public function query($keyword, $index) { if ($error = $this->error()) { Error::showError($error, 3003); } $index = empty($index) ? '*' : $index; return self::$sphinx->query($keyword, $index); }
public function filterParam() { $data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : ''; unset($_GET, $_POST, $_SESSION, $_SERVER, $_COOKIE, $_FILES); $json = json_decode($data, true); if ($json) { return $json; } else { Error::showError("POST DATA EMPTY", 1001); } }
public function execute($sql) { $this->connect(); $result = mysql_query($sql, $this->dblink); if ($result == false) { Error::showError("Mysql Execute Error:" . mysql_error($this->dblink), 2004); } else { $numrows = mysql_affected_rows($this->dblink); $last_insid = mysql_insert_id($this->dblink); return $last_insid ? $last_insid : $numrows; } }
/** * return absolute path to selected template directory * @param string $path path to file from views folder * @param array $data array of data * @param string $custom path to template folder */ public static function renderTemplate($path, $data = false, $custom = false) { self::init(); if (!headers_sent()) { foreach (self::$headers as $header) { header($header, true); } } $file = "app/Templates/" . \HMC\Config::SITE_TEMPLATE() . "/{$path}.php"; if ($custom == false) { if (file_exists($file)) { require $file; } else { Logger::error('File (' . $file . ') was not found.'); Error::showError(500); die; } } else { require "app/Templates/{$custom}/{$path}.php"; } }
<?php if (@$magic != "0xDEADBEEF") { die("This file cannot be executed directly"); } if (@is_dir("setup")) { $error = new Error("Setup directory exists. You either haven't installed your guestbook, or forgot to delete the setup folder."); die($error->showError()); } if (!file_exists("data.php")) { $error = new Error("Data file doesn't exist. Have you installed your guestbook yet?"); die($error->showError()); } require_once 'configuration.php'; if ($config['offline']) { $error = new Error($config['offlineMessage']); die($error->showError()); } include_once 'classes/mobile/mobile.class.php'; if (Mobile::isMobile($_SERVER['HTTP_USER_AGENT'])) { $config['guestbookTheme'] = $config['mobileTheme']; }
function _getSegmentParamFile($segment) { $filePath = $this->_getCustomSegmentParamFile($segment); if (!is_file($filePath)) { Error::showError("切片数据文件 " . $segment . " 不存在"); } return $filePath; }
/** * 检查初始化配置是否定义 */ function _check() { if (!defined('APP_VIEWER') || !defined('APP_CONTROLLER')) { Error::showError("you shoule config APP_VIEWER|APP_CONTROLLER"); } }
public function field($table) { if (empty($this->field)) { Error::showError('Field Empty', 1005); } $newField = array(); $index = Config::$index; $cfield = $index[$table]; foreach ($this->field as $k => $v) { if (isset($cfield[$k])) { $newField[$k] = $v; } } return $newField; }