本文整理汇总了PHP中ErrorHandler::logError方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorHandler::logError方法的具体用法?PHP ErrorHandler::logError怎么用?PHP ErrorHandler::logError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorHandler
的用法示例。
在下文中一共展示了ErrorHandler::logError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionPermissionDenied
/**
* Show Permission denied page
*/
public function actionPermissionDenied()
{
// TODO: logout user, redirect to admin login form and the error should be dislayed in the form
ErrorHandler::logError('Permission denied!<br />- You do not have enough privilege to access the page you requested or<br />- The requested page is accessible but a service on that page cannot be performed on your behalf.');
Yii::app()->layout = 'permission';
$this->render('PermissionDenied');
}
示例2: actionEdit
/**
* Edit user
* User query string Id parameter as the User ID, if Id=0 or not provided
* the action will create a new user
*/
public function actionEdit()
{
$userId = $this->get('Id', 0);
if ($userId == 0) {
$user = new FUser();
$user->Status = FUser::STATUS_MEMBER;
} else {
$user = FUser::model()->findByPk($userId);
}
if (!is_null($user)) {
$user->Password = '';
// We don't show user password
} else {
ErrorHandler::logError(Yii::t('User', 'Invalid user Id.'));
}
$this->render('Edit', array('user' => $user));
}
示例3: actionSave
public function actionSave()
{
$module = $this->post('Module', '');
if (Yii::app()->request->isPostRequest) {
$this->message = 'Your new configuration is updated successfully.';
//POST data
foreach ($_POST as $key => $value) {
$param = Setting::model()->find('Name = :Param AND Module = :Module', array(':Param' => $key, ':Module' => $module));
if (is_null($param)) {
continue;
}
$param->Value = $value;
if (!$param->validate()) {
ErrorHandler::logError($param->getError('Value'));
$this->message = '';
} else {
$param->save();
}
}
//FILE upload if any
foreach ($_FILES as $key => $file) {
/**
* If enctype='multipart/form-data' has file fiels, $_FILES always
* has information related to file fields. We have to check if
* each field has file uploaded or not
*/
if ($file['error'] == UPLOAD_ERR_NO_FILE) {
continue;
}
$param = Setting::model()->find('Name = :Param', array(':Param' => $key));
if (is_null($param)) {
continue;
}
//Not match any setting param
/**
* Set param value to $file as normally an upload file param should have
* a writer Service to save file and return filepath as the final value
*/
$param->Value = $file;
if (!$param->validate()) {
ErrorHandler::logError($param->getError('Value'));
$this->message = '';
} else {
$param->save();
}
}
//Cms::service('Cms/Settings/db2php', array('Module' => $module));
}
$params = array();
if ($module) {
$params = array('module' => $module);
}
$this->redirect($this->createUrl("/Core/settings", $params));
}
示例4: displayForbiddenError
/**
* Displays Forbidden Error (403 Error)
*
* @static
* @return bool
*/
public static function displayForbiddenError()
{
$config = Config::getInstance();
try {
$errorPath = $config->getParam("errorPath");
$dir = $errorPath . DS . "view" . DS;
$customDir = $errorPath . DS . "view" . DS . "customTemplates" . DS;
$listDir = @scandir($customDir, 1);
if (count($listDir) == 2) {
$template = "defaultForbiddenError.php";
$template = $dir . $template;
} else {
$template = (string) $config->getParam("customForbiddenTemplate");
$template = $customDir . $dir;
}
if (file_exists($template)) {
require_once $template;
} else {
print "<h1>Error: 403</h1>";
}
$caller = debug_backtrace();
$caller = $caller[1];
if (isset($caller["file"])) {
$file = $caller["file"];
} else {
$file = "";
}
if (isset($caller["line"])) {
$line = $caller["line"];
} else {
$line = 0;
}
$get = print_r($_GET, TRUE);
$post = print_r($_POST, TRUE);
$files = print_r($_FILES, TRUE);
$session = print_r($_SESSION, TRUE);
$message = "403 Forbidden for {$_SERVER["REQUEST_URI"]} IP={$_SERVER["REMOTE_ADDR"]} Parameters: ( GET={$get} | POST={$post} | FILE={$files} | SESSION={$session}";
return ErrorHandler::logError("forbidden", $line, $message, $file);
} catch (Exception $ex) {
return false;
}
}