20 Commits

667 changed files with 111991 additions and 34830 deletions

21
UPDATE.md Normal file
View File

@@ -0,0 +1,21 @@
## PicHome beta3.3 更新说明
### 1.billfish数据支持兼容billfish2.5版本数据导入
### 2.eagle数据支持兼容新旧版本eagle数据导入
### 3.优化普通目录文件缩略图生成逻辑,优化效率,以及缩略图转换数字显示等问题修复
### 4.修复普通目录由于文件名长度问题导致的文件缺失和部分服务器中存在因路径分割符不同导致文件导入累加式重复问题
### 5.库设置增加库名称修改选项
### 6.修复页面标签未分类数据显示错误问题,修复单一库时存在的筛选项不能正常显示问题
### 7.页面增加按eagle和billfish内目录排序显示支持
### 8.优化库删除逻辑,删除时清理库冗余数据
### 9.文件访问地址修改为动态地址,增强文件私密性,为之后版本文件私密保护做准备
### 10.其他已知bug修复

View File

@@ -1,170 +1,170 @@
<?php <?php
/* /*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd * @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/ * @license https://www.oaooa.com/licenses/
* *
* @link https://www.oaooa.com * @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com) * @author zyx(zyx@oaooa.com)
*/ */
if (!defined('IN_OAOOA') ) { if (!defined('IN_OAOOA') ) {
exit('Access Denied'); exit('Access Denied');
} }
if (!function_exists('ajaxshowheader')) { if (!function_exists('ajaxshowheader')) {
function ajaxshowheader() { function ajaxshowheader() {
global $_G; global $_G;
ob_end_clean(); ob_end_clean();
@header("Expires: -1"); @header("Expires: -1");
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE); @header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
@header("Pragma: no-cache"); @header("Pragma: no-cache");
header("Content-type: application/xml"); header("Content-type: application/xml");
echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<root><![CDATA["; echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<root><![CDATA[";
} }
} }
if (!function_exists('ajaxshowfooter')) { if (!function_exists('ajaxshowfooter')) {
function ajaxshowfooter() { function ajaxshowfooter() {
echo ']]></root>'; echo ']]></root>';
exit(); exit();
} }
} }
if ($admincp->core ->var['inajax']) { if ($admincp->core ->var['inajax']) {
ajaxshowheader(); ajaxshowheader();
ajaxshowfooter(); ajaxshowfooter();
} }
if ($admincp -> cpaccess == -3) { if ($admincp -> cpaccess == -3) {
html_login_header(false); html_login_header(false);
} else { } else {
html_login_header(); html_login_header();
} }
if ($admincp -> cpaccess == -3) { if ($admincp -> cpaccess == -3) {
echo '<p class="logintips">' . lang('login_cp_noaccess') . '</p>'; echo '<p class="logintips">' . lang('login_cp_noaccess') . '</p>';
} elseif ($admincp -> cpaccess == -1) { } elseif ($admincp -> cpaccess == -1) {
$ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']); $ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']);
echo '<p class="logintips">' . lang('login_cplock', array('ltime' => $ltime)) . '</p>'; echo '<p class="logintips">' . lang('login_cplock', array('ltime' => $ltime)) . '</p>';
} elseif ($admincp -> cpaccess == -4) { } elseif ($admincp -> cpaccess == -4) {
$ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']); $ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']);
echo '<p class="logintips">' . lang('login_user_lock') . '</p>'; echo '<p class="logintips">' . lang('login_user_lock') . '</p>';
} else { } else {
html_login_form(); html_login_form();
} }
html_login_footer(); html_login_footer();
function html_login_header($form = true) { function html_login_header($form = true) {
global $_G; global $_G;
$uid = getglobal('uid'); $uid = getglobal('uid');
$charset = CHARSET; $charset = CHARSET;
$lang = &lang(); $lang = &lang();
$title = $lang['login_title']; $title = $lang['login_title'];
$tips = $lang['login_tips']; $tips = $lang['login_tips'];
echo <<<EOT echo <<<EOT
<!DOCTYPE> <!DOCTYPE>
<html> <html>
<head> <head>
<title>$title</title> <title>$title</title>
<base href="{$_G['siteurl']}"> <base href="{$_G['siteurl']}">
<meta http-equiv="Content-Type" content="text/html;charset=$charset" /> <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"> <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="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="admin/login/images/adminlogin.css" type="text/css" media="all" />
<link rel="stylesheet" href="static/css/common.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/js/md5.js"></script>
<script type="text/javascript" src="static/jquery/jquery.min.js?{VERHASH}"></script> <script type="text/javascript" src="static/jquery/jquery.min.js?{VERHASH}"></script>
<script type="text/javascript" src="static/js/common.js?{VERHASH}"></script> <script type="text/javascript" src="static/js/common.js?{VERHASH}"></script>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="static/js/jquery.placeholder.js" type="text/javascript"></script> <script src="static/js/jquery.placeholder.js" type="text/javascript"></script>
<![endif]--> <![endif]-->
<meta content="oaooa.com" name="Copyright" /> <meta content="oaooa.com" name="Copyright" />
</head> </head>
<body> <body>
EOT; EOT;
if ($form) { if ($form) {
$loginset_img=$_G['setting']['loginset']['img']?$_G['setting']['loginset']['img']:'user/login/images/login.jpg'; $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'; $loginset_bcolor=$_G['setting']['loginset']['bcolor']?$_G['setting']['loginset']['bcolor']:'#76838f';
echo <<<EOT 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;"> <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%"> <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>
<div class="mainContainer"> <div class="mainContainer">
<table class="loginContainer" wide="100%" height="100%"> <table class="loginContainer" wide="100%" height="100%">
<tr><td align="center" valign="middle"> <tr><td align="center" valign="middle">
EOT; EOT;
} }
} }
function html_login_footer($halt = true) { function html_login_footer($halt = true) {
$version = CORE_VERSION; $version = CORE_VERSION;
$release = CORE_RELEASE; $release = CORE_RELEASE;
echo <<<EOT echo <<<EOT
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
</body> </body>
</html> </html>
EOT; EOT;
$halt && exit(); $halt && exit();
} }
function html_login_form() { function html_login_form() {
global $_G; global $_G;
$uid = getglobal('uid'); $uid = getglobal('uid');
$isguest = !getglobal('uid'); $isguest = !getglobal('uid');
$lang1 = lang(); $lang1 = lang();
$year=dgmdate(TIMESTAMP,'Y'); $year=dgmdate(TIMESTAMP,'Y');
$maintitle=lang('title_admincp'); $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>'; $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'); $sid = getglobal('sid');
$avatarstatus=getglobal('avatarstatus','member'); $avatarstatus=getglobal('avatarstatus','member');
if(!$uid ){ if(!$uid ){
$avastar ='<img src="'.($_G['setting']['sitelogo']?\IO::getFileUri('attach::'.$_G['setting']['sitelogo']):'static/image/common/logo.png').'" />'; $avastar ='<img src="data/attachment/sitelogo/sitelogo.png" />';
}else{ }else{
$avastar = avatar_block($uid); $avastar = avatar_block($uid);
} }
$avastar.='<div class="maintitle">'.$maintitle.'</div>'; $avastar.='<div class="maintitle">'.$maintitle.'</div>';
$extra = BASESCRIPT . '?' . $_SERVER['QUERY_STRING']; $extra = BASESCRIPT . '?' . $_SERVER['QUERY_STRING'];
$forcesecques = '<option value="0">' . ($_G['config']['admincp']['forcesecques'] ? $lang1['forcesecques'] : $lang1['security_question_0']) . '</option>'; $forcesecques = '<option value="0">' . ($_G['config']['admincp']['forcesecques'] ? $lang1['forcesecques'] : $lang1['security_question_0']) . '</option>';
echo <<<EOT echo <<<EOT
<form method="post" name="login" id="loginform" action="$extra" onsubmit="pwmd5('admin_password')"> <form method="post" name="login" id="loginform" action="$extra" onsubmit="pwmd5('admin_password')">
<input type="hidden" name="sid" value="$sid"> <input type="hidden" name="sid" value="$sid">
<input type="hidden" name="referer" value="$_GET[referer]"> <input type="hidden" name="referer" value="$_GET[referer]">
<div class="loginformContainer"> <div class="loginformContainer">
<div class="avatarContainer">$avastar</div> <div class="avatarContainer">$avastar</div>
$loginuser $loginuser
<div id="admin_password_Container"> <div id="admin_password_Container">
<input name="admin_password" id="admin_password" type="password" class="form-control" value="" autocomplete="off" placeholder="$lang1[password]" /> <input name="admin_password" id="admin_password" type="password" class="form-control" value="" autocomplete="off" placeholder="$lang1[password]" />
</div> </div>
<input name="submit" value="$lang1[login]" type="submit" class="btn btn-primary" /> <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> &copy; 2012-$year</div> <div class="copyright">Powered by <a href="https://www.oaooa.com/" target="_blank">oaooa</a> &copy; 2012-$year</div>
</div> </div>
</form> </form>
<script type="text/JavaScript"> <script type="text/JavaScript">
jQuery(document).ready(function(e) { jQuery(document).ready(function(e) {
jQuery('#loginform .form-control:first').focus(); jQuery('#loginform .form-control:first').focus();
if(jQuery('.ie8,.ie9').length){ //ie8模拟placeholder; if(jQuery('.ie8,.ie9').length){ //ie8模拟placeholder;
jQuery(':input[placeholder]').each(function(){ jQuery(':input[placeholder]').each(function(){
jQuery(this).placeholder(); jQuery(this).placeholder();
}); });
} }
}); });
</script> </script>
EOT; EOT;
} }
?> ?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,184 +1,184 @@
<?php <?php
/* /*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd * @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/ * @license https://www.oaooa.com/licenses/
* *
* @link https://www.oaooa.com * @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com) * @author zyx(zyx@oaooa.com)
*/ */
if(!defined('IN_OAOOA')) { if(!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
global $_G; global $_G;
Hook::listen('adminlogin'); Hook::listen('adminlogin');
$uid = $_G['uid']; $uid = $_G['uid'];
include libfile('function/filerouterule'); include libfile('function/filerouterule');
require libfile('function/code'); require libfile('function/code');
$operation = $_GET['operation'] ? trim($_GET['operation']) : ''; $operation = $_GET['operation'] ? trim($_GET['operation']) : '';
if($operation == 'getApp'){//获取当前用户应用 if($operation == 'getApp'){//获取当前用户应用
$config = array(); $config = array();
if($_G['uid']){ if($_G['uid']){
$config= dzz_userconfig_init(); $config= dzz_userconfig_init();
if(!$config){ if(!$config){
//$config= dzz_userconfig_init(); //$config= dzz_userconfig_init();
if($config['applist']){ if($config['applist']){
$applist=explode(',',$config['applist']); $applist=explode(',',$config['applist']);
}else{ }else{
$applist=array(); $applist=array();
} }
}else{//检测不允许删除的应用,重新添加进去 }else{//检测不允许删除的应用,重新添加进去
if($config['applist']){ if($config['applist']){
$applist=explode(',',$config['applist']); $applist=explode(',',$config['applist']);
}else{ }else{
$applist=array(); $applist=array();
} }
if($applist_n =array_keys(C::t('app_market')->fetch_all_by_notdelete($_G['uid']))) { if($applist_n =array_keys(C::t('app_market')->fetch_all_by_notdelete($_G['uid']))) {
$newappids = array(); $newappids = array();
foreach ($applist_n as $appid) { foreach ($applist_n as $appid) {
if (!in_array($appid, $applist)) { if (!in_array($appid, $applist)) {
$applist[] = $appid; $applist[] = $appid;
$newappids[] = $appid; $newappids[] = $appid;
} }
} }
if ($newappids) C::t('app_user')->insert_by_uid($_G['uid'], $newappids); if ($newappids) C::t('app_user')->insert_by_uid($_G['uid'], $newappids);
C::t('user_field')->update($_G['uid'], array('applist' => implode(',', $applist))); C::t('user_field')->update($_G['uid'], array('applist' => implode(',', $applist)));
} }
} }
}else{ }else{
$applist =array_keys(C::t('app_market')->fetch_all_by_default()); $applist =array_keys(C::t('app_market')->fetch_all_by_default());
} }
//获取已安装应用 //获取已安装应用
$app=C::t('app_market')->fetch_all_by_appid($applist); $app=C::t('app_market')->fetch_all_by_appid($applist);
$applist_1=array(); $applist_1=array();
$applist_2=array(); $applist_2=array();
$identifier=array('imageTool','picture'); $identifier=array('imageTool','picture');
foreach($app as $key => $value){ foreach($app as $key => $value){
if($value['isshow']<1) continue; if($value['isshow']<1) continue;
if($value['available']<1) continue; if($value['available']<1) continue;
if($value['position']<1) continue;//位置为无的忽略 if($value['position']<1) continue;//位置为无的忽略
//判断管理员应用 //判断管理员应用
if($_G['adminid']!=1 && $value['group']==3){ if($_G['adminid']!=1 && $value['group']==3){
continue; continue;
} }
$params=array('name'=>$value['identifier'],'perm'=>1,'return_type'=>'bool'); $params=array('name'=>$value['identifier'],'perm'=>1,'return_type'=>'bool');
if(Hook::listen('rolecheck',$params,null,true)===false) continue; if(Hook::listen('rolecheck',$params,null,true)===false) continue;
//if($value['system'] == 2) continue; //if($value['system'] == 2) continue;
if(in_array($value['identifier'], $identifier)){ if(in_array($value['identifier'], $identifier)){
$applist_1[] = $value; $applist_1[] = $value;
}else{ }else{
$applist_2[] = $value; $applist_2[] = $value;
} }
} }
//获取虚拟应用 //获取虚拟应用
$params=array(); $params=array();
$vapps=Hook::listen('vapplist',$params,null,true); $vapps=Hook::listen('vapplist',$params,null,true);
foreach($vapps as $key => $value){ foreach($vapps as $key => $value){
$params=array('name'=>'vapp/'.$value['identifier'],'perm'=>1,'return_type'=>'bool'); $params=array('name'=>'vapp/'.$value['identifier'],'perm'=>1,'return_type'=>'bool');
if(Hook::listen('rolecheck',$params,null,true)===false) continue; if(Hook::listen('rolecheck',$params,null,true)===false) continue;
$applist_1[] = $value; $applist_1[] = $value;
} }
//对应用根据disp 排序 //对应用根据disp 排序
if($applist_1){ if($applist_1){
$sort = array( $sort = array(
'direction' => 'SORT_ASC', //排序顺序标志 SORT_DESC 降序SORT_ASC 升序 'direction' => 'SORT_ASC', //排序顺序标志 SORT_DESC 降序SORT_ASC 升序
'field' => 'disp', //排序字段 'field' => 'disp', //排序字段
); );
$arrSort = array(); $arrSort = array();
foreach($applist_1 AS $uniqid => $row){ foreach($applist_1 AS $uniqid => $row){
foreach($row AS $key=>$value){ foreach($row AS $key=>$value){
$arrSort[$key][$uniqid] = $value; $arrSort[$key][$uniqid] = $value;
} }
} }
if($sort['direction']){ if($sort['direction']){
array_multisort($arrSort[$sort['field']], constant($sort['direction']), $applist_1); array_multisort($arrSort[$sort['field']], constant($sort['direction']), $applist_1);
} }
} }
exit(json_encode(array('data'=>array_merge($applist_1,$applist_2)))); exit(json_encode(array('data'=>array_merge($applist_1,$applist_2))));
}else{ }else{
// 地址栏名称 // 地址栏名称
$navtitle = $_G['setting']['sitename']; $navtitle = $_G['setting']['sitename'];
// 获取hash // 获取hash
$hash = FORMHASH; $hash = FORMHASH;
// 获取当前用户信息 // 获取当前用户信息
$userData = array(); $userData = array();
$udata = DB::fetch_first("select u.uid,u.avatarstatus,u.username,u.groupid,u.adminid,u.nickname,s.svalue from %t u $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", left join %t s on s.uid = u.uid and s.skey=%swhere u.uid =%d",
array('user','user_setting','headerColor',$uid)); array('user','user_setting','headerColor',$uid));
if($udata['avatarstatus'] == 1){ if($udata['avatarstatus'] == 1){
$userData['icon'] = 'avatar.php?uid='.$udata['uid']; $userData['icon'] = 'avatar.php?uid='.$udata['uid'].'&random='.VERHASH;
}elseif($udata['svalue']){ }elseif($udata['svalue']){
$userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,'')); $userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,''));
$userData['headerColor'] = $udata['svalue']; $userData['headerColor'] = $udata['svalue'];
$userData['icon'] = false; $userData['icon'] = false;
}else{ }else{
$colorkey = rand(1,15); $colorkey = rand(1,15);
$headerColor = $colors[$colorkey]; $headerColor = $colors[$colorkey];
C::t('user_setting')->insert_by_skey('headerColor',$headerColor,$udata['uid']); C::t('user_setting')->insert_by_skey('headerColor',$headerColor,$udata['uid']);
$userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,'')); $userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,''));
$userData['headerColor'] = $udata['svalue']; $userData['headerColor'] = $udata['svalue'];
} }
if( C::t('user')->checkfounder($udata)){ if( C::t('user')->checkfounder($udata)){
$userData['perm'] = 3; $userData['perm'] = 3;
}elseif($udata['adminid'] == 1){ }elseif($udata['adminid'] == 1){
$userData['perm'] = 2; $userData['perm'] = 2;
}else{ }else{
$userData['perm'] = 1; $userData['perm'] = 1;
} }
$userData['username'] = $udata['username']; $userData['username'] = $udata['username'];
$userData['uid'] = $uid; $userData['uid'] = $uid;
$userData['language'] = $_G[language]; $userData['language'] = $_G[language];
$userData['upgrade'] = $_G['setting']['upgrade']; $userData['upgrade'] = $_G['setting']['upgrade'];
$userData['version'] = $_G['setting']['version']; $userData['version'] = $_G['setting']['version'];
// 获取顶部应用 // 获取顶部应用
if($userData['language'] == 'en-US'){ if($userData['language'] == 'en-US'){
$navMenuNames = ['System setting','Cloud settings','Orguser','App','Statistics','System Tool']; $navMenuNames = ['System setting','Cloud settings','Orguser','App','Statistics','System Tool'];
}else{ }else{
$navMenuNames = ['系统设置','云设置','用户','应用','统计','系统工具']; $navMenuNames = ['系统设置','云设置','用户','应用','统计','系统工具'];
} }
$navMenu = array( $navMenu = array(
array( array(
'name'=>$navMenuNames[0], 'name'=>$navMenuNames[0],
'index'=>'setting', 'index'=>'setting',
'type'=>'admin' 'type'=>'admin'
), ),
array( array(
'name'=>$navMenuNames[1], 'name'=>$navMenuNames[1],
'index'=>'cloudsetting', 'index'=>'cloudsetting',
'type'=>'admin' 'type'=>'admin'
), ),
array( array(
'name'=>$navMenuNames[2], 'name'=>$navMenuNames[2],
'index'=>'orguser', 'index'=>'orguser',
'type'=>'admin' 'type'=>'admin'
), ),
array( array(
'name'=>$navMenuNames[3], 'name'=>$navMenuNames[3],
'index'=>'app', 'index'=>'app',
'type'=>'admin' 'type'=>'admin'
), ),
array( array(
'name'=>$navMenuNames[4], 'name'=>$navMenuNames[4],
'index'=>'stats', 'index'=>'stats',
'type'=>'dzz' 'type'=>'dzz'
), ),
array( array(
'name'=>$navMenuNames[5], 'name'=>$navMenuNames[5],
'index'=>'system', 'index'=>'system',
'type'=>'admin' 'type'=>'admin'
), ),
); );
// 获取通知 // 获取通知
$notice_num=DB::result_first("select COUNT(*) from %t where new>0 and uid=%d",array('notification',$_G['uid'])); $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))); exit(json_encode(array('hash'=>$hash,'navMenu'=>$navMenu,'userData'=>$userData,'notice_num'=>$notice_num,'navtitle'=>$navtitle)));
} }
?> ?>

View File

@@ -1,200 +1,200 @@
<?php <?php
/* /*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd * @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/ * @license https://www.oaooa.com/licenses/
* *
* @link https://www.oaooa.com * @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com) * @author zyx(zyx@oaooa.com)
*/ */
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) { if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
exit('Access Denied'); exit('Access Denied');
} }
include_once libfile('function/cache'); include_once libfile('function/cache');
//error_reporting(E_ALL); //error_reporting(E_ALL);
$op = $_GET['op']; $op = $_GET['op'];
$navtitle = lang('cron') . ' - ' . lang('admin_navtitle'); $navtitle = lang('cron') . ' - ' . lang('admin_navtitle');
if (empty($_GET['edit']) && empty($_GET['run'])) { if (empty($_GET['edit']) && empty($_GET['run'])) {
if (!submitcheck('cronssubmit')) { if (!submitcheck('cronssubmit')) {
$crons = array(); $crons = array();
$query = DB::query("SELECT * FROM " . DB::table('cron') . " ORDER BY type DESC"); $query = DB::query("SELECT * FROM " . DB::table('cron') . " ORDER BY type DESC");
while ($cron = DB::fetch($query)) { while ($cron = DB::fetch($query)) {
$disabled = $cron['weekday'] == -1 && $cron['day'] == -1 && $cron['hour'] == -1 && $cron['minute'] == '' ? 'disabled' : ''; $disabled = $cron['weekday'] == -1 && $cron['day'] == -1 && $cron['hour'] == -1 && $cron['minute'] == '' ? 'disabled' : '';
if ($cron['day'] > 0 && $cron['day'] < 32) { if ($cron['day'] > 0 && $cron['day'] < 32) {
$cron['time'] = lang('monthly') . $cron['day'] . lang('day'); $cron['time'] = lang('monthly') . $cron['day'] . lang('day');
} elseif ($cron['weekday'] >= 0 && $cron['weekday'] < 7) { } elseif ($cron['weekday'] >= 0 && $cron['weekday'] < 7) {
$cron['time'] = lang('weekly') . lang('misc_cron_week_day_' . $cron['weekday']); $cron['time'] = lang('weekly') . lang('misc_cron_week_day_' . $cron['weekday']);
} elseif ($cron['hour'] >= 0 && $cron['hour'] < 24) { } elseif ($cron['hour'] >= 0 && $cron['hour'] < 24) {
$cron['time'] = lang('everyday'); $cron['time'] = lang('everyday');
} else { } else {
$cron['time'] = lang('per_hour'); $cron['time'] = lang('per_hour');
} }
$cron['time'] .= $cron['hour'] >= 0 && $cron['hour'] < 24 ? sprintf('%02d', $cron[hour]) . lang('timeliness') : ''; $cron['time'] .= $cron['hour'] >= 0 && $cron['hour'] < 24 ? sprintf('%02d', $cron[hour]) . lang('timeliness') : '';
if (!in_array($cron['minute'], array(-1, ''))) { if (!in_array($cron['minute'], array(-1, ''))) {
foreach ($cron['minute'] = explode("\t", $cron['minute']) as $k => $v) { foreach ($cron['minute'] = explode("\t", $cron['minute']) as $k => $v) {
$cron['minute'][$k] = sprintf('%02d', $v); $cron['minute'][$k] = sprintf('%02d', $v);
} }
$cron['minute'] = implode(',', $cron['minute']); $cron['minute'] = implode(',', $cron['minute']);
$cron['time'] .= $cron['minute'] . lang('point'); $cron['time'] .= $cron['minute'] . lang('point');
} else { } else {
$cron['time'] .= '00' . lang('point'); $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['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['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['nextrun'] = $cron['nextrun'] ? dgmdate($cron['nextrun'], $_G['setting']['dateformat'] . "<\b\\r />" . $_G['setting']['timeformat']) : '<b>N/A</b>';
$cron['run'] = $cron['available']; $cron['run'] = $cron['available'];
$crons[] = $cron; $crons[] = $cron;
} }
} else { } else {
if ($ids = dimplode($_GET['delete'])) { if ($ids = dimplode($_GET['delete'])) {
DB::delete('cron', "cronid IN ($ids) AND type!='system'"); DB::delete('cron', "cronid IN ($ids) AND type!='system'");
} }
if (is_array($_GET['namenew'])) { if (is_array($_GET['namenew'])) {
foreach ($_GET['namenew'] as $id => $name) { foreach ($_GET['namenew'] as $id => $name) {
$newcron = array('name' => dhtmlspecialchars($_GET['namenew'][$id]), 'available' => $_GET['availablenew'][$id]); $newcron = array('name' => dhtmlspecialchars($_GET['namenew'][$id]), 'available' => $_GET['availablenew'][$id]);
if (empty($_GET['availablenew'][$id])) { if (empty($_GET['availablenew'][$id])) {
$newcron['nextrun'] = '0'; $newcron['nextrun'] = '0';
} }
DB::update('cron', $newcron, "cronid='{$id}'"); DB::update('cron', $newcron, "cronid='{$id}'");
} }
} }
if ($newname = trim($_GET['newname'])) { 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'], )); 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')); $query = DB::query("SELECT cronid, filename FROM " . DB::table('cron'));
while ($cron = DB::fetch($query)) { while ($cron = DB::fetch($query)) {
$efile = explode(':', $cron['filename']); $efile = explode(':', $cron['filename']);
if (count($efile) > 1) { if (count($efile) > 1) {
$filename = array_pop($efile); $filename = array_pop($efile);
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename; $cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
} else { } else {
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename']; $cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
} }
if (!file_exists($cronfile)) { if (!file_exists($cronfile)) {
DB::update('cron', array('available' => '0', 'nextrun' => '0', ), "cronid='$cron[cronid]'"); DB::update('cron', array('available' => '0', 'nextrun' => '0', ), "cronid='$cron[cronid]'");
} }
} }
updatecache('setting'); updatecache('setting');
$msg = lang('crons_succeed'); $msg = lang('crons_succeed');
$redirecturl = BASESCRIPT . '?mod=system&op=cron'; $redirecturl = BASESCRIPT . '?mod=system&op=cron';
$msg_type = 'text-success'; $msg_type = 'text-success';
} }
} else { } else {
$cronid = empty($_GET['run']) ? $_GET['edit'] : $_GET['run']; $cronid = empty($_GET['run']) ? $_GET['edit'] : $_GET['run'];
$cron = DB::fetch_first("SELECT * FROM " . DB::table('cron') . " WHERE cronid='$cronid'"); $cron = DB::fetch_first("SELECT * FROM " . DB::table('cron') . " WHERE cronid='$cronid'");
if (!$cron) { if (!$cron) {
$msg = lang('cron_not_found'); $msg = lang('cron_not_found');
$redirecturl = BASESCRIPT . '?mod=system&op=cron'; $redirecturl = BASESCRIPT . '?mod=system&op=cron';
$msg_type = 'text-error'; $msg_type = 'text-error';
include template('cron'); include template('cron');
exit(); exit();
} }
$cron['filename'] = str_replace(array('..', '/', '\\'), array('', '', ''), $cron['filename']); $cron['filename'] = str_replace(array('..', '/', '\\'), array('', '', ''), $cron['filename']);
$cronminute = str_replace("\t", ',', $cron['minute']); $cronminute = str_replace("\t", ',', $cron['minute']);
$cron['minute'] = explode("\t", $cron['minute']); $cron['minute'] = explode("\t", $cron['minute']);
if (!empty($_GET['edit'])) { if (!empty($_GET['edit'])) {
if (!submitcheck('editsubmit')) { if (!submitcheck('editsubmit')) {
$navtitle = lang('misc_cron_edit') . ' - ' . lang('admin_navtitle'); $navtitle = lang('misc_cron_edit') . ' - ' . lang('admin_navtitle');
$weekdayselect = $dayselect = $hourselect = ''; $weekdayselect = $dayselect = $hourselect = '';
for ($i = 0; $i <= 6; $i++) { for ($i = 0; $i <= 6; $i++) {
$weekdayselect .= "<option value=\"$i\" " . ($cron['weekday'] == $i ? 'selected' : '') . ">" . lang('misc_cron_week_day_' . $i) . "</option>"; $weekdayselect .= "<option value=\"$i\" " . ($cron['weekday'] == $i ? 'selected' : '') . ">" . lang('misc_cron_week_day_' . $i) . "</option>";
} }
for ($i = 1; $i <= 31; $i++) { for ($i = 1; $i <= 31; $i++) {
$dayselect .= "<option value=\"$i\" " . ($cron['day'] == $i ? 'selected' : '') . ">$i " . lang('day') . "</option>"; $dayselect .= "<option value=\"$i\" " . ($cron['day'] == $i ? 'selected' : '') . ">$i " . lang('day') . "</option>";
} }
for ($i = 0; $i <= 23; $i++) { for ($i = 0; $i <= 23; $i++) {
$hourselect .= "<option value=\"$i\" " . ($cron['hour'] == $i ? 'selected' : '') . ">$i " . lang('timeliness') . "</option>"; $hourselect .= "<option value=\"$i\" " . ($cron['hour'] == $i ? 'selected' : '') . ">$i " . lang('timeliness') . "</option>";
} }
} else { } else {
$daynew = $_GET['weekdaynew'] != -1 ? -1 : $_GET['daynew']; $daynew = $_GET['weekdaynew'] != -1 ? -1 : $_GET['daynew'];
if (strpos($_GET['minutenew'], ',') !== FALSE) { if (strpos($_GET['minutenew'], ',') !== FALSE) {
$minutenew = explode(',', $_GET['minutenew']); $minutenew = explode(',', $_GET['minutenew']);
foreach ($minutenew as $key => $val) { foreach ($minutenew as $key => $val) {
$minutenew[$key] = $val = intval($val); $minutenew[$key] = $val = intval($val);
if ($val < 0 || $var > 59) { if ($val < 0 || $var > 59) {
unset($minutenew[$key]); unset($minutenew[$key]);
} }
} }
$minutenew = array_slice(array_unique($minutenew), 0, 12); $minutenew = array_slice(array_unique($minutenew), 0, 12);
$minutenew = implode("\t", $minutenew); $minutenew = implode("\t", $minutenew);
} else { } else {
$minutenew = intval($_GET['minutenew']); $minutenew = intval($_GET['minutenew']);
$minutenew = $minutenew >= 0 && $minutenew < 60 ? $minutenew : ''; $minutenew = $minutenew >= 0 && $minutenew < 60 ? $minutenew : '';
} }
$msg = ''; $msg = '';
$_GET['filenamenew'] = str_replace(array('..', '/', '\\'), '', $_GET['filenamenew']); $_GET['filenamenew'] = str_replace(array('..', '/', '\\'), '', $_GET['filenamenew']);
$efile = explode(':', $_GET['filenamenew']); $efile = explode(':', $_GET['filenamenew']);
if (count($efile) > 1) { if (count($efile) > 1) {
$filename = array_pop($efile); $filename = array_pop($efile);
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename; $cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
} else { } else {
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename']; $cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
} }
if (preg_match("/[\\\\\/\*\?\"\<\>\|]+/", $_GET['filenamenew'])) { if (preg_match("/[\\\\\/\*\?\"\<\>\|]+/", $_GET['filenamenew'])) {
$msg = lang('crons_filename_illegal'); $msg = lang('crons_filename_illegal');
} elseif (!is_readable($cronfile)) { } elseif (!is_readable($cronfile)) {
$msg = lang('crons_filename_invalid', array('cronfile' => $cronfile)); $msg = lang('crons_filename_invalid', array('cronfile' => $cronfile));
} elseif ($_GET['weekdaynew'] == -1 && $daynew == -1 && $_GET['hournew'] == -1 && $minutenew === '') { } elseif ($_GET['weekdaynew'] == -1 && $daynew == -1 && $_GET['hournew'] == -1 && $minutenew === '') {
$msg = lang('crons_time_invalid'); $msg = lang('crons_time_invalid');
} }
if (!empty($msg)) { if (!empty($msg)) {
$msg_type = 'text-error'; $msg_type = 'text-error';
$redirecturl = dreferer(); $redirecturl = dreferer();
include template('cron'); include template('cron');
exit(); exit();
} }
DB::update('cron', array('weekday' => $_GET['weekdaynew'], 'day' => $daynew, 'hour' => $_GET['hournew'], 'minute' => $minutenew, 'filename' => trim($_GET['filenamenew']), ), "cronid='$cronid'"); DB::update('cron', array('weekday' => $_GET['weekdaynew'], 'day' => $daynew, 'hour' => $_GET['hournew'], 'minute' => $minutenew, 'filename' => trim($_GET['filenamenew']), ), "cronid='$cronid'");
dzz_cron::run($cronid); dzz_cron::run($cronid);
$msg = lang('crons_succeed'); $msg = lang('crons_succeed');
$msg_type = 'text-success'; $msg_type = 'text-success';
$redirecturl = BASESCRIPT . '?mod=system&op=cron'; $redirecturl = BASESCRIPT . '?mod=system&op=cron';
} }
} else { } else {
$cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']); $cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']);
$efile = explode(':', $cron['filename']); $efile = explode(':', $cron['filename']);
if (count($efile) > 1) { if (count($efile) > 1) {
$filename = array_pop($efile); $filename = array_pop($efile);
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename; $cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
} else { } else {
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename']; $cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
} }
if (!file_exists($cronfile)) { if (!file_exists($cronfile)) {
$msg = lang('crons_run_invalid', array('cronfile' => $cronfile)); $msg = lang('crons_run_invalid', array('cronfile' => $cronfile));
$msg_type = 'text-error'; $msg_type = 'text-error';
} else { } else {
dzz_cron::run($cron['cronid']); dzz_cron::run($cron['cronid']);
$msg = lang('crons_run_succeed'); $msg = lang('crons_run_succeed');
$redirecturl = BASESCRIPT . '?mod=system&op=cron'; $redirecturl = BASESCRIPT . '?mod=system&op=cron';
$msg_type = 'text-success'; $msg_type = 'text-success';
} }
} }
} }
include template('cron'); include template('cron');
?> ?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
.el-avatar[data-v-663b95fa]{float:left;cursor:pointer}.el-divider--horizontal.el-divider[data-v-663b95fa]{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}

View File

@@ -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-801d4da6.a47ba236.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.8dd0185d.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-801d4da6.0f74a3ea.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.5892fe49.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.5892fe49.js></script></body></html>

View File

@@ -0,0 +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-801d4da6").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}}]);

View 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}}]);

View File

@@ -0,0 +1 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-801d4da6"],{"04d2":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:"orguser"}},[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=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-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("a16b"),a("9c24"),a("2877")),p=Object(l["a"])(d,o,s,!1,null,"663b95fa",null);e["default"]=p.exports},"864f":function(t,e,a){},"9c24":function(t,e,a){"use strict";var o=a("864f"),s=a.n(o);s.a},a16b:function(t,e,a){"use strict";var o=a("04d2"),s=a.n(o);s.a}}]);

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

View File

@@ -1,18 +1,18 @@
<?php <?php
/* /*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd * @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/ * @license https://www.oaooa.com/licenses/
* *
* @link https://www.oaooa.com * @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com) * @author zyx(zyx@oaooa.com)
*/ */
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) { if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
exit('Access Denied'); exit('Access Denied');
} }
require_once(__DIR__.'/dist/index.html'); require_once(__DIR__.'/dist/index.html');
exit(); exit();
$operation = $_GET['operation'] ? $_GET['operation'] : 'updatecache'; $operation = $_GET['operation'] ? $_GET['operation'] : 'updatecache';
$url=getglobal('siteurl'). BASESCRIPT . '?mod=system&op=' . $operation; $url=getglobal('siteurl'). BASESCRIPT . '?mod=system&op=' . $operation;
$url = outputurl($url); $url = outputurl($url);
@header("location: $url"); @header("location: $url");
?> ?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,343 +1,345 @@
<?php <?php
/* /*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd * @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/ * @license https://www.oaooa.com/licenses/
* *
* @link https://www.oaooa.com * @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com) * @author zyx(zyx@oaooa.com)
*/ */
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) { if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
exit('Access Denied'); exit('Access Denied');
} }
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle'); $navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
@set_time_limit(0); @set_time_limit(0);
include_once DZZ_ROOT . './core/core_version.php'; include_once DZZ_ROOT . './core/core_version.php';
include_once libfile('function/admin'); include_once libfile('function/admin');
include_once libfile('function/cache'); include_once libfile('function/cache');
$dzz_upgrade = new dzz_upgrade(); $dzz_upgrade = new dzz_upgrade();
$step = intval($_GET['step']); $step = intval($_GET['step']);
$op = $_GET['op']; $op = $_GET['op'];
$step = $step ? $step : 1; $step = $step ? $step : 1;
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check'; $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')); $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 ($operation == 'patch' || $operation == 'cross') {
if (!$_G['setting']['bbclosed']) { if (!$_G['setting']['bbclosed']) {
exit(json_encode(array('bbclosed'=>true))); exit(json_encode(array('bbclosed'=>true)));
} }
$msg = ''; $msg = '';
$version = trim($_GET['version']); $version = trim($_GET['version']);
$release = trim($_GET['release']); $release = trim($_GET['release']);
$locale = trim($_GET['locale']); $locale = trim($_GET['locale']);
$charset = trim($_GET['charset']); $charset = trim($_GET['charset']);
$upgradeinfo = $upgrade_step = array(); $upgradeinfo = $upgrade_step = array();
// if ($_GET['ungetfrom']) { // if ($_GET['ungetfrom']) {
// if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) { // if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
// $dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$version; // $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'])) ); // $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))); // exit(json_encode(array('iframe'=>true,'url'=>$url)));
// dheader('Location: ' . $url); // dheader('Location: ' . $url);
// } else { // } else {
// exit(json_encode(array('error'=>true,'msg'=>lang('upgrade_param_error')))); // exit(json_encode(array('error'=>true,'msg'=>lang('upgrade_param_error'))));
// } // }
// } // }
$upgrade_step = C::t('cache') -> fetch('upgrade_step'); $upgrade_step = C::t('cache') -> fetch('upgrade_step');
$upgrade_step = dunserialize($upgrade_step['cachevalue']); $upgrade_step = dunserialize($upgrade_step['cachevalue']);
$upgrade_step['step'] = $step; $upgrade_step['step'] = $step;
$upgrade_step['operation'] = $operation; $upgrade_step['operation'] = $operation;
$upgrade_step['version'] = $version; $upgrade_step['version'] = $version;
$upgrade_step['release'] = $release; $upgrade_step['release'] = $release;
$upgrade_step['charset'] = $charset; $upgrade_step['charset'] = $charset;
$upgrade_step['locale'] = $locale; $upgrade_step['locale'] = $locale;
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true); 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'); $upgrade_run = C::t('cache') -> fetch('upgrade_run');
if (!$upgrade_run) { if (!$upgrade_run) {
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true); C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
$upgrade_run = $_G['setting']['upgrade']; $upgrade_run = $_G['setting']['upgrade'];
} else { } else {
$upgrade_run = dunserialize($upgrade_run['cachevalue']); $upgrade_run = dunserialize($upgrade_run['cachevalue']);
} }
if ($step != 5) { if ($step != 5) {
foreach ($upgrade_run as $type => $list) { foreach ($upgrade_run as $type => $list) {
if ($type == $operation && $version == $list['latestversion']) { if ($type == $operation && $version == $list['latestversion']) {
$dzz_upgrade -> locale = $locale; $dzz_upgrade -> locale = $locale;
$dzz_upgrade -> charset = $charset; $dzz_upgrade -> charset = $charset;
$upgradeinfo = $list; $upgradeinfo = $list;
break; break;
} }
} }
if (!$upgradeinfo) { if (!$upgradeinfo) {
upgradeinformation(-1); upgradeinformation(-1);
exit(json_encode(array('upgradeNone'=>true))); exit(json_encode(array('upgradeNone'=>true)));
} }
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo); $updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
$updatemd5filelist = $updatefilelist['md5']; $updatemd5filelist = $updatefilelist['md5'];
$updatefilelist = $updatefilelist['file']; $updatefilelist = $updatefilelist['file'];
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=intsystemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset; $theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=intsystemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
if (empty($updatefilelist)) { if (empty($updatefilelist)) {
upgradeinformation(-2); upgradeinformation(-2);
exit(json_encode(array('upgradeError'=>true))); exit(json_encode(array('upgradeError'=>true)));
} }
} }
if ($step == 1) { if ($step == 1) {
exit(json_encode(array('step'=>1,'data'=>$updatefilelist))); exit(json_encode(array('step'=>1,'data'=>$updatefilelist)));
} elseif ($step == 2) { } elseif ($step == 2) {
$fileseq = intval($_GET['fileseq']); $fileseq = intval($_GET['fileseq']);
$fileseq = $fileseq ? $fileseq : 1; $fileseq = $fileseq ? $fileseq : 1;
if ($fileseq > count($updatefilelist)) { if ($fileseq > count($updatefilelist)) {
$linkurl = $theurl . '&step=3'; $linkurl = $theurl . '&step=3';
upgradeinformation(0); upgradeinformation(0);
exit(json_encode(array('step'=>2,'downloadstatus'=>4))); exit(json_encode(array('step'=>2,'downloadstatus'=>4)));
} else { } else {
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]); $downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
if ($downloadstatus == 1) { if ($downloadstatus == 1) {
$data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>$fileseq,'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist))); $data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>$fileseq,'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)));
upgradeinformation(1); upgradeinformation(1);
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>1))); exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>1)));
} elseif ($downloadstatus == 2) { } elseif ($downloadstatus == 2) {
$data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>($fileseq + 1),'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist))); $data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>($fileseq + 1),'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)));
upgradeinformation(1); upgradeinformation(1);
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>2))); exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>2)));
} else { } else {
$data = array('file' => $updatefilelist[$fileseq - 1]); $data = array('file' => $updatefilelist[$fileseq - 1]);
upgradeinformation(-3); upgradeinformation(-3);
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>3))); exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>3)));
} }
} }
} elseif ($step == 3) { } elseif ($step == 3) {
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist); list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
$tableData = array(); $tableData = array();
$button = ''; $button = '';
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) { if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
}else{ }else{
if(empty($modifylist)){ if(empty($modifylist)){
$button = lang('founder_upgrade_regular'); $button = lang('founder_upgrade_regular');
}else{ }else{
$button = lang('founder_upgrade_force'); $button = lang('founder_upgrade_force');
} }
foreach($updatefilelist as $val){ foreach($updatefilelist as $val){
if(isset($modifylist[$val])){ if(isset($modifylist[$val])){
$res = array('name'=>$val,'status'=>1); $res = array('name'=>$val,'status'=>1);
}elseif(isset($showlist[$val])){ }elseif(isset($showlist[$val])){
$res = array('name'=>$val,'status'=>2); $res = array('name'=>$val,'status'=>2);
}elseif(isset($newlist[$val])){ }elseif(isset($newlist[$val])){
$res = array('name'=>$val,'status'=>3); $res = array('name'=>$val,'status'=>3);
}else{ }else{
$res = array('name'=>$val,'status'=>1); $res = array('name'=>$val,'status'=>1);
} }
$tableData[] = $res; $tableData[] = $res;
} }
} }
upgradeinformation(-4); upgradeinformation(-4);
exit(json_encode(array('step'=>3,'tableData'=>$tableData,'button'=>$button,'oldversion'=>CORE_VERSION))); exit(json_encode(array('step'=>3,'tableData'=>$tableData,'button'=>$button,'oldversion'=>CORE_VERSION)));
} elseif ($step == 4) { } elseif ($step == 4) {
$confirm = $_GET['confirm']; $confirm = $_GET['confirm'];
if (!$confirm) { if (!$confirm) {
if ($_GET['siteftpsetting']) { if ($_GET['siteftpsetting']) {
$action = $theurl . '&step=4&confirm=ftp&formhash='.FORMHASH . ($_GET['startupgrade'] ? '&startupgrade=1' : ''); $action = $theurl . '&step=4&confirm=ftp&formhash='.FORMHASH . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
exit(json_encode(array('siteftpsetting'=>true,'url'=>$action))); exit(json_encode(array('siteftpsetting'=>true,'url'=>$action)));
} }
if ($upgradeinfo['isupdatedb']) { if ($upgradeinfo['isupdatedb']) {
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql'); $checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist); $checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
} else { } else {
$checkupdatefilelist = $updatefilelist; $checkupdatefilelist = $updatefilelist;
} }
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) { if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
$confirm = 'file'; $confirm = 'file';
} else { } else {
exit(json_encode(array('againsiteftpsetting'=>true))); exit(json_encode(array('againsiteftpsetting'=>true)));
} }
} }
$paraftp = ''; $paraftp = '';
if ($_GET['siteftp']) { if ($_GET['siteftp']) {
foreach ($_GET['siteftp'] as $k => $v) { foreach ($_GET['siteftp'] as $k => $v) {
$paraftp .= '&siteftp[' . $k . ']=' . $v; $paraftp .= '&siteftp[' . $k . ']=' . $v;
} }
} }
if (!$_GET['startupgrade']) { if (!$_GET['startupgrade']) {
if (!$_GET['backfile']) { if (!$_GET['backfile']) {
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp; $linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
upgradeinformation(2); upgradeinformation(2);
exit(json_encode(array('backfile'=>true,'url'=>$linkurl))); exit(json_encode(array('backfile'=>true,'url'=>$linkurl)));
} }
foreach ($updatefilelist as $updatefile) { foreach ($updatefilelist as $updatefile) {
$destfile = DZZ_ROOT . $updatefile; $destfile = DZZ_ROOT . $updatefile;
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile; $backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
if (is_file($destfile)) { if (is_file($destfile)) {
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) { if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
upgradeinformation(-5); upgradeinformation(-5);
exit(json_encode(array('destfile'=>true))); exit(json_encode(array('destfile'=>true)));
} }
} }
} }
upgradeinformation(3); upgradeinformation(3);
exit(json_encode(array('complete'=>true,'url'=>$theurl.'&step=4&startupgrade=1&confirm='.$confirm.$paraftp))); exit(json_encode(array('complete'=>true,'url'=>$theurl.'&step=4&startupgrade=1&confirm='.$confirm.$paraftp)));
} }
$linkurl = $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'; $ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
foreach ($updatefilelist as $updatefile) { foreach ($updatefilelist as $updatefile) {
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile; $srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
if ($confirm == 'ftp') { if ($confirm == 'ftp') {
$destfile = $updatefile; $destfile = $updatefile;
} else { } else {
$destfile = DZZ_ROOT . $updatefile; $destfile = DZZ_ROOT . $updatefile;
} }
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) { if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
if ($confirm == 'ftp') { if ($confirm == 'ftp') {
upgradeinformation(-6); upgradeinformation(-6);
exit(json_encode(array('ftpError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl))); exit(json_encode(array('ftpError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl)));
} else { } else {
upgradeinformation(-7); upgradeinformation(-7);
exit(json_encode(array('copyError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl))); exit(json_encode(array('copyError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl)));
} }
} }
} }
if ($upgradeinfo['isupdatedb']) { if ($upgradeinfo['isupdatedb']) {
$upgrade_step['step'] = 'dbupdate'; $upgrade_step['step'] = 'dbupdate';
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true); 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&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$version; $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'])); $linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
upgradeinformation(4); upgradeinformation(4);
exit(json_encode(array('updateMysql'=>true,'url'=>$linkurl))); exit(json_encode(array('updateMysql'=>true,'url'=>$linkurl)));
} }
exit(json_encode(array('nextStep'=>true))); exit(json_encode(array('nextStep'=>true)));
} elseif ($step == 5) { } elseif ($step == 5) {
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp'; $file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
@unlink($file); @unlink($file);
@unlink(DZZ_ROOT . './install/update.php'); @unlink(DZZ_ROOT . './install/update.php');
C::t('cache') -> delete('upgrade_step'); //打开站点
C::t('cache') -> delete('upgrade_run'); C::t('setting')->update('bbclosed', 0);
C::t('setting') -> update('upgrade', ''); C::t('cache') -> delete('upgrade_step');
updatecache('setting'); C::t('cache') -> delete('upgrade_run');
$old_update_dir = './data/update/'; C::t('setting') -> update('upgrade', '');
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/'; updatecache('setting');
$old_back_dir = './data/back/'; $old_update_dir = './data/update/';
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/'; $new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir); $old_back_dir = './data/back/';
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir); $new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir); $dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir); $dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
upgradeinformation(0); $dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
exit(json_encode(array('dir'=>$new_update_dir,'backdir'=>$new_back_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))); 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'); }elseif ($operation == 'check') {
if (!empty($upgrade_step['cachevalue'])) { $msg = '';
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']); $upgrade_step = C::t('cache') -> fetch('upgrade_step');
if (!empty($upgrade_step['cachevalue']['step'])) { if (!empty($upgrade_step['cachevalue'])) {
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
$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']; if (!empty($upgrade_step['cachevalue']['step'])) {
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck'; $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'];
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
// $dbreturnurl = $_G['siteurl'] . $theurl . '&step=5'; $recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$upgrade_step['cachevalue']['version']; if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])); // $dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
exit(json_encode(array('iframe'=>true,'steplang'=>$steplang['dbupdate'],'url'=>$stepurl))); $dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$upgrade_step['cachevalue']['version'];
} else { $stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
exit(json_encode(array('html'=>true,'steplang'=>$steplang[$upgrade_step['cachevalue']['step']],'data'=>$upgrade_step['cachevalue']))); exit(json_encode(array('iframe'=>true,'steplang'=>$steplang['dbupdate'],'url'=>$stepurl)));
} } else {
}else{ exit(json_encode(array('html'=>true,'steplang'=>$steplang[$upgrade_step['cachevalue']['step']],'data'=>$upgrade_step['cachevalue'])));
$dzz_upgrade -> check_upgrade(); }
exit(json_encode(array('html'=>false))); }else{
} $dzz_upgrade -> check_upgrade();
}else{ exit(json_encode(array('html'=>false)));
$dzz_upgrade -> check_upgrade(); }
exit(json_encode(array('html'=>false))); }else{
} $dzz_upgrade -> check_upgrade();
exit(); exit(json_encode(array('html'=>false)));
}elseif ($operation == 'showupgrade') { }
exit();
if ($_G['setting']['upgrade']) { }elseif ($operation == 'showupgrade') {
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true); if ($_G['setting']['upgrade']) {
$upgraderow = $patchrow = array(); C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
$dbversion = helper_dbtool::dbversion(); $upgraderow = $patchrow = array();
$locale = ''; $charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
$dbversion = helper_dbtool::dbversion();
if ($charset == 'BIG5') { $locale = '';
$locale = 'TC';
} elseif ($charset == 'GBK') { if ($charset == 'BIG5') {
$locale = 'SC'; $locale = 'TC';
} elseif ($charset == 'UTF8') { } elseif ($charset == 'GBK') {
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') { $locale = 'SC';
$locale = 'SC'; } elseif ($charset == 'UTF8') {
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') { if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
$locale = 'TC'; $locale = 'SC';
}else{ } elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
$locale = 'SC'; $locale = 'TC';
} }else{
} $locale = 'SC';
}
if (!is_array($_G['setting']['upgrade'])) }
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
$list = array(); if (!is_array($_G['setting']['upgrade']))
foreach ($_G['setting']['upgrade'] as $type => $upgrade) { $_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
$flist = array(); $list = array();
$unupgrade = 0; foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) { $flist = array();
$unupgrade = 1; $unupgrade = 0;
} if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
if ($unupgrade) { $unupgrade = 1;
$flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset; }
$flist['msg'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion; if ($unupgrade) {
$flist['update'] = false; $flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
} else { $flist['msg'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
$flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset; $flist['update'] = false;
$flist['update'] = true; } else {
$flist['version'] = $upgrade['latestversion']; $flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
$flist['locale'] = $locale; $flist['update'] = true;
$flist['charset'] = $charset; $flist['version'] = $upgrade['latestversion'];
} $flist['locale'] = $locale;
$list[] = $flist; $flist['charset'] = $charset;
} }
exit(json_encode(array('content'=>true,'data'=>$list))); $list[] = $flist;
} else { }
exit(json_encode(array('content'=>false))); exit(json_encode(array('content'=>true,'data'=>$list)));
} } else {
}elseif ($operation == 'recheck') { exit(json_encode(array('content'=>false)));
$upgrade_step = C::t('cache') -> fetch('upgrade_step'); }
$upgrade_step = dunserialize($upgrade_step['cachevalue']); }elseif ($operation == 'recheck') {
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp'; $upgrade_step = C::t('cache') -> fetch('upgrade_step');
@unlink($file); $upgrade_step = dunserialize($upgrade_step['cachevalue']);
@unlink(DZZ_ROOT . './install/update.php'); $file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
C::t('cache') -> delete('upgrade_step'); @unlink($file);
C::t('cache') -> delete('upgrade_run'); @unlink(DZZ_ROOT . './install/update.php');
C::t('setting') -> update('upgrade', ''); C::t('cache') -> delete('upgrade_step');
updatecache('setting'); C::t('cache') -> delete('upgrade_run');
$old_update_dir = './data/update/'; C::t('setting') -> update('upgrade', '');
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir); updatecache('setting');
$dzz_upgrade -> check_upgrade(); $old_update_dir = './data/update/';
// $url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' ); $dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
// dheader('Location: ' . $url); $dzz_upgrade -> check_upgrade();
} // $url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
// include template('upgrade'); // dheader('Location: ' . $url);
}
// include template('upgrade');
?> ?>

View File

@@ -1,7 +1,7 @@
<?php <?php
$lang = array ( $lang = array (
'appname'=>'System Tool', 'appname'=>'System Tool',
'systemupgrade'=>'online upgrade', 'systemupgrade'=>'online upgrade',
'tools_updatecache_memory'=>'Memory Cache' 'tools_updatecache_memory'=>'Memory Cache'
); );
?> ?>

View File

@@ -1,7 +1,7 @@
<?php <?php
$lang = array ( $lang = array (
'appname'=>'系统工具', 'appname'=>'系统工具',
'systemupgrade'=>'在线升级', 'systemupgrade'=>'在线升级',
'tools_updatecache_memory'=>'内存缓存' 'tools_updatecache_memory'=>'内存缓存'
); );
?> ?>

View File

@@ -1,416 +1,416 @@
<?php <?php
/* /*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd * @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/ * @license https://www.oaooa.com/licenses/
* *
* @link https://www.oaooa.com * @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com) * @author zyx(zyx@oaooa.com)
*/ */
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) { if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
exit('Access Denied'); exit('Access Denied');
} }
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle'); $navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
@set_time_limit(0); @set_time_limit(0);
include_once DZZ_ROOT . './core/core_version.php'; include_once DZZ_ROOT . './core/core_version.php';
include_once libfile('function/admin'); include_once libfile('function/admin');
include_once libfile('function/cache'); include_once libfile('function/cache');
$dzz_upgrade = new dzz_upgrade(); $dzz_upgrade = new dzz_upgrade();
$step = intval($_GET['step']); $step = intval($_GET['step']);
$op = $_GET['op']; $op = $_GET['op'];
$step = $step ? $step : 1; $step = $step ? $step : 1;
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check'; $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')); $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 ($operation == 'patch' || $operation == 'cross') {
if (!$_G['setting']['bbclosed']) { if (!$_G['setting']['bbclosed']) {
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_close_site') . '</p>'; $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"><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 .= "<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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
$msg .= "</script></p>"; $msg .= "</script></p>";
if (!$_GET['iframe']) { if (!$_GET['iframe']) {
include template('upgrade'); include template('upgrade');
exit(); exit();
} else { } else {
include template('upgrade_iframe'); include template('upgrade_iframe');
exit(); exit();
} }
} }
$msg = ''; $msg = '';
$version = trim($_GET['version']); $version = trim($_GET['version']);
//$release = trim($_GET['release']); //$release = trim($_GET['release']);
$locale = trim($_GET['locale']); $locale = trim($_GET['locale']);
$charset = trim($_GET['charset']); $charset = trim($_GET['charset']);
$upgradeinfo = $upgrade_step = array(); $upgradeinfo = $upgrade_step = array();
if ($_GET['ungetfrom']) { if ($_GET['ungetfrom']) {
if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) { if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5'; $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'])) ); $url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
dheader('Location: ' . $url); dheader('Location: ' . $url);
} else { } else {
showmessage('upgrade_param_error'); showmessage('upgrade_param_error');
} }
} }
$upgrade_step = C::t('cache') -> fetch('upgrade_step'); $upgrade_step = C::t('cache') -> fetch('upgrade_step');
$upgrade_step = dunserialize($upgrade_step['cachevalue']); $upgrade_step = dunserialize($upgrade_step['cachevalue']);
$upgrade_step['step'] = $step; $upgrade_step['step'] = $step;
$upgrade_step['operation'] = $operation; $upgrade_step['operation'] = $operation;
$upgrade_step['version'] = $version; $upgrade_step['version'] = $version;
//$upgrade_step['release'] = $release; //$upgrade_step['release'] = $release;
$upgrade_step['charset'] = $charset; $upgrade_step['charset'] = $charset;
$upgrade_step['locale'] = $locale; $upgrade_step['locale'] = $locale;
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true); 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'); $upgrade_run = C::t('cache') -> fetch('upgrade_run');
if (!$upgrade_run) { if (!$upgrade_run) {
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true); C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
$upgrade_run = $_G['setting']['upgrade']; $upgrade_run = $_G['setting']['upgrade'];
} else { } else {
$upgrade_run = dunserialize($upgrade_run['cachevalue']); $upgrade_run = dunserialize($upgrade_run['cachevalue']);
} }
if ($step != 5) { if ($step != 5) {
foreach ($upgrade_run as $type => $list) { foreach ($upgrade_run as $type => $list) {
if ($type == $operation && $version == $list['latestversion']) { if ($type == $operation && $version == $list['latestversion']) {
$dzz_upgrade -> locale = $locale; $dzz_upgrade -> locale = $locale;
$dzz_upgrade -> charset = $charset; $dzz_upgrade -> charset = $charset;
$upgradeinfo = $list; $upgradeinfo = $list;
break; break;
} }
} }
if (!$upgradeinfo) { if (!$upgradeinfo) {
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_none', array('upgradeurl' => upgradeinformation(-1))) . '</p>'; $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 .= "<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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
$msg .= "</script></p>"; $msg .= "</script></p>";
if (!$_GET['iframe']) { if (!$_GET['iframe']) {
include template('upgrade'); include template('upgrade');
exit(); exit();
} else { } else {
include template('upgrade_iframe'); include template('upgrade_iframe');
exit(); exit();
} }
} }
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo); $updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
$updatemd5filelist = $updatefilelist['md5']; $updatemd5filelist = $updatefilelist['md5'];
$updatefilelist = $updatefilelist['file']; $updatefilelist = $updatefilelist['file'];
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset; $theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
if (empty($updatefilelist)) { if (empty($updatefilelist)) {
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_download_upgradelist_error', array('upgradeurl' => upgradeinformation(-2))) . '</p>'; $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 .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($thurl) . '\';", 1000);</script>';
$msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>'; $msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>';
if (!$_GET['iframe']) { if (!$_GET['iframe']) {
include template('upgrade'); include template('upgrade');
exit(); exit();
} else { } else {
include template('upgrade_iframe'); include template('upgrade_iframe');
exit(); exit();
} }
} }
} }
if ($step == 1) { if ($step == 1) {
$linkurl = $theurl . '&step=2'; $linkurl = $theurl . '&step=2';
include template('upgrade'); include template('upgrade');
exit(); exit();
} elseif ($step == 2) { } elseif ($step == 2) {
$fileseq = intval($_GET['fileseq']); $fileseq = intval($_GET['fileseq']);
$fileseq = $fileseq ? $fileseq : 1; $fileseq = $fileseq ? $fileseq : 1;
if ($fileseq > count($updatefilelist)) { if ($fileseq > count($updatefilelist)) {
$linkurl = $theurl . '&step=3'; $linkurl = $theurl . '&step=3';
$downloadstatus = 3; $downloadstatus = 3;
$msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0))); $msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0)));
if (!$_GET['iframe']) { if (!$_GET['iframe']) {
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>'; $msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>';
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>'; $msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
} else { } else {
$msg .= '<script type="text/JavaScript">setTimeout("parent.location.href=\'' . $linkurl . '\';", 1000);</script>'; $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>'; $msg .= ' <p><a href="javascript:;" onclick="parent.location.href=\'' . $linkurl . '\';return false;">' . lang('message_redirect') . '</a></p>';
include template('upgrade_iframe'); include template('upgrade_iframe');
exit(); exit();
} }
} else { } else {
if (!$_GET['iframe']) { if (!$_GET['iframe']) {
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1'; $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>'; $msg = '<iframe id="downiframe" marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' . $linkurl . '" style="width:100%;height:100%;"></iframe>';
} else { } else {
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]); $downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
if ($downloadstatus == 1) { if ($downloadstatus == 1) {
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=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 = 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>'; $msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
} elseif ($downloadstatus == 2) { } elseif ($downloadstatus == 2) {
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq + 1) . '&iframe=1'; $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 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>'; $msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
} else { } else {
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq) . '&iframe=1'; $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">' . 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 . '\'" />'; $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'); include template('upgrade_iframe');
exit(); exit();
} }
} }
} elseif ($step == 3) { } elseif ($step == 3) {
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist); list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) { if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
$msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4))); $msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4)));
} }
$linkurl = $theurl . '&step=4'; $linkurl = $theurl . '&step=4';
} elseif ($step == 4) { } elseif ($step == 4) {
$confirm = $_GET['confirm']; $confirm = $_GET['confirm'];
if (!$confirm) { if (!$confirm) {
if ($_GET['siteftpsetting']) { if ($_GET['siteftpsetting']) {
$action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : ''); $action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
if ($upgradeinfo['isupdatedb']) { if ($upgradeinfo['isupdatedb']) {
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql'); $checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist); $checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
} else { } else {
$checkupdatefilelist = $updatefilelist; $checkupdatefilelist = $updatefilelist;
} }
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) { if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
$confirm = 'file'; $confirm = 'file';
} else { } else {
$linkurl = $theurl . '&step=4'; $linkurl = $theurl . '&step=4';
$ftplinkurl = $linkurl . '&siteftpsetting=1'; $ftplinkurl = $linkurl . '&siteftpsetting=1';
$msg = '<p style="margin:10px 0">' . lang('upgrade_cannot_access_file') . '</p>'; $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 .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" />';
$msg .= ' &nbsp; <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>'; $msg .= ' &nbsp; <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>';
$msg .= "<script type=\"text/javascript\">"; $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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
$msg .= "</script>"; $msg .= "</script>";
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
} }
$paraftp = ''; $paraftp = '';
if ($_GET['siteftp']) { if ($_GET['siteftp']) {
foreach ($_GET['siteftp'] as $k => $v) { foreach ($_GET['siteftp'] as $k => $v) {
$paraftp .= '&siteftp[' . $k . ']=' . $v; $paraftp .= '&siteftp[' . $k . ']=' . $v;
} }
} }
if (!$_GET['startupgrade']) { if (!$_GET['startupgrade']) {
if (!$_GET['backfile']) { if (!$_GET['backfile']) {
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp; $linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
$msg = '<p style="margin:10px 0">' . lang('upgrade_backuping', array('upgradeurl' => upgradeinformation(2))) . '</p>'; $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 .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($linkurl) . '\';", 1000);</script>';
$msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>'; $msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>';
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
foreach ($updatefilelist as $updatefile) { foreach ($updatefilelist as $updatefile) {
$destfile = DZZ_ROOT . $updatefile; $destfile = DZZ_ROOT . $updatefile;
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile; $backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
if (is_file($destfile)) { if (is_file($destfile)) {
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) { 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">' . lang('upgrade_backup_error', array('upgradeurl' => upgradeinformation(-5))) . '</p>';
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">"; $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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
$msg .= "</script></p>"; $msg .= "</script></p>";
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
} }
} }
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_complete', array('upgradeurl' => upgradeinformation(3))) . '</p>'; $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 .= '<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>'; $msg .= ' <p><a href="' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '">' . lang('message_redirect') . '</p>';
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
$linkurl = $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'; $ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
foreach ($updatefilelist as $updatefile) { foreach ($updatefilelist as $updatefile) {
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile; $srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
if ($confirm == 'ftp') { if ($confirm == 'ftp') {
$destfile = $updatefile; $destfile = $updatefile;
} else { } else {
$destfile = DZZ_ROOT . $updatefile; $destfile = DZZ_ROOT . $updatefile;
} }
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) { if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
if ($confirm == 'ftp') { 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">' . 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 .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reupload') . '" />';
$msg .= '&nbsp;<input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_reset_ftp') . '" /></p>'; $msg .= '&nbsp;<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 .= "<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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
$msg .= "</script></p>"; $msg .= "</script></p>";
include template('upgrade'); include template('upgrade');
exit(); exit();
} else { } else {
$msg = '<p style="margin:10px 0">' . lang('upgrade_copy_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7))) . '</p>'; $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 .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_recopy') . '" />';
$msg .= '&nbsp;<input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" /></p>'; $msg .= '&nbsp;<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 .= "<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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
$msg .= "</script></p>"; $msg .= "</script></p>";
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
} }
} }
if ($upgradeinfo['isupdatedb']) { if ($upgradeinfo['isupdatedb']) {
$upgrade_step['step'] = 'dbupdate'; $upgrade_step['step'] = 'dbupdate';
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true); 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&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'])); $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 = '<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 .= '<script type="text/JavaScript">setTimeout(function(){createIframe(\'' . $linkurl . '\');}, 1000);</script>';
$msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>'; $msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>';
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' ); $url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' );
dheader('Location: ' . $url); dheader('Location: ' . $url);
} elseif ($step == 5) { } elseif ($step == 5) {
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp'; $file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
@unlink($file); @unlink($file);
@unlink(DZZ_ROOT . './install/update.php'); @unlink(DZZ_ROOT . './install/update.php');
C::t('cache') -> delete('upgrade_step'); C::t('cache') -> delete('upgrade_step');
C::t('cache') -> delete('upgrade_run'); C::t('cache') -> delete('upgrade_run');
C::t('setting') -> update('upgrade', ''); C::t('setting') -> update('upgrade', '');
updatecache('setting'); updatecache('setting');
$old_update_dir = './data/update/'; $old_update_dir = './data/update/';
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/'; $new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
$old_back_dir = './data/back/'; $old_back_dir = './data/back/';
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/'; $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_update_dir, DZZ_ROOT . $new_update_dir);
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_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_update_dir);
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_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))); $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') { elseif ($operation == 'check') {
$msg = ''; $msg = '';
if (!intval($_GET['rechecking'])) { if (!intval($_GET['rechecking'])) {
$upgrade_step = C::t('cache') -> fetch('upgrade_step'); $upgrade_step = C::t('cache') -> fetch('upgrade_step');
if (!empty($upgrade_step['cachevalue'])) { if (!empty($upgrade_step['cachevalue'])) {
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']); $upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
if (!empty($upgrade_step['cachevalue']['step'])) { 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']; $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'; $recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') { if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
$dbreturnurl = $_G['siteurl'] . $theurl . '&step=5'; $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'])); $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>'; $msg = '<p style="margin:10px 0;">' . lang('upgrade_continue_db', array('steplang' => $steplang['dbupdate'], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
} else { } else {
$stepurl = $theurl . '&step=' . $upgrade_step['cachevalue']['step']; $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>'; $msg = '<p style="margin:10px 0;">' . lang('upgrade_continue', array('steplang' => $steplang[$upgrade_step['cachevalue']['step']], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
} }
} }
} }
} else { } else {
C::t('cache') -> delete('upgrade_step'); C::t('cache') -> delete('upgrade_step');
} }
if (!intval($_GET['checking']) || $msg) { if (!intval($_GET['checking']) || $msg) {
} else { } else {
$dzz_upgrade -> check_upgrade(); $dzz_upgrade -> check_upgrade();
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' ); $url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' );
dheader('Location: ' . $url); dheader('Location: ' . $url);
} }
} }
elseif ($operation == 'showupgrade') { elseif ($operation == 'showupgrade') {
if ($_G['setting']['upgrade']) { if ($_G['setting']['upgrade']) {
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true); C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
$upgraderow = $patchrow = array(); $upgraderow = $patchrow = array();
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset'])); $charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
$dbversion = helper_dbtool::dbversion(); $dbversion = helper_dbtool::dbversion();
$locale = ''; $locale = '';
if ($charset == 'BIG5') { if ($charset == 'BIG5') {
$locale = 'TC'; $locale = 'TC';
} elseif ($charset == 'GBK') { } elseif ($charset == 'GBK') {
$locale = 'SC'; $locale = 'SC';
} elseif ($charset == 'UTF8') { } elseif ($charset == 'UTF8') {
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') { if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
$locale = 'SC'; $locale = 'SC';
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') { } elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
$locale = 'TC'; $locale = 'TC';
}else{ }else{
$locale = 'SC'; $locale = 'SC';
} }
} }
if (!is_array($_G['setting']['upgrade'])) if (!is_array($_G['setting']['upgrade']))
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']); $_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
$list = array(); $list = array();
foreach ($_G['setting']['upgrade'] as $type => $upgrade) { foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
$unupgrade = 0; $unupgrade = 0;
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) { if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
$unupgrade = 1; $unupgrade = 1;
} }
$list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset; $list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset;
if ($unupgrade) { if ($unupgrade) {
$list[$type]['title'] = 'oaooa PicHome' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset; $list[$type]['title'] = 'oaooa PicHome' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
$list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion; $list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
} else { } else {
$list[$type]['title'] = 'oaooa PicHome' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset; $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]['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>'; $list[$type]['official'] = '<a class="btn btn-link" href="' . $upgrade['official'] . '" target="_blank">' . lang('founder_upgrade_manually') . '</a>';
} }
} }
} else { } else {
$msg = lang('upgrade_latest_version'); $msg = lang('upgrade_latest_version');
} }
} }
elseif ($operation == 'recheck') { elseif ($operation == 'recheck') {
$upgrade_step = C::t('cache') -> fetch('upgrade_step'); $upgrade_step = C::t('cache') -> fetch('upgrade_step');
$upgrade_step = dunserialize($upgrade_step['cachevalue']); $upgrade_step = dunserialize($upgrade_step['cachevalue']);
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp'; $file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
@unlink($file); @unlink($file);
@unlink(DZZ_ROOT . './install/update.php'); @unlink(DZZ_ROOT . './install/update.php');
C::t('cache') -> delete('upgrade_step'); C::t('cache') -> delete('upgrade_step');
C::t('cache') -> delete('upgrade_run'); C::t('cache') -> delete('upgrade_run');
C::t('setting') -> update('upgrade', ''); C::t('setting') -> update('upgrade', '');
updatecache('setting'); updatecache('setting');
$old_update_dir = './data/update/'; $old_update_dir = './data/update/';
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir); $dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
$url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' ); $url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
dheader('Location: ' . $url); dheader('Location: ' . $url);
} }
include template('upgrade'); include template('upgrade');
?> ?>

View File

@@ -1,188 +1,188 @@
<!--{template common/header_simple_start}--> <!--{template common/header_simple_start}-->
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all"> <link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script> <script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
<script src="admin/scripts/admin.js?{VERHASH}"></script> <script src="admin/scripts/admin.js?{VERHASH}"></script>
<style> <style>
input[type="text"] { input[type="text"] {
margin: 0; margin: 0;
} }
ul.help-block, ul.help-block li, .help-block li{ ul.help-block, ul.help-block li, .help-block li{
margin-bottom: 5px; margin-bottom: 5px;
} }
</style> </style>
<!--{template common/header_simple_end}--> <!--{template common/header_simple_end}-->
<!--{template common/commer_header}--> <!--{template common/commer_header}-->
<div class="bs-container clearfix"> <div class="bs-container clearfix">
<div class="bs-left-container clearfix"> <div class="bs-left-container clearfix">
<!--{template left}--> <!--{template left}-->
</div> </div>
<div class="left-drager"> <div class="left-drager">
</div> </div>
<div class="bs-main-container clearfix"> <div class="bs-main-container clearfix">
<div class="main-header clearfix"> <div class="main-header clearfix">
<ul class="nav nav-pills nav-pills-bottomguide"> <ul class="nav nav-pills nav-pills-bottomguide">
<li <!--{if empty($_GET[ 'edit']) && empty($_GET[ 'run'])}-->class="active"<!--{/if}-->> <li <!--{if empty($_GET[ 'edit']) && empty($_GET[ 'run'])}-->class="active"<!--{/if}-->>
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron">{lang cron}</a> <a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron">{lang cron}</a>
</li> </li>
<!--{if !empty($_GET['edit'])}--> <!--{if !empty($_GET['edit'])}-->
<li class="active"> <li class="active">
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&edit=$_GET[edit]">{lang misc_cron_edit}</a> <a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&edit=$_GET[edit]">{lang misc_cron_edit}</a>
</li> </li>
<!--{/if}--> <!--{/if}-->
<!--{if !empty($_GET['run'])}--> <!--{if !empty($_GET['run'])}-->
<li class="active"> <li class="active">
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&run=$_GET[run]">{lang misc_cron_operation}</a> <a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&run=$_GET[run]">{lang misc_cron_operation}</a>
</li> </li>
<!--{/if}--> <!--{/if}-->
</ul> </ul>
</div> </div>
<div class="main-content" style="padding:15px;border-top:1px solid #FFF"> <div class="main-content" style="padding:15px;border-top:1px solid #FFF">
<!--{if $msg}--> <!--{if $msg}-->
<div class="well"> <div class="well">
<p class="$msg_type">$msg</p> <p class="$msg_type">$msg</p>
<!--{if $redirecturl}--> <!--{if $redirecturl}-->
<p class="text-info"> <p class="text-info">
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a> <a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
</p> </p>
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script> <script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
<!--{/if}--> <!--{/if}-->
</div> </div>
<!--{else}--> <!--{else}-->
<!--{if $_GET['edit']>0}--> <!--{if $_GET['edit']>0}-->
<ul class="help-block"> <ul class="help-block">
<h4>{lang board_message}</h4> {lang misc_cron_edit_tips} <h4>{lang board_message}</h4> {lang misc_cron_edit_tips}
</ul> </ul>
<form id="cpform" action="{BASESCRIPT}?mod=system&op=cron&edit=$cronid" class="form-horizontal form-horizontal-left" method="post" name="cpform"> <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="{FORMHASH}" name="formhash">
<input type="hidden" value="true" name="editsubmit"> <input type="hidden" value="true" name="editsubmit">
<dl> <dl>
<dt>{lang weekly}:</dt> <dt>{lang weekly}:</dt>
<dd class="clearfix"> <dd class="clearfix">
<select name="weekdaynew" class="form-control"> <select name="weekdaynew" class="form-control">
<option value="-1" selected="selected">*</option> <option value="-1" selected="selected">*</option>
$weekdayselect $weekdayselect
</select> </select>
<span class="help-inline">{lang misc_cron_edit_weekday_comment}</span> <span class="help-inline">{lang misc_cron_edit_weekday_comment}</span>
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt>{lang everyday}:</dt> <dt>{lang everyday}:</dt>
<dd class="clearfix"> <dd class="clearfix">
<select name="daynew" class="form-control"> <select name="daynew" class="form-control">
<option value="-1" selected="selected">*</option> <option value="-1" selected="selected">*</option>
$dayselect $dayselect
</select> </select>
<span class="help-inline">{lang misc_cron_edit_day_comment}</span> <span class="help-inline">{lang misc_cron_edit_day_comment}</span>
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt>{lang hour}:</dt> <dt>{lang hour}:</dt>
<dd class="clearfix"> <dd class="clearfix">
<select name="hournew" class="form-control"> <select name="hournew" class="form-control">
<option value="-1" selected="selected">*</option> <option value="-1" selected="selected">*</option>
$hourselect $hourselect
</select> </select>
<span class="help-inline">{lang misc_cron_edit_hour_comment}</span> <span class="help-inline">{lang misc_cron_edit_hour_comment}</span>
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt>{lang minute}:</dt> <dt>{lang minute}:</dt>
<dd class="clearfix"> <dd class="clearfix">
<input name="minutenew" value="{eval echo implode(',',$cron[minute])}" type="text" class="form-control"> <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> <span class="help-inline">{lang misc_cron_edit_minute_comment}</span>
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt>{lang misc_cron_edit_filename}:</dt> <dt>{lang misc_cron_edit_filename}:</dt>
<dd class="clearfix"> <dd class="clearfix">
<input name="filenamenew" value="$cron[filename]" type="text" class="form-control"> <input name="filenamenew" value="$cron[filename]" type="text" class="form-control">
<span class="help-inline">{lang misc_cron_edit_filename_comment}</span> <span class="help-inline">{lang misc_cron_edit_filename_comment}</span>
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dd class="clearfix"> <dd class="clearfix">
<button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button> <button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button>
</dd> </dd>
</dl> </dl>
</form> </form>
<!--{elseif $_GET['run']}--> <!--{elseif $_GET['run']}-->
<!--{else}--> <!--{else}-->
<ul class="help-block"> <ul class="help-block">
<h5>{lang board_message}</h5> {lang misc_cron_tips} <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 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 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> <li>详细请查阅官方文档 <a href="http://help.oaooa.com/corpus/list?cid=24#fid_330" target="_blank">管理员手册-计划任务</a> 中的相关内容</li>
</ul> </ul>
<form id="cpform" action="{BASESCRIPT}?mod=system&op=cron" class="form-horizontal form-horizontal-left" method="post" name="cpform"> <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="{FORMHASH}" name="formhash">
<input type="hidden" value="true" name="cronssubmit"> <input type="hidden" value="true" name="cronssubmit">
<table class="table"> <table class="table">
<thead> <thead>
<th width="45"></th> <th width="45"></th>
<th>{lang name}</th> <th>{lang name}</th>
<th>{lang available}</th> <th>{lang available}</th>
<th>{lang type}</th> <th>{lang type}</th>
<th>{lang time}</th> <th>{lang time}</th>
<th>{lang misc_cron_last_run}</th> <th>{lang misc_cron_last_run}</th>
<th>{lang misc_cron_next_run}</th> <th>{lang misc_cron_next_run}</th>
<th></th> <th></th>
</thead> </thead>
<!--{loop $crons $cron}--> <!--{loop $crons $cron}-->
<tr> <tr>
<td align="right"><input type="checkbox" name="delete[]" value="$cron[cronid]" <!--{if $cron[type]=='system' }-->disabled <td align="right"><input type="checkbox" name="delete[]" value="$cron[cronid]" <!--{if $cron[type]=='system' }-->disabled
<!--{/if}-->></td> <!--{/if}-->></td>
<td> <td>
<p class="clearfix"> <p class="clearfix">
<input type="text" name="namenew[{$cron[cronid]}]" class="form-control" value="$cron[name]"></p> <input type="text" name="namenew[{$cron[cronid]}]" class="form-control" value="$cron[name]"></p>
<strong>$cron[filename]</strong> <strong>$cron[filename]</strong>
</td> </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><label class="checkbox-inline"><input type="checkbox" name="availablenew[{$cron[cronid]}]" value="1" <!--{if $cron[available]>0}-->checked="checked"<!--{/if}-->></label></td>
<td> <td>
<!--{if $cron['type'] == 'system'}--> <!--{if $cron['type'] == 'system'}-->
{lang inbuilt} {lang inbuilt}
<!--{elseif $cron['type'] == 'user'}--> <!--{elseif $cron['type'] == 'user'}-->
{lang custom} {lang custom}
<!--{/if}--> <!--{/if}-->
</td> </td>
<td>$cron[time]</td> <td>$cron[time]</td>
<td>$cron[lastrun]</td> <td>$cron[lastrun]</td>
<td>$cron[nextrun]</td> <td>$cron[nextrun]</td>
<td> <td>
<a href="{BASESCRIPT}?mod=system&op=cron&edit=$cron[cronid]">{lang edit}</a> <a href="{BASESCRIPT}?mod=system&op=cron&edit=$cron[cronid]">{lang edit}</a>
<br /> <br />
<!--{if $cron['run']}--> <!--{if $cron['run']}-->
<a href="{BASESCRIPT}?mod=system&op=cron&run=$cron[cronid]">{lang execute}</a> <a href="{BASESCRIPT}?mod=system&op=cron&run=$cron[cronid]">{lang execute}</a>
<!--{else}--> <!--{else}-->
<a href="javascript:;" class="text-muted">{lang execute}</a> <a href="javascript:;" class="text-muted">{lang execute}</a>
<!--{/if}--> <!--{/if}-->
</td> </td>
</tr> </tr>
<!--{/loop}--> <!--{/loop}-->
<tr> <tr>
<td>{lang add_new}</td> <td>{lang add_new}</td>
<td colspan="10"><input type="text" name="newname" value="" class="form-control"></td> <td colspan="10"><input type="text" name="newname" value="" class="form-control"></td>
</tr> </tr>
<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>&nbsp;&nbsp;<button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button> <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>&nbsp;&nbsp;<button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button>
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
<!--{/if}--> <!--{/if}-->
<!--{/if}--> <!--{/if}-->
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
jQuery('.left-drager').leftDrager_layout(); jQuery('.left-drager').leftDrager_layout();
</script> </script>
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script> <script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
<!--{template common/footer_simple}--> <!--{template common/footer_simple}-->

View File

@@ -1,236 +1,236 @@
<!--{template common/header_simple_start}--> <!--{template common/header_simple_start}-->
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all"> <link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script> <script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
<script src="admin/scripts/admin.js?{VERHASH}"></script> <script src="admin/scripts/admin.js?{VERHASH}"></script>
<!--{template common/header_simple_end}--> <!--{template common/header_simple_end}-->
<!--{template common/commer_header}--> <!--{template common/commer_header}-->
<div class="bs-container clearfix"> <div class="bs-container clearfix">
<div class="bs-left-container clearfix"> <div class="bs-left-container clearfix">
<!--{template left}--> <!--{template left}-->
</div> </div>
<div class="left-drager"> <div class="left-drager">
</div> </div>
<div class="bs-main-container clearfix"> <div class="bs-main-container clearfix">
<div class="main-header clearfix"> <div class="main-header clearfix">
<ul class="nav nav-pills nav-pills-bottomguide"> <ul class="nav nav-pills nav-pills-bottomguide">
<li <!--{if $operation=='export' }-->class="active"<!--{/if}-->> <li <!--{if $operation=='export' }-->class="active"<!--{/if}-->>
<a hidefocus="true" href="{MOD_URL}&op=database&operation=export">{lang export}</a> <a hidefocus="true" href="{MOD_URL}&op=database&operation=export">{lang export}</a>
</li> </li>
<li <!--{if $operation=='import' }-->class="active"<!--{/if}-->> <li <!--{if $operation=='import' }-->class="active"<!--{/if}-->>
<a hidefocus="true" href="{MOD_URL}&op=database&operation=import">{lang nav_db_import}</a> <a hidefocus="true" href="{MOD_URL}&op=database&operation=import">{lang nav_db_import}</a>
</li> </li>
<li <!--{if $operation=='runquery' }-->class="active"<!--{/if}-->> <li <!--{if $operation=='runquery' }-->class="active"<!--{/if}-->>
<a hidefocus="true" href="{MOD_URL}&op=database&operation=runquery">{lang nav_db_runquery}</a> <a hidefocus="true" href="{MOD_URL}&op=database&operation=runquery">{lang nav_db_runquery}</a>
</li> </li>
</ul> </ul>
</div> </div>
<!--{if $operation=='export'}--> <!--{if $operation=='export'}-->
<ul class="help-block mt20"> <ul class="help-block mt20">
<h5>{lang board_message}</h5> {lang db_export_tips} <h5>{lang board_message}</h5> {lang db_export_tips}
</ul> </ul>
<div class="main-content"> <div class="main-content">
<!--{if !$submit}--> <!--{if !$submit}-->
<form id="cpform" action="{MOD_URL}&op=database&operation=export&setup=1" class="form-horizontal form-horizontal-left" method="post" name="cpform"> <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="{FORMHASH}" name="formhash">
<input type="hidden" value="true" name="exportsubmit"> <input type="hidden" value="true" name="exportsubmit">
<dl> <dl>
<dt>{lang db_export_type}:</dt> <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="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 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"> <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> <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"> <ul class="list-unstyled">
<!--{loop $dztables $value}--> <!--{loop $dztables $value}-->
<li class="col-xs-4"><label class="checkbox-inline"><input type="checkbox" name="customtables[]" value="$value" checked="checked">$value</label></li> <li class="col-xs-4"><label class="checkbox-inline"><input type="checkbox" name="customtables[]" value="$value" checked="checked">$value</label></li>
<!--{/loop}--> <!--{/loop}-->
</ul> </ul>
</dd> </dd>
</dl> </dl>
<div id="advanceoption" style="display:none"> <div id="advanceoption" style="display:none">
<dl> <dl>
<dt>{lang db_export_method}:</dt> <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&lt;=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="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&lt;=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> <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"> <input type="text" class="input-sm form-control" style="width:50px;" name="sizelimit" value="2048">
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt>{lang db_export_options_extended_insert}:</dt> <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> <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>
<dl> <dl>
<dt>{lang db_export_options_sql_compatible}:</dt> <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="" 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="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> <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>
<dl> <dl>
<dt>{lang db_export_options_charset}:</dt> <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> <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> <label class="radio radio-inline"><input type="radio" name="sqlcharset" value="utf8"> UTF8</label></dd>
</dl> </dl>
<dl> <dl>
<dt>{lang db_export_usehex}:</dt> <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> <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> <label class="radio radio-inline"><input type="radio" name="usehex" value="0" >{lang no}</label></dd>
</dl> </dl>
<dl> <dl>
<dt>{lang db_export_usezip}:</dt> <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="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="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> <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>
<dl> <dl>
<dt>{lang db_export_filename}:</dt> <dt>{lang db_export_filename}:</dt>
<dd class="clearfix"><input type="text" class="form-control" name="filename" value="$defaultfilename"></dd> <dd class="clearfix"><input type="text" class="form-control" name="filename" value="$defaultfilename"></dd>
</dl> </dl>
</div> </div>
<dl> <dl>
<dd class="clearfix"><button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button> <dd class="clearfix"><button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button>
&nbsp; &nbsp;<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> &nbsp; &nbsp;<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> </dl>
</form> </form>
<!--{else}--> <!--{else}-->
<div class="well"> <div class="well">
<!--{if $msg}--> <!--{if $msg}-->
<p class="$msg_type">$msg</p> <p class="$msg_type">$msg</p>
<!--{/if}--> <!--{/if}-->
<!--{if $redirecturl}--> <!--{if $redirecturl}-->
<p class="text-info"> <p class="text-info">
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a> <a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
</p> </p>
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script> <script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
<!--{/if}--> <!--{/if}-->
</div> </div>
<!--{/if}--> <!--{/if}-->
</div> </div>
<!--{elseif $operation=='import'}--> <!--{elseif $operation=='import'}-->
<div class="main-content" style="border:1px solid #FFF"> <div class="main-content" style="border:1px solid #FFF">
<!--{if $msg}--> <!--{if $msg}-->
<div class="well"> <div class="well">
<p class="$msg_type">$msg</p> <p class="$msg_type">$msg</p>
<!--{if $redirecturl}--> <!--{if $redirecturl}-->
<p class="text-info"> <p class="text-info">
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a> <a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
</p> </p>
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script> <script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
<!--{/if}--> <!--{/if}-->
</div> </div>
<!--{else}--> <!--{else}-->
<ul class="help-block"> <ul class="help-block">
<h5>{lang board_message}</h5> {lang db_import_tips} <h5>{lang board_message}</h5> {lang db_import_tips}
</ul> </ul>
$do_import_option $do_import_option
<form id="cpform" action="{MOD_URL}&op=database&operation=import" class="form-horizontal form-horizontal-left " method="post" name="cpform"> <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="{FORMHASH}" name="formhash">
<input type="hidden" value="true" name="deletesubmit"> <input type="hidden" value="true" name="deletesubmit">
<table class="table table-hover" style="border-top:1px solid #DDD"> <table class="table table-hover" style="border-top:1px solid #DDD">
<thead> <thead>
<th></th> <th></th>
<th>{lang filename}</th> <th>{lang filename}</th>
<th>{lang version}</th> <th>{lang version}</th>
<th>{lang time}</th> <th>{lang time}</th>
<th>{lang type}</th> <th>{lang type}</th>
<th>{lang big_small}</th> <th>{lang big_small}</th>
<th>{lang db_method}</th> <th>{lang db_method}</th>
<th>{lang db_volume}</th> <th>{lang db_volume}</th>
<th></th> <th></th>
</thead> </thead>
<!--{loop $list $key $val}--> <!--{loop $list $key $val}-->
<tr> <tr>
<td><input type="checkbox" name="delete[]" value="$key"></td> <td><input type="checkbox" name="delete[]" value="$key"></td>
<td> <td>
<!--{if $val['list']}--> <!--{if $val['list']}-->
<a href="javascript:;" onclick="jQuery('#exportlog_{$key}').toggle()">$key</a> <a href="javascript:;" onclick="jQuery('#exportlog_{$key}').toggle()">$key</a>
<!--{else}--> <!--{else}-->
<a href="$val[filename]">$key</a> <a href="$val[filename]">$key</a>
<!--{/if}--> <!--{/if}-->
</td> </td>
<td>$val[version]</td> <td>$val[version]</td>
<td>$val[dateline]</td> <td>$val[dateline]</td>
<td>$val[ftype]</td> <td>$val[ftype]</td>
<td>$val[size]</td> <td>$val[size]</td>
<td>$val[method]</td> <td>$val[method]</td>
<td>$val[volume]</td> <td>$val[volume]</td>
<td> <td>
<!--{if $val['list']}--> <!--{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> <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}--> <!--{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> <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}--> <!--{/if}-->
</td> </td>
</tr> </tr>
<thead id="exportlog_{$key}" style="display:none;"> <thead id="exportlog_{$key}" style="display:none;">
<!--{loop $val[list] $key1 $val1}--> <!--{loop $val[list] $key1 $val1}-->
<tr> <tr>
<td></td> <td></td>
<td> <td>
<a href="$val1[filename]">$val1[filename]</a> <a href="$val1[filename]">$val1[filename]</a>
</td> </td>
<td>$val1[version]</td> <td>$val1[version]</td>
<td>$val1[dateline]</td> <td>$val1[dateline]</td>
<td></td> <td></td>
<td>$val1[size]</td> <td>$val1[size]</td>
<td></td> <td></td>
<td>$val1[volume]</td> <td>$val1[volume]</td>
<td></td> <td></td>
</tr> </tr>
<!--{/loop}--> <!--{/loop}-->
</thead> </thead>
<!--{/loop}--> <!--{/loop}-->
<thead> <thead>
<tr> <tr>
<td colspan="15"><input type="checkbox" name="chkall" id="chkallspKI" onclick="checkAll('prefix', this.form, 'delete')">{lang del}&nbsp;&nbsp;<button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button> <td colspan="15"><input type="checkbox" name="chkall" id="chkallspKI" onclick="checkAll('prefix', this.form, 'delete')">{lang del}&nbsp;&nbsp;<button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button>
</td> </td>
</tr> </tr>
</thead> </thead>
</table> </table>
</form> </form>
<!--{/if}--> <!--{/if}-->
</div> </div>
<!--{elseif $operation=='runquery'}--> <!--{elseif $operation=='runquery'}-->
<div class="main-content"> <div class="main-content">
<ul class="help-block"> <ul class="help-block">
<h4>{lang board_message}</h4> <h4>{lang board_message}</h4>
{lang db_runquery_tips} {lang db_runquery_tips}
</ul> </ul>
<!--{if $msg}--> <!--{if $msg}-->
<div class="well"> <div class="well">
<p class="$msg_type">$msg</p> <p class="$msg_type">$msg</p>
<!--{if $redirecturl}--> <!--{if $redirecturl}-->
<p class="text-info"> <p class="text-info">
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a> <a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
</p> </p>
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 5000);</script> <script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 5000);</script>
<!--{/if}--> <!--{/if}-->
</div> </div>
<!--{else}--> <!--{else}-->
<form id="cpform" action="{MOD_URL}&op=database&operation=runquery" method="post" name="cpform"> <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="{FORMHASH}" name="formhash">
<input type="hidden" value="true" name="sqlsubmit"> <input type="hidden" value="true" name="sqlsubmit">
<dl> <dl>
<dt>{lang db_runquery_sql}</dt> <dt>{lang db_runquery_sql}</dt>
<dd class="clearfix"><textarea cols="85" rows="10" name="queries" style="width:500px;"></textarea></dd> <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> <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>
<dl> <dl>
<dd class="clearfix"><button type="submit" class="btn btn-primary">{lang blank_submit}</button></dd> <dd class="clearfix"><button type="submit" class="btn btn-primary">{lang blank_submit}</button></dd>
</dl> </dl>
</form> </form>
<!--{/if}--> <!--{/if}-->
</div> </div>
<!--{/if}--> <!--{/if}-->
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
jQuery('.left-drager').leftDrager_layout(); jQuery('.left-drager').leftDrager_layout();
</script> </script>
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script> <script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
<!--{template common/footer_simple}--> <!--{template common/footer_simple}-->

View File

@@ -1,12 +1,12 @@
{eval $oparr=array('updatecache','database','cron','systemupgrade' );} {eval $oparr=array('updatecache','database','cron','systemupgrade' );}
{eval $leftmenu=array();} {eval $leftmenu=array();}
{eval foreach($oparr as $key => $value){} {eval foreach($oparr as $key => $value){}
{eval $leftmenu[$value]=array('title'=>lang($value),'active'=>'');} {eval $leftmenu[$value]=array('title'=>lang($value),'active'=>'');}
{eval if($value==$op) $leftmenu[$value]['active']='class="active"';} {eval if($value==$op) $leftmenu[$value]['active']='class="active"';}
{eval }} {eval }}
<ul class="nav-stacked"> <ul class="nav-stacked">
<!--{loop $leftmenu $key $value}--> <!--{loop $leftmenu $key $value}-->
<li $value[active]><a hidefocus="true" href="{MOD_URL}&op=$key">$value[title]</a></li> <li $value[active]><a hidefocus="true" href="{MOD_URL}&op=$key">$value[title]</a></li>
<!--{/loop}--> <!--{/loop}-->
</ul> </ul>

View File

@@ -1,73 +1,73 @@
<!--{template common/header_simple_start}--> <!--{template common/header_simple_start}-->
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all"> <link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script> <script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
<!--{template common/header_simple_end}--> <!--{template common/header_simple_end}-->
<!--{template common/commer_header}--> <!--{template common/commer_header}-->
<div class="bs-container clearfix"> <div class="bs-container clearfix">
<div class="bs-left-container clearfix"> <div class="bs-left-container clearfix">
<!--{template left}--> <!--{template left}-->
</div> </div>
<div class="left-drager"> <div class="left-drager">
</div> </div>
<div class="bs-main-container clearfix"> <div class="bs-main-container clearfix">
<div class="main-header"> <div class="main-header">
<div class="clearfix" style="line-height:40px;padding:0 10px"> <div class="clearfix" style="line-height:40px;padding:0 10px">
<!-- <strong style="font-size:14px;">{lang updatecache}</strong>--> <!-- <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="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="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> <span class="text-muted" id="step3" <!--{if $step==3}-->style="color:green"<!--{/if}-->>3.{lang nav_updatecache_completed}</span>
</div> </div>
</div> </div>
<div class="main-content" style="padding:20px;border-top:1px solid #FFF"> <div class="main-content" style="padding:20px;border-top:1px solid #FFF">
<div class="well well-sm"> <div class="well well-sm">
<!--{if $step==1}--> <!--{if $step==1}-->
<form method="post" class="form-horizontal form-horizontal-left" action="{MOD_URL}&op=updatecache&step=2"> <form method="post" class="form-horizontal form-horizontal-left" action="{MOD_URL}&op=updatecache&step=2">
<input name="formhash" value="{VERHASH}" type="hidden"> <input name="formhash" value="{VERHASH}" type="hidden">
<p class="clearfix ml20"> <p class="clearfix ml20">
<label class="checkbox-inline"> <label class="checkbox-inline">
<input name="type[]" value="data" checked="" type="checkbox"> <input name="type[]" value="data" checked="" type="checkbox">
{lang tools_updatecache_data} {lang tools_updatecache_data}
</label> </label>
<label class="checkbox-inline"> <label class="checkbox-inline">
<input name="type[]" value="tpl" id="tplcache" checked="" type="checkbox"> <input name="type[]" value="tpl" id="tplcache" checked="" type="checkbox">
{lang tools_updatecache_tpl} {lang tools_updatecache_tpl}
</label> </label>
<label class="checkbox-inline"> <label class="checkbox-inline">
<input name="type[]" value="memory" id="momerycache" type="checkbox"> <input name="type[]" value="memory" id="momerycache" type="checkbox">
{lang tools_updatecache_memory} {lang tools_updatecache_memory}
</label> </label>
</p> </p>
<p class="clearfix ml20"> <p class="clearfix ml20">
<input class="btn btn-primary" name="confirmed" value="{lang confirms}" type="submit"> &nbsp; <input class="btn btn-primary" name="confirmed" value="{lang confirms}" type="submit"> &nbsp;
<script type="text/javascript"> <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);">'); if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<input type="button" class="btn btn-default" value="{lang cancel}" onClick="history.go(-1);">');
</script> </script>
</p> </p>
</form> </form>
<!--{elseif $step==2}--> <!--{elseif $step==2}-->
<p class="ml20">{lang tools_updatecache_waiting}</p> <p class="ml20">{lang tools_updatecache_waiting}</p>
<p class="text-success ml20"> <p class="text-success ml20">
<a href="{MOD_URL}&op=updatecache&step=3&type=$type" class="lightlink">{lang message_redirect}</a> <a href="{MOD_URL}&op=updatecache&step=3&type=$type" class="lightlink">{lang message_redirect}</a>
</p> </p>
<script type="text/JavaScript">setTimeout(function(){location.href='{MOD_URL}&op=updatecache&step=3&type=$type';}, 2000);</script> <script type="text/JavaScript">setTimeout(function(){location.href='{MOD_URL}&op=updatecache&step=3&type=$type';}, 2000);</script>
<!--{elseif $step==3}--> <!--{elseif $step==3}-->
<p class="text-success ml20" style="margin:10px;">{lang update_cache_succeed}</p> <p class="text-success ml20" style="margin:10px;">{lang update_cache_succeed}</p>
<script type="text/javascript"> <script type="text/javascript">
window.setTimeout(function() { location.href = '{MOD_URL}&op=updatecache'; }, 5000); window.setTimeout(function() { location.href = '{MOD_URL}&op=updatecache'; }, 5000);
</script> </script>
<!--{/if}--> <!--{/if}-->
</div> </div>
<ul class="help-block"> <ul class="help-block">
<h5>{lang board_message}</h5> {lang tools_updatecache_tips} <h5>{lang board_message}</h5> {lang tools_updatecache_tips}
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
jQuery('.left-drager').leftDrager_layout(); jQuery('.left-drager').leftDrager_layout();
</script> </script>
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script> <script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
<!--{template common/footer_simple}--> <!--{template common/footer_simple}-->

View File

@@ -1,246 +1,246 @@
<!--{template common/header_simple_start}--> <!--{template common/header_simple_start}-->
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all"> <link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script> <script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
<script src="admin/scripts/admin.js?{VERHASH}"></script> <script src="admin/scripts/admin.js?{VERHASH}"></script>
<style> <style>
.progress.active .progress-bar { .progress.active .progress-bar {
-webkit-animation: none; -webkit-animation: none;
animation: none; animation: none;
transition: none; transition: none;
-webkit-box-shadow: none; -webkit-box-shadow: none;
box-shadow: none; box-shadow: none;
} }
</style> </style>
<!--{template common/header_simple_end}--> <!--{template common/header_simple_end}-->
<!--{template common/commer_header}--> <!--{template common/commer_header}-->
<div class="bs-container clearfix"> <div class="bs-container clearfix">
<div class="bs-left-container clearfix"> <div class="bs-left-container clearfix">
<!--{template left}--> <!--{template left}-->
</div> </div>
<div class="left-drager"> <div class="left-drager">
</div> </div>
<div class="bs-main-container clearfix"> <div class="bs-main-container clearfix">
<!--{if $operation == 'patch' || $operation == 'cross'}--> <!--{if $operation == 'patch' || $operation == 'cross'}-->
<div class="main-header"> <div class="main-header">
<div class="clearfix" style="line-height:40px;padding:0 10px;font-size:12px;"> <div class="clearfix" style="line-height:40px;padding:0 10px;font-size:12px;">
<strong style="font-size:14px;">{lang upgrade}</strong> <strong style="font-size:14px;">{lang upgrade}</strong>
<!--{loop $steplang $key $value}--> <!--{loop $steplang $key $value}-->
<!--{if $key>0 && $key<=5}--> <!--{if $key>0 && $key<=5}-->
<span class="text-muted" <!--{if $key==$step}-->style="color:green"<!--{/if}-->>{$key}.{$value}</span> <span class="text-muted" <!--{if $key==$step}-->style="color:green"<!--{/if}-->>{$key}.{$value}</span>
<!--{/if}--> <!--{/if}-->
<!--{/loop}--> <!--{/loop}-->
</div> </div>
</div> </div>
<!--{/if}--> <!--{/if}-->
<!--{if $operation=='check'}--> <!--{if $operation=='check'}-->
<div class="main-content" style="border-top:1px solid #FFF"> <div class="main-content" style="border-top:1px solid #FFF">
<!--{if $msg}--> <!--{if $msg}-->
<div id="step4" style="padding:20px;height:450px"> <div id="step4" style="padding:20px;height:450px">
<div class="alert alert-warning text-center"> <div class="alert alert-warning text-center">
$msg $msg
</div> </div>
</div> </div>
<!--{else}--> <!--{else}-->
<div style="padding:20px;"> <div style="padding:20px;">
<div class="text-center" style="width:300px;margin:0 auto"> <div class="text-center" style="width:300px;margin:0 auto">
<p style="margin:20px 0;">{lang upgrade_checking}</p> <p style="margin:20px 0;">{lang upgrade_checking}</p>
<div class="progress progress-striped active" style="border:1px solid #5bc0de"> <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 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>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
jQuery('.progress-bar').animate({ width: '100%' }, 3000, function() { jQuery('.progress-bar').animate({ width: '100%' }, 3000, function() {
window.location.href = '{MOD_URL}&op=systemupgrade&operation=check&checking=1'; window.location.href = '{MOD_URL}&op=systemupgrade&operation=check&checking=1';
}); });
</script> </script>
</div> </div>
<!--{/if}--> <!--{/if}-->
</div> </div>
<!--{elseif $operation=='showupgrade'}--> <!--{elseif $operation=='showupgrade'}-->
<div class="main-content" style="border-top:1px solid #FFF"> <div class="main-content" style="border-top:1px solid #FFF">
<!--{if $msg}--> <!--{if $msg}-->
<div id="step4" style="padding:20px;height:450px"> <div id="step4" style="padding:20px;height:450px">
<div class="alert alert-warning"> <div class="alert alert-warning">
$msg $msg
</div> </div>
</div> </div>
<!--{else}--> <!--{else}-->
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<th colspan="5">{lang founder_upgrade_select_version}</th> <th colspan="5">{lang founder_upgrade_select_version}</th>
</thead> </thead>
<!--{loop $list $value}--> <!--{loop $list $value}-->
<tr> <tr>
<td>$value[title]</td> <td>$value[title]</td>
<td>$value[btn1]</td> <td>$value[btn1]</td>
</tr> </tr>
<!--{/loop}--> <!--{/loop}-->
</table> </table>
<!--{/if}--> <!--{/if}-->
</div> </div>
<!--{elseif $operation=='patch' || $operation=='cross' }--> <!--{elseif $operation=='patch' || $operation=='cross' }-->
<div class="main-content" style="border-top:1px solid #FFF;"> <div class="main-content" style="border-top:1px solid #FFF;">
<!--{if !$_G['setting']['bbclosed']}--> <!--{if !$_G['setting']['bbclosed']}-->
<div style="padding:20px;height:450px"> <div style="padding:20px;height:450px">
<div class="alert alert-warning text-center"> <div class="alert alert-warning text-center">
$msg $msg
</div> </div>
</div> </div>
<!--{elseif $step==1}--> <!--{elseif $step==1}-->
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<th colspan="5">{lang founder_upgrade_preupdatelist}</th> <th colspan="5">{lang founder_upgrade_preupdatelist}</th>
</thead> </thead>
<!--{loop $updatefilelist $value}--> <!--{loop $updatefilelist $value}-->
<tr> <tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;<i class="glyphicon glyphicon-file"></i> $value</td> <td>&nbsp;&nbsp;&nbsp;&nbsp;<i class="glyphicon glyphicon-file"></i> $value</td>
</tr> </tr>
<!--{/loop}--> <!--{/loop}-->
<thead> <thead>
<th colspan="5">&nbsp;{lang founder_upgrade_store_directory} ./data/update/oaooa$version</th> <th colspan="5">&nbsp;{lang founder_upgrade_store_directory} ./data/update/oaooa$version</th>
</thead> </thead>
<thead> <thead>
<th colspan="5">&nbsp;<input type="button" class="btn btn-primary" onclick="window.location.href='$linkurl'" value="{lang founder_upgrade_download}">{eval echo upgradeinformation(0)}</th> <th colspan="5">&nbsp;<input type="button" class="btn btn-primary" onclick="window.location.href='$linkurl'" value="{lang founder_upgrade_download}">{eval echo upgradeinformation(0)}</th>
</thead> </thead>
</table> </table>
<!--{elseif $step==2}--> <!--{elseif $step==2}-->
<div style="padding:20px;">$msg</div> <div style="padding:20px;">$msg</div>
<!--{elseif $step==3}--> <!--{elseif $step==3}-->
<!--{if $msg}--> <!--{if $msg}-->
<div id="step4" style="padding:20px;"> <div id="step4" style="padding:20px;">
<div class="alert alert-warning text-center"> <div class="alert alert-warning text-center">
$msg $msg
</div> </div>
</div> </div>
<!--{else}--> <!--{else}-->
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<th colspan="5">{lang founder_upgrade_diff_show}</th> <th colspan="5">{lang founder_upgrade_diff_show}</th>
</thead> </thead>
<!--{loop $updatefilelist $v}--> <!--{loop $updatefilelist $v}-->
<!--{if isset($ignorelist[$v])}--> <!--{if isset($ignorelist[$v])}-->
<!--{elseif isset($modifylist[$v])}--> <!--{elseif isset($modifylist[$v])}-->
<tr> <tr>
<td class="text-danger">&nbsp;&nbsp;&nbsp;&nbsp;{lang founder_upgrade_diff} &nbsp;<i class="glyphicon glyphicon-exclamation-sign"></i> $v</td> <td class="text-danger">&nbsp;&nbsp;&nbsp;&nbsp;{lang founder_upgrade_diff} &nbsp;<i class="glyphicon glyphicon-exclamation-sign"></i> $v</td>
</tr> </tr>
<!--{elseif isset($showlist[$v])}--> <!--{elseif isset($showlist[$v])}-->
<tr> <tr>
<td class="text-success">&nbsp;&nbsp;&nbsp;&nbsp;{lang founder_upgrade_normal} &nbsp;<i class="glyphicon glyphicon-ok"></i> $v</td> <td class="text-success">&nbsp;&nbsp;&nbsp;&nbsp;{lang founder_upgrade_normal} &nbsp;<i class="glyphicon glyphicon-ok"></i> $v</td>
</tr> </tr>
<!--{elseif isset($newlist[$v])}--> <!--{elseif isset($newlist[$v])}-->
<tr> <tr>
<td class="text-info">&nbsp;&nbsp;&nbsp;&nbsp;{lang founder_upgrade_new} &nbsp;<i class="glyphicon glyphicon-plus"></i> $v</td> <td class="text-info">&nbsp;&nbsp;&nbsp;&nbsp;{lang founder_upgrade_new} &nbsp;<i class="glyphicon glyphicon-plus"></i> $v</td>
</tr> </tr>
<!--{/if}--> <!--{/if}-->
<!--{/loop}--> <!--{/loop}-->
<thead> <thead>
<th colspan="5">{lang founder_upgrade_download_file} ./data/update/oaooa{$version}</th> <th colspan="5">{lang founder_upgrade_download_file} ./data/update/oaooa{$version}</th>
</thead> </thead>
<thead> <thead>
<th colspan="5">&nbsp;{lang founder_upgrade_backup_file} ./data/back/oaooa{CORE_VERSION} {lang founder_upgrade_backup_file2} </th> <th colspan="5">&nbsp;{lang founder_upgrade_backup_file} ./data/back/oaooa{CORE_VERSION} {lang founder_upgrade_backup_file2} </th>
</thead> </thead>
<thead> <thead>
<th colspan="5">&nbsp;<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> <th colspan="5">&nbsp;<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> </thead>
</table> </table>
<!--{/if}--> <!--{/if}-->
<!--{elseif $step==4}--> <!--{elseif $step==4}-->
<!--{if $msg}--> <!--{if $msg}-->
<div id="step4" style="padding:20px;height:450px"> <div id="step4" style="padding:20px;height:450px">
<div class="alert alert-warning text-center"> <div class="alert alert-warning text-center">
$msg $msg
</div> </div>
</div> </div>
<!--{elseif $_GET['siteftpsetting']}--> <!--{elseif $_GET['siteftpsetting']}-->
<form name="aliform" class="form-horizontal form-horizontal-left" action="$action" method="post" style="padding:20px;"> <form name="aliform" class="form-horizontal form-horizontal-left" action="$action" method="post" style="padding:20px;">
<input type="hidden" name="formhash" value="{FORMHASH}"> <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> <p style="padding-left:20px;font-weight:bold;font-size:16px;padding-bottom:20px;">{lang upgrade_website_FTP_set}</p>
<div class="form-group"> <div class="form-group">
<label class="control-label">FTP {lang server_address}</label> <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}"> <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> <span class="help-inline">{lang FTP_server_IP_site_domain}</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label">FTP {lang server_port}</label> <label class="control-label">FTP {lang server_port}</label>
<input type="text" class="form-control required" name="siteftp[port]" value="21" placeholder="{lang port}"> <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> <span class="help-inline">{lang default_for_the_21st}</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label">FTP {lang account}</label> <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}"> <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> <span class="help-inline">{lang accounts_supreme_authority}</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label">FTP {lang password}</label> <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}"> <input type="password" class="form-control required" name="siteftp[password]" value="" placeholder="{lang FTP_account_user_password}">
</div> </div>
<!--<div class="form-group"> <!--<div class="form-group">
<label class="control-label">编码</label> <label class="control-label">编码</label>
<select class="form-control" name="siteftp[charset]"> <select class="form-control" name="siteftp[charset]">
<option value="GBK" selected="selected">GBK</option> <option value="GBK" selected="selected">GBK</option>
<option value="UTF-8">UTF-8</option> <option value="UTF-8">UTF-8</option>
<option value="BIG5">BIG5</option> <option value="BIG5">BIG5</option>
</select> </select>
<span class="help-inline">根据FTP服务器的编码设置不一致会导致乱码</span> <span class="help-inline">根据FTP服务器的编码设置不一致会导致乱码</span>
</div>--> </div>-->
<div class="form-group"> <div class="form-group">
<label class="control-label">{lang sitepath}</label> <label class="control-label">{lang sitepath}</label>
<input type="text" class="form-control required" name="siteftp[attachdir]" value=""> <input type="text" class="form-control required" name="siteftp[attachdir]" value="">
<span class="help-inline">{lang site_absolute_path_root_directory}</span> <span class="help-inline">{lang site_absolute_path_root_directory}</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label"></label> <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> <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> <span class="help-inline">{lang general_condition_passive_mode}</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label"></label> <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> <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> <span class="help-inline">{lang notice_FTP_open_SSL}</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label"></label> <label class="control-label"></label>
<input type="submit" class="btn btn-primary" style="padding:6px 25px" value="{lang confirms}"> <input type="submit" class="btn btn-primary" style="padding:6px 25px" value="{lang confirms}">
</div> </div>
</form> </form>
<!--{/if}--> <!--{/if}-->
<!--{elseif $step==5}--> <!--{elseif $step==5}-->
<div style="padding:20px;"> <div style="padding:20px;">
<div class="alert alert-success text-center"> <div class="alert alert-success text-center">
$msg $msg
</div> </div>
</div> </div>
<!--{/if}--> <!--{/if}-->
</div> </div>
<!--{/if}--> <!--{/if}-->
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
jQuery('.left-drager').leftDrager_layout(); jQuery('.left-drager').leftDrager_layout();
function createIframe(src) { function createIframe(src) {
document.getElementById('step4').innerHTML = '<iframe marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' + src + '" style="width:100%;height:100%;"></iframe>'; document.getElementById('step4').innerHTML = '<iframe marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' + src + '" style="width:100%;height:100%;"></iframe>';
} }
</script> </script>
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script> <script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
<!--{template common/footer_simple}--> <!--{template common/footer_simple}-->

View File

@@ -1,21 +1,21 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <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 rel="stylesheet" type="text/css" href="static/bootstrap/css/bootstrap.min.css">
<link href="static/css/common.css" rel="stylesheet" media="all"> <link href="static/css/common.css" rel="stylesheet" media="all">
<style> <style>
body { body {
overflow: hidden; overflow: hidden;
} }
</style> </style>
</head> </head>
<body> <body>
<div class="alert alert-warning"> <div class="alert alert-warning">
$msg $msg
</div> </div>
</body> </body>
</html> </html>

View File

@@ -1,46 +1,46 @@
<?php <?php
/* /*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd * @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/ * @license https://www.oaooa.com/licenses/
* *
* @link https://www.oaooa.com * @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com) * @author zyx(zyx@oaooa.com)
*/ */
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) { if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
exit('Access Denied'); exit('Access Denied');
} }
$oparr = array('updatecache', 'database', /*'security','patch','update',*/ $oparr = array('updatecache', 'database', /*'security','patch','update',*/
'cron', 'log'); 'cron', 'log');
$leftmenu = array(); $leftmenu = array();
$op = $_GET['op']; $op = $_GET['op'];
foreach ($oparr as $key => $value) { foreach ($oparr as $key => $value) {
$leftmenu[$value] = array('title' => lang($value), 'active' => ''); $leftmenu[$value] = array('title' => lang($value), 'active' => '');
if ($value == $op) if ($value == $op)
$leftmenu[$value]['active'] = 'class="active"'; $leftmenu[$value]['active'] = 'class="active"';
} }
include libfile('function/cache'); include libfile('function/cache');
$navtitle = lang('updatecache') . ' - ' . lang('admin_navtitle'); $navtitle = lang('updatecache') . ' - ' . lang('admin_navtitle');
$step = max(1, intval($_GET['step'])); $step = max(1, intval($_GET['step']));
if ($step == 1) { if ($step == 1) {
} elseif ($step == 2) { } elseif ($step == 2) {
$type = implode('_', (array)$_GET['type']); $type = implode('_', (array)$_GET['type']);
} elseif ($step == 3) { } elseif ($step == 3) {
$type = explode('_', $_GET['type']); $type = explode('_', $_GET['type']);
if (in_array('data', $type)) { if (in_array('data', $type)) {
updatecache(); updatecache();
} }
if (in_array('tpl', $type) && $_G['config']['output']['tplrefresh']) { if (in_array('tpl', $type) && $_G['config']['output']['tplrefresh']) {
cleartemplatecache(); cleartemplatecache();
} }
if (in_array('memory', $type)) { if (in_array('memory', $type)) {
//清空内存缓存 //清空内存缓存
C::memory()->clear(); C::memory()->clear();
} }
} }
include template('updatecache'); include template('updatecache');
?> ?>

View File

@@ -1,414 +1,416 @@
<?php <?php
/* /*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd * @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/ * @license https://www.oaooa.com/licenses/
* *
* @link https://www.oaooa.com * @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com) * @author zyx(zyx@oaooa.com)
*/ */
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) { if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
exit('Access Denied'); exit('Access Denied');
} }
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle'); $navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
@set_time_limit(0); @set_time_limit(0);
include_once DZZ_ROOT . './core/core_version.php'; include_once DZZ_ROOT . './core/core_version.php';
include_once libfile('function/admin'); include_once libfile('function/admin');
include_once libfile('function/cache'); include_once libfile('function/cache');
$dzz_upgrade = new dzz_upgrade(); $dzz_upgrade = new dzz_upgrade();
$step = intval($_GET['step']); $step = intval($_GET['step']);
$op = $_GET['op']; $op = $_GET['op'];
$step = $step ? $step : 1; $step = $step ? $step : 1;
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check'; $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')); $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 ($operation == 'patch' || $operation == 'cross') {
if (!$_G['setting']['bbclosed']) { if (!$_G['setting']['bbclosed']) {
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_close_site') . '</p>'; $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"><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 .= "<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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
$msg .= "</script></p>"; $msg .= "</script></p>";
if (!$_GET['iframe']) { if (!$_GET['iframe']) {
include template('upgrade'); include template('upgrade');
exit(); exit();
} else { } else {
include template('upgrade_iframe'); include template('upgrade_iframe');
exit(); exit();
} }
} }
$msg = ''; $msg = '';
$version = trim($_GET['version']); $version = trim($_GET['version']);
//$release = trim($_GET['release']); //$release = trim($_GET['release']);
$locale = trim($_GET['locale']); $locale = trim($_GET['locale']);
$charset = trim($_GET['charset']); $charset = trim($_GET['charset']);
$upgradeinfo = $upgrade_step = array(); $upgradeinfo = $upgrade_step = array();
if ($_GET['ungetfrom']) { if ($_GET['ungetfrom']) {
if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) { if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5'; $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'])) ); $url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
dheader('Location: ' . $url); dheader('Location: ' . $url);
} else { } else {
showmessage('upgrade_param_error'); showmessage('upgrade_param_error');
} }
} }
$upgrade_step = C::t('cache') -> fetch('upgrade_step'); $upgrade_step = C::t('cache') -> fetch('upgrade_step');
$upgrade_step = dunserialize($upgrade_step['cachevalue']); $upgrade_step = dunserialize($upgrade_step['cachevalue']);
$upgrade_step['step'] = $step; $upgrade_step['step'] = $step;
$upgrade_step['operation'] = $operation; $upgrade_step['operation'] = $operation;
$upgrade_step['version'] = $version; $upgrade_step['version'] = $version;
//$upgrade_step['release'] = $release; //$upgrade_step['release'] = $release;
$upgrade_step['charset'] = $charset; $upgrade_step['charset'] = $charset;
$upgrade_step['locale'] = $locale; $upgrade_step['locale'] = $locale;
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true); 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'); $upgrade_run = C::t('cache') -> fetch('upgrade_run');
if (!$upgrade_run) { if (!$upgrade_run) {
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true); C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
$upgrade_run = $_G['setting']['upgrade']; $upgrade_run = $_G['setting']['upgrade'];
} else { } else {
$upgrade_run = dunserialize($upgrade_run['cachevalue']); $upgrade_run = dunserialize($upgrade_run['cachevalue']);
} }
if ($step != 5) { if ($step != 5) {
foreach ($upgrade_run as $type => $list) { foreach ($upgrade_run as $type => $list) {
if ($type == $operation && $version == $list['latestversion']) { if ($type == $operation && $version == $list['latestversion']) {
$dzz_upgrade -> locale = $locale; $dzz_upgrade -> locale = $locale;
$dzz_upgrade -> charset = $charset; $dzz_upgrade -> charset = $charset;
$upgradeinfo = $list; $upgradeinfo = $list;
break; break;
} }
} }
if (!$upgradeinfo) { if (!$upgradeinfo) {
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_none', array('upgradeurl' => upgradeinformation(-1))) . '</p>'; $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 .= "<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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
$msg .= "</script></p>"; $msg .= "</script></p>";
if (!$_GET['iframe']) { if (!$_GET['iframe']) {
include template('upgrade'); include template('upgrade');
exit(); exit();
} else { } else {
include template('upgrade_iframe'); include template('upgrade_iframe');
exit(); exit();
} }
} }
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo); $updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
$updatemd5filelist = $updatefilelist['md5']; $updatemd5filelist = $updatefilelist['md5'];
$updatefilelist = $updatefilelist['file']; $updatefilelist = $updatefilelist['file'];
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset; $theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
if (empty($updatefilelist)) { if (empty($updatefilelist)) {
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_download_upgradelist_error', array('upgradeurl' => upgradeinformation(-2))) . '</p>'; $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 .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($thurl) . '\';", 1000);</script>';
$msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>'; $msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>';
if (!$_GET['iframe']) { if (!$_GET['iframe']) {
include template('upgrade'); include template('upgrade');
exit(); exit();
} else { } else {
include template('upgrade_iframe'); include template('upgrade_iframe');
exit(); exit();
} }
} }
} }
if ($step == 1) { if ($step == 1) {
$linkurl = $theurl . '&step=2'; $linkurl = $theurl . '&step=2';
include template('upgrade'); include template('upgrade');
exit(); exit();
} elseif ($step == 2) { } elseif ($step == 2) {
$fileseq = intval($_GET['fileseq']); $fileseq = intval($_GET['fileseq']);
$fileseq = $fileseq ? $fileseq : 1; $fileseq = $fileseq ? $fileseq : 1;
if ($fileseq > count($updatefilelist)) { if ($fileseq > count($updatefilelist)) {
$linkurl = $theurl . '&step=3'; $linkurl = $theurl . '&step=3';
$downloadstatus = 3; $downloadstatus = 3;
$msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0))); $msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0)));
if (!$_GET['iframe']) { if (!$_GET['iframe']) {
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>'; $msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>';
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>'; $msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
} else { } else {
$msg .= '<script type="text/JavaScript">setTimeout("parent.location.href=\'' . $linkurl . '\';", 1000);</script>'; $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>'; $msg .= ' <p><a href="javascript:;" onclick="parent.location.href=\'' . $linkurl . '\';return false;">' . lang('message_redirect') . '</a></p>';
include template('upgrade_iframe'); include template('upgrade_iframe');
exit(); exit();
} }
} else { } else {
if (!$_GET['iframe']) { if (!$_GET['iframe']) {
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1'; $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>'; $msg = '<iframe id="downiframe" marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' . $linkurl . '" style="width:100%;height:100%;"></iframe>';
} else { } else {
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]); $downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
if ($downloadstatus == 1) { if ($downloadstatus == 1) {
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=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 = 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>'; $msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
} elseif ($downloadstatus == 2) { } elseif ($downloadstatus == 2) {
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq + 1) . '&iframe=1'; $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 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>'; $msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
} else { } else {
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq) . '&iframe=1'; $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">' . 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 . '\'" />'; $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'); include template('upgrade_iframe');
exit(); exit();
} }
} }
} elseif ($step == 3) { } elseif ($step == 3) {
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist); list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) { if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
$msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4))); $msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4)));
} }
$linkurl = $theurl . '&step=4'; $linkurl = $theurl . '&step=4';
} elseif ($step == 4) { } elseif ($step == 4) {
$confirm = $_GET['confirm']; $confirm = $_GET['confirm'];
if (!$confirm) { if (!$confirm) {
if ($_GET['siteftpsetting']) { if ($_GET['siteftpsetting']) {
$action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : ''); $action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
if ($upgradeinfo['isupdatedb']) { if ($upgradeinfo['isupdatedb']) {
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql'); $checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist); $checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
} else { } else {
$checkupdatefilelist = $updatefilelist; $checkupdatefilelist = $updatefilelist;
} }
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) { if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
$confirm = 'file'; $confirm = 'file';
} else { } else {
$linkurl = $theurl . '&step=4'; $linkurl = $theurl . '&step=4';
$ftplinkurl = $linkurl . '&siteftpsetting=1'; $ftplinkurl = $linkurl . '&siteftpsetting=1';
$msg = '<p style="margin:10px 0">' . lang('upgrade_cannot_access_file') . '</p>'; $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 .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" />';
$msg .= ' &nbsp; <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>'; $msg .= ' &nbsp; <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>';
$msg .= "<script type=\"text/javascript\">"; $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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
$msg .= "</script>"; $msg .= "</script>";
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
} }
$paraftp = ''; $paraftp = '';
if ($_GET['siteftp']) { if ($_GET['siteftp']) {
foreach ($_GET['siteftp'] as $k => $v) { foreach ($_GET['siteftp'] as $k => $v) {
$paraftp .= '&siteftp[' . $k . ']=' . $v; $paraftp .= '&siteftp[' . $k . ']=' . $v;
} }
} }
if (!$_GET['startupgrade']) { if (!$_GET['startupgrade']) {
if (!$_GET['backfile']) { if (!$_GET['backfile']) {
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp; $linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
$msg = '<p style="margin:10px 0">' . lang('upgrade_backuping', array('upgradeurl' => upgradeinformation(2))) . '</p>'; $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 .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($linkurl) . '\';", 1000);</script>';
$msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>'; $msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>';
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
foreach ($updatefilelist as $updatefile) { foreach ($updatefilelist as $updatefile) {
$destfile = DZZ_ROOT . $updatefile; $destfile = DZZ_ROOT . $updatefile;
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile; $backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
if (is_file($destfile)) { if (is_file($destfile)) {
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) { 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">' . lang('upgrade_backup_error', array('upgradeurl' => upgradeinformation(-5))) . '</p>';
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">"; $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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
$msg .= "</script></p>"; $msg .= "</script></p>";
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
} }
} }
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_complete', array('upgradeurl' => upgradeinformation(3))) . '</p>'; $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 .= '<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>'; $msg .= ' <p><a href="' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '">' . lang('message_redirect') . '</p>';
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
$linkurl = $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'; $ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
foreach ($updatefilelist as $updatefile) { foreach ($updatefilelist as $updatefile) {
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile; $srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
if ($confirm == 'ftp') { if ($confirm == 'ftp') {
$destfile = $updatefile; $destfile = $updatefile;
} else { } else {
$destfile = DZZ_ROOT . $updatefile; $destfile = DZZ_ROOT . $updatefile;
} }
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) { if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
if ($confirm == 'ftp') { 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">' . 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 .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reupload') . '" />';
$msg .= '&nbsp;<input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_reset_ftp') . '" /></p>'; $msg .= '&nbsp;<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 .= "<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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
$msg .= "</script></p>"; $msg .= "</script></p>";
include template('upgrade'); include template('upgrade');
exit(); exit();
} else { } else {
$msg = '<p style="margin:10px 0">' . lang('upgrade_copy_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7))) . '</p>'; $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 .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_recopy') . '" />';
$msg .= '&nbsp;<input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" /></p>'; $msg .= '&nbsp;<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 .= "<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 .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
$msg .= "</script></p>"; $msg .= "</script></p>";
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
} }
} }
if ($upgradeinfo['isupdatedb']) { if ($upgradeinfo['isupdatedb']) {
$upgrade_step['step'] = 'dbupdate'; $upgrade_step['step'] = 'dbupdate';
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true); 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&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'])); $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 = '<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 .= '<script type="text/JavaScript">setTimeout(function(){createIframe(\'' . $linkurl . '\');}, 1000);</script>';
$msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>'; $msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>';
include template('upgrade'); include template('upgrade');
exit(); exit();
} }
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' ); $url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' );
dheader('Location: ' . $url); dheader('Location: ' . $url);
} elseif ($step == 5) { } elseif ($step == 5) {
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp'; print_r(1111);
@unlink($file); die;
@unlink(DZZ_ROOT . './install/update.php'); $file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
C::t('cache') -> delete('upgrade_step'); @unlink($file);
C::t('cache') -> delete('upgrade_run'); @unlink(DZZ_ROOT . './install/update.php');
C::t('setting') -> update('upgrade', ''); C::t('cache') -> delete('upgrade_step');
updatecache('setting'); C::t('cache') -> delete('upgrade_run');
$old_update_dir = './data/update/'; C::t('setting') -> update('upgrade', '');
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/'; updatecache('setting');
$old_back_dir = './data/back/'; $old_update_dir = './data/update/';
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/'; $new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir); $old_back_dir = './data/back/';
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir); $new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir); $dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir); $dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
$msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0))); $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'])) { }elseif ($operation == 'check') {
$upgrade_step = C::t('cache') -> fetch('upgrade_step'); $msg = '';
if (!empty($upgrade_step['cachevalue'])) { if (!intval($_GET['rechecking'])) {
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']); $upgrade_step = C::t('cache') -> fetch('upgrade_step');
if (!empty($upgrade_step['cachevalue']['step'])) { if (!empty($upgrade_step['cachevalue'])) {
$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']; $upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
if (!empty($upgrade_step['cachevalue']['step'])) {
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck'; $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'];
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
$dbreturnurl = $_G['siteurl'] . $theurl . '&step=5'; $recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])); if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue_db', array('steplang' => $steplang['dbupdate'], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>'; $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']));
} else { $msg = '<p style="margin:10px 0;">' . lang('upgrade_continue_db', array('steplang' => $steplang['dbupdate'], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
$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 {
$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'); }
} } else {
C::t('cache') -> delete('upgrade_step');
if (!intval($_GET['checking']) || $msg) { }
if (!intval($_GET['checking']) || $msg) {
} else {
$dzz_upgrade -> check_upgrade();
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' ); } else {
dheader('Location: ' . $url); $dzz_upgrade -> check_upgrade();
} $url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' );
dheader('Location: ' . $url);
}elseif ($operation == 'showupgrade') { }
if ($_G['setting']['upgrade']) { }elseif ($operation == 'showupgrade') {
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true); if ($_G['setting']['upgrade']) {
$upgraderow = $patchrow = array(); C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
$dbversion = helper_dbtool::dbversion(); $upgraderow = $patchrow = array();
$locale = ''; $charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
$dbversion = helper_dbtool::dbversion();
if ($charset == 'BIG5') { $locale = '';
$locale = 'TC';
} elseif ($charset == 'GBK') { if ($charset == 'BIG5') {
$locale = 'SC'; $locale = 'TC';
} elseif ($charset == 'UTF8') { } elseif ($charset == 'GBK') {
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') { $locale = 'SC';
$locale = 'SC'; } elseif ($charset == 'UTF8') {
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') { if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
$locale = 'TC'; $locale = 'SC';
}else{ } elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
$locale = 'SC'; $locale = 'TC';
} }else{
} $locale = 'SC';
}
if (!is_array($_G['setting']['upgrade'])) }
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
$list = array(); if (!is_array($_G['setting']['upgrade']))
foreach ($_G['setting']['upgrade'] as $type => $upgrade) { $_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
$unupgrade = 0; $list = array();
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) { foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
$unupgrade = 1; $unupgrade = 0;
} if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
$list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset; $unupgrade = 1;
if ($unupgrade) { }
$list[$type]['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset; $list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset;
$list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion; if ($unupgrade) {
} else { $list[$type]['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
$list[$type]['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset; $list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
$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') . '">'; } else {
$list[$type]['official'] = '<a class="btn btn-link" href="' . $upgrade['official'] . '" target="_blank">' . lang('founder_upgrade_manually') . '</a>'; $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'); } else {
}
$msg = lang('upgrade_latest_version');
}elseif ($operation == 'recheck') { }
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
$upgrade_step = dunserialize($upgrade_step['cachevalue']); }elseif ($operation == 'recheck') {
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp'; $upgrade_step = C::t('cache') -> fetch('upgrade_step');
@unlink($file); $upgrade_step = dunserialize($upgrade_step['cachevalue']);
@unlink(DZZ_ROOT . './install/update.php'); $file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
C::t('cache') -> delete('upgrade_step'); @unlink($file);
C::t('cache') -> delete('upgrade_run'); @unlink(DZZ_ROOT . './install/update.php');
C::t('setting') -> update('upgrade', ''); C::t('cache') -> delete('upgrade_step');
updatecache('setting'); C::t('cache') -> delete('upgrade_run');
$old_update_dir = './data/update/'; C::t('setting') -> update('upgrade', '');
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir); updatecache('setting');
$old_update_dir = './data/update/';
$url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' ); $dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
dheader('Location: ' . $url);
} $url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
include template('upgrade'); dheader('Location: ' . $url);
}
include template('upgrade');
?> ?>

View File

@@ -29,7 +29,7 @@ if(file_exists(dirname(__FILE__).'/'.$avatar)) {
exit; exit;
} }
$size = in_array($size, array('big', 'middle', 'small')) ? $size : 'middle'; $size = in_array($size, array('big', 'middle', 'small')) ? $size : 'middle';
$avatar_url = 'static/image/avatar/noavatar_'.$size.'.gif'; $avatar_url = 'data/avatar/noavatar_'.$size.'.gif';
} }
if(empty($random)) { if(empty($random)) {

View File

@@ -1,169 +1,186 @@
<?php <?php
$_config = array(); $_config = array();
// ---------------------------- CONFIG DB ----------------------------- // // ---------------------------- CONFIG DB ----------------------------- //
// ---------------------------- 数据库相关设置---------------------------- // // ---------------------------- 数据库相关设置---------------------------- //
/** /**
* 数据库主服务器设置, 支持多组服务器设置, 当设置多组服务器时, 则会根据分布式策略使用某个服务器 * 数据库主服务器设置, 支持多组服务器设置, 当设置多组服务器时, 则会根据分布式策略使用某个服务器
* @example * @example
* $_config['db']['1']['dbhost'] = 'localhost'; // 服务器地址 * $_config['db']['1']['dbhost'] = 'localhost'; // 服务器地址
* $_config['db']['1']['dbuser'] = 'root'; // 用户 * $_config['db']['1']['dbuser'] = 'root'; // 用户
* $_config['db']['1']['dbpw'] = '';// 密码 * $_config['db']['1']['dbpw'] = '';// 密码
* $_config['db']['1']['dbcharset'] = 'gbk';// 字符集 * $_config['db']['1']['dbcharset'] = 'gbk';// 字符集
* $_config['db']['1']['pconnect'] = '0';// 是否持续连接 * $_config['db']['1']['pconnect'] = '0';// 是否持续连接
* $_config['db']['1']['dbname'] = 'x1';// 数据库 * $_config['db']['1']['dbname'] = 'x1';// 数据库
* $_config['db']['1']['tablepre'] = 'pre_';// 表名前缀 * $_config['db']['1']['tablepre'] = 'pre_';// 表名前缀
* *
* $_config['db']['2']['dbhost'] = 'localhost'; * $_config['db']['2']['dbhost'] = 'localhost';
* ... * ...
*/ */
$_config['db'][1]['dbhost'] = 'localhost';//支持三种直接加端口如127.0.0.1:3306或使用UNix socket 如:/tmp/mysql.sock $_config['db'][1]['dbhost'] = 'localhost';//支持三种直接加端口如127.0.0.1:3306或使用UNix socket 如:/tmp/mysql.sock
$_config['db'][1]['dbuser'] = 'root'; $_config['db'][1]['dbuser'] = 'root';
$_config['db'][1]['dbpw'] = 'root'; $_config['db'][1]['dbpw'] = 'root';
$_config['db'][1]['dbcharset'] = 'utf8'; $_config['db'][1]['dbcharset'] = 'utf8';
$_config['db'][1]['pconnect'] = 0; $_config['db'][1]['pconnect'] = 0;
$_config['db'][1]['dbname'] = 'pichome'; $_config['db'][1]['dbname'] = 'pichome';
$_config['db'][1]['tablepre'] = 'pichome_'; $_config['db'][1]['tablepre'] = 'pichome_';
$_config['db'][1]['port'] = '3306';//mysql端口 $_config['db'][1]['port'] = '3306';//mysql端口
$_config['db'][1]['unix_socket'] = '';//使用此方式连接时 dbhost设置为localhost $_config['db'][1]['unix_socket'] = '';//使用此方式连接时 dbhost设置为localhost
/** /**
* 数据库从服务器设置( slave, 只读 ), 支持多组服务器设置, 当设置多组服务器时, 系统根据每次随机使用 * 数据库从服务器设置( slave, 只读 ), 支持多组服务器设置, 当设置多组服务器时, 系统根据每次随机使用
* @example * @example
* $_config['db']['1']['slave']['1']['dbhost'] = 'localhost'; * $_config['db']['1']['slave']['1']['dbhost'] = 'localhost';
* $_config['db']['1']['slave']['1']['dbuser'] = 'root'; * $_config['db']['1']['slave']['1']['dbuser'] = 'root';
* $_config['db']['1']['slave']['1']['dbpw'] = 'root'; * $_config['db']['1']['slave']['1']['dbpw'] = 'root';
* $_config['db']['1']['slave']['1']['dbcharset'] = 'gbk'; * $_config['db']['1']['slave']['1']['dbcharset'] = 'gbk';
* $_config['db']['1']['slave']['1']['pconnect'] = '0'; * $_config['db']['1']['slave']['1']['pconnect'] = '0';
* $_config['db']['1']['slave']['1']['dbname'] = 'x1'; * $_config['db']['1']['slave']['1']['dbname'] = 'x1';
* $_config['db']['1']['slave']['1']['tablepre'] = 'pre_'; * $_config['db']['1']['slave']['1']['tablepre'] = 'pre_';
* $_config['db']['1']['slave']['1']['weight'] = '0'; //权重:数据越大权重越高 * $_config['db']['1']['slave']['1']['weight'] = '0'; //权重:数据越大权重越高
* *
* $_config['db']['1']['slave']['2']['dbhost'] = 'localhost'; * $_config['db']['1']['slave']['2']['dbhost'] = 'localhost';
* ... * ...
* *
*/ */
$_config['db']['1']['slave'] = array(); $_config['db']['1']['slave'] = array();
//启用从服务器的开关 //启用从服务器的开关
$_config['db']['slave'] = false; $_config['db']['slave'] = false;
/** /**
* 数据库 分布部署策略设置 * 数据库 分布部署策略设置
* *
* @example 将 user 部署到第二服务器, session 部署在第三服务器, 则设置为 * @example 将 user 部署到第二服务器, session 部署在第三服务器, 则设置为
* $_config['db']['map']['user'] = 2; * $_config['db']['map']['user'] = 2;
* $_config['db']['map']['session'] = 3; * $_config['db']['map']['session'] = 3;
* *
* 对于没有明确声明服务器的表, 则一律默认部署在第一服务器上 * 对于没有明确声明服务器的表, 则一律默认部署在第一服务器上
* *
*/ */
$_config['db']['map'] = array(); $_config['db']['map'] = array();
/** /**
* 数据库 公共设置, 此类设置通常对针对每个部署的服务器 * 数据库 公共设置, 此类设置通常对针对每个部署的服务器
*/ */
$_config['db']['common'] = array(); $_config['db']['common'] = array();
/** /**
* 禁用从数据库的数据表, 表名字之间使用逗号分割 * 禁用从数据库的数据表, 表名字之间使用逗号分割
* *
* @example session, user 这两个表仅从主服务器读写, 不使用从服务器 * @example session, user 这两个表仅从主服务器读写, 不使用从服务器
* $_config['db']['common']['slave_except_table'] = 'session, user'; * $_config['db']['common']['slave_except_table'] = 'session, user';
* *
*/ */
$_config['db']['common']['slave_except_table'] = ''; $_config['db']['common']['slave_except_table'] = '';
/** /**
* 内存服务器优化设置 * 内存服务器优化设置
* 以下设置需要PHP扩展组件支持其中 memcache 优先于其他设置, * 以下设置需要PHP扩展组件支持其中 memcache 优先于其他设置,
* 当 memcache 无法启用时,会自动开启另外的两种优化模式 * 当 memcache 无法启用时,会自动开启另外的两种优化模式
*/ */
//内存变量前缀, 可更改,避免同服务器中的程序引用错乱 //内存变量前缀, 可更改,避免同服务器中的程序引用错乱
$_config['memory']['prefix'] = 'oaooa_'; $_config['memory']['prefix'] = 'oaooa_';
/* reids设置, 需要PHP扩展组件支持, timeout参数的作用没有查证 */ /* reids设置, 需要PHP扩展组件支持, timeout参数的作用没有查证 */
$_config['memory']['redis']['server'] = ''; $_config['memory']['redis']['server'] = '';
$_config['memory']['redis']['port'] = 6379; $_config['memory']['redis']['port'] = 6379;
$_config['memory']['redis']['pconnect'] = 1; $_config['memory']['redis']['pconnect'] = 1;
$_config['memory']['redis']['timeout'] = 0; $_config['memory']['redis']['timeout'] = 0;
$_config['memory']['redis']['requirepass'] = '';//如果redis需要密码请填写redis密码 $_config['memory']['redis']['requirepass'] = '';//如果redis需要密码请填写redis密码
/** /**
* 是否使用 Redis::SERIALIZER_IGBINARY选项,需要igbinary支持,windows下测试时请关闭否则会出>现错误Reading from client: Connection reset by peer * 是否使用 Redis::SERIALIZER_IGBINARY选项,需要igbinary支持,windows下测试时请关闭否则会出>现错误Reading from client: Connection reset by peer
* 支持以下选项默认使用PHP的serializer * 支持以下选项默认使用PHP的serializer
* Redis::SERIALIZER_IGBINARY =2 * Redis::SERIALIZER_IGBINARY =2
* Redis::SERIALIZER_PHP =1 * Redis::SERIALIZER_PHP =1
* Redis::SERIALIZER_NONE =0 //则不使用serialize,即无法保存array * Redis::SERIALIZER_NONE =0 //则不使用serialize,即无法保存array
*/ */
$_config['memory']['redis']['serializer'] = 1; $_config['memory']['redis']['serializer'] = 1;
$_config['memory']['memcache']['server'] = ''; // memcache 服务器地址 $_config['memory']['memcache']['server'] = ''; // memcache 服务器地址
$_config['memory']['memcache']['port'] = 11211; // memcache 服务器端口 $_config['memory']['memcache']['port'] = 11211; // memcache 服务器端口
$_config['memory']['memcache']['pconnect'] = 1; // memcache 是否长久连接 $_config['memory']['memcache']['pconnect'] = 1; // memcache 是否长久连接
$_config['memory']['memcache']['timeout'] = 1; // memcache 服务器连接超时 $_config['memory']['memcache']['timeout'] = 1; // memcache 服务器连接超时
$_config['memory']['memcached']['server'] = '127.0.0.1'; // memcached 服务器地址 $_config['memory']['memcached']['server'] = '127.0.0.1'; // memcached 服务器地址
$_config['memory']['memcached']['port'] = 11211; // memcached 服务器端口 $_config['memory']['memcached']['port'] = 11211; // memcached 服务器端口
$_config['memory']['memcached']['pconnect'] = 1; // memcached 是否长久连接 $_config['memory']['memcached']['pconnect'] = 1; // memcached 是否长久连接
$_config['memory']['memcached']['timeout'] = 1; // memcached 服务器连接超时 $_config['memory']['memcached']['timeout'] = 1; // memcached 服务器连接超时
$_config['memory']['apc'] = 1; // 启动对 apc 的支持 $_config['memory']['apc'] = 1; // 启动对 apc 的支持
$_config['memory']['xcache'] = 1; // 启动对 xcache 的支持 $_config['memory']['xcache'] = 1; // 启动对 xcache 的支持
$_config['memory']['eaccelerator'] = 0; // 启动对 eaccelerator 的支持 $_config['memory']['eaccelerator'] = 0; // 启动对 eaccelerator 的支持
$_config['memory']['wincache'] = 1; // 启动对 wincache 的支持 $_config['memory']['wincache'] = 1; // 启动对 wincache 的支持
// 服务器相关设置 // 服务器相关设置
$_config['server']['id'] = 1; // 服务器编号多webserver的时候用于标识当前服务器的ID $_config['server']['id'] = 1; // 服务器编号多webserver的时候用于标识当前服务器的ID
//计划任务设置 //计划任务设置
$_config['remote']['on']=0; //1设定计划任务由外部触发0通过用户访问触发 $_config['remote']['on']=0; //1设定计划任务由外部触发0通过用户访问触发
$_config['remote']['cron']=0; //1设定计划任务由外部触发0通过用户访问触发 $_config['remote']['cron']=0; //1设定计划任务由外部触发0通过用户访问触发
// CONFIG CACHE // CONFIG CACHE
$_config['cache']['type'] = 'sql'; // 缓存类型 file=文件缓存, sql=数据库缓存 $_config['cache']['type'] = 'sql'; // 缓存类型 file=文件缓存, sql=数据库缓存
// 页面输出设置 // 页面输出设置
$_config['output']['charset'] = 'utf-8'; // 页面字符集 $_config['output']['charset'] = 'utf-8'; // 页面字符集
$_config['output']['forceheader'] = 1; // 强制输出页面字符集,用于避免某些环境乱码 $_config['output']['forceheader'] = 1; // 强制输出页面字符集,用于避免某些环境乱码
$_config['output']['gzip'] = 0; // 是否采用 Gzip 压缩输出 $_config['output']['gzip'] = 0; // 是否采用 Gzip 压缩输出
$_config['output']['tplrefresh'] = 1; // 模板自动刷新开关 0=关闭, 1=打开 $_config['output']['tplrefresh'] = 1; // 模板自动刷新开关 0=关闭, 1=打开
$_config['output']['language'] = 'zh-CN'; // 页面语言 zh-cn/zh-tw $_config['output']['language'] = 'zh-CN'; // 页面语言 zh-cn/zh-tw
$_config['output']['language_list']['zh-CN']='简体中文'; // 页面语言 zh-CN/en-US $_config['output']['language_list']['zh-CN']='简体中文'; // 页面语言 zh-CN/en-US
$_config['output']['language_list']['en-US']='English'; // 页面语言 zh-CN/en-US $_config['output']['language_list']['en-US']='English'; // 页面语言 zh-CN/en-US
$_config['output']['staticurl'] = 'static/'; // 站点静态文件路径,“/”结尾 $_config['output']['staticurl'] = 'static/'; // 站点静态文件路径,“/”结尾
$_config['output']['ajaxvalidate'] = 0; // 是否严格验证 Ajax 页面的真实性 0=关闭1=打开 $_config['output']['ajaxvalidate'] = 0; // 是否严格验证 Ajax 页面的真实性 0=关闭1=打开
$_config['output']['iecompatible'] = 0; // 页面 IE 兼容模式 $_config['output']['iecompatible'] = 0; // 页面 IE 兼容模式
// COOKIE 设置 // COOKIE 设置
$_config['cookie']['cookiepre'] = 'oaooa_'; // COOKIE前缀 $_config['cookie']['cookiepre'] = 'oaooa_'; // COOKIE前缀
$_config['cookie']['cookiedomain'] = ''; // COOKIE作用域 $_config['cookie']['cookiedomain'] = ''; // COOKIE作用域
$_config['cookie']['cookiepath'] = '/'; // COOKIE作用路径 $_config['cookie']['cookiepath'] = '/'; // COOKIE作用路径
// 站点安全设置 // 站点安全设置
$_config['security']['authkey'] = 'oaooa'; // 站点加密密钥 $_config['security']['authkey'] = 'oaooa'; // 站点加密密钥
$_config['security']['urlxssdefend'] = true; // 自身 URL XSS 防御 $_config['security']['urlxssdefend'] = true; // 自身 URL XSS 防御
$_config['security']['attackevasive'] = 0; // CC 攻击防御 1|2|4|8 $_config['security']['attackevasive'] = 0; // CC 攻击防御 1|2|4|8
$_config['security']['querysafe']['status'] = 1; // 是否开启SQL安全检测可自动预防SQL注入攻击 $_config['security']['querysafe']['status'] = 1; // 是否开启SQL安全检测可自动预防SQL注入攻击
$_config['security']['querysafe']['dfunction'] = array('load_file','hex','substring','if','ord','char'); $_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']['daction'] = array('@','intooutfile','intodumpfile','unionselect','(select', 'unionall', 'uniondistinct');
$_config['security']['querysafe']['dnote'] = array('/*','*/','#','--','"'); $_config['security']['querysafe']['dnote'] = array('/*','*/','#','--','"');
$_config['security']['querysafe']['dlikehex'] = 1; $_config['security']['querysafe']['dlikehex'] = 1;
$_config['security']['querysafe']['afullnote'] = 0; $_config['security']['querysafe']['afullnote'] = 0;
$_config['admincp']['founder'] = '1'; // 站点创始人:拥有站点管理后台的最高权限,每个站点可以设置 1名或多名创始人 $_config['admincp']['founder'] = '1'; // 站点创始人:拥有站点管理后台的最高权限,每个站点可以设置 1名或多名创始人
// 可以使用uid也可以使用用户名多个创始人之间请使用逗号“,”分开; // 可以使用uid也可以使用用户名多个创始人之间请使用逗号“,”分开;
$_config['admincp']['checkip'] = 1; // 后台管理操作是否验证管理员的 IP, 1=是[安全], 0=否。仅在管理员无法登录后台时设置 0。 $_config['admincp']['checkip'] = 1; // 后台管理操作是否验证管理员的 IP, 1=是[安全], 0=否。仅在管理员无法登录后台时设置 0。
$_config['admincp']['runquery'] = 0; // 是否允许后台运行 SQL 语句 1=是 0=否[安全] $_config['admincp']['runquery'] = 0; // 是否允许后台运行 SQL 语句 1=是 0=否[安全]
$_config['admincp']['dbimport'] = 0; // 是否允许后台恢复网站数据 1=是 0=否[安全] $_config['admincp']['dbimport'] = 0; // 是否允许后台恢复网站数据 1=是 0=否[安全]
$_config['userlogin']['checkip'] = 1; //用户登录错误验证ip对于同一ip同时使用时建议设置为0,否则当有一位用户登录错误次数超过5次该ip被锁定15分钟导致其他的同IP用户无法登录; $_config['userlogin']['checkip'] = 1; //用户登录错误验证ip对于同一ip同时使用时建议设置为0,否则当有一位用户登录错误次数超过5次该ip被锁定15分钟导致其他的同IP用户无法登录;
//$_config['system_os'] = 'linux'; //windows,linux,mac,系统会自动判断 //$_config['system_os'] = 'linux'; //windows,linux,mac,系统会自动判断
//$_config['system_charset']='utf-8'; //操作系统编码不设置系统将根据操作系统类型来判断linux:utf-8;windows:gbk; //$_config['system_charset']='utf-8'; //操作系统编码不设置系统将根据操作系统类型来判断linux:utf-8;windows:gbk;
return $_config;
//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;

View File

@@ -1,103 +1,113 @@
<?php <?php
/** php下载类,支持断点续传 /** php下载类,支持断点续传
* Date: 2013-06-30 * Date: 2013-06-30
* Author: test * Author: test
* Ver: 1.0 * Ver: 1.0
* *
* Func: * Func:
* download: 下载文件 * download: 下载文件
* setSpeed: 设置下载速度 * setSpeed: 设置下载速度
* getRange: 获取header中Range * getRange: 获取header中Range
*/ */
class FileDownload{ // class start class FileDownload{ // class start
private $_speed = 512; // 下载速度 private $_speed = 512; // 下载速度
/** 下载 /** 下载
* @param String $file 要下载的文件路径 * @param String $file 要下载的文件路径
* @param String $name 文件名称,为空则与下载的文件名称一样 * @param String $name 文件名称,为空则与下载的文件名称一样
* @param boolean $reload 是否开启断点续传 * @param boolean $reload 是否开启断点续传
*/ */
public function download($file, $name='',$file_size=0,$dateline=0, $reload=false){ public function download($file, $name='',$file_size=0,$dateline=0, $reload=false){
if($name==''){ if($name==''){
$name = basename($file); $name = basename($file);
} }
if(!$dateline){ if(!$dateline){
$dataline=TIMESTAMP; $dataline=TIMESTAMP;
} }
if(!$fp = fopen($file, 'rb')){ if(!$fp = fopen($file, 'rb')){
topshowmessage(lang('file_not_exist1')); topshowmessage(lang('file_not_exist1'));
} }
$db = DB::object(); $charset = CHARSET;
$db->close(); $db = DB::object();
@ob_end_clean(); $db->close();
if(getglobal('gzipcompress')) @ob_start('ob_gzhandler'); @ob_end_clean();
if(!$file_size) $file_size = filesize($file); if(getglobal('gzipcompress')) @ob_start('ob_gzhandler');
$ranges = $this->getRange($file_size); 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('cache-control:public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $dateline).' GMT'); header('Date: '.gmdate('D, d M Y H:i:s', $dateline).' GMT');
header('content-type:application/octet-stream'); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $dateline).' GMT');
header('content-disposition:attachment; filename='.$name); header('content-type:application/octet-stream');
if($reload && $ranges!=null){ // 使用续传 if (preg_match("/Firefox/", $_SERVER["HTTP_USER_AGENT"])) {
header('HTTP/1.1 206 Partial Content'); $attachment = 'attachment; filename*='.$charset.'\'\'' . $name;
header('Accept-Ranges:bytes'); } 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;
header(sprintf('content-length:%u',$ranges['end']-$ranges['start']+1)); } else{
$attachment = 'attachment; filename='.$name;
// range信息 }
header(sprintf('content-range:bytes %s-%s/%s', $ranges['start'], $ranges['end'], $file_size)); //header('content-disposition:attachment; filename='.$name);
header('content-disposition:'.$attachment);
// fp指针跳到断点位置 if($reload && $ranges!=null){ // 使用续传
fseek($fp, sprintf('%u', $ranges['start'])); header('HTTP/1.1 206 Partial Content');
}else{ header('Accept-Ranges:bytes');
header('HTTP/1.1 200 OK');
header('content-length:'.$file_size); // 剩余长度
} header(sprintf('content-length:%u',$ranges['end']-$ranges['start']+1));
while(!feof($fp)){ // range信息
echo fread($fp, round($this->_speed*1024,0)); header(sprintf('content-range:bytes %s-%s/%s', $ranges['start'], $ranges['end'], $file_size));
@flush(); @ob_flush();
// usleep(500); // 用于测试,减慢下载速度 // fp指针跳到断点位置
} fseek($fp, sprintf('%u', $ranges['start']));
($fp!=null) && fclose($fp); }else{
header('HTTP/1.1 200 OK');
} header('content-length:'.$file_size);
}
/** 设置下载速度
* @param int $speed while(!feof($fp)){
*/ echo fread($fp, round($this->_speed*1024,0));
public function setSpeed($speed){ @flush(); @ob_flush();
if(is_numeric($speed) && $speed>16 && $speed<4096){ // usleep(500); // 用于测试,减慢下载速度
$this->_speed = $speed; }
} ($fp!=null) && fclose($fp);
}
}
/** 获取header range信息
* @param int $file_size 文件大小 /** 设置下载速度
* @return Array * @param int $speed
*/ */
private function getRange($file_size){ public function setSpeed($speed){
if(is_numeric($speed) && $speed>16 && $speed<4096){
if(isset($_SERVER['HTTP_RANGE'])){ $this->_speed = $speed;
list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2); }
list($range) = explode(",",$range,2); }
list($start, $range_end) = explode("-", $range);
$start=intval($start); /** 获取header range信息
if(!$range_end) { * @param int $file_size 文件大小
$range_end=$file_size-1; * @return Array
} else { */
$range_end=intval($range_end); private function getRange($file_size){
}
$range = array('start'=>$start,'end'=>$range_end); if(isset($_SERVER['HTTP_RANGE'])){
return $range; list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2);
} list($range) = explode(",",$range,2);
return null; list($start, $range_end) = explode("-", $range);
} $start=intval($start);
if(!$range_end) {
} // class 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
?> ?>

View File

@@ -1,471 +1,472 @@
<?php <?php
/** /**
* This file is part of the ImagePalette package. * This file is part of the ImagePalette package.
* *
* (c) Brian McDonald <brian@brianmcdonald.io> * (c) Brian McDonald <brian@brianmcdonald.io>
* (c) gandalfx - https://github.com/gandalfx * (c) gandalfx - https://github.com/gandalfx
* *
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
/** /**
* Class ImagePalette * Class ImagePalette
* *
* Gets the prominent colors in a given image. To get common color matching, all pixels are matched * Gets the prominent colors in a given image. To get common color matching, all pixels are matched
* against a white-listed color palette. * against a white-listed color palette.
* *
* @package BrianMcdo\ImagePalette * @package BrianMcdo\ImagePalette
*/ */
class ImagePalette implements IteratorAggregate class ImagePalette implements IteratorAggregate
{ {
/** /**
* File or Url * File or Url
* @var string * @var string
*/ */
protected $file; protected $file;
/** /**
* Loaded Image * Loaded Image
* @var object * @var object
*/ */
protected $loadedImage; protected $loadedImage;
/** /**
* Process every Nth pixel * Process every Nth pixel
* @var int * @var int
*/ */
protected $precision; protected $precision;
/** /**
* Width of image * Width of image
* @var integer * @var integer
*/ */
protected $width; protected $width;
/** /**
* Height of image * Height of image
* @var integer * @var integer
*/ */
protected $height; protected $height;
/** /**
* Number of colors to return * Number of colors to return
* @var integer * @var integer
*/ */
protected $paletteLength; protected $paletteLength;
/** /**
* Colors Whitelist * Colors Whitelist
* @var array * @var array
*/ */
/* protected $whiteList = array( /* protected $whiteList = array(
0x660000, 0x990000, 0xcc0000, 0xcc3333, 0xea4c88, 0x993399, 0x660000, 0x990000, 0xcc0000, 0xcc3333, 0xea4c88, 0x993399,
0x663399, 0x333399, 0x0066cc, 0x0099cc, 0x66cccc, 0x77cc33, 0x663399, 0x333399, 0x0066cc, 0x0099cc, 0x66cccc, 0x77cc33,
0x669900, 0x336600, 0x666600, 0x999900, 0xcccc33, 0xffff00, 0x669900, 0x336600, 0x666600, 0x999900, 0xcccc33, 0xffff00,
0xffcc33, 0xff9900, 0xff6600, 0xcc6633, 0x996633, 0x663300, 0xffcc33, 0xff9900, 0xff6600, 0xcc6633, 0x996633, 0x663300,
0x000000, 0x999999, 0xcccccc, 0xffffff, 0xE7D8B1, 0xFDADC7, 0x000000, 0x999999, 0xcccccc, 0xffffff, 0xE7D8B1, 0xFDADC7,
0x424153, 0xABBCDA, 0xF5DD01 0x424153, 0xABBCDA, 0xF5DD01
);*/ );*/
protected $whiteList = array( protected $whiteList = array(
0x111111,0xFFFFFF,0x9E9E9E,0xA48057,0xFC85B3,0xFF2727,0xFFA34B,0xFFD534,0x47C595,0x51C4C4,0x2B76E7,0x6D50ED 0x111111,0xFFFFFF,0x9E9E9E,0xA48057,0xFC85B3,0xFF2727,0xFFA34B,0xFFD534,0x47C595,0x51C4C4,0x2B76E7,0x6D50ED
); );
protected $whiteList1 = array(); protected $whiteList1 = array();
/** /**
* Colors that were found to be prominent * Colors that were found to be prominent
* Array of Color objects * Array of Color objects
* *
* @var array * @var array
*/ */
protected $palette; protected $palette;
protected $colorNumber; protected $colorNumber;
/** /**
* Library used * Library used
* Supported are GD and Imagick * Supported are GD and Imagick
* @var string * @var string
*/ */
protected $lib; protected $lib;
/** /**
* Constructor * Constructor
* @param string $file * @param string $file
* @param int $precision * @param int $precision
* @param int $paletteLength * @param int $paletteLength
* @param string $library * @param string $library
*/ */
public function __construct($file, $precision = 10, $paletteLength = 5, $library = 'gd',$whiteList=array()) public function __construct($file, $precision = 10, $paletteLength = 5, $library = 'gd',$whiteList=array())
{ {
$this->file = $file; $this->file = $file;
$this->precision = $precision; $this->precision = $precision;
$this->paletteLength = $paletteLength; $this->paletteLength = $paletteLength;
// use provided libname or auto-detect // use provided libname or auto-detect
$this->lib = $this->graphicsLibrary($library); $this->lib = $this->graphicsLibrary($library);
// create an array with color ints as keys // create an array with color ints as keys
$this->whiteList = array_fill_keys($whiteList?$whiteList:$this->whiteList, 0); $this->whiteList = array_fill_keys($whiteList?$whiteList:$this->whiteList, 0);
$this->whiteList1 = array_fill_keys($whiteList?$whiteList:$this->whiteList, array()); $this->whiteList1 = array_fill_keys($whiteList?$whiteList:$this->whiteList, array());
$this->process($this->lib); $this->process($this->lib);
} }
/** /**
* Select graphics library to use for processing * Select graphics library to use for processing
* *
* @param string $lib * @param string $lib
* @return mixed * @return mixed
* @throws \Exception * @throws \Exception
*/ */
protected function graphicsLibrary($lib = 'gd') protected function graphicsLibrary($lib = 'gd')
{ {
$libraries = [ $libraries = [
'gd' => 'GD', 'gd' => 'GD',
'imagick' => 'Imagick', 'imagick' => 'Imagick',
//'gmagick' => [false, 'Gmagick'] //'gmagick' => [false, 'Gmagick']
]; ];
if( ! array_key_exists($lib, $libraries)) if( ! array_key_exists($lib, $libraries))
{ {
throw new Exception('This extension specified is not supported.'); throw new Exception('This extension specified is not supported.');
} }
if( ! extension_loaded($lib)) if( ! extension_loaded($lib))
{ {
throw new Exception('This extension is not installed'); throw new Exception('This extension is not installed');
} }
return $libraries[$lib]; return $libraries[$lib];
} }
/** /**
* Select a graphical library and start generating the Image Palette * Select a graphical library and start generating the Image Palette
* @param string $lib * @param string $lib
* @throws \Exception * @throws \Exception
*/ */
protected function process($lib) protected function process($lib)
{ {
if(!$this->{'setWorkingImage' . $lib} ()) return false; if(!$this->{'setWorkingImage' . $lib} ()) return false;
$this->{'setImagesize' . $lib} (); $this->{'setImagesize' . $lib} ();
$this->readPixels(); $this->readPixels();
$ps=array_keys($this->whiteList); $ps=array_keys($this->whiteList);
// sort whiteList // sort whiteList
arsort($this->whiteList1); arsort($this->whiteList1);
$total=0; $total=0;
foreach($this->whiteList as $key => $v){ foreach($this->whiteList as $key => $v){
$total+=intval($v); $total+=intval($v);
} }
//print_r($this->whiteList);exit('ddd'); //print_r($this->whiteList);exit('ddd');
$arr=array(); $arr=array();
$arr1=array(); $arr1=array();
foreach($this->whiteList1 as $key =>$val){ foreach($this->whiteList1 as $key =>$val){
if(!($this->whiteList[$key])) continue; if(!($this->whiteList[$key])) continue;
arsort($val); arsort($val);
$v=array_keys($val); $v=array_keys($val);
$arr[$v[0]]=round(($this->whiteList[$key]/$total)*100,2); $arr[$v[0]]=round(($this->whiteList[$key]/$total)*100,2);
$arr1[$v[0]]=array_search($key,$ps); $arr1[$v[0]]=array_search($key,$ps);
} }
$arr=array_slice($arr,0,$this->paletteLength,true); $arr=array_slice($arr,0,$this->paletteLength,true);
$arr1=array_slice($arr1,0,$this->paletteLength,true); $arr1=array_slice($arr1,0,$this->paletteLength,true);
$this->palette=$arr; $this->palette=$arr;
$this->colorNumber=$arr1; $this->colorNumber=$arr1;
// sort whiteList accordingly // sort whiteList accordingly
// $this->filter($arr); // $this->filter($arr);
/*array_map( /*array_map(
function($color) { function($color) {
return new Color($color); return new Color($color);
}, },
array_keys($arr) array_keys($arr)
);*/ );*/
} }
public function getPalette(){ public function getPalette(){
return $this->palette; return $this->palette;
} }
public function getColorNumber(){ public function getColorNumber(){
return $this->colorNumber; return $this->colorNumber;
} }
public function getWhiteList1(){ public function getWhiteList1(){
return $this->whiteList1; return $this->whiteList1;
} }
public function getWidth(){ public function getWidth(){
return $this->width; return $this->width;
} }
public function getHeight(){ public function getHeight(){
return $this->height; return $this->height;
} }
/** /**
* Load and set the working image. * Load and set the working image.
*/ */
protected function setWorkingImageGD() protected function setWorkingImageGD()
{ {
//$extension = 'jpg';//pathinfo($this->file, PATHINFO_EXTENSION); //$extension = 'jpg';//pathinfo($this->file, PATHINFO_EXTENSION);
$info=@getimagesize($this->file); $info=@getimagesize($this->file);
switch ($info['mime']) switch ($info['mime'])
{ {
case 'image/png': case 'image/png':
$this->loadedImage = imagecreatefrompng($this->file); $this->loadedImage = imagecreatefrompng($this->file);
break; break;
case 'image/jpeg': case 'image/jpeg':
$this->loadedImage = imagecreatefromjpeg($this->file); $this->loadedImage = imagecreatefromjpeg($this->file);
break; break;
case 'image/gif': case 'image/gif':
$this->loadedImage = imagecreatefromgif($this->file); $this->loadedImage = imagecreatefromgif($this->file);
break; break;
default: default:
throw new Exception("The file type .$extension is not supported."); throw new Exception("The file type .$extension is not supported.");
} }
return ture; return ture;
} }
/** /**
* Load and set working image * Load and set working image
* *
* @todo needs work * @todo needs work
* @return mixed * @return mixed
*/ */
protected function setWorkingImageImagick() protected function setWorkingImageImagick()
{ {
$file = file_get_contents($this->file); $file = file_get_contents($this->file);
$temp = tempnam("/tmp", uniqid("ImagePalette_", true)); $temp = tempnam(DZZ_ROOT.'./data/attachment/cache', uniqid("ImagePalette_", true));
if(!file_put_contents($temp, $file)) return false; if(!file_put_contents($temp, $file)) return false;
$this->loadedImage = new Imagick($temp); $this->loadedImage = new Imagick($temp);
$this->loadedImage ->thumbnailImage(64,64,true); $this->loadedImage ->thumbnailImage(64,64,true);
return true; @unlink($temp);
} return true;
}
/**
* Load and set working image /**
* * Load and set working image
* @todo needs work *
* @throws \Exception * @todo needs work
* @return mixed * @throws \Exception
*/ * @return mixed
protected function setWorkingImageGmagick() */
{ protected function setWorkingImageGmagick()
throw new Exception("Gmagick not supported"); {
} throw new Exception("Gmagick not supported");
}
/**
* Get and set size of the image using GD. /**
*/ * Get and set size of the image using GD.
protected function setImageSizeGD() */
{ protected function setImageSizeGD()
list($this->width, $this->height) = getimagesize($this->file); {
} list($this->width, $this->height) = getimagesize($this->file);
}
/**
* Get and set size of image using ImageMagick. /**
*/ * Get and set size of image using ImageMagick.
protected function setImageSizeImagick() */
{ protected function setImageSizeImagick()
$d = $this->loadedImage->getImageGeometry(); {
$d = $this->loadedImage->getImageGeometry();
$this->width = $d['width'];
$this->height = $d['height']; $this->width = $d['width'];
$this->height = $d['height'];
}
}
/**
* For each interesting pixel, add its closest color to the loaded colors array /**
* * For each interesting pixel, add its closest color to the loaded colors array
* @return mixed *
*/ * @return mixed
protected function readPixels() */
{ protected function readPixels()
// Row {
for ($x = 0; $x < $this->width; $x += $this->precision) // Row
{ for ($x = 0; $x < $this->width; $x += $this->precision)
// Column {
for ($y = 0; $y < $this->height; $y += $this->precision) // Column
{ for ($y = 0; $y < $this->height; $y += $this->precision)
{
$color = $this->getPixelColor($x, $y);
$color = $this->getPixelColor($x, $y);
// transparent pixels don't really have a color
if ($color->isTransparent()) // transparent pixels don't really have a color
continue 1; if ($color->isTransparent())
// increment closes whiteList color (key) continue 1;
$this->whiteList[ $this->getClosestColor($color) ]++; // increment closes whiteList color (key)
//$this->whiteList1[$color->toInt()]++; $this->whiteList[ $this->getClosestColor($color) ]++;
} //$this->whiteList1[$color->toInt()]++;
} }
} }
}
/**
* Get closest matching color /**
* * Get closest matching color
* @param Color $color *
* @return int * @param Color $color
*/ * @return int
protected function getClosestColor(Color $color) */
{ protected function getClosestColor(Color $color)
$cint=$color->toInt(); {
$cint=$color->toInt();
$bestDiff = PHP_INT_MAX;
$bestDiff = PHP_INT_MAX;
// default to black so hhvm won't cry
$bestColor = 0x000000; // default to black so hhvm won't cry
$rgbarr=array(); $bestColor = 0x000000;
foreach ($this->whiteList as $wlColor => $hits) $rgbarr=array();
{ foreach ($this->whiteList as $wlColor => $hits)
{
// calculate difference (don't sqrt)
$diff = $color->getDiff($wlColor); // calculate difference (don't sqrt)
$diff = $color->getDiff($wlColor);
// see if we got a new best
if ($diff < $bestDiff) // see if we got a new best
{ if ($diff < $bestDiff)
$bestDiff = $diff; {
$bestColor = $wlColor; $bestDiff = $diff;
} $bestColor = $wlColor;
} }
}
if(!isset( $this->whiteList1[$bestColor][$cint])) $this->whiteList1[$bestColor][$cint]=1;
else { if(!isset( $this->whiteList1[$bestColor][$cint])) $this->whiteList1[$bestColor][$cint]=1;
$this->whiteList1[$bestColor][$cint]++; else {
} $this->whiteList1[$bestColor][$cint]++;
return $bestColor; }
} return $bestColor;
}
/**
* Returns an array describing the color at x,y /**
* At index 0 is the color as a whole int (may include alpha) * Returns an array describing the color at x,y
* At index 1 is the color's red value * At index 0 is the color as a whole int (may include alpha)
* At index 2 is the color's green value * At index 1 is the color's red value
* At index 3 is the color's blue 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 * @param int $x
* @return Color * @param int $y
*/ * @return Color
protected function getPixelColor($x, $y) */
{ protected function getPixelColor($x, $y)
return $this->{'getPixelColor' . $this->lib} ($x, $y); {
} return $this->{'getPixelColor' . $this->lib} ($x, $y);
}
/**
* Using to retrieve color information about a specified pixel /**
* * Using to retrieve color information about a specified pixel
* @see getPixelColor() *
* @param int $x * @see getPixelColor()
* @param int $y * @param int $x
* @return Color * @param int $y
*/ * @return Color
protected function getPixelColorGD($x, $y) */
{ protected function getPixelColorGD($x, $y)
$color = imagecolorat($this->loadedImage, $x, $y); {
$color = imagecolorat($this->loadedImage, $x, $y);
return new Color (
$color return new Color (
// $rgb['red'], $color
// $rgb['green'], // $rgb['red'],
// $rgb['blue'] // $rgb['green'],
); // $rgb['blue']
} );
}
/**
* Using to retrieve color information about a specified pixel /**
* * Using to retrieve color information about a specified pixel
* @see getPixelColor() *
* @param int $x * @see getPixelColor()
* @param int $y * @param int $x
* @return Color * @param int $y
*/ * @return Color
protected function getPixelColorImagick($x, $y) */
{ protected function getPixelColorImagick($x, $y)
$rgb = $this->loadedImage->getImagePixelColor($x, $y)->getColor(); {
foreach($rgb as $k => $v){ $rgb = $this->loadedImage->getImagePixelColor($x, $y)->getColor();
if($v<0) $v=0; foreach($rgb as $k => $v){
$rgb[$k]=$v; if($v<0) $v=0;
} $rgb[$k]=$v;
}
return new Color([
$rgb['r'], return new Color([
$rgb['g'], $rgb['r'],
$rgb['b'], $rgb['g'],
]); $rgb['b'],
} ]);
}
protected function getPixelColorGmagick($x, $y)
{ protected function getPixelColorGmagick($x, $y)
throw new Exception("Gmagick not supported: ($x, $y)"); {
} throw new Exception("Gmagick not supported: ($x, $y)");
}
/**
* Returns an array of Color objects /**
* * Returns an array of Color objects
* @param int $paletteLength *
* @return array * @param int $paletteLength
*/ * @return array
public function getColors($paletteLength = null) */
{ public function getColors($paletteLength = null)
// allow custom length calls {
if ( ! is_numeric($paletteLength)) // allow custom length calls
{ if ( ! is_numeric($paletteLength))
$paletteLength = $this->paletteLength; {
} $paletteLength = $this->paletteLength;
}
// take the best hits
return array_slice($this->palette, 0, $paletteLength, true); // take the best hits
} return array_slice($this->palette, 0, $paletteLength, true);
}
/**
* Returns a json encoded version of the palette /**
* * Returns a json encoded version of the palette
* @return string *
*/ * @return string
public function __toString() */
{ public function __toString()
// Color PHP 5.3 compatible -> not JsonSerializable :( {
return json_encode(array_map( // Color PHP 5.3 compatible -> not JsonSerializable :(
function($color) { return json_encode(array_map(
return (string) $color; function($color) {
}, return (string) $color;
$this->getColors() },
)); $this->getColors()
} ));
}
/**
* Convenient getter access as properties /**
* * Convenient getter access as properties
* @param $name *
* @throws \Exception * @param $name
* @return mixed * @throws \Exception
*/ * @return mixed
public function __get($name) */
{ public function __get($name)
$method = 'get' . ucfirst($name); {
$method = 'get' . ucfirst($name);
if (method_exists($this, $method))
{ if (method_exists($this, $method))
return $this->$method(); {
} return $this->$method();
}
throw new Exception("Method $method does not exist");
} throw new Exception("Method $method does not exist");
}
/**
* Returns the palette for implementation of the IteratorAggregate interface /**
* Used in foreach loops * Returns the palette for implementation of the IteratorAggregate interface
* * Used in foreach loops
* @see getColors() *
* @return \ArrayIterator * @see getColors()
*/ * @return \ArrayIterator
public function getIterator() */
{ public function getIterator()
return new ArrayIterator($this->getColors()); {
} return new ArrayIterator($this->getColors());
} }
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,168 +1,182 @@
<?php <?php
/* /*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd * @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/ * @license https://www.oaooa.com/licenses/
* *
* @link https://www.oaooa.com * @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com) * @author zyx(zyx@oaooa.com)
*/ */
if (!defined('IN_OAOOA')) { if (!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
class dzz_io class dzz_io
{ {
protected function initIO($path) protected function initIO($path)
{ {
$path = self::clean($path); $path = self::clean($path);
$bzarr = explode(':', $path); $bzarr = explode(':', $path);
$allowbz = C::t('connect')->fetch_all_bz();//array('baiduPCS','ALIOSS','dzz','JSS','disk'); $allowbz = C::t('connect')->fetch_all_bz();//array('baiduPCS','ALIOSS','dzz','JSS','disk');
if (strpos($path, 'dzz::') !== false) { if (strpos($path, 'dzz::') !== false) {
$classname = 'io_dzz'; $classname = 'io_dzz';
} elseif (strpos($path, 'attach::') !== false) { } elseif (strpos($path, 'attach::') !== false) {
$classname = 'io_dzz'; $classname = 'io_dzz';
} elseif (strpos($path, 'TMP::') !== false) { } elseif (strpos($path, 'TMP::') !== false) {
$classname = 'io_dzz'; $classname = 'io_dzz';
} elseif (is_numeric($bzarr[0])) { } elseif (is_numeric($bzarr[0])) {
$classname = 'io_dzz'; $classname = 'io_dzz';
} elseif (in_array($bzarr[0], $allowbz)) { } elseif (in_array($bzarr[0], $allowbz)) {
$classname = 'io_' . $bzarr[0]; $classname = 'io_' . $bzarr[0];
} elseif (preg_match('/^\w{32}$/i', $path)) { } elseif (preg_match('/^\w{32}$/i', $path)) {
$classname = 'io_dzz'; $classname = 'io_dzz';
} else { } else {
return false; return false;
} }
return new $classname($path); return new $classname($path);
} }
function MoveToSpace($path, $attach, $ondup = 'overwrite') function MoveToSpace($path, $attach, $ondup = 'overwrite')
{ {
$path = self::clean($path); $path = self::clean($path);
if ($io = self::initIO($path)) { if ($io = self::initIO($path)) {
return $io->MoveToSpace($path, $attach, $ondup); return $io->MoveToSpace($path, $attach, $ondup);
} else { } else {
return false; return false;
} }
} }
function authorize($bz, $refer = '') function authorize($bz, $refer = '')
{ {
if ($io = self::initIO($bz)) { if ($io = self::initIO($bz)) {
$io->authorize($refer); $io->authorize($refer);
} }
} }
function getQuota($bz) function getQuota($bz)
{ {
if ($io = self::initIO($bz)) { if ($io = self::initIO($bz)) {
return $io->getQuota($bz); return $io->getQuota($bz);
} else { } else {
return false; return false;
} }
} }
function chmod($path, $chmod, $son = 0) function chmod($path, $chmod, $son = 0)
{ {
if ($io = self::initIO($path)) { if ($io = self::initIO($path)) {
return $io->chmod($path, $chmod, $son); return $io->chmod($path, $chmod, $son);
} else { } else {
return false; return false;
} }
} }
function parsePath($path) function parsePath($path)
{ {
$path = self::clean($path); $path = self::clean($path);
if ($io = self::initIO($path)) { if ($io = self::initIO($path)) {
return $io->parsePath($path); return $io->parsePath($path);
} else { } else {
return false; return false;
} }
} }
function output_thumb($file, $mine = 'image/JPEG') function output_thumb($file, $mine = 'image/JPEG')
{//根据文件地址,输出图像流 {//根据文件地址,输出图像流
global $_G; global $_G;
$last_modified_time = filemtime($file); $last_modified_time = filemtime($file);
if ($last_modified_time) { if ($last_modified_time) {
$etag = md5_file($file); $etag = md5_file($file);
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified_time) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified_time) . " GMT");
header("Etag: $etag"); header("Etag: $etag");
if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time || if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time ||
trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag
) { ) {
header("HTTP/1.1 304 Not Modified"); header("HTTP/1.1 304 Not Modified");
exit; exit;
} }
} }
/*if(!$last_modified_time) $last_modified_time = TIMESTAMP;*/ /*if(!$last_modified_time) $last_modified_time = TIMESTAMP;*/
@header('cache-control:public'); @header('cache-control:public');
header('Content-Type: ' . $mine); header('Content-Type: ' . $mine);
@ob_end_clean(); @ob_end_clean();
if (getglobal('gzipcompress')) @ob_start('ob_gzhandler'); if (getglobal('gzipcompress')) @ob_start('ob_gzhandler');
@readfile($file); @readfile($file);
@flush(); @flush();
@ob_flush(); @ob_flush();
exit(); exit();
} }
/*将文件缓存到本地,并且返回本地的访问地址*/ /*将文件缓存到本地,并且返回本地的访问地址*/
function cacheFile($data) function cacheFile($data)
{ {
global $_G; global $_G;
$subdir = $subdir1 = $subdir2 = ''; $subdir = $subdir1 = $subdir2 = '';
$subdir1 = date('Ym'); $subdir1 = date('Ym');
$subdir2 = date('d'); $subdir2 = date('d');
$subdir = $subdir1 . '/' . $subdir2 . '/'; $subdir = $subdir1 . '/' . $subdir2 . '/';
$target1 = 'dzzcache/' . $subdir . 'index.html'; $target1 = 'dzzcache/' . $subdir . 'index.html';
$target = 'dzzcache/' . $subdir . random(10); $target = 'dzzcache/' . $subdir . random(10);
$target_attach = $_G['setting']['attachdir'] . $target1; $target_attach = $_G['setting']['attachdir'] . $target1;
$targetpath = dirname($target_attach); $targetpath = dirname($target_attach);
dmkdir($targetpath); dmkdir($targetpath);
if (file_put_contents($target, $data)) { if (file_put_contents($target, $data)) {
return $target; return $target;
} else { } else {
return false; return false;
} }
} }
public function clean($str) {//清除路径 public function clean($str) {//清除路径
if(is_array($str)){ if(is_array($str)){
foreach($str as $key=> $value){ foreach($str as $key=> $value){
$str[$key]=self::clean_path(str_replace(array( "\n", "\r", '../'), '', $value)); $str[$key]=self::clean_path(str_replace(array( "\n", "\r", '../'), '', $value));
} }
}else{ }else{
$str= self::clean_path(str_replace(array( "\n", "\r", '../'), '', $str)); $str= self::clean_path(str_replace(array( "\n", "\r", '../'), '', $str));
} }
return $str; return $str;
} }
private function clean_path($str){ private function clean_path($str){
if(preg_match("/\.\.\//",$str)){ if(preg_match("/\.\.\//",$str)){
$str=str_replace('../','',$str); $str=str_replace('../','',$str);
return self::clean_path($str); return self::clean_path($str);
}else{ }else{
return $str; return $str;
} }
} }
public function getApps($path){ public function getApps($path){
$path = self::clean($path); $path = self::clean($path);
if ($io = self::initIO($path)) { if ($io = self::initIO($path)) {
$return = $io->getApps($path); $return = $io->getApps($path);
return $return; return $return;
} else return false; } else return false;
} }
public function getAllFiles($path,$fid){ public function getAllFiles($path,$fid,$page=1,$limit=100){
$path = self::clean($path); $path = self::clean($path);
if ($io = self::initIO($path)) { if ($io = self::initIO($path)) {
$return = $io->getAllFiles($path,$fid); $return = $io->getAllFiles($path,$fid,$page,$limit);
return $return; return $return;
} else return false; } else return false;
} }
} public function getAlltag($path){
$path = self::clean($path);
if ($io = self::initIO($path)) {
$return = $io->getAlltag($path);
return $return;
} else return false;
}
public function getAlltaggroup($path){
$path = self::clean($path);
if ($io = self::initIO($path)) {
$return = $io->getAlltaggroup($path);
return $return;
} else return false;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
<?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');
}
//所有用户应用
//uid=0 的表示为默认应用
class table_connect extends dzz_table
{
public function __construct() {
$this->_table = 'connect';
$this->_pk = 'bz';
$this->_pre_cache_key = 'connect_';
$this->_cache_ttl = 60*60;
parent::__construct();
}
public function fetch_all_by_available($onlyuser=false){
$data=array();
if($onlyuser) $available=1;
else $available=0;
$query=DB::query("SELECT * FROM ".DB::table($this->_table)." WHERE available > '{$available}' and type!='local' ORDER BY disp");
while($value=DB::fetch($query)){
//检测可用性
if($value['type']=='pan' && (empty($value['key']) || empty($value['secret']))){
$value['available']=0;
$value['warning']=lang('please_open_after_setting');
continue;
}
if(!is_file(DZZ_ROOT.'./core/class/io/io_'.($value['bz']).'.php')){
$value['available']=0;
$value['warning']='api'.lang('typename_attach').'io_'.($value['bz']).'.php'.lang('inexistence').'';
continue;
}
$data[$value['bz']]=$value;
}
return $data;
}
public function fetch_all_folderdata($uid){
$data=self::fetch_all_by_available();
$folderdata=array();
foreach($data as $value){
foreach(DB::fetch_all("select id from ".DB::table($value['dname'])." where uid>0 && uid='{$uid}'") as $value1){
$arr=C::t($value['dname'])->fetch_by_id($value1['id']);
$folderdata[$arr['fid']]=$arr;
}
}
return $folderdata;
}
public function fetch_all_bz(){
$data=array();
foreach(DB::fetch_all("select bz from %t where 1",array($this->_table)) as $value){
$data[]=$value['bz'];
}
return $data;
}
public function delete_by_bz($bz){
if($bz=='dzz') return false; //dzz是内置不能删除
$data=self::fetch($bz);
if(is_file(DZZ_ROOT.'./core/class/table/table_'.$data['dname'].'.php')){
C::t($data['dname'])->delete_by_bz($bz);
}
return self::delete($bz);
}
}
?>

View File

@@ -0,0 +1,82 @@
<?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');
}
//所有用户应用
//uid=0 的表示为默认应用
class table_connect_disk extends dzz_table
{
public function __construct() {
$this->_table = 'connect_disk';
$this->_pk = 'id';
$this->_pre_cache_key = 'connect_disk_';
$this->_cache_ttl = 300;
parent::__construct();
}
public function fetch_by_id($id){
$value=parent::fetch($id);
$cloud=DB::fetch_first("select * from ".DB::table('connect')." where bz='{$value['bz']}'");
$data=array(
'id'=>$value['id'],
'fid'=>md5($cloud['bz'].':'.$value['id'].':'.$cloud['root']),
'pfid'=>0,
'fname'=>$value['cloudname'],
'ficon'=>'dzz/images/default/system/'.$cloud['bz'].'.png',
'bz'=>$cloud['bz'].':'.$value['id'].':',
'path'=>$cloud['bz'].':'.$value['id'].':'.$cloud['root'],
'type'=>'disk',
'fsperm'=>perm_FolderSPerm::flagPower($cloud['bz']),
'perm'=>perm_binPerm::getGroupPower('all'),
'flag'=>$cloud['bz'],
'iconview'=>1,
'disp'=>'0',
);
return $data;
}
public function fetch_all_by_id($ids){
$data=array();
foreach($ids as $id){
$value=self::fetch_by_id($id);
$data[$value['fid']]=$value;
}
return $data;
}
public function delete_by_id($id){
$return=array();
$data=parent::fetch($id);
if(parent::delete($id)){
$return['msg']='success';
//C::t('source_shortcut')->delete_by_bz($data['bz'].':'.$id.':',true);//删除快捷方式;
//删除图片缓存文件
$imgcache=getglobal('setting/attachdir').'./imgcache/'.$data['bz'].'/'.$id.'/';
removedirectory($imgcache);
}
return $return;
}
public function delete_by_uid($uid){
if(!$uid) return 0;
foreach(DB::fetch_all("select id from %t where uid=%d",array($this->_table,$uid)) as $value){
self::delete_by_id($value['id']);
}
return true;
}
public function delete_by_bz($bz){
foreach(DB::fetch_all("select id from %t where bz=%s",array($this->_table,$bz)) as $value){
self::delete_by_id($value['id']);
}
}
}
?>

View File

@@ -0,0 +1,82 @@
<?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');
}
//所有用户应用
//uid=0 的表示为默认应用
class table_connect_ftp extends dzz_table
{
public function __construct() {
$this->_table = 'connect_ftp';
$this->_pk = 'id';
$this->_pre_cache_key = 'connect_ftp_';
$this->_cache_ttl = 300;
parent::__construct();
}
public function fetch_by_id($id){
$value=self::fetch($id);
$cloud=DB::fetch_first("select * from ".DB::table('connect')." where bz='{$value['bz']}'");
$data=array(
'id'=>$value['id'],
'fid'=>md5($cloud['bz'].':'.$value['id'].':'.$cloud['root']),
'pfid'=>0,
'fname'=>$value['cloudname'],
'ficon'=>'dzz/images/default/system/'.$cloud['bz'].'.png',
'bz'=>$cloud['bz'].':'.$value['id'].':',
'path'=>$cloud['bz'].':'.$value['id'].':'.$cloud['root'],
'type'=>'ftp',
'fsperm'=>perm_FolderSPerm::flagPower($cloud['bz']),
'perm'=>perm_binPerm::getGroupPower('all'),
'flag'=>$cloud['bz'],
'iconview'=>1,
'disp'=>'0',
);
return $data;
}
public function fetch_all_by_id($ids){
$data=array();
foreach($ids as $id){
$value=self::fetch_by_id($id);
$data[$value['fid']]=$value;
}
return $data;
}
public function delete_by_id($id){
$return=array();
$data=parent::fetch($id);
if(parent::delete($id)){
$return['msg']='success';
//C::t('source_shortcut')->delete_by_bz($data['bz'].':'.$id.':',true);//删除快捷方式;
//删除图片缓存文件
$imgcache=getglobal('setting/attachdir').'./imgcache/'.$data['bz'].'/'.$id.'/';
removedirectory($imgcache);
}
return $return;
}
public function delete_by_uid($uid){
if(!$uid) return 0;
foreach(DB::fetch_all("select id from %t where uid=%d",array($this->_table,$uid)) as $value){
self::delete_by_id($value['id']);
}
return true;
}
public function delete_by_bz($bz){
foreach(DB::fetch_all("select id from %t where bz=%s",array($this->_table,$bz)) as $value){
self::delete_by_id($value['id']);
}
}
}
?>

View File

@@ -0,0 +1,83 @@
<?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');
}
//所有用户应用
//uid=0 的表示为默认应用
class table_connect_onedrive extends dzz_table
{
public function __construct() {
$this->_table = 'connect_onedrive';
$this->_pk = 'id';
$this->_pre_cache_key = 'connect_onedrive_';
$this->_cache_ttl = 300;
parent::__construct();
}
public function fetch_by_id($id){
$value=self::fetch($id);
$cloud=DB::fetch_first("select * from ".DB::table('connect')." where bz='{$value['bz']}'");
if(!$value['cloudname']) $value['cloudname']=$cloud['name'].':'.($value['cusername']?$value['cusername']:$cloud['cuid']);
$data=array(
'id'=>$value['id'],
'fid'=>md5($cloud['bz'].':'.$value['id'].':'.$cloud['root']),
'pfid'=>0,
'fname'=>$value['cloudname'],
'ficon'=>'dzz/images/default/system/'.$cloud['bz'].'.png',
'bz'=>$cloud['bz'].':'.$value['id'].':',
'path'=>$cloud['bz'].':'.$value['id'].':'.$cloud['root'],
'type'=>'pan',
'fsperm'=>perm_FolderSPerm::flagPower($cloud['bz']),
'perm'=>perm_binPerm::getGroupPower('all'),
'flag'=>$cloud['bz'],
'iconview'=>1,
'disp'=>'0',
);
return $data;
}
public function fetch_all_by_id($ids){
$data=array();
foreach($ids as $id){
$value=self::fetch_by_id($id);
$data[$value['fid']]=$value;
}
return $data;
}
public function delete_by_id($id){
$return=array();
$data=parent::fetch($id);
if(parent::delete($id)){
$return['msg']='success';
//C::t('source_shortcut')->delete_by_bz($data['bz'].':'.$id.':',true);//删除快捷方式;
//删除图片缓存文件
$imgcache=getglobal('setting/attachdir').'./imgcache/'.$data['bz'].'/'.$id.'/';
removedirectory($imgcache);
}
return $return;
}
public function delete_by_uid($uid){
if(!$uid) return 0;
foreach(DB::fetch_all("select id from %t where uid=%d",array($this->_table,$uid)) as $value){
self::delete_by_id($value['id']);
}
return true;
}
public function delete_by_bz($bz){
foreach(DB::fetch_all("select id from %t where bz=%s",array($this->_table,$bz)) as $value){
self::delete_by_id($value['id']);
}
}
}
?>

View File

@@ -0,0 +1,83 @@
<?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');
}
//所有用户应用
//uid=0 的表示为默认应用
class table_connect_pan extends dzz_table
{
public function __construct() {
$this->_table = 'connect_pan';
$this->_pk = 'id';
$this->_pre_cache_key = 'connect_pan_';
$this->_cache_ttl = 300;
parent::__construct();
}
public function fetch_by_id($id){
$value=self::fetch($id);
$cloud=DB::fetch_first("select * from ".DB::table('connect')." where bz='{$value['bz']}'");
if(!$value['cloudname']) $value['cloudname']=$cloud['name'].':'.($value['cusername']?$value['cusername']:$cloud['cuid']);
$data=array(
'id'=>$value['id'],
'fid'=>md5($cloud['bz'].':'.$value['id'].':'.$cloud['root']),
'pfid'=>0,
'fname'=>$value['cloudname'],
'ficon'=>'dzz/images/default/system/'.$cloud['bz'].'.png',
'bz'=>$cloud['bz'].':'.$value['id'].':',
'path'=>$cloud['bz'].':'.$value['id'].':'.$cloud['root'],
'type'=>'pan',
'fsperm'=>perm_FolderSPerm::flagPower($cloud['bz']),
'perm'=>perm_binPerm::getGroupPower('all'),
'flag'=>$cloud['bz'],
'iconview'=>1,
'disp'=>'0',
);
return $data;
}
public function fetch_all_by_id($ids){
$data=array();
foreach($ids as $id){
$value=self::fetch_by_id($id);
$data[$value['fid']]=$value;
}
return $data;
}
public function delete_by_id($id){
$return=array();
$data=parent::fetch($id);
if(parent::delete($id)){
$return['msg']='success';
//C::t('source_shortcut')->delete_by_bz($data['bz'].':'.$id.':',true);//删除快捷方式;
//删除图片缓存文件
$imgcache=getglobal('setting/attachdir').'./imgcache/'.$data['bz'].'/'.$id.'/';
removedirectory($imgcache);
}
return $return;
}
public function delete_by_uid($uid){
if(!$uid) return 0;
foreach(DB::fetch_all("select id from %t where uid=%d",array($this->_table,$uid)) as $value){
self::delete_by_id($value['id']);
}
return true;
}
public function delete_by_bz($bz){
foreach(DB::fetch_all("select id from %t where bz=%s",array($this->_table,$bz)) as $value){
self::delete_by_id($value['id']);
}
}
}
?>

View File

@@ -0,0 +1,84 @@
<?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');
}
//所有用户应用
//uid=0 的表示为默认应用
class table_connect_storage extends dzz_table
{
public function __construct() {
$this->_table = 'connect_storage';
$this->_pk = 'id';
/*$this->_pre_cache_key = 'connect_storage_';
$this->_cache_ttl = 0;*/
parent::__construct();
}
public function fetch_by_id($id){
$value=self::fetch($id);
$cloud=DB::fetch_first("select * from ".DB::table('connect')." where bz='{$value['bz']}'");
$value['access_id']=authcode($value['access_id'],'DECODE',$value['bz'])?authcode($value['access_id'],'DECODE',$value['bz']):$value['access_id'];
if(!$value['cloudname']) $value['cloudname']=$cloud['name'].':'.($value['bucket']?$value['bucket']:cutstr($value['access_id'], 4, ''));
if($value['bucket']) $value['bucket'].='/';
$data=array(
'id'=>$value['id'],
'fid'=>md5($cloud['bz'].':'.$value['id'].':'.$value['bucket']),
'pfid'=>0,
'fname'=>$value['cloudname'],
'ficon'=>'dzz/images/default/system/'.$cloud['bz'].'.png',
'bz'=>$cloud['bz'].':'.$value['id'].':',
'path'=>$cloud['bz'].':'.$value['id'].':'.$value['bucket'],
'type'=>'storage',
'fsperm'=>$value['bucket']?'0':perm_FolderSPerm::flagPower($cloud['bz'].'_root'),
'perm'=>perm_binPerm::getGroupPower('all'),
'flag'=>$cloud['bz'],
'iconview'=>1,
'disp'=>'0',
);
return $data;
}
public function fetch_all_by_id($ids){
$data=array();
foreach($ids as $id){
if($value=self::fetch_by_id($id)) $data[$value['fid']]=$value;
}
return $data;
}
public function delete_by_id($id){
//删除此应用的快捷方式
$return=array();
$data=parent::fetch($id);
if(parent::delete($id)){
$return['msg']='success';
//C::t('source_shortcut')->delete_by_bz($data['bz'].':'.$id.':',true);//删除快捷方式;
//删除图片缓存文件
$imgcache=getglobal('setting/attachdir').'./imgcache/'.$data['bz'].'/'.$id.'/';
removedirectory($imgcache);
}
return $return;
}
public function delete_by_uid($uid){
if(!$uid) return 0;
foreach(DB::fetch_all("select id from %t where uid=%d",array($this->_table,$uid)) as $value){
self::delete_by_id($value['id']);
}
return true;
}
public function delete_by_bz($bz){
foreach(DB::fetch_all("select id from %t where bz=%s",array($this->_table,$bz)) as $value){
self::delete_by_id($value['id']);
}
}
}
?>

View File

@@ -0,0 +1,102 @@
<?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');
}
//所有用户应用
//uid=0 的表示为默认应用
class table_local_router extends dzz_table
{
public function __construct() {
$this->_table = 'local_router';
$this->_pk = 'routerid';
//$this->_pre_cache_key = 'local_router_';
//$this->_cache_ttl = 0;
parent::__construct();
}
public function fetch_by_routerid($routerid){
$data=self::fetch($routerid);
$data['router']=unserialize($data['router']);
$data['drouter']=self::getRouterDetail($data['router']);
return $data;
}
public function fetch_all_orderby_priority($available=false){
$data=array();
$where='1';
if($available){
$where.=' and `available`>0';
}
foreach(DB::fetch_all("SELECT * FROM %t WHERE $where ORDER BY priority DESC ",array($this->_table)) as $value){
$value['router']=unserialize($value['router']);
$value['drouter']=self::getRouterDetail($value['router']);
$data[$value['routerid']]=$value;
}
return $data;
}
public function getRouterDetail($router){
$html='';
foreach($router as $type =>$value){
switch($type){
case 'exts':
if($value) $html.="文件后缀:".implode(',',$value);
else $html.="文件后缀:不限制";
break;
case 'size':
$sizearr=array();
if(is_numeric($value['lt'])) $sizearr[]="大于".formatsize($value['lt']*1024*1024);
if(is_numeric($value['gt'])) $sizearr[]="小于".formatsize($value['gt']*1024*1024);
if($sizearr) $html.='<br>文件大小:'.implode(' and ',$sizearr);
else $html.='<br>文件大小:不限制';
break;
}
}
return $html;
}
public function insert($setarr){
$setarr['router']=serialize($setarr['router']);
return parent::insert($setarr,1);
}
public function update($routerid,$setarr){
if($setarr['router']) $setarr['router']=serialize($setarr['router']);
return parent::update($routerid,$setarr);
}
public function delete_by_remoteid($remoteid){
return DB::delete($this->_table,"remoteid='{$remoteid}'");
}
//根据路由规则筛选出存储位置
public function getRemoteId($data){
$remoteid=0;
$guize=self::fetch_all_orderby_priority(true);
foreach($guize as $value){
//没有此存储位置
if(!$ldata = C::t('local_storage')->fetch($value['remoteid'])){
continue;
}else{
$available = DB::result_first("select available from %t where bz = %s", array('connect',$ldata['bz']));
if($available <1) continue;
}
//云停用跳转
if($available<1) continue;
if($value['router']['exts']){
if(!in_array(strtolower($data['filetype']),$value['router']['exts'])) continue;
}
if(is_numeric($value['router']['size']['lt']) && $data['filesize']<$value['router']['size']['lt']*1024*1024) continue;
if(is_numeric($value['router']['size']['gt']) && $data['filesize']>$value['router']['size']['gt']*1024*1024) continue;
return $value['remoteid'];
}
return $remoteid;
}
}
?>

View File

@@ -0,0 +1,119 @@
<?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');
}
class table_local_storage extends dzz_table
{
public function __construct() {
$this->_table = 'local_storage';
$this->_pk = 'remoteid';
/*$this->_pre_cache_key = 'local_storage_';
$this->_cache_ttl = 300;*/
parent::__construct();
}
public function fetch_by_remoteid($remoteid){
$remoteid=intval($remoteid);
if(!$data=self::fetch($remoteid)){
return array();
}
if($connect=C::t('connect')->fetch($data['bz'])){
$data=array_merge($connect,$data);
}
if($data['dname'] && $data['did']){
if($pan=C::t($data['dname'])->fetch($data['did'])) $data=array_merge($pan,$data);
}
return $data;
}
public function getBzByRemoteid($remoteid){ //通过remoteid获取bz,默认返回dzz
if(!($data=self::fetch_by_remoteid($remoteid))){
return 'dzz';
}
if($data['type']=='pan') $bz=$data['bz'].':'.$data['id'].':'.$data['root'];
elseif($data['type']=='storage') $bz=$data['bz'].':'.$data['id'].':'.$data['bucket'];
elseif($data['type']=='ftp') $bz=$data['bz'].':'.$data['id'].':'.$data['root'];
elseif($data['type']=='disk') $bz=$data['bz'].':'.$data['id'].':'.$data['root'];
else $bz='dzz';
return $bz;
}
public function fetch_all_orderby_disp(){
$data=array();
foreach(DB::fetch_all("SELECT s.*,c.available FROM %t s LEFT JOIN %t c ON c.bz=s.bz WHERE 1 ORDER BY s.disp ",array($this->_table,'connect')) as $value){
$data[$value['remoteid']]=$value;
}
return $data;
}
public function update_usesize_by_remoteid($remoteid,$ceof){
if(!$remoteid) $remoteid=DB::result_first("select remoteid from %t where bz='dzz' limit 1",array($this->_table));
$ceof=intval($ceof);
try{
if($ceof>0){
DB::query("update %t set usesize=usesize+%d where remoteid=%d",array($this->_table,$ceof,$remoteid));
}else{
DB::query("update %t set usesize=usesize-%d where remoteid=%d",array($this->_table,abs($ceof),$remoteid));
}
$this->clear_cache($remoteid);
}catch(Exception $e){}
return true;
}
public function update_sizecount_by_remoteid($remoteid){
if($arr=self::getQuota($remoteid)){
self::update($remoteid,$arr);
return $arr;
}
return false;
}
public function getQuota($remoteid){
global $_G;
$data=self::fetch_by_remoteid($remoteid);
$return=array();
if($data['type']=='local'){
$return['usesize']=C::t('attachment')->getSizeByRemote($remoteid);
$return['totalsize']=disk_free_space($_G['setting']['attachdir']);
}elseif($data['type']=='pan'){
$bz=$data['bz'].':'.$data['id'].':';
$arr=IO::getQuota($bz);
$return['usesize']=C::t('attachment')->getSizeByRemote($remoteid);
if(is_numeric($arr['quota']) && is_numeric($arr['used'])) $return['totalsize']=($arr['quota'])-($arr['used']);
}elseif($data['type']=='storage'){
$return['usesize']=C::t('attachment')->getSizeByRemote($remoteid);
$return['totalsize']=0;
}elseif($data['type']=='ftp'){
$bz=$data['bz'].':'.$data['id'].':';
$return['usesize']=C::t('attachment')->getSizeByRemote($remoteid);
$return['totalsize']=0;
}elseif($data['type']=='disk'){
$bz=$data['bz'].':'.$data['id'].':';
$return['usesize']=C::t('attachment')->getSizeByRemote($remoteid);
$return['totalsize']=disk_free_space($data['attachdir']);
}else{
$return['usesize']=C::t('attachment')->getSizeByRemote($remoteid);
$return['totalsize']=0;
}
return $return;
}
public function delete_by_remoteid($remoteid){
$data=self::fetch($remoteid);
if($data['bz']=='dzz') return array('error'=>'内置,不能删除');
if(C::t('attachment')->getSizeByRemote($remoteid)>0) return array('error'=>'有文件未迁移,不能删除');
C::t('local_router')->delete_by_remoteid($remoteid);
if($data['dname'] && $data['did']) C::t($data['dname'])->delete_by_id($data['did']);//删除链接
return self::delete($remoteid);
}
public function getRemoteId(){
return DB::result_first("select s.remoteid from ".DB::table('local_storage')." s LEFT JOIN ".DB::table('connect')." c ON s.bz=c.bz where c.available>0 order by s.isdefault DESC, s.disp ASC");
}
}
?>

View File

@@ -0,0 +1,432 @@
<?php
if (!defined('IN_OAOOA')) {
exit('Access Denied');
}
class table_pichome_collectlist extends dzz_table
{
public function __construct()
{
$this->_table = 'pichome_collectlist';
$this->_pk = 'id';
$this->_pre_cache_key = 'pichome_collectlist';
$this->_cache_ttl = 3600;
parent::__construct();
}
//添加收藏
public function add_collect($data){
$perm = C::t('pichome_collectuser')->get_perm_by_clid($data['clid']);
if($perm < 2){
return array('error'=>'no_perm');
}
if(empty($data['rid'])) return true;
$existsdata = DB::fetch_all("select rid from %t where rid in(%n) and clid = %d and cid = %d",array($this->_table,$data['rid'],$data['clid'],$data['cid']));
$existsrids = [];
foreach($existsdata as $v){
$existsrids[] = $v['rid'];
}
$totalcount = count($data['rid']);
$data['rid'] = array_diff($data['rid'],$existsrids);
if(empty($data['rid'])) return true;
//记录加入收藏个数
$counti = 0;
$namesarr = [];
foreach(DB::fetch_all("select appid,rid,name from %t where rid in(%n)",array('pichome_resources',$data['rid'])) as $v){
$setarr = [
'rid'=>$v['rid'],
'cid'=>$data['cid'],
'clid'=>$data['clid'],
'uid'=>$data['uid'],
'username'=>$data['username'],
'dateline'=>$data['dateline'],
'appid'=>$v['appid'],
];
$namesarr[] = $v['name'];
if(parent::insert($setarr,1)) $counti += 1;
}
if($counti){
$filenamearr = array_slice($namesarr,0,5);
$filename = implode(',',$filenamearr).'等'.$totalcount.'个文件';
//如果收藏有分类增加该分类下文件数
$position = DB::result_first("select name from %t where clid = %d",array('pichome_collect',$data['clid']));
if($data['cid']){
C::t('pichome_collectcat')->add_filenum_by_cid($data['cid'],$counti);
$pathkey = DB::result_first("select pathkey from %t where cid = %d",array('pichome_collectcat',$data['cid']));
$pathkey = str_replace('_','',$pathkey);
$patharr = explode('-',$pathkey);
foreach(DB::fetch_all("select catname from %t where cid in(%n)",array('pichome_collectcat',$patharr)) as $v){
$position .= '/'.$v['catname'];
}
}
C::t('pichome_collect')->add_filenum_by_clid($data['clid'],$counti);
$enventbodydata = ['username'=>getglobal('username'),'filename'=>$filename,'collectname'=>$position,'rids'=> $data['rid']];
$enventdata = [
'eventbody' =>'collectfile' ,
'uid' => getglobal('uid'),
'username' => getglobal('username'),
'bodydata' => json_encode($enventbodydata),
'clid' =>$data['clid'],
'cid' =>($data['cid']) ? $data['cid']:0,
'do' => 'collect_file',
'do_obj' =>$filename,
'dateline'=>TIMESTAMP
];
C::t('pichome_collectevent')->insert($enventdata);
}
$this->update_collect_thumb($data['clid']);
return true;
}
public function delete($id){
if(!is_array($id)) $id = (array)$id;
if(parent::delete($id)){
//删除对应分享
if(!empty($id))DB::delete('pichome_share','filepath in('.dimplode($id).') and stype = 1');
}
return true;
}
//取消收藏
public function cancle_filecollect($lids,$clid,$cid = 0){
$perm = C::t('pichome_collectuser')->get_perm_by_clid($clid);
if($perm < 2){
return array('error'=>'no_perm');
}
if(!is_array($lids)) $lids = (array)$lids;
if(empty($lids)) return true;
$counti = 0;
$rids = [];
foreach(DB::fetch_all("select rid,id,cid,clid from %t where id in(%n)",array($this->_table,$lids)) as $v){
$rids[] = $v['rid'];
if($this->delete($v['id'])){
$counti += 1;
C::t('pichome_collectcat')->add_filenum_by_cid($v['cid'],-1);
C::t('pichome_collect')->add_filenum_by_clid($v['clid'],-1);
}
}
$position = DB::result_first("select name from %t where clid = %d",array('pichome_collect',$clid));
if($cid){
$pathkey = DB::result_first("select pathkey from %t where cid = %d",array('pichome_collectcat',$cid));
$pathkey = str_replace('_','',$pathkey);
$patharr = explode('-',$pathkey);
foreach(DB::fetch_all("select catname from %t where cid in(%n)",array('pichome_collectcat',$patharr)) as $v){
$position .= '/'.$v['catname'];
}
}
$namesarr = [];
foreach(DB::fetch_all("select name from %t where rid in(%n) limit 0,5",array('pichome_resources',$rids)) as $v){
$namesarr[] = $v['name'];
}
$filename = implode(',',$namesarr).'等'.$counti.'个文件';
$enventbodydata = ['username'=>getglobal('username'),'filename'=>$filename,'collectname'=>$position,'rid'=>$rids];
$enventdata = [
'eventbody' =>'canclecollectfile' ,
'uid' => getglobal('uid'),
'username' => getglobal('username'),
'bodydata' => json_encode($enventbodydata),
'clid' =>$clid,
'cid' =>($cid) ? $cid:0,
'do' => 'cancle_collectfile',
'do_obj' =>$filename,
'dateline'=>TIMESTAMP
];
C::t('pichome_collectevent')->insert($enventdata);
$this->update_collect_thumb($clid);
return true;
}
//更新收藏夹缩略图
public function update_collect_thumb($clid){
$first = false;
$collectdata = C::t('pichome_collect')->fetch($clid);
if(!C::t('pichome_collectlist')->fetch($collectdata['lid'])){
$first = true;
}else{
$first = false;
}
$setarr = [];
if($first){
//取得第一张图
$firstdata = DB::fetch_first("select * from %t where clid = %d order by id asc",array($this->_table,$clid));
if($firstdata){
$icondatas = C::t('pichome_resources')->geticondata_by_rid($firstdata['rid']);
$setarr['covert'] = $icondatas['icondata'];
$setarr['lid'] = $firstdata['id'];
}else{
$setarr['covert'] = '';
$setarr['lid'] = 0;
}
}
//取得最新两张图
$i = 2;
$coverdata = DB::fetch_all("select rid,id from %t where clid = %d order by id desc limit 0,2",array($this->_table,$clid));
$count = count($coverdata);
if($count == 0){
$setarr['covert1'] = '';
$setarr['covert2'] = '';
$setarr['lid1'] = 0;
$setarr['lid2'] = 0;
}elseif($count ==1) {
foreach ($coverdata as $v) {
$icondatas = C::t('pichome_resources')->geticondata_by_rid($v['rid']);
$setarr['covert' . $i] = $icondatas['icondata'];
$setarr['lid' . $i] = $v['id'];
$i--;
}
$setarr['covert2'] = '';
$setarr['lid2'] = 0;
}else{
foreach($coverdata as $v){
$icondatas = C::t('pichome_resources')->geticondata_by_rid($v['rid']);
$setarr['covert'.$i] = $icondatas['icondata'];
$setarr['lid'.$i] = $v['id'];
$i--;
}
}
C::t('pichome_collect')->update($clid,$setarr);
return true;
}
//删除收藏夹所有文件
public function delete_by_clid($clid){
return DB::delete($this->_table,array('clid'=>$clid));
}
//移动文件到某收藏
public function move_collectfile($lids,$oclid,$ocid=0){
if(!is_array($lids)) $lids = (array)$lids;
if(empty($lids)) return true;
$total = count($lids);
$cids = [];
$clid = 0;
$counti = 0;
$rids=[];
foreach(DB::fetch_all("select * from %t where id in(%n)",array('pichome_collectlist',$lids)) as $v){
$cids[] = $v['cid'];
$clid = $v['clid'];
//如果收藏位置相同则不做任何处理
if($v['clid'] == $oclid && $v['cid'] == $ocid){
/* if(parent::delete($v['id'])){
//收藏夹文件数和分类数减1
if($v['cid']) C::t('pichome_collectcat')->add_filenum_by_cid($v['cid'],-1);
if($v['clid'])C::t('pichome_collect')->add_filenum_by_clid($v['clid'],-1);
}*/
continue;
}else{
//如果该收藏文件在目标位置已经存在则删除原收藏位置文件
if($id = DB::result_first("select id from %t where rid = %s and clid = %d and cid = %d",
array($this->_table,$v['rird'],$oclid,$ocid))){
$this->delete($id);
C::t('pichome_collect')->add_filenum_by_clid($clid,-1);
if($v['cid'])C::t('pichome_collectcat')->add_filenum_by_cid($v['cid'],-1);
}else{
$setarr = [
'uid'=>getglobal('uid'),
'username'=>getglobal('username'),
'clid'=>$oclid,
'cid'=>$ocid
];
/* echo $ocid;
print_r($v);die;*/
//更新数据
if(parent::update($v['id'],$setarr)){
//如果移动位置不在一个收藏夹
if($v['clid'] != $oclid){
//增加移入收藏夹文件数
C::t('pichome_collect')->add_filenum_by_clid($oclid,1);
if($v['clid']) C::t('pichome_collect')->add_filenum_by_clid($clid,-1);
}
if($v['cid'])C::t('pichome_collectcat')->add_filenum_by_cid($v['cid'],-1);
$counti++;
//增加移入分类文件数
if($ocid)C::t('pichome_collectcat')->add_filenum_by_cid($ocid,1);
}
}
}
$rids[] = $v['rid'];
}
//如果移动文件位置cid为多个则不记入动态
$cids = array_unique($cids);
if(count($cids) == 1) $cid = $cids[0];
else $cid = 0;
$namesarr = [];
foreach(DB::fetch_all("select name from %t where rid in(%n) limit 0,5",array('pichome_resources',$rids)) as $v){
$namesarr[] = $v['name'];
}
$filename = implode(',',$namesarr).'等'.$total.'个文件';
$oposition = DB::result_first("select name from %t where clid = %d",array('pichome_collect',$oclid));
if($ocid){
$pathkey = DB::result_first("select pathkey from %t where cid = %d",array('pichome_collectcat',$ocid));
$pathkey = str_replace('_','',$pathkey);
$patharr = explode('-',$pathkey);
foreach(DB::fetch_all("select catname from %t where cid in(%n)",array('pichome_collectcat',$patharr)) as $v){
$oposition .= '/'.$v['catname'];
}
}
//更新移出收藏文件数
$position = DB::result_first("select name from %t where clid = %d",array('pichome_collect',$clid));
if($cid){
$pathkey = DB::result_first("select pathkey from %t where cid = %d",array('pichome_collectcat',$cid));
$pathkey = str_replace('_','',$pathkey);
$patharr = explode('-',$pathkey);
foreach(DB::fetch_all("select catname from %t where cid in(%n)",array('pichome_collectcat',$patharr)) as $v){
$position .= '/'.$v['catname'];
}
}
//移入动态
$enventbodydata = ['username'=>getglobal('username'),'filename'=>$filename,'collectname'=>$position,'newcolletname'=>$oposition,'rid'=>$rids];
$enventdata = [
'eventbody' =>'movecollectfileto' ,
'uid' => getglobal('uid'),
'username' => getglobal('username'),
'bodydata' => json_encode($enventbodydata),
'clid' =>$oclid,
'cid' =>($ocid) ? $ocid:0,
'do' => 'move_collectfileto',
'do_obj' =>$filename,
'dateline'=>TIMESTAMP
];
C::t('pichome_collectevent')->insert($enventdata);
//更新移入文件收藏缩略图
if($oclid != $clid) $this->update_collect_thumb($oclid);
//移出动态
$enventbodydata = ['username'=>getglobal('username'),'filename'=>$filename,'collectname'=>$position,'newcolletname'=>$oposition,'rid'=>$rids];
$enventdata = [
'eventbody' =>'delcollectfilefrom' ,
'uid' => getglobal('uid'),
'username' => getglobal('username'),
'bodydata' => json_encode($enventbodydata),
'clid' =>$clid,
'cid' =>($cid) ? $cid:0,
'do' => 'del_collectfilefrom',
'do_obj' =>$filename,
'dateline'=>TIMESTAMP
];
C::t('pichome_collectevent')->insert($enventdata);
//更新移出文件收藏缩略图
if($clid && $oclid != $clid) $this->update_collect_thumb($oclid);
return true;
}
//收藏已收藏文件到指定收藏
public function collect_by_lid($lids,$clid,$cid=0){
$perm = C::t('pichome_collectuser')->get_perm_by_clid($clid);
if($perm < 2){
return array('error'=>'no_perm');
}
if(!is_array($lids)) $lids = (array)$lids;
if(empty($lids)) return true;
$rids = [];
foreach(DB::fetch_all("select rid,id from %t where id in(%n)",array($this->_table,$lids)) as $v){
$rids[] = $v['rid'];
}
$existsrids = [];
foreach(DB::fetch_all("select rid from %t where rid in(%n) and clid = %d and cid = %d",array($this->_table,$rids,$clid,$cid)) as $v){
$existsrids[] = $v['rid'];
}
$totalcount = count($rids);
$insertrids = array_diff($rids,$existsrids);
//记录加入收藏个数
$counti = 0;
$namesarr = [];
foreach(DB::fetch_all("select appid,rid,name from %t where rid in(%n)",array('pichome_resources',$insertrids)) as $v){
$setarr = [
'rid'=>$v['rid'],
'cid'=>$cid,
'clid'=>$clid,
'uid'=>getglobal('uid'),
'username'=>getglobal('username'),
'dateline'=>TIMESTAMP,
'appid'=>$v['appid'],
];
$namesarr[] = $v['name'];
if(parent::insert($setarr,1)) $counti += 1;
}
if($counti){
$filenamearr = array_slice($namesarr,0,5);
$filename = implode(',',$filenamearr).'等'.$totalcount.'个文件';
//如果收藏有分类增加该分类下文件数
$position = DB::result_first("select name from %t where clid = %d",array('pichome_collect',$clid));
if($cid){
C::t('pichome_collectcat')->add_filenum_by_cid($cid,$counti);
$pathkey = DB::result_first("select pathkey from %t where cid = %d",array('pichome_collectcat',$cid));
$pathkey = str_replace('_','',$pathkey);
$patharr = explode('-',$pathkey);
foreach(DB::fetch_all("select catname from %t where cid in(%n)",array('pichome_collectcat',$patharr)) as $v){
$position .= '/'.$v['catname'];
}
}
C::t('pichome_collect')->add_filenum_by_clid($clid,$counti);
$enventbodydata = ['username'=>getglobal('username'),'filename'=>$filename,'collectname'=>$position,'rids'=>$rids];
$enventdata = [
'eventbody' =>'collectfile' ,
'uid' => getglobal('uid'),
'username' => getglobal('username'),
'bodydata' => json_encode($enventbodydata),
'clid' =>$clid,
'cid' =>$cid ? $cid:0,
'do' => 'collect_file',
'do_obj' =>$filename,
'dateline'=>TIMESTAMP
];
C::t('pichome_collectevent')->insert($enventdata);
}
$this->update_collect_thumb($clid);
return true;
}
public function delete_by_rids($rids,$uid,$username){
if(!$rids) $rids = (array)$rids;
if(empty($rids)) return true;
$clids = [];
foreach(DB::fetch_all("select * from %t where rid in(%n)",array($this->_table,$rids)) as $v){
$clids[$v['clid']][] = $v['id'];
}
foreach ($clids as $k=>$val){
$clid = $k;
$counti = 0;
$rids = [];
foreach(DB::fetch_all("select rid,id,cid,clid from %t where id in(%n)",array($this->_table,$val)) as $v){
$rids[] = $v['rid'];
if($this->delete($v['id'])){
$counti += 1;
if($v['cid'])C::t('pichome_collectcat')->add_filenum_by_cid($v['cid'],-1);
if($v['clid'])C::t('pichome_collect')->add_filenum_by_clid($v['clid'],-1);
}
}
$position = DB::result_first("select name from %t where clid = %d",array('pichome_collect',$clid));
$namesarr = [];
foreach(DB::fetch_all("select name from %t where rid in(%n) limit 0,5",array('pichome_resources',$rids)) as $v){
$namesarr[] = $v['name'];
}
$filename = implode(',',$namesarr).'等'.$counti.'个文件';
$enventbodydata = ['username'=>getglobal('username'),'filename'=>$filename,'collectname'=>$position,'rid'=>$rids];
$enventdata = [
'eventbody' =>'canclecollectfile' ,
'uid' => $uid,
'username' => $username,
'bodydata' => json_encode($enventbodydata),
'clid' =>$clid,
'cid' =>0,
'do' => 'cancle_collectfile',
'do_obj' =>$filename,
'dateline'=>TIMESTAMP
];
C::t('pichome_collectevent')->insert($enventdata);
$this->update_collect_thumb($clid);
}
return true;
}
}

View File

@@ -0,0 +1,30 @@
<?php
if(!defined('IN_OAOOA')) {
exit('Access Denied');
}
class table_pichome_ffmpeg_record extends dzz_table
{
public function __construct()
{
$this->_table = 'pichome_ffmpeg_record';
$this->_pk = 'rid';
$this->_pre_cache_key = 'pichome_ffmpeg_record';
$this->_cache_ttl = 3600;
parent::__construct();
}
public function insert($setarr,$isforce = 0){
$rid = $setarr['rid'];
if(DB::result_first("select rid from %t where rid = %s",array($this->_table,$rid))){
if(!$isforce) return $rid;
else {
parent::delete($rid);
return parent::insert($setarr);
}
}else{
return parent::insert($setarr);
}
}
}

View File

@@ -1,107 +1,184 @@
<?php <?php
if(!defined('IN_OAOOA')) { if(!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
class table_pichome_folder extends dzz_table class table_pichome_folder extends dzz_table
{ {
public function __construct() public function __construct()
{ {
$this->_table = 'pichome_folder'; $this->_table = 'pichome_folder';
$this->_pk = 'fid'; $this->_pk = 'fid';
$this->_pre_cache_key = 'pichome_folder'; $this->_pre_cache_key = 'pichome_folder';
$this->_cache_ttl = 3600; $this->_cache_ttl = 3600;
parent::__construct(); parent::__construct();
} }
//根据appid删除目录 //根据appid删除目录
public function delete_by_appid($appid){ public function delete_by_appid($appid){
$fids = []; $fids = [];
foreach(DB::fetch_all("select fid from %t where appid = %s",array($this->_table,$appid)) as $v){ foreach(DB::fetch_all("select fid from %t where appid = %s",array($this->_table,$appid)) as $v){
$fids[] = $v['fid']; $fids[] = $v['fid'];
} }
return parent::delete($fids); $hookdata = ['appid'=>$appid];
} Hook::listen("delpichomefolderafter",$hookdata);
//插入和更新目录数据 return parent::delete($fids);
public function insert_folderdata_by_appid($appid,$folderdata,$folderarr = array(),$pfid='',$pathkey=''){ }
foreach ($folderdata as $v) { //插入和更新目录数据
$fid = $v['id'].$appid; public function insert_folderdata_by_appid($appid,$folderdata,$folderarr = array(),$pfid='',$pathkey=''){
$setarr=['fname'=>$v['name'],'dateline'=>TIMESTAMP,'pfid'=>$pfid,'appid'=>$appid,'pathkey'=>$pathkey.$fid]; foreach ($folderdata as $v) {
if($v['coverId']) $setarr['cover'] = $v['coverId'].$appid; $fid = $v['id'].$appid;
if($v['password']) $setarr['password'] = $v['password']; $setarr=['fname'=>$v['name'],'dateline'=>TIMESTAMP,'pfid'=>$pfid,'appid'=>$appid,'pathkey'=>($pathkey)?$pathkey:$fid];
if($v['passwordTips']) $setarr['passwordtips'] = trim($v['passwordTips']); if($v['coverId']) $setarr['cover'] = $v['coverId'].$appid;
//如果已经有该id时更新 if($v['password']) $setarr['password'] = $v['password'];
if($fname = DB::result_first("select fname from %t where fid = %s",array($this->_table,$fid))){ if($v['passwordTips']) $setarr['passwordtips'] = trim($v['passwordTips']);
parent::update($fid,$setarr); //如果已经有该id时更新
$setarr['fid'] = $fid; if($fname = DB::result_first("select fname from %t where fid = %s",array($this->_table,$fid))){
parent::update($fid,$setarr);
}else{ $setarr['fid'] = $fid;
//如果插入数据失败跳过当前层级目录
$setarr['fid'] = $fid; }else{
if(!parent::insert($setarr))continue; //如果插入数据失败跳过当前层级目录
} $setarr['fid'] = $fid;
$folderarr[] = $setarr; if(!$setarr['fname']) continue;
if ($v['children']) { if(!parent::insert($setarr))continue;
$tmpchild = $v['children']; }
foreach($tmpchild as $child){ $folderarr[] = $setarr;
$cfid = $child['id'].$appid; if ($v['children']) {
$setarr=['fname'=>$child['name'],'dateline'=>TIMESTAMP,'pfid'=>$fid,'appid'=>$appid,'pathkey'=>$pathkey.$fid.$cfid]; $tmpchild = $v['children'];
if($child['coverId']) $setarr['cover'] = $child['coverId'].$appid; foreach($tmpchild as $child){
if($child['password']) $setarr['password'] = $child['password']; $cfid = $child['id'].$appid;
if($v['passwordTips']) $setarr['passwordtips'] = trim($child['passwordTips']); $folderarr = $this->insert_folderdata_by_appid($appid,[$child],$folderarr,$fid,($pathkey) ? $pathkey.$cfid:$fid.$cfid);
} }
$folderarr = $this->insert_folderdata_by_appid($appid,$tmpchild,$folderarr,$fid,$pathkey.$fid.$cfid);
} }
} }
return $folderarr; return $folderarr;
} }
//检查目录是否包含密码,多个目录时,只有都包含密码才视为包含密码
public function check_haspasswrod($folderids,$appid){ public function insert_data($setarr){
$haspassword = 0; $fid = $setarr['fid'];
//组合目录id if($fname = DB::result_first("select count(*) from %t where fid = %s",array($this->_table,$setarr['fid']))){
$fids = []; unset($setarr['fid']);
foreach($folderids as $v){ parent::update($fid,$setarr);
$fids[] = $v.$appid; }else{
} parent::insert($setarr);
$haspasswordfids = []; }
foreach($fids as $val){ return $fid;
//查找当前目录及其上级中任意一层包含密码,则视为该目录包含密码 }
if(DB::result_first("select fid from %t where pathkey regexp %s and password != '' ",array($this->_table,'.*'.$val.'$'))){ //检查目录是否包含密码,多个目录时,只有都包含密码才视为包含密码
$haspasswordfids[$val] = 1; public function check_haspasswrod($folderids,$appid){
}else{ $haspassword = 0;
$haspasswordfids[$val] = 0; //组合目录id
} $fids = [];
} foreach($folderids as $v){
foreach($haspasswordfids as $v){ $fids[] = $v.$appid;
if(!$v) { }
$haspassword = 0; $haspasswordfids = [];
break; foreach($fids as $val){
}else{ //查找当前目录及其上级中任意一层包含密码,则视为该目录包含密码
$haspassword = 1; if(DB::result_first("select fid from %t where pathkey regexp %s and password != '' ",array($this->_table,'.*'.$val.'$'))){
} $haspasswordfids[$val] = 1;
} }else{
return $haspassword; $haspasswordfids[$val] = 0;
} }
}
//根据fid判断当前目录及其上机是否有密码如果当前目录不存在则返回2存在密码返回1 foreach($haspasswordfids as $v){
public function check_password_byfid($fid){ if(!$v) {
if($data = parent::fetch($fid)){ $haspassword = 0;
return DB::result_first("select fid from %t where pathkey regexp %s and password != '' ",array($this->_table,'.*'.$fid.'$')) ? 1:0; break;
}else{ }else{
return 2; $haspassword = 1;
} }
} }
//转义查询语句当中的path unset($haspasswordfids);
public function path_transferred_meaning($path){ unset($folderids);
return str_replace(array('\'','(',')','+','^','$','{','}','[',']','#'),array("\'",'\(','\)','\+','\^','\$','\{','\}','\[','\]','\#'),$path); return $haspassword;
} }
public function fetch_all_folder_by_appid($appid,$pfid=''){ //根据fid判断当前目录及其上机是否有密码如果当前目录不存在则返回2存在密码返回1
foreach(DB::fetch_all("select fid,fname from %t where appid = %s and password = '' and pfid = %s",array($this->_table,$appid,$pfid)) as $v){ public function check_password_byfid($fid){
$v['num'] = C::t('pichome_folderresources')->get_sum_by_fid($v['fid']); if($data = parent::fetch($fid)){
$v['children'] = $this->fetch_all_folder_by_appid($appid,$v['fid']); return DB::result_first("select fid from %t where pathkey regexp %s and password != '' ",array($this->_table,'.*'.$fid.'$')) ? 1:0;
$returndata[] = $v; }else{
} return 2;
return $returndata; }
} }
} //转义查询语句当中的path
public function path_transferred_meaning($path){
return str_replace(array('\'','(',')','+','^','$','{','}','[',']','#'),array("\'",'\(','\)','\+','\^','\$','\{','\}','\[','\]','\#'),$path);
}
public function fetch_all_folder_by_appid($appid,$pfid=''){
foreach(DB::fetch_all("select fid,fname from %t where appid = %s and password = '' and pfid = %s",array($this->_table,$appid,$pfid)) as $v){
$v['num'] = C::t('pichome_folderresources')->get_sum_by_fid($v['fid']);
$v['children'] = $this->fetch_all_folder_by_appid($appid,$v['fid']);
$returndata[] = $v;
}
return $returndata;
}
public function fetch_folder_by_appid_pfid($appid,$pfid=[]){
$folderdata = [];
if(!empty($pfid)){
foreach(DB::fetch_all("select fid,fname,pathkey,appid,pfid,filenum as nosubfilenum from %t where appid = %s and pfid in(%n) order by disp asc",array($this->_table,$appid,$pfid)) as $v){
$v['filenum'] = DB::result_first("SELECT count(DISTINCT fr.rid) FROM %t fr
left join %t f on fr.fid = f.fid
where fr.appid = %s and f.pathkey like %s",array('pichome_folderresources','pichome_folder',$appid,$v['pathkey'].'%'));
$v['leaf'] = DB::result_first("select count(*) from %t where pfid = %s",array($this->_table,$v['fid'])) ? false:true;
$folderdata[] = $v;
}
}else{
foreach(DB::fetch_all("select fid,fname,pathkey,appid,pfid,filenum as nosubfilenum from %t where appid = %s and pfid = '' order by disp asc",array($this->_table,$appid)) as $v){
$v['filenum'] = DB::result_first("SELECT count(DISTINCT fr.rid) FROM %t fr
left join %t f on fr.fid = f.fid
where fr.appid = %s and f.pathkey like %s",array('pichome_folderresources','pichome_folder',$appid,$v['pathkey'].'%'));
$v['leaf'] = DB::result_first("select count(*) from %t where pfid = %s",array($this->_table,$v['fid'])) ? false:true;
$folderdata[] = $v;
}
}
return $folderdata;
}
public function search_by_fname($keyword,$appid=''){
$folderdata = [];
$wheresql = ' fname like %s ';
$params = array($this->_table,'%'.$keyword.'%');
if($appid){
$wheresql .= ' and appid = %s ';
$params[] = $appid;
}
foreach(DB::fetch_all("select fname,fid,pathkey,appid,pfid from %t where $wheresql",$params)as $v ){
$folderdata[$v['fid']] = $v;
}
foreach ($folderdata as $k=>$v){
$len=strlen($folderdata[$k]['pathkey']);
$folderdata[$k]['len']=$len;
}
$cloumarr = array_column($folderdata,'len');
array_multisort($cloumarr,SORT_ASC,$folderdata);
return $folderdata;
}
public function createfidbyappid($appid){
$fid = random(13).$appid;
if(DB::result_first("select count(fid) from %t where fid = %s and appid = %s",array($this->_table,$fid,$appid))){
$fid = $this->createfidbyappid($appid);
}
return $fid;
}
public function delete_by_fids($fids){
if(!is_array($fids)) $fids = (array)$fids;
if(!empty($fids)){
DB::delete('pichome_folderresources',"fid in (".dimplode($fids).")");
parent::delete($fids);
return true;
}
}
}

View File

@@ -0,0 +1,24 @@
<?php
if (!defined('IN_OAOOA')) {
exit('Access Denied');
}
class table_pichome_folder_relation extends dzz_table
{
public function __construct()
{
$this->_table = 'pichome_folder_relation';
$this->_pk = 'id';
$this->_pre_cache_key = 'pichome_folder_relation';
$this->_cache_ttl = 3600;
parent::__construct();
}
public function fetch_by_ofid_appid($ofid,$appid){
return DB::fetch_first("select * from %t where nfid = %d and appid = %s",array($this->_table,$ofid,$appid));
}
}

View File

@@ -1,72 +1,77 @@
<?php <?php
if(!defined('IN_OAOOA')) { if(!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
class table_pichome_folderresources extends dzz_table class table_pichome_folderresources extends dzz_table
{ {
public function __construct() public function __construct()
{ {
$this->_table = 'pichome_folderresources'; $this->_table = 'pichome_folderresources';
$this->_pk = 'id'; $this->_pk = 'id';
$this->_pre_cache_key = 'pichome_folderresources'; $this->_pre_cache_key = 'pichome_folderresources';
$this->_cache_ttl = 3600; $this->_cache_ttl = 3600;
parent::__construct(); parent::__construct();
} }
public function insert($setarr){ public function insert($setarr){
if($id = DB::result_first("select id from %t where rid = %s and fid =%s",array($this->_table,$setarr['rid'],$setarr['fid']))){ if($id = DB::result_first("select id from %t where rid = %s and fid =%s and appid = %s",array($this->_table,$setarr['rid'],$setarr['fid'],$setarr['appid']))){
return $id; return $id;
}else{ }else{
return parent::insert($setarr); if($id = DB::result_first("select id from %t where rid = %s and fid = %s and appid = %s",array($this->_table,$setarr['rid'],$setarr['fid'],$setarr['appid']))){
} $rid = $setarr['rid'];
} unset($setarr['rid']);
public function delete_by_appid($appid){ return parent::update($rid,$setarr);
$rids=[]; }
foreach(DB::fetch_all("select rid from %t where appid = %s",array($this->_table,$appid)) as $v){ return parent::insert($setarr);
$rids[] = $v['rid']; }
} }
return parent::delete($rids); public function delete_by_appid($appid){
} $rids=[];
public function delete_by_rid($rid){ foreach(DB::fetch_all("select rid from %t where appid = %s",array($this->_table,$appid)) as $v){
if(!is_array($rid)) $rid = (array) $rid; $rids[] = $v['rid'];
$dids = []; }
foreach(DB::fetch_all("select id from %t where rid in(%n)",array($this->_table,$rid)) as $v){ return parent::delete($rids);
$dids[] = $v['id']; }
} public function delete_by_rid($rid){
return parent::delete($dids); if(!is_array($rid)) $rid = (array) $rid;
} $dids = [];
foreach(DB::fetch_all("select id from %t where rid in(%n)",array($this->_table,$rid)) as $v){
public function fetch_id_by_rid($rid){ $dids[] = $v['id'];
$ids = []; }
foreach(DB::fetch_all("select id from %t where rid = %s",array($this->_table,$rid)) as $v){ return parent::delete($dids);
$ids[] = $v['id']; }
}
return $ids; public function fetch_id_by_rid($rid){
} $ids = [];
public function get_sum_by_fid($fid){ foreach(DB::fetch_all("select id from %t where rid = %s",array($this->_table,$rid)) as $v){
return DB::result_first("select count(rid) from %t where fid=%s",array($this->_table,$fid)); $ids[] = $v['id'];
} }
public function get_sum_by_fids($fids){ return $ids;
if(!is_array($fids)) $fids = (array) $fids; }
$datas = []; public function get_sum_by_fid($fid){
foreach(DB::fetch_all("select fid,count(rid) as num from %t where fid in(%n) group by fid",array($this->_table,$fids)) as $val){ return DB::result_first("select count(rid) from %t where fid=%s",array($this->_table,$fid));
$datas[$val['fid']]= $val['num']; }
} public function get_sum_by_fids($fids){
return $datas; if(!is_array($fids)) $fids = (array) $fids;
} $datas = [];
public function get_foldername_by_rid($rid){ foreach(DB::fetch_all("select fid,count(rid) as num from %t where fid in(%n) group by fid",array($this->_table,$fids)) as $val){
$foldernames = []; $datas[$val['fid']]= $val['num'];
foreach(DB::fetch_all("select f.fid,f.fname from %t fr left join %t f on f.fid=fr.fid where rid = %s",array($this->_table,'pichome_folder',$rid)) as $v){ }
$foldernames[$v['fid']] = $v['fname']; return $datas;
} }
return $foldernames; public function get_foldername_by_rid($rid){
} $foldernames = [];
public function fetch_rid_by_fids($fids,$limit = 6,$rid=''){ foreach(DB::fetch_all("select f.fid,f.fname from %t fr left join %t f on f.fid=fr.fid where rid = %s",array($this->_table,'pichome_folder',$rid)) as $v){
if(!is_array($fids)) $fids = (array) $fids; $foldernames[$v['fid']] = $v['fname'];
$rids = []; }
foreach(DB::fetch_all("select distinct rid from %t where fid in(%n) and rid != %s limit 0,$limit",array($this->_table,$fids,$rid)) as $v){ return $foldernames;
$rids[] = $v['rid']; }
} public function fetch_rid_by_fids($fids,$limit = 6,$rid=''){
return $rids; if(!is_array($fids)) $fids = (array) $fids;
} $rids = [];
foreach(DB::fetch_all("select distinct rid from %t where fid in(%n) and rid != %s limit 0,$limit",array($this->_table,$fids,$rid)) as $v){
$rids[] = $v['rid'];
}
return $rids;
}
} }

View File

@@ -0,0 +1,30 @@
<?php
if(!defined('IN_OAOOA')) {
exit('Access Denied');
}
class table_pichome_imagickrecord extends dzz_table
{
public function __construct()
{
$this->_table = 'pichome_imagickrecord';
$this->_pk = 'rid';
$this->_pre_cache_key = 'pichome_imagickrecord';
$this->_cache_ttl = 3600;
parent::__construct();
}
public function insert($setarr,$isforce = 0){
$rid = $setarr['rid'];
if(DB::result_first("select rid from %t where rid = %s",array($this->_table,$rid))){
if(!$isforce) return $rid;
else {
parent::delete($rid);
return parent::insert($setarr);
}
}else{
return parent::insert($setarr);
}
}
}

View File

@@ -1,109 +1,160 @@
<?php <?php
if(!defined('IN_OAOOA')) { if(!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
class table_pichome_palette extends dzz_table class table_pichome_palette extends dzz_table
{ {
public function __construct() public function __construct()
{ {
$this->_table = 'pichome_palette'; $this->_table = 'pichome_palette';
$this->_pk = 'id'; $this->_pk = 'id';
$this->_pre_cache_key = 'pichome_palette'; $this->_pre_cache_key = 'pichome_palette';
$this->_cache_ttl = 3600; $this->_cache_ttl = 3600;
parent::__construct(); parent::__construct();
} }
//根据appid删除目录 //根据appid删除目录
public function delete_by_appid($appid){ public function delete_by_appid($appid){
$ids = []; $ids = [];
foreach(DB::fetch_all("select id from %t where appid = %s",array($this->_table,$appid)) as $v){ foreach(DB::fetch_all("select id from %t where appid = %s",array($this->_table,$appid)) as $v){
$ids[] = $v['id']; $ids[] = $v['id'];
} }
return parent::delete($ids); return parent::delete($ids);
} }
public function delete_by_rid($rid){ public function delete_by_rid($rid){
if(!is_array($rid)) $rid = (array) $rid; if(!is_array($rid)) $rid = (array) $rid;
$delids = []; $delids = [];
foreach (DB::fetch_all("select id from %t where rid in(%n)",array($this->_table,$rid)) as $v){ foreach (DB::fetch_all("select id from %t where rid in(%n)",array($this->_table,$rid)) as $v){
$delids[] = $v['id']; $delids[] = $v['id'];
} }
return parent::delete($delids); return parent::delete($delids);
} }
public function fetch_rid_by_color($color,$persion=0,$appid='',$limit=6,$rid=''){ public function fetch_rid_by_color($color,$persion=0,$appid='',$limit=6,$rid=''){
//设定基础相似度为80%,当精度调整时相似度根据精度数值相应增加调整范围为0-100,实际计算用20的差异量进行转换 //设定基础相似度为80%,当精度调整时相似度根据精度数值相应增加调整范围为0-100,实际计算用20的差异量进行转换
$similarity = 90+(10/100)*$persion; $similarity = 90+(10/100)*$persion;
//此值为rgb(0,0,0)与rgb(255,255,255)最大色差值,用以计算相似度的被除数 //此值为rgb(0,0,0)与rgb(255,255,255)最大色差值,用以计算相似度的被除数
$maxColDist = 764.8339663572415; $maxColDist = 764.8339663572415;
//获取颜色的rgb,该操作为十六进制转换为rgb //获取颜色的rgb,该操作为十六进制转换为rgb
$rgbcolor = $this->hex2rgb($color); $rgbcolor = $this->hex2rgb($color);
//色差计算公式为sqrt((2 + $rmean / 256) * (pow($r, 2)) + 4 * (pow($g, 2)) + (2 + (255 - $rmean) / 256) * (pow($b, 2))) //色差计算公式为sqrt((2 + $rmean / 256) * (pow($r, 2)) + 4 * (pow($g, 2)) + (2 + (255 - $rmean) / 256) * (pow($b, 2)))
//公式中rgb值为连个rgb的差值$rmean为r值之和的二分之一 //公式中rgb值为连个rgb的差值$rmean为r值之和的二分之一
if($appid){ if($appid){
$sql = 'select distinct p.rid from %t p left join %t r on p.rid = r.rid'; $sql = 'select distinct p.rid from %t p left join %t r on p.rid = r.rid';
$wheresql = " r.appid = %s and p.rid != %s $wheresql = " r.appid = %s and p.rid != %s
and round((%d-sqrt((((2+(p.r+%d)/2)/256)*(pow((%d-p.r),2))+(4*pow((%d-p.g),2)) + (((2+(255-(p.r+%d)/2))/256))*(pow((%d-p.b), 2)))))/%d,4)*100 >= %d "; and round((%d-sqrt((((2+(p.r+%d)/2)/256)*(pow((%d-p.r),2))+(4*pow((%d-p.g),2)) + (((2+(255-(p.r+%d)/2))/256))*(pow((%d-p.b), 2)))))/%d,4)*100 >= %d ";
$ordersql = ' order by round((%d-sqrt((((2+(p.r+%d)/2)/256)*(pow((%d-p.r),2))+(4*pow((%d-p.g),2)) + (((2+(255-(p.r+%d)/2))/256))*(pow((%d-p.b), 2)))))/%d,4)*100*weight '; $ordersql = ' order by round((%d-sqrt((((2+(p.r+%d)/2)/256)*(pow((%d-p.r),2))+(4*pow((%d-p.g),2)) + (((2+(255-(p.r+%d)/2))/256))*(pow((%d-p.b), 2)))))/%d,4)*100*weight ';
$params = array($this->_table,'pichome_resources',$appid,$rid,$maxColDist,$rgbcolor['r'],$rgbcolor['r'],$rgbcolor['g'],$rgbcolor['r'],$rgbcolor['b'],$maxColDist,$similarity, $params = array($this->_table,'pichome_resources',$appid,$rid,$maxColDist,$rgbcolor['r'],$rgbcolor['r'],$rgbcolor['g'],$rgbcolor['r'],$rgbcolor['b'],$maxColDist,$similarity,
$maxColDist,$rgbcolor['r'],$rgbcolor['r'],$rgbcolor['g'],$rgbcolor['r'],$rgbcolor['b'],$maxColDist,$similarity); $maxColDist,$rgbcolor['r'],$rgbcolor['r'],$rgbcolor['g'],$rgbcolor['r'],$rgbcolor['b'],$maxColDist,$similarity);
}else{ }else{
$sql = 'select distinct rid from %t '; $sql = 'select distinct rid from %t ';
$wheresql = " rid != %s $wheresql = " rid != %s
and round((%d-sqrt((((2+(r+%d)/2)/256)*(pow((%d-r),2))+(4*pow((%d-g),2)) + (((2+(255-(r+%d)/2))/256))*(pow((%d-b), 2)))))/%d,4)*100 >= %d "; and round((%d-sqrt((((2+(r+%d)/2)/256)*(pow((%d-r),2))+(4*pow((%d-g),2)) + (((2+(255-(r+%d)/2))/256))*(pow((%d-b), 2)))))/%d,4)*100 >= %d ";
$params = array($this->_table,$rid,$maxColDist,$rgbcolor['r'],$rgbcolor['r'],$rgbcolor['g'],$rgbcolor['r'],$rgbcolor['b'],$maxColDist,$similarity, $params = array($this->_table,$rid,$maxColDist,$rgbcolor['r'],$rgbcolor['r'],$rgbcolor['g'],$rgbcolor['r'],$rgbcolor['b'],$maxColDist,$similarity,
$maxColDist,$rgbcolor['r'],$rgbcolor['r'],$rgbcolor['g'],$rgbcolor['r'],$rgbcolor['b'],$maxColDist,$similarity); $maxColDist,$rgbcolor['r'],$rgbcolor['r'],$rgbcolor['g'],$rgbcolor['r'],$rgbcolor['b'],$maxColDist,$similarity);
} }
$riddata = DB::fetch_all("$sql where $wheresql $ordersql desc limit 0,$limit ",$params); $riddata = DB::fetch_all("$sql where $wheresql $ordersql desc limit 0,$limit ",$params);
$rids= []; $rids= [];
foreach ($riddata as $v){ foreach ($riddata as $v){
$rids[] = $v['rid']; $rids[] = $v['rid'];
} }
return $rids; return $rids;
} }
//转换十六进制颜色为rgb //转换十六进制颜色为rgb
public function hex2rgb($hexColor){ public function hex2rgb($hexColor){
$color=str_replace('#','',$hexColor); $color=str_replace('#','',$hexColor);
if (strlen($color)> 3){ if (strlen($color)> 3){
$rgb=array( $rgb=array(
'r'=>hexdec(substr($color,0,2)), 'r'=>hexdec(substr($color,0,2)),
'g'=>hexdec(substr($color,2,2)), 'g'=>hexdec(substr($color,2,2)),
'b'=>hexdec(substr($color,4,2)) 'b'=>hexdec(substr($color,4,2))
); );
}else{ }else{
$r=substr($color,0,1). substr($color,0,1); $r=substr($color,0,1). substr($color,0,1);
$g=substr($color,1,1). substr($color,1,1); $g=substr($color,1,1). substr($color,1,1);
$b=substr($color,2,1). substr($color,2,1); $b=substr($color,2,1). substr($color,2,1);
$rgb=array( $rgb=array(
'r'=>hexdec($r), 'r'=>hexdec($r),
'g'=>hexdec($g), 'g'=>hexdec($g),
'b'=>hexdec($b) 'b'=>hexdec($b)
); );
} }
return $rgb; return $rgb;
} }
function RGBToHex($rgb){
public function fetch_colordata_by_rid($rid){ $regexp = "/^rgb\(([0-9]{0,3})\,\s*([0-9]{0,3})\,\s*([0-9]{0,3})\)/";
$data = []; $re = preg_match($regexp, $rgb, $match);
foreach(DB::fetch_all("select color,weight from %t where rid = %s",array($this->_table,$rid)) as $v){
$weight = $v['weight']*100; $re = array_shift($match);
$data[$weight] = dechex($v['color']);
} $hexColor = "";
krsort($data);
return $data; $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
}
/* for ($i = 0; $i < 3; $i++) {
*$colors 该参数需带权重,以键为权重值,此处查询优先权重最大的查询近似颜色值 $r = null;
* ***/
public function fetch_rids_by_clolos($colors,$limit=6){ $c = $match[$i];
$rids = [];
//此处颜色值按权重顺序,优先寻找权重最大的,如果权重最大的得到足够数据,则不再查找其它颜色相似数据 $hexAr = array();
foreach($colors as $k=>$v){
foreach($this->fetch_rid_by_color($v) as $v){ while ($c > 16) {
$rids[] = $v; $r = $c % 16;
}
if(count($rids) >= $limit) break; $c = ($c / 16) >> 0;
}
return $rids; array_push($hexAr, $hex[$r]);
}
}
array_push($hexAr, $hex[$c]);
$ret = array_reverse($hexAr);
$item = implode('', $ret);
$item = str_pad($item, 2, '0', STR_PAD_LEFT);
$hexColor .= $item;
}
return $hexColor;
}
public function fetch_colordata_by_rid($rid){
$data = [];
foreach(DB::fetch_all("select r,g,b,weight from %t where rid = %s",array($this->_table,$rid)) as $v){
$rgbdata = 'rgb('.$v['r'].','.$v['g'].','.$v['b'].')';
$weight = $v['weight']*100;
$v['color'] = $this->RGBToHex($rgbdata);
$data[] = ['color'=>$v['color'],'weight'=>$weight];
}
$distance = [];
$colordata = [];
foreach($data as $v){
$distance[] = $v['weight'];
}
array_multisort($distance, SORT_DESC, $data);
foreach($data as $v){
$colordata[] = $v['color'];
}
return $colordata;
}
/*
*$colors 该参数需带权重,以键为权重值,此处查询优先权重最大的查询近似颜色值
* ***/
public function fetch_rids_by_clolos($colors,$limit=6){
$rids = [];
//此处颜色值按权重顺序,优先寻找权重最大的,如果权重最大的得到足够数据,则不再查找其它颜色相似数据
foreach($colors as $k=>$v){
foreach($this->fetch_rid_by_color($v) as $v){
$rids[] = $v;
}
if(count($rids) >= $limit) break;
}
return $rids;
}
} }

View File

@@ -1,235 +1,296 @@
<?php <?php
if (!defined('IN_OAOOA')) { if (!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
class table_pichome_resources extends dzz_table class table_pichome_resources extends dzz_table
{ {
public function __construct() public function __construct()
{ {
$this->_table = 'pichome_resources'; $this->_table = 'pichome_resources';
$this->_pk = 'rid'; $this->_pk = 'rid';
$this->_pre_cache_key = 'pichome_resources'; $this->_pre_cache_key = 'pichome_resources';
$this->_cache_ttl = 3600; $this->_cache_ttl = 3600;
parent::__construct(); parent::__construct();
} }
public function insert($setarr) public function insert($setarr)
{ {
if (DB::result_first("select count(*) from %t where rid = %s", array($this->_table, $setarr['rid']))) { if (DB::result_first("select count(*) from %t where rid = %s", array($this->_table, $setarr['rid']))) {
$rid = $setarr['rid']; $rid = $setarr['rid'];
unset($setarr['rid']); unset($setarr['rid']);
return parent::update($rid, $setarr); parent::update($rid, $setarr);
} else { } else {
return parent::insert($setarr); parent::insert($setarr);
} }
} return true;
}
public function delete_by_appid($appid)
{ public function delete_by_appid($appid)
$rids = []; {
foreach (DB::fetch_all("select rid from %t where appid = %s", array($this->_table, $appid)) as $v) { $data = C::t('pichome_vapp')->fetch($appid);
$rids[] = $v['rid']; //$i = 0;
} $rids = [];
return $this->delete_by_rid($rids); foreach (DB::fetch_all("select rid from %t where appid = %s limit 0,100", array($this->_table, $appid)) as $v) {
} $rids[] = $v['rid'];
}
public function fetch_by_path($path) if ($rids) $this->delete_by_rid($rids, $data['deluid'], $data['delusername']);
{ //return $i;
$path = trim($path); }
return DB::result_first("select * from %t where path = %s", array($this->_table, $path));
} public function fetch_by_path($path)
{
public function delete_by_rid($rids) $path = trim($path);
{ return DB::result_first("select * from %t where path = %s", array($this->_table, $path));
if (!is_array($rids)) $rids = (array)$rids; }
C::t('pichome_resources_attr')->delete_by_rid($rids);
C::t('pichome_folderresources')->delete_by_rid($rids); public function delete_by_rid($rids, $uid = 0, $username = '')
C::t('pichome_palette')->delete_by_rid($rids); {
C::t('pichome_comments')->delete_by_rid($rids); if (!is_array($rids)) $rids = (array)$rids;
C::t('pichome_resourcestag')->delete_by_rid($rids); C::t('pichome_resources_attr')->delete_by_rid($rids);
C::t('pichome_share')->delete_by_rid($rids); C::t('pichome_folderresources')->delete_by_rid($rids);
return parent::delete($rids); C::t('pichome_palette')->delete_by_rid($rids);
} C::t('pichome_comments')->delete_by_rid($rids);
C::t('pichome_resourcestag')->delete_by_rid($rids);
//以rid获取文件缩略图 C::t('pichome_share')->delete_by_rid($rids);
public function get_icon_by_rids($rids) C::t('pichome_ffmpeg_record')->delete($rids);
{ C::t('pichome_imagickrecord')->delete($rids);
if (!is_array($rids)) $rids = (array)$rids; $deldata = ['rids' => $rids, 'deluid' => $uid, 'delusername' => $username];
$icondatas = []; Hook::listen('pichomedatadeleteafter', $deldata);
foreach (DB::fetch_all("select r.rid,r.type,r.hasthumb,ra.path from %t r left join %t ra on r.rid=ra.rid where rid in(%n) ", array($this->_table, $rids)) as $v) {
if ($v['hasthumb']) { return $this->delete($rids);
$filename = str_replace(strrchr($v['name'], "."), "", $v['name']); }
$filepath = dirname($v['path']);
$thumbpath = $filepath . $filename . '_thumb.png';
// if (!file_exists($thumbpath)) $thumbpath = iconv('UTF-8', 'GB2312', $thumbpath); public function fetch_by_rids($rids)
$icondatas[$v['rid']] = $thumbpath; {
} else { global $Opentype;
if ($v['type'] == 'commonimage') { if (!is_array($rids)) $rids = (array)$rids;
$v['icondata'] = $v['path'];
} else { $datas = $tmpdatas = [];
$v['icondata'] = geticonfromext($v['ext'], $v['type']); foreach (parent::fetch_all($rids) as $v) {
} $v['fsize'] = formatsize($v['size']);
} $v['mtime'] = dgmdate(round($v['mtime'] / 1000), 'Y/m/d H:i');
} $v['dateline'] = dgmdate(round($v['dateline'] / 1000), 'Y/m/d H:i');
return $icondatas; $v['name'] = str_replace(strrchr($v['name'], "."), "", $v['name']);
} $v['btime'] = dgmdate(round($v['btime'] / 1000), 'Y/m/d H:i');
$v['dpath'] = dzzencode($v['rid'], '', 0, 0);
public function fetch_by_rids($rids) if (in_array($v['ext'], $Opentype['video'])) {
{ $v['opentype'] = 'video';
global $Opentype; } elseif (in_array($v['ext'], $Opentype['text'])) {
if (!is_array($rids)) $rids = (array)$rids; $v['opentype'] = 'text';
} elseif (in_array($v['ext'], $Opentype['pdf'])) {
$datas = $tmpdatas = []; $v['opentype'] = 'pdf';
foreach (parent::fetch_all($rids) as $v) { } elseif (in_array($v['ext'], $Opentype['image'])) {
$v['fsize'] = formatsize($v['size']); $v['opentype'] = 'image';
$v['mtime'] = dgmdate(round($v['mtime'] / 1000), 'Y/m/d H:i'); } else {
$v['dateline'] = dgmdate(round($v['dateline'] / 1000), 'Y/m/d H:i'); $v['opentype'] = 'other';
$v['name'] = str_replace(strrchr($v['name'], "."), "", $v['name']); }
$v['btime'] = dgmdate(round($v['btime'] / 1000), 'Y/m/d H:i'); $tmpdatas[$v['rid']] = $v;
$v['dpath'] = dzzencode($v['rid'], '', 0); }
if (in_array($v['ext'], $Opentype['video'])) { foreach ($rids as $rid) {
$v['opentype'] = 'video'; $datas[$rid] = $tmpdatas[$rid];
} elseif (in_array($v['ext'], $Opentype['text'])) { }
$v['opentype'] = 'text'; foreach (C::t('pichome_resources_attr')->fetch_all($rids) as $v) {
} elseif (in_array($v['ext'], $Opentype['pdf'])) { $datas[$v['rid']]['path'] = $v['path'];
$v['opentype'] = 'pdf'; //$datas[$v['rid']]['hasthumb'] = $v['hasthumb'];
} elseif (in_array($v['ext'], $Opentype['image'])) { $colorsarr = [];
$v['opentype'] = 'image'; //获取颜色数据
} else { $colordata = C::t('pichome_palette')->fetch_colordata_by_rid($v['rid']);
$v['opentype'] = 'other'; foreach ($colordata as $cv) {
} $colorsarr[] = $cv;
$tmpdatas[$v['rid']] = $v; }
} $datas[$v['rid']]['color'] = $colorsarr[0];
foreach($rids as $rid){ $datas[$v['rid']]['link'] = $v['link'];
$datas[$rid] = $tmpdatas[$rid]; }
} //array_multisort($datas, 'rid', SORT_ASC, $rids);
foreach (C::t('pichome_resources_attr')->fetch_all($rids) as $v) { foreach (C::t('pichome_resourcestag')->fetch_all_tag_by_rids($rids) as $k => $v) {
if ($datas[$v['rid']]['hasthumb']) { $datas[$k]['tags'] = $v;
// $datas[$k]['tags'] = '•'.implode('•',$v);
$filepath = dirname($v['path']); }
$filename = substr($v['path'],strrpos($v['path'],'/')+1);
$filename = str_replace(strrchr($filename, "."),"",$filename); return $datas;
$thumbpath = 'library/' . $filepath . '/' . $filename . '_thumbnail.png'; }
$datas[$v['rid']]['icondata'] = str_replace('+',' ',urlencode($thumbpath));
} //获取数据后端使用
else { public function fetch_data_by_rid($rid)
if ($datas[$v['rid']]['type'] == 'commonimage') { {
$datas[$v['rid']]['icondata'] = str_replace('+',' ',urlencode('library/' . $v['path']));
} else { if (!$resourcesdata = parent::fetch($rid)) return array();
$datas[$v['rid']]['icondata'] = geticonfromext($datas[$v['rid']]['ext'], $datas[$v['rid']]['type']); if ($resourcesdata['isdelete'] > 0) return array();
} $downshare = C::t('pichome_vapp')->fetch_all_sharedownlod();
} if ($downshare[$resourcesdata['appid']]['isdelete']) return array();
$datas[$v['rid']]['realpath'] = str_replace('+',' ',urlencode('library/' . $v['path'])); $attrdata = C::t('pichome_resources_attr')->fetch($rid);
$colorsarr = []; $resourcesdata = array_merge($resourcesdata, $attrdata);
//获取颜色数据 $resourcesdata['realpath'] = $downshare[$resourcesdata['appid']]['path'] . BS . $resourcesdata['path'];
$colordata = C::t('pichome_palette')->fetch_colordata_by_rid($v['rid']); return $resourcesdata;
foreach ($colordata as $cv) { }
$colorsarr[] = $cv;
} public function fetch_by_rid($rid)
$datas[$v['rid']]['color'] = $colorsarr[0]; {
$datas[$v['rid']]['link'] = $v['link']; global $Opentype;
} if (!$resourcesdata = parent::fetch($rid)) return array();
//array_multisort($datas, 'rid', SORT_ASC, $rids); if ($resourcesdata['isdelete'] > 0) return array();
foreach (C::t('pichome_resourcestag')->fetch_all_tag_by_rids($rids) as $k => $v) { //获取所有库分享和下载权限
$datas[$k]['tags'] = $v; $downshare = C::t('pichome_vapp')->fetch_all_sharedownlod();
// $datas[$k]['tags'] = '•'.implode('•',$v); $attrdata = C::t('pichome_resources_attr')->fetch($rid);
} if ($attrdata['desc']) $attrdata['desc'] = strip_tags($attrdata['desc']);
$resourcesdata = array_merge($resourcesdata, $attrdata);
return $datas; $resourcesdata['colors'] = C::t('pichome_palette')->fetch_colordata_by_rid($rid);
} $resourcesdata['ext'] = strtolower($resourcesdata['ext']);
if (in_array($resourcesdata['ext'], $Opentype['video'])) {
$resourcesdata['opentype'] = 'video';
public function fetch_by_rid($rid) } elseif (in_array($resourcesdata['ext'], $Opentype['text'])) {
{ $resourcesdata['opentype'] = 'text';
global $Opentype; } elseif (in_array($resourcesdata['ext'], $Opentype['pdf'])) {
if (!$resourcesdata = parent::fetch($rid)) return array(); $resourcesdata['opentype'] = 'pdf';
if ($resourcesdata['isdelete'] > 0) return array(); } elseif (in_array($resourcesdata['ext'], $Opentype['image'])) {
$attrdata = C::t('pichome_resources_attr')->fetch($rid); $resourcesdata['opentype'] = 'image';
$resourcesdata = array_merge($resourcesdata, $attrdata); } else {
$resourcesdata['colors'] = C::t('pichome_palette')->fetch_colordata_by_rid($rid); $resourcesdata['opentype'] = 'other';
if (in_array($resourcesdata['ext'], $Opentype['video'])) { }
$resourcesdata['opentype'] = 'video'; $resourcesdata['icondata'] = getglobal('siteurl') . 'index.php?mod=io&op=getImg&path=' . dzzencode($rid, '', 0, 0);
} elseif (in_array($resourcesdata['ext'], $Opentype['text'])) {
$resourcesdata['opentype'] = 'text'; $thumbwidth = getglobal('config/pichomethumbwidth') ? getglobal('config/pichomethumbwidth') : 900;
} elseif (in_array($resourcesdata['ext'], $Opentype['pdf'])) { $thumbheight = getglobal('config/pichomethumbheight') ? getglobal('config/pichomethumbheight') : 900;
$resourcesdata['opentype'] = 'pdf'; $thumsizearr = $this->getImageThumbsize($resourcesdata['width'], $resourcesdata['height'], $thumbwidth, $thumbheight);
} elseif (in_array($resourcesdata['ext'], $Opentype['image'])) { $resourcesdata['iconwidth'] = $thumsizearr[0];
$resourcesdata['opentype'] = 'image'; $resourcesdata['iconheight'] = $thumsizearr[1];
} else { //echo $resourcesdata['icondata'];die;
$resourcesdata['opentype'] = 'other'; //$imginfo = @getimagesize($resourcesdata['icondata']);
} // $resourcesdata['iconwidth'] = $imginfo[0] ? $imginfo[0] : $resourcesdata['width'];
if ($resourcesdata['hasthumb']) { //$resourcesdata['iconheight'] = $imginfo[1] ? $imginfo[1] : $resourcesdata['height'];
$filepath = dirname($resourcesdata['path']); $resourcesdata['icondata'] = str_replace('+', '%20', $resourcesdata['icondata']);
$filename = substr($resourcesdata['path'],strrpos($resourcesdata['path'],'/')+1);
$filename = str_replace(strrchr($filename, "."),"",$filename);
$thumbpath = 'library/' . $filepath . '/' . $filename . '_thumbnail.png'; $resourcesdata['share'] = $downshare[$resourcesdata['appid']]['share'];
$resourcesdata['icondata'] = $thumbpath; $resourcesdata['download'] = $downshare[$resourcesdata['appid']]['download'];
//} /* if ($downshare[$resourcesdata['appid']]['iswebsitefile']) {
} else { $originalimg = str_replace(DZZ_ROOT, '', $downshare[$resourcesdata['appid']]['path'] . BS . $resourcesdata['path']);
if ($resourcesdata['type'] == 'commonimage') { $originalimg = str_replace(BS, '/', $originalimg);
$resourcesdata['icondata'] = 'library/' . $resourcesdata['path']; $resourcesdata['originalimg'] = str_replace('+', '%20', urlencode($originalimg));
$resourcesdata['realpath'] = str_replace('+', '%20', urlencode($originalimg));
} else { } else {*/
$resourcesdata['icondata'] = geticonfromext($resourcesdata['ext'], $resourcesdata['type']); $originalimg = $downshare[$resourcesdata['appid']]['path'] . BS . $resourcesdata['path'];
} $resourcesdata['originalimg'] = getglobal('siteurl') . 'index.php?mod=io&op=getImg&fpath=' . dzzencode($originalimg, '', 0, 0);
} if (in_array($resourcesdata['opentype'], array('text', 'video', 'pdf'))) {
$imginfo = @getimagesize($resourcesdata['icondata']); $resourcesdata['realpath'] = str_replace('+', '', urlencode(getglobal('siteurl') . 'index.php?mod=io&op=getImg&fpath=' . dzzencode($originalimg, '', 0, 0)));
$resourcesdata['iconwidth'] = $imginfo[0]; } else {
$resourcesdata['iconheight'] = $imginfo[1]; $resourcesdata['realpath'] = getglobal('siteurl') . 'index.php?mod=io&op=getImg&fpath=' . dzzencode($originalimg, '', 0, 0);
$resourcesdata['icondata'] = str_replace('+',' ',urlencode($resourcesdata['icondata'])); }
//获取所有库分享和下载权限 //}
$downshare = C::t('pichome_vapp')->fetch_all_sharedownlod();
$resourcesdata['share'] = $downshare[$resourcesdata['appid']]['share']; $resourcesdata['name'] = str_replace(strrchr($resourcesdata['name'], "."), "", $resourcesdata['name']);
$resourcesdata['download'] = $downshare[$resourcesdata['appid']]['download']; $resourcesdata['fsize'] = formatsize($resourcesdata['size']);
$resourcesdata['originalimg'] = str_replace('+',' ',urlencode('library/' . $resourcesdata['path'])); $resourcesdata['mtime'] = dgmdate(round($resourcesdata['mtime'] / 1000), 'Y/m/d H:i');
$resourcesdata['realpath'] = str_replace('+',' ',urlencode('library/' . $resourcesdata['path'])); $resourcesdata['dateline'] = dgmdate(round($resourcesdata['dateline'] / 1000), 'Y/m/d H:i');
$resourcesdata['name'] = str_replace(strrchr($resourcesdata['name'], "."), "", $resourcesdata['name']); $resourcesdata['btime'] = dgmdate(round($resourcesdata['btime'] / 1000), 'Y/m/d H:i');
$resourcesdata['fsize'] = formatsize($resourcesdata['size']); unset($resourcesdata['path']);
$resourcesdata['mtime'] = dgmdate(round($resourcesdata['mtime'] / 1000), 'Y/m/d H:i'); $resourcesdata['foldernames'] = C::t('pichome_folderresources')->get_foldername_by_rid($rid);
$resourcesdata['dateline'] = dgmdate(round($resourcesdata['dateline'] / 1000), 'Y/m/d H:i'); $resourcesdata['tag'] = C::t('pichome_resourcestag')->fetch_tag_by_rid($rid);
$resourcesdata['btime'] = dgmdate(round($resourcesdata['btime'] / 1000), 'Y/m/d H:i'); $resourcesdata['dpath'] = dzzencode($rid, '', 0, 0);
unset($resourcesdata['path']);
$resourcesdata['foldernames'] = C::t('pichome_folderresources')->get_foldername_by_rid($rid);
$resourcesdata['tag'] = C::t('pichome_resourcestag')->fetch_tag_by_rid($rid); return $resourcesdata;
$resourcesdata['dpath'] = dzzencode($rid, '', 0); }
public function getdatasbyrids($rids)
return $resourcesdata; {
} $returndata = [];
//文件数据
public function getdatasbyrids($rids) $resourcesdata = $this->fetch_by_rids($rids);
{ //获取所有库分享和下载权限,以及编码数据
$returndata = []; $downshare = C::t('pichome_vapp')->fetch_all_sharedownlod();
//文件数据 //文件附属表数据
$resourcesdata = $this->fetch_by_rids($rids); // $attrdata = C::t('pichome_resources_attr')->fetch_by_rids($rids);
//获取所有库分享和下载权限 //文件标注数
$downshare = C::t('pichome_vapp')->fetch_all_sharedownlod(); $annonationnumdata = C::t('pichome_comments')->fetch_annonationnum_by_rids($rids);
//文件附属表数据 foreach ($resourcesdata as $v) {
// $attrdata = C::t('pichome_resources_attr')->fetch_by_rids($rids); //echo $v['hasthumb'];die;
//文件标注数 $v['annonationnum'] = $annonationnumdata[$v['rid']]['num'];
$annonationnumdata = C::t('pichome_comments')->fetch_annonationnum_by_rids($rids); $v['share'] = $downshare[$v['appid']]['share'];
foreach ($resourcesdata as $v) { $v['download'] = $downshare[$v['appid']]['download'];
$v['annonationnum'] = $annonationnumdata[$v['rid']]['num'];
$v['share'] = $downshare[$v['appid']]['share']; $v['icondata'] = getglobal('siteurl') . 'index.php?mod=io&op=getImg&path=' . dzzencode($v['rid'], '', 0, 0);
$v['download'] = $downshare[$v['appid']]['download']; $thumbwidth = getglobal('config/pichomethumbwidth') ? getglobal('config/pichomethumbwidth') : 900;
$returndata[] = $v; $thumbheight = getglobal('config/pichomethumbheight') ? getglobal('config/pichomethumbheight') : 900;
} $thumsizearr = $this->getImageThumbsize($v['width'], $v['height'], $thumbwidth, $thumbheight);
return $returndata; $v['thumbwidth'] = $thumsizearr[0];
} $v['thumbheight'] = $thumsizearr[1];
public function fetch_like_words($keyword, $limit = 10) $originalimg = $downshare[$v['appid']]['path'] . BS . $v['path'];
{ $v['realpath'] = getglobal('siteurl') . 'index.php?mod=io&op=getImg&fpath=' . dzzencode($originalimg, '', 0, 0);
$likewords = [];
$presql = " case when name like %s then 3 when name like %s then 2 when name like %s then 1 end as rn";
$wheresql = " name like %s"; unset($v['path']);
$params = [$keyword . '%', '%' . $keyword, '%' . $keyword . '%', $this->_table, '%' . $keyword . '%']; $returndata[] = $v;
foreach (DB::fetch_all("select name,$presql from %t where $wheresql order by rn desc limit 0,$limit", $params) as $v) { }
$likewords[] = $v['name']; return $returndata;
} }
return $likewords;
} public function getImageThumbsize($owidth, $oheight, $width, $height)
{
} if ($owidth > $width || $oheight > $height) {
$or = $owidth / $oheight;
$r = $width / $height;
if ($r > $or) {
if ($oheight < $height) {
$height = $oheight;
$width = $owidth;
} else {
$width = ceil($height * $or);
if ($width < 242) {
$width = 242;
$height = ceil($width / $or);
}
}
} else {
if ($owidth < $width) {
$height = $oheight;
$width = $owidth;
} else {
$height = ceil($width / $or);
$width = ceil($height * $or);
if ($width < 242) {
$width = 242;
$height = ceil($width / $or);
}
}
}
} else {
$width = $owidth;
$height = $oheight;
}
//Return the results
return array($width, $height);
}
public function geticondata_by_rid($rid)
{
$resourcesdata = DB::fetch_first("select r.rid,r.appid,r.hasthumb,r.ext,r.type,ra.path as fpath,
v.path,r.apptype,v.iswebsitefile,v.version from %t r
left join %t ra on r.rid=ra.rid left join %t v on r.appid = v.appid where r.rid = %s and r.isdelete = 0",
array($this->_table, 'pichome_resources_attr', 'pichome_vapp', $rid));
$resourcesdata['icondata'] = getglobal('siteurl') . 'index.php?mod=io&op=getImg&path=' . dzzencode($rid, '', 0, 0);
return $resourcesdata;
}
public function fetch_like_words($keyword, $limit = 10)
{
$likewords = [];
$presql = " case when name like %s then 3 when name like %s then 2 when name like %s then 1 end as rn";
$wheresql = " name like %s";
$params = [$keyword . '%', '%' . $keyword, '%' . $keyword . '%', $this->_table, '%' . $keyword . '%'];
foreach (DB::fetch_all("select name,$presql from %t where $wheresql order by rn desc limit 0,$limit", $params) as $v) {
$likewords[] = $v['name'];
}
return $likewords;
}
}

View File

@@ -1,81 +1,66 @@
<?php <?php
if(!defined('IN_OAOOA')) { if(!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
class table_pichome_resources_attr extends dzz_table class table_pichome_resources_attr extends dzz_table
{ {
public function __construct() public function __construct()
{ {
$this->_table = 'pichome_resources_attr'; $this->_table = 'pichome_resources_attr';
$this->_pk = 'rid'; $this->_pk = 'rid';
$this->_pre_cache_key = 'pichome_resourcesattr'; $this->_pre_cache_key = 'pichome_resourcesattr';
$this->_cache_ttl = 3600; $this->_cache_ttl = 3600;
parent::__construct(); parent::__construct();
} }
public function insert($setarr){ public function insert($setarr){
$rid = trim($setarr['rid']); $rid = trim($setarr['rid']);
if($attrdata = parent::fetch($rid)){ if($attrdata = parent::fetch($rid)){
unset($setarr['rid']); unset($setarr['rid']);
if($setarr['tag']){ return parent::update($rid,$setarr);
$tagarr = explode(',',$setarr['tag']); }else{
$otagarr = explode(',',$attrdata['tag']); return parent::insert($setarr);
$delrtids = []; }
foreach(DB::fetch_all("select id,tid from %t where rid = %s and tid not in(%n)",array('pichome_resourcestag',$rid,$tagarr)) as $v){ }
$delrtids[] = $v['id']; //删除文件属性数据
C::t('pichome_tag')->delete_by_tid($v['tid']); public function delete_by_rid($rids){
} if(!is_array($rids)) $rids = (array)$rids;
if(!empty($delrtids)) C::t('pichome_resourcestag')->delete($delrtids); $aids = [];
$addrtids = array_diff($tagarr,$otagarr); $tids = [];
foreach ($addrtids as $tid){ foreach(DB::fetch_all("select * from %t where rid in(%n) ",array($this->_table,$rids)) as $v){
$rtag = ['appid' => $attrdata['appid'], 'rid' => $rid, 'tid' => $tid]; $tids= array_merge($tids,explode(',',$v['tags']));
C::t('pichome_resourcestag')->insert($rtag); }
} $tids = array_unique($tids);
} foreach ($tids as $tid){
return parent::update($rid,$setarr); C::t('pichome_tag')->delete_by_tid($tid);
}else{ }
return parent::insert($setarr,1); return parent::delete($rids);
} }
}
//删除文件属性数据 public function fetch_by_rids($rids){
public function delete_by_rid($rids){ if(!is_array($rids)) $rids = (array)$rids;
if(!is_array($rids)) $rids = (array)$rids; $data = [];
$aids = []; foreach(parent::fetch_all($rids) as $v){
$tids = []; $data[$v['rid']] = $v;
foreach(DB::fetch_all("select * from %t where rid in(%n) ",array($this->_table,$rids)) as $v){ }
$tids= array_merge($tids,explode(',',$v['tags'])); return $v;
} }
$tids = array_unique($tids); public function fetch_rids_by_link($link,$appid,$limit=6,$rid=''){
foreach ($tids as $tid){ $rids = [];
C::t('pichome_tag')->delete_by_tid($tid); foreach(DB::fetch_all("select distinct rid from %t where link =%s and rid !=%s and appid = %s limit 0,$limit",array($this->_table,$link,$rid,$appid)) as $v){
} $rids[] = $v['rid'];
return parent::delete($rids); }
} return $rids;
}
public function fetch_by_rids($rids){ public function fetch_like_words($keyword,$limit=10){
if(!is_array($rids)) $rids = (array)$rids; $likewords = [];
$data = []; $presql = " case when 'desc' like %s then 3 when 'desc' like %s then 2 when 'desc' like %s then 1 end as rn";
foreach(parent::fetch_all($rids) as $v){ $wheresql = " 'desc' like %s";
$data[$v['rid']] = $v; $params = [$keyword . '%', '%' . $keyword,'%'.$keyword.'%',$this->_table,'%'.$keyword.'%'];
} foreach(DB::fetch_all("select 'desc',$presql from %t where $wheresql order by rn desc limit 0,$limit",$params) as $v){
return $v; $likewords[] = $v['desc'];
} }
public function fetch_rids_by_link($link,$appid,$limit=6,$rid=''){ return $likewords;
$rids = []; }
foreach(DB::fetch_all("select distinct rid from %t where link =%s and rid !=%s and appid = %s limit 0,$limit",array($this->_table,$link,$rid,$appid)) as $v){
$rids[] = $v['rid'];
}
return $rids;
}
public function fetch_like_words($keyword,$limit=10){
$likewords = [];
$presql = " case when 'desc' like %s then 3 when 'desc' like %s then 2 when 'desc' like %s then 1 end as rn";
$wheresql = " 'desc' like %s";
$params = [$keyword . '%', '%' . $keyword,'%'.$keyword.'%',$this->_table,'%'.$keyword.'%'];
foreach(DB::fetch_all("select 'desc',$presql from %t where $wheresql order by rn desc limit 0,$limit",$params) as $v){
$likewords[] = $v['desc'];
}
return $likewords;
}
} }

View File

@@ -0,0 +1,34 @@
<?php
if (!defined('IN_OAOOA')) {
exit('Access Denied');
}
class table_pichome_resources_relation extends dzz_table
{
public function __construct()
{
$this->_table = 'pichome_resources_relation';
$this->_pk = 'id';
$this->_pre_cache_key = 'pichome_resources_relation';
$this->_cache_ttl = 3600;
parent::__construct();
}
public function insert($setarr)
{
if (DB::result_first("select count(*) from %t where rid = %s", array($this->_table, $setarr['rid']))) {
$rid = $setarr['rid'];
unset($setarr['rid']);
return parent::update($rid, $setarr);
} else {
return parent::insert($setarr);
}
}
public function fetch_by_orid_appid($orid,$appid){
return DB::fetch_first("select * from %t where orid = %s and appid = %s",$this->_table,$orid,$appid);
}
}

View File

@@ -1,89 +1,92 @@
<?php <?php
if (!defined('IN_OAOOA')) { if (!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
class table_pichome_resourcestag extends dzz_table class table_pichome_resourcestag extends dzz_table
{ {
public function __construct() public function __construct()
{ {
$this->_table = 'pichome_resourcestag'; $this->_table = 'pichome_resourcestag';
$this->_pk = 'id'; $this->_pk = 'id';
$this->_pre_cache_key = 'pichome_resourcestag'; $this->_pre_cache_key = 'pichome_resourcestag';
$this->_cache_ttl = 3600; $this->_cache_ttl = 3600;
parent::__construct(); parent::__construct();
} }
public function insert($setarr) public function insert($setarr)
{ {
if ($id = DB::result_first("select id from %t where tid = %d and rid = %s", array($this->_table, $setarr['tid'],$setarr['rid']))) { if ($id = DB::result_first("select id from %t where tid = %d and rid = %s", array($this->_table, $setarr['tid'],$setarr['rid']))) {
parent::update($id, $setarr); parent::update($id, $setarr);
} else { } else {
$id=parent::insert($setarr); $id=parent::insert($setarr);
C::t('pichome_tag')->add_hots_by_tid($setarr['tid']); C::t('pichome_tag')->add_hots_by_tid($setarr['tid']);
} }
return $id; return $id;
} }
public function fetch_tag_by_rid($rid){ public function fetch_tag_by_rid($rid){
$tagdata = []; $tagdata = [];
foreach(DB::fetch_all("select t.tid,t.tagname from %t rt left join %t t on rt.tid = t.tid where rt.rid = %s",array($this->_table,'pichome_tag',$rid)) as $v){ foreach(DB::fetch_all("select t.tid,t.tagname from %t rt left join %t t on rt.tid = t.tid where rt.rid = %s",array($this->_table,'pichome_tag',$rid)) as $v){
$tagdata[$v['tid']] = $v['tagname']; $tagdata[$v['tid']] = $v['tagname'];
} }
return $tagdata; return $tagdata;
} }
public function fetch_id_by_rid($rid) public function fetch_id_by_rid($rid)
{ {
$ids = []; $ids = [];
foreach(DB::fetch_all("select id from %t where rid = %s",array($this->_table,$rid)) as $v){ foreach(DB::fetch_all("select id from %t where rid = %s",array($this->_table,$rid)) as $v){
$ids[] = $v['id']; $ids[] = $v['id'];
} }
return $ids; return $ids;
} }
//根据appid删除数据 //根据appid删除数据
public function delete_by_appid($appid) public function delete_by_appid($appid)
{ {
$dids = []; $dids = [];
foreach (DB::fetch_all("select id from %t where appid = %s", array($this->_table, $appid)) as $v) { foreach (DB::fetch_all("select id from %t where appid = %s", array($this->_table, $appid)) as $v) {
$dids[] = $v['id']; $dids[] = $v['id'];
} }
return parent::delete($dids); return parent::delete($dids);
} }
public function delete_by_rid($rid) public function delete_by_rid($rid)
{ {
$delids = []; if(!is_array($rid)) $rid = (array)$rid;
foreach (DB::fetch_all("select id from %t where rid = %s", array($this->_table, $rid)) as $v) { $delids = [];
$delids[] = $v['id']; foreach (DB::fetch_all("select id,tid from %t where rid in(%n)", array($this->_table, $rid)) as $v) {
} $delids[] = $v['id'];
return parent::delete($delids); C::t('pichome_tag')->delete_by_tid($v['tid']);
} }
return parent::delete($delids);
public function fetch_rids_by_tids($tids,$appid,$limit=6,$rid=''){ }
if(!is_array($tids)) $tids = (array) $tids;
$rids = [];
foreach(DB::fetch_all("select distinct rid from %t where tid in(%n) and rid != %s and appid = %s limit 0,$limit",array($this->_table,$tids,$rid,$appid)) as $v){ public function fetch_rids_by_tids($tids,$appid,$limit=6,$rid=''){
$rids[] = $v['rid']; if(!is_array($tids)) $tids = (array) $tids;
} $rids = [];
return $rids; foreach(DB::fetch_all("select distinct rid from %t where tid in(%n) and rid != %s and appid = %s limit 0,$limit",array($this->_table,$tids,$rid,$appid)) as $v){
} $rids[] = $v['rid'];
public function fetch_all_tag_by_rids($rids){ }
$data = []; return $rids;
foreach(DB::fetch_all("select rt.rid,rt.tid,t.tagname from %t rt }
left join %t t on rt.tid = t.tid where rt.rid in(%n)",array($this->_table,'pichome_tag',$rids)) as $v){ public function fetch_all_tag_by_rids($rids){
$data[$v['rid']][]= $v['tagname']; $data = [];
} foreach(DB::fetch_all("select rt.rid,rt.tid,t.tagname from %t rt
return $data; left join %t t on rt.tid = t.tid where rt.rid in(%n)",array($this->_table,'pichome_tag',$rids)) as $v){
} $data[$v['rid']][]= $v['tagname'];
}
public function delete_by_ridtid($rid,$tids){ return $data;
if(!is_array($tids)) $tids = (array) $tids; }
$ids = [];
foreach(DB::fetch_all("select id,tid from %t where rid = %s and tid in(%n)",array($this->_table,$rid,$tids)) as $v){ public function delete_by_ridtid($rid,$tids){
$ids[] = $v['id']; if(!is_array($tids)) $tids = (array) $tids;
C::t('pichome_tag')->delete_by_tid($v['tid']); $ids = [];
} foreach(DB::fetch_all("select id,tid from %t where rid = %s and tid in(%n)",array($this->_table,$rid,$tids)) as $v){
return parent::delete($ids); $ids[] = $v['id'];
} C::t('pichome_tag')->delete_by_tid($v['tid']);
} }
return parent::delete($ids);
}
}

View File

@@ -1,178 +1,162 @@
<?php <?php
if (!defined('IN_OAOOA')) { if (!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
class table_pichome_searchrecent extends dzz_table class table_pichome_searchrecent extends dzz_table
{ {
public function __construct() public function __construct()
{ {
$this->_table = 'pichome_searchrecent'; $this->_table = 'pichome_searchrecent';
$this->_pk = 'id'; $this->_pk = 'id';
$this->_pre_cache_key = 'pichome_searchrecent'; $this->_pre_cache_key = 'pichome_searchrecent';
$this->_cache_ttl = 3600; $this->_cache_ttl = 3600;
parent::__construct(); parent::__construct();
} }
public function add_search($keyword, $appid = '', $ktype = 0) public function add_search($keyword, $appid = '', $ktype = 0)
{ {
global $_G; global $_G;
$wheresql = ' keywords = %s and ktype=%d '; $wheresql = ' keywords = %s and ktype=%d ';
$params = array($this->_table, $keyword, $ktype); $params = array($this->_table, $keyword, $ktype);
if ($_G['uid']) { if ($_G['uid']) {
$wheresql .= ' and uid = %d '; $wheresql .= ' and uid = %d ';
$params[] = $_G['uid']; $params[] = $_G['uid'];
} }
if ($appid) { if ($appid) {
$wheresql .= ' and appid = %s '; $wheresql .= ' and appid = %s ';
$params[] = $appid; $params[] = $appid;
} }
if ($data = DB::fetch_first("select id,hots from %t where$wheresql", $params)) { if ($data = DB::fetch_first("select id,hots from %t where$wheresql", $params)) {
$hots = $data['hots'] + 1; $hots = $data['hots'] + 1;
return parent::update($data['id'], array('hots' => $hots, 'dateline' => TIMESTAMP)); return parent::update($data['id'], array('hots' => $hots, 'dateline' => TIMESTAMP));
} else { } else {
$setarr = [ $setarr = [
'keywords' => $keyword, 'keywords' => $keyword,
'ktype' => $ktype, 'ktype' => $ktype,
'dateline' => TIMESTAMP, 'dateline' => TIMESTAMP,
'uid' => isset($_G['uid']) ? $_G['uid'] : 0, 'uid' => isset($_G['uid']) ? $_G['uid'] : 0,
'hots' => 1, 'hots' => 1,
'appid' => $appid 'appid' => $appid
]; ];
return parent::insert($setarr); return parent::insert($setarr);
} }
} }
//查询最近搜索标签 //查询最近搜索标签
public function fetch_renctent_search_tag($appid = '', $limit = 8) public function fetch_renctent_search_tag($appid = '', $limit = 8)
{ {
global $_G; global $_G;
$wheresql = ' s.ktype = 1 '; $wheresql = ' s.ktype = 1 ';
$params = array($this->_table, 'pichome_tag'); $params = array($this->_table, 'pichome_tag');
if ($appid) { if ($appid) {
$wheresql .= ' and s.appid = %s '; $wheresql .= ' and s.appid = %s ';
$params[] = $appid; $params[] = $appid;
} }
if ($_G['uid']) { if ($_G['uid']) {
$wheresql .= ' and s.uid = %d'; $wheresql .= ' and s.uid = %d';
$params[] = $_G['uid']; $params[] = $_G['uid'];
} }
$datas = []; $datas = [];
foreach (DB::fetch_all("select s.keywords,t.tid from %t s left join %t t on s.keywords = t.tagname where foreach (DB::fetch_all("select s.keywords,t.tid from %t s left join %t t on s.keywords = t.tagname where
$wheresql and t.tid > 0 order by s.hots desc,s.dateline desc limit 0,$limit", $params) as $v) { $wheresql and t.tid > 0 order by s.hots desc,s.dateline desc limit 0,$limit", $params) as $v) {
$datas[$v['tid']] = $v['keywords']; $datas[$v['tid']] = $v['keywords'];
} }
return $datas; return $datas;
} }
public function fetch_hotkeyword_by_appid($appid = '', $limit = 16,$noids=array(),$datas=array()) public function fetch_hotkeyword_by_appid($appid = '', $limit = 16, $noids = array(), $datas = array())
{ {
$start = strtotime(date("Y-m-d", strtotime("-7 day"))); /* $start = strtotime(date("Y-m-d", strtotime("-7 day")));
$end = strtotime(dgmdate(time(), 'Y-m-d')) + 86400; $end = strtotime(dgmdate(time(), 'Y-m-d')) + 86400;*/
$params = array($this->_table/*, $start, $end*/); $params = array($this->_table/*, $start, $end*/);
/* //$wheresql = " dateline <= %d and dateline > %d";
if ($appid) { $count = DB::result_first("select count(id) from %t where 1 order by hots desc limit 0,$limit", $params);
$wheresql .= ' and appid =%s '; //print_r(DB::fetch_all("select keywords,id from %t where 1 order by hots desc limit 0,$limit", $params));die;
$params[] = $appid; foreach (DB::fetch_all("select keywords,id from %t where 1 order by hots desc limit 0,$limit", $params) as $v) {
} $data = $this->get_data_by_keyword($v['keywords']);
if($noids){ if (!$data) {
$wheresql .= ' and id not in(%n) '; parent::delete($v['id']);
$params[] = $noids; } else {
}*/ $datas[$v['id']] = $data;
$count = DB::result_first("select count(id) from %t where 1 order by hots desc limit 0,$limit", $params); }
foreach (DB::fetch_all("select keywords,id from %t where 1 order by hots desc limit 0,$limit", $params) as $v) { }
$data = $this->get_data_by_keyword($v['keywords'],$v['id']); // print_r($datas);die;
if(!$data){ $resultcount = count($datas);
parent::delete($v['id']); //如果有关键词没有结果,并且结果数量大于查询出来的数量
}else{ if ($resultcount < $limit && $count > $limit) {
$datas[$v['id']] = $data; $ids = array_keys($datas);
} $limit = $limit - $resultcount;
} $datas = $this->fetch_hotkeyword_by_appid($appid, $limit, $ids, $datas);
$resultcount = count($datas); }
//如果有关键词没有结果,并且结果数量大于查询出来的数量 return $datas;
if($resultcount < $limit && $count > $limit){ }
$ids = array_keys($datas);
$limit = $limit - $resultcount; public function get_data_by_keyword($keyword)
$datas = $this->fetch_hotkeyword_by_appid($appid,$limit,$ids,$datas); {
} $rid = DB::result_first("select r.rid from %t r left join %t ra on ra.rid=r.rid
return $datas; where ra.searchval LIKE %s order by rand() limit 0,1 ",
} array('pichome_resources', 'pichome_resources_attr', '%' . $keyword . '%'));
public function get_data_by_keyword($keyword){
$tmpdata = DB::fetch_first("select r.rid,r.name,ra.path,r.hasthumb,r.ext,r.type from %t r $tmpdata = C::t('pichome_resources')->geticondata_by_rid($rid);
left join %t ra on ra.rid=r.rid LEFT JOIN %t c on c.rid = r.rid
left join %t rt on r.rid = rt.rid left join %t t on rt.tid= t.tid where r.name like%s or ra.link like %s or ra.desc LIKE %s or c.annotation LIKE %s or t.tagname LIKE %s if (!$tmpdata) {
order by rand() limit 1 ", return false;
array('pichome_resources', 'pichome_resources_attr', 'pichome_comments', 'pichome_resourcestag', 'pichome_tag', '%' . $keyword . '%', } else {
'%' . $keyword . '%', '%' . $keyword . '%', '%' . $keyword . '%', '%' . $keyword . '%')); $tmpdata['keyword'] = $keyword;
if (!$tmpdata) { }
return false; return $tmpdata;
} else { }
if ($tmpdata['hasthumb']) {
$filename = str_replace(strrchr($tmpdata['name'], "."), "", $tmpdata['name']); //查询最近搜索分类
$filepath = dirname($tmpdata['path']); public function fetch_renctent_search_foldername($appid, $limit = 10)
$thumbpath = DZZ_ROOT . 'library/' . $filepath . '/' . $filename . '_thumbnail.png'; {
$thumbpath = str_replace(DZZ_ROOT, '', $thumbpath); global $_G;
$tmpdata['icondata'] = $thumbpath; $wheresql = ' s.ktype = 2 and s.appid = %s';
} else { $params = array($this->_table, 'pichome_folder', $appid);
if ($tmpdata['type'] == 'commonimage') {
$tmpdata['icondata'] = 'library/' . $tmpdata['path']; if ($_G['uid']) {
} else { $wheresql .= ' and s.uid = %d';
$tmpdata['icondata'] = geticonfromext($tmpdata['ext'], $tmpdata['type']); $params[] = $_G['uid'];
} }
} $datas = [];
$tmpdata['keyword'] = $keyword; foreach (DB::fetch_all("select s.keywords,f.fid from %t s left join %t f on f.fname = s.keywords and f.appid = s.appid
} where $wheresql and f.fid !='' and s.hots > 0 order by s.hots desc,s.dateline desc limit 0,$limit", $params) as $v) {
return $tmpdata; $datas[$v['fid']]['name'] = $v['keywords'];
} $datas[$v['fid']]['fid'] = $v['fid'];
//查询最近搜索分类 }
public function fetch_renctent_search_foldername($appid, $limit = 10) $fids = array_keys($datas);
{ if (!empty($fids)) {
global $_G; foreach (DB::fetch_all("select f.fname,f.fid,count(fr.rid) as num from %t fr
$wheresql = ' s.ktype = 2 and s.appid = %s'; left join %t f on f.fid=fr.fid where fr.fid in(%n) group by fr.fid", array('pichome_folderresources', 'pichome_folder', $fids)) as $val) {
$params = array($this->_table, 'pichome_folder', $appid); $datas[$val['fid']]['sum'] = $val['num'];
$datas[$val['fid']]['fname'] = $val['fname'];
if ($_G['uid']) { }
$wheresql .= ' and s.uid = %d'; }
$params[] = $_G['uid'];
}
$datas = []; return $datas;
foreach (DB::fetch_all("select s.keywords,f.fid from %t s left join %t f on f.fname = s.keywords and f.appid = s.appid }
where $wheresql and f.fid !='' and s.hots > 0 order by s.hots desc,s.dateline desc limit 0,$limit", $params) as $v) {
$datas[$v['fid']]['name'] = $v['keywords']; public function fetch_like_words($keyword, $limit = 10)
$datas[$v['fid']]['fid'] = $v['fid']; {
} $likewords = [];
$fids = array_keys($datas); $presql = " case when keywords like %s then 3 when keywords like %s then 2 when keywords like %s then 1 end as rn";
if (!empty($fids)) { $wheresql = " keywords like %s";
foreach (DB::fetch_all("select f.fname,f.fid,count(fr.rid) as num from %t fr $params = [$keyword . '%', '%' . $keyword, '%' . $keyword . '%', $this->_table, '%' . $keyword . '%'];
left join %t f on f.fid=fr.fid where fr.fid in(%n) group by fr.fid", array('pichome_folderresources', 'pichome_folder', $fids)) as $val) { foreach (DB::fetch_all("select keywords,$presql from %t where $wheresql order by rn desc limit 0,$limit", $params) as $v) {
$datas[$val['fid']]['sum'] = $val['num']; $likewords[] = $v['keywords'];
$datas[$val['fid']]['fname'] = $val['fname']; }
} return $likewords;
} }
public function delete_by_appid($appid)
return $datas; {
} $delid = [];
foreach (DB::fetch_all("select id from %t where appid = %s", array($this->_table, $appid)) as $v) {
public function fetch_like_words($keyword, $limit = 10) $delid[] = $v['id'];
{ }
$likewords = []; return parent::delete($delid);
$presql = " case when keywords like %s then 3 when keywords like %s then 2 when keywords like %s then 1 end as rn"; }
$wheresql = " keywords like %s"; }
$params = [$keyword . '%', '%' . $keyword, '%' . $keyword . '%', $this->_table, '%' . $keyword . '%'];
foreach (DB::fetch_all("select keywords,$presql from %t where $wheresql order by rn desc limit 0,$limit", $params) as $v) {
$likewords[] = $v['keywords'];
}
return $likewords;
}
public function delete_by_appid($appid)
{
$delid = [];
foreach (DB::fetch_all("select id from %t where appid = %s", array($this->_table, $appid)) as $v) {
$delid[] = $v['id'];
}
return parent::delete($delid);
}
}

View File

@@ -1,66 +1,66 @@
<?php <?php
if (!defined('IN_OAOOA')) { if (!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
class table_pichome_taggroup extends dzz_table class table_pichome_taggroup extends dzz_table
{ {
public function __construct() public function __construct()
{ {
$this->_table = 'pichome_taggroup'; $this->_table = 'pichome_taggroup';
$this->_pk = 'cid'; $this->_pk = 'cid';
$this->_pre_cache_key = 'pichome_taggroup'; $this->_pre_cache_key = 'pichome_taggroup';
$this->_cache_ttl = 3600; $this->_cache_ttl = 3600;
parent::__construct(); parent::__construct();
} }
public function insert($setarr) public function insert($setarr)
{ {
$cid = $setarr['cid']; $cid = $setarr['cid'];
if ($taggroup = DB::fetch_first("select * from %t where cid = %s", array($this->_table, $cid))) { if ($taggroup = DB::fetch_first("select * from %t where cid = %s and appid = %s", array($this->_table, $cid,$setarr['appid']))) {
unset($setarr['cid']); unset($setarr['cid']);
if ($taggroup['catname'] != $setarr['catname']) parent::update($cid, $setarr); if ($taggroup['catname'] != $setarr['catname']) parent::update($cid, $setarr);
return $cid; return $cid;
} else { } else {
if (parent::insert($setarr)) return $cid; if (parent::insert($setarr)) return $cid;
} }
} }
public function fetch_cid_by_appid($appid) public function fetch_cid_by_appid($appid)
{ {
$cids = []; $cids = [];
foreach (DB::fetch_all("select cid from %t where appid = %s", array($this->_table, $appid)) as $v) { foreach (DB::fetch_all("select cid from %t where appid = %s", array($this->_table, $appid)) as $v) {
$cids[] = $v['cid']; $cids[] = $v['cid'];
} }
return $cids; return $cids;
} }
public function delete_by_cids($cids) public function delete_by_cids($cids)
{ {
if (!is_array($cids)) $cids = (array)$cids; if (!is_array($cids)) $cids = (array)$cids;
if (!empty($cids)) { if (!empty($cids)) {
C::t('pichome_tagrelation')->delete_by_cids($cids); C::t('pichome_tagrelation')->delete_by_cids($cids);
parent::delete($cids); parent::delete($cids);
} }
} }
public function delete_by_appid($appid) public function delete_by_appid($appid)
{ {
$delid = []; $delid = [];
foreach (DB::fetch_all("select cid from %t where appid = %s", array($this->_table, $appid)) as $v) { foreach (DB::fetch_all("select cid from %t where appid = %s", array($this->_table, $appid)) as $v) {
$delid[] = $v['cid']; $delid[] = $v['cid'];
} }
return parent::delete($delid); return parent::delete($delid);
} }
public function fetch_by_appid($appid) public function fetch_by_appid($appid)
{ {
$data = []; $data = [];
return DB::fetch_all("select * from %t where appid = %s", array($this->_table, $appid)); return DB::fetch_all("select * from %t where appid = %s", array($this->_table, $appid));
} }
} }

View File

@@ -0,0 +1,38 @@
<?php
if (!defined('IN_OAOOA')) {
exit('Access Denied');
}
class table_pichome_taggroup_relation extends dzz_table
{
public function __construct()
{
$this->_table = 'pichome_taggroup_relation';
$this->_pk = 'id';
$this->_pre_cache_key = 'pichome_taggroup_relation';
$this->_cache_ttl = 3600;
parent::__construct();
}
//获取库下所有标签分类对应数据
public function fetch_by_appid($appid){
$data = [];
foreach(DB::fetch_all("select * from %t where appid = %s",array($this->_table,$appid)) as $v){
$data[$v['gid']] = $v;
}
return $data;
}
public function fetch_cid_by_gid($gid,$appid){
return DB::result_first("select cid from %t where gid = %d and appid = %s",array($this->_table,$gid,$appid));
}
public function insertdata($setarr){
if($id=DB::result_first("select id from %t where tid = %d and appid = %s",array($this->_table,$setarr['tid'],$setarr['appid']))){
parent::update($id,$setarr);
}else{
parent::insert($setarr);
}
return true;
}
}

View File

@@ -1,51 +1,51 @@
<?php <?php
if(!defined('IN_OAOOA')) { if(!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
class table_pichome_tagrelation extends dzz_table class table_pichome_tagrelation extends dzz_table
{ {
public function __construct() public function __construct()
{ {
$this->_table = 'pichome_tagrelation'; $this->_table = 'pichome_tagrelation';
$this->_pk = 'id'; $this->_pk = 'id';
$this->_pre_cache_key = 'pichome_tagrelation'; $this->_pre_cache_key = 'pichome_tagrelation';
$this->_cache_ttl = 3600; $this->_cache_ttl = 3600;
parent::__construct(); parent::__construct();
} }
public function insert($setarr){ public function insert($setarr){
if($id = DB::fetch_first("select id from %t where cid = %s and tid = %d",array($this->_table,$setarr['cid'],$setarr['tid']))){ if($id = DB::fetch_first("select id from %t where cid = %s and tid = %d",array($this->_table,$setarr['cid'],$setarr['tid']))){
return $id; return $id;
}else{ }else{
//同一库下一个标签只能归属于一个分类 //同一库下一个标签只能归属于一个分类
$this->delete_by_tpid($setarr['tid'],$setarr['appid']); $this->delete_by_tpid($setarr['tid'],$setarr['appid']);
return parent::insert($setarr,1); return parent::insert($setarr);
} }
} }
public function delete_by_tpid($tid,$appid){ public function delete_by_tpid($tid,$appid){
//兼容以修复已经出现错误的数据 //兼容以修复已经出现错误的数据
$ids = []; $ids = [];
foreach(DB::fetch_all("select id from %t where tid = %d and appid =%s",array($this->_table,$tid,$appid)) as $v){ foreach(DB::fetch_all("select id from %t where tid = %d and appid =%s",array($this->_table,$tid,$appid)) as $v){
$ids[] = $v['id']; $ids[] = $v['id'];
} }
//$id = DB::result_first("select id from %t where tid = %d and appid =%s",array($this->_table,$tid,$appid)); //$id = DB::result_first("select id from %t where tid = %d and appid =%s",array($this->_table,$tid,$appid));
if(!empty($ids))return parent::delete($ids); if(!empty($ids))return parent::delete($ids);
return true; return true;
} }
public function delete_by_cids($cids){ public function delete_by_cids($cids){
if(!is_array($cids)) $cids = (array)$cids; if(!is_array($cids)) $cids = (array)$cids;
$ids = []; $ids = [];
foreach(DB::fetch_all("select id from %t where cid in(%n)",array($this->_table,$cids)) as $v){ foreach(DB::fetch_all("select id from %t where cid in(%n)",array($this->_table,$cids)) as $v){
$ids[] = $v['id']; $ids[] = $v['id'];
} }
parent::delete($ids); parent::delete($ids);
} }
public function delete_by_appid($appid) public function delete_by_appid($appid)
{ {
$delid =[]; $delid =[];
foreach (DB::fetch_all("select id from %t where appid = %s",array($this->_table,$appid)) as $v){ foreach (DB::fetch_all("select id from %t where appid = %s",array($this->_table,$appid)) as $v){
$delid[] = $v['id']; $delid[] = $v['id'];
} }
return parent::delete($delid); return parent::delete($delid);
} }
} }

View File

@@ -1,87 +1,134 @@
<?php <?php
if(!defined('IN_OAOOA')) { if(!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
class table_pichome_vapp extends dzz_table class table_pichome_vapp extends dzz_table
{ {
public function __construct() public function __construct()
{ {
$this->_table = 'pichome_vapp'; $this->_table = 'pichome_vapp';
$this->_pk = 'appid'; $this->_pk = 'appid';
$this->_pre_cache_key = 'pichome_vapp'; $this->_pre_cache_key = 'pichome_vapp';
$this->_cache_ttl = 3600; $this->_cache_ttl = 3600;
parent::__construct(); parent::__construct();
} }
private function code62($x) { private function code62($x) {
$show = ''; $show = '';
while($x > 0) { while($x > 0) {
$s = $x % 62; $s = $x % 62;
if ($s > 35) { if ($s > 35) {
$s = chr($s+61); $s = chr($s+61);
} elseif ($s > 9 && $s <=35) { } elseif ($s > 9 && $s <=35) {
$s = chr($s + 55); $s = chr($s + 55);
} }
$show .= $s; $show .= $s;
$x = floor($x/62); $x = floor($x/62);
} }
return $show; return $show;
} }
public function getSid($url) { public function getSid($url) {
$url = crc32($url); $microtime = microtime();
$result = sprintf("%u", $url); list($msec, $sec) = explode(' ', $microtime);
return self::code62($result); $msec = $msec * 1000000;
} $url = crc32($url.$sec.random(6).$msec);
public function insert($setarr){ $result = sprintf("%u", $url);
$path = $setarr['path']; $sid = self::code62($result);
if($appid = DB::result_first("select appid from %t where path = %s",array($this->_table,$path))){ $len = strlen($sid);
return $appid; if($len < 6){
}else{ $sid .= random(1);
$setarr['appid'] = $this->getSid($setarr['path']); }
if(parent::insert($setarr)){ if(strlen($sid) > 6){
return $setarr['appid']; $sid = substr($sid,0,6);
} }
} if(DB::result_first("select appid from %t where appid = %s",array($this->_table,$sid))){
} $sid = $this->getSid($url);
}
public function fetch_by_path($path){ return $sid;
return DB::fetch_first("select * from %t where path = %s",array($this->_table,$path)); }
} public function insert($setarr){
//获取不重复的应用名称 //如果为oaooa库时
public function getNoRepeatName($name) $path = $setarr['path'];
{ if($appid = DB::result_first("select appid from %t where path = %s and isdelete = 0",array($this->_table,$setarr['path']))){
static $i = 0; parent::update($appid,$setarr);
if (DB::result_first("select COUNT(*) from %t where appname=%s ", array($this->_table, $name))) { return $appid;
$name = preg_replace("/\(\d+\)/i", '', $name) . '(' . ($i + 1) . ')'; }
$i += 1; //生成appid
return $this->getNoRepeatName($name); $setarr['appid'] = $this->getSid($path);
} else {
return $name; if(parent::insert($setarr)){
} return $setarr['appid'];
} }
}
//删除虚拟应用
public function delete_vapp_by_appid($appid){ public function fetch_by_path($path){
//删除文件表数据 return DB::fetch_first("select * from %t where path = %s",array($this->_table,$path));
C::t('pichome_resources')->delete_by_appid($appid); }
//删除目录表数据 //获取不重复的应用名称
C::t('pichome_folder')->delete_by_appid($appid); public function getNoRepeatName($name)
//删除目录文件关系表数据 {
C::t('pichome_folderresources')->delete_by_appid($appid); static $i = 0;
//删除标签分类表数据 if (DB::result_first("select COUNT(*) from %t where appname=%s ", array($this->_table, $name))) {
C::t('pichome_taggroup')->delete_by_appid($appid); $name = preg_replace("/\(\d+\)/i", '', $name) . '(' . ($i + 1) . ')';
//删除标签关系表数据 $i += 1;
C::t('pichome_tagrelation')->delete_by_appid($appid); return $this->getNoRepeatName($name);
//删除最近搜索表数据 } else {
C::t('pichome_searchrecent')->delete_by_appid($appid); return $name;
return parent::delete($appid); }
} }
public function fetch_all_sharedownlod(){ //删除虚拟应用
$downshare = array(); public function delete_vapp_by_appid($appid){
foreach(DB::fetch_all("select appid,download,share from %t where 1",array($this->_table)) as $v){ $appdata = parent::fetch($appid);
$downshare[$v['appid']]=['share'=>$v['share'],'download'=>$v['download']]; //删除文件表数据
} C::t('pichome_resources')->delete_by_appid($appid);
return $downshare; //删除目录表数据
} C::t('pichome_folder')->delete_by_appid($appid);
//删除目录文件关系表数据
C::t('pichome_folderresources')->delete_by_appid($appid);
//删除标签分类表数据
C::t('pichome_taggroup')->delete_by_appid($appid);
//删除标签关系表数据
C::t('pichome_tagrelation')->delete_by_appid($appid);
//删除最近搜索表数据
C::t('pichome_searchrecent')->delete_by_appid($appid);
//resources表数据未完成删除前不允许删除vapp表
if(DB::result_first("select count(rid) from %t where appid = %s",array('pichome_resources',$appid))){
return ;
}else{
if(is_dir(getglobal('setting/attachdir').'pichomethumb/'.$appid)){
removedirectory(getglobal('setting/attachdir').'pichomethumb/'.$appid);
}
if($appdata['type'] !== 1){
$hookdata = ['appid'=>$appid,'apptype'=>$appdata['type']];
Hook::listen('pichomevappdelete',$hookdata);
}
return parent::delete($appid);
}
}
public function fetch_all_sharedownlod(){
$downshare = array();
foreach(DB::fetch_all("select * from %t where 1",array($this->_table)) as $v){
$downshare[$v['appid']]=$v;
}
return $downshare;
}
public function add_getinfonum_by_appid($appid,$ceof = 1){
$appdata = C::t('pichome_vapp')->fetch($appid);
if($ceof < 0){
if($appdata['getinfonum'] == 0) return true;
elseif($appdata['getinfonum'] < abs($ceof))$ceof = -$appdata['getinfonum'];
}
if ($ceof > 0) {
DB::query("update %t set getinfonum=getinfonum+%d where appid = %s", array($this->_table, $ceof, $appid));
} else {
DB::query("update %t set getinfonum=getinfonum-%d where appid = %s", array($this->_table, abs($ceof), $appid));
}
$this->clear_cache($appid);
}
} }

View File

@@ -1,18 +1,18 @@
<?php <?php
/* /*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd * @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/ * @license https://www.oaooa.com/licenses/
* *
* @link https://www.oaooa.com * @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com) * @author zyx(zyx@oaooa.com)
*/ */
if(!defined('IN_OAOOA')) { if(!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
if(!defined('CORE_VERSION')) { if(!defined('CORE_VERSION')) {
define('CORE_VERSION', 'beta1'); define('CORE_VERSION', 'beta3.3');
define('CORE_VERSION_LEVEL', 'Pichome'); define('CORE_VERSION_LEVEL', 'Pichome');
define('CORE_RELEASE', '20210820'); define('CORE_RELEASE', '20220224');
define('CORE_FIXBUG' , '01000000'); define('CORE_FIXBUG' , '03300000');
} }

View File

@@ -2,7 +2,7 @@
if(!defined('IN_OAOOA')) { if(!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
gnore_user_abort(true); ignore_user_abort(true);
@set_time_limit(0); @set_time_limit(0);
$percachename = 'pichome_searchhot'; $percachename = 'pichome_searchhot';
$alldata = C::t('pichome_searchrecent')->fetch_hotkeyword_by_appid(); $alldata = C::t('pichome_searchrecent')->fetch_hotkeyword_by_appid();

View File

@@ -0,0 +1,8 @@
<?php
if (!defined('IN_OAOOA')) {
exit('Access Denied');
}
ignore_user_abort(true);
@set_time_limit(0);
dfsockopen(getglobal('localurl') . 'index.php?mod=pichome&op=delete', 0, '', '', false, '', 1);

View File

@@ -0,0 +1,7 @@
<?php
if(!defined('IN_OAOOA')) {
exit('Access Denied');
}
ignore_user_abort(true);
@set_time_limit(0);
dfsockopen(getglobal('localurl'). 'index.php?mod=imageColor&op=index',0, '', '', false, '', 1);

View File

@@ -0,0 +1,8 @@
<?php
if(!defined('IN_OAOOA')) {
exit('Access Denied');
}
ignore_user_abort(true);
@set_time_limit(0);
dfsockopen(getglobal('localurl'). 'index.php?mod=ffmpeg&op=getinfo',0, '', '', false, '', 1);

View File

@@ -0,0 +1,7 @@
<?php
if(!defined('IN_OAOOA')) {
exit('Access Denied');
}
ignore_user_abort(true);
@set_time_limit(0);
dfsockopen(getglobal('localurl'). 'index.php?mod=ffmpeg&op=thumb',0, '', '', false, '', 1);

View File

@@ -1,17 +1,15 @@
<?php <?php
if(!defined('IN_OAOOA')) { if(!defined('IN_OAOOA')) {
exit('Access Denied'); exit('Access Denied');
} }
ignore_user_abort(true); ignore_user_abort(true);
@set_time_limit(0); @set_time_limit(0);
$appdata = DB::fetch_all("select * from %t where 1 ",array('pichome_vapp')); $appdata = DB::fetch_all("select * from %t where isdelete = 0 ",array('pichome_vapp'));
foreach($appdata as $v){ foreach($appdata as $v){
$jsonfile = DZZ_ROOT.'library/' . $v['path'] . '/mtime.json'; if($v['state'] == 2){
if (!file_exists($jsonfile)) { dfsockopen(getglobal('localurl'). 'index.php?mod=pichome&op=exportfile&appid='.$v['appid'],0, '', '', false, '', 1);
//删除库 }elseif($v['state'] == 3){
C::t('#pichome#pichome_vapp')->delete_vapp_by_appid($v['appid']); dfsockopen(getglobal('localurl'). 'index.php?mod=pichome&op=exportfilecheck&appid='.$v['appid'],0, '', '', false, '', 1);
}else{ }
dfsockopen(getglobal('localurl'). 'index.php?mod=pichome&op=exportfile&appid='.$v['appid'],0, '', '', false, '', 1);
}
} }

View File

@@ -54,13 +54,13 @@ function updatecache($cachename = '') {
try{ try{
@include_once DZZ_ROOT.'./dzz/'.$entrys[0].'/cache/cache_'.$entrys[1].'.php'; @include_once DZZ_ROOT.'./dzz/'.$entrys[0].'/cache/cache_'.$entrys[1].'.php';
if(function_exists('build_cache_'.$entrys[0].'_'.$entrys[1])) call_user_func('build_cache_'.$entrys[0].'_'.$entrys[1]); if(function_exists('build_cache_'.$entrys[0].'_'.$entrys[1])) call_user_func('build_cache_'.$entrys[0].'_'.$entrys[1]);
elseif(function_exists('build_cache_app_'.$entryr[1])) call_user_func('build_cache_app_'.$entrys[1]); elseif(function_exists('build_cache_app_'.$entrys[1])) call_user_func('build_cache_app_'.$entrys[1]);
}catch(Exception $e){continue;} }catch(Exception $e){continue;}
}elseif(count($entrys)==3){ }elseif(count($entrys)==3){
try{ try{
@include_once DZZ_ROOT.'./'.$entrys[0].'/'.$entrys[1].'/cache/cache_'.$entrys[2].'.php'; @include_once DZZ_ROOT.'./'.$entrys[0].'/'.$entrys[1].'/cache/cache_'.$entrys[2].'.php';
if(function_exists('build_cache_'.$entrys[1].'_'.$entrys[2])) call_user_func('build_cache_'.$entrys[1].'_'.$entrys[2]); if(function_exists('build_cache_'.$entrys[1].'_'.$entrys[2])) call_user_func('build_cache_'.$entrys[1].'_'.$entrys[2]);
elseif(function_exists('build_cache_app_'.$entryr[1])) call_user_func('build_cache_app_'.$entrys[1]); elseif(function_exists('build_cache_app_'.$entrys[1])) call_user_func('build_cache_app_'.$entrys[1]);
}catch(Exception $e){continue;} }catch(Exception $e){continue;}
} else {//插件缓存 } else {//插件缓存

View File

@@ -804,7 +804,7 @@ function avatar_block($uid=0,$headercolors=array(),$class="Topcarousel"){
} }
if(empty($user)) return ''; if(empty($user)) return '';
if($user['avatarstatus']){//用户已经上传头像 if($user['avatarstatus']){//用户已经上传头像
return '<img src="avatar.php?uid='.$user['uid'].'" class="img-circle special_avatar_class" title="'.$user['username'].'">'; return '<img src="avatar.php?uid='.$user['uid'].'&random='.VERHASH.'" class="img-circle special_avatar_class" title="'.$user['username'].'">';
}else{//没有上传头像,使用背景+首字母 }else{//没有上传头像,使用背景+首字母
if($uid){ if($uid){
if($headercolors[$uid]) $headerColor=$headercolors[$uid]; if($headercolors[$uid]) $headerColor=$headercolors[$uid];

View File

@@ -0,0 +1,96 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>{lang about}</title>
<link rel="stylesheet" href="static/jquery_weui/css/weui.min.css">
<link rel="stylesheet" href="static/jquery_weui/css/jquery-weui.min.css">
<link rel="stylesheet" href="static/dzzicon/icon.css">
<script type="text/javascript" src="static/jquery/jquery.min.js"></script>
<style>
html, body {
height: 100%;
}
.about-container {
width: 100%;
height: 100%;
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center;
-webkit-align-content: center;
align-content: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
}
.wrapper {
text-align: center;
}
.about-body p {
margin-bottom: 10px;
}
a {
cursor: pointer;
color: #3779ff;
}
.about-body .logo {
padding: 10px;
margin-bottom: 0;
}
.about-body .name {
font-size: 28px;
margin-bottom: 20px;
}
.about-body .name>span {
padding: 0 2px;
}
.about-body p .guide {
color: #999;
}
.about-copyright {
color: #999;
font-size: 12px;
text-align: center;
padding: 10px;
}
.about-copyright>a {
color: #999;
}
.about-copyright>a:hover {
color: #999;
text-decoration: underline
}
</style>
</head>
<body>
<div class="about-container">
<div class="wrapper">
<div class="modal-body about-body">
<p class="logo"> <img src="$about[logo]" /> </p>
<p class="name">
<!--{if $about['name_zh']}-->
<span class="name-zh">$about[name_zh]</span>
<!--{/if}-->
<!--{if $about['name_en']}-->
<span class="name-en"><b>Dzz</b>$about[name_en]</span>
<!--{/if}-->
</p>
<div class="detail">
<!--{if $about['version']}-->
<p class="version"> <span class="guide">{lang about_current_version}:</span> <span class="text">{eval echo lang('V_'.$license['license_version'])} $about[version]</span> </p>
<!--{/if}-->
<p class="license"> <span class="guide">{lang license_user_sum}:</span> <span class="text">{$ucount} / {eval echo $license[license_limit]?$license[license_limit]:lang('unlimited')}</span> </p>
<p class="license"> <span class="guide">{lang license_to}:</span> <span class="text">{$license[license_company]}</a></span> </p>
<p class="support"> <span class="guide">{lang service_and_support}:</span> <span class="text"> <a href="http://help.oaooa.com" target="_blank">www.oaooa.com</a></span> </p>
</div>
</div>
<div class="about-copyright">Copyright ©2012-{eval echo dgmdate(TIMESTAMP,'Y');} <a href="https://www.oaooa.com" target="_blank" >oaooa.com</a>&nbsp; All Rights Reserved</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,5 @@
<script type="text/javascript">var DZZSCRIPT='{DZZSCRIPT}',LANG='{$_G[language]}', STATICURL = 'static/', IMGDIR = '{$_G[setting][imgdir]}', VERHASH = '{VERHASH}', charset = '{CHARSET}', dzz_uid = '$_G[uid]', cookiepre = '{$_G[config][cookie][cookiepre]}', cookiedomain = '{$_G[config][cookie][cookiedomain]}', cookiepath = '{$_G[config][cookie][cookiepath]}',attackevasive = '{$_G[config][security][attackevasive]}', disallowfloat = '{$_G[setting][disallowfloat]}', REPORTURL = '$_G[currenturl_encode]', SITEURL = '$_G[siteurl]', JSPATH = '$_G[setting][jspath]',MOD_PATH='{MOD_PATH}',APP_URL='{MOD_URL}',MOD_URL='{MOD_URL}';VAPP_URL='{VAPP_URL}';</script>
</head>
<body id="nv_{$_G[basescript]}" class="$bodyClass" >
<div id="append_parent" style="z-index:99999;"></div>
<div id="ajaxwaitid" style="z-index:99999;"></div>

View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title><!--{if !empty($navtitle)}-->$navtitle - <!--{/if}-->$_G[setting][sitename] </title>
<meta name="keywords" content="{if !empty($_G[setting][metakeywords])}{echo htmlspecialchars($_G[setting][metakeywords])}{/if}" />
<meta name="description" content="{if !empty($_G[setting][metadescription])}{echo htmlspecialchars($_G[setting][metadescription])} {/if}" />
<meta name="generator" content="oaooa" />
<meta name="author" content="oaooa" />
<meta name="copyright" content="2012-{eval echo dgmdate(TIMESTAMP,'Y-m-d');} www.oaooa.com" />
<meta name="MSSmartTagsPreventParsing" content="True" />
<meta http-equiv="MSThemeCompatible" content="Yes" />
<meta name="renderer" content="webkit">
<base href="{$_G['siteurl']}" />
<link rel="stylesheet" type="text/css" href="static/jquery_weui/css/weui.min.css?{VERHASH}">
<link rel="stylesheet" type="text/css" href="static/jquery_weui/css/jquery-weui.min.css?{VERHASH}" >
<link rel="stylesheet" type="text/css" href="static/dzzicon/icon.css?{VERHASH}"/>
<script type="text/javascript" src="static/jquery/jquery.min.js?{VERHASH}"></script>
<script type="text/javascript" src="static/jquery/jquery.json-2.4.min.js?{VERHASH}"></script>
<script src="static/jquery_weui/js/jquery-weui.min.js?{VERHASH}" type="text/javascript" charset="utf-8"></script>
<script src="static/jquery_weui/js/swiper.min.js?{VERHASH}" type="text/javascript" charset="utf-8"></script>
<script src="static/jquery_weui/js/appevent.js?{VERHASH}" type="text/javascript" charset="utf-8"></script>

View File

@@ -0,0 +1,139 @@
<!--{template common/header_ajax}-->
<!--{if $_GET['action']=='setEventkey'}-->
<style>
#fwin_setEvent .modal-dialog{max-width:450px;}
</style>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title">$typetitle[$type]</h4>
</div>
<div class="modal-body" style="padding:30px;">
<form class="form-horizontal">
<input type="hidden" id="eventkey" />
<!--{if $type=='click'}-->
<div class="form-group">
<!--{if $menu_select[click]}-->
<select class="form-control" id="js_select_click" onchange="eventkey_select_change(this)">
<option value="" data-url="" >{lang please_choose}</option>
<!--{loop $menu_select[click] $key $value}-->
<option value="$key" >$value</option>
<!--{/loop}-->
<option value="keys" >{lang custom}KEY</option>
</select>
<!--{else}-->
<input type="hidden" id="js_select_click" value="keys" />
<input type="text" class="form-control js_input_limit" data-limit="64" id="js_select_click_input" value="" >
<p class="help-inline">{lang menu_information_not_more_than_64_words}</p>
<p class="help-inline">{lang set_value_interface_function_effect}</p>
<!--{/if}-->
</div>
<div class="form-group hidden">
<input type="text" class="form-control js_input_limit" data-limit="64" id="js_select_click_input" value="" >
<p class="help-inline">{lang menu_information_not_more_than_64_words}</p>
<p class="help-inline">{lang set_value_interface_function_effect}</p>
</div>
<!--{else}-->
<div class="form-group">
<!--{if $menu_select[link]}-->
<select class="form-control" id="js_select_link" onchange="eventkey_select_change(this)">
<option value="" data-url="" >{lang please_choose}</option>
<!--{loop $menu_select[link] $key $value}-->
<option value="$key" >$value</option>
<!--{/loop}-->
<option value="links">{lang custom_link}</option>
</select>
<!--{else}-->
<input type="hidden" id="js_select_link" value="links" />
<input type="text" class="form-control" id="js_select_link_input" value="" >
<span class="help-inline">{lang member_click_skip_link}</span>
<!--{/if}-->
</div>
<div class="form-group hidden">
<input type="text" class="form-control" id="js_select_link_input" value="">
<span class="help-inline">{lang member_click_skip_link}</span>
</div>
<!--{/if}-->
</form>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary btn-width" data-dismiss="modal" onclick="setEventkeyComplete()"><strong>{lang confirms}</strong></button>&nbsp;&nbsp; <button type="button" data-dismiss="modal" class="btn btn-default"><strong>{lang cancel}</strong></button>
</div>
<script type="text/javascript" reload="1">
jQuery('.fwinmask .focus').select();
var dataid='$_GET[dataid]';
var menuarr=$json_menu_select;
var type='$type';
if(dataid!=''){
var li=jQuery('.js_li[data-id='+dataid+']');
if(type=='click'){
var val=li.attr('data-key');
if(!val ||(val && !menuarr['click'][val])){
val='keys';
}
jQuery('#js_select_click').val(val);
jQuery('#eventkey').val(val);
jQuery('#js_select_click_input').val(val);
if(val=='keys'){
jQuery('#js_select_click_input').parent().removeClass('hidden').end().val(li.attr('data-key')).focus();
}
}else{
var val=li.attr('data-url');
if(!val ||(val && !menuarr['link'][val])){
val='links';
}
//jQuery('#js_link_select').val(val);
jQuery('#js_select_link').val(val);
jQuery('#eventkey').val(val);
jQuery('#js_select_link_input').val(val);
if(val=='links'){
jQuery('#js_select_link_input').parent().removeClass('hidden').end().val(li.attr('data-url')).focus();
}
}
}
function eventkey_select_change(obj){
var el=jQuery(obj);
if(el.val()=='keys'){
jQuery('#js_select_click_input').parent().removeClass('hidden').end().focus();
}else{
jQuery('#js_select_click_input').parent().addClass('hidden');
}
if(el.val()=='links'){
jQuery('#js_select_link_input').parent().removeClass('hidden').end().focus();
}else{
jQuery('#js_select_link_input').parent().addClass('hidden');
}
jQuery('#eventkey').val(el.val());
}
function setEventkeyComplete(){
var li=jQuery('.js_li[data-id='+dataid+']');
var val=jQuery('#eventkey').val();
if(val=='') return;
if(type=='click'){
if(val=='keys'){
val=jQuery('#js_select_click_input').val();
}
li.attr('data-type','click');
li.attr('data-key',val);
li.find('.btn-group').replaceWith('<a class=" pull-right js_click " href="javascript:;" title="{lang menu}KEY" onclick="setEventkey(this,\'click\');return false"><span class="icon icon_click_gray"></span></a>');
}else{
if(val=='links'){
val=jQuery('#js_select_link_input').val();
}
li.attr('data-type','view');
li.attr('data-url',val);
li.find('.btn-group').replaceWith('<a class=" pull-right js_link" href="javascript:;" title="{lang skip_links}" onclick="setEventkey(this,\'link\');return false"><span class="icon icon_link_gray"></span></a>');
}
}
</script>
<!--{/if}-->
<!--{template common/footer_ajax}-->

View File

@@ -0,0 +1,232 @@
<style>
.group-tabul{
margin-left: 0px;
padding-left: 0px;
float: left;
}
.line {
height: 2px;
margin: 10px 0;
font-size: 0;
overflow: hidden;
background-color: transparent;
border-width: 0;
border-top: 1px solid #e7e7e7;
border-bottom: 1px solid #FFF;
}
/*.pull-in {*/
/*margin-left: -15px;*/
/*margin-right: -15px;*/
/*}*/
/*.line-dashed {
border-style: dashed;
background: transparent;
}*/
.form-horizontal .form-group {
margin-right: 0;
margin-left: 0;
}
.line-lg {
margin-top: 15px;
margin-bottom: 15px;
}
.relative {
position: relative;
}
.form-group {
margin-bottom: 0;
}
.copy-success {
position: absolute;
left: -210px;
top: -15px;
padding: 8px;
}
.absoluter {
position: absolute;
right: 0;
top: 0;
padding: 5px;
}
.panel-body {
padding: 15px 0;
}
.ul_hide{
display: block;
}
.form-group .input-black .input-animate {
background-image: -webkit-gradient(linear, left top, left bottom, from(#4c89fb), to(#4c89fb)), -webkit-gradient(linear, left top, left bottom, from(#e6e8eb), to(#e6e8eb));
background-image: -webkit-linear-gradient(#4c89fb, #4c89fb), -webkit-linear-gradient(#e6e8eb, #e6e8eb);
background-image: -o-linear-gradient(#4c89fb, #4c89fb), -o-linear-gradient(#e6e8eb, #e6e8eb);
background-image: linear-gradient(#4c89fb, #4c89fb), linear-gradient(#e6e8eb, #e6e8eb);
}
.form-group .input-black .input-animate.animate {
background-image: -webkit-gradient(linear, left top, left bottom, from(#4c89fb), to(#4c89fb)), -webkit-gradient(linear, left top, left bottom, from(#e6e8eb), to(#e6e8eb));
background-image: -webkit-linear-gradient(#4c89fb, #4c89fb), -webkit-linear-gradient(#e6e8eb, #e6e8eb);
background-image: -o-linear-gradient(#4c89fb, #4c89fb), -o-linear-gradient(#e6e8eb, #e6e8eb);
background-image: linear-gradient(#4c89fb, #4c89fb), linear-gradient(#e6e8eb, #e6e8eb);
}
</style>
<div class="main-header clearfix">
<ul class="group-tabul" style="margin-bottom:0px">
<li class="active"><a href="{$baseurl_info}">{eval echo $base_info_title?$base_info_title:'{lang application_message}';}</a></li>
<li><a href="{$baseurl_menu}">{eval echo $base_menu_title?$base_menu_title:'{lang application_menu}';}</a></li>
</ul>
</div>
<div class="main-content" style="border-top:1px solid #FFF">
<div class="panel-body" >
<div class="entity-panel-body form-horizontal">
<div class="form-group clearfix relative"> <img src="$wxapp[icon]" style="width:80px;position:absolute;left:20px;top:0px">
<div class=" ml20" style="padding-left:100px;">
<h4 class="relative"><strong>$wxapp[name]</strong></h4>
<p class="relative" style="padding-top:5px">$wxapp[desc]</p>
</div>
</div>
<div class="line line-dashed line-lg pull-in"></div>
<div class="form-group clearfix relative">
<form name="settingform" class="form-horizontal form-horizontal-left" action="$baseurl_info" method="post" style="margin:0">
<input type="hidden" name="settingsubmit" value="true" />
<input type="hidden" name="formhash" value="{FORMHASH}" />
<div class="form-group">
<div class="input-black input-static input-form">
<label class="control-label wxlabel">AgendID</label><br>
<div class="input-animate" style="width: 200px;display: inline-block;margin-top: 15px;">
<input type="text" id="agentid" class="form-control" name="agentid" value="$wxapp[agentid]" placeholder="AgendID">
</div>
<span class="help-inline help-info">{lang access_method_login_application}</span>
</div>
<!--<label class="control-label" for="agentid">AgendID</label>-->
<!--<input id="agentid" type="text" class="form-control" style="width:80px;" name="agentid" value="$wxapp[agentid]" />-->
<!--<span class="help-inline">{lang access_method_login_application}</span>-->
</div>
<div class="form-group">
<div class="input-black input-static input-form">
<label class="control-label wxlabel">Secret</label><br>
<div class="input-animate" style="width: 200px;display: inline-block;margin-top: 15px;">
<input type="text" id="agentid" class="form-control" name="secret" value="$wxapp[secret]" placeholder="Secret">
</div>
<span class="help-inline help-info">{lang access_method_login_application_secret}</span>
</div>
<!--<label class="control-label" for="agentid">Secret</label> -->
<!--<input id="agentid" type="text" class="form-control" style="width:80px;" name="secret" value="$wxapp[secret]" />-->
<!--<span class="help-inline">{lang access_method_login_application_secret}</span>-->
</div>
<div class="form-group">
<div class="input-black input-static input-form">
<label class="control-label wxlabel">{lang application_state}</label><br>
<!--<label class="radio-inline"><input type="radio" name="appstatus" value="0" &lt;!&ndash;{if !$wxapp[status]}&ndash;&gt;checked="checked"&lt;!&ndash;{/if}&ndash;&gt; >{lang open_start}</label>-->
<!--<label class="radio-inline"><input type="radio" name="appstatus" value="1" &lt;!&ndash;{if $wxapp[status]>0}&ndash;&gt;checked="checked"&lt;!&ndash;{/if}&ndash;&gt; >{lang close}</label>-->
<span class="help-inline help-info" style="padding-bottom:0;vertical-align: 0;margin-top: 2px;display: inline-block;padding-left: 0;">{lang application_state_message}</span>
<div style="display:inline-block;margin-bottom: 10px;margin-left: 30px;">
<span class="switch-info">{lang open_start}</span>
<input type="checkbox" class="js-switch-primary" checked="" data-switchery="true">
<script type="text/javascript">
var elem = document.querySelector('.js-switch-primary');
Switchery(elem, {
color: '#62a8ea'
});
</script>
</div>
</div>
<div class="form-group" >
<button type="submit" id="ueditorform_btn" class="btn btn-primary" style="padding:6px 25px;" data-loading-text="{lang In_the_save}" >{lang save}</button>
</div>
</form>
</div>
<div class="line line-dashed line-lg pull-in"></div>
<div class="form-group clearfix padding-left">
<div class="col-sm-12" style="padding: 0">
<p class="form-control-static danger relative"><strong style="font-size: 1em;color: rgba(51, 51, 51, 1);">*{lang need_weixin_enterprises_set}</strong> <a href="http://qy.weixin.qq.com/" target="_blank" class="pull-right btn btn-primary-outline">{lang weixin_enterprises_edit}</a> </p>
</div>
</div>
<!--<div class="line line-dashed line-lg pull-in"></div>-->
<div class="form-group clearfix padding-left margin-10">
<label class="wxlabel-item">
<h5><strong>{lang scope_application_visible}:</strong></h5>
</label>
<div class="wxlabel-info">
<p class="form-control-static relative">{lang top_institutions}<span class="gray">{lang weixin_enterprises_address_book_}</span> </p>
</div>
</div>
<!--<div class="line line-dashed line-lg pull-in"></div>-->
<div class="form-group clearfix padding-left margin-10">
<label class="wxlabel-item">
<h5><strong>{lang trusted_domain_name}:</strong></h5>
</label>
<div class="wxlabel-info">
<p class="">$wxapp[host]<span class="copyBtn-wrap">
<span class="copy-btn js_copy" style="border: none;" data-clipboard-text="$wxapp[host]" title="{lang copy}">{lang copy}</span>
<span class="alert copy-success alert-success hide ">{lang copy_success_paste_need_place}</span> </span> </p>
</div>
</div>
<!--<div class="line line-dashed line-lg pull-in"></div>-->
<div class="form-group clearfix padding-left margin-10">
<label class="col-sm-12" style="padding: 0;color: rgba(104, 120, 146, 1);">
<h5><strong>{lang syntony_URL_configuration_information}:</strong></h5>
</label>
</div>
<div class="form-group clearfix padding-left margin-10">
<label class="wxlabel-item">URL</label>
<div class="wxlabel-info">
<p class="form-control-static relative" style="padding-left:0;">$wxapp[callback] <span class="copyBtn-wrap">
<span class="copy-btn js_copy" data-clipboard-text="$wxapp[callback]" title="{lang copy}">{lang copy}</span>
<span class="alert copy-success alert-success hide ">{lang copy_success_paste_need_place}</span> </span> </p>
</div>
</div>
<div class="form-group clearfix padding-left margin-10">
<label class="wxlabel-item">Token</label>
<div class="wxlabel-info">
<p class="form-control-static relative">$wxapp['token'] <span class="copyBtn-wrap">
<span class="copy-btn js_copy" data-clipboard-text="$wxapp[token]" title="{lang copy}">{lang copy}</span>
<span class="alert copy-success alert-success hide ">{lang copy_success_paste_need_place}</span> </span> </p>
</div>
</div>
<div class="form-group clearfix padding-left margin-10">
<label class="wxlabel-item">AESKey</label>
<div class="wxlabel-info">
<p class="form-control-static relative">$wxapp[encodingaeskey] <span class="copyBtn-wrap">
<span class="copy-btn js_copy" data-clipboard-text="$wxapp[encodingaeskey]" title="{lang copy}">{lang copy}</span>
<span class="alert copy-success alert-success hide ">{lang copy_success_paste_need_place}</span> </span> </p>
</div>
</div>
<div class="line line-dashed line-lg pull-in"></div>
<label class="col-sm-12" style="padding: 0">
<h5><strong>{lang other_configuration_information}</strong></h5>
</label>
<div class="col-sm-12" style="margin-bottom:20px;padding: 0;">
<p class="form-control-static relative">
<img src="$wxapp[otherpic]" style="max-width:100%">
</p>
</div>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function(e) {
jQuery('.input-black').each(function() {
InputAnimate.init(jQuery(this));
})
var client = new ZeroClipboard(jQuery('.js_copy'));
client.on( "load", function( client ) {
// alert( "ZeroClipboard SWF is ready!" );
client.on( "complete", function( client,args ) {
var self=this;
jQuery(this).parent().find('.copy-success').removeClass('hide');
window.setTimeout(function(){
jQuery(self).parent().find('.copy-success').addClass('hide');
},1000);
});
});
});
</script>
<script src="static/js/ZeroClipboard/ZeroClipboard.min.js?{VERHASH}"></script>
<script src="static/js/input_field.js"></script>
<!--{template common/footer_simple}-->

View File

@@ -0,0 +1,503 @@
<style>
.group-tabul{
margin-left: 0px;
padding-left: 0px;
float: left;
}
.custom_menu_list {
padding: 2px 15px;
border-top: 1px solid #FFF;
border-bottom: 1px solid #e5e5e5;
height: 38px;
overflow:visible;
}
.custom_menu_list:hover{
background:#F7F7F7;
}
.custom_menu_addName, .custom_menu_name, .custom_menu_subName {
height: 34px;
line-height: 32px;
display: inline-block;
vertical-align: middle;
cursor: pointer;
}
.js_add_second{
padding-left:42px;
}
.custom_menu_list.cm_subname {
padding-left: 42px;
}
.custom_menu_title_text {
padding: 12px 15px 12px 35px;
border-bottom: 1px solid #e5e5e5;
margin:0;
}
.hover_visible{
opacity:0;
_filter: Alpha(opacity=0);
}
.custom_menu_list:hover .hover_visible{
opacity:1;
_filter: Alpha(opacity=100);
}
.custom_menu_list.editing:hover .hover_visible,.custom_menu_list.editing .hover_visible{
display:none;
}
.custom_menu_input{
height: 26px;
border: 1px solid #ddd;
outline: 0;
width: 250px;
padding:0 5px;
display: none;
margin: 2px 0;
}
.custom_menu_notice {
margin-left: 20px;
display: none;
color: #da4a38;
}
.error .custom_menu_input{
border-color:#da4a38;
}
.error .js_input_limit{
border-color:#da4a38;
}
.error .custom_menu_notice{
display:inline-block;
}
.custom_menu_list.editing .custom_menu_subName,.custom_menu_list.editing .custom_menu_name,.custom_menu_list.editing .custom_menu_addName,.custom_menu_list.editing .icon{
display:none;
}
.custom_menu_list.editing .custom_menu_input{
display:inline-block;
}
.icon {
display: inline-block;
width: 24px;
height: 24px;
background-image: url(static/image/common/icon_main.png)!important;
background-repeat: no-repeat!important;
}
.icon_click_gray {
width: 28px;
height: 16px;
background-position: -224px -126px;
}
.icon_link_gray {
width: 20px;
height: 20px;
background-position: -190px -158px;
}
.custom_menu_list .icon_link_gray {
margin: 8px 0 0;
}
.custom_menu_list .icon_click_gray {
margin: 8px -4px 0 0;
}
.custom_menu_list .icon_arrow_down, .custom_menu_list .icon_arrow_right {
margin-right: 8px;
}
.icon_arrow_down {
width: 8px;
height: 8px;
background-position: -64px -96px;
}
.custom_menu_list .icon_add_small {
vertical-align: -3px;
margin-right: 5px;
}
.icon_add_small {
width: 14px;
height: 14px;
background-position: -32px -160px;
}
.icon_edit_gray {
height: 16px;
width: 16px;
background-position: -192px -33px;
}
.custom_menu_list .icon_edit_gray {
vertical-align: middle;
margin-left: 8px;
}
.custom_menu_list .icon_remove {
margin: 8px 0 0 10px;
}
.icon_remove, .icon_remove_gray {
width: 16px;
height: 17px;
background-position: -160px -32px;
}
</style>
<div class="main-header clearfix">
<ul class="group-tabul" style="margin-bottom:0px">
<li><a href="{$baseurl_info}">{eval echo $base_info_title?$base_info_title:'{lang application_message}';}</a></li>
<li class="active"><a href="{$baseurl_menu}">{eval echo $base_menu_title?$base_menu_title:'{lang application_menu}';}</a></li>
</ul>
</div>
<div class="main-content" style="border-top:1px solid #FFF;">
<ul class="help-block text_center custom_menu_title_text ">
<li>{lang creat_three_level_menu}</li>
<li>{lang edit_menu_in_the_user_can_not_see}</li>
<li>{lang menu_release_24_hours_to_update}</li>
<li>{lang drag_can_be_sorted}</li>
</ul>
<div class="custom_menu_mainList_wrap">
<!--{loop $menu[button] $key $value}-->
<div class="custom_cmname_list_wrap">
<div class="custom_menu_list cm_name js_li clearfix" data-id="$key" data-name="$value[name]" data-type="$value[type]" <!--{if $value[type]=='click'}--> data-key="$value[key]"<!--{elseif $value[type]=='view'}-->data-url="$value[url]"<!--{/if}-->>
<a class="icon icon_remove pull-right js_menu_remove hover_visible" href="javascript:;"></a>
<span class="icon icon_arrow_down"></span><span class="custom_menu_name">$value[name]</span>
<!--{if $value[type] && $value[type]=='view'}-->
<a class=" pull-right js_link" href="javascript:;" title="{lang skip_links}" onclick="setEventkey(this,'link');return false"><span class="icon icon_link_gray"></span></a>
<!--{elseif $value[type]}-->
<a class=" pull-right js_click " href="javascript:;" title="{lang menu}KEY" onclick="setEventkey(this,'click');return false"><span class="icon icon_click_gray"></span></a>
<!--{/if}-->
<a class="js_change_name ml10 hover_visible icon icon_edit_gray" href="javascript:;" title="{lang modification}"></a>
<input type="text" class="custom_menu_input js_add_2_menu js_input_limit " value="$value[name]" autofocus data-limit="8">
<span class="custom_menu_notice ">{lang level_1_menu_name_limit_beyond_truncation}</span>
</div>
<div class="custom_menu_list_wrap" data-id="$key">
<!--{loop $value[sub_button] $key1 $value1}-->
<div class="custom_menu_list cm_subname js_li clearfix" data-id="{$key}_{$key1}" data-name="$value1[name]" data-type="$value1[type]" <!--{if $value1[type]=='click'}--> data-key="$value1[key]"<!--{elseif $value1[type]=='view'}-->data-url="$value1[url]"<!--{/if}-->>
<a class="icon icon_remove pull-right js_menu_remove hover_visible" href="javascript:;"></a>
<span class="custom_menu_subName">$value1[name]</span>
<!--{if $value1[type]=='view'}-->
<a class=" pull-right js_link" href="javascript:;" title="{lang skip_links}" onclick="setEventkey(this,'link');return false"><span class="icon icon_link_gray"></span></a>
<!--{elseif $value1[type]=='click'}-->
<a class=" pull-right js_click " href="javascript:;" title="{lang menu}KEY" onclick="setEventkey(this,'click');return false"><span class="icon icon_click_gray"></span></a>
<!--{/if}-->
<a class="js_change_name ml10 hover_visible icon icon_edit_gray" href="javascript:;" title="{lang modification}"></a>
<input type="text" class="custom_menu_input js_add_2_menu js_input_limit" value="$value1[name]" autofocus data-limit="16" >
<span class="custom_menu_notice ">{lang level_2_menu_name_limit_beyond_truncation}</span>
</div>
<!--{/loop}-->
</div>
<div class="custom_menu_list js_add_second" data-id="$key">
<span class="icon icon_add_small"></span>
<span class="custom_menu_addName gray">{lang add_second_level_of_menus}</span>
<input type="text" class="custom_menu_input js_add_2_menu js_input_limit" data-limit="16" autofocus placeholder="{lang level_2_menu_name_limit}">
<span class="custom_menu_notice ">{lang level_2_menu_name_limit_beyond_truncation}</span>
</div>
</div>
<!--{/loop}-->
</div>
<div class="custom_menu_list js_add">
<span class="icon icon_add_small"></span>
<span class="custom_menu_addName gray">{lang add_themselves_menu}</span>
<input type="text" class="custom_menu_input js_add_menu js_input_limit " data-limit="8" autofocus placeholder="{lang level_2_menu_name_limit}">
<span class="custom_menu_notice ">{lang level_1_menu_name_limit_beyond_truncation}</span>
</div>
<div style="padding:10px;">
<button class="btn btn-primary" onclick="menu_save(this)" data-loading-text="{lang In_the_save}" style="width:80px;">{lang save}</button>
&nbsp;&nbsp;<button class="btn btn-success" onclick="menu_publish(this)" data-loading-text="{lang release}" style="width:120px;" <!--{if !$setting['agentid']}-->disabled="disabled"<!--{/if}-->>{lang published_weixin}</button>
&nbsp;&nbsp;<button class="btn btn-danger" onclick="menu_default(this)" data-loading-text="{lang in_recovery}">{lang restore_defaults}</button>
<small class="pull-right gray mt10">{lang release_24_hours_to_update}</small>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function(e) {
check_add_second();
jQuery(document).on('click','.js_change_name',function(){
jQuery(this).parent().addClass('editing');
jQuery(this).parent().find('.custom_menu_input').focus();
});
jQuery(document).on('click','.js_add_second',function(){
if(!jQuery('.custom_menu_list_wrap[data-id='+jQuery(this).attr('data-id')+'] .cm_subname').length){//如果一级目录有事件,弹窗提示;
var self=this;
showDialog('{lang use_the_secondary_menu}', 'confirm', '{lang secondary_menu_confirm}', function(){
jQuery(self).addClass('editing').find('.custom_menu_input').focus();
});
}else{
jQuery(this).addClass('editing');
jQuery(this).find('.custom_menu_input').focus();
}
});
jQuery(document).on('click','.js_add',function(){
jQuery(this).addClass('editing');
jQuery(this).find('.custom_menu_input').focus();
});
jQuery(document).on('click','.js_menu_remove',function(){
var li=jQuery(this).parent();
if(li.hasClass('cm_name')){//是主菜单时,删除所有子菜单
jQuery('.custom_menu_list[data-id='+li.attr('data-id')+']').remove();
jQuery('.custom_menu_list_wrap[data-id='+li.attr('data-id')+']').remove();
}
li.remove();
check_add_second();
});
jQuery(document).on('keyup','.js_input_limit',function(e){
var val=jQuery(this).val();
if(mb_strlen(val)>jQuery(this).attr('data-limit')){
jQuery(this).parent().addClass('error');
}else{
jQuery(this).parent().removeClass('error');
}
if(e.keyCode=='13'){
jQuery(this).trigger('blur');
}
});
jQuery(document).on('blur','.custom_menu_input',function(){
var li=jQuery(this).parent();
var cut_val=mb_cutstr(this.value,jQuery(this).attr('data-limit'));
if(this.value){
if(li.hasClass('js_add_second')){
var pid=li.attr('data-id');
if(jQuery('.custom_menu_list_wrap[data-id='+pid+'] .cm_subname').length<5){//判定是否已经有5个二级菜单了
var html='<div class="custom_menu_list cm_subname js_li clearfix" data-name="'+cut_val+'">'
+' <a class="icon icon_remove pull-right js_menu_remove hover_visible" href="javascript:;"></a>'
+' <span class="custom_menu_subName">'+cut_val+'</span>'
+' <div class="btn-group pull-right eventkey">'
+' <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">'
+' {lang add_the_event_type} <span class="caret"></span>'
+' </button>'
+' <ul class="dropdown-menu" role="menu">'
+' <li><a href="javascript:;" onclick="setEventkey(this,\'click\');return false">{lang menu}key</a></li>'
+' <li><a href="javascript:;" onclick="setEventkey(this,\'link\');return false">{lang jump_page}</a></li>'
+' </ul>'
+' </div>'
+' <a class="js_change_name ml10 hover_visible icon icon_edit_gray" href="javascript:;" title="{lang modification}"></a>'
+' <input type="text" class="custom_menu_input js_add_2_menu js_input_limit " value="'+cut_val+'" autofocus="true" data-limit="16" >'
+' <span class="custom_menu_notice ">{lang level_2_menu_name_limit_beyond_truncation}</span>'
+' </div>';
jQuery('.custom_menu_list_wrap[data-id='+pid+']').append(html);
jQuery('.js_li[data-id='+pid+']').attr('data-type','').find('.js_click,.js_link,.btn-group').remove();
check_add_second();
init_dragsort(2);
}
this.value='';
}else if(li.hasClass('js_add')){
if(jQuery('.cm_name').length<3){
var html='<div class="custom_menu_list cm_name js_li clearfix" data-name="'+cut_val+'" data-type="">'
+' <a class="icon icon_remove pull-right js_menu_remove hover_visible" href="javascript:;"></a>'
+' <span class="icon icon_arrow_down"></span><span class="custom_menu_name">'+cut_val+'</span>'
+' <a class="js_change_name ml10 hover_visible icon icon_edit_gray" href="javascript:;" title="{lang modification}"></a>'
+' <input type="text" class="custom_menu_input js_add_2_menu js_input_limit " value="'+cut_val+'" autofocus="true" data-limit="8">'
+' <span class="custom_menu_notice ">{lang level_1_menu_name_limit_beyond_truncation}</span>'
+'</div>'
+'<div class="custom_menu_list_wrap"></div>'
+'<div class="custom_menu_list js_add_second">'
+' <span class="icon icon_add_small"></span>'
+' <span class="custom_menu_addName gray">{lang add_second_level_of_menus}</span>'
+' <input type="text" class="custom_menu_input js_add_2_menu js_input_limit" data-limit="16" autofocus="true" placeholder="{lang level_2_menu_name_limit}">'
+' <span class="custom_menu_notice ">{lang level_2_menu_name_limit_beyond_truncation}</span>'
+'</div>';
jQuery(html).appendTo('.custom_menu_mainList_wrap');
check_add_second();
init_dragsort(1);
}
}else{
li.find('.custom_menu_subName,.custom_menu_name').html(cut_val);
li.attr('data-name',cut_val);
this.value=cut_val;
}
}
li.removeClass('editing');
});
init_dragsort();
});
var ajaxurl='$baseurl_ajax';
function init_dragsort(flag){
if(flag==1) jQuery('.custom_menu_mainList_wrap').dragsort(null,function(){check_add_second();});
else if(flag==2) jQuery('.custom_menu_list_wrap').dragsort(null,function(){check_add_second();});
else{
jQuery('.custom_menu_list_wrap').dragsort(null,function(){check_add_second();});
jQuery('.custom_menu_mainList_wrap').dragsort(null,function(){check_add_second();});
}
}
function menu_save(obj){
var button=jQuery(obj);
button.button('loading');
var menu=[];
jQuery('.custom_menu_mainList_wrap .js_li').each(function(){
var li=jQuery(this);
if(li.hasClass('cm_name')){
var dataid=li.attr('data-id');
var type=li.attr('data-type');
var arr={}
arr['name']=li.attr('data-name');
if(type){
arr['type']=li.attr('data-type');
if(type=='click'){
arr['key']=li.attr('data-key');
}else{
arr['url']=li.attr('data-url');
}
}else{
arr['sub_button']=[];
}
menu.push(arr);
}else if(li.hasClass('cm_subname')){
var id0=li.parent().attr('data-id');
var type=li.attr('data-type');
var arr={};
arr['name']=li.attr('data-name');
if(type){
arr['type']=li.attr('data-type');
if(type=='click'){
arr['key']=li.attr('data-key');
}else{
arr['url']=li.attr('data-url');
}
}
menu[id0]['sub_button'].push(arr);
}
});
jQuery.post(ajaxurl+'&action=menu_save',{menu:menu},function(json){
if(json.msg=='success'){
showmessage('{lang save_success}!','success',1000,1);
}else{
showmessage('{lang save_unsuccess}!','danger',3000,1);
}
button.button('reset');
},'json');
}
function menu_default(obj){
if(confirm('{lang restore_the_default_menu}')){
var button=jQuery(obj);
button.button('loading');
jQuery.post(ajaxurl+'&action=menu_default',function(json){
window.location.reload();
});
}
}
function menu_publish(obj){
var button=jQuery(obj);
button.button('loading');
var menu=[];
if(jQuery('.custom_menu_mainList_wrap .js_li .btn-group').length){
showmessage('{lang none_response_event_please_check}','danger',5000,1);
button.button('reset');
return;
}
jQuery('.custom_menu_mainList_wrap .js_li').each(function(){
var li=jQuery(this);
if(li.hasClass('cm_name')){
var dataid=li.attr('data-id');
var type=li.attr('data-type');
var arr={}
arr['name']=li.attr('data-name');
if(type){
arr['type']=li.attr('data-type');
if(type=='click'){
arr['key']=li.attr('data-key');
}else{
arr['url']=li.attr('data-url');
}
}else{
arr['sub_button']=[];
}
menu.push(arr);
}else if(li.hasClass('cm_subname')){
var id0=li.parent().attr('data-id');
var type=li.attr('data-type');
var arr={};
if(type){
arr['name']=li.attr('data-name');
arr['type']=li.attr('data-type');
if(type=='click'){
marr['key']=li.attr('data-key');
}else{
arr['url']=li.attr('data-url');
}
menu[id0]['sub_button'].push(arr);
}
}
});
jQuery.post(ajaxurl+'&action=menu_publish',{menu:menu},function(json){
if(json.msg=='success'){
showmessage('{lang release_success}!','success',1000,1);
}else{
showmessage(json.error,'danger',3000,1);
}
button.button('reset');
},'json');
}
function setEventkey(obj,type){
var el=jQuery(obj);
var dataid=el.closest('.js_li').attr('data-id');
showWindow('setEvent',ajaxurl+'&action=setEventkey&type='+type+'&dataid='+dataid+'&t='+new Date().getTime());
}
function check_add_second(){
var i=0;
jQuery('.custom_menu_mainList_wrap .custom_menu_list,.custom_menu_mainList_wrap .custom_menu_list_wrap').each(function(){
var me=jQuery(this);
if(me.hasClass('cm_name')){
me.attr('data-id',i);
i++;
}else if(me.hasClass('custom_menu_list_wrap')){
me.attr('data-id',(i-1));
var li=jQuery('.cm_name[data-id='+(i-1)+']');
if(jQuery('.custom_menu_list_wrap[data-id='+(i-1)+'] .cm_subname').length){//有子菜单主菜单去除evnent
jQuery('.custom_menu_list_wrap[data-id='+(i-1)+'] .cm_subname').each(function(index){
var el=jQuery(this);
el.attr('data-id',(i-1)+'_'+index);
if(el.attr('data-type')==''){
jQuery('<div class="btn-group pull-right eventkey"><button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">{lang add_the_event_type}<span class="caret"></span></button><ul class="dropdown-menu" role="menu"> <li><a href="javascript:;" onclick="setEventkey(this,\'click\');return false">{lang menu}key</a></li><li><a href="javascript:;" onclick="setEventkey(this,\'link\');return false">{lang jump_page}</a></li></ul> </div>').appendTo(this);
}
});
li.attr('data-type','').find('.js_click,.js_link,.btn-group').remove();
}else{
if(li.attr('data-type')==''){
li.find('.js_click,.js_link,.btn-group').remove();
jQuery('<div class="btn-group pull-right eventkey"><button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">{lang add_the_event_type}<span class="caret"></span></button><ul class="dropdown-menu" role="menu"> <li><a href="javascript:;" onclick="setEventkey(this,\'click\');return false">{lang menu}key</a></li><li><a href="javascript:;" onclick="setEventkey(this,\'link\');return false">{lang jump_page}</a></li></ul> </div>').appendTo(li);
}
}
}else if(me.hasClass('js_add_second')){
me.attr('data-id',i-1);
if(jQuery('.custom_menu_list_wrap[data-id='+(i-1)+'] .cm_subname').length>4) me.addClass('hidden');
else me.removeClass('hidden');
}
});
if(i>2){
jQuery('.js_add').addClass('hidden');
}else{
jQuery('.js_add').removeClass('hidden');
}
}
function mb_strlen(str) {
var len = 0;
for(var i = 0; i < str.length; i++) {
len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? 2 : 1;
}
return len;
}
function mb_cutstr(str, maxlen) {
var len = 0;
var ret = '';
var dot = '';
maxlen = maxlen - dot.length;
for(var i = 0; i < str.length; i++) {
len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? 2 : 1;
if(len > maxlen) {
ret += dot;
break;
}
ret += str.substr(i, 1);
}
return ret;
}
</script>
<script type="text/javascript" src="static/js/jquery.dragsort.js?{VERHASH}"></script>

View File

@@ -0,0 +1,147 @@
<style>
.line {
height: 2px;
margin: 10px 0;
font-size: 0;
overflow: hidden;
background-color: transparent;
border-width: 0;
border-top: 1px solid #e7e7e7;
border-bottom: 1px solid #FFF;
}
.pull-in {
margin-left: -15px;
margin-right: -15px;
}
/*.line-dashed {
border-style: dashed;
background: transparent;
}*/
.line-lg {
margin-top: 15px;
margin-bottom: 15px;
}
.padding-left .col-sm-12 {
padding-left: 40px;
}
.relative {
position: relative;
}
.copy-success {
position: absolute;
left: -210px;
top: -15px;
padding: 8px;
}
.absoluter {
position: absolute;
right: 0;
top: 0;
padding: 5px;
}
</style>
<div class="main-header">
<ul class="nav nav-pills nav-pills-bottomguide">
<li class="active"><a href="{$baseurl_info}">{eval echo $base_info_title?$base_info_title:'{lang application_message}';}</a></li>
<li><a href="{$baseurl_menu}">{eval echo $base_menu_title?$base_menu_title:'{lang application_menu}';}</a></li>
</ul>
</div>
<div class="main-content" style="border-top:1px solid #FFF">
<div class="panel-body" >
<div class="entity-panel-body form-horizontal">
<form id="settingform" name="settingform" class="form-horizontal form-horizontal-left" action="$baseurl_info" method="post" style="margin:0">
<input type="hidden" name="settingsubmit" value="true" />
<input type="hidden" name="formhash" value="{FORMHASH}" />
<dl>
<dt>AppID:</dt>
<dd class="clearfix">
<input type="text" id="AppID" class="form-control" name="AppID" value="$setting[AppID]" required="true" />
<span class="help-block">{lang developer_credentials_login_commonality_terrace}</span>
</dd>
</dl>
<dl>
<dt>AppSecret:</dt>
<dd class="clearfix">
<input type="text" id="AppSecret" class="form-control" name="AppSecret" value="$setting[AppSecret]" required="true" />
<span class="help-block">{lang developer_credentials_login_commonality_terrace}</span>
</dd>
</dl>
<dl>
<dd>
<input type="hidden" id="fbind" name="fbind" value="bind" />
<button class="btn btn-success btn-width" onclick="document.getElementById('settingform').onsubmit();" >{lang bundle}</button>
&nbsp;&nbsp;<button class="btn btn-danger btn-width" onclick="document.getElementById('fbind').value='unbind';document.getElementById('settingform').onsubmit();">{lang unbundle}</button>
</dd>
</dl>
</form>
<div class="line line-dashed line-lg pull-in"></div>
<div class="form-group clearfix padding-left">
<div class="col-sm-12">
<p class="form-control-static danger relative"><i class="glyphicon glyphicon-hand-down"></i> <strong style="font-size:1.5em">{lang need_developer_center_settings}</strong> <a href="https://mp.weixin.qq.com/advanced/advanced?action=dev" target="_blank" class="pull-right btn btn-default">{lang weixin_public_number}</a> </p>
</div>
</div>
<div class="line line-dashed line-lg pull-in"></div>
<div class="form-group clearfix padding-left">
<label class="col-sm-12">
<h5><strong>{lang server_configuration_information}</strong></h5>
</label>
</div>
<div class="form-group clearfix padding-left">
<label class="col-xs-2 control-label">URL({lang server_address})</label>
<div class="col-xs-10">
<p class="form-control-static relative" style="padding-left:0;">$wxmp[callback] <span class="absoluter">
<button class="btn btn-default js_copy" data-clipboard-text="$wxmp[callback]" title="{lang copy}">{lang copy}</button>
<span class="alert copy-success alert-success hide ">{lang copy_success_paste_need_place}</span> </span> </p>
</div>
</div>
<div class="form-group clearfix padding-left">
<label class="col-xs-2 control-label">Token({lang token})</label>
<div class="col-xs-10">
<p class="form-control-static relative">$wxmp['token'] <span class="absoluter">
<button class="btn btn-default js_copy" data-clipboard-text="$wxmp[token]" title="{lang copy_success_paste_need_place}">{lang copy_success_paste_need_place}</button>
<span class="alert copy-success alert-success hide ">{lang copy_success_paste_need_place}</span> </span> </p>
</div>
</div>
<div class="form-group clearfix padding-left">
<label class="col-xs-2 control-label">EncodingAESKey({lang message_encryption_key})</label>
<div class="col-xs-10">
<p class="form-control-static relative">$wxmp[encodingaeskey] <span class="absoluter">
<button class="btn btn-default js_copy" data-clipboard-text="$wxmp[encodingaeskey]" title="{lang copy}">{lang copy}</button>
<span class="alert copy-success alert-success hide ">{lang copy_success_paste_need_place}</span> </span> </p>
</div>
</div>
<div class="form-group clearfix padding-left">
<label class="col-xs-2 control-label">{lang message_encryption}</label>
<div class="col-xs-10">
<p class="form-control-static relative">{lang safe_mode}</p>
</div>
</div>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function(e) {
var client = new ZeroClipboard(jQuery('.js_copy'));
client.on( "load", function( client ) {
// alert( "ZeroClipboard SWF is ready!" );
client.on( "complete", function( client,args ) {
var self=this;
jQuery(this).parent().find('.copy-success').removeClass('hide');
window.setTimeout(function(){
jQuery(self).parent().find('.copy-success').addClass('hide');
},1000);
});
});
});
</script>
<script src="static/js/ZeroClipboard/ZeroClipboard.min.js?{VERHASH}"></script>
<!--{template common/footer_simple}-->

0
data/log/index.htm Normal file
View File

0
data/template/index.htm Normal file
View File

View File

@@ -0,0 +1,852 @@
<?php
if (!defined('IN_OAOOA')) {
exit('Access Denied');
}
@set_time_limit(0);
@ini_set('max_execution_time', 0);
require_once(DZZ_ROOT . './dzz/class/class_encode.php');
require_once libfile('function/user', '', 'user');
use \core as C;
use \DB as DB;
use \IO as IO;
use \ImagePalette as ImagePalette;
use \Color as Color;
class billfishxport
{
public $palette = array(
0x111111, 0xFFFFFF, 0x9E9E9E, 0xA48057, 0xFC85B3, 0xFF2727, 0xFFA34B, 0xFFD534, 0x47C595, 0x51C4C4, 0x2B76E7, 0x6D50ED
);
private $path = '';//待执行数据path
private $appid = 0;//库id
private $uid = 0;//用户id
private $username = null;//用户名
private $filenum = 0;//总文件数
private $checklimit = 1000;
private $onceexportnum = 100;
private $getinfonum = 0;
private $readtxt = DZZ_ROOT . './data/attachment/cache/';
private $exportstatus = 0;
private $donum = 0;
private $lastid = '';
private $charset = 'UTF-8';
private $version = '';
private $notallowext = '';
private $db = null;
public function __construct($data = array())
{
global $Defaultallowext;
//获取导入记录表基本数据
$this->path = $data['path'];
$this->appid = $data['appid'];
$this->uid = $data['uid'];
$this->username = $data['username'];
$this->exportstatus = $data['state'];
$this->donum = $data['donum'];
$this->filenum = $data['filenum'];
$this->lastid = $data['lastid'];
$this->version = $data['version'];
if ($data['charset']) $this->charset = $data['charset'];
//尝试连接数据库
$connect = $this->connect_db();
if (!is_object($connect)) {
return $connect;
} else {
$this->db = $connect;
}
}
public function connect_db()
{
$dsn = 'sqlite:' . $this->path . BS . '.bf' . BS . 'billfish.db';
try {
return new PDO($dsn);
} catch (PDOException $e) {
return array('error' => $e->getMessage());
}
}
public function fetch($sql)
{
$q = $this->db->query($sql);
$rows = $q->fetch(PDO::FETCH_ASSOC);
return $rows;
}
public function fetch_all($sql)
{
$q = $this->db->query($sql);
$rows = $q->fetchAll(PDO::FETCH_ASSOC);
return $rows;
}
public function initExport()
{
//修改导入状态为1
$versionsql = " SELECT version from library where 1";
$versions = $this->fetch($versionsql);
$this->version = $versions['version'];
C::t('pichome_vapp')->update($this->appid, array('state' => 1,'version'=>intval($this->version)));
if($this->version >= 30){
//查询res_join_tag是否有文件id索引
$fecthsql = "SELECT * FROM sqlite_master WHERE type = 'index'";
$indexdata = $this->fetch_all($fecthsql);
$indexarr = array_column($indexdata,'name');
//如果标签表iid没有索引创建res_join_tag_iid_idx索引
if(!in_array('res_join_tag_id',$indexarr)){
$createsql = "CREATE INDEX res_join_tag_id ON bf_tag_join_file (tag_id ASC )";
$this->db->query($createsql);
}
//查询待导入文件数
// $sql = "select count(f.id) as num from bf_file f left join bf_material m on f.id = m.file_id where m.is_recycle =0 ";
$sql = "select count(id) as num from bf_file where 1";
$data = $this->fetch($sql);
$this->filenum = $data['num'];
}else{
//查询res_join_tag是否有文件id索引
$fecthsql = "SELECT * FROM sqlite_master WHERE type = 'index'";
$indexdata = $this->fetch_all($fecthsql);
$indexarr = array_column($indexdata,'name');
//如果标签表iid没有索引创建res_join_tag_iid_idx索引
if(!in_array('res_join_tag_iid',$indexarr)){
$createsql = "CREATE INDEX res_join_tag_iid ON res_join_tag ( iid ASC )";
$this->db->query($createsql);
}
//查询待导入文件数
//$sql = "select count(s.id) as num from source s left join res_prop rp on s.id = rp.iid where rp.action =0 ";
$sql = "select count(id) as num from source where 1 ";
$data = $this->fetch($sql);
$this->filenum = $data['num'];
}
//如果没有数据,视为导入成功
if (!$this->filenum) {
C::t('pichome_vapp')->update($this->appid, array('state' => 4));
} else {
C::t('pichome_vapp')->update($this->appid, array('state' => 2, 'filenum' => $this->filenum));
}
return array('success' => true);
}
//获取文件可访问的真实地址
public function getFileRealFileName($filepath,$filename){
$charsetarr = ['GBK','GB18030'];
$returnname = $filename;
if(!is_file($filepath.BS.$filename)){
foreach ($charsetarr as $v){
$filemetadataname = diconv($filename, CHARSET, $v);
if(is_file($filepath.BS.$filemetadataname)){
$returnname = $filemetadataname;
break;
}
}
}
return $returnname;
}
public function execExport($force = false)
{
if($this->version < 30){
$this->oldexport($force);
}else{
$this->export($force);
}
}
public function export($force = false){
//开始页数
if ($this->lastid) {
$start = $this->lastid;
} else $start = 1;
$lastid = $start;
$start = ($start-1)*$this->onceexportnum;
$sql = "select f.*,m.w,m.h,m.is_recycle,m.thumb_tid,mu.comments_detail,mu.note,mu.score,mu.origin from bf_file f
left join bf_material m on m.file_id = f.id
left join bf_material_userdata mu on mu.file_id=f.id
where 1 limit $start,$this->onceexportnum";
$datas = $this->fetch_all($sql);
foreach ($datas as $v) {
//查询文件是否在回收站
$id = $v['id'];//文件id
$rid = md5($this->appid . $id);
//如果文件在回收站
if ($v['is_recycle'] > 0) {
//如果已经有数据,标记为已删除
if (DB::fetch_first("select count(rid) from %t where rid = %s", array('pichome_resources', $rid))) {
C::t('pichome_resources')->update($rid, array('isdelete' => 1));
}
//文件总数减1
$this->filenum -= 1;
}
else {
//获取文件后缀
$ext = strtolower(substr(strrchr($v['name'], '.'), 1));
//获取文件类型
$type = getTypeByExt($ext);
//出入主表数据
$setarr = [
'rid' => $rid,
'uid'=>$this->uid,
'username'=>$this->username,
'appid' => $this->appid,
'ext' => $ext,
'type' => $type,
'name' => $v['name'],
'mtime' => ($v['mtime']) ? $v['mtime'] * 1000 : $v['born'] * 1000,
'dateline' => $v['ctime'] ? $v['ctime'] * 1000:$v['born']*1000,
'btime' => $v['born'] ? $v['born']*1000:$v['mtime'] * 1000,
'size' => $v['file_size'],
'width' => $v['w'],
'height' => $v['h'],
'grade' => $v['score'],
'apptype' => 2,
'hasthumb' => $v['thumb_tid'] ? 1 : 0,
'thumb' => $v['thumb']
];
//数据插入主表
if (C::t('#billfish#billfish_record')->inser_data($v['id'], $setarr)) {
//定义属性表变量
$attrdata = [];
$attrdata['desc'] = $v['note'];
$attrdata['link'] = $v['origin'];
//将名字记入搜索字段
$attrdata['searchval'] = $setarr['name'].$attrdata['desc'].$attrdata['link'];
//处理目录数据
if ($v['pid']) {
$folderdata = $this->getFolderfid($v['pid']);
//处理目录数据
$fid = $folderdata['fid'];
$folderarr = [
'fid' => $fid,
'appid' => $this->appid,
'rid' => $rid
];
C::t('pichome_folderresources')->insert($folderarr);
$attrdata['path'] = $folderdata['dirpath'] . BS . $setarr['name'];
} else {
$attrdata['path'] = $setarr['name'];
}
//目录数据处理完成
$attrdata['path'] = $this->getFileRealFileName($this->path,$attrdata['path']);
//转码路径 记入属性表
//$p = new Encode_Core();
//$this->charset = $p->get_encoding($attrdata['path']);
//if (CHARSET != $this->charset) $attrdata['path'] = diconv($attrdata['path'],CHARSET, $this->charset);;
//标签数据开始
//查询文件标签id
$sql = "select tag_id from bf_tag_join_file where file_id = $id";//耗时最多
$tiddata = $this->fetch_all($sql);
$tids = [];
foreach ($tiddata as $val) {
$tids[] = $val['tag_id'];
}
if (!empty($tids)) {
$tidstr = dimplode($tids);
//查询标签分类数据
$sql = "select jg.gid,g.name from bf_tag_join_group jg
left join bf_tag_group g on g.id = jg.gid
where jg.tag_id in($tidstr) group by jg.gid";
$taggroupdata = $this->fetch_all($sql);
$relationgroupdata = [];
//插入标签分类关系表及pichome分类返回原分类id对应pichome标签分类id
foreach ($taggroupdata as $val) {
$tmpreturn = C::t('#billfish#billfish_taggrouprecord')->insert_data($val, $this->appid);
$relationgroupdata[$tmpreturn['bcid']] = $tmpreturn['cid'];
}
//处理标签表数据
//查询标签名称,id 插入标签对照表 返回原标签id对应pichome标签id 将标签加入searchval
$sql = " select t.id,t.name,j.gid from bf_tag t
left join bf_tag_join_group j on j.tag_id = t.id where t.id in($tidstr)";
$tagdata = $this->fetch_all($sql);
$tagrelativedata = [];
$taggroups =[];
foreach ($tagdata as $val) {
$tagsetarr = ['name' => $val['name'], 'lid' => $val['id']];
$tmptagrelativedata = C::t('#billfish#billfish_tagrecord')->insert_data($tagsetarr, $this->appid);
$tagrelativedata[$tmptagrelativedata['lid']] = $tmptagrelativedata['tid'];
$attrdata['searchval'] .= $val['name'];
if($val['gid']) $taggroups[] = ['gid'=>$val['gid'],'lid'=>$val['id']];
}
//处理标签与分类关系数据 查询原标签分类和标签id 插入pichome标签分类对应标签id
//$sql = "select gid,lid from tag_join_group where lid in($tidstr)";
//$taggroups = $this->fetch_all($sql);
foreach ($taggroups as $val) {
$tagrelarr = [
'tid' => $tagrelativedata[$val['lid']],
'cid' => $relationgroupdata[$val['gid']],
'appid' => $this->appid,
];
C::t('pichome_tagrelation')->insert($tagrelarr);
}
//处理标签文件关系数据
$inserttids = $ftids = array_values($tagrelativedata);
//查询pichome是否有标签数据
$oattrtag = DB::result_first("select tag from %t where rid = %s", array('pichome_resources_attr', $rid));
if ($oattrtag) {
$ottids = explode(',', $oattrtag);
//取得删除的标签
$deltids = array_diff($ftids, $ottids);
if (!empty($deltids)) C::t('pichome_resourcestag')->delete_by_ridtid($rid, $deltids);
//取得插入的标签
$inserttids = $deltids = array_diff($ottids, $ftids);
}
//插入标签关系表
foreach ($inserttids as $val) {
$tagresourcesattr = ['tid' => $val, 'rid' => $rid, 'appid' => $this->appid];
C::t('pichome_resourcestag')->insert($tagresourcesattr);
}
//更新属性表标签数据
$attrdata['tag'] = implode(',', $ftids);
}
//标签数据结束
//开始处理颜色数据
//查询颜色数据
$sql = "select * from bf_material_color where file_id = $id";
$bcolordata = $this->fetch_all($sql);
//删除原颜色数据
DB::delete('pichome_palette', array('rid' => $rid));
foreach ($bcolordata as $val) {
$colorarr = ['rid' => $rid,
'color' => $val['color'],
'weight' => $val['precent'],
'r' => $val['r'],
'g' => $val['g'],
'b' => $val['b']
];
C::t('pichome_palette')->insert($colorarr);
}
//颜色数据处理结束
//处理标注数据
//删除原标注数据
C::t('pichome_comments')->delete_by_rid($rid);
if ($v['comments_detail']) {
$commentdata = json_decode($v['comments_detail'],true);
foreach ($commentdata as $commentval) {
$tcommentval['id'] = random(13) . $this->appid;
$tentval['appid'] = $this->appid;
$tcommentval['rid'] = $rid;
$tcommentval['x'] = number_format($commentval['x'], 2);
$tcommentval['y'] = number_format($commentval['y'], 2);
$tcommentval['width'] = number_format($commentval['cx'], 2);
$tcommentval['height'] = number_format($commentval['cy'], 2);
$tcommentval['annotation'] = $commentval['comment'];
try {
C::t('pichome_comments')->insert($tcommentval);
$setarr['searchval'] .= $tcommentval['annotation'];
} catch (Exception $e) {
}
}
}
//标注数据处理结束
//处理音视频时长数据
//查询音频时长
$sql = "select duration from bf_material_video where file_id = $id";
$videodata = $this->fetch($sql);
if(isset($videodata['duration'])) $attrdata['duration'] = $videodata['duration'];
//查询视频时长
$sql = "select duration from bf_material_audio where file_id = $id";
$audiodata = $this->fetch($sql);
if(isset($audiodata['duration'])) $attrdata['duration'] = $audiodata['duration'];
//时长处理结束
//插入属性表数据
$attrdata['rid'] = $rid;
$attrdata['appid'] = $this->appid;
C::t('pichome_resources_attr')->insert($attrdata);
$this->donum += 1;
}
else{
//文件总数减1
$this->filenum -= 1;
}
}
//导入百分比
$percent = floor(($this->donum / $this->filenum) * 100);
$percent = ($percent > 100) ? 100 : $percent;
$state = ($percent >= 100) ? 3 : 2;
if ($state == 3) {
$lastid = 0;
}
//记录导入起始位置,以备中断后从此处,更改导入状态
C::t('pichome_vapp')->update($this->appid, array('percent' => $percent, 'donum' => $this->donum, 'state' => $state));
}
if($state == 2){
$lastid = $lastid+1;
C::t('pichome_vapp')->update($this->appid,array('lastid' => $lastid));
}
return array('success' => true);
}
public function oldexport($force = false){
//开始页数
if ($this->lastid) {
$start = $this->lastid;
} else $start = 1;
$lastid = $start;
$start = ($start-1)*$this->onceexportnum;
$sql = "select s.*,p.fid,p.score,p.title,p.origin,p.note,p.action from source s
left join res_prop p on p.iid = s.id
where 1 limit $start,$this->onceexportnum";
$datas = $this->fetch_all($sql);
foreach ($datas as $v) {
//查询文件是否在回收站
$id = $v['id'];//文件id
$rid = md5($this->appid . $id);
//如果文件在回收站
if ($v['action'] > 0) {
//如果已经有数据,标记为已删除
if (DB::fetch_first("select count(rid) from %t where rid = %s", array('pichome_resources', $rid))) {
C::t('pichome_resources')->update($rid, array('isdelete' => 1));
}
//文件总数减1
$this->filenum -= 1;
}
else {
//获取文件后缀
$ext = strtolower(substr(strrchr($v['name'], '.'), 1));
//获取文件类型
$type = getTypeByExt($ext);
//出入主表数据
$setarr = [
'rid' => $rid,
'uid'=>$this->uid,
'username'=>$this->username,
'appid' => $this->appid,
'ext' => $ext,
'type' => $type,
'name' => $v['name'],
'mtime' => ($v['born']) ? $v['born'] * 1000 : $v['lastw'] * 1000,
'dateline' => $v['lastw'] * 1000,
'btime' => TIMESTAMP * 1000,
'size' => $v['size'],
'width' => $v['width'],
'height' => $v['height'],
'grade' => $v['score'],
'apptype' => 2,
'hasthumb' => $v['thumb'] ? 1 : 0,
'thumb' => $v['thumb']
];
//数据插入主表
if (C::t('#billfish#billfish_record')->inser_data($v['id'], $setarr)) {
//定义属性表变量
$attrdata = [];
$attrdata['desc'] = $v['note'];
$attrdata['link'] = $v['origin'];
//将名字记入搜索字段
$attrdata['searchval'] = $setarr['name'].$attrdata['desc'].$attrdata['link'];
//处理目录数据
if ($v['fid']) {
$folderdata = $this->getFolderfid($v['fid']);
//处理目录数据
$fid = $folderdata['fid'];
$folderarr = [
'fid' => $fid,
'appid' => $this->appid,
'rid' => $rid
];
C::t('pichome_folderresources')->insert($folderarr);
$attrdata['path'] = $folderdata['dirpath'] . BS . $setarr['name'];
} else {
$attrdata['path'] = $setarr['name'];
}
//目录数据处理完成
$attrdata['path'] = $this->getFileRealFileName($this->path,$attrdata['path']);
//转码路径 记入属性表
//$p = new Encode_Core();
//$this->charset = $p->get_encoding($attrdata['path']);
//if (CHARSET != $this->charset) $attrdata['path'] = diconv($attrdata['path'],CHARSET, $this->charset);;
//标签数据开始
//查询文件标签id
$sql = "select lid from res_join_tag where iid = $id";//耗时最多
$tiddata = $this->fetch_all($sql);
$tids = [];
foreach ($tiddata as $val) {
$tids[] = $val['lid'];
}
if (!empty($tids)) {
$tidstr = dimplode($tids);
//查询标签分类数据
$sql = "select jg.gid,g.name from tag_join_group jg
left join taggrp g on g.id = jg.gid
where jg.lid in($tidstr) group by jg.gid";
$taggroupdata = $this->fetch_all($sql);
$relationgroupdata = [];
//插入标签分类关系表及pichome分类返回原分类id对应pichome标签分类id
foreach ($taggroupdata as $val) {
$tmpreturn = C::t('#billfish#billfish_taggrouprecord')->insert_data($val, $this->appid);
$relationgroupdata[$tmpreturn['bcid']] = $tmpreturn['cid'];
}
//处理标签表数据
//查询标签名称,id 插入标签对照表 返回原标签id对应pichome标签id 将标签加入searchval
$sql = " select t.id,t.name,j.gid from tag t
left join tag_join_group j on j.lid = t.id where t.id in($tidstr)";
$tagdata = $this->fetch_all($sql);
$tagrelativedata = [];
$taggroups =[];
foreach ($tagdata as $val) {
$tagsetarr = ['name' => $val['name'], 'lid' => $val['id']];
$tmptagrelativedata = C::t('#billfish#billfish_tagrecord')->insert_data($tagsetarr, $this->appid);
$tagrelativedata[$tmptagrelativedata['lid']] = $tmptagrelativedata['tid'];
$attrdata['searchval'] .= $val['name'];
if($val['gid']) $taggroups[] = ['gid'=>$val['gid'],'lid'=>$val['id']];
}
//处理标签与分类关系数据 查询原标签分类和标签id 插入pichome标签分类对应标签id
//$sql = "select gid,lid from tag_join_group where lid in($tidstr)";
//$taggroups = $this->fetch_all($sql);
foreach ($taggroups as $val) {
$tagrelarr = [
'tid' => $tagrelativedata[$val['lid']],
'cid' => $relationgroupdata[$val['gid']],
'appid' => $this->appid,
];
C::t('pichome_tagrelation')->insert($tagrelarr);
}
//处理标签文件关系数据
$inserttids = $ftids = array_values($tagrelativedata);
//查询pichome是否有标签数据
$oattrtag = DB::result_first("select tag from %t where rid = %s", array('pichome_resources_attr', $rid));
if ($oattrtag) {
$ottids = explode(',', $oattrtag);
//取得删除的标签
$deltids = array_diff($ftids, $ottids);
if (!empty($deltids)) C::t('pichome_resourcestag')->delete_by_ridtid($rid, $deltids);
//取得插入的标签
$inserttids = $deltids = array_diff($ottids, $ftids);
}
//插入标签关系表
foreach ($inserttids as $val) {
$tagresourcesattr = ['tid' => $val, 'rid' => $rid, 'appid' => $this->appid];
C::t('pichome_resourcestag')->insert($tagresourcesattr);
}
//更新属性表标签数据
$attrdata['tag'] = implode(',', $ftids);
}
//标签数据结束
//开始处理颜色数据
//查询颜色数据
$sql = "select * from colour where iid = $id";
$bcolordata = $this->fetch_all($sql);
//删除原颜色数据
DB::delete('pichome_palette', array('rid' => $rid));
foreach ($bcolordata as $val) {
$colorarr = ['rid' => $rid,
'color' => $val['bf_clr'],
'weight' => $val['precent'],
'r' => $val['r'],
'g' => $val['g'],
'b' => $val['b']
];
C::t('pichome_palette')->insert($colorarr);
}
//颜色数据处理结束
//处理标注数据
$sql = "select * from comment where iid = $id";
$commentdata = $this->fetch_all($sql);
//删除原标注数据
C::t('pichome_comments')->delete_by_rid($rid);
if ($commentdata) {
foreach ($commentdata as $commentval) {
$tcommentval['id'] = random(13) . $this->appid;
$tentval['appid'] = $this->appid;
$tcommentval['rid'] = $rid;
$tcommentval['x'] = number_format($commentval['x'], 2);
$tcommentval['y'] = number_format($commentval['y'], 2);
$tcommentval['width'] = number_format($commentval['cx'], 2);
$tcommentval['height'] = number_format($commentval['cy'], 2);
$tcommentval['annotation'] = $commentval['comment'];
try {
C::t('pichome_comments')->insert($tcommentval);
$setarr['searchval'] .= $tcommentval['annotation'];
} catch (Exception $e) {
}
}
}
//标注数据处理结束
//处理音视频时长数据
//查询音频时长
$sql = "select duration from video where iid = $id";
$videodata = $this->fetch($sql);
if(isset($videodata['duration'])) $attrdata['duration'] = $videodata['duration'];
//查询视频时长
$sql = "select duration from audio where iid = $id";
$audiodata = $this->fetch($sql);
if(isset($audiodata['duration'])) $attrdata['duration'] = $audiodata['duration'];
//时长处理结束
//插入属性表数据
$attrdata['rid'] = $rid;
$attrdata['appid'] = $this->appid;
C::t('pichome_resources_attr')->insert($attrdata);
$this->donum += 1;
}
else{
//文件总数减1
$this->filenum -= 1;
}
}
//导入百分比
$percent = floor(($this->donum / $this->filenum) * 100);
$percent = ($percent > 100) ? 100 : $percent;
$state = ($percent >= 100) ? 3 : 2;
if ($state == 3) {
$lastid = 0;
}
//记录导入起始位置,以备中断后从此处,更改导入状态
C::t('pichome_vapp')->update($this->appid, array('percent' => $percent, 'donum' => $this->donum, 'state' => $state));
}
$lastid = $lastid+1;
C::t('pichome_vapp')->update($this->appid,array('lastid' => $lastid));
return array('success' => true);
}
public function getFolderfid($bfid, $dirpath = '')
{
$parentfolderdata = [];
if($this->version < 30){
$sql = "select * from folder where id = $bfid";
}else{
$sql = "select * from bf_folder where id = $bfid";
}
$folderdata = $this->fetch($sql);
$dirpath = $folderdata['name'] . ($dirpath ? BS . $dirpath : '');
if ($folderdata['pid']) {
$parentfolderdata = $this->getFolderfid($folderdata['pid'], $dirpath);
}
if($parentfolderdata['dirpath']) $dirpath = $parentfolderdata['dirpath'];
$setarr = [
'pfid' => isset($parentfolderdata['fid']) ? $parentfolderdata['fid'] : '',
'fname' => $folderdata['name'],
'appid' => $this->appid,
'disp'=>($this->version < 30) ? $folderdata['seq']:round($folderdata['seq']*1000000000)
];
$return = C::t('#billfish#billfish_folderrecord')->insert_data($bfid, $setarr);
$return['dirpath'] = $dirpath;
return $return;
}
//校验文件
public function execCheckFile()
{
if ($this->exportstatus == 3) {
$total = DB::result_first("select count(rid) from %t where appid = %s ", array('pichome_resources', $this->appid));
//校验文件
$this->check_file($total);
}
return true;
}
public function check_file($total)
{
if ($this->lastid < 1) $this->lastid = 1;
$limitsql = ($this->lastid - 1) * $this->checklimit . ',' . $this->checklimit;
$delrids = [];
$data = DB::fetch_all("select rid,name from %t where appid = %s order by lastdate asc limit $limitsql ", array('pichome_resources', $this->appid));
if (empty($data)) {
//校验完成后更新目录文件数
foreach (DB::fetch_all("select count(rf.id) as num,f.fid from %t f left join %t rf on rf.fid=f.fid where f.appid = %s group by f.fid", array('pichome_folder', 'pichome_folderresources', $this->appid)) as $v) {
C::t('pichome_folder')->update($v['fid'], array('filenum' => $v['num']));
}
//检查不存在的目录删除
$foldertotal = DB::result_first("select count(id) from %t where appid = %s",array('billfish_folderrecord',$this->appid));
$this->check_notexists_folder($foldertotal);
//检查不存在的标签删除
$tagtotal = DB::result_first("select count(id) from %t where appid = %s",array('billfish_tagrecord',$this->appid));
$this->check_notexists_tag($tagtotal);
if($this->version < 30){
//删除创建的索引
$sql = 'DROP INDEX res_join_tag_iid';
$this->db->query($sql);
}else{
$sql = 'DROP INDEX res_join_tag_id';
$this->db->query($sql);
}
$hascatnum = DB::result_first("SELECT count(DISTINCT rid) FROM %t where appid = %s",array('pichome_folderresources',$this->appid));
$nosubfilenum = $total - $hascatnum;
C::t('pichome_vapp')->update($this->appid, array('percent' => 0, 'state' => 4, 'lastid' => 0, 'donum' => 0,'filenum'=>$total,'nosubfilenum'=>$nosubfilenum));
return true;
}
foreach ($data as $v) {
$rid = $v['rid'];
$iid = DB::result_first("select bid from %t where rid = %s and appid = %s",array('billfish_record',$rid,$this->appid));
if($this->version < 30){
$sql = "select count(s.id) as num from source s left join res_prop rp on s.id = rp.iid where rp.action =0 and s.id = $iid";
}else{
//查询billfish中是否有该数据
$sql = "select count(f.id) as num from bf_file f left join bf_material m on f.id = m.file_id where m.is_recycle =0 and f.id = $iid";
}
$numdata = $this->fetch($sql);
if(!isset($numdata['num']) || !$numdata['num']){
$delrids[] = $rid;
}
}
if (!empty($delrids)) {
$this->filenum = $this->filenum - count($delrids);
//如果有需要删除的,删除后,则重新查询上一页数据
C::t('pichome_resources')->delete_by_rid($delrids);
if($this->lastid == 1){
$percent = round(($this->checklimit / $total) * 100);
}else{
$percent = round((($this->lastid - 1) * $this->checklimit / $total) * 100);
}
C::t('pichome_vapp')->update($this->appid, array('lastid' => $this->lastid, 'percent' => $percent, 'state' => 3, 'filenum' => $this->filenum));
} else {
if($this->lastid == 1){
$percent = round(($this->checklimit / $total) * 100);
}else{
$percent = round((($this->lastid - 1) * $this->checklimit / $total) * 100);
}
$percent = ($percent > 100) ? 100:$percent;
C::t('pichome_vapp')->update($this->appid, array('lastid' => $this->lastid + 1, 'percent' => $percent, 'state' => 3));
}
}
//检查目录数据
public function check_notexists_folder($total){
$tmpkey = 'pichomecheckfolder' . $this->appid;
$folderstart = C::t('cache')->fetch($tmpkey);
if (!$folderstart) {
$folderstart = 0;
}
if($folderstart < $total){
$bfids = [];
//检查不存在的目录删除
foreach(DB::fetch_all("select bfr.bfid as bfid from %t f left join %t bfr on bfr.fid=f.fid where f.appid = %s limit $folderstart,100",array('pichome_folder','billfish_folderrecord',$this->appid)) as $v){
$bfids[] = $v['bfid'];
}
if(empty($bfids)){
C::t('cache')->delete($tmpkey);
return true;
}
$bfidstr = dimplode($bfids);
if($this->version < 30){
$sql = "select id from folder where id in($bfidstr)";
}else{
$sql = "select id from bf_folder where id in($bfidstr)";
}
//查询不存的目录
$bfolder = $this->fetch_all($sql);
$blfids = [];
foreach ($bfolder as $val){
$blfids[] = $val['id'];
}
$delfids = array_diff($bfids,$blfids);
if(!empty($delfids))C::t('#billfish#billfish_folderrecord')->delete_by_bfid($delfids,$this->appid);
$folderstart += 100;
$setarr = ['cachekey' => $tmpkey, 'cachevalue' => $folderstart, 'dateline' => time()];
C::t('cache')->insert($setarr);
$this->check_notexists_folder($total);
}else{
C::t('cache')->delete($tmpkey);
return true;
}
}
//检查标签对照表数据
public function check_notexists_tag($total){
$tmpkey = 'pichomechecktag'.$this->appid;
$tagstart = C::t('cache')->fetch($tmpkey);
if (!$tagstart) {
$tagstart = 0;
}
if($tagstart < $total){
$lids=[];
foreach(DB::fetch_all("select lid from %t where appid = %s limit $tagstart,100 ",array('billfish_tagrecord',$this->appid)) as $v){
$lids[] = $v['lid'];
}
if(empty($lids)){
C::t('cache')->delete($tmpkey);
return true;
}
$lidstr = dimplode(',',$lids);
if($this->version < 30){
$sql = "select id from tag where id in($lidstr)";
}
else $sql = "select id from bf_tag where id in($lidstr)";
$blids =[] ;
foreach($this->fetch_all($sql) as $v){
$blids[] = $v['id'];
}
$deblids = array_diff($lids,$blids);
if(!empty($deblids)) DB::delete('billfish_tagrecord','lid in('.dimplode($deblids).')');
$tagstart += 100;
$setarr = ['cachekey' => $tmpkey, 'cachevalue' => $tagstart, 'dateline' => time()];
C::t('cache')->insert($setarr);
$this->check_notexists_tag($total);
}else{
C::t('cache')->delete($tmpkey);
return true;
}
}
}

View File

@@ -0,0 +1,71 @@
<?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');
}
class table_billfish_folderrecord extends dzz_table
{
public function __construct() {
$this->_table = 'billfish_folderrecord';
$this->_pk = 'id';
parent::__construct();
}
public function insert_data($bfid,$setarr){
$returndata =[];
if($fid = DB::result_first("select fid from %t where bfid = %d and appid = %s",array($this->_table,$bfid,$setarr['appid']))){
C::t('pichome_folder')->update($fid,$setarr);
$setarr['fid'] = $fid;
return $setarr;
}else{
$fpathkey = '';
if($setarr['pfid']){
$fpathkey =DB::result_first("select pathkey from %t where fid = %s and appid = %s",array('pichome_folder',$setarr['pfid'],$setarr['appid']));
}
$setarr['fid'] = random(13) . $setarr['appid'];
$setarr['pathkey'] = ($fpathkey) ? $fpathkey.$setarr['fid']:$setarr['fid'];
if(C::t('pichome_folder')->insert($setarr)){
$setarr1 = [
'bfid'=>$bfid,
'fid'=>$setarr['fid'],
'appid'=>$setarr['appid']
];
if(parent::insert($setarr1,1)){
return $setarr;
}else{
C::t('pichome_folder')->delete($setarr['fid']);
return $returndata;
}
}
}
}
public function delete_by_bfid($bfids,$appid){
if(!is_array($bfids)) $bfids = (array)$bfids;
$delfid = $delid = [];
foreach(DB::fetch_all("select fid,id from %t where bfid in(%n) and appid = %s",array($this->_table,$bfids,$appid)) as $v){
$delfid[] = $v['fid'];
$delid[] = $v['id'];
}
DB::delete('pichome_folderresources',"fid in (".dimplode($delfid).")");
DB::delete('pichome_folder',"fid in (".dimplode($delfid).")");
parent::delete($delid);
}
public function delete_by_appid($appid){
DB::delete($this->_table,array('appid'=>$appid));
}
}

View File

@@ -0,0 +1,43 @@
<?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');
}
class table_billfish_record extends dzz_table
{
public function __construct() {
$this->_table = 'billfish_record';
$this->_pk = 'id';
parent::__construct();
}
public function inser_data($bid,$setarr){
$setarr1['thumb'] = $setarr['thumb'];
unset($setarr['thumb']);
if(C::t('pichome_resources')->insert($setarr)){
$setarr1['rid'] = $setarr['rid'];
$setarr1['appid'] = $setarr['appid'];
$setarr1['bid'] = $bid;
$id = DB::result_first("select id from %t where bid = %d and appid = %s",array($this->_table,$bid,$setarr['appid']));
if($id){
parent::update($id,$setarr1);
}else{
parent::insert($setarr1);
}
}
return true;
}
public function delete_by_appid($appid){
DB::delete($this->_table,array('appid'=>$appid));
}
}

View File

@@ -0,0 +1,42 @@
<?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');
}
class table_billfish_taggrouprecord extends dzz_table
{
public function __construct() {
$this->_table = 'billfish_taggrouprecord';
$this->_pk = 'id';
parent::__construct();
}
public function insert_data($setarr,$appid){
$hasrecord = false;
if($cid = DB::result_first("select cid from %t where bcid=%d and appid = %s",array($this->_table,$setarr['gid'],$appid))){
$data['cid'] = $cid;
$hasrecord = true;
}else{
$data['cid'] = random(13).$appid;
}
$data['catname'] = $setarr['name'];
$data['appid'] = $appid;
$data['dateline'] = TIMESTAMP;
if($cid = C::t('pichome_taggroup')->insert($data)){
if(!$hasrecord) parent::insert(array('cid'=>$cid,'bcid'=>$setarr['gid'],'appid'=>$appid));
return array('bcid'=>$setarr['gid'],'cid'=>$cid);
}
}
public function delete_by_appid($appid){
DB::delete($this->_table,array('appid'=>$appid));
}
}

View File

@@ -0,0 +1,39 @@
<?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');
}
class table_billfish_tagrecord extends dzz_table
{
public function __construct() {
$this->_table = 'billfish_tagrecord';
$this->_pk = 'id';
parent::__construct();
}
public function insert_data($setarr,$appid){
if($id = DB::result_first("select id from %t where lid=%d and appid = %s",array($this->_table,$setarr['lid'],$appid))){
parent::update($id,array('name'=>$setarr['name']));
}else{
$setarr['appid'] = $appid;
parent::insert($setarr);
}
if($tid= DB::result_first("select tid from %t where tagname = %s",array('pichome_tag',$setarr['name']))){
return array('lid'=>$setarr['lid'],'tid'=>$tid);
}else{
$tid = C::t('pichome_tag')->insert($setarr['name']);
}
return array('tid'=>$tid,'lid'=>$setarr['lid']);
}
public function delete_by_appid($appid){
DB::delete($this->_table,array('appid'=>$appid));
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace dzz\billfish\classes;
use \core as C;
use \DB as DB;
use \fmpeg as fmpeg;
class delpichomefolderafter
{
public function run($appid)
{
C::t("#billfish#billfish_folderrecord")->delete_by_appid($appid);
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace dzz\billfish\classes;
use \core as C;
use \DB as DB;
use \fmpeg as fmpeg;
class getpichomethumb
{
public function run(&$data)
{
$thumbid = DB::result_first("select thumb from %t where appid = %s and rid = %s", array('billfish_record', $data['appid'], $data['rid']));
if(isset($data['version']) && $data['version'] >=30){
$bid = DB::result_first("select bid from %t where rid = %s",array('billfish_record',$data['rid']));
$thumbdir = dechex($bid);
$thumbdir = (string) $thumbdir;
if(strlen($thumbdir) < 2){
$thumbdir =str_pad($thumbdir,2,0,STR_PAD_LEFT);
}elseif(strlen($thumbdir) > 2){
$thumbdir = substr($thumbdir,-2);
}
$pathdir = $data['apppath'].BS.'.bf'.BS.'.preview'.BS.$thumbdir.BS.$bid.'.small.webp';
return array('icon'=>$pathdir);
}else{
if (strlen($thumbid) < 9) {
$thumbid = str_pad($thumbid,9,0,STR_PAD_LEFT);
}
$pathdir = $data['apppath'].BS.'.bf'.BS.'.preview';
$thumbpatharr = $this->mbStrSplit($thumbid,3);
array_pop($thumbpatharr);
$thumbpath = implode(BS,$thumbpatharr);
return array('icon'=>$pathdir.BS.$thumbpath.BS.$thumbid.'.webp');
}
}
function mbStrSplit ($string, $len=1) {
$start = 0;
$strlen = mb_strlen($string);
while ($strlen) {
$array[] = mb_substr($string,$start,$len,"utf8");
$string = mb_substr($string, $len, $strlen,"utf8");
$strlen = mb_strlen($string);
}
return $array;
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace dzz\billfish\classes;
use \core as C;
use \DB as DB;
use \fmpeg as fmpeg;
class pichomevappdelete
{
public function run($data)
{
if($data['type'] == 2){
C::t("#billfish#billfish_record")->delete_by_appid($data['appid']);
C::t("#billfish#billfish_folderrecord")->delete_by_appid($data['appid']);
C::t("#billfish#billfish_tagrecord")->delete_by_appid($data['appid']);
C::t("#billfish#billfish_taggrouprecord")->delete_by_appid($data['appid']);
}
return true;
}
}

View File

@@ -1,118 +1,118 @@
<?php <?php
/* /*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd * @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/ * @license https://www.oaooa.com/licenses/
* *
* @link https://www.oaooa.com * @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com) * @author zyx(zyx@oaooa.com)
*/ */
define ('UTF32_BIG_ENDIAN_BOM' , chr(0x00) . chr(0x00) . chr(0xFE) . chr(0xFF)); define ('UTF32_BIG_ENDIAN_BOM' , chr(0x00) . chr(0x00) . chr(0xFE) . chr(0xFF));
define ('UTF32_LITTLE_ENDIAN_BOM', chr(0xFF) . chr(0xFE) . chr(0x00) . chr(0x00)); define ('UTF32_LITTLE_ENDIAN_BOM', chr(0xFF) . chr(0xFE) . chr(0x00) . chr(0x00));
define ('UTF16_BIG_ENDIAN_BOM' , chr(0xFE) . chr(0xFF)); define ('UTF16_BIG_ENDIAN_BOM' , chr(0xFE) . chr(0xFF));
define ('UTF16_LITTLE_ENDIAN_BOM', chr(0xFF) . chr(0xFE)); define ('UTF16_LITTLE_ENDIAN_BOM', chr(0xFF) . chr(0xFE));
define ('UTF8_BOM' , chr(0xEF) . chr(0xBB) . chr(0xBF)); define ('UTF8_BOM' , chr(0xEF) . chr(0xBB) . chr(0xBF));
class Encode_Core { class Encode_Core {
/** /**
* 文件分析方法来检查UNICODE文件ANSI文件没有文件头此处不分析 * 文件分析方法来检查UNICODE文件ANSI文件没有文件头此处不分析
*/ */
private function detect_utf_encoding($text) { private function detect_utf_encoding($text) {
$first2 = substr($text, 0, 2); $first2 = substr($text, 0, 2);
$first3 = substr($text, 0, 3); $first3 = substr($text, 0, 3);
$first4 = substr($text, 0, 3); $first4 = substr($text, 0, 3);
if ($first3 == UTF8_BOM) return 'UTF-8'; if ($first3 == UTF8_BOM) return 'UTF-8';
elseif ($first4 == UTF32_BIG_ENDIAN_BOM) return 'UTF-32BE'; elseif ($first4 == UTF32_BIG_ENDIAN_BOM) return 'UTF-32BE';
elseif ($first4 == UTF32_LITTLE_ENDIAN_BOM) return 'UTF-32LE'; elseif ($first4 == UTF32_LITTLE_ENDIAN_BOM) return 'UTF-32LE';
elseif ($first2 == UTF16_BIG_ENDIAN_BOM) return 'UTF-16BE'; elseif ($first2 == UTF16_BIG_ENDIAN_BOM) return 'UTF-16BE';
elseif ($first2 == UTF16_LITTLE_ENDIAN_BOM) return 'UTF-16LE'; elseif ($first2 == UTF16_LITTLE_ENDIAN_BOM) return 'UTF-16LE';
return ''; return '';
} }
/** /**
* 检测是否GB2312编码 * 检测是否GB2312编码
* @param string $str * @param string $str
* @since 2012-03-20 * @since 2012-03-20
* @return boolean * @return boolean
*/ */
private function is_gb2312($str) { private function is_gb2312($str) {
for($i=0; $i<strlen($str); $i++) { for($i=0; $i<strlen($str); $i++) {
$v = ord( $str[$i] ); $v = ord( $str[$i] );
if( $v > 127) { if( $v > 127) {
if( ($v >= 228) && ($v <= 233) ){ if( ($v >= 228) && ($v <= 233) ){
if( ($i+2) >= (strlen($str) - 1)) return true; // not enough characters if( ($i+2) >= (strlen($str) - 1)) return true; // not enough characters
$v1 = ord( $str[$i+1] ); $v1 = ord( $str[$i+1] );
$v2 = ord( $str[$i+2] ); $v2 = ord( $str[$i+2] );
if( ($v1 >= 128) && ($v1 <=191) && ($v2 >=128) && ($v2 <= 191) ) if( ($v1 >= 128) && ($v1 <=191) && ($v2 >=128) && ($v2 <= 191) )
return false; return false;
else else
return true; //GB编码 return true; //GB编码
} }
} }
} }
} }
private function is_GBK($str){ private function is_GBK($str){
$s1 = iconv('gbk','utf-8',$str); $s1 = iconv('gbk','utf-8',$str);
$s0 = iconv('utf-8','gbk',$s1); $s0 = iconv('utf-8','gbk',$s1);
if($s0 == $str){ if($s0 == $str){
return true; return true;
}else{ }else{
return false; return false;
} }
} }
/** /**
* 取得编码 * 取得编码
* @param string $str * @param string $str
* @return string $encoding * @return string $encoding
*/ */
public static function get_encoding($str){ public static function get_encoding($str){
$ary = array(); $ary = array();
//$ary[] = "ASCII"; //$ary[] = "ASCII";
$ary[] = "UTF-8"; $ary[] = "UTF-8";
$ary[] = "GB18030";//简体码 $ary[] = "GB18030";//简体码
$ary[] = "BIG-5";//繁体码 $ary[] = "BIG-5";//繁体码
$ary[] = "EUC-CN"; $ary[] = "EUC-CN";
$ary[] = "JIS";//日文编码 $ary[] = "JIS";//日文编码
$ary[] = "EUC-JP";//日文编码 $ary[] = "EUC-JP";//日文编码
$encoding= self::detect_utf_encoding($str); $encoding= self::detect_utf_encoding($str);
if(empty($encoding) && self::is_gb2312($str)) return 'GBK'; //if(empty($encoding) && self::is_GBK($str)) return 'GBK';
if(empty($encoding)){ if(empty($encoding)){
$encoding=mb_detect_encoding($str,$ary); $encoding=mb_detect_encoding($str,$ary);
} }
if($encoding=='ASCII') $encoding='UTF-8'; if($encoding=='ASCII') $encoding='UTF-8';
return $encoding; return $encoding;
} }
public function utf16_to_utf8($str) { public function utf16_to_utf8($str) {
$len = strlen($str); $len = strlen($str);
$dec = ''; $dec = '';
for ($i = 0; $i < $len; $i += 2) { for ($i = 0; $i < $len; $i += 2) {
$c = ($be) ? ord($str[$i]) << 8 | ord($str[$i + 1]) : $c = ($be) ? ord($str[$i]) << 8 | ord($str[$i + 1]) :
ord($str[$i + 1]) << 8 | ord($str[$i]); ord($str[$i + 1]) << 8 | ord($str[$i]);
if ($c >= 0x0001 && $c <= 0x007F) { if ($c >= 0x0001 && $c <= 0x007F) {
$dec .= chr($c); $dec .= chr($c);
} else if ($c > 0x07FF) { } else if ($c > 0x07FF) {
$dec .= chr(0xE0 | (($c >> 12) & 0x0F)); $dec .= chr(0xE0 | (($c >> 12) & 0x0F));
$dec .= chr(0x80 | (($c >> 6) & 0x3F)); $dec .= chr(0x80 | (($c >> 6) & 0x3F));
$dec .= chr(0x80 | (($c >> 0) & 0x3F)); $dec .= chr(0x80 | (($c >> 0) & 0x3F));
} else { } else {
$dec .= chr(0xC0 | (($c >> 6) & 0x1F)); $dec .= chr(0xC0 | (($c >> 6) & 0x1F));
$dec .= chr(0x80 | (($c >> 0) & 0x3F)); $dec .= chr(0x80 | (($c >> 0) & 0x3F));
} }
} }
return $dec; return $dec;
} }
} }
?> ?>

View File

@@ -0,0 +1,700 @@
<?php
if (!defined('IN_OAOOA')) {
exit('Access Denied');
}
@set_time_limit(0);
@ini_set('max_execution_time', 0);
require_once(DZZ_ROOT . './dzz/class/class_encode.php');
require_once './core/class/class_Color.php';
require_once libfile('function/user', '', 'user');
class eagleexport
{
private $path = '';//待执行数据path
private $appid = 0;//库id
private $uid = 0;//用户id
private $username = null;//用户名
private $filenum = 0;//总文件数
private $checkpage = 1;
private $checklimit = 1000;
private $onceexportnum = 1000;
private $checknum = 0;
private $eagledir = DZZ_ROOT . 'library';
private $readtxt = DZZ_ROOT . './data/attachment/cache/';
private $exportstatus = 0;
private $donum = 0;
private $lastid = '';
public function __construct($data = array())
{
//获取导入记录表基本数据
$this->path = str_replace('/', BS, $data['path']);;
$this->appid = $data['appid'];
$this->uid = $data['uid'];
$this->username = $data['username'];
$this->exportstatus = $data['state'];
$this->donum = $data['donum'];
$this->filenum = $data['filenum'];
$this->lastid = $data['lastid'];
}
public function getpathdata($folderdata, $appid, $pathdata = array())
{
foreach ($folderdata as $v) {
$pathdata[$v['id'] . $appid] = $v['name'];
if ($v['children']) {
$tmpchild = $v['children'];
$pathdata = $this->getpathdata($tmpchild, $appid, $pathdata);
}
}
return $pathdata;
}
public function initFoldertag()
{
$jsonfile = $this->path . BS . 'metadata.json';
$mtime = filemtime($jsonfile);
$appdatas = file_get_contents($jsonfile);
//解析出json数据
$appdatas = json_decode($appdatas, true);
//目录数据
$folderdata = $appdatas['folders'];
$efids = C::t('#eagle#eagle_folderrecord')->insert_folderdata_by_appid($this->appid, $folderdata);
$delids = DB::fetch_all("select id from %t where efid not in(%n) and appid = %s",array('eagle_folderrecord',$efids,$this->appid));
//对比目录数据
if($delids)C::t('#eagle#eagle_folderrecord')->delete_by_ids($delids);
//标签数据
$tagdata = $appdatas['tagsGroups'];
$currentcids = [];
$tids = [];
foreach ($tagdata as $v) {
$taggroupdata = [
'cid' => $v['id'] . $this->appid,
'catname' => $v['name'],
'appid' => $this->appid,
'dateline' => TIMESTAMP
];
//插入或更新标签分类数据
$cid = C::t('pichome_taggroup')->insert($taggroupdata);
$currentcids[] = $cid;
foreach ($v['tags'] as $val) {
$tid = C::t('pichome_tag')->insert($val, 1);
$tids[] = $tid;
if ($cid) {
$relasetarr = ['cid' => $cid, 'tid' => $tid, 'appid' => $this->appid];
C::t('pichome_tagrelation')->insert($relasetarr);
}
}
}
if ($tids) {
//查询关系表中包含的不存在的标签关系
$drids = [];
foreach (DB::fetch_all("select id from %t where tid not in(%n) and appid = %s", array('pichome_tagrelation', $tids, $this->appid)) as $rv) {
$drids[] = $rv['id'];
}
//删除不存在的标签关系数据
C::t('pichome_tagrelation')->delete($drids);
}
$ocids = C::t('pichome_taggroup')->fetch_cid_by_appid($this->appid);
$delcids = array_diff($ocids, $currentcids);
C::t('pichome_taggroup')->delete_by_cids($delcids);
C::t('pichome_vapp')->update($this->appid, array('dateline' => $mtime));
return true;
}
public function initExport()
{
$filedir = $this->path . BS . 'images';
$readtxt = $this->readtxt . 'eagleexport' . md5($this->path) . '.txt';
$filenum = 0;
if (!is_file($readtxt) || filemtime($readtxt) < filemtime($this->path . BS . 'metadata.json')) {
C::t('pichome_vapp')->update($this->appid, array('state' => 1));
if ($dch = opendir($filedir)) {
$thandle = fopen($readtxt, 'w+');
while (($file = readdir($dch)) != false) {
if ($file != '.' && $file != '..') {
$filePath = $filedir . '/' . $file;
if (is_dir($filePath) && is_file($filePath . '/metadata.json')) {
$filenum++;
fwrite($thandle, $file . "\n");
}
unset($filePath);
unset($file);
}
}
fclose($thandle);
closedir($dch);
if ($filenum) $this->filenum = $filenum;
} else {
C::t('pichome_vapp')->update($this->appid, array('state' => 0));
return array('error' => 'Read Dir Failer');
}
C::t('pichome_vapp')->update($this->appid, array('filenum' => $this->filenum, 'state' => 2));
}
C::t('pichome_vapp')->update($this->appid, array('state' => 2));
$this->initFoldertag();
return array('success' => true);
}
//获取文件可访问的真实地址
public function getFileRealFileName($filepath, $filename, $ext)
{
$charsetarr = ['GBK', 'GB18030'];
$returnname = $filename;
if (!is_file($filepath . BS . $filename . '.' . $ext)) {
foreach ($charsetarr as $v) {
$filemetadataname = diconv($filename, CHARSET, $v);
if (is_file($filepath . BS . $filemetadataname . '.' . $ext)) {
$returnname = $filemetadataname;
break;
}
}
}
return $returnname;
}
//生成主键rid
public function createrid()
{
$microtime = microtime();
list($msec, $sec) = explode(' ', $microtime);
$msec = $msec * 1000000;
$idstr = md5($sec . $msec . random(6) . $this->appid);
if (DB::result_first("select count(rid) from %t where rid = %s", array('pichome_resources', $idstr))) {
$this->create_id();
}
return $idstr;
}
public function execExport($force = false)
{
$filedir = $this->path . BS . 'images';
$readtxt = $this->readtxt . 'eagleexport' . md5($this->path) . '.txt';
if (filesize($readtxt) == 0) {
@unlink($readtxt);
C::t('pichome_vapp')->update($this->appid, array('lastid' => 0, 'percent' => 100, 'donum' => 0, 'state' => 3, 'filenum' => $this->filenum));
return array('success' => true);
}
if ($this->lastid) {
$start = $this->lastid;
} else $start = 0;
$spl_object = new SplFileObject($readtxt, 'rb');
$spl_object->seek($start);
if ($this->lastid < $this->filenum && $this->exportstatus == 2) {
$i = 0;
while (is_file($readtxt) && !$spl_object->eof()) {
$i++;
if ($i > $this->onceexportnum) {
break;
}
$file = $spl_object->current();
$file = trim($file);
$filePath = $filedir . '/' . $file;
$id = trim(str_replace('.info', '', $file));
//文件路径
$tmppath = $filePath;
unset($filePath);
//文件信息文件路径
$metadatajsonfile = $tmppath . BS . 'metadata.json';
//尝试获取记录表记录
$rdata = C::t('#eagle#eagle_record')->fetch_by_eid($id,$this->appid);
$rid = '';
if (!isset($rdata['rid'])) {
$orid = $id . $this->appid;//原来rid格式
if ($lastdate = DB::result_first("select lastdate from %t where rid = %s", array('pichome_resources', $orid))) {
$rid = $orid;
}
} else {
$rid = $rdata['rid'];
$lastdate = $rdata['dateline'];
}
//判断是否含有数据信息文件
if (is_file($metadatajsonfile)) {
$flastdate = filemtime($metadatajsonfile);
$metadata = file_get_contents($metadatajsonfile);
$filemetadata = json_decode($metadata, true);
//如果是删除状态,并且已有数据则执行删除
if ($filemetadata['isDeleted'] && $rid) {
C::t('pichome_resources')->delete_by_rid($rid);
} else {
//如果不是新生成rid
if ($rid) {
$data = C::t('pichome_resources')->fetch($rid);
//判断最后更新时间
if ($force || $lastdate < $flastdate) {
$filemetadataname = $this->getFileRealFileName($tmppath, $filemetadata['name'], $filemetadata['ext']);
//文件名称
$filename = $filemetadataname . '.' . $filemetadata['ext'];
//缩略图名称
$thumbname = $filemetadataname . '_thumbnail.png';
//文件路径
$file = $tmppath . BS . $filename;
//缩略图路径
$thumbfile = $tmppath . BS . $thumbname;
//如果mtime发生变化则删除原数据重新导入
if ($data['mtime'] < $filemetadata['mtime']) {
C::t('pichome_resources')->delete_by_rid($rid);
$filemetadata['rid'] = $this->createrid();
$filemetadata['filename'] = $filemetadata['name'];
$filemetadata['file'] = $file;
$filemetadata['thumbfile'] = $thumbfile;
$filemetadata['rid'] = $rid;
$filemetadata['mtime'] = $filemetadata['mtime'] ? $filemetadata['mtime'] : $filemetadata['modificationTime'];
$filemetadata['btime'] = $filemetadata['btime'] ? $filemetadata['btime'] : $filemetadata['modificationTime'];
$filemetadata['dateline'] = $filemetadata['lastModified'];
$filemetadata['lastdate'] = $flastdate;
$this->exportfile($id,$filemetadata);
unset($filemetadata);
}
else {
//信息表数据记录
$setarr = [];
$setarr['searchval'] = $filemetadata['name'];
//查询原数据中的属性信息
$attrdata = C::t('pichome_resources_attr')->fetch($rid);
$filename = $filemetadata['name'] . '.' . $filemetadata['ext'];
//检查reources数据变化
$resourcesarr = [
'name' => $filename,
'dateline' => $filemetadata['lastModified'],
'isdelete' => $filemetadata['isDeleted'],
'grade' => $filemetadata['star'] ? intval($filemetadata['star']) : 0,
'lastdate' => $flastdate
];
$file = str_replace('/', BS, $file);
$attachment = str_replace($this->path . BS, '', $file);
$path = str_replace('/', BS, $attachment);
$thumb = (is_file($thumbfile)) ? 1 : 0;
$setarr['path'] = $path;
$resourcesarr['hasthumb'] = $thumb;
$resourcesarr['rid'] = $rid;
if (C::t('#eagle#eagle_record')->insert_data($id, $resourcesarr)) {
//检查标签变化
//标签数据
$tags = $filemetadata['tags'];
$setarr['searchval'] .= implode('', $tags);
//现有标签
$tagids = [];
//原有标签
$oldtids = [];
if ($attrdata['tag']) $oldtids = explode(',', $attrdata['tag']);
if (!empty($tags)) {
$tagids = $this->addtag($tags);
$setarr['tag'] = implode(',', $tagids);
}
$addtags = array_diff($tagids, $oldtids);
$deltags = array_diff($oldtids, $tagids);
if (!empty($deltags)) C::t('pichome_resourcestag')->delete_by_ridtid($rid, $deltags);
foreach ($addtags as $tid) {
$rtag = ['appid' => $this->appid, 'rid' => $rid, 'tid' => $tid];
C::t('pichome_resourcestag')->insert($rtag);
}
//检查标注变化
if (isset($filemetadata['comments'])) {
$cids = [];
foreach ($filemetadata['comments'] as $commentval) {
$tcommentval['id'] = $commentval['id'] . $this->appid;
$tcommentval['appid'] = $this->appid;
$tcommentval['rid'] = $rid;
$tcommentval['x'] = number_format($commentval['x'], 2);
$tcommentval['y'] = number_format($commentval['y'], 2);
$tcommentval['width'] = $commentval['width'];
$tcommentval['height'] = $commentval['height'];
$tcommentval['annotation'] = $commentval['annotation'];
$tcommentval['lastModified'] = $commentval['lastModified'];
try {
C::t('pichome_comments')->insert($tcommentval);
$setarr['searchval'] .= $tcommentval['annotation'];
} catch (Exception $e) {
}
$cids[] = $tcommentval['id'];
unset($tcommentval);
}
$ocids = C::t('pichome_comments')->fetch_id_by_rid($rid);
$delcids = array_diff($ocids, $cids);
if (!empty($delcids)) C::t('pichome_comments')->delete($delcids);
} else {
C::t('pichome_comments')->delete_by_rid($rid);
}
$rfids = [];
$orfids = C::t('pichome_folderresources')->fetch_id_by_rid($rid);
C::t('pichome_folderresources')->delete($orfids);
$setarr['searchval'] .= $resourcesarr['name'];
//$fids = [];
if(!empty($filemetadata['folders'])){
$realfids = C::t('#eagle#eagle_folderrecord')->fetch_fid_by_efid($filemetadata['folders'],$this->appid);
}
//检查目录变化
foreach ($realfids as $fv) {
$fid = trim($fv) . $this->appid;
if (!C::t('pichome_folder')->check_password_byfid($fid)) {
$frsetarr = ['appid' => $this->appid, 'rid' => $rid, 'fid' => $fid];
C::t('pichome_folderresources')->insert($frsetarr);
// $fids[] = $fid;
}
}
//尝试更新属性表数据
$setarr['link'] = $filemetadata['url'] ? trim($filemetadata['url']) : '';
//描述数据
$setarr['desc'] = $filemetadata['annotation'] ? $filemetadata['annotation'] : '';
$setarr['searchval'] .= $setarr['desc'] . $setarr['link'];
if ($filemetadata['duration']) $setarr['duration'] = number_format($filemetadata['duration'], 2);
$setarr['rid'] = $rid;
C::t('pichome_resources_attr')->insert($setarr);
unset($filemetadata);
unset($setarr);
}
}
}
else{
if(!$rdata){
$setarr = [
'appid'=>$this->appid,
'rid'=>$rid,
'eid'=>$id,
'dateline'=>$flastdate
];
C::t('#eagle#eagle_record')->insert($setarr);
}
}
} else {
if(!empty($filemetadata['folders'])){
$realfids = C::t('#eagle#eagle_folderrecord')->fetch_fid_by_efid($filemetadata['folders'],$this->appid);
}
if(!empty($realfids)){
//如果目录含有密码则不导入数据直接跳过
$haspassword = C::t('pichome_folder')->check_haspasswrod($realfids, $this->appid);
}else{
$haspassword = false;
}
if (!$haspassword) {
$filemetadataname = $this->getFileRealFileName($tmppath, $filemetadata['name'], $filemetadata['ext']);
$filename = $filemetadataname . '.' . $filemetadata['ext'];
$thumbname = $filemetadataname . '_thumbnail.png';
//echo $i.'middle:'.memory_get_usage()/1024 . '<br>';
$file = $tmppath . BS . $filename;
$thumbfile = $tmppath . BS . $thumbname;
//$filemd5 = md5_file($file);
$filemetadata['filename'] = $filemetadata['name'];
$filemetadata['file'] = $file;
unset($file);
$filemetadata['thumbfile'] = $thumbfile;
$filemetadata['folders'] = $realfids;
unset($thumbfile);
$filemetadata['rid'] = $this->createrid();
$filemetadata['mtime'] = $filemetadata['mtime'] ? $filemetadata['mtime'] : $filemetadata['modificationTime'];
$filemetadata['btime'] = $filemetadata['btime'] ? $filemetadata['btime'] : $filemetadata['modificationTime'];
$filemetadata['dateline'] = $filemetadata['lastModified'];
$filemetadata['lastdate'] = $flastdate;
$this->exportfile($id,$filemetadata);
unset($filemetadata);
}
}
}
} else {
//如果已有数据删除,否则不做处理
if (!$rid) C::t('pichome_resources')->delete_by_rid($rid);
}
$this->donum += 1;
$percent = floor(($this->donum / $this->filenum) * 100);
//防止因获取文件总个数不准确百分比溢出
$percent = ($percent > 100) ? 100 : $percent;
$state = ($percent >= 100) ? 3 : 2;
if ($state == 3) {
$spl_object = false;
@unlink($this->readtxt . 'eagleexport' . md5($this->path) . '.txt');
$lastid = 0;
} else {
$lastid = $this->donum;
}
//记录导入起始位置,以备中断后从此处,更改导入状态为正在导入
C::t('pichome_vapp')->update($this->appid, array('lastid' => $lastid, 'percent' => $percent, 'donum' => $this->donum, 'state' => $state, 'filenum' => $this->filenum));
if($spl_object) $spl_object->next();
}
}
return array('success' => true);
}
//校验文件
public function execCheckFile()
{
if ($this->exportstatus == 3) {
$total = DB::result_first("select count(rid) from %t where appid = %s ", array('pichome_resources', $this->appid));
//校验文件
$this->check_file($total);
}
return true;
}
public function check_file($total)
{
if ($this->lastid < 1) $this->lastid = 1;
$limitsql = ($this->lastid - 1) * $this->checklimit . ',' . $this->checklimit;
$delrids = [];
$data = DB::fetch_all("select rid,isdelete from %t where appid = %s order by lastdate asc limit $limitsql ", array('pichome_resources', $this->appid));
if (empty($data)) {
C::t('pichome_vapp')->update($this->appid, array('percent' => 0, 'state' => 4, 'lastid' => 0, 'donum' => 0));
//校验完成后更新目录文件数
foreach (DB::fetch_all("select count(rf.id) as num,f.fid from %t f left join %t rf on rf.fid=f.fid where f.appid = %s group by f.fid", array('pichome_folder', 'pichome_folderresources', $this->appid)) as $v) {
C::t('pichome_folder')->update($v['fid'], array('filenum' => $v['num']));
}
//修正库中文件数
$total = DB::result_first("select count(rid) from %t where appid = %s ", array('pichome_resources', $this->appid));
$hascatnum = DB::result_first("SELECT count(DISTINCT rid) FROM %t where appid = %s", array('pichome_folderresources', $this->appid));
$nosubfilenum = $total - $hascatnum;
C::t('pichome_vapp')->update($this->appid, array('filenum' => $total, 'nosubfilenum' => $nosubfilenum));
return true;
}
foreach ($data as $v) {
if ($v['isdelete']) {
$delrids[] = $v['rid'];
} else {
$id = C::t('#eagle#eagle_record')->fetch_eid_by_rid($v['rid'],$this->appid);
if(!$id){
$id = str_replace($this->appid, '', $v['rid']);
}
$filejson = $this->path . BS . 'images' . BS . $id . '.info' . BS . 'metadata.json';
if (!is_file($filejson)) {
$delrids[] = $v['rid'];
}
}
}
if (!empty($delrids)) {
//如果有需要删除的,删除后,则重新查询上一页数据
C::t('pichome_resources')->delete_by_rid($delrids);
if ($this->lastid == 1) {
$percent = round(($this->checklimit / $total) * 100);
} else {
$percent = round((($this->lastid - 1) * $this->checklimit / $total) * 100);
}
C::t('pichome_vapp')->update($this->appid, array('lastid' => $this->lastid, 'percent' => $percent, 'state' => 3));
} else {
if ($this->lastid == 1) {
$percent = round(($this->checklimit / $total) * 100);
} else {
$percent = round((($this->lastid - 1) * $this->checklimit / $total) * 100);
}
$percent = ($percent > 100) ? 100 : $percent;
C::t('pichome_vapp')->update($this->appid, array('lastid' => $this->lastid + 1, 'percent' => $percent, 'state' => 3));
}
}
public function exportfile($id,$filemetadata)
{
$rid = $filemetadata['rid'];
if (!is_file($filemetadata['file'])) {
return;
}
$filemetadata['file'] = str_replace('/', BS, $filemetadata['file']);
$attachment = str_replace('/', BS, $filemetadata['file']);
$path = str_replace($this->path . BS, '', $attachment);
unset($attachment);
$thumb = (is_file($filemetadata['thumbfile'])) ? 1 : 0;
//echo 'middle1:'.memory_get_usage()/1024 . '<br>';
$type = getTypeByExt($filemetadata['ext']);
$resourcesarr = [
'rid' => $rid,
'uid' => $this->uid,
'username' => $this->username,
'appid' => $this->appid,
'width' => $filemetadata['width'] ? $filemetadata['width'] : 0,
'height' => $filemetadata['height'] ? $filemetadata['height'] : 0,
'name' => $filemetadata['filename'] . '.' . $filemetadata['ext'],
'ext' => $filemetadata['ext'],
'size' => $filemetadata['size'],
'dateline' => $filemetadata['dateline'],
'btime' => $filemetadata['btime'],
'mtime' => $filemetadata['mtime'],
'isdelete' => $filemetadata['isDeleted'],
'hasthumb' => $thumb,
'grade' => $filemetadata['star'] ? intval($filemetadata['star']) : 0,
'type' => $type,
'lastdate' => $filemetadata['lastdate']
];
unset($type);
//插入文件表数据
if (C::t('#eagle#eagle_record')->insert_data($id,$resourcesarr)) {
DB::delete('pichome_folderresources', array('rid' => $rid));
//获取属性表数据
$setarr = [];
$setarr['searchval'] = $resourcesarr['name'];
//$fids = [];
//插入目录关联表数据
foreach ($filemetadata['folders'] as $fv) {
$fid = $fv;
if (!C::t('pichome_folder')->check_password_byfid($fid)) {
$frsetarr = ['appid' => $this->appid, 'rid' => $rid, 'fid' => $fid];
C::t('pichome_folderresources')->insert($frsetarr);
//$fids[] = $fid;
unset($frsetarr);
}
}
/* if(!empty($fids)){
foreach(DB::fetch_all("select fname from %t where fid in(%n)",array('pichome_folder',$fids)) as $foldername){
$setarr['searchval'] .= $foldername['fname'];
}
}*/
//标签数据
$tags = $filemetadata['tags'];
$setarr['searchval'] .= implode('', $tags);
if (!empty($tags)) {
$tagids = $this->addtag($tags);
unset($tags);
foreach ($tagids as $tid) {
$rtag = ['appid' => $this->appid, 'rid' => $rid, 'tid' => $tid];
C::t('pichome_resourcestag')->insert($rtag);
}
$setarr['tag'] = implode(',', $tagids);
unset($tagids);
}
//颜色数据
if (isset($filemetadata['palettes'])) {
$returndata = $this->getColor($filemetadata['palettes'], $resourcesarr['width'], $resourcesarr['height'], $rid);
$setarr['colors'] = $returndata['colors'];
$setarr['gray'] = $returndata['gray'];
$setarr['shape'] = $returndata['shape'];
unset($returndata);
}
//标注数据
if (isset($filemetadata['comments'])) {
foreach ($filemetadata['comments'] as $commentval) {
$tcommentval['id'] = $commentval['id'] . $this->appid;
$tcommentval['appid'] = $this->appid;
$tcommentval['rid'] = $rid;
$tcommentval['x'] = number_format($commentval['x'], 2);
$tcommentval['y'] = number_format($commentval['y'], 2);
$tcommentval['width'] = $commentval['width'];
$tcommentval['height'] = $commentval['height'];
$tcommentval['annotation'] = $commentval['annotation'];
$tcommentval['lastModified'] = $commentval['lastModified'];
C::t('pichome_comments')->insert($tcommentval);
$setarr['searchval'] .= $commentval['annotation'];
unset($tcommentval);
}
}
//时长
if ($filemetadata['duration']) $setarr['duration'] = number_format($filemetadata['duration'], 2);
//链接数据
$setarr['link'] = $filemetadata['url'] ? trim($filemetadata['url']) : '';
//描述数据
$setarr['desc'] = $filemetadata['annotation'] ? $filemetadata['annotation'] : '';
$setarr['searchval'] .= $setarr['desc'] . $setarr['link'];
$setarr['rid'] = $rid;
$setarr['appid'] = $this->appid;
$setarr['path'] = $path;
//echo '属性插入前缓存:'.memory_get_usage()/1024 . '<br>';
//插入数据
C::t('pichome_resources_attr')->insert($setarr);
//echo '属性插入后缓存:'.memory_get_usage()/1024 . '<br>';
} else {
runlog('eagleexport', $rid);
}
}
//判断图片纯色
public function isgray($colors)
{
$i = 0;
if (count($colors) < 1) return 0;
foreach ($colors as $color) {
$color = new Color($color);
$rgb = $color->toRGB();
unset($color);
if (abs($rgb[0] - $rgb[1]) < 10 && abs($rgb[2] - $rgb[1]) < 10) {
$i++;
}
unset($rgb);
}
if ($i == count($colors)) {
return 1;
} else {
return 0;
}
}
//获取颜色数据
public function getColor($colors, $width, $height, $rid)
{
//echo '颜色处理前:'.memory_get_usage()/1024 . '<br>';
$intcolorsarr = $returndata = [];
$i = 1;
foreach ($colors as $c) {
$color = new \Color($c['color']);
//获取颜色整型值
$intcolor = $color->toInt();
$palattedataarr = ['rid' => $rid, 'color' => $intcolor, 'weight' => $c['ratio'], 'r' => $c['color'][0], 'g' => $c['color'][1], 'b' => $c['color'][2]];
$intcolorsarr[] = $intcolor;
//echo "颜色处理中前 $i :".memory_get_usage()/1024 . '<br>';
C::t('pichome_palette')->insert($palattedataarr);
//echo "颜色处理中后 $i :".memory_get_usage()/1024 . '<br>';
$i++;
}
unset($colors);
//颜色整型值数据
// $intcolorsarr= array_keys($palattedataarr);
$returndata['colors'] = implode(',', $intcolorsarr);
$returndata['gray'] = $this->isgray($intcolorsarr);
$returndata['shape'] = round(($width / $height) * 100);
unset($intcolorsarr);
//echo '颜色处理后缓存:'.memory_get_usage()/1024 . '<br>';
return $returndata;
}
//添加标签
public function addtag($tags)
{
$tagids = [];
foreach ($tags as $v) {
if (!preg_match('/^\s*$/', $v)) {
if ($tid = C::t('pichome_tag')->insert($v)) {
$tagids[] = $tid;
}
}
}
unset($tags);
return $tagids;
}
}

View File

@@ -0,0 +1,92 @@
<?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');
}
class table_eagle_folderrecord extends dzz_table
{
public function __construct() {
$this->_table = 'eagle_folderrecord';
$this->_pk = 'id';
parent::__construct();
}
public function createfidby_efidappid($efid,$appid){
//如果没有记录值
if (!$fid = DB::result_first("select fid from %t where efid = %s", array($this->_table, $efid))){
//检查是否有旧版数据记录值
$fid = $efid.$appid;
if(!DB::result_first("select fid from %t where fid = %s",array('pichome_folder',$fid))){
$fid = C::t('pichome_folder')->createfidbyappid($appid);
}
$setarr = [
'appid'=>$appid,
'efid'=>$efid,
'fid'=>$fid
];
parent::insert($setarr);
}
return $fid;
}
public function insert_folderdata_by_appid($appid,$folderdata,$pfid='',$pathkey='',$fids=[])
{
foreach ($folderdata as $k => $v) {
$id = $v['id'];
//获取或生成记录fid值
$fid = $this->createfidby_efidappid($id,$appid);
$setarr=['fid'=>$fid,'fname'=>$v['name'],'dateline'=>TIMESTAMP,'pfid'=>$pfid,'appid'=>$appid,'pathkey'=> ($pathkey)?$pathkey.$fid:$fid,'disp'=>$k];
$fid = C::t('pichome_folder')->insert_data($setarr);
$fids[] = $id;
if($v['children']){
$fids = $this->insert_folderdata_by_appid($appid,$v['children'],$fid,($pathkey)?$pathkey.$fid:$fid,$fids);
}
}
return $fids;
}
public function delete_by_fid($fids,$appid){
if(!is_array($fids)) $fids = (array)$fids;
$delfid = $delid = [];
foreach(DB::fetch_all("select fid,id from %t where fid in(%n) and appid = %s",array($this->_table,$fids,$appid)) as $v){
$delfid[] = $v['fid'];
$delid[] = $v['id'];
}
if(!empty($delfid))C::t('pichome_folder')->delete_by_fids($delfid);
parent::delete($delid);
}
public function delete_by_ids($ids){
if(!array($ids)) $ids = (array)$ids;
$fids = [];
foreach(DB::fetch_all("select fid from %t where id in(%n)",array($this->_table,$ids)) as $v){
$fids[] = $v['fid'];
}
if(!empty($fids))C::t('pichome_folder')->delete_by_fids($fids);
parent::delete($ids);
}
public function delete_by_appid($appid){
DB::delete($this->_table,array('appid'=>$appid));
}
public function fetch_fid_by_efid($efids,$appid){
$fids = [];
foreach(DB::fetch_all("select fid from %t where efid in(%n) and appid = %s",array($this->_table,$efids,$appid)) as $v){
$fids[] = $v['fid'];
}
return $fids;
}
}

View File

@@ -0,0 +1,54 @@
<?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');
}
class table_eagle_record extends dzz_table
{
public function __construct() {
$this->_table = 'eagle_record';
$this->_pk = 'id';
parent::__construct();
}
public function insert_data($eid,$setarr){
if(C::t('pichome_resources')->insert($setarr)){
$setarr1['rid'] = $setarr['rid'];
$setarr1['appid'] = $setarr['appid'];
$setarr1['eid'] = $eid;
$setarr1['dateline']=$setarr['lastdate'];
$id = DB::result_first("select id from %t where eid = %s and appid = %s",array($this->_table,$eid,$setarr['appid']));
if($id){
parent::update($id,$setarr1);
}else{
parent::insert($setarr1);
}
}
return true;
}
public function delete_by_appid($appid){
DB::delete($this->_table,array('appid'=>$appid));
}
public function delete_by_rids($rids){
if (!is_array($rids)) $rids = (array)$rids;
DB::delete($this->_table,'rid in ('.dimplode($rids).')');
}
public function fetch_by_eid($eid,$appid){
return DB::fetch_first("select * from %t where eid = %s and appid = %s",array($this->_table,$eid,$appid));
}
public function fetch_eid_by_rid($rid,$appid){
return DB::result_first("select eid from %t where rid = %s",array($this->_table,$rid,$appid));
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace dzz\eagle\classes;
use \core as C;
use \DB as DB;
class deleteafter
{
public function run($data)
{
C::t('#eagle#eagle_record')->delete_by_rids($data['rids']);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace dzz\eagle\classes;
use \core as C;
use \DB as DB;
use \fmpeg as fmpeg;
class delpichomefolderafter
{
public function run($appid)
{
C::t("#eagle#eagle_folderrecord")->delete_by_appid($appid);
}
}

Some files were not shown because too many files have changed in this diff Show More