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


PHP error::grab方法代码示例

本文整理汇总了PHP中error::grab方法的典型用法代码示例。如果您正苦于以下问题:PHP error::grab方法的具体用法?PHP error::grab怎么用?PHP error::grab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在error的用法示例。


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

示例1: Forum_Controller

 /**
  * Forum_Controller constructor
  * @param string template	The base template to use for
  *							the specific page.
  */
 function Forum_Controller($template)
 {
     /* Globalize the settings and config arrays */
     global $_SETTINGS, $_USERGROUPS, $_ALLFORUMS;
     /* Make sure the default event class exists */
     if (!class_exists('DefaultEvent')) {
         exit('Yahtzee!');
     }
     /* Call the Controller Constructor */
     parent::Controller(new DefaultEvent());
     /* Create a new instance of Template */
     error::reset();
     $this->template =& new Template($template);
     if (error::grab()) {
         critical_error();
     }
     /* Set all of the setting values to the template */
     $this->template->setVarArray($_SETTINGS);
     /* Set the Jump To Box */
     $jump_to =& new AllForumsIterator($_ALLFORUMS);
     $this->template->setList('all_forums', $jump_to);
     /* Add the usergroups to the template */
     $usergroups =& new FAArrayIterator($_USERGROUPS);
     $this->template->setList('usergroups', $usergroups);
 }
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:30,代码来源:forum.inc.php

示例2: compile_error

{
    if ($errorno != 2048 && $errorno != 8) {
        //  E_STRICT & E_NOTICE  && $errorno != 8
        return compile_error($string, $file, $line);
    }
}
set_error_handler("error_handler");
/**
 * Get all of the settings into one big array
 */
/* Get the configuration options */
global $_CONFIG;
/* Get the database Object and set it to a global */
error::reset();
$_DBA =& Database::open($_CONFIG['dba']);
if (error::grab()) {
    return critical_error();
}
$GLOBALS['_DBA'] =& $_DBA;
/*
$query = "";

foreach(explode("\r\n", $query) as $q)
	if($q != '')
		$_DBA->executeUpdate($q);
exit;
*/
/**
 * Create some cache files to reduce queries, but only if it needs to be re/created
 */
$cache = array();
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:31,代码来源:common.php

示例3: Execute


//.........这里部分代码省略.........
     if (!is_dir($templateset)) {
         exit('Invalid template set for: ' . $templateset);
     }
     /* Check to see if our images directory exists */
     if (!is_dir($imgs_dir . $imageset)) {
         exit('Invalid image set for: ' . $imageset);
     }
     /* Set the template an image sets */
     $this->template->setDirname($templateset);
     $this->template->setVar('IMG_DIR', $imageset);
     /* Determine which language to get, and then include the appropriate file */
     $language = is_a($session['user'], 'Member') ? strtolower($user['language']) : strtolower(get_setting('application', 'lang'));
     /* Check to see if this is an invalid language file */
     if (!file_exists(FORUM_BASE_DIR . '/includes/lang/' . $language . '/lang.php')) {
         exit('Invalid Language file.');
     }
     /* Require the language file */
     include FORUM_BASE_DIR . '/includes/lang/' . $language . '/lang.php';
     /* Set the language variable to the template */
     $template->setVar('LANG', $language);
     global $lang;
     /* Check if the language function exists */
     if (!isset($lang) || !is_array($lang) || empty($lang)) {
         exit('Invalid Language file.');
     }
     /* Set the locale to which language we are using */
     setlocale(LC_ALL, $lang['locale']);
     /* Set the language array */
     $template->setVarArray($lang);
     /* Memory Saving */
     unset($lang);
     /**
      * Event Execution
      */
     if (get_map($user, 'can_see_board', 'can_view', array()) > $user['perms']) {
         /* This user doesn't have permission to see the bb */
         $template = BreadCrumbs($template, $template->getVar('L_INFORMATION'));
         $template->setInfo('content', $template->getVar('L_YOUNEEDPERMS'));
     } else {
         if (intval($_SETTINGS['bbactive']) == 0 && $user['perms'] < SUPERMOD) {
             /* The board is closed */
             $template = BreadCrumbs($template, $template->getVar('L_INFORMATION'));
             $template->setInfo('content', $_SETTINGS['bbclosedreason']);
         } else {
             /* get the result of our event call */
             if (isset($request[$act_var]) && isset($this->events[$request[$act_var]])) {
                 $result = $this->events[$request[$act_var]]->Execute(&$template, $request, &$_DBA, &$session, &$user);
             }
             /* If the result is false, execute our defaultevent class */
             if ($result == FALSE) {
                 $this->default->Execute(&$template, $request, &$_DBA, &$session, &$user);
             }
         }
     }
     /**
      * User Information
      */
     /* Clear the session and user variables */
     $session =& $_SESSION;
     $user =& $_SESSION['user']->info;
     /**
      * Filters
      */
     /* Apply each Filter to the request */
     for ($i = 0; $i < count($this->filters); $i++) {
         $this->filters[$i]->Execute(&$template, &$session, $this->cookie, $this->post, $this->get);
     }
     /* If the user is logged in, set all of his user info to the template */
     if (is_a($session['user'], 'Member')) {
         foreach ($user as $key => $val) {
             $this->template->setVar('user_' . $key, $val);
         }
     }
     /* Set the number of queries */
     $template->setVar('num_queries', $_DBA->num_queries);
     /* Set the Load time */
     $template->setVar('load_time', $this->timer->__toString());
     if (DEBUG_SQL) {
         $debug_url =& new Url($_URL->__toString());
         $debug_url->args['debug'] = 1;
         $template->setVar('debug_url', $debug_url->__toString());
         $template->show('sql_debug');
         if (isset($request['debug']) && $request['debug'] == 1) {
             /* Output our debugged SQL */
             debug_sql();
         }
     }
     /* Do the mail queue */
     execute_mail_queue();
     /* Do the topic queue */
     execute_topic_queue();
     /**
      * Render the template 
      */
     error::reset();
     $template->Render();
     if (error::grab()) {
         critical_error();
     }
 }
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:101,代码来源:controller.class.php

