function filter_init() { global $conf, $user; // Inject values into the $conf array - will apply to all sites. // This can be a useful place to apply generic development settings. $conf_inject = unserialize(urldecode(runserver_env('RUNSERVER_CONF'))); // Merge in the injected conf, overriding existing items. $conf = array_merge($conf, $conf_inject); // Log in user if needed. if (isset($_GET['login'])) { $uid = runserver_env('RUNSERVER_USER'); if (!empty($uid) && $user->uid !== $uid) { // If a user was provided, log in as this user. $user = user_load($uid); if (function_exists('drupal_session_regenerate')) { // Drupal 7 drupal_session_regenerate(); } else { // Drupal 6 sess_regenerate(); } } // Refresh the page (in case access denied has been called already). drupal_goto($_GET['q']); } }
function applyForTeamForm_submit($form, $form_state) { global $user; $name = $form_state['values']['personName']; $email = $form_state['values']['email']; $teamName = dbGetTeamName($form_state['TID']); $note = $form_state['values']['message']; // fill in the fields of the application $application['UID'] = $user->uid; $application['TID'] = $form_state['TID']; $application['userEmail'] = stripTags($email, ''); // do not allow tags $application['userMessage'] = stripTags($note); // allow some tags // add a notification for the team owner and admins if (dbApplyForTeam($application)) { // note that this does its own error checking $notification['dateCreated'] = dbDatePHP2SQL(time()); $notification['dateTargeted'] = dbDatePHP2SQL(time()); $notification['TID'] = $form_state['TID']; $notification['message'] = "{$name} has applied to join your team {$teamName}."; $notification['bttnTitle'] = 'View'; $notification['bttnLink'] = '?q=viewUsersToBeApproved&TID=' . $form_state['TID']; notifyUsersByRole($notification, 'teamOwner'); notifyUsersByRole($notification, 'teamAdmin'); drupal_set_message('Your application has been sent! You will receive an email when you have been approved for the team.'); drupal_goto('manageUserTeams'); } }
function deleteUserPage_submit($form, $form_state) { global $user; $UID = $user->uid; $teams = dbGetTeamsForUser($UID); // getting teams that are associated with a user foreach ($teams as $team) { // looping through these teams dbKickUserFromTeam($UID, $team['TID']); // removing the user from these teams dbRemoveAllUserRoles($UID, $team['TID']); // ensuring the user doesn't have any role on the team } dbRemoveAllEmailsForUser($UID); dbDisableUser($UID); $params['feedback'] = stripTags($form_state['values']['misc'], ''); // stripping any "illegal" HTML tags $params['userName'] = dbGetUserName($UID); // getting the user name drupal_mail('users', 'userdeleted', '*****@*****.**', variable_get('language_default'), $params, $from = null, $send = true); // sending the user a confirmation mail drupal_set_message("Your account has been deleted. We're sorry to see you go!"); // message displayed and redirected to front page drupal_goto('<front>'); }
function main_preprocess_node(&$variables) { // Redirect non delta project to first delta if ($variables['type'] == "project") { drupal_goto($variables['node_url'] . '/1'); } }
public function postProcess() { $params = $this->_submitValues; $batchDetailsSql = " UPDATE civicrm_batch SET "; $batchDetailsSql .= " title = %1 "; $batchDetailsSql .= " , description = %2 "; $batchDetailsSql .= " , banking_account = %3 "; $batchDetailsSql .= " , banking_date = %4 "; $batchDetailsSql .= " , exclude_from_posting = %5 "; $batchDetailsSql .= " , contribution_type_id = %6 "; $batchDetailsSql .= " , payment_instrument_id = %7 "; $batchDetailsSql .= " WHERE id = %8 "; $bankingDate = CRM_Utils_Date::processDate($params['banking_date']); $sqlParams = array(); $sqlParams[1] = array((string) $params['batch_title'], 'String'); $sqlParams[2] = array((string) $params['description'], 'String'); $sqlParams[3] = array((string) $params['banking_account'], 'String'); $sqlParams[4] = array((string) $bankingDate, 'String'); $sqlParams[5] = array((string) $params['exclude_from_posting'], 'String'); $sqlParams[6] = array((string) $params['contribution_type_id'], 'String'); $sqlParams[7] = array((string) $params['payment_instrument_id'], 'String'); $sqlParams[8] = array((int) $params['id'], 'Integer'); CRM_Core_DAO::executeQuery($batchDetailsSql, $sqlParams); drupal_goto('civicrm/batch/process', array('query' => array('bid' => $params['id'], 'reset' => '1'))); CRM_Utils_System::civiExit(); }
function notificationForm_submit($form, $form_state) { global $user; $params = drupal_get_query_parameters(); $OID = $params['OID']; // generate the notification $notification = getFields(array('dateTargeted', 'message'), $form_state['values']); $notification = stripTags($notification); // allow some tags $notification['dateTargeted'] = dbDatePHP2SQL(strtotime($notification['dateTargeted'])); $notification['bttnTitle'] = 'View Outreach'; $notification['bttnLink'] = '?q=viewOutreach&OID=' . $OID; $notification['OID'] = $OID; $notification['TID'] = dbGetTeamForOutreach($OID); $notification['dateCreated'] = dbDatePHP2SQL(time()); foreach ($form_state['values']['UID'] as $UID) { if ($UID != null) { $notification['UID'] = $UID; $result = dbAddNotification($notification); } } if ($result) { drupal_set_message('Notification added!'); drupal_goto('manageNotifications', array('query' => array('OID' => $OID))); } else { drupal_set_message('There was an error.', 'error'); } }
function bluemod_init() { //theme ( 'bluemod_javascript' ); error_reporting(0); // Redirecciona a la pantalla de ingreso global $user; //Redirecciona a home a los usuarios anónimos. $curr = current_path(); $anon_main = 0; $link_de_registro = substr_count($curr, 'user/reset/'); $link_de_invitacion = substr_count($curr, 'invite/accept/'); //echo $link_de_registro.','.$curr; if ($user->roles[1] == 'anonymous user' && $curr != 'escritorio') { //echo $curr; //Lista de excepciones que un usuario anónimo puede ver if ($curr != 'user/register' && $curr != 'user/password' && $curr != 'user/reset' && $curr != 'elegir-contactos' && $curr != 'node/374' && $curr != 'node/381' && $curr != 'node/228' && $curr != 'contact' && $curr != "system/ajax" && $link_de_registro == 0 && $link_de_invitacion == 0) { //echo $link_de_registro.','.$curr; //solo si no fuera el link de registro que tiene la forma user/reset/* // header("Location: /"); //$mensaje = drupal_get_message(null,false); //drupal_set_message($mensaje); drupal_goto("<front>"); } } if (arg(0) == 'user' && arg(1) == 'password') { drupal_set_title(t('Recupera tu Contraseña')); } if (arg(0) == 'user' && arg(1) == 'register') { drupal_set_title(t('Solicitar Invitación')); } }
/** guifi_node_add(): creates a new node */ function guifi_node_add($id) { $zone = guifi_zone_load($id); // Set the defaults for a node of this zone // Callback to node/guifi-node/add drupal_goto('node/add/guifi-node?edit[title]=' . $zone->id); }
function dexp_layerslider_clone($slideid) { $slide = db_select('{dexp_layerslider}', 'd')->fields('d')->condition('id', $slideid, '=')->execute()->fetchAssoc(); db_insert("{dexp_layerslider}")->fields(array('name' => "Copy of " . $slide['name'], 'settings' => $slide['settings'], 'data' => $slide['data']))->execute(); drupal_set_message("Successfully cloned."); drupal_goto('admin/dexp_layerslider'); }
public function submit($form, &$form_state) { $paths = $form_state['storage']['paths']; $content_type = $form_state['build_info']['args'][0]; publisher_purge_set_content_type_paths($content_type->type, $paths); drupal_set_message(t('Content Type <strong>@content_type</strong> updated successfully.', array('@content_type' => $content_type->name))); drupal_goto('admin/config/publisher/purge'); }
function usersSearch_submit($form, $form_state) { $names = array('nameContains'); $row = getFields($names, $form_state['values']); $row = stripTags($row, ''); drupal_goto('showUsersForTeam', array('query' => array('query' => $row['nameContains']))); return; }
function acquia_prosper_preprocess(&$vars) { if (!function_exists('fusion_core_add_block')) { drupal_set_message(t('Error! <a href="!link">Fusion Core</a> base theme not found. Please install and enable Fusion Core first.', array('!link' => 'http://drupal.org/project/fusion')), 'error', false); variable_set('theme_default', 'garland'); $vars['is_admin'] ? drupal_goto('admin/build/themes') : drupal_goto(''); } }
/** * Implements OpenIDConnectClientInterface::authorize(). */ public function authorize($scope = 'openid email') { $redirect_uri = OPENID_CONNECT_REDIRECT_PATH_BASE . '/' . $this->name; $url_options = array('query' => array('client_id' => $this->getSetting('client_id'), 'response_type' => 'code', 'scope' => $scope, 'redirect_uri' => url($redirect_uri, array('absolute' => TRUE)), 'state' => openid_connect_create_state_token())); $endpoints = $this->getEndpoints(); // Clear $_GET['destination'] because we need to override it. unset($_GET['destination']); drupal_goto($endpoints['authorization'], $url_options); }
/** * @todo */ function set_item_state($state, $js, $input, $item) { ctools_export_set_object_status($item, $state); if (!$js) { drupal_goto(ctools_export_ui_plugin_base_path($this->plugin)); } else { return $this->list_page($js, $input); } }
function approveHours($HID) { dbApproveHours($HID); drupal_set_message('Hours have been approved!'); if (isset($_SERVER['HTTP_REFERER'])) { drupal_goto($_SERVER['HTTP_REFERER']); } else { drupal_goto('viewHours'); } }
public function submit($form, &$form_state) { if (!isset($form_state['build_info']['args'][0]) || !is_object($form_state['build_info']['args'][0]) || get_class($form_state['build_info']['args'][0]) != 'Drupal\\ablecore_menu\\MenuPathRelationship') { drupal_not_found(); } $relationship = $form_state['build_info']['args'][0]; $relationship->delete(); drupal_set_message('Relationship deleted successfully!'); drupal_goto('admin/config/ablecore/menu-relationships'); }
/** * Payment method callback: checkout form submission. */ public function submitFormCharge($payment_method, $pane_form, $pane_values, $order, $charge) { $config = parent::submitFormCharge($payment_method, $pane_form, $pane_values, $order, $charge); $config['postedParam']['paymentToken'] = $pane_values['cko-cc-paymenToken']; if (!empty($pane_values['cko-cc-redirectUrl'])) { drupal_goto($pane_values['cko-cc-redirectUrl'] . '&trackId=' . $order->order_id); } else { return $this->placeorder($config, $charge, $order, $payment_method); } }
function deleteNotification($NID, $OID) { dbDeleteNotification($NID); drupal_set_message('Notification has been deleted.'); if (isset($_SERVER['HTTP_REFERER'])) { drupal_goto($_SERVER['HTTP_REFERER']); } else { drupal_goto('manageNotifications', array('query' => array('OID' => $OID))); } }
/** * Routes checkout/%commerce_order* to an alternate URL if necessary. * * The checkout module uses two URLs for the checkout form, displaying a form * specific to the checkout page indicated by the URL. * * - checkout/%commerce_order: used for the first checkout page * - checkout/%commerce_order/%commerce_checkout_page: used for all subsequent * checkout pages * * The page callback for these URLs checks the user's access to the requested * checkout page for the given order and to make sure the order has line items. * After these two checks, it gives other modules an opportunity to evaluate the * order and checkout page to see if any other redirection is necessary. This * hook should not be used to alter the output at the actual checkout URL. * * @param $order * The order object specified by the checkout URL. * @param $checkout_page * The checkout page array specified by the checkout URL. * * @see commerce_checkout_router() */ function hook_commerce_checkout_router($order, $checkout_page) { global $user; // Redirect anonymous users to a custom login page instructing them to login // prior to checkout. (Note that Drupal Commerce does not require users to // login prior to checkout as an e-commerce best practice.) if (!$user->uid) { drupal_set_message(t('Please login or create an account now to continue checkout.')); drupal_goto('checkout/login/' . $order->order_id); } }
function dexp_layerslider_form_submit($form, $form_state) { if ($form['id']['#value']) { $sid = db_update("dexp_layerslider")->fields(array('name' => $form['name']['#value']))->condition('id', $form['id']['#value'])->execute(); drupal_set_message("Slide '{$form['name']['#value']}' has been updated"); } else { $sid = db_insert("dexp_layerslider")->fields(array('name' => $form['name']['#value'], 'settings' => '', 'data' => ''))->execute(); drupal_set_message("Slide '{$form['name']['#value']}' has been created"); } drupal_goto('admin/dexp_layerslider'); }
function rejectTeam($TID) { dbRejectTeam($TID); $UID = dbGetOwnerForTeam($TID); drupal_mail('adminFunctions', 'teamRejected', dbGetUserPrimaryEmail($UID), variable_get('language_default'), $params = array('teamName' => dbGetTeamName($TID), 'fullName' => dbGetUserName($UID)), $from = NULL, $send = TRUE); drupal_set_message('The team has been rejected and the team owner has been notified!'); if (isset($_SERVER['HTTP_REFERER'])) { drupal_goto($_SERVER['HTTP_REFERER']); } else { drupal_goto('adminPage'); } }
function netsound2_preprocess_page(&$vars, $hook) { global $user; if (arg(0) == 'min_side' && $user->uid == 0) { drupal_goto('user/login', drupal_get_destination()); } if (arg(3) == 'stream' || arg(3) == 'download' || $_GET['clean'] == 1) { $vars['template_files'] = array('page-clean'); $vars['css']['all']['theme']['sites/all/themes/netsound2/css/style.css'] = false; } //krumo($vars); }
function outreachSettingsHeader() { $team = getCurrentTeam(); $TID = $team['TID']; // if the team does not have permission to access team outreach settings if (teamIsIneligible($TID)) { drupal_set_message('Your team does not have permission to access this page.', 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } // create header with team number $markup = "<h1>Team {$team['number']} Outreach Settings</h1>"; return $markup; }
public function submit($form, &$form_state) { $remote = self::hasRemote($form, $form_state); if ($remote === false) { \drupal_set_message('There was an error deleting that remote.', 'error'); \drupal_goto('admin/config/publisher/remotes'); } if ($remote->delete() !== false) { \drupal_set_message(t('Remote <strong>@remote</strong> deleted successfully!', array('@remote' => $remote->label))); } else { \drupal_set_message('There was an error deleting that remote. Please try again later.', 'error'); } \drupal_goto('admin/config/publisher/remotes'); }
/** * Override or insert variables into the html template. */ function shiny_preprocess_html(&$vars) { global $user; if (arg(0) != 'user' && $user->uid == 0) { drupal_goto('user'); } drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 9', '!IE' => FALSE), 'weight' => 999, 'preprocess' => FALSE)); // Add conditional CSS for IE8 and below. drupal_add_css(path_to_theme() . '/css/ie8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'weight' => 999, 'preprocess' => FALSE)); // Add conditional CSS for IE7 and below. drupal_add_css(path_to_theme() . '/css/ie7.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'weight' => 999, 'preprocess' => FALSE)); // Add conditional CSS for IE6. drupal_add_css(path_to_theme() . '/css/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 6', '!IE' => FALSE), 'weight' => 999, 'preprocess' => FALSE)); }
/** * Override or insert variables into the page template. */ function blogbuzz_process_page(&$vars) { if (isset($vars['main_menu'])) { $vars['primary_nav'] = theme('links__system_main_menu', array( 'links' => $vars['main_menu'], 'attributes' => array( 'class' => array('links', 'inline', 'main-menu'), ), 'heading' => array( 'text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'), ) )); } else { $vars['primary_nav'] = FALSE; } if (isset($vars['secondary_menu'])) { $vars['secondary_nav'] = theme('links__system_secondary_menu', array( 'links' => $vars['secondary_menu'], 'attributes' => array( 'class' => array('links', 'inline', 'secondary-menu'), ), 'heading' => array( 'text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'), ) )); } else { $vars['secondary_nav'] = FALSE; } if($vars['node']->type == 'song') { global $user; if(in_array('worship team', $user->roles) || in_array('worship 3', $user->roles)) { // leave alone as access is allowed } else { // send to login page drupal_goto('user/login'); } } }
function viewUserEventsForTeam() { global $user; $params = drupal_get_query_parameters(); // if user does not have a team if (dbGetTeamsForUser($user->uid) == NULL) { drupal_set_message("You don't have a team assigned.", 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } if (isset($params['UID'])) { $UID = $params['UID']; } else { $UID = $user->uid; } if (isset($params['TID'])) { $TID = $params['TID']; } else { $currentTeam = getCurrentTeam(); $TID = $currentTeam['TID']; } $outreaches = dbGetOutreachesForUserForTeam($UID, $TID); $teamName = dbGetTeamName($TID); // create page header and table $markup = "<table><h1>My Outreaches For {$teamName}</h1></table>"; $markup .= '<table class="infoTable">'; $markup .= '<tr>'; $markup .= '<th colspan="3">Outreach Name</th>'; $markup .= '<th colspan="3">Description</th>'; $markup .= '<th colspan="2">Hours</th>'; $markup .= "</tr>"; // if user has outreaches for the current team if (!empty($outreaches)) { foreach ($outreaches as $outreach) { $markup .= "<tr>"; $markup .= '<td colspan="3">' . '<a href="?q=viewOutreach&OID=' . $outreach['OID'] . '">' . chopString($outreach["name"], 30) . '</a>' . "</td>"; $markup .= '<td colspan="3">' . chopString($outreach["description"], 30) . "</td>"; $markup .= '<td colspan="2">' . dbGetHoursForUserFromOutreach($UID, $outreach['OID']) . "</tr>"; $markup .= "</tr>"; } $markup .= "</table>"; } else { // if the user does not have any outreaches for the current team $markup .= '<tr><td style="text-align:center" colspan="10"><em>[None]</em></td>'; $markup .= "</tr>"; } $markup .= "</table>"; $retArray = array(); $retArray['#markup'] = $markup; return $retArray; }
/** * Menu callback; delete a single ipv4 network. */ function guifi_ipv4_delete($id) { $result = db_query('SELECT * FROM {guifi_networks} WHERE id = %d', $id); $edit = db_fetch_array($result); if ($_POST['confirm']) { $msg = t('The network %base/%mask (%type) has been DELETED by %user.', array('%base' => $edit['base'], '%mask' => $edit['mask'], '%type' => $edit['network_type'], '%user' => $user->name)); $edit['deleted'] = TRUE; $nnetwork = _guifi_db_sql('guifi_networks', array('id' => $edit['id']), (array) $edit, $log, $to_mail); guifi_notify($to_mail, $msg, $log); drupal_goto('node/' . $edit['zone'] . '/view/ipv4'); } return drupal_get_form('guifi_ipv4_confirm_delete', $edit['base'], $edit['mask'], $edit['zone']); }
public static function deliverRedirect($result) { if (is_int($result)) { drupal_deliver_html_page($result); return; } if (module_exists('redirect')) { // Using the redirect module instead of drupal_goto() may allow this // redirect to be stored in the page cache. $redirect = new stdClass(); $redirect->redirect = $result; redirect_redirect($redirect); } else { drupal_goto($result, array(), 301); } }
/** * Return the generated form output. * @param array $args List of parameter values passed through to the form depending on how the form has been configured. * This array always contains a value for language. * @param object $node The Drupal node object. * @param array $response When this form is reloading after saving a submission, contains the response from the service call. * Note this does not apply when redirecting (in this case the details of the saved object are in the $_GET data). * @return Form HTML. */ public static function get_form($args, $node, $response = null) { if (!($user_id = hostsite_get_user_field('indicia_user_id'))) { return self::abort('Please ensure that you\'ve filled in your surname on your user profile before leaving a group.', $args); } if (empty($_GET['group_id'])) { return self::abort('This form must be called with a group_id in the URL parameters.', $args); } $r = ''; $auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']); $group = data_entry_helper::get_population_data(array('table' => 'group', 'extraParams' => $auth['read'] + array('id' => $_GET['group_id']), 'nocache' => true)); if (count($group) !== 1) { return self::abort('The group you\'ve requested membership of does not exist.', $args); } iform_load_helpers(array('submission_builder')); $group = $group[0]; // Check for an existing group user record $existing = data_entry_helper::get_population_data(array('table' => 'groups_user', 'extraParams' => $auth['read'] + array('group_id' => $_GET['group_id'], 'user_id' => $user_id), 'nocache' => true)); if (count($existing) !== 1) { return self::abort('You are not a member of this group.', $args); } if (!empty($_POST['response']) && $_POST['response'] === lang::get('Cancel')) { drupal_goto($args['groups_page_path']); } elseif (!empty($_POST['response']) && $_POST['response'] === lang::get('Confirm')) { $data = array('groups_user:id' => $existing[0]['id'], 'groups_user:group_id' => $group['id'], 'groups_user:user_id' => $user_id, 'deleted' => 't'); $wrap = submission_builder::wrap($data, 'groups_user'); $response = data_entry_helper::forward_post_to('groups_user', $wrap, $auth['write_tokens']); if (isset($response['success'])) { hostsite_show_message("You are no longer participating in {$group['title']}!"); drupal_goto($args['groups_page_path']); } else { return self::abort('An error occurred whilst trying to update your group membership.'); } } else { // First access of the form. Let's get confirmation $reload = data_entry_helper::get_reload_link_parts(); $reloadpath = $reload['path'] . '?' . data_entry_helper::array_to_query_string($reload['params']); $r = '<form action="' . $reloadpath . '" method="POST"><fieldset>'; $r .= '<legend>' . lang::get('Confirmation') . '</legend>'; $r .= '<input type="hidden" name="leave" value="1" />'; $r .= '<p>' . lang::get('Are you sure you want to stop participating in {1}?', $group['title']) . '</p>'; $r .= '<input type="submit" value="' . lang::get('Confirm') . '" name="response" />'; $r .= '<input type="submit" value="' . lang::get('Cancel') . '" name="response" />'; $r .= '</fieldset></form>'; } return $r; }