本文整理汇总了PHP中fatal_error函数的典型用法代码示例。如果您正苦于以下问题:PHP fatal_error函数的具体用法?PHP fatal_error怎么用?PHP fatal_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fatal_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: perform_controller_action
static function perform_controller_action($class_path, $action, $objects, $parameters)
{
//We treat 'new' the same as 'edit', since they generally contain a lot of the same code
if ($action == "new") {
$action = "edit";
}
//Let's look for a controller
$controller_path = SITE_PATH . "/controllers/" . $class_path . "_controller.php";
if (file_exists($controller_path)) {
require_once $controller_path;
$class_path_components = explode("/", $class_path);
$class = $class_path_components[count($class_path_components) - 1];
$controller_class = $class . "_controller";
if (!method_exists($controller_class, $action)) {
if (router::render_view($class_path, $action)) {
exit;
} else {
fatal_error("{$controller_class} does not respond to {$action}");
}
}
$controller = new $controller_class();
$controller->parameters = $parameters;
call_user_func_array(array($controller, $action), $objects);
exit;
}
//If no controller was found, we'll look for a view
if (router::render_view($class_path, $action)) {
exit;
}
}
示例2: save
function save()
{
global $boarddir, $context;
checkSession('post');
$styleheaders = $_POST['headers'];
$stylefooters = $_POST['footers'];
$styleheaders = stripslashes($styleheaders);
$stylefooters = stripslashes($stylefooters);
//Save Headers
$filename = $boarddir . '/smfheader.txt';
@chmod($filename, 0644);
if (!($handle = fopen($filename, 'w'))) {
fatal_error('Can not open' . $filename . '.', false);
}
// Write the headers to our opened file.
if (!fwrite($handle, $styleheaders)) {
//fatal_error('Can not write to' . $filename . '.',false);
}
fclose($handle);
//Save Footers
$filename = $boarddir . '/smffooter.txt';
@chmod($filename, 0644);
if (!($handle = fopen($filename, 'w'))) {
fatal_error('Can not open' . $filename . '.', false);
}
// Write the headers to our opened file.
if (!fwrite($handle, $stylefooters)) {
//fatal_error('Can not write to' . $filename . '.',false);
}
fclose($handle);
redirectexit('action=globalhf;sesc=' . $context['session_id']);
}
示例3: setEnabled
/**
* Set the Enabled Flag
*
* @param string $enabled "Yes" or "No"
*/
function setEnabled($enabled)
{
if (!($enabled == "Yes" || $enabled == "No")) {
fatal_error("ModuleDBO::setEnabled()", "Invalid value for enabled: " . $enabled);
}
$this->enabled = $enabled;
}
示例4: metacharge_get_period
function metacharge_get_period($days, $field = '')
{
// For scheduled payments based upon this transaction, the interval between payments,
// given as XY where X is a number (1-999) and Y is “D” for days, “W” for weeks or “M” for months.
$days = strtolower(trim($days));
if (preg_match('/^(\\d+)(d|w|m|y)$/', $days, $regs)) {
$count = $regs[1];
$period = $regs[2];
if ($period == 'd') {
return sprintf("%03d", $count) . "D";
} elseif ($period == 'w') {
return sprintf("%03d", $count) . "W";
} elseif ($period == 'm') {
return sprintf("%03d", $count) . "M";
} elseif ($period == 'y') {
return sprintf("%03d", $count * 12) . "M";
} else {
fatal_error(_PLUG_PAY_METACHARGE_FERROR2);
}
} elseif (preg_match('/^\\d+$/', $days)) {
return sprintf("%03d", $days) . "D";
} else {
fatal_error(sprintf(_PLUG_PAY_METACHARGE_FERROR3, $field, $days));
}
}
示例5: do_payment
function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
{
global $config, $db;
$payment = $db->get_payment($payment_id);
$product = $db->get_product($product_id);
$member = $db->get_user($member_id);
$nvp = array('AMT' => $price, 'CURRENCYCODE' => $product['paypal_mobile_currency'] ? $product['paypal_mobile_currency'] : 'USD', 'DESC' => substr($product['title'], 0, 127), 'NUMBER' => $product_id, 'CUSTOM' => $payment_id, 'INVNUM' => $payment_id, 'RETURNURL' => $config['root_url'] . '/plugins/payment/paypal_mobile/thanks.php', 'CANCELURL' => $config['root_url'] . '/cancel.php', 'EMAIL' => substr($member['email'], 0, 127));
$redirect_URL = "https://mobile.paypal.com/wc?t=";
if ($this->config['testing']) {
$payment['data'][] = $nvp;
$db->update_payment($payment['payment_id'], $payment);
$redirect_URL = "https://www.sandbox.paypal.com/wc?t=";
}
$nvpstr = array();
foreach ($nvp as $k => $v) {
$nvpstr[] = urlencode($k) . '=' . urlencode($v);
}
$nvpstr = implode('&', $nvpstr);
$response = $this->nvp_api_call("SetMobileCheckout", $nvpstr);
$token = $response["TOKEN"];
if ($token) {
$payment['data']['token'] = $token;
$db->update_payment($payment['payment_id'], $payment);
header("Location: " . $redirect_URL . $token);
exit;
} else {
if ($this->config['testing']) {
$db->log_error("PayPal Mobile Checkout ERROR: SetMobileCheckout \$response=<br />" . $this->get_dump($response));
}
fatal_error("PayPal Mobile Checkout ERROR. Please contact site Administrator.");
}
}
示例6: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$topic_id = request_var('topic_id', 0);
if (!$topic_id) {
fatal_error();
}
$sql = 'SELECT *
FROM _forum_topics
WHERE topic_id = ?';
if (!$data = sql_fieldrow(sql_filter($sql, $topic_id))) {
fatal_error();
}
$title = ucfirst(strtolower($data['topic_title']));
$sql = 'UPDATE _forum_topics SET topic_title = ?
WHERE topic_id = ?';
sql_query(sql_filter($sql, $title, $topic_id));
return _pre($data['topic_title'] . ' > ' . $title, true);
}
示例7: genslotselector
function genslotselector($area, $prefix, $first, $last, $time, $display = "block")
{
global $periods;
$html = '';
// Get the settings for this area. Note that the variables below are
// local variables, not globals.
$enable_periods = $area['enable_periods'];
$resolution = $enable_periods ? 60 : $area['resolution'];
// Check that $resolution is positive to avoid an infinite loop below.
// (Shouldn't be possible, but just in case ...)
if (empty($resolution) || $resolution < 0) {
fatal_error(FALSE, "Internal error - resolution is NULL or <= 0");
}
// If they've asked for "display: none" then we'll also disable the select so
// that there is only one select passing through the variable to the handler
$disabled = strtolower($display) == "none" ? " disabled=\"disabled\"" : "";
$date = getdate($time);
$time_zero = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']);
if ($enable_periods) {
$base = 12 * 60 * 60;
// The start of the first period of the day
} else {
$format = hour_min_format();
}
$html .= "<select style=\"display: {$display}\" id = \"{$prefix}seconds{$area['id']}\" name=\"{$prefix}seconds\" onChange=\"adjustSlotSelectors(this.form)\"{$disabled}>\n";
for ($t = $first; $t <= $last; $t = $t + $resolution) {
$timestamp = $t + $time_zero;
$slot_string = $enable_periods ? $periods[intval(($t - $base) / 60)] : utf8_strftime($format, $timestamp);
$html .= "<option value=\"{$t}\"";
$html .= $timestamp == $time ? " selected=\"selected\"" : "";
$html .= ">{$slot_string}</option>\n";
}
$html .= "</select>\n";
echo $html;
}
示例8: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return;
}
$this->id = request_var('msg_id', 0);
$sql = 'SELECT *
FROM _forum_topics
WHERE topic_id = ?';
if (!$this->object = sql_fieldrow(sql_filter($sql, $this->id))) {
fatal_error();
}
$this->object = (object) $this->object;
$this->object->new_value = ($this->object->topic_featured) ? 0 : 1;
topic_feature($this->id, $this->object->new_value);
$sql_insert = array(
'bio' => $user->d('user_id'),
'time' => time(),
'ip' => $user->ip,
'action' => 'feature',
'old' => $this->object->topic_featured,
'new' => $this->object->new_value
);
sql_insert('log_mod', $sql_insert);
return redirect(s_link('topic', $this->id));
}
示例9: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$username = request_var('username', '');
$password = request_var('password', '');
$username = get_username_base($username);
$sql = 'SELECT user_id, username
FROM _members
WHERE username_base = ?';
if (!$userdata = sql_fieldrow(sql_filter($sql, $username))) {
fatal_error();
}
$sql = 'UPDATE _members SET user_password = ?
WHERE user_id = ?';
sql_query(sql_filter($sql, HashPassword($password), $userdata['user_id']));
return _pre('La contraseña de ' . $userdata['username'] . ' fue actualizada.', true);
}
示例10: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$username = request_var('username', '');
if (empty($username)) {
fatal_error();
}
$username = get_username_base($username);
$sql = 'SELECT user_id
FROM _members
WHERE username_base = ?';
if (!$row = sql_fieldrow(sql_filter($sql, $username))) {
fatal_error();
}
$sql = 'DELETE FROM _members_unread
WHERE user_id = ?
AND element <> ?';
sql_query(sql_filter($sql, $row['user_id'], 16));
return _pre('Deleted', true);
}
示例11: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$topic = request_var('topic', 0);
$important = request_var('important', 0);
$sql = 'SELECT *
FROM _forum_topics
WHERE topic_id = ?';
if (!$topicdata = sql_fieldrow(sql_filter($sql, $topic))) {
fatal_error();
}
$sql_important = ($important) ? ', topic_important = 1' : '';
$sql = 'UPDATE _forum_topics
SET topic_color = ?, topic_announce = 1' . $sql_important . '
WHERE topic_id = ?';
sql_query(sql_filter($sql, 'E1CB39', $topic));
return _pre('El tema <strong>' . $topicdata['topic_title'] . '</strong> ha sido anunciado.', true);
}
示例12: delete_user
function delete_user($login)
{
$sql = "SELECT source FROM " . TABLE_PREFIX . "_utilisateurs\n\t WHERE login LIKE '{$login}'";
$res = grr_sql_query($sql);
$row = grr_sql_row($res, 0);
$source = $row[0];
if ($source == 'ext') {
// Si l'utilisateur avait été créé automatiquement, on le
// supprime
// Cf. admin_user.php l99 et l203
$sql = "DELETE FROM " . TABLE_PREFIX . "_utilisateurs WHERE login='{$login}'";
if (grr_sql_command($sql) < 0) {
fatal_error(1, "<p>" . grr_sql_error());
} else {
grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_mailuser_room WHERE login='{$login}'");
grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_user_area WHERE login='{$login}'");
grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_user_room WHERE login='{$login}'");
grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_useradmin_area WHERE login='{$login}'");
grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_useradmin_site WHERE login='{$login}'");
}
// Fin de la session
grr_closeSession($_GET['auto']);
}
// sinon c'est source="local": on le garde et il y a toujours accès
// classique login/mot de passe).
}
示例13: get_days
function get_days($orig_period)
{
$ret = 0;
if (preg_match('/^\\s*(\\d+)\\s*([y|Y|m|M|w|W|d|D]{0,1})\\s*$/', $orig_period, $regs)) {
$period = $regs[1];
$period_unit = $regs[2];
if (!strlen($period_unit)) {
$period_unit = 'd';
}
$period_unit = strtoupper($period_unit);
switch ($period_unit) {
case 'Y':
$ret = $period * 365;
break;
case 'M':
$ret = $period * intval(date("t"));
// days in curent month
break;
case 'W':
$ret = $period * 7;
break;
case 'D':
$ret = $period;
break;
default:
fatal_error(sprintf("Unknown period unit: %s", $period_unit));
}
} else {
fatal_error("Incorrect value for expire days: " . $orig_period);
}
return $ret;
}
示例14: __call
/**
* Execute API call
*
* @param array $arguments parametrs of API call
* @return mixed stdClass|false
*/
function __call($name, $arguments)
{
if (!isset($this->_sheme[$name])) {
fatal_error("Attempt to execute unspecified API call");
// throw new Exception();
}
$apiCall = $this->_sheme[$name];
$apiURL = $this->_apiBase . $apiCall->type . '/' . $apiCall->name;
$ch = curl_init($apiURL);
$headers = array('Accept: application/json');
//curl configuration
$options = array(CURLOPT_FOLLOWLOCATION => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_CONNECTTIMEOUT => 3, CURLOPT_TIMEOUT => 5, CURLOPT_USERPWD => $this->_username . ':' . $this->_password, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $arguments[0]);
if (self::METHOD_POST == $apiCall->type) {
$options[CURLOPT_POST] = true;
//GET is default state
}
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if (!$response) {
$this->_lastError = "Can't connect to API url";
return false;
}
//DEBUG
$GLOBALS['db']->log_error('DEBUG twocheckuot_r:' . $response);
$response = $this->_encoder->decode($response);
if ($http_code >= 400) {
$this->_lastError = $response->errors;
return false;
}
return $response;
}
示例15: process_thanks
function process_thanks(&$vars)
{
global $db, $config;
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
$payment_id = $vars['payment_id'];
$payment = $db->get_payment($payment_id);
$member_id = $payment['member_id'];
$begin_date = $payment['begin_date'];
if ($vars['vcode'] != md5($payment_id . $begin_date . $member_id)) {
fatal_error(_PLUG_PAY_FREE_ERROR, 0);
}
if ($payment['receipt_id']) {
$root_url = $config['root_url'];
fatal_error($this->config['admin_approval'] ? _PLUG_PAY_FREE_MAILSENT : sprintf(_PLUG_PAY_FREE_SIGNEDUP, "<a href='{$root_url}/member.php'>", "</a>"), 0, 1);
}
if ($this->config['mail_admin']) {
$this->signup_moderator_mail($payment_id, $member_id, $vars);
}
if ($this->config['admin_approval']) {
$new_payment = $payment;
$new_payment['receipt_id'] = $REMOTE_ADDR;
$db->update_payment($payment_id, $new_payment);
} else {
$db->finish_waiting_payment(intval($vars['payment_id']), 'free', $REMOTE_ADDR, '', $vars);
}
}