/** * 错误输出 * @param string $msg 提示内容 * @param string $url 跳转URL * @param int $time 跳转时间 * @param null $tpl 模板文件 */ protected function error($msg = '出错了', $url = NULL, $time = 2, $tpl = null) { if (IS_AJAX) { $this->_ajax(0, $msg); } else { parent::error($msg, $url, $time, $tpl); } }
public static function insert($vars) { if (is_array($vars)) { $ins = array('table' => 'options', 'name' => $vars['name'], 'value' => $vars['value']); $opt = Db::insert($ins); } else { Control::error('unknown', 'Format not Found, please in array'); } return $opt; }
public static function theme($var, $data = '') { if (isset($data)) { # code... $GLOBALS['data'] = $data; } if (self::exist($var)) { include GX_THEME . THEME . '/' . $var . '.php'; } else { Control::error('unknown', 'Theme file is missing.'); } }
/** * GxMain Admin Function. * This will load the backend controller. Secured, so to access it must be * logged in with a current privilege. Default privilege is 2. * * @author Puguh Wijayanto (www.metalgenix.com) * @since 0.0.1 */ public function admin() { Session::start(); User::secure(); System::gZip(); if (User::access(2)) { Control::handler('backend'); } else { Theme::admin('header'); Control::error('noaccess'); Theme::admin('footer'); } System::Zipped(); }
$Planche->setClient($client); socket_getpeername($client, $sClientIp, $nClientPort); $sRequestHeader = socket_read($client, 1024); $GET = http_parse_headers($sRequestHeader, 'GET'); $POST = http_parse_headers($sRequestHeader, 'POST'); $REQUEST = array_merge($GET, $POST); if ($REQUEST['URL'] == '/favicon.ico') { socket_close($client); continue; } if (@$REQUEST['PARAMS']['callback']) { //echo "JSON Callback : ".$REQUEST['PARAMS']['callback']."\n"; $Planche->setCallback($REQUEST['PARAMS']['callback']); } if (isset($REQUEST['PARAMS']) === false) { $Planche->error('Invalid request'); socket_close($client); continue; } if (isset($REQUEST['PARAMS']['cmd']) === false) { $Planche->error('Invalid request'); socket_close($client); continue; } extract(json_decode(base64_decode($REQUEST['PARAMS']['cmd']), true)); echo "Execute Query\n"; echo "Connect {$host}, {$user}, **************, {$db}\n"; if ($Planche->connect($host, $user, $pass, $db)) { echo "Connection Successful\n"; echo "The execution SQL is\n"; print_r($query);
/** * Database Query Function. * This will proccess database query. * * @param string $vars * * @author Puguh Wijayanto (www.metalgenix.com) * @since 0.0.1 */ public static function query($vars) { if (DB_DRIVER == 'mysql') { mysql_query('SET CHARACTER SET utf8'); $q = mysql_query($vars) or die(mysql_error()); } elseif (DB_DRIVER == 'mysqli') { self::$mysqli->set_charset("utf8"); $q = self::$mysqli->query($vars); if ($q === false) { Control::error('db', "Query failed: " . self::$mysqli->error . "<br />\n"); } } return $q; }
</a> on <?php echo Date::local($data['posts'][0]->date); ?> </span> </div> </div> </div> </div> </header> <!-- Post Content --> <article> <div class="container"> <div class="row"> <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> <?php if (isset($data['posts'][0]->title)) { foreach ($data['posts'] as $p) { # code... echo "\n <div class=\"\">\n " . Posts::content($p->content) . "\n </div>\n <hr />\n <div class=\"col-sm-12\">\n <div class=\"row\">\n <h3>Comments</h3>\n <div class=\"fb-comments\" data-href=\"http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}\" data-width=\"100%\" data-numposts=\"5\" data-colorscheme=\"light\"></div>\n </div>\n </div>\n "; } } else { //echo "Error, Post not found."; Control::error('404'); } ?> </div> </div> </div> </article>