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


PHP error_exit函数代码示例

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


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

示例1: perform

 function perform(&$edit)
 {
     $this->field->set('num', $edit['num']);
     $this->field->set('status', $edit['status']);
     $this->field->set('rating', $edit['rating']);
     if (isset($edit['parent_fid'])) {
         $this->field->set('parent_fid', $edit['parent_fid']);
     }
     if ($edit['parent_fid'] == 0) {
         $this->field->set('parent_fid', '');
         $this->field->set('name', $edit['name']);
         $this->field->set('code', $edit['code']);
         $this->field->set('location_street', $edit['location_street']);
         $this->field->set('location_city', $edit['location_city']);
         $this->field->set('location_province', $edit['location_province']);
         $this->field->set('location_country', $edit['location_country']);
         $this->field->set('location_postalcode', $edit['location_postalcode']);
         $this->field->set('is_indoor', $edit['is_indoor']);
         $this->field->set('region', $edit['region']);
         $this->field->set('location_url', $edit['location_url']);
         $this->field->set('layout_url', $edit['layout_url']);
         $this->field->set('driving_directions', $edit['driving_directions']);
         $this->field->set('transit_directions', $edit['transit_directions']);
         $this->field->set('biking_directions', $edit['biking_directions']);
         $this->field->set('parking_details', $edit['parking_details']);
         $this->field->set('washrooms', $edit['washrooms']);
         $this->field->set('public_instructions', $edit['public_instructions']);
         $this->field->set('site_instructions', $edit['site_instructions']);
         $this->field->set('sponsor', $edit['sponsor']);
     }
     if (!$this->field->save()) {
         error_exit("Internal error: couldn't save changes");
     }
     return true;
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:35,代码来源:edit.php

示例2: process

 function process()
 {
     $this->template_name = 'pages/slot/day.tpl';
     list($year, $month, $day) = preg_split("/[\\/-]/", $_GET['date']);
     $today = getdate();
     $yyyy = is_numeric($year) ? $year : $today['year'];
     $mm = is_numeric($month) ? $month : $today['mon'];
     $dd = is_numeric($day) ? $day : $today['mday'];
     if (!validate_date_input($yyyy, $mm, $dd)) {
         error_exit('That date is not valid');
     }
     $this->smarty->assign('date', sprintf("%4d/%02d/%02d", $yyyy, $mm, $dd));
     $formattedDay = strftime('%A %B %d %Y', mktime(6, 0, 0, $mm, $dd, $yyyy));
     $this->title = "Field Availability Report » {$formattedDay}";
     $sth = GameSlot::query(array('game_date' => sprintf('%d-%d-%d', $year, $month, $day), '_order' => 'g.game_start, field_code, field_num'));
     $num_open = 0;
     $slots = array();
     while ($g = $sth->fetch()) {
         // load game info, if game scheduled
         if ($g['game_id']) {
             $g['game'] = Game::load(array('game_id' => $g['game_id']));
         } else {
             $num_open++;
         }
         $slots[] = $g;
     }
     $this->smarty->assign('slots', $slots);
     $this->smarty->assign('num_fields', count($slots));
     $this->smarty->assign('num_open', $num_open);
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:31,代码来源:day.php

示例3: save

 function save()
 {
     global $dbh;
     if (!count($this->_modified_fields)) {
         // No modifications, no need to save
         return true;
     }
     if (!$this->_in_database) {
         if (!$this->create()) {
             error_exit("Couldn't create registration");
         }
     }
     $fields = array();
     $fields_data = array();
     foreach ($this->_modified_fields as $key => $value) {
         $fields[] = "{$key} = ?";
         if (empty($this->{$key})) {
             $fields_data[] = null;
         } else {
             $fields_data[] = $this->{$key};
         }
     }
     if (count($fields_data) != count($fields)) {
         error_exit("Internal error: Incorrect number of fields set");
     }
     $sth = $dbh->prepare('UPDATE registrations SET ' . join(", ", $fields) . ' WHERE order_id = ?');
     $fields_data[] = $this->order_id;
     $sth->execute($fields_data);
     if (1 < $sth->rowCount()) {
         # Affecting zero rows is possible but usually unwanted
         error_exit("Internal error: Strange number of rows affected");
     }
     unset($this->_modified_fields);
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:35,代码来源:registration.php

示例4: perform

 function perform($edit = array())
 {
     $fields = array();
     if (validate_nonblank($edit['username'])) {
         $fields['username'] = $edit['username'];
     }
     if (validate_nonblank($edit['email'])) {
         $fields['email'] = $edit['email'];
     }
     if (count($fields) < 1) {
         error_exit("You must supply at least one of username or email address");
     }
     /* Now, try and find the user */
     $user = Person::load($fields);
     /* Now, we either have one or zero users.  Regardless, we'll present
      * the user with the same output; that prevents them from using this
      * to guess valid usernames.
      */
     if ($user) {
         /* Generate a password */
         $pass = generate_password();
         $user->set_password($pass);
         if (!$user->save()) {
             error_exit("Error setting password");
         }
         /* And fire off an email */
         $rc = send_mail($user, false, false, _person_mail_text('password_reset_subject', array('%site' => variable_get('app_name', 'Leaguerunner'))), _person_mail_text('password_reset_body', array('%fullname' => "{$user->firstname} {$user->lastname}", '%username' => $user->username, '%password' => $pass, '%site' => variable_get('app_name', 'Leaguerunner'))));
         if ($rc == false) {
             error_exit("System was unable to send email to that user.  Please contact system administrator.");
         }
     }
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:32,代码来源:forgotpassword.php

示例5: process

 function process()
 {
     global $lr_session;
     $payments = array();
     $paypal = new PaypalHandler();
     $talkback_results = $paypal->talkback('pdt');
     if (!$talkback_results || $talkback_results['status'] == false) {
         return false;
     }
     // confirm that data from PayPal matches registrations
     $item_numbers = preg_grep_keys('/item_number[0-9]*/', $talkback_results['message']);
     foreach ($item_numbers as $key => $value) {
         // get current Item # from PayPal, which is the last character in $key
         $item = substr($key, -1);
         $status = $paypal->validatePayment($value, $talkback_results['message']['mc_gross_' . $item], $lr_session->user->user_id);
         if ($status['status'] == false) {
             error_exit($status['message']);
         } else {
             // PaymentRegistration object passed back in message on success
             array_push($payments, $status['message']);
         }
     }
     // output confirmation view
     $this->smarty->assign('payments', $payments);
     $this->smarty->assign('order_id_format', variable_get('order_id_format', '%d'));
     $this->title = 'Registration ' . $this->registration->formatted_order_id() . '- Payment Received';
     $this->template_name = 'pages/registration/paypal.tpl';
     return true;
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:29,代码来源:paypal.php

示例6: save

 function save()
 {
     global $dbh;
     if (!count($this->_modified_fields)) {
         // No modifications, no need to save
         return true;
     }
     if (!$this->_in_database) {
         if (!$this->create()) {
             error_exit("Failed to create note");
         }
     }
     $fields = array();
     $fields_data = array();
     foreach ($this->_modified_fields as $key => $value) {
         $fields[] = "{$key} = ?";
         $fields_data[] = $this->{$key};
     }
     if (count($fields_data) != count($fields)) {
         error_exit("Internal error: Incorrect number of fields set");
     }
     $sth = $dbh->prepare('UPDATE note SET ' . join(", ", $fields) . ', edited = NOW() WHERE id = ?');
     $fields_data[] = $this->id;
     $sth->execute($fields_data);
     if (1 != $sth->rowCount()) {
         # Affecting zero rows is possible but usually unwanted
         error_exit("Internal error: Strange number of rows affected");
     }
     unset($this->_modified_fields);
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:31,代码来源:note.php

示例7: process

 function process()
 {
     global $lr_session, $dbh;
     $this->template_name = 'pages/team/list.tpl';
     $ops = array('view' => 'team/view');
     if ($lr_session->has_permission('team', 'delete')) {
         $ops['delete'] = 'team/delete';
     }
     $this->title = 'List Teams';
     $sth = $dbh->prepare("SELECT DISTINCT UPPER(SUBSTRING(t.name,1,1)) as letter\n\t\t\tFROM team t\n\t\t\tLEFT JOIN leagueteams lt ON t.team_id = lt.team_id\n\t\t\tORDER BY letter asc");
     $sth->execute();
     $letters = $sth->fetchAll(PDO::FETCH_COLUMN);
     $this->smarty->assign('current_letter', $this->letter);
     $this->smarty->assign('letters', $letters);
     $query = "SELECT t.name, t.team_id FROM team t WHERE t.name LIKE ? ORDER BY t.name";
     $sth = $dbh->prepare($query);
     $sth->execute(array("{$this->letter}%"));
     $sth->setFetchMode(PDO::FETCH_CLASS, 'Person', array(LOAD_OBJECT_ONLY));
     $teams = array();
     $hits = 0;
     while ($team = $sth->fetch()) {
         if (++$hits > 1000) {
             error_exit("Too many search results; query terminated");
         }
         $teams[] = $team;
     }
     $this->smarty->assign('teams', $teams);
     $this->smarty->assign('ops', $ops);
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:30,代码来源:list.php

示例8: process

 function process()
 {
     global $dbh;
     $data = array('Order ID');
     foreach ($this->formbuilder->_questions as $question) {
         $data[] = $question->qkey;
     }
     if (empty($data)) {
         error_exit('No survey details available for download.');
     }
     header('Content-type: text/x-csv');
     header("Content-Disposition: attachment; filename=\"{$this->event->name}_survey.csv\"");
     $out = fopen('php://output', 'w');
     fputcsv($out, $data);
     $sth = $dbh->prepare('SELECT order_id FROM registrations r WHERE r.registration_id = ?  ORDER BY order_id');
     $sth->execute(array($this->event->registration_id));
     while ($row = $sth->fetch()) {
         $data = array(sprintf(variable_get('order_id_format', '%d'), $row['order_id']));
         // Add all of the answers
         $fsth = $dbh->prepare('SELECT akey FROM registration_answers WHERE order_id = ?  AND qkey = ?');
         foreach ($this->formbuilder->_questions as $question) {
             $fsth->execute(array($row['order_id'], $question->qkey));
             $foo = $fsth->fetchColumn();
             $data[] = preg_replace('/\\s\\s+/', ' ', $foo);
         }
         fputcsv($out, $data);
     }
     fclose($out);
     exit;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:30,代码来源:downloadsurvey.php

示例9: __construct

 function __construct($id)
 {
     $this->slot = GameSlot::load(array('slot_id' => $id));
     if (!$this->slot) {
         error_exit("That gameslot does not exist");
     }
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:7,代码来源:SlotHandler.php

示例10: perform

 function perform($edit)
 {
     $this->league->set('name', $edit['name']);
     $this->league->set('status', $edit['status']);
     if (is_array($edit['day'])) {
         $edit['day'] = join(",", $edit['day']);
     }
     $this->league->set('day', $edit['day']);
     $this->league->set('season', $edit['season']);
     $this->league->set('roster_deadline', $edit['roster_deadline']);
     $this->league->set('min_roster_size', $edit['min_roster_size']);
     $this->league->set('tier', $edit['tier']);
     $this->league->set('ratio', $edit['ratio']);
     $this->league->set('current_round', $edit['current_round']);
     $this->league->set('schedule_type', $edit['schedule_type']);
     if ($edit['schedule_type'] == 'ratings_ladder' || $edit['schedule_type'] == 'ratings_wager_ladder') {
         $this->league->set('games_before_repeat', $edit['games_before_repeat']);
     }
     $this->league->set('display_sotg', $edit['display_sotg']);
     $this->league->set('coord_list', $edit['coord_list']);
     $this->league->set('capt_list', $edit['capt_list']);
     $this->league->set('excludeTeams', $edit['excludeTeams']);
     $this->league->set('finalize_after', $edit['finalize_after']);
     if (!$this->league->save()) {
         error_exit("Internal error: couldn't save changes");
     }
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:28,代码来源:edit.php

示例11: process

 function process()
 {
     $games = Game::load_many(array('league_id' => $this->league->league_id, '_order' => 'g.game_date,g.game_id'));
     if (!is_array($games)) {
         error_exit("There are no games scheduled for this league");
     }
     $s = new Spirit();
     $s->display_numeric_sotg = $this->league->display_numeric_sotg();
     // Start the output, let the browser know what type it is
     header('Content-type: text/x-csv');
     header("Content-Disposition: attachment; filename=\"spirit{$this->league_id}.csv\"");
     $out = fopen('php://output', 'w');
     $header = array_merge(array('Game #', 'Date', 'Giver Name', 'Giver ID', 'Given To', 'Given To ID', 'SOTG Total'), (array) $s->question_headings(), array('Comments'));
     fputcsv($out, $header);
     while (list(, $game) = each($games)) {
         $teams = array($game->home_team => $game->home_name, $game->away_team => $game->away_name);
         while (list($giver, $giver_name) = each($teams)) {
             $recipient = $game->get_opponent_id($giver);
             # Fetch spirit answers for games
             $entry = $game->get_spirit_entry($recipient);
             if (!$entry) {
                 $entry = array(comments => 'Team did not submit a spirit rating');
             }
             $thisrow = array($game->game_id, strftime('%a %b %d %Y', $game->timestamp), $giver_name, $giver, $teams[$recipient], $recipient, $entry['numeric_sotg'], $entry['timeliness'], $entry['rules_knowledge'], $entry['sportsmanship'], $entry['rating_overall'], $entry['score_entry_penalty'], $entry['comments']);
             fputcsv($out, $thisrow);
         }
     }
     fclose($out);
     // Returning would cause the Leaguerunner menus to be added
     exit;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:31,代码来源:spiritdownload.php

示例12: process

 function process()
 {
     global $lr_session;
     $this->title = "{$this->team->name} &raquo; Spirit";
     $this->template_name = 'pages/team/spirit.tpl';
     // load the league
     $league = League::load(array('league_id' => $this->team->league_id));
     // if the person doesn't have permission to see this team's spirit, bail out
     if (!$lr_session->has_permission('team', 'view', $this->team->team_id, 'spirit')) {
         error_exit("You do not have permission to view this team's spirit results");
     }
     if ($league->display_sotg == 'coordinator_only' && !$lr_session->is_coordinator_of($league->league_id)) {
         error_exit("Spirit results are restricted to coordinator-only");
     }
     $s = new Spirit();
     $s->display_numeric_sotg = $league->display_numeric_sotg();
     /*
      * Grab schedule info
      */
     $games = Game::load_many(array('either_team' => $this->team->team_id, '_order' => 'g.game_date'));
     if (!is_array($games)) {
         error_exit('There are no games scheduled for this team');
     }
     $this->smarty->assign('question_keys', array_merge(array('full'), $s->question_keys(), array('score_entry_penalty')));
     $this->smarty->assign('question_headings', $s->question_headings());
     $this->smarty->assign('num_spirit_columns', count($s->question_headings()) + 1);
     $this->smarty->assign('num_comment_columns', count($s->question_headings()) + 2);
     $rows = array();
     foreach ($games as $game) {
         if (!$game->is_finalized()) {
             continue;
         }
         if ($game->home_id == $this->team->team_id) {
             $opponent_id = $game->away_id;
             $opponent_name = $game->away_name;
             $home_away = '(home)';
         } else {
             $opponent_id = $game->home_id;
             $opponent_name = $game->home_name;
             $home_away = '(away)';
         }
         $thisrow = array('game_id' => $game->game_id, 'day_id' => $game->day_id, 'given_by_id' => $opponent_id, 'given_by_name' => $opponent_name, 'has_entry' => 0);
         # Fetch spirit answers for games
         $entry = $game->get_spirit_entry($this->team->team_id);
         if (!$entry) {
             $rows[] = $thisrow;
             continue;
         }
         $thisrow['has_entry'] = 1;
         // can only see comments if you're a coordinator
         if ($lr_session->has_permission('league', 'view', $this->team->league_id, 'spirit')) {
             $thisrow['comments'] = $entry['comments'];
         }
         $thisrow = array_merge($thisrow, (array) $s->fetch_game_spirit_items_html($entry));
         $rows[] = $thisrow;
     }
     $this->smarty->assign('spirit_detail', $rows);
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:59,代码来源:spirit.php

示例13: __construct

 function __construct($id)
 {
     $this->team = Team::load(array('team_id' => $id));
     if (!$this->team) {
         error_exit("That team does not exist");
     }
     team_add_to_menu($this->team);
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:8,代码来源:TeamHandler.php

示例14: __construct

 function __construct($id)
 {
     $this->game = Game::load(array('game_id' => $id));
     if (!$this->game) {
         error_exit("That game does not exist");
     }
     game_add_to_menu($this->get_league(), $this->game);
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:8,代码来源:GameHandler.php

示例15: __construct

 function __construct($id)
 {
     $this->season = Season::load(array('id' => $id));
     if (!$this->season) {
         error_exit("That season does not exist");
     }
     season_add_to_menu($this->season);
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:8,代码来源:SeasonHandler.php


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