Compare commits
20 Commits
21
UPDATE.md
Normal file
21
UPDATE.md
Normal 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修复
|
||||
@@ -1,170 +1,170 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
|
||||
if (!defined('IN_OAOOA') ) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
if (!function_exists('ajaxshowheader')) {
|
||||
function ajaxshowheader() {
|
||||
global $_G;
|
||||
ob_end_clean();
|
||||
@header("Expires: -1");
|
||||
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
|
||||
@header("Pragma: no-cache");
|
||||
header("Content-type: application/xml");
|
||||
echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<root><![CDATA[";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('ajaxshowfooter')) {
|
||||
function ajaxshowfooter() {
|
||||
echo ']]></root>';
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
if ($admincp->core ->var['inajax']) {
|
||||
ajaxshowheader();
|
||||
ajaxshowfooter();
|
||||
}
|
||||
|
||||
if ($admincp -> cpaccess == -3) {
|
||||
html_login_header(false);
|
||||
} else {
|
||||
html_login_header();
|
||||
}
|
||||
|
||||
if ($admincp -> cpaccess == -3) {
|
||||
echo '<p class="logintips">' . lang('login_cp_noaccess') . '</p>';
|
||||
|
||||
} elseif ($admincp -> cpaccess == -1) {
|
||||
$ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']);
|
||||
echo '<p class="logintips">' . lang('login_cplock', array('ltime' => $ltime)) . '</p>';
|
||||
|
||||
} elseif ($admincp -> cpaccess == -4) {
|
||||
$ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']);
|
||||
echo '<p class="logintips">' . lang('login_user_lock') . '</p>';
|
||||
|
||||
} else {
|
||||
|
||||
html_login_form();
|
||||
}
|
||||
|
||||
html_login_footer();
|
||||
|
||||
function html_login_header($form = true) {
|
||||
global $_G;
|
||||
$uid = getglobal('uid');
|
||||
$charset = CHARSET;
|
||||
$lang = &lang();
|
||||
$title = $lang['login_title'];
|
||||
$tips = $lang['login_tips'];
|
||||
|
||||
echo <<<EOT
|
||||
<!DOCTYPE>
|
||||
<html>
|
||||
<head>
|
||||
<title>$title</title>
|
||||
<base href="{$_G['siteurl']}">
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=$charset" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
<link rel="stylesheet" href="static/bootstrap/css/bootstrap.min.css" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="admin/login/images/adminlogin.css" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="static/css/common.css" type="text/css" media="all" />
|
||||
<script type="text/javascript" src="static/js/md5.js"></script>
|
||||
<script type="text/javascript" src="static/jquery/jquery.min.js?{VERHASH}"></script>
|
||||
<script type="text/javascript" src="static/js/common.js?{VERHASH}"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="static/js/jquery.placeholder.js" type="text/javascript"></script>
|
||||
<![endif]-->
|
||||
<meta content="oaooa.com" name="Copyright" />
|
||||
</head>
|
||||
<body>
|
||||
EOT;
|
||||
|
||||
if ($form) {
|
||||
$loginset_img=$_G['setting']['loginset']['img']?$_G['setting']['loginset']['img']:'user/login/images/login.jpg';
|
||||
$loginset_bcolor=$_G['setting']['loginset']['bcolor']?$_G['setting']['loginset']['bcolor']:'#76838f';
|
||||
echo <<<EOT
|
||||
<div id="wrapper_div" style="width: 100%;height:100%; position: absolute; top: 0px; left: 0px; margin: 0px; padding: 0px; overflow: hidden;z-index:0; font-size: 0px; background:$loginset_bcolor;">
|
||||
|
||||
<img src="$loginset_img" name="imgbg" id="imgbg" style="right: 0px; bottom: 0px; top: 0px; left: 0px; z-index:1;margin:0;padding:0;overflow:hidden; position: absolute;width:100%;height:100%" height="100%" width="100%">
|
||||
</div>
|
||||
<div class="mainContainer">
|
||||
<table class="loginContainer" wide="100%" height="100%">
|
||||
<tr><td align="center" valign="middle">
|
||||
EOT;
|
||||
}
|
||||
}
|
||||
|
||||
function html_login_footer($halt = true) {
|
||||
$version = CORE_VERSION;
|
||||
$release = CORE_RELEASE;
|
||||
echo <<<EOT
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
EOT;
|
||||
$halt && exit();
|
||||
}
|
||||
|
||||
function html_login_form() {
|
||||
global $_G;
|
||||
$uid = getglobal('uid');
|
||||
$isguest = !getglobal('uid');
|
||||
$lang1 = lang();
|
||||
$year=dgmdate(TIMESTAMP,'Y');
|
||||
$maintitle=lang('title_admincp');
|
||||
$loginuser = $isguest ? '<input class="form-control" name="admin_email" type="text" title="" onfocus="if(this.value==\'' . lang('login_email_username') . '\'){this.value=\'\'}" onblur="if(this.value==\'\'){this.value=\'' . lang('login_email_username') . '\'}" autocomplete="off" />' : '<div class="username">' . $_G['member']['username'] . '</div><div class="email">' . $_G['member']['email'] . '</div>';
|
||||
$sid = getglobal('sid');
|
||||
$avatarstatus=getglobal('avatarstatus','member');
|
||||
if(!$uid ){
|
||||
$avastar ='<img src="'.($_G['setting']['sitelogo']?\IO::getFileUri('attach::'.$_G['setting']['sitelogo']):'static/image/common/logo.png').'" />';
|
||||
}else{
|
||||
$avastar = avatar_block($uid);
|
||||
}
|
||||
$avastar.='<div class="maintitle">'.$maintitle.'</div>';
|
||||
$extra = BASESCRIPT . '?' . $_SERVER['QUERY_STRING'];
|
||||
$forcesecques = '<option value="0">' . ($_G['config']['admincp']['forcesecques'] ? $lang1['forcesecques'] : $lang1['security_question_0']) . '</option>';
|
||||
echo <<<EOT
|
||||
|
||||
<form method="post" name="login" id="loginform" action="$extra" onsubmit="pwmd5('admin_password')">
|
||||
<input type="hidden" name="sid" value="$sid">
|
||||
<input type="hidden" name="referer" value="$_GET[referer]">
|
||||
<div class="loginformContainer">
|
||||
<div class="avatarContainer">$avastar</div>
|
||||
|
||||
$loginuser
|
||||
<div id="admin_password_Container">
|
||||
<input name="admin_password" id="admin_password" type="password" class="form-control" value="" autocomplete="off" placeholder="$lang1[password]" />
|
||||
|
||||
</div>
|
||||
<input name="submit" value="$lang1[login]" type="submit" class="btn btn-primary" />
|
||||
<div class="copyright">Powered by <a href="https://www.oaooa.com/" target="_blank">oaooa</a> © 2012-$year</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<script type="text/JavaScript">
|
||||
jQuery(document).ready(function(e) {
|
||||
jQuery('#loginform .form-control:first').focus();
|
||||
if(jQuery('.ie8,.ie9').length){ //ie8模拟placeholder;
|
||||
jQuery(':input[placeholder]').each(function(){
|
||||
jQuery(this).placeholder();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
EOT;
|
||||
}
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
|
||||
if (!defined('IN_OAOOA') ) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
if (!function_exists('ajaxshowheader')) {
|
||||
function ajaxshowheader() {
|
||||
global $_G;
|
||||
ob_end_clean();
|
||||
@header("Expires: -1");
|
||||
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
|
||||
@header("Pragma: no-cache");
|
||||
header("Content-type: application/xml");
|
||||
echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<root><![CDATA[";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('ajaxshowfooter')) {
|
||||
function ajaxshowfooter() {
|
||||
echo ']]></root>';
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
if ($admincp->core ->var['inajax']) {
|
||||
ajaxshowheader();
|
||||
ajaxshowfooter();
|
||||
}
|
||||
|
||||
if ($admincp -> cpaccess == -3) {
|
||||
html_login_header(false);
|
||||
} else {
|
||||
html_login_header();
|
||||
}
|
||||
|
||||
if ($admincp -> cpaccess == -3) {
|
||||
echo '<p class="logintips">' . lang('login_cp_noaccess') . '</p>';
|
||||
|
||||
} elseif ($admincp -> cpaccess == -1) {
|
||||
$ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']);
|
||||
echo '<p class="logintips">' . lang('login_cplock', array('ltime' => $ltime)) . '</p>';
|
||||
|
||||
} elseif ($admincp -> cpaccess == -4) {
|
||||
$ltime = $admincp -> sessionlife - (TIMESTAMP - $admincp -> adminsession['dateline']);
|
||||
echo '<p class="logintips">' . lang('login_user_lock') . '</p>';
|
||||
|
||||
} else {
|
||||
|
||||
html_login_form();
|
||||
}
|
||||
|
||||
html_login_footer();
|
||||
|
||||
function html_login_header($form = true) {
|
||||
global $_G;
|
||||
$uid = getglobal('uid');
|
||||
$charset = CHARSET;
|
||||
$lang = &lang();
|
||||
$title = $lang['login_title'];
|
||||
$tips = $lang['login_tips'];
|
||||
|
||||
echo <<<EOT
|
||||
<!DOCTYPE>
|
||||
<html>
|
||||
<head>
|
||||
<title>$title</title>
|
||||
<base href="{$_G['siteurl']}">
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=$charset" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
<link rel="stylesheet" href="static/bootstrap/css/bootstrap.min.css" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="admin/login/images/adminlogin.css" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="static/css/common.css" type="text/css" media="all" />
|
||||
<script type="text/javascript" src="static/js/md5.js"></script>
|
||||
<script type="text/javascript" src="static/jquery/jquery.min.js?{VERHASH}"></script>
|
||||
<script type="text/javascript" src="static/js/common.js?{VERHASH}"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="static/js/jquery.placeholder.js" type="text/javascript"></script>
|
||||
<![endif]-->
|
||||
<meta content="oaooa.com" name="Copyright" />
|
||||
</head>
|
||||
<body>
|
||||
EOT;
|
||||
|
||||
if ($form) {
|
||||
$loginset_img=$_G['setting']['loginset']['img']?$_G['setting']['loginset']['img']:'user/login/images/login.jpg';
|
||||
$loginset_bcolor=$_G['setting']['loginset']['bcolor']?$_G['setting']['loginset']['bcolor']:'#76838f';
|
||||
echo <<<EOT
|
||||
<div id="wrapper_div" style="width: 100%;height:100%; position: absolute; top: 0px; left: 0px; margin: 0px; padding: 0px; overflow: hidden;z-index:0; font-size: 0px; background:$loginset_bcolor;">
|
||||
|
||||
<img src="$loginset_img" name="imgbg" id="imgbg" style="right: 0px; bottom: 0px; top: 0px; left: 0px; z-index:1;margin:0;padding:0;overflow:hidden; position: absolute;width:100%;height:100%" height="100%" width="100%">
|
||||
</div>
|
||||
<div class="mainContainer">
|
||||
<table class="loginContainer" wide="100%" height="100%">
|
||||
<tr><td align="center" valign="middle">
|
||||
EOT;
|
||||
}
|
||||
}
|
||||
|
||||
function html_login_footer($halt = true) {
|
||||
$version = CORE_VERSION;
|
||||
$release = CORE_RELEASE;
|
||||
echo <<<EOT
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
EOT;
|
||||
$halt && exit();
|
||||
}
|
||||
|
||||
function html_login_form() {
|
||||
global $_G;
|
||||
$uid = getglobal('uid');
|
||||
$isguest = !getglobal('uid');
|
||||
$lang1 = lang();
|
||||
$year=dgmdate(TIMESTAMP,'Y');
|
||||
$maintitle=lang('title_admincp');
|
||||
$loginuser = $isguest ? '<input class="form-control" name="admin_email" type="text" title="" onfocus="if(this.value==\'' . lang('login_email_username') . '\'){this.value=\'\'}" onblur="if(this.value==\'\'){this.value=\'' . lang('login_email_username') . '\'}" autocomplete="off" />' : '<div class="username">' . $_G['member']['username'] . '</div><div class="email">' . $_G['member']['email'] . '</div>';
|
||||
$sid = getglobal('sid');
|
||||
$avatarstatus=getglobal('avatarstatus','member');
|
||||
if(!$uid ){
|
||||
$avastar ='<img src="data/attachment/sitelogo/sitelogo.png" />';
|
||||
}else{
|
||||
$avastar = avatar_block($uid);
|
||||
}
|
||||
$avastar.='<div class="maintitle">'.$maintitle.'</div>';
|
||||
$extra = BASESCRIPT . '?' . $_SERVER['QUERY_STRING'];
|
||||
$forcesecques = '<option value="0">' . ($_G['config']['admincp']['forcesecques'] ? $lang1['forcesecques'] : $lang1['security_question_0']) . '</option>';
|
||||
echo <<<EOT
|
||||
|
||||
<form method="post" name="login" id="loginform" action="$extra" onsubmit="pwmd5('admin_password')">
|
||||
<input type="hidden" name="sid" value="$sid">
|
||||
<input type="hidden" name="referer" value="$_GET[referer]">
|
||||
<div class="loginformContainer">
|
||||
<div class="avatarContainer">$avastar</div>
|
||||
|
||||
$loginuser
|
||||
<div id="admin_password_Container">
|
||||
<input name="admin_password" id="admin_password" type="password" class="form-control" value="" autocomplete="off" placeholder="$lang1[password]" />
|
||||
|
||||
</div>
|
||||
<input name="submit" value="$lang1[login]" type="submit" class="btn btn-primary" />
|
||||
<div class="copyright">Powered by <a href="https://www.oaooa.com/" target="_blank">oaooa</a> © 2012-$year</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<script type="text/JavaScript">
|
||||
jQuery(document).ready(function(e) {
|
||||
jQuery('#loginform .form-control:first').focus();
|
||||
if(jQuery('.ie8,.ie9').length){ //ie8模拟placeholder;
|
||||
jQuery(':input[placeholder]').each(function(){
|
||||
jQuery(this).placeholder();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
EOT;
|
||||
}
|
||||
?>
|
||||
3186
admin/oaooafiles.md5
3186
admin/oaooafiles.md5
File diff suppressed because it is too large
Load Diff
@@ -1,184 +1,184 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
global $_G;
|
||||
Hook::listen('adminlogin');
|
||||
$uid = $_G['uid'];
|
||||
include libfile('function/filerouterule');
|
||||
require libfile('function/code');
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : '';
|
||||
if($operation == 'getApp'){//获取当前用户应用
|
||||
$config = array();
|
||||
if($_G['uid']){
|
||||
$config= dzz_userconfig_init();
|
||||
if(!$config){
|
||||
//$config= dzz_userconfig_init();
|
||||
if($config['applist']){
|
||||
$applist=explode(',',$config['applist']);
|
||||
}else{
|
||||
$applist=array();
|
||||
}
|
||||
}else{//检测不允许删除的应用,重新添加进去
|
||||
if($config['applist']){
|
||||
$applist=explode(',',$config['applist']);
|
||||
}else{
|
||||
$applist=array();
|
||||
}
|
||||
if($applist_n =array_keys(C::t('app_market')->fetch_all_by_notdelete($_G['uid']))) {
|
||||
|
||||
$newappids = array();
|
||||
foreach ($applist_n as $appid) {
|
||||
if (!in_array($appid, $applist)) {
|
||||
$applist[] = $appid;
|
||||
$newappids[] = $appid;
|
||||
}
|
||||
}
|
||||
if ($newappids) C::t('app_user')->insert_by_uid($_G['uid'], $newappids);
|
||||
C::t('user_field')->update($_G['uid'], array('applist' => implode(',', $applist)));
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
$applist =array_keys(C::t('app_market')->fetch_all_by_default());
|
||||
}
|
||||
|
||||
//获取已安装应用
|
||||
$app=C::t('app_market')->fetch_all_by_appid($applist);
|
||||
|
||||
$applist_1=array();
|
||||
$applist_2=array();
|
||||
$identifier=array('imageTool','picture');
|
||||
foreach($app as $key => $value){
|
||||
if($value['isshow']<1) continue;
|
||||
if($value['available']<1) continue;
|
||||
if($value['position']<1) continue;//位置为无的忽略
|
||||
//判断管理员应用
|
||||
if($_G['adminid']!=1 && $value['group']==3){
|
||||
continue;
|
||||
}
|
||||
$params=array('name'=>$value['identifier'],'perm'=>1,'return_type'=>'bool');
|
||||
if(Hook::listen('rolecheck',$params,null,true)===false) continue;
|
||||
//if($value['system'] == 2) continue;
|
||||
if(in_array($value['identifier'], $identifier)){
|
||||
$applist_1[] = $value;
|
||||
}else{
|
||||
$applist_2[] = $value;
|
||||
}
|
||||
|
||||
}
|
||||
//获取虚拟应用
|
||||
$params=array();
|
||||
$vapps=Hook::listen('vapplist',$params,null,true);
|
||||
foreach($vapps as $key => $value){
|
||||
$params=array('name'=>'vapp/'.$value['identifier'],'perm'=>1,'return_type'=>'bool');
|
||||
if(Hook::listen('rolecheck',$params,null,true)===false) continue;
|
||||
$applist_1[] = $value;
|
||||
}
|
||||
//对应用根据disp 排序
|
||||
if($applist_1){
|
||||
$sort = array(
|
||||
'direction' => 'SORT_ASC', //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序
|
||||
'field' => 'disp', //排序字段
|
||||
);
|
||||
$arrSort = array();
|
||||
foreach($applist_1 AS $uniqid => $row){
|
||||
foreach($row AS $key=>$value){
|
||||
$arrSort[$key][$uniqid] = $value;
|
||||
}
|
||||
}
|
||||
if($sort['direction']){
|
||||
array_multisort($arrSort[$sort['field']], constant($sort['direction']), $applist_1);
|
||||
}
|
||||
}
|
||||
exit(json_encode(array('data'=>array_merge($applist_1,$applist_2))));
|
||||
|
||||
}else{
|
||||
// 地址栏名称
|
||||
$navtitle = $_G['setting']['sitename'];
|
||||
// 获取hash
|
||||
$hash = FORMHASH;
|
||||
|
||||
// 获取当前用户信息
|
||||
$userData = array();
|
||||
$udata = DB::fetch_first("select u.uid,u.avatarstatus,u.username,u.groupid,u.adminid,u.nickname,s.svalue from %t u
|
||||
left join %t s on s.uid = u.uid and s.skey=%swhere u.uid =%d",
|
||||
array('user','user_setting','headerColor',$uid));
|
||||
if($udata['avatarstatus'] == 1){
|
||||
$userData['icon'] = 'avatar.php?uid='.$udata['uid'];
|
||||
}elseif($udata['svalue']){
|
||||
$userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,''));
|
||||
$userData['headerColor'] = $udata['svalue'];
|
||||
$userData['icon'] = false;
|
||||
}else{
|
||||
$colorkey = rand(1,15);
|
||||
$headerColor = $colors[$colorkey];
|
||||
C::t('user_setting')->insert_by_skey('headerColor',$headerColor,$udata['uid']);
|
||||
$userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,''));
|
||||
$userData['headerColor'] = $udata['svalue'];
|
||||
}
|
||||
if( C::t('user')->checkfounder($udata)){
|
||||
$userData['perm'] = 3;
|
||||
}elseif($udata['adminid'] == 1){
|
||||
$userData['perm'] = 2;
|
||||
}else{
|
||||
$userData['perm'] = 1;
|
||||
}
|
||||
$userData['username'] = $udata['username'];
|
||||
$userData['uid'] = $uid;
|
||||
$userData['language'] = $_G[language];
|
||||
$userData['upgrade'] = $_G['setting']['upgrade'];
|
||||
$userData['version'] = $_G['setting']['version'];
|
||||
|
||||
// 获取顶部应用
|
||||
if($userData['language'] == 'en-US'){
|
||||
$navMenuNames = ['System setting','Cloud settings','Orguser','App','Statistics','System Tool'];
|
||||
}else{
|
||||
$navMenuNames = ['系统设置','云设置','用户','应用','统计','系统工具'];
|
||||
}
|
||||
$navMenu = array(
|
||||
array(
|
||||
'name'=>$navMenuNames[0],
|
||||
'index'=>'setting',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[1],
|
||||
'index'=>'cloudsetting',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[2],
|
||||
'index'=>'orguser',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[3],
|
||||
'index'=>'app',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[4],
|
||||
'index'=>'stats',
|
||||
'type'=>'dzz'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[5],
|
||||
'index'=>'system',
|
||||
'type'=>'admin'
|
||||
),
|
||||
);
|
||||
// 获取通知
|
||||
$notice_num=DB::result_first("select COUNT(*) from %t where new>0 and uid=%d",array('notification',$_G['uid']));
|
||||
|
||||
exit(json_encode(array('hash'=>$hash,'navMenu'=>$navMenu,'userData'=>$userData,'notice_num'=>$notice_num,'navtitle'=>$navtitle)));
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
global $_G;
|
||||
Hook::listen('adminlogin');
|
||||
$uid = $_G['uid'];
|
||||
include libfile('function/filerouterule');
|
||||
require libfile('function/code');
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : '';
|
||||
if($operation == 'getApp'){//获取当前用户应用
|
||||
$config = array();
|
||||
if($_G['uid']){
|
||||
$config= dzz_userconfig_init();
|
||||
if(!$config){
|
||||
//$config= dzz_userconfig_init();
|
||||
if($config['applist']){
|
||||
$applist=explode(',',$config['applist']);
|
||||
}else{
|
||||
$applist=array();
|
||||
}
|
||||
}else{//检测不允许删除的应用,重新添加进去
|
||||
if($config['applist']){
|
||||
$applist=explode(',',$config['applist']);
|
||||
}else{
|
||||
$applist=array();
|
||||
}
|
||||
if($applist_n =array_keys(C::t('app_market')->fetch_all_by_notdelete($_G['uid']))) {
|
||||
|
||||
$newappids = array();
|
||||
foreach ($applist_n as $appid) {
|
||||
if (!in_array($appid, $applist)) {
|
||||
$applist[] = $appid;
|
||||
$newappids[] = $appid;
|
||||
}
|
||||
}
|
||||
if ($newappids) C::t('app_user')->insert_by_uid($_G['uid'], $newappids);
|
||||
C::t('user_field')->update($_G['uid'], array('applist' => implode(',', $applist)));
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
$applist =array_keys(C::t('app_market')->fetch_all_by_default());
|
||||
}
|
||||
|
||||
//获取已安装应用
|
||||
$app=C::t('app_market')->fetch_all_by_appid($applist);
|
||||
|
||||
$applist_1=array();
|
||||
$applist_2=array();
|
||||
$identifier=array('imageTool','picture');
|
||||
foreach($app as $key => $value){
|
||||
if($value['isshow']<1) continue;
|
||||
if($value['available']<1) continue;
|
||||
if($value['position']<1) continue;//位置为无的忽略
|
||||
//判断管理员应用
|
||||
if($_G['adminid']!=1 && $value['group']==3){
|
||||
continue;
|
||||
}
|
||||
$params=array('name'=>$value['identifier'],'perm'=>1,'return_type'=>'bool');
|
||||
if(Hook::listen('rolecheck',$params,null,true)===false) continue;
|
||||
//if($value['system'] == 2) continue;
|
||||
if(in_array($value['identifier'], $identifier)){
|
||||
$applist_1[] = $value;
|
||||
}else{
|
||||
$applist_2[] = $value;
|
||||
}
|
||||
|
||||
}
|
||||
//获取虚拟应用
|
||||
$params=array();
|
||||
$vapps=Hook::listen('vapplist',$params,null,true);
|
||||
foreach($vapps as $key => $value){
|
||||
$params=array('name'=>'vapp/'.$value['identifier'],'perm'=>1,'return_type'=>'bool');
|
||||
if(Hook::listen('rolecheck',$params,null,true)===false) continue;
|
||||
$applist_1[] = $value;
|
||||
}
|
||||
//对应用根据disp 排序
|
||||
if($applist_1){
|
||||
$sort = array(
|
||||
'direction' => 'SORT_ASC', //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序
|
||||
'field' => 'disp', //排序字段
|
||||
);
|
||||
$arrSort = array();
|
||||
foreach($applist_1 AS $uniqid => $row){
|
||||
foreach($row AS $key=>$value){
|
||||
$arrSort[$key][$uniqid] = $value;
|
||||
}
|
||||
}
|
||||
if($sort['direction']){
|
||||
array_multisort($arrSort[$sort['field']], constant($sort['direction']), $applist_1);
|
||||
}
|
||||
}
|
||||
exit(json_encode(array('data'=>array_merge($applist_1,$applist_2))));
|
||||
|
||||
}else{
|
||||
// 地址栏名称
|
||||
$navtitle = $_G['setting']['sitename'];
|
||||
// 获取hash
|
||||
$hash = FORMHASH;
|
||||
|
||||
// 获取当前用户信息
|
||||
$userData = array();
|
||||
$udata = DB::fetch_first("select u.uid,u.avatarstatus,u.username,u.groupid,u.adminid,u.nickname,s.svalue from %t u
|
||||
left join %t s on s.uid = u.uid and s.skey=%swhere u.uid =%d",
|
||||
array('user','user_setting','headerColor',$uid));
|
||||
if($udata['avatarstatus'] == 1){
|
||||
$userData['icon'] = 'avatar.php?uid='.$udata['uid'].'&random='.VERHASH;
|
||||
}elseif($udata['svalue']){
|
||||
$userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,''));
|
||||
$userData['headerColor'] = $udata['svalue'];
|
||||
$userData['icon'] = false;
|
||||
}else{
|
||||
$colorkey = rand(1,15);
|
||||
$headerColor = $colors[$colorkey];
|
||||
C::t('user_setting')->insert_by_skey('headerColor',$headerColor,$udata['uid']);
|
||||
$userData['firstword'] = strtoupper(new_strsubstr($udata['username'],1,''));
|
||||
$userData['headerColor'] = $udata['svalue'];
|
||||
}
|
||||
if( C::t('user')->checkfounder($udata)){
|
||||
$userData['perm'] = 3;
|
||||
}elseif($udata['adminid'] == 1){
|
||||
$userData['perm'] = 2;
|
||||
}else{
|
||||
$userData['perm'] = 1;
|
||||
}
|
||||
$userData['username'] = $udata['username'];
|
||||
$userData['uid'] = $uid;
|
||||
$userData['language'] = $_G[language];
|
||||
$userData['upgrade'] = $_G['setting']['upgrade'];
|
||||
$userData['version'] = $_G['setting']['version'];
|
||||
|
||||
// 获取顶部应用
|
||||
if($userData['language'] == 'en-US'){
|
||||
$navMenuNames = ['System setting','Cloud settings','Orguser','App','Statistics','System Tool'];
|
||||
}else{
|
||||
$navMenuNames = ['系统设置','云设置','用户','应用','统计','系统工具'];
|
||||
}
|
||||
$navMenu = array(
|
||||
array(
|
||||
'name'=>$navMenuNames[0],
|
||||
'index'=>'setting',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[1],
|
||||
'index'=>'cloudsetting',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[2],
|
||||
'index'=>'orguser',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[3],
|
||||
'index'=>'app',
|
||||
'type'=>'admin'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[4],
|
||||
'index'=>'stats',
|
||||
'type'=>'dzz'
|
||||
),
|
||||
array(
|
||||
'name'=>$navMenuNames[5],
|
||||
'index'=>'system',
|
||||
'type'=>'admin'
|
||||
),
|
||||
);
|
||||
// 获取通知
|
||||
$notice_num=DB::result_first("select COUNT(*) from %t where new>0 and uid=%d",array('notification',$_G['uid']));
|
||||
|
||||
exit(json_encode(array('hash'=>$hash,'navMenu'=>$navMenu,'userData'=>$userData,'notice_num'=>$notice_num,'navtitle'=>$navtitle)));
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,200 +1,200 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
include_once libfile('function/cache');
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
$op = $_GET['op'];
|
||||
$navtitle = lang('cron') . ' - ' . lang('admin_navtitle');
|
||||
if (empty($_GET['edit']) && empty($_GET['run'])) {
|
||||
|
||||
if (!submitcheck('cronssubmit')) {
|
||||
$crons = array();
|
||||
$query = DB::query("SELECT * FROM " . DB::table('cron') . " ORDER BY type DESC");
|
||||
while ($cron = DB::fetch($query)) {
|
||||
$disabled = $cron['weekday'] == -1 && $cron['day'] == -1 && $cron['hour'] == -1 && $cron['minute'] == '' ? 'disabled' : '';
|
||||
|
||||
if ($cron['day'] > 0 && $cron['day'] < 32) {
|
||||
$cron['time'] = lang('monthly') . $cron['day'] . lang('day');
|
||||
} elseif ($cron['weekday'] >= 0 && $cron['weekday'] < 7) {
|
||||
$cron['time'] = lang('weekly') . lang('misc_cron_week_day_' . $cron['weekday']);
|
||||
} elseif ($cron['hour'] >= 0 && $cron['hour'] < 24) {
|
||||
$cron['time'] = lang('everyday');
|
||||
} else {
|
||||
$cron['time'] = lang('per_hour');
|
||||
}
|
||||
$cron['time'] .= $cron['hour'] >= 0 && $cron['hour'] < 24 ? sprintf('%02d', $cron[hour]) . lang('timeliness') : '';
|
||||
if (!in_array($cron['minute'], array(-1, ''))) {
|
||||
foreach ($cron['minute'] = explode("\t", $cron['minute']) as $k => $v) {
|
||||
$cron['minute'][$k] = sprintf('%02d', $v);
|
||||
}
|
||||
$cron['minute'] = implode(',', $cron['minute']);
|
||||
$cron['time'] .= $cron['minute'] . lang('point');
|
||||
} else {
|
||||
$cron['time'] .= '00' . lang('point');
|
||||
}
|
||||
|
||||
$cron['lastrun'] = $cron['lastrun'] ? dgmdate($cron['lastrun'], $_G['setting']['dateformat'] . "<\b\\r />" . $_G['setting']['timeformat']) : '<b>N/A</b>';
|
||||
$cron['nextcolor'] = $cron['nextrun'] && $cron['nextrun'] + $_G['setting']['timeoffset'] * 3600 < TIMESTAMP ? 'style="color: #ff0000"' : '';
|
||||
$cron['nextrun'] = $cron['nextrun'] ? dgmdate($cron['nextrun'], $_G['setting']['dateformat'] . "<\b\\r />" . $_G['setting']['timeformat']) : '<b>N/A</b>';
|
||||
$cron['run'] = $cron['available'];
|
||||
|
||||
$crons[] = $cron;
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($ids = dimplode($_GET['delete'])) {
|
||||
DB::delete('cron', "cronid IN ($ids) AND type!='system'");
|
||||
}
|
||||
|
||||
if (is_array($_GET['namenew'])) {
|
||||
foreach ($_GET['namenew'] as $id => $name) {
|
||||
$newcron = array('name' => dhtmlspecialchars($_GET['namenew'][$id]), 'available' => $_GET['availablenew'][$id]);
|
||||
if (empty($_GET['availablenew'][$id])) {
|
||||
$newcron['nextrun'] = '0';
|
||||
}
|
||||
DB::update('cron', $newcron, "cronid='{$id}'");
|
||||
}
|
||||
}
|
||||
|
||||
if ($newname = trim($_GET['newname'])) {
|
||||
DB::insert('cron', array('name' => dhtmlspecialchars($newname), 'type' => 'user', 'available' => '0', 'weekday' => '-1', 'day' => '-1', 'hour' => '-1', 'minute' => '', 'nextrun' => $_G['timestamp'], ));
|
||||
}
|
||||
|
||||
$query = DB::query("SELECT cronid, filename FROM " . DB::table('cron'));
|
||||
while ($cron = DB::fetch($query)) {
|
||||
$efile = explode(':', $cron['filename']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
if (!file_exists($cronfile)) {
|
||||
DB::update('cron', array('available' => '0', 'nextrun' => '0', ), "cronid='$cron[cronid]'");
|
||||
}
|
||||
}
|
||||
updatecache('setting');
|
||||
$msg = lang('crons_succeed');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-success';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$cronid = empty($_GET['run']) ? $_GET['edit'] : $_GET['run'];
|
||||
$cron = DB::fetch_first("SELECT * FROM " . DB::table('cron') . " WHERE cronid='$cronid'");
|
||||
if (!$cron) {
|
||||
$msg = lang('cron_not_found');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-error';
|
||||
include template('cron');
|
||||
exit();
|
||||
}
|
||||
$cron['filename'] = str_replace(array('..', '/', '\\'), array('', '', ''), $cron['filename']);
|
||||
$cronminute = str_replace("\t", ',', $cron['minute']);
|
||||
$cron['minute'] = explode("\t", $cron['minute']);
|
||||
|
||||
if (!empty($_GET['edit'])) {
|
||||
|
||||
if (!submitcheck('editsubmit')) {
|
||||
|
||||
$navtitle = lang('misc_cron_edit') . ' - ' . lang('admin_navtitle');
|
||||
|
||||
$weekdayselect = $dayselect = $hourselect = '';
|
||||
|
||||
for ($i = 0; $i <= 6; $i++) {
|
||||
$weekdayselect .= "<option value=\"$i\" " . ($cron['weekday'] == $i ? 'selected' : '') . ">" . lang('misc_cron_week_day_' . $i) . "</option>";
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= 31; $i++) {
|
||||
$dayselect .= "<option value=\"$i\" " . ($cron['day'] == $i ? 'selected' : '') . ">$i " . lang('day') . "</option>";
|
||||
}
|
||||
|
||||
for ($i = 0; $i <= 23; $i++) {
|
||||
$hourselect .= "<option value=\"$i\" " . ($cron['hour'] == $i ? 'selected' : '') . ">$i " . lang('timeliness') . "</option>";
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$daynew = $_GET['weekdaynew'] != -1 ? -1 : $_GET['daynew'];
|
||||
if (strpos($_GET['minutenew'], ',') !== FALSE) {
|
||||
$minutenew = explode(',', $_GET['minutenew']);
|
||||
foreach ($minutenew as $key => $val) {
|
||||
$minutenew[$key] = $val = intval($val);
|
||||
if ($val < 0 || $var > 59) {
|
||||
unset($minutenew[$key]);
|
||||
}
|
||||
}
|
||||
$minutenew = array_slice(array_unique($minutenew), 0, 12);
|
||||
$minutenew = implode("\t", $minutenew);
|
||||
} else {
|
||||
$minutenew = intval($_GET['minutenew']);
|
||||
$minutenew = $minutenew >= 0 && $minutenew < 60 ? $minutenew : '';
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$_GET['filenamenew'] = str_replace(array('..', '/', '\\'), '', $_GET['filenamenew']);
|
||||
$efile = explode(':', $_GET['filenamenew']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
if (preg_match("/[\\\\\/\*\?\"\<\>\|]+/", $_GET['filenamenew'])) {
|
||||
$msg = lang('crons_filename_illegal');
|
||||
} elseif (!is_readable($cronfile)) {
|
||||
$msg = lang('crons_filename_invalid', array('cronfile' => $cronfile));
|
||||
} elseif ($_GET['weekdaynew'] == -1 && $daynew == -1 && $_GET['hournew'] == -1 && $minutenew === '') {
|
||||
$msg = lang('crons_time_invalid');
|
||||
}
|
||||
if (!empty($msg)) {
|
||||
$msg_type = 'text-error';
|
||||
$redirecturl = dreferer();
|
||||
include template('cron');
|
||||
exit();
|
||||
}
|
||||
|
||||
DB::update('cron', array('weekday' => $_GET['weekdaynew'], 'day' => $daynew, 'hour' => $_GET['hournew'], 'minute' => $minutenew, 'filename' => trim($_GET['filenamenew']), ), "cronid='$cronid'");
|
||||
|
||||
dzz_cron::run($cronid);
|
||||
|
||||
$msg = lang('crons_succeed');
|
||||
$msg_type = 'text-success';
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']);
|
||||
$efile = explode(':', $cron['filename']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
|
||||
if (!file_exists($cronfile)) {
|
||||
$msg = lang('crons_run_invalid', array('cronfile' => $cronfile));
|
||||
$msg_type = 'text-error';
|
||||
|
||||
} else {
|
||||
dzz_cron::run($cron['cronid']);
|
||||
$msg = lang('crons_run_succeed');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-success';
|
||||
}
|
||||
}
|
||||
}
|
||||
include template('cron');
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
include_once libfile('function/cache');
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
$op = $_GET['op'];
|
||||
$navtitle = lang('cron') . ' - ' . lang('admin_navtitle');
|
||||
if (empty($_GET['edit']) && empty($_GET['run'])) {
|
||||
|
||||
if (!submitcheck('cronssubmit')) {
|
||||
$crons = array();
|
||||
$query = DB::query("SELECT * FROM " . DB::table('cron') . " ORDER BY type DESC");
|
||||
while ($cron = DB::fetch($query)) {
|
||||
$disabled = $cron['weekday'] == -1 && $cron['day'] == -1 && $cron['hour'] == -1 && $cron['minute'] == '' ? 'disabled' : '';
|
||||
|
||||
if ($cron['day'] > 0 && $cron['day'] < 32) {
|
||||
$cron['time'] = lang('monthly') . $cron['day'] . lang('day');
|
||||
} elseif ($cron['weekday'] >= 0 && $cron['weekday'] < 7) {
|
||||
$cron['time'] = lang('weekly') . lang('misc_cron_week_day_' . $cron['weekday']);
|
||||
} elseif ($cron['hour'] >= 0 && $cron['hour'] < 24) {
|
||||
$cron['time'] = lang('everyday');
|
||||
} else {
|
||||
$cron['time'] = lang('per_hour');
|
||||
}
|
||||
$cron['time'] .= $cron['hour'] >= 0 && $cron['hour'] < 24 ? sprintf('%02d', $cron[hour]) . lang('timeliness') : '';
|
||||
if (!in_array($cron['minute'], array(-1, ''))) {
|
||||
foreach ($cron['minute'] = explode("\t", $cron['minute']) as $k => $v) {
|
||||
$cron['minute'][$k] = sprintf('%02d', $v);
|
||||
}
|
||||
$cron['minute'] = implode(',', $cron['minute']);
|
||||
$cron['time'] .= $cron['minute'] . lang('point');
|
||||
} else {
|
||||
$cron['time'] .= '00' . lang('point');
|
||||
}
|
||||
|
||||
$cron['lastrun'] = $cron['lastrun'] ? dgmdate($cron['lastrun'], $_G['setting']['dateformat'] . "<\b\\r />" . $_G['setting']['timeformat']) : '<b>N/A</b>';
|
||||
$cron['nextcolor'] = $cron['nextrun'] && $cron['nextrun'] + $_G['setting']['timeoffset'] * 3600 < TIMESTAMP ? 'style="color: #ff0000"' : '';
|
||||
$cron['nextrun'] = $cron['nextrun'] ? dgmdate($cron['nextrun'], $_G['setting']['dateformat'] . "<\b\\r />" . $_G['setting']['timeformat']) : '<b>N/A</b>';
|
||||
$cron['run'] = $cron['available'];
|
||||
|
||||
$crons[] = $cron;
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($ids = dimplode($_GET['delete'])) {
|
||||
DB::delete('cron', "cronid IN ($ids) AND type!='system'");
|
||||
}
|
||||
|
||||
if (is_array($_GET['namenew'])) {
|
||||
foreach ($_GET['namenew'] as $id => $name) {
|
||||
$newcron = array('name' => dhtmlspecialchars($_GET['namenew'][$id]), 'available' => $_GET['availablenew'][$id]);
|
||||
if (empty($_GET['availablenew'][$id])) {
|
||||
$newcron['nextrun'] = '0';
|
||||
}
|
||||
DB::update('cron', $newcron, "cronid='{$id}'");
|
||||
}
|
||||
}
|
||||
|
||||
if ($newname = trim($_GET['newname'])) {
|
||||
DB::insert('cron', array('name' => dhtmlspecialchars($newname), 'type' => 'user', 'available' => '0', 'weekday' => '-1', 'day' => '-1', 'hour' => '-1', 'minute' => '', 'nextrun' => $_G['timestamp'], ));
|
||||
}
|
||||
|
||||
$query = DB::query("SELECT cronid, filename FROM " . DB::table('cron'));
|
||||
while ($cron = DB::fetch($query)) {
|
||||
$efile = explode(':', $cron['filename']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
if (!file_exists($cronfile)) {
|
||||
DB::update('cron', array('available' => '0', 'nextrun' => '0', ), "cronid='$cron[cronid]'");
|
||||
}
|
||||
}
|
||||
updatecache('setting');
|
||||
$msg = lang('crons_succeed');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-success';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$cronid = empty($_GET['run']) ? $_GET['edit'] : $_GET['run'];
|
||||
$cron = DB::fetch_first("SELECT * FROM " . DB::table('cron') . " WHERE cronid='$cronid'");
|
||||
if (!$cron) {
|
||||
$msg = lang('cron_not_found');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-error';
|
||||
include template('cron');
|
||||
exit();
|
||||
}
|
||||
$cron['filename'] = str_replace(array('..', '/', '\\'), array('', '', ''), $cron['filename']);
|
||||
$cronminute = str_replace("\t", ',', $cron['minute']);
|
||||
$cron['minute'] = explode("\t", $cron['minute']);
|
||||
|
||||
if (!empty($_GET['edit'])) {
|
||||
|
||||
if (!submitcheck('editsubmit')) {
|
||||
|
||||
$navtitle = lang('misc_cron_edit') . ' - ' . lang('admin_navtitle');
|
||||
|
||||
$weekdayselect = $dayselect = $hourselect = '';
|
||||
|
||||
for ($i = 0; $i <= 6; $i++) {
|
||||
$weekdayselect .= "<option value=\"$i\" " . ($cron['weekday'] == $i ? 'selected' : '') . ">" . lang('misc_cron_week_day_' . $i) . "</option>";
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= 31; $i++) {
|
||||
$dayselect .= "<option value=\"$i\" " . ($cron['day'] == $i ? 'selected' : '') . ">$i " . lang('day') . "</option>";
|
||||
}
|
||||
|
||||
for ($i = 0; $i <= 23; $i++) {
|
||||
$hourselect .= "<option value=\"$i\" " . ($cron['hour'] == $i ? 'selected' : '') . ">$i " . lang('timeliness') . "</option>";
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$daynew = $_GET['weekdaynew'] != -1 ? -1 : $_GET['daynew'];
|
||||
if (strpos($_GET['minutenew'], ',') !== FALSE) {
|
||||
$minutenew = explode(',', $_GET['minutenew']);
|
||||
foreach ($minutenew as $key => $val) {
|
||||
$minutenew[$key] = $val = intval($val);
|
||||
if ($val < 0 || $var > 59) {
|
||||
unset($minutenew[$key]);
|
||||
}
|
||||
}
|
||||
$minutenew = array_slice(array_unique($minutenew), 0, 12);
|
||||
$minutenew = implode("\t", $minutenew);
|
||||
} else {
|
||||
$minutenew = intval($_GET['minutenew']);
|
||||
$minutenew = $minutenew >= 0 && $minutenew < 60 ? $minutenew : '';
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$_GET['filenamenew'] = str_replace(array('..', '/', '\\'), '', $_GET['filenamenew']);
|
||||
$efile = explode(':', $_GET['filenamenew']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
if (preg_match("/[\\\\\/\*\?\"\<\>\|]+/", $_GET['filenamenew'])) {
|
||||
$msg = lang('crons_filename_illegal');
|
||||
} elseif (!is_readable($cronfile)) {
|
||||
$msg = lang('crons_filename_invalid', array('cronfile' => $cronfile));
|
||||
} elseif ($_GET['weekdaynew'] == -1 && $daynew == -1 && $_GET['hournew'] == -1 && $minutenew === '') {
|
||||
$msg = lang('crons_time_invalid');
|
||||
}
|
||||
if (!empty($msg)) {
|
||||
$msg_type = 'text-error';
|
||||
$redirecturl = dreferer();
|
||||
include template('cron');
|
||||
exit();
|
||||
}
|
||||
|
||||
DB::update('cron', array('weekday' => $_GET['weekdaynew'], 'day' => $daynew, 'hour' => $_GET['hournew'], 'minute' => $minutenew, 'filename' => trim($_GET['filenamenew']), ), "cronid='$cronid'");
|
||||
|
||||
dzz_cron::run($cronid);
|
||||
|
||||
$msg = lang('crons_succeed');
|
||||
$msg_type = 'text-success';
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']);
|
||||
$efile = explode(':', $cron['filename']);
|
||||
if (count($efile) > 1) {
|
||||
$filename = array_pop($efile);
|
||||
$cronfile = DZZ_ROOT. ''.implode("/",$efile).'/cron/'.$filename;
|
||||
} else {
|
||||
$cronfile = DZZ_ROOT . './core/cron/' . $cron['filename'];
|
||||
}
|
||||
|
||||
if (!file_exists($cronfile)) {
|
||||
$msg = lang('crons_run_invalid', array('cronfile' => $cronfile));
|
||||
$msg_type = 'text-error';
|
||||
|
||||
} else {
|
||||
dzz_cron::run($cron['cronid']);
|
||||
$msg = lang('crons_run_succeed');
|
||||
$redirecturl = BASESCRIPT . '?mod=system&op=cron';
|
||||
$msg_type = 'text-success';
|
||||
}
|
||||
}
|
||||
}
|
||||
include template('cron');
|
||||
?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1
admin/system/dist/css/chunk-801d4da6.a47ba236.css
vendored
Normal file
1
admin/system/dist/css/chunk-801d4da6.a47ba236.css
vendored
Normal 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}
|
||||
2
admin/system/dist/index.html
vendored
2
admin/system/dist/index.html
vendored
@@ -1 +1 @@
|
||||
<!DOCTYPE html><html lang=zh><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><title></title><link href=/admin/system/dist/css/chunk-2b4f90f7.519dec70.css rel=prefetch><link href=/admin/system/dist/css/chunk-494f643e.7502109f.css rel=prefetch><link href=/admin/system/dist/css/chunk-5ae5cc35.d763cbce.css rel=prefetch><link href=/admin/system/dist/css/chunk-5cdcd199.6f46c04d.css rel=prefetch><link href=/admin/system/dist/css/chunk-74c32c70.4b7d665e.css rel=prefetch><link href=/admin/system/dist/css/chunk-76f23146.6fc79cd8.css rel=prefetch><link href=/admin/system/dist/css/chunk-7828662a.c81657ef.css rel=prefetch><link href=/admin/system/dist/css/chunk-9f9c2568.5356ad7d.css rel=prefetch><link href=/admin/system/dist/css/chunk-af3b1b98.b822363f.css rel=prefetch><link href=/admin/system/dist/css/chunk-e730cc06.987283b7.css rel=prefetch><link href=/admin/system/dist/css/system_temp.a56510eb.css rel=prefetch><link href=/admin/system/dist/js/chunk-2b4f90f7.ec4ac270.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d0a3327.ad2684c9.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d0bdbc6.4ec7bc5e.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d0dd46d.0816c17e.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d0efd3c.44a093d1.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d20fcd9.50f81306.js rel=prefetch><link href=/admin/system/dist/js/chunk-2d21ddf7.9f7b329e.js rel=prefetch><link href=/admin/system/dist/js/chunk-494f643e.77a11d42.js rel=prefetch><link href=/admin/system/dist/js/chunk-5ae5cc35.25761a21.js rel=prefetch><link href=/admin/system/dist/js/chunk-5cdcd199.070f9c94.js rel=prefetch><link href=/admin/system/dist/js/chunk-74c32c70.1f5e9382.js rel=prefetch><link href=/admin/system/dist/js/chunk-76f23146.0d2957ed.js rel=prefetch><link href=/admin/system/dist/js/chunk-7828662a.e587f025.js rel=prefetch><link href=/admin/system/dist/js/chunk-9f9c2568.538835dd.js rel=prefetch><link href=/admin/system/dist/js/chunk-af3b1b98.850ec152.js rel=prefetch><link href=/admin/system/dist/js/chunk-e730cc06.3ce9a994.js rel=prefetch><link href=/admin/system/dist/js/system_temp.c7e32270.js rel=prefetch><link href=/admin/system/dist/css/chunk-vendors.4d5d56a8.css rel=preload as=style><link href=/admin/system/dist/css/index.7d0ec6bf.css rel=preload as=style><link href=/admin/system/dist/js/chunk-vendors.3b95dfe3.js rel=preload as=script><link href=/admin/system/dist/js/index.b5ff203c.js rel=preload as=script><link href=/admin/system/dist/css/chunk-vendors.4d5d56a8.css rel=stylesheet><link href=/admin/system/dist/css/index.7d0ec6bf.css rel=stylesheet></head><body><div id=app></div><script src=/admin/system/dist/js/chunk-vendors.3b95dfe3.js></script><script src=/admin/system/dist/js/index.b5ff203c.js></script></body></html>
|
||||
<!DOCTYPE html><html lang=zh><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><title></title><link href=admin/system/dist/css/chunk-2b4f90f7.519dec70.css rel=prefetch><link href=admin/system/dist/css/chunk-494f643e.7502109f.css rel=prefetch><link href=admin/system/dist/css/chunk-5ae5cc35.d763cbce.css rel=prefetch><link href=admin/system/dist/css/chunk-74c32c70.4b7d665e.css rel=prefetch><link href=admin/system/dist/css/chunk-76f23146.6fc79cd8.css rel=prefetch><link href=admin/system/dist/css/chunk-7828662a.c81657ef.css rel=prefetch><link href=admin/system/dist/css/chunk-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>
|
||||
1
admin/system/dist/js/chunk-2b4f90f7.8dd0185d.js
vendored
Normal file
1
admin/system/dist/js/chunk-2b4f90f7.8dd0185d.js
vendored
Normal 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}}]);
|
||||
1
admin/system/dist/js/chunk-2d0dd46d.e13ddeba.js
vendored
Normal file
1
admin/system/dist/js/chunk-2d0dd46d.e13ddeba.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0dd46d"],{8164:function(e,t,s){"use strict";s.r(t);var n=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}]},[s("el-card",{staticClass:"box-card",staticStyle:{background:"rgb(240, 249, 235)","text-align":"center"},attrs:{shadow:"hover"}},[s("p",{staticStyle:{"margin-bottom":"0"}},[s("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful1")))])],1),s("p",{staticStyle:{margin:"0"}},[s("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.version))])],1),s("p",{staticStyle:{"margin-bottom":"0"}},[s("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful3",{dir:e.dir})))])],1),s("p",{staticStyle:{margin:"0"}},[s("el-link",{attrs:{type:"success",underline:!1}},[e._v(e._s(e.$t("upgrade_successful4",{backdir:e.backdir})))])],1)])],1)},a=[],r=(s("96cf"),s("1da1")),i={data:function(){return{loading:!1,version:"",dir:"",backdir:""}},created:function(){this.getData()},methods:{getData:function(){var e=this;return Object(r["a"])(regeneratorRuntime.mark((function t(){var s,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.loading=!0,t.next=3,e.axios.post("admin.php?mod=system&op=intsystemupgrade&operation=patch&step=5&version="+e.$route.params.version);case 3:s=t.sent,n=s.data,e.version=e.$t("upgrade_successful2",{msg:n.version}),e.dir=n.dir,e.backdir=n.backdir,e.loading=!1;case 9:case"end":return t.stop()}}),t)})))()}},components:{},mounted:function(){}},c=i,d=s("2877"),o=Object(d["a"])(c,n,a,!1,null,"321830d5",null);t["default"]=o.exports}}]);
|
||||
1
admin/system/dist/js/chunk-801d4da6.0f74a3ea.js
vendored
Normal file
1
admin/system/dist/js/chunk-801d4da6.0f74a3ea.js
vendored
Normal 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}}]);
|
||||
1
admin/system/dist/js/index.5892fe49.js
vendored
Normal file
1
admin/system/dist/js/index.5892fe49.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
admin/system/dist/js/index.d36cff59.js
vendored
Normal file
1
admin/system/dist/js/index.d36cff59.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -1,18 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
require_once(__DIR__.'/dist/index.html');
|
||||
exit();
|
||||
$operation = $_GET['operation'] ? $_GET['operation'] : 'updatecache';
|
||||
$url=getglobal('siteurl'). BASESCRIPT . '?mod=system&op=' . $operation;
|
||||
$url = outputurl($url);
|
||||
@header("location: $url");
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
require_once(__DIR__.'/dist/index.html');
|
||||
exit();
|
||||
$operation = $_GET['operation'] ? $_GET['operation'] : 'updatecache';
|
||||
$url=getglobal('siteurl'). BASESCRIPT . '?mod=system&op=' . $operation;
|
||||
$url = outputurl($url);
|
||||
@header("location: $url");
|
||||
?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,343 +1,345 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
exit(json_encode(array('bbclosed'=>true)));
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
// if ($_GET['ungetfrom']) {
|
||||
// if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
// $dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$version;
|
||||
// $url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
// exit(json_encode(array('iframe'=>true,'url'=>$url)));
|
||||
// dheader('Location: ' . $url);
|
||||
// } else {
|
||||
// exit(json_encode(array('error'=>true,'msg'=>lang('upgrade_param_error'))));
|
||||
// }
|
||||
// }
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
upgradeinformation(-1);
|
||||
exit(json_encode(array('upgradeNone'=>true)));
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=intsystemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if (empty($updatefilelist)) {
|
||||
upgradeinformation(-2);
|
||||
exit(json_encode(array('upgradeError'=>true)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
exit(json_encode(array('step'=>1,'data'=>$updatefilelist)));
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
$linkurl = $theurl . '&step=3';
|
||||
upgradeinformation(0);
|
||||
exit(json_encode(array('step'=>2,'downloadstatus'=>4)));
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>$fileseq,'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)));
|
||||
upgradeinformation(1);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>1)));
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>($fileseq + 1),'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)));
|
||||
upgradeinformation(1);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>2)));
|
||||
} else {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1]);
|
||||
upgradeinformation(-3);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>3)));
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
|
||||
$tableData = array();
|
||||
$button = '';
|
||||
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
|
||||
}else{
|
||||
if(empty($modifylist)){
|
||||
$button = lang('founder_upgrade_regular');
|
||||
}else{
|
||||
$button = lang('founder_upgrade_force');
|
||||
}
|
||||
foreach($updatefilelist as $val){
|
||||
if(isset($modifylist[$val])){
|
||||
$res = array('name'=>$val,'status'=>1);
|
||||
}elseif(isset($showlist[$val])){
|
||||
$res = array('name'=>$val,'status'=>2);
|
||||
}elseif(isset($newlist[$val])){
|
||||
$res = array('name'=>$val,'status'=>3);
|
||||
}else{
|
||||
$res = array('name'=>$val,'status'=>1);
|
||||
}
|
||||
$tableData[] = $res;
|
||||
}
|
||||
}
|
||||
upgradeinformation(-4);
|
||||
exit(json_encode(array('step'=>3,'tableData'=>$tableData,'button'=>$button,'oldversion'=>CORE_VERSION)));
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp&formhash='.FORMHASH . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
exit(json_encode(array('siteftpsetting'=>true,'url'=>$action)));
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
exit(json_encode(array('againsiteftpsetting'=>true)));
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
upgradeinformation(2);
|
||||
exit(json_encode(array('backfile'=>true,'url'=>$linkurl)));
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
upgradeinformation(-5);
|
||||
exit(json_encode(array('destfile'=>true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
upgradeinformation(3);
|
||||
exit(json_encode(array('complete'=>true,'url'=>$theurl.'&step=4&startupgrade=1&confirm='.$confirm.$paraftp)));
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
upgradeinformation(-6);
|
||||
exit(json_encode(array('ftpError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl)));
|
||||
} else {
|
||||
upgradeinformation(-7);
|
||||
exit(json_encode(array('copyError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
// $dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$version;
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
upgradeinformation(4);
|
||||
exit(json_encode(array('updateMysql'=>true,'url'=>$linkurl)));
|
||||
|
||||
}
|
||||
exit(json_encode(array('nextStep'=>true)));
|
||||
|
||||
} elseif ($step == 5) {
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
upgradeinformation(0);
|
||||
exit(json_encode(array('dir'=>$new_update_dir,'backdir'=>$new_back_dir)));
|
||||
// $msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
// $dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$upgrade_step['cachevalue']['version'];
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
exit(json_encode(array('iframe'=>true,'steplang'=>$steplang['dbupdate'],'url'=>$stepurl)));
|
||||
} else {
|
||||
exit(json_encode(array('html'=>true,'steplang'=>$steplang[$upgrade_step['cachevalue']['step']],'data'=>$upgrade_step['cachevalue'])));
|
||||
}
|
||||
}else{
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
exit(json_encode(array('html'=>false)));
|
||||
}
|
||||
}else{
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
exit(json_encode(array('html'=>false)));
|
||||
}
|
||||
exit();
|
||||
}elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$flist = array();
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
if ($unupgrade) {
|
||||
$flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$flist['msg'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
$flist['update'] = false;
|
||||
} else {
|
||||
$flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$flist['update'] = true;
|
||||
$flist['version'] = $upgrade['latestversion'];
|
||||
$flist['locale'] = $locale;
|
||||
$flist['charset'] = $charset;
|
||||
}
|
||||
$list[] = $flist;
|
||||
}
|
||||
exit(json_encode(array('content'=>true,'data'=>$list)));
|
||||
} else {
|
||||
exit(json_encode(array('content'=>false)));
|
||||
}
|
||||
}elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
// $url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
// dheader('Location: ' . $url);
|
||||
}
|
||||
// include template('upgrade');
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
exit(json_encode(array('bbclosed'=>true)));
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
// if ($_GET['ungetfrom']) {
|
||||
// if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
// $dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$version;
|
||||
// $url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
// exit(json_encode(array('iframe'=>true,'url'=>$url)));
|
||||
// dheader('Location: ' . $url);
|
||||
// } else {
|
||||
// exit(json_encode(array('error'=>true,'msg'=>lang('upgrade_param_error'))));
|
||||
// }
|
||||
// }
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
upgradeinformation(-1);
|
||||
exit(json_encode(array('upgradeNone'=>true)));
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=intsystemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if (empty($updatefilelist)) {
|
||||
upgradeinformation(-2);
|
||||
exit(json_encode(array('upgradeError'=>true)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
exit(json_encode(array('step'=>1,'data'=>$updatefilelist)));
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
$linkurl = $theurl . '&step=3';
|
||||
upgradeinformation(0);
|
||||
exit(json_encode(array('step'=>2,'downloadstatus'=>4)));
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>$fileseq,'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)));
|
||||
upgradeinformation(1);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>1)));
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1],'fileseq'=>($fileseq + 1),'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)));
|
||||
upgradeinformation(1);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>2)));
|
||||
} else {
|
||||
$data = array('file' => $updatefilelist[$fileseq - 1]);
|
||||
upgradeinformation(-3);
|
||||
exit(json_encode(array('step'=>2,'data'=>$data,'downloadstatus'=>3)));
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
|
||||
$tableData = array();
|
||||
$button = '';
|
||||
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
|
||||
}else{
|
||||
if(empty($modifylist)){
|
||||
$button = lang('founder_upgrade_regular');
|
||||
}else{
|
||||
$button = lang('founder_upgrade_force');
|
||||
}
|
||||
foreach($updatefilelist as $val){
|
||||
if(isset($modifylist[$val])){
|
||||
$res = array('name'=>$val,'status'=>1);
|
||||
}elseif(isset($showlist[$val])){
|
||||
$res = array('name'=>$val,'status'=>2);
|
||||
}elseif(isset($newlist[$val])){
|
||||
$res = array('name'=>$val,'status'=>3);
|
||||
}else{
|
||||
$res = array('name'=>$val,'status'=>1);
|
||||
}
|
||||
$tableData[] = $res;
|
||||
}
|
||||
}
|
||||
upgradeinformation(-4);
|
||||
exit(json_encode(array('step'=>3,'tableData'=>$tableData,'button'=>$button,'oldversion'=>CORE_VERSION)));
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp&formhash='.FORMHASH . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
exit(json_encode(array('siteftpsetting'=>true,'url'=>$action)));
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
exit(json_encode(array('againsiteftpsetting'=>true)));
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
upgradeinformation(2);
|
||||
exit(json_encode(array('backfile'=>true,'url'=>$linkurl)));
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
upgradeinformation(-5);
|
||||
exit(json_encode(array('destfile'=>true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
upgradeinformation(3);
|
||||
exit(json_encode(array('complete'=>true,'url'=>$theurl.'&step=4&startupgrade=1&confirm='.$confirm.$paraftp)));
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
upgradeinformation(-6);
|
||||
exit(json_encode(array('ftpError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl)));
|
||||
} else {
|
||||
upgradeinformation(-7);
|
||||
exit(json_encode(array('copyError'=>true,'file'=>$updatefile,'againUpdate'=>$linkurl,'ftpUrl'=>$ftplinkurl)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
// $dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$version;
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
upgradeinformation(4);
|
||||
exit(json_encode(array('updateMysql'=>true,'url'=>$linkurl)));
|
||||
|
||||
}
|
||||
exit(json_encode(array('nextStep'=>true)));
|
||||
|
||||
} elseif ($step == 5) {
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
//打开站点
|
||||
C::t('setting')->update('bbclosed', 0);
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
upgradeinformation(0);
|
||||
exit(json_encode(array('version' => $version,'dir'=>$new_update_dir,'backdir'=>$new_back_dir)));
|
||||
// $msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
// $dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system#/systemupgrade/'.$upgrade_step['cachevalue']['version'];
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
exit(json_encode(array('iframe'=>true,'steplang'=>$steplang['dbupdate'],'url'=>$stepurl)));
|
||||
} else {
|
||||
exit(json_encode(array('html'=>true,'steplang'=>$steplang[$upgrade_step['cachevalue']['step']],'data'=>$upgrade_step['cachevalue'])));
|
||||
}
|
||||
}else{
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
exit(json_encode(array('html'=>false)));
|
||||
}
|
||||
}else{
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
exit(json_encode(array('html'=>false)));
|
||||
}
|
||||
exit();
|
||||
}elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$flist = array();
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
if ($unupgrade) {
|
||||
$flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$flist['msg'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
$flist['update'] = false;
|
||||
} else {
|
||||
$flist['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$flist['update'] = true;
|
||||
$flist['version'] = $upgrade['latestversion'];
|
||||
$flist['locale'] = $locale;
|
||||
$flist['charset'] = $charset;
|
||||
}
|
||||
$list[] = $flist;
|
||||
}
|
||||
exit(json_encode(array('content'=>true,'data'=>$list)));
|
||||
} else {
|
||||
exit(json_encode(array('content'=>false)));
|
||||
}
|
||||
}elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
// $url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
// dheader('Location: ' . $url);
|
||||
}
|
||||
// include template('upgrade');
|
||||
?>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$lang = array (
|
||||
'appname'=>'System Tool',
|
||||
'systemupgrade'=>'online upgrade',
|
||||
'tools_updatecache_memory'=>'Memory Cache'
|
||||
);
|
||||
<?php
|
||||
$lang = array (
|
||||
'appname'=>'System Tool',
|
||||
'systemupgrade'=>'online upgrade',
|
||||
'tools_updatecache_memory'=>'Memory Cache'
|
||||
);
|
||||
?>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$lang = array (
|
||||
'appname'=>'系统工具',
|
||||
'systemupgrade'=>'在线升级',
|
||||
'tools_updatecache_memory'=>'内存缓存'
|
||||
);
|
||||
<?php
|
||||
$lang = array (
|
||||
'appname'=>'系统工具',
|
||||
'systemupgrade'=>'在线升级',
|
||||
'tools_updatecache_memory'=>'内存缓存'
|
||||
);
|
||||
?>
|
||||
@@ -1,416 +1,416 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_close_site') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.reload();" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
//$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
if ($_GET['ungetfrom']) {
|
||||
if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
dheader('Location: ' . $url);
|
||||
} else {
|
||||
showmessage('upgrade_param_error');
|
||||
}
|
||||
}
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
//$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_none', array('upgradeurl' => upgradeinformation(-1))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
|
||||
if (empty($updatefilelist)) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_download_upgradelist_error', array('upgradeurl' => upgradeinformation(-2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($thurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>';
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
$linkurl = $theurl . '&step=2';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
|
||||
$linkurl = $theurl . '&step=3';
|
||||
$downloadstatus = 3;
|
||||
$msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0)));
|
||||
if (!$_GET['iframe']) {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("parent.location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="parent.location.href=\'' . $linkurl . '\';return false;">' . lang('message_redirect') . '</a></p>';
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
if (!$_GET['iframe']) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = '<iframe id="downiframe" marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' . $linkurl . '" style="width:100%;height:100%;"></iframe>';
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq + 1) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script></p>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_redownload', array('file' => $updatefilelist[$fileseq - 1], 'upgradeurl' => upgradeinformation(-3))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0;"><input type="button" class="btn btn-success" value="'.lang('founder_upgrade_reset').'" onclick="location.href=\'' . $linkurl . '\'" />';
|
||||
}
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
$msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4)));
|
||||
}
|
||||
$linkurl = $theurl . '&step=4';
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=4';
|
||||
$ftplinkurl = $linkurl . '&siteftpsetting=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_cannot_access_file') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
$msg .= "<script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backuping', array('upgradeurl' => upgradeinformation(2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($linkurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_error', array('upgradeurl' => upgradeinformation(-5))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_complete', array('upgradeurl' => upgradeinformation(3))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_ftp_upload_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-6))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reupload') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_reset_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
} else {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_copy_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_recopy') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_file_successful', array('upgradeurl' => upgradeinformation(4))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout(function(){createIframe(\'' . $linkurl . '\');}, 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' );
|
||||
dheader('Location: ' . $url);
|
||||
|
||||
} elseif ($step == 5) {
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
|
||||
$msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
if (!intval($_GET['rechecking'])) {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
$dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue_db', array('steplang' => $steplang['dbupdate'], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
} else {
|
||||
$stepurl = $theurl . '&step=' . $upgrade_step['cachevalue']['step'];
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue', array('steplang' => $steplang[$upgrade_step['cachevalue']['step']], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
}
|
||||
|
||||
if (!intval($_GET['checking']) || $msg) {
|
||||
|
||||
|
||||
} else {
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
$list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if ($unupgrade) {
|
||||
$list[$type]['title'] = 'oaooa PicHome' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
} else {
|
||||
$list[$type]['title'] = 'oaooa PicHome' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = '<input type="button" class="btn btn-success" onclick="confirm(\'' . lang('founder_upgrade_backup_remind') . '\') ? window.location.href=\'' . $linkurl . '\' : \'\';" value="' . lang('founder_upgrade_automatically') . '">';
|
||||
$list[$type]['official'] = '<a class="btn btn-link" href="' . $upgrade['official'] . '" target="_blank">' . lang('founder_upgrade_manually') . '</a>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
$msg = lang('upgrade_latest_version');
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
|
||||
$url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
include template('upgrade');
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_close_site') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.reload();" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
//$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
if ($_GET['ungetfrom']) {
|
||||
if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
dheader('Location: ' . $url);
|
||||
} else {
|
||||
showmessage('upgrade_param_error');
|
||||
}
|
||||
}
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
//$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_none', array('upgradeurl' => upgradeinformation(-1))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
|
||||
if (empty($updatefilelist)) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_download_upgradelist_error', array('upgradeurl' => upgradeinformation(-2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($thurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>';
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
$linkurl = $theurl . '&step=2';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
|
||||
$linkurl = $theurl . '&step=3';
|
||||
$downloadstatus = 3;
|
||||
$msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0)));
|
||||
if (!$_GET['iframe']) {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("parent.location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="parent.location.href=\'' . $linkurl . '\';return false;">' . lang('message_redirect') . '</a></p>';
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
if (!$_GET['iframe']) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = '<iframe id="downiframe" marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' . $linkurl . '" style="width:100%;height:100%;"></iframe>';
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq + 1) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script></p>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_redownload', array('file' => $updatefilelist[$fileseq - 1], 'upgradeurl' => upgradeinformation(-3))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0;"><input type="button" class="btn btn-success" value="'.lang('founder_upgrade_reset').'" onclick="location.href=\'' . $linkurl . '\'" />';
|
||||
}
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
$msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4)));
|
||||
}
|
||||
$linkurl = $theurl . '&step=4';
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=4';
|
||||
$ftplinkurl = $linkurl . '&siteftpsetting=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_cannot_access_file') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
$msg .= "<script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backuping', array('upgradeurl' => upgradeinformation(2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($linkurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_error', array('upgradeurl' => upgradeinformation(-5))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_complete', array('upgradeurl' => upgradeinformation(3))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_ftp_upload_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-6))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reupload') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_reset_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
} else {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_copy_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_recopy') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_file_successful', array('upgradeurl' => upgradeinformation(4))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout(function(){createIframe(\'' . $linkurl . '\');}, 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' );
|
||||
dheader('Location: ' . $url);
|
||||
|
||||
} elseif ($step == 5) {
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
|
||||
$msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
if (!intval($_GET['rechecking'])) {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
$dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue_db', array('steplang' => $steplang['dbupdate'], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
} else {
|
||||
$stepurl = $theurl . '&step=' . $upgrade_step['cachevalue']['step'];
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue', array('steplang' => $steplang[$upgrade_step['cachevalue']['step']], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
}
|
||||
|
||||
if (!intval($_GET['checking']) || $msg) {
|
||||
|
||||
|
||||
} else {
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
$list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if ($unupgrade) {
|
||||
$list[$type]['title'] = 'oaooa PicHome' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
} else {
|
||||
$list[$type]['title'] = 'oaooa PicHome' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = '<input type="button" class="btn btn-success" onclick="confirm(\'' . lang('founder_upgrade_backup_remind') . '\') ? window.location.href=\'' . $linkurl . '\' : \'\';" value="' . lang('founder_upgrade_automatically') . '">';
|
||||
$list[$type]['official'] = '<a class="btn btn-link" href="' . $upgrade['official'] . '" target="_blank">' . lang('founder_upgrade_manually') . '</a>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
$msg = lang('upgrade_latest_version');
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
|
||||
$url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
include template('upgrade');
|
||||
?>
|
||||
@@ -1,188 +1,188 @@
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<style>
|
||||
input[type="text"] {
|
||||
margin: 0;
|
||||
}
|
||||
ul.help-block, ul.help-block li, .help-block li{
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
<div class="main-header clearfix">
|
||||
<ul class="nav nav-pills nav-pills-bottomguide">
|
||||
<li <!--{if empty($_GET[ 'edit']) && empty($_GET[ 'run'])}-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron">{lang cron}</a>
|
||||
</li>
|
||||
<!--{if !empty($_GET['edit'])}-->
|
||||
<li class="active">
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&edit=$_GET[edit]">{lang misc_cron_edit}</a>
|
||||
</li>
|
||||
<!--{/if}-->
|
||||
<!--{if !empty($_GET['run'])}-->
|
||||
<li class="active">
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&run=$_GET[run]">{lang misc_cron_operation}</a>
|
||||
</li>
|
||||
<!--{/if}-->
|
||||
</ul>
|
||||
</div>
|
||||
<div class="main-content" style="padding:15px;border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<!--{if $_GET['edit']>0}-->
|
||||
<ul class="help-block">
|
||||
<h4>{lang board_message}</h4> {lang misc_cron_edit_tips}
|
||||
</ul>
|
||||
<form id="cpform" action="{BASESCRIPT}?mod=system&op=cron&edit=$cronid" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="editsubmit">
|
||||
<dl>
|
||||
<dt>{lang weekly}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="weekdaynew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$weekdayselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_weekday_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang everyday}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="daynew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$dayselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_day_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang hour}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="hournew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$hourselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_hour_comment}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang minute}:</dt>
|
||||
<dd class="clearfix">
|
||||
<input name="minutenew" value="{eval echo implode(',',$cron[minute])}" type="text" class="form-control">
|
||||
<span class="help-inline">{lang misc_cron_edit_minute_comment}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang misc_cron_edit_filename}:</dt>
|
||||
<dd class="clearfix">
|
||||
<input name="filenamenew" value="$cron[filename]" type="text" class="form-control">
|
||||
<span class="help-inline">{lang misc_cron_edit_filename_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dd class="clearfix">
|
||||
<button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button>
|
||||
</dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{elseif $_GET['run']}-->
|
||||
|
||||
<!--{else}-->
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang misc_cron_tips}
|
||||
<li class="text-danger mt10">计划任务默认通过用户访问触发。缺点是影响用户访问体验;计划任务执行不及时。可以修改config.php文件,设置参数 {eval echo '$_config[remote][on]=1; $_config[remote][cron]=1;';} 停止这种触发方式。</li>
|
||||
<li class="text-danger">推荐设置通过系统计划任务来触发。如linux系统,可以修改/etc/crontab,加入一行 * * * * root php {eval echo DZZ_ROOT.'cron.php >>/dev/null 2>$1';}</li>
|
||||
<li>详细请查阅官方文档 <a href="http://help.oaooa.com/corpus/list?cid=24#fid_330" target="_blank">管理员手册-计划任务</a> 中的相关内容</li>
|
||||
</ul>
|
||||
<form id="cpform" action="{BASESCRIPT}?mod=system&op=cron" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="cronssubmit">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th width="45"></th>
|
||||
<th>{lang name}</th>
|
||||
<th>{lang available}</th>
|
||||
<th>{lang type}</th>
|
||||
<th>{lang time}</th>
|
||||
<th>{lang misc_cron_last_run}</th>
|
||||
<th>{lang misc_cron_next_run}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<!--{loop $crons $cron}-->
|
||||
<tr>
|
||||
<td align="right"><input type="checkbox" name="delete[]" value="$cron[cronid]" <!--{if $cron[type]=='system' }-->disabled
|
||||
<!--{/if}-->></td>
|
||||
<td>
|
||||
<p class="clearfix">
|
||||
<input type="text" name="namenew[{$cron[cronid]}]" class="form-control" value="$cron[name]"></p>
|
||||
<strong>$cron[filename]</strong>
|
||||
</td>
|
||||
<td><label class="checkbox-inline"><input type="checkbox" name="availablenew[{$cron[cronid]}]" value="1" <!--{if $cron[available]>0}-->checked="checked"<!--{/if}-->></label></td>
|
||||
<td>
|
||||
<!--{if $cron['type'] == 'system'}-->
|
||||
{lang inbuilt}
|
||||
<!--{elseif $cron['type'] == 'user'}-->
|
||||
{lang custom}
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
<td>$cron[time]</td>
|
||||
<td>$cron[lastrun]</td>
|
||||
<td>$cron[nextrun]</td>
|
||||
|
||||
<td>
|
||||
<a href="{BASESCRIPT}?mod=system&op=cron&edit=$cron[cronid]">{lang edit}</a>
|
||||
<br />
|
||||
<!--{if $cron['run']}-->
|
||||
<a href="{BASESCRIPT}?mod=system&op=cron&run=$cron[cronid]">{lang execute}</a>
|
||||
<!--{else}-->
|
||||
<a href="javascript:;" class="text-muted">{lang execute}</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!--{/loop}-->
|
||||
<tr>
|
||||
<td>{lang add_new}</td>
|
||||
<td colspan="10"><input type="text" name="newname" value="" class="form-control"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="15" style="border-bottom:none"><label class="checkbox-inline ml20"><input type="checkbox" name="chkall" id="chkallspKI" onclick="checkAll('prefix', this.form, 'delete')">{lang del}</label> <button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<style>
|
||||
input[type="text"] {
|
||||
margin: 0;
|
||||
}
|
||||
ul.help-block, ul.help-block li, .help-block li{
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
<div class="main-header clearfix">
|
||||
<ul class="nav nav-pills nav-pills-bottomguide">
|
||||
<li <!--{if empty($_GET[ 'edit']) && empty($_GET[ 'run'])}-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron">{lang cron}</a>
|
||||
</li>
|
||||
<!--{if !empty($_GET['edit'])}-->
|
||||
<li class="active">
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&edit=$_GET[edit]">{lang misc_cron_edit}</a>
|
||||
</li>
|
||||
<!--{/if}-->
|
||||
<!--{if !empty($_GET['run'])}-->
|
||||
<li class="active">
|
||||
<a hidefocus="true" href="{BASESCRIPT}?mod={MOD_NAME}&op=cron&run=$_GET[run]">{lang misc_cron_operation}</a>
|
||||
</li>
|
||||
<!--{/if}-->
|
||||
</ul>
|
||||
</div>
|
||||
<div class="main-content" style="padding:15px;border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<!--{if $_GET['edit']>0}-->
|
||||
<ul class="help-block">
|
||||
<h4>{lang board_message}</h4> {lang misc_cron_edit_tips}
|
||||
</ul>
|
||||
<form id="cpform" action="{BASESCRIPT}?mod=system&op=cron&edit=$cronid" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="editsubmit">
|
||||
<dl>
|
||||
<dt>{lang weekly}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="weekdaynew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$weekdayselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_weekday_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang everyday}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="daynew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$dayselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_day_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang hour}:</dt>
|
||||
<dd class="clearfix">
|
||||
<select name="hournew" class="form-control">
|
||||
<option value="-1" selected="selected">*</option>
|
||||
$hourselect
|
||||
</select>
|
||||
<span class="help-inline">{lang misc_cron_edit_hour_comment}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang minute}:</dt>
|
||||
<dd class="clearfix">
|
||||
<input name="minutenew" value="{eval echo implode(',',$cron[minute])}" type="text" class="form-control">
|
||||
<span class="help-inline">{lang misc_cron_edit_minute_comment}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang misc_cron_edit_filename}:</dt>
|
||||
<dd class="clearfix">
|
||||
<input name="filenamenew" value="$cron[filename]" type="text" class="form-control">
|
||||
<span class="help-inline">{lang misc_cron_edit_filename_comment}</span>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<dl>
|
||||
<dd class="clearfix">
|
||||
<button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button>
|
||||
</dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{elseif $_GET['run']}-->
|
||||
|
||||
<!--{else}-->
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang misc_cron_tips}
|
||||
<li class="text-danger mt10">计划任务默认通过用户访问触发。缺点是影响用户访问体验;计划任务执行不及时。可以修改config.php文件,设置参数 {eval echo '$_config[remote][on]=1; $_config[remote][cron]=1;';} 停止这种触发方式。</li>
|
||||
<li class="text-danger">推荐设置通过系统计划任务来触发。如linux系统,可以修改/etc/crontab,加入一行 * * * * root php {eval echo DZZ_ROOT.'cron.php >>/dev/null 2>$1';}</li>
|
||||
<li>详细请查阅官方文档 <a href="http://help.oaooa.com/corpus/list?cid=24#fid_330" target="_blank">管理员手册-计划任务</a> 中的相关内容</li>
|
||||
</ul>
|
||||
<form id="cpform" action="{BASESCRIPT}?mod=system&op=cron" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="cronssubmit">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th width="45"></th>
|
||||
<th>{lang name}</th>
|
||||
<th>{lang available}</th>
|
||||
<th>{lang type}</th>
|
||||
<th>{lang time}</th>
|
||||
<th>{lang misc_cron_last_run}</th>
|
||||
<th>{lang misc_cron_next_run}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<!--{loop $crons $cron}-->
|
||||
<tr>
|
||||
<td align="right"><input type="checkbox" name="delete[]" value="$cron[cronid]" <!--{if $cron[type]=='system' }-->disabled
|
||||
<!--{/if}-->></td>
|
||||
<td>
|
||||
<p class="clearfix">
|
||||
<input type="text" name="namenew[{$cron[cronid]}]" class="form-control" value="$cron[name]"></p>
|
||||
<strong>$cron[filename]</strong>
|
||||
</td>
|
||||
<td><label class="checkbox-inline"><input type="checkbox" name="availablenew[{$cron[cronid]}]" value="1" <!--{if $cron[available]>0}-->checked="checked"<!--{/if}-->></label></td>
|
||||
<td>
|
||||
<!--{if $cron['type'] == 'system'}-->
|
||||
{lang inbuilt}
|
||||
<!--{elseif $cron['type'] == 'user'}-->
|
||||
{lang custom}
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
<td>$cron[time]</td>
|
||||
<td>$cron[lastrun]</td>
|
||||
<td>$cron[nextrun]</td>
|
||||
|
||||
<td>
|
||||
<a href="{BASESCRIPT}?mod=system&op=cron&edit=$cron[cronid]">{lang edit}</a>
|
||||
<br />
|
||||
<!--{if $cron['run']}-->
|
||||
<a href="{BASESCRIPT}?mod=system&op=cron&run=$cron[cronid]">{lang execute}</a>
|
||||
<!--{else}-->
|
||||
<a href="javascript:;" class="text-muted">{lang execute}</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!--{/loop}-->
|
||||
<tr>
|
||||
<td>{lang add_new}</td>
|
||||
<td colspan="10"><input type="text" name="newname" value="" class="form-control"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="15" style="border-bottom:none"><label class="checkbox-inline ml20"><input type="checkbox" name="chkall" id="chkallspKI" onclick="checkAll('prefix', this.form, 'delete')">{lang del}</label> <button type="submit" class="btn btn-primary" name="exportsubmit" value="true">{lang blank_submit}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/footer_simple}-->
|
||||
@@ -1,236 +1,236 @@
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
<div class="main-header clearfix">
|
||||
<ul class="nav nav-pills nav-pills-bottomguide">
|
||||
<li <!--{if $operation=='export' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=export">{lang export}</a>
|
||||
</li>
|
||||
<li <!--{if $operation=='import' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=import">{lang nav_db_import}</a>
|
||||
</li>
|
||||
<li <!--{if $operation=='runquery' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=runquery">{lang nav_db_runquery}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--{if $operation=='export'}-->
|
||||
<ul class="help-block mt20">
|
||||
<h5>{lang board_message}</h5> {lang db_export_tips}
|
||||
</ul>
|
||||
<div class="main-content">
|
||||
<!--{if !$submit}-->
|
||||
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=export&setup=1" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="exportsubmit">
|
||||
<dl>
|
||||
<dt>{lang db_export_type}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="type" value="dzz" checked="" onclick="document.getElementById('showtables').style.display = 'none';">{lang all_data_table}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="type" value="custom" onclick="document.getElementById('showtables').style.display = '';">{lang db_export_custom}</label></dd>
|
||||
<dd id="showtables" class="clearfix" style="display:none;border:1px solid #D2D2D2">
|
||||
<h4 class="clearfix ml20"> <label class="checkbox-inline" for ="chkalltables"><input name="chkall" onclick="checkAll('prefix', this.form, 'customtables', 'chkall', true)" checked="checked" type="checkbox" id="chkalltables">{lang check_all_data_table}</label></h4>
|
||||
<ul class="list-unstyled">
|
||||
<!--{loop $dztables $value}-->
|
||||
<li class="col-xs-4"><label class="checkbox-inline"><input type="checkbox" name="customtables[]" value="$value" checked="checked">$value</label></li>
|
||||
<!--{/loop}-->
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<div id="advanceoption" style="display:none">
|
||||
|
||||
<dl>
|
||||
<dt>{lang db_export_method}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="method" value="shell" onclick="if('0') {if(this.form.sqlcompat[2].checked==true) this.form.sqlcompat[0].checked=true; this.form.sqlcompat[2].disabled=true; this.form.sizelimit.disabled=true;} else {this.form.sqlcharset[0].checked=true; for(var i=1; i<=5; i++) {if(this.form.sqlcharset[i]) this.form.sqlcharset[i].disabled=true;}}" id="method_shell">{lang db_export_shell}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="method" value="multivol" checked="checked" onclick="this.form.sqlcompat[2].disabled=false; this.form.sizelimit.disabled=false; for(var i=1; i<=5; i++) {if(this.form.sqlcharset[i]) this.form.sqlcharset[i].disabled=false;}" id="method_multivol">{lang db_export_multivol}</label>
|
||||
<input type="text" class="input-sm form-control" style="width:50px;" name="sizelimit" value="2048">
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_extended_insert}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="extendins" value="1">{lang yes}</label><label class="radio radio-inline"><input type="radio" name="extendins" value="0" checked="checked">{lang no}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_sql_compatible}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="" checked="">{lang default}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="MYSQL40"> MySQL 3.23/4.0.x</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="MYSQL41" disabled=""> MySQL 4.1.x/5.x</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_charset}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcharset" value="">{lang db_export_options_charset}</label>
|
||||
<label class="radio radio-inline"><input type="radio" name="sqlcharset" value="utf8"> UTF8</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_usehex}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usehex" value="1" checked="checked">{lang yes}</label>
|
||||
<label class="radio radio-inline"><input type="radio" name="usehex" value="0" >{lang no}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_usezip}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="1">{lang db_export_zip_1}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="2">{lang db_export_zip_2}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="0" checked>{lang db_export_zip_3}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_filename}:</dt>
|
||||
<dd class="clearfix"><input type="text" class="form-control" name="filename" value="$defaultfilename"></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<dl>
|
||||
<dd class="clearfix"><button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button>
|
||||
<label class="checkbox inline"><input type="checkbox" value="1" onclick="document.getElementById('advanceoption').style.display = document.getElementById('advanceoption').style.display == 'none' ? '' : 'none'; this.value = this.value == 1 ? 0 : 1; this.checked = this.value == 1 ? false : true" id="btn_more">{lang more_options}</label></dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{else}-->
|
||||
<div class="well">
|
||||
<!--{if $msg}-->
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{/if}-->
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='import'}-->
|
||||
<div class="main-content" style="border:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang db_import_tips}
|
||||
</ul>
|
||||
$do_import_option
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=import" class="form-horizontal form-horizontal-left " method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="deletesubmit">
|
||||
<table class="table table-hover" style="border-top:1px solid #DDD">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th>{lang filename}</th>
|
||||
<th>{lang version}</th>
|
||||
<th>{lang time}</th>
|
||||
<th>{lang type}</th>
|
||||
<th>{lang big_small}</th>
|
||||
<th>{lang db_method}</th>
|
||||
<th>{lang db_volume}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<!--{loop $list $key $val}-->
|
||||
<tr>
|
||||
<td><input type="checkbox" name="delete[]" value="$key"></td>
|
||||
<td>
|
||||
<!--{if $val['list']}-->
|
||||
<a href="javascript:;" onclick="jQuery('#exportlog_{$key}').toggle()">$key</a>
|
||||
<!--{else}-->
|
||||
<a href="$val[filename]">$key</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
<td>$val[version]</td>
|
||||
<td>$val[dateline]</td>
|
||||
<td>$val[ftype]</td>
|
||||
<td>$val[size]</td>
|
||||
<td>$val[method]</td>
|
||||
<td>$val[volume]</td>
|
||||
<td>
|
||||
<!--{if $val['list']}-->
|
||||
<a href="{$datasiteurl}restore.php?operation=import&from=server&datafile_server=$val[datafile_server]&importsubmit=yes" <!--{if $info[ 'version'] !=$_G[ 'setting'][ 'version']}--> onclick="return confirm('{lang db_import_confirm}');"<!--{else}-->onclick="return confirm('{lang db_import_confirm_sql}');"<!--{/if}-->target="_blank">{lang import}</a>
|
||||
<!--{else}-->
|
||||
<a href="{$datasiteurl}restore.php?operation=importzip&datafile_server=$info[datafile_server]&importsubmit=yes" onclick="return confirm('{lang db_import_confirm_zip}');" target="_blank">{lang db_import_unzip}</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
<thead id="exportlog_{$key}" style="display:none;">
|
||||
<!--{loop $val[list] $key1 $val1}-->
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<a href="$val1[filename]">$val1[filename]</a>
|
||||
</td>
|
||||
<td>$val1[version]</td>
|
||||
<td>$val1[dateline]</td>
|
||||
<td></td>
|
||||
<td>$val1[size]</td>
|
||||
<td></td>
|
||||
<td>$val1[volume]</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
</thead>
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="15"><input type="checkbox" name="chkall" id="chkallspKI" onclick="checkAll('prefix', this.form, 'delete')">{lang del} <button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='runquery'}-->
|
||||
<div class="main-content">
|
||||
|
||||
<ul class="help-block">
|
||||
<h4>{lang board_message}</h4>
|
||||
{lang db_runquery_tips}
|
||||
</ul>
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 5000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=runquery" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="sqlsubmit">
|
||||
<dl>
|
||||
<dt>{lang db_runquery_sql}</dt>
|
||||
<dd class="clearfix"><textarea cols="85" rows="10" name="queries" style="width:500px;"></textarea></dd>
|
||||
<dd class="clearfix mt10"><label class="checkbox-inline"><input name="createcompatible" type="checkbox" value="1" checked="checked" />{lang db_runquery_createcompatible}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dd class="clearfix"><button type="submit" class="btn btn-primary">{lang blank_submit}</button></dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
<div class="main-header clearfix">
|
||||
<ul class="nav nav-pills nav-pills-bottomguide">
|
||||
<li <!--{if $operation=='export' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=export">{lang export}</a>
|
||||
</li>
|
||||
<li <!--{if $operation=='import' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=import">{lang nav_db_import}</a>
|
||||
</li>
|
||||
<li <!--{if $operation=='runquery' }-->class="active"<!--{/if}-->>
|
||||
<a hidefocus="true" href="{MOD_URL}&op=database&operation=runquery">{lang nav_db_runquery}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--{if $operation=='export'}-->
|
||||
<ul class="help-block mt20">
|
||||
<h5>{lang board_message}</h5> {lang db_export_tips}
|
||||
</ul>
|
||||
<div class="main-content">
|
||||
<!--{if !$submit}-->
|
||||
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=export&setup=1" class="form-horizontal form-horizontal-left" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="exportsubmit">
|
||||
<dl>
|
||||
<dt>{lang db_export_type}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="type" value="dzz" checked="" onclick="document.getElementById('showtables').style.display = 'none';">{lang all_data_table}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="type" value="custom" onclick="document.getElementById('showtables').style.display = '';">{lang db_export_custom}</label></dd>
|
||||
<dd id="showtables" class="clearfix" style="display:none;border:1px solid #D2D2D2">
|
||||
<h4 class="clearfix ml20"> <label class="checkbox-inline" for ="chkalltables"><input name="chkall" onclick="checkAll('prefix', this.form, 'customtables', 'chkall', true)" checked="checked" type="checkbox" id="chkalltables">{lang check_all_data_table}</label></h4>
|
||||
<ul class="list-unstyled">
|
||||
<!--{loop $dztables $value}-->
|
||||
<li class="col-xs-4"><label class="checkbox-inline"><input type="checkbox" name="customtables[]" value="$value" checked="checked">$value</label></li>
|
||||
<!--{/loop}-->
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<div id="advanceoption" style="display:none">
|
||||
|
||||
<dl>
|
||||
<dt>{lang db_export_method}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="method" value="shell" onclick="if('0') {if(this.form.sqlcompat[2].checked==true) this.form.sqlcompat[0].checked=true; this.form.sqlcompat[2].disabled=true; this.form.sizelimit.disabled=true;} else {this.form.sqlcharset[0].checked=true; for(var i=1; i<=5; i++) {if(this.form.sqlcharset[i]) this.form.sqlcharset[i].disabled=true;}}" id="method_shell">{lang db_export_shell}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="method" value="multivol" checked="checked" onclick="this.form.sqlcompat[2].disabled=false; this.form.sizelimit.disabled=false; for(var i=1; i<=5; i++) {if(this.form.sqlcharset[i]) this.form.sqlcharset[i].disabled=false;}" id="method_multivol">{lang db_export_multivol}</label>
|
||||
<input type="text" class="input-sm form-control" style="width:50px;" name="sizelimit" value="2048">
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_extended_insert}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="extendins" value="1">{lang yes}</label><label class="radio radio-inline"><input type="radio" name="extendins" value="0" checked="checked">{lang no}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_sql_compatible}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="" checked="">{lang default}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="MYSQL40"> MySQL 3.23/4.0.x</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcompat" value="MYSQL41" disabled=""> MySQL 4.1.x/5.x</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_options_charset}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="sqlcharset" value="">{lang db_export_options_charset}</label>
|
||||
<label class="radio radio-inline"><input type="radio" name="sqlcharset" value="utf8"> UTF8</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_usehex}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usehex" value="1" checked="checked">{lang yes}</label>
|
||||
<label class="radio radio-inline"><input type="radio" name="usehex" value="0" >{lang no}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_usezip}:</dt>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="1">{lang db_export_zip_1}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="2">{lang db_export_zip_2}</label></dd>
|
||||
<dd class="clearfix"><label class="radio radio-inline"><input type="radio" name="usezip" value="0" checked>{lang db_export_zip_3}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang db_export_filename}:</dt>
|
||||
<dd class="clearfix"><input type="text" class="form-control" name="filename" value="$defaultfilename"></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<dl>
|
||||
<dd class="clearfix"><button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button>
|
||||
<label class="checkbox inline"><input type="checkbox" value="1" onclick="document.getElementById('advanceoption').style.display = document.getElementById('advanceoption').style.display == 'none' ? '' : 'none'; this.value = this.value == 1 ? 0 : 1; this.checked = this.value == 1 ? false : true" id="btn_more">{lang more_options}</label></dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{else}-->
|
||||
<div class="well">
|
||||
<!--{if $msg}-->
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{/if}-->
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='import'}-->
|
||||
<div class="main-content" style="border:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang db_import_tips}
|
||||
</ul>
|
||||
$do_import_option
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=import" class="form-horizontal form-horizontal-left " method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="deletesubmit">
|
||||
<table class="table table-hover" style="border-top:1px solid #DDD">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th>{lang filename}</th>
|
||||
<th>{lang version}</th>
|
||||
<th>{lang time}</th>
|
||||
<th>{lang type}</th>
|
||||
<th>{lang big_small}</th>
|
||||
<th>{lang db_method}</th>
|
||||
<th>{lang db_volume}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<!--{loop $list $key $val}-->
|
||||
<tr>
|
||||
<td><input type="checkbox" name="delete[]" value="$key"></td>
|
||||
<td>
|
||||
<!--{if $val['list']}-->
|
||||
<a href="javascript:;" onclick="jQuery('#exportlog_{$key}').toggle()">$key</a>
|
||||
<!--{else}-->
|
||||
<a href="$val[filename]">$key</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
<td>$val[version]</td>
|
||||
<td>$val[dateline]</td>
|
||||
<td>$val[ftype]</td>
|
||||
<td>$val[size]</td>
|
||||
<td>$val[method]</td>
|
||||
<td>$val[volume]</td>
|
||||
<td>
|
||||
<!--{if $val['list']}-->
|
||||
<a href="{$datasiteurl}restore.php?operation=import&from=server&datafile_server=$val[datafile_server]&importsubmit=yes" <!--{if $info[ 'version'] !=$_G[ 'setting'][ 'version']}--> onclick="return confirm('{lang db_import_confirm}');"<!--{else}-->onclick="return confirm('{lang db_import_confirm_sql}');"<!--{/if}-->target="_blank">{lang import}</a>
|
||||
<!--{else}-->
|
||||
<a href="{$datasiteurl}restore.php?operation=importzip&datafile_server=$info[datafile_server]&importsubmit=yes" onclick="return confirm('{lang db_import_confirm_zip}');" target="_blank">{lang db_import_unzip}</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
<thead id="exportlog_{$key}" style="display:none;">
|
||||
<!--{loop $val[list] $key1 $val1}-->
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<a href="$val1[filename]">$val1[filename]</a>
|
||||
</td>
|
||||
<td>$val1[version]</td>
|
||||
<td>$val1[dateline]</td>
|
||||
<td></td>
|
||||
<td>$val1[size]</td>
|
||||
<td></td>
|
||||
<td>$val1[volume]</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
</thead>
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="15"><input type="checkbox" name="chkall" id="chkallspKI" onclick="checkAll('prefix', this.form, 'delete')">{lang del} <button type="submit" class="btn btn-primary" name="exportsubmit" value="true" >{lang blank_submit}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='runquery'}-->
|
||||
<div class="main-content">
|
||||
|
||||
<ul class="help-block">
|
||||
<h4>{lang board_message}</h4>
|
||||
{lang db_runquery_tips}
|
||||
</ul>
|
||||
<!--{if $msg}-->
|
||||
<div class="well">
|
||||
<p class="$msg_type">$msg</p>
|
||||
<!--{if $redirecturl}-->
|
||||
<p class="text-info">
|
||||
<a href="{$redirecturl}" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 5000);</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{else}-->
|
||||
|
||||
<form id="cpform" action="{MOD_URL}&op=database&operation=runquery" method="post" name="cpform">
|
||||
<input type="hidden" value="{FORMHASH}" name="formhash">
|
||||
<input type="hidden" value="true" name="sqlsubmit">
|
||||
<dl>
|
||||
<dt>{lang db_runquery_sql}</dt>
|
||||
<dd class="clearfix"><textarea cols="85" rows="10" name="queries" style="width:500px;"></textarea></dd>
|
||||
<dd class="clearfix mt10"><label class="checkbox-inline"><input name="createcompatible" type="checkbox" value="1" checked="checked" />{lang db_runquery_createcompatible}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dd class="clearfix"><button type="submit" class="btn btn-primary">{lang blank_submit}</button></dd>
|
||||
</dl>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/footer_simple}-->
|
||||
@@ -1,12 +1,12 @@
|
||||
{eval $oparr=array('updatecache','database','cron','systemupgrade' );}
|
||||
{eval $leftmenu=array();}
|
||||
{eval foreach($oparr as $key => $value){}
|
||||
{eval $leftmenu[$value]=array('title'=>lang($value),'active'=>'');}
|
||||
{eval if($value==$op) $leftmenu[$value]['active']='class="active"';}
|
||||
{eval }}
|
||||
|
||||
<ul class="nav-stacked">
|
||||
<!--{loop $leftmenu $key $value}-->
|
||||
<li $value[active]><a hidefocus="true" href="{MOD_URL}&op=$key">$value[title]</a></li>
|
||||
<!--{/loop}-->
|
||||
{eval $oparr=array('updatecache','database','cron','systemupgrade' );}
|
||||
{eval $leftmenu=array();}
|
||||
{eval foreach($oparr as $key => $value){}
|
||||
{eval $leftmenu[$value]=array('title'=>lang($value),'active'=>'');}
|
||||
{eval if($value==$op) $leftmenu[$value]['active']='class="active"';}
|
||||
{eval }}
|
||||
|
||||
<ul class="nav-stacked">
|
||||
<!--{loop $leftmenu $key $value}-->
|
||||
<li $value[active]><a hidefocus="true" href="{MOD_URL}&op=$key">$value[title]</a></li>
|
||||
<!--{/loop}-->
|
||||
</ul>
|
||||
@@ -1,73 +1,73 @@
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
|
||||
<div class="main-header">
|
||||
<div class="clearfix" style="line-height:40px;padding:0 10px">
|
||||
<!-- <strong style="font-size:14px;">{lang updatecache}</strong>-->
|
||||
<span class="text-muted" id="step1" <!--{if $step==1}-->style="color:green"<!--{/if}-->>1.{lang nav_updatecache_confirm}</span>
|
||||
<span class="text-muted" id="step2" <!--{if $step==2}-->style="color:green"<!--{/if}-->>2.{lang nav_updatecache_verify}</span>
|
||||
<span class="text-muted" id="step3" <!--{if $step==3}-->style="color:green"<!--{/if}-->>3.{lang nav_updatecache_completed}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main-content" style="padding:20px;border-top:1px solid #FFF">
|
||||
<div class="well well-sm">
|
||||
<!--{if $step==1}-->
|
||||
<form method="post" class="form-horizontal form-horizontal-left" action="{MOD_URL}&op=updatecache&step=2">
|
||||
<input name="formhash" value="{VERHASH}" type="hidden">
|
||||
<p class="clearfix ml20">
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="data" checked="" type="checkbox">
|
||||
{lang tools_updatecache_data}
|
||||
</label>
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="tpl" id="tplcache" checked="" type="checkbox">
|
||||
{lang tools_updatecache_tpl}
|
||||
</label>
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="memory" id="momerycache" type="checkbox">
|
||||
{lang tools_updatecache_memory}
|
||||
</label>
|
||||
</p>
|
||||
<p class="clearfix ml20">
|
||||
<input class="btn btn-primary" name="confirmed" value="{lang confirms}" type="submit">
|
||||
<script type="text/javascript">
|
||||
if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<input type="button" class="btn btn-default" value="{lang cancel}" onClick="history.go(-1);">');
|
||||
</script>
|
||||
</p>
|
||||
</form>
|
||||
<!--{elseif $step==2}-->
|
||||
<p class="ml20">{lang tools_updatecache_waiting}</p>
|
||||
<p class="text-success ml20">
|
||||
<a href="{MOD_URL}&op=updatecache&step=3&type=$type" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{MOD_URL}&op=updatecache&step=3&type=$type';}, 2000);</script>
|
||||
<!--{elseif $step==3}-->
|
||||
<p class="text-success ml20" style="margin:10px;">{lang update_cache_succeed}</p>
|
||||
<script type="text/javascript">
|
||||
window.setTimeout(function() { location.href = '{MOD_URL}&op=updatecache'; }, 5000);
|
||||
</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang tools_updatecache_tips}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
|
||||
<div class="main-header">
|
||||
<div class="clearfix" style="line-height:40px;padding:0 10px">
|
||||
<!-- <strong style="font-size:14px;">{lang updatecache}</strong>-->
|
||||
<span class="text-muted" id="step1" <!--{if $step==1}-->style="color:green"<!--{/if}-->>1.{lang nav_updatecache_confirm}</span>
|
||||
<span class="text-muted" id="step2" <!--{if $step==2}-->style="color:green"<!--{/if}-->>2.{lang nav_updatecache_verify}</span>
|
||||
<span class="text-muted" id="step3" <!--{if $step==3}-->style="color:green"<!--{/if}-->>3.{lang nav_updatecache_completed}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main-content" style="padding:20px;border-top:1px solid #FFF">
|
||||
<div class="well well-sm">
|
||||
<!--{if $step==1}-->
|
||||
<form method="post" class="form-horizontal form-horizontal-left" action="{MOD_URL}&op=updatecache&step=2">
|
||||
<input name="formhash" value="{VERHASH}" type="hidden">
|
||||
<p class="clearfix ml20">
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="data" checked="" type="checkbox">
|
||||
{lang tools_updatecache_data}
|
||||
</label>
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="tpl" id="tplcache" checked="" type="checkbox">
|
||||
{lang tools_updatecache_tpl}
|
||||
</label>
|
||||
<label class="checkbox-inline">
|
||||
<input name="type[]" value="memory" id="momerycache" type="checkbox">
|
||||
{lang tools_updatecache_memory}
|
||||
</label>
|
||||
</p>
|
||||
<p class="clearfix ml20">
|
||||
<input class="btn btn-primary" name="confirmed" value="{lang confirms}" type="submit">
|
||||
<script type="text/javascript">
|
||||
if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<input type="button" class="btn btn-default" value="{lang cancel}" onClick="history.go(-1);">');
|
||||
</script>
|
||||
</p>
|
||||
</form>
|
||||
<!--{elseif $step==2}-->
|
||||
<p class="ml20">{lang tools_updatecache_waiting}</p>
|
||||
<p class="text-success ml20">
|
||||
<a href="{MOD_URL}&op=updatecache&step=3&type=$type" class="lightlink">{lang message_redirect}</a>
|
||||
</p>
|
||||
<script type="text/JavaScript">setTimeout(function(){location.href='{MOD_URL}&op=updatecache&step=3&type=$type';}, 2000);</script>
|
||||
<!--{elseif $step==3}-->
|
||||
<p class="text-success ml20" style="margin:10px;">{lang update_cache_succeed}</p>
|
||||
<script type="text/javascript">
|
||||
window.setTimeout(function() { location.href = '{MOD_URL}&op=updatecache'; }, 5000);
|
||||
</script>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<ul class="help-block">
|
||||
<h5>{lang board_message}</h5> {lang tools_updatecache_tips}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/footer_simple}-->
|
||||
@@ -1,246 +1,246 @@
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<style>
|
||||
|
||||
.progress.active .progress-bar {
|
||||
-webkit-animation: none;
|
||||
animation: none;
|
||||
transition: none;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
|
||||
<!--{if $operation == 'patch' || $operation == 'cross'}-->
|
||||
<div class="main-header">
|
||||
<div class="clearfix" style="line-height:40px;padding:0 10px;font-size:12px;">
|
||||
<strong style="font-size:14px;">{lang upgrade}</strong>
|
||||
<!--{loop $steplang $key $value}-->
|
||||
<!--{if $key>0 && $key<=5}-->
|
||||
<span class="text-muted" <!--{if $key==$step}-->style="color:green"<!--{/if}-->>{$key}.{$value}</span>
|
||||
<!--{/if}-->
|
||||
<!--{/loop}-->
|
||||
</div>
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
<!--{if $operation=='check'}-->
|
||||
<div class="main-content" style="border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<div style="padding:20px;">
|
||||
<div class="text-center" style="width:300px;margin:0 auto">
|
||||
<p style="margin:20px 0;">{lang upgrade_checking}</p>
|
||||
<div class="progress progress-striped active" style="border:1px solid #5bc0de">
|
||||
<div class="progress-bar progress-bar-info " role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%"><span class="sr-only">100% Complete</span></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.progress-bar').animate({ width: '100%' }, 3000, function() {
|
||||
window.location.href = '{MOD_URL}&op=systemupgrade&operation=check&checking=1';
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='showupgrade'}-->
|
||||
<div class="main-content" style="border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_select_version}</th>
|
||||
</thead>
|
||||
<!--{loop $list $value}-->
|
||||
<tr>
|
||||
<td>$value[title]</td>
|
||||
<td>$value[btn1]</td>
|
||||
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
|
||||
</table>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='patch' || $operation=='cross' }-->
|
||||
|
||||
<div class="main-content" style="border-top:1px solid #FFF;">
|
||||
<!--{if !$_G['setting']['bbclosed']}-->
|
||||
<div style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{elseif $step==1}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_preupdatelist}</th>
|
||||
</thead>
|
||||
<!--{loop $updatefilelist $value}-->
|
||||
<tr>
|
||||
<td> <i class="glyphicon glyphicon-file"></i> $value</td>
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<th colspan="5"> {lang founder_upgrade_store_directory} ./data/update/oaooa$version</th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> <input type="button" class="btn btn-primary" onclick="window.location.href='$linkurl'" value="{lang founder_upgrade_download}">{eval echo upgradeinformation(0)}</th>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
|
||||
<!--{elseif $step==2}-->
|
||||
<div style="padding:20px;">$msg</div>
|
||||
|
||||
<!--{elseif $step==3}-->
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_diff_show}</th>
|
||||
</thead>
|
||||
<!--{loop $updatefilelist $v}-->
|
||||
<!--{if isset($ignorelist[$v])}-->
|
||||
|
||||
<!--{elseif isset($modifylist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-danger"> {lang founder_upgrade_diff} <i class="glyphicon glyphicon-exclamation-sign"></i> $v</td>
|
||||
</tr>
|
||||
<!--{elseif isset($showlist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-success"> {lang founder_upgrade_normal} <i class="glyphicon glyphicon-ok"></i> $v</td>
|
||||
</tr>
|
||||
<!--{elseif isset($newlist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-info"> {lang founder_upgrade_new} <i class="glyphicon glyphicon-plus"></i> $v</td>
|
||||
</tr>
|
||||
<!--{/if}-->
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_download_file} ./data/update/oaooa{$version}</th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> {lang founder_upgrade_backup_file} ./data/back/oaooa{CORE_VERSION} {lang founder_upgrade_backup_file2} </th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> <input type="button" class="btn btn-primary" onclick="window.location.href='{$linkurl}';" value="<!--{if !empty($modifylist)}-->{lang founder_upgrade_force}<!--{else}-->{lang founder_upgrade_regular}<!--{/if}-->" /> {eval echo upgradeinformation(0)}</th>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
<!--{/if}-->
|
||||
<!--{elseif $step==4}-->
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{elseif $_GET['siteftpsetting']}-->
|
||||
<form name="aliform" class="form-horizontal form-horizontal-left" action="$action" method="post" style="padding:20px;">
|
||||
<input type="hidden" name="formhash" value="{FORMHASH}">
|
||||
<p style="padding-left:20px;font-weight:bold;font-size:16px;padding-bottom:20px;">{lang upgrade_website_FTP_set}</p>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang server_address}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[host]" value="" placeholder="{lang host_IP_address}">
|
||||
<span class="help-inline">{lang FTP_server_IP_site_domain}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang server_port}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[port]" value="21" placeholder="{lang port}">
|
||||
<span class="help-inline">{lang default_for_the_21st}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang account}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[username]" value="" placeholder="{lang FTP_account_user_name}">
|
||||
<span class="help-inline">{lang accounts_supreme_authority}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang password}</label>
|
||||
<input type="password" class="form-control required" name="siteftp[password]" value="" placeholder="{lang FTP_account_user_password}">
|
||||
|
||||
</div>
|
||||
<!--<div class="form-group">
|
||||
<label class="control-label">编码</label>
|
||||
<select class="form-control" name="siteftp[charset]">
|
||||
<option value="GBK" selected="selected">GBK</option>
|
||||
<option value="UTF-8">UTF-8</option>
|
||||
<option value="BIG5">BIG5</option>
|
||||
</select>
|
||||
<span class="help-inline">根据FTP服务器的编码设置,不一致会导致乱码</span>
|
||||
|
||||
</div>-->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label">{lang sitepath}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[attachdir]" value="">
|
||||
<span class="help-inline">{lang site_absolute_path_root_directory}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<label class="checkbox-inline" style="width:180px;"><input type="checkbox" name="siteftp[pasv]" value="1">{lang use_Passive_Mode}</label>
|
||||
<span class="help-inline">{lang general_condition_passive_mode}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<label class="checkbox-inline" style="width:180px;"><input type="checkbox" name="siteftp[ssl]" value="1">{lang enable_secure_link}</label>
|
||||
<span class="help-inline">{lang notice_FTP_open_SSL}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<input type="submit" class="btn btn-primary" style="padding:6px 25px" value="{lang confirms}">
|
||||
</div>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
<!--{elseif $step==5}-->
|
||||
<div style="padding:20px;">
|
||||
<div class="alert alert-success text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
|
||||
<!--{/if}-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
|
||||
function createIframe(src) {
|
||||
document.getElementById('step4').innerHTML = '<iframe marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' + src + '" style="width:100%;height:100%;"></iframe>';
|
||||
}
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/header_simple_start}-->
|
||||
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
|
||||
|
||||
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
|
||||
<script src="admin/scripts/admin.js?{VERHASH}"></script>
|
||||
<style>
|
||||
|
||||
.progress.active .progress-bar {
|
||||
-webkit-animation: none;
|
||||
animation: none;
|
||||
transition: none;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
</style>
|
||||
<!--{template common/header_simple_end}-->
|
||||
<!--{template common/commer_header}-->
|
||||
<div class="bs-container clearfix">
|
||||
<div class="bs-left-container clearfix">
|
||||
<!--{template left}-->
|
||||
</div>
|
||||
<div class="left-drager">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bs-main-container clearfix">
|
||||
|
||||
<!--{if $operation == 'patch' || $operation == 'cross'}-->
|
||||
<div class="main-header">
|
||||
<div class="clearfix" style="line-height:40px;padding:0 10px;font-size:12px;">
|
||||
<strong style="font-size:14px;">{lang upgrade}</strong>
|
||||
<!--{loop $steplang $key $value}-->
|
||||
<!--{if $key>0 && $key<=5}-->
|
||||
<span class="text-muted" <!--{if $key==$step}-->style="color:green"<!--{/if}-->>{$key}.{$value}</span>
|
||||
<!--{/if}-->
|
||||
<!--{/loop}-->
|
||||
</div>
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
<!--{if $operation=='check'}-->
|
||||
<div class="main-content" style="border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<div style="padding:20px;">
|
||||
<div class="text-center" style="width:300px;margin:0 auto">
|
||||
<p style="margin:20px 0;">{lang upgrade_checking}</p>
|
||||
<div class="progress progress-striped active" style="border:1px solid #5bc0de">
|
||||
<div class="progress-bar progress-bar-info " role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%"><span class="sr-only">100% Complete</span></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.progress-bar').animate({ width: '100%' }, 3000, function() {
|
||||
window.location.href = '{MOD_URL}&op=systemupgrade&operation=check&checking=1';
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='showupgrade'}-->
|
||||
<div class="main-content" style="border-top:1px solid #FFF">
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_select_version}</th>
|
||||
</thead>
|
||||
<!--{loop $list $value}-->
|
||||
<tr>
|
||||
<td>$value[title]</td>
|
||||
<td>$value[btn1]</td>
|
||||
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
|
||||
</table>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
<!--{elseif $operation=='patch' || $operation=='cross' }-->
|
||||
|
||||
<div class="main-content" style="border-top:1px solid #FFF;">
|
||||
<!--{if !$_G['setting']['bbclosed']}-->
|
||||
<div style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{elseif $step==1}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_preupdatelist}</th>
|
||||
</thead>
|
||||
<!--{loop $updatefilelist $value}-->
|
||||
<tr>
|
||||
<td> <i class="glyphicon glyphicon-file"></i> $value</td>
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<th colspan="5"> {lang founder_upgrade_store_directory} ./data/update/oaooa$version</th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> <input type="button" class="btn btn-primary" onclick="window.location.href='$linkurl'" value="{lang founder_upgrade_download}">{eval echo upgradeinformation(0)}</th>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
|
||||
<!--{elseif $step==2}-->
|
||||
<div style="padding:20px;">$msg</div>
|
||||
|
||||
<!--{elseif $step==3}-->
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_diff_show}</th>
|
||||
</thead>
|
||||
<!--{loop $updatefilelist $v}-->
|
||||
<!--{if isset($ignorelist[$v])}-->
|
||||
|
||||
<!--{elseif isset($modifylist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-danger"> {lang founder_upgrade_diff} <i class="glyphicon glyphicon-exclamation-sign"></i> $v</td>
|
||||
</tr>
|
||||
<!--{elseif isset($showlist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-success"> {lang founder_upgrade_normal} <i class="glyphicon glyphicon-ok"></i> $v</td>
|
||||
</tr>
|
||||
<!--{elseif isset($newlist[$v])}-->
|
||||
<tr>
|
||||
<td class="text-info"> {lang founder_upgrade_new} <i class="glyphicon glyphicon-plus"></i> $v</td>
|
||||
</tr>
|
||||
<!--{/if}-->
|
||||
<!--{/loop}-->
|
||||
<thead>
|
||||
<th colspan="5">{lang founder_upgrade_download_file} ./data/update/oaooa{$version}</th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> {lang founder_upgrade_backup_file} ./data/back/oaooa{CORE_VERSION} {lang founder_upgrade_backup_file2} </th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="5"> <input type="button" class="btn btn-primary" onclick="window.location.href='{$linkurl}';" value="<!--{if !empty($modifylist)}-->{lang founder_upgrade_force}<!--{else}-->{lang founder_upgrade_regular}<!--{/if}-->" /> {eval echo upgradeinformation(0)}</th>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
<!--{/if}-->
|
||||
<!--{elseif $step==4}-->
|
||||
<!--{if $msg}-->
|
||||
<div id="step4" style="padding:20px;height:450px">
|
||||
<div class="alert alert-warning text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{elseif $_GET['siteftpsetting']}-->
|
||||
<form name="aliform" class="form-horizontal form-horizontal-left" action="$action" method="post" style="padding:20px;">
|
||||
<input type="hidden" name="formhash" value="{FORMHASH}">
|
||||
<p style="padding-left:20px;font-weight:bold;font-size:16px;padding-bottom:20px;">{lang upgrade_website_FTP_set}</p>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang server_address}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[host]" value="" placeholder="{lang host_IP_address}">
|
||||
<span class="help-inline">{lang FTP_server_IP_site_domain}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang server_port}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[port]" value="21" placeholder="{lang port}">
|
||||
<span class="help-inline">{lang default_for_the_21st}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang account}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[username]" value="" placeholder="{lang FTP_account_user_name}">
|
||||
<span class="help-inline">{lang accounts_supreme_authority}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">FTP {lang password}</label>
|
||||
<input type="password" class="form-control required" name="siteftp[password]" value="" placeholder="{lang FTP_account_user_password}">
|
||||
|
||||
</div>
|
||||
<!--<div class="form-group">
|
||||
<label class="control-label">编码</label>
|
||||
<select class="form-control" name="siteftp[charset]">
|
||||
<option value="GBK" selected="selected">GBK</option>
|
||||
<option value="UTF-8">UTF-8</option>
|
||||
<option value="BIG5">BIG5</option>
|
||||
</select>
|
||||
<span class="help-inline">根据FTP服务器的编码设置,不一致会导致乱码</span>
|
||||
|
||||
</div>-->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label">{lang sitepath}</label>
|
||||
<input type="text" class="form-control required" name="siteftp[attachdir]" value="">
|
||||
<span class="help-inline">{lang site_absolute_path_root_directory}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<label class="checkbox-inline" style="width:180px;"><input type="checkbox" name="siteftp[pasv]" value="1">{lang use_Passive_Mode}</label>
|
||||
<span class="help-inline">{lang general_condition_passive_mode}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<label class="checkbox-inline" style="width:180px;"><input type="checkbox" name="siteftp[ssl]" value="1">{lang enable_secure_link}</label>
|
||||
<span class="help-inline">{lang notice_FTP_open_SSL}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<input type="submit" class="btn btn-primary" style="padding:6px 25px" value="{lang confirms}">
|
||||
</div>
|
||||
</form>
|
||||
<!--{/if}-->
|
||||
<!--{elseif $step==5}-->
|
||||
<div style="padding:20px;">
|
||||
<div class="alert alert-success text-center">
|
||||
$msg
|
||||
</div>
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
|
||||
<!--{/if}-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery('.left-drager').leftDrager_layout();
|
||||
|
||||
function createIframe(src) {
|
||||
document.getElementById('step4').innerHTML = '<iframe marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' + src + '" style="width:100%;height:100%;"></iframe>';
|
||||
}
|
||||
</script>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
|
||||
<!--{template common/footer_simple}-->
|
||||
@@ -1,21 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="static/bootstrap/css/bootstrap.min.css">
|
||||
<link href="static/css/common.css" rel="stylesheet" media="all">
|
||||
<style>
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="alert alert-warning">
|
||||
$msg
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="static/bootstrap/css/bootstrap.min.css">
|
||||
<link href="static/css/common.css" rel="stylesheet" media="all">
|
||||
<style>
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="alert alert-warning">
|
||||
$msg
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,46 +1,46 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$oparr = array('updatecache', 'database', /*'security','patch','update',*/
|
||||
'cron', 'log');
|
||||
$leftmenu = array();
|
||||
$op = $_GET['op'];
|
||||
foreach ($oparr as $key => $value) {
|
||||
$leftmenu[$value] = array('title' => lang($value), 'active' => '');
|
||||
if ($value == $op)
|
||||
$leftmenu[$value]['active'] = 'class="active"';
|
||||
}
|
||||
|
||||
include libfile('function/cache');
|
||||
|
||||
$navtitle = lang('updatecache') . ' - ' . lang('admin_navtitle');
|
||||
$step = max(1, intval($_GET['step']));
|
||||
|
||||
if ($step == 1) {
|
||||
} elseif ($step == 2) {
|
||||
$type = implode('_', (array)$_GET['type']);
|
||||
|
||||
} elseif ($step == 3) {
|
||||
$type = explode('_', $_GET['type']);
|
||||
if (in_array('data', $type)) {
|
||||
updatecache();
|
||||
}
|
||||
if (in_array('tpl', $type) && $_G['config']['output']['tplrefresh']) {
|
||||
cleartemplatecache();
|
||||
}
|
||||
if (in_array('memory', $type)) {
|
||||
//清空内存缓存
|
||||
C::memory()->clear();
|
||||
}
|
||||
}
|
||||
include template('updatecache');
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$oparr = array('updatecache', 'database', /*'security','patch','update',*/
|
||||
'cron', 'log');
|
||||
$leftmenu = array();
|
||||
$op = $_GET['op'];
|
||||
foreach ($oparr as $key => $value) {
|
||||
$leftmenu[$value] = array('title' => lang($value), 'active' => '');
|
||||
if ($value == $op)
|
||||
$leftmenu[$value]['active'] = 'class="active"';
|
||||
}
|
||||
|
||||
include libfile('function/cache');
|
||||
|
||||
$navtitle = lang('updatecache') . ' - ' . lang('admin_navtitle');
|
||||
$step = max(1, intval($_GET['step']));
|
||||
|
||||
if ($step == 1) {
|
||||
} elseif ($step == 2) {
|
||||
$type = implode('_', (array)$_GET['type']);
|
||||
|
||||
} elseif ($step == 3) {
|
||||
$type = explode('_', $_GET['type']);
|
||||
if (in_array('data', $type)) {
|
||||
updatecache();
|
||||
}
|
||||
if (in_array('tpl', $type) && $_G['config']['output']['tplrefresh']) {
|
||||
cleartemplatecache();
|
||||
}
|
||||
if (in_array('memory', $type)) {
|
||||
//清空内存缓存
|
||||
C::memory()->clear();
|
||||
}
|
||||
}
|
||||
include template('updatecache');
|
||||
?>
|
||||
|
||||
@@ -1,414 +1,416 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_close_site') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.reload();" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
//$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
if ($_GET['ungetfrom']) {
|
||||
if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
dheader('Location: ' . $url);
|
||||
} else {
|
||||
showmessage('upgrade_param_error');
|
||||
}
|
||||
}
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
//$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_none', array('upgradeurl' => upgradeinformation(-1))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
|
||||
if (empty($updatefilelist)) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_download_upgradelist_error', array('upgradeurl' => upgradeinformation(-2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($thurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>';
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
$linkurl = $theurl . '&step=2';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
|
||||
$linkurl = $theurl . '&step=3';
|
||||
$downloadstatus = 3;
|
||||
$msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0)));
|
||||
if (!$_GET['iframe']) {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("parent.location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="parent.location.href=\'' . $linkurl . '\';return false;">' . lang('message_redirect') . '</a></p>';
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
if (!$_GET['iframe']) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = '<iframe id="downiframe" marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' . $linkurl . '" style="width:100%;height:100%;"></iframe>';
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq + 1) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script></p>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_redownload', array('file' => $updatefilelist[$fileseq - 1], 'upgradeurl' => upgradeinformation(-3))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0;"><input type="button" class="btn btn-success" value="'.lang('founder_upgrade_reset').'" onclick="location.href=\'' . $linkurl . '\'" />';
|
||||
}
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
$msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4)));
|
||||
}
|
||||
$linkurl = $theurl . '&step=4';
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=4';
|
||||
$ftplinkurl = $linkurl . '&siteftpsetting=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_cannot_access_file') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
$msg .= "<script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backuping', array('upgradeurl' => upgradeinformation(2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($linkurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_error', array('upgradeurl' => upgradeinformation(-5))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_complete', array('upgradeurl' => upgradeinformation(3))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_ftp_upload_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-6))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reupload') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_reset_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
} else {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_copy_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_recopy') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_file_successful', array('upgradeurl' => upgradeinformation(4))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout(function(){createIframe(\'' . $linkurl . '\');}, 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' );
|
||||
dheader('Location: ' . $url);
|
||||
|
||||
} elseif ($step == 5) {
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
|
||||
$msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
if (!intval($_GET['rechecking'])) {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
$dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue_db', array('steplang' => $steplang['dbupdate'], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
} else {
|
||||
$stepurl = $theurl . '&step=' . $upgrade_step['cachevalue']['step'];
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue', array('steplang' => $steplang[$upgrade_step['cachevalue']['step']], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
}
|
||||
|
||||
if (!intval($_GET['checking']) || $msg) {
|
||||
|
||||
|
||||
} else {
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
|
||||
}elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
$list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if ($unupgrade) {
|
||||
$list[$type]['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
} else {
|
||||
$list[$type]['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = '<input type="button" class="btn btn-success" onclick="confirm(\'' . lang('founder_upgrade_backup_remind') . '\') ? window.location.href=\'' . $linkurl . '\' : \'\';" value="' . lang('founder_upgrade_automatically') . '">';
|
||||
$list[$type]['official'] = '<a class="btn btn-link" href="' . $upgrade['official'] . '" target="_blank">' . lang('founder_upgrade_manually') . '</a>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
$msg = lang('upgrade_latest_version');
|
||||
}
|
||||
|
||||
}elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
|
||||
$url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
include template('upgrade');
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if (!defined('IN_OAOOA') || !defined('IN_ADMIN')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$navtitle = lang('upgrade') . ' - ' . lang('admin_navtitle');
|
||||
@set_time_limit(0);
|
||||
include_once DZZ_ROOT . './core/core_version.php';
|
||||
include_once libfile('function/admin');
|
||||
include_once libfile('function/cache');
|
||||
$dzz_upgrade = new dzz_upgrade();
|
||||
$step = intval($_GET['step']);
|
||||
$op = $_GET['op'];
|
||||
$step = $step ? $step : 1;
|
||||
$operation = $_GET['operation'] ? trim($_GET['operation']) : 'check';
|
||||
|
||||
$steplang = array('', lang('founder_upgrade_updatelist'), lang('founder_upgrade_download'), lang('founder_upgrade_compare'), lang('founder_upgrade_upgrading'), lang('founder_upgrade_complete'), 'dbupdate' => lang('founder_upgrade_dbupdate'));
|
||||
|
||||
|
||||
if ($operation == 'patch' || $operation == 'cross') {
|
||||
|
||||
if (!$_G['setting']['bbclosed']) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_close_site') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.reload();" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
$version = trim($_GET['version']);
|
||||
//$release = trim($_GET['release']);
|
||||
$locale = trim($_GET['locale']);
|
||||
$charset = trim($_GET['charset']);
|
||||
$upgradeinfo = $upgrade_step = array();
|
||||
|
||||
if ($_GET['ungetfrom']) {
|
||||
if (md5($_GET['ungetfrom'] . $_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$url = outputurl( $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey'])) );
|
||||
dheader('Location: ' . $url);
|
||||
} else {
|
||||
showmessage('upgrade_param_error');
|
||||
}
|
||||
}
|
||||
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$upgrade_step['step'] = $step;
|
||||
$upgrade_step['operation'] = $operation;
|
||||
$upgrade_step['version'] = $version;
|
||||
//$upgrade_step['release'] = $release;
|
||||
$upgrade_step['charset'] = $charset;
|
||||
$upgrade_step['locale'] = $locale;
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgrade_run = C::t('cache') -> fetch('upgrade_run');
|
||||
if (!$upgrade_run) {
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_run', 'cachevalue' => serialize($_G['setting']['upgrade']), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$upgrade_run = $_G['setting']['upgrade'];
|
||||
} else {
|
||||
$upgrade_run = dunserialize($upgrade_run['cachevalue']);
|
||||
}
|
||||
|
||||
if ($step != 5) {
|
||||
|
||||
foreach ($upgrade_run as $type => $list) {
|
||||
if ($type == $operation && $version == $list['latestversion']) {
|
||||
$dzz_upgrade -> locale = $locale;
|
||||
$dzz_upgrade -> charset = $charset;
|
||||
$upgradeinfo = $list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$upgradeinfo) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_none', array('upgradeurl' => upgradeinformation(-1))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$updatefilelist = $dzz_upgrade -> fetch_updatefile_list($upgradeinfo);
|
||||
$updatemd5filelist = $updatefilelist['md5'];
|
||||
$updatefilelist = $updatefilelist['file'];
|
||||
$theurl = $_G['siteurl'].ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&locale=' . $locale . '&charset=' . $charset;
|
||||
|
||||
if (empty($updatefilelist)) {
|
||||
$msg = '<p style="margin:10px 0;color:red">' . lang('upgrade_download_upgradelist_error', array('upgradeurl' => upgradeinformation(-2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($thurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $thurl . '">' . lang('message_redirect') . '</p>';
|
||||
if (!$_GET['iframe']) {
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} else {
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
$linkurl = $theurl . '&step=2';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
} elseif ($step == 2) {
|
||||
$fileseq = intval($_GET['fileseq']);
|
||||
$fileseq = $fileseq ? $fileseq : 1;
|
||||
if ($fileseq > count($updatefilelist)) {
|
||||
|
||||
$linkurl = $theurl . '&step=3';
|
||||
$downloadstatus = 3;
|
||||
$msg = lang('upgrade_download_complete_to_compare', array('upgradeurl' => upgradeinformation(0)));
|
||||
if (!$_GET['iframe']) {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("parent.location.href=\'' . $linkurl . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="parent.location.href=\'' . $linkurl . '\';return false;">' . lang('message_redirect') . '</a></p>';
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
if (!$_GET['iframe']) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = '<iframe id="downiframe" marginheight="0" marginwidth="0" allowtransparency="true" frameborder="0" src="' . $linkurl . '" style="width:100%;height:100%;"></iframe>';
|
||||
} else {
|
||||
$downloadstatus = $dzz_upgrade -> download_file($upgradeinfo, $updatefilelist[$fileseq - 1], 'upload', $updatemd5filelist[$fileseq - 1]);
|
||||
if ($downloadstatus == 1) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . $fileseq . '&iframe=1';
|
||||
$msg = lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
|
||||
} elseif ($downloadstatus == 2) {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq + 1) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_downloading_file', array('file' => $updatefilelist[$fileseq - 1], 'percent' => sprintf("%2d", 100 * $fileseq / count($updatefilelist)) . '%', 'upgradeurl' => upgradeinformation(1))) . '<script type="text/JavaScript">setTimeout("location.href=\'' . $linkurl . '\';", 10);</script></p>';
|
||||
$msg .= ' <p><a href="' . $linkurl . '">' . lang('message_redirect') . '</a></p>';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=2&fileseq=' . ($fileseq) . '&iframe=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_redownload', array('file' => $updatefilelist[$fileseq - 1], 'upgradeurl' => upgradeinformation(-3))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0;"><input type="button" class="btn btn-success" value="'.lang('founder_upgrade_reset').'" onclick="location.href=\'' . $linkurl . '\'" />';
|
||||
}
|
||||
include template('upgrade_iframe');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} elseif ($step == 3) {
|
||||
list($modifylist, $showlist, $ignorelist,$newlist) = $dzz_upgrade -> compare_basefile($upgradeinfo, $updatefilelist,$updatemd5filelist);
|
||||
if (empty($modifylist) && empty($showlist) && empty($ignorelist) && empty($newlist)) {
|
||||
$msg = lang('filecheck_nofound_md5file', array('upgradeurl' => upgradeinformation(-4)));
|
||||
}
|
||||
$linkurl = $theurl . '&step=4';
|
||||
} elseif ($step == 4) {
|
||||
|
||||
$confirm = $_GET['confirm'];
|
||||
if (!$confirm) {
|
||||
if ($_GET['siteftpsetting']) {
|
||||
$action = $theurl . '&step=4&confirm=ftp' . ($_GET['startupgrade'] ? '&startupgrade=1' : '');
|
||||
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
$checkupdatefilelist = array('install/update.php', 'install/data/install.sql', 'install/data/install_data.sql');
|
||||
$checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
|
||||
} else {
|
||||
$checkupdatefilelist = $updatefilelist;
|
||||
}
|
||||
if ($dzz_upgrade -> check_folder_perm($checkupdatefilelist)) {
|
||||
$confirm = 'file';
|
||||
} else {
|
||||
$linkurl = $theurl . '&step=4';
|
||||
$ftplinkurl = $linkurl . '&siteftpsetting=1';
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_cannot_access_file') . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reset') . '" /></p>';
|
||||
$msg .= "<script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$paraftp = '';
|
||||
if ($_GET['siteftp']) {
|
||||
foreach ($_GET['siteftp'] as $k => $v) {
|
||||
$paraftp .= '&siteftp[' . $k . ']=' . $v;
|
||||
}
|
||||
}
|
||||
if (!$_GET['startupgrade']) {
|
||||
if (!$_GET['backfile']) {
|
||||
$linkurl = $theurl . '&step=4&backfile=1&confirm=' . $confirm . $paraftp;
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backuping', array('upgradeurl' => upgradeinformation(2))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($linkurl) . '\';", 1000);</script>';
|
||||
$msg .= ' <p style="margin:10px 0"><a href="' . $linkurl . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
$backfile = DZZ_ROOT . './data/back/pichome' . CORE_VERSION . '/' . $updatefile;
|
||||
if (is_file($destfile)) {
|
||||
if (!$dzz_upgrade -> copy_file($destfile, $backfile, 'file')) {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_error', array('upgradeurl' => upgradeinformation(-5))) . '</p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" >" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_backup_complete', array('upgradeurl' => upgradeinformation(3))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout("location.href=\'' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '\';", 1000);</script>';
|
||||
$msg .= ' <p><a href="' . ($theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp) . '">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
}
|
||||
|
||||
$linkurl = $theurl . '&step=4&startupgrade=1&confirm=' . $confirm . $paraftp;
|
||||
$ftplinkurl = $theurl . '&step=4&startupgrade=1&siteftpsetting=1';
|
||||
foreach ($updatefilelist as $updatefile) {
|
||||
$srcfile = DZZ_ROOT . './data/update/pichome' . $version . '/' . $updatefile;
|
||||
if ($confirm == 'ftp') {
|
||||
$destfile = $updatefile;
|
||||
} else {
|
||||
$destfile = DZZ_ROOT . $updatefile;
|
||||
}
|
||||
if (!$dzz_upgrade -> copy_file($srcfile, $destfile, $confirm)) {
|
||||
if ($confirm == 'ftp') {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_ftp_upload_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-6))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_reupload') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_reset_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
} else {
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_copy_error', array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7))) . '</p>';
|
||||
$msg .= '<p style="margin:10px 0"><input type="button" class="btn btn-primary" onclick="window.location.href=\'' . $linkurl . '\'" value="' . lang('founder_upgrade_recopy') . '" />';
|
||||
$msg .= ' <input type="button" class="btn btn-default" onclick="window.location.href=\'' . $ftplinkurl . '\'" value="' . lang('founder_upgrade_set_ftp') . '" /></p>';
|
||||
$msg .= "<p style=\"margin:10px 0\"><script type=\"text/javascript\">";
|
||||
$msg .= "if(history.length > (BROWSER.ie ? 0 : 1)) document.write('<a href=\"javascript:history.go(-1);\" class=\"lightlink\">" . lang('message_return') . "</a>');";
|
||||
$msg .= "</script></p>";
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($upgradeinfo['isupdatedb']) {
|
||||
|
||||
$upgrade_step['step'] = 'dbupdate';
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize($upgrade_step), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
$dbreturnurl = $_G['siteurl'] . ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5';
|
||||
$linkurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0">' . lang('upgrade_file_successful', array('upgradeurl' => upgradeinformation(4))) . '</p>';
|
||||
$msg .= '<script type="text/JavaScript">setTimeout(function(){createIframe(\'' . $linkurl . '\');}, 1000);</script>';
|
||||
$msg .= ' <p><a href="javascript:;" onclick="createIframe(\'' . $linkurl . '\');return false">' . lang('message_redirect') . '</p>';
|
||||
include template('upgrade');
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=' . $operation . '&version=' . $version . '&step=5' );
|
||||
dheader('Location: ' . $url);
|
||||
|
||||
} elseif ($step == 5) {
|
||||
print_r(1111);
|
||||
die;
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $version . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$new_update_dir = './data/update' . md5('update' . $_G['config']['security']['authkey']) . '/';
|
||||
$old_back_dir = './data/back/';
|
||||
$new_back_dir = './data/back' . md5('back' . $_G['config']['security']['authkey']) . '/';
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_update_dir, DZZ_ROOT . $new_update_dir);
|
||||
$dzz_upgrade -> copy_dir(DZZ_ROOT . $old_back_dir, DZZ_ROOT . $new_back_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_back_dir);
|
||||
|
||||
$msg = lang('upgrade_successful', array('version' => $version, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)));
|
||||
|
||||
}
|
||||
|
||||
}elseif ($operation == 'check') {
|
||||
$msg = '';
|
||||
if (!intval($_GET['rechecking'])) {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
if (!empty($upgrade_step['cachevalue'])) {
|
||||
$upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
|
||||
if (!empty($upgrade_step['cachevalue']['step'])) {
|
||||
$theurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $upgrade_step['cachevalue']['operation'] . '&version=' . $upgrade_step['cachevalue']['version'] . '&locale=' . $upgrade_step['cachevalue']['locale'] . '&charset=' . $upgrade_step['cachevalue']['charset'];
|
||||
|
||||
$recheckurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=recheck';
|
||||
if ($upgrade_step['cachevalue']['step'] == 'dbupdate') {
|
||||
$dbreturnurl = $_G['siteurl'] . $theurl . '&step=5';
|
||||
$stepurl = $_G['siteurl'] . 'install/update.php?step=prepare&from=' . rawurlencode($dbreturnurl) . '&frommd5=' . rawurlencode(md5($dbreturnurl . $_G['config']['security']['authkey']));
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue_db', array('steplang' => $steplang['dbupdate'], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
} else {
|
||||
$stepurl = $theurl . '&step=' . $upgrade_step['cachevalue']['step'];
|
||||
$msg = '<p style="margin:10px 0;">' . lang('upgrade_continue', array('steplang' => $steplang[$upgrade_step['cachevalue']['step']], 'stepurl' => $stepurl, 'recheckurl' => $recheckurl)) . '</p>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
}
|
||||
|
||||
if (!intval($_GET['checking']) || $msg) {
|
||||
|
||||
|
||||
} else {
|
||||
$dzz_upgrade -> check_upgrade();
|
||||
$url = outputurl( $_G['siteurl'].MOD_URL.'&op=systemupgrade&operation=showupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
|
||||
}elseif ($operation == 'showupgrade') {
|
||||
|
||||
if ($_G['setting']['upgrade']) {
|
||||
|
||||
C::t('cache') -> insert(array('cachekey' => 'upgrade_step', 'cachevalue' => serialize(array('curversion' => $dzz_upgrade -> versionpath())), 'dateline' => $_G['timestamp'], ), false, true);
|
||||
|
||||
$upgraderow = $patchrow = array();
|
||||
$charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
|
||||
$dbversion = helper_dbtool::dbversion();
|
||||
$locale = '';
|
||||
|
||||
if ($charset == 'BIG5') {
|
||||
$locale = 'TC';
|
||||
} elseif ($charset == 'GBK') {
|
||||
$locale = 'SC';
|
||||
} elseif ($charset == 'UTF8') {
|
||||
if ($_G['config']['output']['language'] == 'zh-cn' || $_G['config']['output']['language'] == 'zh_cn') {
|
||||
$locale = 'SC';
|
||||
} elseif ($_G['config']['output']['language'] == 'zh-tw' || $_G['config']['output']['language'] == 'zh_tw') {
|
||||
$locale = 'TC';
|
||||
}else{
|
||||
$locale = 'SC';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($_G['setting']['upgrade']))
|
||||
$_G['setting']['upgrade'] = unserialize($_G['setting']['upgrade']);
|
||||
$list = array();
|
||||
foreach ($_G['setting']['upgrade'] as $type => $upgrade) {
|
||||
$unupgrade = 0;
|
||||
if (version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
|
||||
$unupgrade = 1;
|
||||
}
|
||||
$list[$type]['linkurl'] = $linkurl = ADMINSCRIPT . '?mod=system&op=systemupgrade&operation=' . $type . '&version=' . $upgrade['latestversion'] . '&locale=' . $locale . '&charset=' . $charset;
|
||||
if ($unupgrade) {
|
||||
$list[$type]['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = lang('founder_upgrade_require_config') . ' php v' . PHP_VERSION . 'MYSQL v' . $dbversion;
|
||||
} else {
|
||||
$list[$type]['title'] = 'oaooa PicHome ' . $upgrade['latestversion'] . '_' . $locale . '_' . $charset;
|
||||
$list[$type]['btn1'] = '<input type="button" class="btn btn-success" onclick="confirm(\'' . lang('founder_upgrade_backup_remind') . '\') ? window.location.href=\'' . $linkurl . '\' : \'\';" value="' . lang('founder_upgrade_automatically') . '">';
|
||||
$list[$type]['official'] = '<a class="btn btn-link" href="' . $upgrade['official'] . '" target="_blank">' . lang('founder_upgrade_manually') . '</a>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
$msg = lang('upgrade_latest_version');
|
||||
}
|
||||
|
||||
}elseif ($operation == 'recheck') {
|
||||
$upgrade_step = C::t('cache') -> fetch('upgrade_step');
|
||||
$upgrade_step = dunserialize($upgrade_step['cachevalue']);
|
||||
$file = DZZ_ROOT . './data/update/pichome' . $upgrade_step['version'] . '/updatelist.tmp';
|
||||
@unlink($file);
|
||||
@unlink(DZZ_ROOT . './install/update.php');
|
||||
C::t('cache') -> delete('upgrade_step');
|
||||
C::t('cache') -> delete('upgrade_run');
|
||||
C::t('setting') -> update('upgrade', '');
|
||||
updatecache('setting');
|
||||
$old_update_dir = './data/update/';
|
||||
$dzz_upgrade -> rmdirs(DZZ_ROOT . $old_update_dir);
|
||||
|
||||
$url = outputurl($_G['siteurl'].MOD_URL.'&op=systemupgrade' );
|
||||
dheader('Location: ' . $url);
|
||||
}
|
||||
include template('upgrade');
|
||||
?>
|
||||
@@ -29,7 +29,7 @@ if(file_exists(dirname(__FILE__).'/'.$avatar)) {
|
||||
exit;
|
||||
}
|
||||
$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)) {
|
||||
|
||||
@@ -1,169 +1,186 @@
|
||||
<?php
|
||||
$_config = array();
|
||||
|
||||
// ---------------------------- CONFIG DB ----------------------------- //
|
||||
// ---------------------------- 数据库相关设置---------------------------- //
|
||||
|
||||
/**
|
||||
* 数据库主服务器设置, 支持多组服务器设置, 当设置多组服务器时, 则会根据分布式策略使用某个服务器
|
||||
* @example
|
||||
* $_config['db']['1']['dbhost'] = 'localhost'; // 服务器地址
|
||||
* $_config['db']['1']['dbuser'] = 'root'; // 用户
|
||||
* $_config['db']['1']['dbpw'] = '';// 密码
|
||||
* $_config['db']['1']['dbcharset'] = 'gbk';// 字符集
|
||||
* $_config['db']['1']['pconnect'] = '0';// 是否持续连接
|
||||
* $_config['db']['1']['dbname'] = 'x1';// 数据库
|
||||
* $_config['db']['1']['tablepre'] = 'pre_';// 表名前缀
|
||||
*
|
||||
* $_config['db']['2']['dbhost'] = 'localhost';
|
||||
* ...
|
||||
*/
|
||||
$_config['db'][1]['dbhost'] = 'localhost';//支持三种直接加端口如:127.0.0.1:3306或使用UNix socket 如:/tmp/mysql.sock
|
||||
$_config['db'][1]['dbuser'] = 'root';
|
||||
$_config['db'][1]['dbpw'] = 'root';
|
||||
$_config['db'][1]['dbcharset'] = 'utf8';
|
||||
$_config['db'][1]['pconnect'] = 0;
|
||||
$_config['db'][1]['dbname'] = 'pichome';
|
||||
$_config['db'][1]['tablepre'] = 'pichome_';
|
||||
$_config['db'][1]['port'] = '3306';//mysql端口
|
||||
$_config['db'][1]['unix_socket'] = '';//使用此方式连接时 dbhost设置为localhost
|
||||
|
||||
/**
|
||||
* 数据库从服务器设置( slave, 只读 ), 支持多组服务器设置, 当设置多组服务器时, 系统根据每次随机使用
|
||||
* @example
|
||||
* $_config['db']['1']['slave']['1']['dbhost'] = 'localhost';
|
||||
* $_config['db']['1']['slave']['1']['dbuser'] = 'root';
|
||||
* $_config['db']['1']['slave']['1']['dbpw'] = 'root';
|
||||
* $_config['db']['1']['slave']['1']['dbcharset'] = 'gbk';
|
||||
* $_config['db']['1']['slave']['1']['pconnect'] = '0';
|
||||
* $_config['db']['1']['slave']['1']['dbname'] = 'x1';
|
||||
* $_config['db']['1']['slave']['1']['tablepre'] = 'pre_';
|
||||
* $_config['db']['1']['slave']['1']['weight'] = '0'; //权重:数据越大权重越高
|
||||
*
|
||||
* $_config['db']['1']['slave']['2']['dbhost'] = 'localhost';
|
||||
* ...
|
||||
*
|
||||
*/
|
||||
$_config['db']['1']['slave'] = array();
|
||||
|
||||
//启用从服务器的开关
|
||||
$_config['db']['slave'] = false;
|
||||
/**
|
||||
* 数据库 分布部署策略设置
|
||||
*
|
||||
* @example 将 user 部署到第二服务器, session 部署在第三服务器, 则设置为
|
||||
* $_config['db']['map']['user'] = 2;
|
||||
* $_config['db']['map']['session'] = 3;
|
||||
*
|
||||
* 对于没有明确声明服务器的表, 则一律默认部署在第一服务器上
|
||||
*
|
||||
*/
|
||||
$_config['db']['map'] = array();
|
||||
|
||||
/**
|
||||
* 数据库 公共设置, 此类设置通常对针对每个部署的服务器
|
||||
*/
|
||||
$_config['db']['common'] = array();
|
||||
|
||||
/**
|
||||
* 禁用从数据库的数据表, 表名字之间使用逗号分割
|
||||
*
|
||||
* @example session, user 这两个表仅从主服务器读写, 不使用从服务器
|
||||
* $_config['db']['common']['slave_except_table'] = 'session, user';
|
||||
*
|
||||
*/
|
||||
$_config['db']['common']['slave_except_table'] = '';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 内存服务器优化设置
|
||||
* 以下设置需要PHP扩展组件支持,其中 memcache 优先于其他设置,
|
||||
* 当 memcache 无法启用时,会自动开启另外的两种优化模式
|
||||
*/
|
||||
|
||||
//内存变量前缀, 可更改,避免同服务器中的程序引用错乱
|
||||
$_config['memory']['prefix'] = 'oaooa_';
|
||||
|
||||
/* reids设置, 需要PHP扩展组件支持, timeout参数的作用没有查证 */
|
||||
$_config['memory']['redis']['server'] = '';
|
||||
$_config['memory']['redis']['port'] = 6379;
|
||||
$_config['memory']['redis']['pconnect'] = 1;
|
||||
$_config['memory']['redis']['timeout'] = 0;
|
||||
$_config['memory']['redis']['requirepass'] = '';//如果redis需要密码,请填写redis密码
|
||||
/**
|
||||
* 是否使用 Redis::SERIALIZER_IGBINARY选项,需要igbinary支持,windows下测试时请关闭,否则会出>现错误Reading from client: Connection reset by peer
|
||||
* 支持以下选项,默认使用PHP的serializer
|
||||
* Redis::SERIALIZER_IGBINARY =2
|
||||
* Redis::SERIALIZER_PHP =1
|
||||
* Redis::SERIALIZER_NONE =0 //则不使用serialize,即无法保存array
|
||||
*/
|
||||
$_config['memory']['redis']['serializer'] = 1;
|
||||
|
||||
$_config['memory']['memcache']['server'] = ''; // memcache 服务器地址
|
||||
$_config['memory']['memcache']['port'] = 11211; // memcache 服务器端口
|
||||
$_config['memory']['memcache']['pconnect'] = 1; // memcache 是否长久连接
|
||||
$_config['memory']['memcache']['timeout'] = 1; // memcache 服务器连接超时
|
||||
|
||||
$_config['memory']['memcached']['server'] = '127.0.0.1'; // memcached 服务器地址
|
||||
$_config['memory']['memcached']['port'] = 11211; // memcached 服务器端口
|
||||
$_config['memory']['memcached']['pconnect'] = 1; // memcached 是否长久连接
|
||||
$_config['memory']['memcached']['timeout'] = 1; // memcached 服务器连接超时
|
||||
|
||||
$_config['memory']['apc'] = 1; // 启动对 apc 的支持
|
||||
$_config['memory']['xcache'] = 1; // 启动对 xcache 的支持
|
||||
$_config['memory']['eaccelerator'] = 0; // 启动对 eaccelerator 的支持
|
||||
$_config['memory']['wincache'] = 1; // 启动对 wincache 的支持
|
||||
|
||||
|
||||
// 服务器相关设置
|
||||
$_config['server']['id'] = 1; // 服务器编号,多webserver的时候,用于标识当前服务器的ID
|
||||
|
||||
//计划任务设置
|
||||
$_config['remote']['on']=0; //1:设定计划任务由外部触发;0:通过用户访问触发
|
||||
$_config['remote']['cron']=0; //1:设定计划任务由外部触发;0:通过用户访问触发
|
||||
// CONFIG CACHE
|
||||
$_config['cache']['type'] = 'sql'; // 缓存类型 file=文件缓存, sql=数据库缓存
|
||||
|
||||
// 页面输出设置
|
||||
$_config['output']['charset'] = 'utf-8'; // 页面字符集
|
||||
$_config['output']['forceheader'] = 1; // 强制输出页面字符集,用于避免某些环境乱码
|
||||
$_config['output']['gzip'] = 0; // 是否采用 Gzip 压缩输出
|
||||
$_config['output']['tplrefresh'] = 1; // 模板自动刷新开关 0=关闭, 1=打开
|
||||
|
||||
|
||||
$_config['output']['language'] = 'zh-CN'; // 页面语言 zh-cn/zh-tw
|
||||
$_config['output']['language_list']['zh-CN']='简体中文'; // 页面语言 zh-CN/en-US
|
||||
$_config['output']['language_list']['en-US']='English'; // 页面语言 zh-CN/en-US
|
||||
|
||||
$_config['output']['staticurl'] = 'static/'; // 站点静态文件路径,“/”结尾
|
||||
$_config['output']['ajaxvalidate'] = 0; // 是否严格验证 Ajax 页面的真实性 0=关闭,1=打开
|
||||
$_config['output']['iecompatible'] = 0; // 页面 IE 兼容模式
|
||||
|
||||
// COOKIE 设置
|
||||
$_config['cookie']['cookiepre'] = 'oaooa_'; // COOKIE前缀
|
||||
$_config['cookie']['cookiedomain'] = ''; // COOKIE作用域
|
||||
$_config['cookie']['cookiepath'] = '/'; // COOKIE作用路径
|
||||
|
||||
// 站点安全设置
|
||||
$_config['security']['authkey'] = 'oaooa'; // 站点加密密钥
|
||||
$_config['security']['urlxssdefend'] = true; // 自身 URL XSS 防御
|
||||
$_config['security']['attackevasive'] = 0; // CC 攻击防御 1|2|4|8
|
||||
|
||||
$_config['security']['querysafe']['status'] = 1; // 是否开启SQL安全检测,可自动预防SQL注入攻击
|
||||
$_config['security']['querysafe']['dfunction'] = array('load_file','hex','substring','if','ord','char');
|
||||
$_config['security']['querysafe']['daction'] = array('@','intooutfile','intodumpfile','unionselect','(select', 'unionall', 'uniondistinct');
|
||||
$_config['security']['querysafe']['dnote'] = array('/*','*/','#','--','"');
|
||||
$_config['security']['querysafe']['dlikehex'] = 1;
|
||||
$_config['security']['querysafe']['afullnote'] = 0;
|
||||
|
||||
$_config['admincp']['founder'] = '1'; // 站点创始人:拥有站点管理后台的最高权限,每个站点可以设置 1名或多名创始人
|
||||
// 可以使用uid,也可以使用用户名;多个创始人之间请使用逗号“,”分开;
|
||||
$_config['admincp']['checkip'] = 1; // 后台管理操作是否验证管理员的 IP, 1=是[安全], 0=否。仅在管理员无法登录后台时设置 0。
|
||||
$_config['admincp']['runquery'] = 0; // 是否允许后台运行 SQL 语句 1=是 0=否[安全]
|
||||
$_config['admincp']['dbimport'] = 0; // 是否允许后台恢复网站数据 1=是 0=否[安全]
|
||||
$_config['userlogin']['checkip'] = 1; //用户登录错误验证ip,对于同一ip同时使用时建议设置为0,否则当有一位用户登录错误次数超过5次,该ip被锁定15分钟,导致其他的同IP用户无法登录;
|
||||
|
||||
//$_config['system_os'] = 'linux'; //windows,linux,mac,系统会自动判断
|
||||
//$_config['system_charset']='utf-8'; //操作系统编码,不设置系统将根据操作系统类型来判断linux:utf-8;windows:gbk;
|
||||
return $_config;
|
||||
<?php
|
||||
$_config = array();
|
||||
|
||||
// ---------------------------- CONFIG DB ----------------------------- //
|
||||
// ---------------------------- 数据库相关设置---------------------------- //
|
||||
|
||||
/**
|
||||
* 数据库主服务器设置, 支持多组服务器设置, 当设置多组服务器时, 则会根据分布式策略使用某个服务器
|
||||
* @example
|
||||
* $_config['db']['1']['dbhost'] = 'localhost'; // 服务器地址
|
||||
* $_config['db']['1']['dbuser'] = 'root'; // 用户
|
||||
* $_config['db']['1']['dbpw'] = '';// 密码
|
||||
* $_config['db']['1']['dbcharset'] = 'gbk';// 字符集
|
||||
* $_config['db']['1']['pconnect'] = '0';// 是否持续连接
|
||||
* $_config['db']['1']['dbname'] = 'x1';// 数据库
|
||||
* $_config['db']['1']['tablepre'] = 'pre_';// 表名前缀
|
||||
*
|
||||
* $_config['db']['2']['dbhost'] = 'localhost';
|
||||
* ...
|
||||
*/
|
||||
$_config['db'][1]['dbhost'] = 'localhost';//支持三种直接加端口如:127.0.0.1:3306或使用UNix socket 如:/tmp/mysql.sock
|
||||
$_config['db'][1]['dbuser'] = 'root';
|
||||
$_config['db'][1]['dbpw'] = 'root';
|
||||
$_config['db'][1]['dbcharset'] = 'utf8';
|
||||
$_config['db'][1]['pconnect'] = 0;
|
||||
$_config['db'][1]['dbname'] = 'pichome';
|
||||
$_config['db'][1]['tablepre'] = 'pichome_';
|
||||
$_config['db'][1]['port'] = '3306';//mysql端口
|
||||
$_config['db'][1]['unix_socket'] = '';//使用此方式连接时 dbhost设置为localhost
|
||||
|
||||
/**
|
||||
* 数据库从服务器设置( slave, 只读 ), 支持多组服务器设置, 当设置多组服务器时, 系统根据每次随机使用
|
||||
* @example
|
||||
* $_config['db']['1']['slave']['1']['dbhost'] = 'localhost';
|
||||
* $_config['db']['1']['slave']['1']['dbuser'] = 'root';
|
||||
* $_config['db']['1']['slave']['1']['dbpw'] = 'root';
|
||||
* $_config['db']['1']['slave']['1']['dbcharset'] = 'gbk';
|
||||
* $_config['db']['1']['slave']['1']['pconnect'] = '0';
|
||||
* $_config['db']['1']['slave']['1']['dbname'] = 'x1';
|
||||
* $_config['db']['1']['slave']['1']['tablepre'] = 'pre_';
|
||||
* $_config['db']['1']['slave']['1']['weight'] = '0'; //权重:数据越大权重越高
|
||||
*
|
||||
* $_config['db']['1']['slave']['2']['dbhost'] = 'localhost';
|
||||
* ...
|
||||
*
|
||||
*/
|
||||
$_config['db']['1']['slave'] = array();
|
||||
|
||||
//启用从服务器的开关
|
||||
$_config['db']['slave'] = false;
|
||||
/**
|
||||
* 数据库 分布部署策略设置
|
||||
*
|
||||
* @example 将 user 部署到第二服务器, session 部署在第三服务器, 则设置为
|
||||
* $_config['db']['map']['user'] = 2;
|
||||
* $_config['db']['map']['session'] = 3;
|
||||
*
|
||||
* 对于没有明确声明服务器的表, 则一律默认部署在第一服务器上
|
||||
*
|
||||
*/
|
||||
$_config['db']['map'] = array();
|
||||
|
||||
/**
|
||||
* 数据库 公共设置, 此类设置通常对针对每个部署的服务器
|
||||
*/
|
||||
$_config['db']['common'] = array();
|
||||
|
||||
/**
|
||||
* 禁用从数据库的数据表, 表名字之间使用逗号分割
|
||||
*
|
||||
* @example session, user 这两个表仅从主服务器读写, 不使用从服务器
|
||||
* $_config['db']['common']['slave_except_table'] = 'session, user';
|
||||
*
|
||||
*/
|
||||
$_config['db']['common']['slave_except_table'] = '';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 内存服务器优化设置
|
||||
* 以下设置需要PHP扩展组件支持,其中 memcache 优先于其他设置,
|
||||
* 当 memcache 无法启用时,会自动开启另外的两种优化模式
|
||||
*/
|
||||
|
||||
//内存变量前缀, 可更改,避免同服务器中的程序引用错乱
|
||||
$_config['memory']['prefix'] = 'oaooa_';
|
||||
|
||||
/* reids设置, 需要PHP扩展组件支持, timeout参数的作用没有查证 */
|
||||
$_config['memory']['redis']['server'] = '';
|
||||
$_config['memory']['redis']['port'] = 6379;
|
||||
$_config['memory']['redis']['pconnect'] = 1;
|
||||
$_config['memory']['redis']['timeout'] = 0;
|
||||
$_config['memory']['redis']['requirepass'] = '';//如果redis需要密码,请填写redis密码
|
||||
/**
|
||||
* 是否使用 Redis::SERIALIZER_IGBINARY选项,需要igbinary支持,windows下测试时请关闭,否则会出>现错误Reading from client: Connection reset by peer
|
||||
* 支持以下选项,默认使用PHP的serializer
|
||||
* Redis::SERIALIZER_IGBINARY =2
|
||||
* Redis::SERIALIZER_PHP =1
|
||||
* Redis::SERIALIZER_NONE =0 //则不使用serialize,即无法保存array
|
||||
*/
|
||||
$_config['memory']['redis']['serializer'] = 1;
|
||||
|
||||
$_config['memory']['memcache']['server'] = ''; // memcache 服务器地址
|
||||
$_config['memory']['memcache']['port'] = 11211; // memcache 服务器端口
|
||||
$_config['memory']['memcache']['pconnect'] = 1; // memcache 是否长久连接
|
||||
$_config['memory']['memcache']['timeout'] = 1; // memcache 服务器连接超时
|
||||
|
||||
$_config['memory']['memcached']['server'] = '127.0.0.1'; // memcached 服务器地址
|
||||
$_config['memory']['memcached']['port'] = 11211; // memcached 服务器端口
|
||||
$_config['memory']['memcached']['pconnect'] = 1; // memcached 是否长久连接
|
||||
$_config['memory']['memcached']['timeout'] = 1; // memcached 服务器连接超时
|
||||
|
||||
$_config['memory']['apc'] = 1; // 启动对 apc 的支持
|
||||
$_config['memory']['xcache'] = 1; // 启动对 xcache 的支持
|
||||
$_config['memory']['eaccelerator'] = 0; // 启动对 eaccelerator 的支持
|
||||
$_config['memory']['wincache'] = 1; // 启动对 wincache 的支持
|
||||
|
||||
|
||||
// 服务器相关设置
|
||||
$_config['server']['id'] = 1; // 服务器编号,多webserver的时候,用于标识当前服务器的ID
|
||||
|
||||
//计划任务设置
|
||||
$_config['remote']['on']=0; //1:设定计划任务由外部触发;0:通过用户访问触发
|
||||
$_config['remote']['cron']=0; //1:设定计划任务由外部触发;0:通过用户访问触发
|
||||
// CONFIG CACHE
|
||||
$_config['cache']['type'] = 'sql'; // 缓存类型 file=文件缓存, sql=数据库缓存
|
||||
|
||||
// 页面输出设置
|
||||
$_config['output']['charset'] = 'utf-8'; // 页面字符集
|
||||
$_config['output']['forceheader'] = 1; // 强制输出页面字符集,用于避免某些环境乱码
|
||||
$_config['output']['gzip'] = 0; // 是否采用 Gzip 压缩输出
|
||||
$_config['output']['tplrefresh'] = 1; // 模板自动刷新开关 0=关闭, 1=打开
|
||||
|
||||
|
||||
$_config['output']['language'] = 'zh-CN'; // 页面语言 zh-cn/zh-tw
|
||||
$_config['output']['language_list']['zh-CN']='简体中文'; // 页面语言 zh-CN/en-US
|
||||
$_config['output']['language_list']['en-US']='English'; // 页面语言 zh-CN/en-US
|
||||
|
||||
$_config['output']['staticurl'] = 'static/'; // 站点静态文件路径,“/”结尾
|
||||
$_config['output']['ajaxvalidate'] = 0; // 是否严格验证 Ajax 页面的真实性 0=关闭,1=打开
|
||||
$_config['output']['iecompatible'] = 0; // 页面 IE 兼容模式
|
||||
|
||||
// COOKIE 设置
|
||||
$_config['cookie']['cookiepre'] = 'oaooa_'; // COOKIE前缀
|
||||
$_config['cookie']['cookiedomain'] = ''; // COOKIE作用域
|
||||
$_config['cookie']['cookiepath'] = '/'; // COOKIE作用路径
|
||||
|
||||
// 站点安全设置
|
||||
$_config['security']['authkey'] = 'oaooa'; // 站点加密密钥
|
||||
$_config['security']['urlxssdefend'] = true; // 自身 URL XSS 防御
|
||||
$_config['security']['attackevasive'] = 0; // CC 攻击防御 1|2|4|8
|
||||
|
||||
$_config['security']['querysafe']['status'] = 1; // 是否开启SQL安全检测,可自动预防SQL注入攻击
|
||||
$_config['security']['querysafe']['dfunction'] = array('load_file','hex','substring','if','ord','char');
|
||||
$_config['security']['querysafe']['daction'] = array('@','intooutfile','intodumpfile','unionselect','(select', 'unionall', 'uniondistinct');
|
||||
$_config['security']['querysafe']['dnote'] = array('/*','*/','#','--','"');
|
||||
$_config['security']['querysafe']['dlikehex'] = 1;
|
||||
$_config['security']['querysafe']['afullnote'] = 0;
|
||||
|
||||
$_config['admincp']['founder'] = '1'; // 站点创始人:拥有站点管理后台的最高权限,每个站点可以设置 1名或多名创始人
|
||||
// 可以使用uid,也可以使用用户名;多个创始人之间请使用逗号“,”分开;
|
||||
$_config['admincp']['checkip'] = 1; // 后台管理操作是否验证管理员的 IP, 1=是[安全], 0=否。仅在管理员无法登录后台时设置 0。
|
||||
$_config['admincp']['runquery'] = 0; // 是否允许后台运行 SQL 语句 1=是 0=否[安全]
|
||||
$_config['admincp']['dbimport'] = 0; // 是否允许后台恢复网站数据 1=是 0=否[安全]
|
||||
$_config['userlogin']['checkip'] = 1; //用户登录错误验证ip,对于同一ip同时使用时建议设置为0,否则当有一位用户登录错误次数超过5次,该ip被锁定15分钟,导致其他的同IP用户无法登录;
|
||||
|
||||
//$_config['system_os'] = 'linux'; //windows,linux,mac,系统会自动判断
|
||||
//$_config['system_charset']='utf-8'; //操作系统编码,不设置系统将根据操作系统类型来判断linux:utf-8;windows:gbk;
|
||||
|
||||
//pichome宽高
|
||||
$_config['pichomethumbwidth']= 900;
|
||||
$_config['pichomethumbheight']= 900;
|
||||
//pichome缩略图颜色允许后缀
|
||||
$_config['getcolorextlimit'] = ['jpg','png','jpeg','gif','webp','pdf'];
|
||||
//ffmpeg位置
|
||||
$_config['pichomeffmpegposition'] = '';
|
||||
$_config['pichomeffprobposition'] = '';
|
||||
|
||||
//支持获取音视频信息的后缀
|
||||
$_config['pichomeffmpeggetvieoinoext']= [ 'avi', 'rm', 'rmvb', 'mkv', 'mov', 'wmv', 'asf', 'mpg', 'mpe', 'mpeg', 'mp4', 'm4v', 'mpeg', 'f4v', 'vob', 'ogv', 'mts', 'm2ts',
|
||||
'3gp', 'webm', 'flv', 'wav', 'mp3', 'ogg', 'midi', 'wma', 'vqf', 'ra', 'aac', 'flac', 'ape', 'amr', 'aiff', 'au', 'm4a'];
|
||||
//支持获取音视频缩略图后缀
|
||||
$_config['pichomeffmpeggetthumbext']= [ 'avi', 'rm', 'rmvb', 'mkv', 'mov', 'wmv', 'asf', 'mpg', 'mpe', 'mpeg', 'mp4', 'm4v', 'mpeg', 'f4v', 'vob', 'ogv', 'mts', 'm2ts',
|
||||
'3gp', 'webm', 'flv', 'wav', 'mp3', 'ogg', 'midi', 'wma', 'vqf', 'ra', 'aac', 'flac', 'ape', 'amr', 'aiff', 'au', 'm4a'];
|
||||
|
||||
return $_config;
|
||||
|
||||
@@ -1,103 +1,113 @@
|
||||
<?php
|
||||
/** php下载类,支持断点续传
|
||||
* Date: 2013-06-30
|
||||
* Author: test
|
||||
* Ver: 1.0
|
||||
*
|
||||
* Func:
|
||||
* download: 下载文件
|
||||
* setSpeed: 设置下载速度
|
||||
* getRange: 获取header中Range
|
||||
*/
|
||||
|
||||
class FileDownload{ // class start
|
||||
|
||||
private $_speed = 512; // 下载速度
|
||||
|
||||
/** 下载
|
||||
* @param String $file 要下载的文件路径
|
||||
* @param String $name 文件名称,为空则与下载的文件名称一样
|
||||
* @param boolean $reload 是否开启断点续传
|
||||
*/
|
||||
public function download($file, $name='',$file_size=0,$dateline=0, $reload=false){
|
||||
if($name==''){
|
||||
$name = basename($file);
|
||||
}
|
||||
if(!$dateline){
|
||||
$dataline=TIMESTAMP;
|
||||
}
|
||||
if(!$fp = fopen($file, 'rb')){
|
||||
topshowmessage(lang('file_not_exist1'));
|
||||
}
|
||||
$db = DB::object();
|
||||
$db->close();
|
||||
@ob_end_clean();
|
||||
if(getglobal('gzipcompress')) @ob_start('ob_gzhandler');
|
||||
if(!$file_size) $file_size = filesize($file);
|
||||
$ranges = $this->getRange($file_size);
|
||||
|
||||
header('cache-control:public');
|
||||
header('Date: '.gmdate('D, d M Y H:i:s', $dateline).' GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $dateline).' GMT');
|
||||
header('content-type:application/octet-stream');
|
||||
header('content-disposition:attachment; filename='.$name);
|
||||
if($reload && $ranges!=null){ // 使用续传
|
||||
header('HTTP/1.1 206 Partial Content');
|
||||
header('Accept-Ranges:bytes');
|
||||
|
||||
// 剩余长度
|
||||
header(sprintf('content-length:%u',$ranges['end']-$ranges['start']+1));
|
||||
|
||||
// range信息
|
||||
header(sprintf('content-range:bytes %s-%s/%s', $ranges['start'], $ranges['end'], $file_size));
|
||||
|
||||
// fp指针跳到断点位置
|
||||
fseek($fp, sprintf('%u', $ranges['start']));
|
||||
}else{
|
||||
header('HTTP/1.1 200 OK');
|
||||
header('content-length:'.$file_size);
|
||||
}
|
||||
|
||||
while(!feof($fp)){
|
||||
echo fread($fp, round($this->_speed*1024,0));
|
||||
@flush(); @ob_flush();
|
||||
// usleep(500); // 用于测试,减慢下载速度
|
||||
}
|
||||
($fp!=null) && fclose($fp);
|
||||
|
||||
}
|
||||
|
||||
/** 设置下载速度
|
||||
* @param int $speed
|
||||
*/
|
||||
public function setSpeed($speed){
|
||||
if(is_numeric($speed) && $speed>16 && $speed<4096){
|
||||
$this->_speed = $speed;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取header range信息
|
||||
* @param int $file_size 文件大小
|
||||
* @return Array
|
||||
*/
|
||||
private function getRange($file_size){
|
||||
|
||||
if(isset($_SERVER['HTTP_RANGE'])){
|
||||
list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2);
|
||||
list($range) = explode(",",$range,2);
|
||||
list($start, $range_end) = explode("-", $range);
|
||||
$start=intval($start);
|
||||
if(!$range_end) {
|
||||
$range_end=$file_size-1;
|
||||
} else {
|
||||
$range_end=intval($range_end);
|
||||
}
|
||||
$range = array('start'=>$start,'end'=>$range_end);
|
||||
return $range;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
} // class end
|
||||
|
||||
<?php
|
||||
/** php下载类,支持断点续传
|
||||
* Date: 2013-06-30
|
||||
* Author: test
|
||||
* Ver: 1.0
|
||||
*
|
||||
* Func:
|
||||
* download: 下载文件
|
||||
* setSpeed: 设置下载速度
|
||||
* getRange: 获取header中Range
|
||||
*/
|
||||
|
||||
class FileDownload{ // class start
|
||||
|
||||
private $_speed = 512; // 下载速度
|
||||
|
||||
/** 下载
|
||||
* @param String $file 要下载的文件路径
|
||||
* @param String $name 文件名称,为空则与下载的文件名称一样
|
||||
* @param boolean $reload 是否开启断点续传
|
||||
*/
|
||||
public function download($file, $name='',$file_size=0,$dateline=0, $reload=false){
|
||||
if($name==''){
|
||||
$name = basename($file);
|
||||
}
|
||||
if(!$dateline){
|
||||
$dataline=TIMESTAMP;
|
||||
}
|
||||
if(!$fp = fopen($file, 'rb')){
|
||||
topshowmessage(lang('file_not_exist1'));
|
||||
}
|
||||
$charset = CHARSET;
|
||||
$db = DB::object();
|
||||
$db->close();
|
||||
@ob_end_clean();
|
||||
if(getglobal('gzipcompress')) @ob_start('ob_gzhandler');
|
||||
if(!$file_size) $file_size = filesize($file);
|
||||
$ranges = $this->getRange($file_size);
|
||||
|
||||
header('cache-control:public');
|
||||
header('Date: '.gmdate('D, d M Y H:i:s', $dateline).' GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $dateline).' GMT');
|
||||
header('content-type:application/octet-stream');
|
||||
if (preg_match("/Firefox/", $_SERVER["HTTP_USER_AGENT"])) {
|
||||
$attachment = 'attachment; filename*='.$charset.'\'\'' . $name;
|
||||
} elseif (!preg_match("/Chrome/", $_SERVER["HTTP_USER_AGENT"]) && preg_match("/Safari/", $_SERVER["HTTP_USER_AGENT"])) {
|
||||
$filename = rawurlencode($name); // 注意:rawurlencode与urlencode的区别
|
||||
$attachment = 'attachment; filename*='.$charset.'\'\'' . $filename;
|
||||
} else{
|
||||
$attachment = 'attachment; filename='.$name;
|
||||
}
|
||||
//header('content-disposition:attachment; filename='.$name);
|
||||
header('content-disposition:'.$attachment);
|
||||
if($reload && $ranges!=null){ // 使用续传
|
||||
header('HTTP/1.1 206 Partial Content');
|
||||
header('Accept-Ranges:bytes');
|
||||
|
||||
// 剩余长度
|
||||
header(sprintf('content-length:%u',$ranges['end']-$ranges['start']+1));
|
||||
|
||||
// range信息
|
||||
header(sprintf('content-range:bytes %s-%s/%s', $ranges['start'], $ranges['end'], $file_size));
|
||||
|
||||
// fp指针跳到断点位置
|
||||
fseek($fp, sprintf('%u', $ranges['start']));
|
||||
}else{
|
||||
header('HTTP/1.1 200 OK');
|
||||
header('content-length:'.$file_size);
|
||||
}
|
||||
|
||||
while(!feof($fp)){
|
||||
echo fread($fp, round($this->_speed*1024,0));
|
||||
@flush(); @ob_flush();
|
||||
// usleep(500); // 用于测试,减慢下载速度
|
||||
}
|
||||
($fp!=null) && fclose($fp);
|
||||
|
||||
}
|
||||
|
||||
/** 设置下载速度
|
||||
* @param int $speed
|
||||
*/
|
||||
public function setSpeed($speed){
|
||||
if(is_numeric($speed) && $speed>16 && $speed<4096){
|
||||
$this->_speed = $speed;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取header range信息
|
||||
* @param int $file_size 文件大小
|
||||
* @return Array
|
||||
*/
|
||||
private function getRange($file_size){
|
||||
|
||||
if(isset($_SERVER['HTTP_RANGE'])){
|
||||
list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2);
|
||||
list($range) = explode(",",$range,2);
|
||||
list($start, $range_end) = explode("-", $range);
|
||||
$start=intval($start);
|
||||
if(!$range_end) {
|
||||
$range_end=$file_size-1;
|
||||
} else {
|
||||
$range_end=intval($range_end);
|
||||
}
|
||||
$range = array('start'=>$start,'end'=>$range_end);
|
||||
return $range;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
} // class end
|
||||
|
||||
?>
|
||||
@@ -1,471 +1,472 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the ImagePalette package.
|
||||
*
|
||||
* (c) Brian McDonald <brian@brianmcdonald.io>
|
||||
* (c) gandalfx - https://github.com/gandalfx
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class ImagePalette
|
||||
*
|
||||
* Gets the prominent colors in a given image. To get common color matching, all pixels are matched
|
||||
* against a white-listed color palette.
|
||||
*
|
||||
* @package BrianMcdo\ImagePalette
|
||||
*/
|
||||
class ImagePalette implements IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* File or Url
|
||||
* @var string
|
||||
*/
|
||||
protected $file;
|
||||
|
||||
/**
|
||||
* Loaded Image
|
||||
* @var object
|
||||
*/
|
||||
protected $loadedImage;
|
||||
|
||||
/**
|
||||
* Process every Nth pixel
|
||||
* @var int
|
||||
*/
|
||||
protected $precision;
|
||||
|
||||
/**
|
||||
* Width of image
|
||||
* @var integer
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Height of image
|
||||
* @var integer
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Number of colors to return
|
||||
* @var integer
|
||||
*/
|
||||
protected $paletteLength;
|
||||
|
||||
/**
|
||||
* Colors Whitelist
|
||||
* @var array
|
||||
*/
|
||||
/* protected $whiteList = array(
|
||||
0x660000, 0x990000, 0xcc0000, 0xcc3333, 0xea4c88, 0x993399,
|
||||
0x663399, 0x333399, 0x0066cc, 0x0099cc, 0x66cccc, 0x77cc33,
|
||||
0x669900, 0x336600, 0x666600, 0x999900, 0xcccc33, 0xffff00,
|
||||
0xffcc33, 0xff9900, 0xff6600, 0xcc6633, 0x996633, 0x663300,
|
||||
0x000000, 0x999999, 0xcccccc, 0xffffff, 0xE7D8B1, 0xFDADC7,
|
||||
0x424153, 0xABBCDA, 0xF5DD01
|
||||
);*/
|
||||
protected $whiteList = array(
|
||||
0x111111,0xFFFFFF,0x9E9E9E,0xA48057,0xFC85B3,0xFF2727,0xFFA34B,0xFFD534,0x47C595,0x51C4C4,0x2B76E7,0x6D50ED
|
||||
);
|
||||
protected $whiteList1 = array();
|
||||
/**
|
||||
* Colors that were found to be prominent
|
||||
* Array of Color objects
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $palette;
|
||||
|
||||
protected $colorNumber;
|
||||
|
||||
/**
|
||||
* Library used
|
||||
* Supported are GD and Imagick
|
||||
* @var string
|
||||
*/
|
||||
protected $lib;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param string $file
|
||||
* @param int $precision
|
||||
* @param int $paletteLength
|
||||
* @param string $library
|
||||
*/
|
||||
public function __construct($file, $precision = 10, $paletteLength = 5, $library = 'gd',$whiteList=array())
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->precision = $precision;
|
||||
$this->paletteLength = $paletteLength;
|
||||
|
||||
// use provided libname or auto-detect
|
||||
$this->lib = $this->graphicsLibrary($library);
|
||||
|
||||
// create an array with color ints as keys
|
||||
$this->whiteList = array_fill_keys($whiteList?$whiteList:$this->whiteList, 0);
|
||||
$this->whiteList1 = array_fill_keys($whiteList?$whiteList:$this->whiteList, array());
|
||||
|
||||
$this->process($this->lib);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select graphics library to use for processing
|
||||
*
|
||||
* @param string $lib
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function graphicsLibrary($lib = 'gd')
|
||||
{
|
||||
$libraries = [
|
||||
'gd' => 'GD',
|
||||
'imagick' => 'Imagick',
|
||||
//'gmagick' => [false, 'Gmagick']
|
||||
];
|
||||
|
||||
if( ! array_key_exists($lib, $libraries))
|
||||
{
|
||||
throw new Exception('This extension specified is not supported.');
|
||||
}
|
||||
|
||||
if( ! extension_loaded($lib))
|
||||
{
|
||||
throw new Exception('This extension is not installed');
|
||||
}
|
||||
|
||||
return $libraries[$lib];
|
||||
}
|
||||
|
||||
/**
|
||||
* Select a graphical library and start generating the Image Palette
|
||||
* @param string $lib
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function process($lib)
|
||||
{
|
||||
if(!$this->{'setWorkingImage' . $lib} ()) return false;
|
||||
$this->{'setImagesize' . $lib} ();
|
||||
|
||||
$this->readPixels();
|
||||
$ps=array_keys($this->whiteList);
|
||||
// sort whiteList
|
||||
arsort($this->whiteList1);
|
||||
$total=0;
|
||||
foreach($this->whiteList as $key => $v){
|
||||
$total+=intval($v);
|
||||
}
|
||||
//print_r($this->whiteList);exit('ddd');
|
||||
$arr=array();
|
||||
$arr1=array();
|
||||
foreach($this->whiteList1 as $key =>$val){
|
||||
if(!($this->whiteList[$key])) continue;
|
||||
arsort($val);
|
||||
$v=array_keys($val);
|
||||
$arr[$v[0]]=round(($this->whiteList[$key]/$total)*100,2);
|
||||
$arr1[$v[0]]=array_search($key,$ps);
|
||||
}
|
||||
|
||||
$arr=array_slice($arr,0,$this->paletteLength,true);
|
||||
$arr1=array_slice($arr1,0,$this->paletteLength,true);
|
||||
|
||||
$this->palette=$arr;
|
||||
$this->colorNumber=$arr1;
|
||||
|
||||
// sort whiteList accordingly
|
||||
// $this->filter($arr);
|
||||
|
||||
/*array_map(
|
||||
function($color) {
|
||||
return new Color($color);
|
||||
},
|
||||
array_keys($arr)
|
||||
);*/
|
||||
|
||||
}
|
||||
public function getPalette(){
|
||||
return $this->palette;
|
||||
}
|
||||
public function getColorNumber(){
|
||||
return $this->colorNumber;
|
||||
}
|
||||
|
||||
public function getWhiteList1(){
|
||||
return $this->whiteList1;
|
||||
}
|
||||
public function getWidth(){
|
||||
return $this->width;
|
||||
}
|
||||
public function getHeight(){
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set the working image.
|
||||
*/
|
||||
protected function setWorkingImageGD()
|
||||
{
|
||||
//$extension = 'jpg';//pathinfo($this->file, PATHINFO_EXTENSION);
|
||||
$info=@getimagesize($this->file);
|
||||
switch ($info['mime'])
|
||||
{
|
||||
case 'image/png':
|
||||
$this->loadedImage = imagecreatefrompng($this->file);
|
||||
break;
|
||||
|
||||
case 'image/jpeg':
|
||||
$this->loadedImage = imagecreatefromjpeg($this->file);
|
||||
break;
|
||||
|
||||
case 'image/gif':
|
||||
$this->loadedImage = imagecreatefromgif($this->file);
|
||||
break;
|
||||
default:
|
||||
throw new Exception("The file type .$extension is not supported.");
|
||||
}
|
||||
return ture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set working image
|
||||
*
|
||||
* @todo needs work
|
||||
* @return mixed
|
||||
*/
|
||||
protected function setWorkingImageImagick()
|
||||
{
|
||||
$file = file_get_contents($this->file);
|
||||
$temp = tempnam("/tmp", uniqid("ImagePalette_", true));
|
||||
if(!file_put_contents($temp, $file)) return false;
|
||||
$this->loadedImage = new Imagick($temp);
|
||||
$this->loadedImage ->thumbnailImage(64,64,true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set working image
|
||||
*
|
||||
* @todo needs work
|
||||
* @throws \Exception
|
||||
* @return mixed
|
||||
*/
|
||||
protected function setWorkingImageGmagick()
|
||||
{
|
||||
throw new Exception("Gmagick not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and set size of the image using GD.
|
||||
*/
|
||||
protected function setImageSizeGD()
|
||||
{
|
||||
list($this->width, $this->height) = getimagesize($this->file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and set size of image using ImageMagick.
|
||||
*/
|
||||
protected function setImageSizeImagick()
|
||||
{
|
||||
$d = $this->loadedImage->getImageGeometry();
|
||||
|
||||
$this->width = $d['width'];
|
||||
$this->height = $d['height'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* For each interesting pixel, add its closest color to the loaded colors array
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function readPixels()
|
||||
{
|
||||
// Row
|
||||
for ($x = 0; $x < $this->width; $x += $this->precision)
|
||||
{
|
||||
// Column
|
||||
for ($y = 0; $y < $this->height; $y += $this->precision)
|
||||
{
|
||||
|
||||
$color = $this->getPixelColor($x, $y);
|
||||
|
||||
// transparent pixels don't really have a color
|
||||
if ($color->isTransparent())
|
||||
continue 1;
|
||||
// increment closes whiteList color (key)
|
||||
$this->whiteList[ $this->getClosestColor($color) ]++;
|
||||
//$this->whiteList1[$color->toInt()]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get closest matching color
|
||||
*
|
||||
* @param Color $color
|
||||
* @return int
|
||||
*/
|
||||
protected function getClosestColor(Color $color)
|
||||
{
|
||||
$cint=$color->toInt();
|
||||
|
||||
$bestDiff = PHP_INT_MAX;
|
||||
|
||||
// default to black so hhvm won't cry
|
||||
$bestColor = 0x000000;
|
||||
$rgbarr=array();
|
||||
foreach ($this->whiteList as $wlColor => $hits)
|
||||
{
|
||||
|
||||
// calculate difference (don't sqrt)
|
||||
$diff = $color->getDiff($wlColor);
|
||||
|
||||
// see if we got a new best
|
||||
if ($diff < $bestDiff)
|
||||
{
|
||||
$bestDiff = $diff;
|
||||
$bestColor = $wlColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!isset( $this->whiteList1[$bestColor][$cint])) $this->whiteList1[$bestColor][$cint]=1;
|
||||
else {
|
||||
$this->whiteList1[$bestColor][$cint]++;
|
||||
}
|
||||
return $bestColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array describing the color at x,y
|
||||
* At index 0 is the color as a whole int (may include alpha)
|
||||
* At index 1 is the color's red value
|
||||
* At index 2 is the color's green value
|
||||
* At index 3 is the color's blue value
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColor($x, $y)
|
||||
{
|
||||
return $this->{'getPixelColor' . $this->lib} ($x, $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Using to retrieve color information about a specified pixel
|
||||
*
|
||||
* @see getPixelColor()
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColorGD($x, $y)
|
||||
{
|
||||
$color = imagecolorat($this->loadedImage, $x, $y);
|
||||
|
||||
return new Color (
|
||||
$color
|
||||
// $rgb['red'],
|
||||
// $rgb['green'],
|
||||
// $rgb['blue']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Using to retrieve color information about a specified pixel
|
||||
*
|
||||
* @see getPixelColor()
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColorImagick($x, $y)
|
||||
{
|
||||
$rgb = $this->loadedImage->getImagePixelColor($x, $y)->getColor();
|
||||
foreach($rgb as $k => $v){
|
||||
if($v<0) $v=0;
|
||||
$rgb[$k]=$v;
|
||||
}
|
||||
|
||||
return new Color([
|
||||
$rgb['r'],
|
||||
$rgb['g'],
|
||||
$rgb['b'],
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getPixelColorGmagick($x, $y)
|
||||
{
|
||||
throw new Exception("Gmagick not supported: ($x, $y)");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of Color objects
|
||||
*
|
||||
* @param int $paletteLength
|
||||
* @return array
|
||||
*/
|
||||
public function getColors($paletteLength = null)
|
||||
{
|
||||
// allow custom length calls
|
||||
if ( ! is_numeric($paletteLength))
|
||||
{
|
||||
$paletteLength = $this->paletteLength;
|
||||
}
|
||||
|
||||
// take the best hits
|
||||
return array_slice($this->palette, 0, $paletteLength, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a json encoded version of the palette
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
// Color PHP 5.3 compatible -> not JsonSerializable :(
|
||||
return json_encode(array_map(
|
||||
function($color) {
|
||||
return (string) $color;
|
||||
},
|
||||
$this->getColors()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient getter access as properties
|
||||
*
|
||||
* @param $name
|
||||
* @throws \Exception
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
$method = 'get' . ucfirst($name);
|
||||
|
||||
if (method_exists($this, $method))
|
||||
{
|
||||
return $this->$method();
|
||||
}
|
||||
|
||||
throw new Exception("Method $method does not exist");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the palette for implementation of the IteratorAggregate interface
|
||||
* Used in foreach loops
|
||||
*
|
||||
* @see getColors()
|
||||
* @return \ArrayIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->getColors());
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the ImagePalette package.
|
||||
*
|
||||
* (c) Brian McDonald <brian@brianmcdonald.io>
|
||||
* (c) gandalfx - https://github.com/gandalfx
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class ImagePalette
|
||||
*
|
||||
* Gets the prominent colors in a given image. To get common color matching, all pixels are matched
|
||||
* against a white-listed color palette.
|
||||
*
|
||||
* @package BrianMcdo\ImagePalette
|
||||
*/
|
||||
class ImagePalette implements IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* File or Url
|
||||
* @var string
|
||||
*/
|
||||
protected $file;
|
||||
|
||||
/**
|
||||
* Loaded Image
|
||||
* @var object
|
||||
*/
|
||||
protected $loadedImage;
|
||||
|
||||
/**
|
||||
* Process every Nth pixel
|
||||
* @var int
|
||||
*/
|
||||
protected $precision;
|
||||
|
||||
/**
|
||||
* Width of image
|
||||
* @var integer
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Height of image
|
||||
* @var integer
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Number of colors to return
|
||||
* @var integer
|
||||
*/
|
||||
protected $paletteLength;
|
||||
|
||||
/**
|
||||
* Colors Whitelist
|
||||
* @var array
|
||||
*/
|
||||
/* protected $whiteList = array(
|
||||
0x660000, 0x990000, 0xcc0000, 0xcc3333, 0xea4c88, 0x993399,
|
||||
0x663399, 0x333399, 0x0066cc, 0x0099cc, 0x66cccc, 0x77cc33,
|
||||
0x669900, 0x336600, 0x666600, 0x999900, 0xcccc33, 0xffff00,
|
||||
0xffcc33, 0xff9900, 0xff6600, 0xcc6633, 0x996633, 0x663300,
|
||||
0x000000, 0x999999, 0xcccccc, 0xffffff, 0xE7D8B1, 0xFDADC7,
|
||||
0x424153, 0xABBCDA, 0xF5DD01
|
||||
);*/
|
||||
protected $whiteList = array(
|
||||
0x111111,0xFFFFFF,0x9E9E9E,0xA48057,0xFC85B3,0xFF2727,0xFFA34B,0xFFD534,0x47C595,0x51C4C4,0x2B76E7,0x6D50ED
|
||||
);
|
||||
protected $whiteList1 = array();
|
||||
/**
|
||||
* Colors that were found to be prominent
|
||||
* Array of Color objects
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $palette;
|
||||
|
||||
protected $colorNumber;
|
||||
|
||||
/**
|
||||
* Library used
|
||||
* Supported are GD and Imagick
|
||||
* @var string
|
||||
*/
|
||||
protected $lib;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param string $file
|
||||
* @param int $precision
|
||||
* @param int $paletteLength
|
||||
* @param string $library
|
||||
*/
|
||||
public function __construct($file, $precision = 10, $paletteLength = 5, $library = 'gd',$whiteList=array())
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->precision = $precision;
|
||||
$this->paletteLength = $paletteLength;
|
||||
|
||||
// use provided libname or auto-detect
|
||||
$this->lib = $this->graphicsLibrary($library);
|
||||
|
||||
// create an array with color ints as keys
|
||||
$this->whiteList = array_fill_keys($whiteList?$whiteList:$this->whiteList, 0);
|
||||
$this->whiteList1 = array_fill_keys($whiteList?$whiteList:$this->whiteList, array());
|
||||
|
||||
$this->process($this->lib);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select graphics library to use for processing
|
||||
*
|
||||
* @param string $lib
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function graphicsLibrary($lib = 'gd')
|
||||
{
|
||||
$libraries = [
|
||||
'gd' => 'GD',
|
||||
'imagick' => 'Imagick',
|
||||
//'gmagick' => [false, 'Gmagick']
|
||||
];
|
||||
|
||||
if( ! array_key_exists($lib, $libraries))
|
||||
{
|
||||
throw new Exception('This extension specified is not supported.');
|
||||
}
|
||||
|
||||
if( ! extension_loaded($lib))
|
||||
{
|
||||
throw new Exception('This extension is not installed');
|
||||
}
|
||||
|
||||
return $libraries[$lib];
|
||||
}
|
||||
|
||||
/**
|
||||
* Select a graphical library and start generating the Image Palette
|
||||
* @param string $lib
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function process($lib)
|
||||
{
|
||||
if(!$this->{'setWorkingImage' . $lib} ()) return false;
|
||||
$this->{'setImagesize' . $lib} ();
|
||||
|
||||
$this->readPixels();
|
||||
$ps=array_keys($this->whiteList);
|
||||
// sort whiteList
|
||||
arsort($this->whiteList1);
|
||||
$total=0;
|
||||
foreach($this->whiteList as $key => $v){
|
||||
$total+=intval($v);
|
||||
}
|
||||
//print_r($this->whiteList);exit('ddd');
|
||||
$arr=array();
|
||||
$arr1=array();
|
||||
foreach($this->whiteList1 as $key =>$val){
|
||||
if(!($this->whiteList[$key])) continue;
|
||||
arsort($val);
|
||||
$v=array_keys($val);
|
||||
$arr[$v[0]]=round(($this->whiteList[$key]/$total)*100,2);
|
||||
$arr1[$v[0]]=array_search($key,$ps);
|
||||
}
|
||||
|
||||
$arr=array_slice($arr,0,$this->paletteLength,true);
|
||||
$arr1=array_slice($arr1,0,$this->paletteLength,true);
|
||||
|
||||
$this->palette=$arr;
|
||||
$this->colorNumber=$arr1;
|
||||
|
||||
// sort whiteList accordingly
|
||||
// $this->filter($arr);
|
||||
|
||||
/*array_map(
|
||||
function($color) {
|
||||
return new Color($color);
|
||||
},
|
||||
array_keys($arr)
|
||||
);*/
|
||||
|
||||
}
|
||||
public function getPalette(){
|
||||
return $this->palette;
|
||||
}
|
||||
public function getColorNumber(){
|
||||
return $this->colorNumber;
|
||||
}
|
||||
|
||||
public function getWhiteList1(){
|
||||
return $this->whiteList1;
|
||||
}
|
||||
public function getWidth(){
|
||||
return $this->width;
|
||||
}
|
||||
public function getHeight(){
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set the working image.
|
||||
*/
|
||||
protected function setWorkingImageGD()
|
||||
{
|
||||
//$extension = 'jpg';//pathinfo($this->file, PATHINFO_EXTENSION);
|
||||
$info=@getimagesize($this->file);
|
||||
switch ($info['mime'])
|
||||
{
|
||||
case 'image/png':
|
||||
$this->loadedImage = imagecreatefrompng($this->file);
|
||||
break;
|
||||
|
||||
case 'image/jpeg':
|
||||
$this->loadedImage = imagecreatefromjpeg($this->file);
|
||||
break;
|
||||
|
||||
case 'image/gif':
|
||||
$this->loadedImage = imagecreatefromgif($this->file);
|
||||
break;
|
||||
default:
|
||||
throw new Exception("The file type .$extension is not supported.");
|
||||
}
|
||||
return ture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set working image
|
||||
*
|
||||
* @todo needs work
|
||||
* @return mixed
|
||||
*/
|
||||
protected function setWorkingImageImagick()
|
||||
{
|
||||
$file = file_get_contents($this->file);
|
||||
$temp = tempnam(DZZ_ROOT.'./data/attachment/cache', uniqid("ImagePalette_", true));
|
||||
if(!file_put_contents($temp, $file)) return false;
|
||||
$this->loadedImage = new Imagick($temp);
|
||||
$this->loadedImage ->thumbnailImage(64,64,true);
|
||||
@unlink($temp);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set working image
|
||||
*
|
||||
* @todo needs work
|
||||
* @throws \Exception
|
||||
* @return mixed
|
||||
*/
|
||||
protected function setWorkingImageGmagick()
|
||||
{
|
||||
throw new Exception("Gmagick not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and set size of the image using GD.
|
||||
*/
|
||||
protected function setImageSizeGD()
|
||||
{
|
||||
list($this->width, $this->height) = getimagesize($this->file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and set size of image using ImageMagick.
|
||||
*/
|
||||
protected function setImageSizeImagick()
|
||||
{
|
||||
$d = $this->loadedImage->getImageGeometry();
|
||||
|
||||
$this->width = $d['width'];
|
||||
$this->height = $d['height'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* For each interesting pixel, add its closest color to the loaded colors array
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function readPixels()
|
||||
{
|
||||
// Row
|
||||
for ($x = 0; $x < $this->width; $x += $this->precision)
|
||||
{
|
||||
// Column
|
||||
for ($y = 0; $y < $this->height; $y += $this->precision)
|
||||
{
|
||||
|
||||
$color = $this->getPixelColor($x, $y);
|
||||
|
||||
// transparent pixels don't really have a color
|
||||
if ($color->isTransparent())
|
||||
continue 1;
|
||||
// increment closes whiteList color (key)
|
||||
$this->whiteList[ $this->getClosestColor($color) ]++;
|
||||
//$this->whiteList1[$color->toInt()]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get closest matching color
|
||||
*
|
||||
* @param Color $color
|
||||
* @return int
|
||||
*/
|
||||
protected function getClosestColor(Color $color)
|
||||
{
|
||||
$cint=$color->toInt();
|
||||
|
||||
$bestDiff = PHP_INT_MAX;
|
||||
|
||||
// default to black so hhvm won't cry
|
||||
$bestColor = 0x000000;
|
||||
$rgbarr=array();
|
||||
foreach ($this->whiteList as $wlColor => $hits)
|
||||
{
|
||||
|
||||
// calculate difference (don't sqrt)
|
||||
$diff = $color->getDiff($wlColor);
|
||||
|
||||
// see if we got a new best
|
||||
if ($diff < $bestDiff)
|
||||
{
|
||||
$bestDiff = $diff;
|
||||
$bestColor = $wlColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!isset( $this->whiteList1[$bestColor][$cint])) $this->whiteList1[$bestColor][$cint]=1;
|
||||
else {
|
||||
$this->whiteList1[$bestColor][$cint]++;
|
||||
}
|
||||
return $bestColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array describing the color at x,y
|
||||
* At index 0 is the color as a whole int (may include alpha)
|
||||
* At index 1 is the color's red value
|
||||
* At index 2 is the color's green value
|
||||
* At index 3 is the color's blue value
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColor($x, $y)
|
||||
{
|
||||
return $this->{'getPixelColor' . $this->lib} ($x, $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Using to retrieve color information about a specified pixel
|
||||
*
|
||||
* @see getPixelColor()
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColorGD($x, $y)
|
||||
{
|
||||
$color = imagecolorat($this->loadedImage, $x, $y);
|
||||
|
||||
return new Color (
|
||||
$color
|
||||
// $rgb['red'],
|
||||
// $rgb['green'],
|
||||
// $rgb['blue']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Using to retrieve color information about a specified pixel
|
||||
*
|
||||
* @see getPixelColor()
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return Color
|
||||
*/
|
||||
protected function getPixelColorImagick($x, $y)
|
||||
{
|
||||
$rgb = $this->loadedImage->getImagePixelColor($x, $y)->getColor();
|
||||
foreach($rgb as $k => $v){
|
||||
if($v<0) $v=0;
|
||||
$rgb[$k]=$v;
|
||||
}
|
||||
|
||||
return new Color([
|
||||
$rgb['r'],
|
||||
$rgb['g'],
|
||||
$rgb['b'],
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getPixelColorGmagick($x, $y)
|
||||
{
|
||||
throw new Exception("Gmagick not supported: ($x, $y)");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of Color objects
|
||||
*
|
||||
* @param int $paletteLength
|
||||
* @return array
|
||||
*/
|
||||
public function getColors($paletteLength = null)
|
||||
{
|
||||
// allow custom length calls
|
||||
if ( ! is_numeric($paletteLength))
|
||||
{
|
||||
$paletteLength = $this->paletteLength;
|
||||
}
|
||||
|
||||
// take the best hits
|
||||
return array_slice($this->palette, 0, $paletteLength, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a json encoded version of the palette
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
// Color PHP 5.3 compatible -> not JsonSerializable :(
|
||||
return json_encode(array_map(
|
||||
function($color) {
|
||||
return (string) $color;
|
||||
},
|
||||
$this->getColors()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient getter access as properties
|
||||
*
|
||||
* @param $name
|
||||
* @throws \Exception
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
$method = 'get' . ucfirst($name);
|
||||
|
||||
if (method_exists($this, $method))
|
||||
{
|
||||
return $this->$method();
|
||||
}
|
||||
|
||||
throw new Exception("Method $method does not exist");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the palette for implementation of the IteratorAggregate interface
|
||||
* Used in foreach loops
|
||||
*
|
||||
* @see getColors()
|
||||
* @return \ArrayIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->getColors());
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,168 +1,182 @@
|
||||
<?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 dzz_io
|
||||
{
|
||||
protected function initIO($path)
|
||||
{
|
||||
$path = self::clean($path);
|
||||
$bzarr = explode(':', $path);
|
||||
$allowbz = C::t('connect')->fetch_all_bz();//array('baiduPCS','ALIOSS','dzz','JSS','disk');
|
||||
if (strpos($path, 'dzz::') !== false) {
|
||||
$classname = 'io_dzz';
|
||||
} elseif (strpos($path, 'attach::') !== false) {
|
||||
$classname = 'io_dzz';
|
||||
} elseif (strpos($path, 'TMP::') !== false) {
|
||||
$classname = 'io_dzz';
|
||||
} elseif (is_numeric($bzarr[0])) {
|
||||
$classname = 'io_dzz';
|
||||
} elseif (in_array($bzarr[0], $allowbz)) {
|
||||
$classname = 'io_' . $bzarr[0];
|
||||
} elseif (preg_match('/^\w{32}$/i', $path)) {
|
||||
$classname = 'io_dzz';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return new $classname($path);
|
||||
}
|
||||
|
||||
function MoveToSpace($path, $attach, $ondup = 'overwrite')
|
||||
{
|
||||
$path = self::clean($path);
|
||||
if ($io = self::initIO($path)) {
|
||||
return $io->MoveToSpace($path, $attach, $ondup);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function authorize($bz, $refer = '')
|
||||
{
|
||||
if ($io = self::initIO($bz)) {
|
||||
$io->authorize($refer);
|
||||
}
|
||||
}
|
||||
|
||||
function getQuota($bz)
|
||||
{
|
||||
if ($io = self::initIO($bz)) {
|
||||
return $io->getQuota($bz);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function chmod($path, $chmod, $son = 0)
|
||||
{
|
||||
if ($io = self::initIO($path)) {
|
||||
return $io->chmod($path, $chmod, $son);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function parsePath($path)
|
||||
{
|
||||
$path = self::clean($path);
|
||||
if ($io = self::initIO($path)) {
|
||||
return $io->parsePath($path);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function output_thumb($file, $mine = 'image/JPEG')
|
||||
{//根据文件地址,输出图像流
|
||||
global $_G;
|
||||
$last_modified_time = filemtime($file);
|
||||
if ($last_modified_time) {
|
||||
$etag = md5_file($file);
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified_time) . " GMT");
|
||||
header("Etag: $etag");
|
||||
if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time ||
|
||||
trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag
|
||||
) {
|
||||
header("HTTP/1.1 304 Not Modified");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
/*if(!$last_modified_time) $last_modified_time = TIMESTAMP;*/
|
||||
@header('cache-control:public');
|
||||
header('Content-Type: ' . $mine);
|
||||
@ob_end_clean();
|
||||
if (getglobal('gzipcompress')) @ob_start('ob_gzhandler');
|
||||
@readfile($file);
|
||||
@flush();
|
||||
@ob_flush();
|
||||
exit();
|
||||
}
|
||||
|
||||
/*将文件缓存到本地,并且返回本地的访问地址*/
|
||||
function cacheFile($data)
|
||||
{
|
||||
global $_G;
|
||||
$subdir = $subdir1 = $subdir2 = '';
|
||||
$subdir1 = date('Ym');
|
||||
$subdir2 = date('d');
|
||||
$subdir = $subdir1 . '/' . $subdir2 . '/';
|
||||
$target1 = 'dzzcache/' . $subdir . 'index.html';
|
||||
$target = 'dzzcache/' . $subdir . random(10);
|
||||
$target_attach = $_G['setting']['attachdir'] . $target1;
|
||||
$targetpath = dirname($target_attach);
|
||||
dmkdir($targetpath);
|
||||
if (file_put_contents($target, $data)) {
|
||||
return $target;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function clean($str) {//清除路径
|
||||
if(is_array($str)){
|
||||
foreach($str as $key=> $value){
|
||||
$str[$key]=self::clean_path(str_replace(array( "\n", "\r", '../'), '', $value));
|
||||
}
|
||||
}else{
|
||||
$str= self::clean_path(str_replace(array( "\n", "\r", '../'), '', $str));
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
private function clean_path($str){
|
||||
if(preg_match("/\.\.\//",$str)){
|
||||
$str=str_replace('../','',$str);
|
||||
return self::clean_path($str);
|
||||
}else{
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getApps($path){
|
||||
$path = self::clean($path);
|
||||
if ($io = self::initIO($path)) {
|
||||
$return = $io->getApps($path);
|
||||
return $return;
|
||||
} else return false;
|
||||
}
|
||||
public function getAllFiles($path,$fid){
|
||||
$path = self::clean($path);
|
||||
if ($io = self::initIO($path)) {
|
||||
$return = $io->getAllFiles($path,$fid);
|
||||
return $return;
|
||||
} else return false;
|
||||
}
|
||||
}
|
||||
<?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 dzz_io
|
||||
{
|
||||
protected function initIO($path)
|
||||
{
|
||||
$path = self::clean($path);
|
||||
$bzarr = explode(':', $path);
|
||||
$allowbz = C::t('connect')->fetch_all_bz();//array('baiduPCS','ALIOSS','dzz','JSS','disk');
|
||||
if (strpos($path, 'dzz::') !== false) {
|
||||
$classname = 'io_dzz';
|
||||
} elseif (strpos($path, 'attach::') !== false) {
|
||||
$classname = 'io_dzz';
|
||||
} elseif (strpos($path, 'TMP::') !== false) {
|
||||
$classname = 'io_dzz';
|
||||
} elseif (is_numeric($bzarr[0])) {
|
||||
$classname = 'io_dzz';
|
||||
} elseif (in_array($bzarr[0], $allowbz)) {
|
||||
$classname = 'io_' . $bzarr[0];
|
||||
} elseif (preg_match('/^\w{32}$/i', $path)) {
|
||||
$classname = 'io_dzz';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return new $classname($path);
|
||||
}
|
||||
|
||||
function MoveToSpace($path, $attach, $ondup = 'overwrite')
|
||||
{
|
||||
$path = self::clean($path);
|
||||
if ($io = self::initIO($path)) {
|
||||
return $io->MoveToSpace($path, $attach, $ondup);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function authorize($bz, $refer = '')
|
||||
{
|
||||
if ($io = self::initIO($bz)) {
|
||||
$io->authorize($refer);
|
||||
}
|
||||
}
|
||||
|
||||
function getQuota($bz)
|
||||
{
|
||||
if ($io = self::initIO($bz)) {
|
||||
return $io->getQuota($bz);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function chmod($path, $chmod, $son = 0)
|
||||
{
|
||||
if ($io = self::initIO($path)) {
|
||||
return $io->chmod($path, $chmod, $son);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function parsePath($path)
|
||||
{
|
||||
$path = self::clean($path);
|
||||
if ($io = self::initIO($path)) {
|
||||
return $io->parsePath($path);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function output_thumb($file, $mine = 'image/JPEG')
|
||||
{//根据文件地址,输出图像流
|
||||
global $_G;
|
||||
$last_modified_time = filemtime($file);
|
||||
if ($last_modified_time) {
|
||||
$etag = md5_file($file);
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified_time) . " GMT");
|
||||
header("Etag: $etag");
|
||||
if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time ||
|
||||
trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag
|
||||
) {
|
||||
header("HTTP/1.1 304 Not Modified");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
/*if(!$last_modified_time) $last_modified_time = TIMESTAMP;*/
|
||||
@header('cache-control:public');
|
||||
header('Content-Type: ' . $mine);
|
||||
@ob_end_clean();
|
||||
if (getglobal('gzipcompress')) @ob_start('ob_gzhandler');
|
||||
@readfile($file);
|
||||
@flush();
|
||||
@ob_flush();
|
||||
exit();
|
||||
}
|
||||
|
||||
/*将文件缓存到本地,并且返回本地的访问地址*/
|
||||
function cacheFile($data)
|
||||
{
|
||||
global $_G;
|
||||
$subdir = $subdir1 = $subdir2 = '';
|
||||
$subdir1 = date('Ym');
|
||||
$subdir2 = date('d');
|
||||
$subdir = $subdir1 . '/' . $subdir2 . '/';
|
||||
$target1 = 'dzzcache/' . $subdir . 'index.html';
|
||||
$target = 'dzzcache/' . $subdir . random(10);
|
||||
$target_attach = $_G['setting']['attachdir'] . $target1;
|
||||
$targetpath = dirname($target_attach);
|
||||
dmkdir($targetpath);
|
||||
if (file_put_contents($target, $data)) {
|
||||
return $target;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function clean($str) {//清除路径
|
||||
if(is_array($str)){
|
||||
foreach($str as $key=> $value){
|
||||
$str[$key]=self::clean_path(str_replace(array( "\n", "\r", '../'), '', $value));
|
||||
}
|
||||
}else{
|
||||
$str= self::clean_path(str_replace(array( "\n", "\r", '../'), '', $str));
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
private function clean_path($str){
|
||||
if(preg_match("/\.\.\//",$str)){
|
||||
$str=str_replace('../','',$str);
|
||||
return self::clean_path($str);
|
||||
}else{
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getApps($path){
|
||||
$path = self::clean($path);
|
||||
if ($io = self::initIO($path)) {
|
||||
$return = $io->getApps($path);
|
||||
return $return;
|
||||
} else return false;
|
||||
}
|
||||
public function getAllFiles($path,$fid,$page=1,$limit=100){
|
||||
$path = self::clean($path);
|
||||
if ($io = self::initIO($path)) {
|
||||
$return = $io->getAllFiles($path,$fid,$page,$limit);
|
||||
return $return;
|
||||
} 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
77
core/class/table/table_connect.php
Normal file
77
core/class/table/table_connect.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
82
core/class/table/table_connect_disk.php
Normal file
82
core/class/table/table_connect_disk.php
Normal 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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
82
core/class/table/table_connect_ftp.php
Normal file
82
core/class/table/table_connect_ftp.php
Normal 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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
83
core/class/table/table_connect_onedrive.php
Normal file
83
core/class/table/table_connect_onedrive.php
Normal 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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
83
core/class/table/table_connect_pan.php
Normal file
83
core/class/table/table_connect_pan.php
Normal 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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
84
core/class/table/table_connect_storage.php
Normal file
84
core/class/table/table_connect_storage.php
Normal 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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
102
core/class/table/table_local_router.php
Normal file
102
core/class/table/table_local_router.php
Normal 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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
119
core/class/table/table_local_storage.php
Normal file
119
core/class/table/table_local_storage.php
Normal 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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
432
core/class/table/table_pichome_collectlist.php
Normal file
432
core/class/table/table_pichome_collectlist.php
Normal 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;
|
||||
}
|
||||
}
|
||||
30
core/class/table/table_pichome_ffmpeg_record.php
Normal file
30
core/class/table/table_pichome_ffmpeg_record.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,107 +1,184 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_folder extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_folder';
|
||||
$this->_pk = 'fid';
|
||||
$this->_pre_cache_key = 'pichome_folder';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
//根据appid删除目录
|
||||
public function delete_by_appid($appid){
|
||||
$fids = [];
|
||||
foreach(DB::fetch_all("select fid from %t where appid = %s",array($this->_table,$appid)) as $v){
|
||||
$fids[] = $v['fid'];
|
||||
}
|
||||
return parent::delete($fids);
|
||||
}
|
||||
//插入和更新目录数据
|
||||
public function insert_folderdata_by_appid($appid,$folderdata,$folderarr = array(),$pfid='',$pathkey=''){
|
||||
foreach ($folderdata as $v) {
|
||||
$fid = $v['id'].$appid;
|
||||
$setarr=['fname'=>$v['name'],'dateline'=>TIMESTAMP,'pfid'=>$pfid,'appid'=>$appid,'pathkey'=>$pathkey.$fid];
|
||||
if($v['coverId']) $setarr['cover'] = $v['coverId'].$appid;
|
||||
if($v['password']) $setarr['password'] = $v['password'];
|
||||
if($v['passwordTips']) $setarr['passwordtips'] = trim($v['passwordTips']);
|
||||
//如果已经有该id时更新
|
||||
if($fname = DB::result_first("select fname from %t where fid = %s",array($this->_table,$fid))){
|
||||
parent::update($fid,$setarr);
|
||||
$setarr['fid'] = $fid;
|
||||
|
||||
}else{
|
||||
//如果插入数据失败跳过当前层级目录
|
||||
$setarr['fid'] = $fid;
|
||||
if(!parent::insert($setarr))continue;
|
||||
}
|
||||
$folderarr[] = $setarr;
|
||||
if ($v['children']) {
|
||||
$tmpchild = $v['children'];
|
||||
foreach($tmpchild as $child){
|
||||
$cfid = $child['id'].$appid;
|
||||
$setarr=['fname'=>$child['name'],'dateline'=>TIMESTAMP,'pfid'=>$fid,'appid'=>$appid,'pathkey'=>$pathkey.$fid.$cfid];
|
||||
if($child['coverId']) $setarr['cover'] = $child['coverId'].$appid;
|
||||
if($child['password']) $setarr['password'] = $child['password'];
|
||||
if($v['passwordTips']) $setarr['passwordtips'] = trim($child['passwordTips']);
|
||||
}
|
||||
$folderarr = $this->insert_folderdata_by_appid($appid,$tmpchild,$folderarr,$fid,$pathkey.$fid.$cfid);
|
||||
|
||||
}
|
||||
}
|
||||
return $folderarr;
|
||||
}
|
||||
//检查目录是否包含密码,多个目录时,只有都包含密码才视为包含密码
|
||||
public function check_haspasswrod($folderids,$appid){
|
||||
$haspassword = 0;
|
||||
//组合目录id
|
||||
$fids = [];
|
||||
foreach($folderids as $v){
|
||||
$fids[] = $v.$appid;
|
||||
}
|
||||
$haspasswordfids = [];
|
||||
foreach($fids as $val){
|
||||
//查找当前目录及其上级中任意一层包含密码,则视为该目录包含密码
|
||||
if(DB::result_first("select fid from %t where pathkey regexp %s and password != '' ",array($this->_table,'.*'.$val.'$'))){
|
||||
$haspasswordfids[$val] = 1;
|
||||
}else{
|
||||
$haspasswordfids[$val] = 0;
|
||||
}
|
||||
}
|
||||
foreach($haspasswordfids as $v){
|
||||
if(!$v) {
|
||||
$haspassword = 0;
|
||||
break;
|
||||
}else{
|
||||
$haspassword = 1;
|
||||
}
|
||||
}
|
||||
return $haspassword;
|
||||
}
|
||||
|
||||
//根据fid判断当前目录及其上机是否有密码,如果当前目录不存在则返回2,存在密码返回1
|
||||
public function check_password_byfid($fid){
|
||||
if($data = parent::fetch($fid)){
|
||||
return DB::result_first("select fid from %t where pathkey regexp %s and password != '' ",array($this->_table,'.*'.$fid.'$')) ? 1:0;
|
||||
}else{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
//转义查询语句当中的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;
|
||||
}
|
||||
}
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_folder extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_folder';
|
||||
$this->_pk = 'fid';
|
||||
$this->_pre_cache_key = 'pichome_folder';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
//根据appid删除目录
|
||||
public function delete_by_appid($appid){
|
||||
$fids = [];
|
||||
foreach(DB::fetch_all("select fid from %t where appid = %s",array($this->_table,$appid)) as $v){
|
||||
$fids[] = $v['fid'];
|
||||
}
|
||||
$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;
|
||||
$setarr=['fname'=>$v['name'],'dateline'=>TIMESTAMP,'pfid'=>$pfid,'appid'=>$appid,'pathkey'=>($pathkey)?$pathkey:$fid];
|
||||
if($v['coverId']) $setarr['cover'] = $v['coverId'].$appid;
|
||||
if($v['password']) $setarr['password'] = $v['password'];
|
||||
if($v['passwordTips']) $setarr['passwordtips'] = trim($v['passwordTips']);
|
||||
//如果已经有该id时更新
|
||||
if($fname = DB::result_first("select fname from %t where fid = %s",array($this->_table,$fid))){
|
||||
parent::update($fid,$setarr);
|
||||
$setarr['fid'] = $fid;
|
||||
|
||||
}else{
|
||||
//如果插入数据失败跳过当前层级目录
|
||||
$setarr['fid'] = $fid;
|
||||
if(!$setarr['fname']) continue;
|
||||
if(!parent::insert($setarr))continue;
|
||||
}
|
||||
$folderarr[] = $setarr;
|
||||
if ($v['children']) {
|
||||
$tmpchild = $v['children'];
|
||||
foreach($tmpchild as $child){
|
||||
$cfid = $child['id'].$appid;
|
||||
$folderarr = $this->insert_folderdata_by_appid($appid,[$child],$folderarr,$fid,($pathkey) ? $pathkey.$cfid:$fid.$cfid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return $folderarr;
|
||||
}
|
||||
|
||||
public function insert_data($setarr){
|
||||
$fid = $setarr['fid'];
|
||||
if($fname = DB::result_first("select count(*) from %t where fid = %s",array($this->_table,$setarr['fid']))){
|
||||
unset($setarr['fid']);
|
||||
parent::update($fid,$setarr);
|
||||
}else{
|
||||
parent::insert($setarr);
|
||||
}
|
||||
return $fid;
|
||||
}
|
||||
//检查目录是否包含密码,多个目录时,只有都包含密码才视为包含密码
|
||||
public function check_haspasswrod($folderids,$appid){
|
||||
$haspassword = 0;
|
||||
//组合目录id
|
||||
$fids = [];
|
||||
foreach($folderids as $v){
|
||||
$fids[] = $v.$appid;
|
||||
}
|
||||
$haspasswordfids = [];
|
||||
foreach($fids as $val){
|
||||
//查找当前目录及其上级中任意一层包含密码,则视为该目录包含密码
|
||||
if(DB::result_first("select fid from %t where pathkey regexp %s and password != '' ",array($this->_table,'.*'.$val.'$'))){
|
||||
$haspasswordfids[$val] = 1;
|
||||
}else{
|
||||
$haspasswordfids[$val] = 0;
|
||||
}
|
||||
}
|
||||
foreach($haspasswordfids as $v){
|
||||
if(!$v) {
|
||||
$haspassword = 0;
|
||||
break;
|
||||
}else{
|
||||
$haspassword = 1;
|
||||
}
|
||||
}
|
||||
unset($haspasswordfids);
|
||||
unset($folderids);
|
||||
return $haspassword;
|
||||
}
|
||||
|
||||
//根据fid判断当前目录及其上机是否有密码,如果当前目录不存在则返回2,存在密码返回1
|
||||
public function check_password_byfid($fid){
|
||||
if($data = parent::fetch($fid)){
|
||||
return DB::result_first("select fid from %t where pathkey regexp %s and password != '' ",array($this->_table,'.*'.$fid.'$')) ? 1:0;
|
||||
}else{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
//转义查询语句当中的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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
24
core/class/table/table_pichome_folder_relation.php
Normal file
24
core/class/table/table_pichome_folder_relation.php
Normal 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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,72 +1,77 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_folderresources extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_folderresources';
|
||||
$this->_pk = 'id';
|
||||
$this->_pre_cache_key = 'pichome_folderresources';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
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']))){
|
||||
return $id;
|
||||
}else{
|
||||
return parent::insert($setarr);
|
||||
}
|
||||
}
|
||||
public function delete_by_appid($appid){
|
||||
$rids=[];
|
||||
foreach(DB::fetch_all("select rid from %t where appid = %s",array($this->_table,$appid)) as $v){
|
||||
$rids[] = $v['rid'];
|
||||
}
|
||||
return parent::delete($rids);
|
||||
}
|
||||
public function delete_by_rid($rid){
|
||||
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){
|
||||
$dids[] = $v['id'];
|
||||
}
|
||||
return parent::delete($dids);
|
||||
}
|
||||
|
||||
public function fetch_id_by_rid($rid){
|
||||
$ids = [];
|
||||
foreach(DB::fetch_all("select id from %t where rid = %s",array($this->_table,$rid)) as $v){
|
||||
$ids[] = $v['id'];
|
||||
}
|
||||
return $ids;
|
||||
}
|
||||
public function get_sum_by_fid($fid){
|
||||
return DB::result_first("select count(rid) from %t where fid=%s",array($this->_table,$fid));
|
||||
}
|
||||
public function get_sum_by_fids($fids){
|
||||
if(!is_array($fids)) $fids = (array) $fids;
|
||||
$datas = [];
|
||||
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){
|
||||
$datas[$val['fid']]= $val['num'];
|
||||
}
|
||||
return $datas;
|
||||
}
|
||||
public function get_foldername_by_rid($rid){
|
||||
$foldernames = [];
|
||||
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 $foldernames;
|
||||
}
|
||||
public function fetch_rid_by_fids($fids,$limit = 6,$rid=''){
|
||||
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;
|
||||
}
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_folderresources extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_folderresources';
|
||||
$this->_pk = 'id';
|
||||
$this->_pre_cache_key = 'pichome_folderresources';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
public function 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']))){
|
||||
return $id;
|
||||
}else{
|
||||
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']);
|
||||
return parent::update($rid,$setarr);
|
||||
}
|
||||
return parent::insert($setarr);
|
||||
}
|
||||
}
|
||||
public function delete_by_appid($appid){
|
||||
$rids=[];
|
||||
foreach(DB::fetch_all("select rid from %t where appid = %s",array($this->_table,$appid)) as $v){
|
||||
$rids[] = $v['rid'];
|
||||
}
|
||||
return parent::delete($rids);
|
||||
}
|
||||
public function delete_by_rid($rid){
|
||||
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){
|
||||
$dids[] = $v['id'];
|
||||
}
|
||||
return parent::delete($dids);
|
||||
}
|
||||
|
||||
public function fetch_id_by_rid($rid){
|
||||
$ids = [];
|
||||
foreach(DB::fetch_all("select id from %t where rid = %s",array($this->_table,$rid)) as $v){
|
||||
$ids[] = $v['id'];
|
||||
}
|
||||
return $ids;
|
||||
}
|
||||
public function get_sum_by_fid($fid){
|
||||
return DB::result_first("select count(rid) from %t where fid=%s",array($this->_table,$fid));
|
||||
}
|
||||
public function get_sum_by_fids($fids){
|
||||
if(!is_array($fids)) $fids = (array) $fids;
|
||||
$datas = [];
|
||||
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){
|
||||
$datas[$val['fid']]= $val['num'];
|
||||
}
|
||||
return $datas;
|
||||
}
|
||||
public function get_foldername_by_rid($rid){
|
||||
$foldernames = [];
|
||||
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 $foldernames;
|
||||
}
|
||||
public function fetch_rid_by_fids($fids,$limit = 6,$rid=''){
|
||||
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;
|
||||
}
|
||||
}
|
||||
30
core/class/table/table_pichome_imagickrecord.php
Normal file
30
core/class/table/table_pichome_imagickrecord.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,109 +1,160 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_palette extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_palette';
|
||||
$this->_pk = 'id';
|
||||
$this->_pre_cache_key = 'pichome_palette';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
//根据appid删除目录
|
||||
public function delete_by_appid($appid){
|
||||
$ids = [];
|
||||
foreach(DB::fetch_all("select id from %t where appid = %s",array($this->_table,$appid)) as $v){
|
||||
$ids[] = $v['id'];
|
||||
}
|
||||
return parent::delete($ids);
|
||||
}
|
||||
|
||||
public function delete_by_rid($rid){
|
||||
if(!is_array($rid)) $rid = (array) $rid;
|
||||
$delids = [];
|
||||
foreach (DB::fetch_all("select id from %t where rid in(%n)",array($this->_table,$rid)) as $v){
|
||||
$delids[] = $v['id'];
|
||||
}
|
||||
return parent::delete($delids);
|
||||
}
|
||||
|
||||
public function fetch_rid_by_color($color,$persion=0,$appid='',$limit=6,$rid=''){
|
||||
//设定基础相似度为80%,当精度调整时,相似度根据精度数值相应增加,调整范围为0-100,实际计算用20的差异量进行转换
|
||||
$similarity = 90+(10/100)*$persion;
|
||||
//此值为rgb(0,0,0)与rgb(255,255,255)最大色差值,用以计算相似度的被除数
|
||||
$maxColDist = 764.8339663572415;
|
||||
//获取颜色的rgb,该操作为十六进制转换为rgb
|
||||
$rgbcolor = $this->hex2rgb($color);
|
||||
//色差计算公式为sqrt((2 + $rmean / 256) * (pow($r, 2)) + 4 * (pow($g, 2)) + (2 + (255 - $rmean) / 256) * (pow($b, 2)))
|
||||
//公式中rgb值为连个rgb的差值,$rmean为r值之和的二分之一
|
||||
if($appid){
|
||||
$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
|
||||
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 ';
|
||||
$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);
|
||||
}else{
|
||||
$sql = 'select distinct rid from %t ';
|
||||
$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 ";
|
||||
$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);
|
||||
}
|
||||
$riddata = DB::fetch_all("$sql where $wheresql $ordersql desc limit 0,$limit ",$params);
|
||||
$rids= [];
|
||||
foreach ($riddata as $v){
|
||||
$rids[] = $v['rid'];
|
||||
}
|
||||
return $rids;
|
||||
}
|
||||
//转换十六进制颜色为rgb
|
||||
public function hex2rgb($hexColor){
|
||||
$color=str_replace('#','',$hexColor);
|
||||
if (strlen($color)> 3){
|
||||
$rgb=array(
|
||||
'r'=>hexdec(substr($color,0,2)),
|
||||
'g'=>hexdec(substr($color,2,2)),
|
||||
'b'=>hexdec(substr($color,4,2))
|
||||
);
|
||||
}else{
|
||||
$r=substr($color,0,1). substr($color,0,1);
|
||||
$g=substr($color,1,1). substr($color,1,1);
|
||||
$b=substr($color,2,1). substr($color,2,1);
|
||||
$rgb=array(
|
||||
'r'=>hexdec($r),
|
||||
'g'=>hexdec($g),
|
||||
'b'=>hexdec($b)
|
||||
);
|
||||
}
|
||||
return $rgb;
|
||||
}
|
||||
|
||||
public function fetch_colordata_by_rid($rid){
|
||||
$data = [];
|
||||
foreach(DB::fetch_all("select color,weight from %t where rid = %s",array($this->_table,$rid)) as $v){
|
||||
$weight = $v['weight']*100;
|
||||
$data[$weight] = dechex($v['color']);
|
||||
}
|
||||
krsort($data);
|
||||
return $data;
|
||||
}
|
||||
/*
|
||||
*$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;
|
||||
}
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_palette extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_palette';
|
||||
$this->_pk = 'id';
|
||||
$this->_pre_cache_key = 'pichome_palette';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
//根据appid删除目录
|
||||
public function delete_by_appid($appid){
|
||||
$ids = [];
|
||||
foreach(DB::fetch_all("select id from %t where appid = %s",array($this->_table,$appid)) as $v){
|
||||
$ids[] = $v['id'];
|
||||
}
|
||||
return parent::delete($ids);
|
||||
}
|
||||
|
||||
public function delete_by_rid($rid){
|
||||
if(!is_array($rid)) $rid = (array) $rid;
|
||||
$delids = [];
|
||||
foreach (DB::fetch_all("select id from %t where rid in(%n)",array($this->_table,$rid)) as $v){
|
||||
$delids[] = $v['id'];
|
||||
}
|
||||
return parent::delete($delids);
|
||||
}
|
||||
|
||||
public function fetch_rid_by_color($color,$persion=0,$appid='',$limit=6,$rid=''){
|
||||
//设定基础相似度为80%,当精度调整时,相似度根据精度数值相应增加,调整范围为0-100,实际计算用20的差异量进行转换
|
||||
$similarity = 90+(10/100)*$persion;
|
||||
//此值为rgb(0,0,0)与rgb(255,255,255)最大色差值,用以计算相似度的被除数
|
||||
$maxColDist = 764.8339663572415;
|
||||
//获取颜色的rgb,该操作为十六进制转换为rgb
|
||||
$rgbcolor = $this->hex2rgb($color);
|
||||
//色差计算公式为sqrt((2 + $rmean / 256) * (pow($r, 2)) + 4 * (pow($g, 2)) + (2 + (255 - $rmean) / 256) * (pow($b, 2)))
|
||||
//公式中rgb值为连个rgb的差值,$rmean为r值之和的二分之一
|
||||
if($appid){
|
||||
$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
|
||||
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 ';
|
||||
$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);
|
||||
}else{
|
||||
$sql = 'select distinct rid from %t ';
|
||||
$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 ";
|
||||
$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);
|
||||
}
|
||||
$riddata = DB::fetch_all("$sql where $wheresql $ordersql desc limit 0,$limit ",$params);
|
||||
$rids= [];
|
||||
foreach ($riddata as $v){
|
||||
$rids[] = $v['rid'];
|
||||
}
|
||||
return $rids;
|
||||
}
|
||||
//转换十六进制颜色为rgb
|
||||
public function hex2rgb($hexColor){
|
||||
$color=str_replace('#','',$hexColor);
|
||||
if (strlen($color)> 3){
|
||||
$rgb=array(
|
||||
'r'=>hexdec(substr($color,0,2)),
|
||||
'g'=>hexdec(substr($color,2,2)),
|
||||
'b'=>hexdec(substr($color,4,2))
|
||||
);
|
||||
}else{
|
||||
$r=substr($color,0,1). substr($color,0,1);
|
||||
$g=substr($color,1,1). substr($color,1,1);
|
||||
$b=substr($color,2,1). substr($color,2,1);
|
||||
$rgb=array(
|
||||
'r'=>hexdec($r),
|
||||
'g'=>hexdec($g),
|
||||
'b'=>hexdec($b)
|
||||
);
|
||||
}
|
||||
return $rgb;
|
||||
}
|
||||
function RGBToHex($rgb){
|
||||
$regexp = "/^rgb\(([0-9]{0,3})\,\s*([0-9]{0,3})\,\s*([0-9]{0,3})\)/";
|
||||
$re = preg_match($regexp, $rgb, $match);
|
||||
|
||||
$re = array_shift($match);
|
||||
|
||||
$hexColor = "";
|
||||
|
||||
$hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
|
||||
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
$r = null;
|
||||
|
||||
$c = $match[$i];
|
||||
|
||||
$hexAr = array();
|
||||
|
||||
while ($c > 16) {
|
||||
$r = $c % 16;
|
||||
|
||||
$c = ($c / 16) >> 0;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,235 +1,296 @@
|
||||
<?php
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class table_pichome_resources extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_resources';
|
||||
$this->_pk = 'rid';
|
||||
$this->_pre_cache_key = 'pichome_resources';
|
||||
$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 delete_by_appid($appid)
|
||||
{
|
||||
$rids = [];
|
||||
foreach (DB::fetch_all("select rid from %t where appid = %s", array($this->_table, $appid)) as $v) {
|
||||
$rids[] = $v['rid'];
|
||||
}
|
||||
return $this->delete_by_rid($rids);
|
||||
}
|
||||
|
||||
public function fetch_by_path($path)
|
||||
{
|
||||
$path = trim($path);
|
||||
return DB::result_first("select * from %t where path = %s", array($this->_table, $path));
|
||||
}
|
||||
|
||||
public function delete_by_rid($rids)
|
||||
{
|
||||
if (!is_array($rids)) $rids = (array)$rids;
|
||||
C::t('pichome_resources_attr')->delete_by_rid($rids);
|
||||
C::t('pichome_folderresources')->delete_by_rid($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);
|
||||
C::t('pichome_share')->delete_by_rid($rids);
|
||||
return parent::delete($rids);
|
||||
}
|
||||
|
||||
//以rid获取文件缩略图
|
||||
public function get_icon_by_rids($rids)
|
||||
{
|
||||
if (!is_array($rids)) $rids = (array)$rids;
|
||||
$icondatas = [];
|
||||
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']) {
|
||||
$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);
|
||||
$icondatas[$v['rid']] = $thumbpath;
|
||||
} else {
|
||||
if ($v['type'] == 'commonimage') {
|
||||
$v['icondata'] = $v['path'];
|
||||
} else {
|
||||
$v['icondata'] = geticonfromext($v['ext'], $v['type']);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $icondatas;
|
||||
}
|
||||
|
||||
public function fetch_by_rids($rids)
|
||||
{
|
||||
global $Opentype;
|
||||
if (!is_array($rids)) $rids = (array)$rids;
|
||||
|
||||
$datas = $tmpdatas = [];
|
||||
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');
|
||||
$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);
|
||||
if (in_array($v['ext'], $Opentype['video'])) {
|
||||
$v['opentype'] = 'video';
|
||||
} elseif (in_array($v['ext'], $Opentype['text'])) {
|
||||
$v['opentype'] = 'text';
|
||||
} elseif (in_array($v['ext'], $Opentype['pdf'])) {
|
||||
$v['opentype'] = 'pdf';
|
||||
} elseif (in_array($v['ext'], $Opentype['image'])) {
|
||||
$v['opentype'] = 'image';
|
||||
} else {
|
||||
$v['opentype'] = 'other';
|
||||
}
|
||||
$tmpdatas[$v['rid']] = $v;
|
||||
}
|
||||
foreach($rids as $rid){
|
||||
$datas[$rid] = $tmpdatas[$rid];
|
||||
}
|
||||
foreach (C::t('pichome_resources_attr')->fetch_all($rids) as $v) {
|
||||
if ($datas[$v['rid']]['hasthumb']) {
|
||||
|
||||
$filepath = dirname($v['path']);
|
||||
$filename = substr($v['path'],strrpos($v['path'],'/')+1);
|
||||
$filename = str_replace(strrchr($filename, "."),"",$filename);
|
||||
$thumbpath = 'library/' . $filepath . '/' . $filename . '_thumbnail.png';
|
||||
$datas[$v['rid']]['icondata'] = str_replace('+',' ',urlencode($thumbpath));
|
||||
}
|
||||
else {
|
||||
if ($datas[$v['rid']]['type'] == 'commonimage') {
|
||||
$datas[$v['rid']]['icondata'] = str_replace('+',' ',urlencode('library/' . $v['path']));
|
||||
} else {
|
||||
$datas[$v['rid']]['icondata'] = geticonfromext($datas[$v['rid']]['ext'], $datas[$v['rid']]['type']);
|
||||
}
|
||||
}
|
||||
$datas[$v['rid']]['realpath'] = str_replace('+',' ',urlencode('library/' . $v['path']));
|
||||
$colorsarr = [];
|
||||
//获取颜色数据
|
||||
$colordata = C::t('pichome_palette')->fetch_colordata_by_rid($v['rid']);
|
||||
foreach ($colordata as $cv) {
|
||||
$colorsarr[] = $cv;
|
||||
}
|
||||
$datas[$v['rid']]['color'] = $colorsarr[0];
|
||||
$datas[$v['rid']]['link'] = $v['link'];
|
||||
}
|
||||
//array_multisort($datas, 'rid', SORT_ASC, $rids);
|
||||
foreach (C::t('pichome_resourcestag')->fetch_all_tag_by_rids($rids) as $k => $v) {
|
||||
$datas[$k]['tags'] = $v;
|
||||
// $datas[$k]['tags'] = '•'.implode('•',$v);
|
||||
}
|
||||
|
||||
return $datas;
|
||||
}
|
||||
|
||||
|
||||
public function fetch_by_rid($rid)
|
||||
{
|
||||
global $Opentype;
|
||||
if (!$resourcesdata = parent::fetch($rid)) return array();
|
||||
if ($resourcesdata['isdelete'] > 0) return array();
|
||||
$attrdata = C::t('pichome_resources_attr')->fetch($rid);
|
||||
$resourcesdata = array_merge($resourcesdata, $attrdata);
|
||||
$resourcesdata['colors'] = C::t('pichome_palette')->fetch_colordata_by_rid($rid);
|
||||
if (in_array($resourcesdata['ext'], $Opentype['video'])) {
|
||||
$resourcesdata['opentype'] = 'video';
|
||||
} elseif (in_array($resourcesdata['ext'], $Opentype['text'])) {
|
||||
$resourcesdata['opentype'] = 'text';
|
||||
} elseif (in_array($resourcesdata['ext'], $Opentype['pdf'])) {
|
||||
$resourcesdata['opentype'] = 'pdf';
|
||||
} elseif (in_array($resourcesdata['ext'], $Opentype['image'])) {
|
||||
$resourcesdata['opentype'] = 'image';
|
||||
} else {
|
||||
$resourcesdata['opentype'] = 'other';
|
||||
}
|
||||
if ($resourcesdata['hasthumb']) {
|
||||
$filepath = dirname($resourcesdata['path']);
|
||||
$filename = substr($resourcesdata['path'],strrpos($resourcesdata['path'],'/')+1);
|
||||
$filename = str_replace(strrchr($filename, "."),"",$filename);
|
||||
$thumbpath = 'library/' . $filepath . '/' . $filename . '_thumbnail.png';
|
||||
$resourcesdata['icondata'] = $thumbpath;
|
||||
//}
|
||||
} else {
|
||||
if ($resourcesdata['type'] == 'commonimage') {
|
||||
$resourcesdata['icondata'] = 'library/' . $resourcesdata['path'];
|
||||
|
||||
} else {
|
||||
$resourcesdata['icondata'] = geticonfromext($resourcesdata['ext'], $resourcesdata['type']);
|
||||
}
|
||||
}
|
||||
$imginfo = @getimagesize($resourcesdata['icondata']);
|
||||
$resourcesdata['iconwidth'] = $imginfo[0];
|
||||
$resourcesdata['iconheight'] = $imginfo[1];
|
||||
$resourcesdata['icondata'] = str_replace('+',' ',urlencode($resourcesdata['icondata']));
|
||||
|
||||
//获取所有库分享和下载权限
|
||||
$downshare = C::t('pichome_vapp')->fetch_all_sharedownlod();
|
||||
$resourcesdata['share'] = $downshare[$resourcesdata['appid']]['share'];
|
||||
$resourcesdata['download'] = $downshare[$resourcesdata['appid']]['download'];
|
||||
$resourcesdata['originalimg'] = str_replace('+',' ',urlencode('library/' . $resourcesdata['path']));
|
||||
$resourcesdata['realpath'] = str_replace('+',' ',urlencode('library/' . $resourcesdata['path']));
|
||||
$resourcesdata['name'] = str_replace(strrchr($resourcesdata['name'], "."), "", $resourcesdata['name']);
|
||||
$resourcesdata['fsize'] = formatsize($resourcesdata['size']);
|
||||
$resourcesdata['mtime'] = dgmdate(round($resourcesdata['mtime'] / 1000), 'Y/m/d H:i');
|
||||
$resourcesdata['dateline'] = dgmdate(round($resourcesdata['dateline'] / 1000), 'Y/m/d H:i');
|
||||
$resourcesdata['btime'] = dgmdate(round($resourcesdata['btime'] / 1000), 'Y/m/d H:i');
|
||||
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);
|
||||
$resourcesdata['dpath'] = dzzencode($rid, '', 0);
|
||||
|
||||
|
||||
return $resourcesdata;
|
||||
}
|
||||
|
||||
public function getdatasbyrids($rids)
|
||||
{
|
||||
$returndata = [];
|
||||
//文件数据
|
||||
$resourcesdata = $this->fetch_by_rids($rids);
|
||||
//获取所有库分享和下载权限
|
||||
$downshare = C::t('pichome_vapp')->fetch_all_sharedownlod();
|
||||
//文件附属表数据
|
||||
// $attrdata = C::t('pichome_resources_attr')->fetch_by_rids($rids);
|
||||
//文件标注数
|
||||
$annonationnumdata = C::t('pichome_comments')->fetch_annonationnum_by_rids($rids);
|
||||
foreach ($resourcesdata as $v) {
|
||||
$v['annonationnum'] = $annonationnumdata[$v['rid']]['num'];
|
||||
$v['share'] = $downshare[$v['appid']]['share'];
|
||||
$v['download'] = $downshare[$v['appid']]['download'];
|
||||
$returndata[] = $v;
|
||||
}
|
||||
return $returndata;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class table_pichome_resources extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_resources';
|
||||
$this->_pk = 'rid';
|
||||
$this->_pre_cache_key = 'pichome_resources';
|
||||
$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']);
|
||||
parent::update($rid, $setarr);
|
||||
} else {
|
||||
parent::insert($setarr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete_by_appid($appid)
|
||||
{
|
||||
$data = C::t('pichome_vapp')->fetch($appid);
|
||||
//$i = 0;
|
||||
$rids = [];
|
||||
foreach (DB::fetch_all("select rid from %t where appid = %s limit 0,100", array($this->_table, $appid)) as $v) {
|
||||
$rids[] = $v['rid'];
|
||||
}
|
||||
if ($rids) $this->delete_by_rid($rids, $data['deluid'], $data['delusername']);
|
||||
//return $i;
|
||||
}
|
||||
|
||||
public function fetch_by_path($path)
|
||||
{
|
||||
$path = trim($path);
|
||||
return DB::result_first("select * from %t where path = %s", array($this->_table, $path));
|
||||
}
|
||||
|
||||
public function delete_by_rid($rids, $uid = 0, $username = '')
|
||||
{
|
||||
if (!is_array($rids)) $rids = (array)$rids;
|
||||
C::t('pichome_resources_attr')->delete_by_rid($rids);
|
||||
C::t('pichome_folderresources')->delete_by_rid($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);
|
||||
C::t('pichome_share')->delete_by_rid($rids);
|
||||
C::t('pichome_ffmpeg_record')->delete($rids);
|
||||
C::t('pichome_imagickrecord')->delete($rids);
|
||||
$deldata = ['rids' => $rids, 'deluid' => $uid, 'delusername' => $username];
|
||||
Hook::listen('pichomedatadeleteafter', $deldata);
|
||||
|
||||
return $this->delete($rids);
|
||||
}
|
||||
|
||||
|
||||
public function fetch_by_rids($rids)
|
||||
{
|
||||
global $Opentype;
|
||||
if (!is_array($rids)) $rids = (array)$rids;
|
||||
|
||||
$datas = $tmpdatas = [];
|
||||
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');
|
||||
$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);
|
||||
if (in_array($v['ext'], $Opentype['video'])) {
|
||||
$v['opentype'] = 'video';
|
||||
} elseif (in_array($v['ext'], $Opentype['text'])) {
|
||||
$v['opentype'] = 'text';
|
||||
} elseif (in_array($v['ext'], $Opentype['pdf'])) {
|
||||
$v['opentype'] = 'pdf';
|
||||
} elseif (in_array($v['ext'], $Opentype['image'])) {
|
||||
$v['opentype'] = 'image';
|
||||
} else {
|
||||
$v['opentype'] = 'other';
|
||||
}
|
||||
$tmpdatas[$v['rid']] = $v;
|
||||
}
|
||||
foreach ($rids as $rid) {
|
||||
$datas[$rid] = $tmpdatas[$rid];
|
||||
}
|
||||
foreach (C::t('pichome_resources_attr')->fetch_all($rids) as $v) {
|
||||
$datas[$v['rid']]['path'] = $v['path'];
|
||||
//$datas[$v['rid']]['hasthumb'] = $v['hasthumb'];
|
||||
$colorsarr = [];
|
||||
//获取颜色数据
|
||||
$colordata = C::t('pichome_palette')->fetch_colordata_by_rid($v['rid']);
|
||||
foreach ($colordata as $cv) {
|
||||
$colorsarr[] = $cv;
|
||||
}
|
||||
$datas[$v['rid']]['color'] = $colorsarr[0];
|
||||
$datas[$v['rid']]['link'] = $v['link'];
|
||||
}
|
||||
//array_multisort($datas, 'rid', SORT_ASC, $rids);
|
||||
foreach (C::t('pichome_resourcestag')->fetch_all_tag_by_rids($rids) as $k => $v) {
|
||||
$datas[$k]['tags'] = $v;
|
||||
// $datas[$k]['tags'] = '•'.implode('•',$v);
|
||||
}
|
||||
|
||||
return $datas;
|
||||
}
|
||||
|
||||
//获取数据后端使用
|
||||
public function fetch_data_by_rid($rid)
|
||||
{
|
||||
|
||||
if (!$resourcesdata = parent::fetch($rid)) return array();
|
||||
if ($resourcesdata['isdelete'] > 0) return array();
|
||||
$downshare = C::t('pichome_vapp')->fetch_all_sharedownlod();
|
||||
if ($downshare[$resourcesdata['appid']]['isdelete']) return array();
|
||||
$attrdata = C::t('pichome_resources_attr')->fetch($rid);
|
||||
$resourcesdata = array_merge($resourcesdata, $attrdata);
|
||||
$resourcesdata['realpath'] = $downshare[$resourcesdata['appid']]['path'] . BS . $resourcesdata['path'];
|
||||
return $resourcesdata;
|
||||
}
|
||||
|
||||
public function fetch_by_rid($rid)
|
||||
{
|
||||
global $Opentype;
|
||||
if (!$resourcesdata = parent::fetch($rid)) return array();
|
||||
if ($resourcesdata['isdelete'] > 0) return array();
|
||||
//获取所有库分享和下载权限
|
||||
$downshare = C::t('pichome_vapp')->fetch_all_sharedownlod();
|
||||
$attrdata = C::t('pichome_resources_attr')->fetch($rid);
|
||||
if ($attrdata['desc']) $attrdata['desc'] = strip_tags($attrdata['desc']);
|
||||
$resourcesdata = array_merge($resourcesdata, $attrdata);
|
||||
$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';
|
||||
} elseif (in_array($resourcesdata['ext'], $Opentype['text'])) {
|
||||
$resourcesdata['opentype'] = 'text';
|
||||
} elseif (in_array($resourcesdata['ext'], $Opentype['pdf'])) {
|
||||
$resourcesdata['opentype'] = 'pdf';
|
||||
} elseif (in_array($resourcesdata['ext'], $Opentype['image'])) {
|
||||
$resourcesdata['opentype'] = 'image';
|
||||
} else {
|
||||
$resourcesdata['opentype'] = 'other';
|
||||
}
|
||||
$resourcesdata['icondata'] = getglobal('siteurl') . 'index.php?mod=io&op=getImg&path=' . dzzencode($rid, '', 0, 0);
|
||||
|
||||
$thumbwidth = getglobal('config/pichomethumbwidth') ? getglobal('config/pichomethumbwidth') : 900;
|
||||
$thumbheight = getglobal('config/pichomethumbheight') ? getglobal('config/pichomethumbheight') : 900;
|
||||
$thumsizearr = $this->getImageThumbsize($resourcesdata['width'], $resourcesdata['height'], $thumbwidth, $thumbheight);
|
||||
$resourcesdata['iconwidth'] = $thumsizearr[0];
|
||||
$resourcesdata['iconheight'] = $thumsizearr[1];
|
||||
//echo $resourcesdata['icondata'];die;
|
||||
//$imginfo = @getimagesize($resourcesdata['icondata']);
|
||||
// $resourcesdata['iconwidth'] = $imginfo[0] ? $imginfo[0] : $resourcesdata['width'];
|
||||
//$resourcesdata['iconheight'] = $imginfo[1] ? $imginfo[1] : $resourcesdata['height'];
|
||||
$resourcesdata['icondata'] = str_replace('+', '%20', $resourcesdata['icondata']);
|
||||
|
||||
|
||||
$resourcesdata['share'] = $downshare[$resourcesdata['appid']]['share'];
|
||||
$resourcesdata['download'] = $downshare[$resourcesdata['appid']]['download'];
|
||||
/* if ($downshare[$resourcesdata['appid']]['iswebsitefile']) {
|
||||
$originalimg = str_replace(DZZ_ROOT, '', $downshare[$resourcesdata['appid']]['path'] . BS . $resourcesdata['path']);
|
||||
$originalimg = str_replace(BS, '/', $originalimg);
|
||||
$resourcesdata['originalimg'] = str_replace('+', '%20', urlencode($originalimg));
|
||||
$resourcesdata['realpath'] = str_replace('+', '%20', urlencode($originalimg));
|
||||
} else {*/
|
||||
$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'))) {
|
||||
$resourcesdata['realpath'] = str_replace('+', '', urlencode(getglobal('siteurl') . 'index.php?mod=io&op=getImg&fpath=' . dzzencode($originalimg, '', 0, 0)));
|
||||
} else {
|
||||
$resourcesdata['realpath'] = getglobal('siteurl') . 'index.php?mod=io&op=getImg&fpath=' . dzzencode($originalimg, '', 0, 0);
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
$resourcesdata['name'] = str_replace(strrchr($resourcesdata['name'], "."), "", $resourcesdata['name']);
|
||||
$resourcesdata['fsize'] = formatsize($resourcesdata['size']);
|
||||
$resourcesdata['mtime'] = dgmdate(round($resourcesdata['mtime'] / 1000), 'Y/m/d H:i');
|
||||
$resourcesdata['dateline'] = dgmdate(round($resourcesdata['dateline'] / 1000), 'Y/m/d H:i');
|
||||
$resourcesdata['btime'] = dgmdate(round($resourcesdata['btime'] / 1000), 'Y/m/d H:i');
|
||||
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);
|
||||
$resourcesdata['dpath'] = dzzencode($rid, '', 0, 0);
|
||||
|
||||
|
||||
return $resourcesdata;
|
||||
}
|
||||
|
||||
public function getdatasbyrids($rids)
|
||||
{
|
||||
$returndata = [];
|
||||
//文件数据
|
||||
$resourcesdata = $this->fetch_by_rids($rids);
|
||||
//获取所有库分享和下载权限,以及编码数据
|
||||
$downshare = C::t('pichome_vapp')->fetch_all_sharedownlod();
|
||||
//文件附属表数据
|
||||
// $attrdata = C::t('pichome_resources_attr')->fetch_by_rids($rids);
|
||||
//文件标注数
|
||||
$annonationnumdata = C::t('pichome_comments')->fetch_annonationnum_by_rids($rids);
|
||||
foreach ($resourcesdata as $v) {
|
||||
//echo $v['hasthumb'];die;
|
||||
$v['annonationnum'] = $annonationnumdata[$v['rid']]['num'];
|
||||
$v['share'] = $downshare[$v['appid']]['share'];
|
||||
$v['download'] = $downshare[$v['appid']]['download'];
|
||||
|
||||
$v['icondata'] = getglobal('siteurl') . 'index.php?mod=io&op=getImg&path=' . dzzencode($v['rid'], '', 0, 0);
|
||||
$thumbwidth = getglobal('config/pichomethumbwidth') ? getglobal('config/pichomethumbwidth') : 900;
|
||||
$thumbheight = getglobal('config/pichomethumbheight') ? getglobal('config/pichomethumbheight') : 900;
|
||||
$thumsizearr = $this->getImageThumbsize($v['width'], $v['height'], $thumbwidth, $thumbheight);
|
||||
$v['thumbwidth'] = $thumsizearr[0];
|
||||
$v['thumbheight'] = $thumsizearr[1];
|
||||
|
||||
$originalimg = $downshare[$v['appid']]['path'] . BS . $v['path'];
|
||||
$v['realpath'] = getglobal('siteurl') . 'index.php?mod=io&op=getImg&fpath=' . dzzencode($originalimg, '', 0, 0);
|
||||
|
||||
|
||||
unset($v['path']);
|
||||
$returndata[] = $v;
|
||||
}
|
||||
return $returndata;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,81 +1,66 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_resources_attr extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_resources_attr';
|
||||
$this->_pk = 'rid';
|
||||
$this->_pre_cache_key = 'pichome_resourcesattr';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function insert($setarr){
|
||||
$rid = trim($setarr['rid']);
|
||||
if($attrdata = parent::fetch($rid)){
|
||||
unset($setarr['rid']);
|
||||
if($setarr['tag']){
|
||||
$tagarr = explode(',',$setarr['tag']);
|
||||
$otagarr = explode(',',$attrdata['tag']);
|
||||
$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']);
|
||||
}
|
||||
if(!empty($delrtids)) C::t('pichome_resourcestag')->delete($delrtids);
|
||||
$addrtids = array_diff($tagarr,$otagarr);
|
||||
foreach ($addrtids as $tid){
|
||||
$rtag = ['appid' => $attrdata['appid'], 'rid' => $rid, 'tid' => $tid];
|
||||
C::t('pichome_resourcestag')->insert($rtag);
|
||||
}
|
||||
}
|
||||
return parent::update($rid,$setarr);
|
||||
}else{
|
||||
return parent::insert($setarr,1);
|
||||
}
|
||||
}
|
||||
//删除文件属性数据
|
||||
public function delete_by_rid($rids){
|
||||
if(!is_array($rids)) $rids = (array)$rids;
|
||||
$aids = [];
|
||||
$tids = [];
|
||||
foreach(DB::fetch_all("select * from %t where rid in(%n) ",array($this->_table,$rids)) as $v){
|
||||
$tids= array_merge($tids,explode(',',$v['tags']));
|
||||
}
|
||||
$tids = array_unique($tids);
|
||||
foreach ($tids as $tid){
|
||||
C::t('pichome_tag')->delete_by_tid($tid);
|
||||
}
|
||||
return parent::delete($rids);
|
||||
}
|
||||
|
||||
public function fetch_by_rids($rids){
|
||||
if(!is_array($rids)) $rids = (array)$rids;
|
||||
$data = [];
|
||||
foreach(parent::fetch_all($rids) as $v){
|
||||
$data[$v['rid']] = $v;
|
||||
}
|
||||
return $v;
|
||||
}
|
||||
public function fetch_rids_by_link($link,$appid,$limit=6,$rid=''){
|
||||
$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;
|
||||
}
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_resources_attr extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_resources_attr';
|
||||
$this->_pk = 'rid';
|
||||
$this->_pre_cache_key = 'pichome_resourcesattr';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function insert($setarr){
|
||||
$rid = trim($setarr['rid']);
|
||||
if($attrdata = parent::fetch($rid)){
|
||||
unset($setarr['rid']);
|
||||
return parent::update($rid,$setarr);
|
||||
}else{
|
||||
return parent::insert($setarr);
|
||||
}
|
||||
}
|
||||
//删除文件属性数据
|
||||
public function delete_by_rid($rids){
|
||||
if(!is_array($rids)) $rids = (array)$rids;
|
||||
$aids = [];
|
||||
$tids = [];
|
||||
foreach(DB::fetch_all("select * from %t where rid in(%n) ",array($this->_table,$rids)) as $v){
|
||||
$tids= array_merge($tids,explode(',',$v['tags']));
|
||||
}
|
||||
$tids = array_unique($tids);
|
||||
foreach ($tids as $tid){
|
||||
C::t('pichome_tag')->delete_by_tid($tid);
|
||||
}
|
||||
return parent::delete($rids);
|
||||
}
|
||||
|
||||
public function fetch_by_rids($rids){
|
||||
if(!is_array($rids)) $rids = (array)$rids;
|
||||
$data = [];
|
||||
foreach(parent::fetch_all($rids) as $v){
|
||||
$data[$v['rid']] = $v;
|
||||
}
|
||||
return $v;
|
||||
}
|
||||
public function fetch_rids_by_link($link,$appid,$limit=6,$rid=''){
|
||||
$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;
|
||||
}
|
||||
}
|
||||
34
core/class/table/table_pichome_resources_relation.php
Normal file
34
core/class/table/table_pichome_resources_relation.php
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,89 +1,92 @@
|
||||
<?php
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class table_pichome_resourcestag extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_resourcestag';
|
||||
$this->_pk = 'id';
|
||||
$this->_pre_cache_key = 'pichome_resourcestag';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
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']))) {
|
||||
parent::update($id, $setarr);
|
||||
} else {
|
||||
$id=parent::insert($setarr);
|
||||
C::t('pichome_tag')->add_hots_by_tid($setarr['tid']);
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
public function fetch_tag_by_rid($rid){
|
||||
$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){
|
||||
$tagdata[$v['tid']] = $v['tagname'];
|
||||
}
|
||||
return $tagdata;
|
||||
}
|
||||
public function fetch_id_by_rid($rid)
|
||||
{
|
||||
$ids = [];
|
||||
foreach(DB::fetch_all("select id from %t where rid = %s",array($this->_table,$rid)) as $v){
|
||||
$ids[] = $v['id'];
|
||||
}
|
||||
return $ids;
|
||||
}
|
||||
|
||||
//根据appid删除数据
|
||||
public function delete_by_appid($appid)
|
||||
{
|
||||
$dids = [];
|
||||
foreach (DB::fetch_all("select id from %t where appid = %s", array($this->_table, $appid)) as $v) {
|
||||
$dids[] = $v['id'];
|
||||
}
|
||||
return parent::delete($dids);
|
||||
}
|
||||
public function delete_by_rid($rid)
|
||||
{
|
||||
$delids = [];
|
||||
foreach (DB::fetch_all("select id from %t where rid = %s", array($this->_table, $rid)) as $v) {
|
||||
$delids[] = $v['id'];
|
||||
}
|
||||
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){
|
||||
$rids[] = $v['rid'];
|
||||
}
|
||||
return $rids;
|
||||
}
|
||||
public function fetch_all_tag_by_rids($rids){
|
||||
$data = [];
|
||||
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){
|
||||
$data[$v['rid']][]= $v['tagname'];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function delete_by_ridtid($rid,$tids){
|
||||
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){
|
||||
$ids[] = $v['id'];
|
||||
C::t('pichome_tag')->delete_by_tid($v['tid']);
|
||||
}
|
||||
return parent::delete($ids);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class table_pichome_resourcestag extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_resourcestag';
|
||||
$this->_pk = 'id';
|
||||
$this->_pre_cache_key = 'pichome_resourcestag';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
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']))) {
|
||||
parent::update($id, $setarr);
|
||||
} else {
|
||||
$id=parent::insert($setarr);
|
||||
C::t('pichome_tag')->add_hots_by_tid($setarr['tid']);
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
public function fetch_tag_by_rid($rid){
|
||||
$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){
|
||||
$tagdata[$v['tid']] = $v['tagname'];
|
||||
}
|
||||
return $tagdata;
|
||||
}
|
||||
public function fetch_id_by_rid($rid)
|
||||
{
|
||||
$ids = [];
|
||||
foreach(DB::fetch_all("select id from %t where rid = %s",array($this->_table,$rid)) as $v){
|
||||
$ids[] = $v['id'];
|
||||
}
|
||||
return $ids;
|
||||
}
|
||||
|
||||
//根据appid删除数据
|
||||
public function delete_by_appid($appid)
|
||||
{
|
||||
$dids = [];
|
||||
foreach (DB::fetch_all("select id from %t where appid = %s", array($this->_table, $appid)) as $v) {
|
||||
$dids[] = $v['id'];
|
||||
}
|
||||
return parent::delete($dids);
|
||||
}
|
||||
public function delete_by_rid($rid)
|
||||
{
|
||||
if(!is_array($rid)) $rid = (array)$rid;
|
||||
$delids = [];
|
||||
foreach (DB::fetch_all("select id,tid from %t where rid in(%n)", array($this->_table, $rid)) as $v) {
|
||||
$delids[] = $v['id'];
|
||||
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){
|
||||
$rids[] = $v['rid'];
|
||||
}
|
||||
return $rids;
|
||||
}
|
||||
public function fetch_all_tag_by_rids($rids){
|
||||
$data = [];
|
||||
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){
|
||||
$data[$v['rid']][]= $v['tagname'];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function delete_by_ridtid($rid,$tids){
|
||||
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){
|
||||
$ids[] = $v['id'];
|
||||
C::t('pichome_tag')->delete_by_tid($v['tid']);
|
||||
}
|
||||
return parent::delete($ids);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,178 +1,162 @@
|
||||
<?php
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class table_pichome_searchrecent extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_searchrecent';
|
||||
$this->_pk = 'id';
|
||||
$this->_pre_cache_key = 'pichome_searchrecent';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function add_search($keyword, $appid = '', $ktype = 0)
|
||||
{
|
||||
global $_G;
|
||||
$wheresql = ' keywords = %s and ktype=%d ';
|
||||
$params = array($this->_table, $keyword, $ktype);
|
||||
if ($_G['uid']) {
|
||||
$wheresql .= ' and uid = %d ';
|
||||
$params[] = $_G['uid'];
|
||||
}
|
||||
if ($appid) {
|
||||
$wheresql .= ' and appid = %s ';
|
||||
$params[] = $appid;
|
||||
}
|
||||
if ($data = DB::fetch_first("select id,hots from %t where$wheresql", $params)) {
|
||||
$hots = $data['hots'] + 1;
|
||||
return parent::update($data['id'], array('hots' => $hots, 'dateline' => TIMESTAMP));
|
||||
} else {
|
||||
$setarr = [
|
||||
'keywords' => $keyword,
|
||||
'ktype' => $ktype,
|
||||
'dateline' => TIMESTAMP,
|
||||
'uid' => isset($_G['uid']) ? $_G['uid'] : 0,
|
||||
'hots' => 1,
|
||||
'appid' => $appid
|
||||
];
|
||||
return parent::insert($setarr);
|
||||
}
|
||||
}
|
||||
|
||||
//查询最近搜索标签
|
||||
public function fetch_renctent_search_tag($appid = '', $limit = 8)
|
||||
{
|
||||
global $_G;
|
||||
$wheresql = ' s.ktype = 1 ';
|
||||
$params = array($this->_table, 'pichome_tag');
|
||||
if ($appid) {
|
||||
$wheresql .= ' and s.appid = %s ';
|
||||
$params[] = $appid;
|
||||
}
|
||||
if ($_G['uid']) {
|
||||
$wheresql .= ' and s.uid = %d';
|
||||
$params[] = $_G['uid'];
|
||||
}
|
||||
$datas = [];
|
||||
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) {
|
||||
$datas[$v['tid']] = $v['keywords'];
|
||||
}
|
||||
return $datas;
|
||||
}
|
||||
|
||||
public function fetch_hotkeyword_by_appid($appid = '', $limit = 16,$noids=array(),$datas=array())
|
||||
{
|
||||
$start = strtotime(date("Y-m-d", strtotime("-7 day")));
|
||||
$end = strtotime(dgmdate(time(), 'Y-m-d')) + 86400;
|
||||
$params = array($this->_table/*, $start, $end*/);
|
||||
/* //$wheresql = " dateline <= %d and dateline > %d";
|
||||
if ($appid) {
|
||||
$wheresql .= ' and appid =%s ';
|
||||
$params[] = $appid;
|
||||
}
|
||||
if($noids){
|
||||
$wheresql .= ' and id not in(%n) ';
|
||||
$params[] = $noids;
|
||||
}*/
|
||||
$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']);
|
||||
if(!$data){
|
||||
parent::delete($v['id']);
|
||||
}else{
|
||||
$datas[$v['id']] = $data;
|
||||
}
|
||||
}
|
||||
$resultcount = count($datas);
|
||||
//如果有关键词没有结果,并且结果数量大于查询出来的数量
|
||||
if($resultcount < $limit && $count > $limit){
|
||||
$ids = array_keys($datas);
|
||||
$limit = $limit - $resultcount;
|
||||
$datas = $this->fetch_hotkeyword_by_appid($appid,$limit,$ids,$datas);
|
||||
}
|
||||
return $datas;
|
||||
}
|
||||
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
|
||||
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
|
||||
order by rand() limit 1 ",
|
||||
array('pichome_resources', 'pichome_resources_attr', 'pichome_comments', 'pichome_resourcestag', 'pichome_tag', '%' . $keyword . '%',
|
||||
'%' . $keyword . '%', '%' . $keyword . '%', '%' . $keyword . '%', '%' . $keyword . '%'));
|
||||
if (!$tmpdata) {
|
||||
return false;
|
||||
} else {
|
||||
if ($tmpdata['hasthumb']) {
|
||||
$filename = str_replace(strrchr($tmpdata['name'], "."), "", $tmpdata['name']);
|
||||
$filepath = dirname($tmpdata['path']);
|
||||
$thumbpath = DZZ_ROOT . 'library/' . $filepath . '/' . $filename . '_thumbnail.png';
|
||||
$thumbpath = str_replace(DZZ_ROOT, '', $thumbpath);
|
||||
$tmpdata['icondata'] = $thumbpath;
|
||||
} else {
|
||||
if ($tmpdata['type'] == 'commonimage') {
|
||||
$tmpdata['icondata'] = 'library/' . $tmpdata['path'];
|
||||
} else {
|
||||
$tmpdata['icondata'] = geticonfromext($tmpdata['ext'], $tmpdata['type']);
|
||||
}
|
||||
}
|
||||
$tmpdata['keyword'] = $keyword;
|
||||
}
|
||||
return $tmpdata;
|
||||
}
|
||||
//查询最近搜索分类
|
||||
public function fetch_renctent_search_foldername($appid, $limit = 10)
|
||||
{
|
||||
global $_G;
|
||||
$wheresql = ' s.ktype = 2 and s.appid = %s';
|
||||
$params = array($this->_table, 'pichome_folder', $appid);
|
||||
|
||||
if ($_G['uid']) {
|
||||
$wheresql .= ' and s.uid = %d';
|
||||
$params[] = $_G['uid'];
|
||||
}
|
||||
$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'];
|
||||
$datas[$v['fid']]['fid'] = $v['fid'];
|
||||
}
|
||||
$fids = array_keys($datas);
|
||||
if (!empty($fids)) {
|
||||
foreach (DB::fetch_all("select f.fname,f.fid,count(fr.rid) as num from %t fr
|
||||
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) {
|
||||
$datas[$val['fid']]['sum'] = $val['num'];
|
||||
$datas[$val['fid']]['fname'] = $val['fname'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $datas;
|
||||
}
|
||||
|
||||
public function fetch_like_words($keyword, $limit = 10)
|
||||
{
|
||||
$likewords = [];
|
||||
$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);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class table_pichome_searchrecent extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_searchrecent';
|
||||
$this->_pk = 'id';
|
||||
$this->_pre_cache_key = 'pichome_searchrecent';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function add_search($keyword, $appid = '', $ktype = 0)
|
||||
{
|
||||
global $_G;
|
||||
$wheresql = ' keywords = %s and ktype=%d ';
|
||||
$params = array($this->_table, $keyword, $ktype);
|
||||
if ($_G['uid']) {
|
||||
$wheresql .= ' and uid = %d ';
|
||||
$params[] = $_G['uid'];
|
||||
}
|
||||
if ($appid) {
|
||||
$wheresql .= ' and appid = %s ';
|
||||
$params[] = $appid;
|
||||
}
|
||||
if ($data = DB::fetch_first("select id,hots from %t where$wheresql", $params)) {
|
||||
$hots = $data['hots'] + 1;
|
||||
return parent::update($data['id'], array('hots' => $hots, 'dateline' => TIMESTAMP));
|
||||
} else {
|
||||
$setarr = [
|
||||
'keywords' => $keyword,
|
||||
'ktype' => $ktype,
|
||||
'dateline' => TIMESTAMP,
|
||||
'uid' => isset($_G['uid']) ? $_G['uid'] : 0,
|
||||
'hots' => 1,
|
||||
'appid' => $appid
|
||||
];
|
||||
return parent::insert($setarr);
|
||||
}
|
||||
}
|
||||
|
||||
//查询最近搜索标签
|
||||
public function fetch_renctent_search_tag($appid = '', $limit = 8)
|
||||
{
|
||||
global $_G;
|
||||
$wheresql = ' s.ktype = 1 ';
|
||||
$params = array($this->_table, 'pichome_tag');
|
||||
if ($appid) {
|
||||
$wheresql .= ' and s.appid = %s ';
|
||||
$params[] = $appid;
|
||||
}
|
||||
if ($_G['uid']) {
|
||||
$wheresql .= ' and s.uid = %d';
|
||||
$params[] = $_G['uid'];
|
||||
}
|
||||
$datas = [];
|
||||
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) {
|
||||
$datas[$v['tid']] = $v['keywords'];
|
||||
}
|
||||
return $datas;
|
||||
}
|
||||
|
||||
public function fetch_hotkeyword_by_appid($appid = '', $limit = 16, $noids = array(), $datas = array())
|
||||
{
|
||||
/* $start = strtotime(date("Y-m-d", strtotime("-7 day")));
|
||||
$end = strtotime(dgmdate(time(), 'Y-m-d')) + 86400;*/
|
||||
$params = array($this->_table/*, $start, $end*/);
|
||||
|
||||
$count = DB::result_first("select count(id) from %t where 1 order by hots desc limit 0,$limit", $params);
|
||||
//print_r(DB::fetch_all("select keywords,id from %t where 1 order by hots desc limit 0,$limit", $params));die;
|
||||
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 (!$data) {
|
||||
parent::delete($v['id']);
|
||||
} else {
|
||||
$datas[$v['id']] = $data;
|
||||
}
|
||||
}
|
||||
// print_r($datas);die;
|
||||
$resultcount = count($datas);
|
||||
//如果有关键词没有结果,并且结果数量大于查询出来的数量
|
||||
if ($resultcount < $limit && $count > $limit) {
|
||||
$ids = array_keys($datas);
|
||||
$limit = $limit - $resultcount;
|
||||
$datas = $this->fetch_hotkeyword_by_appid($appid, $limit, $ids, $datas);
|
||||
}
|
||||
return $datas;
|
||||
}
|
||||
|
||||
public function get_data_by_keyword($keyword)
|
||||
{
|
||||
$rid = DB::result_first("select r.rid from %t r left join %t ra on ra.rid=r.rid
|
||||
where ra.searchval LIKE %s order by rand() limit 0,1 ",
|
||||
array('pichome_resources', 'pichome_resources_attr', '%' . $keyword . '%'));
|
||||
|
||||
$tmpdata = C::t('pichome_resources')->geticondata_by_rid($rid);
|
||||
|
||||
if (!$tmpdata) {
|
||||
return false;
|
||||
} else {
|
||||
$tmpdata['keyword'] = $keyword;
|
||||
}
|
||||
return $tmpdata;
|
||||
}
|
||||
|
||||
//查询最近搜索分类
|
||||
public function fetch_renctent_search_foldername($appid, $limit = 10)
|
||||
{
|
||||
global $_G;
|
||||
$wheresql = ' s.ktype = 2 and s.appid = %s';
|
||||
$params = array($this->_table, 'pichome_folder', $appid);
|
||||
|
||||
if ($_G['uid']) {
|
||||
$wheresql .= ' and s.uid = %d';
|
||||
$params[] = $_G['uid'];
|
||||
}
|
||||
$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'];
|
||||
$datas[$v['fid']]['fid'] = $v['fid'];
|
||||
}
|
||||
$fids = array_keys($datas);
|
||||
if (!empty($fids)) {
|
||||
foreach (DB::fetch_all("select f.fname,f.fid,count(fr.rid) as num from %t fr
|
||||
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) {
|
||||
$datas[$val['fid']]['sum'] = $val['num'];
|
||||
$datas[$val['fid']]['fname'] = $val['fname'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $datas;
|
||||
}
|
||||
|
||||
public function fetch_like_words($keyword, $limit = 10)
|
||||
{
|
||||
$likewords = [];
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
<?php
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class table_pichome_taggroup extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_taggroup';
|
||||
$this->_pk = 'cid';
|
||||
$this->_pre_cache_key = 'pichome_taggroup';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function insert($setarr)
|
||||
{
|
||||
$cid = $setarr['cid'];
|
||||
if ($taggroup = DB::fetch_first("select * from %t where cid = %s", array($this->_table, $cid))) {
|
||||
unset($setarr['cid']);
|
||||
if ($taggroup['catname'] != $setarr['catname']) parent::update($cid, $setarr);
|
||||
return $cid;
|
||||
} else {
|
||||
if (parent::insert($setarr)) return $cid;
|
||||
}
|
||||
}
|
||||
|
||||
public function fetch_cid_by_appid($appid)
|
||||
{
|
||||
$cids = [];
|
||||
foreach (DB::fetch_all("select cid from %t where appid = %s", array($this->_table, $appid)) as $v) {
|
||||
$cids[] = $v['cid'];
|
||||
}
|
||||
return $cids;
|
||||
}
|
||||
|
||||
public function delete_by_cids($cids)
|
||||
{
|
||||
if (!is_array($cids)) $cids = (array)$cids;
|
||||
if (!empty($cids)) {
|
||||
C::t('pichome_tagrelation')->delete_by_cids($cids);
|
||||
parent::delete($cids);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function delete_by_appid($appid)
|
||||
{
|
||||
$delid = [];
|
||||
foreach (DB::fetch_all("select cid from %t where appid = %s", array($this->_table, $appid)) as $v) {
|
||||
$delid[] = $v['cid'];
|
||||
}
|
||||
return parent::delete($delid);
|
||||
}
|
||||
|
||||
public function fetch_by_appid($appid)
|
||||
{
|
||||
$data = [];
|
||||
return DB::fetch_all("select * from %t where appid = %s", array($this->_table, $appid));
|
||||
|
||||
}
|
||||
|
||||
|
||||
<?php
|
||||
if (!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class table_pichome_taggroup extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_taggroup';
|
||||
$this->_pk = 'cid';
|
||||
$this->_pre_cache_key = 'pichome_taggroup';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function insert($setarr)
|
||||
{
|
||||
$cid = $setarr['cid'];
|
||||
if ($taggroup = DB::fetch_first("select * from %t where cid = %s and appid = %s", array($this->_table, $cid,$setarr['appid']))) {
|
||||
unset($setarr['cid']);
|
||||
if ($taggroup['catname'] != $setarr['catname']) parent::update($cid, $setarr);
|
||||
return $cid;
|
||||
} else {
|
||||
if (parent::insert($setarr)) return $cid;
|
||||
}
|
||||
}
|
||||
|
||||
public function fetch_cid_by_appid($appid)
|
||||
{
|
||||
$cids = [];
|
||||
foreach (DB::fetch_all("select cid from %t where appid = %s", array($this->_table, $appid)) as $v) {
|
||||
$cids[] = $v['cid'];
|
||||
}
|
||||
return $cids;
|
||||
}
|
||||
|
||||
public function delete_by_cids($cids)
|
||||
{
|
||||
if (!is_array($cids)) $cids = (array)$cids;
|
||||
if (!empty($cids)) {
|
||||
C::t('pichome_tagrelation')->delete_by_cids($cids);
|
||||
parent::delete($cids);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function delete_by_appid($appid)
|
||||
{
|
||||
$delid = [];
|
||||
foreach (DB::fetch_all("select cid from %t where appid = %s", array($this->_table, $appid)) as $v) {
|
||||
$delid[] = $v['cid'];
|
||||
}
|
||||
return parent::delete($delid);
|
||||
}
|
||||
|
||||
public function fetch_by_appid($appid)
|
||||
{
|
||||
$data = [];
|
||||
return DB::fetch_all("select * from %t where appid = %s", array($this->_table, $appid));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
38
core/class/table/table_pichome_taggroup_relation.php
Normal file
38
core/class/table/table_pichome_taggroup_relation.php
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +1,51 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_tagrelation extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_tagrelation';
|
||||
$this->_pk = 'id';
|
||||
$this->_pre_cache_key = 'pichome_tagrelation';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
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']))){
|
||||
return $id;
|
||||
}else{
|
||||
//同一库下一个标签只能归属于一个分类
|
||||
$this->delete_by_tpid($setarr['tid'],$setarr['appid']);
|
||||
return parent::insert($setarr,1);
|
||||
}
|
||||
}
|
||||
public function delete_by_tpid($tid,$appid){
|
||||
//兼容以修复已经出现错误的数据
|
||||
$ids = [];
|
||||
foreach(DB::fetch_all("select id from %t where tid = %d and appid =%s",array($this->_table,$tid,$appid)) as $v){
|
||||
$ids[] = $v['id'];
|
||||
}
|
||||
//$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);
|
||||
return true;
|
||||
}
|
||||
public function delete_by_cids($cids){
|
||||
if(!is_array($cids)) $cids = (array)$cids;
|
||||
$ids = [];
|
||||
foreach(DB::fetch_all("select id from %t where cid in(%n)",array($this->_table,$cids)) as $v){
|
||||
$ids[] = $v['id'];
|
||||
}
|
||||
parent::delete($ids);
|
||||
}
|
||||
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);
|
||||
}
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_tagrelation extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_tagrelation';
|
||||
$this->_pk = 'id';
|
||||
$this->_pre_cache_key = 'pichome_tagrelation';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
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']))){
|
||||
return $id;
|
||||
}else{
|
||||
//同一库下一个标签只能归属于一个分类
|
||||
$this->delete_by_tpid($setarr['tid'],$setarr['appid']);
|
||||
return parent::insert($setarr);
|
||||
}
|
||||
}
|
||||
public function delete_by_tpid($tid,$appid){
|
||||
//兼容以修复已经出现错误的数据
|
||||
$ids = [];
|
||||
foreach(DB::fetch_all("select id from %t where tid = %d and appid =%s",array($this->_table,$tid,$appid)) as $v){
|
||||
$ids[] = $v['id'];
|
||||
}
|
||||
//$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);
|
||||
return true;
|
||||
}
|
||||
public function delete_by_cids($cids){
|
||||
if(!is_array($cids)) $cids = (array)$cids;
|
||||
$ids = [];
|
||||
foreach(DB::fetch_all("select id from %t where cid in(%n)",array($this->_table,$cids)) as $v){
|
||||
$ids[] = $v['id'];
|
||||
}
|
||||
parent::delete($ids);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,87 +1,134 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_vapp extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_vapp';
|
||||
$this->_pk = 'appid';
|
||||
$this->_pre_cache_key = 'pichome_vapp';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
private function code62($x) {
|
||||
$show = '';
|
||||
while($x > 0) {
|
||||
$s = $x % 62;
|
||||
if ($s > 35) {
|
||||
$s = chr($s+61);
|
||||
} elseif ($s > 9 && $s <=35) {
|
||||
$s = chr($s + 55);
|
||||
}
|
||||
$show .= $s;
|
||||
$x = floor($x/62);
|
||||
}
|
||||
return $show;
|
||||
}
|
||||
public function getSid($url) {
|
||||
$url = crc32($url);
|
||||
$result = sprintf("%u", $url);
|
||||
return self::code62($result);
|
||||
}
|
||||
public function insert($setarr){
|
||||
$path = $setarr['path'];
|
||||
if($appid = DB::result_first("select appid from %t where path = %s",array($this->_table,$path))){
|
||||
return $appid;
|
||||
}else{
|
||||
$setarr['appid'] = $this->getSid($setarr['path']);
|
||||
if(parent::insert($setarr)){
|
||||
return $setarr['appid'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function fetch_by_path($path){
|
||||
return DB::fetch_first("select * from %t where path = %s",array($this->_table,$path));
|
||||
}
|
||||
//获取不重复的应用名称
|
||||
public function getNoRepeatName($name)
|
||||
{
|
||||
static $i = 0;
|
||||
if (DB::result_first("select COUNT(*) from %t where appname=%s ", array($this->_table, $name))) {
|
||||
$name = preg_replace("/\(\d+\)/i", '', $name) . '(' . ($i + 1) . ')';
|
||||
$i += 1;
|
||||
return $this->getNoRepeatName($name);
|
||||
} else {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
//删除虚拟应用
|
||||
public function delete_vapp_by_appid($appid){
|
||||
//删除文件表数据
|
||||
C::t('pichome_resources')->delete_by_appid($appid);
|
||||
//删除目录表数据
|
||||
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);
|
||||
return parent::delete($appid);
|
||||
}
|
||||
|
||||
public function fetch_all_sharedownlod(){
|
||||
$downshare = array();
|
||||
foreach(DB::fetch_all("select appid,download,share from %t where 1",array($this->_table)) as $v){
|
||||
$downshare[$v['appid']]=['share'=>$v['share'],'download'=>$v['download']];
|
||||
}
|
||||
return $downshare;
|
||||
}
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
class table_pichome_vapp extends dzz_table
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_table = 'pichome_vapp';
|
||||
$this->_pk = 'appid';
|
||||
$this->_pre_cache_key = 'pichome_vapp';
|
||||
$this->_cache_ttl = 3600;
|
||||
parent::__construct();
|
||||
}
|
||||
private function code62($x) {
|
||||
$show = '';
|
||||
while($x > 0) {
|
||||
$s = $x % 62;
|
||||
if ($s > 35) {
|
||||
$s = chr($s+61);
|
||||
} elseif ($s > 9 && $s <=35) {
|
||||
$s = chr($s + 55);
|
||||
}
|
||||
$show .= $s;
|
||||
$x = floor($x/62);
|
||||
}
|
||||
return $show;
|
||||
}
|
||||
public function getSid($url) {
|
||||
$microtime = microtime();
|
||||
list($msec, $sec) = explode(' ', $microtime);
|
||||
$msec = $msec * 1000000;
|
||||
$url = crc32($url.$sec.random(6).$msec);
|
||||
$result = sprintf("%u", $url);
|
||||
$sid = self::code62($result);
|
||||
$len = strlen($sid);
|
||||
if($len < 6){
|
||||
$sid .= random(1);
|
||||
}
|
||||
if(strlen($sid) > 6){
|
||||
$sid = substr($sid,0,6);
|
||||
}
|
||||
if(DB::result_first("select appid from %t where appid = %s",array($this->_table,$sid))){
|
||||
$sid = $this->getSid($url);
|
||||
}
|
||||
return $sid;
|
||||
}
|
||||
public function insert($setarr){
|
||||
//如果为oaooa库时
|
||||
$path = $setarr['path'];
|
||||
if($appid = DB::result_first("select appid from %t where path = %s and isdelete = 0",array($this->_table,$setarr['path']))){
|
||||
parent::update($appid,$setarr);
|
||||
return $appid;
|
||||
}
|
||||
//生成appid
|
||||
$setarr['appid'] = $this->getSid($path);
|
||||
|
||||
if(parent::insert($setarr)){
|
||||
return $setarr['appid'];
|
||||
}
|
||||
}
|
||||
|
||||
public function fetch_by_path($path){
|
||||
return DB::fetch_first("select * from %t where path = %s",array($this->_table,$path));
|
||||
}
|
||||
//获取不重复的应用名称
|
||||
public function getNoRepeatName($name)
|
||||
{
|
||||
static $i = 0;
|
||||
if (DB::result_first("select COUNT(*) from %t where appname=%s ", array($this->_table, $name))) {
|
||||
$name = preg_replace("/\(\d+\)/i", '', $name) . '(' . ($i + 1) . ')';
|
||||
$i += 1;
|
||||
return $this->getNoRepeatName($name);
|
||||
} else {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
//删除虚拟应用
|
||||
public function delete_vapp_by_appid($appid){
|
||||
$appdata = parent::fetch($appid);
|
||||
//删除文件表数据
|
||||
C::t('pichome_resources')->delete_by_appid($appid);
|
||||
//删除目录表数据
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
if(!defined('CORE_VERSION')) {
|
||||
define('CORE_VERSION', 'beta1');
|
||||
define('CORE_VERSION_LEVEL', 'Pichome');
|
||||
define('CORE_RELEASE', '20210820');
|
||||
define('CORE_FIXBUG' , '01000000');
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
if(!defined('CORE_VERSION')) {
|
||||
define('CORE_VERSION', 'beta3.3');
|
||||
define('CORE_VERSION_LEVEL', 'Pichome');
|
||||
define('CORE_RELEASE', '20220224');
|
||||
define('CORE_FIXBUG' , '03300000');
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
gnore_user_abort(true);
|
||||
ignore_user_abort(true);
|
||||
@set_time_limit(0);
|
||||
$percachename = 'pichome_searchhot';
|
||||
$alldata = C::t('pichome_searchrecent')->fetch_hotkeyword_by_appid();
|
||||
|
||||
8
core/cron/cron_pichome_delete.php
Normal file
8
core/cron/cron_pichome_delete.php
Normal 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);
|
||||
7
core/cron/cron_pichome_getimagecolor.php
Normal file
7
core/cron/cron_pichome_getimagecolor.php
Normal 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);
|
||||
8
core/cron/cron_pichome_getvideoinfo.php
Normal file
8
core/cron/cron_pichome_getvideoinfo.php
Normal 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);
|
||||
|
||||
7
core/cron/cron_pichome_getwideothumb.php
Normal file
7
core/cron/cron_pichome_getwideothumb.php
Normal 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);
|
||||
@@ -1,17 +1,15 @@
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
ignore_user_abort(true);
|
||||
@set_time_limit(0);
|
||||
$appdata = DB::fetch_all("select * from %t where 1 ",array('pichome_vapp'));
|
||||
foreach($appdata as $v){
|
||||
$jsonfile = DZZ_ROOT.'library/' . $v['path'] . '/mtime.json';
|
||||
if (!file_exists($jsonfile)) {
|
||||
//删除库
|
||||
C::t('#pichome#pichome_vapp')->delete_vapp_by_appid($v['appid']);
|
||||
}else{
|
||||
dfsockopen(getglobal('localurl'). 'index.php?mod=pichome&op=exportfile&appid='.$v['appid'],0, '', '', false, '', 1);
|
||||
}
|
||||
|
||||
<?php
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
ignore_user_abort(true);
|
||||
@set_time_limit(0);
|
||||
$appdata = DB::fetch_all("select * from %t where isdelete = 0 ",array('pichome_vapp'));
|
||||
foreach($appdata as $v){
|
||||
if($v['state'] == 2){
|
||||
dfsockopen(getglobal('localurl'). 'index.php?mod=pichome&op=exportfile&appid='.$v['appid'],0, '', '', false, '', 1);
|
||||
}elseif($v['state'] == 3){
|
||||
dfsockopen(getglobal('localurl'). 'index.php?mod=pichome&op=exportfilecheck&appid='.$v['appid'],0, '', '', false, '', 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,13 +54,13 @@ function updatecache($cachename = '') {
|
||||
try{
|
||||
@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]);
|
||||
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;}
|
||||
}elseif(count($entrys)==3){
|
||||
try{
|
||||
@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]);
|
||||
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;}
|
||||
} else {//插件缓存
|
||||
|
||||
|
||||
@@ -804,7 +804,7 @@ function avatar_block($uid=0,$headercolors=array(),$class="Topcarousel"){
|
||||
}
|
||||
if(empty($user)) return '';
|
||||
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{//没有上传头像,使用背景+首字母
|
||||
if($uid){
|
||||
if($headercolors[$uid]) $headerColor=$headercolors[$uid];
|
||||
|
||||
96
core/template/default/common/mobile_about.htm
Normal file
96
core/template/default/common/mobile_about.htm
Normal 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> All Rights Reserved</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
5
core/template/default/common/mobile_simple_process.htm
Normal file
5
core/template/default/common/mobile_simple_process.htm
Normal 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>
|
||||
24
core/template/default/common/mobile_simple_start.htm
Normal file
24
core/template/default/common/mobile_simple_start.htm
Normal 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>
|
||||
139
core/template/default/common/wx_ajax.htm
Normal file
139
core/template/default/common/wx_ajax.htm
Normal 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">×</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> <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}-->
|
||||
232
core/template/default/common/wx_appinfo.htm
Normal file
232
core/template/default/common/wx_appinfo.htm
Normal 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" <!–{if !$wxapp[status]}–>checked="checked"<!–{/if}–> >{lang open_start}</label>-->
|
||||
<!--<label class="radio-inline"><input type="radio" name="appstatus" value="1" <!–{if $wxapp[status]>0}–>checked="checked"<!–{/if}–> >{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}-->
|
||||
503
core/template/default/common/wx_menu.htm
Normal file
503
core/template/default/common/wx_menu.htm
Normal 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>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
147
core/template/default/common/wx_mpinfo.htm
Normal file
147
core/template/default/common/wx_mpinfo.htm
Normal 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>
|
||||
<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
0
data/log/index.htm
Normal file
0
data/template/index.htm
Normal file
0
data/template/index.htm
Normal file
852
dzz/billfish/class/class_billfishexport.php
Normal file
852
dzz/billfish/class/class_billfishexport.php
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
71
dzz/billfish/class/table/table_billfish_folderrecord.php
Normal file
71
dzz/billfish/class/table/table_billfish_folderrecord.php
Normal 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
43
dzz/billfish/class/table/table_billfish_record.php
Normal file
43
dzz/billfish/class/table/table_billfish_record.php
Normal 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
42
dzz/billfish/class/table/table_billfish_taggrouprecord.php
Normal file
42
dzz/billfish/class/table/table_billfish_taggrouprecord.php
Normal 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
39
dzz/billfish/class/table/table_billfish_tagrecord.php
Normal file
39
dzz/billfish/class/table/table_billfish_tagrecord.php
Normal 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));
|
||||
}
|
||||
}
|
||||
|
||||
18
dzz/billfish/classes/delpichomefolderafter.php
Normal file
18
dzz/billfish/classes/delpichomefolderafter.php
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
51
dzz/billfish/classes/getpichomethumb.php
Normal file
51
dzz/billfish/classes/getpichomethumb.php
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
26
dzz/billfish/classes/pichomevappdelete.php
Normal file
26
dzz/billfish/classes/pichomevappdelete.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,118 +1,118 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
|
||||
define ('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 ('UTF16_BIG_ENDIAN_BOM' , chr(0xFE) . chr(0xFF));
|
||||
|
||||
define ('UTF16_LITTLE_ENDIAN_BOM', chr(0xFF) . chr(0xFE));
|
||||
|
||||
define ('UTF8_BOM' , chr(0xEF) . chr(0xBB) . chr(0xBF));
|
||||
class Encode_Core {
|
||||
|
||||
/**
|
||||
* 文件分析方法来检查UNICODE文件,ANSI文件没有文件头,此处不分析
|
||||
*/
|
||||
private function detect_utf_encoding($text) {
|
||||
$first2 = substr($text, 0, 2);
|
||||
$first3 = substr($text, 0, 3);
|
||||
$first4 = substr($text, 0, 3);
|
||||
if ($first3 == UTF8_BOM) return 'UTF-8';
|
||||
|
||||
elseif ($first4 == UTF32_BIG_ENDIAN_BOM) return 'UTF-32BE';
|
||||
|
||||
elseif ($first4 == UTF32_LITTLE_ENDIAN_BOM) return 'UTF-32LE';
|
||||
|
||||
elseif ($first2 == UTF16_BIG_ENDIAN_BOM) return 'UTF-16BE';
|
||||
|
||||
elseif ($first2 == UTF16_LITTLE_ENDIAN_BOM) return 'UTF-16LE';
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
/**
|
||||
* 检测是否GB2312编码
|
||||
* @param string $str
|
||||
* @since 2012-03-20
|
||||
* @return boolean
|
||||
*/
|
||||
private function is_gb2312($str) {
|
||||
for($i=0; $i<strlen($str); $i++) {
|
||||
$v = ord( $str[$i] );
|
||||
if( $v > 127) {
|
||||
if( ($v >= 228) && ($v <= 233) ){
|
||||
if( ($i+2) >= (strlen($str) - 1)) return true; // not enough characters
|
||||
$v1 = ord( $str[$i+1] );
|
||||
$v2 = ord( $str[$i+2] );
|
||||
if( ($v1 >= 128) && ($v1 <=191) && ($v2 >=128) && ($v2 <= 191) )
|
||||
return false;
|
||||
else
|
||||
return true; //GB编码
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private function is_GBK($str){
|
||||
$s1 = iconv('gbk','utf-8',$str);
|
||||
$s0 = iconv('utf-8','gbk',$s1);
|
||||
if($s0 == $str){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 取得编码
|
||||
* @param string $str
|
||||
* @return string $encoding
|
||||
*/
|
||||
public static function get_encoding($str){
|
||||
$ary = array();
|
||||
|
||||
//$ary[] = "ASCII";
|
||||
$ary[] = "UTF-8";
|
||||
$ary[] = "GB18030";//简体码
|
||||
$ary[] = "BIG-5";//繁体码
|
||||
$ary[] = "EUC-CN";
|
||||
$ary[] = "JIS";//日文编码
|
||||
$ary[] = "EUC-JP";//日文编码
|
||||
$encoding= self::detect_utf_encoding($str);
|
||||
if(empty($encoding) && self::is_gb2312($str)) return 'GBK';
|
||||
if(empty($encoding)){
|
||||
$encoding=mb_detect_encoding($str,$ary);
|
||||
}
|
||||
if($encoding=='ASCII') $encoding='UTF-8';
|
||||
return $encoding;
|
||||
}
|
||||
|
||||
public function utf16_to_utf8($str) {
|
||||
|
||||
$len = strlen($str);
|
||||
$dec = '';
|
||||
for ($i = 0; $i < $len; $i += 2) {
|
||||
$c = ($be) ? ord($str[$i]) << 8 | ord($str[$i + 1]) :
|
||||
ord($str[$i + 1]) << 8 | ord($str[$i]);
|
||||
if ($c >= 0x0001 && $c <= 0x007F) {
|
||||
$dec .= chr($c);
|
||||
} else if ($c > 0x07FF) {
|
||||
$dec .= chr(0xE0 | (($c >> 12) & 0x0F));
|
||||
$dec .= chr(0x80 | (($c >> 6) & 0x3F));
|
||||
$dec .= chr(0x80 | (($c >> 0) & 0x3F));
|
||||
} else {
|
||||
$dec .= chr(0xC0 | (($c >> 6) & 0x1F));
|
||||
$dec .= chr(0x80 | (($c >> 0) & 0x3F));
|
||||
}
|
||||
}
|
||||
return $dec;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
||||
* @license https://www.oaooa.com/licenses/
|
||||
*
|
||||
* @link https://www.oaooa.com
|
||||
* @author zyx(zyx@oaooa.com)
|
||||
*/
|
||||
|
||||
define ('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 ('UTF16_BIG_ENDIAN_BOM' , chr(0xFE) . chr(0xFF));
|
||||
|
||||
define ('UTF16_LITTLE_ENDIAN_BOM', chr(0xFF) . chr(0xFE));
|
||||
|
||||
define ('UTF8_BOM' , chr(0xEF) . chr(0xBB) . chr(0xBF));
|
||||
class Encode_Core {
|
||||
|
||||
/**
|
||||
* 文件分析方法来检查UNICODE文件,ANSI文件没有文件头,此处不分析
|
||||
*/
|
||||
private function detect_utf_encoding($text) {
|
||||
$first2 = substr($text, 0, 2);
|
||||
$first3 = substr($text, 0, 3);
|
||||
$first4 = substr($text, 0, 3);
|
||||
if ($first3 == UTF8_BOM) return 'UTF-8';
|
||||
|
||||
elseif ($first4 == UTF32_BIG_ENDIAN_BOM) return 'UTF-32BE';
|
||||
|
||||
elseif ($first4 == UTF32_LITTLE_ENDIAN_BOM) return 'UTF-32LE';
|
||||
|
||||
elseif ($first2 == UTF16_BIG_ENDIAN_BOM) return 'UTF-16BE';
|
||||
|
||||
elseif ($first2 == UTF16_LITTLE_ENDIAN_BOM) return 'UTF-16LE';
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
/**
|
||||
* 检测是否GB2312编码
|
||||
* @param string $str
|
||||
* @since 2012-03-20
|
||||
* @return boolean
|
||||
*/
|
||||
private function is_gb2312($str) {
|
||||
for($i=0; $i<strlen($str); $i++) {
|
||||
$v = ord( $str[$i] );
|
||||
if( $v > 127) {
|
||||
if( ($v >= 228) && ($v <= 233) ){
|
||||
if( ($i+2) >= (strlen($str) - 1)) return true; // not enough characters
|
||||
$v1 = ord( $str[$i+1] );
|
||||
$v2 = ord( $str[$i+2] );
|
||||
if( ($v1 >= 128) && ($v1 <=191) && ($v2 >=128) && ($v2 <= 191) )
|
||||
return false;
|
||||
else
|
||||
return true; //GB编码
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private function is_GBK($str){
|
||||
$s1 = iconv('gbk','utf-8',$str);
|
||||
$s0 = iconv('utf-8','gbk',$s1);
|
||||
if($s0 == $str){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 取得编码
|
||||
* @param string $str
|
||||
* @return string $encoding
|
||||
*/
|
||||
public static function get_encoding($str){
|
||||
$ary = array();
|
||||
|
||||
//$ary[] = "ASCII";
|
||||
$ary[] = "UTF-8";
|
||||
$ary[] = "GB18030";//简体码
|
||||
$ary[] = "BIG-5";//繁体码
|
||||
$ary[] = "EUC-CN";
|
||||
$ary[] = "JIS";//日文编码
|
||||
$ary[] = "EUC-JP";//日文编码
|
||||
$encoding= self::detect_utf_encoding($str);
|
||||
//if(empty($encoding) && self::is_GBK($str)) return 'GBK';
|
||||
if(empty($encoding)){
|
||||
$encoding=mb_detect_encoding($str,$ary);
|
||||
}
|
||||
if($encoding=='ASCII') $encoding='UTF-8';
|
||||
return $encoding;
|
||||
}
|
||||
|
||||
public function utf16_to_utf8($str) {
|
||||
|
||||
$len = strlen($str);
|
||||
$dec = '';
|
||||
for ($i = 0; $i < $len; $i += 2) {
|
||||
$c = ($be) ? ord($str[$i]) << 8 | ord($str[$i + 1]) :
|
||||
ord($str[$i + 1]) << 8 | ord($str[$i]);
|
||||
if ($c >= 0x0001 && $c <= 0x007F) {
|
||||
$dec .= chr($c);
|
||||
} else if ($c > 0x07FF) {
|
||||
$dec .= chr(0xE0 | (($c >> 12) & 0x0F));
|
||||
$dec .= chr(0x80 | (($c >> 6) & 0x3F));
|
||||
$dec .= chr(0x80 | (($c >> 0) & 0x3F));
|
||||
} else {
|
||||
$dec .= chr(0xC0 | (($c >> 6) & 0x1F));
|
||||
$dec .= chr(0x80 | (($c >> 0) & 0x3F));
|
||||
}
|
||||
}
|
||||
return $dec;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
700
dzz/eagle/class/class_eagleexport.php
Normal file
700
dzz/eagle/class/class_eagleexport.php
Normal 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;
|
||||
}
|
||||
}
|
||||
92
dzz/eagle/class/table/table_eagle_folderrecord.php
Normal file
92
dzz/eagle/class/table/table_eagle_folderrecord.php
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
54
dzz/eagle/class/table/table_eagle_record.php
Normal file
54
dzz/eagle/class/table/table_eagle_record.php
Normal 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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
20
dzz/eagle/classes/deleteafter.php
Normal file
20
dzz/eagle/classes/deleteafter.php
Normal 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']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
18
dzz/eagle/classes/delpichomefolderafter.php
Normal file
18
dzz/eagle/classes/delpichomefolderafter.php
Normal 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
Reference in New Issue
Block a user