示例4: Execute

 function Execute(&$template, $request, &$dba, &$session, &$user)
 {
     if (is_a($session['user'], 'Member') && $user['perms'] >= ADMIN) {
         if (!isset($request['field']) || $request['field'] == '') {
             $template->setInfo('content', $template->getVar('L_INVALIDUSERFIELD'), TRUE);
             return TRUE;
         }
         $field = $dba->getRow("SELECT * FROM " . PROFILEFIELDS . " WHERE name = '" . $dba->quote($request['field']) . "'");
         if (!$field || !is_array($field) || empty($field)) {
             $template->setInfo('content', $template->getVar('L_INVALIDUSERFIELD'), TRUE);
             return TRUE;
         }
         if (!$dba->query("SELECT " . $field['name'] . " FROM " . USERINFO . " LIMIT 1")) {
             /* Delete the profile field version of this because obviously it shouldn't exist */
             $dba->executeUpdate("DELETE FROM " . PROFILEFIELDS . " WHERE name = '" . $dba->quote($field['name']) . "'");
             $template->setInfo('content', $template->getVar('L_INVALIDUSERFIELD'), TRUE);
             return TRUE;
         }
         /* Remove the field */
         error::reset();
         $dba->alterTable(USERINFO, "DROP " . $dba->quote($field['name']));
         $error = error::grab();
         if ($error) {
             $template->setInfo('content', sprintf($template->getVar('L_ERRORDELPROFILEFIELD'), $request['title'], $error->message . ' Line: ' . $error->line . ', File: ' . basename($error->filename)), FALSE);
             return TRUE;
         }
         /* Remove the last of the profile field info if we've made it this far */
         $dba->executeUpdate("DELETE FROM " . PROFILEFIELDS . " WHERE name = '" . $dba->quote($field['name']) . "'");
         /* Remove the cache file so it may be remade */
         if (!@touch(CACHE_FILE, time() - 86460)) {
             @unlink(CACHE_FILE);
         }
         $template->setInfo('content', sprintf($template->getVar('L_REMOVEDPROFILEFIELD'), $field['title']), FALSE);
         $template->setRedirect('admin.php?act=userfields', 3);
     } else {
         $template->setError('content', $template->getVar('L_YOUNEEDPERMS'));
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:39,代码来源:profilefields.class.php

示例5: critical_error

function critical_error()
{
    $error =& error::grab();
    $logo = file_exists(FORUM_BASE_DIR . '/Images/k4.gif') ? 'Images/k4.gif' : '';
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
	<title>k4 v2.0 - Critical Error - Powered by k4 BB</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
	<meta http-equiv="Content-Style-Type" content="text/css" />
	<meta name="generator" content="k4 Bulletin Board 2.0" />
	<meta name="robots" content="all" />
	<meta name="revisit-after" content="1 Days" />

	<meta http-equiv="Expires" content="1" />
	<meta name="description" content="k4 v2.0 - Powered by k4 Bulletin Board" />
	<meta name="keywords" content="k4, bb, bulletin, board, bulletin board, forum, k4st, forums, message, board, message board" />
	<meta name="author" content="k4 Bulletin Board" />
	<meta name="distribution" content="GLOBAL" />
	<meta name="rating" content="general" />
	<link rel="icon" href="favicon.ico" type="image/x-icon" />
	<style type="text/css">
	body {
		background-color: #FFFFFF;
		padding: 0px;
		margin: 0px;
	}
	a {
		font-family: Geneva, Arial, Helvetica, Sans-Serif;
		font-size: 12px;
		color: #000000;
		text-decoration: none;
	}
	h2 {
		font-family: Geneva, Arial, Helvetica, Sans-Serif;
		color: #045975;
	}
	.error_box {
		text-align: left;
		border: 1px solid #666666;
		background-color: #f7f7f7;
		color: #000000;
		font-family: Geneva, Arial, Helvetica, Sans-Serif;
		font-size: 12px;
		width: 500px;
		padding: 10px;
	}
	.redtext {
		color: #FF0000;
	}
	.greentext {
		color: #009900;
		font-weight: bold;
	}
	</style>
</head>
<body>
<div align="center">
	<?php 
    if ($logo != '') {
        echo '<img src="' . $logo . '" alt="k4 Bulletin Board" border="0" />';
    } else {
        echo '<h2>k4 Bulletin Board</h2>';
    }
    ?>
	<div class="error_box">
		<span class="redtext">The following critical error occured:</span>
		<br /><br />
		<span class="greentext"><?php 
    echo $error->message;
    ?>
</span>
		<br /><br />
		Line: <strong><?php 
    echo $error->line;
    ?>
</strong><br />
		File: <strong><?php 
    echo $error->filename;
    ?>
</strong>
	</div>
</div>
<br /><br />
<div align="center">
	<span style="width:150px;color:#666666;border-top:1px dashed #666666;padding-top:2px;margin:4px;" class="smalltext">
		[ <a href="http://www.k4bb.org" title="k4 Bulletin Board" target="_blank">Powered By: k4 Bulletin Board</a> ]
	</span>
	<br />
</div>
</body>
</html>
</div>
	<?php 
    exit;
}
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:97,代码来源:functions.inc.php


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