当前位置: 首页>>代码示例>>PHP>>正文


PHP local_redirect函数代码示例

本文整理汇总了PHP中local_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP local_redirect函数的具体用法?PHP local_redirect怎么用?PHP local_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了local_redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 function process()
 {
     $edit =& $_POST['edit'];
     $this->template_name = 'pages/league/edit.tpl';
     $this->smarty->assign('status', getOptionsFromEnum('league', 'status'));
     $this->smarty->assign('seasons', getOptionsFromQuery("SELECT id AS theKey, display_name AS theValue FROM season ORDER BY year, id"));
     $this->smarty->assign('days', getOptionsFromEnum('league', 'day'));
     $this->smarty->assign('ratios', getOptionsFromEnum('league', 'ratio'));
     $this->smarty->assign('schedule_types', getOptionsFromEnum('league', 'schedule_type'));
     $this->smarty->assign('display_sotg', getOptionsFromEnum('league', 'display_sotg'));
     $this->smarty->assign('excludeTeams', getOptionsFromEnum('league', 'excludeTeams'));
     /* TODO: 10 is a magic number.  Make it a config variable */
     $this->smarty->assign('tiers', getOptionsFromRange(0, 10));
     /* TODO: 5 is a magic number.  Make it a config variable */
     $this->smarty->assign('rounds', getOptionsFromRange(0, 5));
     $this->smarty->assign('games_before_repeat', getOptionsFromRange(0, 9));
     if ($edit['step'] == 'perform') {
         $errors = $this->check_input_errors($edit);
         if (count($errors) > 0) {
             $this->smarty->assign('edit', $edit);
             $this->smarty->assign('formErrors', $errors);
             return true;
         }
         $this->perform($edit);
         local_redirect(url("league/view/" . $this->league->league_id));
     } else {
         /* Deal with multiple days and start times */
         if (strpos($league->day, ",")) {
             $league->day = explode(',', $league->day);
         }
         $this->smarty->assign('edit', (array) $this->league);
     }
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:34,代码来源:edit.php

示例2: process

 function process()
 {
     $edit = $_POST['edit'];
     $this->template_name = 'pages/event/edit.tpl';
     $this->smarty->assign('event_types', $this->event_types);
     $this->smarty->assign('currency_codes', getCurrencyCodes());
     $this->smarty->assign('time_choices', getOptionsFromTimeRange(00, 2400, 30));
     $this->smarty->assign('yes_no', array('No', 'Yes'));
     $this->smarty->assign('seasons', getOptionsFromQuery("SELECT id AS theKey, display_name AS theValue FROM season ORDER BY year, id"));
     if ($edit['step'] == 'perform') {
         $errors = $this->check_input_errors($edit);
         if (count($errors) > 0) {
             $this->smarty->assign('edit', $edit);
             $this->smarty->assign('formErrors', $errors);
             return true;
         }
         $this->perform($edit);
         local_redirect(url("event/view/" . $this->event->registration_id));
     } else {
         # Smarty form auto-fill can't handle booleans directly,
         # so we substitute:
         $this->event->multiple = $this->event->multiple ? 1 : 0;
         $this->event->anonymous = $this->event->anonymous ? 1 : 0;
         $this->smarty->assign('edit', (array) $this->event);
     }
     return true;
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:27,代码来源:edit.php

示例3: process

 function process()
 {
     global $lr_session;
     $lr_session->expire();
     local_redirect(url("login"));
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:7,代码来源:logout.php

示例4: process

 function process()
 {
     global $lr_session;
     // Using these multiple times, so saving them
     $is_admin = $lr_session->is_admin();
     $is_captain = $lr_session->is_captain_of($this->team->team_id);
     $this->title = "{$this->team->name} » Roster Status";
     if ($this->team->roster_deadline > 0 && !$lr_session->is_admin() && time() > $this->team->roster_deadline) {
         info_exit('The roster deadline has passed.');
     }
     if (!$this->player) {
         $this->title = "{$this->team->name} » Add Player";
         if (!($is_admin || $is_captain)) {
             error_exit("You cannot add a person to that team!");
         }
         $new_handler = new person_search();
         $new_handler->smarty =& $this->smarty;
         $new_handler->initialize();
         $new_handler->ops['Add to ' . $this->team->name] = 'team/roster/' . $this->team->team_id;
         $new_handler->process();
         $this->template_name = $new_handler->template_name;
         return true;
     }
     if (!$this->player->is_player()) {
         error_exit('Only registered players can be added to a team.');
     }
     $events = $this->player->is_eligible_for($this->team->team_id);
     if ($events !== true) {
         // Captains and admins can modify players even if they haven't registered for events.
         // That way, the onus is on the player to register, saving captains the hassle.
         // So, only disable the roster change for players
         if (!($is_admin || $is_captain)) {
             $this->smarty->assign('prerequisites', $events);
             $this->smarty->assign('disabled', 'disabled="disabled"');
         }
     }
     $this->positions = Team::get_roster_positions();
     $this->currentStatus = $this->team->get_roster_status($this->player->user_id);
     $this->permittedStates = $this->permitted_roster_states();
     $edit =& $_POST['edit'];
     if ($this->player->status != 'active' && $edit['status'] && $edit['status'] != 'none') {
         error_exit("Inactive players may only be removed from a team.  Please contact this player directly to have them activate their account.");
     }
     if ($edit['step'] != 'perform') {
         $this->smarty->assign('current_status', $this->positions[$this->currentStatus]);
         $this->smarty->assign('player', $this->player);
         $this->smarty->assign('team', $this->team);
         $this->smarty->assign('states', $this->permittedStates);
         return true;
     }
     if (!array_key_exists($edit['status'], $this->permittedStates)) {
         error_exit("You do not have permission to set that status.");
     }
     if (!$this->team->set_roster_status($this->player->user_id, $edit['status'], $this->currentStatus)) {
         error_exit("Could not set roster status for {$this->player->fullname}");
     }
     local_redirect(url("team/view/" . $this->team->team_id));
     return true;
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:59,代码来源:roster.php

示例5: perform

 function perform(&$edit)
 {
     list($rc, $message) = $this->league->reschedule_games_for_day($edit['olddate'], $edit['newdate']);
     if ($rc) {
         local_redirect(url("schedule/view/" . $this->league->league_id));
     } else {
         error_exit("Failure rescheduling games: {$message}");
     }
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:9,代码来源:reschedule.php

示例6: process

 function process()
 {
     global $lr_session;
     # Nuke HTML just in case
     $team_name = check_form($this->team->name, ENT_NOQUOTES);
     $this->title = "{$team_name} » Move";
     $edit = $_POST['edit'];
     if ($edit['step']) {
         if ($edit['target'] < 1) {
             error_exit("That is not a valid league to move to");
         }
         if (!$lr_session->has_permission('league', 'manage teams', $edit['target'])) {
             error_exit("Sorry, you cannot move teams to leagues you do not coordinate");
         }
         $targetleague = League::load(array('league_id' => $edit['target']));
         if (!$targetleague) {
             error_exit("You must supply a valid league to move to");
         }
         if ($targetleague->league_id == $this->team->league_id) {
             error_exit("You can't move a team to the league it's currently in!");
         }
     }
     if ($edit['swaptarget']) {
         $target_team = Team::load(array('team_id' => $edit['swaptarget']));
         if (!$target_team) {
             error_exit("You must supply a valid target team ID");
         }
         if ($target_team->league_id == $this->team->league_id) {
             error_exit("You can't swap with a team that's already in the same league!");
         }
         if ($target_team->league_id != $targetleague->league_id) {
             error_exit("You can't swap with a team that's not in the league you want to move to!");
         }
         if (!$lr_session->has_permission('league', 'manage teams', $target_team->league_id)) {
             error_exit("Sorry, you cannot move teams to leagues you do not coordinate");
         }
     }
     switch ($edit['step']) {
         case 'perform':
             $sourceleague = League::load(array('league_id' => $this->team->league_id));
             $this->perform($targetleague, $target_team);
             local_redirect(url("league/view/" . $sourceleague->league_id));
         case 'confirm':
             return $this->confirm($targetleague, $target_team);
         case 'swaptarget':
             return $this->choose_swaptarget($targetleague);
         default:
             return $this->choose_league();
     }
     error_exit("Error: This code should never be reached.");
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:51,代码来源:move.php

示例7: process

 function process()
 {
     global $dbh, $lr_session;
     $this->title = $this->team->name . " &raquo; Rank Fields";
     if ($lr_session->has_permission('team', 'viewfieldprefs', $this->team->team_id) && !$lr_session->has_permission('team', 'edit', $this->team->team_id)) {
         # Non-captain team members can view the preferences
         return $this->process_readonly();
     }
     $this->template_name = 'pages/team/fieldpreference.tpl';
     $fields = array();
     $selected = array();
     // Load any currently-selected selected fields
     $sth = $dbh->prepare("SELECT r.site_id, f.name, f.region FROM team_site_ranking r LEFT JOIN field f ON (f.fid = r.site_id) WHERE team_id = ? ORDER BY rank ASC");
     $sth->execute(array($this->team->team_id));
     $chosen = array();
     while ($item = $sth->fetch(PDO::FETCH_OBJ)) {
         $chosen[$item->site_id] = "{$item->name} ({$item->region})";
         array_push($selected, $item->site_id);
     }
     if (count($chosen) > 0) {
         $fields['Previously Chosen'] = $chosen;
     } else {
         $fields['Previously Chosen'] = array();
     }
     // Ugh, now figure out what fields to display
     $sth = $dbh->prepare("SELECT f.fid, f.region, f.name\n\t\t\tFROM field f\n\t\t\tWHERE f.fid IN ( SELECT\n\t\t\t\tDISTINCT COALESCE(f.parent_fid, f.fid)\n\t\t\t\tFROM leagueteams lt,\n\t\t\t\t\tleague_gameslot_availability a,\n\t\t\t\t\tgameslot g,\n\t\t\t\t\tfield f\n\t\t\t\tWHERE\n\t\t\t\t\tf.fid = g.fid\n\t\t\t\t\tAND g.slot_id = a.slot_id\n\t\t\t\t\tAND a.league_id = lt.league_id\n\t\t\t\t\tAND lt.team_id = ?)\n\t\t\tORDER BY f.region, f.name");
     $sth->execute(array($this->team->team_id));
     while ($field = $sth->fetch(PDO::FETCH_OBJ)) {
         if (array_key_exists($field->fid, $fields['Previously Chosen'])) {
             continue;
         }
         if (!array_key_exists($field->region, $fields)) {
             $fields[$field->region] = array();
         }
         $fields[$field->region][$field->fid] = "{$field->name} ({$field->region})";
     }
     $this->smarty->assign('fields', $fields);
     $this->smarty->assign('selected', $selected);
     $this->smarty->assign('team', $this->team);
     $edit = $_POST['edit'];
     if ($edit['step'] == 'perform' && $lr_session->has_permission('team', 'edit', $this->team->team_id)) {
         $errors = $this->check_input_errors($edit);
         if (count($errors) > 0) {
             $this->smarty->assign('formErrors', $errors);
             return true;
         }
         $this->perform($edit);
         local_redirect(url("team/fieldpreference/" . $this->team->team_id));
     }
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:51,代码来源:fieldpreference.php

示例8: process

 function process()
 {
     $this->title = "{$this->league->fullname} &raquo; Ratings Adjustment";
     $this->template_name = 'pages/league/ratings.tpl';
     $edit =& $_POST['edit'];
     // make sure the teams are loaded
     $this->league->load_teams();
     if ($edit['step'] == 'perform') {
         $this->perform($edit);
         local_redirect(url("league/view/" . $this->league->league_id));
     }
     // TODO: replace with a load_teams_ordered() or maybe a flag to load_teams() ?
     list($order, $season, $round) = $this->league->calculate_standings(array('round' => $this->league->current_round));
     $this->smarty->assign('teams', $season);
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:16,代码来源:ratings.php

示例9: process

 function process()
 {
     global $lr_session;
     $this->title = 'Registration ' . $this->registration->formatted_order_id() . ' &raquo; Add Payment';
     $this->smarty->assign('reg', $this->registration);
     $this->smarty->assign('event', $this->event);
     // TODO: should be get_user() for consistency.
     $this->smarty->assign('registrant', $this->registration->user());
     $edit = $_POST['edit'];
     $payment = new RegistrationPayment();
     $payment->set('order_id', $this->registration->order_id);
     $payment->set('entered_by', $lr_session->user->user_id);
     $fields = array('payment_type', 'payment_amount', 'payment_method', 'paid_by', 'date_paid');
     foreach ($fields as $field) {
         $payment->set($field, $edit[$field]);
     }
     $dataInvalid = $payment->validate();
     if ($dataInvalid) {
         info_exit($dataInvalid . '<br>Please use your back button to return to the form, fix these errors, and try again.');
     }
     switch ($edit['step']) {
         default:
         case 'confirm':
             $this->smarty->assign('payment', $payment);
             $this->template_name = 'pages/registration/addpayment.tpl';
             break;
         case 'submit':
             if (!$payment->save()) {
                 error_exit("Internal error: couldn't save payment");
             }
             switch ($payment->payment_type) {
                 case 'Deposit':
                     $this->registration->set('payment', 'Deposit Paid');
                     break;
                 case 'Full':
                 case 'Remaining Balance':
                     $this->registration->set('payment', 'Paid');
                     break;
             }
             if (!$this->registration->save()) {
                 error_exit("Internal error: couldn't save changes to registration");
             }
             local_redirect(url("registration/view/" . $this->registration->order_id));
             break;
     }
     return true;
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:47,代码来源:addpayment.php

示例10: process

 function process()
 {
     $this->title = "Game {$this->game->game_id} &raquo; Remove Results";
     $this->template_name = 'pages/game/removeresults.tpl';
     switch ($_POST['step']) {
         case 'perform':
             if (!$this->game->removeresults()) {
                 error_exit("Could not successfully remove results for the game");
             }
             local_redirect(url("schedule/view/" . $this->league->league_id));
             break;
         default:
             $this->smarty->assign('game', $this->game);
             return true;
     }
     return $rc;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:17,代码来源:removeresults.php

示例11: process

 function process()
 {
     global $lr_session;
     $this->title = "{$this->team->name} &raquo; Roster Status";
     if ($this->team->roster_deadline > 0 && !$lr_session->is_admin() && time() > $this->team->roster_deadline) {
         error_exit('The roster deadline has passed.');
     }
     if (!$this->player) {
         $this->title = "{$this->team->name} &raquo; Add Player";
         if (!($lr_session->is_admin() || $lr_session->is_captain_of($this->team->team_id))) {
             error_exit("You cannot add a person to that team!");
         }
         $new_handler = new person_search();
         $new_handler->smarty =& $this->smarty;
         $new_handler->initialize();
         $new_handler->ops['Add to ' . $this->team->name] = 'team/roster/' . $this->team->team_id;
         $new_handler->process();
         $this->template_name = $new_handler->template_name;
         return true;
     }
     if (!$this->player->is_player()) {
         error_exit('Only registered players can be added to a team.');
     }
     $this->positions = Team::get_roster_positions();
     $this->currentStatus = $this->team->get_roster_status($this->player->user_id);
     $this->permittedStates = $this->permitted_roster_states();
     $edit =& $_POST['edit'];
     if ($this->player->status != 'active' && $edit['status'] && $edit['status'] != 'none') {
         error_exit("Inactive players may only be removed from a team.  Please contact this player directly to have them activate their account.");
     }
     if ($edit['step'] != 'perform') {
         $this->smarty->assign('current_status', $this->positions[$this->currentStatus]);
         $this->smarty->assign('player', $this->player);
         $this->smarty->assign('team', $this->team);
         $this->smarty->assign('states', $this->permittedStates);
         return true;
     }
     if (!array_key_exists($edit['status'], $this->permittedStates)) {
         error_exit("You do not have permission to set that status.");
     }
     if (!$this->team->set_roster_status($this->player->user_id, $edit['status'], $this->currentStatus)) {
         error_exit("Could not set roster status for {$this->player->fullname}");
     }
     local_redirect(url("team/view/" . $this->team->team_id));
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:46,代码来源:roster.php

示例12: process

 function process()
 {
     $edit = $_POST['edit'];
     $this->title = "Create Field";
     switch ($edit['step']) {
         case 'confirm':
             $rc = $this->generateConfirm($edit);
             break;
         case 'perform':
             $this->field = new Field();
             $this->perform($this->field, $edit);
             local_redirect(url("field/view/" . $this->field->fid));
             break;
         default:
             $edit = array();
             $rc = $this->generateForm($edit);
     }
     return $rc;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:19,代码来源:create.php

示例13: handle_valid

 function handle_valid($remember_me = 0, $next = null)
 {
     global $lr_session;
     $status = $lr_session->attr_get('status');
     // New users may be treated as active, if the right setting is on
     if ($lr_session->user->is_active()) {
         $status = 'active';
     }
     switch ($status) {
         case 'new':
             return $this->login_form("Login Denied.  Account creation is awaiting approval.");
         case 'locked':
             return $this->login_form("Login Denied.  Account has been locked by administrator.");
         case 'inactive':
             /* Inactive.  Send this person to the revalidation page(s) */
             local_redirect(url("person/activate"));
             break;
         case 'active':
             /* These accounts are active and can continue */
             /*
              * If the user wants to be remembered, set the proper cookie
              * such that the session won't expire.
              */
             $path = ini_get('session.cookie_path');
             if (!$path) {
                 $path = '/';
             }
             $domain = ini_get('session.cookie_domain');
             if ($remember_me) {
                 setcookie(session_name(), session_id(), time() + 3600 * 24 * 365, $path, $domain);
             } else {
                 setcookie(session_name(), session_id(), FALSE, $path, $domain);
             }
             if ($next) {
                 local_redirect(queryUnpickle($next));
             } else {
                 local_redirect(url("home"));
             }
             break;
     }
     return true;
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:42,代码来源:login.php

示例14: process

 function process()
 {
     global $lr_session;
     $edit = $_POST['edit'];
     switch ($edit['step']) {
         case 'perform':
             if ($edit['password_one'] != $edit['password_two']) {
                 error_exit("You must enter the same password twice.");
             }
             $this->person->set_password($edit['password_one']);
             if (!$this->person->save()) {
                 error_exit("Couldn't change password due to internal error");
             }
             local_redirect(url("person/view/" . $this->person->user_id));
             break;
         default:
             $rc = $this->generateForm();
     }
     return $rc;
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:20,代码来源:changepassword.php

示例15: process

 function process()
 {
     $this->template_name = 'pages/registration/delpayment.tpl';
     $this->smarty->assign('reg', $this->registration);
     $this->smarty->assign('event', $this->event);
     // TODO: should be get_user() for consistency.
     $this->smarty->assign('registrant', $this->registration->user());
     $this->smarty->assign('payment', $this->payment);
     $this->title = 'Registration ' . $this->registration->formatted_order_id() . ' &raquo; Delete Payment';
     if ($_POST['submit'] == 'Delete Payment') {
         if (!$this->payment->delete()) {
             error_exit("Could not delete payment");
         }
         $this->registration->set('payment', 'Pending');
         if (!$this->registration->save()) {
             error_exit("Could not save changes to registration");
         }
         local_redirect(url("registration/view/" . $this->registration->order_id));
     }
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:21,代码来源:delpayment.php


注:本文中的local_redirect函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。