本文整理汇总了PHP中G::fatalError方法的典型用法代码示例。如果您正苦于以下问题:PHP G::fatalError方法的具体用法?PHP G::fatalError怎么用?PHP G::fatalError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::fatalError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getArticles
public static function getArticles($limit)
{
$t_nodes = TABLE_ARTICLES;
$t_users = TABLE_USERS;
$query_str = "SELECT *," . "{$t_nodes}.id as id " . "FROM {$t_nodes} " . "LEFT JOIN {$t_users} ON {$t_nodes}.author_id = {$t_users}.id " . "ORDER BY created_time DESC " . ($limit > 0 ? "LIMIT {$limit}" : "");
$query = G::$db->query($query_str) or G::fatalError("ArticleUtils::getArticles() : " . DATABASE_ERROR_MESSAGE);
$list = $query->fetchAll(PDO::FETCH_ASSOC);
return $list;
}
示例2: initModule
private function initModule()
{
if (G::$user->isOrHigher(U_MODERATOR) && (!isset(G::$modules) || !is_array(G::$modules) || !count(G::$modules))) {
G::fatalError("AdminModulesManager::initOvertopBlock() : Modules' config had not been inited yet!");
}
if (!$this->currentModule) {
if (isset(G::$modules[$this->moduleLabel])) {
$this->moduleClassName = $className = G::$modules[$this->moduleLabel];
$adminModule = new $className();
if (!$adminModule instanceof iAdminModule) {
G::fatalError("PageData::getAdminPageItem() : Admin module (" . G::$modules[$this->moduleLabel] . " => " . $className . ") does not implement iAdminModule correct.");
}
}
$this->currentModule = $adminModule;
}
}
示例3: getAllCurrency
public static function getAllCurrency()
{
$entities = array();
$query = G::$db->query("SELECT * FROM " . TABLE_CURRENCY) or G::fatalError("PageUtils::getAllCurrency() -> " . DATABASE_ERROR_MESSAGE);
while ($row = $query->fetch()) {
$entities[$row["id"]] = $row;
}
return $entities;
}
示例4: getPathItems
/**
* Load titles of each path label
*/
public static function getPathItems($path_arr)
{
# TODO path items limit!
$path_items = array();
$t_cat = TABLE_CATALOGUE;
$addr = "'" . implode("','", $path_arr) . "'";
$query = G::$db->query("SELECT * FROM {$t_cat} WHERE label IN ({$addr})");
while ($row = $query->fetch()) {
$key = array_search($row["label"], $path_arr);
$path_items[$key] = $row;
}
if (count($path_arr) !== count($path_items)) {
# TODO redirect on 404
// DEBUG
G::fatalError("CatalogueUtils::getPathItems() : Some of items not found!");
//
}
return $path_items;
}
示例5: init
break;
case GET_CATEGORIES_TREE:
init("admin/catalogue");
// PageData load
G::$pageData->load();
if (G::$user->isOrHigher(U_MODERATOR)) {
include $_SERVER["DOCUMENT_ROOT"] . PATH_INCLUDES . "admin/admin_categories_tree.php";
} else {
echo "ACCESS DENIED";
}
die;
break;
case GET_POPUP_CONTENT:
$label = $_POST["label"];
if (!preg_match("/^\\/?admin\\/.*/", $label)) {
G::fatalError("Access denied!");
}
init($label);
// PageData load
G::$pageData->load();
$popup = new PopupManager($_POST["type"]);
$popup->renderPopupContent();
die;
break;
case UPLOAD_IMAGE:
init("admin/catalogue/product");
if (G::$user->isOrHigher(U_MODERATOR)) {
$data = AdminUtils::uploadProductImage($_FILES["file_browse"]);
G::logMessage($data["img_filename"]);
$data["result"] = true;
} else {
示例6: updateCatalogue
/** CREATE or UPDATE catalogue node
* @param $data - product\category data
* @return bool
*/
public function updateCatalogue($data)
{
// rename item_type (client vars conflict)
$data["type"] = $data["item_type"];
unset($data["item_type"]);
//
// parent_id
$validation = PageUtils::validatePageParam($data["parent_id"], "parent_id");
if (!$validation["result"]) {
G::fatalError("PARENT_ID is not valid");
}
unset($data["parent_id"]);
$parent_id = $validation["value"];
//
// images
//G::logMessage("IMAGES: " . "small=" . $data["img_small"] . "&medium=" . $data["img_medium"] . "&large=" . $data["img_large"]);
$data["image"] = "small=" . $data["img_small"] . "&medium=" . $data["img_medium"] . "&large=" . $data["img_large"];
unset($data["img_small"], $data["img_medium"], $data["img_large"]);
//
$data = $this->validatePageData($data, P_TYPE_CATALOGUE);
//check if label already exists
if (!$this->checkNewLabel($data["id"], $data["label"])) {
$this->errors[] = "Label already exists in another product";
}
$result = false;
if (count($this->errors) == 0) {
if (isset($data["id"])) {
// UPDATE PAGE
$result = CatalogueUtils::updateCatalogueNode($data["id"], $data);
$parents = CatalogueUtils::findParentsOf($data["id"]);
$parentAlreadyHasIt = false;
foreach ($parents as $parent) {
if ($parent["id"] != $parent_id) {
CatalogueUtils::deleteChildFromParent($data["id"], $parent["id"]);
} else {
$parentAlreadyHasIt = true;
}
}
if (!$parentAlreadyHasIt && $parent_id) {
CatalogueUtils::addChildToParent($data["id"], $parent_id);
}
} else {
// CREATE NEW NODE
$result = CatalogueUtils::createCatalogueNode($data, $parent_id);
}
// check db errors
if (intval(G::$db->errorCode()) != 0) {
$error_info = G::$db->errorInfo();
$text_error = " DB >> " . $error_info[1] . " > " . $error_info[2];
$this->errors[] = RenderUtils::renderError($text_error);
}
if (count($this->errors) == 0 && $result) {
//reinit
$this->init("catalogue/" . $data["label"]);
$this->load();
}
}
return $result;
}