<?php
/* import other */
import('configure');
import('current');
import('rewrite');
import('utility');
import('mailer');
import('sms');
import('upgrade');
import('uc');
import('cron');
function template($tFile) {
global $INI;
if ( 0===strpos($tFile, 'manage') ) {
return __template($tFile);
}
if ($INI['skin']['template']) {
$templatedir = DIR_TEMPLATE. '/' . $INI['skin']['template'];
$checkfile = $templatedir . '/html_header.html';
if ( file_exists($checkfile) ) {
return __template($INI['skin']['template'].'/'.$tFile);
}
}
return __template($tFile);
}
function render($tFile, $vs=array()) {
ob_start();
foreach($GLOBALS AS $_k=>$_v) {
${$_k} = $_v;
}
foreach($vs AS $_k=>$_v) {
${$_k} = $_v;
}
include template($tFile);
return render_hook(ob_get_clean());
}
function render_hook($c) {
global $INI;
$c = preg_replace('#href="/#i', 'href="'.WEB_ROOT.'/', $c);
$c = preg_replace('#src="/#i', 'src="'.WEB_ROOT.'/', $c);
$c = preg_replace('#action="/#i', 'action="'.WEB_ROOT.'/', $c);
/* theme */
$page = strval($_SERVER['REQUEST_URI']);
if($INI['skin']['theme'] && !preg_match('#/manage/#i',$page)) {
$themedir = WWW_ROOT. '/static/theme/' . $INI['skin']['theme'];
$checkfile = $themedir. '/css/index.css';
if ( file_exists($checkfile) ) {
$c = preg_replace('#/static/css/#', "/static/theme/{$INI['skin']['theme']}/css/", $c);
$c = preg_replace('#/static/img/#', "/static/theme/{$INI['skin']['theme']}/img/", $c);
}
}
$c = preg_replace('#([\'\=\"]+)/static/#', "$1{$INI['system']['cssprefix']}/static/", $c);
if (strtolower(cookieget('locale','zh_cn'))=='zh_tw') {
require_once(DIR_FUNCTION . '/tradition.php');
$c = str_replace(explode('|',$_charset_simple), explode('|',$_charset_tradition),$c);
}
/* encode id */
$c = rewrite_hook($c);
$c = obscure_rep($c);
return $c;
}
function output_hook($c) {
global $INI;
if ( 0==abs(intval($INI['system']['gzip']))) die($c);
$HTTP_ACCEPT_ENCODING = $_SERVER["HTTP_ACCEPT_ENCODING"];
if( strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false )
$encoding = 'x-gzip';
else if( strpos($HTTP_ACCEPT_ENCODING,'gzip') !== false )
$encoding = 'gzip';
else $encoding == false;
if (function_exists('gzencode')&&$encoding) {
$c = gzencode($c);
header("Content-Encoding: {$encoding}");
}
$length = strlen($c);
header("Content-Length: {$length}");
die($c);
}
$lang_properties = array();
function I($key) {
global $lang_properties, $LC;
if (!$lang_properties) {
$ini = DIR_ROOT . '/i18n/' . $LC. '/properties.ini';
$lang_properties = Config::Instance($ini);
}
return isset($lang_properties[$key]) ?
$lang_properties[$key] : $key;
}
function json($data, $type='eval') {
$type = strtolower($type);
$allow = array('eval','alert','updater','dialog','mix', 'refresh');
if (false==in_array($type, $allow))
return false;
Output::Json(array( 'data' => $data, 'type' => $type,));
}
function redirect($url=null, $notice=null, $error=null) {
$url = $url ? obscure_rep($url) : $_SERVER['HTTP_REFERER'];
$url = $url ? $url : '/';
if ($notice) Session::Set('notice', $notice);
if ($error) Session::Set('error', $error);
header("Location: {$url}");
exit;
}
function write_php_file($array, $filename=null){
$v = "<?php\r\n\$INI = ";
$v .= var_export($array, true);
$v .=";\r\n?>";
return file_put_contents($filename, $v);
}
function write_ini_file($array, $filename=null){
$ok = null;
if ($filename) {
$s = ";;;;;;;;;;;;;;;;;;\r\n";
$s .= ";; SYS_INIFILE\r\n";
$s .= ";;;;;;;;;;;;;;;;;;\r\n";
}
foreach($array as $k=>$v) {
if(is_array($v)) {
if($k != $ok) {
$s .= "\r\n[{$k}]\r\n";
$ok = $k;
}
$s .= write_ini_file($v);
}else {
if(trim($v) != $v || strstr($v,"["))
$v = "\"{$v}\"";
$s .= "$k = \"{$v}\"\r\n";
}
}
if(!$filename) return $s;
return file_put_contents($filename, $s);
}
function save_config($type='ini') {
return configure_save();
global $INI; $q = ZSystem::GetSaveINI($INI);
if ( strtoupper($type) == 'INI' ) {
if (!is_writeable(SYS_INIFILE)) return false;
return write_ini_file($q, SYS_INIFILE);
}
if ( strtoupper($type) == 'PHP' ) {
if (!is_writeable(SYS_PHPFILE)) return false;
return write_php_file($q, SYS_PHPFILE);
}
return false;
}
function save_system($ini) {
$system = Table::Fetch('system', 1);
$ini = ZSystem::GetUnsetINI($ini);
$value = Utility::ExtraEncode($ini);
$table = new Table('system', array('value'=>$value));
if ( $system ) $table->SetPK('id', 1);
return $table->update(array( 'value'));
}
/* user relative */
function need_login($wap=false) {
if ( isset($_SESSION['user_id']) ) {
if (is_post()) {
unset($_SESSION['loginpage']);
unset($_SESSION['loginpagepost']);
}
return $_SESSION['user_id'];
}
if ( is_get() ) {
Session::Set('loginpage', $_SERVER['REQUEST_URI']);
} else {
Session::Set('loginpage', $_SERVER['HTTP_REFERER']);
Session::Set('loginpagepost', json_encode($_POST));
}
if (true===$wap) {
return redirect('login.php');
}
return redirect(WEB_ROOT . '/account/loginup.php');
}
function need_post() {
return is_post() ? true : redirect(WEB_ROOT . '/index.php');
}
function need_manager($super=false) {
if ( ! is_manager() ) {
redirect( WEB_ROOT . '/manage/login.php' );
}
if ( ! $super ) return true;
if ( abs(intval($_SESSION['user_id'])) == 1 ) return true;
return redirect( WEB_ROOT . '/manage/misc/index.php');
}
function need_partner() {
return is_partner() ? true : redirect( WEB_ROOT . '/biz/login.php');
}
function need_open($b=true) {
if (true===$b) {
return true;
}
if ($AJAX) json('本功能未开放', 'alert');
Session::Set('error', '你访问的功能页未开放');
redirect( WEB_ROOT . '/index.php');
}
function need_auth($b=true) {
global $AJAX, $INI, $login_user;
if (is_string($b)) {
$auths = $INI['authorization'][$login_user['id']];
$bs = explode('|', $b);
$b = is_manager(true);
if ($b) return true;
foreach($bs AS $bo) if(!$b) $b = in_array($bo, $auths);
}
if (true===$b) {
return true;
}
if ($AJAX) json('无权操作', 'alert');
die(include template('manage_misc_noright'));
}
function is_manager($super=false, $weak=false) {
global $login_user;
if ( $weak===false &&
( !$_SESSION['admin_id']
|| $_SESSION['admin_id'] != $login_user['id']) ) {
return false;
}
if ( ! $super ) return ($login_user['manager'] == 'Y');
return $login_user['id'] == 1;
}
function is_partner() {
return ($_SESSION['partner_id']>0);
}
function is_newbie(){ return (cookieget('newbie')!='N'); }
function is_get() { return ! is_post(); }
function is_post() {
return strtoupper($_SERVER['REQUEST_METHOD']) == 'POST';
}
function is_login() {
return isset($_SESSION['user_id']);
}
function get_loginpage($default=null) {
$loginpage = Session::Get('loginpage', true);
if ($loginpage) return $loginpage;
if ($default) return $default;
return WEB_ROOT . '/index.php';
}
function cookie_city($city) {
global $hotcities;
if($city) {
cookieset('city', $city['id']);
return $city;
}
$city_id = cookieget('city');
$city = Table::Fetch('category', $city_id);
if (!$city) $city = get_city();
if (!$city) $city = array_shift($hotcities);
if ($city) return cookie_city($city);
return $city;
}
function ename_city($ename=null) {
return DB::LimitQuery('category', array(
'condition' => array(
'zone' => 'city',
'ename' => $ename,
),
'one' => true,
));
}
function cookieset($k, $v, $expire=0) {
$pre = substr(md5($_SERVER['HTTP_HOST']),0,4);
$k = "{$pre}_{$k}";
if ($expire==0) {
$expire = time() + 365 * 86400;
} else {
$expire += time();
}
setCookie($k, $v, $expire, '/');
}
function cookieget($k, $default='') {
$pre = substr(md5($_SERVER['HTTP_HOST']),0,4);
$k = "{$pre}_{$k}";
return isset($_COOKIE[$k]) ? strval($_COOKIE[$k]) : $default;
}
function moneyit($k) {
return rtrim(rtrim(sprintf('%.2f',$k), '0
没有合适的资源?快使用搜索试试~ 我知道了~
最土团购最新补丁(三)
共53个文件
php:30个
html:16个
js:3个
需积分: 0 1 下载量 164 浏览量
2011-03-24
10:43:59
上传
评论
收藏 126KB RAR 举报
温馨提示
3.ZuituGo_Patch_CV2.0_1724_1768.rar
资源推荐
资源详情
资源评论
收起资源包目录
3.ZuituGo_Patch_CV2.0_1724_1768.rar (53个子文件)
rewrite
httpd.ini 199B
httpd.conf 182B
nginx.conf 197B
forum
new.php 923B
static
jssrc
customize.js 17KB
index.js 75KB
js
index.js 75KB
datepicker
My97DatePicker.htm 1KB
include
library
Image.class.php 3KB
application.php 2KB
template
block_block_captcha.html 474B
manage_system_option_a.html 2KB
order_view.html 5KB
manage_misc_index.html 2KB
manage_coupon_card.html 3KB
account_settings.html 7KB
account_signup.html 5KB
forum_new.html 2KB
block_side_score.html 581B
block_side_lastestcomment.html 1KB
feedback_seller.html 2KB
manage_tpl_smsvoucher.html 130B
manage_team_edit.html 12KB
credit_goods.html 2KB
team_multi.html 7KB
manage_team_editvoucher.html 3KB
function
sms.php 4KB
common.php 20KB
classes
ZCard.class.php 2KB
ZCoupon.class.php 2KB
ZVoucher.class.php 1KB
ZTeam.class.php 2KB
api
tuan800.php 3KB
360.php 4KB
baidu.php 2KB
ganji.php 2KB
sohu.php 2KB
tuanp.php 2KB
install.php 2KB
feedback
suggest.php 848B
seller.php 846B
ajax
validator.php 635B
manage.php 15KB
coupon.php 4KB
manage
system
upgrade.php 884B
misc
index.php 2KB
team
ajax.php 2KB
editvoucher.php 1KB
current.php 430B
account
ajax.php 790B
settings.php 2KB
signup.php 2KB
order
view.php 1KB
共 53 条
- 1
资源评论
tianxingxia_cn
- 粉丝: 1
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功