本文整理汇总了PHP中AZLib::check_uri方法的典型用法代码示例。如果您正苦于以下问题:PHP AZLib::check_uri方法的具体用法?PHP AZLib::check_uri怎么用?PHP AZLib::check_uri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AZLib
的用法示例。
在下文中一共展示了AZLib::check_uri方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_login
function check_login()
{
if (!User::is_login()) {
AZLib::check_uri();
Url::redirect_url('?page=sign_in&href=' . base64_encode(CGlobal::$query_string));
}
}
示例2: PostItem
function PostItem($row)
{
Module::Module($row);
if (User::is_login()) {
if (!User::have_permit(ADMIN_ITEM) || User::is_block()) {
Url::access_denied();
} else {
if (Url::get('cmd') == 'edit') {
if (Url::get('id')) {
require_once 'forms/EditItemForm.php';
$this->add_form(new EditItemForm());
return;
}
}
if (Url::get('cmd') != '') {
Url::redirect_current();
}
require_once 'forms/PostItemForm.php';
$this->add_form(new PostItemForm());
}
} else {
AZLib::check_uri();
Url::redirect_url('?page=sign_in&href=' . base64_encode(CGlobal::$query_string));
}
}
示例3: update_user_online
function update_user_online()
{
$user_id = isset($_SESSION['user_id']) ? (int) $_SESSION['user_id'] : 0;
$session_id = session_id();
$page = '';
$page_id = 0;
$user_name = isset($_SESSION['user_name']) ? $_SESSION['user_name'] : 0;
$login_type = isset($_SESSION['openid_url']) && $_SESSION['openid_url'] != '' ? 1 : 0;
$open_id = isset($_SESSION['openid_url']) && $_SESSION['openid_url'] != '' ? $_SESSION['openid_url'] : '';
if (class_exists('AZNet')) {
$page = AZNet::$page['name'];
$page_id = (int) AZNet::$page['id'];
}
if (($page == 'ItemDetail' || $page == 'item_detail') && isset($_GET['id']) && $_GET['id']) {
$item_id = (int) $_GET['id'];
} else {
$item_id = 0;
}
if (in_array(basename($_SERVER['PHP_SELF']), array('ebxml.php', 'ajax.php', 'captcha.php'))) {
$ref_url = '';
} else {
AZLib::check_uri();
$ref_url = CGlobal::$query_string;
}
$sql = "SELECT session_referer, page, page_id, item_id FROM " . _SESS_TABLE . " WHERE session_id = '{$session_id}'";
$result = DB::query($sql, __LINE__ . __FILE__);
if (mysql_num_rows($result)) {
$s_row = mysql_fetch_assoc($result);
} else {
$s_row = array();
}
if ($s_row) {
if ($ref_url == '' || in_array(basename($_SERVER['PHP_SELF']), array('ebxml.php', 'ajax.php', 'captcha.php'))) {
$ref_url = stripslashes($s_row['session_referer']);
}
if (!$page) {
$page = $s_row['page'];
}
if (!$page_id) {
$page_id = (int) $s_row['page_id'];
}
if (!$item_id) {
$item_id = (int) $s_row['item_id'];
}
$sql = "UPDATE " . _SESS_TABLE . " SET\r\n\t\t\t\t\t\t\t\t\t\t\t\t \tsession_expires = " . time() . ", \r\n\t\t\t\t\t\t\t\t\t\t\t\t \tsession_referer = '" . addslashes($ref_url) . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t \tsession_ip \t\t= '" . $_SERVER['SERVER_ADDR'] . '::' . $_SERVER['REMOTE_ADDR'] . "', \r\n\t\t\t\t\t\t\t\t\t\t\t\t \tpage \t\t\t= '{$page}',\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t \tpage_id \t\t= {$page_id},\r\n\t\t\t\t\t\t\t\t\t\t\t\t \tcategory_id \t= " . CGlobal::$curCategory . ",\r\n\t\t\t\t\t\t\t\t\t\t\t\t \titem_id \t\t= {$item_id},\r\n\t\t\t\t\t\t\t\t\t\t\t\t \tuser_id \t\t= '{$user_id}',\r\n\t\t\t\t\t\t\t\t\t\t\t\t \tuser_name\t\t= '{$user_name}',\r\n\t\t\t\t\t\t\t\t\t\t\t\t \tlogin_type\t\t= '{$login_type}',\r\n\t\t\t\t\t\t\t\t\t\t\t\t \topen_id\t\t\t= '{$open_id}'\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE session_id \t= '{$session_id}'";
} else {
$sql = "INSERT INTO " . _SESS_TABLE . " \r\n\t\t\t\t\t\t\t\t (\r\n\t\t\t\t\t\t\t\t \tsession_id, \r\n\t\t\t\t\t\t\t\t \tsession_expires, \r\n\t\t\t\t\t\t\t\t \tsession_referer, \r\n\t\t\t\t\t\t\t\t \tsession_ip, \r\n\t\t\t\t\t\t\t\t \tpage, \r\n\t\t\t\t\t\t\t\t \tpage_id, \r\n\t\t\t\t\t\t\t\t \tcategory_id, \r\n\t\t\t\t\t\t\t\t \titem_id, \r\n\t\t\t\t\t\t\t\t \tuser_id, \r\n\t\t\t\t\t\t\t\t \tuser_name,\r\n\t\t\t\t\t\t\t\t \tlogin_type,\r\n\t\t\t\t\t\t\t\t \topen_id\r\n\t\t\t\t\t\t\t\t \t) \r\n\t\t VALUES (\r\n\t\t \t\t\t'{$session_id}', \t\t\t\t\r\n\t\t \t\t\t" . time() . ", \t\t\t\r\n\t\t \t\t\t'" . addslashes($ref_url) . "', \t \r\n\t\t \t\t\t'" . $_SERVER['SERVER_ADDR'] . '::' . $_SERVER['REMOTE_ADDR'] . "',\t\r\n\t\t \t\t\t'{$page}',\t \r\n\t\t \t\t\t{$page_id},\t\t \r\n\t\t \t\t\t" . CGlobal::$curCategory . ", \t\t \r\n\t\t \t\t\t{$item_id}, \t \r\n\t\t \t\t\t{$user_id} ,\t\t\r\n\t\t \t\t\t'{$user_name}' ,\t\t\r\n\t\t \t\t\t{$login_type} ,\t\t\r\n\t\t \t\t\t'{$open_id}')";
}
DB::query($sql, __LINE__ . __FILE__);
if (User::is_login() && MEMCACHE_ON) {
$user = User::$current->data;
if ($user && !isset($user['last_login']) || isset($user['last_login']) && $user['last_login'] < TIME_NOW - 300) {
DB::query("UPDATE user SET last_login=" . TIME_NOW . " WHERE id={$user['id']}");
$user_memcache = AZMemcache::do_get("user:{$user['id']}");
if ($user_memcache) {
$user_memcache['last_login'] = TIME_NOW;
AZMemcache::do_put("user:{$user['id']}", $user_memcache);
}
}
}
if (StaticCache::notExistCache('del_exs', 1)) {
//Run 1 cronjob/15s
StaticCache::startCache();
StaticCache::endCache();
DB::query("DELETE FROM " . _SESS_TABLE . " WHERE session_expires <= " . (time() - _SESS_TIME_EXPIRE));
}
}
示例4: dirname
static function check_uri()
{
if (!self::$check_uri) {
CGlobal::$request_uri = $_SERVER['REQUEST_URI'];
if (isset($_SERVER['HTTP_REFERER'])) {
CGlobal::$referer_url = $_SERVER['HTTP_REFERER'];
}
CGlobal::$query_string = $_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '';
$dir = dirname($_SERVER['SCRIPT_NAME']) ? dirname($_SERVER['SCRIPT_NAME']) : '';
$dir = str_replace('\\', '/', $dir);
if ($dir && $dir != '/' && $dir != './') {
if ($dir[0] != '/') {
$dir = '/' . $dir;
}
$dir .= $dir[strlen($dir) - 1] != '/' ? '/' : '';
CGlobal::$query_string = str_replace($dir, '', CGlobal::$request_uri);
} else {
$uri = CGlobal::$request_uri;
if (strlen($uri) > 1) {
while ($uri[0] == '/') {
$uri = substr($uri, 1, strlen($uri) - 1);
}
CGlobal::$query_string = $uri;
unset($uri);
} else {
CGlobal::$query_string = '';
}
}
self::$check_uri = true;
}
}
示例5: draw
//.........这里部分代码省略.........
$display->add('topcats', $topcats);
$display->add('web_dir', WEB_DIR);
$display->add('DATA_PATH', DATA_PATH);
//Load Logo
//$test_time = mktime(0,0,0,11,26,2010);
AZLib::getWebsiteLogo();
if (CGlobal::$websiteLogo !== FALSE && isset(CGlobal::$websiteLogo['current']['expired']) && CGlobal::$websiteLogo['current']['expired'] && CGlobal::$websiteLogo['current']['expired'] < TIME_NOW) {
// Nếu Logo đang sử dụng đã hết hạn, lấy Logo còn hạn hoặc lấy Logo mặc định
AZLib::getWebsiteLogo(1);
}
$display->add('logo', CGlobal::$websiteLogo['current']);
$display->add('logos', CGlobal::$websiteLogo['logos']);
//Top menu
if (!isset($_SESSION['is_load_page_first'])) {
$_SESSION['is_load_page_first'] = 0;
}
$display->add('url_root', WEB_ROOT);
if (!User::is_login()) {
$num_mess = 0;
} else {
$num_mess = User::$current->data['total_pm'] > 0 ? User::$current->data['total_pm'] : 0;
}
if (User::id()) {
$display->add('user_id', User::id());
$user_name = User::$current->data['user_name'];
$display->add('user_name', $user_name);
}
$referer_login_url = '';
$yahoo_open_id_href = '';
$google_open_id_href = '';
if (isset($_SESSION['openid_url']) && $_SESSION['user_id'] != 0) {
$display->add('show_openid', FALSE);
} elseif (!User::is_az_team()) {
AZLib::check_uri();
$referer_login_url = base64_encode(CGlobal::$query_string);
$yahoo_open_id_href = OID_URL . 'index.html?openid_identifier=http://me.yahoo.com/&long_redirect=' . base64_encode(CGlobal::$query_string);
$google_open_id_href = OID_URL . 'index.html?openid_identifier=https://www.google.com/users/o8/id&long_redirect=' . base64_encode(CGlobal::$query_string);
$display->add('show_openid', TRUE);
}
$display->add('OID_URL', $yahoo_open_id_href);
$display->add('OID_URL_GOG', $google_open_id_href);
$display->add('referer_login_url', $referer_login_url);
$display->add('google_open_id_href', $google_open_id_href);
$display->add('yahoo_open_id_href', $yahoo_open_id_href);
$display->add('openid_on', OPENID_ON);
$display->add('num_mess', $num_mess);
$display->add('is_login', (int) User::is_login());
$display->add('is_admin', (int) User::is_az_team());
$display->add('is_admin_item', (int) User::have_permit(ADMIN_ITEM));
$display->add('is_root', User::is_root());
//End Top menu
$display->add('category_id', CGlobal::$curCategory);
$display->add('keywords', AZLib::cleanHtml(Url::get('keywords', '')));
$display->add('not_error_page', (int) (AZNet::$page['name'] != 'error'));
$display->add('is_load_page_first', $_SESSION['is_load_page_first']);
// Tỷ giá
AZLib::get_config();
//$exchange = CGlobal::$configs['exchange']['conf_val'];
//$display->add('exchange', number_format($exchange, 0, ',', '.'));
// End Tỷ giá
if ($_SESSION['is_load_page_first'] == 1) {
$_SESSION['is_load_page_first'] = 0;
}
//End of top menu
$curMainCat = CGlobal::$curMainCat;
$curLevel2Cat = CGlobal::$curLevel2Cat;
示例6: write
/**
* Write the session
* @param int session id
* @param string data of the session
*/
function write($session_id, $data)
{
$page = '';
$page_id = 0;
$user_id = isset($_SESSION['user_id']) ? (int) $_SESSION['user_id'] : 0;
$user_name = isset($_SESSION['user_name']) ? $_SESSION['user_name'] : 0;
$login_type = isset($_SESSION['openid_url']) && $_SESSION['openid_url'] != '' ? 1 : 0;
$open_id = isset($_SESSION['openid_url']) && $_SESSION['openid_url'] != '' ? $_SESSION['openid_url'] : '';
if (class_exists('AZNet')) {
$page = AZNet::$page['name'];
$page_id = (int) AZNet::$page['id'];
}
if (($page == 'ItemDetail' || $page == 'item_detail') && isset($_GET['id']) && $_GET['id']) {
$item_id = (int) $_GET['id'];
} else {
$item_id = 0;
}
if (in_array(basename($_SERVER['PHP_SELF']), array('ebxml.php', 'ajax.php', 'captcha.php'))) {
$ref_url = '';
} else {
AZLib::check_uri();
$ref_url = CGlobal::$query_string;
}
if ($this->data) {
if ($ref_url == '' || in_array(basename($_SERVER['PHP_SELF']), array('ebxml.php', 'ajax.php', 'captcha.php'))) {
$ref_url = stripslashes($this->data['session_referer']);
}
if (!$page) {
$page = $this->data['page'];
}
if (!$page_id) {
$page_id = (int) $this->data['page_id'];
}
if (!$item_id) {
$item_id = (int) $this->data['item_id'];
}
$sql = "UPDATE " . _SESS_TABLE . " SET\r\n\t\t\t\t\t\t\t\t\t\t\t \tsession_expires = " . TIME_NOW . ", \r\n\t\t\t\t\t\t\t\t\t\t\t \tsession_data \t= '{$data}',\r\n\t\t\t\t\t\t\t\t\t\t\t \tsession_referer = '" . addslashes($ref_url) . "',\r\n\t\t\t\t\t\t\t\t\t\t\t \tsession_ip \t\t= '" . $_SERVER['SERVER_ADDR'] . '::' . $_SERVER['REMOTE_ADDR'] . "', \r\n\t\t\t\t\t\t\t\t\t\t\t \tpage \t\t\t= '{$page}',\t\r\n\t\t\t\t\t\t\t\t\t\t\t \tpage_id \t\t= {$page_id},\r\n\t\t\t\t\t\t\t\t\t\t\t \tcategory_id \t= " . CGlobal::$curCategory . ",\r\n\t\t\t\t\t\t\t\t\t\t\t \titem_id \t\t= {$item_id},\r\n\t\t\t\t\t\t\t\t\t\t\t \tuser_id \t\t= '{$user_id}',\r\n\t\t\t\t\t\t\t\t\t\t\t \tuser_name\t\t= '{$user_name}',\r\n\t\t\t\t\t\t\t\t\t\t\t \tlogin_type\t\t= '{$login_type}',\r\n\t\t\t\t\t\t\t\t\t\t\t \topen_id\t\t\t= '{$open_id}'\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE session_id \t= '{$session_id}'";
} else {
$sql = "INSERT INTO " . _SESS_TABLE . " \r\n \t\t\t\t\t\t (\r\n \t\t\t\t\t\t \tsession_id, \r\n \t\t\t\t\t\t \tsession_expires, \r\n \t\t\t\t\t\t \tsession_data, \r\n \t\t\t\t\t\t \tsession_referer, \r\n \t\t\t\t\t\t \tsession_ip, \r\n \t\t\t\t\t\t \tpage, \r\n \t\t\t\t\t\t \tpage_id, \r\n \t\t\t\t\t\t \tcategory_id, \r\n \t\t\t\t\t\t \titem_id, \r\n \t\t\t\t\t\t \tuser_id, \r\n \t\t\t\t\t\t \tuser_name,\r\n\t\t\t\t\t\t\t \tlogin_type,\r\n\t\t\t\t\t\t\t \topen_id\r\n \t\t\t\t\t\t \t) \r\n VALUES (\r\n \t\t\t'{$session_id}', \t\t\t\t\r\n \t\t\t" . TIME_NOW . ", \t\t\t\r\n \t\t\t'{$data}', \t\t\t \r\n \t\t\t'" . addslashes($ref_url) . "', \t \r\n \t\t\t'" . $_SERVER['SERVER_ADDR'] . '::' . $_SERVER['REMOTE_ADDR'] . "',\t\r\n \t\t\t'{$page}',\t \r\n \t\t\t{$page_id},\t\t \r\n \t\t\t" . CGlobal::$curCategory . ", \t\t \r\n \t\t\t{$item_id}, \t \r\n \t\t\t{$user_id} ,\t\t\r\n \t\t\t'{$user_name}',\t\t\r\n\t \t\t\t{$login_type} ,\t\t\r\n\t \t\t\t'{$open_id}')";
}
$this->query($sql, __LINE__ . __FILE__);
if (User::is_login() && MEMCACHE_ON) {
//Nếu đã đăng nhập
$user = User::$current->data;
if ($user && !isset($user['last_login']) || isset($user['last_login']) && $user['last_login'] < TIME_NOW - 300) {
DB::query("UPDATE user SET last_login=" . TIME_NOW . " WHERE id={$user['id']}");
$user_memcache = AZMemcache::do_get("user:{$user['id']}");
if ($user_memcache) {
$user_memcache['last_login'] = TIME_NOW;
AZMemcache::do_put("user:{$user['id']}", $user_memcache);
}
}
}
if ($this->effect_rows) {
//if row was created, return true
return true;
}
return false;
//an unknown error occured
}