?? global.php
字號:
"FormCheck('\\1','\\2','\\3')",
$output
);
ob_end_clean();
echo ObContents($output);
ObFlush();
exit;
}
function FormCheck($pre,$url,$add){
return '<form'.stripslashes($pre).' action="'.EncodeUrl($url).'&"'.stripslashes($add).'>';
}
function EncodeUrl($url){
global $db_hash,$admin_name,$admin_gid;
$url_a = substr($url,strrpos($url,'?')+1);
$commer = '';
if (strpos($url,'&')!==false) {
substr($url,-1)!='&' && $commer = '&';
} else {
substr($url,-1)!='?' && $commer = '?';
}
parse_str($url_a,$url_a);
$source = '';
foreach ($url_a as $key => $value) {
$source .= $key.$value;
}
$url .= $commer.'verify='.substr(md5($source.$admin_name.$admin_gid.$db_hash),0,8);
return $url;
}
function PostCheck($verify){
global $db_hash,$admin_name,$admin_gid;
$source = '';
foreach ($_GET as $key => $value) {
$key!='verify' && $source .= $key.$value;
}
$verify!=substr(md5($source.$admin_name.$admin_gid.$db_hash),0,8) && usermsg('illegal_request');
return true;
}
function StrCode($string,$action='ENCODE'){
$key = substr(md5($_SERVER["HTTP_USER_AGENT"].$GLOBALS['db_hash']),8,18);
$action == 'DECODE' && $string = base64_decode($string);
$len = strlen($key); $code = '';
for ($i=0; $i<strlen($string); $i++) {
$k = $i % $len;
$code .= $string[$i] ^ $key[$k];
}
$action == 'ENCODE' && $code = base64_encode($code);
return $code;
}
function Pcv($filename,$ifcheck = true){
(preg_match('/http(s)?:\/\//i',$filename) || ($ifcheck && strpos($filename,'..')!==false)) && exit('Forbidden');
return $filename;
}
function Ipban(){
global $db_ipban,$onlineip;
if ($db_ipban) {
$baniparray = explode(',',$db_ipban);
foreach ($baniparray as $banip) {
if (!$banip) continue;
$banip = trim($banip);
(strpos(','.$onlineip.'.',','.$banip.'.')!==false) && usermsg('ip_ban');
}
}
return true;
}
function usermsg($msg,$jumpurl = null,$t = 2){
@extract($GLOBALS, EXTR_SKIP);
require_once GetLang('msg');
if ($msg == 'undefined_action') {
$jumpurl = $admin_file;
}
$lang[$msg] && $msg = $lang[$msg];
include PrintEot('usermsg');footer();
}
function GetCookie($Var){
return $_COOKIE[CookiePre().'_'.$Var];
}
function Cookie($ck_Var,$ck_Value,$ck_Time='F',$httponly = true){
global $timestamp,$db_ckpath,$db_ckdomain,$islocalhost;
if ($islocalhost) {
$db_ckpath = '/'; $db_ckdomain = '';
} else {
if (!$db_ckdomain) {
$pre_host = strtolower(substr($_SERVER['HTTP_HOST'],0,strpos($_SERVER['HTTP_HOST'],'.'))+1);
$db_ckdomain = substr($_SERVER['HTTP_HOST'],strpos($_SERVER['HTTP_HOST'],'.')+1);
$db_ckdomain = '.'.((strpos($db_ckdomain,'.')===false) ? $_SERVER['HTTP_HOST'] : $db_ckdomain);
if (strpos($B_url,$pre_host)!==false) {
$db_ckdomain = $pre_host.$db_ckdomain;
}
}
}
if ($ck_Time=='F') {
$ck_Time = $timestamp+31536000;
} else {
($ck_Value=='' && $ck_Time==0) && $ck_Time = $timestamp-31536000;
}
if (version_compare(PHP_VERSION, '5.2.0', '>=')) {
return setcookie(CookiePre().'_'.$ck_Var, $ck_Value, $ck_Time, $db_ckpath, $db_ckdomain, GetSecure(), $httponly);
} else {
return setcookie(CookiePre().'_'.$ck_Var, $ck_Value, $ck_Time, $db_ckpath.($httponly ? '; HttpOnly' : ''), $db_ckdomain, GetSecure());
}
}
function CookiePre(){
return substr(md5($GLOBALS['db_hash']),0,5);
}
function GetSecure(){
$https = array();
$_SERVER['REQUEST_URI'] && $https = @parse_url($_SERVER['REQUEST_URI']);
if (empty($https['scheme'])) {
if ($_SERVER['HTTP_SCHEME']) {
$https['scheme'] = $_SERVER['HTTP_SCHEME'];
} else {
$https['scheme'] = ($_SERVER['HTTPS'] && strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http';
}
}
if ($https['scheme'] == 'https'){
return true;
}
return false;
}
function GetLang($lang,$EXT='php'){
global $tplpath;
!file_exists(R_P."template/$tplpath/user/cp_lang_$lang.$EXT") && $tplpath = 'default';
return R_P."template/$tplpath/user/cp_lang_$lang.$EXT";
}
function PrintEot($template,$EXT="htm"){
global $tplpath;
!file_exists(R_P."template/$tplpath/user/$template.$EXT") && $tplpath = 'default';
return R_P."template/$tplpath/user/$template.$EXT";
}
function ObFlush(){
if (php_sapi_name() != 'apache2handler' && php_sapi_name() != 'apache2filter') {
ObGetMode() == 1 ? ob_flush() : flush();
}
return true;
}
function ObStart(){
ObGetMode() == 1 ? ob_start('ob_gzhandler') : ob_start();
return true;
}
function ObContents($output){
$returntext = $output;
if (ObGetMode() == 1 && function_exists('crc32') && function_exists('gzcompress') && $_SERVER['HTTP_ACCEPT_ENCODING']) {
$encoding = '';
if (strpos(' '.$_SERVER['HTTP_ACCEPT_ENCODING'],'x-gzip') !== false) {
$encoding = 'x-gzip';
}
if (strpos(' '.$_SERVER['HTTP_ACCEPT_ENCODING'],'gzip') !== false) {
$encoding = 'gzip';
}
if ($encoding) {
header('Content-Encoding: '.$encoding);
if (false && function_exists('gzencode')) {
$returntext = gzencode($output,1);
} else {
$size = strlen($output);
$crc = crc32($output);
$returntext = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff";
$returntext .= substr(gzcompress($output,1),2,-4);
$returntext .= pack('V', $crc);
$returntext .= pack('V', $size);
}
}
}
return $returntext;
}
function ObGetMode(){
global $ob_check;
$mode = 0;
if ($ob_check && $GLOBALS['db_obstart']==1 && function_exists('ob_gzhandler')) {
if (ini_get('output_handler') == 'ob_gzhandler') {
$mode = 0;
} elseif (function_exists('ob_get_level') && ob_get_level() > 0) {
$mode = 0;
} else {
$mode = 1;
}
}
return $mode;
}
function Strip_S(&$array){
if (is_array($array)) {
foreach ($array as $key => $value) {
if (!is_array($value)) {
$array[$key] = stripslashes($value);
} else {
Strip_S($array[$key]);
}
}
}
}
function Add_S(&$array){
if (is_array($array)) {
array_map('Add_S',&$array);
} else {
$array = addslashes($array);
}
}
function forumoption($catetype,$cid=''){
@include(D_P.'data/cache/forum_cache_'.$catetype.'.php');
$catetype = ${'_'.strtoupper($catetype)};
$forumcache = '';
foreach ($catetype as $value) {
$add = '';
$value['name'] = preg_replace("/\<(.+?)\>/eis",'',$value['name']);
for ($i=0;$i<$value['type'];$i++) {
$add .= '>';
}
$selected = ($cid && $value['cid'] == $cid) ? ' SELECTED' : '';
$forumcache .= '<option value="'.$value['cid'].'"'.$selected.'>'.$add.' '.$value['name'].'</option>';
}
return $forumcache;
}function itemtypeoption($uid,$type,$typeid=''){
global $db;
$itemtypeoption='';
$query = $db->query("SELECT typeid,name FROM pw_itemtype WHERE uid='$uid' AND type='$type' ORDER BY vieworder ASC");
while ($rt = $db->fetch_array($query)){
if($typeid && $rt['typeid'] == $typeid){
$itemtypeoption .= "<option value='$rt[typeid]' selected>$rt[name]</option>";
}else{
$itemtypeoption .= "<option value='$rt[typeid]'>$rt[name]</option>";
}
}
return $itemtypeoption;
}function ifcheck($var,$out){
global ${$out.'_Y'},${$out.'_N'};
empty($var) ? ${$out.'_N'}='CHECKED' : ${$out.'_Y'} = 'CHECKED';
}
function checkselid($selid){
if(is_array($selid)){
$extra=$ret='';
foreach($selid as $key => $value){
if(!is_numeric($value)) return;
$ret.=$extra.$value; $extra=',';
}
return $ret;
} else{
return;
}
}
function ObHeader($URL){
global $db_obstart,$db_blogurl,$db_htmifopen;
($db_htmifopen && strtolower(substr($URL,0,4))!='http') && $URL = $db_blogurl.'/'.$URL;
ob_end_clean();
if ($db_obstart) {
header('Location: '.$URL);exit;
} else {
ObStart();
echo '<meta http-equiv="refresh" content="0;url='.$URL.'">';exit;
}
}
function Showtruemsg($msg){
if (function_exists('usermsg')) {
usermsg($msg);
} elseif (function_exists('adminmsg')) {
adminmsg($msg);
} elseif (function_exists('Showmsg')) {
Showmsg($msg);
} else {
exit($msg);
}
}
function N_strireplace($search,$replace,$subject){
return function_exists('str_ireplace') ? str_ireplace($search,$replace,$subject) : preg_replace("/$search/i",$replace,$subject);
}
function N_stripos($haystack,$needle){
if (function_exists('stripos')) {
if (stripos($haystack,$needle)!==false) {
return true;
}
return false;
}
if (@preg_match("/$needle/i",$haystack)) {
return true;
}
return false;
}
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -