本文整理汇总了PHP中ErrorHandler::getSingleton方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorHandler::getSingleton方法的具体用法?PHP ErrorHandler::getSingleton怎么用?PHP ErrorHandler::getSingleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorHandler
的用法示例。
在下文中一共展示了ErrorHandler::getSingleton方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PageAdminPanel
/**
* Constructor
*
* init superclass, create navigation
*/
function PageAdminPanel()
{
// MANDATORY SECURITY CHECK IN CONSTRUCTOR OF EACH PAGE
$rightsManager = RightsManager::getSingleton();
if (!$rightsManager->currentUserIsAllowedTo('administrate')) {
ErrorHandler::getSingleton()->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
}
$this->Page('Admin Panel');
$this->nav = new Navigation('admin-menu');
$this->nav->addEntry('return', 'return', Navigation::mainPageUrl());
}
示例2: PageContactEdit
/**
* Constructor: ONLY TO BE CALLED like this: Page::newPage(classname,$id,$add) factory method!!
*
* @param $idOrContact integer|Contact the id of the contact, or the contact that is to be edited
* @param $add boolean whether the contact is to be added or not (cannot be detected through {@link $id}, because a contact can be passed if an error occurs to preserve already inserted information)
* @param $xsltProcessing boolean allows to deactivate XSLT processing if FALSE. default: TRUE
* @global Options admin options
*/
function PageContactEdit($idOrContact, $add = false, $enableXSLTProcessing = TRUE)
{
global $options;
$this->counters = array();
$this->add = $add;
$this->enableXSLTProcessing = $enableXSLTProcessing;
if ($idOrContact === null) {
$this->contact = Contact::newContact();
$this->add = TRUE;
} elseif (is_numeric($idOrContact)) {
$this->contact = Contact::newContact($idOrContact);
} else {
$this->contact =& $idOrContact;
}
// MANDATORY SECURITY CHECK IN CONSTRUCTOR OF EACH PAGE
$rightsManager = RightsManager::getSingleton();
if ($add) {
if (!$rightsManager->currentUserIsAllowedTo('create')) {
ErrorHandler::getSingleton()->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
}
$this->Page('Add new entry');
} else {
if (!$rightsManager->currentUserIsAllowedTo('edit', $this->contact)) {
ErrorHandler::getSingleton()->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
}
$this->Page($this->contact->contact['firstname'] . ' ' . $this->contact->contact['lastname']);
}
$this->menu = new Navigation('edit-menu');
// disable save when XSLT will be processed. XSLT files MUST provide their own save button.
if (!($this->enableXSLTProcessing && !empty($this->contact->contact['xsltDisplayType']))) {
$this->menu->addEntry('save', 'save', 'javascript:saveEntry();');
}
if (isset($this->contact->contact['id'])) {
$this->menu->addEntry('cancel', 'cancel', '?id=' . $this->contact->contact['id']);
} else {
$this->menu->addEntry('cancel', 'cancel', Navigation::previousPageUrl());
}
if (!$this->add) {
$rightsManager = RightsManager::getSingleton();
if ($rightsManager->mayDeleteContact($this->contact)) {
$this->menu->addEntry('delete', 'delete', 'javascript:deleteEntry(' . $this->contact->contact['id'] . ');');
if ($_SESSION['user']->isAtLeast('admin') && $options->getOption('deleteTrashMode')) {
$this->menu->addEntry('trash', 'trash', '?mode=trash&id=' . $this->contact->contact['id']);
}
}
}
if ($_SESSION['user']->isAtLeast('admin')) {
// no putting on changed list
$this->menu->addEntry('adminsave', '[adminsave]', 'javascript:adminsaveEntry();');
}
}