本文整理汇总了PHP中Site::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::error方法的具体用法?PHP Site::error怎么用?PHP Site::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::error方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refreshCacheDir
function refreshCacheDir()
{
$dirTmp = Site::racine() . Config::getCacheDir() . 'Smarty/' . $this->templateName . '/';
if (!is_dir($dirTmp)) {
if (!mkdir($dirTmp, 0777, true)) {
Site::error('Impossible de creer le dossier de cache : ' . $dirTmp);
return false;
}
}
$this->cache_dir = $dirTmp;
return true;
}
示例2: prepare
public function prepare($_qry, $_options = NULL)
{
Debug::write("SQL prepare : " . $_qry, 2);
self::$count = self::$count + 1;
try {
// Should be caught through Site.class.php, but still... just in case
if ($_options === null) {
return parent::prepare($_qry);
} else {
return parent::prepare($_qry, $_options);
}
} catch (PDOException $e) {
Site::error(Site::app_error, "Database error", $GLOBALS['config']['security']['displayExplicitErrors'] === true ? $e->getMessage() : $GLOBALS['config']['errors']['framework']['503']);
}
}
示例3: Objekt
if ($site->fdat['id']) {
$site->debug->msg("EDIT: ID = " . $site->fdat['id']);
# $all_parents = $site->get_obj_all_parents($site->fdat['id']);
# echo "all_parents=".printr($all_parents);
$objekt = new Objekt(array(objekt_id => $site->fdat['id'], on_sisu => 1, no_cache => 1));
# kui objektil on rohkem, kui 1 parent, siis loodame objekti uuesti uue parentiga:
if ($objekt->all['parents_count'] > 1 && $objekt->parent_id != $site->fdat['parent_id']) {
$site->debug->msg("EDIT: Leidsin mitu parenti (" . $objekt->all['parents_count'] . "). Kasutan parent_id=" . $site->fdat['parent_id']);
unset($objekt);
$objekt = new Objekt(array(objekt_id => $site->fdat['id'], parent_id => $site->fdat['parent_id'], no_cache => 1, on_sisu => 1));
}
$tyyp['tyyp_id'] = $objekt->all['tyyp_id'];
$site->debug->msg("EDIT: " . $objekt->debug->get_msgs());
$site->debug->msg("EDIT: Tyyp_id detected: " . $tyyp['tyyp_id']);
if (!$objekt->objekt_id) {
$site->error("EDIT: Vale objekti ID");
}
} else {
# default parent for file (folder "public/")
if ($site->fdat['op'] == 'new' && $site->fdat['tyyp_id'] == 21 && !$site->fdat['parent_id']) {
# file object and no parent ID set
# get folder ID of "public/", Bug #2342
$sql = $site->db->prepare("SELECT objekt_id FROM obj_folder WHERE relative_path = ? LIMIT 1", $site->CONF['file_path']);
$sth = new SQL($sql);
$tmp = $sth->fetch();
$site->fdat['parent_id'] = $tmp['objekt_id'];
}
$parent_objekt = new Objekt(array(objekt_id => $site->fdat['parent_id'], no_cache => 1));
}
# / GET PARENT OBJECT
###################
示例4: findController
/**
* [From request, find what controller file is concerned]
*/
protected function findController()
{
self::$path_to_controller = CONTROLLERS_DIR;
// initialize path
if (!empty(self::$sections)) {
foreach (self::$sections as $section) {
if (is_dir(self::$path_to_controller . strtolower($section))) {
self::$path_to_controller .= strtolower($section) . "/";
} elseif (file_exists(self::$path_to_controller . ucwords(strtolower($section)) . ".class.php")) {
self::$controller_file_to_load = ucwords(strtolower($section)) . ".class.php";
} else {
if ($GLOBALS['config']['controller']['loadLastKnownController'] === false) {
Site::error(Site::HTTP_error, "404", $GLOBALS['config']['errors']['framework']['404']);
} else {
break;
}
}
}
}
if (empty(self::$controller_file_to_load)) {
self::$controller_file_to_load = "Index.class.php";
}
//TODO : change .class.php to .php if not poo
self::$controller_name_to_load = str_replace(".class.php", "", self::$controller_file_to_load);
}
示例5: display
/**
* [A kind of destructor.
* loads template, replace patterns and display the content to the web browser]
*/
public function display()
{
if (empty($this->template)) {
if (!isset($GLOBALS['config']['HTML']['template']) || empty($GLOBALS['config']['HTML']['template'])) {
Site::error(Site::app_error, "10", $GLOBALS['config']['errors']['framework']['10']);
} elseif (!is_dir(HTML_DIR . $GLOBALS['config']['HTML']['template'])) {
Site::error(Site::app_error, "11", $GLOBALS['config']['errors']['framework']['11']);
}
$this->template = HTML_DIR . $GLOBALS['config']['HTML']['template'] . "/" . $GLOBALS['config']['HTML']['template'] . ".template";
}
if (is_readable($this->template)) {
ob_start();
include $this->template;
$this->content = ob_get_clean();
} else {
Site::error(Site::app_error, "12", $GLOBALS['config']['errors']['framework']['12']);
}
if (empty($this->items)) {
Debug::write("No pattern to be replaced were found in this template !", 0);
}
$this->replaceDefaultUserContent();
$this->setLocaleContent("global");
if ($this->locale) {
$this->setLocaleContent($this->locale);
}
$this->replaceAllContent();
/**
* look for unreplaced patterns
*/
preg_match_all("/%%[^%]*%%/", $this->content, $ressources_config_file);
preg_match_all("/##[^#]*##/", $this->content, $ressources_locale);
$unreplaced_patterns = array_merge($ressources_locale[0], $ressources_config_file[0]);
if (!empty($unreplaced_patterns)) {
foreach ($unreplaced_patterns as $pattern) {
$current = "'" . $pattern . "' ";
$msg = empty($msg) ? $current : $msg . $current;
$this->setContent($pattern, "");
}
$msg = preg_replace("/%/", "", $msg);
Debug::write("One or several HTML field hasn't been replaced : " . htmlentities($msg), 0);
if (!isset($GLOBALS['config']['HTML']['view']['suppressUnmatchedPatterns']) || $GLOBALS['config']['HTML']['view']['suppressUnmatchedPatterns'] === true) {
$this->replaceAllContent();
}
//delete unreplaced patterns from HTML template
}
echo $this->content;
}
示例6: php_iniChecks
*/
if (isset($GLOBALS['config']['DEBUG']['enabled']) && $GLOBALS['config']['DEBUG']['enabled'] == true) {
Debug::build();
}
/**
* Security checks
* Keep in mind it just does a BASIC check on world-permission on files/folders under DOCUMENT_ROOT ; and a quick check on php.ini
*/
if ($GLOBALS['config']['security']['skipLocalChecks'] === false) {
//Setup
CoreController::startCapturing();
$successful_Check = true;
/**
* php.ini config
*/
echo "<u>Checking php.ini file ...</u><br />";
php_iniChecks();
echo "******************<br />";
/**
* File rights
*/
echo "<u>Checking file permissions ...</u><br />";
localSecurityChecks(ROOT_DIR);
// Can be found in FUNCTIONS_DIR . security.php
//Cleaning
$output = CoreController::stopCapturing();
if ($GLOBALS["successful_Check"] === false) {
Site::error(Site::app_error, "Some misconfiguration were detected. <br />Please fix them in order to run this framework safely", $output);
}
unset($successful_Check, $checks);
}