-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathsetunrun.php
54 lines (49 loc) · 2.11 KB
/
setunrun.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/
*
* @link https://www.oaooa.com
* @author zyx([email protected])
*/
ignore_user_abort(true);
@set_time_limit(0);
if(!defined('IN_OAOOA')) {
exit('Access Denied');
}
$unrunexts=$_G['setting']['unRunExts'];
//获取所有需要设置为禁止运行的项目
//设置所有本地的需要修改的项目
foreach(DB::fetch_all("select attachment,filetype,aid,unrun,remote from %t where filetype!='' and filetype IN(%n)",array('attachment',$unrunexts)) as $value){
if($value['unrun']<1){
if($value['remote']<2){
$earr=explode('.',$value['attachment']);
foreach($earr as $key=> $ext){
if(in_array(strtolower($ext),array($value['filetype'],'dzz'))) unset($earr[$key]);
}
$eattachment=implode('.',$earr);
$tattachment=implode('.',$earr).'.dzz';
if(@is_file(getglobal('setting/attachdir').'./'.$value['attachment']) && @rename(getglobal('setting/attachdir').'./'.$value['attachment'],getglobal('setting/attachdir').'./'.$tattachment)){
C::t('attachment')->update($value['aid'],array('unrun'=>1,'attachment'=>$tattachment));
}
}else{
C::t('attachment')->update($value['aid'],array('unrun'=>1));
}
}
}
foreach(DB::fetch_all("select attachment,filetype,aid,unrun,remote from %t where filetype!='' and filetype NOT IN(%n) and unrun='1'",array('attachment',$unrunexts)) as $value){
if($value['remote']<2){
$earr=explode('.',$value['attachment']);
foreach($earr as $key=> $ext){
if(in_array(strtolower($ext),array($value['filetype'],'dzz'))) unset($earr[$key]);
}
$tattachment=implode('.',$earr).'.'.$value['filetype'];
if(@is_file(getglobal('setting/attachdir').'./'.$value['attachment']) && @rename(getglobal('setting/attachdir').'./'.$value['attachment'],getglobal('setting/attachdir').'./'.$tattachment)){
C::t('attachment')->update($value['aid'],array('unrun'=>0,'attachment'=>$tattachment));
}
}else{
C::t('attachment')->update($value['aid'],array('unrun'=>0));
}
}
exit('success');
?>