本文整理汇总了PHP中Error::addError方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::addError方法的具体用法?PHP Error::addError怎么用?PHP Error::addError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::addError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _checkConfig
/**
* read the config file and check for existence
*
* @return void
*/
private function _checkConfig()
{
if (!is_readable(APP_ROOT . '/config.php')) {
$this->error->addError('file_exists(config.php)', 'config.php does not exist or is not readable by the webserver in the phpsysinfo directory.');
} else {
include_once APP_ROOT . '/config.php';
}
if ($this->error->errorsExist()) {
$this->error->errorsAsXML();
}
}
示例2: trigger_error
/**
* trigger Smarty error
*
* @param string $error_msg
* @param integer $error_type
*/
function trigger_error($error_msg, $error_type = E_USER_WARNING)
{
// print the error message
Error::addError("Smarty error: {$error_msg}", true);
if ($error_type == E_USER_ERROR) {
die("Smarty error!");
}
}
示例3: Error
public function Error($msg)
{
// unset all class variables
$this->_destroy(true);
// exit program and print error
// print the error message
Error::addError('TCPDF ERROR: ' . $msg, true);
//die("TCPDF error!");
}
示例4: _buildXml
/**
* generate the xml document
*
* @return void
*/
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if (version_compare("5.2", PHP_VERSION, ">")) {
$this->_errors->addError("ERROR", "PHP 5.2 or greater is required, some things may not work correctly");
}
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
// unstable version check
if (!is_numeric(substr(PSI_VERSION, -1))) {
$this->_errors->addError("WARN", "This is an unstable version of phpSysInfo, some things may not work correctly");
}
// Safe mode check
$safe_mode = @ini_get("safe_mode") ? true : false;
if ($safe_mode) {
$this->_errors->addError("WARN", "PhpSysInfo requires to set off 'safe_mode' in 'php.ini'");
}
// Include path check
$include_path = @ini_get("include_path");
if ($include_path && $include_path != "") {
$include_path = preg_replace("/(:)|(;)/", "\n", $include_path);
if (preg_match("/^\\.\$/m", $include_path)) {
$include_path = ".";
}
}
if ($include_path != ".") {
$this->_errors->addError("WARN", "PhpSysInfo requires '.' inside the 'include_path' in php.ini");
}
// popen mode check
if (defined("PSI_MODE_POPEN") && PSI_MODE_POPEN === true) {
$this->_errors->addError("WARN", "Installed version of PHP does not support proc_open() function, popen() is used");
}
}
$this->_sys = $this->_sysinfo->getSys();
}
$this->_buildVitals();
$this->_buildNetwork();
$this->_buildHardware();
$this->_buildMemory();
$this->_buildFilesystems();
$this->_buildMbinfo();
$this->_buildUpsinfo();
}
$this->_buildPlugins();
$this->_xml->combinexml($this->_errors->errorsAddToXML($this->_sysinfo->getEncoding()));
}
示例5: _checkfiles
/**
* check if there is a default translation file availabe and also the required js file for
* appending the content of the plugin to the main webpage
*
* @return void
*/
private function _checkfiles()
{
if (!file_exists($this->_plugin_base . "js/" . strtolower($this->_plugin_name) . ".js")) {
$this->global_error->addError("file_exists(" . $this->_plugin_base . "js/" . strtolower($this->_plugin_name) . ".js)", "JS-File for Plugin '" . $this->_plugin_name . "' is missing!");
} else {
if (!is_readable($this->_plugin_base . "js/" . strtolower($this->_plugin_name) . ".js")) {
$this->global_error->addError("is_readable(" . $this->_plugin_base . "js/" . strtolower($this->_plugin_name) . ".js)", "JS-File for Plugin '" . $this->_plugin_name . "' is not readable but present!");
}
}
if (!file_exists($this->_plugin_base . "lang/en.xml")) {
$this->global_error->addError("file_exists(" . $this->_plugin_base . "lang/en.xml)", "At least an english translation must exist for the plugin!");
} else {
if (!is_readable($this->_plugin_base . "lang/en.xml")) {
$this->global_error->addError("is_readable(" . $this->_plugin_base . "js/" . $this->_plugin_name . ".js)", "The english translation can't be read but is present!");
}
}
}
示例6: _buildXml
/**
* generate the xml document
*
* @return void
*/
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
// Safe mode check
$safe_mode = @ini_get("safe_mode") ? TRUE : FALSE;
if ($safe_mode) {
$this->_errors->addError("WARN", "PhpSysInfo requires to set off 'safe_mode' in 'php.ini'");
}
// Include path check
$include_path = @ini_get("include_path");
if ($include_path && $include_path != "") {
$include_path = preg_replace("/(:)|(;)/", "\n", $include_path);
if (preg_match("/^\\.\$/m", $include_path)) {
$include_path = ".";
}
}
if ($include_path != ".") {
$this->_errors->addError("WARN", "PhpSysInfo requires '.' inside the 'include_path' in php.ini");
}
// popen mode check
if (defined("PSI_MODE_POPEN") && PSI_MODE_POPEN === true) {
$this->_errors->addError("WARN", "Installed version of PHP does not support proc_open() function, popen() is used");
}
}
$this->_sys = $this->_sysinfo->getSys();
}
$this->_buildVitals();
$this->_buildNetwork();
$this->_buildHardware();
$this->_buildMemory();
$this->_buildFilesystems();
$this->_buildMbinfo();
$this->_buildUpsinfo();
}
$this->_buildPlugins();
$this->_xml->combinexml($this->_errors->errorsAddToXML($this->_sysinfo->getEncoding()));
}
示例7: handleForm
/**
* Handle the submitted forms.
*/
protected final function handleForm()
{
// check, if user is logged in (except for /user/login OR /booking/website)
if ($this->s->auth() === false && !($this->s->controller == 'user' && $this->s->action == 'login') && !($this->s->controller == 'booking' && $this->s->action == 'website')) {
Error::addError('<strong>Die Anfrage konnte leider nicht bearbeitet werden</strong><br/>Sie sind nicht im System angemeldet!', true);
return false;
}
// check if action is allowed for the user
$right = $this->right();
$action = $this->s->controller . ':' . $right;
if (!($this->s->controller == 'user' && $this->s->action == 'login') && !($this->s->controller == 'booking' && $this->s->action == 'website') && !$this->s->user->hasRights($action) && array_key_exists($right, $this->registerRights())) {
Error::addError('<strong>Die Anfrage konnte leider nicht bearbeitet werden</strong><br/>Du besitzt nicht die erforderlichen Rechte, um die Aktion ' . $action . ' auszuführen!', true);
return false;
}
// get the validation rules for this action
$rules = $this->config['rules'][$this->s->action];
// is it a valid action?
if (!is_array($rules)) {
Error::addError('<strong>Die Anfrage konnte leider nicht bearbeitet werden</strong><br/>Interner Fehler: Es sind keine Regeln für die Aktion "' . $this->s->action . '" im Modul "' . $this->s->controller . '" definiert. Bitte benachrichtigen Sie den Administrator!', true);
return false;
}
// validate the form fields using the rules of the module for this action
$vars = array_merge($this->s->get, $this->s->post);
$check = new Check($vars, $rules, $this->config["messages"]);
if (true === $check->run($escape)) {
// replace unfiltered post vars
$this->vars = $check->vars;
// execute the requested action
return $this->formAction();
} else {
$this->form['errors'] = $check->errorFields;
foreach ($check->errorMessages as $error) {
Error::addWarning($error);
}
return false;
}
}
示例8: formAction
/**
* Handle form action
*/
protected function formAction()
{
$this->escapeFormVars();
switch ($this->s->action) {
case 'send':
$message = new Message();
$message->text = $this->vars['text'];
$message->subject = $this->vars['subject'];
if ($this->s->params[0] != '') {
$message->type = $this->s->params[0];
switch ($message->type) {
case 'poker':
$message->receiver = PokerTable::getInstance($this->s->params[1]);
break;
}
} else {
if (!is_array($this->vars['user']) || count($this->vars['user']) == 0) {
return false;
}
$message->type = 'user';
$rec = array();
foreach ($this->vars['user'] as $r) {
$rec[] = User::getInstance($r);
}
$message->receiver = $rec;
}
$message->sender = $this->s->user;
if ($message->save()) {
Error::addMessage('Die Nachricht wurde verschickt!');
$this->form['reload'] = array('message' => array('sidebar'));
return true;
}
break;
case 'update':
$message = Message::getInstance($this->s->element);
$message->text = $this->vars['text'];
$message->subject = $this->vars['subject'];
if ($message->save()) {
Error::addMessage('Die Nachricht wurde geändert!');
$this->form['reload'] = array('message' => array('u_message'));
return true;
}
break;
case 'reply':
$r = Message::getInstance($this->s->element);
$message = new Message();
$message->text = $this->vars['text'];
$message->subject = $this->vars['subject'];
$message->receiver = $r->sender;
$message->sender = $this->s->user;
$message->replyto = $this->s->element;
if ($message->save()) {
Error::addMessage('Die Nachricht wurde verschickt!');
$this->form['reload'] = array('message' => array('u_message'));
return true;
}
break;
case 'mark':
if ($this->s->element != '') {
$m = Message::getInstance($this->s->element);
// mark all messages in thread as (un-)read
if ($this->vars['messages'] == 'all') {
if (is_array($m->replies)) {
foreach ($m->replies as $r) {
if ($r->receiver == $this->s->user) {
$r->read = $this->vars['option'] == 'read' ? true : false;
if (!$r->save()) {
Error::addError('Interner Fehler: Nachricht konnte nicht gespeichert werden!');
return false;
}
}
}
}
$this->form['reload'] = array('message' => array('u_message'));
} else {
$this->form['reload'] = array('message' => array('sidebar', 'bb_messages'));
}
// mark current message as (un-)read
$m->read = $this->vars['option'] == 'read' ? true : false;
if ($m->save()) {
return true;
} else {
Error::addError('Interner Fehler: Nachricht konnte nicht gespeichert werden!');
return false;
}
}
Error::addError('Es konnte keine Nachricht gefunden werden!');
break;
case 'delete':
$m = Message::getInstance($this->s->element);
if ($m->delete()) {
Error::addMessage('Die Nachricht wurde gelöscht!');
$this->form['reload'] = array('message' => array('sidebar', 'u_message'));
return true;
}
break;
case 'reload':
//.........这里部分代码省略.........
示例9: listModules
/**
* List all availiable Modules
*/
private function listModules()
{
// get all modules listed in the database
$db = DB::getInstance();
$sql = "SELECT name\n FROM modules";
$result = $db->query($sql);
do {
$mod_db[$result->name] = '';
} while ($result->next());
// get all available modules from the file system
$dir = opendir('modules/');
// run through module directory
while (false !== ($name = readdir($dir))) {
// only real folders
if ($name != "." && $name != ".." && is_dir('modules/' . $name)) {
// is there any MODULENAME.info file?
$file = 'modules/' . $name . '/' . $name . '.info';
if (is_readable($file)) {
// read module information
$info = array();
$raw = file($file);
foreach ($raw as $line) {
$parts = explode(':', $line);
if (strtolower($parts[0]) == 'requires') {
$req = explode(',', trim($parts[1]));
if (count($req) > 0 && $req[0] != '') {
$info[strtolower($parts[0])] = $req;
}
} else {
$info[strtolower($parts[0])] = trim($parts[1]);
}
}
// is all given info correct?
if ($info['id'] == $name && !empty($info['name']) && !empty($info['version']) && !empty($info['group']) && !empty($info['description'])) {
$module = Module::getInstance($name);
unset($mod_db[$name]);
$module->version = $info['version'];
$module->requires = $info['requires'];
$module->name = $info['name'];
$module->description = $info['description'];
$module->save();
$groups[$info['group']][] = $module;
$modules[$module->id] = $module;
}
}
}
}
closedir($dir);
// are there any module entries in the db for which no module folder exist?
if (count($mod_db) > 0) {
Error::addError('Achtung: Zu einigen Einträgen in der Datenbank konnte kein Modul gefunden werden!');
}
// resolve dependancies
foreach ($modules as $m) {
$activable = $deact = true;
// all required modules active?
if (is_array($m->requires)) {
foreach ($m->requires as $r) {
if ($r->active === false) {
$activable = false;
break;
}
}
}
$m->can_act = $activable;
// any active modules which rely on the current one?
foreach ($modules as $d) {
if ($d->active === true && is_array($d->requires)) {
foreach ($d->requires as $r) {
if ($r === $m->id) {
$deact = false;
break;
}
}
}
}
$m->can_deact = $deact;
}
$tpl = new Template('module');
$tpl->assign('modules', $modules);
$tpl->assign('groups', $groups);
$tpl->assign('permission', $this->s->user->hasRights('module:activate'));
return $tpl->fetch("modules_table.html");
}
示例10: close
/**
* close server connection and delete marked messages
*
* @return bool
* @author Elias Müller
**/
public function close()
{
if (($error = $this->server->Close()) == "") {
return true;
} else {
Error::addError("Fehler beim Trennen der Verbindung zum Mail-Server: " . HtmlSpecialChars($error), true);
return false;
}
}
示例11: microtime
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// $Id: index.php,v 1.122.4.1 2007/08/19 09:21:57 xqus Exp $
// phpsysinfo release version number
$VERSION = "2.5.4";
$startTime = array_sum(explode(" ", microtime()));
define('APP_ROOT', dirname(__FILE__));
define('IN_PHPSYSINFO', true);
ini_set('magic_quotes_runtime', 'off');
ini_set('register_globals', 'off');
// ini_set('display_errors','on');
require_once APP_ROOT . '/includes/class.error.inc.php';
$error = new Error();
// Figure out which OS where running on, and detect support
if (file_exists(APP_ROOT . '/includes/os/class.' . PHP_OS . '.inc.php')) {
} else {
$error->addError('include(class.' . PHP_OS . '.php.inc)', PHP_OS . ' is not currently supported', __LINE__, __FILE__);
}
if (!extension_loaded('xml')) {
$error->addError('extension_loaded(xml)', 'phpsysinfo requires the xml module for php to work', __LINE__, __FILE__);
}
if (!extension_loaded('pcre')) {
$error->addError('extension_loaded(pcre)', 'phpsysinfo requires the pcre module for php to work', __LINE__, __FILE__);
}
if (!file_exists(APP_ROOT . '/config.php')) {
$error->addError('file_exists(config.php)', 'config.php does not exist in the phpsysinfo directory.', __LINE__, __FILE__);
} else {
require_once APP_ROOT . '/config.php';
// get the config file
}
if ($error->ErrorsExist()) {
echo $error->ErrorsAsHTML();
示例12: delete
/**
* delete the object information from the db
*/
public function delete()
{
$db = DB::getInstance();
$sql = "SELECT idstatus\n\t\t\t\t FROM users\n\t\t\t\t WHERE idstatus = " . $this->id;
$result = $db->query($sql);
if ($result->length() == 0) {
$sql = "DELETE FROM groups\n\t\t\t\t\t\t WHERE idstatus = '" . $this->id . "'";
if ($db->query($sql) != 0) {
return true;
}
}
Error::addError('Die Gruppe konnte nicht gelöscht werden, da ihr noch Benutzer zugeordnet sind. Diese müssen zuvor anderen Gruppen zugewiesen werden!');
return false;
}
示例13: formAction
/**
* Handle form action
*/
protected function formAction()
{
switch ($this->s->action) {
case 'create':
$spot = $this->vars['idspot'] != 0 ? PokerSpot::getInstance($this->vars['idspot']) : FALSE;
$table = new PokerTable($this->vars['title'], $this->vars['seats'], $this->vars['blind'], $spot);
if ($table->save()) {
Error::addMessage('Der Pokertisch wurde erfolgreich angelegt!');
$this->form['reload'] = array('poker' => array('poker_table' => 'tables'));
return true;
}
//*/
break;
case 'update':
$table = PokerTable::getInstance($this->s->element);
$table->title = $this->vars['title'];
$table->seats = $this->vars['seats'];
if ($this->vars['idspot'] != 0) {
$table->spot = PokerSpot::getInstance($this->vars['idspot']);
}
$table->blinds = array('big' => 2 * $this->vars['blind'], 'small' => $this->vars['blind']);
if ($table->save()) {
Error::addMessage('Die Änderungen wurden erfolgreich gespeichert!');
$this->form['reload'] = array('poker' => array('poker_table' => 'tables'));
return true;
}
break;
case 'delete':
$table = PokerTable::getInstance($this->s->element);
if (is_object($table->game)) {
Error::addError('Der Tisch kann nicht gelöscht werden (Spiel ist noch aktiv)!');
return false;
}
if ($table->delete()) {
Error::addMessage('Der Pokertisch wurde erfolgreich gelöscht!');
$this->form['reload'] = array('poker' => array('poker_table' => 'tables'));
return true;
}
break;
case 'reload':
echo $this->listTables();
break;
}
return false;
}
示例14: halt
/**
* error handling
*
* @param string $msg the error message
*/
private function halt($msg)
{
// get the errors
$this->error = @mysql_error($this->link_id);
$this->errno = @mysql_errno($this->link_id);
// should we ignore the error?
if ($this->halt_on_error == "no") {
return;
}
// print the error message
Error::addError("<strong>Database error:</strong> {$msg}<br/>\n<strong>MySQL Error</strong>: {$this->errno} ({$this->error})<br/>\n", true);
// skip the whole programm
if ($this->halt_on_error != "report") {
die("Session halted.");
}
}
示例15: loadModule
/**
* Load a module.
* @param string $module_name The name of the module
* @param bool $site_call true, if the loaded module should display a site (only to set by cBootstrap)
* @return SiteController An instance of the requested module
*/
public function loadModule($module_name, $site_call = false)
{
// check if requested module is active
if (!array_key_exists($module_name, $this->active_modules)) {
Error::addError('<strong>Ihre Anfrage konnte leider nicht bearbeitet werden</strong><br/>Interner Fehler: Modul "' . $module_name . '" ist nicht aktiv. Bitte benachrichtigen Sie den Administrator!', true);
return false;
}
// check if module exists
if (!is_dir("modules/" . $module_name)) {
Error::addError('<strong>Ihre Anfrage konnte leider nicht bearbeitet werden</strong><br/>Interner Fehler: Modul "' . $module_name . '" nicht vorhanden. Bitte benachrichtigen Sie den Administrator!', true);
return false;
}
$class = $this->params["area"] == 'frontend' ? 'frontend' : 'backend';
require_once 'classes/site_controller.class.php';
$action = $site_call === true ? $this->params['action'] : '';
$controller = SiteController::factory($class, $module_name, $action);
return $controller;
}