Compare commits
21 Commits
33
UPDATE.md
Normal file
33
UPDATE.md
Normal file
@@ -0,0 +1,33 @@
|
||||
## PicHome Home1.0 更新说明
|
||||
|
||||
### 1.支持升级到团队版,可在站点设置->授权信息界面查看
|
||||
|
||||
### 2.billfish数据支持,修复billfish导入有回收站数据导致导入进度不能完成的问题
|
||||
|
||||
### 3.eagle数据支持,修复eagle导入更新数据时目录数据异常问题
|
||||
|
||||
### 4.eagle数据支持,修复eagle导入非图片文件缩略图变更后显示异常问题
|
||||
|
||||
### 5.普通目录数据支持,整体修改导入逻辑,修复导入错误,提升导入效率
|
||||
|
||||
### 6.优化导入体验,导入增加部分错误提示,修复导入时删除库不断弹出弹窗的错误,以及导入类型提示不匹配问题
|
||||
|
||||
### 7.导入增加校验更新,用于修复以往导入产生的错误修正
|
||||
|
||||
### 7.修复删除库错误,由数据兼容错误导致没有真正删除问题
|
||||
|
||||
### 8.增加文件访问永久地址获取(仅管理员可用)
|
||||
|
||||
### 9.文件访问地址使用动态地址增强安全性(非永久地址)
|
||||
|
||||
### 10.开放库筛选项设置,可在站点设置->筛选器设置中修改,支持标签分类作为单独筛选项展示;若库未设置筛选项,默认使用“全部库”筛选项,并依其变化而变化
|
||||
|
||||
### 11.修复分享的移动端问题
|
||||
|
||||
### 12.新增模板3(适用标签类筛选的内容)
|
||||
|
||||
### 13.优化访问效率
|
||||
|
||||
### 14.优化界面展示效果
|
||||
|
||||
### 15.其他已知bug修复
|
||||
28
admin.php
28
admin.php
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
define('IN_ADMIN', TRUE);
|
||||
define('NOROBOT', TRUE);
|
||||
define('ADMINSCRIPT', basename(__FILE__));
|
||||
define('BASESCRIPT', basename(__FILE__));
|
||||
define('CURSCRIPT', 'admin');
|
||||
define('APPTYPEID', 0);
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
define('IN_ADMIN', TRUE);
|
||||
define('NOROBOT', TRUE);
|
||||
define('ADMINSCRIPT', basename(__FILE__));
|
||||
define('BASESCRIPT', basename(__FILE__));
|
||||
define('CURSCRIPT', 'admin');
|
||||
define('APPTYPEID', 0);
|
||||
require __DIR__.'/core/adminstart.php';
|
||||
@@ -1,395 +1,395 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if(!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
function runquery($sql) {
|
||||
global $_G;
|
||||
$tablepre = $_G['config']['db'][1]['tablepre'];
|
||||
$dbcharset = $_G['config']['db'][1]['dbcharset'];
|
||||
|
||||
$sql = str_replace(array(' dzz_', ' `dzz_',' oaooa_', ' `oaooa_' ), array(' {tablepre}', ' `{tablepre}',' {tablepre}', ' `{tablepre}' ), $sql);
|
||||
|
||||
$sql = str_replace("\r", "\n", str_replace(array(' {tablepre}', ' `{tablepre}'), array(' '.$tablepre, ' `'.$tablepre), $sql));
|
||||
|
||||
$ret = array();
|
||||
$num = 0;
|
||||
foreach(explode(";\n", trim($sql)) as $query) {
|
||||
$queries = explode("\n", trim($query));
|
||||
foreach($queries as $query) {
|
||||
$ret[$num] .= $query[0] == '#' || $query[0].$query[1] == '--' ? '' : $query;
|
||||
}
|
||||
$num++;
|
||||
}
|
||||
unset($sql);
|
||||
|
||||
foreach($ret as $query) {
|
||||
$query = trim($query);
|
||||
if($query) {
|
||||
|
||||
if(substr($query, 0, 12) == 'CREATE TABLE') {
|
||||
$name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
|
||||
DB::query(createtable($query, $dbcharset));
|
||||
|
||||
} else {
|
||||
DB::query($query);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createtable($sql, $dbcharset) {
|
||||
$type = strtoupper(preg_replace("/^\s*CREATE TABLE\s+.+\s+\(.+?\).*(ENGINE|TYPE)\s*=\s*([a-z]+?).*$/isU", "\\2", $sql));
|
||||
$type = in_array($type, array('MYISAM', 'HEAP')) ? $type : 'MYISAM';
|
||||
return preg_replace("/^\s*(CREATE TABLE\s+.+\s+\(.+?\)).*$/isU", "\\1", $sql).
|
||||
( " ENGINE=$type DEFAULT CHARSET=$dbcharset");
|
||||
}
|
||||
|
||||
function cron_create($app, $filename='', $name='', $weekday=-1, $day=-1, $hour=-1, $minute=-1) {
|
||||
$pluginid = $app['identifier'];
|
||||
$app_path = $app['app_path'];
|
||||
if(!ispluginkey($pluginid)) {
|
||||
return false;
|
||||
}
|
||||
$dir = DZZ_ROOT.'./'.$app_path.'/'.$pluginid.'/cron';
|
||||
if(!file_exists($dir)) {
|
||||
return false;
|
||||
}
|
||||
$crondir = dir($dir);
|
||||
while($filename = $crondir->read()) {
|
||||
if(!in_array($filename, array('.', '..')) && preg_match("/^cron\_[\w\.]+$/", $filename)) {
|
||||
$content = file_get_contents($dir.'/'.$filename);
|
||||
preg_match("/cronname\:(.+?)\n/", $content, $r);$name = trim($r[1]);
|
||||
preg_match("/week\:(.+?)\n/", $content, $r);$weekday = trim($r[1]) ? intval($r[1]) : -1;
|
||||
preg_match("/day\:(.+?)\n/", $content, $r);$day = trim($r[1]) ? intval($r[1]) : -1;
|
||||
preg_match("/hour\:(.+?)\n/", $content, $r);$hour = trim($r[1]) ? intval($r[1]) : -1;
|
||||
preg_match("/minute\:(.+?)\n/", $content, $r);$minute = trim($r[1]) ? trim($r[1]) : 0;
|
||||
$minutenew = explode(',', $minute);
|
||||
foreach($minutenew as $key => $val) {
|
||||
$minutenew[$key] = $val = intval($val);
|
||||
if($val < 0 || $var > 59) {
|
||||
unset($minutenew[$key]);
|
||||
}
|
||||
}
|
||||
$minutenew = array_slice(array_unique($minutenew), 0, 12);
|
||||
$minutenew = implode("\t", $minutenew);
|
||||
$filename = $app_path.':'.$pluginid.':'.$filename;
|
||||
$cronid = C::t('cron')->get_cronid_by_filename($filename);
|
||||
if(!$cronid) {
|
||||
C::t('cron')->insert(array(
|
||||
'available' => 1,
|
||||
'type' => 'app',
|
||||
'name' => $name,
|
||||
'filename' => $filename,
|
||||
'weekday' => $weekday,
|
||||
'day' => $day,
|
||||
'hour' => $hour,
|
||||
'minute' => $minutenew,
|
||||
), true);
|
||||
} else {
|
||||
C::t('cron')->update($cronid, array(
|
||||
'name' => $name,
|
||||
'weekday' => $weekday,
|
||||
'day' => $day,
|
||||
'hour' => $hour,
|
||||
'minute' => $minutenew,
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cron_delete($app) {
|
||||
$pluginid = $app['identifier'];
|
||||
$app_path = $app['app_path'];
|
||||
|
||||
if(!ispluginkey($pluginid)) {
|
||||
return false;
|
||||
}
|
||||
$dir = DZZ_ROOT.'./'.$app_path.'/'.$pluginid.'/cron';
|
||||
if(!file_exists($dir)) {
|
||||
return false;
|
||||
}
|
||||
$crondir = dir($dir);
|
||||
$count = 0;
|
||||
while($filename = $crondir->read()) {
|
||||
if(!in_array($filename, array('.', '..')) && preg_match("/^cron\_[\w\.]+$/", $filename)) {
|
||||
$filename = $app_path.':'.$pluginid.':'.$filename;
|
||||
$cronid = C::t('cron')->get_cronid_by_filename($filename);
|
||||
C::t('cron')->delete($cronid);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
function isplugindir($dir) {
|
||||
return preg_match("/^[a-z]+[a-z0-9_]*\/$/", $dir);
|
||||
}
|
||||
|
||||
function ispluginkey($key) {
|
||||
return preg_match("/^[a-z]+[a-z0-9_]*$/i", $key);
|
||||
}
|
||||
|
||||
function dir_writeable($dir) {
|
||||
if(!is_dir($dir)) {
|
||||
@mkdir($dir, 0777);
|
||||
}
|
||||
if(is_dir($dir)) {
|
||||
if($fp = @fopen("$dir/test.txt", 'w')) {
|
||||
@fclose($fp);
|
||||
@unlink("$dir/test.txt");
|
||||
$writeable = 1;
|
||||
} else {
|
||||
$writeable = 0;
|
||||
}
|
||||
}
|
||||
return $writeable;
|
||||
}
|
||||
|
||||
|
||||
function exportdata($name, $filename, $data) {
|
||||
global $_G;
|
||||
require_once libfile('class/xml');
|
||||
$root = array(
|
||||
'Title' => $name,
|
||||
'Version' => $_G['setting']['version'],
|
||||
'Time' => dgmdate(TIMESTAMP, 'Y-m-d H:i'),
|
||||
'From' => $_G['setting']['bbname'].' ('.$_G['siteurl'].')',
|
||||
'Data' => exportarray($data, 1)
|
||||
);
|
||||
$filename = strtolower(str_replace(array('!', ' '), array('', '_'), $name)).'_'.$filename.'.xml';
|
||||
$plugin_export = array2xml($root, 1);
|
||||
ob_end_clean();
|
||||
dheader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
dheader('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
dheader('Cache-Control: no-cache, must-revalidate');
|
||||
dheader('Pragma: no-cache');
|
||||
dheader('Content-Encoding: none');
|
||||
dheader('Content-Length: '.strlen($plugin_export));
|
||||
dheader('Content-Disposition: attachment; filename='.$filename);
|
||||
dheader('Content-Type: text/xml');
|
||||
echo $plugin_export;
|
||||
define('FOOTERDISABLED' , 1);
|
||||
exit();
|
||||
}
|
||||
|
||||
function imagetobase64($file){
|
||||
$type=getimagesize($file);//取得图片的大小,类型等
|
||||
$fp=fopen($file,"r")or die("Can't open file");
|
||||
$file_content=chunk_split(base64_encode(fread($fp,filesize($file))));//base64编码
|
||||
switch($type[2]){//判读图片类型
|
||||
case 1:$img_type="gif";break;
|
||||
case 2:$img_type="jpg";break;
|
||||
case 3:$img_type="png";break;
|
||||
}
|
||||
$img='data:image/'.$img_type.';base64,'.$file_content;//合成图片的base64编码
|
||||
fclose($fp);
|
||||
return $img;
|
||||
}
|
||||
function base64toimage($data,$dir='appimg',$target=''){
|
||||
global $_G;
|
||||
$dataarr=explode(',',$data);
|
||||
$imgcontent=base64_decode($dataarr[1]);
|
||||
$imgext=str_replace(array('data:image/',';base64'),'',$dataarr[0]);
|
||||
if(!$target) {
|
||||
$imageext=array('jpg','jpeg','png','gif');
|
||||
if(!in_array($imgext,$imageext)) $ext='jpg';
|
||||
$subdir = $subdir1 = $subdir2 = '';
|
||||
$subdir1 = date('Ym');
|
||||
$subdir2 = date('d');
|
||||
$subdir = $subdir1.'/'.$subdir2.'/';
|
||||
$target1=$_G['setting']['attachdir'].$dir.'/'.$subdir.''.date('His').''.strtolower(random(16)).'.'.$imgext;
|
||||
$target=str_replace($_G['setting']['attachdir'],'',$target1);
|
||||
}else{
|
||||
$target1=$_G['setting']['attachdir'].$target;
|
||||
}
|
||||
$targetpath = dirname($target1);
|
||||
dmkdir($targetpath);
|
||||
if(file_put_contents($target1, $imgcontent)){
|
||||
if(@filesize($target1)<200) {
|
||||
@unlink($target1);
|
||||
return false;
|
||||
}
|
||||
return $target;
|
||||
}else return false;
|
||||
}
|
||||
function importByarray($arr,$force=0){
|
||||
$app=$arr['app'];
|
||||
//判断应用是否已经存在
|
||||
$oapp=DB::fetch_first("select * from %t where identifier=%s and app_path=%s ",array('app_market', $app['identifier'],$app['app_path']));
|
||||
if(!$force && $oapp){
|
||||
showmessage('application_been');
|
||||
}
|
||||
|
||||
//转化应用图标
|
||||
if($app['appico']){
|
||||
$app['appico']=base64toimage($app['appico'],'appico');
|
||||
}
|
||||
|
||||
$app['extra']=serialize($app['extra']);
|
||||
|
||||
if($oapp){
|
||||
$appid=$oapp['appid'];
|
||||
C::t('app_market')->update($appid,$app);
|
||||
}else{
|
||||
$app['available']=0;
|
||||
$appid=$app['appid']=C::t('app_market')->insert($app,1);
|
||||
}
|
||||
if($arr['hooks']){//初始化钩子
|
||||
C::t('hooks')->insert_by_appid($appid,$arr['hooks'],$arr['_attributes']['hooks']);
|
||||
}
|
||||
if($appid){
|
||||
C::t('app_open')->insert_by_exts($appid,($app['fileext']?explode(',',$app['fileext']):array()));
|
||||
C::t('app_tag')->addtags(($app['tag']?explode(',',$app['tag']):array()),$appid);
|
||||
}
|
||||
return $app;
|
||||
}
|
||||
function upgradeinformation($status = 0) {
|
||||
global $_G, $upgrade_step;
|
||||
|
||||
if(empty($upgrade_step)) {
|
||||
return '';
|
||||
}
|
||||
if($status==1 && $upgrade_step['step']==2) return '';
|
||||
$update = array();
|
||||
$siteuniqueid = C::t('setting')->fetch('siteuniqueid');
|
||||
$update['siteurl']=$_G['siteurl'];
|
||||
$update['sitename']=$_G['setting']['sitename'];
|
||||
$update['uniqueid'] = $siteuniqueid;
|
||||
$update['curversion'] = $upgrade_step['curversion'];
|
||||
$update['currelease'] = $upgrade_step['currelease'];
|
||||
$update['upgradeversion'] = $upgrade_step['version'];
|
||||
$update['upgraderelease'] = $upgrade_step['release'];
|
||||
$update['step'] = $upgrade_step['step'] == 'dbupdate' ? 4 : $upgrade_step['step'];
|
||||
$update['status'] = $status;
|
||||
$update['version_level'] = CORE_VERSION_LEVEL;
|
||||
|
||||
$data = '';
|
||||
foreach($update as $key => $value) {
|
||||
$data .= $key.'='.rawurlencode($value).'&';
|
||||
}
|
||||
$upgradeurl = APP_CHECK_URL."market/system/upgrade/".rawurlencode(base64_encode($data))."/".TIMESTAMP;
|
||||
dfsockopen($upgradeurl,0, '', '', FALSE, '',0.2);
|
||||
return '';
|
||||
//return '<img src="'.$upgradeurl.'" width="0" height="0" />';
|
||||
}
|
||||
|
||||
function upgradeinformation_app($status = 0) {
|
||||
global $_G, $appinfo;
|
||||
if(empty($appinfo)) {
|
||||
return '';
|
||||
}else{
|
||||
if( isset($appinfo['upgradeinfo']) ){
|
||||
$lastversion=$appinfo['upgradeinfo']['version'];
|
||||
$mid=$appinfo['upgradeinfo']['mid'];
|
||||
}else{
|
||||
$lastversion=$appinfo['version'];
|
||||
$mid=$appinfo['mid'];
|
||||
}
|
||||
}
|
||||
if($status==0) return '';
|
||||
$update = array();
|
||||
$siteuniqueid = C::t('setting')->fetch('siteuniqueid');
|
||||
$update['siteurl']=$_G['siteurl'];
|
||||
$update['sitename']=$_G['setting']['sitename'];
|
||||
$update['uniqueid'] = $siteuniqueid;
|
||||
$update['mid'] = $mid;
|
||||
$update['curversion'] = $appinfo['version'];
|
||||
$update['lastversion'] = $lastversion;
|
||||
$update['identifier'] = $appinfo['identifier'];
|
||||
$update['lastversion'] = $lastversion;
|
||||
$update['status'] = $status;
|
||||
$update['version_level'] = CORE_VERSION_LEVEL;
|
||||
|
||||
$data = '';
|
||||
foreach($update as $key => $value) {
|
||||
$data .= $key.'='.rawurlencode($value).'&';
|
||||
}
|
||||
$upgradeurl=APP_CHECK_URL."market/appinstall/".rawurlencode(base64_encode($data)); //APP_CHECK_URL."index.php?mod=dzzmarket&op=installinfo&data=".rawurlencode(base64_encode($data)).'×tamp='.TIMESTAMP;
|
||||
dfsockopen($upgradeurl,0, '', '', FALSE, '',0.2);
|
||||
return '';
|
||||
//return '<img src="'.$upgradeurl.'" width="0" height="0" />';
|
||||
}
|
||||
|
||||
function getwheres($intkeys, $strkeys, $randkeys, $likekeys, $pre='') {
|
||||
|
||||
$wherearr = array();
|
||||
$urls = array();
|
||||
|
||||
foreach ($intkeys as $var) {
|
||||
$value = isset($_GET[$var])?$_GET[$var]:'';
|
||||
if(strlen($value)) {
|
||||
$urls[] = "$var=$value";
|
||||
$var = addslashes($var);
|
||||
$wherearr[] = "{$pre}{$var}='".intval($value)."'";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($strkeys as $var) {
|
||||
$value = isset($_GET[$var])?trim($_GET[$var]):'';
|
||||
if(strlen($value)) {
|
||||
$urls[] = "$var=".rawurlencode($value);
|
||||
$var = addslashes($var);
|
||||
$value = addslashes($value);
|
||||
$wherearr[] = "{$pre}{$var}='$value'";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($randkeys as $vars) {
|
||||
$value1 = isset($_GET[$vars[1].'1'])?$vars[0]($_GET[$vars[1].'1']):'';
|
||||
$value2 = isset($_GET[$vars[1].'2'])?$vars[0]($_GET[$vars[1].'2']):'';
|
||||
if($value1) {
|
||||
$urls[] = "{$vars[1]}1=".rawurlencode($_GET[$vars[1].'1']);
|
||||
$vars[1] = addslashes($vars[1]);
|
||||
$value1 = addslashes($value1);
|
||||
$wherearr[] = "{$pre}{$vars[1]}>='$value1'";
|
||||
}
|
||||
if($value2) {
|
||||
$wherearr[] = "{$pre}{$vars[1]}<='$value2'";
|
||||
$vars[2] = addslashes($vars[2]);
|
||||
$value2 = addslashes($value2);
|
||||
$urls[] = "{$vars[1]}2=".rawurlencode($_GET[$vars[1].'2']);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($likekeys as $var) {
|
||||
$value = isset($_GET[$var])?stripsearchkey($_GET[$var]):'';
|
||||
if(strlen($value)>1) {
|
||||
$urls[] = "$var=".rawurlencode($_GET[$var]);
|
||||
$var = addslashes($var);
|
||||
$value = addslashes($value);
|
||||
$wherearr[] = "{$pre}{$var} LIKE BINARY '%$value%'";
|
||||
}
|
||||
}
|
||||
|
||||
return array('wherearr'=>$wherearr, 'urls'=>$urls);
|
||||
}
|
||||
|
||||
function getorders($alloworders, $default, $pre='') {
|
||||
$orders = array('sql'=>'', 'urls'=>array());
|
||||
if(empty($_GET['orderby']) || !in_array($_GET['orderby'], $alloworders)) {
|
||||
$_GET['orderby'] = $default;
|
||||
if(empty($_GET['ordersc'])) $_GET['ordersc'] = 'desc';
|
||||
}
|
||||
|
||||
$orders['sql'] = " ORDER BY {$pre}$_GET[orderby] ";
|
||||
$orders['urls'][] = "orderby=$_GET[orderby]";
|
||||
|
||||
if(!empty($_GET['ordersc']) && $_GET['ordersc'] == 'desc') {
|
||||
$orders['urls'][] = 'ordersc=desc';
|
||||
$orders['sql'] .= ' DESC ';
|
||||
} else {
|
||||
$orders['urls'][] = 'ordersc=asc';
|
||||
}
|
||||
return $orders;
|
||||
}
|
||||
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if(!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
function runquery($sql) {
|
||||
global $_G;
|
||||
$tablepre = $_G['config']['db'][1]['tablepre'];
|
||||
$dbcharset = $_G['config']['db'][1]['dbcharset'];
|
||||
|
||||
$sql = str_replace(array(' dzz_', ' `dzz_',' oaooa_', ' `oaooa_' ), array(' {tablepre}', ' `{tablepre}',' {tablepre}', ' `{tablepre}' ), $sql);
|
||||
|
||||
$sql = str_replace("\r", "\n", str_replace(array(' {tablepre}', ' `{tablepre}'), array(' '.$tablepre, ' `'.$tablepre), $sql));
|
||||
|
||||
$ret = array();
|
||||
$num = 0;
|
||||
foreach(explode(";\n", trim($sql)) as $query) {
|
||||
$queries = explode("\n", trim($query));
|
||||
foreach($queries as $query) {
|
||||
$ret[$num] .= $query[0] == '#' || $query[0].$query[1] == '--' ? '' : $query;
|
||||
}
|
||||
$num++;
|
||||
}
|
||||
unset($sql);
|
||||
|
||||
foreach($ret as $query) {
|
||||
$query = trim($query);
|
||||
if($query) {
|
||||
|
||||
if(substr($query, 0, 12) == 'CREATE TABLE') {
|
||||
$name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
|
||||
DB::query(createtable($query, $dbcharset));
|
||||
|
||||
} else {
|
||||
DB::query($query);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createtable($sql, $dbcharset) {
|
||||
$type = strtoupper(preg_replace("/^\s*CREATE TABLE\s+.+\s+\(.+?\).*(ENGINE|TYPE)\s*=\s*([a-z]+?).*$/isU", "\\2", $sql));
|
||||
$type = in_array($type, array('MYISAM', 'HEAP')) ? $type : 'MYISAM';
|
||||
return preg_replace("/^\s*(CREATE TABLE\s+.+\s+\(.+?\)).*$/isU", "\\1", $sql).
|
||||
( " ENGINE=$type DEFAULT CHARSET=$dbcharset");
|
||||
}
|
||||
|
||||
function cron_create($app, $filename='', $name='', $weekday=-1, $day=-1, $hour=-1, $minute=-1) {
|
||||
$pluginid = $app['identifier'];
|
||||
$app_path = $app['app_path'];
|
||||
if(!ispluginkey($pluginid)) {
|
||||
return false;
|
||||
}
|
||||
$dir = DZZ_ROOT.'./'.$app_path.'/'.$pluginid.'/cron';
|
||||
if(!file_exists($dir)) {
|
||||
return false;
|
||||
}
|
||||
$crondir = dir($dir);
|
||||
while($filename = $crondir->read()) {
|
||||
if(!in_array($filename, array('.', '..')) && preg_match("/^cron\_[\w\.]+$/", $filename)) {
|
||||
$content = file_get_contents($dir.'/'.$filename);
|
||||
preg_match("/cronname\:(.+?)\n/", $content, $r);$name = trim($r[1]);
|
||||
preg_match("/week\:(.+?)\n/", $content, $r);$weekday = trim($r[1]) ? intval($r[1]) : -1;
|
||||
preg_match("/day\:(.+?)\n/", $content, $r);$day = trim($r[1]) ? intval($r[1]) : -1;
|
||||
preg_match("/hour\:(.+?)\n/", $content, $r);$hour = trim($r[1]) ? intval($r[1]) : -1;
|
||||
preg_match("/minute\:(.+?)\n/", $content, $r);$minute = trim($r[1]) ? trim($r[1]) : 0;
|
||||
$minutenew = explode(',', $minute);
|
||||
foreach($minutenew as $key => $val) {
|
||||
$minutenew[$key] = $val = intval($val);
|
||||
if($val < 0 || $var > 59) {
|
||||
unset($minutenew[$key]);
|
||||
}
|
||||
}
|
||||
$minutenew = array_slice(array_unique($minutenew), 0, 12);
|
||||
$minutenew = implode("\t", $minutenew);
|
||||
$filename = $app_path.':'.$pluginid.':'.$filename;
|
||||
$cronid = C::t('cron')->get_cronid_by_filename($filename);
|
||||
if(!$cronid) {
|
||||
C::t('cron')->insert(array(
|
||||
'available' => 1,
|
||||
'type' => 'app',
|
||||
'name' => $name,
|
||||
'filename' => $filename,
|
||||
'weekday' => $weekday,
|
||||
'day' => $day,
|
||||
'hour' => $hour,
|
||||
'minute' => $minutenew,
|
||||
), true);
|
||||
} else {
|
||||
C::t('cron')->update($cronid, array(
|
||||
'name' => $name,
|
||||
'weekday' => $weekday,
|
||||
'day' => $day,
|
||||
'hour' => $hour,
|
||||
'minute' => $minutenew,
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cron_delete($app) {
|
||||
$pluginid = $app['identifier'];
|
||||
$app_path = $app['app_path'];
|
||||
|
||||
if(!ispluginkey($pluginid)) {
|
||||
return false;
|
||||
}
|
||||
$dir = DZZ_ROOT.'./'.$app_path.'/'.$pluginid.'/cron';
|
||||
if(!file_exists($dir)) {
|
||||
return false;
|
||||
}
|
||||
$crondir = dir($dir);
|
||||
$count = 0;
|
||||
while($filename = $crondir->read()) {
|
||||
if(!in_array($filename, array('.', '..')) && preg_match("/^cron\_[\w\.]+$/", $filename)) {
|
||||
$filename = $app_path.':'.$pluginid.':'.$filename;
|
||||
$cronid = C::t('cron')->get_cronid_by_filename($filename);
|
||||
C::t('cron')->delete($cronid);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
function isplugindir($dir) {
|
||||
return preg_match("/^[a-z]+[a-z0-9_]*\/$/", $dir);
|
||||
}
|
||||
|
||||
function ispluginkey($key) {
|
||||
return preg_match("/^[a-z]+[a-z0-9_]*$/i", $key);
|
||||
}
|
||||
|
||||
function dir_writeable($dir) {
|
||||
if(!is_dir($dir)) {
|
||||
@mkdir($dir, 0777);
|
||||
}
|
||||
if(is_dir($dir)) {
|
||||
if($fp = @fopen("$dir/test.txt", 'w')) {
|
||||
@fclose($fp);
|
||||
@unlink("$dir/test.txt");
|
||||
$writeable = 1;
|
||||
} else {
|
||||
$writeable = 0;
|
||||
}
|
||||
}
|
||||
return $writeable;
|
||||
}
|
||||
|
||||
|
||||
function exportdata($name, $filename, $data) {
|
||||
global $_G;
|
||||
require_once libfile('class/xml');
|
||||
$root = array(
|
||||
'Title' => $name,
|
||||
'Version' => $_G['setting']['version'],
|
||||
'Time' => dgmdate(TIMESTAMP, 'Y-m-d H:i'),
|
||||
'From' => $_G['setting']['bbname'].' ('.$_G['siteurl'].')',
|
||||
'Data' => exportarray($data, 1)
|
||||
);
|
||||
$filename = strtolower(str_replace(array('!', ' '), array('', '_'), $name)).'_'.$filename.'.xml';
|
||||
$plugin_export = array2xml($root, 1);
|
||||
ob_end_clean();
|
||||
dheader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
dheader('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
dheader('Cache-Control: no-cache, must-revalidate');
|
||||
dheader('Pragma: no-cache');
|
||||
dheader('Content-Encoding: none');
|
||||
dheader('Content-Length: '.strlen($plugin_export));
|
||||
dheader('Content-Disposition: attachment; filename='.$filename);
|
||||
dheader('Content-Type: text/xml');
|
||||
echo $plugin_export;
|
||||
define('FOOTERDISABLED' , 1);
|
||||
exit();
|
||||
}
|
||||
|
||||
function imagetobase64($file){
|
||||
$type=getimagesize($file);//取得图片的大小,类型等
|
||||
$fp=fopen($file,"r")or die("Can't open file");
|
||||
$file_content=chunk_split(base64_encode(fread($fp,filesize($file))));//base64编码
|
||||
switch($type[2]){//判读图片类型
|
||||
case 1:$img_type="gif";break;
|
||||
case 2:$img_type="jpg";break;
|
||||
case 3:$img_type="png";break;
|
||||
}
|
||||
$img='data:image/'.$img_type.';base64,'.$file_content;//合成图片的base64编码
|
||||
fclose($fp);
|
||||
return $img;
|
||||
}
|
||||
function base64toimage($data,$dir='appimg',$target=''){
|
||||
global $_G;
|
||||
$dataarr=explode(',',$data);
|
||||
$imgcontent=base64_decode($dataarr[1]);
|
||||
$imgext=str_replace(array('data:image/',';base64'),'',$dataarr[0]);
|
||||
if(!$target) {
|
||||
$imageext=array('jpg','jpeg','png','gif');
|
||||
if(!in_array($imgext,$imageext)) $ext='jpg';
|
||||
$subdir = $subdir1 = $subdir2 = '';
|
||||
$subdir1 = date('Ym');
|
||||
$subdir2 = date('d');
|
||||
$subdir = $subdir1.'/'.$subdir2.'/';
|
||||
$target1=$_G['setting']['attachdir'].$dir.'/'.$subdir.''.date('His').''.strtolower(random(16)).'.'.$imgext;
|
||||
$target=str_replace($_G['setting']['attachdir'],'',$target1);
|
||||
}else{
|
||||
$target1=$_G['setting']['attachdir'].$target;
|
||||
}
|
||||
$targetpath = dirname($target1);
|
||||
dmkdir($targetpath);
|
||||
if(file_put_contents($target1, $imgcontent)){
|
||||
if(@filesize($target1)<200) {
|
||||
@unlink($target1);
|
||||
return false;
|
||||
}
|
||||
return $target;
|
||||
}else return false;
|
||||
}
|
||||
function importByarray($arr,$force=0){
|
||||
$app=$arr['app'];
|
||||
//判断应用是否已经存在
|
||||
$oapp=DB::fetch_first("select * from %t where identifier=%s and app_path=%s ",array('app_market', $app['identifier'],$app['app_path']));
|
||||
if(!$force && $oapp){
|
||||
showmessage('application_been');
|
||||
}
|
||||
|
||||
//转化应用图标
|
||||
if($app['appico']){
|
||||
$app['appico']=base64toimage($app['appico'],'appico');
|
||||
}
|
||||
|
||||
$app['extra']=serialize($app['extra']);
|
||||
|
||||
if($oapp){
|
||||
$appid=$oapp['appid'];
|
||||
C::t('app_market')->update($appid,$app);
|
||||
}else{
|
||||
$app['available']=0;
|
||||
$appid=$app['appid']=C::t('app_market')->insert($app,1);
|
||||
}
|
||||
if($arr['hooks']){//初始化钩子
|
||||
C::t('hooks')->insert_by_appid($appid,$arr['hooks'],$arr['_attributes']['hooks']);
|
||||
}
|
||||
if($appid){
|
||||
C::t('app_open')->insert_by_exts($appid,($app['fileext']?explode(',',$app['fileext']):array()));
|
||||
C::t('app_tag')->addtags(($app['tag']?explode(',',$app['tag']):array()),$appid);
|
||||
}
|
||||
return $app;
|
||||
}
|
||||
function upgradeinformation($status = 0) {
|
||||
global $_G, $upgrade_step;
|
||||
|
||||
if(empty($upgrade_step)) {
|
||||
return '';
|
||||
}
|
||||
if($status==1 && $upgrade_step['step']==2) return '';
|
||||
$update = array();
|
||||
$mcode = C::t('setting')->fetch('machinecode');
|
||||
$update['siteurl']=$_G['siteurl'];
|
||||
$update['sitename']=$_G['setting']['sitename'];
|
||||
$update['mcode'] = $mcode;
|
||||
$update['curversion'] = $upgrade_step['curversion'];
|
||||
$update['currelease'] = $upgrade_step['currelease'];
|
||||
$update['upgradeversion'] = $upgrade_step['version'];
|
||||
$update['upgraderelease'] = $upgrade_step['release'];
|
||||
$update['step'] = $upgrade_step['step'] == 'dbupdate' ? 4 : $upgrade_step['step'];
|
||||
$update['status'] = $status;
|
||||
$update['version_level'] = CORE_VERSION_LEVEL;
|
||||
|
||||
$data = '';
|
||||
foreach($update as $key => $value) {
|
||||
$data .= $key.'='.rawurlencode($value).'&';
|
||||
}
|
||||
$upgradeurl = APP_CHECK_URL."authlicense/count//upgrade/".rawurlencode(base64_encode($data))."/".TIMESTAMP;
|
||||
dfsockopen($upgradeurl,0, '', '', FALSE, '',0.2);
|
||||
return '';
|
||||
//return '<img src="'.$upgradeurl.'" width="0" height="0" />';
|
||||
}
|
||||
|
||||
function upgradeinformation_app($status = 0) {
|
||||
global $_G, $appinfo;
|
||||
if(empty($appinfo)) {
|
||||
return '';
|
||||
}else{
|
||||
if( isset($appinfo['upgradeinfo']) ){
|
||||
$lastversion=$appinfo['upgradeinfo']['version'];
|
||||
$mid=$appinfo['upgradeinfo']['mid'];
|
||||
}else{
|
||||
$lastversion=$appinfo['version'];
|
||||
$mid=$appinfo['mid'];
|
||||
}
|
||||
}
|
||||
if($status==0) return '';
|
||||
$update = array();
|
||||
$siteuniqueid = C::t('setting')->fetch('siteuniqueid');
|
||||
$update['siteurl']=$_G['siteurl'];
|
||||
$update['sitename']=$_G['setting']['sitename'];
|
||||
$update['uniqueid'] = $siteuniqueid;
|
||||
$update['mid'] = $mid;
|
||||
$update['curversion'] = $appinfo['version'];
|
||||
$update['lastversion'] = $lastversion;
|
||||
$update['identifier'] = $appinfo['identifier'];
|
||||
$update['lastversion'] = $lastversion;
|
||||
$update['status'] = $status;
|
||||
$update['version_level'] = CORE_VERSION_LEVEL;
|
||||
|
||||
$data = '';
|
||||
foreach($update as $key => $value) {
|
||||
$data .= $key.'='.rawurlencode($value).'&';
|
||||
}
|
||||
$upgradeurl=APP_CHECK_URL."market/appinstall/".rawurlencode(base64_encode($data)); //APP_CHECK_URL."index.php?mod=dzzmarket&op=installinfo&data=".rawurlencode(base64_encode($data)).'×tamp='.TIMESTAMP;
|
||||
dfsockopen($upgradeurl,0, '', '', FALSE, '',0.2);
|
||||
return '';
|
||||
//return '<img src="'.$upgradeurl.'" width="0" height="0" />';
|
||||
}
|
||||
|
||||
function getwheres($intkeys, $strkeys, $randkeys, $likekeys, $pre='') {
|
||||
|
||||
$wherearr = array();
|
||||
$urls = array();
|
||||
|
||||
foreach ($intkeys as $var) {
|
||||
$value = isset($_GET[$var])?$_GET[$var]:'';
|
||||
if(strlen($value)) {
|
||||
$urls[] = "$var=$value";
|
||||
$var = addslashes($var);
|
||||
$wherearr[] = "{$pre}{$var}='".intval($value)."'";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($strkeys as $var) {
|
||||
$value = isset($_GET[$var])?trim($_GET[$var]):'';
|
||||
if(strlen($value)) {
|
||||
$urls[] = "$var=".rawurlencode($value);
|
||||
$var = addslashes($var);
|
||||
$value = addslashes($value);
|
||||
$wherearr[] = "{$pre}{$var}='$value'";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($randkeys as $vars) {
|
||||
$value1 = isset($_GET[$vars[1].'1'])?$vars[0]($_GET[$vars[1].'1']):'';
|
||||
$value2 = isset($_GET[$vars[1].'2'])?$vars[0]($_GET[$vars[1].'2']):'';
|
||||
if($value1) {
|
||||
$urls[] = "{$vars[1]}1=".rawurlencode($_GET[$vars[1].'1']);
|
||||
$vars[1] = addslashes($vars[1]);
|
||||
$value1 = addslashes($value1);
|
||||
$wherearr[] = "{$pre}{$vars[1]}>='$value1'";
|
||||
}
|
||||
if($value2) {
|
||||
$wherearr[] = "{$pre}{$vars[1]}<='$value2'";
|
||||
$vars[2] = addslashes($vars[2]);
|
||||
$value2 = addslashes($value2);
|
||||
$urls[] = "{$vars[1]}2=".rawurlencode($_GET[$vars[1].'2']);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($likekeys as $var) {
|
||||
$value = isset($_GET[$var])?stripsearchkey($_GET[$var]):'';
|
||||
if(strlen($value)>1) {
|
||||
$urls[] = "$var=".rawurlencode($_GET[$var]);
|
||||
$var = addslashes($var);
|
||||
$value = addslashes($value);
|
||||
$wherearr[] = "{$pre}{$var} LIKE BINARY '%$value%'";
|
||||
}
|
||||
}
|
||||
|
||||
return array('wherearr'=>$wherearr, 'urls'=>$urls);
|
||||
}
|
||||
|
||||
function getorders($alloworders, $default, $pre='') {
|
||||
$orders = array('sql'=>'', 'urls'=>array());
|
||||
if(empty($_GET['orderby']) || !in_array($_GET['orderby'], $alloworders)) {
|
||||
$_GET['orderby'] = $default;
|
||||
if(empty($_GET['ordersc'])) $_GET['ordersc'] = 'desc';
|
||||
}
|
||||
|
||||
$orders['sql'] = " ORDER BY {$pre}$_GET[orderby] ";
|
||||
$orders['urls'][] = "orderby=$_GET[orderby]";
|
||||
|
||||
if(!empty($_GET['ordersc']) && $_GET['ordersc'] == 'desc') {
|
||||
$orders['urls'][] = 'ordersc=desc';
|
||||
$orders['sql'] .= ' DESC ';
|
||||
} else {
|
||||
$orders['urls'][] = 'ordersc=asc';
|
||||
}
|
||||
return $orders;
|
||||
}
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
namespace admin\login\classes;
|
||||
use \core as C;
|
||||
class Adminlogin{
|
||||
public function run(){
|
||||
$dzz = C::app();
|
||||
$dzz->init();
|
||||
$admincp = new \dzz_admincp();
|
||||
$admincp->core = $dzz;
|
||||
$return = $admincp->init();
|
||||
if(defined('IS_API') && IS_API && $return === 0){
|
||||
exit(json_encode(array('loginstatus'=>0,'hash'=>FORMHASH)));
|
||||
}
|
||||
}
|
||||
<?php
|
||||
namespace admin\login\classes;
|
||||
use \core as C;
|
||||
class Adminlogin{
|
||||
public function run(){
|
||||
$dzz = C::app();
|
||||
$dzz->init();
|
||||
$admincp = new \dzz_admincp();
|
||||
$admincp->core = $dzz;
|
||||
$return = $admincp->init();
|
||||
if(defined('IS_API') && IS_API && $return === 0){
|
||||
exit(json_encode(array('loginstatus'=>0,'hash'=>FORMHASH)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,130 +1,130 @@
|
||||
input:-webkit-autofill {
|
||||
box-shadow: 0 0 0px 1000px white inset !important;
|
||||
}
|
||||
.mainContainer {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 10;
|
||||
}
|
||||
.loginContainer {
|
||||
height: 100%;
|
||||
width: 100%
|
||||
}
|
||||
.logintips {
|
||||
color: red;
|
||||
line-height: 30px;
|
||||
padding: 20px;
|
||||
width: 350px;
|
||||
background: #FFF;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #e3e3e3;
|
||||
-webkit-box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
-moz-box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
}
|
||||
#loginform {
|
||||
width: 350px;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
.login h4 {
|
||||
height: 35px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.avatarContainer {
|
||||
margin-bottom: 50px;
|
||||
margin-top: 20px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
}
|
||||
.avatarContainer img {
|
||||
max-width: 128px;
|
||||
max-height: 128px;
|
||||
}
|
||||
.avatarContainer .maintitle{
|
||||
font-size:20px;
|
||||
font-weight: 600;
|
||||
padding-top:10px;
|
||||
}
|
||||
#admin_password_Container {
|
||||
padding: 30px 0 30px 0;
|
||||
}
|
||||
#admin_password_Container .input-black {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.loginformContainer {
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
background-color: #FFF;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #e3e3e3;
|
||||
-webkit-box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
-moz-box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
}
|
||||
.loginformContainer .username {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin: 10px 0 0;
|
||||
min-height: 1em;
|
||||
}
|
||||
.loginformContainer .email {
|
||||
color: #404040;
|
||||
line-height: 2;
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
input[type="password"], input[type="text"] {
|
||||
height: 40px;
|
||||
width: 100%;
|
||||
direction: ltr;
|
||||
font-size: 14px;
|
||||
outline: none;
|
||||
width: 286px\0;
|
||||
*width:286px;
|
||||
}
|
||||
input[type="submit"] {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
width: 286px\0;
|
||||
*width:286px;
|
||||
}
|
||||
input[type="password"]:focus, input[type="text"]:focus {
|
||||
box-shadow: none;
|
||||
outline: none;
|
||||
}
|
||||
.footer .copyright {
|
||||
border: medium none;
|
||||
font-size: 12px;
|
||||
position: static;
|
||||
text-align: center;
|
||||
}
|
||||
.copyright {
|
||||
color: #899;
|
||||
font-family: "微软雅黑";
|
||||
font-size: 12px;
|
||||
left: 5px;
|
||||
line-height: 150%;
|
||||
padding-top: 20px;
|
||||
text-align: center;
|
||||
z-index: 10;
|
||||
}
|
||||
.copyright a {
|
||||
color: #899;
|
||||
}
|
||||
.wrapper-placeholder {
|
||||
text-align: left
|
||||
}
|
||||
.Topcarousel {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
line-height: 100px;
|
||||
font-size: 45px;
|
||||
color: #fff;
|
||||
}
|
||||
input:-webkit-autofill {
|
||||
box-shadow: 0 0 0px 1000px white inset !important;
|
||||
}
|
||||
.mainContainer {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 10;
|
||||
}
|
||||
.loginContainer {
|
||||
height: 100%;
|
||||
width: 100%
|
||||
}
|
||||
.logintips {
|
||||
color: red;
|
||||
line-height: 30px;
|
||||
padding: 20px;
|
||||
width: 350px;
|
||||
background: #FFF;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #e3e3e3;
|
||||
-webkit-box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
-moz-box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
}
|
||||
#loginform {
|
||||
width: 350px;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
.login h4 {
|
||||
height: 35px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.avatarContainer {
|
||||
margin-bottom: 50px;
|
||||
margin-top: 20px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
}
|
||||
.avatarContainer img {
|
||||
max-width: 128px;
|
||||
max-height: 128px;
|
||||
}
|
||||
.avatarContainer .maintitle{
|
||||
font-size:20px;
|
||||
font-weight: 600;
|
||||
padding-top:10px;
|
||||
}
|
||||
#admin_password_Container {
|
||||
padding: 30px 0 30px 0;
|
||||
}
|
||||
#admin_password_Container .input-black {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.loginformContainer {
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
background-color: #FFF;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #e3e3e3;
|
||||
-webkit-box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
-moz-box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
box-shadow: 0 5px 15px RGBA(0,0,0,.3);
|
||||
}
|
||||
.loginformContainer .username {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin: 10px 0 0;
|
||||
min-height: 1em;
|
||||
}
|
||||
.loginformContainer .email {
|
||||
color: #404040;
|
||||
line-height: 2;
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
input[type="password"], input[type="text"] {
|
||||
height: 40px;
|
||||
width: 100%;
|
||||
direction: ltr;
|
||||
font-size: 14px;
|
||||
outline: none;
|
||||
width: 286px\0;
|
||||
*width:286px;
|
||||
}
|
||||
input[type="submit"] {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
width: 286px\0;
|
||||
*width:286px;
|
||||
}
|
||||
input[type="password"]:focus, input[type="text"]:focus {
|
||||
box-shadow: none;
|
||||
outline: none;
|
||||
}
|
||||
.footer .copyright {
|
||||
border: medium none;
|
||||
font-size: 12px;
|
||||
position: static;
|
||||
text-align: center;
|
||||
}
|
||||
.copyright {
|
||||
color: #899;
|
||||
font-family: "微软雅黑";
|
||||
font-size: 12px;
|
||||
left: 5px;
|
||||
line-height: 150%;
|
||||
padding-top: 20px;
|
||||
text-align: center;
|
||||
z-index: 10;
|
||||
}
|
||||
.copyright a {
|
||||
color: #899;
|
||||
}
|
||||
.wrapper-placeholder {
|
||||
text-align: left
|
||||
}
|
||||
.Topcarousel {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
line-height: 100px;
|
||||
font-size: 45px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@@ -1,170 +1,170 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
|
||||
if (!defined('IN_OAOOA') ) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
if (!function_exists('ajaxshowheader')) {
|
||||
function ajaxshowheader() {
|
||||
global $_G;
|
||||
ob_end_clean();
|
||||
@header("Expires: -1");
|
||||
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
|
||||
@header("Pragma: no-cache");
|
||||
header("Content-type: application/xml");
|
||||
echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<root><![CDATA[";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('ajaxshowfooter')) {
|
||||
function ajaxshowfooter() {
|
||||
echo ']]></root>';
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
if ($admincp->core ->var['inajax']) {
|
||||
ajaxshowheader();
|
||||
ajaxshowfooter();
|
||||
}
|
||||
|
||||
if ($admincp -> cpaccess == -3) {
|
||||
html_login_header(false);
|
||||
} else {
|
||||
html_login_header();
|
||||
}
|
||||
|
||||
if ($admincp -> cpaccess == -3) {
|
||||
echo '<p class="logintips">' . lang('login_cp_noaccess') . '</p>';
|
||||
|
||||
} elseif ($admincp -> cpaccess == -1) {
|
||||
$ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']);
|
||||
echo '<p class="logintips">' . lang('login_cplock', array('ltime' => $ltime)) . '</p>';
|
||||
|
||||
} elseif ($admincp -> cpaccess == -4) {
|
||||
$ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']);
|
||||
echo '<p class="logintips">' . lang('login_user_lock') . '</p>';
|
||||
|
||||
} else {
|
||||
|
||||
html_login_form();
|
||||
}
|
||||
|
||||
html_login_footer();
|
||||
|
||||
function html_login_header($form = true) {
|
||||
global $_G;
|
||||
$uid = getglobal('uid');
|
||||
$charset = CHARSET;
|
||||
$lang = &lang();
|
||||
$title = $lang['login_title'];
|
||||
$tips = $lang['login_tips'];
|
||||
|
||||
echo <<<EOT
|
||||
<!DOCTYPE>
|
||||
<html>
|
||||
<head>
|
||||
<title>$title</title>
|
||||
<base href="{$_G['siteurl']}">
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=$charset" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
<link rel="stylesheet" href="static/bootstrap/css/bootstrap.min.css" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="admin/login/images/adminlogin.css" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="static/css/common.css" type="text/css" media="all" />
|
||||
<script type="text/javascript" src="static/js/md5.js"></script>
|
||||
<script type="text/javascript" src="static/jquery/jquery.min.js?{VERHASH}"></script>
|
||||
<script type="text/javascript" src="static/js/common.js?{VERHASH}"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="static/js/jquery.placeholder.js" type="text/javascript"></script>
|
||||
<![endif]-->
|
||||
<meta content="oaooa.com" name="Copyright" />
|
||||
</head>
|
||||
<body>
|
||||
EOT;
|
||||
|
||||
if ($form) {
|
||||
$loginset_img=$_G['setting']['loginset']['img']?$_G['setting']['loginset']['img']:'user/login/images/login.jpg';
|
||||
$loginset_bcolor=$_G['setting']['loginset']['bcolor']?$_G['setting']['loginset']['bcolor']:'#76838f';
|
||||
echo <<<EOT
|
||||
<div id="wrapper_div" style="width: 100%;height:100%; position: absolute; top: 0px; left: 0px; margin: 0px; padding: 0px; overflow: hidden;z-index:0; font-size: 0px; background:$loginset_bcolor;">
|
||||
|
||||
<img src="$loginset_img" name="imgbg" id="imgbg" style="right: 0px; bottom: 0px; top: 0px; left: 0px; z-index:1;margin:0;padding:0;overflow:hidden; position: absolute;width:100%;height:100%" height="100%" width="100%">
|
||||
</div>
|
||||
<div class="mainContainer">
|
||||
<table class="loginContainer" wide="100%" height="100%">
|
||||
<tr><td align="center" valign="middle">
|
||||
EOT;
|
||||
}
|
||||
}
|
||||
|
||||
function html_login_footer($halt = true) {
|
||||
$version = CORE_VERSION;
|
||||
$release = CORE_RELEASE;
|
||||
echo <<<EOT
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
EOT;
|
||||
$halt && exit();
|
||||
}
|
||||
|
||||
function html_login_form() {
|
||||
global $_G;
|
||||
$uid = getglobal('uid');
|
||||
$isguest = !getglobal('uid');
|
||||
$lang1 = lang();
|
||||
$year=dgmdate(TIMESTAMP,'Y');
|
||||
$maintitle=lang('title_admincp');
|
||||
$loginuser = $isguest ? '<input class="form-control" name="admin_email" type="text" title="" onfocus="if(this.value==\'' . lang('login_email_username') . '\'){this.value=\'\'}" onblur="if(this.value==\'\'){this.value=\'' . lang('login_email_username') . '\'}" autocomplete="off" />' : '<div class="username">' . $_G['member']['username'] . '</div><div class="email">' . $_G['member']['email'] . '</div>';
|
||||
$sid = getglobal('sid');
|
||||
$avatarstatus=getglobal('avatarstatus','member');
|
||||
if(!$uid ){
|
||||
$avastar ='<img src="'.($_G['setting']['sitelogo']?\IO::getFileUri('attach::'.$_G['setting']['sitelogo']):'static/image/common/logo.png').'" />';
|
||||
}else{
|
||||
$avastar = avatar_block($uid);
|
||||
}
|
||||
$avastar.='<div class="maintitle">'.$maintitle.'</div>';
|
||||
$extra = BASESCRIPT . '?' . $_SERVER['QUERY_STRING'];
|
||||
$forcesecques = '<option value="0">' . ($_G['config']['admincp']['forcesecques'] ? $lang1['forcesecques'] : $lang1['security_question_0']) . '</option>';
|
||||
echo <<<EOT
|
||||
|
||||
<form method="post" name="login" id="loginform" action="$extra" onsubmit="pwmd5('admin_password')">
|
||||
<input type="hidden" name="sid" value="$sid">
|
||||
<input type="hidden" name="referer" value="$_GET[referer]">
|
||||
<div class="loginformContainer">
|
||||
<div class="avatarContainer">$avastar</div>
|
||||
|
||||
$loginuser
|
||||
<div id="admin_password_Container">
|
||||
<input name="admin_password" id="admin_password" type="password" class="form-control" value="" autocomplete="off" placeholder="$lang1[password]" />
|
||||
|
||||
</div>
|
||||
<input name="submit" value="$lang1[login]" type="submit" class="btn btn-primary" />
|
||||
<div class="copyright">Powered by <a href="https://www.oaooa.com/" target="_blank">oaooa</a> © 2012-$year</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<script type="text/JavaScript">
|
||||
jQuery(document).ready(function(e) {
|
||||
jQuery('#loginform .form-control:first').focus();
|
||||
if(jQuery('.ie8,.ie9').length){ //ie8模拟placeholder;
|
||||
jQuery(':input[placeholder]').each(function(){
|
||||
jQuery(this).placeholder();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
EOT;
|
||||
}
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
|
||||
if (!defined('IN_OAOOA') ) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
if (!function_exists('ajaxshowheader')) {
|
||||
function ajaxshowheader() {
|
||||
global $_G;
|
||||
ob_end_clean();
|
||||
@header("Expires: -1");
|
||||
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
|
||||
@header("Pragma: no-cache");
|
||||
header("Content-type: application/xml");
|
||||
echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<root><![CDATA[";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('ajaxshowfooter')) {
|
||||
function ajaxshowfooter() {
|
||||
echo ']]></root>';
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
if ($admincp->core ->var['inajax']) {
|
||||
ajaxshowheader();
|
||||
ajaxshowfooter();
|
||||
}
|
||||
|
||||
if ($admincp -> cpaccess == -3) {
|
||||
html_login_header(false);
|
||||
} else {
|
||||
html_login_header();
|
||||
}
|
||||
|
||||
if ($admincp -> cpaccess == -3) {
|
||||
echo '<p class="logintips">' . lang('login_cp_noaccess') . '</p>';
|
||||
|
||||
} elseif ($admincp -> cpaccess == -1) {
|
||||
$ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']);
|
||||
echo '<p class="logintips">' . lang('login_cplock', array('ltime' => $ltime)) . '</p>';
|
||||
|
||||
} elseif ($admincp -> cpaccess == -4) {
|
||||
$ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']);
|
||||
echo '<p class="logintips">' . lang('login_user_lock') . '</p>';
|
||||
|
||||
} else {
|
||||
|
||||
html_login_form();
|
||||
}
|
||||
|
||||
html_login_footer();
|
||||
|
||||
function html_login_header($form = true) {
|
||||
global $_G;
|
||||
$uid = getglobal('uid');
|
||||
$charset = CHARSET;
|
||||
$lang = &lang();
|
||||
$title = $lang['login_title'];
|
||||
$tips = $lang['login_tips'];
|
||||
|
||||
echo <<<EOT
|
||||
<!DOCTYPE>
|
||||
<html>
|
||||
<head>
|
||||
<title>$title</title>
|
||||
<base href="{$_G['siteurl']}">
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=$charset" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
<link rel="stylesheet" href="static/bootstrap/css/bootstrap.min.css" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="admin/login/images/adminlogin.css" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="static/css/common.css" type="text/css" media="all" />
|
||||
<script type="text/javascript" src="static/js/md5.js"></script>
|
||||
<script type="text/javascript" src="static/jquery/jquery.min.js?{VERHASH}"></script>
|
||||
<script type="text/javascript" src="static/js/common.js?{VERHASH}"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="static/js/jquery.placeholder.js" type="text/javascript"></script>
|
||||
<![endif]-->
|
||||
<meta content="oaooa.com" name="Copyright" />
|
||||
</head>
|
||||
<body>
|
||||
EOT;
|
||||
|
||||
if ($form) {
|
||||
$loginset_img=$_G['setting']['loginset']['img']?$_G['setting']['loginset']['img']:'user/login/images/login.jpg';
|
||||
$loginset_bcolor=$_G['setting']['loginset']['bcolor']?$_G['setting']['loginset']['bcolor']:'#76838f';
|
||||
echo <<<EOT
|
||||
<div id="wrapper_div" style="width: 100%;height:100%; position: absolute; top: 0px; left: 0px; margin: 0px; padding: 0px; overflow: hidden;z-index:0; font-size: 0px; background:$loginset_bcolor;">
|
||||
|
||||
<img src="$loginset_img" name="imgbg" id="imgbg" style="right: 0px; bottom: 0px; top: 0px; left: 0px; z-index:1;margin:0;padding:0;overflow:hidden; position: absolute;width:100%;height:100%" height="100%" width="100%">
|
||||
</div>
|
||||
<div class="mainContainer">
|
||||
<table class="loginContainer" wide="100%" height="100%">
|
||||
<tr><td align="center" valign="middle">
|
||||
EOT;
|
||||
}
|
||||
}
|
||||
|
||||
function html_login_footer($halt = true) {
|
||||
$version = CORE_VERSION;
|
||||
$release = CORE_RELEASE;
|
||||
echo <<<EOT
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
EOT;
|
||||
$halt && exit();
|
||||
}
|
||||
|
||||
function html_login_form() {
|
||||
global $_G;
|
||||
$uid = getglobal('uid');
|
||||
$isguest = !getglobal('uid');
|
||||
$lang1 = lang();
|
||||
$year=dgmdate(TIMESTAMP,'Y');
|
||||
$maintitle=lang('title_admincp');
|
||||
$loginuser = $isguest ? '<input class="form-control" name="admin_email" type="text" title="" onfocus="if(this.value==\'' . lang('login_email_username') . '\'){this.value=\'\'}" onblur="if(this.value==\'\'){this.value=\'' . lang('login_email_username') . '\'}" autocomplete="off" />' : '<div class="username">' . $_G['member']['username'] . '</div><div class="email">' . $_G['member']['email'] . '</div>';
|
||||
$sid = getglobal('sid');
|
||||
$avatarstatus=getglobal('avatarstatus','member');
|
||||
if(!$uid ){
|
||||
$avastar ='<img src="data/attachment/sitelogo/sitelogo.png" />';
|
||||
}else{
|
||||
$avastar = avatar_block($uid);
|
||||
}
|
||||
$avastar.='<div class="maintitle">'.$maintitle.'</div>';
|
||||
$extra = BASESCRIPT . '?' . $_SERVER['QUERY_STRING'];
|
||||
$forcesecques = '<option value="0">' . ($_G['config']['admincp']['forcesecques'] ? $lang1['forcesecques'] : $lang1['security_question_0']) . '</option>';
|
||||
echo <<<EOT
|
||||
|
||||
<form method="post" name="login" id="loginform" action="$extra" onsubmit="pwmd5('admin_password')">
|
||||
<input type="hidden" name="sid" value="$sid">
|
||||
<input type="hidden" name="referer" value="$_GET[referer]">
|
||||
<div class="loginformContainer">
|
||||
<div class="avatarContainer">$avastar</div>
|
||||
|
||||
$loginuser
|
||||
<div id="admin_password_Container">
|
||||
<input name="admin_password" id="admin_password" type="password" class="form-control" value="" autocomplete="off" placeholder="$lang1[password]" />
|
||||
|
||||
</div>
|
||||
<input name="submit" value="$lang1[login]" type="submit" class="btn btn-primary" />
|
||||
<div class="copyright">Powered by <a href="https://www.oaooa.com/" target="_blank">oaooa</a> © 2012-$year</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<script type="text/JavaScript">
|
||||
jQuery(document).ready(function(e) {
|
||||
jQuery('#loginform .form-control:first').focus();
|
||||
if(jQuery('.ie8,.ie9').length){ //ie8模拟placeholder;
|
||||
jQuery(':input[placeholder]').each(function(){
|
||||
jQuery(this).placeholder();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
EOT;
|
||||
}
|
||||
?>
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/9/7
|
||||
* Time: 16:24
|
||||
*/
|
||||
$return = updatesession();
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/9/7
|
||||
* Time: 16:24
|
||||
*/
|
||||
$return = updatesession();
|
||||
exit(json_encode(array('status'=>$return)));
|
||||
3186
admin/oaooafiles.md5
3186
admin/oaooafiles.md5
File diff suppressed because it is too large
Load Diff
@@ -1,49 +1,49 @@
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
function checkAll(type, form, value, checkall, changestyle) {
|
||||
var checkall = checkall ? checkall : 'chkall';
|
||||
for(var i = 0; i < form.elements.length; i++) {
|
||||
var e = form.elements[i];
|
||||
if(type == 'option' && e.type == 'radio' && e.value == value && e.disabled != true) {
|
||||
e.checked = true;
|
||||
} else if(type == 'value' && e.type == 'checkbox' && e.getAttribute('chkvalue') == value) {
|
||||
e.checked = form.elements[checkall].checked;
|
||||
if(changestyle) {
|
||||
multiupdate(e);
|
||||
}
|
||||
} else if(type == 'prefix' && e.name && e.name != checkall && (!value || (value && e.name.match(value)))) {
|
||||
e.checked = form.elements[checkall].checked;
|
||||
if(changestyle) {
|
||||
if(e.parentNode && e.parentNode.tagName.toLowerCase() == 'li') {
|
||||
e.parentNode.className = e.checked ? 'checked' : '';
|
||||
}
|
||||
if(e.parentNode.parentNode && e.parentNode.parentNode.tagName.toLowerCase() == 'div') {
|
||||
e.parentNode.parentNode.className = e.checked ? 'item checked' : 'item';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function fixTree_organization(el){
|
||||
el.find('.tree-heng1').each(function(){
|
||||
var tr=jQuery(this).parent().parent().parent();
|
||||
var dep=jQuery(this).parent().find('.tree-su').length;
|
||||
|
||||
tr.nextAll().each(function(){
|
||||
var child_org=jQuery(this).find('.child-org');
|
||||
var dep1=child_org.find('.tree-su').length;
|
||||
if(dep1<=dep) return false;
|
||||
else{
|
||||
child_org.find('.tree-su').eq(dep).removeClass('tree-su');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
function checkAll(type, form, value, checkall, changestyle) {
|
||||
var checkall = checkall ? checkall : 'chkall';
|
||||
for(var i = 0; i < form.elements.length; i++) {
|
||||
var e = form.elements[i];
|
||||
if(type == 'option' && e.type == 'radio' && e.value == value && e.disabled != true) {
|
||||
e.checked = true;
|
||||
} else if(type == 'value' && e.type == 'checkbox' && e.getAttribute('chkvalue') == value) {
|
||||
e.checked = form.elements[checkall].checked;
|
||||
if(changestyle) {
|
||||
multiupdate(e);
|
||||
}
|
||||
} else if(type == 'prefix' && e.name && e.name != checkall && (!value || (value && e.name.match(value)))) {
|
||||
e.checked = form.elements[checkall].checked;
|
||||
if(changestyle) {
|
||||
if(e.parentNode && e.parentNode.tagName.toLowerCase() == 'li') {
|
||||
e.parentNode.className = e.checked ? 'checked' : '';
|
||||
}
|
||||
if(e.parentNode.parentNode && e.parentNode.parentNode.tagName.toLowerCase() == 'div') {
|
||||
e.parentNode.parentNode.className = e.checked ? 'item checked' : 'item';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function fixTree_organization(el){
|
||||
el.find('.tree-heng1').each(function(){
|
||||
var tr=jQuery(this).parent().parent().parent();
|
||||
var dep=jQuery(this).parent().find('.tree-su').length;
|
||||
|
||||
tr.nextAll().each(function(){
|
||||
var child_org=jQuery(this).find('.child-org');
|
||||
var dep1=child_org.find('.tree-su').length;
|
||||
if(dep1<=dep) return false;
|
||||
else{
|
||||
child_org.find('.tree-su').eq(dep).removeClass('tree-su');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,184 +1,184 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
global $_G;
|
||||
Hook::listen('adminlogin');
|
||||
$uid = $_G['uid'];
|
||||
include libfile('function/filerouterule');
|
||||
require libfile('function/code');
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : '';
|
||||
if($operation == 'getApp'){//获取当前用户应用
|
||||
$config = array();
|
||||
if($_G['uid']){
|
||||
$config= dzz_userconfig_init();
|
||||
if(!$config){
|
||||
//$config= dzz_userconfig_init();
|
||||
if($config['applist']){
|
||||
$applist=explode(',',$config['applist']);
|
||||
}else{
|
||||
$applist=array();
|
||||
}
|
||||
}else{//检测不允许删除的应用,重新添加进去
|
||||
if($config['applist']){
|
||||
$applist=explode(',',$config['applist']);
|
||||
}else{
|
||||
$applist=array();
|
||||
}
|
||||
if($applist_n =array_keys(C::t('app_market')->fetch_all_by_notdelete($_G['uid']))) {
|
||||
|
||||
$newappids = array();
|
||||
foreach ($applist_n as $appid) {
|
||||
if (!in_array($appid, $applist)) {
|
||||
$applist[] = $appid;
|
||||
$newappids[] = $appid;
|
||||
}
|
||||
}
|
||||
if ($newappids) C::t('app_user')->insert_by_uid($_G['uid'], $newappids);
|
||||
C::t('user_field')->update($_G['uid'], array('applist' => implode(',', $applist)));
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
$applist =array_keys(C::t('app_market')->fetch_all_by_default());
|
||||
}
|
||||
|
||||
//获取已安装应用
|
||||
$app=C::t('app_market')->fetch_all_by_appid($applist);
|
||||
|
||||
$applist_1=array();
|
||||
$applist_2=array();
|
||||
$identifier=array('imageTool','picture');
|
||||
foreach($app as $key => $value){
|
||||
if($value['isshow']<1) continue;
|
||||
if($value['available']<1) continue;
|
||||
if($value['position']<1) continue;//位置为无的忽略
|
||||
//判断管理员应用
|
||||
if($_G['adminid']!=1 && $value['group']==3){
|
||||
continue;
|
||||
}
|
||||
$params=array('name'=>$value['identifier'],'perm'=>1,'return_type'=>'bool');
|
||||
if(Hook::listen('rolecheck',$params,null,true)===false) continue;
|
||||
//if($value['system'] == 2) continue;
|
||||
if(in_array($value['identifier'], $identifier)){
|
||||
$applist_1[] = $value;
|
||||
}else{
|
||||
$applist_2[] = $value;
|
||||
}
|
||||
|
||||
}
|
||||
//获取虚拟应用
|
||||
$params=array();
|
||||
$vapps=Hook::listen('vapplist',$params,null,true);
|
||||
foreach($vapps as $key => $value){
|
||||
$params=array('name'=>'vapp/'.$value['identifier'],'perm'=>1,'return_type'=>'bool');
|
||||
if(Hook::listen('rolecheck',$params,null,true)===false) continue;
|
||||
$applist_1[] = $value;
|
||||
}
|
||||
//对应用根据disp 排序
|
||||
if($applist_1){
|
||||
$sort = array(
|
||||
'direction' => 'SORT_ASC', //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序
|
||||
'field' => 'disp', //排序字段
|
||||
);
|
||||
$arrSort = array();
|
||||
foreach($applist_1 AS $uniqid => $row){
|
||||
foreach($row AS $key=>$value){
|
||||
$arrSort[$key][$uniqid] = $value;
|
||||
}
|
||||
}
|
||||
if($sort['direction']){
|
||||
array_multisort($arrSort[$sort['field']], constant($sort['direction']), $applist_1);
|
||||
}
|
||||
}
|
||||
exit(json_encode(array('data'=>array_merge($applist_1,$applist_2))));
|
||||
|
||||
}else{
|
||||
// 地址栏名称
|
||||
$navtitle = $_G['setting']['sitename'];
|
||||
// 获取hash
|
||||
$hash = FORMHASH;
|
||||
|
||||
// 获取当前用户信息
|
||||
$userData = array();
|
||||
$udata = DB::fetch_first("select u.uid,u.avatarstatus,u.username,u.groupid,u.adminid,u.nickname,s.svalue from %t u
|
||||
left join %t s on s.uid = u.uid and s.skey=%swhere u.uid =%d",
|
||||
array('user','user_setting','headerColor',$uid));
|
||||
if($udata['avatarstatus'] == 1){
|
||||
$userData['icon'] = 'avatar.php?uid='.$udata['uid'];
|
||||
}elseif($udata['svalue']){
|
||||
$userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,''));
|
||||
$userData['headerColor'] = $udata['svalue'];
|
||||
$userData['icon'] = false;
|
||||
}else{
|
||||
$colorkey = rand(1,15);
|
||||
$headerColor = $colors[$colorkey];
|
||||
C::t('user_setting')->insert_by_skey('headerColor',$headerColor,$udata['uid']);
|
||||
$userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,''));
|
||||
$userData['headerColor'] = $udata['svalue'];
|
||||
}
|
||||
if( C::t('user')->checkfounder($udata)){
|
||||
$userData['perm'] = 3;
|
||||
}elseif($udata['adminid'] == 1){
|
||||
$userData['perm'] = 2;
|
||||
}else{
|
||||
$userData['perm'] = 1;
|
||||
}
|
||||
$userData['username'] = $udata['username'];
|
||||
$userData['uid'] = $uid;
|
||||
$userData['language'] = $_G[language];
|
||||
$userData['upgrade'] = $_G['setting']['upgrade'];
|
||||
$userData['version'] = $_G['setting']['version'];
|
||||
|
||||
// 获取顶部应用
|
||||
if($userData['language'] == 'en-US'){
|
||||
$navMenuNames = ['System setting','Cloud settings','Orguser','App','Statistics','System Tool'];
|
||||
}else{
|
||||
$navMenuNames = ['系统设置','云设置','用户','应用','统计','系统工具'];
|
||||
}
|
||||
$navMenu = array(
|
||||
array(
|
||||
'name'=>$navMenuNames[0],
|
||||
'index'=>'setting',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[1],
|
||||
'index'=>'cloudsetting',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[2],
|
||||
'index'=>'orguser',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[3],
|
||||
'index'=>'app',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[4],
|
||||
'index'=>'stats',
|
||||
'type'=>'dzz'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[5],
|
||||
'index'=>'system',
|
||||
'type'=>'admin'
|
||||
),
|
||||
);
|
||||
// 获取通知
|
||||
$notice_num=DB::result_first("select COUNT(*) from %t where new>0 and uid=%d",array('notification',$_G['uid']));
|
||||
|
||||
exit(json_encode(array('hash'=>$hash,'navMenu'=>$navMenu,'userData'=>$userData,'notice_num'=>$notice_num,'navtitle'=>$navtitle)));
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
global $_G;
|
||||
Hook::listen('adminlogin');
|
||||
$uid = $_G['uid'];
|
||||
include libfile('function/filerouterule');
|
||||
require libfile('function/code');
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : '';
|
||||
if($operation == 'getApp'){//获取当前用户应用
|
||||
$config = array();
|
||||
if($_G['uid']){
|
||||
$config= dzz_userconfig_init();
|
||||
if(!$config){
|
||||
//$config= dzz_userconfig_init();
|
||||
if($config['applist']){
|
||||
$applist=explode(',',$config['applist']);
|
||||
}else{
|
||||
$applist=array();
|
||||
}
|
||||
}else{//检测不允许删除的应用,重新添加进去
|
||||
if($config['applist']){
|
||||
$applist=explode(',',$config['applist']);
|
||||
}else{
|
||||
$applist=array();
|
||||
}
|
||||
if($applist_n =array_keys(C::t('app_market')->fetch_all_by_notdelete($_G['uid']))) {
|
||||
|
||||
$newappids = array();
|
||||
foreach ($applist_n as $appid) {
|
||||
if (!in_array($appid, $applist)) {
|
||||
$applist[] = $appid;
|
||||
$newappids[] = $appid;
|
||||
}
|
||||
}
|
||||
if ($newappids) C::t('app_user')->insert_by_uid($_G['uid'], $newappids);
|
||||
C::t('user_field')->update($_G['uid'], array('applist' => implode(',', $applist)));
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
$applist =array_keys(C::t('app_market')->fetch_all_by_default());
|
||||
}
|
||||
|
||||
//获取已安装应用
|
||||
$app=C::t('app_market')->fetch_all_by_appid($applist);
|
||||
|
||||
$applist_1=array();
|
||||
$applist_2=array();
|
||||
$identifier=array('imageTool','picture');
|
||||
foreach($app as $key => $value){
|
||||
if($value['isshow']<1) continue;
|
||||
if($value['available']<1) continue;
|
||||
if($value['position']<1) continue;//位置为无的忽略
|
||||
//判断管理员应用
|
||||
if($_G['adminid']!=1 && $value['group']==3){
|
||||
continue;
|
||||
}
|
||||
$params=array('name'=>$value['identifier'],'perm'=>1,'return_type'=>'bool');
|
||||
if(Hook::listen('rolecheck',$params,null,true)===false) continue;
|
||||
//if($value['system'] == 2) continue;
|
||||
if(in_array($value['identifier'], $identifier)){
|
||||
$applist_1[] = $value;
|
||||
}else{
|
||||
$applist_2[] = $value;
|
||||
}
|
||||
|
||||
}
|
||||
//获取虚拟应用
|
||||
$params=array();
|
||||
$vapps=Hook::listen('vapplist',$params,null,true);
|
||||
foreach($vapps as $key => $value){
|
||||
$params=array('name'=>'vapp/'.$value['identifier'],'perm'=>1,'return_type'=>'bool');
|
||||
if(Hook::listen('rolecheck',$params,null,true)===false) continue;
|
||||
$applist_1[] = $value;
|
||||
}
|
||||
//对应用根据disp 排序
|
||||
if($applist_1){
|
||||
$sort = array(
|
||||
'direction' => 'SORT_ASC', //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序
|
||||
'field' => 'disp', //排序字段
|
||||
);
|
||||
$arrSort = array();
|
||||
foreach($applist_1 AS $uniqid => $row){
|
||||
foreach($row AS $key=>$value){
|
||||
$arrSort[$key][$uniqid] = $value;
|
||||
}
|
||||
}
|
||||
if($sort['direction']){
|
||||
array_multisort($arrSort[$sort['field']], constant($sort['direction']), $applist_1);
|
||||
}
|
||||
}
|
||||
exit(json_encode(array('data'=>array_merge($applist_1,$applist_2))));
|
||||
|
||||
}else{
|
||||
// 地址栏名称
|
||||
$navtitle = $_G['setting']['sitename'];
|
||||
// 获取hash
|
||||
$hash = FORMHASH;
|
||||
|
||||
// 获取当前用户信息
|
||||
$userData = array();
|
||||
$udata = DB::fetch_first("select u.uid,u.avatarstatus,u.username,u.groupid,u.adminid,u.nickname,s.svalue from %t u
|
||||
left join %t s on s.uid = u.uid and s.skey=%swhere u.uid =%d",
|
||||
array('user','user_setting','headerColor',$uid));
|
||||
if($udata['avatarstatus'] == 1){
|
||||
$userData['icon'] = 'avatar.php?uid='.$udata['uid'].'&random='.VERHASH;
|
||||
}elseif($udata['svalue']){
|
||||
$userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,''));
|
||||
$userData['headerColor'] = $udata['svalue'];
|
||||
$userData['icon'] = false;
|
||||
}else{
|
||||
$colorkey = rand(1,15);
|
||||
$headerColor = $colors[$colorkey];
|
||||
C::t('user_setting')->insert_by_skey('headerColor',$headerColor,$udata['uid']);
|
||||
$userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,''));
|
||||
$userData['headerColor'] = $udata['svalue'];
|
||||
}
|
||||
if( C::t('user')->checkfounder($udata)){
|
||||
$userData['perm'] = 3;
|
||||
}elseif($udata['adminid'] == 1){
|
||||
$userData['perm'] = 2;
|
||||
}else{
|
||||
$userData['perm'] = 1;
|
||||
}
|
||||
$userData['username'] = $udata['username'];
|
||||
$userData['uid'] = $uid;
|
||||
$userData['language'] = $_G[language];
|
||||
$userData['upgrade'] = $_G['setting']['upgrade'];
|
||||
$userData['version'] = $_G['setting']['version'];
|
||||
|
||||
// 获取顶部应用
|
||||
if($userData['language'] == 'en-US'){
|
||||
$navMenuNames = ['System setting','Cloud settings','Orguser','App','Statistics','System Tool'];
|
||||
}else{
|
||||
$navMenuNames = ['系统设置','云设置','用户','应用','统计','系统工具'];
|
||||
}
|
||||
$navMenu = array(
|
||||
array(
|
||||
'name'=>$navMenuNames[0],
|
||||
'index'=>'setting',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[1],
|
||||
'index'=>'cloudsetting',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[2],
|
||||
'index'=>'orguser',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[3],
|
||||
'index'=>'app',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[4],
|
||||
'index'=>'stats',
|
||||
'type'=>'dzz'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[5],
|
||||
'index'=>'system',
|
||||
'type'=>'admin'
|
||||
),
|
||||
);
|
||||
// 获取通知
|
||||
$notice_num=DB::result_first("select COUNT(*) from %t where new>0 and uid=%d",array('notification',$_G['uid']));
|
||||
|
||||
exit(json_encode(array('hash'=>$hash,'navMenu'=>$navMenu,'userData'=>$userData,'notice_num'=>$notice_num,'navtitle'=>$navtitle)));
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,200 +1,200 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
include_once libfile('function/cache');
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
$op = $_GET['op'];
|
||||
$navtitle = lang('cron') . ' - ' . lang('admin_navtitle');
|
||||
if (empty($_GET['edit']) && empty($_GET['run'])) {
|
||||
|
||||
if (!submitcheck('cronssubmit')) {
|
||||
$crons = array();
|
||||
$query = DB::query("SELECT * FROM " . DB::table('cron') . " ORDER BY type DESC");
|
||||
while ($cron = DB::fetch($query)) {
|
||||
$disabled = $cron['weekday'] == -1 && $cron['day'] == -1 && $cron['hour'] == -1 && $cron['minute'] == '' ? 'disabled' : '';
|
||||
|
||||
if ($cron['day'] > 0 && $cron['day'] < 32) {
|
||||
$cron['time'] = lang('monthly') . $cron['day'] . lang('day');
|
||||
} elseif ($cron['weekday'] >= 0 && $cron['weekday'] < 7) {
|
||||
$cron['time'] = lang('weekly') . lang('misc_cron_week_day_' . $cron['weekday']);
|
||||
} elseif ($cron['hour'] >= 0 && $cron['hour'] < 24) {
|
||||
$cron['time'] = lang('everyday');
|
||||
} else {
|
||||
$cron['time'] = lang('per_hour');
|
||||
}
|
||||
$cron['time'] .= $cron['hour'] >= 0 && $cron['hour'] < 24 ? sprintf('%02d', $cron[hour]) . lang('timeliness') : '';
|
||||
if (!in_array($cron['minute'], array(-1, ''))) {
|
||||
foreach ($cron['minute'] = explode("\t", $cron['minute']) as $k => $v) {
|
||||
$cron['minute'][$k] = sprintf('%02d', $v);
|
||||
}
|
||||
$cron['minute'] = implode(',', $cron['minute']);
|
||||
$cron['time'] .= $cron['minute'] . lang('point');
|
||||
} else {
|
||||
$cron['time'] .= '00' . lang('point');
|
||||
}
|
||||
|
||||
$cron['lastrun'] = $cron['lastrun'] ? dgmdate($cron['lastrun'], $_G['setting']['dateformat'] . "<\b\\r />" . $_G['setting']['timeformat']) : '<b>N/A</b>';
|
||||
$cron['nextcolor'] = $cron['nextrun'] && $cron['nextrun'] + $_G['setting']['timeoffset'] * 3600 < TIMESTAMP ? 'style="color: #ff0000"' : '';
|
||||
$cron['nextrun'] = $cron['nextrun'] ? dgmdate($cron['nextrun'], $_G['setting']['dateformat'] . "<\b\\r />" . $_G['setting']['timeformat']) : '<b>N/A</b>';
|
||||
$cron['run'] = $cron['available'];
|
||||
|
||||
$crons[] = $cron;
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($ids = dimplode($_GET['delete'])) {
|
||||
DB::delete('cron', "cronid IN ($ids) AND type!='system'");
|
||||
}
|
||||
|
||||
if (is_array($_GET['namenew'])) {
|
||||
foreach ($_GET['namenew'] as $id => $name) {
|
||||
$newcron = array('name' => dhtmlspecialchars($_GET['namenew'][$id]), 'available' => $_GET['availablenew'][$id]);
|
||||
if (empty($_GET['availablenew'][$id])) {
|
||||
$newcron['nextrun'] = '0';
|
||||
}
|
||||
DB::update('cron', $newcron, "cronid='{$id}'");
|
||||
}
|
||||
}
|
||||
|
||||
if ($newname = trim($_GET['newname'])) {
|
||||
DB::insert('cron', array('name' => dhtmlspecialchars($newname), 'type' => 'user', 'available' => '0', 'weekday' => '-1', 'day' => '-1', 'hour' => '-1', 'minute' => '', 'nextrun' => $_G['timestamp'], ));
|
||||
}
|
||||
|
||||
$query = DB::query("SELECT cronid, filename FROM " . DB::table('cron'));
|
||||
while ($cron = DB::fetch($query)) {
|
||||
$efile = explode(':', $cron['filename']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
if (!file_exists($cronfile)) {
|
||||
DB::update('cron', array('available' => '0', 'nextrun' => '0', ), "cronid='$cron[cronid]'");
|
||||
}
|
||||
}
|
||||
updatecache('setting');
|
||||
$msg = lang('crons_succeed');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-success';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$cronid = empty($_GET['run']) ? $_GET['edit'] : $_GET['run'];
|
||||
$cron = DB::fetch_first("SELECT * FROM " . DB::table('cron') . " WHERE cronid='$cronid'");
|
||||
if (!$cron) {
|
||||
$msg = lang('cron_not_found');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-error';
|
||||
include template('cron');
|
||||
exit();
|
||||
}
|
||||
$cron['filename'] = str_replace(array('..', '/', '\\'), array('', '', ''), $cron['filename']);
|
||||
$cronminute = str_replace("\t", ',', $cron['minute']);
|
||||
$cron['minute'] = explode("\t", $cron['minute']);
|
||||
|
||||
if (!empty($_GET['edit'])) {
|
||||
|
||||
if (!submitcheck('editsubmit')) {
|
||||
|
||||
$navtitle = lang('misc_cron_edit') . ' - ' . lang('admin_navtitle');
|
||||
|
||||
$weekdayselect = $dayselect = $hourselect = '';
|
||||
|
||||
for ($i = 0; $i <= 6; $i++) {
|
||||
$weekdayselect .= "<option value=\"$i\" " . ($cron['weekday'] == $i ? 'selected' : '') . ">" . lang('misc_cron_week_day_' . $i) . "</option>";
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= 31; $i++) {
|
||||
$dayselect .= "<option value=\"$i\" " . ($cron['day'] == $i ? 'selected' : '') . ">$i " . lang('day') . "</option>";
|
||||
}
|
||||
|
||||
for ($i = 0; $i <= 23; $i++) {
|
||||
$hourselect .= "<option value=\"$i\" " . ($cron['hour'] == $i ? 'selected' : '') . ">$i " . lang('timeliness') . "</option>";
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$daynew = $_GET['weekdaynew'] != -1 ? -1 : $_GET['daynew'];
|
||||
if (strpos($_GET['minutenew'], ',') !== FALSE) {
|
||||
$minutenew = explode(',', $_GET['minutenew']);
|
||||
foreach ($minutenew as $key => $val) {
|
||||
$minutenew[$key] = $val = intval($val);
|
||||
if ($val < 0 || $var > 59) {
|
||||
unset($minutenew[$key]);
|
||||
}
|
||||
}
|
||||
$minutenew = array_slice(array_unique($minutenew), 0, 12);
|
||||
$minutenew = implode("\t", $minutenew);
|
||||
} else {
|
||||
$minutenew = intval($_GET['minutenew']);
|
||||
$minutenew = $minutenew >= 0 && $minutenew < 60 ? $minutenew : '';
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$_GET['filenamenew'] = str_replace(array('..', '/', '\\'), '', $_GET['filenamenew']);
|
||||
$efile = explode(':', $_GET['filenamenew']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
if (preg_match("/[\\\\\/\*\?\"\<\>\|]+/", $_GET['filenamenew'])) {
|
||||
$msg = lang('crons_filename_illegal');
|
||||
} elseif (!is_readable($cronfile)) {
|
||||
$msg = lang('crons_filename_invalid', array('cronfile' => $cronfile));
|
||||
} elseif ($_GET['weekdaynew'] == -1 && $daynew == -1 && $_GET['hournew'] == -1 && $minutenew === '') {
|
||||
$msg = lang('crons_time_invalid');
|
||||
}
|
||||
if (!empty($msg)) {
|
||||
$msg_type = 'text-error';
|
||||
$redirecturl = dreferer();
|
||||
include template('cron');
|
||||
exit();
|
||||
}
|
||||
|
||||
DB::update('cron', array('weekday' => $_GET['weekdaynew'], 'day' => $daynew, 'hour' => $_GET['hournew'], 'minute' => $minutenew, 'filename' => trim($_GET['filenamenew']), ), "cronid='$cronid'");
|
||||
|
||||
dzz_cron::run($cronid);
|
||||
|
||||
$msg = lang('crons_succeed');
|
||||
$msg_type = 'text-success';
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']);
|
||||
$efile = explode(':', $cron['filename']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
|
||||
if (!file_exists($cronfile)) {
|
||||
$msg = lang('crons_run_invalid', array('cronfile' => $cronfile));
|
||||
$msg_type = 'text-error';
|
||||
|
||||
} else {
|
||||
dzz_cron::run($cron['cronid']);
|
||||
$msg = lang('crons_run_succeed');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-success';
|
||||
}
|
||||
}
|
||||
}
|
||||
include template('cron');
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
include_once libfile('function/cache');
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
$op = $_GET['op'];
|
||||
$navtitle = lang('cron') . ' - ' . lang('admin_navtitle');
|
||||
if (empty($_GET['edit']) && empty($_GET['run'])) {
|
||||
|
||||
if (!submitcheck('cronssubmit')) {
|
||||
$crons = array();
|
||||
$query = DB::query("SELECT * FROM " . DB::table('cron') . " ORDER BY type DESC");
|
||||
while ($cron = DB::fetch($query)) {
|
||||
$disabled = $cron['weekday'] == -1 && $cron['day'] == -1 && $cron['hour'] == -1 && $cron['minute'] == '' ? 'disabled' : '';
|
||||
|
||||
if ($cron['day'] > 0 && $cron['day'] < 32) {
|
||||
$cron['time'] = lang('monthly') . $cron['day'] . lang('day');
|
||||
} elseif ($cron['weekday'] >= 0 && $cron['weekday'] < 7) {
|
||||
$cron['time'] = lang('weekly') . lang('misc_cron_week_day_' . $cron['weekday']);
|
||||
} elseif ($cron['hour'] >= 0 && $cron['hour'] < 24) {
|
||||
$cron['time'] = lang('everyday');
|
||||
} else {
|
||||
$cron['time'] = lang('per_hour');
|
||||
}
|
||||
$cron['time'] .= $cron['hour'] >= 0 && $cron['hour'] < 24 ? sprintf('%02d', $cron[hour]) . lang('timeliness') : '';
|
||||
if (!in_array($cron['minute'], array(-1, ''))) {
|
||||
foreach ($cron['minute'] = explode("\t", $cron['minute']) as $k => $v) {
|
||||
$cron['minute'][$k] = sprintf('%02d', $v);
|
||||
}
|
||||
$cron['minute'] = implode(',', $cron['minute']);
|
||||
$cron['time'] .= $cron['minute'] . lang('point');
|
||||
} else {
|
||||
$cron['time'] .= '00' . lang('point');
|
||||
}
|
||||
|
||||
$cron['lastrun'] = $cron['lastrun'] ? dgmdate($cron['lastrun'], $_G['setting']['dateformat'] . "<\b\\r />" . $_G['setting']['timeformat']) : '<b>N/A</b>';
|
||||
$cron['nextcolor'] = $cron['nextrun'] && $cron['nextrun'] + $_G['setting']['timeoffset'] * 3600 < TIMESTAMP ? 'style="color: #ff0000"' : '';
|
||||
$cron['nextrun'] = $cron['nextrun'] ? dgmdate($cron['nextrun'], $_G['setting']['dateformat'] . "<\b\\r />" . $_G['setting']['timeformat']) : '<b>N/A</b>';
|
||||
$cron['run'] = $cron['available'];
|
||||
|
||||
$crons[] = $cron;
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($ids = dimplode($_GET['delete'])) {
|
||||
DB::delete('cron', "cronid IN ($ids) AND type!='system'");
|
||||
}
|
||||
|
||||
if (is_array($_GET['namenew'])) {
|
||||
foreach ($_GET['namenew'] as $id => $name) {
|
||||
$newcron = array('name' => dhtmlspecialchars($_GET['namenew'][$id]), 'available' => $_GET['availablenew'][$id]);
|
||||
if (empty($_GET['availablenew'][$id])) {
|
||||
$newcron['nextrun'] = '0';
|
||||
}
|
||||
DB::update('cron', $newcron, "cronid='{$id}'");
|
||||
}
|
||||
}
|
||||
|
||||
if ($newname = trim($_GET['newname'])) {
|
||||
DB::insert('cron', array('name' => dhtmlspecialchars($newname), 'type' => 'user', 'available' => '0', 'weekday' => '-1', 'day' => '-1', 'hour' => '-1', 'minute' => '', 'nextrun' => $_G['timestamp'], ));
|
||||
}
|
||||
|
||||
$query = DB::query("SELECT cronid, filename FROM " . DB::table('cron'));
|
||||
while ($cron = DB::fetch($query)) {
|
||||
$efile = explode(':', $cron['filename']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
if (!file_exists($cronfile)) {
|
||||
DB::update('cron', array('available' => '0', 'nextrun' => '0', ), "cronid='$cron[cronid]'");
|
||||
}
|
||||
}
|
||||
updatecache('setting');
|
||||
$msg = lang('crons_succeed');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-success';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$cronid = empty($_GET['run']) ? $_GET['edit'] : $_GET['run'];
|
||||
$cron = DB::fetch_first("SELECT * FROM " . DB::table('cron') . " WHERE cronid='$cronid'");
|
||||
if (!$cron) {
|
||||
$msg = lang('cron_not_found');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-error';
|
||||
include template('cron');
|
||||
exit();
|
||||
}
|
||||
$cron['filename'] = str_replace(array('..', '/', '\\'), array('', '', ''), $cron['filename']);
|
||||
$cronminute = str_replace("\t", ',', $cron['minute']);
|
||||
$cron['minute'] = explode("\t", $cron['minute']);
|
||||
|
||||
if (!empty($_GET['edit'])) {
|
||||
|
||||
if (!submitcheck('editsubmit')) {
|
||||
|
||||
$navtitle = lang('misc_cron_edit') . ' - ' . lang('admin_navtitle');
|
||||
|
||||
$weekdayselect = $dayselect = $hourselect = '';
|
||||
|
||||
for ($i = 0; $i <= 6; $i++) {
|
||||
$weekdayselect .= "<option value=\"$i\" " . ($cron['weekday'] == $i ? 'selected' : '') . ">" . lang('misc_cron_week_day_' . $i) . "</option>";
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= 31; $i++) {
|
||||
$dayselect .= "<option value=\"$i\" " . ($cron['day'] == $i ? 'selected' : '') . ">$i " . lang('day') . "</option>";
|
||||
}
|
||||
|
||||
for ($i = 0; $i <= 23; $i++) {
|
||||
$hourselect .= "<option value=\"$i\" " . ($cron['hour'] == $i ? 'selected' : '') . ">$i " . lang('timeliness') . "</option>";
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$daynew = $_GET['weekdaynew'] != -1 ? -1 : $_GET['daynew'];
|
||||
if (strpos($_GET['minutenew'], ',') !== FALSE) {
|
||||
$minutenew = explode(',', $_GET['minutenew']);
|
||||
foreach ($minutenew as $key => $val) {
|
||||
$minutenew[$key] = $val = intval($val);
|
||||
if ($val < 0 || $var > 59) {
|
||||
unset($minutenew[$key]);
|
||||
}
|
||||
}
|
||||
$minutenew = array_slice(array_unique($minutenew), 0, 12);
|
||||
$minutenew = implode("\t", $minutenew);
|
||||
} else {
|
||||
$minutenew = intval($_GET['minutenew']);
|
||||
$minutenew = $minutenew >= 0 && $minutenew < 60 ? $minutenew : '';
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$_GET['filenamenew'] = str_replace(array('..', '/', '\\'), '', $_GET['filenamenew']);
|
||||
$efile = explode(':', $_GET['filenamenew']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
if (preg_match("/[\\\\\/\*\?\"\<\>\|]+/", $_GET['filenamenew'])) {
|
||||
$msg = lang('crons_filename_illegal');
|
||||
} elseif (!is_readable($cronfile)) {
|
||||
$msg = lang('crons_filename_invalid', array('cronfile' => $cronfile));
|
||||
} elseif ($_GET['weekdaynew'] == -1 && $daynew == -1 && $_GET['hournew'] == -1 && $minutenew === '') {
|
||||
$msg = lang('crons_time_invalid');
|
||||
}
|
||||
if (!empty($msg)) {
|
||||
$msg_type = 'text-error';
|
||||
$redirecturl = dreferer();
|
||||
include template('cron');
|
||||
exit();
|
||||
}
|
||||
|
||||
DB::update('cron', array('weekday' => $_GET['weekdaynew'], 'day' => $daynew, 'hour' => $_GET['hournew'], 'minute' => $minutenew, 'filename' => trim($_GET['filenamenew']), ), "cronid='$cronid'");
|
||||
|
||||
dzz_cron::run($cronid);
|
||||
|
||||
$msg = lang('crons_succeed');
|
||||
$msg_type = 'text-success';
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']);
|
||||
$efile = explode(':', $cron['filename']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
|
||||
if (!file_exists($cronfile)) {
|
||||
$msg = lang('crons_run_invalid', array('cronfile' => $cronfile));
|
||||
$msg_type = 'text-error';
|
||||
|
||||
} else {
|
||||
dzz_cron::run($cron['cronid']);
|
||||
$msg = lang('crons_run_succeed');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-success';
|
||||
}
|
||||
}
|
||||
}
|
||||
include template('cron');
|
||||
?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
.max-width[data-v-6168216d]{width:360px}
|
||||
@@ -1 +0,0 @@
|
||||
.wait-files[data-v-00939ee2]{line-height:25px;border:1px solid #dcdfe6;margin-bottom:10px;padding:5px;font-size:14px}
|
||||
@@ -1 +1 @@
|
||||
.el-avatar[data-v-6f47bc15]{float:left;cursor:pointer}.el-divider--horizontal.el-divider[data-v-6f47bc15]{margin:8px 0}.aboutPichome{padding:0;width:478px}.aboutPichome .el-message-box__btns,.aboutPichome .el-message-box__header{display:none}.aboutPichome .aboutlogo{text-align:center;line-height:0;padding-top:40px}.aboutPichome .aboutmessage{padding:65px 40px;font-size:19px;padding-bottom:15px}.aboutPichome .aboutmessage .aboutlist{margin-bottom:20px;overflow:hidden}.aboutPichome a{text-decoration:none}.aboutPichome .aboutmessage .aboutlist .title{float:left;width:95px}.aboutPichome .aboutmessage .aboutlist .mes{float:left;width:calc(100% - 95px)}.aboutPichome .aboutmessage .aboutlist .update{font-size:12px}
|
||||
.el-avatar[data-v-1aac96c1]{float:left;cursor:pointer}.el-divider--horizontal.el-divider[data-v-1aac96c1]{margin:8px 0}.aboutPichome{padding:0;width:478px}.aboutPichome .el-message-box__btns,.aboutPichome .el-message-box__header{display:none}.aboutPichome .aboutlogo{text-align:center;line-height:0;padding-top:40px}.aboutPichome .aboutmessage{padding:65px 40px;font-size:19px;padding-bottom:15px}.aboutPichome .aboutmessage .aboutlist{margin-bottom:20px;overflow:hidden}.aboutPichome a{text-decoration:none}.aboutPichome .aboutmessage .aboutlist .title{float:left;width:95px}.aboutPichome .aboutmessage .aboutlist .mes{float:left;width:calc(100% - 95px)}.aboutPichome .aboutmessage .aboutlist .update{font-size:12px}
|
||||
@@ -1 +1 @@
|
||||
.el-container[data-v-6b6f1ca9],.el-main[data-v-6b6f1ca9]{height:100%}.el-main[data-v-6b6f1ca9]{padding:0}.top-title .el-steps[data-v-31baf320]{background:transparent;padding:0 25px}.top-title .el-steps[data-v-31baf320] .el-step__icon{vertical-align:middle}.el-progress[data-v-31baf320]{width:400px;display:inline-block}.content[data-v-31baf320]{padding:20px 25px}.help-inline li[data-v-31baf320]{margin-bottom:5px}.top-title .main-title[data-v-da54ce54]{font-size:14px;color:#909399;cursor:pointer;margin-right:20px;vertical-align:bottom}.top-title .main-title.is-active[data-v-da54ce54]{color:#369}.content[data-v-da54ce54]{padding:20px 25px}.systemExportNotify{width:auto}.help-inline li[data-v-174d5b16]{margin-bottom:5px;padding:0}.max-width[data-v-174d5b16]{width:260px}.custom-single[data-v-174d5b16]{height:40px;margin-bottom:5px}.custom-single .el-checkbox[data-v-174d5b16]{overflow:hidden}.custom-single .el-checkbox[data-v-174d5b16] .el-checkbox__input{vertical-align:text-top}.custom-single .el-checkbox[data-v-174d5b16] .el-checkbox__label{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-checkbox[data-v-174d5b16],.el-radio[data-v-174d5b16]{margin-bottom:5px;margin-left:0!important}.el-radio[data-v-174d5b16]{min-width:260px}.max-width[data-v-71031654]{width:50%}.content[data-v-24008314]{padding:20px 25px}.help-inline li[data-v-24008314]{margin-bottom:5px;padding:0}.help-inline[data-v-5e61246c]{display:block}.help-inline li[data-v-5e61246c]{margin-bottom:5px;padding:0}.max-width[data-v-5e61246c]{width:360px}
|
||||
.el-container[data-v-51d41a2c],.el-main[data-v-51d41a2c]{height:100%}.el-main[data-v-51d41a2c]{padding:0}.top-title .el-steps[data-v-31baf320]{background:transparent;padding:0 25px}.top-title .el-steps[data-v-31baf320] .el-step__icon{vertical-align:middle}.el-progress[data-v-31baf320]{width:400px;display:inline-block}.content[data-v-31baf320]{padding:20px 25px}.help-inline li[data-v-31baf320]{margin-bottom:5px}.top-title .main-title[data-v-da54ce54]{font-size:14px;color:#909399;cursor:pointer;margin-right:20px;vertical-align:bottom}.top-title .main-title.is-active[data-v-da54ce54]{color:#369}.content[data-v-da54ce54]{padding:20px 25px}.systemExportNotify{width:auto}.help-inline li[data-v-174d5b16]{margin-bottom:5px;padding:0}.max-width[data-v-174d5b16]{width:260px}.custom-single[data-v-174d5b16]{height:40px;margin-bottom:5px}.custom-single .el-checkbox[data-v-174d5b16]{overflow:hidden}.custom-single .el-checkbox[data-v-174d5b16] .el-checkbox__input{vertical-align:text-top}.custom-single .el-checkbox[data-v-174d5b16] .el-checkbox__label{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-checkbox[data-v-174d5b16],.el-radio[data-v-174d5b16]{margin-bottom:5px;margin-left:0!important}.el-radio[data-v-174d5b16]{min-width:260px}.max-width[data-v-71031654]{width:50%}.content[data-v-24008314]{padding:20px 25px}.help-inline li[data-v-24008314]{margin-bottom:5px;padding:0}.help-inline[data-v-5e61246c]{display:block}.help-inline li[data-v-5e61246c]{margin-bottom:5px;padding:0}.max-width[data-v-5e61246c]{width:360px}
|
||||
2
admin/system/dist/index.html
vendored
2
admin/system/dist/index.html
vendored
@@ -1 +1 @@
|
||||
<!DOCTYPE html><html lang=zh><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><title></title><link href=/admin/system/dist/css/chunk-2b4f90f7.519dec70.css rel=prefetch><link href=/admin/system/dist/css/chunk-494f643e.7502109f.css rel=prefetch><link href=/admin/system/dist/css/chunk-5ae5cc35.d763cbce.css rel=prefetch><link href=/admin/system/dist/css/chunk-5cdcd199.6f46c04d.css rel=prefetch><link href=/admin/system/dist/css/chunk-74c32c70.4b7d665e.css rel=prefetch><link href=/admin/system/dist/css/chunk-76f23146.6fc79cd8.css rel=prefetch><link href=/admin/system/dist/css/chunk-7828662a.c81657ef.css rel=prefetch><link href=/admin/system/dist/css/chunk-9f9c2568.5356ad7d.css rel=prefetch><link href=/admin/system/dist/css/chunk-af3b1b98.b822363f.css rel=prefetch><link href=/admin/system/dist/css/chunk-e730cc06.987283b7.css rel=prefetch><link href=/admin/system/dist/css/system_temp.a56510eb.css rel=prefetch><link href=/admin/system/dist/js/chunk-2b4f90f7.ec4ac270.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d0a3327.ad2684c9.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d0bdbc6.4ec7bc5e.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d0dd46d.0816c17e.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d0efd3c.44a093d1.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d20fcd9.50f81306.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d21ddf7.9f7b329e.js rel=prefetch><link href=/admin/system/dist/js/chunk-494f643e.77a11d42.js rel=prefetch><link href=/admin/system/dist/js/chunk-5ae5cc35.25761a21.js rel=prefetch><link href=/admin/system/dist/js/chunk-5cdcd199.070f9c94.js rel=prefetch><link href=/admin/system/dist/js/chunk-74c32c70.1f5e9382.js rel=prefetch><link href=/admin/system/dist/js/chunk-76f23146.0d2957ed.js rel=prefetch><link href=/admin/system/dist/js/chunk-7828662a.e587f025.js rel=prefetch><link href=/admin/system/dist/js/chunk-9f9c2568.538835dd.js rel=prefetch><link href=/admin/system/dist/js/chunk-af3b1b98.850ec152.js rel=prefetch><link href=/admin/system/dist/js/chunk-e730cc06.3ce9a994.js rel=prefetch><link href=/admin/system/dist/js/system_temp.c7e32270.js rel=prefetch><link href=/admin/system/dist/css/chunk-vendors.4d5d56a8.css rel=preload as=style><link href=/admin/system/dist/css/index.7d0ec6bf.css rel=preload as=style><link href=/admin/system/dist/js/chunk-vendors.3b95dfe3.js rel=preload as=script><link href=/admin/system/dist/js/index.b5ff203c.js rel=preload as=script><link href=/admin/system/dist/css/chunk-vendors.4d5d56a8.css rel=stylesheet><link href=/admin/system/dist/css/index.7d0ec6bf.css rel=stylesheet></head><body><div id=app></div><script src=/admin/system/dist/js/chunk-vendors.3b95dfe3.js></script><script src=/admin/system/dist/js/index.b5ff203c.js></script></body></html>
|
||||
<!DOCTYPE html><html lang=zh><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><title></title><link href=admin/system/dist/css/chunk-2b4f90f7.519dec70.css rel=prefetch><link href=admin/system/dist/css/chunk-494f643e.7502109f.css rel=prefetch><link href=admin/system/dist/css/chunk-5ae5cc35.d763cbce.css rel=prefetch><link href=admin/system/dist/css/chunk-74c32c70.4b7d665e.css rel=prefetch><link href=admin/system/dist/css/chunk-76f23146.6fc79cd8.css rel=prefetch><link href=admin/system/dist/css/chunk-7828662a.c81657ef.css rel=prefetch><link href=admin/system/dist/css/chunk-7aef2525.9e97ae28.css rel=prefetch><link href=admin/system/dist/css/chunk-9f9c2568.5356ad7d.css rel=prefetch><link href=admin/system/dist/css/chunk-af3b1b98.b822363f.css rel=prefetch><link href=admin/system/dist/css/chunk-e730cc06.987283b7.css rel=prefetch><link href=admin/system/dist/css/system_temp.abc9b69c.css rel=prefetch><link href=admin/system/dist/js/chunk-2b4f90f7.45b9151d.js rel=prefetch><link href=admin/system/dist/js/chunk-2d0a3327.ad2684c9.js rel=prefetch><link href=admin/system/dist/js/chunk-2d0bdbc6.4ec7bc5e.js rel=prefetch><link href=admin/system/dist/js/chunk-2d0dd46d.e13ddeba.js rel=prefetch><link href=admin/system/dist/js/chunk-2d0efd3c.44a093d1.js rel=prefetch><link href=admin/system/dist/js/chunk-2d20fcd9.50f81306.js rel=prefetch><link href=admin/system/dist/js/chunk-2d21ddf7.9f7b329e.js rel=prefetch><link href=admin/system/dist/js/chunk-494f643e.77a11d42.js rel=prefetch><link href=admin/system/dist/js/chunk-5ae5cc35.25761a21.js rel=prefetch><link href=admin/system/dist/js/chunk-74c32c70.1f5e9382.js rel=prefetch><link href=admin/system/dist/js/chunk-76f23146.0d2957ed.js rel=prefetch><link href=admin/system/dist/js/chunk-7828662a.e587f025.js rel=prefetch><link href=admin/system/dist/js/chunk-7aef2525.35b8efb8.js rel=prefetch><link href=admin/system/dist/js/chunk-9f9c2568.538835dd.js rel=prefetch><link href=admin/system/dist/js/chunk-af3b1b98.850ec152.js rel=prefetch><link href=admin/system/dist/js/chunk-e730cc06.3ce9a994.js rel=prefetch><link href=admin/system/dist/js/system_temp.b94f1119.js rel=prefetch><link href=admin/system/dist/css/chunk-vendors.4d5d56a8.css rel=preload as=style><link href=admin/system/dist/css/index.7d0ec6bf.css rel=preload as=style><link href=admin/system/dist/js/chunk-vendors.3b95dfe3.js rel=preload as=script><link href=admin/system/dist/js/index.b9edc49b.js rel=preload as=script><link href=admin/system/dist/css/chunk-vendors.4d5d56a8.css rel=stylesheet><link href=admin/system/dist/css/index.7d0ec6bf.css rel=stylesheet></head><body><div id=app></div><script src=admin/system/dist/js/chunk-vendors.3b95dfe3.js></script><script src=admin/system/dist/js/index.b9edc49b.js></script></body></html>
|
||||
@@ -1 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2b4f90f7"],{3685:function(t,e,a){},ec9e:function(t,e,a){"use strict";var n=a("3685"),i=a.n(n);i.a},fcc8f:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"resNav"},[a("div",{staticClass:"resNav-item resNav-left"},[a("a",{staticClass:"h-left",attrs:{href:"javascript:;"},on:{click:function(e){return t.goBack()}}},[a("el-image",{attrs:{src:"data/attachment/sitelogo/sitelogo.png",fit:"contain"}}),a("span",{staticClass:"text"},[t._v(t._s(t.navTitle))])],1)]),a("div",{staticClass:"resNav-item resNav-center"}),a("div",{staticClass:"resNav-item resNav-right"},[a("Mavatar")],1)])},i=[],c=(a("d3b7"),a("5530")),s=a("2f62"),r={props:["hideContent","apptype","hideBack"],data:function(){return{}},computed:Object(c["a"])(Object(c["a"])({},Object(s["c"])(["headerName","navTitle","IfuserAgent"])),Object(s["b"])(["GetNavMenu"])),methods:{handleClick:function(t){var e=this.GetNavMenu;for(var a in e)if(e[a].index==t){"admin"==e[a].type?window.location.href="admin.php?mod="+t:window.location.href="index.php?mod="+t;break}},goBack:function(){window.location.href="/"}},components:{Mavatar:function(){return a.e("chunk-5cdcd199").then(a.bind(null,"6254"))}}},o=r,d=(a("ec9e"),a("2877")),l=Object(d["a"])(o,n,i,!1,null,"b9d2b62e",null);e["default"]=l.exports}}]);
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2b4f90f7"],{3685:function(t,e,a){},ec9e:function(t,e,a){"use strict";var n=a("3685"),i=a.n(n);i.a},fcc8f:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"resNav"},[a("div",{staticClass:"resNav-item resNav-left"},[a("a",{staticClass:"h-left",attrs:{href:"javascript:;"},on:{click:function(e){return t.goBack()}}},[a("el-image",{attrs:{src:"data/attachment/sitelogo/sitelogo.png",fit:"contain"}}),a("span",{staticClass:"text"},[t._v(t._s(t.navTitle))])],1)]),a("div",{staticClass:"resNav-item resNav-center"}),a("div",{staticClass:"resNav-item resNav-right"},[a("Mavatar")],1)])},i=[],c=(a("d3b7"),a("5530")),s=a("2f62"),r={props:["hideContent","apptype","hideBack"],data:function(){return{}},computed:Object(c["a"])(Object(c["a"])({},Object(s["c"])(["headerName","navTitle","IfuserAgent"])),Object(s["b"])(["GetNavMenu"])),methods:{handleClick:function(t){var e=this.GetNavMenu;for(var a in e)if(e[a].index==t){"admin"==e[a].type?window.location.href="admin.php?mod="+t:window.location.href="index.php?mod="+t;break}},goBack:function(){window.location.href="/"}},components:{Mavatar:function(){return a.e("chunk-7aef2525").then(a.bind(null,"6254"))}}},o=r,l=(a("ec9e"),a("2877")),d=Object(l["a"])(o,n,i,!1,null,"b9d2b62e",null);e["default"]=d.exports}}]);
|
||||
@@ -1 +0,0 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0bdbc6"],{"2ced":function(t,n,e){"use strict";e.r(n);var c=function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("el-card",{staticClass:"box-card",staticStyle:{background:"rgb(240, 249, 235)","text-align":"center"},attrs:{shadow:"hover"}},[e("p",[t._v(t._s(t.$t("upgrade_none")))])])},a=[],o={data:function(){return{}},created:function(){},methods:{},components:{},mounted:function(){}},r=o,s=e("2877"),u=Object(s["a"])(r,c,a,!1,null,null,null);n["default"]=u.exports}}]);
|
||||
@@ -1 +0,0 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0dd46d"],{8164:function(e,t,a){"use strict";a.r(t);var s=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}]},[a("el-card",{staticClass:"box-card",staticStyle:{background:"rgb(240, 249, 235)","text-align":"center"},attrs:{shadow:"hover"}},[a("p",{staticStyle:{"margin-bottom":"0"}},[a("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful1")))])],1),a("p",{staticStyle:{margin:"0"}},[a("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful2",{msg:e.$route.params.version})))])],1),a("p",{staticStyle:{"margin-bottom":"0"}},[a("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful3",{dir:e.dir})))])],1),a("p",{staticStyle:{margin:"0"}},[a("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful4",{backdir:e.backdir})))])],1)])],1)},n=[],r=(a("96cf"),a("1da1")),i={data:function(){return{loading:!1,dir:"",backdir:""}},created:function(){this.getData()},methods:{getData:function(){var e=this;return Object(r["a"])(regeneratorRuntime.mark((function t(){var a,s;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.loading=!0,t.next=3,e.axios.post("admin.php?mod=system&op=intsystemupgrade&operation=patch&step=5",{version:e.$route.params.version});case 3:a=t.sent,s=a.data,e.dir=s.dir,e.backdir=s.backdir,e.loading=!1;case 8:case"end":return t.stop()}}),t)})))()}},components:{},mounted:function(){}},c=i,d=a("2877"),u=Object(d["a"])(c,s,n,!1,null,"f4790950",null);t["default"]=u.exports}}]);
|
||||
@@ -1 +0,0 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0dd46d"],{8164:function(e,t,a){"use strict";a.r(t);var s=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}]},[a("el-card",{staticClass:"box-card",staticStyle:{background:"rgb(240, 249, 235)","text-align":"center"},attrs:{shadow:"hover"}},[a("p",{staticStyle:{"margin-bottom":"0"}},[a("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful1")))])],1),a("p",{staticStyle:{margin:"0"}},[a("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful2",{msg:e.$route.params.version})))])],1),a("p",{staticStyle:{"margin-bottom":"0"}},[a("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful3",{dir:e.dir})))])],1),a("p",{staticStyle:{margin:"0"}},[a("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful4",{backdir:e.backdir})))])],1)])],1)},n=[],r=(a("96cf"),a("1da1")),i={data:function(){return{loading:!1,dir:"",backdir:""}},created:function(){this.getData()},methods:{getData:function(){var e=this;return Object(r["a"])(regeneratorRuntime.mark((function t(){var a,s;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.loading=!0,t.next=3,e.axios.post("admin.php?mod=system&op=intsystemupgrade&operation=patch&step=5",{version:e.$route.params.version});case 3:a=t.sent,s=a.data,e.dir=s.dir,e.backdir=s.backdir,e.loading=!1;case 8:case"end":return t.stop()}}),t)})))()}},components:{},mounted:function(){}},c=i,d=a("2877"),u=Object(d["a"])(c,s,n,!1,null,"306dae10",null);t["default"]=u.exports}}]);
|
||||
1
admin/system/dist/js/chunk-2d0dd46d.e13ddeba.js
vendored
Normal file
1
admin/system/dist/js/chunk-2d0dd46d.e13ddeba.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0dd46d"],{8164:function(e,t,s){"use strict";s.r(t);var n=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}]},[s("el-card",{staticClass:"box-card",staticStyle:{background:"rgb(240, 249, 235)","text-align":"center"},attrs:{shadow:"hover"}},[s("p",{staticStyle:{"margin-bottom":"0"}},[s("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful1")))])],1),s("p",{staticStyle:{margin:"0"}},[s("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.version))])],1),s("p",{staticStyle:{"margin-bottom":"0"}},[s("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful3",{dir:e.dir})))])],1),s("p",{staticStyle:{margin:"0"}},[s("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful4",{backdir:e.backdir})))])],1)])],1)},a=[],r=(s("96cf"),s("1da1")),i={data:function(){return{loading:!1,version:"",dir:"",backdir:""}},created:function(){this.getData()},methods:{getData:function(){var e=this;return Object(r["a"])(regeneratorRuntime.mark((function t(){var s,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.loading=!0,t.next=3,e.axios.post("admin.php?mod=system&op=intsystemupgrade&operation=patch&step=5&version="+e.$route.params.version);case 3:s=t.sent,n=s.data,e.version=e.$t("upgrade_successful2",{msg:n.version}),e.dir=n.dir,e.backdir=n.backdir,e.loading=!1;case 9:case"end":return t.stop()}}),t)})))()}},components:{},mounted:function(){}},c=i,d=s("2877"),o=Object(d["a"])(c,n,a,!1,null,"321830d5",null);t["default"]=o.exports}}]);
|
||||
@@ -1 +0,0 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0efd3c"],{"9a86":function(e,t,a){"use strict";a.r(t);var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}]},[e.floading?a("div",[e.tableData.length?[a("el-card",{staticClass:"box-card",staticStyle:{background:"rgb(240, 249, 235)","margin-bottom":"25px"},attrs:{shadow:"hover"}},[a("ul",{staticClass:"help-inline",domProps:{innerHTML:e._s(e.$t("founder_upgrade_diff_show",{version:e.returnData.version,oldversion:e.oldversion}))}})]),a("el-table",{staticStyle:{width:"100%"},attrs:{data:e.tableData,border:""}},[a("el-table-column",{attrs:{prop:"name",label:"文件名"}}),a("el-table-column",{attrs:{align:"center",prop:"status",label:"状态",width:"120"},scopedSlots:e._u([{key:"default",fn:function(t){return[1==t.row.status?[a("el-link",{attrs:{underline:!1,type:"danger"}},[e._v(e._s(e.$t("founder_upgrade_diff")))])]:2==t.row.status?[a("el-link",{attrs:{underline:!1,type:"info"}},[e._v(e._s(e.$t("founder_upgrade_normal")))])]:3==t.row.status?[a("el-link",{attrs:{underline:!1,type:"primary"}},[e._v(e._s(e.$t("founder_upgrade_new")))])]:e._e()]}}],null,!1,3979069617)})],1),a("div",{staticStyle:{"margin-top":"10px"}},[a("el-button",{attrs:{size:"small",type:"primary"},on:{click:e.handleupdate}},[e._v(e._s(e.button))])],1)]:[a("el-card",{staticClass:"box-card",staticStyle:{background:"rgb(240, 249, 235)"},attrs:{shadow:"hover"}},[a("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("filecheck_nofound_md5file")))])],1)]],2):e._e()])},n=[],o=(a("96cf"),a("1da1")),s={props:["returnData"],data:function(){return{loading:!1,floading:!1,tableData:[],button:"",oldversion:""}},created:function(){this.getData()},methods:{getData:function(){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function t(){var a,r,n,o,s;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.loading=!0,a={version:e.returnData.version?e.returnData.version:"",locale:e.returnData.locale?e.returnData.locale:"",charset:e.returnData.charset?e.returnData.charset:""},t.next=4,e.axios.post("admin.php?mod=system&op=intsystemupgrade&operation=patch&step=3",a);case 4:if(r=t.sent,n=r.data,!n.upgradeNone){t.next=12;break}return o={upgradeNone:!0},e.$emit("handleStep",o),t.abrupt("return",!1);case 12:if(!n.upgradeError){t.next=18;break}return o={upgradeError:!0},e.$emit("handleStep",o),t.abrupt("return",!1);case 18:if(!n.bbclosed){t.next=22;break}return s={template:"bbclosed"},e.$emit("handleStep",s),t.abrupt("return",!1);case 22:e.tableData=n.tableData,e.button=n.button,e.oldversion=n.oldversion,e.loading=!1,e.floading=!0;case 27:case"end":return t.stop()}}),t)})))()},handleupdate:function(){var e={template:4};return this.$emit("handleStep",e),!1}},components:{},mounted:function(){}},l=s,i=a("2877"),u=Object(i["a"])(l,r,n,!1,null,null,null);t["default"]=u.exports}}]);
|
||||
@@ -1 +0,0 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d21ddf7"],{d2c6:function(t,e,a){"use strict";a.r(e);var r=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[3==t.downloadstatus?[a("el-card",{staticClass:"box-card",staticStyle:{background:"rgb(240, 249, 235)","text-align":"center"},attrs:{shadow:"hover"}},[a("p",[t._v(t._s(t.$t("upgrade_redownload",{file:t.data.file})))]),a("el-button",{attrs:{type:"primary",size:"medium"},on:{click:t.handleretry}},[t._v(t._s(t.$t("retry")))])],1)]:[a("el-card",{staticClass:"box-card",staticStyle:{width:"600px",margin:"0 auto","margin-top":"50px"}},[a("div",{staticClass:"clearfix",staticStyle:{"text-align":"center"},attrs:{slot:"header"},slot:"header"},[a("span",[t._v(t._s(t.$t("upgrade_downloading_file")))])]),a("p",{staticStyle:{width:"100%",overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis","font-size":"14px"}},[4==t.downloadstatus?[t._v(t._s(t.$t("upgrade_download_complete_to_compare")))]:[t._v(t._s(t.data.file))]],2),a("el-progress",{staticStyle:{"margin-bottom":"20px"},attrs:{"text-inside":!0,"stroke-width":26,percentage:t.data.percent}})],1)]],2)},n=[],s=(a("96cf"),a("1da1")),o={props:["returnData"],data:function(){return{stepstatus:!0,downloadstatus:0,data:{file:"",fileseq:1,percent:0}}},created:function(){this.getData()},methods:{getData:function(){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function e(){var a,r,n,s,o,d;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t.stepstatus){e.next=2;break}return e.abrupt("return",!1);case 2:return a={version:t.returnData.version?t.returnData.version:"",locale:t.returnData.locale?t.returnData.locale:"",charset:t.returnData.charset?t.returnData.charset:"",fileseq:t.data.fileseq},e.next=5,t.axios.post("admin.php?mod=system&op=intsystemupgrade&operation=patch&step=2",a);case 5:if(r=e.sent,n=r.data,!n.upgradeNone){e.next=13;break}return s={upgradeNone:!0},t.$emit("handleStep",s),e.abrupt("return",!1);case 13:if(!n.upgradeError){e.next=19;break}return s={upgradeError:!0},t.$emit("handleStep",s),e.abrupt("return",!1);case 19:if(!n.bbclosed){e.next=23;break}return o={template:"bbclosed"},t.$emit("handleStep",o),e.abrupt("return",!1);case 23:return t.downloadstatus=n.downloadstatus,3==n.downloadstatus?t.data.file=n.data.file:4==n.downloadstatus?(t.data.percent=100,d={template:3},setTimeout((function(){t.$emit("handleStep",d)}),1e3)):(n.data.percent=parseInt(n.data.percent),t.data=n.data,t.getData()),e.abrupt("return",!1);case 26:case"end":return e.stop()}}),e)})))()},handleretry:function(){window.location.reload()}},components:{},mounted:function(){},destroyed:function(){this.stepstatus=!1}},d=o,i=a("2877"),u=Object(i["a"])(d,r,n,!1,null,null,null);e["default"]=u.exports}}]);
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5cdcd199"],{6254:function(t,a,e){"use strict";e.r(a);var o=function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",{staticStyle:{"margin-left":"10px",display:"inherit"}},[e("el-dropdown",{staticStyle:{width:"35px",height:"35px"},attrs:{trigger:"click","hide-on-click":!1},on:{command:t.handleAvatar}},[t.GetUserData.icon?[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.GetUserData.username,placement:"left"}},[e("el-avatar",{attrs:{size:35,src:t.GetUserData.icon}})],1)]:[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.GetUserData.username,placement:"left"}},[e("el-avatar",{style:{background:t.GetUserData.headerColor},attrs:{size:35}},[t._v(t._s(t.GetUserData.firstword))])],1)],e("el-dropdown-menu",{staticClass:"avatar-dropdown",attrs:{slot:"dropdown"},slot:"dropdown"},[e("el-dropdown-item",{attrs:{command:"personal"}},[t._v("个人设置")]),e("el-dropdown-item",{attrs:{command:"help"}},[t._v("帮助文档")]),e("el-dropdown-item",{attrs:{command:"problem"}},[t._v("问题反馈")]),e("el-divider"),e("el-dropdown-item",{attrs:{command:"setting"}},[t._v("站点设置")]),e("el-dropdown-item",{attrs:{command:"library"}},[t._v("库设置")]),e("el-dropdown-item",{attrs:{command:"system"}},[e("span",{staticStyle:{position:"relative"}},[t._v(" 系统工具 "),t.GetUserData.upgrade?e("div",{staticClass:"tip",staticStyle:{width:"7px",height:"7px","border-radius":"50%",background:"red",position:"absolute",left:"-13px",top:"0",bottom:"0",margin:"auto"}}):t._e()])]),e("el-divider"),e("el-dropdown-item",{attrs:{command:"about"}},[t._v("关于PicHome")]),e("el-dropdown-item",{attrs:{command:"OutLogin"}},[t._v("退出站点")])],1)],2)],1)},s=[],n=(e("96cf"),e("1da1")),i=e("5530"),r=e("2f62"),c={data:function(){return{}},computed:Object(i["a"])({},Object(r["b"])(["GetUserData","GetFormHash","GetLanguage"])),methods:{handleAvatar:function(t){switch(t){case"personal":window.location.href="index.php?mod=pichome&op=user&do=personal";break;case"help":window.open("https://www.yuque.com/pichome");break;case"problem":window.open("https://support.qq.com/products/340252");break;case"setting":window.location.href="index.php?mod=pichome&op=admin&do=basic";break;case"library":window.location.href="index.php?mod=pichome&op=library";break;case"about":this.$alert('<div class="aboutlogo">\n \t\t\t<img src="dzz/pichome/image/phlogo.png" alt="">\n \t\t</div>\n \t\t<div class="aboutmessage">\n \t\t\t<div class="aboutlist">\n \t\t\t\t<span class="title">软件名称:</span><span class="mes">欧奥PicHome</span>\n \t\t\t</div>\n \t\t\t<div class="aboutlist">\n \t\t\t\t<span class="title">版本信息:</span><span class="mes">'+this.GetUserData.version+'</span>\n \t\t\t</div>\n \t\t\t<div class="aboutlist">\n \t\t\t\t<span class="title">版权信息:</span><span class="mes">Powered By oaooa PicHome © 2020-2021 欧奥图文</span>\n \t\t\t</div>\n \t\t\t<div class="aboutlist">\n \t\t\t\t<span class="title">网站地址:</span><span class="mes"><a class="address" href="https://oaooa.com/" target="_blank">oaooa.com</a></span>\n \t\t\t</div>\n \t\t</div>',"",{customClass:"aboutPichome",showClose:!1,showConfirmButton:!1,dangerouslyUseHTMLString:!0,closeOnClickModal:!0});break;case"OutLogin":this.outLogin();break;case"system":window.open("admin.php?mod=system");break}return!1},outLogin:function(){var t=this;return Object(n["a"])(regeneratorRuntime.mark((function a(){var e;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.next=2,t.axios.post(t.AxiosApi+"user.php?mod=login&op=logging&action=logout&formhash="+t.GetFormHash+"&t="+(new Date).getTime());case 2:e=a.sent,e.data,window.location.reload();case 5:case"end":return a.stop()}}),a)})))()}}},d=c,l=(e("d2ba"),e("9c24"),e("2877")),p=Object(l["a"])(d,o,s,!1,null,"6f47bc15",null);a["default"]=p.exports},"864f":function(t,a,e){},"9c24":function(t,a,e){"use strict";var o=e("864f"),s=e.n(o);s.a},ae63:function(t,a,e){},d2ba:function(t,a,e){"use strict";var o=e("ae63"),s=e.n(o);s.a}}]);
|
||||
@@ -1 +0,0 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-77c8d08e"],{"1f5d":function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}]},[a("el-card",{staticClass:"box-card",staticStyle:{background:"rgb(240, 249, 235)","margin-bottom":"25px"},attrs:{shadow:"hover"}},[a("ul",{staticClass:"help-inline",domProps:{innerHTML:e._s(e.$t("founder_upgrade_store_directory",{msg:e.returnData.version}))}})]),e._l(e.files,(function(t){return a("div",{staticClass:"wait-files"},[a("i",{staticClass:"el-icon-document"}),e._v(" "+e._s(t)+" ")])})),a("el-button",{attrs:{type:"primary",size:"medium"},on:{click:e.handleupdate}},[e._v(e._s(e.$t("founder_upgrade_download")))])],2)},r=[],o=(a("96cf"),a("1da1")),i={props:["returnData"],data:function(){return{files:[],loading:!1}},created:function(){this.getData()},methods:{getData:function(){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function t(){var a,n,r,o,i;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.loading=!0,a={version:e.returnData.version?e.returnData.version:"",locale:e.returnData.locale?e.returnData.locale:"",charset:e.returnData.charset?e.returnData.charset:""},t.next=4,e.axios.post("admin.php?mod=system&op=intsystemupgrade&operation=patch&step=1",a);case 4:return n=t.sent,r=n.data,r.upgradeNone?(o={upgradeNone:!0},e.$emit("handleStep",o)):r.upgradeError?(o={upgradeError:!0},e.$emit("handleStep",o)):r.bbclosed?(i={bbclosed:!0},e.$emit("handleStep",i)):(e.files=r.data,e.loading=!1),t.abrupt("return",!1);case 8:case"end":return t.stop()}}),t)})))()},handleupdate:function(){var e={template:2};this.$emit("handleStep",e)}},components:{},mounted:function(){}},s=i,u=(a("7949"),a("2877")),d=Object(u["a"])(s,n,r,!1,null,"00939ee2",null);t["default"]=d.exports},7949:function(e,t,a){"use strict";var n=a("93b8"),r=a.n(n);r.a},"93b8":function(e,t,a){}}]);
|
||||
1
admin/system/dist/js/chunk-7aef2525.35b8efb8.js
vendored
Normal file
1
admin/system/dist/js/chunk-7aef2525.35b8efb8.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7aef2525"],{"3e42":function(t,e,a){},6254:function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticStyle:{"margin-left":"10px",display:"inherit"}},[a("el-dropdown",{staticStyle:{width:"35px",height:"35px"},attrs:{trigger:"click","hide-on-click":!1},on:{command:t.handleAvatar}},[t.GetUserData.icon?[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.GetUserData.username,placement:"left"}},[a("el-avatar",{attrs:{size:35,src:t.GetUserData.icon}})],1)]:[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.GetUserData.username,placement:"left"}},[a("el-avatar",{style:{background:t.GetUserData.headerColor},attrs:{size:35}},[t._v(t._s(t.GetUserData.firstword))])],1)],a("el-dropdown-menu",{staticClass:"avatar-dropdown",attrs:{slot:"dropdown"},slot:"dropdown"},[a("el-dropdown-item",{attrs:{command:"personal"}},[t._v("个人设置")]),a("el-dropdown-item",{attrs:{command:"help"}},[t._v("帮助文档")]),a("el-dropdown-item",{attrs:{command:"problem"}},[t._v("问题反馈")]),a("el-divider"),a("el-dropdown-item",{attrs:{command:"setting"}},[t._v("站点设置")]),a("el-dropdown-item",{attrs:{command:"library"}},[t._v("库设置")]),a("el-dropdown-item",{attrs:{command:"system"}},[a("span",{staticStyle:{position:"relative"}},[t._v(" 系统工具 "),t.GetUserData.upgrade?a("div",{staticClass:"tip",staticStyle:{width:"7px",height:"7px","border-radius":"50%",background:"red",position:"absolute",left:"-13px",top:"0",bottom:"0",margin:"auto"}}):t._e()])]),a("el-divider"),a("el-dropdown-item",{attrs:{command:"about"}},[t._v("关于PicHome")]),a("el-dropdown-item",{attrs:{command:"OutLogin"}},[t._v("退出站点")])],1)],2)],1)},s=[],n=(a("96cf"),a("1da1")),i=a("5530"),r=a("2f62"),c={data:function(){return{}},computed:Object(i["a"])({},Object(r["b"])(["GetUserData","GetFormHash","GetLanguage"])),methods:{handleAvatar:function(t){switch(t){case"collection":window.location.href="index.php?mod=collection";break;case"personal":window.location.href="index.php?mod=pichome&op=user&do=personal";break;case"help":window.open("https://www.yuque.com/pichome");break;case"problem":window.open("https://support.qq.com/products/340252");break;case"setting":window.location.href="index.php?mod=pichome&op=admin&do=authorize";break;case"library":window.location.href="index.php?mod=pichome&op=library";break;case"about":this.$alert('<div class="aboutlogo">\n \t\t\t<img src="dzz/pichome/image/phlogo.png" alt="">\n \t\t</div>\n \t\t<div class="aboutmessage">\n \t\t\t<div class="aboutlist">\n \t\t\t\t<span class="title">软件名称:</span><span class="mes">欧奥PicHome</span>\n \t\t\t</div>\n \t\t\t<div class="aboutlist">\n \t\t\t\t<span class="title">版本信息:</span><span class="mes">'+this.GetUserData.version+'</span>\n \t\t\t</div>\n \t\t\t<div class="aboutlist">\n \t\t\t\t<span class="title">版权信息:</span><span class="mes">Powered By oaooa PicHome © 2020-2022 欧奥图文</span>\n \t\t\t</div>\n \t\t\t<div class="aboutlist">\n \t\t\t\t<span class="title">网站地址:</span><span class="mes"><a class="address" href="https://oaooa.com/" target="_blank">oaooa.com</a></span>\n \t\t\t</div>\n \t\t</div>',"",{customClass:"aboutPichome",showClose:!1,showConfirmButton:!1,dangerouslyUseHTMLString:!0,closeOnClickModal:!0});break;case"OutLogin":this.outLogin();break;case"system":window.open("admin.php?mod=system");break;case"orguser":window.open("admin.php?mod=orguser");break}return!1},outLogin:function(){var t=this;return Object(n["a"])(regeneratorRuntime.mark((function e(){var a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.axios.post(t.AxiosApi+"user.php?mod=login&op=logging&action=logout&formhash="+t.GetFormHash+"&t="+(new Date).getTime());case 2:a=e.sent,a.data,window.location.reload();case 5:case"end":return e.stop()}}),e)})))()}}},d=c,l=(a("74bc"),a("9c24"),a("2877")),p=Object(l["a"])(d,o,s,!1,null,"1aac96c1",null);e["default"]=p.exports},"74bc":function(t,e,a){"use strict";var o=a("3e42"),s=a.n(o);s.a},"864f":function(t,e,a){},"9c24":function(t,e,a){"use strict";var o=a("864f"),s=a.n(o);s.a}}]);
|
||||
@@ -1 +0,0 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-9f9c2568"],{"01e3":function(e,t,n){"use strict";n.r(t);var s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"page-content"},[n("div",{staticClass:"top-title color-border",staticStyle:{display:"flex"}},[n("span",[e._v(e._s(e.$t("upgrade"))),e.elstep>0?n("span",{staticClass:"line"}):e._e()]),e.elstep>0?n("el-steps",{staticStyle:{flex:"1"},attrs:{active:e.elstep,"finish-status":"success",simple:""}},[n("el-step",{attrs:{title:e.$t("founder_upgrade_updatelist")}}),n("el-step",{attrs:{title:e.$t("founder_upgrade_download")}}),n("el-step",{attrs:{title:e.$t("founder_upgrade_compare")}}),n("el-step",{attrs:{title:e.$t("founder_upgrade_upgrading")}}),n("el-step",{attrs:{title:e.$t("founder_upgrade_complete")}})],1):e._e()],1),n("el-scrollbar",{staticClass:"page-component__scroll"},[n("div",{staticClass:"content",staticStyle:{padding:"25px"}},[n(e.template,{tag:"component",attrs:{returnData:e.returnData},on:{handleStep:e.handleStep}})],1)])],1)},a=[],r=(n("d3b7"),{props:["returnData"],data:function(){return{elstep:"",template:""}},watch:{elstep:{handler:function(e){this.handleTemplate()}},$route:{handler:function(e){e.params&&e.params.version&&(this.elstep=5)},deep:!0}},created:function(){this.returnData.iframes?this.elstep=4:(this.elstep=this.returnData.step?this.returnData.step:1,this.handleTemplate())},methods:{handleStep:function(e){e.upgradeNone?(this.template="upgradeNone",this.elstep=0):e.upgradeError?(this.template="upgradeError",this.elstep=0):e.bbclosed?(this.template="bbclosed",this.elstep=0):this.elstep=e.template},handleTemplate:function(){switch(this.elstep){case 1:this.template="step1";break;case 2:this.template="step2";break;case 3:this.template="step3";break;case 4:this.template="step4";break;case 5:this.template="step5";break}}},components:{upgradeError:function(){return n.e("chunk-2d20fcd9").then(n.bind(null,"b4d5"))},upgradeNone:function(){return n.e("chunk-2d0bdbc6").then(n.bind(null,"2ced"))},bbclosed:function(){return n.e("chunk-2d0a3327").then(n.bind(null,"00c4"))},step1:function(){return n.e("chunk-77c8d08e").then(n.bind(null,"1f5d"))},step2:function(){return n.e("chunk-2d21ddf7").then(n.bind(null,"d2c6"))},step3:function(){return n.e("chunk-2d0efd3c").then(n.bind(null,"9a86"))},step4:function(){return n.e("chunk-36bedb7f").then(n.bind(null,"4e68"))},step5:function(){return n.e("chunk-2d0dd46d").then(n.bind(null,"8164"))}},destroyed:function(){}}),l=r,p=(n("8dc4"),n("2877")),i=Object(p["a"])(l,s,a,!1,null,"0dbad62e",null);t["default"]=i.exports},"1a21":function(e,t,n){},"8dc4":function(e,t,n){"use strict";var s=n("1a21"),a=n.n(s);a.a}}]);
|
||||
1
admin/system/dist/js/index.b5ff203c.js
vendored
1
admin/system/dist/js/index.b5ff203c.js
vendored
File diff suppressed because one or more lines are too long
1
admin/system/dist/js/index.b9edc49b.js
vendored
Normal file
1
admin/system/dist/js/index.b9edc49b.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
admin/system/dist/js/index.d77cc092.js
vendored
1
admin/system/dist/js/index.d77cc092.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -1,18 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
require_once(__DIR__.'/dist/index.html');
|
||||
exit();
|
||||
$operation = $_GET['operation'] ? $_GET['operation'] : 'updatecache';
|
||||
$url=getglobal('siteurl'). BASESCRIPT . '?mod=system&op=' . $operation;
|
||||
$url = outputurl($url);
|
||||
@header("location: $url");
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
require_once(__DIR__.'/dist/index.html');
|
||||
exit();
|
||||
$operation = $_GET['operation'] ? $_GET['operation'] : 'updatecache';
|
||||
$url=getglobal('siteurl'). BASESCRIPT . '?mod=system&op=' . $operation;
|
||||
$url = outputurl($url);
|
||||
@header("location: $url");
|
||||
?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,343 +1,346 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
exit(json_encode(array('bbclosed'=>true)));
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
// if ($_GET['ungetfrom']) {
|
||||
// if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
// $dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$version;
|
||||
// $url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
// exit(json_encode(array('iframe'=>true,'url'=>$url)));
|
||||
// dheader('Location: ' . $url);
|
||||
// } else {
|
||||
// exit(json_encode(array('error'=>true,'msg'=>lang('upgrade_param_error'))));
|
||||
// }
|
||||
// }
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
upgradeinformation(-1);
|
||||
exit(json_encode(array('upgradeNone'=>true)));
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=intsystemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if (empty($updatefilelist)) {
|
||||
upgradeinformation(-2);
|
||||
exit(json_encode(array('upgradeError'=>true)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
exit(json_encode(array('step'=>1,'data'=>$updatefilelist)));
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
$linkurl = $theurl . '&step=3';
|
||||
upgradeinformation(0);
|
||||
exit(json_encode(array('step'=>2,'downloadstatus'=>4)));
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>$fileseq,'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)));
|
||||
upgradeinformation(1);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>1)));
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>($fileseq + 1),'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)));
|
||||
upgradeinformation(1);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>2)));
|
||||
} else {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1]);
|
||||
upgradeinformation(-3);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>3)));
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
|
||||
$tableData = array();
|
||||
$button = '';
|
||||
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
|
||||
}else{
|
||||
if(empty($modifylist)){
|
||||
$button = lang('founder_upgrade_regular');
|
||||
}else{
|
||||
$button = lang('founder_upgrade_force');
|
||||
}
|
||||
foreach($updatefilelist as $val){
|
||||
if(isset($modifylist[$val])){
|
||||
$res = array('name'=>$val,'status'=>1);
|
||||
}elseif(isset($showlist[$val])){
|
||||
$res = array('name'=>$val,'status'=>2);
|
||||
}elseif(isset($newlist[$val])){
|
||||
$res = array('name'=>$val,'status'=>3);
|
||||
}else{
|
||||
$res = array('name'=>$val,'status'=>1);
|
||||
}
|
||||
$tableData[] = $res;
|
||||
}
|
||||
}
|
||||
upgradeinformation(-4);
|
||||
exit(json_encode(array('step'=>3,'tableData'=>$tableData,'button'=>$button,'oldversion'=>CORE_VERSION)));
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp&formhash='.FORMHASH . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
exit(json_encode(array('siteftpsetting'=>true,'url'=>$action)));
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
exit(json_encode(array('againsiteftpsetting'=>true)));
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
upgradeinformation(2);
|
||||
exit(json_encode(array('backfile'=>true,'url'=>$linkurl)));
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
upgradeinformation(-5);
|
||||
exit(json_encode(array('destfile'=>true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
upgradeinformation(3);
|
||||
exit(json_encode(array('complete'=>true,'url'=>$theurl.'&step=4&startupgrade=1&confirm='.$confirm.$paraftp)));
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
upgradeinformation(-6);
|
||||
exit(json_encode(array('ftpError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl)));
|
||||
} else {
|
||||
upgradeinformation(-7);
|
||||
exit(json_encode(array('copyError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
// $dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$version;
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
upgradeinformation(4);
|
||||
exit(json_encode(array('updateMysql'=>true,'url'=>$linkurl)));
|
||||
|
||||
}
|
||||
exit(json_encode(array('nextStep'=>true)));
|
||||
|
||||
} elseif ($step == 5) {
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
upgradeinformation(0);
|
||||
exit(json_encode(array('dir'=>$new_update_dir,'backdir'=>$new_back_dir)));
|
||||
// $msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
// $dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$upgrade_step['cachevalue']['version'];
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
exit(json_encode(array('iframe'=>true,'steplang'=>$steplang['dbupdate'],'url'=>$stepurl)));
|
||||
} else {
|
||||
exit(json_encode(array('html'=>true,'steplang'=>$steplang[$upgrade_step['cachevalue']['step']],'data'=>$upgrade_step['cachevalue'])));
|
||||
}
|
||||
}else{
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
exit(json_encode(array('html'=>false)));
|
||||
}
|
||||
}else{
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
exit(json_encode(array('html'=>false)));
|
||||
}
|
||||
exit();
|
||||
}elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$flist = array();
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
if ($unupgrade) {
|
||||
$flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$flist['msg'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
$flist['update'] = false;
|
||||
} else {
|
||||
$flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$flist['update'] = true;
|
||||
$flist['version'] = $upgrade['latestversion'];
|
||||
$flist['locale'] = $locale;
|
||||
$flist['charset'] = $charset;
|
||||
}
|
||||
$list[] = $flist;
|
||||
}
|
||||
exit(json_encode(array('content'=>true,'data'=>$list)));
|
||||
} else {
|
||||
exit(json_encode(array('content'=>false)));
|
||||
}
|
||||
}elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
// $url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
// dheader('Location: ' . $url);
|
||||
}
|
||||
// include template('upgrade');
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
C::t('setting')->update('bbclosed', 1);
|
||||
updatecache('setting');
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
// if ($_GET['ungetfrom']) {
|
||||
// if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
// $dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$version;
|
||||
// $url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
// exit(json_encode(array('iframe'=>true,'url'=>$url)));
|
||||
// dheader('Location: ' . $url);
|
||||
// } else {
|
||||
// exit(json_encode(array('error'=>true,'msg'=>lang('upgrade_param_error'))));
|
||||
// }
|
||||
// }
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
upgradeinformation(-1);
|
||||
exit(json_encode(array('upgradeNone'=>true)));
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=intsystemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if (empty($updatefilelist)) {
|
||||
upgradeinformation(-2);
|
||||
exit(json_encode(array('upgradeError'=>true)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
exit(json_encode(array('step'=>1,'data'=>$updatefilelist)));
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
$linkurl = $theurl . '&step=3';
|
||||
upgradeinformation(0);
|
||||
exit(json_encode(array('step'=>2,'downloadstatus'=>4)));
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>$fileseq,'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)));
|
||||
upgradeinformation(1);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>1)));
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>($fileseq + 1),'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)));
|
||||
upgradeinformation(1);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>2)));
|
||||
} else {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1]);
|
||||
upgradeinformation(-3);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>3)));
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
|
||||
$tableData = array();
|
||||
$button = '';
|
||||
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
|
||||
}else{
|
||||
if(empty($modifylist)){
|
||||
$button = lang('founder_upgrade_regular');
|
||||
}else{
|
||||
$button = lang('founder_upgrade_force');
|
||||
}
|
||||
foreach($updatefilelist as $val){
|
||||
if(isset($modifylist[$val])){
|
||||
$res = array('name'=>$val,'status'=>1);
|
||||
}elseif(isset($showlist[$val])){
|
||||
$res = array('name'=>$val,'status'=>2);
|
||||
}elseif(isset($newlist[$val])){
|
||||
$res = array('name'=>$val,'status'=>3);
|
||||
}else{
|
||||
$res = array('name'=>$val,'status'=>1);
|
||||
}
|
||||
$tableData[] = $res;
|
||||
}
|
||||
}
|
||||
upgradeinformation(-4);
|
||||
exit(json_encode(array('step'=>3,'tableData'=>$tableData,'button'=>$button,'oldversion'=>CORE_VERSION)));
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp&formhash='.FORMHASH . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
exit(json_encode(array('siteftpsetting'=>true,'url'=>$action)));
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
exit(json_encode(array('againsiteftpsetting'=>true)));
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
upgradeinformation(2);
|
||||
exit(json_encode(array('backfile'=>true,'url'=>$linkurl)));
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
upgradeinformation(-5);
|
||||
exit(json_encode(array('destfile'=>true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
upgradeinformation(3);
|
||||
exit(json_encode(array('complete'=>true,'url'=>$theurl.'&step=4&startupgrade=1&confirm='.$confirm.$paraftp)));
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
upgradeinformation(-6);
|
||||
exit(json_encode(array('ftpError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl)));
|
||||
} else {
|
||||
upgradeinformation(-7);
|
||||
exit(json_encode(array('copyError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
// $dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$version;
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
upgradeinformation(4);
|
||||
exit(json_encode(array('updateMysql'=>true,'url'=>$linkurl)));
|
||||
|
||||
}
|
||||
exit(json_encode(array('nextStep'=>true)));
|
||||
|
||||
} elseif ($step == 5) {
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
//打开站点
|
||||
C::t('setting')->update('bbclosed', 0);
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
upgradeinformation(0);
|
||||
exit(json_encode(array('version' => $version,'dir'=>$new_update_dir,'backdir'=>$new_back_dir)));
|
||||
// $msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
// $dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$upgrade_step['cachevalue']['version'];
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
exit(json_encode(array('iframe'=>true,'steplang'=>$steplang['dbupdate'],'url'=>$stepurl)));
|
||||
} else {
|
||||
exit(json_encode(array('html'=>true,'steplang'=>$steplang[$upgrade_step['cachevalue']['step']],'data'=>$upgrade_step['cachevalue'])));
|
||||
}
|
||||
}else{
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
exit(json_encode(array('html'=>false)));
|
||||
}
|
||||
}else{
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
exit(json_encode(array('html'=>false)));
|
||||
}
|
||||
exit();
|
||||
}elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$flist = array();
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
if ($unupgrade) {
|
||||
$flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$flist['msg'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
$flist['update'] = false;
|
||||
} else {
|
||||
$flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$flist['update'] = true;
|
||||
$flist['version'] = $upgrade['latestversion'];
|
||||
$flist['locale'] = $locale;
|
||||
$flist['charset'] = $charset;
|
||||
}
|
||||
$list[] = $flist;
|
||||
}
|
||||
exit(json_encode(array('content'=>true,'data'=>$list)));
|
||||
} else {
|
||||
exit(json_encode(array('content'=>false)));
|
||||
}
|
||||
}elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
// $url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
// dheader('Location: ' . $url);
|
||||
}
|
||||
// include template('upgrade');
|
||||
?>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$lang = array (
|
||||
'appname'=>'System Tool',
|
||||
'systemupgrade'=>'online upgrade',
|
||||
'tools_updatecache_memory'=>'Memory Cache'
|
||||
);
|
||||
<?php
|
||||
$lang = array (
|
||||
'appname'=>'System Tool',
|
||||
'systemupgrade'=>'online upgrade',
|
||||
'tools_updatecache_memory'=>'Memory Cache'
|
||||
);
|
||||
?>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$lang = array (
|
||||
'appname'=>'系统工具',
|
||||
'systemupgrade'=>'在线升级',
|
||||
'tools_updatecache_memory'=>'内存缓存'
|
||||
);
|
||||
<?php
|
||||
$lang = array (
|
||||
'appname'=>'系统工具',
|
||||
'systemupgrade'=>'在线升级',
|
||||
'tools_updatecache_memory'=>'内存缓存'
|
||||
);
|
||||
?>
|
||||
@@ -1,416 +1,416 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_close_site') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.reload();" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
//$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
if ($_GET['ungetfrom']) {
|
||||
if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
dheader('Location: ' . $url);
|
||||
} else {
|
||||
showmessage('upgrade_param_error');
|
||||
}
|
||||
}
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
//$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_none', array('upgradeurl' => upgradeinformation(-1))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
|
||||
if (empty($updatefilelist)) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_download_upgradelist_error', array('upgradeurl' => upgradeinformation(-2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($thurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>';
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
$linkurl = $theurl . '&step=2';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
|
||||
$linkurl = $theurl . '&step=3';
|
||||
$downloadstatus = 3;
|
||||
$msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0)));
|
||||
if (!$_GET['iframe']) {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("parent.location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="parent.location.href=\'' . $linkurl . '\';return false;">' . lang('message_redirect') . '</a></p>';
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
if (!$_GET['iframe']) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = '<iframe id="downiframe" marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' . $linkurl . '" style="width:100%;height:100%;"></iframe>';
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq + 1) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script></p>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_redownload', array('file' => $updatefilelist[$fileseq - 1], 'upgradeurl' => upgradeinformation(-3))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0;"><input type="button" class="btn btn-success" value="'.lang('founder_upgrade_reset').'" onclick="location.href=\'' . $linkurl . '\'" />';
|
||||
}
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
$msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4)));
|
||||
}
|
||||
$linkurl = $theurl . '&step=4';
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=4';
|
||||
$ftplinkurl = $linkurl . '&siteftpsetting=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_cannot_access_file') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
$msg .= "<script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backuping', array('upgradeurl' => upgradeinformation(2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($linkurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_error', array('upgradeurl' => upgradeinformation(-5))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_complete', array('upgradeurl' => upgradeinformation(3))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_ftp_upload_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-6))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reupload') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_reset_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
} else {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_copy_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_recopy') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_file_successful', array('upgradeurl' => upgradeinformation(4))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout(function(){createIframe(\'' . $linkurl . '\');}, 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' );
|
||||
dheader('Location: ' . $url);
|
||||
|
||||
} elseif ($step == 5) {
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
|
||||
$msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
if (!intval($_GET['rechecking'])) {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
$dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue_db', array('steplang' => $steplang['dbupdate'], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
} else {
|
||||
$stepurl = $theurl . '&step=' . $upgrade_step['cachevalue']['step'];
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue', array('steplang' => $steplang[$upgrade_step['cachevalue']['step']], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
}
|
||||
|
||||
if (!intval($_GET['checking']) || $msg) {
|
||||
|
||||
|
||||
} else {
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
$list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if ($unupgrade) {
|
||||
$list[$type]['title'] = 'oaooa PicHome' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
} else {
|
||||
$list[$type]['title'] = 'oaooa PicHome' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = '<input type="button" class="btn btn-success" onclick="confirm(\'' . lang('founder_upgrade_backup_remind') . '\') ? window.location.href=\'' . $linkurl . '\' : \'\';" value="' . lang('founder_upgrade_automatically') . '">';
|
||||
$list[$type]['official'] = '<a class="btn btn-link" href="' . $upgrade['official'] . '" target="_blank">' . lang('founder_upgrade_manually') . '</a>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
$msg = lang('upgrade_latest_version');
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
|
||||
$url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
include template('upgrade');
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_close_site') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.reload();" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
//$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
if ($_GET['ungetfrom']) {
|
||||
if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
dheader('Location: ' . $url);
|
||||
} else {
|
||||
showmessage('upgrade_param_error');
|
||||
}
|
||||
}
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
//$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_none', array('upgradeurl' => upgradeinformation(-1))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
|
||||
if (empty($updatefilelist)) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_download_upgradelist_error', array('upgradeurl' => upgradeinformation(-2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($thurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>';
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
$linkurl = $theurl . '&step=2';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
|
||||
$linkurl = $theurl . '&step=3';
|
||||
$downloadstatus = 3;
|
||||
$msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0)));
|
||||
if (!$_GET['iframe']) {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("parent.location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="parent.location.href=\'' . $linkurl . '\';return false;">' . lang('message_redirect') . '</a></p>';
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
if (!$_GET['iframe']) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = '<iframe id="downiframe" marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' . $linkurl . '" style="width:100%;height:100%;"></iframe>';
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq + 1) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script></p>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_redownload', array('file' => $updatefilelist[$fileseq - 1], 'upgradeurl' => upgradeinformation(-3))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0;"><input type="button" class="btn btn-success" value="'.lang('founder_upgrade_reset').'" onclick="location.href=\'' . $linkurl . '\'" />';
|
||||
}
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
$msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4)));
|
||||
}
|
||||
$linkurl = $theurl . '&step=4';
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=4';
|
||||
$ftplinkurl = $linkurl . '&siteftpsetting=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_cannot_access_file') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
$msg .= "<script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backuping', array('upgradeurl' => upgradeinformation(2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($linkurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_error', array('upgradeurl' => upgradeinformation(-5))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_complete', array('upgradeurl' => upgradeinformation(3))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_ftp_upload_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-6))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reupload') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_reset_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
} else {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_copy_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_recopy') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_file_successful', array('upgradeurl' => upgradeinformation(4))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout(function(){createIframe(\'' . $linkurl . '\');}, 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' );
|
||||
dheader('Location: ' . $url);
|
||||
|
||||
} elseif ($step == 5) {
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
|
||||
$msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
if (!intval($_GET['rechecking'])) {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
$dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue_db', array('steplang' => $steplang['dbupdate'], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
} else {
|
||||
$stepurl = $theurl . '&step=' . $upgrade_step['cachevalue']['step'];
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue', array('steplang' => $steplang[$upgrade_step['cachevalue']['step']], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
}
|
||||
|
||||
if (!intval($_GET['checking']) || $msg) {
|
||||
|
||||
|
||||
} else {
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
$list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if ($unupgrade) {
|
||||
$list[$type]['title'] = 'oaooa PicHome' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
} else {
|
||||
$list[$type]['title'] = 'oaooa PicHome' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = '<input type="button" class="btn btn-success" onclick="confirm(\'' . lang('founder_upgrade_backup_remind') . '\') ? window.location.href=\'' . $linkurl . '\' : \'\';" value="' . lang('founder_upgrade_automatically') . '">';
|
||||
$list[$type]['official'] = '<a class="btn btn-link" href="' . $upgrade['official'] . '" target="_blank">' . lang('founder_upgrade_manually') . '</a>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
$msg = lang('upgrade_latest_version');
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
|
||||
$url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
include template('upgrade');
|
||||
?>
|
||||
@@ -1,188 +1,188 @@
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<style>
|
||||
input[type="text"] {
|
||||
margin: 0;
|
||||
}
|
||||
ul.help-block, ul.help-block li, .help-block li{
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
<div class="main-header clearfix">
|
||||
<ul class="nav nav-pills nav-pills-bottomguide">
|
||||
<li <!--{if empty($_GET[ 'edit']) && empty($_GET[ 'run'])}-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron">{lang cron}</a>
|
||||
</li>
|
||||
<!--{if !empty($_GET['edit'])}-->
|
||||
<li class="active">
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&edit=$_GET[edit]">{lang misc_cron_edit}</a>
|
||||
</li>
|
||||
<!--{/if}-->
|
||||
<!--{if !empty($_GET['run'])}-->
|
||||
<li class="active">
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&run=$_GET[run]">{lang misc_cron_operation}</a>
|
||||
</li>
|
||||
<!--{/if}-->
|
||||
</ul>
|
||||
</div>
|
||||
<div class="main-content" style="padding:15px;border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<!--{if $_GET['edit']>0}-->
|
||||
<ul class="help-block">
|
||||
<h4>{lang board_message}</h4> {lang misc_cron_edit_tips}
|
||||
</ul>
|
||||
<form id="cpform" action="{BASESCRIPT}?mod=system&op=cron&edit=$cronid" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="editsubmit">
|
||||
<dl>
|
||||
<dt>{lang weekly}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="weekdaynew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$weekdayselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_weekday_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang everyday}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="daynew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$dayselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_day_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang hour}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="hournew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$hourselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_hour_comment}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang minute}:</dt>
|
||||
<dd class="clearfix">
|
||||
<input name="minutenew" value="{eval echo implode(',',$cron[minute])}" type="text" class="form-control">
|
||||
<span class="help-inline">{lang misc_cron_edit_minute_comment}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang misc_cron_edit_filename}:</dt>
|
||||
<dd class="clearfix">
|
||||
<input name="filenamenew" value="$cron[filename]" type="text" class="form-control">
|
||||
<span class="help-inline">{lang misc_cron_edit_filename_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dd class="clearfix">
|
||||
<button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button>
|
||||
</dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{elseif $_GET['run']}-->
|
||||
|
||||
<!--{else}-->
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang misc_cron_tips}
|
||||
<li class="text-danger mt10">计划任务默认通过用户访问触发。缺点是影响用户访问体验;计划任务执行不及时。可以修改config.php文件,设置参数 {eval echo '$_config[remote][on]=1; $_config[remote][cron]=1;';} 停止这种触发方式。</li>
|
||||
<li class="text-danger">推荐设置通过系统计划任务来触发。如linux系统,可以修改/etc/crontab,加入一行 * * * * root php {eval echo DZZ_ROOT.'cron.php >>/dev/null 2>$1';}</li>
|
||||
<li>详细请查阅官方文档 <a href="http://help.oaooa.com/corpus/list?cid=24#fid_330" target="_blank">管理员手册-计划任务</a> 中的相关内容</li>
|
||||
</ul>
|
||||
<form id="cpform" action="{BASESCRIPT}?mod=system&op=cron" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="cronssubmit">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th width="45"></th>
|
||||
<th>{lang name}</th>
|
||||
<th>{lang available}</th>
|
||||
<th>{lang type}</th>
|
||||
<th>{lang time}</th>
|
||||
<th>{lang misc_cron_last_run}</th>
|
||||
<th>{lang misc_cron_next_run}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<!--{loop $crons $cron}-->
|
||||
<tr>
|
||||
<td align="right"><input type="checkbox" name="delete[]" value="$cron[cronid]" <!--{if $cron[type]=='system' }-->disabled
|
||||
<!--{/if}-->></td>
|
||||
<td>
|
||||
<p class="clearfix">
|
||||
<input type="text" name="namenew[{$cron[cronid]}]" class="form-control" value="$cron[name]"></p>
|
||||
<strong>$cron[filename]</strong>
|
||||
</td>
|
||||
<td><label class="checkbox-inline"><input type="checkbox" name="availablenew[{$cron[cronid]}]" value="1" <!--{if $cron[available]>0}-->checked="checked"<!--{/if}-->></label></td>
|
||||
<td>
|
||||
<!--{if $cron['type'] == 'system'}-->
|
||||
{lang inbuilt}
|
||||
<!--{elseif $cron['type'] == 'user'}-->
|
||||
{lang custom}
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
<td>$cron[time]</td>
|
||||
<td>$cron[lastrun]</td>
|
||||
<td>$cron[nextrun]</td>
|
||||
|
||||
<td>
|
||||
<a href="{BASESCRIPT}?mod=system&op=cron&edit=$cron[cronid]">{lang edit}</a>
|
||||
<br />
|
||||
<!--{if $cron['run']}-->
|
||||
<a href="{BASESCRIPT}?mod=system&op=cron&run=$cron[cronid]">{lang execute}</a>
|
||||
<!--{else}-->
|
||||
<a href="javascript:;" class="text-muted">{lang execute}</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!--{/loop}-->
|
||||
<tr>
|
||||
<td>{lang add_new}</td>
|
||||
<td colspan="10"><input type="text" name="newname" value="" class="form-control"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="15" style="border-bottom:none"><label class="checkbox-inline ml20"><input type="checkbox" name="chkall" id="chkallspKI" onclick="checkAll('prefix', this.form, 'delete')">{lang del}</label> <button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<style>
|
||||
input[type="text"] {
|
||||
margin: 0;
|
||||
}
|
||||
ul.help-block, ul.help-block li, .help-block li{
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
<div class="main-header clearfix">
|
||||
<ul class="nav nav-pills nav-pills-bottomguide">
|
||||
<li <!--{if empty($_GET[ 'edit']) && empty($_GET[ 'run'])}-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron">{lang cron}</a>
|
||||
</li>
|
||||
<!--{if !empty($_GET['edit'])}-->
|
||||
<li class="active">
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&edit=$_GET[edit]">{lang misc_cron_edit}</a>
|
||||
</li>
|
||||
<!--{/if}-->
|
||||
<!--{if !empty($_GET['run'])}-->
|
||||
<li class="active">
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&run=$_GET[run]">{lang misc_cron_operation}</a>
|
||||
</li>
|
||||
<!--{/if}-->
|
||||
</ul>
|
||||
</div>
|
||||
<div class="main-content" style="padding:15px;border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<!--{if $_GET['edit']>0}-->
|
||||
<ul class="help-block">
|
||||
<h4>{lang board_message}</h4> {lang misc_cron_edit_tips}
|
||||
</ul>
|
||||
<form id="cpform" action="{BASESCRIPT}?mod=system&op=cron&edit=$cronid" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="editsubmit">
|
||||
<dl>
|
||||
<dt>{lang weekly}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="weekdaynew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$weekdayselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_weekday_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang everyday}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="daynew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$dayselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_day_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang hour}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="hournew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$hourselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_hour_comment}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang minute}:</dt>
|
||||
<dd class="clearfix">
|
||||
<input name="minutenew" value="{eval echo implode(',',$cron[minute])}" type="text" class="form-control">
|
||||
<span class="help-inline">{lang misc_cron_edit_minute_comment}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang misc_cron_edit_filename}:</dt>
|
||||
<dd class="clearfix">
|
||||
<input name="filenamenew" value="$cron[filename]" type="text" class="form-control">
|
||||
<span class="help-inline">{lang misc_cron_edit_filename_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dd class="clearfix">
|
||||
<button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button>
|
||||
</dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{elseif $_GET['run']}-->
|
||||
|
||||
<!--{else}-->
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang misc_cron_tips}
|
||||
<li class="text-danger mt10">计划任务默认通过用户访问触发。缺点是影响用户访问体验;计划任务执行不及时。可以修改config.php文件,设置参数 {eval echo '$_config[remote][on]=1; $_config[remote][cron]=1;';} 停止这种触发方式。</li>
|
||||
<li class="text-danger">推荐设置通过系统计划任务来触发。如linux系统,可以修改/etc/crontab,加入一行 * * * * root php {eval echo DZZ_ROOT.'cron.php >>/dev/null 2>$1';}</li>
|
||||
<li>详细请查阅官方文档 <a href="http://help.oaooa.com/corpus/list?cid=24#fid_330" target="_blank">管理员手册-计划任务</a> 中的相关内容</li>
|
||||
</ul>
|
||||
<form id="cpform" action="{BASESCRIPT}?mod=system&op=cron" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="cronssubmit">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th width="45"></th>
|
||||
<th>{lang name}</th>
|
||||
<th>{lang available}</th>
|
||||
<th>{lang type}</th>
|
||||
<th>{lang time}</th>
|
||||
<th>{lang misc_cron_last_run}</th>
|
||||
<th>{lang misc_cron_next_run}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<!--{loop $crons $cron}-->
|
||||
<tr>
|
||||
<td align="right"><input type="checkbox" name="delete[]" value="$cron[cronid]" <!--{if $cron[type]=='system' }-->disabled
|
||||
<!--{/if}-->></td>
|
||||
<td>
|
||||
<p class="clearfix">
|
||||
<input type="text" name="namenew[{$cron[cronid]}]" class="form-control" value="$cron[name]"></p>
|
||||
<strong>$cron[filename]</strong>
|
||||
</td>
|
||||
<td><label class="checkbox-inline"><input type="checkbox" name="availablenew[{$cron[cronid]}]" value="1" <!--{if $cron[available]>0}-->checked="checked"<!--{/if}-->></label></td>
|
||||
<td>
|
||||
<!--{if $cron['type'] == 'system'}-->
|
||||
{lang inbuilt}
|
||||
<!--{elseif $cron['type'] == 'user'}-->
|
||||
{lang custom}
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
<td>$cron[time]</td>
|
||||
<td>$cron[lastrun]</td>
|
||||
<td>$cron[nextrun]</td>
|
||||
|
||||
<td>
|
||||
<a href="{BASESCRIPT}?mod=system&op=cron&edit=$cron[cronid]">{lang edit}</a>
|
||||
<br />
|
||||
<!--{if $cron['run']}-->
|
||||
<a href="{BASESCRIPT}?mod=system&op=cron&run=$cron[cronid]">{lang execute}</a>
|
||||
<!--{else}-->
|
||||
<a href="javascript:;" class="text-muted">{lang execute}</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!--{/loop}-->
|
||||
<tr>
|
||||
<td>{lang add_new}</td>
|
||||
<td colspan="10"><input type="text" name="newname" value="" class="form-control"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="15" style="border-bottom:none"><label class="checkbox-inline ml20"><input type="checkbox" name="chkall" id="chkallspKI" onclick="checkAll('prefix', this.form, 'delete')">{lang del}</label> <button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/footer_simple}-->
|
||||
@@ -1,236 +1,236 @@
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
<div class="main-header clearfix">
|
||||
<ul class="nav nav-pills nav-pills-bottomguide">
|
||||
<li <!--{if $operation=='export' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=export">{lang export}</a>
|
||||
</li>
|
||||
<li <!--{if $operation=='import' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=import">{lang nav_db_import}</a>
|
||||
</li>
|
||||
<li <!--{if $operation=='runquery' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=runquery">{lang nav_db_runquery}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--{if $operation=='export'}-->
|
||||
<ul class="help-block mt20">
|
||||
<h5>{lang board_message}</h5> {lang db_export_tips}
|
||||
</ul>
|
||||
<div class="main-content">
|
||||
<!--{if !$submit}-->
|
||||
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=export&setup=1" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="exportsubmit">
|
||||
<dl>
|
||||
<dt>{lang db_export_type}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="type" value="dzz" checked="" onclick="document.getElementById('showtables').style.display = 'none';">{lang all_data_table}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="type" value="custom" onclick="document.getElementById('showtables').style.display = '';">{lang db_export_custom}</label></dd>
|
||||
<dd id="showtables" class="clearfix" style="display:none;border:1px solid #D2D2D2">
|
||||
<h4 class="clearfix ml20"> <label class="checkbox-inline" for ="chkalltables"><input name="chkall" onclick="checkAll('prefix', this.form, 'customtables', 'chkall', true)" checked="checked" type="checkbox" id="chkalltables">{lang check_all_data_table}</label></h4>
|
||||
<ul class="list-unstyled">
|
||||
<!--{loop $dztables $value}-->
|
||||
<li class="col-xs-4"><label class="checkbox-inline"><input type="checkbox" name="customtables[]" value="$value" checked="checked">$value</label></li>
|
||||
<!--{/loop}-->
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<div id="advanceoption" style="display:none">
|
||||
|
||||
<dl>
|
||||
<dt>{lang db_export_method}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="method" value="shell" onclick="if('0') {if(this.form.sqlcompat[2].checked==true) this.form.sqlcompat[0].checked=true; this.form.sqlcompat[2].disabled=true; this.form.sizelimit.disabled=true;} else {this.form.sqlcharset[0].checked=true; for(var i=1; i<=5; i++) {if(this.form.sqlcharset[i]) this.form.sqlcharset[i].disabled=true;}}" id="method_shell">{lang db_export_shell}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="method" value="multivol" checked="checked" onclick="this.form.sqlcompat[2].disabled=false; this.form.sizelimit.disabled=false; for(var i=1; i<=5; i++) {if(this.form.sqlcharset[i]) this.form.sqlcharset[i].disabled=false;}" id="method_multivol">{lang db_export_multivol}</label>
|
||||
<input type="text" class="input-sm form-control" style="width:50px;" name="sizelimit" value="2048">
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_extended_insert}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="extendins" value="1">{lang yes}</label><label class="radio radio-inline"><input type="radio" name="extendins" value="0" checked="checked">{lang no}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_sql_compatible}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="" checked="">{lang default}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="MYSQL40"> MySQL 3.23/4.0.x</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="MYSQL41" disabled=""> MySQL 4.1.x/5.x</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_charset}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcharset" value="">{lang db_export_options_charset}</label>
|
||||
<label class="radio radio-inline"><input type="radio" name="sqlcharset" value="utf8"> UTF8</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_usehex}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usehex" value="1" checked="checked">{lang yes}</label>
|
||||
<label class="radio radio-inline"><input type="radio" name="usehex" value="0" >{lang no}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_usezip}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="1">{lang db_export_zip_1}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="2">{lang db_export_zip_2}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="0" checked>{lang db_export_zip_3}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_filename}:</dt>
|
||||
<dd class="clearfix"><input type="text" class="form-control" name="filename" value="$defaultfilename"></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<dl>
|
||||
<dd class="clearfix"><button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button>
|
||||
<label class="checkbox inline"><input type="checkbox" value="1" onclick="document.getElementById('advanceoption').style.display = document.getElementById('advanceoption').style.display == 'none' ? '' : 'none'; this.value = this.value == 1 ? 0 : 1; this.checked = this.value == 1 ? false : true" id="btn_more">{lang more_options}</label></dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{else}-->
|
||||
<div class="well">
|
||||
<!--{if $msg}-->
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{/if}-->
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='import'}-->
|
||||
<div class="main-content" style="border:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang db_import_tips}
|
||||
</ul>
|
||||
$do_import_option
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=import" class="form-horizontal form-horizontal-left " method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="deletesubmit">
|
||||
<table class="table table-hover" style="border-top:1px solid #DDD">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th>{lang filename}</th>
|
||||
<th>{lang version}</th>
|
||||
<th>{lang time}</th>
|
||||
<th>{lang type}</th>
|
||||
<th>{lang big_small}</th>
|
||||
<th>{lang db_method}</th>
|
||||
<th>{lang db_volume}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<!--{loop $list $key $val}-->
|
||||
<tr>
|
||||
<td><input type="checkbox" name="delete[]" value="$key"></td>
|
||||
<td>
|
||||
<!--{if $val['list']}-->
|
||||
<a href="javascript:;" onclick="jQuery('#exportlog_{$key}').toggle()">$key</a>
|
||||
<!--{else}-->
|
||||
<a href="$val[filename]">$key</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
<td>$val[version]</td>
|
||||
<td>$val[dateline]</td>
|
||||
<td>$val[ftype]</td>
|
||||
<td>$val[size]</td>
|
||||
<td>$val[method]</td>
|
||||
<td>$val[volume]</td>
|
||||
<td>
|
||||
<!--{if $val['list']}-->
|
||||
<a href="{$datasiteurl}restore.php?operation=import&from=server&datafile_server=$val[datafile_server]&importsubmit=yes" <!--{if $info[ 'version'] !=$_G[ 'setting'][ 'version']}--> onclick="return confirm('{lang db_import_confirm}');"<!--{else}-->onclick="return confirm('{lang db_import_confirm_sql}');"<!--{/if}-->target="_blank">{lang import}</a>
|
||||
<!--{else}-->
|
||||
<a href="{$datasiteurl}restore.php?operation=importzip&datafile_server=$info[datafile_server]&importsubmit=yes" onclick="return confirm('{lang db_import_confirm_zip}');" target="_blank">{lang db_import_unzip}</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
<thead id="exportlog_{$key}" style="display:none;">
|
||||
<!--{loop $val[list] $key1 $val1}-->
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<a href="$val1[filename]">$val1[filename]</a>
|
||||
</td>
|
||||
<td>$val1[version]</td>
|
||||
<td>$val1[dateline]</td>
|
||||
<td></td>
|
||||
<td>$val1[size]</td>
|
||||
<td></td>
|
||||
<td>$val1[volume]</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
</thead>
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="15"><input type="checkbox" name="chkall" id="chkallspKI" onclick="checkAll('prefix', this.form, 'delete')">{lang del} <button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='runquery'}-->
|
||||
<div class="main-content">
|
||||
|
||||
<ul class="help-block">
|
||||
<h4>{lang board_message}</h4>
|
||||
{lang db_runquery_tips}
|
||||
</ul>
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 5000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=runquery" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="sqlsubmit">
|
||||
<dl>
|
||||
<dt>{lang db_runquery_sql}</dt>
|
||||
<dd class="clearfix"><textarea cols="85" rows="10" name="queries" style="width:500px;"></textarea></dd>
|
||||
<dd class="clearfix mt10"><label class="checkbox-inline"><input name="createcompatible" type="checkbox" value="1" checked="checked" />{lang db_runquery_createcompatible}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dd class="clearfix"><button type="submit" class="btn btn-primary">{lang blank_submit}</button></dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
<div class="main-header clearfix">
|
||||
<ul class="nav nav-pills nav-pills-bottomguide">
|
||||
<li <!--{if $operation=='export' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=export">{lang export}</a>
|
||||
</li>
|
||||
<li <!--{if $operation=='import' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=import">{lang nav_db_import}</a>
|
||||
</li>
|
||||
<li <!--{if $operation=='runquery' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=runquery">{lang nav_db_runquery}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--{if $operation=='export'}-->
|
||||
<ul class="help-block mt20">
|
||||
<h5>{lang board_message}</h5> {lang db_export_tips}
|
||||
</ul>
|
||||
<div class="main-content">
|
||||
<!--{if !$submit}-->
|
||||
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=export&setup=1" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="exportsubmit">
|
||||
<dl>
|
||||
<dt>{lang db_export_type}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="type" value="dzz" checked="" onclick="document.getElementById('showtables').style.display = 'none';">{lang all_data_table}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="type" value="custom" onclick="document.getElementById('showtables').style.display = '';">{lang db_export_custom}</label></dd>
|
||||
<dd id="showtables" class="clearfix" style="display:none;border:1px solid #D2D2D2">
|
||||
<h4 class="clearfix ml20"> <label class="checkbox-inline" for ="chkalltables"><input name="chkall" onclick="checkAll('prefix', this.form, 'customtables', 'chkall', true)" checked="checked" type="checkbox" id="chkalltables">{lang check_all_data_table}</label></h4>
|
||||
<ul class="list-unstyled">
|
||||
<!--{loop $dztables $value}-->
|
||||
<li class="col-xs-4"><label class="checkbox-inline"><input type="checkbox" name="customtables[]" value="$value" checked="checked">$value</label></li>
|
||||
<!--{/loop}-->
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<div id="advanceoption" style="display:none">
|
||||
|
||||
<dl>
|
||||
<dt>{lang db_export_method}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="method" value="shell" onclick="if('0') {if(this.form.sqlcompat[2].checked==true) this.form.sqlcompat[0].checked=true; this.form.sqlcompat[2].disabled=true; this.form.sizelimit.disabled=true;} else {this.form.sqlcharset[0].checked=true; for(var i=1; i<=5; i++) {if(this.form.sqlcharset[i]) this.form.sqlcharset[i].disabled=true;}}" id="method_shell">{lang db_export_shell}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="method" value="multivol" checked="checked" onclick="this.form.sqlcompat[2].disabled=false; this.form.sizelimit.disabled=false; for(var i=1; i<=5; i++) {if(this.form.sqlcharset[i]) this.form.sqlcharset[i].disabled=false;}" id="method_multivol">{lang db_export_multivol}</label>
|
||||
<input type="text" class="input-sm form-control" style="width:50px;" name="sizelimit" value="2048">
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_extended_insert}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="extendins" value="1">{lang yes}</label><label class="radio radio-inline"><input type="radio" name="extendins" value="0" checked="checked">{lang no}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_sql_compatible}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="" checked="">{lang default}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="MYSQL40"> MySQL 3.23/4.0.x</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="MYSQL41" disabled=""> MySQL 4.1.x/5.x</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_charset}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcharset" value="">{lang db_export_options_charset}</label>
|
||||
<label class="radio radio-inline"><input type="radio" name="sqlcharset" value="utf8"> UTF8</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_usehex}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usehex" value="1" checked="checked">{lang yes}</label>
|
||||
<label class="radio radio-inline"><input type="radio" name="usehex" value="0" >{lang no}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_usezip}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="1">{lang db_export_zip_1}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="2">{lang db_export_zip_2}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="0" checked>{lang db_export_zip_3}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_filename}:</dt>
|
||||
<dd class="clearfix"><input type="text" class="form-control" name="filename" value="$defaultfilename"></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<dl>
|
||||
<dd class="clearfix"><button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button>
|
||||
<label class="checkbox inline"><input type="checkbox" value="1" onclick="document.getElementById('advanceoption').style.display = document.getElementById('advanceoption').style.display == 'none' ? '' : 'none'; this.value = this.value == 1 ? 0 : 1; this.checked = this.value == 1 ? false : true" id="btn_more">{lang more_options}</label></dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{else}-->
|
||||
<div class="well">
|
||||
<!--{if $msg}-->
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{/if}-->
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='import'}-->
|
||||
<div class="main-content" style="border:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang db_import_tips}
|
||||
</ul>
|
||||
$do_import_option
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=import" class="form-horizontal form-horizontal-left " method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="deletesubmit">
|
||||
<table class="table table-hover" style="border-top:1px solid #DDD">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th>{lang filename}</th>
|
||||
<th>{lang version}</th>
|
||||
<th>{lang time}</th>
|
||||
<th>{lang type}</th>
|
||||
<th>{lang big_small}</th>
|
||||
<th>{lang db_method}</th>
|
||||
<th>{lang db_volume}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<!--{loop $list $key $val}-->
|
||||
<tr>
|
||||
<td><input type="checkbox" name="delete[]" value="$key"></td>
|
||||
<td>
|
||||
<!--{if $val['list']}-->
|
||||
<a href="javascript:;" onclick="jQuery('#exportlog_{$key}').toggle()">$key</a>
|
||||
<!--{else}-->
|
||||
<a href="$val[filename]">$key</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
<td>$val[version]</td>
|
||||
<td>$val[dateline]</td>
|
||||
<td>$val[ftype]</td>
|
||||
<td>$val[size]</td>
|
||||
<td>$val[method]</td>
|
||||
<td>$val[volume]</td>
|
||||
<td>
|
||||
<!--{if $val['list']}-->
|
||||
<a href="{$datasiteurl}restore.php?operation=import&from=server&datafile_server=$val[datafile_server]&importsubmit=yes" <!--{if $info[ 'version'] !=$_G[ 'setting'][ 'version']}--> onclick="return confirm('{lang db_import_confirm}');"<!--{else}-->onclick="return confirm('{lang db_import_confirm_sql}');"<!--{/if}-->target="_blank">{lang import}</a>
|
||||
<!--{else}-->
|
||||
<a href="{$datasiteurl}restore.php?operation=importzip&datafile_server=$info[datafile_server]&importsubmit=yes" onclick="return confirm('{lang db_import_confirm_zip}');" target="_blank">{lang db_import_unzip}</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
<thead id="exportlog_{$key}" style="display:none;">
|
||||
<!--{loop $val[list] $key1 $val1}-->
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<a href="$val1[filename]">$val1[filename]</a>
|
||||
</td>
|
||||
<td>$val1[version]</td>
|
||||
<td>$val1[dateline]</td>
|
||||
<td></td>
|
||||
<td>$val1[size]</td>
|
||||
<td></td>
|
||||
<td>$val1[volume]</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
</thead>
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="15"><input type="checkbox" name="chkall" id="chkallspKI" onclick="checkAll('prefix', this.form, 'delete')">{lang del} <button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='runquery'}-->
|
||||
<div class="main-content">
|
||||
|
||||
<ul class="help-block">
|
||||
<h4>{lang board_message}</h4>
|
||||
{lang db_runquery_tips}
|
||||
</ul>
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 5000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=runquery" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="sqlsubmit">
|
||||
<dl>
|
||||
<dt>{lang db_runquery_sql}</dt>
|
||||
<dd class="clearfix"><textarea cols="85" rows="10" name="queries" style="width:500px;"></textarea></dd>
|
||||
<dd class="clearfix mt10"><label class="checkbox-inline"><input name="createcompatible" type="checkbox" value="1" checked="checked" />{lang db_runquery_createcompatible}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dd class="clearfix"><button type="submit" class="btn btn-primary">{lang blank_submit}</button></dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/footer_simple}-->
|
||||
@@ -1,12 +1,12 @@
|
||||
{eval $oparr=array('updatecache','database','cron','systemupgrade' );}
|
||||
{eval $leftmenu=array();}
|
||||
{eval foreach($oparr as $key => $value){}
|
||||
{eval $leftmenu[$value]=array('title'=>lang($value),'active'=>'');}
|
||||
{eval if($value==$op) $leftmenu[$value]['active']='class="active"';}
|
||||
{eval }}
|
||||
|
||||
<ul class="nav-stacked">
|
||||
<!--{loop $leftmenu $key $value}-->
|
||||
<li $value[active]><a hidefocus="true" href="{MOD_URL}&op=$key">$value[title]</a></li>
|
||||
<!--{/loop}-->
|
||||
{eval $oparr=array('updatecache','database','cron','systemupgrade' );}
|
||||
{eval $leftmenu=array();}
|
||||
{eval foreach($oparr as $key => $value){}
|
||||
{eval $leftmenu[$value]=array('title'=>lang($value),'active'=>'');}
|
||||
{eval if($value==$op) $leftmenu[$value]['active']='class="active"';}
|
||||
{eval }}
|
||||
|
||||
<ul class="nav-stacked">
|
||||
<!--{loop $leftmenu $key $value}-->
|
||||
<li $value[active]><a hidefocus="true" href="{MOD_URL}&op=$key">$value[title]</a></li>
|
||||
<!--{/loop}-->
|
||||
</ul>
|
||||
@@ -1,73 +1,73 @@
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
|
||||
<div class="main-header">
|
||||
<div class="clearfix" style="line-height:40px;padding:0 10px">
|
||||
<!-- <strong style="font-size:14px;">{lang updatecache}</strong>-->
|
||||
<span class="text-muted" id="step1" <!--{if $step==1}-->style="color:green"<!--{/if}-->>1.{lang nav_updatecache_confirm}</span>
|
||||
<span class="text-muted" id="step2" <!--{if $step==2}-->style="color:green"<!--{/if}-->>2.{lang nav_updatecache_verify}</span>
|
||||
<span class="text-muted" id="step3" <!--{if $step==3}-->style="color:green"<!--{/if}-->>3.{lang nav_updatecache_completed}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main-content" style="padding:20px;border-top:1px solid #FFF">
|
||||
<div class="well well-sm">
|
||||
<!--{if $step==1}-->
|
||||
<form method="post" class="form-horizontal form-horizontal-left" action="{MOD_URL}&op=updatecache&step=2">
|
||||
<input name="formhash" value="{VERHASH}" type="hidden">
|
||||
<p class="clearfix ml20">
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="data" checked="" type="checkbox">
|
||||
{lang tools_updatecache_data}
|
||||
</label>
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="tpl" id="tplcache" checked="" type="checkbox">
|
||||
{lang tools_updatecache_tpl}
|
||||
</label>
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="memory" id="momerycache" type="checkbox">
|
||||
{lang tools_updatecache_memory}
|
||||
</label>
|
||||
</p>
|
||||
<p class="clearfix ml20">
|
||||
<input class="btn btn-primary" name="confirmed" value="{lang confirms}" type="submit">
|
||||
<script type="text/javascript">
|
||||
if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<input type="button" class="btn btn-default" value="{lang cancel}" onClick="history.go(-1);">');
|
||||
</script>
|
||||
</p>
|
||||
</form>
|
||||
<!--{elseif $step==2}-->
|
||||
<p class="ml20">{lang tools_updatecache_waiting}</p>
|
||||
<p class="text-success ml20">
|
||||
<a href="{MOD_URL}&op=updatecache&step=3&type=$type" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{MOD_URL}&op=updatecache&step=3&type=$type';}, 2000);</script>
|
||||
<!--{elseif $step==3}-->
|
||||
<p class="text-success ml20" style="margin:10px;">{lang update_cache_succeed}</p>
|
||||
<script type="text/javascript">
|
||||
window.setTimeout(function() { location.href = '{MOD_URL}&op=updatecache'; }, 5000);
|
||||
</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang tools_updatecache_tips}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
|
||||
<div class="main-header">
|
||||
<div class="clearfix" style="line-height:40px;padding:0 10px">
|
||||
<!-- <strong style="font-size:14px;">{lang updatecache}</strong>-->
|
||||
<span class="text-muted" id="step1" <!--{if $step==1}-->style="color:green"<!--{/if}-->>1.{lang nav_updatecache_confirm}</span>
|
||||
<span class="text-muted" id="step2" <!--{if $step==2}-->style="color:green"<!--{/if}-->>2.{lang nav_updatecache_verify}</span>
|
||||
<span class="text-muted" id="step3" <!--{if $step==3}-->style="color:green"<!--{/if}-->>3.{lang nav_updatecache_completed}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main-content" style="padding:20px;border-top:1px solid #FFF">
|
||||
<div class="well well-sm">
|
||||
<!--{if $step==1}-->
|
||||
<form method="post" class="form-horizontal form-horizontal-left" action="{MOD_URL}&op=updatecache&step=2">
|
||||
<input name="formhash" value="{VERHASH}" type="hidden">
|
||||
<p class="clearfix ml20">
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="data" checked="" type="checkbox">
|
||||
{lang tools_updatecache_data}
|
||||
</label>
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="tpl" id="tplcache" checked="" type="checkbox">
|
||||
{lang tools_updatecache_tpl}
|
||||
</label>
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="memory" id="momerycache" type="checkbox">
|
||||
{lang tools_updatecache_memory}
|
||||
</label>
|
||||
</p>
|
||||
<p class="clearfix ml20">
|
||||
<input class="btn btn-primary" name="confirmed" value="{lang confirms}" type="submit">
|
||||
<script type="text/javascript">
|
||||
if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<input type="button" class="btn btn-default" value="{lang cancel}" onClick="history.go(-1);">');
|
||||
</script>
|
||||
</p>
|
||||
</form>
|
||||
<!--{elseif $step==2}-->
|
||||
<p class="ml20">{lang tools_updatecache_waiting}</p>
|
||||
<p class="text-success ml20">
|
||||
<a href="{MOD_URL}&op=updatecache&step=3&type=$type" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{MOD_URL}&op=updatecache&step=3&type=$type';}, 2000);</script>
|
||||
<!--{elseif $step==3}-->
|
||||
<p class="text-success ml20" style="margin:10px;">{lang update_cache_succeed}</p>
|
||||
<script type="text/javascript">
|
||||
window.setTimeout(function() { location.href = '{MOD_URL}&op=updatecache'; }, 5000);
|
||||
</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang tools_updatecache_tips}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/footer_simple}-->
|
||||
@@ -1,246 +1,246 @@
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<style>
|
||||
|
||||
.progress.active .progress-bar {
|
||||
-webkit-animation: none;
|
||||
animation: none;
|
||||
transition: none;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
|
||||
<!--{if $operation == 'patch' || $operation == 'cross'}-->
|
||||
<div class="main-header">
|
||||
<div class="clearfix" style="line-height:40px;padding:0 10px;font-size:12px;">
|
||||
<strong style="font-size:14px;">{lang upgrade}</strong>
|
||||
<!--{loop $steplang $key $value}-->
|
||||
<!--{if $key>0 && $key<=5}-->
|
||||
<span class="text-muted" <!--{if $key==$step}-->style="color:green"<!--{/if}-->>{$key}.{$value}</span>
|
||||
<!--{/if}-->
|
||||
<!--{/loop}-->
|
||||
</div>
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
<!--{if $operation=='check'}-->
|
||||
<div class="main-content" style="border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<div style="padding:20px;">
|
||||
<div class="text-center" style="width:300px;margin:0 auto">
|
||||
<p style="margin:20px 0;">{lang upgrade_checking}</p>
|
||||
<div class="progress progress-striped active" style="border:1px solid #5bc0de">
|
||||
<div class="progress-bar progress-bar-info " role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%"><span class="sr-only">100% Complete</span></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.progress-bar').animate({ width: '100%' }, 3000, function() {
|
||||
window.location.href = '{MOD_URL}&op=systemupgrade&operation=check&checking=1';
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='showupgrade'}-->
|
||||
<div class="main-content" style="border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_select_version}</th>
|
||||
</thead>
|
||||
<!--{loop $list $value}-->
|
||||
<tr>
|
||||
<td>$value[title]</td>
|
||||
<td>$value[btn1]</td>
|
||||
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
|
||||
</table>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='patch' || $operation=='cross' }-->
|
||||
|
||||
<div class="main-content" style="border-top:1px solid #FFF;">
|
||||
<!--{if !$_G['setting']['bbclosed']}-->
|
||||
<div style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{elseif $step==1}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_preupdatelist}</th>
|
||||
</thead>
|
||||
<!--{loop $updatefilelist $value}-->
|
||||
<tr>
|
||||
<td> <i class="glyphicon glyphicon-file"></i> $value</td>
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<th colspan="5"> {lang founder_upgrade_store_directory} ./data/update/oaooa$version</th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> <input type="button" class="btn btn-primary" onclick="window.location.href='$linkurl'" value="{lang founder_upgrade_download}">{eval echo upgradeinformation(0)}</th>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
|
||||
<!--{elseif $step==2}-->
|
||||
<div style="padding:20px;">$msg</div>
|
||||
|
||||
<!--{elseif $step==3}-->
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_diff_show}</th>
|
||||
</thead>
|
||||
<!--{loop $updatefilelist $v}-->
|
||||
<!--{if isset($ignorelist[$v])}-->
|
||||
|
||||
<!--{elseif isset($modifylist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-danger"> {lang founder_upgrade_diff} <i class="glyphicon glyphicon-exclamation-sign"></i> $v</td>
|
||||
</tr>
|
||||
<!--{elseif isset($showlist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-success"> {lang founder_upgrade_normal} <i class="glyphicon glyphicon-ok"></i> $v</td>
|
||||
</tr>
|
||||
<!--{elseif isset($newlist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-info"> {lang founder_upgrade_new} <i class="glyphicon glyphicon-plus"></i> $v</td>
|
||||
</tr>
|
||||
<!--{/if}-->
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_download_file} ./data/update/oaooa{$version}</th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> {lang founder_upgrade_backup_file} ./data/back/oaooa{CORE_VERSION} {lang founder_upgrade_backup_file2} </th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> <input type="button" class="btn btn-primary" onclick="window.location.href='{$linkurl}';" value="<!--{if !empty($modifylist)}-->{lang founder_upgrade_force}<!--{else}-->{lang founder_upgrade_regular}<!--{/if}-->" /> {eval echo upgradeinformation(0)}</th>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
<!--{/if}-->
|
||||
<!--{elseif $step==4}-->
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{elseif $_GET['siteftpsetting']}-->
|
||||
<form name="aliform" class="form-horizontal form-horizontal-left" action="$action" method="post" style="padding:20px;">
|
||||
<input type="hidden" name="formhash" value="{FORMHASH}">
|
||||
<p style="padding-left:20px;font-weight:bold;font-size:16px;padding-bottom:20px;">{lang upgrade_website_FTP_set}</p>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang server_address}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[host]" value="" placeholder="{lang host_IP_address}">
|
||||
<span class="help-inline">{lang FTP_server_IP_site_domain}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang server_port}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[port]" value="21" placeholder="{lang port}">
|
||||
<span class="help-inline">{lang default_for_the_21st}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang account}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[username]" value="" placeholder="{lang FTP_account_user_name}">
|
||||
<span class="help-inline">{lang accounts_supreme_authority}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang password}</label>
|
||||
<input type="password" class="form-control required" name="siteftp[password]" value="" placeholder="{lang FTP_account_user_password}">
|
||||
|
||||
</div>
|
||||
<!--<div class="form-group">
|
||||
<label class="control-label">编码</label>
|
||||
<select class="form-control" name="siteftp[charset]">
|
||||
<option value="GBK" selected="selected">GBK</option>
|
||||
<option value="UTF-8">UTF-8</option>
|
||||
<option value="BIG5">BIG5</option>
|
||||
</select>
|
||||
<span class="help-inline">根据FTP服务器的编码设置,不一致会导致乱码</span>
|
||||
|
||||
</div>-->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label">{lang sitepath}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[attachdir]" value="">
|
||||
<span class="help-inline">{lang site_absolute_path_root_directory}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<label class="checkbox-inline" style="width:180px;"><input type="checkbox" name="siteftp[pasv]" value="1">{lang use_Passive_Mode}</label>
|
||||
<span class="help-inline">{lang general_condition_passive_mode}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<label class="checkbox-inline" style="width:180px;"><input type="checkbox" name="siteftp[ssl]" value="1">{lang enable_secure_link}</label>
|
||||
<span class="help-inline">{lang notice_FTP_open_SSL}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<input type="submit" class="btn btn-primary" style="padding:6px 25px" value="{lang confirms}">
|
||||
</div>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
<!--{elseif $step==5}-->
|
||||
<div style="padding:20px;">
|
||||
<div class="alert alert-success text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
|
||||
<!--{/if}-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
|
||||
function createIframe(src) {
|
||||
document.getElementById('step4').innerHTML = '<iframe marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' + src + '" style="width:100%;height:100%;"></iframe>';
|
||||
}
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<style>
|
||||
|
||||
.progress.active .progress-bar {
|
||||
-webkit-animation: none;
|
||||
animation: none;
|
||||
transition: none;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
|
||||
<!--{if $operation == 'patch' || $operation == 'cross'}-->
|
||||
<div class="main-header">
|
||||
<div class="clearfix" style="line-height:40px;padding:0 10px;font-size:12px;">
|
||||
<strong style="font-size:14px;">{lang upgrade}</strong>
|
||||
<!--{loop $steplang $key $value}-->
|
||||
<!--{if $key>0 && $key<=5}-->
|
||||
<span class="text-muted" <!--{if $key==$step}-->style="color:green"<!--{/if}-->>{$key}.{$value}</span>
|
||||
<!--{/if}-->
|
||||
<!--{/loop}-->
|
||||
</div>
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
<!--{if $operation=='check'}-->
|
||||
<div class="main-content" style="border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<div style="padding:20px;">
|
||||
<div class="text-center" style="width:300px;margin:0 auto">
|
||||
<p style="margin:20px 0;">{lang upgrade_checking}</p>
|
||||
<div class="progress progress-striped active" style="border:1px solid #5bc0de">
|
||||
<div class="progress-bar progress-bar-info " role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%"><span class="sr-only">100% Complete</span></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.progress-bar').animate({ width: '100%' }, 3000, function() {
|
||||
window.location.href = '{MOD_URL}&op=systemupgrade&operation=check&checking=1';
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='showupgrade'}-->
|
||||
<div class="main-content" style="border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_select_version}</th>
|
||||
</thead>
|
||||
<!--{loop $list $value}-->
|
||||
<tr>
|
||||
<td>$value[title]</td>
|
||||
<td>$value[btn1]</td>
|
||||
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
|
||||
</table>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='patch' || $operation=='cross' }-->
|
||||
|
||||
<div class="main-content" style="border-top:1px solid #FFF;">
|
||||
<!--{if !$_G['setting']['bbclosed']}-->
|
||||
<div style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{elseif $step==1}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_preupdatelist}</th>
|
||||
</thead>
|
||||
<!--{loop $updatefilelist $value}-->
|
||||
<tr>
|
||||
<td> <i class="glyphicon glyphicon-file"></i> $value</td>
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<th colspan="5"> {lang founder_upgrade_store_directory} ./data/update/oaooa$version</th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> <input type="button" class="btn btn-primary" onclick="window.location.href='$linkurl'" value="{lang founder_upgrade_download}">{eval echo upgradeinformation(0)}</th>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
|
||||
<!--{elseif $step==2}-->
|
||||
<div style="padding:20px;">$msg</div>
|
||||
|
||||
<!--{elseif $step==3}-->
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_diff_show}</th>
|
||||
</thead>
|
||||
<!--{loop $updatefilelist $v}-->
|
||||
<!--{if isset($ignorelist[$v])}-->
|
||||
|
||||
<!--{elseif isset($modifylist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-danger"> {lang founder_upgrade_diff} <i class="glyphicon glyphicon-exclamation-sign"></i> $v</td>
|
||||
</tr>
|
||||
<!--{elseif isset($showlist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-success"> {lang founder_upgrade_normal} <i class="glyphicon glyphicon-ok"></i> $v</td>
|
||||
</tr>
|
||||
<!--{elseif isset($newlist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-info"> {lang founder_upgrade_new} <i class="glyphicon glyphicon-plus"></i> $v</td>
|
||||
</tr>
|
||||
<!--{/if}-->
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_download_file} ./data/update/oaooa{$version}</th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> {lang founder_upgrade_backup_file} ./data/back/oaooa{CORE_VERSION} {lang founder_upgrade_backup_file2} </th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> <input type="button" class="btn btn-primary" onclick="window.location.href='{$linkurl}';" value="<!--{if !empty($modifylist)}-->{lang founder_upgrade_force}<!--{else}-->{lang founder_upgrade_regular}<!--{/if}-->" /> {eval echo upgradeinformation(0)}</th>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
<!--{/if}-->
|
||||
<!--{elseif $step==4}-->
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{elseif $_GET['siteftpsetting']}-->
|
||||
<form name="aliform" class="form-horizontal form-horizontal-left" action="$action" method="post" style="padding:20px;">
|
||||
<input type="hidden" name="formhash" value="{FORMHASH}">
|
||||
<p style="padding-left:20px;font-weight:bold;font-size:16px;padding-bottom:20px;">{lang upgrade_website_FTP_set}</p>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang server_address}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[host]" value="" placeholder="{lang host_IP_address}">
|
||||
<span class="help-inline">{lang FTP_server_IP_site_domain}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang server_port}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[port]" value="21" placeholder="{lang port}">
|
||||
<span class="help-inline">{lang default_for_the_21st}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang account}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[username]" value="" placeholder="{lang FTP_account_user_name}">
|
||||
<span class="help-inline">{lang accounts_supreme_authority}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang password}</label>
|
||||
<input type="password" class="form-control required" name="siteftp[password]" value="" placeholder="{lang FTP_account_user_password}">
|
||||
|
||||
</div>
|
||||
<!--<div class="form-group">
|
||||
<label class="control-label">编码</label>
|
||||
<select class="form-control" name="siteftp[charset]">
|
||||
<option value="GBK" selected="selected">GBK</option>
|
||||
<option value="UTF-8">UTF-8</option>
|
||||
<option value="BIG5">BIG5</option>
|
||||
</select>
|
||||
<span class="help-inline">根据FTP服务器的编码设置,不一致会导致乱码</span>
|
||||
|
||||
</div>-->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label">{lang sitepath}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[attachdir]" value="">
|
||||
<span class="help-inline">{lang site_absolute_path_root_directory}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<label class="checkbox-inline" style="width:180px;"><input type="checkbox" name="siteftp[pasv]" value="1">{lang use_Passive_Mode}</label>
|
||||
<span class="help-inline">{lang general_condition_passive_mode}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<label class="checkbox-inline" style="width:180px;"><input type="checkbox" name="siteftp[ssl]" value="1">{lang enable_secure_link}</label>
|
||||
<span class="help-inline">{lang notice_FTP_open_SSL}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<input type="submit" class="btn btn-primary" style="padding:6px 25px" value="{lang confirms}">
|
||||
</div>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
<!--{elseif $step==5}-->
|
||||
<div style="padding:20px;">
|
||||
<div class="alert alert-success text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
|
||||
<!--{/if}-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
|
||||
function createIframe(src) {
|
||||
document.getElementById('step4').innerHTML = '<iframe marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' + src + '" style="width:100%;height:100%;"></iframe>';
|
||||
}
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/footer_simple}-->
|
||||
@@ -1,21 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="static/bootstrap/css/bootstrap.min.css">
|
||||
<link href="static/css/common.css" rel="stylesheet" media="all">
|
||||
<style>
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="alert alert-warning">
|
||||
$msg
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="static/bootstrap/css/bootstrap.min.css">
|
||||
<link href="static/css/common.css" rel="stylesheet" media="all">
|
||||
<style>
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="alert alert-warning">
|
||||
$msg
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,46 +1,46 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$oparr = array('updatecache', 'database', /*'security','patch','update',*/
|
||||
'cron', 'log');
|
||||
$leftmenu = array();
|
||||
$op = $_GET['op'];
|
||||
foreach ($oparr as $key => $value) {
|
||||
$leftmenu[$value] = array('title' => lang($value), 'active' => '');
|
||||
if ($value == $op)
|
||||
$leftmenu[$value]['active'] = 'class="active"';
|
||||
}
|
||||
|
||||
include libfile('function/cache');
|
||||
|
||||
$navtitle = lang('updatecache') . ' - ' . lang('admin_navtitle');
|
||||
$step = max(1, intval($_GET['step']));
|
||||
|
||||
if ($step == 1) {
|
||||
} elseif ($step == 2) {
|
||||
$type = implode('_', (array)$_GET['type']);
|
||||
|
||||
} elseif ($step == 3) {
|
||||
$type = explode('_', $_GET['type']);
|
||||
if (in_array('data', $type)) {
|
||||
updatecache();
|
||||
}
|
||||
if (in_array('tpl', $type) && $_G['config']['output']['tplrefresh']) {
|
||||
cleartemplatecache();
|
||||
}
|
||||
if (in_array('memory', $type)) {
|
||||
//清空内存缓存
|
||||
C::memory()->clear();
|
||||
}
|
||||
}
|
||||
include template('updatecache');
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$oparr = array('updatecache', 'database', /*'security','patch','update',*/
|
||||
'cron', 'log');
|
||||
$leftmenu = array();
|
||||
$op = $_GET['op'];
|
||||
foreach ($oparr as $key => $value) {
|
||||
$leftmenu[$value] = array('title' => lang($value), 'active' => '');
|
||||
if ($value == $op)
|
||||
$leftmenu[$value]['active'] = 'class="active"';
|
||||
}
|
||||
|
||||
include libfile('function/cache');
|
||||
|
||||
$navtitle = lang('updatecache') . ' - ' . lang('admin_navtitle');
|
||||
$step = max(1, intval($_GET['step']));
|
||||
|
||||
if ($step == 1) {
|
||||
} elseif ($step == 2) {
|
||||
$type = implode('_', (array)$_GET['type']);
|
||||
|
||||
} elseif ($step == 3) {
|
||||
$type = explode('_', $_GET['type']);
|
||||
if (in_array('data', $type)) {
|
||||
updatecache();
|
||||
}
|
||||
if (in_array('tpl', $type) && $_G['config']['output']['tplrefresh']) {
|
||||
cleartemplatecache();
|
||||
}
|
||||
if (in_array('memory', $type)) {
|
||||
//清空内存缓存
|
||||
C::memory()->clear();
|
||||
}
|
||||
}
|
||||
include template('updatecache');
|
||||
?>
|
||||
|
||||
@@ -1,414 +1,416 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_close_site') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.reload();" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
//$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
if ($_GET['ungetfrom']) {
|
||||
if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
dheader('Location: ' . $url);
|
||||
} else {
|
||||
showmessage('upgrade_param_error');
|
||||
}
|
||||
}
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
//$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_none', array('upgradeurl' => upgradeinformation(-1))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
|
||||
if (empty($updatefilelist)) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_download_upgradelist_error', array('upgradeurl' => upgradeinformation(-2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($thurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>';
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
$linkurl = $theurl . '&step=2';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
|
||||
$linkurl = $theurl . '&step=3';
|
||||
$downloadstatus = 3;
|
||||
$msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0)));
|
||||
if (!$_GET['iframe']) {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("parent.location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="parent.location.href=\'' . $linkurl . '\';return false;">' . lang('message_redirect') . '</a></p>';
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
if (!$_GET['iframe']) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = '<iframe id="downiframe" marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' . $linkurl . '" style="width:100%;height:100%;"></iframe>';
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq + 1) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script></p>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_redownload', array('file' => $updatefilelist[$fileseq - 1], 'upgradeurl' => upgradeinformation(-3))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0;"><input type="button" class="btn btn-success" value="'.lang('founder_upgrade_reset').'" onclick="location.href=\'' . $linkurl . '\'" />';
|
||||
}
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
$msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4)));
|
||||
}
|
||||
$linkurl = $theurl . '&step=4';
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=4';
|
||||
$ftplinkurl = $linkurl . '&siteftpsetting=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_cannot_access_file') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
$msg .= "<script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backuping', array('upgradeurl' => upgradeinformation(2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($linkurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_error', array('upgradeurl' => upgradeinformation(-5))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_complete', array('upgradeurl' => upgradeinformation(3))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_ftp_upload_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-6))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reupload') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_reset_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
} else {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_copy_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_recopy') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_file_successful', array('upgradeurl' => upgradeinformation(4))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout(function(){createIframe(\'' . $linkurl . '\');}, 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' );
|
||||
dheader('Location: ' . $url);
|
||||
|
||||
} elseif ($step == 5) {
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
|
||||
$msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
if (!intval($_GET['rechecking'])) {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
$dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue_db', array('steplang' => $steplang['dbupdate'], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
} else {
|
||||
$stepurl = $theurl . '&step=' . $upgrade_step['cachevalue']['step'];
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue', array('steplang' => $steplang[$upgrade_step['cachevalue']['step']], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
}
|
||||
|
||||
if (!intval($_GET['checking']) || $msg) {
|
||||
|
||||
|
||||
} else {
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
|
||||
}elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
$list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if ($unupgrade) {
|
||||
$list[$type]['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
} else {
|
||||
$list[$type]['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = '<input type="button" class="btn btn-success" onclick="confirm(\'' . lang('founder_upgrade_backup_remind') . '\') ? window.location.href=\'' . $linkurl . '\' : \'\';" value="' . lang('founder_upgrade_automatically') . '">';
|
||||
$list[$type]['official'] = '<a class="btn btn-link" href="' . $upgrade['official'] . '" target="_blank">' . lang('founder_upgrade_manually') . '</a>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
$msg = lang('upgrade_latest_version');
|
||||
}
|
||||
|
||||
}elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
|
||||
$url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
include template('upgrade');
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_close_site') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.reload();" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
//$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
if ($_GET['ungetfrom']) {
|
||||
if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
dheader('Location: ' . $url);
|
||||
} else {
|
||||
showmessage('upgrade_param_error');
|
||||
}
|
||||
}
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
//$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_none', array('upgradeurl' => upgradeinformation(-1))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
|
||||
if (empty($updatefilelist)) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_download_upgradelist_error', array('upgradeurl' => upgradeinformation(-2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($thurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>';
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
$linkurl = $theurl . '&step=2';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
|
||||
$linkurl = $theurl . '&step=3';
|
||||
$downloadstatus = 3;
|
||||
$msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0)));
|
||||
if (!$_GET['iframe']) {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("parent.location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="parent.location.href=\'' . $linkurl . '\';return false;">' . lang('message_redirect') . '</a></p>';
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
if (!$_GET['iframe']) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = '<iframe id="downiframe" marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' . $linkurl . '" style="width:100%;height:100%;"></iframe>';
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq + 1) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script></p>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_redownload', array('file' => $updatefilelist[$fileseq - 1], 'upgradeurl' => upgradeinformation(-3))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0;"><input type="button" class="btn btn-success" value="'.lang('founder_upgrade_reset').'" onclick="location.href=\'' . $linkurl . '\'" />';
|
||||
}
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
$msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4)));
|
||||
}
|
||||
$linkurl = $theurl . '&step=4';
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=4';
|
||||
$ftplinkurl = $linkurl . '&siteftpsetting=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_cannot_access_file') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
$msg .= "<script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backuping', array('upgradeurl' => upgradeinformation(2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($linkurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_error', array('upgradeurl' => upgradeinformation(-5))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_complete', array('upgradeurl' => upgradeinformation(3))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_ftp_upload_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-6))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reupload') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_reset_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
} else {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_copy_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_recopy') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_file_successful', array('upgradeurl' => upgradeinformation(4))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout(function(){createIframe(\'' . $linkurl . '\');}, 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' );
|
||||
dheader('Location: ' . $url);
|
||||
|
||||
} elseif ($step == 5) {
|
||||
print_r(1111);
|
||||
die;
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
|
||||
$msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
if (!intval($_GET['rechecking'])) {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
$dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue_db', array('steplang' => $steplang['dbupdate'], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
} else {
|
||||
$stepurl = $theurl . '&step=' . $upgrade_step['cachevalue']['step'];
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue', array('steplang' => $steplang[$upgrade_step['cachevalue']['step']], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
}
|
||||
|
||||
if (!intval($_GET['checking']) || $msg) {
|
||||
|
||||
|
||||
} else {
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
|
||||
}elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
$list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if ($unupgrade) {
|
||||
$list[$type]['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
} else {
|
||||
$list[$type]['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = '<input type="button" class="btn btn-success" onclick="confirm(\'' . lang('founder_upgrade_backup_remind') . '\') ? window.location.href=\'' . $linkurl . '\' : \'\';" value="' . lang('founder_upgrade_automatically') . '">';
|
||||
$list[$type]['official'] = '<a class="btn btn-link" href="' . $upgrade['official'] . '" target="_blank">' . lang('founder_upgrade_manually') . '</a>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
$msg = lang('upgrade_latest_version');
|
||||
}
|
||||
|
||||
}elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
|
||||
$url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
include template('upgrade');
|
||||
?>
|
||||
@@ -1,51 +1,51 @@
|
||||
<?php
|
||||
//error_reporting(E_ALL);
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
define('NOROBOT', TRUE);
|
||||
$returntype = isset($_GET['returnType']) ? $_GET['returnType']: 'json';//返回值方式
|
||||
|
||||
$checkLanguage = $_G['language'];
|
||||
if(file_exists (DZZ_ROOT.'./admin/language/'.$checkLanguage.'/'.'lang.php')){
|
||||
include DZZ_ROOT.'./admin/language/'.$checkLanguage.'/'.'lang.php';
|
||||
$_G['lang']['template']=array_merge($_G['lang']['template'],$lang);
|
||||
}
|
||||
//判断管理员登录
|
||||
//Hook::listen('adminlogin');
|
||||
//后台管理页面
|
||||
if(submitcheck('settingsubmit')){
|
||||
if ($_G['adminid'] != 1){
|
||||
showmessage( lang('no_privilege') ,$returntype);
|
||||
}
|
||||
$settingnew=$_GET["settingnew"];
|
||||
$data=array();
|
||||
foreach($settingnew["mark"] as $k=>$v){
|
||||
if( isset($data[$v]) ){
|
||||
showmessage( lang('Logtag').$v.lang('repeat') ,$returntype);
|
||||
}
|
||||
$data[$v]=array(
|
||||
"title" => $settingnew["title"][$k],
|
||||
"is_open" => intval($settingnew["is_open"][$k]),
|
||||
"issystem" => $settingnew["issystem"][$k]
|
||||
);
|
||||
}
|
||||
|
||||
$settingnew = serialize($data);
|
||||
$update=array(
|
||||
"systemlog_open" =>$_GET["systemlog_open"],
|
||||
"systemlog_setting" =>$settingnew,
|
||||
);
|
||||
$result = C::t('setting') ->update_batch($update);
|
||||
if( $result ){
|
||||
include_once libfile('function/cache');
|
||||
updatecache('setting');
|
||||
}
|
||||
writelog('otherlog', lang('Update_setting'));
|
||||
showmessage('do_success', dreferer());
|
||||
}
|
||||
else{
|
||||
$systemlog_setting = ($_G["setting"]["systemlog_setting"]);
|
||||
$navtitle=lang('systemlog_setting').' - '.lang('appname');
|
||||
include template("admin");
|
||||
<?php
|
||||
//error_reporting(E_ALL);
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
define('NOROBOT', TRUE);
|
||||
$returntype = isset($_GET['returnType']) ? $_GET['returnType']: 'json';//返回值方式
|
||||
|
||||
$checkLanguage = $_G['language'];
|
||||
if(file_exists (DZZ_ROOT.'./admin/language/'.$checkLanguage.'/'.'lang.php')){
|
||||
include DZZ_ROOT.'./admin/language/'.$checkLanguage.'/'.'lang.php';
|
||||
$_G['lang']['template']=array_merge($_G['lang']['template'],$lang);
|
||||
}
|
||||
//判断管理员登录
|
||||
//Hook::listen('adminlogin');
|
||||
//后台管理页面
|
||||
if(submitcheck('settingsubmit')){
|
||||
if ($_G['adminid'] != 1){
|
||||
showmessage( lang('no_privilege') ,$returntype);
|
||||
}
|
||||
$settingnew=$_GET["settingnew"];
|
||||
$data=array();
|
||||
foreach($settingnew["mark"] as $k=>$v){
|
||||
if( isset($data[$v]) ){
|
||||
showmessage( lang('Logtag').$v.lang('repeat') ,$returntype);
|
||||
}
|
||||
$data[$v]=array(
|
||||
"title" => $settingnew["title"][$k],
|
||||
"is_open" => intval($settingnew["is_open"][$k]),
|
||||
"issystem" => $settingnew["issystem"][$k]
|
||||
);
|
||||
}
|
||||
|
||||
$settingnew = serialize($data);
|
||||
$update=array(
|
||||
"systemlog_open" =>$_GET["systemlog_open"],
|
||||
"systemlog_setting" =>$settingnew,
|
||||
);
|
||||
$result = C::t('setting') ->update_batch($update);
|
||||
if( $result ){
|
||||
include_once libfile('function/cache');
|
||||
updatecache('setting');
|
||||
}
|
||||
writelog('otherlog', lang('Update_setting'));
|
||||
showmessage('do_success', dreferer());
|
||||
}
|
||||
else{
|
||||
$systemlog_setting = ($_G["setting"]["systemlog_setting"]);
|
||||
$navtitle=lang('systemlog_setting').' - '.lang('appname');
|
||||
include template("admin");
|
||||
}
|
||||
@@ -1,63 +1,63 @@
|
||||
<?php
|
||||
namespace admin\systemlog\classes;
|
||||
class Systemlog{
|
||||
//$arr 必须传入 level,content
|
||||
public function run( $arr=array() ){
|
||||
global $_G;
|
||||
if( $_G['setting']['systemlog_open'] > 0 ){
|
||||
$systemlog_setting = ($_G['setting']['systemlog_setting']);
|
||||
//判断是否开启该类型日志
|
||||
if(!isset($arr["mark"]) || (isset($systemlog_setting[$arr["mark"]]) && $systemlog_setting[$arr["mark"]]["is_open"]!=1) ){
|
||||
return;
|
||||
}
|
||||
$file=$arr["mark"];//$arr["level"];//级别
|
||||
$log=$arr["content"];
|
||||
$yearmonth = "dzz";//dgmdate(TIMESTAMP, 'Ym', $_G['setting']['timeoffset']);
|
||||
$logdir = DZZ_ROOT.'./data/log/';
|
||||
$logfile = $logdir.$yearmonth.'_'.$file.'.php';
|
||||
|
||||
//检查并返回当前log文件行数
|
||||
$i=0;
|
||||
if( file_exists($logfile)){
|
||||
$fp=fopen($logfile, "r");
|
||||
while(!feof($fp)) {
|
||||
//每次最多读取1M
|
||||
if($data=fread($fp,1024*1024*1)){
|
||||
//计算读取到的行数
|
||||
$num=substr_count($data,"\n");
|
||||
$i+=$num;
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
//每4000行重新生成日志文件
|
||||
if($i>=4000) {
|
||||
$dir = opendir($logdir);
|
||||
$length = strlen($file);
|
||||
$maxid = $id = 0;
|
||||
while($entry = readdir($dir)) {
|
||||
if(strpos($entry, $yearmonth.'_'.$file) !== false) {
|
||||
$id = intval(substr($entry, $length + 8, -4));
|
||||
$id > $maxid && $maxid = $id;
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
$logfilebak = $logdir.$yearmonth.'_'.$file.'_'.($maxid + 1).'.php';
|
||||
@rename($logfile, $logfilebak);
|
||||
}
|
||||
if($fp = @fopen($logfile, 'a')) {
|
||||
@flock($fp, 2);
|
||||
if(!is_array($log)) {
|
||||
$log = array($log);
|
||||
}
|
||||
$cur_url = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
|
||||
$from_url = $_SERVER['HTTP_REFERER'];
|
||||
foreach($log as $tmp) {
|
||||
$tmp=implode("\t", clearlogstring(array($_G['timestamp'], $_G['username'], $_G['groupid'], $_G['clientip'],$tmp,$cur_url,$from_url))) ;
|
||||
fwrite($fp, "<?PHP exit;?>\t".str_replace(array('<?', '?>'), '', $tmp)."\n");
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
<?php
|
||||
namespace admin\systemlog\classes;
|
||||
class Systemlog{
|
||||
//$arr 必须传入 level,content
|
||||
public function run( $arr=array() ){
|
||||
global $_G;
|
||||
if( $_G['setting']['systemlog_open'] > 0 ){
|
||||
$systemlog_setting = ($_G['setting']['systemlog_setting']);
|
||||
//判断是否开启该类型日志
|
||||
if(!isset($arr["mark"]) || (isset($systemlog_setting[$arr["mark"]]) && $systemlog_setting[$arr["mark"]]["is_open"]!=1) ){
|
||||
return;
|
||||
}
|
||||
$file=$arr["mark"];//$arr["level"];//级别
|
||||
$log=$arr["content"];
|
||||
$yearmonth = "dzz";//dgmdate(TIMESTAMP, 'Ym', $_G['setting']['timeoffset']);
|
||||
$logdir = DZZ_ROOT.'./data/log/';
|
||||
$logfile = $logdir.$yearmonth.'_'.$file.'.php';
|
||||
|
||||
//检查并返回当前log文件行数
|
||||
$i=0;
|
||||
if( file_exists($logfile)){
|
||||
$fp=fopen($logfile, "r");
|
||||
while(!feof($fp)) {
|
||||
//每次最多读取1M
|
||||
if($data=fread($fp,1024*1024*1)){
|
||||
//计算读取到的行数
|
||||
$num=substr_count($data,"\n");
|
||||
$i+=$num;
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
//每4000行重新生成日志文件
|
||||
if($i>=4000) {
|
||||
$dir = opendir($logdir);
|
||||
$length = strlen($file);
|
||||
$maxid = $id = 0;
|
||||
while($entry = readdir($dir)) {
|
||||
if(strpos($entry, $yearmonth.'_'.$file) !== false) {
|
||||
$id = intval(substr($entry, $length + 8, -4));
|
||||
$id > $maxid && $maxid = $id;
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
$logfilebak = $logdir.$yearmonth.'_'.$file.'_'.($maxid + 1).'.php';
|
||||
@rename($logfile, $logfilebak);
|
||||
}
|
||||
if($fp = @fopen($logfile, 'a')) {
|
||||
@flock($fp, 2);
|
||||
if(!is_array($log)) {
|
||||
$log = array($log);
|
||||
}
|
||||
$cur_url = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
|
||||
$from_url = $_SERVER['HTTP_REFERER'];
|
||||
foreach($log as $tmp) {
|
||||
$tmp=implode("\t", clearlogstring(array($_G['timestamp'], $_G['username'], $_G['groupid'], $_G['clientip'],$tmp,$cur_url,$from_url))) ;
|
||||
fwrite($fp, "<?PHP exit;?>\t".str_replace(array('<?', '?>'), '', $tmp)."\n");
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,177 +1,177 @@
|
||||
<?php
|
||||
//error_reporting(E_ALL);
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
define('NOROBOT', TRUE);
|
||||
$returntype = isset($_GET['returnType']) ? $_GET['returnType']: 'json';//返回值方式
|
||||
$type=$_GET['type'];
|
||||
if(!in_array($type, array('list'))) {
|
||||
$type='list';
|
||||
}
|
||||
|
||||
$checkLanguage = $_G['language'];
|
||||
if(file_exists (DZZ_ROOT.'./admin/language/'.$checkLanguage.'/'.'lang.php')){
|
||||
include DZZ_ROOT.'./admin/language/'.$checkLanguage.'/'.'lang.php';
|
||||
$_G['lang']['template']=array_merge($_G['lang']['template'],$lang);
|
||||
}
|
||||
|
||||
if($type=="list"){
|
||||
//Hook::listen('adminlogin');
|
||||
!isset($_GET['page']) && $_GET['page']=1;
|
||||
$page=max(1,intval($_GET['page']));
|
||||
$lpp = empty($_GET['lpp']) ? 15 : $_GET['lpp'];
|
||||
$checklpp = array();
|
||||
$checklpp[$lpp] = 'selected="selected"';
|
||||
$extrainput = '';
|
||||
$systemlog_setting = is_serialized($_G["setting"]["systemlog_setting"])?unserialize($_G["setting"]["systemlog_setting"]):$_G["setting"]["systemlog_setting"];
|
||||
$operationarr = array_keys($systemlog_setting);
|
||||
$operation = in_array($_GET['operation'], $operationarr) ? $_GET['operation'] : "cplog";
|
||||
$navtitle=$systemlog_setting[$operation]["title"].' - '.lang('appname');//lang('nav_logs_'.$operation).' - '.lang('admin_navtitle');
|
||||
|
||||
$logdir = DZZ_ROOT.'./data/log/';
|
||||
$logfiles = get_log_files($logdir, $operation);
|
||||
|
||||
if($logfiles) $logfiles=array_reverse($logfiles);
|
||||
//error_reporting(E_ALL);
|
||||
$firstlogs = file( $logdir.$logfiles[0] ) ;
|
||||
$firstlogsnum = count($firstlogs);
|
||||
$countlogfile=count($logfiles);
|
||||
$count = ($countlogfile-1)*4000+$firstlogsnum;
|
||||
$multipage = multi($count, $lpp, $page, MOD_URL."&type=list&operation=$operation&lpp=$lpp",'pull-right' );
|
||||
|
||||
$logs = array();
|
||||
$jishu=4000;//每个日志文件最多行数
|
||||
$start = ($page - 1) * $lpp;
|
||||
$lastlog=$last_secondlog="";
|
||||
|
||||
$newdata=array();
|
||||
foreach($logfiles as $k=>$v){
|
||||
$nowfilemaxnum=($jishu*($k+1))-($jishu-$firstlogsnum);
|
||||
$startnum=($nowfilemaxnum-$jishu)<=0?0:($nowfilemaxnum-$jishu+1);
|
||||
$newdata[]=array("file"=>$v,"start"=>$startnum,"end"=>$nowfilemaxnum);
|
||||
}
|
||||
//print_R($newdata);
|
||||
//查询当前分页数据位于哪个日志文件
|
||||
$lastlog=$last_secondlog="";
|
||||
foreach($newdata as $k=>$v){
|
||||
if( $start<=$v["end"]){
|
||||
$lastlog=$v;
|
||||
if( ($start+$lpp)<$v["end"]){
|
||||
|
||||
}else{
|
||||
if( isset($newdata[$k+1])){
|
||||
$last_secondlog=$newdata[$k+1];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$j=0;
|
||||
for($i=$lastlog["start"];$i<$lastlog["end"];$i++){
|
||||
if( $start<=($lastlog["start"]+$j) ){
|
||||
break;
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
//获取数据开始
|
||||
$logs = file( $logdir.$lastlog["file"] );
|
||||
$logs = array_reverse($logs);
|
||||
if( $lastlog["file"]!=$logfiles[0] ){
|
||||
$j++;
|
||||
}
|
||||
$logs = array_slice($logs, $j, $lpp);
|
||||
$onecountget = count($logs);
|
||||
|
||||
$jj=0;
|
||||
if( $last_secondlog ){
|
||||
for($i=$last_secondlog["start"];$i<$last_secondlog["end"];$i++){
|
||||
if( ($jj)>= ($lpp-$onecountget) ){//$last_secondlog["start"] ){
|
||||
break;
|
||||
}
|
||||
$jj++;
|
||||
}
|
||||
}
|
||||
|
||||
if($last_secondlog){
|
||||
$logs2 = file( $logdir.$last_secondlog["file"] );
|
||||
$logs2 = array_reverse($logs2);
|
||||
$end=$lpp-count($logs);
|
||||
$logs2 = array_slice( $logs2, 0, $jj);
|
||||
$logs=array_merge($logs,$logs2);
|
||||
}
|
||||
//获取数据结束
|
||||
|
||||
$usergroup = array();
|
||||
foreach(C::t('usergroup')->range() as $group) {
|
||||
$usergroup[$group['groupid']] = $group['grouptitle'];
|
||||
}
|
||||
|
||||
$list=array();
|
||||
foreach($logs as $k => $logrow) {
|
||||
$log = explode("\t", $logrow);
|
||||
if(empty($log[1])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$log[1] = dgmdate($log[1], 'y-n-j H:i');
|
||||
$log[2] = $log[2];
|
||||
$log[2] = ($log[2] != $_G['member']['username'] ? "<b>$log[2]</b>" : $log[2]);
|
||||
$log[3] = $usergroup[$log[3]];
|
||||
|
||||
$list[$k]=$log;
|
||||
}
|
||||
|
||||
include template('list');
|
||||
}
|
||||
|
||||
|
||||
function getactionarray() {
|
||||
$isfounder = true;
|
||||
unset($topmenu['index'], $menu['index']);
|
||||
$actioncat = $actionarray = array();
|
||||
$actioncat[] = 'setting';
|
||||
$actioncat = array_merge($actioncat, array_keys($topmenu));
|
||||
foreach($menu as $tkey => $items) {
|
||||
foreach($items as $item) {
|
||||
$actionarray[$tkey][] = $item;
|
||||
}
|
||||
}
|
||||
return array('actions' => $actionarray, 'cats' => $actioncat);
|
||||
}
|
||||
function get_log_files($logdir = '', $action = 'action') {
|
||||
$dir = opendir($logdir);
|
||||
$files = array();
|
||||
while($entry = readdir($dir)) {
|
||||
$files[] = $entry;
|
||||
}
|
||||
closedir($dir);
|
||||
|
||||
if($files) {
|
||||
sort($files);
|
||||
$logfile = $action;
|
||||
$logfiles = array();
|
||||
$ym = '';
|
||||
foreach($files as $file) {
|
||||
if(strpos($file, $logfile) !== FALSE) {
|
||||
if(substr($file, 0, 6) != $ym) {
|
||||
$ym = substr($file, 0, 6);
|
||||
}
|
||||
$logfiles[$ym][] = $file;
|
||||
}
|
||||
}
|
||||
if($logfiles) {
|
||||
$lfs = array();
|
||||
foreach($logfiles as $ym => $lf) {
|
||||
$lastlogfile = $lf[0];
|
||||
unset($lf[0]);
|
||||
$lf[] = $lastlogfile;
|
||||
$lfs = array_merge($lfs, $lf);
|
||||
}
|
||||
return $lfs;
|
||||
}
|
||||
return array();
|
||||
}
|
||||
return array();
|
||||
<?php
|
||||
//error_reporting(E_ALL);
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
define('NOROBOT', TRUE);
|
||||
$returntype = isset($_GET['returnType']) ? $_GET['returnType']: 'json';//返回值方式
|
||||
$type=$_GET['type'];
|
||||
if(!in_array($type, array('list'))) {
|
||||
$type='list';
|
||||
}
|
||||
|
||||
$checkLanguage = $_G['language'];
|
||||
if(file_exists (DZZ_ROOT.'./admin/language/'.$checkLanguage.'/'.'lang.php')){
|
||||
include DZZ_ROOT.'./admin/language/'.$checkLanguage.'/'.'lang.php';
|
||||
$_G['lang']['template']=array_merge($_G['lang']['template'],$lang);
|
||||
}
|
||||
|
||||
if($type=="list"){
|
||||
//Hook::listen('adminlogin');
|
||||
!isset($_GET['page']) && $_GET['page']=1;
|
||||
$page=max(1,intval($_GET['page']));
|
||||
$lpp = empty($_GET['lpp']) ? 15 : $_GET['lpp'];
|
||||
$checklpp = array();
|
||||
$checklpp[$lpp] = 'selected="selected"';
|
||||
$extrainput = '';
|
||||
$systemlog_setting = is_serialized($_G["setting"]["systemlog_setting"])?unserialize($_G["setting"]["systemlog_setting"]):$_G["setting"]["systemlog_setting"];
|
||||
$operationarr = array_keys($systemlog_setting);
|
||||
$operation = in_array($_GET['operation'], $operationarr) ? $_GET['operation'] : "cplog";
|
||||
$navtitle=$systemlog_setting[$operation]["title"].' - '.lang('appname');//lang('nav_logs_'.$operation).' - '.lang('admin_navtitle');
|
||||
|
||||
$logdir = DZZ_ROOT.'./data/log/';
|
||||
$logfiles = get_log_files($logdir, $operation);
|
||||
|
||||
if($logfiles) $logfiles=array_reverse($logfiles);
|
||||
//error_reporting(E_ALL);
|
||||
$firstlogs = file( $logdir.$logfiles[0] ) ;
|
||||
$firstlogsnum = count($firstlogs);
|
||||
$countlogfile=count($logfiles);
|
||||
$count = ($countlogfile-1)*4000+$firstlogsnum;
|
||||
$multipage = multi($count, $lpp, $page, MOD_URL."&type=list&operation=$operation&lpp=$lpp",'pull-right' );
|
||||
|
||||
$logs = array();
|
||||
$jishu=4000;//每个日志文件最多行数
|
||||
$start = ($page - 1) * $lpp;
|
||||
$lastlog=$last_secondlog="";
|
||||
|
||||
$newdata=array();
|
||||
foreach($logfiles as $k=>$v){
|
||||
$nowfilemaxnum=($jishu*($k+1))-($jishu-$firstlogsnum);
|
||||
$startnum=($nowfilemaxnum-$jishu)<=0?0:($nowfilemaxnum-$jishu+1);
|
||||
$newdata[]=array("file"=>$v,"start"=>$startnum,"end"=>$nowfilemaxnum);
|
||||
}
|
||||
//print_R($newdata);
|
||||
//查询当前分页数据位于哪个日志文件
|
||||
$lastlog=$last_secondlog="";
|
||||
foreach($newdata as $k=>$v){
|
||||
if( $start<=$v["end"]){
|
||||
$lastlog=$v;
|
||||
if( ($start+$lpp)<$v["end"]){
|
||||
|
||||
}else{
|
||||
if( isset($newdata[$k+1])){
|
||||
$last_secondlog=$newdata[$k+1];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$j=0;
|
||||
for($i=$lastlog["start"];$i<$lastlog["end"];$i++){
|
||||
if( $start<=($lastlog["start"]+$j) ){
|
||||
break;
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
//获取数据开始
|
||||
$logs = file( $logdir.$lastlog["file"] );
|
||||
$logs = array_reverse($logs);
|
||||
if( $lastlog["file"]!=$logfiles[0] ){
|
||||
$j++;
|
||||
}
|
||||
$logs = array_slice($logs, $j, $lpp);
|
||||
$onecountget = count($logs);
|
||||
|
||||
$jj=0;
|
||||
if( $last_secondlog ){
|
||||
for($i=$last_secondlog["start"];$i<$last_secondlog["end"];$i++){
|
||||
if( ($jj)>= ($lpp-$onecountget) ){//$last_secondlog["start"] ){
|
||||
break;
|
||||
}
|
||||
$jj++;
|
||||
}
|
||||
}
|
||||
|
||||
if($last_secondlog){
|
||||
$logs2 = file( $logdir.$last_secondlog["file"] );
|
||||
$logs2 = array_reverse($logs2);
|
||||
$end=$lpp-count($logs);
|
||||
$logs2 = array_slice( $logs2, 0, $jj);
|
||||
$logs=array_merge($logs,$logs2);
|
||||
}
|
||||
//获取数据结束
|
||||
|
||||
$usergroup = array();
|
||||
foreach(C::t('usergroup')->range() as $group) {
|
||||
$usergroup[$group['groupid']] = $group['grouptitle'];
|
||||
}
|
||||
|
||||
$list=array();
|
||||
foreach($logs as $k => $logrow) {
|
||||
$log = explode("\t", $logrow);
|
||||
if(empty($log[1])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$log[1] = dgmdate($log[1], 'y-n-j H:i');
|
||||
$log[2] = $log[2];
|
||||
$log[2] = ($log[2] != $_G['member']['username'] ? "<b>$log[2]</b>" : $log[2]);
|
||||
$log[3] = $usergroup[$log[3]];
|
||||
|
||||
$list[$k]=$log;
|
||||
}
|
||||
|
||||
include template('list');
|
||||
}
|
||||
|
||||
|
||||
function getactionarray() {
|
||||
$isfounder = true;
|
||||
unset($topmenu['index'], $menu['index']);
|
||||
$actioncat = $actionarray = array();
|
||||
$actioncat[] = 'setting';
|
||||
$actioncat = array_merge($actioncat, array_keys($topmenu));
|
||||
foreach($menu as $tkey => $items) {
|
||||
foreach($items as $item) {
|
||||
$actionarray[$tkey][] = $item;
|
||||
}
|
||||
}
|
||||
return array('actions' => $actionarray, 'cats' => $actioncat);
|
||||
}
|
||||
function get_log_files($logdir = '', $action = 'action') {
|
||||
$dir = opendir($logdir);
|
||||
$files = array();
|
||||
while($entry = readdir($dir)) {
|
||||
$files[] = $entry;
|
||||
}
|
||||
closedir($dir);
|
||||
|
||||
if($files) {
|
||||
sort($files);
|
||||
$logfile = $action;
|
||||
$logfiles = array();
|
||||
$ym = '';
|
||||
foreach($files as $file) {
|
||||
if(strpos($file, $logfile) !== FALSE) {
|
||||
if(substr($file, 0, 6) != $ym) {
|
||||
$ym = substr($file, 0, 6);
|
||||
}
|
||||
$logfiles[$ym][] = $file;
|
||||
}
|
||||
}
|
||||
if($logfiles) {
|
||||
$lfs = array();
|
||||
foreach($logfiles as $ym => $lf) {
|
||||
$lastlogfile = $lf[0];
|
||||
unset($lf[0]);
|
||||
$lf[] = $lastlogfile;
|
||||
$lfs = array_merge($lfs, $lf);
|
||||
}
|
||||
return $lfs;
|
||||
}
|
||||
return array();
|
||||
}
|
||||
return array();
|
||||
}
|
||||
@@ -1,33 +1,33 @@
|
||||
<?php
|
||||
/*
|
||||
* 应用安装文件;
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author qchlian
|
||||
*/
|
||||
if(!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
/*以下配置初始化时已存入数据库配置表
|
||||
*$systemlog_setting = array(
|
||||
* 级别 名称 标记 是否开启
|
||||
"errorlog"=>array("title"=>"系统错误","is_open"=>1,"issystem"=>1),
|
||||
"cplog"=>array("title"=>"后台访问","is_open"=>1,"issystem"=>1),
|
||||
"deletelog"=>array("title"=>"数据删除","is_open"=>1,"issystem"=>1),
|
||||
"updatelog"=>array("title"=>"数据更新","is_open"=>1,"issystem"=>1),
|
||||
"loginlog"=>array("title"=>"用户登录","is_open"=>1,"issystem"=>1),
|
||||
"sendmail"=>array("title"=>"邮件发送","is_open"=>1,"issystem"=>1),
|
||||
"otherlog"=>array("title"=>"其他信息","is_open"=>1,"issystem"=>1),
|
||||
);
|
||||
*/
|
||||
|
||||
$sql = <<<EOF
|
||||
DELETE FROM `dzz_setting` WHERE `skey` = 'systemlog_open';
|
||||
INSERT INTO `dzz_setting` (`skey`,`svalue`) VALUES ('systemlog_open', '1');
|
||||
DELETE FROM `dzz_setting` WHERE `skey` = 'systemlog_setting';
|
||||
INSERT INTO `dzz_setting` (`skey`,`svalue`) VALUES ('systemlog_setting','a:7:{s:8:"errorlog";a:3:{s:5:"title";s:12:"系统错误";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:5:"cplog";a:3:{s:5:"title";s:12:"后台访问";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:9:"deletelog";a:3:{s:5:"title";s:12:"数据删除";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:9:"updatelog";a:3:{s:5:"title";s:12:"数据更新";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:8:"loginlog";a:3:{s:5:"title";s:12:"用户登录";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:8:"sendmail";a:3:{s:5:"title";s:12:"邮件发送";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:8:"otherlog";a:3:{s:5:"title";s:12:"其他信息";s:7:"is_open";i:1;s:8:"issystem";i:1;}}');
|
||||
EOF;
|
||||
runquery($sql);
|
||||
<?php
|
||||
/*
|
||||
* 应用安装文件;
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author qchlian
|
||||
*/
|
||||
if(!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
/*以下配置初始化时已存入数据库配置表
|
||||
*$systemlog_setting = array(
|
||||
* 级别 名称 标记 是否开启
|
||||
"errorlog"=>array("title"=>"系统错误","is_open"=>1,"issystem"=>1),
|
||||
"cplog"=>array("title"=>"后台访问","is_open"=>1,"issystem"=>1),
|
||||
"deletelog"=>array("title"=>"数据删除","is_open"=>1,"issystem"=>1),
|
||||
"updatelog"=>array("title"=>"数据更新","is_open"=>1,"issystem"=>1),
|
||||
"loginlog"=>array("title"=>"用户登录","is_open"=>1,"issystem"=>1),
|
||||
"sendmail"=>array("title"=>"邮件发送","is_open"=>1,"issystem"=>1),
|
||||
"otherlog"=>array("title"=>"其他信息","is_open"=>1,"issystem"=>1),
|
||||
);
|
||||
*/
|
||||
|
||||
$sql = <<<EOF
|
||||
DELETE FROM `dzz_setting` WHERE `skey` = 'systemlog_open';
|
||||
INSERT INTO `dzz_setting` (`skey`,`svalue`) VALUES ('systemlog_open', '1');
|
||||
DELETE FROM `dzz_setting` WHERE `skey` = 'systemlog_setting';
|
||||
INSERT INTO `dzz_setting` (`skey`,`svalue`) VALUES ('systemlog_setting','a:7:{s:8:"errorlog";a:3:{s:5:"title";s:12:"系统错误";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:5:"cplog";a:3:{s:5:"title";s:12:"后台访问";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:9:"deletelog";a:3:{s:5:"title";s:12:"数据删除";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:9:"updatelog";a:3:{s:5:"title";s:12:"数据更新";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:8:"loginlog";a:3:{s:5:"title";s:12:"用户登录";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:8:"sendmail";a:3:{s:5:"title";s:12:"邮件发送";s:7:"is_open";i:1;s:8:"issystem";i:1;}s:8:"otherlog";a:3:{s:5:"title";s:12:"其他信息";s:7:"is_open";i:1;s:8:"issystem";i:1;}}');
|
||||
EOF;
|
||||
runquery($sql);
|
||||
$finish = true; //结束时必须加入此句,告诉应用安装程序已经完成自定义的安装流程
|
||||
@@ -1,21 +1,21 @@
|
||||
<?php
|
||||
$lang = array (
|
||||
'appname'=>'系统日志',
|
||||
'logs' => '运行记录',
|
||||
'systemlog_setting'=>'设置',
|
||||
'systemlog_list'=>'日志列表',
|
||||
'info'=>'信息',
|
||||
'loginfo'=>'日志信息',
|
||||
'visit'=>'访问页面',
|
||||
'from'=>'来源页面',
|
||||
'logswitch'=>'日志开关',
|
||||
'logtype'=>'日志类型',
|
||||
'logtypename'=>'日志类型名称',
|
||||
'logtype'=>'日志类型',
|
||||
'logflag'=>'日志标识',
|
||||
'Logtag'=>'日志标记',
|
||||
'repeat'=>'重复',
|
||||
'Update_setting'=>'更新日志设置'
|
||||
);
|
||||
|
||||
<?php
|
||||
$lang = array (
|
||||
'appname'=>'系统日志',
|
||||
'logs' => '运行记录',
|
||||
'systemlog_setting'=>'设置',
|
||||
'systemlog_list'=>'日志列表',
|
||||
'info'=>'信息',
|
||||
'loginfo'=>'日志信息',
|
||||
'visit'=>'访问页面',
|
||||
'from'=>'来源页面',
|
||||
'logswitch'=>'日志开关',
|
||||
'logtype'=>'日志类型',
|
||||
'logtypename'=>'日志类型名称',
|
||||
'logtype'=>'日志类型',
|
||||
'logflag'=>'日志标识',
|
||||
'Logtag'=>'日志标记',
|
||||
'repeat'=>'重复',
|
||||
'Update_setting'=>'更新日志设置'
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -1,160 +1,160 @@
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
<link href="static/icheck/skins/minimal/blue.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
<link rel="stylesheet" href="static/css/checkbox.css">
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<style>
|
||||
html, body {
|
||||
overflow: hidden;
|
||||
background: #FFF;
|
||||
color: #4B4B4B;
|
||||
}
|
||||
.form-horizontal-left .radio-inline {
|
||||
padding: 5px 20px;
|
||||
margin: 0;
|
||||
}
|
||||
.loginset-template{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
.loginset-template .loginset-template-icon{
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 1px solid #AAB479;
|
||||
position: absolute;
|
||||
right: 1px;
|
||||
top: 1px;
|
||||
color: #DD4B39;
|
||||
font-size: 15px;
|
||||
display: none;
|
||||
}
|
||||
.loginset-template:hover .loginset-template-icon{
|
||||
display: block;
|
||||
}
|
||||
.loginset-template:hover .loginset-template-icon>span{
|
||||
display: none;
|
||||
}
|
||||
.loginset-template .loginset-template-icon1{
|
||||
display: block!important;
|
||||
}
|
||||
.loginset-template .loginset-template-icon1>span{
|
||||
display: block!important;
|
||||
}
|
||||
#cpform{
|
||||
margin-top: 15px;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
<div class="left-drager-op">
|
||||
<div class="left-drager-sub"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bs-main-container clearfix">
|
||||
<div class="main-title clearfix">
|
||||
</div>
|
||||
|
||||
<div class="main-content">
|
||||
<form id="cpform" action="{MOD_URL}&op=admin" class="form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="basic" name="operation">
|
||||
|
||||
<dl>
|
||||
<dt>{lang logswitch}:</dt>
|
||||
<dd class="clearfix">
|
||||
<label class="radio-inline "><input type="radio" name="systemlog_open" value="1"<!--{if $_G[setting][systemlog_open]==1}-->checked<!--{/if}--> onclick="document.getElementById('hidden1').style.display='block';">{lang enable}</label>
|
||||
<label class="radio radio-inline"><input type="radio" name="systemlog_open" value="0"<!--{if $_G[setting][systemlog_open]==0}-->checked<!--{/if}--> onclick="document.getElementById('hidden1').style.display='none';">{lang forbidden}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl id="hidden1">
|
||||
<dt>{lang logtype}:</dt>
|
||||
<dd class="clearfix">
|
||||
|
||||
<table id="systemlogtable" class="table text-center" style="width: auto;margin-bottom:0; <!--{if $_G[setting][systemlog_open]==0}-->display:none<!--{/if}-->">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{lang logtypename}</th>
|
||||
<th>{lang logflag}</th>
|
||||
<th>{lang logswitch}</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
{eval $i=0;}
|
||||
<!--{loop $systemlog_setting $mark $info}-->
|
||||
<tr>
|
||||
<td>
|
||||
<input type="hidden" name="settingnew[issystem][$i]" value="$info[issystem]" />
|
||||
<input class="form-control" style="width:120px;" <!--{if $info[issystem]==1}-->readonly="readonly"<!--{/if}--> type="text" name="settingnew[title][$i]" value="$info[title]" />
|
||||
</td>
|
||||
<td><input class="form-control" style="width:100px;" <!--{if $info[issystem]==1}-->readonly="readonly"<!--{/if}--> type="text" name="settingnew[mark][$i]" value="$mark" /></td>
|
||||
<td><input type="checkbox" name="settingnew[is_open][$i]" value="1" <!--{if $info[is_open]==1}-->checked<!--{/if}--> /></td>
|
||||
<td>
|
||||
<!--{if $info[issystem]!=1}-->
|
||||
<a href="javascript:;" class="col-xs-2 img_delete" onclick="deletesystem(this);"><span class="dzz dzz-delete" style="font-size:22px;"></span></a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
{eval $i++;}
|
||||
<!--{/loop}-->
|
||||
<tr>
|
||||
<td colspan="4" align="left"><a href="javascript:;" onclick="addsystemtype(this);"><i class="glyphicon glyphicon-plus"></i>{lang add}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
|
||||
<dd>
|
||||
<input class="btn btn-primary" id="submit_editsubmit" name="settingsubmit" value="{lang save_changes}" type="submit">
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
jQuery(document).ready(function(e) {
|
||||
jQuery('input').iCheck({
|
||||
checkboxClass: 'icheckbox_minimal-blue',
|
||||
radioClass: 'iradio_minimal-blue',
|
||||
});
|
||||
jQuery('input').on('ifChecked', function(e) {
|
||||
jQuery(this).trigger('click');
|
||||
});
|
||||
|
||||
jQuery('input[required]').on('blur', function() {
|
||||
if(this.value == '') { jQuery(this).addClass('input-error') } else { jQuery(this).removeClass('input-error'); }
|
||||
});
|
||||
});
|
||||
function addsystemtype( obj ){
|
||||
var num=jQuery("#systemlogtable").find("tr").length-1;
|
||||
var html='<tr><td><input type="hidden" name="settingnew[issystem]['+num+']" value="0" /><input class="form-control" style="width:120px;" type="text" name="settingnew[title]['+num+']" value="" /></td><td><input class="form-control" style="width:100px;" type="text" name="settingnew[mark]['+num+']" value="" /></td><td><input type="checkbox" name="settingnew[is_open]['+num+']" value="1" checked /></td><td><a class="col-xs-2 img_delete" onclick="deletesystem(this);" href="javascript:;"><span class="dzz dzz-delete" style="font-size:22px;"></span></a></td></tr>';
|
||||
jQuery(obj).parents("tr").before(html);
|
||||
|
||||
jQuery("#systemlogtable").iCheck({
|
||||
checkboxClass: 'icheckbox_minimal-blue',
|
||||
radioClass: 'iradio_minimal-blue',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function deletesystem( obj ){
|
||||
jQuery(obj).parents("tr").remove();
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<script type="text/javascript" src="static/icheck/icheck.min.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
<link href="static/icheck/skins/minimal/blue.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
<link rel="stylesheet" href="static/css/checkbox.css">
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<style>
|
||||
html, body {
|
||||
overflow: hidden;
|
||||
background: #FFF;
|
||||
color: #4B4B4B;
|
||||
}
|
||||
.form-horizontal-left .radio-inline {
|
||||
padding: 5px 20px;
|
||||
margin: 0;
|
||||
}
|
||||
.loginset-template{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
.loginset-template .loginset-template-icon{
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 1px solid #AAB479;
|
||||
position: absolute;
|
||||
right: 1px;
|
||||
top: 1px;
|
||||
color: #DD4B39;
|
||||
font-size: 15px;
|
||||
display: none;
|
||||
}
|
||||
.loginset-template:hover .loginset-template-icon{
|
||||
display: block;
|
||||
}
|
||||
.loginset-template:hover .loginset-template-icon>span{
|
||||
display: none;
|
||||
}
|
||||
.loginset-template .loginset-template-icon1{
|
||||
display: block!important;
|
||||
}
|
||||
.loginset-template .loginset-template-icon1>span{
|
||||
display: block!important;
|
||||
}
|
||||
#cpform{
|
||||
margin-top: 15px;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
<div class="left-drager-op">
|
||||
<div class="left-drager-sub"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bs-main-container clearfix">
|
||||
<div class="main-title clearfix">
|
||||
</div>
|
||||
|
||||
<div class="main-content">
|
||||
<form id="cpform" action="{MOD_URL}&op=admin" class="form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="basic" name="operation">
|
||||
|
||||
<dl>
|
||||
<dt>{lang logswitch}:</dt>
|
||||
<dd class="clearfix">
|
||||
<label class="radio-inline "><input type="radio" name="systemlog_open" value="1"<!--{if $_G[setting][systemlog_open]==1}-->checked<!--{/if}--> onclick="document.getElementById('hidden1').style.display='block';">{lang enable}</label>
|
||||
<label class="radio radio-inline"><input type="radio" name="systemlog_open" value="0"<!--{if $_G[setting][systemlog_open]==0}-->checked<!--{/if}--> onclick="document.getElementById('hidden1').style.display='none';">{lang forbidden}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl id="hidden1">
|
||||
<dt>{lang logtype}:</dt>
|
||||
<dd class="clearfix">
|
||||
|
||||
<table id="systemlogtable" class="table text-center" style="width: auto;margin-bottom:0; <!--{if $_G[setting][systemlog_open]==0}-->display:none<!--{/if}-->">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{lang logtypename}</th>
|
||||
<th>{lang logflag}</th>
|
||||
<th>{lang logswitch}</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
{eval $i=0;}
|
||||
<!--{loop $systemlog_setting $mark $info}-->
|
||||
<tr>
|
||||
<td>
|
||||
<input type="hidden" name="settingnew[issystem][$i]" value="$info[issystem]" />
|
||||
<input class="form-control" style="width:120px;" <!--{if $info[issystem]==1}-->readonly="readonly"<!--{/if}--> type="text" name="settingnew[title][$i]" value="$info[title]" />
|
||||
</td>
|
||||
<td><input class="form-control" style="width:100px;" <!--{if $info[issystem]==1}-->readonly="readonly"<!--{/if}--> type="text" name="settingnew[mark][$i]" value="$mark" /></td>
|
||||
<td><input type="checkbox" name="settingnew[is_open][$i]" value="1" <!--{if $info[is_open]==1}-->checked<!--{/if}--> /></td>
|
||||
<td>
|
||||
<!--{if $info[issystem]!=1}-->
|
||||
<a href="javascript:;" class="col-xs-2 img_delete" onclick="deletesystem(this);"><span class="dzz dzz-delete" style="font-size:22px;"></span></a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
{eval $i++;}
|
||||
<!--{/loop}-->
|
||||
<tr>
|
||||
<td colspan="4" align="left"><a href="javascript:;" onclick="addsystemtype(this);"><i class="glyphicon glyphicon-plus"></i>{lang add}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
|
||||
<dd>
|
||||
<input class="btn btn-primary" id="submit_editsubmit" name="settingsubmit" value="{lang save_changes}" type="submit">
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
jQuery(document).ready(function(e) {
|
||||
jQuery('input').iCheck({
|
||||
checkboxClass: 'icheckbox_minimal-blue',
|
||||
radioClass: 'iradio_minimal-blue',
|
||||
});
|
||||
jQuery('input').on('ifChecked', function(e) {
|
||||
jQuery(this).trigger('click');
|
||||
});
|
||||
|
||||
jQuery('input[required]').on('blur', function() {
|
||||
if(this.value == '') { jQuery(this).addClass('input-error') } else { jQuery(this).removeClass('input-error'); }
|
||||
});
|
||||
});
|
||||
function addsystemtype( obj ){
|
||||
var num=jQuery("#systemlogtable").find("tr").length-1;
|
||||
var html='<tr><td><input type="hidden" name="settingnew[issystem]['+num+']" value="0" /><input class="form-control" style="width:120px;" type="text" name="settingnew[title]['+num+']" value="" /></td><td><input class="form-control" style="width:100px;" type="text" name="settingnew[mark]['+num+']" value="" /></td><td><input type="checkbox" name="settingnew[is_open]['+num+']" value="1" checked /></td><td><a class="col-xs-2 img_delete" onclick="deletesystem(this);" href="javascript:;"><span class="dzz dzz-delete" style="font-size:22px;"></span></a></td></tr>';
|
||||
jQuery(obj).parents("tr").before(html);
|
||||
|
||||
jQuery("#systemlogtable").iCheck({
|
||||
checkboxClass: 'icheckbox_minimal-blue',
|
||||
radioClass: 'iradio_minimal-blue',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function deletesystem( obj ){
|
||||
jQuery(obj).parents("tr").remove();
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<script type="text/javascript" src="static/icheck/icheck.min.js?{VERHASH}"></script>
|
||||
<!--{template common/footer_simple}-->
|
||||
@@ -1,4 +1,4 @@
|
||||
<ul class="nav-stacked">
|
||||
<li <!--{if $_GET[op]!="admin" }--> class="active" <!--{/if}-->><a hidefocus="true" href="{MOD_URL}">{lang systemlog_list}</a></li>
|
||||
<li <!--{if $_GET[op]=="admin" }--> class="active" <!--{/if}-->><a hidefocus="true" href="{MOD_URL}&op=admin">{lang systemlog_setting}</a></li>
|
||||
<ul class="nav-stacked">
|
||||
<li <!--{if $_GET[op]!="admin" }--> class="active" <!--{/if}-->><a hidefocus="true" href="{MOD_URL}">{lang systemlog_list}</a></li>
|
||||
<li <!--{if $_GET[op]=="admin" }--> class="active" <!--{/if}-->><a hidefocus="true" href="{MOD_URL}&op=admin">{lang systemlog_setting}</a></li>
|
||||
</ul>
|
||||
@@ -1,110 +1,110 @@
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
<link href="static/select2/select2.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
<link href="static/select2/select2-bootstrap.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<style>
|
||||
input[type="text"] {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
|
||||
<div class="main-header clearfix" style="border-bottom:1px solid #e1e1e1;padding-top: 15px;">
|
||||
|
||||
<ul class="nav nav-pills nav-pills-bottomguide">
|
||||
|
||||
<!--{loop $systemlog_setting $mark $info}-->
|
||||
<!--{if $info[is_open]==1 }-->
|
||||
<li <!--{if $operation==$mark }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod=systemlog&type=list&operation=$mark">{$info['title']}</a>
|
||||
</li>
|
||||
<!--{/if}-->
|
||||
<!--{/loop}-->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="main-content" style="border-top:1px solid #FFF">
|
||||
|
||||
<form id="cpform" action="{BASESCRIPT}?mod=systemlog&type=list&operation=$operation" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" name="lpp" value="20">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th width="80">{lang operator}</th>
|
||||
<th width="80">{lang usergroup}</th>
|
||||
<th width="120">{lang ip}</th>
|
||||
<th width="120">{lang time}</th>
|
||||
<th>{lang info}</th>
|
||||
</thead>
|
||||
<!--{if $list}-->
|
||||
<!--{loop $list $key $log}-->
|
||||
<tr>
|
||||
<td>$log[2]</td>
|
||||
<td>$log[3]</td>
|
||||
<td>$log[4]</td>
|
||||
<td>$log[1]</td>
|
||||
<td>
|
||||
<a href="javascript:;" onclick="togglecplog('{$key}')">{eval echo cutstr($log[5], 200)}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<thead id="cplog_{$key}" style="display:none">
|
||||
<td colspan="10">
|
||||
{lang loginfo}: $log[5]
|
||||
<br/>{lang visit}: $log[6]
|
||||
<br/>{lang from}: $log[7]</td>
|
||||
</thead>
|
||||
<!--{/loop}-->
|
||||
<tr>
|
||||
<td colspan="15">
|
||||
<div class="pull-left input-group" style="width:100px;">
|
||||
<span class="input-group-addon">{lang logs_lpp}</span>
|
||||
<select class="input-sm form-control" style="margin:0;width:60px;" onchange="if(this.options[this.selectedIndex].value != '') {this.form.lpp.value = this.options[this.selectedIndex].value;this.form.submit(); }">
|
||||
<option value="20" $checklpp[20]> 20 </option>
|
||||
<option value="40" $checklpp[40]> 40 </option>
|
||||
<option value="80" $checklpp[80]> 80 </option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="pull-left input-group" style="width:128px;">
|
||||
<input type="text" class="input-sm form-control" style="width:90px;border-left:0" name="keyword" value="$_GET[keyword]">
|
||||
<a href="javascript:;" class="input-group-addon" onclick="document.getElementById('cpform').submit();return false"><i class="glyphicon glyphicon-search"></i></a>
|
||||
</div>
|
||||
$multipage
|
||||
</td>
|
||||
</tr>
|
||||
<!--{else}-->
|
||||
<tr>
|
||||
<td colspan="5">{lang there_no_such_results}</td>
|
||||
</tr>
|
||||
<!--{/if}-->
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
function togglecplog(k) {
|
||||
var cplogobj = document.getElementById('cplog_' + k);
|
||||
if(cplogobj.style.display == 'none') {
|
||||
cplogobj.style.display = '';
|
||||
} else {
|
||||
cplogobj.style.display = 'none';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
<link href="static/select2/select2.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
<link href="static/select2/select2-bootstrap.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<style>
|
||||
input[type="text"] {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
|
||||
<div class="main-header clearfix" style="border-bottom:1px solid #e1e1e1;padding-top: 15px;">
|
||||
|
||||
<ul class="nav nav-pills nav-pills-bottomguide">
|
||||
|
||||
<!--{loop $systemlog_setting $mark $info}-->
|
||||
<!--{if $info[is_open]==1 }-->
|
||||
<li <!--{if $operation==$mark }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod=systemlog&type=list&operation=$mark">{$info['title']}</a>
|
||||
</li>
|
||||
<!--{/if}-->
|
||||
<!--{/loop}-->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="main-content" style="border-top:1px solid #FFF">
|
||||
|
||||
<form id="cpform" action="{BASESCRIPT}?mod=systemlog&type=list&operation=$operation" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" name="lpp" value="20">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th width="80">{lang operator}</th>
|
||||
<th width="80">{lang usergroup}</th>
|
||||
<th width="120">{lang ip}</th>
|
||||
<th width="120">{lang time}</th>
|
||||
<th>{lang info}</th>
|
||||
</thead>
|
||||
<!--{if $list}-->
|
||||
<!--{loop $list $key $log}-->
|
||||
<tr>
|
||||
<td>$log[2]</td>
|
||||
<td>$log[3]</td>
|
||||
<td>$log[4]</td>
|
||||
<td>$log[1]</td>
|
||||
<td>
|
||||
<a href="javascript:;" onclick="togglecplog('{$key}')">{eval echo cutstr($log[5], 200)}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<thead id="cplog_{$key}" style="display:none">
|
||||
<td colspan="10">
|
||||
{lang loginfo}: $log[5]
|
||||
<br/>{lang visit}: $log[6]
|
||||
<br/>{lang from}: $log[7]</td>
|
||||
</thead>
|
||||
<!--{/loop}-->
|
||||
<tr>
|
||||
<td colspan="15">
|
||||
<div class="pull-left input-group" style="width:100px;">
|
||||
<span class="input-group-addon">{lang logs_lpp}</span>
|
||||
<select class="input-sm form-control" style="margin:0;width:60px;" onchange="if(this.options[this.selectedIndex].value != '') {this.form.lpp.value = this.options[this.selectedIndex].value;this.form.submit(); }">
|
||||
<option value="20" $checklpp[20]> 20 </option>
|
||||
<option value="40" $checklpp[40]> 40 </option>
|
||||
<option value="80" $checklpp[80]> 80 </option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="pull-left input-group" style="width:128px;">
|
||||
<input type="text" class="input-sm form-control" style="width:90px;border-left:0" name="keyword" value="$_GET[keyword]">
|
||||
<a href="javascript:;" class="input-group-addon" onclick="document.getElementById('cpform').submit();return false"><i class="glyphicon glyphicon-search"></i></a>
|
||||
</div>
|
||||
$multipage
|
||||
</td>
|
||||
</tr>
|
||||
<!--{else}-->
|
||||
<tr>
|
||||
<td colspan="5">{lang there_no_such_results}</td>
|
||||
</tr>
|
||||
<!--{/if}-->
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
function togglecplog(k) {
|
||||
var cplogobj = document.getElementById('cplog_' + k);
|
||||
if(cplogobj.style.display == 'none') {
|
||||
cplogobj.style.display = '';
|
||||
} else {
|
||||
cplogobj.style.display = 'none';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/footer_simple}-->
|
||||
@@ -1,18 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
* 应用卸载文件;
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author qchlian
|
||||
*/
|
||||
if(!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$sql = <<<EOF
|
||||
DELETE FROM `dzz_setting` WHERE `dzz_setting`.`skey` = 'systemlog_setting';
|
||||
DELETE FROM `dzz_setting` WHERE `dzz_setting`.`skey` = 'systemlog_open';
|
||||
EOF;
|
||||
runquery($sql);
|
||||
$finish = true;
|
||||
<?php
|
||||
/*
|
||||
* 应用卸载文件;
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author qchlian
|
||||
*/
|
||||
if(!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$sql = <<<EOF
|
||||
DELETE FROM `dzz_setting` WHERE `dzz_setting`.`skey` = 'systemlog_setting';
|
||||
DELETE FROM `dzz_setting` WHERE `dzz_setting`.`skey` = 'systemlog_open';
|
||||
EOF;
|
||||
runquery($sql);
|
||||
$finish = true;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<ul class="nav navbar-nav navbar-nav-left" style="min-width:168px">
|
||||
<li>
|
||||
<a class="leftTopmenu" href="index.php?mod=appmanagement" style="padding:8px"><div class="gb_fc"><span class="dzz dzz-chevron-left" style="display:block"></span></div></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{MOD_URL}">{lang appname}</a>
|
||||
</li>
|
||||
<ul class="nav navbar-nav navbar-nav-left" style="min-width:168px">
|
||||
<li>
|
||||
<a class="leftTopmenu" href="index.php?mod=appmanagement" style="padding:8px"><div class="gb_fc"><span class="dzz dzz-chevron-left" style="display:block"></span></div></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{MOD_URL}">{lang appname}</a>
|
||||
</li>
|
||||
</ul>
|
||||
110
avatar.php
110
avatar.php
@@ -1,55 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
error_reporting(0);
|
||||
define('SITEURL', strtolower(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))));
|
||||
|
||||
$uid = isset($_GET['uid']) ? $_GET['uid'] : 0;
|
||||
$size = isset($_GET['size']) ? $_GET['size'] : '';
|
||||
$random = isset($_GET['random']) ? $_GET['random'] : '';
|
||||
$type = isset($_GET['type']) ? $_GET['type'] : '';
|
||||
$check = isset($_GET['check_file_exists']) ? $_GET['check_file_exists'] : '';
|
||||
|
||||
$avatar = './data/avatar/'.get_avatar($uid, $size, $type);
|
||||
if(file_exists(dirname(__FILE__).'/'.$avatar)) {
|
||||
if($check) {
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
$random = !empty($random) ? rand(1000, 9999) : '';
|
||||
$avatar_url = empty($random) ? $avatar : $avatar.'?random='.$random;
|
||||
} else {
|
||||
if($check) {
|
||||
echo 0;
|
||||
exit;
|
||||
}
|
||||
$size = in_array($size, array('big', 'middle', 'small')) ? $size : 'middle';
|
||||
$avatar_url = 'static/image/avatar/noavatar_'.$size.'.gif';
|
||||
}
|
||||
|
||||
if(empty($random)) {
|
||||
header("HTTP/1.1 301 Moved Permanently");
|
||||
header("Last-Modified:".date('r'));
|
||||
header("Expires: ".date('r', time() + 86400));
|
||||
}
|
||||
|
||||
header('Location: '.SITEURL.'/'.$avatar_url);
|
||||
exit;
|
||||
|
||||
function get_avatar($uid, $size = 'middle', $type = '') {
|
||||
$size = in_array($size, array('big', 'middle', 'small')) ? $size : 'middle';
|
||||
$uid = abs(intval($uid));
|
||||
$uid = sprintf("%09d", $uid);
|
||||
$dir1 = substr($uid, 0, 3);
|
||||
$dir2 = substr($uid, 3, 2);
|
||||
$dir3 = substr($uid, 5, 2);
|
||||
$typeadd = $type == 'real' ? '_real' : '';
|
||||
return $dir1.'/'.$dir2.'/'.$dir3.'/'.substr($uid, -2).$typeadd."_avatar_$size.jpg";
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
error_reporting(0);
|
||||
define('SITEURL', strtolower(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))));
|
||||
|
||||
$uid = isset($_GET['uid']) ? $_GET['uid'] : 0;
|
||||
$size = isset($_GET['size']) ? $_GET['size'] : '';
|
||||
$random = isset($_GET['random']) ? $_GET['random'] : '';
|
||||
$type = isset($_GET['type']) ? $_GET['type'] : '';
|
||||
$check = isset($_GET['check_file_exists']) ? $_GET['check_file_exists'] : '';
|
||||
|
||||
$avatar = './data/avatar/'.get_avatar($uid, $size, $type);
|
||||
if(file_exists(dirname(__FILE__).'/'.$avatar)) {
|
||||
if($check) {
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
$random = !empty($random) ? rand(1000, 9999) : '';
|
||||
$avatar_url = empty($random) ? $avatar : $avatar.'?random='.$random;
|
||||
} else {
|
||||
if($check) {
|
||||
echo 0;
|
||||
exit;
|
||||
}
|
||||
$size = in_array($size, array('big', 'middle', 'small')) ? $size : 'middle';
|
||||
$avatar_url = 'data/avatar/noavatar_'.$size.'.gif';
|
||||
}
|
||||
|
||||
if(empty($random)) {
|
||||
header("HTTP/1.1 301 Moved Permanently");
|
||||
header("Last-Modified:".date('r'));
|
||||
header("Expires: ".date('r', time() + 86400));
|
||||
}
|
||||
|
||||
header('Location: '.SITEURL.'/'.$avatar_url);
|
||||
exit;
|
||||
|
||||
function get_avatar($uid, $size = 'middle', $type = '') {
|
||||
$size = in_array($size, array('big', 'middle', 'small')) ? $size : 'middle';
|
||||
$uid = abs(intval($uid));
|
||||
$uid = sprintf("%09d", $uid);
|
||||
$dir1 = substr($uid, 0, 3);
|
||||
$dir2 = substr($uid, 3, 2);
|
||||
$dir3 = substr($uid, 5, 2);
|
||||
$typeadd = $type == 'real' ? '_real' : '';
|
||||
return $dir1.'/'.$dir2.'/'.$dir3.'/'.substr($uid, -2).$typeadd."_avatar_$size.jpg";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,169 +1,186 @@
|
||||
<?php
|
||||
$_config = array();
|
||||
|
||||
// ---------------------------- CONFIG DB ----------------------------- //
|
||||
// ---------------------------- 数据库相关设置---------------------------- //
|
||||
|
||||
/**
|
||||
* 数据库主服务器设置, 支持多组服务器设置, 当设置多组服务器时, 则会根据分布式策略使用某个服务器
|
||||
* @example
|
||||
* $_config['db']['1']['dbhost'] = 'localhost'; // 服务器地址
|
||||
* $_config['db']['1']['dbuser'] = 'root'; // 用户
|
||||
* $_config['db']['1']['dbpw'] = '';// 密码
|
||||
* $_config['db']['1']['dbcharset'] = 'gbk';// 字符集
|
||||
* $_config['db']['1']['pconnect'] = '0';// 是否持续连接
|
||||
* $_config['db']['1']['dbname'] = 'x1';// 数据库
|
||||
* $_config['db']['1']['tablepre'] = 'pre_';// 表名前缀
|
||||
*
|
||||
* $_config['db']['2']['dbhost'] = 'localhost';
|
||||
* ...
|
||||
*/
|
||||
$_config['db'][1]['dbhost'] = 'localhost';//支持三种直接加端口如:127.0.0.1:3306或使用UNix socket 如:/tmp/mysql.sock
|
||||
$_config['db'][1]['dbuser'] = 'root';
|
||||
$_config['db'][1]['dbpw'] = 'root';
|
||||
$_config['db'][1]['dbcharset'] = 'utf8';
|
||||
$_config['db'][1]['pconnect'] = 0;
|
||||
$_config['db'][1]['dbname'] = 'pichome';
|
||||
$_config['db'][1]['tablepre'] = 'pichome_';
|
||||
$_config['db'][1]['port'] = '3306';//mysql端口
|
||||
$_config['db'][1]['unix_socket'] = '';//使用此方式连接时 dbhost设置为localhost
|
||||
|
||||
/**
|
||||
* 数据库从服务器设置( slave, 只读 ), 支持多组服务器设置, 当设置多组服务器时, 系统根据每次随机使用
|
||||
* @example
|
||||
* $_config['db']['1']['slave']['1']['dbhost'] = 'localhost';
|
||||
* $_config['db']['1']['slave']['1']['dbuser'] = 'root';
|
||||
* $_config['db']['1']['slave']['1']['dbpw'] = 'root';
|
||||
* $_config['db']['1']['slave']['1']['dbcharset'] = 'gbk';
|
||||
* $_config['db']['1']['slave']['1']['pconnect'] = '0';
|
||||
* $_config['db']['1']['slave']['1']['dbname'] = 'x1';
|
||||
* $_config['db']['1']['slave']['1']['tablepre'] = 'pre_';
|
||||
* $_config['db']['1']['slave']['1']['weight'] = '0'; //权重:数据越大权重越高
|
||||
*
|
||||
* $_config['db']['1']['slave']['2']['dbhost'] = 'localhost';
|
||||
* ...
|
||||
*
|
||||
*/
|
||||
$_config['db']['1']['slave'] = array();
|
||||
|
||||
//启用从服务器的开关
|
||||
$_config['db']['slave'] = false;
|
||||
/**
|
||||
* 数据库 分布部署策略设置
|
||||
*
|
||||
* @example 将 user 部署到第二服务器, session 部署在第三服务器, 则设置为
|
||||
* $_config['db']['map']['user'] = 2;
|
||||
* $_config['db']['map']['session'] = 3;
|
||||
*
|
||||
* 对于没有明确声明服务器的表, 则一律默认部署在第一服务器上
|
||||
*
|
||||
*/
|
||||
$_config['db']['map'] = array();
|
||||
|
||||
/**
|
||||
* 数据库 公共设置, 此类设置通常对针对每个部署的服务器
|
||||
*/
|
||||
$_config['db']['common'] = array();
|
||||
|
||||
/**
|
||||
* 禁用从数据库的数据表, 表名字之间使用逗号分割
|
||||
*
|
||||
* @example session, user 这两个表仅从主服务器读写, 不使用从服务器
|
||||
* $_config['db']['common']['slave_except_table'] = 'session, user';
|
||||
*
|
||||
*/
|
||||
$_config['db']['common']['slave_except_table'] = '';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 内存服务器优化设置
|
||||
* 以下设置需要PHP扩展组件支持,其中 memcache 优先于其他设置,
|
||||
* 当 memcache 无法启用时,会自动开启另外的两种优化模式
|
||||
*/
|
||||
|
||||
//内存变量前缀, 可更改,避免同服务器中的程序引用错乱
|
||||
$_config['memory']['prefix'] = 'oaooa_';
|
||||
|
||||
/* reids设置, 需要PHP扩展组件支持, timeout参数的作用没有查证 */
|
||||
$_config['memory']['redis']['server'] = '';
|
||||
$_config['memory']['redis']['port'] = 6379;
|
||||
$_config['memory']['redis']['pconnect'] = 1;
|
||||
$_config['memory']['redis']['timeout'] = 0;
|
||||
$_config['memory']['redis']['requirepass'] = '';//如果redis需要密码,请填写redis密码
|
||||
/**
|
||||
* 是否使用 Redis::SERIALIZER_IGBINARY选项,需要igbinary支持,windows下测试时请关闭,否则会出>现错误Reading from client: Connection reset by peer
|
||||
* 支持以下选项,默认使用PHP的serializer
|
||||
* Redis::SERIALIZER_IGBINARY =2
|
||||
* Redis::SERIALIZER_PHP =1
|
||||
* Redis::SERIALIZER_NONE =0 //则不使用serialize,即无法保存array
|
||||
*/
|
||||
$_config['memory']['redis']['serializer'] = 1;
|
||||
|
||||
$_config['memory']['memcache']['server'] = ''; // memcache 服务器地址
|
||||
$_config['memory']['memcache']['port'] = 11211; // memcache 服务器端口
|
||||
$_config['memory']['memcache']['pconnect'] = 1; // memcache 是否长久连接
|
||||
$_config['memory']['memcache']['timeout'] = 1; // memcache 服务器连接超时
|
||||
|
||||
$_config['memory']['memcached']['server'] = '127.0.0.1'; // memcached 服务器地址
|
||||
$_config['memory']['memcached']['port'] = 11211; // memcached 服务器端口
|
||||
$_config['memory']['memcached']['pconnect'] = 1; // memcached 是否长久连接
|
||||
$_config['memory']['memcached']['timeout'] = 1; // memcached 服务器连接超时
|
||||
|
||||
$_config['memory']['apc'] = 1; // 启动对 apc 的支持
|
||||
$_config['memory']['xcache'] = 1; // 启动对 xcache 的支持
|
||||
$_config['memory']['eaccelerator'] = 0; // 启动对 eaccelerator 的支持
|
||||
$_config['memory']['wincache'] = 1; // 启动对 wincache 的支持
|
||||
|
||||
|
||||
// 服务器相关设置
|
||||
$_config['server']['id'] = 1; // 服务器编号,多webserver的时候,用于标识当前服务器的ID
|
||||
|
||||
//计划任务设置
|
||||
$_config['remote']['on']=0; //1:设定计划任务由外部触发;0:通过用户访问触发
|
||||
$_config['remote']['cron']=0; //1:设定计划任务由外部触发;0:通过用户访问触发
|
||||
// CONFIG CACHE
|
||||
$_config['cache']['type'] = 'sql'; // 缓存类型 file=文件缓存, sql=数据库缓存
|
||||
|
||||
// 页面输出设置
|
||||
$_config['output']['charset'] = 'utf-8'; // 页面字符集
|
||||
$_config['output']['forceheader'] = 1; // 强制输出页面字符集,用于避免某些环境乱码
|
||||
$_config['output']['gzip'] = 0; // 是否采用 Gzip 压缩输出
|
||||
$_config['output']['tplrefresh'] = 1; // 模板自动刷新开关 0=关闭, 1=打开
|
||||
|
||||
|
||||
$_config['output']['language'] = 'zh-CN'; // 页面语言 zh-cn/zh-tw
|
||||
$_config['output']['language_list']['zh-CN']='简体中文'; // 页面语言 zh-CN/en-US
|
||||
$_config['output']['language_list']['en-US']='English'; // 页面语言 zh-CN/en-US
|
||||
|
||||
$_config['output']['staticurl'] = 'static/'; // 站点静态文件路径,“/”结尾
|
||||
$_config['output']['ajaxvalidate'] = 0; // 是否严格验证 Ajax 页面的真实性 0=关闭,1=打开
|
||||
$_config['output']['iecompatible'] = 0; // 页面 IE 兼容模式
|
||||
|
||||
// COOKIE 设置
|
||||
$_config['cookie']['cookiepre'] = 'oaooa_'; // COOKIE前缀
|
||||
$_config['cookie']['cookiedomain'] = ''; // COOKIE作用域
|
||||
$_config['cookie']['cookiepath'] = '/'; // COOKIE作用路径
|
||||
|
||||
// 站点安全设置
|
||||
$_config['security']['authkey'] = 'oaooa'; // 站点加密密钥
|
||||
$_config['security']['urlxssdefend'] = true; // 自身 URL XSS 防御
|
||||
$_config['security']['attackevasive'] = 0; // CC 攻击防御 1|2|4|8
|
||||
|
||||
$_config['security']['querysafe']['status'] = 1; // 是否开启SQL安全检测,可自动预防SQL注入攻击
|
||||
$_config['security']['querysafe']['dfunction'] = array('load_file','hex','substring','if','ord','char');
|
||||
$_config['security']['querysafe']['daction'] = array('@','intooutfile','intodumpfile','unionselect','(select', 'unionall', 'uniondistinct');
|
||||
$_config['security']['querysafe']['dnote'] = array('/*','*/','#','--','"');
|
||||
$_config['security']['querysafe']['dlikehex'] = 1;
|
||||
$_config['security']['querysafe']['afullnote'] = 0;
|
||||
|
||||
$_config['admincp']['founder'] = '1'; // 站点创始人:拥有站点管理后台的最高权限,每个站点可以设置 1名或多名创始人
|
||||
// 可以使用uid,也可以使用用户名;多个创始人之间请使用逗号“,”分开;
|
||||
$_config['admincp']['checkip'] = 1; // 后台管理操作是否验证管理员的 IP, 1=是[安全], 0=否。仅在管理员无法登录后台时设置 0。
|
||||
$_config['admincp']['runquery'] = 0; // 是否允许后台运行 SQL 语句 1=是 0=否[安全]
|
||||
$_config['admincp']['dbimport'] = 0; // 是否允许后台恢复网站数据 1=是 0=否[安全]
|
||||
$_config['userlogin']['checkip'] = 1; //用户登录错误验证ip,对于同一ip同时使用时建议设置为0,否则当有一位用户登录错误次数超过5次,该ip被锁定15分钟,导致其他的同IP用户无法登录;
|
||||
|
||||
//$_config['system_os'] = 'linux'; //windows,linux,mac,系统会自动判断
|
||||
//$_config['system_charset']='utf-8'; //操作系统编码,不设置系统将根据操作系统类型来判断linux:utf-8;windows:gbk;
|
||||
return $_config;
|
||||
<?php
|
||||
$_config = array();
|
||||
|
||||
// ---------------------------- CONFIG DB ----------------------------- //
|
||||
// ---------------------------- 数据库相关设置---------------------------- //
|
||||
|
||||
/**
|
||||
* 数据库主服务器设置, 支持多组服务器设置, 当设置多组服务器时, 则会根据分布式策略使用某个服务器
|
||||
* @example
|
||||
* $_config['db']['1']['dbhost'] = 'localhost'; // 服务器地址
|
||||
* $_config['db']['1']['dbuser'] = 'root'; // 用户
|
||||
* $_config['db']['1']['dbpw'] = '';// 密码
|
||||
* $_config['db']['1']['dbcharset'] = 'gbk';// 字符集
|
||||
* $_config['db']['1']['pconnect'] = '0';// 是否持续连接
|
||||
* $_config['db']['1']['dbname'] = 'x1';// 数据库
|
||||
* $_config['db']['1']['tablepre'] = 'pre_';// 表名前缀
|
||||
*
|
||||
* $_config['db']['2']['dbhost'] = 'localhost';
|
||||
* ...
|
||||
*/
|
||||
$_config['db'][1]['dbhost'] = 'localhost';//支持三种直接加端口如:127.0.0.1:3306或使用UNix socket 如:/tmp/mysql.sock
|
||||
$_config['db'][1]['dbuser'] = 'root';
|
||||
$_config['db'][1]['dbpw'] = 'root';
|
||||
$_config['db'][1]['dbcharset'] = 'utf8';
|
||||
$_config['db'][1]['pconnect'] = 0;
|
||||
$_config['db'][1]['dbname'] = 'pichome';
|
||||
$_config['db'][1]['tablepre'] = 'pichome_';
|
||||
$_config['db'][1]['port'] = '3306';//mysql端口
|
||||
$_config['db'][1]['unix_socket'] = '';//使用此方式连接时 dbhost设置为localhost
|
||||
|
||||
/**
|
||||
* 数据库从服务器设置( slave, 只读 ), 支持多组服务器设置, 当设置多组服务器时, 系统根据每次随机使用
|
||||
* @example
|
||||
* $_config['db']['1']['slave']['1']['dbhost'] = 'localhost';
|
||||
* $_config['db']['1']['slave']['1']['dbuser'] = 'root';
|
||||
* $_config['db']['1']['slave']['1']['dbpw'] = 'root';
|
||||
* $_config['db']['1']['slave']['1']['dbcharset'] = 'gbk';
|
||||
* $_config['db']['1']['slave']['1']['pconnect'] = '0';
|
||||
* $_config['db']['1']['slave']['1']['dbname'] = 'x1';
|
||||
* $_config['db']['1']['slave']['1']['tablepre'] = 'pre_';
|
||||
* $_config['db']['1']['slave']['1']['weight'] = '0'; //权重:数据越大权重越高
|
||||
*
|
||||
* $_config['db']['1']['slave']['2']['dbhost'] = 'localhost';
|
||||
* ...
|
||||
*
|
||||
*/
|
||||
$_config['db']['1']['slave'] = array();
|
||||
|
||||
//启用从服务器的开关
|
||||
$_config['db']['slave'] = false;
|
||||
/**
|
||||
* 数据库 分布部署策略设置
|
||||
*
|
||||
* @example 将 user 部署到第二服务器, session 部署在第三服务器, 则设置为
|
||||
* $_config['db']['map']['user'] = 2;
|
||||
* $_config['db']['map']['session'] = 3;
|
||||
*
|
||||
* 对于没有明确声明服务器的表, 则一律默认部署在第一服务器上
|
||||
*
|
||||
*/
|
||||
$_config['db']['map'] = array();
|
||||
|
||||
/**
|
||||
* 数据库 公共设置, 此类设置通常对针对每个部署的服务器
|
||||
*/
|
||||
$_config['db']['common'] = array();
|
||||
|
||||
/**
|
||||
* 禁用从数据库的数据表, 表名字之间使用逗号分割
|
||||
*
|
||||
* @example session, user 这两个表仅从主服务器读写, 不使用从服务器
|
||||
* $_config['db']['common']['slave_except_table'] = 'session, user';
|
||||
*
|
||||
*/
|
||||
$_config['db']['common']['slave_except_table'] = '';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 内存服务器优化设置
|
||||
* 以下设置需要PHP扩展组件支持,其中 memcache 优先于其他设置,
|
||||
* 当 memcache 无法启用时,会自动开启另外的两种优化模式
|
||||
*/
|
||||
|
||||
//内存变量前缀, 可更改,避免同服务器中的程序引用错乱
|
||||
$_config['memory']['prefix'] = 'oaooa_';
|
||||
|
||||
/* reids设置, 需要PHP扩展组件支持, timeout参数的作用没有查证 */
|
||||
$_config['memory']['redis']['server'] = '';
|
||||
$_config['memory']['redis']['port'] = 6379;
|
||||
$_config['memory']['redis']['pconnect'] = 1;
|
||||
$_config['memory']['redis']['timeout'] = 0;
|
||||
$_config['memory']['redis']['requirepass'] = '';//如果redis需要密码,请填写redis密码
|
||||
/**
|
||||
* 是否使用 Redis::SERIALIZER_IGBINARY选项,需要igbinary支持,windows下测试时请关闭,否则会出>现错误Reading from client: Connection reset by peer
|
||||
* 支持以下选项,默认使用PHP的serializer
|
||||
* Redis::SERIALIZER_IGBINARY =2
|
||||
* Redis::SERIALIZER_PHP =1
|
||||
* Redis::SERIALIZER_NONE =0 //则不使用serialize,即无法保存array
|
||||
*/
|
||||
$_config['memory']['redis']['serializer'] = 1;
|
||||
|
||||
$_config['memory']['memcache']['server'] = ''; // memcache 服务器地址
|
||||
$_config['memory']['memcache']['port'] = 11211; // memcache 服务器端口
|
||||
$_config['memory']['memcache']['pconnect'] = 1; // memcache 是否长久连接
|
||||
$_config['memory']['memcache']['timeout'] = 1; // memcache 服务器连接超时
|
||||
|
||||
$_config['memory']['memcached']['server'] = '127.0.0.1'; // memcached 服务器地址
|
||||
$_config['memory']['memcached']['port'] = 11211; // memcached 服务器端口
|
||||
$_config['memory']['memcached']['pconnect'] = 1; // memcached 是否长久连接
|
||||
$_config['memory']['memcached']['timeout'] = 1; // memcached 服务器连接超时
|
||||
|
||||
$_config['memory']['apc'] = 1; // 启动对 apc 的支持
|
||||
$_config['memory']['xcache'] = 1; // 启动对 xcache 的支持
|
||||
$_config['memory']['eaccelerator'] = 0; // 启动对 eaccelerator 的支持
|
||||
$_config['memory']['wincache'] = 1; // 启动对 wincache 的支持
|
||||
|
||||
|
||||
// 服务器相关设置
|
||||
$_config['server']['id'] = 1; // 服务器编号,多webserver的时候,用于标识当前服务器的ID
|
||||
|
||||
//计划任务设置
|
||||
$_config['remote']['on']=0; //1:设定计划任务由外部触发;0:通过用户访问触发
|
||||
$_config['remote']['cron']=0; //1:设定计划任务由外部触发;0:通过用户访问触发
|
||||
// CONFIG CACHE
|
||||
$_config['cache']['type'] = 'sql'; // 缓存类型 file=文件缓存, sql=数据库缓存
|
||||
|
||||
// 页面输出设置
|
||||
$_config['output']['charset'] = 'utf-8'; // 页面字符集
|
||||
$_config['output']['forceheader'] = 1; // 强制输出页面字符集,用于避免某些环境乱码
|
||||
$_config['output']['gzip'] = 0; // 是否采用 Gzip 压缩输出
|
||||
$_config['output']['tplrefresh'] = 1; // 模板自动刷新开关 0=关闭, 1=打开
|
||||
|
||||
|
||||
$_config['output']['language'] = 'zh-CN'; // 页面语言 zh-cn/zh-tw
|
||||
$_config['output']['language_list']['zh-CN']='简体中文'; // 页面语言 zh-CN/en-US
|
||||
$_config['output']['language_list']['en-US']='English'; // 页面语言 zh-CN/en-US
|
||||
|
||||
$_config['output']['staticurl'] = 'static/'; // 站点静态文件路径,“/”结尾
|
||||
$_config['output']['ajaxvalidate'] = 0; // 是否严格验证 Ajax 页面的真实性 0=关闭,1=打开
|
||||
$_config['output']['iecompatible'] = 0; // 页面 IE 兼容模式
|
||||
|
||||
// COOKIE 设置
|
||||
$_config['cookie']['cookiepre'] = 'oaooa_'; // COOKIE前缀
|
||||
$_config['cookie']['cookiedomain'] = ''; // COOKIE作用域
|
||||
$_config['cookie']['cookiepath'] = '/'; // COOKIE作用路径
|
||||
|
||||
// 站点安全设置
|
||||
$_config['security']['authkey'] = 'oaooa'; // 站点加密密钥
|
||||
$_config['security']['urlxssdefend'] = true; // 自身 URL XSS 防御
|
||||
$_config['security']['attackevasive'] = 0; // CC 攻击防御 1|2|4|8
|
||||
|
||||
$_config['security']['querysafe']['status'] = 1; // 是否开启SQL安全检测,可自动预防SQL注入攻击
|
||||
$_config['security']['querysafe']['dfunction'] = array('load_file','hex','substring','if','ord','char');
|
||||
$_config['security']['querysafe']['daction'] = array('@','intooutfile','intodumpfile','unionselect','(select', 'unionall', 'uniondistinct');
|
||||
$_config['security']['querysafe']['dnote'] = array('/*','*/','#','--','"');
|
||||
$_config['security']['querysafe']['dlikehex'] = 1;
|
||||
$_config['security']['querysafe']['afullnote'] = 0;
|
||||
|
||||
$_config['admincp']['founder'] = '1'; // 站点创始人:拥有站点管理后台的最高权限,每个站点可以设置 1名或多名创始人
|
||||
// 可以使用uid,也可以使用用户名;多个创始人之间请使用逗号“,”分开;
|
||||
$_config['admincp']['checkip'] = 1; // 后台管理操作是否验证管理员的 IP, 1=是[安全], 0=否。仅在管理员无法登录后台时设置 0。
|
||||
$_config['admincp']['runquery'] = 0; // 是否允许后台运行 SQL 语句 1=是 0=否[安全]
|
||||
$_config['admincp']['dbimport'] = 0; // 是否允许后台恢复网站数据 1=是 0=否[安全]
|
||||
$_config['userlogin']['checkip'] = 1; //用户登录错误验证ip,对于同一ip同时使用时建议设置为0,否则当有一位用户登录错误次数超过5次,该ip被锁定15分钟,导致其他的同IP用户无法登录;
|
||||
|
||||
//$_config['system_os'] = 'linux'; //windows,linux,mac,系统会自动判断
|
||||
//$_config['system_charset']='utf-8'; //操作系统编码,不设置系统将根据操作系统类型来判断linux:utf-8;windows:gbk;
|
||||
|
||||
//pichome宽高
|
||||
$_config['pichomethumbwidth']= 900;
|
||||
$_config['pichomethumbheight']= 900;
|
||||
//pichome缩略图颜色允许后缀
|
||||
$_config['getcolorextlimit'] = ['jpg','png','jpeg','gif','webp','pdf'];
|
||||
//ffmpeg位置
|
||||
$_config['pichomeffmpegposition'] = '';
|
||||
$_config['pichomeffprobposition'] = '';
|
||||
|
||||
//支持获取音视频信息的后缀
|
||||
$_config['pichomeffmpeggetvieoinoext']= [ 'avi', 'rm', 'rmvb', 'mkv', 'mov', 'wmv', 'asf', 'mpg', 'mpe', 'mpeg', 'mp4', 'm4v', 'mpeg', 'f4v', 'vob', 'ogv', 'mts', 'm2ts',
|
||||
'3gp', 'webm', 'flv', 'wav', 'mp3', 'ogg', 'midi', 'wma', 'vqf', 'ra', 'aac', 'flac', 'ape', 'amr', 'aiff', 'au', 'm4a'];
|
||||
//支持获取音视频缩略图后缀
|
||||
$_config['pichomeffmpeggetthumbext']= [ 'avi', 'rm', 'rmvb', 'mkv', 'mov', 'wmv', 'asf', 'mpg', 'mpe', 'mpeg', 'mp4', 'm4v', 'mpeg', 'f4v', 'vob', 'ogv', 'mts', 'm2ts',
|
||||
'3gp', 'webm', 'flv', 'wav', 'mp3', 'ogg', 'midi', 'wma', 'vqf', 'ra', 'aac', 'flac', 'ape', 'amr', 'aiff', 'au', 'm4a'];
|
||||
|
||||
return $_config;
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
<?php
|
||||
$_config = array();
|
||||
$_config['namespacelist'] = array(
|
||||
'root' =>DZZ_ROOT,
|
||||
'coreroot' => DZZ_ROOT.'core',
|
||||
'admin' => DZZ_ROOT.'admin',
|
||||
'core' => CORE_PATH,
|
||||
'dzz' => DZZ_ROOT.APP_DIRNAME,
|
||||
'user' => DZZ_ROOT.'user',
|
||||
'misc' => DZZ_ROOT.'misc'
|
||||
);
|
||||
|
||||
$_config['default_mod'] = 'index';
|
||||
|
||||
$_config['default_op'] = 'index';
|
||||
|
||||
$_config['default_action'] = 'index';
|
||||
|
||||
|
||||
/**
|
||||
* 其它配置
|
||||
*/
|
||||
$_config['allow_robot'] = false;
|
||||
$_config['allow_view'] = 0;//(0=>所有人,1=>用户,2=>管理员,3=>创始人)
|
||||
$_config['libfile'] = '';
|
||||
$_config['language'] = '';
|
||||
$_config['mod_view_perm'] = '';
|
||||
$_config['action_name'] = 'do';
|
||||
$_config['do_name'] = 'action';
|
||||
|
||||
$_config['profile']['privacy'] = array(
|
||||
'-1'=>'私密',
|
||||
'0'=>'公开',
|
||||
'1'=>'本部门可见',
|
||||
'2'=>'本机构可见',
|
||||
);
|
||||
<?php
|
||||
$_config = array();
|
||||
$_config['namespacelist'] = array(
|
||||
'root' =>DZZ_ROOT,
|
||||
'coreroot' => DZZ_ROOT.'core',
|
||||
'admin' => DZZ_ROOT.'admin',
|
||||
'core' => CORE_PATH,
|
||||
'dzz' => DZZ_ROOT.APP_DIRNAME,
|
||||
'user' => DZZ_ROOT.'user',
|
||||
'misc' => DZZ_ROOT.'misc'
|
||||
);
|
||||
|
||||
$_config['default_mod'] = 'index';
|
||||
|
||||
$_config['default_op'] = 'index';
|
||||
|
||||
$_config['default_action'] = 'index';
|
||||
|
||||
|
||||
/**
|
||||
* 其它配置
|
||||
*/
|
||||
$_config['allow_robot'] = false;
|
||||
$_config['allow_view'] = 0;//(0=>所有人,1=>用户,2=>管理员,3=>创始人)
|
||||
$_config['libfile'] = '';
|
||||
$_config['language'] = '';
|
||||
$_config['mod_view_perm'] = '';
|
||||
$_config['action_name'] = 'do';
|
||||
$_config['do_name'] = 'action';
|
||||
|
||||
$_config['profile']['privacy'] = array(
|
||||
'-1'=>'私密',
|
||||
'0'=>'公开',
|
||||
'1'=>'本部门可见',
|
||||
'2'=>'本机构可见',
|
||||
);
|
||||
return $_config;
|
||||
@@ -1,22 +1,22 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
require __DIR__.'/coreBase.php';
|
||||
$dzz = C::app();
|
||||
Hook::listen('dzz_initbefore');//初始化前钩子
|
||||
$dzz->init();
|
||||
|
||||
$admincp = new dzz_admincp();
|
||||
$admincp->core = $dzz;
|
||||
$admincp->init();
|
||||
Hook::listen('dzz_initafter');//初始化后钩子
|
||||
$files = Hook::listen('dzz_route',$_GET);//路由钩子,返回文件路径
|
||||
foreach($files as $v){
|
||||
require $v;//包含文件
|
||||
}
|
||||
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
require __DIR__.'/coreBase.php';
|
||||
$dzz = C::app();
|
||||
Hook::listen('dzz_initbefore');//初始化前钩子
|
||||
$dzz->init();
|
||||
|
||||
$admincp = new dzz_admincp();
|
||||
$admincp->core = $dzz;
|
||||
$admincp->init();
|
||||
Hook::listen('dzz_initafter');//初始化后钩子
|
||||
$files = Hook::listen('dzz_route',$_GET);//路由钩子,返回文件路径
|
||||
foreach($files as $v){
|
||||
require $v;//包含文件
|
||||
}
|
||||
|
||||
|
||||
152
core/class/cache/cache_file.php
vendored
152
core/class/cache/cache_file.php
vendored
@@ -1,77 +1,77 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class ultrax_cache {
|
||||
|
||||
function ultrax_cache($conf) {
|
||||
$this->conf = $conf;
|
||||
}
|
||||
|
||||
function get_cache($key) {
|
||||
if($this->cache_exists($key)) {
|
||||
$data = $this->_get_cache($key);
|
||||
return $data['data'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function set_cache($key, $value, $life) {
|
||||
global $_G;
|
||||
$data = array($key => array('data' => $value, 'life' => $life));
|
||||
require_once libfile('function/cache');
|
||||
$cache_file = $this->get_cache_file_path($key);
|
||||
dmkdir(dirname($cache_file));
|
||||
$cachedata = "\$data = ".arrayeval($data).";\n";
|
||||
if($fp = @fopen($cache_file, 'wb')) {
|
||||
fwrite($fp, "<?php\n//Dzz! cache file, DO NOT modify me!".
|
||||
"\n//Created: ".date("M j, Y, G:i").
|
||||
"\n//Identify: ".md5($cache_file.$cachedata.$_G['config']['security']['authkey'])."\n\nif(!defined('IN_OAOOA')) {\n\texit('Access Denied');\n}\n\n$cachedata?>");
|
||||
fclose($fp);
|
||||
} else {
|
||||
exit('Can not write to cache files, please check directory ./data/ and ./data/ultraxcache/ .');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function del_cache($key) {
|
||||
$cache_file = $this->get_cache_file_path($key);
|
||||
if(file_exists($cache_file)) {
|
||||
return @unlink($cache_file);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function _get_cache($key) {
|
||||
static $data = null;
|
||||
if(!isset($data[$key])) {
|
||||
include $this->get_cache_file_path($key);
|
||||
}
|
||||
return $data[$key];
|
||||
}
|
||||
|
||||
function cache_exists($key) {
|
||||
$cache_file = $this->get_cache_file_path($key);
|
||||
if(!file_exists($cache_file)) {
|
||||
return false;
|
||||
}
|
||||
$data = $this->_get_cache($key);
|
||||
if($data['life'] && (filemtime($cache_file) < time() - $data['life'])) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function get_cache_file_path($key) {
|
||||
static $cache_path = null;
|
||||
if(!isset($cache_path[$key])) {
|
||||
$dir = hexdec($key{0}.$key{1}.$key{2}) % 1000;
|
||||
$cache_path[$key] = $this->conf['path'].'/'.$dir.'/'.$key.'.php';
|
||||
}
|
||||
return $cache_path[$key];
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class ultrax_cache {
|
||||
|
||||
function ultrax_cache($conf) {
|
||||
$this->conf = $conf;
|
||||
}
|
||||
|
||||
function get_cache($key) {
|
||||
if($this->cache_exists($key)) {
|
||||
$data = $this->_get_cache($key);
|
||||
return $data['data'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function set_cache($key, $value, $life) {
|
||||
global $_G;
|
||||
$data = array($key => array('data' => $value, 'life' => $life));
|
||||
require_once libfile('function/cache');
|
||||
$cache_file = $this->get_cache_file_path($key);
|
||||
dmkdir(dirname($cache_file));
|
||||
$cachedata = "\$data = ".arrayeval($data).";\n";
|
||||
if($fp = @fopen($cache_file, 'wb')) {
|
||||
fwrite($fp, "<?php\n//Dzz! cache file, DO NOT modify me!".
|
||||
"\n//Created: ".date("M j, Y, G:i").
|
||||
"\n//Identify: ".md5($cache_file.$cachedata.$_G['config']['security']['authkey'])."\n\nif(!defined('IN_OAOOA')) {\n\texit('Access Denied');\n}\n\n$cachedata?>");
|
||||
fclose($fp);
|
||||
} else {
|
||||
exit('Can not write to cache files, please check directory ./data/ and ./data/ultraxcache/ .');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function del_cache($key) {
|
||||
$cache_file = $this->get_cache_file_path($key);
|
||||
if(file_exists($cache_file)) {
|
||||
return @unlink($cache_file);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function _get_cache($key) {
|
||||
static $data = null;
|
||||
if(!isset($data[$key])) {
|
||||
include $this->get_cache_file_path($key);
|
||||
}
|
||||
return $data[$key];
|
||||
}
|
||||
|
||||
function cache_exists($key) {
|
||||
$cache_file = $this->get_cache_file_path($key);
|
||||
if(!file_exists($cache_file)) {
|
||||
return false;
|
||||
}
|
||||
$data = $this->_get_cache($key);
|
||||
if($data['life'] && (filemtime($cache_file) < time() - $data['life'])) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function get_cache_file_path($key) {
|
||||
static $cache_path = null;
|
||||
if(!isset($cache_path[$key])) {
|
||||
$dir = hexdec($key{0}.$key{1}.$key{2}) % 1000;
|
||||
$cache_path[$key] = $this->conf['path'].'/'.$dir.'/'.$key.'.php';
|
||||
}
|
||||
return $cache_path[$key];
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
80
core/class/cache/cache_sql.php
vendored
80
core/class/cache/cache_sql.php
vendored
@@ -1,41 +1,41 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class ultrax_cache {
|
||||
|
||||
function ultrax_cache($conf) {
|
||||
$this->conf = $conf;
|
||||
}
|
||||
|
||||
function get_cache($key) {
|
||||
static $data = null;
|
||||
if(!isset($data[$key])) {
|
||||
$cache = C::t('cache')->fetch($key);
|
||||
if(!$cache) {
|
||||
return false;
|
||||
}
|
||||
$data[$key] = unserialize($cache['cachevalue']);
|
||||
if($cache['life'] && ($cache['dateline'] < time() - $data[$key]['life'])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $data[$key]['data'];
|
||||
}
|
||||
|
||||
function set_cache($key, $value, $life) {
|
||||
$data = array(
|
||||
'cachekey' => $key,
|
||||
'cachevalue' => serialize(array('data' => $value, 'life' => $life)),
|
||||
'dateline' => time(),
|
||||
);
|
||||
return C::t('cache')->insert($data);
|
||||
}
|
||||
|
||||
function del_cache($key) {
|
||||
return C::t('cache')->delete($key);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class ultrax_cache {
|
||||
|
||||
function ultrax_cache($conf) {
|
||||
$this->conf = $conf;
|
||||
}
|
||||
|
||||
function get_cache($key) {
|
||||
static $data = null;
|
||||
if(!isset($data[$key])) {
|
||||
$cache = C::t('cache')->fetch($key);
|
||||
if(!$cache) {
|
||||
return false;
|
||||
}
|
||||
$data[$key] = unserialize($cache['cachevalue']);
|
||||
if($cache['life'] && ($cache['dateline'] < time() - $data[$key]['life'])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $data[$key]['data'];
|
||||
}
|
||||
|
||||
function set_cache($key, $value, $life) {
|
||||
$data = array(
|
||||
'cachekey' => $key,
|
||||
'cachevalue' => serialize(array('data' => $value, 'life' => $life)),
|
||||
'dateline' => time(),
|
||||
);
|
||||
return C::t('cache')->insert($data);
|
||||
}
|
||||
|
||||
function del_cache($key) {
|
||||
return C::t('cache')->delete($key);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class CException extends Exception{
|
||||
|
||||
}
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class CException extends Exception{
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,239 +1,239 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
define('CODETABLE_DIR', DZZ_ROOT.'./core/class/chinesetable/');
|
||||
|
||||
class Chinese {
|
||||
|
||||
var $table = '';
|
||||
var $iconv_enabled = false;
|
||||
var $convertbig5 = false;
|
||||
var $unicode_table = array();
|
||||
var $config = array (
|
||||
'SourceLang' => '',
|
||||
'TargetLang' => '',
|
||||
'GBtoUnicode_table' => 'gb-unicode.table',
|
||||
'BIG5toUnicode_table' => 'big5-unicode.table',
|
||||
'GBtoBIG5_table' => 'gb-big5.table',
|
||||
);
|
||||
|
||||
function Chinese($SourceLang, $TargetLang, $ForceTable = FALSE) {
|
||||
$this->config['SourceLang'] = $this->_lang($SourceLang);
|
||||
$this->config['TargetLang'] = $this->_lang($TargetLang);
|
||||
|
||||
if(ICONV_ENABLE && $this->config['TargetLang'] != 'BIG5' && !$ForceTable) {
|
||||
$this->iconv_enabled = true;
|
||||
} else {
|
||||
$this->iconv_enabled = false;
|
||||
$this->OpenTable();
|
||||
}
|
||||
}
|
||||
|
||||
function _lang($LangCode) {
|
||||
$LangCode = strtoupper($LangCode);
|
||||
|
||||
if(substr($LangCode, 0, 2) == 'GB') {
|
||||
return 'GBK';
|
||||
} elseif(substr($LangCode, 0, 3) == 'BIG') {
|
||||
return 'BIG5';
|
||||
} elseif(substr($LangCode, 0, 3) == 'UTF') {
|
||||
return 'UTF-8';
|
||||
} elseif(substr($LangCode, 0, 3) == 'UNI') {
|
||||
return 'UNICODE';
|
||||
}
|
||||
}
|
||||
|
||||
function _hex2bin($hexdata) {
|
||||
for($i=0; $i < strlen($hexdata); $i += 2) {
|
||||
$bindata .= chr(hexdec(substr($hexdata, $i, 2)));
|
||||
}
|
||||
return $bindata;
|
||||
}
|
||||
|
||||
function OpenTable() {
|
||||
$this->unicode_table = array();
|
||||
if(!$this->iconv_enabled && $this->config['TargetLang'] == 'BIG5') {
|
||||
$this->config['TargetLang'] = 'GBK';
|
||||
$this->convertbig5 = TRUE;
|
||||
}
|
||||
if($this->config['SourceLang'] == 'GBK' || $this->config['TargetLang'] == 'GBK') {
|
||||
$this->table = CODETABLE_DIR.$this->config['GBtoUnicode_table'];
|
||||
} elseif($this->config['SourceLang'] == 'BIG5' || $this->config['TargetLang'] == 'BIG5') {
|
||||
$this->table = CODETABLE_DIR.$this->config['BIG5toUnicode_table'];
|
||||
}
|
||||
$fp = fopen($this->table, 'rb');
|
||||
$tabletmp = fread($fp, filesize($this->table));
|
||||
for($i = 0; $i < strlen($tabletmp); $i += 4) {
|
||||
$tmp = unpack('nkey/nvalue', substr($tabletmp, $i, 4));
|
||||
if($this->config['TargetLang'] == 'UTF-8') {
|
||||
$this->unicode_table[$tmp['key']] = '0x'.dechex($tmp['value']);
|
||||
} elseif($this->config['SourceLang'] == 'UTF-8') {
|
||||
$this->unicode_table[$tmp['value']] = '0x'.dechex($tmp['key']);
|
||||
} elseif($this->config['TargetLang'] == 'UNICODE') {
|
||||
$this->unicode_table[$tmp['key']] = dechex($tmp['value']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CHSUtoUTF8($c) {
|
||||
$str = '';
|
||||
if($c < 0x80) {
|
||||
$str .= $c;
|
||||
} elseif($c < 0x800) {
|
||||
$str .= (0xC0 | $c >> 6);
|
||||
$str .= (0x80 | $c & 0x3F);
|
||||
} elseif($c < 0x10000) {
|
||||
$str .= (0xE0 | $c >> 12);
|
||||
$str .= (0x80 | $c >> 6 & 0x3F);
|
||||
$str .=( 0x80 | $c & 0x3F);
|
||||
} elseif($c < 0x200000) {
|
||||
$str .= (0xF0 | $c >> 18);
|
||||
$str .= (0x80 | $c >> 12 & 0x3F);
|
||||
$str .= (0x80 | $c >> 6 & 0x3F);
|
||||
$str .= (0x80 | $c & 0x3F);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
function GB2312toBIG5($c) {
|
||||
$f = fopen(CODETABLE_DIR.$this->config['GBtoBIG5_table'], 'r');
|
||||
$max=strlen($c)-1;
|
||||
for($i = 0;$i < $max;$i++){
|
||||
$h=ord($c[$i]);
|
||||
if($h>=160) {
|
||||
$l=ord($c[$i+1]);
|
||||
if($h==161 && $l==64){
|
||||
$gb=" ";
|
||||
} else{
|
||||
fseek($f,($h-160)*510+($l-1)*2);
|
||||
$gb=fread($f,2);
|
||||
}
|
||||
$c[$i]=$gb[0];
|
||||
$c[$i+1]=$gb[1];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$result = $c;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function Convert($SourceText) {
|
||||
if($this->config['SourceLang'] == $this->config['TargetLang']) {
|
||||
return $SourceText;
|
||||
} elseif($this->iconv_enabled) {
|
||||
if($this->config['TargetLang'] <> 'UNICODE') {
|
||||
return iconv($this->config['SourceLang'], $this->config['TargetLang'], $SourceText);
|
||||
} else {
|
||||
$return = '';
|
||||
while($SourceText != '') {
|
||||
if(ord(substr($SourceText, 0, 1)) > 127) {
|
||||
$return .= "&#x".dechex($this->Utf8_Unicode(iconv($this->config['SourceLang'],"UTF-8", substr($SourceText, 0, 2)))).";";
|
||||
$SourceText = substr($SourceText, 2, strlen($SourceText));
|
||||
} else {
|
||||
$return .= substr($SourceText, 0, 1);
|
||||
$SourceText = substr($SourceText, 1, strlen($SourceText));
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
} elseif($this->config['TargetLang'] == 'UNICODE') {
|
||||
$utf = '';
|
||||
while($SourceText != '') {
|
||||
if(ord(substr($SourceText, 0, 1)) > 127) {
|
||||
if($this->config['SourceLang'] == 'GBK') {
|
||||
$utf .= '&#x'.$this->unicode_table[hexdec(bin2hex(substr($SourceText, 0, 2))) - 0x8080].';';
|
||||
} elseif($this->config['SourceLang'] == 'BIG5') {
|
||||
$utf .= '&#x'.$this->unicode_table[hexdec(bin2hex(substr($SourceText, 0, 2)))].';';
|
||||
}
|
||||
$SourceText = substr($SourceText, 2, strlen($SourceText));
|
||||
} else {
|
||||
$utf .= substr($SourceText, 0, 1);
|
||||
$SourceText = substr($SourceText, 1, strlen($SourceText));
|
||||
}
|
||||
}
|
||||
return $utf;
|
||||
} else {
|
||||
$ret = '';
|
||||
if($this->config['SourceLang'] == 'UTF-8') {
|
||||
$out = '';
|
||||
$len = strlen($SourceText);
|
||||
$i = 0;
|
||||
while($i < $len) {
|
||||
$c = ord(substr($SourceText, $i++, 1));
|
||||
switch($c >> 4) {
|
||||
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
|
||||
$out .= substr($SourceText, $i - 1, 1);
|
||||
break;
|
||||
case 12: case 13:
|
||||
$char2 = ord(substr($SourceText, $i++, 1));
|
||||
$char3 = $this->unicode_table[(($c & 0x1F) << 6) | ($char2 & 0x3F)];
|
||||
if($this->config['TargetLang'] == 'GBK') {
|
||||
$out .= $this->_hex2bin(dechex($char3 + 0x8080));
|
||||
} elseif($this->config['TargetLang'] == 'BIG5') {
|
||||
$out .= $this->_hex2bin($char3);
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
$char2 = ord(substr($SourceText, $i++, 1));
|
||||
$char3 = ord(substr($SourceText, $i++, 1));
|
||||
$char4 = $this->unicode_table[(($c & 0x0F) << 12) | (($char2 & 0x3F) << 6) | (($char3 & 0x3F) << 0)];
|
||||
if($this->config['TargetLang'] == 'GBK') {
|
||||
$out .= $this->_hex2bin(dechex($char4 + 0x8080));
|
||||
} elseif($this->config['TargetLang'] == 'BIG5') {
|
||||
$out .= $this->_hex2bin($char4);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return !$this->convertbig5 ? $out : $this->GB2312toBIG5($out);
|
||||
} else {
|
||||
while($SourceText != '') {
|
||||
if(ord(substr($SourceText, 0, 1)) > 127) {
|
||||
if($this->config['SourceLang'] == 'BIG5') {
|
||||
$utf8 = $this->CHSUtoUTF8(hexdec($this->unicode_table[hexdec(bin2hex(substr($SourceText, 0, 2)))]));
|
||||
} elseif($this->config['SourceLang'] == 'GBK') {
|
||||
$utf8=$this->CHSUtoUTF8(hexdec($this->unicode_table[hexdec(bin2hex(substr($SourceText, 0, 2))) - 0x8080]));
|
||||
}
|
||||
for($i = 0; $i < strlen($utf8); $i += 3) {
|
||||
$ret .= chr(substr($utf8, $i, 3));
|
||||
}
|
||||
$SourceText = substr($SourceText, 2, strlen($SourceText));
|
||||
} else {
|
||||
$ret .= substr($SourceText, 0, 1);
|
||||
$SourceText = substr($SourceText, 1, strlen($SourceText));
|
||||
}
|
||||
}
|
||||
$SourceText = '';
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Utf8_Unicode($char) {
|
||||
switch(strlen($char)) {
|
||||
case 1:
|
||||
return ord($char);
|
||||
case 2:
|
||||
$n = (ord($char[0]) & 0x3f) << 6;
|
||||
$n += ord($char[1]) & 0x3f;
|
||||
return $n;
|
||||
case 3:
|
||||
$n = (ord($char[0]) & 0x1f) << 12;
|
||||
$n += (ord($char[1]) & 0x3f) << 6;
|
||||
$n += ord($char[2]) & 0x3f;
|
||||
return $n;
|
||||
case 4:
|
||||
$n = (ord($char[0]) & 0x0f) << 18;
|
||||
$n += (ord($char[1]) & 0x3f) << 12;
|
||||
$n += (ord($char[2]) & 0x3f) << 6;
|
||||
$n += ord($char[3]) & 0x3f;
|
||||
return $n;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
define('CODETABLE_DIR', DZZ_ROOT.'./core/class/chinesetable/');
|
||||
|
||||
class Chinese {
|
||||
|
||||
var $table = '';
|
||||
var $iconv_enabled = false;
|
||||
var $convertbig5 = false;
|
||||
var $unicode_table = array();
|
||||
var $config = array (
|
||||
'SourceLang' => '',
|
||||
'TargetLang' => '',
|
||||
'GBtoUnicode_table' => 'gb-unicode.table',
|
||||
'BIG5toUnicode_table' => 'big5-unicode.table',
|
||||
'GBtoBIG5_table' => 'gb-big5.table',
|
||||
);
|
||||
|
||||
function Chinese($SourceLang, $TargetLang, $ForceTable = FALSE) {
|
||||
$this->config['SourceLang'] = $this->_lang($SourceLang);
|
||||
$this->config['TargetLang'] = $this->_lang($TargetLang);
|
||||
|
||||
if(ICONV_ENABLE && $this->config['TargetLang'] != 'BIG5' && !$ForceTable) {
|
||||
$this->iconv_enabled = true;
|
||||
} else {
|
||||
$this->iconv_enabled = false;
|
||||
$this->OpenTable();
|
||||
}
|
||||
}
|
||||
|
||||
function _lang($LangCode) {
|
||||
$LangCode = strtoupper($LangCode);
|
||||
|
||||
if(substr($LangCode, 0, 2) == 'GB') {
|
||||
return 'GBK';
|
||||
} elseif(substr($LangCode, 0, 3) == 'BIG') {
|
||||
return 'BIG5';
|
||||
} elseif(substr($LangCode, 0, 3) == 'UTF') {
|
||||
return 'UTF-8';
|
||||
} elseif(substr($LangCode, 0, 3) == 'UNI') {
|
||||
return 'UNICODE';
|
||||
}
|
||||
}
|
||||
|
||||
function _hex2bin($hexdata) {
|
||||
for($i=0; $i < strlen($hexdata); $i += 2) {
|
||||
$bindata .= chr(hexdec(substr($hexdata, $i, 2)));
|
||||
}
|
||||
return $bindata;
|
||||
}
|
||||
|
||||
function OpenTable() {
|
||||
$this->unicode_table = array();
|
||||
if(!$this->iconv_enabled && $this->config['TargetLang'] == 'BIG5') {
|
||||
$this->config['TargetLang'] = 'GBK';
|
||||
$this->convertbig5 = TRUE;
|
||||
}
|
||||
if($this->config['SourceLang'] == 'GBK' || $this->config['TargetLang'] == 'GBK') {
|
||||
$this->table = CODETABLE_DIR.$this->config['GBtoUnicode_table'];
|
||||
} elseif($this->config['SourceLang'] == 'BIG5' || $this->config['TargetLang'] == 'BIG5') {
|
||||
$this->table = CODETABLE_DIR.$this->config['BIG5toUnicode_table'];
|
||||
}
|
||||
$fp = fopen($this->table, 'rb');
|
||||
$tabletmp = fread($fp, filesize($this->table));
|
||||
for($i = 0; $i < strlen($tabletmp); $i += 4) {
|
||||
$tmp = unpack('nkey/nvalue', substr($tabletmp, $i, 4));
|
||||
if($this->config['TargetLang'] == 'UTF-8') {
|
||||
$this->unicode_table[$tmp['key']] = '0x'.dechex($tmp['value']);
|
||||
} elseif($this->config['SourceLang'] == 'UTF-8') {
|
||||
$this->unicode_table[$tmp['value']] = '0x'.dechex($tmp['key']);
|
||||
} elseif($this->config['TargetLang'] == 'UNICODE') {
|
||||
$this->unicode_table[$tmp['key']] = dechex($tmp['value']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CHSUtoUTF8($c) {
|
||||
$str = '';
|
||||
if($c < 0x80) {
|
||||
$str .= $c;
|
||||
} elseif($c < 0x800) {
|
||||
$str .= (0xC0 | $c >> 6);
|
||||
$str .= (0x80 | $c & 0x3F);
|
||||
} elseif($c < 0x10000) {
|
||||
$str .= (0xE0 | $c >> 12);
|
||||
$str .= (0x80 | $c >> 6 & 0x3F);
|
||||
$str .=( 0x80 | $c & 0x3F);
|
||||
} elseif($c < 0x200000) {
|
||||
$str .= (0xF0 | $c >> 18);
|
||||
$str .= (0x80 | $c >> 12 & 0x3F);
|
||||
$str .= (0x80 | $c >> 6 & 0x3F);
|
||||
$str .= (0x80 | $c & 0x3F);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
function GB2312toBIG5($c) {
|
||||
$f = fopen(CODETABLE_DIR.$this->config['GBtoBIG5_table'], 'r');
|
||||
$max=strlen($c)-1;
|
||||
for($i = 0;$i < $max;$i++){
|
||||
$h=ord($c[$i]);
|
||||
if($h>=160) {
|
||||
$l=ord($c[$i+1]);
|
||||
if($h==161 && $l==64){
|
||||
$gb=" ";
|
||||
} else{
|
||||
fseek($f,($h-160)*510+($l-1)*2);
|
||||
$gb=fread($f,2);
|
||||
}
|
||||
$c[$i]=$gb[0];
|
||||
$c[$i+1]=$gb[1];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$result = $c;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function Convert($SourceText) {
|
||||
if($this->config['SourceLang'] == $this->config['TargetLang']) {
|
||||
return $SourceText;
|
||||
} elseif($this->iconv_enabled) {
|
||||
if($this->config['TargetLang'] <> 'UNICODE') {
|
||||
return iconv($this->config['SourceLang'], $this->config['TargetLang'], $SourceText);
|
||||
} else {
|
||||
$return = '';
|
||||
while($SourceText != '') {
|
||||
if(ord(substr($SourceText, 0, 1)) > 127) {
|
||||
$return .= "&#x".dechex($this->Utf8_Unicode(iconv($this->config['SourceLang'],"UTF-8", substr($SourceText, 0, 2)))).";";
|
||||
$SourceText = substr($SourceText, 2, strlen($SourceText));
|
||||
} else {
|
||||
$return .= substr($SourceText, 0, 1);
|
||||
$SourceText = substr($SourceText, 1, strlen($SourceText));
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
} elseif($this->config['TargetLang'] == 'UNICODE') {
|
||||
$utf = '';
|
||||
while($SourceText != '') {
|
||||
if(ord(substr($SourceText, 0, 1)) > 127) {
|
||||
if($this->config['SourceLang'] == 'GBK') {
|
||||
$utf .= '&#x'.$this->unicode_table[hexdec(bin2hex(substr($SourceText, 0, 2))) - 0x8080].';';
|
||||
} elseif($this->config['SourceLang'] == 'BIG5') {
|
||||
$utf .= '&#x'.$this->unicode_table[hexdec(bin2hex(substr($SourceText, 0, 2)))].';';
|
||||
}
|
||||
$SourceText = substr($SourceText, 2, strlen($SourceText));
|
||||
} else {
|
||||
$utf .= substr($SourceText, 0, 1);
|
||||
$SourceText = substr($SourceText, 1, strlen($SourceText));
|
||||
}
|
||||
}
|
||||
return $utf;
|
||||
} else {
|
||||
$ret = '';
|
||||
if($this->config['SourceLang'] == 'UTF-8') {
|
||||
$out = '';
|
||||
$len = strlen($SourceText);
|
||||
$i = 0;
|
||||
while($i < $len) {
|
||||
$c = ord(substr($SourceText, $i++, 1));
|
||||
switch($c >> 4) {
|
||||
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
|
||||
$out .= substr($SourceText, $i - 1, 1);
|
||||
break;
|
||||
case 12: case 13:
|
||||
$char2 = ord(substr($SourceText, $i++, 1));
|
||||
$char3 = $this->unicode_table[(($c & 0x1F) << 6) | ($char2 & 0x3F)];
|
||||
if($this->config['TargetLang'] == 'GBK') {
|
||||
$out .= $this->_hex2bin(dechex($char3 + 0x8080));
|
||||
} elseif($this->config['TargetLang'] == 'BIG5') {
|
||||
$out .= $this->_hex2bin($char3);
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
$char2 = ord(substr($SourceText, $i++, 1));
|
||||
$char3 = ord(substr($SourceText, $i++, 1));
|
||||
$char4 = $this->unicode_table[(($c & 0x0F) << 12) | (($char2 & 0x3F) << 6) | (($char3 & 0x3F) << 0)];
|
||||
if($this->config['TargetLang'] == 'GBK') {
|
||||
$out .= $this->_hex2bin(dechex($char4 + 0x8080));
|
||||
} elseif($this->config['TargetLang'] == 'BIG5') {
|
||||
$out .= $this->_hex2bin($char4);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return !$this->convertbig5 ? $out : $this->GB2312toBIG5($out);
|
||||
} else {
|
||||
while($SourceText != '') {
|
||||
if(ord(substr($SourceText, 0, 1)) > 127) {
|
||||
if($this->config['SourceLang'] == 'BIG5') {
|
||||
$utf8 = $this->CHSUtoUTF8(hexdec($this->unicode_table[hexdec(bin2hex(substr($SourceText, 0, 2)))]));
|
||||
} elseif($this->config['SourceLang'] == 'GBK') {
|
||||
$utf8=$this->CHSUtoUTF8(hexdec($this->unicode_table[hexdec(bin2hex(substr($SourceText, 0, 2))) - 0x8080]));
|
||||
}
|
||||
for($i = 0; $i < strlen($utf8); $i += 3) {
|
||||
$ret .= chr(substr($utf8, $i, 3));
|
||||
}
|
||||
$SourceText = substr($SourceText, 2, strlen($SourceText));
|
||||
} else {
|
||||
$ret .= substr($SourceText, 0, 1);
|
||||
$SourceText = substr($SourceText, 1, strlen($SourceText));
|
||||
}
|
||||
}
|
||||
$SourceText = '';
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Utf8_Unicode($char) {
|
||||
switch(strlen($char)) {
|
||||
case 1:
|
||||
return ord($char);
|
||||
case 2:
|
||||
$n = (ord($char[0]) & 0x3f) << 6;
|
||||
$n += ord($char[1]) & 0x3f;
|
||||
return $n;
|
||||
case 3:
|
||||
$n = (ord($char[0]) & 0x1f) << 12;
|
||||
$n += (ord($char[1]) & 0x3f) << 6;
|
||||
$n += ord($char[2]) & 0x3f;
|
||||
return $n;
|
||||
case 4:
|
||||
$n = (ord($char[0]) & 0x0f) << 18;
|
||||
$n += (ord($char[1]) & 0x3f) << 12;
|
||||
$n += (ord($char[2]) & 0x3f) << 6;
|
||||
$n += ord($char[3]) & 0x3f;
|
||||
return $n;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,262 +1,262 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the ImagePalette package.
|
||||
*
|
||||
* (c) Brian McDonald <brian@brianmcdonald.io>
|
||||
* (c) gandalfx - https://github.com/gandalfx
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Represents an argb color
|
||||
*
|
||||
* @author Gandalfx
|
||||
* @package BrianMcdo\ImagePalette
|
||||
*
|
||||
*/
|
||||
class Color {
|
||||
|
||||
/**
|
||||
* Red value
|
||||
* @var int
|
||||
*/
|
||||
public $r;
|
||||
|
||||
/**
|
||||
* Green value
|
||||
* @var int
|
||||
*/
|
||||
public $g;
|
||||
|
||||
/**
|
||||
* Blue value
|
||||
* @var int
|
||||
*/
|
||||
public $b;
|
||||
|
||||
/**
|
||||
* Alpha value
|
||||
* @var int
|
||||
*/
|
||||
public $a;
|
||||
|
||||
|
||||
/**
|
||||
* Construct new Color
|
||||
*
|
||||
* @param int|array $color
|
||||
* @param bool $short
|
||||
*/
|
||||
//颜色16进制转RGB
|
||||
static function hex2rgb($color){
|
||||
if ( $color[0] == '#' ) {
|
||||
$color = substr( $color, 1 );
|
||||
}
|
||||
|
||||
if ( strlen( $color ) == 6 ) {
|
||||
list( $r, $g, $b ) = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
|
||||
} elseif ( strlen( $color ) == 3 ) {
|
||||
list( $r, $g, $b ) = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$r = hexdec( $r );
|
||||
$g = hexdec( $g );
|
||||
$b = hexdec( $b );
|
||||
$a = hexdec( $b );
|
||||
return array( $r, $g, $b );
|
||||
}
|
||||
public function __construct($color = 0x000000, $short = false)
|
||||
{
|
||||
if (is_numeric($color)) {
|
||||
|
||||
if ($short) {
|
||||
$this->r = (($color >> 8) & 0xf) * 0x11;
|
||||
$this->g = (($color >> 4) & 0xf) * 0x11;
|
||||
$this->b = ($color & 0xf) * 0x11;
|
||||
$this->a = (($color >> 12) & 0xf) * 0x11;
|
||||
} else {
|
||||
$this->r = ($color >> 16) & 0xff;
|
||||
$this->g = ($color >> 8) & 0xff;
|
||||
$this->b = $color & 0xff;
|
||||
$this->a = ($color >> 24) & 0xff;
|
||||
}
|
||||
|
||||
} elseif (is_array($color)) {
|
||||
|
||||
list($this->r, $this->g, $this->b) = $color;
|
||||
|
||||
if (count($color) > 3)
|
||||
$this->a = $color[3];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Some useful magic getters
|
||||
*
|
||||
* @param string $property
|
||||
* @throws \Exception
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($property)
|
||||
{
|
||||
$method = 'to' . ucfirst($property);
|
||||
if (method_exists($this, $method))
|
||||
return $this->$method();
|
||||
|
||||
switch ($property) {
|
||||
case 'red': case 'getRed':
|
||||
return $this->r;
|
||||
case 'green': case 'getGreen':
|
||||
return $this->g;
|
||||
case 'blue': case 'getBlue':
|
||||
return $this->b;
|
||||
case 'alpha': case 'getAlpha':
|
||||
return $this->a;
|
||||
}
|
||||
|
||||
throw new \Exception("Property $property does not exist");
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method, alias for toHexString
|
||||
*
|
||||
* @see toHexString()
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toHexString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the difference between this color
|
||||
* and the provided color
|
||||
* using simple pythagoras *without* sqrt
|
||||
*
|
||||
* @param int|Color
|
||||
* @return int
|
||||
*/
|
||||
public function getDiff($color)
|
||||
{
|
||||
if (!$color instanceof Color) {
|
||||
$color = new Color($color);
|
||||
}
|
||||
return pow($this->r - $color->r, 2)
|
||||
+ pow($this->g - $color->g, 2)
|
||||
+ pow($this->b - $color->b, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not this color has an alpha value > 0
|
||||
*
|
||||
* @see isTransparent for full transparency
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasAlpha()
|
||||
{
|
||||
return (boolean) $this->a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Transparency using GD
|
||||
* Returns true if the provided color has zero opacity
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isTransparent()
|
||||
{
|
||||
return $this->a === 127;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing int values for
|
||||
* red, green, blue and alpha
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return array($this->r, $this->g, $this->b, $this->a);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing int values for
|
||||
* red, green and blue
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toRgb()
|
||||
{
|
||||
return array($this->r, $this->g, $this->b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing int values for
|
||||
* red, green and blue and a double for alpha
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toRgba()
|
||||
{
|
||||
return array($this->r, $this->g, $this->b, 1 - $this->a / 0x100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an int representing the color
|
||||
* defined by the red, green and blue values
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function toInt()
|
||||
{
|
||||
return ($this->r << 16) | ($this->g << 8) | $this->b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render 6-digit hexadecimal string representation
|
||||
* like '#abcdef'
|
||||
*
|
||||
* @param string $prefix defaults to '#'
|
||||
* @return string
|
||||
*/
|
||||
public function toHexString($prefix = '#')
|
||||
{
|
||||
return $prefix . str_pad(dechex($this->toInt()), 6, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render 3-integer decimal string representation
|
||||
* like 'rgb(123,0,20)'
|
||||
*
|
||||
* @param string $prefix defaults to 'rgb'
|
||||
* @return string
|
||||
*/
|
||||
public function toRgbString($prefix = 'rgb')
|
||||
{
|
||||
return $prefix . '('
|
||||
. $this->r . ','
|
||||
. $this->g . ','
|
||||
. $this->b . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render 3-integer decimal string representation
|
||||
* like 'rgba(123,0,20,0.5)'
|
||||
*
|
||||
* @param string $prefix defaults to 'argb'
|
||||
* @param int $alphaPrecision max alpha digits, default 2
|
||||
* @return string
|
||||
*/
|
||||
public function toRgbaString($prefix = 'rgba', $alphaPrecision = 2)
|
||||
{
|
||||
return $prefix . '('
|
||||
. $this->r . ','
|
||||
. $this->g . ','
|
||||
. $this->b . ','
|
||||
. round(1 - $this->a / 0x100, $alphaPrecision) . ')';
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the ImagePalette package.
|
||||
*
|
||||
* (c) Brian McDonald <brian@brianmcdonald.io>
|
||||
* (c) gandalfx - https://github.com/gandalfx
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Represents an argb color
|
||||
*
|
||||
* @author Gandalfx
|
||||
* @package BrianMcdo\ImagePalette
|
||||
*
|
||||
*/
|
||||
class Color {
|
||||
|
||||
/**
|
||||
* Red value
|
||||
* @var int
|
||||
*/
|
||||
public $r;
|
||||
|
||||
/**
|
||||
* Green value
|
||||
* @var int
|
||||
*/
|
||||
public $g;
|
||||
|
||||
/**
|
||||
* Blue value
|
||||
* @var int
|
||||
*/
|
||||
public $b;
|
||||
|
||||
/**
|
||||
* Alpha value
|
||||
* @var int
|
||||
*/
|
||||
public $a;
|
||||
|
||||
|
||||
/**
|
||||
* Construct new Color
|
||||
*
|
||||
* @param int|array $color
|
||||
* @param bool $short
|
||||
*/
|
||||
//颜色16进制转RGB
|
||||
static function hex2rgb($color){
|
||||
if ( $color[0] == '#' ) {
|
||||
$color = substr( $color, 1 );
|
||||
}
|
||||
|
||||
if ( strlen( $color ) == 6 ) {
|
||||
list( $r, $g, $b ) = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
|
||||
} elseif ( strlen( $color ) == 3 ) {
|
||||
list( $r, $g, $b ) = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$r = hexdec( $r );
|
||||
$g = hexdec( $g );
|
||||
$b = hexdec( $b );
|
||||
$a = hexdec( $b );
|
||||
return array( $r, $g, $b );
|
||||
}
|
||||
public function __construct($color = 0x000000, $short = false)
|
||||
{
|
||||
if (is_numeric($color)) {
|
||||
|
||||
if ($short) {
|
||||
$this->r = (($color >> 8) & 0xf) * 0x11;
|
||||
$this->g = (($color >> 4) & 0xf) * 0x11;
|
||||
$this->b = ($color & 0xf) * 0x11;
|
||||
$this->a = (($color >> 12) & 0xf) * 0x11;
|
||||
} else {
|
||||
$this->r = ($color >> 16) & 0xff;
|
||||
$this->g = ($color >> 8) & 0xff;
|
||||
$this->b = $color & 0xff;
|
||||
$this->a = ($color >> 24) & 0xff;
|
||||
}
|
||||
|
||||
} elseif (is_array($color)) {
|
||||
|
||||
list($this->r, $this->g, $this->b) = $color;
|
||||
|
||||
if (count($color) > 3)
|
||||
$this->a = $color[3];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Some useful magic getters
|
||||
*
|
||||
* @param string $property
|
||||
* @throws \Exception
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($property)
|
||||
{
|
||||
$method = 'to' . ucfirst($property);
|
||||
if (method_exists($this, $method))
|
||||
return $this->$method();
|
||||
|
||||
switch ($property) {
|
||||
case 'red': case 'getRed':
|
||||
return $this->r;
|
||||
case 'green': case 'getGreen':
|
||||
return $this->g;
|
||||
case 'blue': case 'getBlue':
|
||||
return $this->b;
|
||||
case 'alpha': case 'getAlpha':
|
||||
return $this->a;
|
||||
}
|
||||
|
||||
throw new \Exception("Property $property does not exist");
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method, alias for toHexString
|
||||
*
|
||||
* @see toHexString()
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toHexString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the difference between this color
|
||||
* and the provided color
|
||||
* using simple pythagoras *without* sqrt
|
||||
*
|
||||
* @param int|Color
|
||||
* @return int
|
||||
*/
|
||||
public function getDiff($color)
|
||||
{
|
||||
if (!$color instanceof Color) {
|
||||
$color = new Color($color);
|
||||
}
|
||||
return pow($this->r - $color->r, 2)
|
||||
+ pow($this->g - $color->g, 2)
|
||||
+ pow($this->b - $color->b, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not this color has an alpha value > 0
|
||||
*
|
||||
* @see isTransparent for full transparency
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasAlpha()
|
||||
{
|
||||
return (boolean) $this->a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Transparency using GD
|
||||
* Returns true if the provided color has zero opacity
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isTransparent()
|
||||
{
|
||||
return $this->a === 127;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing int values for
|
||||
* red, green, blue and alpha
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return array($this->r, $this->g, $this->b, $this->a);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing int values for
|
||||
* red, green and blue
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toRgb()
|
||||
{
|
||||
return array($this->r, $this->g, $this->b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing int values for
|
||||
* red, green and blue and a double for alpha
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toRgba()
|
||||
{
|
||||
return array($this->r, $this->g, $this->b, 1 - $this->a / 0x100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an int representing the color
|
||||
* defined by the red, green and blue values
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function toInt()
|
||||
{
|
||||
return ($this->r << 16) | ($this->g << 8) | $this->b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render 6-digit hexadecimal string representation
|
||||
* like '#abcdef'
|
||||
*
|
||||
* @param string $prefix defaults to '#'
|
||||
* @return string
|
||||
*/
|
||||
public function toHexString($prefix = '#')
|
||||
{
|
||||
return $prefix . str_pad(dechex($this->toInt()), 6, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render 3-integer decimal string representation
|
||||
* like 'rgb(123,0,20)'
|
||||
*
|
||||
* @param string $prefix defaults to 'rgb'
|
||||
* @return string
|
||||
*/
|
||||
public function toRgbString($prefix = 'rgb')
|
||||
{
|
||||
return $prefix . '('
|
||||
. $this->r . ','
|
||||
. $this->g . ','
|
||||
. $this->b . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render 3-integer decimal string representation
|
||||
* like 'rgba(123,0,20,0.5)'
|
||||
*
|
||||
* @param string $prefix defaults to 'argb'
|
||||
* @param int $alphaPrecision max alpha digits, default 2
|
||||
* @return string
|
||||
*/
|
||||
public function toRgbaString($prefix = 'rgba', $alphaPrecision = 2)
|
||||
{
|
||||
return $prefix . '('
|
||||
. $this->r . ','
|
||||
. $this->g . ','
|
||||
. $this->b . ','
|
||||
. round(1 - $this->a / 0x100, $alphaPrecision) . ')';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class DbException extends Exception{
|
||||
|
||||
public $sql;
|
||||
|
||||
public function __construct($message, $code = 0, $sql = '') {
|
||||
$this->sql = $sql;
|
||||
parent::__construct($message, $code);
|
||||
}
|
||||
|
||||
public function getSql() {
|
||||
return $this->sql;
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class DbException extends Exception{
|
||||
|
||||
public $sql;
|
||||
|
||||
public function __construct($message, $code = 0, $sql = '') {
|
||||
$this->sql = $sql;
|
||||
parent::__construct($message, $code);
|
||||
}
|
||||
|
||||
public function getSql() {
|
||||
return $this->sql;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,198 +1,198 @@
|
||||
<?php
|
||||
class Des
|
||||
{
|
||||
/**
|
||||
* 加密方法
|
||||
*
|
||||
* @param string $str 需要加密的内容
|
||||
* @param string $key 密钥
|
||||
* @param bool $toBase64 是否base64
|
||||
* return string
|
||||
*/
|
||||
public function encrypt($str, $key, $toBase64=true)
|
||||
{
|
||||
if ($str == "") {
|
||||
return "";
|
||||
}
|
||||
if ($toBase64) {
|
||||
return base64_encode(self::_des($key,$str,1));
|
||||
}
|
||||
return self::_des($key,$str,1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密方法
|
||||
*
|
||||
* @param string $str 需要加密的内容
|
||||
* @param string $key 密钥
|
||||
* @param bool $toBase64 是否base64
|
||||
* return string
|
||||
*/
|
||||
public function decrypt($str, $key, $toBase64=true)
|
||||
{
|
||||
if ($str == "") {
|
||||
return "";
|
||||
}
|
||||
if ($toBase64) {
|
||||
return self::_des($key,base64_decode($str),0);
|
||||
}
|
||||
return self::_des($key,$str,0);
|
||||
}
|
||||
|
||||
private function _des($key, $message, $encrypt, $mode=0, $iv=null) {
|
||||
$spfunction1 = array (0x1010400,0,0x10000,0x1010404,0x1010004,0x10404,0x4,0x10000,0x400,0x1010400,0x1010404,0x400,0x1000404,0x1010004,0x1000000,0x4,0x404,0x1000400,0x1000400,0x10400,0x10400,0x1010000,0x1010000,0x1000404,0x10004,0x1000004,0x1000004,0x10004,0,0x404,0x10404,0x1000000,0x10000,0x1010404,0x4,0x1010000,0x1010400,0x1000000,0x1000000,0x400,0x1010004,0x10000,0x10400,0x1000004,0x400,0x4,0x1000404,0x10404,0x1010404,0x10004,0x1010000,0x1000404,0x1000004,0x404,0x10404,0x1010400,0x404,0x1000400,0x1000400,0,0x10004,0x10400,0,0x1010004);
|
||||
$spfunction2 = array (-0x7fef7fe0,-0x7fff8000,0x8000,0x108020,0x100000,0x20,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,0x100000,0x20,-0x7fefffe0,0x108000,0x100020,-0x7fff7fe0,0,-0x80000000,0x8000,0x108020,-0x7ff00000,0x100020,-0x7fffffe0,0,0x108000,0x8020,-0x7fef8000,-0x7ff00000,0x8020,0,0x108020,-0x7fefffe0,0x100000,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,0x8000,-0x7ff00000,-0x7fff8000,0x20,-0x7fef7fe0,0x108020,0x20,0x8000,-0x80000000,0x8020,-0x7fef8000,0x100000,-0x7fffffe0,0x100020,-0x7fff7fe0,-0x7fffffe0,0x100020,0x108000,0,-0x7fff8000,0x8020,-0x80000000,-0x7fefffe0,-0x7fef7fe0,0x108000);
|
||||
$spfunction3 = array (0x208,0x8020200,0,0x8020008,0x8000200,0,0x20208,0x8000200,0x20008,0x8000008,0x8000008,0x20000,0x8020208,0x20008,0x8020000,0x208,0x8000000,0x8,0x8020200,0x200,0x20200,0x8020000,0x8020008,0x20208,0x8000208,0x20200,0x20000,0x8000208,0x8,0x8020208,0x200,0x8000000,0x8020200,0x8000000,0x20008,0x208,0x20000,0x8020200,0x8000200,0,0x200,0x20008,0x8020208,0x8000200,0x8000008,0x200,0,0x8020008,0x8000208,0x20000,0x8000000,0x8020208,0x8,0x20208,0x20200,0x8000008,0x8020000,0x8000208,0x208,0x8020000,0x20208,0x8,0x8020008,0x20200);
|
||||
$spfunction4 = array (0x802001,0x2081,0x2081,0x80,0x802080,0x800081,0x800001,0x2001,0,0x802000,0x802000,0x802081,0x81,0,0x800080,0x800001,0x1,0x2000,0x800000,0x802001,0x80,0x800000,0x2001,0x2080,0x800081,0x1,0x2080,0x800080,0x2000,0x802080,0x802081,0x81,0x800080,0x800001,0x802000,0x802081,0x81,0,0,0x802000,0x2080,0x800080,0x800081,0x1,0x802001,0x2081,0x2081,0x80,0x802081,0x81,0x1,0x2000,0x800001,0x2001,0x802080,0x800081,0x2001,0x2080,0x800000,0x802001,0x80,0x800000,0x2000,0x802080);
|
||||
$spfunction5 = array (0x100,0x2080100,0x2080000,0x42000100,0x80000,0x100,0x40000000,0x2080000,0x40080100,0x80000,0x2000100,0x40080100,0x42000100,0x42080000,0x80100,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,0x80100,0x80000,0x42000100,0x100,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,0x100,0x2000000,0x42080000,0x42080100,0x80100,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,0x80100,0x2000100,0x40000100,0x80000,0,0x40080000,0x2080100,0x40000100);
|
||||
$spfunction6 = array (0x20000010,0x20400000,0x4000,0x20404010,0x20400000,0x10,0x20404010,0x400000,0x20004000,0x404010,0x400000,0x20000010,0x400010,0x20004000,0x20000000,0x4010,0,0x400010,0x20004010,0x4000,0x404000,0x20004010,0x10,0x20400010,0x20400010,0,0x404010,0x20404000,0x4010,0x404000,0x20404000,0x20000000,0x20004000,0x10,0x20400010,0x404000,0x20404010,0x400000,0x4010,0x20000010,0x400000,0x20004000,0x20000000,0x4010,0x20000010,0x20404010,0x404000,0x20400000,0x404010,0x20404000,0,0x20400010,0x10,0x4000,0x20400000,0x404010,0x4000,0x400010,0x20004010,0,0x20404000,0x20000000,0x400010,0x20004010);
|
||||
$spfunction7 = array (0x200000,0x4200002,0x4000802,0,0x800,0x4000802,0x200802,0x4200800,0x4200802,0x200000,0,0x4000002,0x2,0x4000000,0x4200002,0x802,0x4000800,0x200802,0x200002,0x4000800,0x4000002,0x4200000,0x4200800,0x200002,0x4200000,0x800,0x802,0x4200802,0x200800,0x2,0x4000000,0x200800,0x4000000,0x200800,0x200000,0x4000802,0x4000802,0x4200002,0x4200002,0x2,0x200002,0x4000000,0x4000800,0x200000,0x4200800,0x802,0x200802,0x4200800,0x802,0x4000002,0x4200802,0x4200000,0x200800,0,0x2,0x4200802,0,0x200802,0x4200000,0x800,0x4000002,0x4000800,0x800,0x200002);
|
||||
$spfunction8 = array (0x10001040,0x1000,0x40000,0x10041040,0x10000000,0x10001040,0x40,0x10000000,0x40040,0x10040000,0x10041040,0x41000,0x10041000,0x41040,0x1000,0x40,0x10040000,0x10000040,0x10001000,0x1040,0x41000,0x40040,0x10040040,0x10041000,0x1040,0,0,0x10040040,0x10000040,0x10001000,0x41040,0x40000,0x41040,0x40000,0x10041000,0x1000,0x40,0x10040040,0x1000,0x41040,0x10001000,0x40,0x10000040,0x10040000,0x10040040,0x10000000,0x40000,0x10001040,0,0x10041040,0x40040,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,0x41000,0x41000,0x1040,0x1040,0x40040,0x10000000,0x10041000);
|
||||
$masks = array (4294967295,2147483647,1073741823,536870911,268435455,134217727,67108863,33554431,16777215,8388607,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,0);
|
||||
|
||||
$keys = self::_createKeys ($key);
|
||||
$m=0;
|
||||
$len = strlen($message);
|
||||
$chunk = 0;
|
||||
|
||||
$iterations = ((count($keys) == 32) ? 3 : 9);
|
||||
if ($iterations == 3) {$looping = (($encrypt) ? array (0, 32, 2) : array (30, -2, -2));}
|
||||
else {$looping = (($encrypt) ? array (0, 32, 2, 62, 30, -2, 64, 96, 2) : array (94, 62, -2, 32, 64, 2, 30, -2, -2));}
|
||||
|
||||
$message .= (chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . chr(0));
|
||||
|
||||
$result = "";
|
||||
$tempresult = "";
|
||||
|
||||
if ($mode == 1) {
|
||||
$cbcleft = (ord($iv{$m++}) << 24) | (ord($iv{$m++}) << 16) | (ord($iv{$m++}) << 8) | ord($iv{$m++});
|
||||
$cbcright = (ord($iv{$m++}) << 24) | (ord($iv{$m++}) << 16) | (ord($iv{$m++}) << 8) | ord($iv{$m++});
|
||||
$m=0;
|
||||
}
|
||||
|
||||
while ($m < $len) {
|
||||
$left = (ord($message{$m++}) << 24) | (ord($message{$m++}) << 16) | (ord($message{$m++}) << 8) | ord($message{$m++});
|
||||
$right = (ord($message{$m++}) << 24) | (ord($message{$m++}) << 16) | (ord($message{$m++}) << 8) | ord($message{$m++});
|
||||
|
||||
if ($mode == 1) {if ($encrypt) {$left ^= $cbcleft; $right ^= $cbcright;} else {$cbcleft2 = $cbcleft; $cbcright2 = $cbcright; $cbcleft = $left; $cbcright = $right;}}
|
||||
|
||||
$temp = (($left >> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4);
|
||||
$temp = (($left >> 16 & $masks[16]) ^ $right) & 0x0000ffff; $right ^= $temp; $left ^= ($temp << 16);
|
||||
$temp = (($right >> 2 & $masks[2]) ^ $left) & 0x33333333; $left ^= $temp; $right ^= ($temp << 2);
|
||||
$temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8);
|
||||
$temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);
|
||||
|
||||
$left = (($left << 1) | ($left >> 31 & $masks[31]));
|
||||
$right = (($right << 1) | ($right >> 31 & $masks[31]));
|
||||
|
||||
for ($j=0; $j<$iterations; $j+=3) {
|
||||
$endloop = $looping[$j+1];
|
||||
$loopinc = $looping[$j+2];
|
||||
for ($i=$looping[$j]; $i!=$endloop; $i+=$loopinc) {
|
||||
$right1 = $right ^ $keys[$i];
|
||||
$right2 = (($right >> 4 & $masks[4]) | ($right << 28)) ^ $keys[$i+1];
|
||||
$temp = $left;
|
||||
$left = $right;
|
||||
$right = $temp ^ ($spfunction2[($right1 >> 24 & $masks[24]) & 0x3f] | $spfunction4[($right1 >> 16 & $masks[16]) & 0x3f]
|
||||
| $spfunction6[($right1 >> 8 & $masks[8]) & 0x3f] | $spfunction8[$right1 & 0x3f]
|
||||
| $spfunction1[($right2 >> 24 & $masks[24]) & 0x3f] | $spfunction3[($right2 >> 16 & $masks[16]) & 0x3f]
|
||||
| $spfunction5[($right2 >> 8 & $masks[8]) & 0x3f] | $spfunction7[$right2 & 0x3f]);
|
||||
}
|
||||
$temp = $left; $left = $right; $right = $temp;
|
||||
}
|
||||
|
||||
$left = (($left >> 1 & $masks[1]) | ($left << 31));
|
||||
$right = (($right >> 1 & $masks[1]) | ($right << 31));
|
||||
|
||||
$temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);
|
||||
$temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8);
|
||||
$temp = (($right >> 2 & $masks[2]) ^ $left) & 0x33333333; $left ^= $temp; $right ^= ($temp << 2);
|
||||
$temp = (($left >> 16 & $masks[16]) ^ $right) & 0x0000ffff; $right ^= $temp; $left ^= ($temp << 16);
|
||||
$temp = (($left >> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4);
|
||||
|
||||
if ($mode == 1) {if ($encrypt) {$cbcleft = $left; $cbcright = $right;} else {$left ^= $cbcleft2; $right ^= $cbcright2;}}
|
||||
$tempresult .= (chr($left>>24 & $masks[24]) . chr(($left>>16 & $masks[16]) & 0xff) . chr(($left>>8 & $masks[8]) & 0xff) . chr($left & 0xff) . chr($right>>24 & $masks[24]) . chr(($right>>16 & $masks[16]) & 0xff) . chr(($right>>8 & $masks[8]) & 0xff) . chr($right & 0xff));
|
||||
|
||||
$chunk += 8;
|
||||
if ($chunk == 512) {$result .= $tempresult; $tempresult = ""; $chunk = 0;}
|
||||
}
|
||||
|
||||
return ($result . $tempresult);
|
||||
}
|
||||
|
||||
private function _createKeys ($key) {
|
||||
$pc2bytes0 = array (0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204);
|
||||
$pc2bytes1 = array (0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101);
|
||||
$pc2bytes2 = array (0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808);
|
||||
$pc2bytes3 = array (0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000);
|
||||
$pc2bytes4 = array (0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010);
|
||||
$pc2bytes5 = array (0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420);
|
||||
$pc2bytes6 = array (0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002);
|
||||
$pc2bytes7 = array (0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800);
|
||||
$pc2bytes8 = array (0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002);
|
||||
$pc2bytes9 = array (0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408);
|
||||
$pc2bytes10 = array (0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020);
|
||||
$pc2bytes11 = array (0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200);
|
||||
$pc2bytes12 = array (0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010);
|
||||
$pc2bytes13 = array (0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105);
|
||||
$masks = array (4294967295,2147483647,1073741823,536870911,268435455,134217727,67108863,33554431,16777215,8388607,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,0);
|
||||
|
||||
$iterations = ((strlen($key) >= 24) ? 3 : 1);
|
||||
$keys = array ();
|
||||
$shifts = array (0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0);
|
||||
$m=0;
|
||||
$n=0;
|
||||
|
||||
for ($j=0; $j<$iterations; $j++) {
|
||||
$left = (ord($key{$m++}) << 24) | (ord($key{$m++}) << 16) | (ord($key{$m++}) << 8) | ord($key{$m++});
|
||||
$right = (ord($key{$m++}) << 24) | (ord($key{$m++}) << 16) | (ord($key{$m++}) << 8) | ord($key{$m++});
|
||||
|
||||
$temp = (($left >> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4);
|
||||
$temp = (($right >> 16 & $masks[16]) ^ $left) & 0x0000ffff; $left ^= $temp; $right ^= ($temp << -16);
|
||||
$temp = (($left >> 2 & $masks[2]) ^ $right) & 0x33333333; $right ^= $temp; $left ^= ($temp << 2);
|
||||
$temp = (($right >> 16 & $masks[16]) ^ $left) & 0x0000ffff; $left ^= $temp; $right ^= ($temp << -16);
|
||||
$temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);
|
||||
$temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8);
|
||||
$temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);
|
||||
|
||||
$temp = ($left << 8) | (($right >> 20 & $masks[20]) & 0x000000f0);
|
||||
$left = ($right << 24) | (($right << 8) & 0xff0000) | (($right >> 8 & $masks[8]) & 0xff00) | (($right >> 24 & $masks[24]) & 0xf0);
|
||||
$right = $temp;
|
||||
|
||||
for ($i=0; $i < count($shifts); $i++) {
|
||||
if ($shifts[$i] > 0) {
|
||||
$left = (($left << 2) | ($left >> 26 & $masks[26]));
|
||||
$right = (($right << 2) | ($right >> 26 & $masks[26]));
|
||||
} else {
|
||||
$left = (($left << 1) | ($left >> 27 & $masks[27]));
|
||||
$right = (($right << 1) | ($right >> 27 & $masks[27]));
|
||||
}
|
||||
$left = $left & -0xf;
|
||||
$right = $right & -0xf;
|
||||
|
||||
$lefttemp = $pc2bytes0[$left >> 28 & $masks[28]] | $pc2bytes1[($left >> 24 & $masks[24]) & 0xf]
|
||||
| $pc2bytes2[($left >> 20 & $masks[20]) & 0xf] | $pc2bytes3[($left >> 16 & $masks[16]) & 0xf]
|
||||
| $pc2bytes4[($left >> 12 & $masks[12]) & 0xf] | $pc2bytes5[($left >> 8 & $masks[8]) & 0xf]
|
||||
| $pc2bytes6[($left >> 4 & $masks[4]) & 0xf];
|
||||
$righttemp = $pc2bytes7[$right >> 28 & $masks[28]] | $pc2bytes8[($right >> 24 & $masks[24]) & 0xf]
|
||||
| $pc2bytes9[($right >> 20 & $masks[20]) & 0xf] | $pc2bytes10[($right >> 16 & $masks[16]) & 0xf]
|
||||
| $pc2bytes11[($right >> 12 & $masks[12]) & 0xf] | $pc2bytes12[($right >> 8 & $masks[8]) & 0xf]
|
||||
| $pc2bytes13[($right >> 4 & $masks[4]) & 0xf];
|
||||
$temp = (($righttemp >> 16 & $masks[16]) ^ $lefttemp) & 0x0000ffff;
|
||||
$keys[$n++] = $lefttemp ^ $temp; $keys[$n++] = $righttemp ^ ($temp << 16);
|
||||
}
|
||||
}
|
||||
return $keys;
|
||||
}
|
||||
}
|
||||
|
||||
// 使用方式
|
||||
//$Des = new Des();
|
||||
/*$string = 'hello leven';
|
||||
$key = '123456';
|
||||
$encode = $Des->encrypt($string,$key,true);
|
||||
$decode = $Des->decrypt($encode,$key,true);
|
||||
echo $encode;
|
||||
echo "<br />";
|
||||
echo $decode;*/
|
||||
<?php
|
||||
class Des
|
||||
{
|
||||
/**
|
||||
* 加密方法
|
||||
*
|
||||
* @param string $str 需要加密的内容
|
||||
* @param string $key 密钥
|
||||
* @param bool $toBase64 是否base64
|
||||
* return string
|
||||
*/
|
||||
public function encrypt($str, $key, $toBase64=true)
|
||||
{
|
||||
if ($str == "") {
|
||||
return "";
|
||||
}
|
||||
if ($toBase64) {
|
||||
return base64_encode(self::_des($key,$str,1));
|
||||
}
|
||||
return self::_des($key,$str,1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密方法
|
||||
*
|
||||
* @param string $str 需要加密的内容
|
||||
* @param string $key 密钥
|
||||
* @param bool $toBase64 是否base64
|
||||
* return string
|
||||
*/
|
||||
public function decrypt($str, $key, $toBase64=true)
|
||||
{
|
||||
if ($str == "") {
|
||||
return "";
|
||||
}
|
||||
if ($toBase64) {
|
||||
return self::_des($key,base64_decode($str),0);
|
||||
}
|
||||
return self::_des($key,$str,0);
|
||||
}
|
||||
|
||||
private function _des($key, $message, $encrypt, $mode=0, $iv=null) {
|
||||
$spfunction1 = array (0x1010400,0,0x10000,0x1010404,0x1010004,0x10404,0x4,0x10000,0x400,0x1010400,0x1010404,0x400,0x1000404,0x1010004,0x1000000,0x4,0x404,0x1000400,0x1000400,0x10400,0x10400,0x1010000,0x1010000,0x1000404,0x10004,0x1000004,0x1000004,0x10004,0,0x404,0x10404,0x1000000,0x10000,0x1010404,0x4,0x1010000,0x1010400,0x1000000,0x1000000,0x400,0x1010004,0x10000,0x10400,0x1000004,0x400,0x4,0x1000404,0x10404,0x1010404,0x10004,0x1010000,0x1000404,0x1000004,0x404,0x10404,0x1010400,0x404,0x1000400,0x1000400,0,0x10004,0x10400,0,0x1010004);
|
||||
$spfunction2 = array (-0x7fef7fe0,-0x7fff8000,0x8000,0x108020,0x100000,0x20,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,0x100000,0x20,-0x7fefffe0,0x108000,0x100020,-0x7fff7fe0,0,-0x80000000,0x8000,0x108020,-0x7ff00000,0x100020,-0x7fffffe0,0,0x108000,0x8020,-0x7fef8000,-0x7ff00000,0x8020,0,0x108020,-0x7fefffe0,0x100000,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,0x8000,-0x7ff00000,-0x7fff8000,0x20,-0x7fef7fe0,0x108020,0x20,0x8000,-0x80000000,0x8020,-0x7fef8000,0x100000,-0x7fffffe0,0x100020,-0x7fff7fe0,-0x7fffffe0,0x100020,0x108000,0,-0x7fff8000,0x8020,-0x80000000,-0x7fefffe0,-0x7fef7fe0,0x108000);
|
||||
$spfunction3 = array (0x208,0x8020200,0,0x8020008,0x8000200,0,0x20208,0x8000200,0x20008,0x8000008,0x8000008,0x20000,0x8020208,0x20008,0x8020000,0x208,0x8000000,0x8,0x8020200,0x200,0x20200,0x8020000,0x8020008,0x20208,0x8000208,0x20200,0x20000,0x8000208,0x8,0x8020208,0x200,0x8000000,0x8020200,0x8000000,0x20008,0x208,0x20000,0x8020200,0x8000200,0,0x200,0x20008,0x8020208,0x8000200,0x8000008,0x200,0,0x8020008,0x8000208,0x20000,0x8000000,0x8020208,0x8,0x20208,0x20200,0x8000008,0x8020000,0x8000208,0x208,0x8020000,0x20208,0x8,0x8020008,0x20200);
|
||||
$spfunction4 = array (0x802001,0x2081,0x2081,0x80,0x802080,0x800081,0x800001,0x2001,0,0x802000,0x802000,0x802081,0x81,0,0x800080,0x800001,0x1,0x2000,0x800000,0x802001,0x80,0x800000,0x2001,0x2080,0x800081,0x1,0x2080,0x800080,0x2000,0x802080,0x802081,0x81,0x800080,0x800001,0x802000,0x802081,0x81,0,0,0x802000,0x2080,0x800080,0x800081,0x1,0x802001,0x2081,0x2081,0x80,0x802081,0x81,0x1,0x2000,0x800001,0x2001,0x802080,0x800081,0x2001,0x2080,0x800000,0x802001,0x80,0x800000,0x2000,0x802080);
|
||||
$spfunction5 = array (0x100,0x2080100,0x2080000,0x42000100,0x80000,0x100,0x40000000,0x2080000,0x40080100,0x80000,0x2000100,0x40080100,0x42000100,0x42080000,0x80100,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,0x80100,0x80000,0x42000100,0x100,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,0x100,0x2000000,0x42080000,0x42080100,0x80100,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,0x80100,0x2000100,0x40000100,0x80000,0,0x40080000,0x2080100,0x40000100);
|
||||
$spfunction6 = array (0x20000010,0x20400000,0x4000,0x20404010,0x20400000,0x10,0x20404010,0x400000,0x20004000,0x404010,0x400000,0x20000010,0x400010,0x20004000,0x20000000,0x4010,0,0x400010,0x20004010,0x4000,0x404000,0x20004010,0x10,0x20400010,0x20400010,0,0x404010,0x20404000,0x4010,0x404000,0x20404000,0x20000000,0x20004000,0x10,0x20400010,0x404000,0x20404010,0x400000,0x4010,0x20000010,0x400000,0x20004000,0x20000000,0x4010,0x20000010,0x20404010,0x404000,0x20400000,0x404010,0x20404000,0,0x20400010,0x10,0x4000,0x20400000,0x404010,0x4000,0x400010,0x20004010,0,0x20404000,0x20000000,0x400010,0x20004010);
|
||||
$spfunction7 = array (0x200000,0x4200002,0x4000802,0,0x800,0x4000802,0x200802,0x4200800,0x4200802,0x200000,0,0x4000002,0x2,0x4000000,0x4200002,0x802,0x4000800,0x200802,0x200002,0x4000800,0x4000002,0x4200000,0x4200800,0x200002,0x4200000,0x800,0x802,0x4200802,0x200800,0x2,0x4000000,0x200800,0x4000000,0x200800,0x200000,0x4000802,0x4000802,0x4200002,0x4200002,0x2,0x200002,0x4000000,0x4000800,0x200000,0x4200800,0x802,0x200802,0x4200800,0x802,0x4000002,0x4200802,0x4200000,0x200800,0,0x2,0x4200802,0,0x200802,0x4200000,0x800,0x4000002,0x4000800,0x800,0x200002);
|
||||
$spfunction8 = array (0x10001040,0x1000,0x40000,0x10041040,0x10000000,0x10001040,0x40,0x10000000,0x40040,0x10040000,0x10041040,0x41000,0x10041000,0x41040,0x1000,0x40,0x10040000,0x10000040,0x10001000,0x1040,0x41000,0x40040,0x10040040,0x10041000,0x1040,0,0,0x10040040,0x10000040,0x10001000,0x41040,0x40000,0x41040,0x40000,0x10041000,0x1000,0x40,0x10040040,0x1000,0x41040,0x10001000,0x40,0x10000040,0x10040000,0x10040040,0x10000000,0x40000,0x10001040,0,0x10041040,0x40040,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,0x41000,0x41000,0x1040,0x1040,0x40040,0x10000000,0x10041000);
|
||||
$masks = array (4294967295,2147483647,1073741823,536870911,268435455,134217727,67108863,33554431,16777215,8388607,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,0);
|
||||
|
||||
$keys = self::_createKeys ($key);
|
||||
$m=0;
|
||||
$len = strlen($message);
|
||||
$chunk = 0;
|
||||
|
||||
$iterations = ((count($keys) == 32) ? 3 : 9);
|
||||
if ($iterations == 3) {$looping = (($encrypt) ? array (0, 32, 2) : array (30, -2, -2));}
|
||||
else {$looping = (($encrypt) ? array (0, 32, 2, 62, 30, -2, 64, 96, 2) : array (94, 62, -2, 32, 64, 2, 30, -2, -2));}
|
||||
|
||||
$message .= (chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . chr(0));
|
||||
|
||||
$result = "";
|
||||
$tempresult = "";
|
||||
|
||||
if ($mode == 1) {
|
||||
$cbcleft = (ord($iv{$m++}) << 24) | (ord($iv{$m++}) << 16) | (ord($iv{$m++}) << 8) | ord($iv{$m++});
|
||||
$cbcright = (ord($iv{$m++}) << 24) | (ord($iv{$m++}) << 16) | (ord($iv{$m++}) << 8) | ord($iv{$m++});
|
||||
$m=0;
|
||||
}
|
||||
|
||||
while ($m < $len) {
|
||||
$left = (ord($message{$m++}) << 24) | (ord($message{$m++}) << 16) | (ord($message{$m++}) << 8) | ord($message{$m++});
|
||||
$right = (ord($message{$m++}) << 24) | (ord($message{$m++}) << 16) | (ord($message{$m++}) << 8) | ord($message{$m++});
|
||||
|
||||
if ($mode == 1) {if ($encrypt) {$left ^= $cbcleft; $right ^= $cbcright;} else {$cbcleft2 = $cbcleft; $cbcright2 = $cbcright; $cbcleft = $left; $cbcright = $right;}}
|
||||
|
||||
$temp = (($left >> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4);
|
||||
$temp = (($left >> 16 & $masks[16]) ^ $right) & 0x0000ffff; $right ^= $temp; $left ^= ($temp << 16);
|
||||
$temp = (($right >> 2 & $masks[2]) ^ $left) & 0x33333333; $left ^= $temp; $right ^= ($temp << 2);
|
||||
$temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8);
|
||||
$temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);
|
||||
|
||||
$left = (($left << 1) | ($left >> 31 & $masks[31]));
|
||||
$right = (($right << 1) | ($right >> 31 & $masks[31]));
|
||||
|
||||
for ($j=0; $j<$iterations; $j+=3) {
|
||||
$endloop = $looping[$j+1];
|
||||
$loopinc = $looping[$j+2];
|
||||
for ($i=$looping[$j]; $i!=$endloop; $i+=$loopinc) {
|
||||
$right1 = $right ^ $keys[$i];
|
||||
$right2 = (($right >> 4 & $masks[4]) | ($right << 28)) ^ $keys[$i+1];
|
||||
$temp = $left;
|
||||
$left = $right;
|
||||
$right = $temp ^ ($spfunction2[($right1 >> 24 & $masks[24]) & 0x3f] | $spfunction4[($right1 >> 16 & $masks[16]) & 0x3f]
|
||||
| $spfunction6[($right1 >> 8 & $masks[8]) & 0x3f] | $spfunction8[$right1 & 0x3f]
|
||||
| $spfunction1[($right2 >> 24 & $masks[24]) & 0x3f] | $spfunction3[($right2 >> 16 & $masks[16]) & 0x3f]
|
||||
| $spfunction5[($right2 >> 8 & $masks[8]) & 0x3f] | $spfunction7[$right2 & 0x3f]);
|
||||
}
|
||||
$temp = $left; $left = $right; $right = $temp;
|
||||
}
|
||||
|
||||
$left = (($left >> 1 & $masks[1]) | ($left << 31));
|
||||
$right = (($right >> 1 & $masks[1]) | ($right << 31));
|
||||
|
||||
$temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);
|
||||
$temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8);
|
||||
$temp = (($right >> 2 & $masks[2]) ^ $left) & 0x33333333; $left ^= $temp; $right ^= ($temp << 2);
|
||||
$temp = (($left >> 16 & $masks[16]) ^ $right) & 0x0000ffff; $right ^= $temp; $left ^= ($temp << 16);
|
||||
$temp = (($left >> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4);
|
||||
|
||||
if ($mode == 1) {if ($encrypt) {$cbcleft = $left; $cbcright = $right;} else {$left ^= $cbcleft2; $right ^= $cbcright2;}}
|
||||
$tempresult .= (chr($left>>24 & $masks[24]) . chr(($left>>16 & $masks[16]) & 0xff) . chr(($left>>8 & $masks[8]) & 0xff) . chr($left & 0xff) . chr($right>>24 & $masks[24]) . chr(($right>>16 & $masks[16]) & 0xff) . chr(($right>>8 & $masks[8]) & 0xff) . chr($right & 0xff));
|
||||
|
||||
$chunk += 8;
|
||||
if ($chunk == 512) {$result .= $tempresult; $tempresult = ""; $chunk = 0;}
|
||||
}
|
||||
|
||||
return ($result . $tempresult);
|
||||
}
|
||||
|
||||
private function _createKeys ($key) {
|
||||
$pc2bytes0 = array (0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204);
|
||||
$pc2bytes1 = array (0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101);
|
||||
$pc2bytes2 = array (0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808);
|
||||
$pc2bytes3 = array (0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000);
|
||||
$pc2bytes4 = array (0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010);
|
||||
$pc2bytes5 = array (0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420);
|
||||
$pc2bytes6 = array (0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002);
|
||||
$pc2bytes7 = array (0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800);
|
||||
$pc2bytes8 = array (0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002);
|
||||
$pc2bytes9 = array (0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408);
|
||||
$pc2bytes10 = array (0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020);
|
||||
$pc2bytes11 = array (0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200);
|
||||
$pc2bytes12 = array (0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010);
|
||||
$pc2bytes13 = array (0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105);
|
||||
$masks = array (4294967295,2147483647,1073741823,536870911,268435455,134217727,67108863,33554431,16777215,8388607,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,0);
|
||||
|
||||
$iterations = ((strlen($key) >= 24) ? 3 : 1);
|
||||
$keys = array ();
|
||||
$shifts = array (0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0);
|
||||
$m=0;
|
||||
$n=0;
|
||||
|
||||
for ($j=0; $j<$iterations; $j++) {
|
||||
$left = (ord($key{$m++}) << 24) | (ord($key{$m++}) << 16) | (ord($key{$m++}) << 8) | ord($key{$m++});
|
||||
$right = (ord($key{$m++}) << 24) | (ord($key{$m++}) << 16) | (ord($key{$m++}) << 8) | ord($key{$m++});
|
||||
|
||||
$temp = (($left >> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4);
|
||||
$temp = (($right >> 16 & $masks[16]) ^ $left) & 0x0000ffff; $left ^= $temp; $right ^= ($temp << -16);
|
||||
$temp = (($left >> 2 & $masks[2]) ^ $right) & 0x33333333; $right ^= $temp; $left ^= ($temp << 2);
|
||||
$temp = (($right >> 16 & $masks[16]) ^ $left) & 0x0000ffff; $left ^= $temp; $right ^= ($temp << -16);
|
||||
$temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);
|
||||
$temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8);
|
||||
$temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);
|
||||
|
||||
$temp = ($left << 8) | (($right >> 20 & $masks[20]) & 0x000000f0);
|
||||
$left = ($right << 24) | (($right << 8) & 0xff0000) | (($right >> 8 & $masks[8]) & 0xff00) | (($right >> 24 & $masks[24]) & 0xf0);
|
||||
$right = $temp;
|
||||
|
||||
for ($i=0; $i < count($shifts); $i++) {
|
||||
if ($shifts[$i] > 0) {
|
||||
$left = (($left << 2) | ($left >> 26 & $masks[26]));
|
||||
$right = (($right << 2) | ($right >> 26 & $masks[26]));
|
||||
} else {
|
||||
$left = (($left << 1) | ($left >> 27 & $masks[27]));
|
||||
$right = (($right << 1) | ($right >> 27 & $masks[27]));
|
||||
}
|
||||
$left = $left & -0xf;
|
||||
$right = $right & -0xf;
|
||||
|
||||
$lefttemp = $pc2bytes0[$left >> 28 & $masks[28]] | $pc2bytes1[($left >> 24 & $masks[24]) & 0xf]
|
||||
| $pc2bytes2[($left >> 20 & $masks[20]) & 0xf] | $pc2bytes3[($left >> 16 & $masks[16]) & 0xf]
|
||||
| $pc2bytes4[($left >> 12 & $masks[12]) & 0xf] | $pc2bytes5[($left >> 8 & $masks[8]) & 0xf]
|
||||
| $pc2bytes6[($left >> 4 & $masks[4]) & 0xf];
|
||||
$righttemp = $pc2bytes7[$right >> 28 & $masks[28]] | $pc2bytes8[($right >> 24 & $masks[24]) & 0xf]
|
||||
| $pc2bytes9[($right >> 20 & $masks[20]) & 0xf] | $pc2bytes10[($right >> 16 & $masks[16]) & 0xf]
|
||||
| $pc2bytes11[($right >> 12 & $masks[12]) & 0xf] | $pc2bytes12[($right >> 8 & $masks[8]) & 0xf]
|
||||
| $pc2bytes13[($right >> 4 & $masks[4]) & 0xf];
|
||||
$temp = (($righttemp >> 16 & $masks[16]) ^ $lefttemp) & 0x0000ffff;
|
||||
$keys[$n++] = $lefttemp ^ $temp; $keys[$n++] = $righttemp ^ ($temp << 16);
|
||||
}
|
||||
}
|
||||
return $keys;
|
||||
}
|
||||
}
|
||||
|
||||
// 使用方式
|
||||
//$Des = new Des();
|
||||
/*$string = 'hello leven';
|
||||
$key = '123456';
|
||||
$encode = $Des->encrypt($string,$key,true);
|
||||
$decode = $Des->decrypt($encode,$key,true);
|
||||
echo $encode;
|
||||
echo "<br />";
|
||||
echo $decode;*/
|
||||
?>
|
||||
@@ -1,103 +1,113 @@
|
||||
<?php
|
||||
/** php下载类,支持断点续传
|
||||
* Date: 2013-06-30
|
||||
* Author: test
|
||||
* Ver: 1.0
|
||||
*
|
||||
* Func:
|
||||
* download: 下载文件
|
||||
* setSpeed: 设置下载速度
|
||||
* getRange: 获取header中Range
|
||||
*/
|
||||
|
||||
class FileDownload{ // class start
|
||||
|
||||
private $_speed = 512; // 下载速度
|
||||
|
||||
/** 下载
|
||||
* @param String $file 要下载的文件路径
|
||||
* @param String $name 文件名称,为空则与下载的文件名称一样
|
||||
* @param boolean $reload 是否开启断点续传
|
||||
*/
|
||||
public function download($file, $name='',$file_size=0,$dateline=0, $reload=false){
|
||||
if($name==''){
|
||||
$name = basename($file);
|
||||
}
|
||||
if(!$dateline){
|
||||
$dataline=TIMESTAMP;
|
||||
}
|
||||
if(!$fp = fopen($file, 'rb')){
|
||||
topshowmessage(lang('file_not_exist1'));
|
||||
}
|
||||
$db = DB::object();
|
||||
$db->close();
|
||||
@ob_end_clean();
|
||||
if(getglobal('gzipcompress')) @ob_start('ob_gzhandler');
|
||||
if(!$file_size) $file_size = filesize($file);
|
||||
$ranges = $this->getRange($file_size);
|
||||
|
||||
header('cache-control:public');
|
||||
header('Date: '.gmdate('D, d M Y H:i:s', $dateline).' GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $dateline).' GMT');
|
||||
header('content-type:application/octet-stream');
|
||||
header('content-disposition:attachment; filename='.$name);
|
||||
if($reload && $ranges!=null){ // 使用续传
|
||||
header('HTTP/1.1 206 Partial Content');
|
||||
header('Accept-Ranges:bytes');
|
||||
|
||||
// 剩余长度
|
||||
header(sprintf('content-length:%u',$ranges['end']-$ranges['start']+1));
|
||||
|
||||
// range信息
|
||||
header(sprintf('content-range:bytes %s-%s/%s', $ranges['start'], $ranges['end'], $file_size));
|
||||
|
||||
// fp指针跳到断点位置
|
||||
fseek($fp, sprintf('%u', $ranges['start']));
|
||||
}else{
|
||||
header('HTTP/1.1 200 OK');
|
||||
header('content-length:'.$file_size);
|
||||
}
|
||||
|
||||
while(!feof($fp)){
|
||||
echo fread($fp, round($this->_speed*1024,0));
|
||||
@flush(); @ob_flush();
|
||||
// usleep(500); // 用于测试,减慢下载速度
|
||||
}
|
||||
($fp!=null) && fclose($fp);
|
||||
|
||||
}
|
||||
|
||||
/** 设置下载速度
|
||||
* @param int $speed
|
||||
*/
|
||||
public function setSpeed($speed){
|
||||
if(is_numeric($speed) && $speed>16 && $speed<4096){
|
||||
$this->_speed = $speed;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取header range信息
|
||||
* @param int $file_size 文件大小
|
||||
* @return Array
|
||||
*/
|
||||
private function getRange($file_size){
|
||||
|
||||
if(isset($_SERVER['HTTP_RANGE'])){
|
||||
list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2);
|
||||
list($range) = explode(",",$range,2);
|
||||
list($start, $range_end) = explode("-", $range);
|
||||
$start=intval($start);
|
||||
if(!$range_end) {
|
||||
$range_end=$file_size-1;
|
||||
} else {
|
||||
$range_end=intval($range_end);
|
||||
}
|
||||
$range = array('start'=>$start,'end'=>$range_end);
|
||||
return $range;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
} // class end
|
||||
|
||||
<?php
|
||||
/** php下载类,支持断点续传
|
||||
* Date: 2013-06-30
|
||||
* Author: test
|
||||
* Ver: 1.0
|
||||
*
|
||||
* Func:
|
||||
* download: 下载文件
|
||||
* setSpeed: 设置下载速度
|
||||
* getRange: 获取header中Range
|
||||
*/
|
||||
|
||||
class FileDownload{ // class start
|
||||
|
||||
private $_speed = 512; // 下载速度
|
||||
|
||||
/** 下载
|
||||
* @param String $file 要下载的文件路径
|
||||
* @param String $name 文件名称,为空则与下载的文件名称一样
|
||||
* @param boolean $reload 是否开启断点续传
|
||||
*/
|
||||
public function download($file, $name='',$file_size=0,$dateline=0, $reload=false){
|
||||
if($name==''){
|
||||
$name = basename($file);
|
||||
}
|
||||
if(!$dateline){
|
||||
$dataline=TIMESTAMP;
|
||||
}
|
||||
if(!$fp = fopen($file, 'rb')){
|
||||
topshowmessage(lang('file_not_exist1'));
|
||||
}
|
||||
$charset = CHARSET;
|
||||
$db = DB::object();
|
||||
$db->close();
|
||||
@ob_end_clean();
|
||||
if(getglobal('gzipcompress')) @ob_start('ob_gzhandler');
|
||||
if(!$file_size) $file_size = filesize($file);
|
||||
$ranges = $this->getRange($file_size);
|
||||
|
||||
header('cache-control:public');
|
||||
header('Date: '.gmdate('D, d M Y H:i:s', $dateline).' GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $dateline).' GMT');
|
||||
header('content-type:application/octet-stream');
|
||||
if (preg_match("/Firefox/", $_SERVER["HTTP_USER_AGENT"])) {
|
||||
$attachment = 'attachment; filename*='.$charset.'\'\'' . $name;
|
||||
} elseif (!preg_match("/Chrome/", $_SERVER["HTTP_USER_AGENT"]) && preg_match("/Safari/", $_SERVER["HTTP_USER_AGENT"])) {
|
||||
$filename = rawurlencode($name); // 注意:rawurlencode与urlencode的区别
|
||||
$attachment = 'attachment; filename*='.$charset.'\'\'' . $filename;
|
||||
} else{
|
||||
$attachment = 'attachment; filename='.$name;
|
||||
}
|
||||
//header('content-disposition:attachment; filename='.$name);
|
||||
header('content-disposition:'.$attachment);
|
||||
if($reload && $ranges!=null){ // 使用续传
|
||||
header('HTTP/1.1 206 Partial Content');
|
||||
header('Accept-Ranges:bytes');
|
||||
|
||||
// 剩余长度
|
||||
header(sprintf('content-length:%u',$ranges['end']-$ranges['start']+1));
|
||||
|
||||
// range信息
|
||||
header(sprintf('content-range:bytes %s-%s/%s', $ranges['start'], $ranges['end'], $file_size));
|
||||
|
||||
// fp指针跳到断点位置
|
||||
fseek($fp, sprintf('%u', $ranges['start']));
|
||||
}else{
|
||||
header('HTTP/1.1 200 OK');
|
||||
header('content-length:'.$file_size);
|
||||
}
|
||||
|
||||
while(!feof($fp)){
|
||||
echo fread($fp, round($this->_speed*1024,0));
|
||||
@flush(); @ob_flush();
|
||||
// usleep(500); // 用于测试,减慢下载速度
|
||||
}
|
||||
($fp!=null) && fclose($fp);
|
||||
|
||||
}
|
||||
|
||||
/** 设置下载速度
|
||||
* @param int $speed
|
||||
*/
|
||||
public function setSpeed($speed){
|
||||
if(is_numeric($speed) && $speed>16 && $speed<4096){
|
||||
$this->_speed = $speed;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取header range信息
|
||||
* @param int $file_size 文件大小
|
||||
* @return Array
|
||||
*/
|
||||
private function getRange($file_size){
|
||||
|
||||
if(isset($_SERVER['HTTP_RANGE'])){
|
||||
list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2);
|
||||
list($range) = explode(",",$range,2);
|
||||
list($start, $range_end) = explode("-", $range);
|
||||
$start=intval($start);
|
||||
if(!$range_end) {
|
||||
$range_end=$file_size-1;
|
||||
} else {
|
||||
$range_end=intval($range_end);
|
||||
}
|
||||
$range = array('start'=>$start,'end'=>$range_end);
|
||||
return $range;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
} // class end
|
||||
|
||||
?>
|
||||
@@ -1,321 +1,321 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class GifMerge {
|
||||
var $ver = '1.1';
|
||||
var $dly = 50;
|
||||
var $mod = 'C_FILE';
|
||||
var $first = true;
|
||||
var $use_loop = false;
|
||||
var $transparent = false;
|
||||
var $use_global_in = false;
|
||||
var $x = 0;
|
||||
var $y = 0;
|
||||
var $ch = 0;
|
||||
var $fin = 0;
|
||||
var $fout = '';
|
||||
var $loop = 0;
|
||||
var $delay = 0;
|
||||
var $width = 0;
|
||||
var $height = 0;
|
||||
var $trans1 = 255;
|
||||
var $trans2 = 255;
|
||||
var $trans3 = 255;
|
||||
var $disposal = 2;
|
||||
var $out_color_table_size = 0;
|
||||
var $local_color_table_flag = 0;
|
||||
var $global_color_table_size = 0;
|
||||
var $out_color_table_sizecode = 0;
|
||||
var $global_color_table_sizecode= 0;
|
||||
var $gif = array(0x47, 0x49, 0x46);
|
||||
var $buffer = array();
|
||||
var $local_in = array();
|
||||
var $global_in = array();
|
||||
var $global_out = array();
|
||||
var $logical_screen_descriptor = array();
|
||||
|
||||
function GifMerge($images, $t1, $t2, $t3, $loop, $dl, $xpos, $ypos, $model) {
|
||||
if($model) {
|
||||
$this->mod = $model;
|
||||
}
|
||||
if($loop > -1) {
|
||||
$this->loop = floor($loop - 1);
|
||||
$this->use_loop = true;
|
||||
}
|
||||
if($t1 > -1 && $t2 > -1 && $t3 > -1) {
|
||||
$this->trans1 = $t1;
|
||||
$this->trans2 = $t2;
|
||||
$this->trans3 = $t3;
|
||||
$this->transparent = true;
|
||||
}
|
||||
for($i = 0; $i < count($images); $i++) {
|
||||
$dl[$i] ? $this->delay = $dl[$i] : $this->delay = $this->dly;
|
||||
$xpos[$i] ? $this->x = $xpos[$i] : $this->x = 0;
|
||||
$ypos[$i] ? $this->y = $ypos[$i] : $this->y = 0;
|
||||
$this->start_gifmerge_process($images[$i]);
|
||||
}
|
||||
$this->fout .= "\x3b";
|
||||
}
|
||||
|
||||
function start_gifmerge_process($fp) {
|
||||
if($this->mod == 'C_FILE') {
|
||||
if(!$this->fin = fopen($fp, 'rb')) {
|
||||
return;
|
||||
}
|
||||
} elseif($this->mod == 'C_MEMORY') {
|
||||
$this->ch = 0;
|
||||
$this->fin = $fp;
|
||||
}
|
||||
$this->getbytes(6);
|
||||
if(!$this->arrcmp($this->buffer, $this->gif, 3)) {
|
||||
return;
|
||||
}
|
||||
$this->getbytes(7);
|
||||
if($this->first) $this->logical_screen_descriptor = $this->buffer;
|
||||
$this->global_color_table_sizecode = $this->buffer[4] & 0x07;
|
||||
$this->global_color_table_size = 2 << $this->global_color_table_sizecode;
|
||||
if($this->buffer[4] & 0x80) {
|
||||
$this->getbytes((3 * $this->global_color_table_size));
|
||||
for($i = 0; $i < ((3 * $this->global_color_table_size)); $i++) {
|
||||
$this->global_in[$i] = $this->buffer[$i];
|
||||
}
|
||||
if($this->out_color_table_size == 0) {
|
||||
$this->out_color_table_size = $this->global_color_table_size;
|
||||
$this->out_color_table_sizecode = $this->global_color_table_sizecode;
|
||||
$this->global_out = $this->global_in;
|
||||
}
|
||||
if($this->global_color_table_size != $this->out_color_table_size || $this->arrcmp($this->global_out, $this->global_in, (3 * $this->global_color_table_size))) {
|
||||
$this->use_global_in = true;
|
||||
}
|
||||
}
|
||||
for($loop = true; $loop;) {
|
||||
$this->getbytes(1);
|
||||
switch($this->buffer[0]) {
|
||||
case 0x21:
|
||||
$this->read_extension();
|
||||
break;
|
||||
case 0x2c:
|
||||
$this->read_image_descriptor();
|
||||
break;
|
||||
case 0x3b:
|
||||
$loop = false;
|
||||
break;
|
||||
default:
|
||||
$loop = false;
|
||||
}
|
||||
}
|
||||
if($this->mod == 'C_FILE') {
|
||||
fclose($this->fin);
|
||||
}
|
||||
}
|
||||
|
||||
function read_image_descriptor() {
|
||||
$this->getbytes(9);
|
||||
$head = $this->buffer;
|
||||
$this->local_color_table_flag = ($this->buffer[8] & 0x80) ? true : false;
|
||||
if($this->local_color_table_flag) {
|
||||
$sizecode = $this->buffer[8] & 0x07;
|
||||
$size = 2 << $sizecode;
|
||||
$this->getbytes(3 * $size);
|
||||
for($i = 0; $i < (3 * $size); $i++) {
|
||||
$this->local_in[$i] = $this->buffer[$i];
|
||||
}
|
||||
if($this->out_color_table_size == 0) {
|
||||
$this->out_color_table_size = $size;
|
||||
$this->out_color_table_sizecode = $sizecode;
|
||||
for($i = 0; $i < (3 * $size); $i++) {
|
||||
$this->global_out[$i] = $this->local_in[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if($this->first) {
|
||||
$this->first = false;
|
||||
$this->fout .= "\x47\x49\x46\x38\x39\x61";
|
||||
if($this->width && $this->height) {
|
||||
$this->logical_screen_descriptor[0] = $this->width & 0xFF;
|
||||
$this->logical_screen_descriptor[1] = ($this->width & 0xFF00) >> 8;
|
||||
$this->logical_screen_descriptor[2] = $this->height & 0xFF;
|
||||
$this->logical_screen_descriptor[3] = ($this->height & 0xFF00) >> 8;
|
||||
}
|
||||
$this->logical_screen_descriptor[4] |= 0x80;
|
||||
$this->logical_screen_descriptor[5] &= 0xF0;
|
||||
$this->logical_screen_descriptor[6] |= $this->out_color_table_sizecode;
|
||||
$this->putbytes($this->logical_screen_descriptor, 7);
|
||||
$this->putbytes($this->global_out, ($this->out_color_table_size * 3));
|
||||
if($this->use_loop) {
|
||||
$ns[0] = 0x21;
|
||||
$ns[1] = 0xFF;
|
||||
$ns[2] = 0x0B;
|
||||
$ns[3] = 0x4e;
|
||||
$ns[4] = 0x45;
|
||||
$ns[5] = 0x54;
|
||||
$ns[6] = 0x53;
|
||||
$ns[7] = 0x43;
|
||||
$ns[8] = 0x41;
|
||||
$ns[9] = 0x50;
|
||||
$ns[10] = 0x45;
|
||||
$ns[11] = 0x32;
|
||||
$ns[12] = 0x2e;
|
||||
$ns[13] = 0x30;
|
||||
$ns[14] = 0x03;
|
||||
$ns[15] = 0x01;
|
||||
$ns[16] = $this->loop & 255;
|
||||
$ns[17] = $this->loop >> 8;
|
||||
$ns[18] = 0x00;
|
||||
$this->putbytes($ns, 19);
|
||||
}
|
||||
}
|
||||
if($this->use_global_in) {
|
||||
$outtable = $this->global_in;
|
||||
$outsize = $this->global_color_table_size;
|
||||
$outsizecode = $this->global_color_table_sizecode;
|
||||
} else {
|
||||
$outtable = $this->global_out;
|
||||
$outsize = $this->out_color_table_size;
|
||||
}
|
||||
if($this->local_color_table_flag) {
|
||||
if($size == $this->out_color_table_size && !$this->arrcmp($this->local_in, $this->global_out, $size)) {
|
||||
$outtable = $this->global_out;
|
||||
$outsize = $this->out_color_table_size;
|
||||
} else {
|
||||
$outtable = $this->local_in;
|
||||
$outsize = $size;
|
||||
$outsizecode = $sizecode;
|
||||
}
|
||||
}
|
||||
$use_trans = false;
|
||||
if($this->transparent) {
|
||||
for($i = 0; $i < $outsize; $i++) {
|
||||
if($outtable[3 * $i] == $this->trans1 && $outtable [3 * $i + 1] == $this->trans2 && $outtable [3 * $i + 2] == $this->trans3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($i < $outsize) {
|
||||
$transindex = $i;
|
||||
$use_trans = true;
|
||||
}
|
||||
}
|
||||
if($this->delay || $use_trans) {
|
||||
$this->buffer[0] = 0x21;
|
||||
$this->buffer[1] = 0xf9;
|
||||
$this->buffer[2] = 0x04;
|
||||
$this->buffer[3] = ($this->disposal << 2) + ($use_trans ? 1 : 0);
|
||||
$this->buffer[4] = $this->delay & 0xff;
|
||||
$this->buffer[5] = ($this->delay & 0xff00) >> 8;
|
||||
$this->buffer[6] = $use_trans ? $transindex : 0;
|
||||
$this->buffer[7] = 0x00;
|
||||
$this->putbytes($this->buffer,8);
|
||||
}
|
||||
$this->buffer[0] = 0x2c;
|
||||
$this->putbytes($this->buffer,1);
|
||||
$head[0] = $this->x & 0xff;
|
||||
$head[1] = ($this->x & 0xff00) >> 8;
|
||||
$head[2] = $this->y & 0xff;
|
||||
$head[3] = ($this->y & 0xff00) >> 8;
|
||||
$head[8] &= 0x40;
|
||||
if($outtable != $this->global_out) {
|
||||
$head[8] |= 0x80;
|
||||
$head[8] |= $outsizecode;
|
||||
}
|
||||
$this->putbytes($head,9);
|
||||
if($outtable != $this->global_out) {
|
||||
$this->putbytes($outtable, (3 * $outsize));
|
||||
}
|
||||
$this->getbytes(1);
|
||||
$this->putbytes($this->buffer,1);
|
||||
for(;;) {
|
||||
$this->getbytes(1);
|
||||
$this->putbytes($this->buffer,1);
|
||||
if(($u = $this->buffer[0]) == 0) {
|
||||
break;
|
||||
}
|
||||
$this->getbytes($u);
|
||||
$this->putbytes($this->buffer, $u);
|
||||
}
|
||||
}
|
||||
|
||||
function read_extension() {
|
||||
$this->getbytes(1);
|
||||
switch($this->buffer[0]) {
|
||||
case 0xf9:
|
||||
$this->getbytes(6);
|
||||
break;
|
||||
case 0xfe:
|
||||
for(;;) {
|
||||
$this->getbytes(1);
|
||||
if(($u = $this->buffer[0]) == 0) {
|
||||
break;
|
||||
}
|
||||
$this->getbytes($u);
|
||||
}
|
||||
break;
|
||||
case 0x01:
|
||||
$this->getbytes(13);
|
||||
for(;;) {
|
||||
$this->getbytes(0);
|
||||
if(($u = $this->buffer[0]) == 0) {
|
||||
break;
|
||||
}
|
||||
$this->getbytes($u);
|
||||
}
|
||||
break;
|
||||
case 0xff:
|
||||
$this->getbytes(9);
|
||||
$this->getbytes(3);
|
||||
for(;;) {
|
||||
$this->getbytes(1);
|
||||
if(!$this->buffer[0]) {
|
||||
break;
|
||||
}
|
||||
$this->getbytes($this->buffer[0]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
for(;;) {
|
||||
$this->getbytes(1);
|
||||
if(!$this->buffer[0]) {
|
||||
break;
|
||||
}
|
||||
$this->getbytes($this->buffer[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function arrcmp($b, $s, $l) {
|
||||
for($i = 0; $i < $l; $i++) {
|
||||
if($s{$i} != $b{$i}) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function getbytes($l) {
|
||||
for($i = 0; $i < $l; $i++) {
|
||||
if($this->mod == 'C_FILE') {
|
||||
$bin = unpack('C*', fread($this->fin, 1));
|
||||
$this->buffer[$i] = $bin[1];
|
||||
} elseif($this->mod == 'C_MEMORY') {
|
||||
$bin = unpack('C*', substr($this->fin, $this->ch, 1));
|
||||
$this->buffer[$i] = $bin[1];
|
||||
$this->ch++;
|
||||
}
|
||||
}
|
||||
return $this->buffer;
|
||||
}
|
||||
|
||||
function putbytes($s, $l) {
|
||||
for($i = 0; $i < $l; $i++) {
|
||||
$this->fout .= pack('C*', $s[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
function getAnimation() {
|
||||
return $this->fout;
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class GifMerge {
|
||||
var $ver = '1.1';
|
||||
var $dly = 50;
|
||||
var $mod = 'C_FILE';
|
||||
var $first = true;
|
||||
var $use_loop = false;
|
||||
var $transparent = false;
|
||||
var $use_global_in = false;
|
||||
var $x = 0;
|
||||
var $y = 0;
|
||||
var $ch = 0;
|
||||
var $fin = 0;
|
||||
var $fout = '';
|
||||
var $loop = 0;
|
||||
var $delay = 0;
|
||||
var $width = 0;
|
||||
var $height = 0;
|
||||
var $trans1 = 255;
|
||||
var $trans2 = 255;
|
||||
var $trans3 = 255;
|
||||
var $disposal = 2;
|
||||
var $out_color_table_size = 0;
|
||||
var $local_color_table_flag = 0;
|
||||
var $global_color_table_size = 0;
|
||||
var $out_color_table_sizecode = 0;
|
||||
var $global_color_table_sizecode= 0;
|
||||
var $gif = array(0x47, 0x49, 0x46);
|
||||
var $buffer = array();
|
||||
var $local_in = array();
|
||||
var $global_in = array();
|
||||
var $global_out = array();
|
||||
var $logical_screen_descriptor = array();
|
||||
|
||||
function GifMerge($images, $t1, $t2, $t3, $loop, $dl, $xpos, $ypos, $model) {
|
||||
if($model) {
|
||||
$this->mod = $model;
|
||||
}
|
||||
if($loop > -1) {
|
||||
$this->loop = floor($loop - 1);
|
||||
$this->use_loop = true;
|
||||
}
|
||||
if($t1 > -1 && $t2 > -1 && $t3 > -1) {
|
||||
$this->trans1 = $t1;
|
||||
$this->trans2 = $t2;
|
||||
$this->trans3 = $t3;
|
||||
$this->transparent = true;
|
||||
}
|
||||
for($i = 0; $i < count($images); $i++) {
|
||||
$dl[$i] ? $this->delay = $dl[$i] : $this->delay = $this->dly;
|
||||
$xpos[$i] ? $this->x = $xpos[$i] : $this->x = 0;
|
||||
$ypos[$i] ? $this->y = $ypos[$i] : $this->y = 0;
|
||||
$this->start_gifmerge_process($images[$i]);
|
||||
}
|
||||
$this->fout .= "\x3b";
|
||||
}
|
||||
|
||||
function start_gifmerge_process($fp) {
|
||||
if($this->mod == 'C_FILE') {
|
||||
if(!$this->fin = fopen($fp, 'rb')) {
|
||||
return;
|
||||
}
|
||||
} elseif($this->mod == 'C_MEMORY') {
|
||||
$this->ch = 0;
|
||||
$this->fin = $fp;
|
||||
}
|
||||
$this->getbytes(6);
|
||||
if(!$this->arrcmp($this->buffer, $this->gif, 3)) {
|
||||
return;
|
||||
}
|
||||
$this->getbytes(7);
|
||||
if($this->first) $this->logical_screen_descriptor = $this->buffer;
|
||||
$this->global_color_table_sizecode = $this->buffer[4] & 0x07;
|
||||
$this->global_color_table_size = 2 << $this->global_color_table_sizecode;
|
||||
if($this->buffer[4] & 0x80) {
|
||||
$this->getbytes((3 * $this->global_color_table_size));
|
||||
for($i = 0; $i < ((3 * $this->global_color_table_size)); $i++) {
|
||||
$this->global_in[$i] = $this->buffer[$i];
|
||||
}
|
||||
if($this->out_color_table_size == 0) {
|
||||
$this->out_color_table_size = $this->global_color_table_size;
|
||||
$this->out_color_table_sizecode = $this->global_color_table_sizecode;
|
||||
$this->global_out = $this->global_in;
|
||||
}
|
||||
if($this->global_color_table_size != $this->out_color_table_size || $this->arrcmp($this->global_out, $this->global_in, (3 * $this->global_color_table_size))) {
|
||||
$this->use_global_in = true;
|
||||
}
|
||||
}
|
||||
for($loop = true; $loop;) {
|
||||
$this->getbytes(1);
|
||||
switch($this->buffer[0]) {
|
||||
case 0x21:
|
||||
$this->read_extension();
|
||||
break;
|
||||
case 0x2c:
|
||||
$this->read_image_descriptor();
|
||||
break;
|
||||
case 0x3b:
|
||||
$loop = false;
|
||||
break;
|
||||
default:
|
||||
$loop = false;
|
||||
}
|
||||
}
|
||||
if($this->mod == 'C_FILE') {
|
||||
fclose($this->fin);
|
||||
}
|
||||
}
|
||||
|
||||
function read_image_descriptor() {
|
||||
$this->getbytes(9);
|
||||
$head = $this->buffer;
|
||||
$this->local_color_table_flag = ($this->buffer[8] & 0x80) ? true : false;
|
||||
if($this->local_color_table_flag) {
|
||||
$sizecode = $this->buffer[8] & 0x07;
|
||||
$size = 2 << $sizecode;
|
||||
$this->getbytes(3 * $size);
|
||||
for($i = 0; $i < (3 * $size); $i++) {
|
||||
$this->local_in[$i] = $this->buffer[$i];
|
||||
}
|
||||
if($this->out_color_table_size == 0) {
|
||||
$this->out_color_table_size = $size;
|
||||
$this->out_color_table_sizecode = $sizecode;
|
||||
for($i = 0; $i < (3 * $size); $i++) {
|
||||
$this->global_out[$i] = $this->local_in[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if($this->first) {
|
||||
$this->first = false;
|
||||
$this->fout .= "\x47\x49\x46\x38\x39\x61";
|
||||
if($this->width && $this->height) {
|
||||
$this->logical_screen_descriptor[0] = $this->width & 0xFF;
|
||||
$this->logical_screen_descriptor[1] = ($this->width & 0xFF00) >> 8;
|
||||
$this->logical_screen_descriptor[2] = $this->height & 0xFF;
|
||||
$this->logical_screen_descriptor[3] = ($this->height & 0xFF00) >> 8;
|
||||
}
|
||||
$this->logical_screen_descriptor[4] |= 0x80;
|
||||
$this->logical_screen_descriptor[5] &= 0xF0;
|
||||
$this->logical_screen_descriptor[6] |= $this->out_color_table_sizecode;
|
||||
$this->putbytes($this->logical_screen_descriptor, 7);
|
||||
$this->putbytes($this->global_out, ($this->out_color_table_size * 3));
|
||||
if($this->use_loop) {
|
||||
$ns[0] = 0x21;
|
||||
$ns[1] = 0xFF;
|
||||
$ns[2] = 0x0B;
|
||||
$ns[3] = 0x4e;
|
||||
$ns[4] = 0x45;
|
||||
$ns[5] = 0x54;
|
||||
$ns[6] = 0x53;
|
||||
$ns[7] = 0x43;
|
||||
$ns[8] = 0x41;
|
||||
$ns[9] = 0x50;
|
||||
$ns[10] = 0x45;
|
||||
$ns[11] = 0x32;
|
||||
$ns[12] = 0x2e;
|
||||
$ns[13] = 0x30;
|
||||
$ns[14] = 0x03;
|
||||
$ns[15] = 0x01;
|
||||
$ns[16] = $this->loop & 255;
|
||||
$ns[17] = $this->loop >> 8;
|
||||
$ns[18] = 0x00;
|
||||
$this->putbytes($ns, 19);
|
||||
}
|
||||
}
|
||||
if($this->use_global_in) {
|
||||
$outtable = $this->global_in;
|
||||
$outsize = $this->global_color_table_size;
|
||||
$outsizecode = $this->global_color_table_sizecode;
|
||||
} else {
|
||||
$outtable = $this->global_out;
|
||||
$outsize = $this->out_color_table_size;
|
||||
}
|
||||
if($this->local_color_table_flag) {
|
||||
if($size == $this->out_color_table_size && !$this->arrcmp($this->local_in, $this->global_out, $size)) {
|
||||
$outtable = $this->global_out;
|
||||
$outsize = $this->out_color_table_size;
|
||||
} else {
|
||||
$outtable = $this->local_in;
|
||||
$outsize = $size;
|
||||
$outsizecode = $sizecode;
|
||||
}
|
||||
}
|
||||
$use_trans = false;
|
||||
if($this->transparent) {
|
||||
for($i = 0; $i < $outsize; $i++) {
|
||||
if($outtable[3 * $i] == $this->trans1 && $outtable [3 * $i + 1] == $this->trans2 && $outtable [3 * $i + 2] == $this->trans3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($i < $outsize) {
|
||||
$transindex = $i;
|
||||
$use_trans = true;
|
||||
}
|
||||
}
|
||||
if($this->delay || $use_trans) {
|
||||
$this->buffer[0] = 0x21;
|
||||
$this->buffer[1] = 0xf9;
|
||||
$this->buffer[2] = 0x04;
|
||||
$this->buffer[3] = ($this->disposal << 2) + ($use_trans ? 1 : 0);
|
||||
$this->buffer[4] = $this->delay & 0xff;
|
||||
$this->buffer[5] = ($this->delay & 0xff00) >> 8;
|
||||
$this->buffer[6] = $use_trans ? $transindex : 0;
|
||||
$this->buffer[7] = 0x00;
|
||||
$this->putbytes($this->buffer,8);
|
||||
}
|
||||
$this->buffer[0] = 0x2c;
|
||||
$this->putbytes($this->buffer,1);
|
||||
$head[0] = $this->x & 0xff;
|
||||
$head[1] = ($this->x & 0xff00) >> 8;
|
||||
$head[2] = $this->y & 0xff;
|
||||
$head[3] = ($this->y & 0xff00) >> 8;
|
||||
$head[8] &= 0x40;
|
||||
if($outtable != $this->global_out) {
|
||||
$head[8] |= 0x80;
|
||||
$head[8] |= $outsizecode;
|
||||
}
|
||||
$this->putbytes($head,9);
|
||||
if($outtable != $this->global_out) {
|
||||
$this->putbytes($outtable, (3 * $outsize));
|
||||
}
|
||||
$this->getbytes(1);
|
||||
$this->putbytes($this->buffer,1);
|
||||
for(;;) {
|
||||
$this->getbytes(1);
|
||||
$this->putbytes($this->buffer,1);
|
||||
if(($u = $this->buffer[0]) == 0) {
|
||||
break;
|
||||
}
|
||||
$this->getbytes($u);
|
||||
$this->putbytes($this->buffer, $u);
|
||||
}
|
||||
}
|
||||
|
||||
function read_extension() {
|
||||
$this->getbytes(1);
|
||||
switch($this->buffer[0]) {
|
||||
case 0xf9:
|
||||
$this->getbytes(6);
|
||||
break;
|
||||
case 0xfe:
|
||||
for(;;) {
|
||||
$this->getbytes(1);
|
||||
if(($u = $this->buffer[0]) == 0) {
|
||||
break;
|
||||
}
|
||||
$this->getbytes($u);
|
||||
}
|
||||
break;
|
||||
case 0x01:
|
||||
$this->getbytes(13);
|
||||
for(;;) {
|
||||
$this->getbytes(0);
|
||||
if(($u = $this->buffer[0]) == 0) {
|
||||
break;
|
||||
}
|
||||
$this->getbytes($u);
|
||||
}
|
||||
break;
|
||||
case 0xff:
|
||||
$this->getbytes(9);
|
||||
$this->getbytes(3);
|
||||
for(;;) {
|
||||
$this->getbytes(1);
|
||||
if(!$this->buffer[0]) {
|
||||
break;
|
||||
}
|
||||
$this->getbytes($this->buffer[0]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
for(;;) {
|
||||
$this->getbytes(1);
|
||||
if(!$this->buffer[0]) {
|
||||
break;
|
||||
}
|
||||
$this->getbytes($this->buffer[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function arrcmp($b, $s, $l) {
|
||||
for($i = 0; $i < $l; $i++) {
|
||||
if($s{$i} != $b{$i}) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function getbytes($l) {
|
||||
for($i = 0; $i < $l; $i++) {
|
||||
if($this->mod == 'C_FILE') {
|
||||
$bin = unpack('C*', fread($this->fin, 1));
|
||||
$this->buffer[$i] = $bin[1];
|
||||
} elseif($this->mod == 'C_MEMORY') {
|
||||
$bin = unpack('C*', substr($this->fin, $this->ch, 1));
|
||||
$this->buffer[$i] = $bin[1];
|
||||
$this->ch++;
|
||||
}
|
||||
}
|
||||
return $this->buffer;
|
||||
}
|
||||
|
||||
function putbytes($s, $l) {
|
||||
for($i = 0; $i < $l; $i++) {
|
||||
$this->fout .= pack('C*', $s[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
function getAnimation() {
|
||||
return $this->fout;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,471 +1,472 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the ImagePalette package.
|
||||
*
|
||||
* (c) Brian McDonald <brian@brianmcdonald.io>
|
||||
* (c) gandalfx - https://github.com/gandalfx
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class ImagePalette
|
||||
*
|
||||
* Gets the prominent colors in a given image. To get common color matching, all pixels are matched
|
||||
* against a white-listed color palette.
|
||||
*
|
||||
* @package BrianMcdo\ImagePalette
|
||||
*/
|
||||
class ImagePalette implements IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* File or Url
|
||||
* @var string
|
||||
*/
|
||||
protected $file;
|
||||
|
||||
/**
|
||||
* Loaded Image
|
||||
* @var object
|
||||
*/
|
||||
protected $loadedImage;
|
||||
|
||||
/**
|
||||
* Process every Nth pixel
|
||||
* @var int
|
||||
*/
|
||||
protected $precision;
|
||||
|
||||
/**
|
||||
* Width of image
|
||||
* @var integer
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Height of image
|
||||
* @var integer
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Number of colors to return
|
||||
* @var integer
|
||||
*/
|
||||
protected $paletteLength;
|
||||
|
||||
/**
|
||||
* Colors Whitelist
|
||||
* @var array
|
||||
*/
|
||||
/* protected $whiteList = array(
|
||||
0x660000, 0x990000, 0xcc0000, 0xcc3333, 0xea4c88, 0x993399,
|
||||
0x663399, 0x333399, 0x0066cc, 0x0099cc, 0x66cccc, 0x77cc33,
|
||||
0x669900, 0x336600, 0x666600, 0x999900, 0xcccc33, 0xffff00,
|
||||
0xffcc33, 0xff9900, 0xff6600, 0xcc6633, 0x996633, 0x663300,
|
||||
0x000000, 0x999999, 0xcccccc, 0xffffff, 0xE7D8B1, 0xFDADC7,
|
||||
0x424153, 0xABBCDA, 0xF5DD01
|
||||
);*/
|
||||
protected $whiteList = array(
|
||||
0x111111,0xFFFFFF,0x9E9E9E,0xA48057,0xFC85B3,0xFF2727,0xFFA34B,0xFFD534,0x47C595,0x51C4C4,0x2B76E7,0x6D50ED
|
||||
);
|
||||
protected $whiteList1 = array();
|
||||
/**
|
||||
* Colors that were found to be prominent
|
||||
* Array of Color objects
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $palette;
|
||||
|
||||
protected $colorNumber;
|
||||
|
||||
/**
|
||||
* Library used
|
||||
* Supported are GD and Imagick
|
||||
* @var string
|
||||
*/
|
||||
protected $lib;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param string $file
|
||||
* @param int $precision
|
||||
* @param int $paletteLength
|
||||
* @param string $library
|
||||
*/
|
||||
public function __construct($file, $precision = 10, $paletteLength = 5, $library = 'gd',$whiteList=array())
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->precision = $precision;
|
||||
$this->paletteLength = $paletteLength;
|
||||
|
||||
// use provided libname or auto-detect
|
||||
$this->lib = $this->graphicsLibrary($library);
|
||||
|
||||
// create an array with color ints as keys
|
||||
$this->whiteList = array_fill_keys($whiteList?$whiteList:$this->whiteList, 0);
|
||||
$this->whiteList1 = array_fill_keys($whiteList?$whiteList:$this->whiteList, array());
|
||||
|
||||
$this->process($this->lib);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select graphics library to use for processing
|
||||
*
|
||||
* @param string $lib
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function graphicsLibrary($lib = 'gd')
|
||||
{
|
||||
$libraries = [
|
||||
'gd' => 'GD',
|
||||
'imagick' => 'Imagick',
|
||||
//'gmagick' => [false, 'Gmagick']
|
||||
];
|
||||
|
||||
if( ! array_key_exists($lib, $libraries))
|
||||
{
|
||||
throw new Exception('This extension specified is not supported.');
|
||||
}
|
||||
|
||||
if( ! extension_loaded($lib))
|
||||
{
|
||||
throw new Exception('This extension is not installed');
|
||||
}
|
||||
|
||||
return $libraries[$lib];
|
||||
}
|
||||
|
||||
/**
|
||||
* Select a graphical library and start generating the Image Palette
|
||||
* @param string $lib
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function process($lib)
|
||||
{
|
||||
if(!$this->{'setWorkingImage' . $lib} ()) return false;
|
||||
$this->{'setImagesize' . $lib} ();
|
||||
|
||||
$this->readPixels();
|
||||
$ps=array_keys($this->whiteList);
|
||||
// sort whiteList
|
||||
arsort($this->whiteList1);
|
||||
$total=0;
|
||||
foreach($this->whiteList as $key => $v){
|
||||
$total+=intval($v);
|
||||
}
|
||||
//print_r($this->whiteList);exit('ddd');
|
||||
$arr=array();
|
||||
$arr1=array();
|
||||
foreach($this->whiteList1 as $key =>$val){
|
||||
if(!($this->whiteList[$key])) continue;
|
||||
arsort($val);
|
||||
$v=array_keys($val);
|
||||
$arr[$v[0]]=round(($this->whiteList[$key]/$total)*100,2);
|
||||
$arr1[$v[0]]=array_search($key,$ps);
|
||||
}
|
||||
|
||||
$arr=array_slice($arr,0,$this->paletteLength,true);
|
||||
$arr1=array_slice($arr1,0,$this->paletteLength,true);
|
||||
|
||||
$this->palette=$arr;
|
||||
$this->colorNumber=$arr1;
|
||||
|
||||
// sort whiteList accordingly
|
||||
// $this->filter($arr);
|
||||
|
||||
/*array_map(
|
||||
function($color) {
|
||||
return new Color($color);
|
||||
},
|
||||
array_keys($arr)
|
||||
);*/
|
||||
|
||||
}
|
||||
public function getPalette(){
|
||||
return $this->palette;
|
||||
}
|
||||
public function getColorNumber(){
|
||||
return $this->colorNumber;
|
||||
}
|
||||
|
||||
public function getWhiteList1(){
|
||||
return $this->whiteList1;
|
||||
}
|
||||
public function getWidth(){
|
||||
return $this->width;
|
||||
}
|
||||
public function getHeight(){
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set the working image.
|
||||
*/
|
||||
protected function setWorkingImageGD()
|
||||
{
|
||||
//$extension = 'jpg';//pathinfo($this->file, PATHINFO_EXTENSION);
|
||||
$info=@getimagesize($this->file);
|
||||
switch ($info['mime'])
|
||||
{
|
||||
case 'image/png':
|
||||
$this->loadedImage = imagecreatefrompng($this->file);
|
||||
break;
|
||||
|
||||
case 'image/jpeg':
|
||||
$this->loadedImage = imagecreatefromjpeg($this->file);
|
||||
break;
|
||||
|
||||
case 'image/gif':
|
||||
$this->loadedImage = imagecreatefromgif($this->file);
|
||||
break;
|
||||
default:
|
||||
throw new Exception("The file type .$extension is not supported.");
|
||||
}
|
||||
return ture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set working image
|
||||
*
|
||||
* @todo needs work
|
||||
* @return mixed
|
||||
*/
|
||||
protected function setWorkingImageImagick()
|
||||
{
|
||||
$file = file_get_contents($this->file);
|
||||
$temp = tempnam("/tmp", uniqid("ImagePalette_", true));
|
||||
if(!file_put_contents($temp, $file)) return false;
|
||||
$this->loadedImage = new Imagick($temp);
|
||||
$this->loadedImage ->thumbnailImage(64,64,true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set working image
|
||||
*
|
||||
* @todo needs work
|
||||
* @throws \Exception
|
||||
* @return mixed
|
||||
*/
|
||||
protected function setWorkingImageGmagick()
|
||||
{
|
||||
throw new Exception("Gmagick not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and set size of the image using GD.
|
||||
*/
|
||||
protected function setImageSizeGD()
|
||||
{
|
||||
list($this->width, $this->height) = getimagesize($this->file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and set size of image using ImageMagick.
|
||||
*/
|
||||
protected function setImageSizeImagick()
|
||||
{
|
||||
$d = $this->loadedImage->getImageGeometry();
|
||||
|
||||
$this->width = $d['width'];
|
||||
$this->height = $d['height'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* For each interesting pixel, add its closest color to the loaded colors array
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function readPixels()
|
||||
{
|
||||
// Row
|
||||
for ($x = 0; $x < $this->width; $x += $this->precision)
|
||||
{
|
||||
// Column
|
||||
for ($y = 0; $y < $this->height; $y += $this->precision)
|
||||
{
|
||||
|
||||
$color = $this->getPixelColor($x, $y);
|
||||
|
||||
// transparent pixels don't really have a color
|
||||
if ($color->isTransparent())
|
||||
continue 1;
|
||||
// increment closes whiteList color (key)
|
||||
$this->whiteList[ $this->getClosestColor($color) ]++;
|
||||
//$this->whiteList1[$color->toInt()]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get closest matching color
|
||||
*
|
||||
* @param Color $color
|
||||
* @return int
|
||||
*/
|
||||
protected function getClosestColor(Color $color)
|
||||
{
|
||||
$cint=$color->toInt();
|
||||
|
||||
$bestDiff = PHP_INT_MAX;
|
||||
|
||||
// default to black so hhvm won't cry
|
||||
$bestColor = 0x000000;
|
||||
$rgbarr=array();
|
||||
foreach ($this->whiteList as $wlColor => $hits)
|
||||
{
|
||||
|
||||
// calculate difference (don't sqrt)
|
||||
$diff = $color->getDiff($wlColor);
|
||||
|
||||
// see if we got a new best
|
||||
if ($diff < $bestDiff)
|
||||
{
|
||||
$bestDiff = $diff;
|
||||
$bestColor = $wlColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!isset( $this->whiteList1[$bestColor][$cint])) $this->whiteList1[$bestColor][$cint]=1;
|
||||
else {
|
||||
$this->whiteList1[$bestColor][$cint]++;
|
||||
}
|
||||
return $bestColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array describing the color at x,y
|
||||
* At index 0 is the color as a whole int (may include alpha)
|
||||
* At index 1 is the color's red value
|
||||
* At index 2 is the color's green value
|
||||
* At index 3 is the color's blue value
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColor($x, $y)
|
||||
{
|
||||
return $this->{'getPixelColor' . $this->lib} ($x, $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Using to retrieve color information about a specified pixel
|
||||
*
|
||||
* @see getPixelColor()
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColorGD($x, $y)
|
||||
{
|
||||
$color = imagecolorat($this->loadedImage, $x, $y);
|
||||
|
||||
return new Color (
|
||||
$color
|
||||
// $rgb['red'],
|
||||
// $rgb['green'],
|
||||
// $rgb['blue']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Using to retrieve color information about a specified pixel
|
||||
*
|
||||
* @see getPixelColor()
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColorImagick($x, $y)
|
||||
{
|
||||
$rgb = $this->loadedImage->getImagePixelColor($x, $y)->getColor();
|
||||
foreach($rgb as $k => $v){
|
||||
if($v<0) $v=0;
|
||||
$rgb[$k]=$v;
|
||||
}
|
||||
|
||||
return new Color([
|
||||
$rgb['r'],
|
||||
$rgb['g'],
|
||||
$rgb['b'],
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getPixelColorGmagick($x, $y)
|
||||
{
|
||||
throw new Exception("Gmagick not supported: ($x, $y)");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of Color objects
|
||||
*
|
||||
* @param int $paletteLength
|
||||
* @return array
|
||||
*/
|
||||
public function getColors($paletteLength = null)
|
||||
{
|
||||
// allow custom length calls
|
||||
if ( ! is_numeric($paletteLength))
|
||||
{
|
||||
$paletteLength = $this->paletteLength;
|
||||
}
|
||||
|
||||
// take the best hits
|
||||
return array_slice($this->palette, 0, $paletteLength, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a json encoded version of the palette
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
// Color PHP 5.3 compatible -> not JsonSerializable :(
|
||||
return json_encode(array_map(
|
||||
function($color) {
|
||||
return (string) $color;
|
||||
},
|
||||
$this->getColors()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient getter access as properties
|
||||
*
|
||||
* @param $name
|
||||
* @throws \Exception
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
$method = 'get' . ucfirst($name);
|
||||
|
||||
if (method_exists($this, $method))
|
||||
{
|
||||
return $this->$method();
|
||||
}
|
||||
|
||||
throw new Exception("Method $method does not exist");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the palette for implementation of the IteratorAggregate interface
|
||||
* Used in foreach loops
|
||||
*
|
||||
* @see getColors()
|
||||
* @return \ArrayIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->getColors());
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the ImagePalette package.
|
||||
*
|
||||
* (c) Brian McDonald <brian@brianmcdonald.io>
|
||||
* (c) gandalfx - https://github.com/gandalfx
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class ImagePalette
|
||||
*
|
||||
* Gets the prominent colors in a given image. To get common color matching, all pixels are matched
|
||||
* against a white-listed color palette.
|
||||
*
|
||||
* @package BrianMcdo\ImagePalette
|
||||
*/
|
||||
class ImagePalette implements IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* File or Url
|
||||
* @var string
|
||||
*/
|
||||
protected $file;
|
||||
|
||||
/**
|
||||
* Loaded Image
|
||||
* @var object
|
||||
*/
|
||||
protected $loadedImage;
|
||||
|
||||
/**
|
||||
* Process every Nth pixel
|
||||
* @var int
|
||||
*/
|
||||
protected $precision;
|
||||
|
||||
/**
|
||||
* Width of image
|
||||
* @var integer
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Height of image
|
||||
* @var integer
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Number of colors to return
|
||||
* @var integer
|
||||
*/
|
||||
protected $paletteLength;
|
||||
|
||||
/**
|
||||
* Colors Whitelist
|
||||
* @var array
|
||||
*/
|
||||
/* protected $whiteList = array(
|
||||
0x660000, 0x990000, 0xcc0000, 0xcc3333, 0xea4c88, 0x993399,
|
||||
0x663399, 0x333399, 0x0066cc, 0x0099cc, 0x66cccc, 0x77cc33,
|
||||
0x669900, 0x336600, 0x666600, 0x999900, 0xcccc33, 0xffff00,
|
||||
0xffcc33, 0xff9900, 0xff6600, 0xcc6633, 0x996633, 0x663300,
|
||||
0x000000, 0x999999, 0xcccccc, 0xffffff, 0xE7D8B1, 0xFDADC7,
|
||||
0x424153, 0xABBCDA, 0xF5DD01
|
||||
);*/
|
||||
protected $whiteList = array(
|
||||
0x111111,0xFFFFFF,0x9E9E9E,0xA48057,0xFC85B3,0xFF2727,0xFFA34B,0xFFD534,0x47C595,0x51C4C4,0x2B76E7,0x6D50ED
|
||||
);
|
||||
protected $whiteList1 = array();
|
||||
/**
|
||||
* Colors that were found to be prominent
|
||||
* Array of Color objects
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $palette;
|
||||
|
||||
protected $colorNumber;
|
||||
|
||||
/**
|
||||
* Library used
|
||||
* Supported are GD and Imagick
|
||||
* @var string
|
||||
*/
|
||||
protected $lib;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param string $file
|
||||
* @param int $precision
|
||||
* @param int $paletteLength
|
||||
* @param string $library
|
||||
*/
|
||||
public function __construct($file, $precision = 10, $paletteLength = 5, $library = 'gd',$whiteList=array())
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->precision = $precision;
|
||||
$this->paletteLength = $paletteLength;
|
||||
|
||||
// use provided libname or auto-detect
|
||||
$this->lib = $this->graphicsLibrary($library);
|
||||
|
||||
// create an array with color ints as keys
|
||||
$this->whiteList = array_fill_keys($whiteList?$whiteList:$this->whiteList, 0);
|
||||
$this->whiteList1 = array_fill_keys($whiteList?$whiteList:$this->whiteList, array());
|
||||
|
||||
$this->process($this->lib);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select graphics library to use for processing
|
||||
*
|
||||
* @param string $lib
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function graphicsLibrary($lib = 'gd')
|
||||
{
|
||||
$libraries = [
|
||||
'gd' => 'GD',
|
||||
'imagick' => 'Imagick',
|
||||
//'gmagick' => [false, 'Gmagick']
|
||||
];
|
||||
|
||||
if( ! array_key_exists($lib, $libraries))
|
||||
{
|
||||
throw new Exception('This extension specified is not supported.');
|
||||
}
|
||||
|
||||
if( ! extension_loaded($lib))
|
||||
{
|
||||
throw new Exception('This extension is not installed');
|
||||
}
|
||||
|
||||
return $libraries[$lib];
|
||||
}
|
||||
|
||||
/**
|
||||
* Select a graphical library and start generating the Image Palette
|
||||
* @param string $lib
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function process($lib)
|
||||
{
|
||||
if(!$this->{'setWorkingImage' . $lib} ()) return false;
|
||||
$this->{'setImagesize' . $lib} ();
|
||||
|
||||
$this->readPixels();
|
||||
$ps=array_keys($this->whiteList);
|
||||
// sort whiteList
|
||||
arsort($this->whiteList1);
|
||||
$total=0;
|
||||
foreach($this->whiteList as $key => $v){
|
||||
$total+=intval($v);
|
||||
}
|
||||
//print_r($this->whiteList);exit('ddd');
|
||||
$arr=array();
|
||||
$arr1=array();
|
||||
foreach($this->whiteList1 as $key =>$val){
|
||||
if(!($this->whiteList[$key])) continue;
|
||||
arsort($val);
|
||||
$v=array_keys($val);
|
||||
$arr[$v[0]]=round(($this->whiteList[$key]/$total)*100,2);
|
||||
$arr1[$v[0]]=array_search($key,$ps);
|
||||
}
|
||||
|
||||
$arr=array_slice($arr,0,$this->paletteLength,true);
|
||||
$arr1=array_slice($arr1,0,$this->paletteLength,true);
|
||||
|
||||
$this->palette=$arr;
|
||||
$this->colorNumber=$arr1;
|
||||
|
||||
// sort whiteList accordingly
|
||||
// $this->filter($arr);
|
||||
|
||||
/*array_map(
|
||||
function($color) {
|
||||
return new Color($color);
|
||||
},
|
||||
array_keys($arr)
|
||||
);*/
|
||||
|
||||
}
|
||||
public function getPalette(){
|
||||
return $this->palette;
|
||||
}
|
||||
public function getColorNumber(){
|
||||
return $this->colorNumber;
|
||||
}
|
||||
|
||||
public function getWhiteList1(){
|
||||
return $this->whiteList1;
|
||||
}
|
||||
public function getWidth(){
|
||||
return $this->width;
|
||||
}
|
||||
public function getHeight(){
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set the working image.
|
||||
*/
|
||||
protected function setWorkingImageGD()
|
||||
{
|
||||
//$extension = 'jpg';//pathinfo($this->file, PATHINFO_EXTENSION);
|
||||
$info=@getimagesize($this->file);
|
||||
switch ($info['mime'])
|
||||
{
|
||||
case 'image/png':
|
||||
$this->loadedImage = imagecreatefrompng($this->file);
|
||||
break;
|
||||
|
||||
case 'image/jpeg':
|
||||
$this->loadedImage = imagecreatefromjpeg($this->file);
|
||||
break;
|
||||
|
||||
case 'image/gif':
|
||||
$this->loadedImage = imagecreatefromgif($this->file);
|
||||
break;
|
||||
default:
|
||||
throw new Exception("The file type .$extension is not supported.");
|
||||
}
|
||||
return ture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set working image
|
||||
*
|
||||
* @todo needs work
|
||||
* @return mixed
|
||||
*/
|
||||
protected function setWorkingImageImagick()
|
||||
{
|
||||
$file = file_get_contents($this->file);
|
||||
$temp = tempnam(DZZ_ROOT.'./data/attachment/cache', uniqid("ImagePalette_", true));
|
||||
if(!file_put_contents($temp, $file)) return false;
|
||||
$this->loadedImage = new Imagick($temp);
|
||||
$this->loadedImage ->thumbnailImage(64,64,true);
|
||||
@unlink($temp);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set working image
|
||||
*
|
||||
* @todo needs work
|
||||
* @throws \Exception
|
||||
* @return mixed
|
||||
*/
|
||||
protected function setWorkingImageGmagick()
|
||||
{
|
||||
throw new Exception("Gmagick not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and set size of the image using GD.
|
||||
*/
|
||||
protected function setImageSizeGD()
|
||||
{
|
||||
list($this->width, $this->height) = getimagesize($this->file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and set size of image using ImageMagick.
|
||||
*/
|
||||
protected function setImageSizeImagick()
|
||||
{
|
||||
$d = $this->loadedImage->getImageGeometry();
|
||||
|
||||
$this->width = $d['width'];
|
||||
$this->height = $d['height'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* For each interesting pixel, add its closest color to the loaded colors array
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function readPixels()
|
||||
{
|
||||
// Row
|
||||
for ($x = 0; $x < $this->width; $x += $this->precision)
|
||||
{
|
||||
// Column
|
||||
for ($y = 0; $y < $this->height; $y += $this->precision)
|
||||
{
|
||||
|
||||
$color = $this->getPixelColor($x, $y);
|
||||
|
||||
// transparent pixels don't really have a color
|
||||
if ($color->isTransparent())
|
||||
continue 1;
|
||||
// increment closes whiteList color (key)
|
||||
$this->whiteList[ $this->getClosestColor($color) ]++;
|
||||
//$this->whiteList1[$color->toInt()]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get closest matching color
|
||||
*
|
||||
* @param Color $color
|
||||
* @return int
|
||||
*/
|
||||
protected function getClosestColor(Color $color)
|
||||
{
|
||||
$cint=$color->toInt();
|
||||
|
||||
$bestDiff = PHP_INT_MAX;
|
||||
|
||||
// default to black so hhvm won't cry
|
||||
$bestColor = 0x000000;
|
||||
$rgbarr=array();
|
||||
foreach ($this->whiteList as $wlColor => $hits)
|
||||
{
|
||||
|
||||
// calculate difference (don't sqrt)
|
||||
$diff = $color->getDiff($wlColor);
|
||||
|
||||
// see if we got a new best
|
||||
if ($diff < $bestDiff)
|
||||
{
|
||||
$bestDiff = $diff;
|
||||
$bestColor = $wlColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!isset( $this->whiteList1[$bestColor][$cint])) $this->whiteList1[$bestColor][$cint]=1;
|
||||
else {
|
||||
$this->whiteList1[$bestColor][$cint]++;
|
||||
}
|
||||
return $bestColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array describing the color at x,y
|
||||
* At index 0 is the color as a whole int (may include alpha)
|
||||
* At index 1 is the color's red value
|
||||
* At index 2 is the color's green value
|
||||
* At index 3 is the color's blue value
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColor($x, $y)
|
||||
{
|
||||
return $this->{'getPixelColor' . $this->lib} ($x, $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Using to retrieve color information about a specified pixel
|
||||
*
|
||||
* @see getPixelColor()
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColorGD($x, $y)
|
||||
{
|
||||
$color = imagecolorat($this->loadedImage, $x, $y);
|
||||
|
||||
return new Color (
|
||||
$color
|
||||
// $rgb['red'],
|
||||
// $rgb['green'],
|
||||
// $rgb['blue']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Using to retrieve color information about a specified pixel
|
||||
*
|
||||
* @see getPixelColor()
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColorImagick($x, $y)
|
||||
{
|
||||
$rgb = $this->loadedImage->getImagePixelColor($x, $y)->getColor();
|
||||
foreach($rgb as $k => $v){
|
||||
if($v<0) $v=0;
|
||||
$rgb[$k]=$v;
|
||||
}
|
||||
|
||||
return new Color([
|
||||
$rgb['r'],
|
||||
$rgb['g'],
|
||||
$rgb['b'],
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getPixelColorGmagick($x, $y)
|
||||
{
|
||||
throw new Exception("Gmagick not supported: ($x, $y)");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of Color objects
|
||||
*
|
||||
* @param int $paletteLength
|
||||
* @return array
|
||||
*/
|
||||
public function getColors($paletteLength = null)
|
||||
{
|
||||
// allow custom length calls
|
||||
if ( ! is_numeric($paletteLength))
|
||||
{
|
||||
$paletteLength = $this->paletteLength;
|
||||
}
|
||||
|
||||
// take the best hits
|
||||
return array_slice($this->palette, 0, $paletteLength, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a json encoded version of the palette
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
// Color PHP 5.3 compatible -> not JsonSerializable :(
|
||||
return json_encode(array_map(
|
||||
function($color) {
|
||||
return (string) $color;
|
||||
},
|
||||
$this->getColors()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient getter access as properties
|
||||
*
|
||||
* @param $name
|
||||
* @throws \Exception
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
$method = 'get' . ucfirst($name);
|
||||
|
||||
if (method_exists($this, $method))
|
||||
{
|
||||
return $this->$method();
|
||||
}
|
||||
|
||||
throw new Exception("Method $method does not exist");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the palette for implementation of the IteratorAggregate interface
|
||||
* Used in foreach loops
|
||||
*
|
||||
* @see getColors()
|
||||
* @return \ArrayIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->getColors());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,99 +1,99 @@
|
||||
<?php
|
||||
class JSSDK {
|
||||
private $appId;
|
||||
private $appSecret;
|
||||
private $qy;
|
||||
public function __construct($appId, $appSecret,$qy=1) {
|
||||
$this->appId = $appId;
|
||||
$this->appSecret = $appSecret;
|
||||
$this->qy=$qy;
|
||||
}
|
||||
|
||||
public function getSignPackage() {
|
||||
|
||||
$jsapiTicket = $this->getJsApiTicket();
|
||||
// 注意 URL 一定要动态获取,不能 hardcode.
|
||||
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
|
||||
$url = "$protocol$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||
|
||||
$timestamp = time();
|
||||
$nonceStr = $this->createNonceStr();
|
||||
|
||||
// 这里参数的顺序要按照 key 值 ASCII 码升序排序
|
||||
$string = "jsapi_ticket=$jsapiTicket&noncestr=$nonceStr×tamp=$timestamp&url=$url";
|
||||
|
||||
$signature = sha1($string);
|
||||
|
||||
$signPackage = array(
|
||||
"appId" => $this->appId,
|
||||
"nonceStr" => $nonceStr,
|
||||
"timestamp" => $timestamp,
|
||||
"url" => $url,
|
||||
"signature" => $signature,
|
||||
"rawString" => $string
|
||||
);
|
||||
return $signPackage;
|
||||
}
|
||||
|
||||
private function createNonceStr($length = 16) {
|
||||
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
$str = "";
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
private function getJsApiTicket() {
|
||||
// jsapi_ticket 应该全局存储与更新
|
||||
if(loadcache('qy_jsapi_ticket') && ($ticket=authcode(getglobal('cache/qy_jsapi_ticket'),'DECODE',getglobal('setting/authkey')))){
|
||||
return $ticket;
|
||||
}
|
||||
|
||||
$accessToken = $this->getAccessToken();
|
||||
// 如果是企业号用以下 URL 获取 ticket
|
||||
if($this->qy) $url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=$accessToken";
|
||||
else $url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=$accessToken";
|
||||
$res = json_decode($this->httpGet($url));
|
||||
$ticket = $res->ticket;
|
||||
if ($ticket) {
|
||||
$expire = $res->expires_in ? intval($res->expires_in)-200 : 7000;
|
||||
savecache('qy_jsapi_ticket',authcode($ticket,'ENCODE',getglobal('setting/authkey'),$expire));
|
||||
return $ticket;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function getAccessToken() {
|
||||
// access_token 应该全局存储与更新
|
||||
if(loadcache('qy_access_token') && ($token=authcode(getglobal('cache/qy_access_token'),'DECODE',getglobal('setting/authkey')))){
|
||||
return $token;
|
||||
}
|
||||
// 如果是企业号用以下URL获取access_token
|
||||
if($this->qy) $url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$this->appId&corpsecret=$this->appSecret";
|
||||
else $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$this->appId&secret=$this->appSecret";
|
||||
$res = json_decode($this->httpGet($url));
|
||||
$access_token = $res->access_token;
|
||||
if ($access_token) {
|
||||
$expire = $res->expires_in ? intval($res->expires_in)-200 : 7000;
|
||||
//TODO: cache access_token
|
||||
savecache('qy_access_token',authcode($access_token,'ENCODE',getglobal('setting/authkey'),$expire));
|
||||
}
|
||||
return $access_token;
|
||||
}
|
||||
|
||||
private function httpGet($url) {
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
|
||||
$res = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
class JSSDK {
|
||||
private $appId;
|
||||
private $appSecret;
|
||||
private $qy;
|
||||
public function __construct($appId, $appSecret,$qy=1) {
|
||||
$this->appId = $appId;
|
||||
$this->appSecret = $appSecret;
|
||||
$this->qy=$qy;
|
||||
}
|
||||
|
||||
public function getSignPackage() {
|
||||
|
||||
$jsapiTicket = $this->getJsApiTicket();
|
||||
// 注意 URL 一定要动态获取,不能 hardcode.
|
||||
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
|
||||
$url = "$protocol$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||
|
||||
$timestamp = time();
|
||||
$nonceStr = $this->createNonceStr();
|
||||
|
||||
// 这里参数的顺序要按照 key 值 ASCII 码升序排序
|
||||
$string = "jsapi_ticket=$jsapiTicket&noncestr=$nonceStr×tamp=$timestamp&url=$url";
|
||||
|
||||
$signature = sha1($string);
|
||||
|
||||
$signPackage = array(
|
||||
"appId" => $this->appId,
|
||||
"nonceStr" => $nonceStr,
|
||||
"timestamp" => $timestamp,
|
||||
"url" => $url,
|
||||
"signature" => $signature,
|
||||
"rawString" => $string
|
||||
);
|
||||
return $signPackage;
|
||||
}
|
||||
|
||||
private function createNonceStr($length = 16) {
|
||||
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
$str = "";
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
private function getJsApiTicket() {
|
||||
// jsapi_ticket 应该全局存储与更新
|
||||
if(loadcache('qy_jsapi_ticket') && ($ticket=authcode(getglobal('cache/qy_jsapi_ticket'),'DECODE',getglobal('setting/authkey')))){
|
||||
return $ticket;
|
||||
}
|
||||
|
||||
$accessToken = $this->getAccessToken();
|
||||
// 如果是企业号用以下 URL 获取 ticket
|
||||
if($this->qy) $url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=$accessToken";
|
||||
else $url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=$accessToken";
|
||||
$res = json_decode($this->httpGet($url));
|
||||
$ticket = $res->ticket;
|
||||
if ($ticket) {
|
||||
$expire = $res->expires_in ? intval($res->expires_in)-200 : 7000;
|
||||
savecache('qy_jsapi_ticket',authcode($ticket,'ENCODE',getglobal('setting/authkey'),$expire));
|
||||
return $ticket;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function getAccessToken() {
|
||||
// access_token 应该全局存储与更新
|
||||
if(loadcache('qy_access_token') && ($token=authcode(getglobal('cache/qy_access_token'),'DECODE',getglobal('setting/authkey')))){
|
||||
return $token;
|
||||
}
|
||||
// 如果是企业号用以下URL获取access_token
|
||||
if($this->qy) $url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$this->appId&corpsecret=$this->appSecret";
|
||||
else $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$this->appId&secret=$this->appSecret";
|
||||
$res = json_decode($this->httpGet($url));
|
||||
$access_token = $res->access_token;
|
||||
if ($access_token) {
|
||||
$expire = $res->expires_in ? intval($res->expires_in)-200 : 7000;
|
||||
//TODO: cache access_token
|
||||
savecache('qy_access_token',authcode($access_token,'ENCODE',getglobal('setting/authkey'),$expire));
|
||||
}
|
||||
return $access_token;
|
||||
}
|
||||
|
||||
private function httpGet($url) {
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
|
||||
$res = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,109 +1,109 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class bbcode {
|
||||
|
||||
var $search_exp = array();
|
||||
var $replace_exp = array();
|
||||
var $search_str = array();
|
||||
var $replace_str = array();
|
||||
var $html_s_exp = array();
|
||||
var $html_r_exp = array();
|
||||
var $html_s_str = array();
|
||||
var $html_r_str = array();
|
||||
|
||||
function &instance() {
|
||||
static $object;
|
||||
if(empty($object)) {
|
||||
$object = new bbcode();
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
function bbcode() {
|
||||
}
|
||||
|
||||
function bbcode2html($message, $parseurl=0) {
|
||||
if(empty($this->search_exp)) {
|
||||
$this->search_exp = array(
|
||||
"/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is",
|
||||
"/\[url\]\s*(https?:\/\/|ftp:\/\/|gopher:\/\/|news:\/\/|telnet:\/\/|rtsp:\/\/|mms:\/\/|callto:\/\/|ed2k:\/\/){1}([^\[\"']+?)\s*\[\/url\]/i",
|
||||
"/\[em:([0-9]+):\]/i",
|
||||
);
|
||||
$this->replace_exp = array(
|
||||
"<div class=\"quote\"><blockquote>\\1</blockquote></div>",
|
||||
"<a href=\"\\1\\2\" target=\"_blank\">\\1\\2</a>",
|
||||
" <img src=\"".STATICURL."image/smiley/comcom/\\1.gif\" class=\"vm\"> "
|
||||
);
|
||||
$this->replace_exp[] = '$this->bb_img(\'\\1\')';
|
||||
$this->search_str = array('[b]', '[/b]','[i]', '[/i]', '[u]', '[/u]');
|
||||
$this->replace_str = array('<b>', '</b>', '<i>','</i>', '<u>', '</u>');
|
||||
}
|
||||
|
||||
if($parseurl==2) {
|
||||
$message = bbcode::parseurl($message);
|
||||
}
|
||||
|
||||
@$message = preg_replace($this->search_exp, $this->replace_exp, $message, 20);
|
||||
|
||||
if($parseurl==2) {
|
||||
@$message = preg_replace_callback("/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/is", array($this, 'bbcode2html_callback_bb_img_1'), $message, 20);
|
||||
}
|
||||
|
||||
@$message = str_replace($this->search_str, $this->replace_str, $message);
|
||||
return nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message));
|
||||
}
|
||||
|
||||
function bbcode2html_callback_bb_img_1($matches) {
|
||||
return $this->bb_img($matches[1]);
|
||||
}
|
||||
|
||||
function parseurl($message) {
|
||||
return preg_replace("/(?<=[^\]a-z0-9-=\"'\\/])((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/)([a-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+)/i", "[url]\\1\\3[/url]", ' '.$message);
|
||||
}
|
||||
|
||||
function html2bbcode($message) {
|
||||
|
||||
if(empty($this->html_s_exp)) {
|
||||
$this->html_s_exp = array(
|
||||
"/\<div class=\"quote\"\>\<blockquote\>(.*?)\<\/blockquote\>\<\/div\>/is",
|
||||
"/\<a href=\"(.+?)\".*?\<\/a\>/is",
|
||||
"/(\r\n|\n|\r)/",
|
||||
"/<br.*>/siU",
|
||||
"/[ \t]*\<img src=\"static\/image\/smiley\/comcom\/(.+?).gif\".*?\>[ \t]*/is",
|
||||
"/\s*\<img src=\"(.+?)\".*?\>\s*/is"
|
||||
);
|
||||
$this->html_r_exp = array(
|
||||
"[quote]\\1[/quote]",
|
||||
"\\1",
|
||||
'',
|
||||
"\n",
|
||||
"[em:\\1:]",
|
||||
"\n[img]\\1[/img]\n"
|
||||
);
|
||||
$this->html_s_str = array('<b>', '</b>', '<i>','</i>', '<u>', '</u>', ' ', ' ', ' ', '<', '>', '&');
|
||||
$this->html_r_str = array('[b]', '[/b]','[i]', '[/i]', '[u]', '[/u]', "\t", ' ', ' ', '<', '>', '&');
|
||||
}
|
||||
|
||||
@$message = str_replace($this->html_s_str, $this->html_r_str,
|
||||
preg_replace($this->html_s_exp, $this->html_r_exp, $message));
|
||||
|
||||
$message = dhtmlspecialchars($message);
|
||||
|
||||
return trim($message);
|
||||
}
|
||||
|
||||
function bb_img($url) {
|
||||
global $_G;
|
||||
|
||||
if(!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://'))) {
|
||||
$url = isset($_G['siteurl']) && !empty($_G['siteurl']) ? $_G['siteurl'].$url : 'http://'.$url;
|
||||
}
|
||||
$url = addslashes($url);
|
||||
return "<img src=\"$url\" class=\"vm\">";
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class bbcode {
|
||||
|
||||
var $search_exp = array();
|
||||
var $replace_exp = array();
|
||||
var $search_str = array();
|
||||
var $replace_str = array();
|
||||
var $html_s_exp = array();
|
||||
var $html_r_exp = array();
|
||||
var $html_s_str = array();
|
||||
var $html_r_str = array();
|
||||
|
||||
function &instance() {
|
||||
static $object;
|
||||
if(empty($object)) {
|
||||
$object = new bbcode();
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
function bbcode() {
|
||||
}
|
||||
|
||||
function bbcode2html($message, $parseurl=0) {
|
||||
if(empty($this->search_exp)) {
|
||||
$this->search_exp = array(
|
||||
"/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is",
|
||||
"/\[url\]\s*(https?:\/\/|ftp:\/\/|gopher:\/\/|news:\/\/|telnet:\/\/|rtsp:\/\/|mms:\/\/|callto:\/\/|ed2k:\/\/){1}([^\[\"']+?)\s*\[\/url\]/i",
|
||||
"/\[em:([0-9]+):\]/i",
|
||||
);
|
||||
$this->replace_exp = array(
|
||||
"<div class=\"quote\"><blockquote>\\1</blockquote></div>",
|
||||
"<a href=\"\\1\\2\" target=\"_blank\">\\1\\2</a>",
|
||||
" <img src=\"".STATICURL."image/smiley/comcom/\\1.gif\" class=\"vm\"> "
|
||||
);
|
||||
$this->replace_exp[] = '$this->bb_img(\'\\1\')';
|
||||
$this->search_str = array('[b]', '[/b]','[i]', '[/i]', '[u]', '[/u]');
|
||||
$this->replace_str = array('<b>', '</b>', '<i>','</i>', '<u>', '</u>');
|
||||
}
|
||||
|
||||
if($parseurl==2) {
|
||||
$message = bbcode::parseurl($message);
|
||||
}
|
||||
|
||||
@$message = preg_replace($this->search_exp, $this->replace_exp, $message, 20);
|
||||
|
||||
if($parseurl==2) {
|
||||
@$message = preg_replace_callback("/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/is", array($this, 'bbcode2html_callback_bb_img_1'), $message, 20);
|
||||
}
|
||||
|
||||
@$message = str_replace($this->search_str, $this->replace_str, $message);
|
||||
return nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message));
|
||||
}
|
||||
|
||||
function bbcode2html_callback_bb_img_1($matches) {
|
||||
return $this->bb_img($matches[1]);
|
||||
}
|
||||
|
||||
function parseurl($message) {
|
||||
return preg_replace("/(?<=[^\]a-z0-9-=\"'\\/])((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/)([a-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+)/i", "[url]\\1\\3[/url]", ' '.$message);
|
||||
}
|
||||
|
||||
function html2bbcode($message) {
|
||||
|
||||
if(empty($this->html_s_exp)) {
|
||||
$this->html_s_exp = array(
|
||||
"/\<div class=\"quote\"\>\<blockquote\>(.*?)\<\/blockquote\>\<\/div\>/is",
|
||||
"/\<a href=\"(.+?)\".*?\<\/a\>/is",
|
||||
"/(\r\n|\n|\r)/",
|
||||
"/<br.*>/siU",
|
||||
"/[ \t]*\<img src=\"static\/image\/smiley\/comcom\/(.+?).gif\".*?\>[ \t]*/is",
|
||||
"/\s*\<img src=\"(.+?)\".*?\>\s*/is"
|
||||
);
|
||||
$this->html_r_exp = array(
|
||||
"[quote]\\1[/quote]",
|
||||
"\\1",
|
||||
'',
|
||||
"\n",
|
||||
"[em:\\1:]",
|
||||
"\n[img]\\1[/img]\n"
|
||||
);
|
||||
$this->html_s_str = array('<b>', '</b>', '<i>','</i>', '<u>', '</u>', ' ', ' ', ' ', '<', '>', '&');
|
||||
$this->html_r_str = array('[b]', '[/b]','[i]', '[/i]', '[u]', '[/u]', "\t", ' ', ' ', '<', '>', '&');
|
||||
}
|
||||
|
||||
@$message = str_replace($this->html_s_str, $this->html_r_str,
|
||||
preg_replace($this->html_s_exp, $this->html_r_exp, $message));
|
||||
|
||||
$message = dhtmlspecialchars($message);
|
||||
|
||||
return trim($message);
|
||||
}
|
||||
|
||||
function bb_img($url) {
|
||||
global $_G;
|
||||
|
||||
if(!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://'))) {
|
||||
$url = isset($_G['siteurl']) && !empty($_G['siteurl']) ? $_G['siteurl'].$url : 'http://'.$url;
|
||||
}
|
||||
$url = addslashes($url);
|
||||
return "<img src=\"$url\" class=\"vm\">";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,323 +1,323 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Command
|
||||
*
|
||||
* This class represents a shell command.
|
||||
*
|
||||
* @author Michael Härtl <haertl.mike@gmail.com>
|
||||
* @version 1.0.5
|
||||
* @license http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
class command
|
||||
{
|
||||
/**
|
||||
* @var bool whether to escape any argument passed through addArg(). Default is true.
|
||||
*/
|
||||
public $escapeArgs = true;
|
||||
|
||||
/**
|
||||
* @var bool whether to escape the command passed to setCommand() or the constructor.
|
||||
* This is only useful if $escapeArgs is false. Default is false.
|
||||
*/
|
||||
public $escapeCommand = false;
|
||||
|
||||
/**
|
||||
* @var bool whether to use `exec()` instead of `proc_open()`. This can be used on Windows system
|
||||
* to workaround some quirks there. Note, that any errors from your command will be output directly
|
||||
* to the PHP output stream. `getStdErr()` will also not work anymore and thus you also won't get
|
||||
* the error output from `getError()` in this case. You also can't pass any environment
|
||||
* variables to the command if this is enabled. Default is false.
|
||||
*/
|
||||
public $useExec = false;
|
||||
|
||||
/**
|
||||
* @var bool whether to capture stderr (2>&1) when `useExec` is true. This will try to redirect the
|
||||
* stderr to stdout and provide the complete output of both in `getStdErr()` and `getError()`.
|
||||
* Default is `true`.
|
||||
*/
|
||||
public $captureStdErr = true;
|
||||
|
||||
/**
|
||||
* @var string|null the initial working dir for proc_open(). Default is null for current PHP working dir.
|
||||
*/
|
||||
public $procCwd;
|
||||
|
||||
/**
|
||||
* @var array|null an array with environment variables to pass to proc_open(). Default is null for none.
|
||||
*/
|
||||
public $procEnv;
|
||||
|
||||
/**
|
||||
* @var array|null an array of other_options for proc_open(). Default is null for none.
|
||||
*/
|
||||
public $procOptions;
|
||||
|
||||
/**
|
||||
* @var string the command to execute
|
||||
*/
|
||||
protected $_command;
|
||||
|
||||
/**
|
||||
* @var array the list of command arguments
|
||||
*/
|
||||
protected $_args = array();
|
||||
|
||||
/**
|
||||
* @var string the full command string to execute
|
||||
*/
|
||||
protected $_execCommand;
|
||||
|
||||
/**
|
||||
* @var string the stdout output
|
||||
*/
|
||||
protected $_stdOut = '';
|
||||
|
||||
/**
|
||||
* @var string the stderr output
|
||||
*/
|
||||
protected $_stdErr = '';
|
||||
|
||||
/**
|
||||
* @var int the exit code
|
||||
*/
|
||||
protected $_exitCode;
|
||||
|
||||
/**
|
||||
* @var string the error message
|
||||
*/
|
||||
protected $_error = '';
|
||||
|
||||
/**
|
||||
* @var bool whether the command was successfully executed
|
||||
*/
|
||||
protected $_executed = false;
|
||||
|
||||
/**
|
||||
* @param string|array $options either a command string or an options array (see setOptions())
|
||||
*/
|
||||
public function __construct($options = null)
|
||||
{
|
||||
if (is_array($options)) {
|
||||
$this->setOptions($options);
|
||||
} elseif (is_string($options)) {
|
||||
$this->setCommand($options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options array of name => value options that should be applied to the object
|
||||
* You can also pass options that use a setter, e.g. you can pass a 'fileName' option which
|
||||
* will be passed to setFileName().
|
||||
* @return Command for method chaining
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
foreach ($options as $key => $value) {
|
||||
if (property_exists($this, $key)) {
|
||||
$this->$key = $value;
|
||||
} else {
|
||||
$method = 'set'.ucfirst($key);
|
||||
if (method_exists($this, $method)) {
|
||||
call_user_func(array($this,$method), $value);
|
||||
} else {
|
||||
throw new \Exception("Unknown configuration option '$key'");
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $command the command or full command string to execute, like 'gzip' or 'gzip -d'.
|
||||
* You can still call addArg() to add more arguments to the command. If $escapeCommand was set to true,
|
||||
* the command gets escaped through escapeshellcmd().
|
||||
* @return Command for method chaining
|
||||
*/
|
||||
public function setCommand($command)
|
||||
{
|
||||
$this->_command = $this->escapeCommand ? escapeshellcmd($command) : $command;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null the command that was set through setCommand() or passed to the constructor. Null if none.
|
||||
*/
|
||||
public function getCommand()
|
||||
{
|
||||
return $this->_command;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|bool the full command string to execute. If no command was set with setCommand()
|
||||
* or passed to the constructor it will return false.
|
||||
*/
|
||||
public function getExecCommand()
|
||||
{
|
||||
if ($this->_execCommand===null) {
|
||||
$command = $this->getCommand();
|
||||
if (!$command) {
|
||||
$this->_error = 'Could not locate any executable command';
|
||||
return false;
|
||||
}
|
||||
$args = $this->getArgs();
|
||||
$this->_execCommand = $args ? $command.' '.$args : $command;
|
||||
}
|
||||
return $this->_execCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $args the command arguments as string. Note that these will not get escaped!
|
||||
* @return Command for method chaining
|
||||
*/
|
||||
public function setArgs($args)
|
||||
{
|
||||
$this->_args = array($args);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the command args that where set through setArgs() or added with addArg() separated by spaces
|
||||
*/
|
||||
public function getArgs()
|
||||
{
|
||||
return implode(' ', $this->_args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key the argument key to add e.g. `--feature` or `--name=`. If the key does not end with
|
||||
* and `=`, the $value will be separated by a space, if any. Keys are not escaped unless $value is null
|
||||
* and $escape is `true`.
|
||||
* @param string|array|null $value the optional argument value which will get escaped if $escapeArgs is true.
|
||||
* An array can be passed to add more than one value for a key, e.g. `addArg('--exclude', array('val1','val2'))`
|
||||
* which will create the option `--exclude 'val1' 'val2'`.
|
||||
* @param bool|null $escape if set, this overrides the $escapeArgs setting and enforces escaping/no escaping
|
||||
* @return Command for method chaining
|
||||
*/
|
||||
public function addArg($key, $value = null, $escape = null)
|
||||
{
|
||||
$old=setlocale(LC_ALL,0);
|
||||
setlocale(LC_ALL,'us');
|
||||
$doEscape = $escape!==null ? $escape : $this->escapeArgs;
|
||||
if ($value===null) {
|
||||
// Only escape single arguments if explicitely requested
|
||||
$this->_args[] = $escape ? escapeshellarg($key) : $key;
|
||||
} else {
|
||||
$separator = substr($key, -1)==='=' ? '' : ' ';
|
||||
if (is_array($value)) {
|
||||
$params = array();
|
||||
foreach ($value as $v) {
|
||||
$params[] = $doEscape ? escapeshellarg($v) : $v;
|
||||
}
|
||||
$this->_args[] = $key.$separator.implode(' ',$params);
|
||||
} else {
|
||||
$this->_args[] = $key.$separator.($doEscape ? escapeshellarg($value) : $value);
|
||||
}
|
||||
}
|
||||
//print_r($old);
|
||||
setlocale(LC_ALL,$old);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the command output (stdout). Empty if none.
|
||||
*/
|
||||
public function getOutput()
|
||||
{
|
||||
return $this->_stdOut;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the error message, either stderr or internal message. Empty if none.
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->_error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the stderr output. Empty if none.
|
||||
*/
|
||||
public function getStdErr()
|
||||
{
|
||||
return $this->_stdErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null the exit code or null if command was not executed yet
|
||||
*/
|
||||
public function getExitCode()
|
||||
{
|
||||
return $this->_exitCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string whether the command was successfully executed
|
||||
*/
|
||||
public function getExecuted()
|
||||
{
|
||||
return $this->_executed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the command
|
||||
*
|
||||
* @return bool whether execution was successful. If false, error details can be obtained through
|
||||
* getError(), getStdErr() and getExitCode().
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$command = $this->getExecCommand();
|
||||
|
||||
if (!$command) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->useExec) {
|
||||
$execCommand = $this->captureStdErr ? "$command 2>&1" : $command;
|
||||
exec($execCommand, $output, $this->_exitCode);
|
||||
$this->_stdOut = trim(implode("\n", $output));
|
||||
if ($this->_exitCode!==0) {
|
||||
$this->_stdErr = $this->_stdOut;
|
||||
$this->_error = empty($this->_stdErr) ? 'Command failed' : $this->_stdErr;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$descriptors = array(
|
||||
1 => array('pipe','w'),
|
||||
2 => array('pipe','a'),
|
||||
);
|
||||
$process = proc_open($command, $descriptors, $pipes, $this->procCwd, $this->procEnv, $this->procOptions);
|
||||
|
||||
if (is_resource($process)) {
|
||||
|
||||
$this->_stdOut = trim(stream_get_contents($pipes[1]));
|
||||
$this->_stdErr = trim(stream_get_contents($pipes[2]));
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
|
||||
$this->_exitCode = proc_close($process);
|
||||
|
||||
if ($this->_exitCode!==0) {
|
||||
$this->_error = $this->_stdErr ? $this->_stdErr : "Failed without error message: $command";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$this->_error = "Could not run command $command";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_executed = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the current command string to execute
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string)$this->getExecCommand();
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Command
|
||||
*
|
||||
* This class represents a shell command.
|
||||
*
|
||||
* @author Michael Härtl <haertl.mike@gmail.com>
|
||||
* @version 1.0.5
|
||||
* @license http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
class command
|
||||
{
|
||||
/**
|
||||
* @var bool whether to escape any argument passed through addArg(). Default is true.
|
||||
*/
|
||||
public $escapeArgs = true;
|
||||
|
||||
/**
|
||||
* @var bool whether to escape the command passed to setCommand() or the constructor.
|
||||
* This is only useful if $escapeArgs is false. Default is false.
|
||||
*/
|
||||
public $escapeCommand = false;
|
||||
|
||||
/**
|
||||
* @var bool whether to use `exec()` instead of `proc_open()`. This can be used on Windows system
|
||||
* to workaround some quirks there. Note, that any errors from your command will be output directly
|
||||
* to the PHP output stream. `getStdErr()` will also not work anymore and thus you also won't get
|
||||
* the error output from `getError()` in this case. You also can't pass any environment
|
||||
* variables to the command if this is enabled. Default is false.
|
||||
*/
|
||||
public $useExec = false;
|
||||
|
||||
/**
|
||||
* @var bool whether to capture stderr (2>&1) when `useExec` is true. This will try to redirect the
|
||||
* stderr to stdout and provide the complete output of both in `getStdErr()` and `getError()`.
|
||||
* Default is `true`.
|
||||
*/
|
||||
public $captureStdErr = true;
|
||||
|
||||
/**
|
||||
* @var string|null the initial working dir for proc_open(). Default is null for current PHP working dir.
|
||||
*/
|
||||
public $procCwd;
|
||||
|
||||
/**
|
||||
* @var array|null an array with environment variables to pass to proc_open(). Default is null for none.
|
||||
*/
|
||||
public $procEnv;
|
||||
|
||||
/**
|
||||
* @var array|null an array of other_options for proc_open(). Default is null for none.
|
||||
*/
|
||||
public $procOptions;
|
||||
|
||||
/**
|
||||
* @var string the command to execute
|
||||
*/
|
||||
protected $_command;
|
||||
|
||||
/**
|
||||
* @var array the list of command arguments
|
||||
*/
|
||||
protected $_args = array();
|
||||
|
||||
/**
|
||||
* @var string the full command string to execute
|
||||
*/
|
||||
protected $_execCommand;
|
||||
|
||||
/**
|
||||
* @var string the stdout output
|
||||
*/
|
||||
protected $_stdOut = '';
|
||||
|
||||
/**
|
||||
* @var string the stderr output
|
||||
*/
|
||||
protected $_stdErr = '';
|
||||
|
||||
/**
|
||||
* @var int the exit code
|
||||
*/
|
||||
protected $_exitCode;
|
||||
|
||||
/**
|
||||
* @var string the error message
|
||||
*/
|
||||
protected $_error = '';
|
||||
|
||||
/**
|
||||
* @var bool whether the command was successfully executed
|
||||
*/
|
||||
protected $_executed = false;
|
||||
|
||||
/**
|
||||
* @param string|array $options either a command string or an options array (see setOptions())
|
||||
*/
|
||||
public function __construct($options = null)
|
||||
{
|
||||
if (is_array($options)) {
|
||||
$this->setOptions($options);
|
||||
} elseif (is_string($options)) {
|
||||
$this->setCommand($options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options array of name => value options that should be applied to the object
|
||||
* You can also pass options that use a setter, e.g. you can pass a 'fileName' option which
|
||||
* will be passed to setFileName().
|
||||
* @return Command for method chaining
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
foreach ($options as $key => $value) {
|
||||
if (property_exists($this, $key)) {
|
||||
$this->$key = $value;
|
||||
} else {
|
||||
$method = 'set'.ucfirst($key);
|
||||
if (method_exists($this, $method)) {
|
||||
call_user_func(array($this,$method), $value);
|
||||
} else {
|
||||
throw new \Exception("Unknown configuration option '$key'");
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $command the command or full command string to execute, like 'gzip' or 'gzip -d'.
|
||||
* You can still call addArg() to add more arguments to the command. If $escapeCommand was set to true,
|
||||
* the command gets escaped through escapeshellcmd().
|
||||
* @return Command for method chaining
|
||||
*/
|
||||
public function setCommand($command)
|
||||
{
|
||||
$this->_command = $this->escapeCommand ? escapeshellcmd($command) : $command;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null the command that was set through setCommand() or passed to the constructor. Null if none.
|
||||
*/
|
||||
public function getCommand()
|
||||
{
|
||||
return $this->_command;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|bool the full command string to execute. If no command was set with setCommand()
|
||||
* or passed to the constructor it will return false.
|
||||
*/
|
||||
public function getExecCommand()
|
||||
{
|
||||
if ($this->_execCommand===null) {
|
||||
$command = $this->getCommand();
|
||||
if (!$command) {
|
||||
$this->_error = 'Could not locate any executable command';
|
||||
return false;
|
||||
}
|
||||
$args = $this->getArgs();
|
||||
$this->_execCommand = $args ? $command.' '.$args : $command;
|
||||
}
|
||||
return $this->_execCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $args the command arguments as string. Note that these will not get escaped!
|
||||
* @return Command for method chaining
|
||||
*/
|
||||
public function setArgs($args)
|
||||
{
|
||||
$this->_args = array($args);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the command args that where set through setArgs() or added with addArg() separated by spaces
|
||||
*/
|
||||
public function getArgs()
|
||||
{
|
||||
return implode(' ', $this->_args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key the argument key to add e.g. `--feature` or `--name=`. If the key does not end with
|
||||
* and `=`, the $value will be separated by a space, if any. Keys are not escaped unless $value is null
|
||||
* and $escape is `true`.
|
||||
* @param string|array|null $value the optional argument value which will get escaped if $escapeArgs is true.
|
||||
* An array can be passed to add more than one value for a key, e.g. `addArg('--exclude', array('val1','val2'))`
|
||||
* which will create the option `--exclude 'val1' 'val2'`.
|
||||
* @param bool|null $escape if set, this overrides the $escapeArgs setting and enforces escaping/no escaping
|
||||
* @return Command for method chaining
|
||||
*/
|
||||
public function addArg($key, $value = null, $escape = null)
|
||||
{
|
||||
$old=setlocale(LC_ALL,0);
|
||||
setlocale(LC_ALL,'us');
|
||||
$doEscape = $escape!==null ? $escape : $this->escapeArgs;
|
||||
if ($value===null) {
|
||||
// Only escape single arguments if explicitely requested
|
||||
$this->_args[] = $escape ? escapeshellarg($key) : $key;
|
||||
} else {
|
||||
$separator = substr($key, -1)==='=' ? '' : ' ';
|
||||
if (is_array($value)) {
|
||||
$params = array();
|
||||
foreach ($value as $v) {
|
||||
$params[] = $doEscape ? escapeshellarg($v) : $v;
|
||||
}
|
||||
$this->_args[] = $key.$separator.implode(' ',$params);
|
||||
} else {
|
||||
$this->_args[] = $key.$separator.($doEscape ? escapeshellarg($value) : $value);
|
||||
}
|
||||
}
|
||||
//print_r($old);
|
||||
setlocale(LC_ALL,$old);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the command output (stdout). Empty if none.
|
||||
*/
|
||||
public function getOutput()
|
||||
{
|
||||
return $this->_stdOut;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the error message, either stderr or internal message. Empty if none.
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->_error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the stderr output. Empty if none.
|
||||
*/
|
||||
public function getStdErr()
|
||||
{
|
||||
return $this->_stdErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null the exit code or null if command was not executed yet
|
||||
*/
|
||||
public function getExitCode()
|
||||
{
|
||||
return $this->_exitCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string whether the command was successfully executed
|
||||
*/
|
||||
public function getExecuted()
|
||||
{
|
||||
return $this->_executed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the command
|
||||
*
|
||||
* @return bool whether execution was successful. If false, error details can be obtained through
|
||||
* getError(), getStdErr() and getExitCode().
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$command = $this->getExecCommand();
|
||||
|
||||
if (!$command) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->useExec) {
|
||||
$execCommand = $this->captureStdErr ? "$command 2>&1" : $command;
|
||||
exec($execCommand, $output, $this->_exitCode);
|
||||
$this->_stdOut = trim(implode("\n", $output));
|
||||
if ($this->_exitCode!==0) {
|
||||
$this->_stdErr = $this->_stdOut;
|
||||
$this->_error = empty($this->_stdErr) ? 'Command failed' : $this->_stdErr;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$descriptors = array(
|
||||
1 => array('pipe','w'),
|
||||
2 => array('pipe','a'),
|
||||
);
|
||||
$process = proc_open($command, $descriptors, $pipes, $this->procCwd, $this->procEnv, $this->procOptions);
|
||||
|
||||
if (is_resource($process)) {
|
||||
|
||||
$this->_stdOut = trim(stream_get_contents($pipes[1]));
|
||||
$this->_stdErr = trim(stream_get_contents($pipes[2]));
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
|
||||
$this->_exitCode = proc_close($process);
|
||||
|
||||
if ($this->_exitCode!==0) {
|
||||
$this->_error = $this->_stdErr ? $this->_stdErr : "Failed without error message: $command";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$this->_error = "Could not run command $command";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_executed = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the current command string to execute
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string)$this->getExecCommand();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,393 +1,393 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class core
|
||||
{
|
||||
private static $_tables;
|
||||
private static $_tptables;
|
||||
private static $_imports;
|
||||
private static $_app;
|
||||
private static $_memory;
|
||||
|
||||
// 类名映射
|
||||
protected static $map = array();
|
||||
|
||||
//psr4
|
||||
private static $prefixLengthsPsr4 = array();
|
||||
private static $prefixDirsPsr4 = array();
|
||||
private static $fallbackDirsPsr4 = array();
|
||||
|
||||
public static function app($params=array()) {
|
||||
if(!is_object(self::$_app)) {
|
||||
self::$_app = dzz_app::instance($params);
|
||||
}
|
||||
return self::$_app;
|
||||
}
|
||||
|
||||
public static function creatapp() {
|
||||
|
||||
if(!is_object(self::$_app)) {
|
||||
|
||||
self::$_app = dzz_app::instance();
|
||||
}
|
||||
|
||||
return self::$_app;
|
||||
}
|
||||
|
||||
public static function t($name) {
|
||||
return self::_make_obj($name, 'table', DZZ_TABLE_EXTENDABLE);
|
||||
}
|
||||
|
||||
public static function tp_t($name) {
|
||||
return self::_tp_make_obj($name, 'table', DZZ_TABLE_EXTENDABLE);
|
||||
}
|
||||
|
||||
public static function m($name) {
|
||||
$args = array();
|
||||
if(func_num_args() > 1) {
|
||||
$args = func_get_args();
|
||||
unset($args[0]);
|
||||
}
|
||||
return self::_make_obj($name, 'model', true, $args);
|
||||
}
|
||||
|
||||
protected static function _make_obj($name, $type, $extendable = true, $p = array()) {
|
||||
$folder = null;
|
||||
if($name[0] === '#') {
|
||||
list(, $folder, $name) = explode('#', $name);
|
||||
}
|
||||
$cname = $type.'_'.$name;
|
||||
if(!isset(self::$_tables[$cname])) {
|
||||
if(!class_exists($cname, false)) {
|
||||
self::import('class'.'/'.$type.'/'.$name,$folder);
|
||||
}
|
||||
if($extendable) {
|
||||
self::$_tables[$cname] = new dzz_container();
|
||||
switch (count($p)) {
|
||||
case 0: self::$_tables[$cname]->obj = new $cname();break;
|
||||
case 1: self::$_tables[$cname]->obj = new $cname($p[1]);break;
|
||||
case 2: self::$_tables[$cname]->obj = new $cname($p[1], $p[2]);break;
|
||||
case 3: self::$_tables[$cname]->obj = new $cname($p[1], $p[2], $p[3]);break;
|
||||
case 4: self::$_tables[$cname]->obj = new $cname($p[1], $p[2], $p[3], $p[4]);break;
|
||||
case 5: self::$_tables[$cname]->obj = new $cname($p[1], $p[2], $p[3], $p[4], $p[5]);break;
|
||||
default: $ref = new ReflectionClass($cname);self::$_tables[$cname]->obj = $ref->newInstanceArgs($p);unset($ref);break;
|
||||
}
|
||||
} else {
|
||||
self::$_tables[$cname] = new $cname();
|
||||
}
|
||||
}
|
||||
return self::$_tables[$cname];
|
||||
}
|
||||
|
||||
protected static function _tp_make_obj($name, $type, $extendable = true, $p = array()) {
|
||||
$folder = null;
|
||||
if($name[0] === '#') {
|
||||
list(, $folder, $name) = explode('#', $name);
|
||||
}
|
||||
$cname = $type.'_'.$name;
|
||||
if(!isset(self::$_tptables[$cname])) {
|
||||
/*if(!class_exists($cname, false)) {
|
||||
self::import('class'.'/'.$type.'/'.$name,$folder);
|
||||
}*/
|
||||
self::$_tptables[$cname] = new dzz_mode($name);
|
||||
}
|
||||
return self::$_tptables[$cname];
|
||||
}
|
||||
|
||||
public static function memory() {
|
||||
if(!self::$_memory) {
|
||||
self::$_memory = new dzz_memory();
|
||||
self::$_memory->init(self::app()->config['memory']);
|
||||
}
|
||||
return self::$_memory;
|
||||
}
|
||||
|
||||
public static function import($name, $folder = '', $force = true) {
|
||||
//如果文件名为空或者false,阻止向下进行
|
||||
if(preg_match('/^\s*$/',$name) || $name == false){
|
||||
return false;
|
||||
}
|
||||
$key = $folder.$name;
|
||||
if(!isset(self::$_imports[$key])) {
|
||||
if($folder){
|
||||
$path = DZZ_ROOT.'./dzz/'.$folder.'/';
|
||||
}else{
|
||||
$path = DZZ_ROOT.'./core/';
|
||||
if(defined('CURSCRIPT')) {
|
||||
$path1= DZZ_ROOT.'./'.CURSCRIPT.'/';
|
||||
if(defined('CURMODULE')) $path2=DZZ_ROOT.'/'.CURSCRIPT.'/'.CURMODULE.'/';
|
||||
}
|
||||
}
|
||||
|
||||
if(strpos($name, '/') !== false) {
|
||||
$pre = basename(dirname($name));
|
||||
$filename = dirname($name).'/'.$pre.'_'.basename($name).'.php';
|
||||
} else {
|
||||
$filename = $name.'.php';
|
||||
}
|
||||
if(isset($path2) && is_file($path2.$filename)) {
|
||||
self::$_imports[$key] = true;
|
||||
$rt = include $path2.$filename;
|
||||
return $rt;
|
||||
}elseif(isset($path1) && is_file($path1.$filename)) {
|
||||
self::$_imports[$key] = true;
|
||||
$rt = include $path1.$filename;
|
||||
return $rt;
|
||||
}elseif(is_file($path.$filename)) {
|
||||
self::$_imports[$key] = true;
|
||||
$rt = include $path.$filename;
|
||||
return $rt;
|
||||
} elseif(!$force) {
|
||||
return false;
|
||||
} else {
|
||||
//throw new Exception('Oops! System file lost: '.$filename);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function handleException($exception) {
|
||||
global $_config;
|
||||
if($_config['debug']>0){
|
||||
dzz_error::exception_error($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function handleError($errno, $errstr, $errfile, $errline) {
|
||||
if($errno & DZZ_CORE_DEBUG) {
|
||||
dzz_error::system_error($errstr, false, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static function handleShutdown() {
|
||||
if(($error = error_get_last()) && $error['type'] & DZZ_CORE_DEBUG) {
|
||||
dzz_error::system_error($error['message'], false, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static function autoload($class) {
|
||||
$module='';
|
||||
if($class[0] === '#') {
|
||||
list(, $module, $class) = explode('#', $class);
|
||||
}
|
||||
$class = ($class);
|
||||
$namespaceArr = explode('\\',$class);
|
||||
$namesapce = $namespaceArr[0].'\\';
|
||||
if(array_key_exists($namesapce,self::$prefixDirsPsr4)){
|
||||
$file = self::findFile($class);
|
||||
if(file_exists($file)){
|
||||
include_once $file;
|
||||
return true;
|
||||
}
|
||||
} elseif(strpos($class, '_') !== false) {
|
||||
list($folder) = explode('_', $class);
|
||||
$file = 'class/'.$folder.BS.substr($class, strlen($folder) + 1);
|
||||
} else {
|
||||
$file = 'class/'.$class;
|
||||
}
|
||||
|
||||
try {
|
||||
self::import($file,$module);
|
||||
return true;
|
||||
|
||||
} catch (Exception $exc) {
|
||||
|
||||
$trace = $exc->getTrace();
|
||||
foreach ($trace as $log) {
|
||||
if(empty($log['class']) && $log['function'] == 'class_exists') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
dzz_error::exception_error($exc);
|
||||
}
|
||||
}
|
||||
|
||||
//查找文件
|
||||
private static function findFile($class)
|
||||
{
|
||||
if (!empty(self::$map[$class])) {
|
||||
// 类库映射
|
||||
return self::$map[$class];
|
||||
}
|
||||
|
||||
// 查找 PSR-4
|
||||
$logicalPathPsr4 = strtr($class, '\\', '/') . EXT;
|
||||
$first = $class[0];
|
||||
if (isset(self::$prefixLengthsPsr4[$first])) {
|
||||
|
||||
foreach (self::$prefixLengthsPsr4[$first] as $prefix => $length) {
|
||||
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
|
||||
foreach (self::$prefixDirsPsr4[$prefix] as $dir) {
|
||||
if (is_file($file = $dir .BS .substr($logicalPathPsr4, $length))) {
|
||||
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查找 PSR-4 fallback dirs
|
||||
foreach (self::$fallbackDirsPsr4 as $dir) {
|
||||
if (is_file($file = $dir . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
return self::$map[$class] = false;
|
||||
}
|
||||
// 注册命名空间
|
||||
public static function addNamespace($namespace, $path = '')
|
||||
{
|
||||
if (is_array($namespace)) {
|
||||
foreach ($namespace as $prefix => $paths) {
|
||||
self::addPsr4($prefix . '\\', rtrim($paths, '/'), true);
|
||||
}
|
||||
} else {
|
||||
self::addPsr4($namespace . '\\', rtrim($path, '/'), true);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加Psr4空间
|
||||
private static function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
self::$fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
self::$fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
self::$fallbackDirsPsr4 = array_merge(
|
||||
self::$fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset(self::$prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw dzz_error::system_error("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
self::$prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
self::$prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
self::$prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
self::$prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
self::$prefixDirsPsr4[$prefix] = array_merge(
|
||||
self::$prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static function analysisStart($name){
|
||||
$key = 'other';
|
||||
if($name[0] === '#') {
|
||||
list(, $key, $name) = explode('#', $name);
|
||||
}
|
||||
if(!isset($_ENV['analysis'])) {
|
||||
$_ENV['analysis'] = array();
|
||||
}
|
||||
if(!isset($_ENV['analysis'][$key])) {
|
||||
$_ENV['analysis'][$key] = array();
|
||||
$_ENV['analysis'][$key]['sum'] = 0;
|
||||
}
|
||||
$_ENV['analysis'][$key][$name]['start'] = microtime(TRUE);
|
||||
$_ENV['analysis'][$key][$name]['start_memory_get_usage'] = memory_get_usage();
|
||||
$_ENV['analysis'][$key][$name]['start_memory_get_real_usage'] = memory_get_usage(true);
|
||||
$_ENV['analysis'][$key][$name]['start_memory_get_peak_usage'] = memory_get_peak_usage();
|
||||
$_ENV['analysis'][$key][$name]['start_memory_get_peak_real_usage'] = memory_get_peak_usage(true);
|
||||
}
|
||||
|
||||
public static function analysisStop($name) {
|
||||
$key = 'other';
|
||||
if($name[0] === '#') {
|
||||
list(, $key, $name) = explode('#', $name);
|
||||
}
|
||||
if(isset($_ENV['analysis'][$key][$name]['start'])) {
|
||||
$diff = round((microtime(TRUE) - $_ENV['analysis'][$key][$name]['start']) * 1000, 5);
|
||||
$_ENV['analysis'][$key][$name]['time'] = $diff;
|
||||
$_ENV['analysis'][$key]['sum'] = $_ENV['analysis'][$key]['sum'] + $diff;
|
||||
unset($_ENV['analysis'][$key][$name]['start']);
|
||||
$_ENV['analysis'][$key][$name]['stop_memory_get_usage'] = memory_get_usage();
|
||||
$_ENV['analysis'][$key][$name]['stop_memory_get_real_usage'] = memory_get_usage(true);
|
||||
$_ENV['analysis'][$key][$name]['stop_memory_get_peak_usage'] = memory_get_peak_usage();
|
||||
$_ENV['analysis'][$key][$name]['stop_memory_get_peak_real_usage'] = memory_get_peak_usage(true);
|
||||
}
|
||||
return $_ENV['analysis'][$key][$name];
|
||||
}
|
||||
|
||||
public static function loadConfig($file = null){
|
||||
if($file && file_exists($file)){
|
||||
|
||||
return include $file;
|
||||
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function getConfig($name){
|
||||
|
||||
global $_config;
|
||||
|
||||
return $_config[$name];
|
||||
}
|
||||
public static function setConfig($name,$value = null){
|
||||
|
||||
global $_config;
|
||||
|
||||
if(is_string($name)){//单个设置
|
||||
|
||||
$name = strtolower($name);
|
||||
|
||||
$_config[$name] = $value;
|
||||
|
||||
}elseif(is_array($name)){//批量设置
|
||||
|
||||
$name = array_change_key_case($name,CASE_LOWER);
|
||||
|
||||
foreach($name as $k=>$v){
|
||||
|
||||
$_config[$k] = $v;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static function getNamespaceDir($namespace = null){
|
||||
// 查找 PSR-4
|
||||
$logicalPathPsr4 = strtr($namespace, '\\', '/');
|
||||
|
||||
$first = $namespace[0];
|
||||
|
||||
if (isset(self::$prefixLengthsPsr4[$first])) {
|
||||
|
||||
foreach (self::$prefixLengthsPsr4[$first] as $prefix => $length) {
|
||||
|
||||
if (0 === strpos($namespace, $prefix)) {
|
||||
|
||||
foreach (self::$prefixDirsPsr4[$prefix] as $dir) {
|
||||
|
||||
if (is_dir($realdir = $dir .BS .substr($logicalPathPsr4, $length))) {
|
||||
|
||||
return $realdir;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class core
|
||||
{
|
||||
private static $_tables;
|
||||
private static $_tptables;
|
||||
private static $_imports;
|
||||
private static $_app;
|
||||
private static $_memory;
|
||||
|
||||
// 类名映射
|
||||
protected static $map = array();
|
||||
|
||||
//psr4
|
||||
private static $prefixLengthsPsr4 = array();
|
||||
private static $prefixDirsPsr4 = array();
|
||||
private static $fallbackDirsPsr4 = array();
|
||||
|
||||
public static function app($params=array()) {
|
||||
if(!is_object(self::$_app)) {
|
||||
self::$_app = dzz_app::instance($params);
|
||||
}
|
||||
return self::$_app;
|
||||
}
|
||||
|
||||
public static function creatapp() {
|
||||
|
||||
if(!is_object(self::$_app)) {
|
||||
|
||||
self::$_app = dzz_app::instance();
|
||||
}
|
||||
|
||||
return self::$_app;
|
||||
}
|
||||
|
||||
public static function t($name) {
|
||||
return self::_make_obj($name, 'table', DZZ_TABLE_EXTENDABLE);
|
||||
}
|
||||
|
||||
public static function tp_t($name) {
|
||||
return self::_tp_make_obj($name, 'table', DZZ_TABLE_EXTENDABLE);
|
||||
}
|
||||
|
||||
public static function m($name) {
|
||||
$args = array();
|
||||
if(func_num_args() > 1) {
|
||||
$args = func_get_args();
|
||||
unset($args[0]);
|
||||
}
|
||||
return self::_make_obj($name, 'model', true, $args);
|
||||
}
|
||||
|
||||
protected static function _make_obj($name, $type, $extendable = true, $p = array()) {
|
||||
$folder = null;
|
||||
if($name[0] === '#') {
|
||||
list(, $folder, $name) = explode('#', $name);
|
||||
}
|
||||
$cname = $type.'_'.$name;
|
||||
if(!isset(self::$_tables[$cname])) {
|
||||
if(!class_exists($cname, false)) {
|
||||
self::import('class'.'/'.$type.'/'.$name,$folder);
|
||||
}
|
||||
if($extendable) {
|
||||
self::$_tables[$cname] = new dzz_container();
|
||||
switch (count($p)) {
|
||||
case 0: self::$_tables[$cname]->obj = new $cname();break;
|
||||
case 1: self::$_tables[$cname]->obj = new $cname($p[1]);break;
|
||||
case 2: self::$_tables[$cname]->obj = new $cname($p[1], $p[2]);break;
|
||||
case 3: self::$_tables[$cname]->obj = new $cname($p[1], $p[2], $p[3]);break;
|
||||
case 4: self::$_tables[$cname]->obj = new $cname($p[1], $p[2], $p[3], $p[4]);break;
|
||||
case 5: self::$_tables[$cname]->obj = new $cname($p[1], $p[2], $p[3], $p[4], $p[5]);break;
|
||||
default: $ref = new ReflectionClass($cname);self::$_tables[$cname]->obj = $ref->newInstanceArgs($p);unset($ref);break;
|
||||
}
|
||||
} else {
|
||||
self::$_tables[$cname] = new $cname();
|
||||
}
|
||||
}
|
||||
return self::$_tables[$cname];
|
||||
}
|
||||
|
||||
protected static function _tp_make_obj($name, $type, $extendable = true, $p = array()) {
|
||||
$folder = null;
|
||||
if($name[0] === '#') {
|
||||
list(, $folder, $name) = explode('#', $name);
|
||||
}
|
||||
$cname = $type.'_'.$name;
|
||||
if(!isset(self::$_tptables[$cname])) {
|
||||
/*if(!class_exists($cname, false)) {
|
||||
self::import('class'.'/'.$type.'/'.$name,$folder);
|
||||
}*/
|
||||
self::$_tptables[$cname] = new dzz_mode($name);
|
||||
}
|
||||
return self::$_tptables[$cname];
|
||||
}
|
||||
|
||||
public static function memory() {
|
||||
if(!self::$_memory) {
|
||||
self::$_memory = new dzz_memory();
|
||||
self::$_memory->init(self::app()->config['memory']);
|
||||
}
|
||||
return self::$_memory;
|
||||
}
|
||||
|
||||
public static function import($name, $folder = '', $force = true) {
|
||||
//如果文件名为空或者false,阻止向下进行
|
||||
if(preg_match('/^\s*$/',$name) || $name == false){
|
||||
return false;
|
||||
}
|
||||
$key = $folder.$name;
|
||||
if(!isset(self::$_imports[$key])) {
|
||||
if($folder){
|
||||
$path = DZZ_ROOT.'./dzz/'.$folder.'/';
|
||||
}else{
|
||||
$path = DZZ_ROOT.'./core/';
|
||||
if(defined('CURSCRIPT')) {
|
||||
$path1= DZZ_ROOT.'./'.CURSCRIPT.'/';
|
||||
if(defined('CURMODULE')) $path2=DZZ_ROOT.'/'.CURSCRIPT.'/'.CURMODULE.'/';
|
||||
}
|
||||
}
|
||||
|
||||
if(strpos($name, '/') !== false) {
|
||||
$pre = basename(dirname($name));
|
||||
$filename = dirname($name).'/'.$pre.'_'.basename($name).'.php';
|
||||
} else {
|
||||
$filename = $name.'.php';
|
||||
}
|
||||
if(isset($path2) && is_file($path2.$filename)) {
|
||||
self::$_imports[$key] = true;
|
||||
$rt = include $path2.$filename;
|
||||
return $rt;
|
||||
}elseif(isset($path1) && is_file($path1.$filename)) {
|
||||
self::$_imports[$key] = true;
|
||||
$rt = include $path1.$filename;
|
||||
return $rt;
|
||||
}elseif(is_file($path.$filename)) {
|
||||
self::$_imports[$key] = true;
|
||||
$rt = include $path.$filename;
|
||||
return $rt;
|
||||
} elseif(!$force) {
|
||||
return false;
|
||||
} else {
|
||||
//throw new Exception('Oops! System file lost: '.$filename);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function handleException($exception) {
|
||||
global $_config;
|
||||
if($_config['debug']>0){
|
||||
dzz_error::exception_error($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function handleError($errno, $errstr, $errfile, $errline) {
|
||||
if($errno & DZZ_CORE_DEBUG) {
|
||||
dzz_error::system_error($errstr, false, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static function handleShutdown() {
|
||||
if(($error = error_get_last()) && $error['type'] & DZZ_CORE_DEBUG) {
|
||||
dzz_error::system_error($error['message'], false, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static function autoload($class) {
|
||||
$module='';
|
||||
if($class[0] === '#') {
|
||||
list(, $module, $class) = explode('#', $class);
|
||||
}
|
||||
$class = ($class);
|
||||
$namespaceArr = explode('\\',$class);
|
||||
$namesapce = $namespaceArr[0].'\\';
|
||||
if(array_key_exists($namesapce,self::$prefixDirsPsr4)){
|
||||
$file = self::findFile($class);
|
||||
if(file_exists($file)){
|
||||
include_once $file;
|
||||
return true;
|
||||
}
|
||||
} elseif(strpos($class, '_') !== false) {
|
||||
list($folder) = explode('_', $class);
|
||||
$file = 'class/'.$folder.BS.substr($class, strlen($folder) + 1);
|
||||
} else {
|
||||
$file = 'class/'.$class;
|
||||
}
|
||||
|
||||
try {
|
||||
self::import($file,$module);
|
||||
return true;
|
||||
|
||||
} catch (Exception $exc) {
|
||||
|
||||
$trace = $exc->getTrace();
|
||||
foreach ($trace as $log) {
|
||||
if(empty($log['class']) && $log['function'] == 'class_exists') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
dzz_error::exception_error($exc);
|
||||
}
|
||||
}
|
||||
|
||||
//查找文件
|
||||
private static function findFile($class)
|
||||
{
|
||||
if (!empty(self::$map[$class])) {
|
||||
// 类库映射
|
||||
return self::$map[$class];
|
||||
}
|
||||
|
||||
// 查找 PSR-4
|
||||
$logicalPathPsr4 = strtr($class, '\\', '/') . EXT;
|
||||
$first = $class[0];
|
||||
if (isset(self::$prefixLengthsPsr4[$first])) {
|
||||
|
||||
foreach (self::$prefixLengthsPsr4[$first] as $prefix => $length) {
|
||||
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
|
||||
foreach (self::$prefixDirsPsr4[$prefix] as $dir) {
|
||||
if (is_file($file = $dir .BS .substr($logicalPathPsr4, $length))) {
|
||||
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查找 PSR-4 fallback dirs
|
||||
foreach (self::$fallbackDirsPsr4 as $dir) {
|
||||
if (is_file($file = $dir . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
return self::$map[$class] = false;
|
||||
}
|
||||
// 注册命名空间
|
||||
public static function addNamespace($namespace, $path = '')
|
||||
{
|
||||
if (is_array($namespace)) {
|
||||
foreach ($namespace as $prefix => $paths) {
|
||||
self::addPsr4($prefix . '\\', rtrim($paths, '/'), true);
|
||||
}
|
||||
} else {
|
||||
self::addPsr4($namespace . '\\', rtrim($path, '/'), true);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加Psr4空间
|
||||
private static function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
self::$fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
self::$fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
self::$fallbackDirsPsr4 = array_merge(
|
||||
self::$fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset(self::$prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw dzz_error::system_error("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
self::$prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
self::$prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
self::$prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
self::$prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
self::$prefixDirsPsr4[$prefix] = array_merge(
|
||||
self::$prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static function analysisStart($name){
|
||||
$key = 'other';
|
||||
if($name[0] === '#') {
|
||||
list(, $key, $name) = explode('#', $name);
|
||||
}
|
||||
if(!isset($_ENV['analysis'])) {
|
||||
$_ENV['analysis'] = array();
|
||||
}
|
||||
if(!isset($_ENV['analysis'][$key])) {
|
||||
$_ENV['analysis'][$key] = array();
|
||||
$_ENV['analysis'][$key]['sum'] = 0;
|
||||
}
|
||||
$_ENV['analysis'][$key][$name]['start'] = microtime(TRUE);
|
||||
$_ENV['analysis'][$key][$name]['start_memory_get_usage'] = memory_get_usage();
|
||||
$_ENV['analysis'][$key][$name]['start_memory_get_real_usage'] = memory_get_usage(true);
|
||||
$_ENV['analysis'][$key][$name]['start_memory_get_peak_usage'] = memory_get_peak_usage();
|
||||
$_ENV['analysis'][$key][$name]['start_memory_get_peak_real_usage'] = memory_get_peak_usage(true);
|
||||
}
|
||||
|
||||
public static function analysisStop($name) {
|
||||
$key = 'other';
|
||||
if($name[0] === '#') {
|
||||
list(, $key, $name) = explode('#', $name);
|
||||
}
|
||||
if(isset($_ENV['analysis'][$key][$name]['start'])) {
|
||||
$diff = round((microtime(TRUE) - $_ENV['analysis'][$key][$name]['start']) * 1000, 5);
|
||||
$_ENV['analysis'][$key][$name]['time'] = $diff;
|
||||
$_ENV['analysis'][$key]['sum'] = $_ENV['analysis'][$key]['sum'] + $diff;
|
||||
unset($_ENV['analysis'][$key][$name]['start']);
|
||||
$_ENV['analysis'][$key][$name]['stop_memory_get_usage'] = memory_get_usage();
|
||||
$_ENV['analysis'][$key][$name]['stop_memory_get_real_usage'] = memory_get_usage(true);
|
||||
$_ENV['analysis'][$key][$name]['stop_memory_get_peak_usage'] = memory_get_peak_usage();
|
||||
$_ENV['analysis'][$key][$name]['stop_memory_get_peak_real_usage'] = memory_get_peak_usage(true);
|
||||
}
|
||||
return $_ENV['analysis'][$key][$name];
|
||||
}
|
||||
|
||||
public static function loadConfig($file = null){
|
||||
if($file && file_exists($file)){
|
||||
|
||||
return include $file;
|
||||
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function getConfig($name){
|
||||
|
||||
global $_config;
|
||||
|
||||
return $_config[$name];
|
||||
}
|
||||
public static function setConfig($name,$value = null){
|
||||
|
||||
global $_config;
|
||||
|
||||
if(is_string($name)){//单个设置
|
||||
|
||||
$name = strtolower($name);
|
||||
|
||||
$_config[$name] = $value;
|
||||
|
||||
}elseif(is_array($name)){//批量设置
|
||||
|
||||
$name = array_change_key_case($name,CASE_LOWER);
|
||||
|
||||
foreach($name as $k=>$v){
|
||||
|
||||
$_config[$k] = $v;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static function getNamespaceDir($namespace = null){
|
||||
// 查找 PSR-4
|
||||
$logicalPathPsr4 = strtr($namespace, '\\', '/');
|
||||
|
||||
$first = $namespace[0];
|
||||
|
||||
if (isset(self::$prefixLengthsPsr4[$first])) {
|
||||
|
||||
foreach (self::$prefixLengthsPsr4[$first] as $prefix => $length) {
|
||||
|
||||
if (0 === strpos($namespace, $prefix)) {
|
||||
|
||||
foreach (self::$prefixDirsPsr4[$prefix] as $dir) {
|
||||
|
||||
if (is_dir($realdir = $dir .BS .substr($logicalPathPsr4, $length))) {
|
||||
|
||||
return $realdir;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,82 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP 汉字转拼音
|
||||
* @example
|
||||
* echo pinyin::encode('乐云网络'); //编码为拼音首字母
|
||||
* echo pinyin::encode('乐云网络', 'all'); //编码为全拼音
|
||||
*/
|
||||
class pinyin {
|
||||
/**
|
||||
* 拼音字符转换图
|
||||
* @var array
|
||||
*/
|
||||
private static $_aMaps = array(
|
||||
'a'=>-20319,'ai'=>-20317,'an'=>-20304,'ang'=>-20295,'ao'=>-20292,
|
||||
'ba'=>-20283,'bai'=>-20265,'ban'=>-20257,'bang'=>-20242,'bao'=>-20230,'bei'=>-20051,'ben'=>-20036,'beng'=>-20032,'bi'=>-20026,'bian'=>-20002,'biao'=>-19990,'bie'=>-19986,'bin'=>-19982,'bing'=>-19976,'bo'=>-19805,'bu'=>-19784,
|
||||
'ca'=>-19775,'cai'=>-19774,'can'=>-19763,'cang'=>-19756,'cao'=>-19751,'ce'=>-19746,'ceng'=>-19741,'cha'=>-19739,'chai'=>-19728,'chan'=>-19725,'chang'=>-19715,'chao'=>-19540,'che'=>-19531,'chen'=>-19525,'cheng'=>-19515,'chi'=>-19500,'chong'=>-19484,'chou'=>-19479,'chu'=>-19467,'chuai'=>-19289,'chuan'=>-19288,'chuang'=>-19281,'chui'=>-19275,'chun'=>-19270,'chuo'=>-19263,'ci'=>-19261,'cong'=>-19249,'cou'=>-19243,'cu'=>-19242,'cuan'=>-19238,'cui'=>-19235,'cun'=>-19227,'cuo'=>-19224,
|
||||
'da'=>-19218,'dai'=>-19212,'dan'=>-19038,'dang'=>-19023,'dao'=>-19018,'de'=>-19006,'deng'=>-19003,'di'=>-18996,'dian'=>-18977,'diao'=>-18961,'die'=>-18952,'ding'=>-18783,'diu'=>-18774,'dong'=>-18773,'dou'=>-18763,'du'=>-18756,'duan'=>-18741,'dui'=>-18735,'dun'=>-18731,'duo'=>-18722,
|
||||
'e'=>-18710,'en'=>-18697,'er'=>-18696,
|
||||
'fa'=>-18526,'fan'=>-18518,'fang'=>-18501,'fei'=>-18490,'fen'=>-18478,'feng'=>-18463,'fo'=>-18448,'fou'=>-18447,'fu'=>-18446,
|
||||
'ga'=>-18239,'gai'=>-18237,'gan'=>-18231,'gang'=>-18220,'gao'=>-18211,'ge'=>-18201,'gei'=>-18184,'gen'=>-18183,'geng'=>-18181,'gong'=>-18012,'gou'=>-17997,'gu'=>-17988,'gua'=>-17970,'guai'=>-17964,'guan'=>-17961,'guang'=>-17950,'gui'=>-17947,'gun'=>-17931,'guo'=>-17928,
|
||||
'ha'=>-17922,'hai'=>-17759,'han'=>-17752,'hang'=>-17733,'hao'=>-17730,'he'=>-17721,'hei'=>-17703,'hen'=>-17701,'heng'=>-17697,'hong'=>-17692,'hou'=>-17683,'hu'=>-17676,'hua'=>-17496,'huai'=>-17487,'huan'=>-17482,'huang'=>-17468,'hui'=>-17454,'hun'=>-17433,'huo'=>-17427,
|
||||
'ji'=>-17417,'jia'=>-17202,'jian'=>-17185,'jiang'=>-16983,'jiao'=>-16970,'jie'=>-16942,'jin'=>-16915,'jing'=>-16733,'jiong'=>-16708,'jiu'=>-16706,'ju'=>-16689,'juan'=>-16664,'jue'=>-16657,'jun'=>-16647,
|
||||
'ka'=>-16474,'kai'=>-16470,'kan'=>-16465,'kang'=>-16459,'kao'=>-16452,'ke'=>-16448,'ken'=>-16433,'keng'=>-16429,'kong'=>-16427,'kou'=>-16423,'ku'=>-16419,'kua'=>-16412,'kuai'=>-16407,'kuan'=>-16403,'kuang'=>-16401,'kui'=>-16393,'kun'=>-16220,'kuo'=>-16216,
|
||||
'la'=>-16212,'lai'=>-16205,'lan'=>-16202,'lang'=>-16187,'lao'=>-16180,'le'=>-16171,'lei'=>-16169,'leng'=>-16158,'li'=>-16155,'lia'=>-15959,'lian'=>-15958,'liang'=>-15944,'liao'=>-15933,'lie'=>-15920,'lin'=>-15915,'ling'=>-15903,'liu'=>-15889,'long'=>-15878,'lou'=>-15707,'lu'=>-15701,'lv'=>-15681,'luan'=>-15667,'lue'=>-15661,'lun'=>-15659,'luo'=>-15652,
|
||||
'ma'=>-15640,'mai'=>-15631,'man'=>-15625,'mang'=>-15454,'mao'=>-15448,'me'=>-15436,'mei'=>-15435,'men'=>-15419,'meng'=>-15416,'mi'=>-15408,'mian'=>-15394,'miao'=>-15385,'mie'=>-15377,'min'=>-15375,'ming'=>-15369,'miu'=>-15363,'mo'=>-15362,'mou'=>-15183,'mu'=>-15180,
|
||||
'na'=>-15165,'nai'=>-15158,'nan'=>-15153,'nang'=>-15150,'nao'=>-15149,'ne'=>-15144,'nei'=>-15143,'nen'=>-15141,'neng'=>-15140,'ni'=>-15139,'nian'=>-15128,'niang'=>-15121,'niao'=>-15119,'nie'=>-15117,'nin'=>-15110,'ning'=>-15109,'niu'=>-14941,'nong'=>-14937,'nu'=>-14933,'nv'=>-14930,'nuan'=>-14929,'nue'=>-14928,'nuo'=>-14926,
|
||||
'o'=>-14922,'ou'=>-14921,
|
||||
'pa'=>-14914,'pai'=>-14908,'pan'=>-14902,'pang'=>-14894,'pao'=>-14889,'pei'=>-14882,'pen'=>-14873,'peng'=>-14871,'pi'=>-14857,'pian'=>-14678,'piao'=>-14674,'pie'=>-14670,'pin'=>-14668,'ping'=>-14663,'po'=>-14654,'pu'=>-14645,
|
||||
'qi'=>-14630,'qia'=>-14594,'qian'=>-14429,'qiang'=>-14407,'qiao'=>-14399,'qie'=>-14384,'qin'=>-14379,'qing'=>-14368,'qiong'=>-14355,'qiu'=>-14353,'qu'=>-14345,'quan'=>-14170,'que'=>-14159,'qun'=>-14151,
|
||||
'ran'=>-14149,'rang'=>-14145,'rao'=>-14140,'re'=>-14137,'ren'=>-14135,'reng'=>-14125,'ri'=>-14123,'rong'=>-14122,'rou'=>-14112,'ru'=>-14109,'ruan'=>-14099,'rui'=>-14097,'run'=>-14094,'ruo'=>-14092,
|
||||
'sa'=>-14090,'sai'=>-14087,'san'=>-14083,'sang'=>-13917,'sao'=>-13914,'se'=>-13910,'sen'=>-13907,'seng'=>-13906,'sha'=>-13905,'shai'=>-13896,'shan'=>-13894,'shang'=>-13878,'shao'=>-13870,'she'=>-13859,'shen'=>-13847,'sheng'=>-13831,'shi'=>-13658,'shou'=>-13611,'shu'=>-13601,'shua'=>-13406,'shuai'=>-13404,'shuan'=>-13400,'shuang'=>-13398,'shui'=>-13395,'shun'=>-13391,'shuo'=>-13387,'si'=>-13383,'song'=>-13367,'sou'=>-13359,'su'=>-13356,'suan'=>-13343,'sui'=>-13340,'sun'=>-13329,'suo'=>-13326,
|
||||
'ta'=>-13318,'tai'=>-13147,'tan'=>-13138,'tang'=>-13120,'tao'=>-13107,'te'=>-13096,'teng'=>-13095,'ti'=>-13091,'tian'=>-13076,'tiao'=>-13068,'tie'=>-13063,'ting'=>-13060,'tong'=>-12888,'tou'=>-12875,'tu'=>-12871,'tuan'=>-12860,'tui'=>-12858,'tun'=>-12852,'tuo'=>-12849,
|
||||
'wa'=>-12838,'wai'=>-12831,'wan'=>-12829,'wang'=>-12812,'wei'=>-12802,'wen'=>-12607,'weng'=>-12597,'wo'=>-12594,'wu'=>-12585,
|
||||
'xi'=>-12556,'xia'=>-12359,'xian'=>-12346,'xiang'=>-12320,'xiao'=>-12300,'xie'=>-12120,'xin'=>-12099,'xing'=>-12089,'xiong'=>-12074,'xiu'=>-12067,'xu'=>-12058,'xuan'=>-12039,'xue'=>-11867,'xun'=>-11861,
|
||||
'ya'=>-11847,'yan'=>-11831,'yang'=>-11798,'yao'=>-11781,'ye'=>-11604,'yi'=>-11589,'yin'=>-11536,'ying'=>-11358,'yo'=>-11340,'yong'=>-11339,'you'=>-11324,'yu'=>-11303,'yuan'=>-11097,'yue'=>-11077,'yun'=>-11067,
|
||||
'za'=>-11055,'zai'=>-11052,'zan'=>-11045,'zang'=>-11041,'zao'=>-11038,'ze'=>-11024,'zei'=>-11020,'zen'=>-11019,'zeng'=>-11018,'zha'=>-11014,'zhai'=>-10838,'zhan'=>-10832,'zhang'=>-10815,'zhao'=>-10800,'zhe'=>-10790,'zhen'=>-10780,'zheng'=>-10764,'zhi'=>-10587,'zhong'=>-10544,'zhou'=>-10533,'zhu'=>-10519,'zhua'=>-10331,'zhuai'=>-10329,'zhuan'=>-10328,'zhuang'=>-10322,'zhui'=>-10315,'zhun'=>-10309,'zhuo'=>-10307,'zi'=>-10296,'zong'=>-10281,'zou'=>-10274,'zu'=>-10270,'zuan'=>-10262,'zui'=>-10260,'zun'=>-10256,'zuo'=>-10254
|
||||
);
|
||||
|
||||
/**
|
||||
* 将中文编码成拼音
|
||||
* @param string $utf8Data utf8字符集数据
|
||||
* @param string $sRetFormat 返回格式 [head:首字母|all:全拼音]
|
||||
* @return string
|
||||
*/
|
||||
public static function encode($utf8Data, $sRetFormat='head'){
|
||||
$sGBK = iconv('UTF-8', 'GBK', $utf8Data);
|
||||
$aBuf = array();
|
||||
for ($i=0, $iLoop=strlen($sGBK); $i<$iLoop; $i++) {
|
||||
$iChr = ord($sGBK{$i});
|
||||
if ($iChr>160)
|
||||
$iChr = ($iChr<<8) + ord($sGBK{++$i}) - 65536;
|
||||
if ('head' === $sRetFormat)
|
||||
$aBuf[] = substr(self::zh2py($iChr),0,1);
|
||||
else
|
||||
$aBuf[] = self::zh2py($iChr);
|
||||
}
|
||||
if ('head' === $sRetFormat)
|
||||
return implode('', $aBuf);
|
||||
else
|
||||
return implode(' ', $aBuf);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中文转换到拼音(每次处理一个字符)
|
||||
* @param number $iWORD 待处理字符双字节
|
||||
* @return string 拼音
|
||||
*/
|
||||
private static function zh2py($iWORD) {
|
||||
if($iWORD>0 && $iWORD<160 ) {
|
||||
return chr($iWORD);
|
||||
} elseif ($iWORD<-20319||$iWORD>-10247) {
|
||||
return '';
|
||||
} else {
|
||||
foreach (self::$_aMaps as $py => $code) {
|
||||
if($code > $iWORD) break;
|
||||
$result = $py;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* PHP 汉字转拼音
|
||||
* @example
|
||||
* echo pinyin::encode('乐云网络'); //编码为拼音首字母
|
||||
* echo pinyin::encode('乐云网络', 'all'); //编码为全拼音
|
||||
*/
|
||||
class pinyin {
|
||||
/**
|
||||
* 拼音字符转换图
|
||||
* @var array
|
||||
*/
|
||||
private static $_aMaps = array(
|
||||
'a'=>-20319,'ai'=>-20317,'an'=>-20304,'ang'=>-20295,'ao'=>-20292,
|
||||
'ba'=>-20283,'bai'=>-20265,'ban'=>-20257,'bang'=>-20242,'bao'=>-20230,'bei'=>-20051,'ben'=>-20036,'beng'=>-20032,'bi'=>-20026,'bian'=>-20002,'biao'=>-19990,'bie'=>-19986,'bin'=>-19982,'bing'=>-19976,'bo'=>-19805,'bu'=>-19784,
|
||||
'ca'=>-19775,'cai'=>-19774,'can'=>-19763,'cang'=>-19756,'cao'=>-19751,'ce'=>-19746,'ceng'=>-19741,'cha'=>-19739,'chai'=>-19728,'chan'=>-19725,'chang'=>-19715,'chao'=>-19540,'che'=>-19531,'chen'=>-19525,'cheng'=>-19515,'chi'=>-19500,'chong'=>-19484,'chou'=>-19479,'chu'=>-19467,'chuai'=>-19289,'chuan'=>-19288,'chuang'=>-19281,'chui'=>-19275,'chun'=>-19270,'chuo'=>-19263,'ci'=>-19261,'cong'=>-19249,'cou'=>-19243,'cu'=>-19242,'cuan'=>-19238,'cui'=>-19235,'cun'=>-19227,'cuo'=>-19224,
|
||||
'da'=>-19218,'dai'=>-19212,'dan'=>-19038,'dang'=>-19023,'dao'=>-19018,'de'=>-19006,'deng'=>-19003,'di'=>-18996,'dian'=>-18977,'diao'=>-18961,'die'=>-18952,'ding'=>-18783,'diu'=>-18774,'dong'=>-18773,'dou'=>-18763,'du'=>-18756,'duan'=>-18741,'dui'=>-18735,'dun'=>-18731,'duo'=>-18722,
|
||||
'e'=>-18710,'en'=>-18697,'er'=>-18696,
|
||||
'fa'=>-18526,'fan'=>-18518,'fang'=>-18501,'fei'=>-18490,'fen'=>-18478,'feng'=>-18463,'fo'=>-18448,'fou'=>-18447,'fu'=>-18446,
|
||||
'ga'=>-18239,'gai'=>-18237,'gan'=>-18231,'gang'=>-18220,'gao'=>-18211,'ge'=>-18201,'gei'=>-18184,'gen'=>-18183,'geng'=>-18181,'gong'=>-18012,'gou'=>-17997,'gu'=>-17988,'gua'=>-17970,'guai'=>-17964,'guan'=>-17961,'guang'=>-17950,'gui'=>-17947,'gun'=>-17931,'guo'=>-17928,
|
||||
'ha'=>-17922,'hai'=>-17759,'han'=>-17752,'hang'=>-17733,'hao'=>-17730,'he'=>-17721,'hei'=>-17703,'hen'=>-17701,'heng'=>-17697,'hong'=>-17692,'hou'=>-17683,'hu'=>-17676,'hua'=>-17496,'huai'=>-17487,'huan'=>-17482,'huang'=>-17468,'hui'=>-17454,'hun'=>-17433,'huo'=>-17427,
|
||||
'ji'=>-17417,'jia'=>-17202,'jian'=>-17185,'jiang'=>-16983,'jiao'=>-16970,'jie'=>-16942,'jin'=>-16915,'jing'=>-16733,'jiong'=>-16708,'jiu'=>-16706,'ju'=>-16689,'juan'=>-16664,'jue'=>-16657,'jun'=>-16647,
|
||||
'ka'=>-16474,'kai'=>-16470,'kan'=>-16465,'kang'=>-16459,'kao'=>-16452,'ke'=>-16448,'ken'=>-16433,'keng'=>-16429,'kong'=>-16427,'kou'=>-16423,'ku'=>-16419,'kua'=>-16412,'kuai'=>-16407,'kuan'=>-16403,'kuang'=>-16401,'kui'=>-16393,'kun'=>-16220,'kuo'=>-16216,
|
||||
'la'=>-16212,'lai'=>-16205,'lan'=>-16202,'lang'=>-16187,'lao'=>-16180,'le'=>-16171,'lei'=>-16169,'leng'=>-16158,'li'=>-16155,'lia'=>-15959,'lian'=>-15958,'liang'=>-15944,'liao'=>-15933,'lie'=>-15920,'lin'=>-15915,'ling'=>-15903,'liu'=>-15889,'long'=>-15878,'lou'=>-15707,'lu'=>-15701,'lv'=>-15681,'luan'=>-15667,'lue'=>-15661,'lun'=>-15659,'luo'=>-15652,
|
||||
'ma'=>-15640,'mai'=>-15631,'man'=>-15625,'mang'=>-15454,'mao'=>-15448,'me'=>-15436,'mei'=>-15435,'men'=>-15419,'meng'=>-15416,'mi'=>-15408,'mian'=>-15394,'miao'=>-15385,'mie'=>-15377,'min'=>-15375,'ming'=>-15369,'miu'=>-15363,'mo'=>-15362,'mou'=>-15183,'mu'=>-15180,
|
||||
'na'=>-15165,'nai'=>-15158,'nan'=>-15153,'nang'=>-15150,'nao'=>-15149,'ne'=>-15144,'nei'=>-15143,'nen'=>-15141,'neng'=>-15140,'ni'=>-15139,'nian'=>-15128,'niang'=>-15121,'niao'=>-15119,'nie'=>-15117,'nin'=>-15110,'ning'=>-15109,'niu'=>-14941,'nong'=>-14937,'nu'=>-14933,'nv'=>-14930,'nuan'=>-14929,'nue'=>-14928,'nuo'=>-14926,
|
||||
'o'=>-14922,'ou'=>-14921,
|
||||
'pa'=>-14914,'pai'=>-14908,'pan'=>-14902,'pang'=>-14894,'pao'=>-14889,'pei'=>-14882,'pen'=>-14873,'peng'=>-14871,'pi'=>-14857,'pian'=>-14678,'piao'=>-14674,'pie'=>-14670,'pin'=>-14668,'ping'=>-14663,'po'=>-14654,'pu'=>-14645,
|
||||
'qi'=>-14630,'qia'=>-14594,'qian'=>-14429,'qiang'=>-14407,'qiao'=>-14399,'qie'=>-14384,'qin'=>-14379,'qing'=>-14368,'qiong'=>-14355,'qiu'=>-14353,'qu'=>-14345,'quan'=>-14170,'que'=>-14159,'qun'=>-14151,
|
||||
'ran'=>-14149,'rang'=>-14145,'rao'=>-14140,'re'=>-14137,'ren'=>-14135,'reng'=>-14125,'ri'=>-14123,'rong'=>-14122,'rou'=>-14112,'ru'=>-14109,'ruan'=>-14099,'rui'=>-14097,'run'=>-14094,'ruo'=>-14092,
|
||||
'sa'=>-14090,'sai'=>-14087,'san'=>-14083,'sang'=>-13917,'sao'=>-13914,'se'=>-13910,'sen'=>-13907,'seng'=>-13906,'sha'=>-13905,'shai'=>-13896,'shan'=>-13894,'shang'=>-13878,'shao'=>-13870,'she'=>-13859,'shen'=>-13847,'sheng'=>-13831,'shi'=>-13658,'shou'=>-13611,'shu'=>-13601,'shua'=>-13406,'shuai'=>-13404,'shuan'=>-13400,'shuang'=>-13398,'shui'=>-13395,'shun'=>-13391,'shuo'=>-13387,'si'=>-13383,'song'=>-13367,'sou'=>-13359,'su'=>-13356,'suan'=>-13343,'sui'=>-13340,'sun'=>-13329,'suo'=>-13326,
|
||||
'ta'=>-13318,'tai'=>-13147,'tan'=>-13138,'tang'=>-13120,'tao'=>-13107,'te'=>-13096,'teng'=>-13095,'ti'=>-13091,'tian'=>-13076,'tiao'=>-13068,'tie'=>-13063,'ting'=>-13060,'tong'=>-12888,'tou'=>-12875,'tu'=>-12871,'tuan'=>-12860,'tui'=>-12858,'tun'=>-12852,'tuo'=>-12849,
|
||||
'wa'=>-12838,'wai'=>-12831,'wan'=>-12829,'wang'=>-12812,'wei'=>-12802,'wen'=>-12607,'weng'=>-12597,'wo'=>-12594,'wu'=>-12585,
|
||||
'xi'=>-12556,'xia'=>-12359,'xian'=>-12346,'xiang'=>-12320,'xiao'=>-12300,'xie'=>-12120,'xin'=>-12099,'xing'=>-12089,'xiong'=>-12074,'xiu'=>-12067,'xu'=>-12058,'xuan'=>-12039,'xue'=>-11867,'xun'=>-11861,
|
||||
'ya'=>-11847,'yan'=>-11831,'yang'=>-11798,'yao'=>-11781,'ye'=>-11604,'yi'=>-11589,'yin'=>-11536,'ying'=>-11358,'yo'=>-11340,'yong'=>-11339,'you'=>-11324,'yu'=>-11303,'yuan'=>-11097,'yue'=>-11077,'yun'=>-11067,
|
||||
'za'=>-11055,'zai'=>-11052,'zan'=>-11045,'zang'=>-11041,'zao'=>-11038,'ze'=>-11024,'zei'=>-11020,'zen'=>-11019,'zeng'=>-11018,'zha'=>-11014,'zhai'=>-10838,'zhan'=>-10832,'zhang'=>-10815,'zhao'=>-10800,'zhe'=>-10790,'zhen'=>-10780,'zheng'=>-10764,'zhi'=>-10587,'zhong'=>-10544,'zhou'=>-10533,'zhu'=>-10519,'zhua'=>-10331,'zhuai'=>-10329,'zhuan'=>-10328,'zhuang'=>-10322,'zhui'=>-10315,'zhun'=>-10309,'zhuo'=>-10307,'zi'=>-10296,'zong'=>-10281,'zou'=>-10274,'zu'=>-10270,'zuan'=>-10262,'zui'=>-10260,'zun'=>-10256,'zuo'=>-10254
|
||||
);
|
||||
|
||||
/**
|
||||
* 将中文编码成拼音
|
||||
* @param string $utf8Data utf8字符集数据
|
||||
* @param string $sRetFormat 返回格式 [head:首字母|all:全拼音]
|
||||
* @return string
|
||||
*/
|
||||
public static function encode($utf8Data, $sRetFormat='head'){
|
||||
$sGBK = iconv('UTF-8', 'GBK', $utf8Data);
|
||||
$aBuf = array();
|
||||
for ($i=0, $iLoop=strlen($sGBK); $i<$iLoop; $i++) {
|
||||
$iChr = ord($sGBK{$i});
|
||||
if ($iChr>160)
|
||||
$iChr = ($iChr<<8) + ord($sGBK{++$i}) - 65536;
|
||||
if ('head' === $sRetFormat)
|
||||
$aBuf[] = substr(self::zh2py($iChr),0,1);
|
||||
else
|
||||
$aBuf[] = self::zh2py($iChr);
|
||||
}
|
||||
if ('head' === $sRetFormat)
|
||||
return implode('', $aBuf);
|
||||
else
|
||||
return implode(' ', $aBuf);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中文转换到拼音(每次处理一个字符)
|
||||
* @param number $iWORD 待处理字符双字节
|
||||
* @return string 拼音
|
||||
*/
|
||||
private static function zh2py($iWORD) {
|
||||
if($iWORD>0 && $iWORD<160 ) {
|
||||
return chr($iWORD);
|
||||
} elseif ($iWORD<-20319||$iWORD>-10247) {
|
||||
return '';
|
||||
} else {
|
||||
foreach (self::$_aMaps as $py => $code) {
|
||||
if($code > $iWORD) break;
|
||||
$result = $py;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,459 +1,459 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class seccode {
|
||||
|
||||
var $code;
|
||||
var $type = 0;
|
||||
var $width = 150;
|
||||
var $height = 60;
|
||||
var $background = 1;
|
||||
var $adulterate = 1;
|
||||
var $ttf = 0;
|
||||
var $angle = 0;
|
||||
var $warping = 0;
|
||||
var $scatter = 0;
|
||||
var $color = 1;
|
||||
var $size = 0;
|
||||
var $shadow = 1;
|
||||
var $animator = 0;
|
||||
var $fontpath = '';
|
||||
var $datapath = '';
|
||||
var $includepath= '';
|
||||
|
||||
var $fontcolor;
|
||||
var $im;
|
||||
|
||||
function display() {
|
||||
$this->type == 2 && !extension_loaded('ming') && $this->type = 0;
|
||||
if($this->type < 2 && function_exists('imagecreate') && function_exists('imagecolorset') && function_exists('imagecopyresized') &&
|
||||
function_exists('imagecolorallocate') && function_exists('imagechar') && function_exists('imagecolorsforindex') &&
|
||||
function_exists('imageline') && function_exists('imagecreatefromstring') && (function_exists('imagegif') || function_exists('imagepng') || function_exists('imagejpeg'))) {
|
||||
$this->image();
|
||||
} elseif($this->type == 2 && extension_loaded('ming')) {
|
||||
$this->flash();
|
||||
} elseif($this->type == 3) {
|
||||
$this->audio();
|
||||
} else {
|
||||
$this->bitmap();
|
||||
}
|
||||
}
|
||||
|
||||
function image() {
|
||||
$bgcontent = $this->background();
|
||||
|
||||
if($this->animator == 1 && function_exists('imagegif')) {
|
||||
include_once $this->includepath.'class_gifmerge.php';
|
||||
$trueframe = mt_rand(1, 9);
|
||||
|
||||
for($i = 0; $i <= 9; $i++) {
|
||||
$this->im = imagecreatefromstring($bgcontent);
|
||||
$x[$i] = $y[$i] = 0;
|
||||
$this->adulterate && $this->adulterate();
|
||||
if($i == $trueframe) {
|
||||
$this->ttf && function_exists('imagettftext') || $this->type == 1 ? $this->ttffont() : $this->giffont();
|
||||
$d[$i] = mt_rand(250, 400);
|
||||
$this->scatter && $this->scatter($this->im);
|
||||
} else {
|
||||
$this->adulteratefont();
|
||||
$d[$i] = mt_rand(5, 15);
|
||||
$this->scatter && $this->scatter($this->im, 1);
|
||||
}
|
||||
ob_start();
|
||||
imagegif($this->im);
|
||||
imagedestroy($this->im);
|
||||
$frame[$i] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
$anim = new GifMerge($frame, 255, 255, 255, 0, $d, $x, $y, 'C_MEMORY');
|
||||
header('Content-type: image/gif');
|
||||
echo $anim->getAnimation();
|
||||
} else {
|
||||
$this->im = imagecreatefromstring($bgcontent);
|
||||
$this->adulterate && $this->adulterate();
|
||||
$this->ttf && function_exists('imagettftext') || $this->type == 1 ? $this->ttffont() : $this->giffont();
|
||||
$this->scatter && $this->scatter($this->im);
|
||||
|
||||
if(function_exists('imagepng')) {
|
||||
header('Content-type: image/png');
|
||||
imagepng($this->im);
|
||||
} else {
|
||||
header('Content-type: image/jpeg');
|
||||
imagejpeg($this->im, '', 100);
|
||||
}
|
||||
imagedestroy($this->im);
|
||||
}
|
||||
}
|
||||
|
||||
function background() {
|
||||
$this->im = imagecreatetruecolor($this->width, $this->height);
|
||||
$backgrounds = $c = array();
|
||||
if($this->background && function_exists('imagecreatefromjpeg') && function_exists('imagecolorat') && function_exists('imagecopymerge') &&
|
||||
function_exists('imagesetpixel') && function_exists('imageSX') && function_exists('imageSY')) {
|
||||
if($handle = @opendir($this->datapath.'background/')) {
|
||||
while($bgfile = @readdir($handle)) {
|
||||
if(preg_match('/\.jpg$/i', $bgfile)) {
|
||||
$backgrounds[] = $this->datapath.'background/'.$bgfile;
|
||||
}
|
||||
}
|
||||
@closedir($handle);
|
||||
}
|
||||
if($backgrounds) {
|
||||
$imwm = imagecreatefromjpeg($backgrounds[array_rand($backgrounds)]);
|
||||
$colorindex = imagecolorat($imwm, 0, 0);
|
||||
$c = imagecolorsforindex($imwm, $colorindex);
|
||||
$colorindex = imagecolorat($imwm, 1, 0);
|
||||
imagesetpixel($imwm, 0, 0, $colorindex);
|
||||
$c[0] = $c['red'];$c[1] = $c['green'];$c[2] = $c['blue'];
|
||||
imagecopymerge($this->im, $imwm, 0, 0, mt_rand(0, 200 - $this->width), mt_rand(0, 80 - $this->height), imageSX($imwm), imageSY($imwm), 100);
|
||||
imagedestroy($imwm);
|
||||
}
|
||||
}
|
||||
if(!$this->background || !$backgrounds) {
|
||||
for($i = 0;$i < 3;$i++) {
|
||||
$start[$i] = mt_rand(200, 255);$end[$i] = mt_rand(100, 150);$step[$i] = ($end[$i] - $start[$i]) / $this->width;$c[$i] = $start[$i];
|
||||
}
|
||||
for($i = 0;$i < $this->width;$i++) {
|
||||
$color = imagecolorallocate($this->im, $c[0], $c[1], $c[2]);
|
||||
imageline($this->im, $i, 0, $i, $this->height, $color);
|
||||
$c[0] += $step[0];$c[1] += $step[1];$c[2] += $step[2];
|
||||
}
|
||||
$c[0] -= 20;$c[1] -= 20;$c[2] -= 20;
|
||||
}
|
||||
ob_start();
|
||||
if(function_exists('imagepng')) {
|
||||
imagepng($this->im);
|
||||
} else {
|
||||
imagejpeg($this->im, '', 100);
|
||||
}
|
||||
imagedestroy($this->im);
|
||||
$bgcontent = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->fontcolor = $c;
|
||||
return $bgcontent;
|
||||
}
|
||||
|
||||
function adulterate() {
|
||||
$linenums = $this->height / 10;
|
||||
for($i = 0; $i <= $linenums;$i++) {
|
||||
$color = $this->color ? imagecolorallocate($this->im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255)) : imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
$x = mt_rand(0, $this->width);
|
||||
$y = mt_rand(0, $this->height);
|
||||
if(mt_rand(0, 1)) {
|
||||
$w = mt_rand(0, $this->width);
|
||||
$h = mt_rand(0, $this->height);
|
||||
$s = mt_rand(0, 360);
|
||||
$e = mt_rand(0, 360);
|
||||
for($j = 0;$j < 3;$j++) {
|
||||
imagearc($this->im, $x + $j, $y, $w, $h, $s, $e, $color);
|
||||
}
|
||||
} else {
|
||||
$xe = mt_rand(0, $this->width);
|
||||
$ye = mt_rand(0, $this->height);
|
||||
imageline($this->im, $x, $y, $xe, $ye, $color);
|
||||
for($j = 0;$j < 3;$j++) {
|
||||
imageline($this->im, $x + $j, $y, $xe, $ye, $color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function adulteratefont() {
|
||||
$seccodeunits = 'BCEFGHJKMPQRTVWXY2346789';
|
||||
$x = $this->width / 4;
|
||||
$y = $this->height / 10;
|
||||
$text_color = imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
for($i = 0; $i <= 3; $i++) {
|
||||
$adulteratecode = $seccodeunits[mt_rand(0, 23)];
|
||||
imagechar($this->im, 5, $x * $i + mt_rand(0, $x - 10), mt_rand($y, $this->height - 10 - $y), $adulteratecode, $text_color);
|
||||
}
|
||||
}
|
||||
|
||||
function ttffont() {
|
||||
$seccode = $this->code;
|
||||
$seccoderoot = $this->type ? $this->fontpath.'ch/' : $this->fontpath.'en/';
|
||||
$dirs = opendir($seccoderoot);
|
||||
$seccodettf = array();
|
||||
while($entry = readdir($dirs)) {
|
||||
if($entry != '.' && $entry != '..' && in_array(strtolower(fileext($entry)), array('ttf', 'ttc'))) {
|
||||
$seccodettf[] = $entry;
|
||||
}
|
||||
}
|
||||
if(empty($seccodettf)) {
|
||||
$this->giffont();
|
||||
return;
|
||||
}
|
||||
$seccodelength = 4;
|
||||
if($this->type && !empty($seccodettf)) {
|
||||
if(strtoupper(CHARSET) != 'UTF-8') {
|
||||
include $this->includepath.'class_chinese.php';
|
||||
$cvt = new Chinese(CHARSET, 'utf8');
|
||||
$seccode = $cvt->Convert($seccode);
|
||||
}
|
||||
$seccode = array(substr($seccode, 0, 3), substr($seccode, 3, 3));
|
||||
$seccodelength = 2;
|
||||
}
|
||||
$widthtotal = 0;
|
||||
for($i = 0; $i < $seccodelength; $i++) {
|
||||
$font[$i]['font'] = $seccoderoot.$seccodettf[array_rand($seccodettf)];
|
||||
$font[$i]['angle'] = $this->angle ? mt_rand(-30, 30) : 0;
|
||||
$font[$i]['size'] = $this->type ? $this->width / 7 : $this->width / 6;
|
||||
$this->size && $font[$i]['size'] = mt_rand($font[$i]['size'] - $this->width / 40, $font[$i]['size'] + $this->width / 20);
|
||||
$box = imagettfbbox($font[$i]['size'], 0, $font[$i]['font'], $seccode[$i]);
|
||||
$font[$i]['zheight'] = max($box[1], $box[3]) - min($box[5], $box[7]);
|
||||
$box = imagettfbbox($font[$i]['size'], $font[$i]['angle'], $font[$i]['font'], $seccode[$i]);
|
||||
$font[$i]['height'] = max($box[1], $box[3]) - min($box[5], $box[7]);
|
||||
$font[$i]['hd'] = $font[$i]['height'] - $font[$i]['zheight'];
|
||||
$font[$i]['width'] = (max($box[2], $box[4]) - min($box[0], $box[6])) + mt_rand(0, $this->width / 8);
|
||||
$font[$i]['width'] = $font[$i]['width'] > $this->width / $seccodelength ? $this->width / $seccodelength : $font[$i]['width'];
|
||||
$widthtotal += $font[$i]['width'];
|
||||
}
|
||||
$x = mt_rand($font[0]['angle'] > 0 ? cos(deg2rad(90 - $font[0]['angle'])) * $font[0]['zheight'] : 1, $this->width - $widthtotal);
|
||||
!$this->color && $text_color = imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
for($i = 0; $i < $seccodelength; $i++) {
|
||||
if($this->color) {
|
||||
$this->fontcolor = array(mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
|
||||
$this->shadow && $text_shadowcolor = imagecolorallocate($this->im, 0, 0, 0);
|
||||
$text_color = imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
} elseif($this->shadow) {
|
||||
$text_shadowcolor = imagecolorallocate($this->im, 0, 0, 0);
|
||||
}
|
||||
$y = $font[0]['angle'] > 0 ? mt_rand($font[$i]['height'], $this->height) : mt_rand($font[$i]['height'] - $font[$i]['hd'], $this->height - $font[$i]['hd']);
|
||||
$this->shadow && imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x + 1, $y + 1, $text_shadowcolor, $font[$i]['font'], $seccode[$i]);
|
||||
imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x, $y, $text_color, $font[$i]['font'], $seccode[$i]);
|
||||
$x += $font[$i]['width'];
|
||||
}
|
||||
$this->warping && $this->warping($this->im);
|
||||
}
|
||||
|
||||
function warping(&$obj) {
|
||||
$rgb = array();
|
||||
$direct = rand(0, 1);
|
||||
$width = imagesx($obj);
|
||||
$height = imagesy($obj);
|
||||
$level = $width / 20;
|
||||
for($j = 0;$j < $height;$j++) {
|
||||
for($i = 0;$i < $width;$i++) {
|
||||
$rgb[$i] = imagecolorat($obj, $i , $j);
|
||||
}
|
||||
for($i = 0;$i < $width;$i++) {
|
||||
$r = sin($j / $height * 2 * M_PI - M_PI * 0.5) * ($direct ? $level : -$level);
|
||||
imagesetpixel($obj, $i + $r , $j , $rgb[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function scatter(&$obj, $level = 0) {
|
||||
$rgb = array();
|
||||
$this->scatter = $level ? $level : $this->scatter;
|
||||
$width = imagesx($obj);
|
||||
$height = imagesy($obj);
|
||||
for($j = 0;$j < $height;$j++) {
|
||||
for($i = 0;$i < $width;$i++) {
|
||||
$rgb[$i] = imagecolorat($obj, $i , $j);
|
||||
}
|
||||
for($i = 0;$i < $width;$i++) {
|
||||
$r = rand(-$this->scatter, $this->scatter);
|
||||
imagesetpixel($obj, $i + $r , $j , $rgb[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function giffont() {
|
||||
$seccode = $this->code;
|
||||
$seccodedir = array();
|
||||
if(function_exists('imagecreatefromgif')) {
|
||||
$seccoderoot = $this->datapath.'gif/';
|
||||
$dirs = opendir($seccoderoot);
|
||||
while($dir = readdir($dirs)) {
|
||||
if($dir != '.' && $dir != '..' && file_exists($seccoderoot.$dir.'/9.gif')) {
|
||||
$seccodedir[] = $dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
$widthtotal = 0;
|
||||
for($i = 0; $i <= 3; $i++) {
|
||||
$this->imcodefile = $seccodedir ? $seccoderoot.$seccodedir[array_rand($seccodedir)].'/'.strtolower($seccode[$i]).'.gif' : '';
|
||||
if(!empty($this->imcodefile) && file_exists($this->imcodefile)) {
|
||||
$font[$i]['file'] = $this->imcodefile;
|
||||
$font[$i]['data'] = getimagesize($this->imcodefile);
|
||||
$font[$i]['width'] = $font[$i]['data'][0] + mt_rand(0, 6) - 4;
|
||||
$font[$i]['height'] = $font[$i]['data'][1] + mt_rand(0, 6) - 4;
|
||||
$font[$i]['width'] += mt_rand(0, $this->width / 5 - $font[$i]['width']);
|
||||
$widthtotal += $font[$i]['width'];
|
||||
} else {
|
||||
$font[$i]['file'] = '';
|
||||
$font[$i]['width'] = 8 + mt_rand(0, $this->width / 5 - 5);
|
||||
$widthtotal += $font[$i]['width'];
|
||||
}
|
||||
}
|
||||
$x = mt_rand(1, $this->width - $widthtotal);
|
||||
for($i = 0; $i <= 3; $i++) {
|
||||
$this->color && $this->fontcolor = array(mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
|
||||
if($font[$i]['file']) {
|
||||
$this->imcode = imagecreatefromgif($font[$i]['file']);
|
||||
if($this->size) {
|
||||
$font[$i]['width'] = mt_rand($font[$i]['width'] - $this->width / 20, $font[$i]['width'] + $this->width / 20);
|
||||
$font[$i]['height'] = mt_rand($font[$i]['height'] - $this->width / 20, $font[$i]['height'] + $this->width / 20);
|
||||
}
|
||||
$y = mt_rand(0, $this->height - $font[$i]['height']);
|
||||
if($this->shadow) {
|
||||
$this->imcodeshadow = $this->imcode;
|
||||
imagecolorset($this->imcodeshadow, 0, 0, 0, 0);
|
||||
imagecopyresized($this->im, $this->imcodeshadow, $x + 1, $y + 1, 0, 0, $font[$i]['width'], $font[$i]['height'], $font[$i]['data'][0], $font[$i]['data'][1]);
|
||||
}
|
||||
imagecolorset($this->imcode, 0 , $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
imagecopyresized($this->im, $this->imcode, $x, $y, 0, 0, $font[$i]['width'], $font[$i]['height'], $font[$i]['data'][0], $font[$i]['data'][1]);
|
||||
} else {
|
||||
$y = mt_rand(0, $this->height - 20);
|
||||
if($this->shadow) {
|
||||
$text_shadowcolor = imagecolorallocate($this->im, 0, 0, 0);
|
||||
imagechar($this->im, 5, $x + 1, $y + 1, $seccode[$i], $text_shadowcolor);
|
||||
}
|
||||
$text_color = imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
imagechar($this->im, 5, $x, $y, $seccode[$i], $text_color);
|
||||
}
|
||||
$x += $font[$i]['width'];
|
||||
}
|
||||
}
|
||||
|
||||
function flash() {
|
||||
$spacing = 5;
|
||||
$codewidth = ($this->width - $spacing * 5) / 4;
|
||||
$strforswdaction = '';
|
||||
for($i = 0; $i <= 3; $i++) {
|
||||
$strforswdaction .= $this->swfcode($codewidth, $spacing, $this->code[$i], $i+1);
|
||||
}
|
||||
|
||||
ming_setScale(20.00000000);
|
||||
ming_useswfversion(6);
|
||||
$movie = new SWFMovie();
|
||||
$movie->setDimension($this->width, $this->height);
|
||||
$movie->setBackground(255, 255, 255);
|
||||
$movie->setRate(31);
|
||||
|
||||
$fontcolor = '0x'.(sprintf('%02s', dechex (mt_rand(0, 255)))).(sprintf('%02s', dechex (mt_rand(0, 128)))).(sprintf('%02s', dechex (mt_rand(0, 255))));
|
||||
$strAction = "
|
||||
_root.createEmptyMovieClip ( 'triangle', 1 );
|
||||
with ( _root.triangle ) {
|
||||
lineStyle( 3, $fontcolor, 100 );
|
||||
$strforswdaction
|
||||
}
|
||||
";
|
||||
$movie->add(new SWFAction( str_replace("\r", "", $strAction) ));
|
||||
header('Content-type: application/x-shockwave-flash');
|
||||
$movie->output();
|
||||
}
|
||||
|
||||
function swfcode($width, $d, $code, $order) {
|
||||
$str = '';
|
||||
$height = $this->height - $d * 2;
|
||||
$x_0 = ($order * ($width + $d) - $width);
|
||||
$x_1 = $x_0 + $width / 2;
|
||||
$x_2 = $x_0 + $width;
|
||||
$y_0 = $d;
|
||||
$y_2 = $y_0 + $height;
|
||||
$y_1 = $y_2 / 2;
|
||||
$y_0_5 = $y_2 / 4;
|
||||
$y_1_5 = $y_1 + $y_0_5;
|
||||
switch($code) {
|
||||
case 'B':$str .= 'moveTo('.$x_1.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_1.', '.$y_2.');lineTo('.$x_2.', '.$y_1_5.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_0_5.');lineTo('.$x_1.', '.$y_0.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');';break;
|
||||
case 'C':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case 'E':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');';break;
|
||||
case 'F':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');';break;
|
||||
case 'G':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_2.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');';break;
|
||||
case 'H':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');moveTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_2.', '.$y_1.');';break;
|
||||
case 'J':$str .= 'moveTo('.$x_1.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_0.', '.$y_1_5.');';break;
|
||||
case 'K':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_0.', '.$y_1.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');moveTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case 'M':$str .= 'moveTo('.$x_0.', '.$y_2.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case 'P':$str .= 'moveTo('.$x_0.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_0_5.');lineTo('.$x_1.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');';break;
|
||||
case 'Q':$str .= 'moveTo('.$x_2.', '.$y_2.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_1.', '.$y_1.');';break;
|
||||
case 'R':$str .= 'moveTo('.$x_0.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_0_5.');lineTo('.$x_1.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');moveTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case 'T':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');moveTo('.$x_1.', '.$y_0.');lineTo('.$x_1.', '.$y_2.');';break;
|
||||
case 'V':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_1.', '.$y_2.');lineTo('.$x_2.', '.$y_0.');';break;
|
||||
case 'W':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_2.', '.$y_0.');';break;
|
||||
case 'X':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');';break;
|
||||
case 'Y':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_0.');moveTo('.$x_1.', '.$y_1.');lineTo('.$x_1.', '.$y_2.');';break;
|
||||
case '2':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_1.');lineTo('.$x_0.', '.$y_1.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case '3':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_0.', '.$y_2.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_2.', '.$y_1.');';break;
|
||||
case '4':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');moveTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_1.');lineTo('.$x_2.', '.$y_1.');';break;
|
||||
case '6':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_2.', '.$y_1.');lineTo('.$x_0.', '.$y_1.');';break;
|
||||
case '7':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case '8':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_2.', '.$y_1.');';break;
|
||||
case '9':$str .= 'moveTo('.$x_2.', '.$y_1.');lineTo('.$x_0.', '.$y_1.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_0.', '.$y_2.');';break;
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
function audio() {
|
||||
header('Content-type: audio/mpeg');
|
||||
for($i = 0;$i <= 3; $i++) {
|
||||
readfile($this->datapath.'sound/'.strtolower($this->code[$i]).'.mp3');
|
||||
}
|
||||
}
|
||||
|
||||
function bitmap() {
|
||||
$numbers = array
|
||||
(
|
||||
'B' => array('00','fc','66','66','66','7c','66','66','fc','00'),
|
||||
'C' => array('00','38','64','c0','c0','c0','c4','64','3c','00'),
|
||||
'E' => array('00','fe','62','62','68','78','6a','62','fe','00'),
|
||||
'F' => array('00','f8','60','60','68','78','6a','62','fe','00'),
|
||||
'G' => array('00','78','cc','cc','de','c0','c4','c4','7c','00'),
|
||||
'H' => array('00','e7','66','66','66','7e','66','66','e7','00'),
|
||||
'J' => array('00','f8','cc','cc','cc','0c','0c','0c','7f','00'),
|
||||
'K' => array('00','f3','66','66','7c','78','6c','66','f7','00'),
|
||||
'M' => array('00','f7','63','6b','6b','77','77','77','e3','00'),
|
||||
'P' => array('00','f8','60','60','7c','66','66','66','fc','00'),
|
||||
'Q' => array('00','78','cc','cc','cc','cc','cc','cc','78','00'),
|
||||
'R' => array('00','f3','66','6c','7c','66','66','66','fc','00'),
|
||||
'T' => array('00','78','30','30','30','30','b4','b4','fc','00'),
|
||||
'V' => array('00','1c','1c','36','36','36','63','63','f7','00'),
|
||||
'W' => array('00','36','36','36','77','7f','6b','63','f7','00'),
|
||||
'X' => array('00','f7','66','3c','18','18','3c','66','ef','00'),
|
||||
'Y' => array('00','7e','18','18','18','3c','24','66','ef','00'),
|
||||
'2' => array('fc','c0','60','30','18','0c','cc','cc','78','00'),
|
||||
'3' => array('78','8c','0c','0c','38','0c','0c','8c','78','00'),
|
||||
'4' => array('00','3e','0c','fe','4c','6c','2c','3c','1c','1c'),
|
||||
'6' => array('78','cc','cc','cc','ec','d8','c0','60','3c','00'),
|
||||
'7' => array('30','30','38','18','18','18','1c','8c','fc','00'),
|
||||
'8' => array('78','cc','cc','cc','78','cc','cc','cc','78','00'),
|
||||
'9' => array('f0','18','0c','6c','dc','cc','cc','cc','78','00')
|
||||
);
|
||||
|
||||
foreach($numbers as $i => $number) {
|
||||
for($j = 0; $j < 6; $j++) {
|
||||
$a1 = substr('012', mt_rand(0, 2), 1).substr('012345', mt_rand(0, 5), 1);
|
||||
$a2 = substr('012345', mt_rand(0, 5), 1).substr('0123', mt_rand(0, 3), 1);
|
||||
mt_rand(0, 1) == 1 ? array_push($numbers[$i], $a1) : array_unshift($numbers[$i], $a1);
|
||||
mt_rand(0, 1) == 0 ? array_push($numbers[$i], $a1) : array_unshift($numbers[$i], $a2);
|
||||
}
|
||||
}
|
||||
|
||||
$bitmap = array();
|
||||
for($i = 0; $i < 20; $i++) {
|
||||
for($j = 0; $j <= 3; $j++) {
|
||||
$bytes = $numbers[$this->code[$j]][$i];
|
||||
$a = mt_rand(0, 14);
|
||||
array_push($bitmap, $bytes);
|
||||
}
|
||||
}
|
||||
|
||||
for($i = 0; $i < 8; $i++) {
|
||||
$a = substr('012345', mt_rand(0, 2), 1) . substr('012345', mt_rand(0, 5), 1);
|
||||
array_unshift($bitmap, $a);
|
||||
array_push($bitmap, $a);
|
||||
}
|
||||
|
||||
$image = pack('H*', '424d9e000000000000003e000000280000002000000018000000010001000000'.
|
||||
'0000600000000000000000000000000000000000000000000000FFFFFF00'.implode('', $bitmap));
|
||||
|
||||
header('Content-Type: image/bmp');
|
||||
echo $image;
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class seccode {
|
||||
|
||||
var $code;
|
||||
var $type = 0;
|
||||
var $width = 150;
|
||||
var $height = 60;
|
||||
var $background = 1;
|
||||
var $adulterate = 1;
|
||||
var $ttf = 0;
|
||||
var $angle = 0;
|
||||
var $warping = 0;
|
||||
var $scatter = 0;
|
||||
var $color = 1;
|
||||
var $size = 0;
|
||||
var $shadow = 1;
|
||||
var $animator = 0;
|
||||
var $fontpath = '';
|
||||
var $datapath = '';
|
||||
var $includepath= '';
|
||||
|
||||
var $fontcolor;
|
||||
var $im;
|
||||
|
||||
function display() {
|
||||
$this->type == 2 && !extension_loaded('ming') && $this->type = 0;
|
||||
if($this->type < 2 && function_exists('imagecreate') && function_exists('imagecolorset') && function_exists('imagecopyresized') &&
|
||||
function_exists('imagecolorallocate') && function_exists('imagechar') && function_exists('imagecolorsforindex') &&
|
||||
function_exists('imageline') && function_exists('imagecreatefromstring') && (function_exists('imagegif') || function_exists('imagepng') || function_exists('imagejpeg'))) {
|
||||
$this->image();
|
||||
} elseif($this->type == 2 && extension_loaded('ming')) {
|
||||
$this->flash();
|
||||
} elseif($this->type == 3) {
|
||||
$this->audio();
|
||||
} else {
|
||||
$this->bitmap();
|
||||
}
|
||||
}
|
||||
|
||||
function image() {
|
||||
$bgcontent = $this->background();
|
||||
|
||||
if($this->animator == 1 && function_exists('imagegif')) {
|
||||
include_once $this->includepath.'class_gifmerge.php';
|
||||
$trueframe = mt_rand(1, 9);
|
||||
|
||||
for($i = 0; $i <= 9; $i++) {
|
||||
$this->im = imagecreatefromstring($bgcontent);
|
||||
$x[$i] = $y[$i] = 0;
|
||||
$this->adulterate && $this->adulterate();
|
||||
if($i == $trueframe) {
|
||||
$this->ttf && function_exists('imagettftext') || $this->type == 1 ? $this->ttffont() : $this->giffont();
|
||||
$d[$i] = mt_rand(250, 400);
|
||||
$this->scatter && $this->scatter($this->im);
|
||||
} else {
|
||||
$this->adulteratefont();
|
||||
$d[$i] = mt_rand(5, 15);
|
||||
$this->scatter && $this->scatter($this->im, 1);
|
||||
}
|
||||
ob_start();
|
||||
imagegif($this->im);
|
||||
imagedestroy($this->im);
|
||||
$frame[$i] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
$anim = new GifMerge($frame, 255, 255, 255, 0, $d, $x, $y, 'C_MEMORY');
|
||||
header('Content-type: image/gif');
|
||||
echo $anim->getAnimation();
|
||||
} else {
|
||||
$this->im = imagecreatefromstring($bgcontent);
|
||||
$this->adulterate && $this->adulterate();
|
||||
$this->ttf && function_exists('imagettftext') || $this->type == 1 ? $this->ttffont() : $this->giffont();
|
||||
$this->scatter && $this->scatter($this->im);
|
||||
|
||||
if(function_exists('imagepng')) {
|
||||
header('Content-type: image/png');
|
||||
imagepng($this->im);
|
||||
} else {
|
||||
header('Content-type: image/jpeg');
|
||||
imagejpeg($this->im, '', 100);
|
||||
}
|
||||
imagedestroy($this->im);
|
||||
}
|
||||
}
|
||||
|
||||
function background() {
|
||||
$this->im = imagecreatetruecolor($this->width, $this->height);
|
||||
$backgrounds = $c = array();
|
||||
if($this->background && function_exists('imagecreatefromjpeg') && function_exists('imagecolorat') && function_exists('imagecopymerge') &&
|
||||
function_exists('imagesetpixel') && function_exists('imageSX') && function_exists('imageSY')) {
|
||||
if($handle = @opendir($this->datapath.'background/')) {
|
||||
while($bgfile = @readdir($handle)) {
|
||||
if(preg_match('/\.jpg$/i', $bgfile)) {
|
||||
$backgrounds[] = $this->datapath.'background/'.$bgfile;
|
||||
}
|
||||
}
|
||||
@closedir($handle);
|
||||
}
|
||||
if($backgrounds) {
|
||||
$imwm = imagecreatefromjpeg($backgrounds[array_rand($backgrounds)]);
|
||||
$colorindex = imagecolorat($imwm, 0, 0);
|
||||
$c = imagecolorsforindex($imwm, $colorindex);
|
||||
$colorindex = imagecolorat($imwm, 1, 0);
|
||||
imagesetpixel($imwm, 0, 0, $colorindex);
|
||||
$c[0] = $c['red'];$c[1] = $c['green'];$c[2] = $c['blue'];
|
||||
imagecopymerge($this->im, $imwm, 0, 0, mt_rand(0, 200 - $this->width), mt_rand(0, 80 - $this->height), imageSX($imwm), imageSY($imwm), 100);
|
||||
imagedestroy($imwm);
|
||||
}
|
||||
}
|
||||
if(!$this->background || !$backgrounds) {
|
||||
for($i = 0;$i < 3;$i++) {
|
||||
$start[$i] = mt_rand(200, 255);$end[$i] = mt_rand(100, 150);$step[$i] = ($end[$i] - $start[$i]) / $this->width;$c[$i] = $start[$i];
|
||||
}
|
||||
for($i = 0;$i < $this->width;$i++) {
|
||||
$color = imagecolorallocate($this->im, $c[0], $c[1], $c[2]);
|
||||
imageline($this->im, $i, 0, $i, $this->height, $color);
|
||||
$c[0] += $step[0];$c[1] += $step[1];$c[2] += $step[2];
|
||||
}
|
||||
$c[0] -= 20;$c[1] -= 20;$c[2] -= 20;
|
||||
}
|
||||
ob_start();
|
||||
if(function_exists('imagepng')) {
|
||||
imagepng($this->im);
|
||||
} else {
|
||||
imagejpeg($this->im, '', 100);
|
||||
}
|
||||
imagedestroy($this->im);
|
||||
$bgcontent = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->fontcolor = $c;
|
||||
return $bgcontent;
|
||||
}
|
||||
|
||||
function adulterate() {
|
||||
$linenums = $this->height / 10;
|
||||
for($i = 0; $i <= $linenums;$i++) {
|
||||
$color = $this->color ? imagecolorallocate($this->im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255)) : imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
$x = mt_rand(0, $this->width);
|
||||
$y = mt_rand(0, $this->height);
|
||||
if(mt_rand(0, 1)) {
|
||||
$w = mt_rand(0, $this->width);
|
||||
$h = mt_rand(0, $this->height);
|
||||
$s = mt_rand(0, 360);
|
||||
$e = mt_rand(0, 360);
|
||||
for($j = 0;$j < 3;$j++) {
|
||||
imagearc($this->im, $x + $j, $y, $w, $h, $s, $e, $color);
|
||||
}
|
||||
} else {
|
||||
$xe = mt_rand(0, $this->width);
|
||||
$ye = mt_rand(0, $this->height);
|
||||
imageline($this->im, $x, $y, $xe, $ye, $color);
|
||||
for($j = 0;$j < 3;$j++) {
|
||||
imageline($this->im, $x + $j, $y, $xe, $ye, $color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function adulteratefont() {
|
||||
$seccodeunits = 'BCEFGHJKMPQRTVWXY2346789';
|
||||
$x = $this->width / 4;
|
||||
$y = $this->height / 10;
|
||||
$text_color = imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
for($i = 0; $i <= 3; $i++) {
|
||||
$adulteratecode = $seccodeunits[mt_rand(0, 23)];
|
||||
imagechar($this->im, 5, $x * $i + mt_rand(0, $x - 10), mt_rand($y, $this->height - 10 - $y), $adulteratecode, $text_color);
|
||||
}
|
||||
}
|
||||
|
||||
function ttffont() {
|
||||
$seccode = $this->code;
|
||||
$seccoderoot = $this->type ? $this->fontpath.'ch/' : $this->fontpath.'en/';
|
||||
$dirs = opendir($seccoderoot);
|
||||
$seccodettf = array();
|
||||
while($entry = readdir($dirs)) {
|
||||
if($entry != '.' && $entry != '..' && in_array(strtolower(fileext($entry)), array('ttf', 'ttc'))) {
|
||||
$seccodettf[] = $entry;
|
||||
}
|
||||
}
|
||||
if(empty($seccodettf)) {
|
||||
$this->giffont();
|
||||
return;
|
||||
}
|
||||
$seccodelength = 4;
|
||||
if($this->type && !empty($seccodettf)) {
|
||||
if(strtoupper(CHARSET) != 'UTF-8') {
|
||||
include $this->includepath.'class_chinese.php';
|
||||
$cvt = new Chinese(CHARSET, 'utf8');
|
||||
$seccode = $cvt->Convert($seccode);
|
||||
}
|
||||
$seccode = array(substr($seccode, 0, 3), substr($seccode, 3, 3));
|
||||
$seccodelength = 2;
|
||||
}
|
||||
$widthtotal = 0;
|
||||
for($i = 0; $i < $seccodelength; $i++) {
|
||||
$font[$i]['font'] = $seccoderoot.$seccodettf[array_rand($seccodettf)];
|
||||
$font[$i]['angle'] = $this->angle ? mt_rand(-30, 30) : 0;
|
||||
$font[$i]['size'] = $this->type ? $this->width / 7 : $this->width / 6;
|
||||
$this->size && $font[$i]['size'] = mt_rand($font[$i]['size'] - $this->width / 40, $font[$i]['size'] + $this->width / 20);
|
||||
$box = imagettfbbox($font[$i]['size'], 0, $font[$i]['font'], $seccode[$i]);
|
||||
$font[$i]['zheight'] = max($box[1], $box[3]) - min($box[5], $box[7]);
|
||||
$box = imagettfbbox($font[$i]['size'], $font[$i]['angle'], $font[$i]['font'], $seccode[$i]);
|
||||
$font[$i]['height'] = max($box[1], $box[3]) - min($box[5], $box[7]);
|
||||
$font[$i]['hd'] = $font[$i]['height'] - $font[$i]['zheight'];
|
||||
$font[$i]['width'] = (max($box[2], $box[4]) - min($box[0], $box[6])) + mt_rand(0, $this->width / 8);
|
||||
$font[$i]['width'] = $font[$i]['width'] > $this->width / $seccodelength ? $this->width / $seccodelength : $font[$i]['width'];
|
||||
$widthtotal += $font[$i]['width'];
|
||||
}
|
||||
$x = mt_rand($font[0]['angle'] > 0 ? cos(deg2rad(90 - $font[0]['angle'])) * $font[0]['zheight'] : 1, $this->width - $widthtotal);
|
||||
!$this->color && $text_color = imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
for($i = 0; $i < $seccodelength; $i++) {
|
||||
if($this->color) {
|
||||
$this->fontcolor = array(mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
|
||||
$this->shadow && $text_shadowcolor = imagecolorallocate($this->im, 0, 0, 0);
|
||||
$text_color = imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
} elseif($this->shadow) {
|
||||
$text_shadowcolor = imagecolorallocate($this->im, 0, 0, 0);
|
||||
}
|
||||
$y = $font[0]['angle'] > 0 ? mt_rand($font[$i]['height'], $this->height) : mt_rand($font[$i]['height'] - $font[$i]['hd'], $this->height - $font[$i]['hd']);
|
||||
$this->shadow && imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x + 1, $y + 1, $text_shadowcolor, $font[$i]['font'], $seccode[$i]);
|
||||
imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x, $y, $text_color, $font[$i]['font'], $seccode[$i]);
|
||||
$x += $font[$i]['width'];
|
||||
}
|
||||
$this->warping && $this->warping($this->im);
|
||||
}
|
||||
|
||||
function warping(&$obj) {
|
||||
$rgb = array();
|
||||
$direct = rand(0, 1);
|
||||
$width = imagesx($obj);
|
||||
$height = imagesy($obj);
|
||||
$level = $width / 20;
|
||||
for($j = 0;$j < $height;$j++) {
|
||||
for($i = 0;$i < $width;$i++) {
|
||||
$rgb[$i] = imagecolorat($obj, $i , $j);
|
||||
}
|
||||
for($i = 0;$i < $width;$i++) {
|
||||
$r = sin($j / $height * 2 * M_PI - M_PI * 0.5) * ($direct ? $level : -$level);
|
||||
imagesetpixel($obj, $i + $r , $j , $rgb[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function scatter(&$obj, $level = 0) {
|
||||
$rgb = array();
|
||||
$this->scatter = $level ? $level : $this->scatter;
|
||||
$width = imagesx($obj);
|
||||
$height = imagesy($obj);
|
||||
for($j = 0;$j < $height;$j++) {
|
||||
for($i = 0;$i < $width;$i++) {
|
||||
$rgb[$i] = imagecolorat($obj, $i , $j);
|
||||
}
|
||||
for($i = 0;$i < $width;$i++) {
|
||||
$r = rand(-$this->scatter, $this->scatter);
|
||||
imagesetpixel($obj, $i + $r , $j , $rgb[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function giffont() {
|
||||
$seccode = $this->code;
|
||||
$seccodedir = array();
|
||||
if(function_exists('imagecreatefromgif')) {
|
||||
$seccoderoot = $this->datapath.'gif/';
|
||||
$dirs = opendir($seccoderoot);
|
||||
while($dir = readdir($dirs)) {
|
||||
if($dir != '.' && $dir != '..' && file_exists($seccoderoot.$dir.'/9.gif')) {
|
||||
$seccodedir[] = $dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
$widthtotal = 0;
|
||||
for($i = 0; $i <= 3; $i++) {
|
||||
$this->imcodefile = $seccodedir ? $seccoderoot.$seccodedir[array_rand($seccodedir)].'/'.strtolower($seccode[$i]).'.gif' : '';
|
||||
if(!empty($this->imcodefile) && file_exists($this->imcodefile)) {
|
||||
$font[$i]['file'] = $this->imcodefile;
|
||||
$font[$i]['data'] = getimagesize($this->imcodefile);
|
||||
$font[$i]['width'] = $font[$i]['data'][0] + mt_rand(0, 6) - 4;
|
||||
$font[$i]['height'] = $font[$i]['data'][1] + mt_rand(0, 6) - 4;
|
||||
$font[$i]['width'] += mt_rand(0, $this->width / 5 - $font[$i]['width']);
|
||||
$widthtotal += $font[$i]['width'];
|
||||
} else {
|
||||
$font[$i]['file'] = '';
|
||||
$font[$i]['width'] = 8 + mt_rand(0, $this->width / 5 - 5);
|
||||
$widthtotal += $font[$i]['width'];
|
||||
}
|
||||
}
|
||||
$x = mt_rand(1, $this->width - $widthtotal);
|
||||
for($i = 0; $i <= 3; $i++) {
|
||||
$this->color && $this->fontcolor = array(mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
|
||||
if($font[$i]['file']) {
|
||||
$this->imcode = imagecreatefromgif($font[$i]['file']);
|
||||
if($this->size) {
|
||||
$font[$i]['width'] = mt_rand($font[$i]['width'] - $this->width / 20, $font[$i]['width'] + $this->width / 20);
|
||||
$font[$i]['height'] = mt_rand($font[$i]['height'] - $this->width / 20, $font[$i]['height'] + $this->width / 20);
|
||||
}
|
||||
$y = mt_rand(0, $this->height - $font[$i]['height']);
|
||||
if($this->shadow) {
|
||||
$this->imcodeshadow = $this->imcode;
|
||||
imagecolorset($this->imcodeshadow, 0, 0, 0, 0);
|
||||
imagecopyresized($this->im, $this->imcodeshadow, $x + 1, $y + 1, 0, 0, $font[$i]['width'], $font[$i]['height'], $font[$i]['data'][0], $font[$i]['data'][1]);
|
||||
}
|
||||
imagecolorset($this->imcode, 0 , $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
imagecopyresized($this->im, $this->imcode, $x, $y, 0, 0, $font[$i]['width'], $font[$i]['height'], $font[$i]['data'][0], $font[$i]['data'][1]);
|
||||
} else {
|
||||
$y = mt_rand(0, $this->height - 20);
|
||||
if($this->shadow) {
|
||||
$text_shadowcolor = imagecolorallocate($this->im, 0, 0, 0);
|
||||
imagechar($this->im, 5, $x + 1, $y + 1, $seccode[$i], $text_shadowcolor);
|
||||
}
|
||||
$text_color = imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
|
||||
imagechar($this->im, 5, $x, $y, $seccode[$i], $text_color);
|
||||
}
|
||||
$x += $font[$i]['width'];
|
||||
}
|
||||
}
|
||||
|
||||
function flash() {
|
||||
$spacing = 5;
|
||||
$codewidth = ($this->width - $spacing * 5) / 4;
|
||||
$strforswdaction = '';
|
||||
for($i = 0; $i <= 3; $i++) {
|
||||
$strforswdaction .= $this->swfcode($codewidth, $spacing, $this->code[$i], $i+1);
|
||||
}
|
||||
|
||||
ming_setScale(20.00000000);
|
||||
ming_useswfversion(6);
|
||||
$movie = new SWFMovie();
|
||||
$movie->setDimension($this->width, $this->height);
|
||||
$movie->setBackground(255, 255, 255);
|
||||
$movie->setRate(31);
|
||||
|
||||
$fontcolor = '0x'.(sprintf('%02s', dechex (mt_rand(0, 255)))).(sprintf('%02s', dechex (mt_rand(0, 128)))).(sprintf('%02s', dechex (mt_rand(0, 255))));
|
||||
$strAction = "
|
||||
_root.createEmptyMovieClip ( 'triangle', 1 );
|
||||
with ( _root.triangle ) {
|
||||
lineStyle( 3, $fontcolor, 100 );
|
||||
$strforswdaction
|
||||
}
|
||||
";
|
||||
$movie->add(new SWFAction( str_replace("\r", "", $strAction) ));
|
||||
header('Content-type: application/x-shockwave-flash');
|
||||
$movie->output();
|
||||
}
|
||||
|
||||
function swfcode($width, $d, $code, $order) {
|
||||
$str = '';
|
||||
$height = $this->height - $d * 2;
|
||||
$x_0 = ($order * ($width + $d) - $width);
|
||||
$x_1 = $x_0 + $width / 2;
|
||||
$x_2 = $x_0 + $width;
|
||||
$y_0 = $d;
|
||||
$y_2 = $y_0 + $height;
|
||||
$y_1 = $y_2 / 2;
|
||||
$y_0_5 = $y_2 / 4;
|
||||
$y_1_5 = $y_1 + $y_0_5;
|
||||
switch($code) {
|
||||
case 'B':$str .= 'moveTo('.$x_1.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_1.', '.$y_2.');lineTo('.$x_2.', '.$y_1_5.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_0_5.');lineTo('.$x_1.', '.$y_0.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');';break;
|
||||
case 'C':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case 'E':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');';break;
|
||||
case 'F':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');';break;
|
||||
case 'G':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_2.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');';break;
|
||||
case 'H':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');moveTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_2.', '.$y_1.');';break;
|
||||
case 'J':$str .= 'moveTo('.$x_1.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_0.', '.$y_1_5.');';break;
|
||||
case 'K':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_0.', '.$y_1.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');moveTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case 'M':$str .= 'moveTo('.$x_0.', '.$y_2.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case 'P':$str .= 'moveTo('.$x_0.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_0_5.');lineTo('.$x_1.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');';break;
|
||||
case 'Q':$str .= 'moveTo('.$x_2.', '.$y_2.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_1.', '.$y_1.');';break;
|
||||
case 'R':$str .= 'moveTo('.$x_0.', '.$y_1.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_0_5.');lineTo('.$x_1.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');moveTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case 'T':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');moveTo('.$x_1.', '.$y_0.');lineTo('.$x_1.', '.$y_2.');';break;
|
||||
case 'V':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_1.', '.$y_2.');lineTo('.$x_2.', '.$y_0.');';break;
|
||||
case 'W':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_2.', '.$y_0.');';break;
|
||||
case 'X':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');';break;
|
||||
case 'Y':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_1.', '.$y_1.');lineTo('.$x_2.', '.$y_0.');moveTo('.$x_1.', '.$y_1.');lineTo('.$x_1.', '.$y_2.');';break;
|
||||
case '2':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_1.');lineTo('.$x_0.', '.$y_1.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case '3':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_0.', '.$y_2.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_2.', '.$y_1.');';break;
|
||||
case '4':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');moveTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_1.');lineTo('.$x_2.', '.$y_1.');';break;
|
||||
case '6':$str .= 'moveTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_2.', '.$y_1.');lineTo('.$x_0.', '.$y_1.');';break;
|
||||
case '7':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');';break;
|
||||
case '8':$str .= 'moveTo('.$x_0.', '.$y_0.');lineTo('.$x_0.', '.$y_2.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_0.', '.$y_0.');moveTo('.$x_0.', '.$y_1.');lineTo('.$x_2.', '.$y_1.');';break;
|
||||
case '9':$str .= 'moveTo('.$x_2.', '.$y_1.');lineTo('.$x_0.', '.$y_1.');lineTo('.$x_0.', '.$y_0.');lineTo('.$x_2.', '.$y_0.');lineTo('.$x_2.', '.$y_2.');lineTo('.$x_0.', '.$y_2.');';break;
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
function audio() {
|
||||
header('Content-type: audio/mpeg');
|
||||
for($i = 0;$i <= 3; $i++) {
|
||||
readfile($this->datapath.'sound/'.strtolower($this->code[$i]).'.mp3');
|
||||
}
|
||||
}
|
||||
|
||||
function bitmap() {
|
||||
$numbers = array
|
||||
(
|
||||
'B' => array('00','fc','66','66','66','7c','66','66','fc','00'),
|
||||
'C' => array('00','38','64','c0','c0','c0','c4','64','3c','00'),
|
||||
'E' => array('00','fe','62','62','68','78','6a','62','fe','00'),
|
||||
'F' => array('00','f8','60','60','68','78','6a','62','fe','00'),
|
||||
'G' => array('00','78','cc','cc','de','c0','c4','c4','7c','00'),
|
||||
'H' => array('00','e7','66','66','66','7e','66','66','e7','00'),
|
||||
'J' => array('00','f8','cc','cc','cc','0c','0c','0c','7f','00'),
|
||||
'K' => array('00','f3','66','66','7c','78','6c','66','f7','00'),
|
||||
'M' => array('00','f7','63','6b','6b','77','77','77','e3','00'),
|
||||
'P' => array('00','f8','60','60','7c','66','66','66','fc','00'),
|
||||
'Q' => array('00','78','cc','cc','cc','cc','cc','cc','78','00'),
|
||||
'R' => array('00','f3','66','6c','7c','66','66','66','fc','00'),
|
||||
'T' => array('00','78','30','30','30','30','b4','b4','fc','00'),
|
||||
'V' => array('00','1c','1c','36','36','36','63','63','f7','00'),
|
||||
'W' => array('00','36','36','36','77','7f','6b','63','f7','00'),
|
||||
'X' => array('00','f7','66','3c','18','18','3c','66','ef','00'),
|
||||
'Y' => array('00','7e','18','18','18','3c','24','66','ef','00'),
|
||||
'2' => array('fc','c0','60','30','18','0c','cc','cc','78','00'),
|
||||
'3' => array('78','8c','0c','0c','38','0c','0c','8c','78','00'),
|
||||
'4' => array('00','3e','0c','fe','4c','6c','2c','3c','1c','1c'),
|
||||
'6' => array('78','cc','cc','cc','ec','d8','c0','60','3c','00'),
|
||||
'7' => array('30','30','38','18','18','18','1c','8c','fc','00'),
|
||||
'8' => array('78','cc','cc','cc','78','cc','cc','cc','78','00'),
|
||||
'9' => array('f0','18','0c','6c','dc','cc','cc','cc','78','00')
|
||||
);
|
||||
|
||||
foreach($numbers as $i => $number) {
|
||||
for($j = 0; $j < 6; $j++) {
|
||||
$a1 = substr('012', mt_rand(0, 2), 1).substr('012345', mt_rand(0, 5), 1);
|
||||
$a2 = substr('012345', mt_rand(0, 5), 1).substr('0123', mt_rand(0, 3), 1);
|
||||
mt_rand(0, 1) == 1 ? array_push($numbers[$i], $a1) : array_unshift($numbers[$i], $a1);
|
||||
mt_rand(0, 1) == 0 ? array_push($numbers[$i], $a1) : array_unshift($numbers[$i], $a2);
|
||||
}
|
||||
}
|
||||
|
||||
$bitmap = array();
|
||||
for($i = 0; $i < 20; $i++) {
|
||||
for($j = 0; $j <= 3; $j++) {
|
||||
$bytes = $numbers[$this->code[$j]][$i];
|
||||
$a = mt_rand(0, 14);
|
||||
array_push($bitmap, $bytes);
|
||||
}
|
||||
}
|
||||
|
||||
for($i = 0; $i < 8; $i++) {
|
||||
$a = substr('012345', mt_rand(0, 2), 1) . substr('012345', mt_rand(0, 5), 1);
|
||||
array_unshift($bitmap, $a);
|
||||
array_push($bitmap, $a);
|
||||
}
|
||||
|
||||
$image = pack('H*', '424d9e000000000000003e000000280000002000000018000000010001000000'.
|
||||
'0000600000000000000000000000000000000000000000000000FFFFFF00'.implode('', $bitmap));
|
||||
|
||||
header('Content-Type: image/bmp');
|
||||
echo $image;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,140 +1,140 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
function xml2array(&$xml, $isnormal = FALSE,$encodeing='ISO-8859-1') {
|
||||
$xml_parser = new XMLparse($isnormal,$encodeing);
|
||||
$data = $xml_parser->parse($xml);
|
||||
$xml_parser->destruct();
|
||||
return $data;
|
||||
}
|
||||
|
||||
function xmlattribute( $xml, $encodeing='ISO-8859-1') {
|
||||
$xml = str_replace($encodeing, 'UTF-8', $xml);
|
||||
libxml_disable_entity_loader(true);
|
||||
$values = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement')), true);
|
||||
if( $values["item"] ){
|
||||
$data=attribute2arr($values["item"]);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function attribute2arr( $values,$data=array() ){
|
||||
foreach( $values as $k=>$v ){
|
||||
if( isset($v["item"]) ){
|
||||
$return = attribute2arr($v["item"]);
|
||||
if($return) $data[$v['@attributes']["id"]]=$return ;
|
||||
}
|
||||
if( count($v['@attributes'])>1 ){
|
||||
$data[$v['@attributes']["id"]]["_attributes"]=$v['@attributes'];
|
||||
unset($data[$v['@attributes']["id"]]["_attributes"]["id"]);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
function array2xml($arr, $htmlon = TRUE, $isnormal = FALSE, $level = 1,$encodeing='ISO-8859-1') {
|
||||
$s = $level == 1 ? "<?xml version=\"1.0\" encoding=\"".$encodeing."\"?>\r\n<root>\r\n" : '';
|
||||
$space = str_repeat("\t", $level);
|
||||
|
||||
foreach($arr as $k => $v) {
|
||||
if($k=="_attributes"){
|
||||
continue;
|
||||
}
|
||||
|
||||
$string="";
|
||||
if( isset($arr['_attributes'])){
|
||||
foreach($arr["_attributes"] as $k2=>$v2){
|
||||
if($k2==$k){
|
||||
foreach($v2 as $k3=>$v3){
|
||||
$string.=' '.$k3.'="'.$v3.'"';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!is_array($v)) {
|
||||
$s .= $space."<item id=\"$k\"$string>".($htmlon ? '<![CDATA[' : '').$v.($htmlon ? ']]>' : '')."</item>\r\n";
|
||||
} else {
|
||||
$s .= $space."<item id=\"$k\"$string>\r\n".array2xml($v, $htmlon, $isnormal, $level + 1,$encodeing).$space."</item>\r\n";
|
||||
}
|
||||
}
|
||||
$s = preg_replace("/([\x01-\x08\x0b-\x0c\x0e-\x1f])+/", ' ', $s);
|
||||
return $level == 1 ? $s."</root>" : $s;
|
||||
}
|
||||
|
||||
class XMLparse {
|
||||
|
||||
var $parser;
|
||||
var $document;
|
||||
var $stack;
|
||||
var $data;
|
||||
var $last_opened_tag;
|
||||
var $isnormal;
|
||||
var $attrs = array();
|
||||
var $failed = FALSE;
|
||||
|
||||
function __construct($isnormal,$encodeing) {
|
||||
$this->XMLparse($isnormal,$encodeing);
|
||||
}
|
||||
|
||||
function XMLparse($isnormal,$encodeing) {
|
||||
$this->isnormal = $isnormal;
|
||||
$this->parser = xml_parser_create($encodeing);
|
||||
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
|
||||
xml_set_object($this->parser, $this);
|
||||
xml_set_element_handler($this->parser, 'open','close');
|
||||
xml_set_character_data_handler($this->parser, 'data');
|
||||
}
|
||||
|
||||
function destruct() {
|
||||
xml_parser_free($this->parser);
|
||||
}
|
||||
|
||||
function parse(&$data) {
|
||||
$this->document = array();
|
||||
$this->stack = array();
|
||||
return xml_parse($this->parser, $data, true) && !$this->failed ? $this->document : '';
|
||||
}
|
||||
|
||||
function open(&$parser, $tag, $attributes) {
|
||||
$this->data = '';
|
||||
$this->failed = FALSE;
|
||||
if(!$this->isnormal) {
|
||||
if(isset($attributes['id']) && !is_string($this->document[$attributes['id']])) {
|
||||
$this->document = &$this->document[$attributes['id']];
|
||||
} else {
|
||||
$this->failed = TRUE;
|
||||
}
|
||||
} else {
|
||||
if(!isset($this->document[$tag]) || !is_string($this->document[$tag])) {
|
||||
$this->document = &$this->document[$tag];
|
||||
} else {
|
||||
$this->failed = TRUE;
|
||||
}
|
||||
}
|
||||
$this->stack[] = &$this->document;
|
||||
$this->last_opened_tag = $tag;
|
||||
$this->attrs = $attributes;
|
||||
}
|
||||
|
||||
function data(&$parser, $data) {
|
||||
if($this->last_opened_tag != NULL) {
|
||||
$this->data .= $data;
|
||||
}
|
||||
}
|
||||
|
||||
function close(&$parser, $tag) {
|
||||
if($this->last_opened_tag == $tag) {
|
||||
$this->document = $this->data;
|
||||
$this->last_opened_tag = NULL;
|
||||
}
|
||||
array_pop($this->stack);
|
||||
if($this->stack) {
|
||||
$this->document = &$this->stack[count($this->stack)-1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
function xml2array(&$xml, $isnormal = FALSE,$encodeing='ISO-8859-1') {
|
||||
$xml_parser = new XMLparse($isnormal,$encodeing);
|
||||
$data = $xml_parser->parse($xml);
|
||||
$xml_parser->destruct();
|
||||
return $data;
|
||||
}
|
||||
|
||||
function xmlattribute( $xml, $encodeing='ISO-8859-1') {
|
||||
$xml = str_replace($encodeing, 'UTF-8', $xml);
|
||||
libxml_disable_entity_loader(true);
|
||||
$values = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement')), true);
|
||||
if( $values["item"] ){
|
||||
$data=attribute2arr($values["item"]);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function attribute2arr( $values,$data=array() ){
|
||||
foreach( $values as $k=>$v ){
|
||||
if( isset($v["item"]) ){
|
||||
$return = attribute2arr($v["item"]);
|
||||
if($return) $data[$v['@attributes']["id"]]=$return ;
|
||||
}
|
||||
if( count($v['@attributes'])>1 ){
|
||||
$data[$v['@attributes']["id"]]["_attributes"]=$v['@attributes'];
|
||||
unset($data[$v['@attributes']["id"]]["_attributes"]["id"]);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
function array2xml($arr, $htmlon = TRUE, $isnormal = FALSE, $level = 1,$encodeing='ISO-8859-1') {
|
||||
$s = $level == 1 ? "<?xml version=\"1.0\" encoding=\"".$encodeing."\"?>\r\n<root>\r\n" : '';
|
||||
$space = str_repeat("\t", $level);
|
||||
|
||||
foreach($arr as $k => $v) {
|
||||
if($k=="_attributes"){
|
||||
continue;
|
||||
}
|
||||
|
||||
$string="";
|
||||
if( isset($arr['_attributes'])){
|
||||
foreach($arr["_attributes"] as $k2=>$v2){
|
||||
if($k2==$k){
|
||||
foreach($v2 as $k3=>$v3){
|
||||
$string.=' '.$k3.'="'.$v3.'"';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!is_array($v)) {
|
||||
$s .= $space."<item id=\"$k\"$string>".($htmlon ? '<![CDATA[' : '').$v.($htmlon ? ']]>' : '')."</item>\r\n";
|
||||
} else {
|
||||
$s .= $space."<item id=\"$k\"$string>\r\n".array2xml($v, $htmlon, $isnormal, $level + 1,$encodeing).$space."</item>\r\n";
|
||||
}
|
||||
}
|
||||
$s = preg_replace("/([\x01-\x08\x0b-\x0c\x0e-\x1f])+/", ' ', $s);
|
||||
return $level == 1 ? $s."</root>" : $s;
|
||||
}
|
||||
|
||||
class XMLparse {
|
||||
|
||||
var $parser;
|
||||
var $document;
|
||||
var $stack;
|
||||
var $data;
|
||||
var $last_opened_tag;
|
||||
var $isnormal;
|
||||
var $attrs = array();
|
||||
var $failed = FALSE;
|
||||
|
||||
function __construct($isnormal,$encodeing) {
|
||||
$this->XMLparse($isnormal,$encodeing);
|
||||
}
|
||||
|
||||
function XMLparse($isnormal,$encodeing) {
|
||||
$this->isnormal = $isnormal;
|
||||
$this->parser = xml_parser_create($encodeing);
|
||||
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
|
||||
xml_set_object($this->parser, $this);
|
||||
xml_set_element_handler($this->parser, 'open','close');
|
||||
xml_set_character_data_handler($this->parser, 'data');
|
||||
}
|
||||
|
||||
function destruct() {
|
||||
xml_parser_free($this->parser);
|
||||
}
|
||||
|
||||
function parse(&$data) {
|
||||
$this->document = array();
|
||||
$this->stack = array();
|
||||
return xml_parse($this->parser, $data, true) && !$this->failed ? $this->document : '';
|
||||
}
|
||||
|
||||
function open(&$parser, $tag, $attributes) {
|
||||
$this->data = '';
|
||||
$this->failed = FALSE;
|
||||
if(!$this->isnormal) {
|
||||
if(isset($attributes['id']) && !is_string($this->document[$attributes['id']])) {
|
||||
$this->document = &$this->document[$attributes['id']];
|
||||
} else {
|
||||
$this->failed = TRUE;
|
||||
}
|
||||
} else {
|
||||
if(!isset($this->document[$tag]) || !is_string($this->document[$tag])) {
|
||||
$this->document = &$this->document[$tag];
|
||||
} else {
|
||||
$this->failed = TRUE;
|
||||
}
|
||||
}
|
||||
$this->stack[] = &$this->document;
|
||||
$this->last_opened_tag = $tag;
|
||||
$this->attrs = $attributes;
|
||||
}
|
||||
|
||||
function data(&$parser, $data) {
|
||||
if($this->last_opened_tag != NULL) {
|
||||
$this->data .= $data;
|
||||
}
|
||||
}
|
||||
|
||||
function close(&$parser, $tag) {
|
||||
if($this->last_opened_tag == $tag) {
|
||||
$this->document = $this->data;
|
||||
$this->last_opened_tag = NULL;
|
||||
}
|
||||
array_pop($this->stack);
|
||||
if($this->stack) {
|
||||
$this->document = &$this->stack[count($this->stack)-1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,309 +1,309 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
|
||||
class zipfile {
|
||||
var $datasec = array();
|
||||
|
||||
var $ctrl_dir = array();
|
||||
|
||||
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
|
||||
|
||||
var $old_offset = 0;
|
||||
function unix2DosTime($unixtime = 0) {
|
||||
$timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);
|
||||
|
||||
if($timearray['year'] < 1980) {
|
||||
$timearray['year'] = 1980;
|
||||
$timearray['mon'] = 1;
|
||||
$timearray['mday'] = 1;
|
||||
$timearray['hours'] = 0;
|
||||
$timearray['minutes'] = 0;
|
||||
$timearray['seconds'] = 0;
|
||||
} // end if
|
||||
|
||||
return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) |
|
||||
($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1);
|
||||
} // end of the 'unix2DosTime()' method
|
||||
|
||||
|
||||
function addFile($data, $name, $time = 0) {
|
||||
$name = str_replace('\\', '/', $name);
|
||||
|
||||
$dtime = dechex($this->unix2DosTime($time));
|
||||
$hexdtime = '\x' . $dtime[6] . $dtime[7]
|
||||
. '\x' . $dtime[4] . $dtime[5]
|
||||
. '\x' . $dtime[2] . $dtime[3]
|
||||
. '\x' . $dtime[0] . $dtime[1];
|
||||
eval('$hexdtime = "' . $hexdtime . '";');
|
||||
|
||||
$fr = "\x50\x4b\x03\x04";
|
||||
$fr .= "\x14\x00"; // ver needed to extract
|
||||
$fr .= "\x00\x00"; // gen purpose bit flag
|
||||
$fr .= "\x08\x00"; // compression method
|
||||
$fr .= $hexdtime; // last mod time and date
|
||||
|
||||
$unc_len = strlen($data);
|
||||
$crc = crc32($data);
|
||||
$zdata = gzcompress($data);
|
||||
$zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug
|
||||
$c_len = strlen($zdata);
|
||||
$fr .= pack('V', $crc); // crc32
|
||||
$fr .= pack('V', $c_len); // compressed filesize
|
||||
$fr .= pack('V', $unc_len); // uncompressed filesize
|
||||
$fr .= pack('v', strlen($name)); // length of filename
|
||||
$fr .= pack('v', 0); // extra field length
|
||||
$fr .= $name;
|
||||
|
||||
$fr .= $zdata;
|
||||
|
||||
|
||||
$this -> datasec[] = $fr;
|
||||
|
||||
$cdrec = "\x50\x4b\x01\x02";
|
||||
$cdrec .= "\x00\x00"; // version made by
|
||||
$cdrec .= "\x14\x00"; // version needed to extract
|
||||
$cdrec .= "\x00\x00"; // gen purpose bit flag
|
||||
$cdrec .= "\x08\x00"; // compression method
|
||||
$cdrec .= $hexdtime; // last mod time & date
|
||||
$cdrec .= pack('V', $crc); // crc32
|
||||
$cdrec .= pack('V', $c_len); // compressed filesize
|
||||
$cdrec .= pack('V', $unc_len); // uncompressed filesize
|
||||
$cdrec .= pack('v', strlen($name) ); // length of filename
|
||||
$cdrec .= pack('v', 0 ); // extra field length
|
||||
$cdrec .= pack('v', 0 ); // file comment length
|
||||
$cdrec .= pack('v', 0 ); // disk number start
|
||||
$cdrec .= pack('v', 0 ); // internal file attributes
|
||||
$cdrec .= pack('V', 32 ); // external file attributes - 'archive' bit set
|
||||
|
||||
$cdrec .= pack('V', $this -> old_offset ); // relative offset of local header
|
||||
$this -> old_offset += strlen($fr);
|
||||
|
||||
$cdrec .= $name;
|
||||
|
||||
$this -> ctrl_dir[] = $cdrec;
|
||||
} // end of the 'addFile()' method
|
||||
|
||||
|
||||
function file() {
|
||||
$data = implode('', $this -> datasec);
|
||||
$ctrldir = implode('', $this -> ctrl_dir);
|
||||
|
||||
return
|
||||
$data .
|
||||
$ctrldir .
|
||||
$this -> eof_ctrl_dir .
|
||||
pack('v', sizeof($this -> ctrl_dir)) . // total # of entries "on this disk"
|
||||
pack('v', sizeof($this -> ctrl_dir)) . // total # of entries overall
|
||||
pack('V', strlen($ctrldir)) . // size of central dir
|
||||
pack('V', strlen($data)) . // offset to start of central dir
|
||||
"\x00\x00"; // .zip file comment length
|
||||
} // end of the 'file()' method
|
||||
|
||||
} // end of the 'zipfile' class
|
||||
|
||||
|
||||
class SimpleUnzip {
|
||||
var $Comment = '';
|
||||
|
||||
var $Entries = array();
|
||||
|
||||
var $Name = '';
|
||||
|
||||
var $Size = 0;
|
||||
|
||||
var $Time = 0;
|
||||
|
||||
function SimpleUnzip($in_FileName = '') {
|
||||
if($in_FileName !== '') {
|
||||
SimpleUnzip::ReadFile($in_FileName);
|
||||
}
|
||||
} // end of the 'SimpleUnzip' constructor
|
||||
|
||||
function Count() {
|
||||
return count($this->Entries);
|
||||
} // end of the 'Count()' method
|
||||
|
||||
function GetData($in_Index) {
|
||||
return $this->Entries[$in_Index]->Data;
|
||||
} // end of the 'GetData()' method
|
||||
|
||||
function GetEntry($in_Index) {
|
||||
return $this->Entries[$in_Index];
|
||||
} // end of the 'GetEntry()' method
|
||||
|
||||
function GetError($in_Index) {
|
||||
return $this->Entries[$in_Index]->Error;
|
||||
} // end of the 'GetError()' method
|
||||
|
||||
function GetErrorMsg($in_Index) {
|
||||
return $this->Entries[$in_Index]->ErrorMsg;
|
||||
} // end of the 'GetErrorMsg()' method
|
||||
|
||||
function GetName($in_Index) {
|
||||
return $this->Entries[$in_Index]->Name;
|
||||
} // end of the 'GetName()' method
|
||||
|
||||
function GetPath($in_Index) {
|
||||
return $this->Entries[$in_Index]->Path;
|
||||
} // end of the 'GetPath()' method
|
||||
|
||||
function GetTime($in_Index) {
|
||||
return $this->Entries[$in_Index]->Time;
|
||||
} // end of the 'GetTime()' method
|
||||
|
||||
function ReadFile($in_FileName) {
|
||||
$this->Entries = array();
|
||||
|
||||
$this->Name = $in_FileName;
|
||||
$this->Time = filemtime($in_FileName);
|
||||
$this->Size = filesize($in_FileName);
|
||||
|
||||
$oF = fopen($in_FileName, 'rb');
|
||||
$vZ = fread($oF, $this->Size);
|
||||
fclose($oF);
|
||||
|
||||
$aE = explode("\x50\x4b\x05\x06", $vZ);
|
||||
|
||||
|
||||
$aP = unpack('x16/v1CL', $aE[1]);
|
||||
$this->Comment = substr($aE[1], 18, $aP['CL']);
|
||||
|
||||
$this->Comment = strtr($this->Comment, array("\r\n" => "\n",
|
||||
"\r" => "\n"));
|
||||
|
||||
$aE = explode("\x50\x4b\x01\x02", $vZ);
|
||||
$aE = explode("\x50\x4b\x03\x04", $aE[0]);
|
||||
array_shift($aE);
|
||||
|
||||
foreach($aE as $vZ) {
|
||||
$aI = array();
|
||||
$aI['E'] = 0;
|
||||
$aI['EM'] = '';
|
||||
$aP = unpack('v1VN/v1GPF/v1CM/v1FT/v1FD/V1CRC/V1CS/V1UCS/v1FNL', $vZ);
|
||||
$bE = ($aP['GPF'] && 0x0001) ? TRUE : FALSE;
|
||||
$nF = $aP['FNL'];
|
||||
|
||||
if($aP['GPF'] & 0x0008) {
|
||||
$aP1 = unpack('V1CRC/V1CS/V1UCS', substr($vZ, -12));
|
||||
|
||||
$aP['CRC'] = $aP1['CRC'];
|
||||
$aP['CS'] = $aP1['CS'];
|
||||
$aP['UCS'] = $aP1['UCS'];
|
||||
|
||||
$vZ = substr($vZ, 0, -12);
|
||||
}
|
||||
|
||||
$aI['N'] = substr($vZ, 26, $nF);
|
||||
|
||||
if(substr($aI['N'], -1) == '/') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$aI['P'] = dirname($aI['N']);
|
||||
$aI['P'] = $aI['P'] == '.' ? '' : $aI['P'];
|
||||
$aI['N'] = basename($aI['N']);
|
||||
|
||||
$vZ = substr($vZ, 26 + $nF);
|
||||
|
||||
if(strlen($vZ) != $aP['CS']) {
|
||||
$aI['E'] = 1;
|
||||
$aI['EM'] = 'Compressed size is not equal with the value in header information.';
|
||||
} else {
|
||||
if($bE) {
|
||||
$aI['E'] = 5;
|
||||
$aI['EM'] = 'File is encrypted, which is not supported from this class.';
|
||||
} else {
|
||||
switch($aP['CM']) {
|
||||
case 0: // Stored
|
||||
break;
|
||||
|
||||
case 8: // Deflated
|
||||
$vZ = gzinflate($vZ);
|
||||
break;
|
||||
|
||||
case 12: // BZIP2
|
||||
if(! extension_loaded('bz2')) {
|
||||
if(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
||||
@dl('php_bz2.dll');
|
||||
} else {
|
||||
@dl('bz2.so');
|
||||
}
|
||||
}
|
||||
|
||||
if(extension_loaded('bz2')) {
|
||||
$vZ = bzdecompress($vZ);
|
||||
} else {
|
||||
$aI['E'] = 7;
|
||||
$aI['EM'] = "PHP BZIP2 extension not available.";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$aI['E'] = 6;
|
||||
$aI['EM'] = "De-/Compression method {$aP['CM']} is not supported.";
|
||||
}
|
||||
|
||||
if(! $aI['E']) {
|
||||
if($vZ === FALSE) {
|
||||
$aI['E'] = 2;
|
||||
$aI['EM'] = 'Decompression of data failed.';
|
||||
} else {
|
||||
if(strlen($vZ) != $aP['UCS']) {
|
||||
$aI['E'] = 3;
|
||||
$aI['EM'] = 'Uncompressed size is not equal with the value in header information.';
|
||||
} else {
|
||||
if(crc32($vZ) != $aP['CRC']) {
|
||||
$aI['E'] = 4;
|
||||
$aI['EM'] = 'CRC32 checksum is not equal with the value in header information.';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$aI['D'] = $vZ;
|
||||
|
||||
$aI['T'] = @mktime(($aP['FT'] & 0xf800) >> 11,
|
||||
($aP['FT'] & 0x07e0) >> 5,
|
||||
($aP['FT'] & 0x001f) << 1,
|
||||
($aP['FD'] & 0x01e0) >> 5,
|
||||
($aP['FD'] & 0x001f),
|
||||
(($aP['FD'] & 0xfe00) >> 9) + 1980);
|
||||
|
||||
$this->Entries[] = new SimpleUnzipEntry($aI);
|
||||
} // end for each entries
|
||||
|
||||
return $this->Entries;
|
||||
} // end of the 'ReadFile()' method
|
||||
} // end of the 'SimpleUnzip' class
|
||||
|
||||
class SimpleUnzipEntry {
|
||||
var $Data = '';
|
||||
|
||||
var $Error = 0;
|
||||
|
||||
var $ErrorMsg = '';
|
||||
|
||||
var $Name = '';
|
||||
|
||||
var $Path = '';
|
||||
|
||||
var $Time = 0;
|
||||
|
||||
function SimpleUnzipEntry($in_Entry) {
|
||||
$this->Data = $in_Entry['D'];
|
||||
$this->Error = $in_Entry['E'];
|
||||
$this->ErrorMsg = $in_Entry['EM'];
|
||||
$this->Name = $in_Entry['N'];
|
||||
$this->Path = $in_Entry['P'];
|
||||
$this->Time = $in_Entry['T'];
|
||||
} // end of the 'SimpleUnzipEntry' constructor
|
||||
} // end of the 'SimpleUnzipEntry' class
|
||||
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
|
||||
class zipfile {
|
||||
var $datasec = array();
|
||||
|
||||
var $ctrl_dir = array();
|
||||
|
||||
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
|
||||
|
||||
var $old_offset = 0;
|
||||
function unix2DosTime($unixtime = 0) {
|
||||
$timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);
|
||||
|
||||
if($timearray['year'] < 1980) {
|
||||
$timearray['year'] = 1980;
|
||||
$timearray['mon'] = 1;
|
||||
$timearray['mday'] = 1;
|
||||
$timearray['hours'] = 0;
|
||||
$timearray['minutes'] = 0;
|
||||
$timearray['seconds'] = 0;
|
||||
} // end if
|
||||
|
||||
return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) |
|
||||
($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1);
|
||||
} // end of the 'unix2DosTime()' method
|
||||
|
||||
|
||||
function addFile($data, $name, $time = 0) {
|
||||
$name = str_replace('\\', '/', $name);
|
||||
|
||||
$dtime = dechex($this->unix2DosTime($time));
|
||||
$hexdtime = '\x' . $dtime[6] . $dtime[7]
|
||||
. '\x' . $dtime[4] . $dtime[5]
|
||||
. '\x' . $dtime[2] . $dtime[3]
|
||||
. '\x' . $dtime[0] . $dtime[1];
|
||||
eval('$hexdtime = "' . $hexdtime . '";');
|
||||
|
||||
$fr = "\x50\x4b\x03\x04";
|
||||
$fr .= "\x14\x00"; // ver needed to extract
|
||||
$fr .= "\x00\x00"; // gen purpose bit flag
|
||||
$fr .= "\x08\x00"; // compression method
|
||||
$fr .= $hexdtime; // last mod time and date
|
||||
|
||||
$unc_len = strlen($data);
|
||||
$crc = crc32($data);
|
||||
$zdata = gzcompress($data);
|
||||
$zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug
|
||||
$c_len = strlen($zdata);
|
||||
$fr .= pack('V', $crc); // crc32
|
||||
$fr .= pack('V', $c_len); // compressed filesize
|
||||
$fr .= pack('V', $unc_len); // uncompressed filesize
|
||||
$fr .= pack('v', strlen($name)); // length of filename
|
||||
$fr .= pack('v', 0); // extra field length
|
||||
$fr .= $name;
|
||||
|
||||
$fr .= $zdata;
|
||||
|
||||
|
||||
$this -> datasec[] = $fr;
|
||||
|
||||
$cdrec = "\x50\x4b\x01\x02";
|
||||
$cdrec .= "\x00\x00"; // version made by
|
||||
$cdrec .= "\x14\x00"; // version needed to extract
|
||||
$cdrec .= "\x00\x00"; // gen purpose bit flag
|
||||
$cdrec .= "\x08\x00"; // compression method
|
||||
$cdrec .= $hexdtime; // last mod time & date
|
||||
$cdrec .= pack('V', $crc); // crc32
|
||||
$cdrec .= pack('V', $c_len); // compressed filesize
|
||||
$cdrec .= pack('V', $unc_len); // uncompressed filesize
|
||||
$cdrec .= pack('v', strlen($name) ); // length of filename
|
||||
$cdrec .= pack('v', 0 ); // extra field length
|
||||
$cdrec .= pack('v', 0 ); // file comment length
|
||||
$cdrec .= pack('v', 0 ); // disk number start
|
||||
$cdrec .= pack('v', 0 ); // internal file attributes
|
||||
$cdrec .= pack('V', 32 ); // external file attributes - 'archive' bit set
|
||||
|
||||
$cdrec .= pack('V', $this -> old_offset ); // relative offset of local header
|
||||
$this -> old_offset += strlen($fr);
|
||||
|
||||
$cdrec .= $name;
|
||||
|
||||
$this -> ctrl_dir[] = $cdrec;
|
||||
} // end of the 'addFile()' method
|
||||
|
||||
|
||||
function file() {
|
||||
$data = implode('', $this -> datasec);
|
||||
$ctrldir = implode('', $this -> ctrl_dir);
|
||||
|
||||
return
|
||||
$data .
|
||||
$ctrldir .
|
||||
$this -> eof_ctrl_dir .
|
||||
pack('v', sizeof($this -> ctrl_dir)) . // total # of entries "on this disk"
|
||||
pack('v', sizeof($this -> ctrl_dir)) . // total # of entries overall
|
||||
pack('V', strlen($ctrldir)) . // size of central dir
|
||||
pack('V', strlen($data)) . // offset to start of central dir
|
||||
"\x00\x00"; // .zip file comment length
|
||||
} // end of the 'file()' method
|
||||
|
||||
} // end of the 'zipfile' class
|
||||
|
||||
|
||||
class SimpleUnzip {
|
||||
var $Comment = '';
|
||||
|
||||
var $Entries = array();
|
||||
|
||||
var $Name = '';
|
||||
|
||||
var $Size = 0;
|
||||
|
||||
var $Time = 0;
|
||||
|
||||
function SimpleUnzip($in_FileName = '') {
|
||||
if($in_FileName !== '') {
|
||||
SimpleUnzip::ReadFile($in_FileName);
|
||||
}
|
||||
} // end of the 'SimpleUnzip' constructor
|
||||
|
||||
function Count() {
|
||||
return count($this->Entries);
|
||||
} // end of the 'Count()' method
|
||||
|
||||
function GetData($in_Index) {
|
||||
return $this->Entries[$in_Index]->Data;
|
||||
} // end of the 'GetData()' method
|
||||
|
||||
function GetEntry($in_Index) {
|
||||
return $this->Entries[$in_Index];
|
||||
} // end of the 'GetEntry()' method
|
||||
|
||||
function GetError($in_Index) {
|
||||
return $this->Entries[$in_Index]->Error;
|
||||
} // end of the 'GetError()' method
|
||||
|
||||
function GetErrorMsg($in_Index) {
|
||||
return $this->Entries[$in_Index]->ErrorMsg;
|
||||
} // end of the 'GetErrorMsg()' method
|
||||
|
||||
function GetName($in_Index) {
|
||||
return $this->Entries[$in_Index]->Name;
|
||||
} // end of the 'GetName()' method
|
||||
|
||||
function GetPath($in_Index) {
|
||||
return $this->Entries[$in_Index]->Path;
|
||||
} // end of the 'GetPath()' method
|
||||
|
||||
function GetTime($in_Index) {
|
||||
return $this->Entries[$in_Index]->Time;
|
||||
} // end of the 'GetTime()' method
|
||||
|
||||
function ReadFile($in_FileName) {
|
||||
$this->Entries = array();
|
||||
|
||||
$this->Name = $in_FileName;
|
||||
$this->Time = filemtime($in_FileName);
|
||||
$this->Size = filesize($in_FileName);
|
||||
|
||||
$oF = fopen($in_FileName, 'rb');
|
||||
$vZ = fread($oF, $this->Size);
|
||||
fclose($oF);
|
||||
|
||||
$aE = explode("\x50\x4b\x05\x06", $vZ);
|
||||
|
||||
|
||||
$aP = unpack('x16/v1CL', $aE[1]);
|
||||
$this->Comment = substr($aE[1], 18, $aP['CL']);
|
||||
|
||||
$this->Comment = strtr($this->Comment, array("\r\n" => "\n",
|
||||
"\r" => "\n"));
|
||||
|
||||
$aE = explode("\x50\x4b\x01\x02", $vZ);
|
||||
$aE = explode("\x50\x4b\x03\x04", $aE[0]);
|
||||
array_shift($aE);
|
||||
|
||||
foreach($aE as $vZ) {
|
||||
$aI = array();
|
||||
$aI['E'] = 0;
|
||||
$aI['EM'] = '';
|
||||
$aP = unpack('v1VN/v1GPF/v1CM/v1FT/v1FD/V1CRC/V1CS/V1UCS/v1FNL', $vZ);
|
||||
$bE = ($aP['GPF'] && 0x0001) ? TRUE : FALSE;
|
||||
$nF = $aP['FNL'];
|
||||
|
||||
if($aP['GPF'] & 0x0008) {
|
||||
$aP1 = unpack('V1CRC/V1CS/V1UCS', substr($vZ, -12));
|
||||
|
||||
$aP['CRC'] = $aP1['CRC'];
|
||||
$aP['CS'] = $aP1['CS'];
|
||||
$aP['UCS'] = $aP1['UCS'];
|
||||
|
||||
$vZ = substr($vZ, 0, -12);
|
||||
}
|
||||
|
||||
$aI['N'] = substr($vZ, 26, $nF);
|
||||
|
||||
if(substr($aI['N'], -1) == '/') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$aI['P'] = dirname($aI['N']);
|
||||
$aI['P'] = $aI['P'] == '.' ? '' : $aI['P'];
|
||||
$aI['N'] = basename($aI['N']);
|
||||
|
||||
$vZ = substr($vZ, 26 + $nF);
|
||||
|
||||
if(strlen($vZ) != $aP['CS']) {
|
||||
$aI['E'] = 1;
|
||||
$aI['EM'] = 'Compressed size is not equal with the value in header information.';
|
||||
} else {
|
||||
if($bE) {
|
||||
$aI['E'] = 5;
|
||||
$aI['EM'] = 'File is encrypted, which is not supported from this class.';
|
||||
} else {
|
||||
switch($aP['CM']) {
|
||||
case 0: // Stored
|
||||
break;
|
||||
|
||||
case 8: // Deflated
|
||||
$vZ = gzinflate($vZ);
|
||||
break;
|
||||
|
||||
case 12: // BZIP2
|
||||
if(! extension_loaded('bz2')) {
|
||||
if(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
||||
@dl('php_bz2.dll');
|
||||
} else {
|
||||
@dl('bz2.so');
|
||||
}
|
||||
}
|
||||
|
||||
if(extension_loaded('bz2')) {
|
||||
$vZ = bzdecompress($vZ);
|
||||
} else {
|
||||
$aI['E'] = 7;
|
||||
$aI['EM'] = "PHP BZIP2 extension not available.";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$aI['E'] = 6;
|
||||
$aI['EM'] = "De-/Compression method {$aP['CM']} is not supported.";
|
||||
}
|
||||
|
||||
if(! $aI['E']) {
|
||||
if($vZ === FALSE) {
|
||||
$aI['E'] = 2;
|
||||
$aI['EM'] = 'Decompression of data failed.';
|
||||
} else {
|
||||
if(strlen($vZ) != $aP['UCS']) {
|
||||
$aI['E'] = 3;
|
||||
$aI['EM'] = 'Uncompressed size is not equal with the value in header information.';
|
||||
} else {
|
||||
if(crc32($vZ) != $aP['CRC']) {
|
||||
$aI['E'] = 4;
|
||||
$aI['EM'] = 'CRC32 checksum is not equal with the value in header information.';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$aI['D'] = $vZ;
|
||||
|
||||
$aI['T'] = @mktime(($aP['FT'] & 0xf800) >> 11,
|
||||
($aP['FT'] & 0x07e0) >> 5,
|
||||
($aP['FT'] & 0x001f) << 1,
|
||||
($aP['FD'] & 0x01e0) >> 5,
|
||||
($aP['FD'] & 0x001f),
|
||||
(($aP['FD'] & 0xfe00) >> 9) + 1980);
|
||||
|
||||
$this->Entries[] = new SimpleUnzipEntry($aI);
|
||||
} // end for each entries
|
||||
|
||||
return $this->Entries;
|
||||
} // end of the 'ReadFile()' method
|
||||
} // end of the 'SimpleUnzip' class
|
||||
|
||||
class SimpleUnzipEntry {
|
||||
var $Data = '';
|
||||
|
||||
var $Error = 0;
|
||||
|
||||
var $ErrorMsg = '';
|
||||
|
||||
var $Name = '';
|
||||
|
||||
var $Path = '';
|
||||
|
||||
var $Time = 0;
|
||||
|
||||
function SimpleUnzipEntry($in_Entry) {
|
||||
$this->Data = $in_Entry['D'];
|
||||
$this->Error = $in_Entry['E'];
|
||||
$this->ErrorMsg = $in_Entry['EM'];
|
||||
$this->Name = $in_Entry['N'];
|
||||
$this->Path = $in_Entry['P'];
|
||||
$this->Time = $in_Entry['T'];
|
||||
} // end of the 'SimpleUnzipEntry' constructor
|
||||
} // end of the 'SimpleUnzipEntry' class
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,221 +1,221 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class db_driver_mysql
|
||||
{
|
||||
var $tablepre;
|
||||
var $version = '';
|
||||
var $drivertype = 'mysql';
|
||||
var $querynum = 0;
|
||||
var $slaveid = 0;
|
||||
var $curlink;
|
||||
var $link = array();
|
||||
var $config = array();
|
||||
var $sqldebug = array();
|
||||
var $map = array();
|
||||
|
||||
function db_mysql($config = array()) {
|
||||
if(!empty($config)) {
|
||||
$this->set_config($config);
|
||||
}
|
||||
}
|
||||
|
||||
function set_config($config) {
|
||||
$this->config = &$config;
|
||||
$this->tablepre = $config['1']['tablepre'];
|
||||
if(!empty($this->config['map'])) {
|
||||
$this->map = $this->config['map'];
|
||||
for($i = 1; $i <= 100; $i++) {
|
||||
if(isset($this->map['attachment']) && $i <= 10) {
|
||||
$this->map['attachment_'.($i-1)] = $this->map['attachment'];
|
||||
}
|
||||
}
|
||||
if(isset($this->map['user'])) {
|
||||
$this->map['user_status'] =
|
||||
$this->map['user_profile'] =
|
||||
$this->map['user_field'] =
|
||||
$this->map['user'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function linknum(){
|
||||
return $this->curlink;
|
||||
}
|
||||
|
||||
function connect($serverid = 1) {
|
||||
|
||||
if(empty($this->config) || empty($this->config[$serverid])) {
|
||||
$this->halt('config_db_not_found');
|
||||
}
|
||||
if(!empty($this->config[$serverid]['unix_socket'])){//使用socket连接;
|
||||
$this->config[$serverid]['dbhost']=$this->config[$serverid]['unix_socket'];
|
||||
}elseif($this->config[$serverid]['port']){
|
||||
list($dbhost,$port)=explode(':',$this->config[$serverid]['dbhost']);
|
||||
$this->config[$serverid]['dbhost']=$dbhost.':'.$this->config[$serverid]['port'];
|
||||
}
|
||||
$this->link[$serverid] = $this->_dbconnect(
|
||||
$this->config[$serverid]['dbhost'],
|
||||
$this->config[$serverid]['dbuser'],
|
||||
$this->config[$serverid]['dbpw'],
|
||||
$this->config[$serverid]['dbcharset'],
|
||||
$this->config[$serverid]['dbname'],
|
||||
$this->config[$serverid]['pconnect']
|
||||
);
|
||||
$this->curlink = $this->link[$serverid];
|
||||
|
||||
}
|
||||
|
||||
function _dbconnect($dbhost, $dbuser, $dbpw, $dbcharset, $dbname, $pconnect, $halt = true) {
|
||||
|
||||
if($pconnect) {
|
||||
$link = @mysql_pconnect($dbhost, $dbuser, $dbpw);
|
||||
} else {
|
||||
$link = @mysql_connect($dbhost, $dbuser, $dbpw, 1);
|
||||
}
|
||||
if(!$link) {
|
||||
$halt && $this->halt('notconnect', $this->errno());
|
||||
} else {
|
||||
$this->curlink = $link;
|
||||
if($this->version() > '4.1') {
|
||||
$dbcharset = $dbcharset ? $dbcharset : $this->config[1]['dbcharset'];
|
||||
$serverset = $dbcharset ? 'character_set_connection='.$dbcharset.', character_set_results='.$dbcharset.', character_set_client=binary' : '';
|
||||
$serverset .= $this->version() > '5.0.1' ? ((empty($serverset) ? '' : ',').'sql_mode=\'\'') : '';
|
||||
$serverset && mysql_query("SET $serverset", $link);
|
||||
}
|
||||
$dbname && @mysql_select_db($dbname, $link);
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
function table_name($tablename) {
|
||||
if(!empty($this->map) && !empty($this->map[$tablename])) {
|
||||
$id = $this->map[$tablename];
|
||||
if(!$this->link[$id]) {
|
||||
$this->connect($id);
|
||||
}
|
||||
$this->curlink = $this->link[$id];
|
||||
} else {
|
||||
$this->curlink = $this->link[1];
|
||||
}
|
||||
return $this->tablepre.$tablename;
|
||||
}
|
||||
|
||||
function select_db($dbname) {
|
||||
return mysql_select_db($dbname, $this->curlink);
|
||||
}
|
||||
|
||||
function fetch_array($query, $result_type = MYSQL_ASSOC) {
|
||||
if($result_type == 'MYSQL_ASSOC') $result_type = MYSQL_ASSOC;
|
||||
return mysql_fetch_array($query, $result_type);
|
||||
}
|
||||
|
||||
function fetch_first($sql) {
|
||||
return $this->fetch_array($this->query($sql));
|
||||
}
|
||||
|
||||
function result_first($sql) {
|
||||
return $this->result($this->query($sql), 0);
|
||||
}
|
||||
|
||||
public function query($sql, $silent = false, $unbuffered = false) {
|
||||
if(defined('DZZ_DEBUG') && DZZ_DEBUG) {
|
||||
$starttime = microtime(true);
|
||||
}
|
||||
|
||||
if('UNBUFFERED' === $silent) {
|
||||
$silent = false;
|
||||
$unbuffered = true;
|
||||
} elseif('SILENT' === $silent) {
|
||||
$silent = true;
|
||||
$unbuffered = false;
|
||||
}
|
||||
|
||||
$func = $unbuffered ? 'mysql_unbuffered_query' : 'mysql_query';
|
||||
|
||||
if(!($query = $func($sql, $this->curlink))) {
|
||||
if(in_array($this->errno(), array(2006, 2013)) && substr($silent, 0, 5) != 'RETRY') {
|
||||
$this->connect();
|
||||
return $this->query($sql, 'RETRY'.$silent);
|
||||
}
|
||||
if(!$silent) {
|
||||
$this->halt($this->error(), $this->errno(), $sql);
|
||||
}
|
||||
}
|
||||
|
||||
if(defined('DZZ_DEBUG') && DZZ_DEBUG) {
|
||||
$this->sqldebug[] = array($sql, number_format((microtime(true) - $starttime), 6), debug_backtrace(), $this->curlink);
|
||||
}
|
||||
|
||||
$this->querynum++;
|
||||
return $query;
|
||||
}
|
||||
|
||||
function affected_rows() {
|
||||
return mysql_affected_rows($this->curlink);
|
||||
}
|
||||
|
||||
function error() {
|
||||
return (($this->curlink) ? mysql_error($this->curlink) : mysql_error());
|
||||
}
|
||||
|
||||
function errno() {
|
||||
return intval(($this->curlink) ? mysql_errno($this->curlink) : mysql_errno());
|
||||
}
|
||||
|
||||
function result($query, $row = 0) {
|
||||
$query = @mysql_result($query, $row);
|
||||
return $query;
|
||||
}
|
||||
|
||||
function num_rows($query) {
|
||||
$query = mysql_num_rows($query);
|
||||
return $query;
|
||||
}
|
||||
|
||||
function num_fields($query) {
|
||||
return mysql_num_fields($query);
|
||||
}
|
||||
|
||||
function free_result($query) {
|
||||
return mysql_free_result($query);
|
||||
}
|
||||
|
||||
function insert_id() {
|
||||
return ($id = mysql_insert_id($this->curlink)) >= 0 ? $id : $this->result($this->query("SELECT last_insert_id()"), 0);
|
||||
}
|
||||
|
||||
function fetch_row($query) {
|
||||
$query = mysql_fetch_row($query);
|
||||
return $query;
|
||||
}
|
||||
|
||||
function fetch_fields($query) {
|
||||
return mysql_fetch_field($query);
|
||||
}
|
||||
|
||||
function version() {
|
||||
if(empty($this->version)) {
|
||||
$this->version = mysql_get_server_info($this->curlink);
|
||||
}
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
function escape_string($str) {
|
||||
return mysql_escape_string($str);
|
||||
}
|
||||
|
||||
function close() {
|
||||
return mysql_close($this->curlink);
|
||||
}
|
||||
|
||||
function halt($message = '', $code = 0, $sql = '') {
|
||||
throw new DbException($message, $code, $sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class db_driver_mysql
|
||||
{
|
||||
var $tablepre;
|
||||
var $version = '';
|
||||
var $drivertype = 'mysql';
|
||||
var $querynum = 0;
|
||||
var $slaveid = 0;
|
||||
var $curlink;
|
||||
var $link = array();
|
||||
var $config = array();
|
||||
var $sqldebug = array();
|
||||
var $map = array();
|
||||
|
||||
function db_mysql($config = array()) {
|
||||
if(!empty($config)) {
|
||||
$this->set_config($config);
|
||||
}
|
||||
}
|
||||
|
||||
function set_config($config) {
|
||||
$this->config = &$config;
|
||||
$this->tablepre = $config['1']['tablepre'];
|
||||
if(!empty($this->config['map'])) {
|
||||
$this->map = $this->config['map'];
|
||||
for($i = 1; $i <= 100; $i++) {
|
||||
if(isset($this->map['attachment']) && $i <= 10) {
|
||||
$this->map['attachment_'.($i-1)] = $this->map['attachment'];
|
||||
}
|
||||
}
|
||||
if(isset($this->map['user'])) {
|
||||
$this->map['user_status'] =
|
||||
$this->map['user_profile'] =
|
||||
$this->map['user_field'] =
|
||||
$this->map['user'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function linknum(){
|
||||
return $this->curlink;
|
||||
}
|
||||
|
||||
function connect($serverid = 1) {
|
||||
|
||||
if(empty($this->config) || empty($this->config[$serverid])) {
|
||||
$this->halt('config_db_not_found');
|
||||
}
|
||||
if(!empty($this->config[$serverid]['unix_socket'])){//使用socket连接;
|
||||
$this->config[$serverid]['dbhost']=$this->config[$serverid]['unix_socket'];
|
||||
}elseif($this->config[$serverid]['port']){
|
||||
list($dbhost,$port)=explode(':',$this->config[$serverid]['dbhost']);
|
||||
$this->config[$serverid]['dbhost']=$dbhost.':'.$this->config[$serverid]['port'];
|
||||
}
|
||||
$this->link[$serverid] = $this->_dbconnect(
|
||||
$this->config[$serverid]['dbhost'],
|
||||
$this->config[$serverid]['dbuser'],
|
||||
$this->config[$serverid]['dbpw'],
|
||||
$this->config[$serverid]['dbcharset'],
|
||||
$this->config[$serverid]['dbname'],
|
||||
$this->config[$serverid]['pconnect']
|
||||
);
|
||||
$this->curlink = $this->link[$serverid];
|
||||
|
||||
}
|
||||
|
||||
function _dbconnect($dbhost, $dbuser, $dbpw, $dbcharset, $dbname, $pconnect, $halt = true) {
|
||||
|
||||
if($pconnect) {
|
||||
$link = @mysql_pconnect($dbhost, $dbuser, $dbpw);
|
||||
} else {
|
||||
$link = @mysql_connect($dbhost, $dbuser, $dbpw, 1);
|
||||
}
|
||||
if(!$link) {
|
||||
$halt && $this->halt('notconnect', $this->errno());
|
||||
} else {
|
||||
$this->curlink = $link;
|
||||
if($this->version() > '4.1') {
|
||||
$dbcharset = $dbcharset ? $dbcharset : $this->config[1]['dbcharset'];
|
||||
$serverset = $dbcharset ? 'character_set_connection='.$dbcharset.', character_set_results='.$dbcharset.', character_set_client=binary' : '';
|
||||
$serverset .= $this->version() > '5.0.1' ? ((empty($serverset) ? '' : ',').'sql_mode=\'\'') : '';
|
||||
$serverset && mysql_query("SET $serverset", $link);
|
||||
}
|
||||
$dbname && @mysql_select_db($dbname, $link);
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
function table_name($tablename) {
|
||||
if(!empty($this->map) && !empty($this->map[$tablename])) {
|
||||
$id = $this->map[$tablename];
|
||||
if(!$this->link[$id]) {
|
||||
$this->connect($id);
|
||||
}
|
||||
$this->curlink = $this->link[$id];
|
||||
} else {
|
||||
$this->curlink = $this->link[1];
|
||||
}
|
||||
return $this->tablepre.$tablename;
|
||||
}
|
||||
|
||||
function select_db($dbname) {
|
||||
return mysql_select_db($dbname, $this->curlink);
|
||||
}
|
||||
|
||||
function fetch_array($query, $result_type = MYSQL_ASSOC) {
|
||||
if($result_type == 'MYSQL_ASSOC') $result_type = MYSQL_ASSOC;
|
||||
return mysql_fetch_array($query, $result_type);
|
||||
}
|
||||
|
||||
function fetch_first($sql) {
|
||||
return $this->fetch_array($this->query($sql));
|
||||
}
|
||||
|
||||
function result_first($sql) {
|
||||
return $this->result($this->query($sql), 0);
|
||||
}
|
||||
|
||||
public function query($sql, $silent = false, $unbuffered = false) {
|
||||
if(defined('DZZ_DEBUG') && DZZ_DEBUG) {
|
||||
$starttime = microtime(true);
|
||||
}
|
||||
|
||||
if('UNBUFFERED' === $silent) {
|
||||
$silent = false;
|
||||
$unbuffered = true;
|
||||
} elseif('SILENT' === $silent) {
|
||||
$silent = true;
|
||||
$unbuffered = false;
|
||||
}
|
||||
|
||||
$func = $unbuffered ? 'mysql_unbuffered_query' : 'mysql_query';
|
||||
|
||||
if(!($query = $func($sql, $this->curlink))) {
|
||||
if(in_array($this->errno(), array(2006, 2013)) && substr($silent, 0, 5) != 'RETRY') {
|
||||
$this->connect();
|
||||
return $this->query($sql, 'RETRY'.$silent);
|
||||
}
|
||||
if(!$silent) {
|
||||
$this->halt($this->error(), $this->errno(), $sql);
|
||||
}
|
||||
}
|
||||
|
||||
if(defined('DZZ_DEBUG') && DZZ_DEBUG) {
|
||||
$this->sqldebug[] = array($sql, number_format((microtime(true) - $starttime), 6), debug_backtrace(), $this->curlink);
|
||||
}
|
||||
|
||||
$this->querynum++;
|
||||
return $query;
|
||||
}
|
||||
|
||||
function affected_rows() {
|
||||
return mysql_affected_rows($this->curlink);
|
||||
}
|
||||
|
||||
function error() {
|
||||
return (($this->curlink) ? mysql_error($this->curlink) : mysql_error());
|
||||
}
|
||||
|
||||
function errno() {
|
||||
return intval(($this->curlink) ? mysql_errno($this->curlink) : mysql_errno());
|
||||
}
|
||||
|
||||
function result($query, $row = 0) {
|
||||
$query = @mysql_result($query, $row);
|
||||
return $query;
|
||||
}
|
||||
|
||||
function num_rows($query) {
|
||||
$query = mysql_num_rows($query);
|
||||
return $query;
|
||||
}
|
||||
|
||||
function num_fields($query) {
|
||||
return mysql_num_fields($query);
|
||||
}
|
||||
|
||||
function free_result($query) {
|
||||
return mysql_free_result($query);
|
||||
}
|
||||
|
||||
function insert_id() {
|
||||
return ($id = mysql_insert_id($this->curlink)) >= 0 ? $id : $this->result($this->query("SELECT last_insert_id()"), 0);
|
||||
}
|
||||
|
||||
function fetch_row($query) {
|
||||
$query = mysql_fetch_row($query);
|
||||
return $query;
|
||||
}
|
||||
|
||||
function fetch_fields($query) {
|
||||
return mysql_fetch_field($query);
|
||||
}
|
||||
|
||||
function version() {
|
||||
if(empty($this->version)) {
|
||||
$this->version = mysql_get_server_info($this->curlink);
|
||||
}
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
function escape_string($str) {
|
||||
return mysql_escape_string($str);
|
||||
}
|
||||
|
||||
function close() {
|
||||
return mysql_close($this->curlink);
|
||||
}
|
||||
|
||||
function halt($message = '', $code = 0, $sql = '') {
|
||||
throw new DbException($message, $code, $sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,85 +1,85 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class db_driver_mysql_slave extends db_driver_mysql
|
||||
{
|
||||
|
||||
public $slaveid = null;
|
||||
|
||||
public $slavequery = 0;
|
||||
|
||||
public $slaveexcept = false;
|
||||
|
||||
public $excepttables = array();
|
||||
|
||||
public $tablename = '';
|
||||
|
||||
protected $_weighttable = array();
|
||||
|
||||
public $serverid = null;
|
||||
|
||||
function set_config($config) {
|
||||
parent::set_config($config);
|
||||
|
||||
if($this->config['common']['slave_except_table']) {
|
||||
$this->excepttables = explode(',', str_replace(' ', '', $this->config['common']['slave_except_table']));
|
||||
}
|
||||
}
|
||||
|
||||
public function table_name($tablename) {
|
||||
$this->tablename = $tablename;
|
||||
if(!$this->slaveexcept && $this->excepttables) {
|
||||
$this->slaveexcept = in_array($tablename, $this->excepttables, true);
|
||||
}
|
||||
$this->serverid = isset($this->map[$this->tablename]) ? $this->map[$this->tablename] : 1;
|
||||
return $this->tablepre.$tablename;
|
||||
}
|
||||
|
||||
protected function _slave_connect() {
|
||||
if(!empty($this->config[$this->serverid]['slave'])) {
|
||||
$this->_choose_slave();
|
||||
if($this->slaveid) {
|
||||
if(!isset($this->link[$this->slaveid])) {
|
||||
$this->connect($this->slaveid);
|
||||
}
|
||||
$this->slavequery ++;
|
||||
$this->curlink = $this->link[$this->slaveid];
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function _choose_slave(){
|
||||
if(!isset($this->_weighttable[$this->serverid])) {
|
||||
foreach ($this->config[$this->serverid]['slave'] as $key => $value) {
|
||||
$this->_weighttable[$this->serverid] .= str_repeat($key, 1 + intval($value['weight']));
|
||||
}
|
||||
}
|
||||
$sid = $this->_weighttable[$this->serverid][mt_rand(0, strlen($this->_weighttable[$this->serverid]) -1)];
|
||||
$this->slaveid = $this->serverid.'_'.$sid;
|
||||
if(!isset($this->config[$this->slaveid])) {
|
||||
$this->config[$this->slaveid] = $this->config[$this->serverid]['slave'][$sid];
|
||||
}
|
||||
}
|
||||
|
||||
protected function _master_connect() {
|
||||
if(!$this->link[$this->serverid]) {
|
||||
$this->connect($this->serverid);
|
||||
}
|
||||
$this->curlink = $this->link[$this->serverid];
|
||||
}
|
||||
|
||||
public function query($sql, $silent = false, $unbuffered = false) {
|
||||
if(!(!$this->slaveexcept && strtoupper(substr($sql, 0 , 6)) === 'SELECT' && $this->_slave_connect())) {
|
||||
$this->_master_connect();
|
||||
}
|
||||
$this->tablename = '';
|
||||
$this->slaveexcept = false;
|
||||
return parent::query($sql, $silent, $unbuffered);
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class db_driver_mysql_slave extends db_driver_mysql
|
||||
{
|
||||
|
||||
public $slaveid = null;
|
||||
|
||||
public $slavequery = 0;
|
||||
|
||||
public $slaveexcept = false;
|
||||
|
||||
public $excepttables = array();
|
||||
|
||||
public $tablename = '';
|
||||
|
||||
protected $_weighttable = array();
|
||||
|
||||
public $serverid = null;
|
||||
|
||||
function set_config($config) {
|
||||
parent::set_config($config);
|
||||
|
||||
if($this->config['common']['slave_except_table']) {
|
||||
$this->excepttables = explode(',', str_replace(' ', '', $this->config['common']['slave_except_table']));
|
||||
}
|
||||
}
|
||||
|
||||
public function table_name($tablename) {
|
||||
$this->tablename = $tablename;
|
||||
if(!$this->slaveexcept && $this->excepttables) {
|
||||
$this->slaveexcept = in_array($tablename, $this->excepttables, true);
|
||||
}
|
||||
$this->serverid = isset($this->map[$this->tablename]) ? $this->map[$this->tablename] : 1;
|
||||
return $this->tablepre.$tablename;
|
||||
}
|
||||
|
||||
protected function _slave_connect() {
|
||||
if(!empty($this->config[$this->serverid]['slave'])) {
|
||||
$this->_choose_slave();
|
||||
if($this->slaveid) {
|
||||
if(!isset($this->link[$this->slaveid])) {
|
||||
$this->connect($this->slaveid);
|
||||
}
|
||||
$this->slavequery ++;
|
||||
$this->curlink = $this->link[$this->slaveid];
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function _choose_slave(){
|
||||
if(!isset($this->_weighttable[$this->serverid])) {
|
||||
foreach ($this->config[$this->serverid]['slave'] as $key => $value) {
|
||||
$this->_weighttable[$this->serverid] .= str_repeat($key, 1 + intval($value['weight']));
|
||||
}
|
||||
}
|
||||
$sid = $this->_weighttable[$this->serverid][mt_rand(0, strlen($this->_weighttable[$this->serverid]) -1)];
|
||||
$this->slaveid = $this->serverid.'_'.$sid;
|
||||
if(!isset($this->config[$this->slaveid])) {
|
||||
$this->config[$this->slaveid] = $this->config[$this->serverid]['slave'][$sid];
|
||||
}
|
||||
}
|
||||
|
||||
protected function _master_connect() {
|
||||
if(!$this->link[$this->serverid]) {
|
||||
$this->connect($this->serverid);
|
||||
}
|
||||
$this->curlink = $this->link[$this->serverid];
|
||||
}
|
||||
|
||||
public function query($sql, $silent = false, $unbuffered = false) {
|
||||
if(!(!$this->slaveexcept && strtoupper(substr($sql, 0 , 6)) === 'SELECT' && $this->_slave_connect())) {
|
||||
$this->_master_connect();
|
||||
}
|
||||
$this->tablename = '';
|
||||
$this->slaveexcept = false;
|
||||
return parent::query($sql, $silent, $unbuffered);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,225 +1,225 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
|
||||
class db_driver_mysqli
|
||||
{
|
||||
var $tablepre;
|
||||
var $version = '';
|
||||
var $drivertype = 'mysqli';
|
||||
var $querynum = 0;
|
||||
var $slaveid = 0;
|
||||
var $curlink;
|
||||
var $link = array();
|
||||
var $config = array();
|
||||
var $sqldebug = array();
|
||||
var $map = array();
|
||||
|
||||
function db_mysql($config = array()) {
|
||||
if(!empty($config)) {
|
||||
$this->set_config($config);
|
||||
}
|
||||
}
|
||||
|
||||
function set_config($config) {
|
||||
$this->config = &$config;
|
||||
$this->tablepre = $config['1']['tablepre'];
|
||||
if(!empty($this->config['map'])) {
|
||||
$this->map = $this->config['map'];
|
||||
for($i = 1; $i <= 100; $i++) {
|
||||
if(isset($this->map['attachment']) && $i <= 10) {
|
||||
$this->map['attachment_'.($i-1)] = $this->map['attachment'];
|
||||
}
|
||||
if(isset($this->map['user'])) {
|
||||
$this->map['user_status'] =
|
||||
$this->map['user_profile'] =
|
||||
$this->map['user_field'] =
|
||||
$this->map['user'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function linknum(){
|
||||
return $this->curlink;
|
||||
}
|
||||
|
||||
function connect($serverid = 1) {
|
||||
|
||||
if(empty($this->config) || empty($this->config[$serverid])) {
|
||||
$this->halt('config_db_not_found');
|
||||
}
|
||||
//兼容支持域名直接带有端口的情况
|
||||
if(strpos($this->config[$serverid]['dbhost'],':')!==false){
|
||||
list($dbhost,$port)=explode(':',$this->config[$serverid]['dbhost']);
|
||||
if($port && empty($this->config[$serverid]['port'])) $this->config[$serverid]['port']=$port;
|
||||
if($dbhost) $this->config[$serverid]['dbhost']=$dbhost;
|
||||
}elseif(strpos($this->config[$serverid]['dbhost'],'.sock')!==false){//地址直接是socket地址
|
||||
$this->config[$serverid]['unix_socket']=$this->config[$serverid]['dbhost'];
|
||||
$this->config[$serverid]['dbhost']='localhost';
|
||||
}
|
||||
if(empty($this->config[$serverid]['port'])) $this->config[$serverid]['port']='3306';
|
||||
|
||||
$this->link[$serverid] = $this->_dbconnect(
|
||||
$this->config[$serverid]['dbhost'],
|
||||
$this->config[$serverid]['dbuser'],
|
||||
$this->config[$serverid]['dbpw'],
|
||||
$this->config[$serverid]['dbcharset'],
|
||||
$this->config[$serverid]['dbname'],
|
||||
$this->config[$serverid]['pconnect'],
|
||||
$this->config[$serverid]['port'],
|
||||
$this->config[$serverid]['unix_socket']
|
||||
);
|
||||
$this->curlink = $this->link[$serverid];
|
||||
}
|
||||
|
||||
function _dbconnect($dbhost, $dbuser, $dbpw, $dbcharset, $dbname, $pconnect,$port='3306',$unix_socket='', $halt = true) {
|
||||
$link = new mysqli();
|
||||
if(!$link->real_connect($dbhost, $dbuser, $dbpw, $dbname, $port, $unix_socket)) {
|
||||
$halt && $this->halt('notconnect', $this->errno());
|
||||
} else {
|
||||
$this->curlink = $link;
|
||||
if($this->version() > '4.1') {
|
||||
$link->set_charset($dbcharset ? $dbcharset : $this->config[1]['dbcharset']);
|
||||
$serverset = $this->version() > '5.0.1' ? 'sql_mode=\'\'' : '';
|
||||
$serverset && $link->query("SET $serverset");
|
||||
}
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
function table_name($tablename) {
|
||||
if(!empty($this->map) && !empty($this->map[$tablename])) {
|
||||
$id = $this->map[$tablename];
|
||||
if(!$this->link[$id]) {
|
||||
$this->connect($id);
|
||||
}
|
||||
$this->curlink = $this->link[$id];
|
||||
} else {
|
||||
$this->curlink = $this->link[1];
|
||||
}
|
||||
return $this->tablepre.$tablename;
|
||||
}
|
||||
|
||||
function select_db($dbname) {
|
||||
return $this->curlink->select_db($dbname);
|
||||
}
|
||||
|
||||
function fetch_array($query, $result_type = MYSQLI_ASSOC) {
|
||||
if($result_type == 'MYSQL_ASSOC') $result_type = MYSQLI_ASSOC;
|
||||
return $query ? $query->fetch_array($result_type) : null;
|
||||
}
|
||||
|
||||
function fetch_first($sql) {
|
||||
return $this->fetch_array($this->query($sql));
|
||||
}
|
||||
|
||||
function result_first($sql) {
|
||||
return $this->result($this->query($sql), 0);
|
||||
}
|
||||
|
||||
public function query($sql, $silent = false, $unbuffered = false) {
|
||||
if(defined('DZZ_DEBUG') && DZZ_DEBUG) {
|
||||
$starttime = microtime(true);
|
||||
}
|
||||
|
||||
if('UNBUFFERED' === $silent) {
|
||||
$silent = false;
|
||||
$unbuffered = true;
|
||||
} elseif('SILENT' === $silent) {
|
||||
$silent = true;
|
||||
$unbuffered = false;
|
||||
}
|
||||
|
||||
$resultmode = $unbuffered ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT;
|
||||
|
||||
if(!($query = $this->curlink->query($sql, $resultmode))) {
|
||||
if(in_array($this->errno(), array(2006, 2013)) && substr($silent, 0, 5) != 'RETRY') {
|
||||
$this->connect();
|
||||
return $this->curlink->query($sql, 'RETRY'.$silent);
|
||||
}
|
||||
if(!$silent) {
|
||||
$this->halt($this->error(), $this->errno(), $sql);
|
||||
}
|
||||
}
|
||||
|
||||
if(defined('DZZ_DEBUG') && DZZ_DEBUG) {
|
||||
$this->sqldebug[] = array($sql, number_format((microtime(true) - $starttime), 6), debug_backtrace(), $this->curlink);
|
||||
}
|
||||
|
||||
$this->querynum++;
|
||||
return $query;
|
||||
}
|
||||
|
||||
function affected_rows() {
|
||||
return $this->curlink->affected_rows;
|
||||
}
|
||||
|
||||
function error() {
|
||||
return (($this->curlink) ? $this->curlink->error : mysqli_error());
|
||||
}
|
||||
|
||||
function errno() {
|
||||
return intval(($this->curlink) ? $this->curlink->errno : mysqli_errno());
|
||||
}
|
||||
|
||||
function result($query, $row = 0) {
|
||||
if(!$query || $query->num_rows == 0) {
|
||||
return null;
|
||||
}
|
||||
$query->data_seek($row);
|
||||
$assocs = $query->fetch_row();
|
||||
return $assocs[0];
|
||||
}
|
||||
|
||||
function num_rows($query) {
|
||||
$query = $query ? $query->num_rows : 0;
|
||||
return $query;
|
||||
}
|
||||
|
||||
function num_fields($query) {
|
||||
return $query ? $query->field_count : null;
|
||||
}
|
||||
|
||||
function free_result($query) {
|
||||
return $query ? $query->free() : false;
|
||||
}
|
||||
|
||||
function insert_id() {
|
||||
return ($id = $this->curlink->insert_id) >= 0 ? $id : $this->result($this->query("SELECT last_insert_id()"), 0);
|
||||
}
|
||||
|
||||
function fetch_row($query) {
|
||||
$query = $query ? $query->fetch_row() : null;
|
||||
return $query;
|
||||
}
|
||||
|
||||
function fetch_fields($query) {
|
||||
return $query ? $query->fetch_field() : null;
|
||||
}
|
||||
|
||||
function version() {
|
||||
if(empty($this->version)) {
|
||||
$this->version = $this->curlink->server_info;
|
||||
}
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
function escape_string($str) {
|
||||
return $this->curlink->escape_string($str);
|
||||
}
|
||||
|
||||
function close() {
|
||||
return $this->curlink->close();
|
||||
}
|
||||
|
||||
function halt($message = '', $code = 0, $sql = '') {
|
||||
throw new DbException($message, $code, $sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
|
||||
class db_driver_mysqli
|
||||
{
|
||||
var $tablepre;
|
||||
var $version = '';
|
||||
var $drivertype = 'mysqli';
|
||||
var $querynum = 0;
|
||||
var $slaveid = 0;
|
||||
var $curlink;
|
||||
var $link = array();
|
||||
var $config = array();
|
||||
var $sqldebug = array();
|
||||
var $map = array();
|
||||
|
||||
function db_mysql($config = array()) {
|
||||
if(!empty($config)) {
|
||||
$this->set_config($config);
|
||||
}
|
||||
}
|
||||
|
||||
function set_config($config) {
|
||||
$this->config = &$config;
|
||||
$this->tablepre = $config['1']['tablepre'];
|
||||
if(!empty($this->config['map'])) {
|
||||
$this->map = $this->config['map'];
|
||||
for($i = 1; $i <= 100; $i++) {
|
||||
if(isset($this->map['attachment']) && $i <= 10) {
|
||||
$this->map['attachment_'.($i-1)] = $this->map['attachment'];
|
||||
}
|
||||
if(isset($this->map['user'])) {
|
||||
$this->map['user_status'] =
|
||||
$this->map['user_profile'] =
|
||||
$this->map['user_field'] =
|
||||
$this->map['user'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function linknum(){
|
||||
return $this->curlink;
|
||||
}
|
||||
|
||||
function connect($serverid = 1) {
|
||||
|
||||
if(empty($this->config) || empty($this->config[$serverid])) {
|
||||
$this->halt('config_db_not_found');
|
||||
}
|
||||
//兼容支持域名直接带有端口的情况
|
||||
if(strpos($this->config[$serverid]['dbhost'],':')!==false){
|
||||
list($dbhost,$port)=explode(':',$this->config[$serverid]['dbhost']);
|
||||
if($port && empty($this->config[$serverid]['port'])) $this->config[$serverid]['port']=$port;
|
||||
if($dbhost) $this->config[$serverid]['dbhost']=$dbhost;
|
||||
}elseif(strpos($this->config[$serverid]['dbhost'],'.sock')!==false){//地址直接是socket地址
|
||||
$this->config[$serverid]['unix_socket']=$this->config[$serverid]['dbhost'];
|
||||
$this->config[$serverid]['dbhost']='localhost';
|
||||
}
|
||||
if(empty($this->config[$serverid]['port'])) $this->config[$serverid]['port']='3306';
|
||||
|
||||
$this->link[$serverid] = $this->_dbconnect(
|
||||
$this->config[$serverid]['dbhost'],
|
||||
$this->config[$serverid]['dbuser'],
|
||||
$this->config[$serverid]['dbpw'],
|
||||
$this->config[$serverid]['dbcharset'],
|
||||
$this->config[$serverid]['dbname'],
|
||||
$this->config[$serverid]['pconnect'],
|
||||
$this->config[$serverid]['port'],
|
||||
$this->config[$serverid]['unix_socket']
|
||||
);
|
||||
$this->curlink = $this->link[$serverid];
|
||||
}
|
||||
|
||||
function _dbconnect($dbhost, $dbuser, $dbpw, $dbcharset, $dbname, $pconnect,$port='3306',$unix_socket='', $halt = true) {
|
||||
$link = new mysqli();
|
||||
if(!$link->real_connect($dbhost, $dbuser, $dbpw, $dbname, $port, $unix_socket)) {
|
||||
$halt && $this->halt('notconnect', $this->errno());
|
||||
} else {
|
||||
$this->curlink = $link;
|
||||
if($this->version() > '4.1') {
|
||||
$link->set_charset($dbcharset ? $dbcharset : $this->config[1]['dbcharset']);
|
||||
$serverset = $this->version() > '5.0.1' ? 'sql_mode=\'\'' : '';
|
||||
$serverset && $link->query("SET $serverset");
|
||||
}
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
function table_name($tablename) {
|
||||
if(!empty($this->map) && !empty($this->map[$tablename])) {
|
||||
$id = $this->map[$tablename];
|
||||
if(!$this->link[$id]) {
|
||||
$this->connect($id);
|
||||
}
|
||||
$this->curlink = $this->link[$id];
|
||||
} else {
|
||||
$this->curlink = $this->link[1];
|
||||
}
|
||||
return $this->tablepre.$tablename;
|
||||
}
|
||||
|
||||
function select_db($dbname) {
|
||||
return $this->curlink->select_db($dbname);
|
||||
}
|
||||
|
||||
function fetch_array($query, $result_type = MYSQLI_ASSOC) {
|
||||
if($result_type == 'MYSQL_ASSOC') $result_type = MYSQLI_ASSOC;
|
||||
return $query ? $query->fetch_array($result_type) : null;
|
||||
}
|
||||
|
||||
function fetch_first($sql) {
|
||||
return $this->fetch_array($this->query($sql));
|
||||
}
|
||||
|
||||
function result_first($sql) {
|
||||
return $this->result($this->query($sql), 0);
|
||||
}
|
||||
|
||||
public function query($sql, $silent = false, $unbuffered = false) {
|
||||
if(defined('DZZ_DEBUG') && DZZ_DEBUG) {
|
||||
$starttime = microtime(true);
|
||||
}
|
||||
|
||||
if('UNBUFFERED' === $silent) {
|
||||
$silent = false;
|
||||
$unbuffered = true;
|
||||
} elseif('SILENT' === $silent) {
|
||||
$silent = true;
|
||||
$unbuffered = false;
|
||||
}
|
||||
|
||||
$resultmode = $unbuffered ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT;
|
||||
|
||||
if(!($query = $this->curlink->query($sql, $resultmode))) {
|
||||
if(in_array($this->errno(), array(2006, 2013)) && substr($silent, 0, 5) != 'RETRY') {
|
||||
$this->connect();
|
||||
return $this->curlink->query($sql, 'RETRY'.$silent);
|
||||
}
|
||||
if(!$silent) {
|
||||
$this->halt($this->error(), $this->errno(), $sql);
|
||||
}
|
||||
}
|
||||
|
||||
if(defined('DZZ_DEBUG') && DZZ_DEBUG) {
|
||||
$this->sqldebug[] = array($sql, number_format((microtime(true) - $starttime), 6), debug_backtrace(), $this->curlink);
|
||||
}
|
||||
|
||||
$this->querynum++;
|
||||
return $query;
|
||||
}
|
||||
|
||||
function affected_rows() {
|
||||
return $this->curlink->affected_rows;
|
||||
}
|
||||
|
||||
function error() {
|
||||
return (($this->curlink) ? $this->curlink->error : mysqli_error());
|
||||
}
|
||||
|
||||
function errno() {
|
||||
return intval(($this->curlink) ? $this->curlink->errno : mysqli_errno());
|
||||
}
|
||||
|
||||
function result($query, $row = 0) {
|
||||
if(!$query || $query->num_rows == 0) {
|
||||
return null;
|
||||
}
|
||||
$query->data_seek($row);
|
||||
$assocs = $query->fetch_row();
|
||||
return $assocs[0];
|
||||
}
|
||||
|
||||
function num_rows($query) {
|
||||
$query = $query ? $query->num_rows : 0;
|
||||
return $query;
|
||||
}
|
||||
|
||||
function num_fields($query) {
|
||||
return $query ? $query->field_count : null;
|
||||
}
|
||||
|
||||
function free_result($query) {
|
||||
return $query ? $query->free() : false;
|
||||
}
|
||||
|
||||
function insert_id() {
|
||||
return ($id = $this->curlink->insert_id) >= 0 ? $id : $this->result($this->query("SELECT last_insert_id()"), 0);
|
||||
}
|
||||
|
||||
function fetch_row($query) {
|
||||
$query = $query ? $query->fetch_row() : null;
|
||||
return $query;
|
||||
}
|
||||
|
||||
function fetch_fields($query) {
|
||||
return $query ? $query->fetch_field() : null;
|
||||
}
|
||||
|
||||
function version() {
|
||||
if(empty($this->version)) {
|
||||
$this->version = $this->curlink->server_info;
|
||||
}
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
function escape_string($str) {
|
||||
return $this->curlink->escape_string($str);
|
||||
}
|
||||
|
||||
function close() {
|
||||
return $this->curlink->close();
|
||||
}
|
||||
|
||||
function halt($message = '', $code = 0, $sql = '') {
|
||||
throw new DbException($message, $code, $sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,86 +1,86 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class db_driver_mysqli_slave extends db_driver_mysqli
|
||||
{
|
||||
|
||||
public $slaveid = null;
|
||||
|
||||
public $slavequery = 0;
|
||||
|
||||
public $slaveexcept = false;
|
||||
|
||||
public $excepttables = array();
|
||||
|
||||
public $tablename = '';
|
||||
|
||||
protected $_weighttable = array();
|
||||
|
||||
public $serverid = null;
|
||||
|
||||
function set_config($config) {
|
||||
parent::set_config($config);
|
||||
|
||||
if($this->config['common']['slave_except_table']) {
|
||||
$this->excepttables = explode(',', str_replace(' ', '', $this->config['common']['slave_except_table']));
|
||||
}
|
||||
}
|
||||
|
||||
public function table_name($tablename) {
|
||||
$this->tablename = $tablename;
|
||||
if(!$this->slaveexcept && $this->excepttables) {
|
||||
$this->slaveexcept = in_array($tablename, $this->excepttables, true);
|
||||
}
|
||||
$this->serverid = isset($this->map[$this->tablename]) ? $this->map[$this->tablename] : 1;
|
||||
return $this->tablepre.$tablename;
|
||||
}
|
||||
|
||||
protected function _slave_connect() {
|
||||
if(!empty($this->config[$this->serverid]['slave'])) {
|
||||
$this->_choose_slave();
|
||||
if($this->slaveid) {
|
||||
if(!isset($this->link[$this->slaveid])) {
|
||||
$this->connect($this->slaveid);
|
||||
}
|
||||
$this->slavequery ++;
|
||||
$this->curlink = $this->link[$this->slaveid];
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function _choose_slave(){
|
||||
if(!isset($this->_weighttable[$this->serverid])) {
|
||||
foreach ($this->config[$this->serverid]['slave'] as $key => $value) {
|
||||
$this->_weighttable[$this->serverid] .= str_repeat($key, 1 + intval($value['weight']));
|
||||
}
|
||||
}
|
||||
$sid = $this->_weighttable[$this->serverid][mt_rand(0, strlen($this->_weighttable[$this->serverid]) -1)];
|
||||
$this->slaveid = $this->serverid.'_'.$sid;
|
||||
if(!isset($this->config[$this->slaveid])) {
|
||||
$this->config[$this->slaveid] = $this->config[$this->serverid]['slave'][$sid];
|
||||
}
|
||||
}
|
||||
|
||||
protected function _master_connect() {
|
||||
if(!$this->link[$this->serverid]) {
|
||||
$this->connect($this->serverid);
|
||||
}
|
||||
$this->curlink = $this->link[$this->serverid];
|
||||
}
|
||||
|
||||
public function query($sql, $silent = false, $unbuffered = false) {
|
||||
if(!(!$this->slaveexcept && strtoupper(substr($sql, 0 , 6)) === 'SELECT' && $this->_slave_connect())) {
|
||||
$this->_master_connect();
|
||||
}
|
||||
$this->tablename = '';
|
||||
$this->slaveexcept = false;
|
||||
return parent::query($sql, $silent, $unbuffered);
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class db_driver_mysqli_slave extends db_driver_mysqli
|
||||
{
|
||||
|
||||
public $slaveid = null;
|
||||
|
||||
public $slavequery = 0;
|
||||
|
||||
public $slaveexcept = false;
|
||||
|
||||
public $excepttables = array();
|
||||
|
||||
public $tablename = '';
|
||||
|
||||
protected $_weighttable = array();
|
||||
|
||||
public $serverid = null;
|
||||
|
||||
function set_config($config) {
|
||||
parent::set_config($config);
|
||||
|
||||
if($this->config['common']['slave_except_table']) {
|
||||
$this->excepttables = explode(',', str_replace(' ', '', $this->config['common']['slave_except_table']));
|
||||
}
|
||||
}
|
||||
|
||||
public function table_name($tablename) {
|
||||
$this->tablename = $tablename;
|
||||
if(!$this->slaveexcept && $this->excepttables) {
|
||||
$this->slaveexcept = in_array($tablename, $this->excepttables, true);
|
||||
}
|
||||
$this->serverid = isset($this->map[$this->tablename]) ? $this->map[$this->tablename] : 1;
|
||||
return $this->tablepre.$tablename;
|
||||
}
|
||||
|
||||
protected function _slave_connect() {
|
||||
if(!empty($this->config[$this->serverid]['slave'])) {
|
||||
$this->_choose_slave();
|
||||
if($this->slaveid) {
|
||||
if(!isset($this->link[$this->slaveid])) {
|
||||
$this->connect($this->slaveid);
|
||||
}
|
||||
$this->slavequery ++;
|
||||
$this->curlink = $this->link[$this->slaveid];
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function _choose_slave(){
|
||||
if(!isset($this->_weighttable[$this->serverid])) {
|
||||
foreach ($this->config[$this->serverid]['slave'] as $key => $value) {
|
||||
$this->_weighttable[$this->serverid] .= str_repeat($key, 1 + intval($value['weight']));
|
||||
}
|
||||
}
|
||||
$sid = $this->_weighttable[$this->serverid][mt_rand(0, strlen($this->_weighttable[$this->serverid]) -1)];
|
||||
$this->slaveid = $this->serverid.'_'.$sid;
|
||||
if(!isset($this->config[$this->slaveid])) {
|
||||
$this->config[$this->slaveid] = $this->config[$this->serverid]['slave'][$sid];
|
||||
}
|
||||
}
|
||||
|
||||
protected function _master_connect() {
|
||||
if(!$this->link[$this->serverid]) {
|
||||
$this->connect($this->serverid);
|
||||
}
|
||||
$this->curlink = $this->link[$this->serverid];
|
||||
}
|
||||
|
||||
public function query($sql, $silent = false, $unbuffered = false) {
|
||||
if(!(!$this->slaveexcept && strtoupper(substr($sql, 0 , 6)) === 'SELECT' && $this->_slave_connect())) {
|
||||
$this->_master_connect();
|
||||
}
|
||||
$this->tablename = '';
|
||||
$this->slaveexcept = false;
|
||||
return parent::query($sql, $silent, $unbuffered);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,75 +1,75 @@
|
||||
<?php
|
||||
namespace core\dzz;
|
||||
|
||||
class Datareturn
|
||||
{
|
||||
|
||||
private static $returnData = '';
|
||||
|
||||
private static $template = '';
|
||||
|
||||
public static function data_return($type = 'json', $data = '', $template = '')
|
||||
{
|
||||
self::$returnData = $data;
|
||||
|
||||
self::$template = $template;
|
||||
|
||||
switch ($type) {
|
||||
|
||||
case 'json':
|
||||
|
||||
self::json_return();
|
||||
break;
|
||||
case 'string':
|
||||
|
||||
self::string_return();
|
||||
|
||||
break;
|
||||
|
||||
case 'html':
|
||||
|
||||
self::html_return();
|
||||
|
||||
break;
|
||||
|
||||
case 'Array':
|
||||
self::Array_return();
|
||||
break;
|
||||
default:
|
||||
self::json_return();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
private static function Array_return()
|
||||
{
|
||||
return self::$returnData;
|
||||
}
|
||||
|
||||
private static function json_return()
|
||||
{
|
||||
|
||||
echo json_encode(self::$returnData);
|
||||
exit;
|
||||
}
|
||||
|
||||
private static function html_return()
|
||||
{
|
||||
|
||||
extract(self::$returnData);
|
||||
|
||||
include template(self::$template);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
private static function string_return()
|
||||
{
|
||||
if(isset(self::$returnData['error'])){
|
||||
echo self::$returnData['error'];
|
||||
}else{
|
||||
echo self::$returnData;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
<?php
|
||||
namespace core\dzz;
|
||||
|
||||
class Datareturn
|
||||
{
|
||||
|
||||
private static $returnData = '';
|
||||
|
||||
private static $template = '';
|
||||
|
||||
public static function data_return($type = 'json', $data = '', $template = '')
|
||||
{
|
||||
self::$returnData = $data;
|
||||
|
||||
self::$template = $template;
|
||||
|
||||
switch ($type) {
|
||||
|
||||
case 'json':
|
||||
|
||||
self::json_return();
|
||||
break;
|
||||
case 'string':
|
||||
|
||||
self::string_return();
|
||||
|
||||
break;
|
||||
|
||||
case 'html':
|
||||
|
||||
self::html_return();
|
||||
|
||||
break;
|
||||
|
||||
case 'Array':
|
||||
self::Array_return();
|
||||
break;
|
||||
default:
|
||||
self::json_return();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
private static function Array_return()
|
||||
{
|
||||
return self::$returnData;
|
||||
}
|
||||
|
||||
private static function json_return()
|
||||
{
|
||||
|
||||
echo json_encode(self::$returnData);
|
||||
exit;
|
||||
}
|
||||
|
||||
private static function html_return()
|
||||
{
|
||||
|
||||
extract(self::$returnData);
|
||||
|
||||
include template(self::$template);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
private static function string_return()
|
||||
{
|
||||
if(isset(self::$returnData['error'])){
|
||||
echo self::$returnData['error'];
|
||||
}else{
|
||||
echo self::$returnData;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -1,186 +1,186 @@
|
||||
<?php
|
||||
namespace core\dzz;
|
||||
class Hook
|
||||
{
|
||||
|
||||
private static $tags = array();
|
||||
public static $usetag = array();
|
||||
/**
|
||||
* 动态添加行为扩展到某个标签
|
||||
* @param string $tag 标签名称
|
||||
* @param mixed $behavior 行为名称
|
||||
* @param mixed $behavior 行为名称
|
||||
* @param bool $first 是否放到开头执行
|
||||
* @return void
|
||||
*/
|
||||
public static function add($tag, $behavior, $first = false)
|
||||
{
|
||||
isset(self::$tags[$tag]) || self::$tags[$tag] = array();
|
||||
if (is_array($behavior) && !is_callable($behavior)) {//此处废弃,暂不调整
|
||||
if (!array_key_exists('_overlay', $behavior) || !$behavior['_overlay']) {
|
||||
unset($behavior['_overlay']);
|
||||
self::$tags[$tag] = array_merge(self::$tags[$tag], $behavior);
|
||||
} else {
|
||||
unset($behavior['_overlay']);
|
||||
self::$tags[$tag] = $behavior;
|
||||
}
|
||||
} elseif ($first) {
|
||||
array_unshift(self::$tags[$tag], $behavior);
|
||||
} else {
|
||||
self::$tags[$tag][] = $behavior;
|
||||
}
|
||||
self::$tags[$tag]=array_unique( self::$tags[$tag]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入插件
|
||||
* @param array $tags 插件信息
|
||||
* @param boolean $recursive 是否递归合并
|
||||
*/
|
||||
public static function import(array $tags, $recursive = true)
|
||||
{
|
||||
if ($recursive) {
|
||||
foreach ($tags as $tag => $behavior) {
|
||||
self::add($tag, $behavior);
|
||||
}
|
||||
} else {
|
||||
self::$tags = $tags + self::$tags;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取插件信息
|
||||
* @param string $tag 插件位置 留空获取全部
|
||||
* @return array
|
||||
*/
|
||||
public static function get($tag = '')
|
||||
{
|
||||
if (empty($tag)) {
|
||||
//获取全部的插件信息
|
||||
return self::$tags;
|
||||
} else {
|
||||
return array_key_exists($tag, self::$tags) ? self::$tags[$tag] : array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听标签的行为
|
||||
* @param string $tag 标签名称
|
||||
* @param mixed $params 传入参数
|
||||
* @param mixed $extra 额外参数
|
||||
* @param bool $once 只获取一个有效返回值
|
||||
* @return mixed
|
||||
*/
|
||||
public static function listen($tag, &$params = null, $extra = null,$once = false)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
$tags = static::get($tag);
|
||||
|
||||
$break = false;
|
||||
|
||||
foreach ($tags as $key => $name) {
|
||||
|
||||
if(is_array($name)){
|
||||
foreach($name as $val){
|
||||
$results[$key] = self::exec($val, $tag, $params, $extra,$break);
|
||||
|
||||
if (false === $results[$key] || $break == true) {
|
||||
break;
|
||||
|
||||
} elseif($once) {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
$results[$key] = self::exec($name, $tag, $params, $extra,$break);
|
||||
|
||||
if (false === $results[$key] || $break == true) {
|
||||
|
||||
// 如果返回false 则中断行为执行
|
||||
break;
|
||||
|
||||
} elseif ($once) {
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return $once ? ($results?end($results):$results) : $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行某个行为
|
||||
* @param mixed $class 要执行的行为
|
||||
* @param string $tag 方法名(标签名)
|
||||
* @param Mixed $params 传人的参数
|
||||
* @param mixed $extra 额外参数
|
||||
* @return mixed
|
||||
*/
|
||||
public static function exec($class, $tag = '', &$params = null,$extra = null,&$break)
|
||||
{
|
||||
if(strpos($class,'|') !== false){//判断是否规定了作用域,并判断作用域确定是否执行钩子
|
||||
$rangArr = explode('|',$class);
|
||||
$class = $rangArr[0];
|
||||
$range = $rangArr[1];
|
||||
if(defined('CURMODULE')){
|
||||
$execrange = CURSCRIPT.'/'.CURMODULE;
|
||||
}else{
|
||||
$execrange = CURSCRIPT;
|
||||
}
|
||||
|
||||
if(strpos($execrange,$range) !== 0){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//self::$usetag[] = $tag;
|
||||
$method = static::parseName($tag, 1, false);
|
||||
if ($class instanceof \Closure) {
|
||||
|
||||
$result = call_user_func_array($class, array( & $params, $extra));
|
||||
$class = 'Closure';
|
||||
|
||||
} elseif (is_array($class)) {
|
||||
list($class, $method) = $class;
|
||||
$classobj = new $class();
|
||||
$result = $classobj->$method($params, $extra);
|
||||
//$result = (new $class())->$method($params, $extra);
|
||||
//$result = call_user_func_array(array($class,$method), array( & $params, $extra));
|
||||
$class = $class . '->' . $method;
|
||||
|
||||
} elseif (is_object($class)) {
|
||||
|
||||
$result = $class->$method($params, $extra);
|
||||
$class = get_class($class);
|
||||
|
||||
} elseif (strpos($class, '::')) {
|
||||
|
||||
$result = call_user_func_array($class, array( & $params, $extra));
|
||||
|
||||
} else {
|
||||
$obj = new $class();
|
||||
$method = ($tag && is_callable(array($obj, $method))) ? $method : 'run';
|
||||
$result = $obj->$method($params, $extra,$break);
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function parseName($name, $type = 0, $ucfirst = true)
|
||||
{
|
||||
if ($type) {
|
||||
$name = preg_replace_callback('/_([a-zA-Z])/', function ($match) {
|
||||
return strtoupper($match[1]);
|
||||
}, $name);
|
||||
return $ucfirst ? ucfirst($name) : lcfirst($name);
|
||||
} else {
|
||||
return strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $name), "_"));
|
||||
}
|
||||
}
|
||||
}
|
||||
<?php
|
||||
namespace core\dzz;
|
||||
class Hook
|
||||
{
|
||||
|
||||
private static $tags = array();
|
||||
public static $usetag = array();
|
||||
/**
|
||||
* 动态添加行为扩展到某个标签
|
||||
* @param string $tag 标签名称
|
||||
* @param mixed $behavior 行为名称
|
||||
* @param mixed $behavior 行为名称
|
||||
* @param bool $first 是否放到开头执行
|
||||
* @return void
|
||||
*/
|
||||
public static function add($tag, $behavior, $first = false)
|
||||
{
|
||||
isset(self::$tags[$tag]) || self::$tags[$tag] = array();
|
||||
if (is_array($behavior) && !is_callable($behavior)) {//此处废弃,暂不调整
|
||||
if (!array_key_exists('_overlay', $behavior) || !$behavior['_overlay']) {
|
||||
unset($behavior['_overlay']);
|
||||
self::$tags[$tag] = array_merge(self::$tags[$tag], $behavior);
|
||||
} else {
|
||||
unset($behavior['_overlay']);
|
||||
self::$tags[$tag] = $behavior;
|
||||
}
|
||||
} elseif ($first) {
|
||||
array_unshift(self::$tags[$tag], $behavior);
|
||||
} else {
|
||||
self::$tags[$tag][] = $behavior;
|
||||
}
|
||||
self::$tags[$tag]=array_unique( self::$tags[$tag]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入插件
|
||||
* @param array $tags 插件信息
|
||||
* @param boolean $recursive 是否递归合并
|
||||
*/
|
||||
public static function import(array $tags, $recursive = true)
|
||||
{
|
||||
if ($recursive) {
|
||||
foreach ($tags as $tag => $behavior) {
|
||||
self::add($tag, $behavior);
|
||||
}
|
||||
} else {
|
||||
self::$tags = $tags + self::$tags;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取插件信息
|
||||
* @param string $tag 插件位置 留空获取全部
|
||||
* @return array
|
||||
*/
|
||||
public static function get($tag = '')
|
||||
{
|
||||
if (empty($tag)) {
|
||||
//获取全部的插件信息
|
||||
return self::$tags;
|
||||
} else {
|
||||
return array_key_exists($tag, self::$tags) ? self::$tags[$tag] : array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听标签的行为
|
||||
* @param string $tag 标签名称
|
||||
* @param mixed $params 传入参数
|
||||
* @param mixed $extra 额外参数
|
||||
* @param bool $once 只获取一个有效返回值
|
||||
* @return mixed
|
||||
*/
|
||||
public static function listen($tag, &$params = null, $extra = null,$once = false)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
$tags = static::get($tag);
|
||||
|
||||
$break = false;
|
||||
|
||||
foreach ($tags as $key => $name) {
|
||||
|
||||
if(is_array($name)){
|
||||
foreach($name as $val){
|
||||
$results[$key] = self::exec($val, $tag, $params, $extra,$break);
|
||||
|
||||
if (false === $results[$key] || $break == true) {
|
||||
break;
|
||||
|
||||
} elseif($once) {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
$results[$key] = self::exec($name, $tag, $params, $extra,$break);
|
||||
|
||||
if (false === $results[$key] || $break == true) {
|
||||
|
||||
// 如果返回false 则中断行为执行
|
||||
break;
|
||||
|
||||
} elseif ($once) {
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return $once ? ($results?end($results):$results) : $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行某个行为
|
||||
* @param mixed $class 要执行的行为
|
||||
* @param string $tag 方法名(标签名)
|
||||
* @param Mixed $params 传人的参数
|
||||
* @param mixed $extra 额外参数
|
||||
* @return mixed
|
||||
*/
|
||||
public static function exec($class, $tag = '', &$params = null,$extra = null,&$break)
|
||||
{
|
||||
if(strpos($class,'|') !== false){//判断是否规定了作用域,并判断作用域确定是否执行钩子
|
||||
$rangArr = explode('|',$class);
|
||||
$class = $rangArr[0];
|
||||
$range = $rangArr[1];
|
||||
if(defined('CURMODULE')){
|
||||
$execrange = CURSCRIPT.'/'.CURMODULE;
|
||||
}else{
|
||||
$execrange = CURSCRIPT;
|
||||
}
|
||||
|
||||
if(strpos($execrange,$range) !== 0){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//self::$usetag[] = $tag;
|
||||
$method = static::parseName($tag, 1, false);
|
||||
if ($class instanceof \Closure) {
|
||||
|
||||
$result = call_user_func_array($class, array( & $params, $extra));
|
||||
$class = 'Closure';
|
||||
|
||||
} elseif (is_array($class)) {
|
||||
list($class, $method) = $class;
|
||||
$classobj = new $class();
|
||||
$result = $classobj->$method($params, $extra);
|
||||
//$result = (new $class())->$method($params, $extra);
|
||||
//$result = call_user_func_array(array($class,$method), array( & $params, $extra));
|
||||
$class = $class . '->' . $method;
|
||||
|
||||
} elseif (is_object($class)) {
|
||||
|
||||
$result = $class->$method($params, $extra);
|
||||
$class = get_class($class);
|
||||
|
||||
} elseif (strpos($class, '::')) {
|
||||
|
||||
$result = call_user_func_array($class, array( & $params, $extra));
|
||||
|
||||
} else {
|
||||
$obj = new $class();
|
||||
$method = ($tag && is_callable(array($obj, $method))) ? $method : 'run';
|
||||
$result = $obj->$method($params, $extra,$break);
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function parseName($name, $type = 0, $ucfirst = true)
|
||||
{
|
||||
if ($type) {
|
||||
$name = preg_replace_callback('/_([a-zA-Z])/', function ($match) {
|
||||
return strtoupper($match[1]);
|
||||
}, $name);
|
||||
return $ucfirst ? ucfirst($name) : lcfirst($name);
|
||||
} else {
|
||||
return strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $name), "_"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user