本文整理汇总了PHP中content::showError方法的典型用法代码示例。如果您正苦于以下问题:PHP content::showError方法的具体用法?PHP content::showError怎么用?PHP content::showError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类content
的用法示例。
在下文中一共展示了content::showError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
//.........这里部分代码省略.........
$controller = htmlspecialchars($_GET["p"], ENT_QUOTES);
if ($controller == "index") {
$controller = $globalcfg["defpage"];
}
}
if (isset($_GET["a"])) {
$action_name = "action_" . $_GET["a"];
}
//endregion
require_once "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "_dat" . DIRECTORY_SEPARATOR . $_SESSION["mwcserver"] . "_" . $_SESSION["mwclang"] . "_pages.php";
if (isset($page[$controller])) {
$path = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . $page[$controller]["ppath"] . DIRECTORY_SEPARATOR . $controller . ".php";
if (file_exists($path)) {
$access = explode(",", $page[$controller]["groups"]);
//region проверка на пользователя (если есть)
$ccfg = Configs::readCfg($controller, $_SESSION["mwcbuild"]);
if (!empty($ccfg["allowedUsrs"])) {
$usrs = explode(",", $ccfg["allowedUsrs"]);
if (!in_array($uid, $usrs)) {
$err = 2;
} else {
$err = 0;
}
} else {
$err = 2;
}
//endregion
try {
if (in_array($_SESSION["mwcpoints"], $access) || in_array(4, $access) || $err == 0) {
if (!empty($page[$controller]["mname"]) && !empty($page[$controller]["mpath"])) {
$modelpath = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . $page[$controller]["mpath"] . DIRECTORY_SEPARATOR . $page[$controller]["mname"] . ".php";
require_once $path;
if (file_exists($modelpath)) {
require_once $modelpath;
$modelname = $page[$controller]["mname"];
} else {
$modelname = "Model";
$action_name = "showError";
$db->SQLog("model {$modelpath} wasn't found", "router", 2);
}
$model = new $modelname($db);
$contolinst = new $controller($model, $content, $page, $_SESSION["mwcserver"]);
$contolinst->init();
if (method_exists($controller, $action_name)) {
$contolinst->{$action_name}();
} else {
$contolinst->action_index();
$db->SQLog("{$controller} hasn't action {$action_name}", "router", 3);
}
$contolinst->parentOut($isBackground);
} else {
$model = new $globalcfg["defModel"]();
$contolinst = new $globalcfg["defController"]($model, $content, $page, $_SESSION["mwcserver"]);
$contolinst->genNonMVC($path);
$contolinst->parentOut($isBackground);
}
} else {
$model = new Model($db);
$contolinst = new Controller($model, $content, $page, $_SESSION["mwcserver"]);
$contolinst->init();
$contolinst->showError(2);
$contolinst->parentOut($isBackground);
if (!empty($_SESSION["mwcuid"])) {
$theGuy = $_SESSION["mwcuid"];
} else {
$theGuy = "?";
}
$db->SQLog("user({$theGuy}) try access to {$controller} but he hasn't access", "router", 6);
}
} catch (Exception $e) {
$model = new Model($db);
$contolinst = new Controller($model, $content, $page, $_SESSION["mwcserver"]);
$contolinst->init();
$contolinst->showErrorText($e->getMessage());
$contolinst->parentOut($isBackground);
}
} else {
$model = new Model($db);
$contolinst = new Controller($model, $content, $page, $_SESSION["mwcserver"]);
$contolinst->init();
$contolinst->showError(3);
$contolinst->parentOut($isBackground);
$db->SQLog("controller {$path} ({$controller}) wasn't found", "router", 1, true);
}
} else {
$model = new Model($db);
$contolinst = new Controller($model, $content, $page, $_SESSION["mwcserver"]);
$contolinst->init();
$contolinst->showError(3);
$contolinst->parentOut($isBackground);
$db->SQLog("controller {$controller} wasn't register", "router", 1);
}
//endregion
} catch (Exception $ex) {
$stack = $ex->getTrace();
$msg = $ex->getMessage() . " in file: " . basename($stack[3]["file"]) . " line: " . $stack[3]["line"];
self::addlog(tbuild . "_error", $msg, "log");
content::showError("Something went wrong", "please, check logs.");
}
}
示例2: __construct
//.........这里部分代码省略.........
}
}
}
}
}
//endregion
//region страницы
//region получение контроллера и экшена
if (!isset($_GET["p"])) {
$controller = $globalcfg["defpage"];
} else {
$controller = htmlspecialchars($_GET["p"], ENT_QUOTES);
if ($controller == "index") {
$controller = $globalcfg["defpage"];
}
}
if (isset($_GET["a"])) {
$action_name = "action_" . $_GET["a"];
}
//endregion
require_once "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "_dat" . DIRECTORY_SEPARATOR . $_SESSION["mwcserver"] . "_" . $_SESSION["mwclang"] . "_pages.php";
if (empty($page)) {
$page = array();
}
if (isset($page[$controller])) {
$path = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . $page[$controller]["ppath"] . DIRECTORY_SEPARATOR . $controller . ".php";
if (file_exists($path)) {
$access = explode(",", $page[$controller]["groups"]);
if (in_array($_SESSION["mwcapoints"], $access) || $_SESSION["mwcapoints"] == 1) {
if (!empty($page[$controller]["mname"]) && !empty($page[$controller]["mpath"])) {
$modelpath = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . $page[$controller]["mpath"] . DIRECTORY_SEPARATOR . $page[$controller]["mname"] . ".php";
require_once $path;
if (file_exists($modelpath)) {
require_once $modelpath;
$modelname = $page[$controller]["mname"];
} else {
$modelname = "Model";
$action_name = "showError";
$db->SQLog("model {$modelpath} wasn't found", "arouter", 3);
}
$model = new $modelname($db);
$contolinst = new $controller($model, $content, $page, $_SESSION["mwcserver"]);
$contolinst->init();
if (method_exists($controller, $action_name)) {
$contolinst->{$action_name}();
} else {
$contolinst->action_index();
$db->SQLog("action {$action_name} wasn't found for {$controller}", "arouter", 3);
}
$contolinst->parentOut($isBackground);
} else {
$model = new $globalcfg["defModel"]();
$contolinst = new $globalcfg["defController"]($model, $content, $page, $_SESSION["mwcserver"]);
if (method_exists($contolinst, $action_name) && $action_name != "action_index" && (in_array($_SESSION["mwcapoints"], $access) || $_SESSION["mwcapoints"] == 1)) {
$contolinst->{$action_name}();
} else {
$contolinst->genNonMVC($path);
}
$contolinst->parentOut($isBackground);
}
} else {
$model = new Model($db);
$contolinst = new Controller($model, $content, $page, $_SESSION["mwcserver"]);
$contolinst->init();
$contolinst->showError(2);
$contolinst->parentOut($isBackground);
if (!empty($_SESSION["mwcuid"])) {
$theGuy = $_SESSION["mwcuid"];
} else {
$theGuy = "?";
}
if (!empty($_SESSION["mwcauid"])) {
$theGuy = $_SESSION["mwcauid"];
}
$db->SQLog("user ({$theGuy}) try access to {$controller} but he hasn't access", "arouter", 6);
}
} else {
$model = new Model();
$contolinst = new Controller($model, $content, $page, $_SESSION["mwcserver"]);
$contolinst->init();
$contolinst->showError(3);
$contolinst->parentOut($isBackground);
$db->SQLog("controller '{$path}' wasn't found", "arouter", 1);
}
} else {
$model = new Model();
$contolinst = new Controller($model, $content, $page, $_SESSION["mwcserver"]);
$contolinst->init();
$contolinst->showError(3);
$contolinst->parentOut($isBackground);
$db->SQLog("controller '{$controller}' does't register in system", "arouter", 1);
}
//endregion
} catch (Exception $ex) {
$stack = $ex->getTrace();
$msg = $ex->getMessage() . " in file: " . basename($stack[3]["file"]) . " line: " . $stack[3]["line"];
self::addlog(tbuild . "_error", $msg, "log");
content::showError("Something went wrong", "please, check logs.");
}
}