Ejemplo n.º 1
0
 function save()
 {
     include load('include.lang');
     if (!$this->is_allow()) {
         return $this->_($L['upload_not_allow']);
     }
     $this->set_savepath($this->savepath);
     $this->set_savename($this->savename);
     if (file_copy($this->file, DT_ROOT . '/' . $this->saveto)) {
         if (!@getimagesize(DT_ROOT . '/' . $this->saveto)) {
             file_del(DT_ROOT . '/' . $this->saveto);
             return $this->_($L['upload_bad']);
         }
         if ($this->maxsize > 0 && filesize(DT_ROOT . '/' . $this->saveto) > $this->maxsize) {
             file_del(DT_ROOT . '/' . $this->saveto);
             return $this->_($L['upload_size_limit'] . ' (' . intval($this->maxsize / 1024) . 'Kb)');
         }
         $this->image = 1;
         return true;
     } else {
         return $this->_($L['upload_failed']);
     }
 }
Ejemplo n.º 2
0
function cache_clear($str, $type = '', $dir = '')
{
    $dir = $dir ? DT_CACHE . '/' . $dir . '/' : DT_CACHE . '/';
    $files = glob($dir . '*');
    if (is_array($files)) {
        if ($type == 'dir') {
            foreach ($files as $file) {
                if (is_dir($file)) {
                    dir_delete($file);
                } else {
                    if (file_ext($file) == $str) {
                        file_del($file);
                    }
                }
            }
        } else {
            foreach ($files as $file) {
                if (!is_dir($file) && strpos(basename($file), $str) !== false) {
                    file_del($file);
                }
            }
        }
    }
}
Ejemplo n.º 3
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
if (!$MOD['sitemaps']) {
    file_del(DT_ROOT . '/sitemaps.xml');
    return false;
}
$today = timetodate($DT_TIME, 3);
$mods = explode(',', $MOD['sitemaps_module']);
$nums = intval($MOD['sitemaps_items'] / count($mods));
$data = '<?xml version="1.0" encoding="UTF-8"?>';
$data .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
$data .= '<url>';
$data .= '<loc>' . DT_PATH . '</loc>';
$data .= '<lastmod>' . $today . '</lastmod>';
$data .= '<changefreq>always</changefreq>';
$data .= '<priority>1.0</priority>';
$data .= '<data><display></display></data>';
$data .= '</url>';
$item = '';
foreach ($mods as $mid) {
    if (isset($MODULE[$mid]) && !$MODULE[$mid]['islink'] && !$MODULE[$mid]['domain']) {
        if ($mid == 4 && $CFG['com_domain']) {
            continue;
        }
        $url = $MODULE[$mid]['linkurl'];
        $data .= '<url>';
        $data .= '<loc>' . $url . '</loc>';
        $data .= '<lastmod>' . $today . '</lastmod>';
        $data .= '<changefreq>hourly</changefreq>';
        $data .= '<priority>0.9</priority>';
Ejemplo n.º 4
0
 $ext = substr($word, -3);
 $file = '';
 $type = 'text';
 if ($str == 'http' && in_array($ext, array('jpg', 'amr', 'mp3', 'mp4'))) {
     if (strpos($word, DT_PATH) === 0) {
         $file = str_replace(DT_PATH, DT_ROOT . '/', $word);
     } else {
         if ($DT['remote_url'] && strpos($word, $DT['remote_url']) === 0) {
             $file = DT_ROOT . '/file/temp/' . date('YmdHis', $DT_TIME) . mt_rand(10, 99) . $_userid . '.' . $ext;
             file_copy($word, $file);
         }
     }
     if (strpos($file, '/file/') !== false && strpos($file, '..') === false && is_file($file)) {
         $arr = $wx->http_upload($file);
         if ($arr[0]) {
             file_del($file);
             $word = $arr[0];
             //Media_ID
             $type = $arr[1];
         } else {
             dalert('上传失败 - ' . $arr[1], '', 'window.parent.chat_show();');
         }
     }
 }
 $arr = $wx->send($openid, $type, $word);
 if ($arr['errcode'] != 0) {
     if ($arr['errcode'] == 45015) {
         dalert('回复时间超过限制[须48小时内回复]', '', 'window.parent.chat_hide(1);');
     }
     dalert('发送失败 - ' . $arr['errmsg'] . '(errcode:' . $arr['errcode'] . ')', '', 'window.parent.chat_show();');
 }
Ejemplo n.º 5
0
                        if ($typeid == 4) {
                            if (in_array(strtolower(file_ext($flash_src)), array('jpg', 'jpeg', 'png', 'gif', 'bmp'))) {
                                $typeid = 3;
                                $image_src = $flash_src;
                            }
                        }
                    }
                }
                ob_start();
                include template($template, $module);
                $data = ob_get_contents();
                ob_clean();
                file_put($filename, '<!--' . $totime . '-->' . $data);
                if ($typeid > 1) {
                    $data = 'document.write(\'' . dwrite($data) . '\');';
                    file_put(DT_ROOT . '/file/script/A' . $p['pid'] . '.js', $data);
                }
            } else {
                file_del($filename);
                if ($typeid > 1) {
                    if ($p['code']) {
                        file_put(DT_ROOT . '/file/script/A' . $p['pid'] . '.js', $p['code']);
                    } else {
                        file_del(DT_ROOT . '/file/script/A' . $p['pid'] . '.js');
                    }
                }
            }
        }
    }
}
return true;
Ejemplo n.º 6
0
             $fields[$k]['name'] = $edit ? $_fields[$k]['name'] : '';
             $fields[$k]['value'] = $edit ? $_fields[$k]['value'] : '';
         }
         include tpl('data_config');
     }
     break;
 case 'download':
     if ($name) {
         file_down(DT_ROOT . '/file/data/' . $name . '.php');
     }
     msg();
     break;
 case 'delete':
     if ($name) {
         file_del(DT_ROOT . '/file/data/' . $name . '.php');
         file_del(DT_ROOT . '/file/data/' . $name . '.inc.php');
     }
     dmsg('删除成功', '?file=' . $file);
     break;
 case 'view':
     $data = array();
     @(include DT_ROOT . '/file/data/' . $name . '.php');
     $data = dstripslashes($data);
     extract($data);
     if ($database == 'mysql') {
         if ($db_host && $db_user && $db_name) {
             $sc = new db_mysql();
             $sc->connect($db_host, $db_user, $db_pass, $db_name, $CFG['db_expires'], $CFG['db_charset'], $CFG['pconnect']);
         } else {
             $sc =& $db;
         }
Ejemplo n.º 7
0
     $moduleid = 1;
     $module = 'destoon';
     tohtml('index');
     $msgs = array('保存系统配置.................成功', '数据库连接....................成功', '创建数据库....................成功', '创建数据表....................成功', '插入初始数据.................成功', '设置管理员....................成功', '安装系统模型.................成功', '更新系统缓存.................成功', '更新模块缓存.................成功', '更新模板缓存.................成功', '生成网站密钥.................成功', '生成网站首页.................成功', '锁定安装程序.................就绪');
     $percent = '80%';
     include IN_ROOT . '/step_' . $step . '.tpl.php';
     break;
 case '6':
     //安装成功
     $percent = '100%';
     include IN_ROOT . '/step_' . $step . '.tpl.php';
     $DT_TIME = time();
     file_put(DT_CACHE . '/install.lock', $DT_TIME);
     $index = file_get(DT_ROOT . '/index.html');
     if (strpos($index, 'install/') !== false) {
         file_del(DT_ROOT . '/index.html');
     }
     file_put(DT_ROOT . '/install/index.php', '<script type="text/javascript">window.location="../?success="+Math.random();</script>');
     break;
 case 'db_test':
     if (!mysql_connect($tdb_host, $tdb_user, $tdb_pass)) {
         exit('<script>alert("无法连接到数据库服务器,请检查配置");</script>');
     }
     if (!mysql_select_db($tdb_name)) {
         if (!mysql_query("CREATE DATABASE {$tdb_name}")) {
             exit('<script>alert("指定的数据库不存在\\n\\n系统尝试创建失败,请通过其他方式建立数据库");</script>');
         }
         mysql_select_db($tdb_name);
     }
     $tables = array();
     $query = mysql_list_tables($tdb_name);
Ejemplo n.º 8
0
     $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
     if ($ftp->connected) {
         $exp = explode("file/upload/", $saveto);
         $remote = $exp[1];
         if ($ftp->dftp_put($do->saveto, $remote)) {
             $saveto = $DT['remote_url'] . $remote;
             $DT['ftp_save'] or file_del(DT_ROOT . '/' . $do->saveto);
             if (strpos($do->saveto, '.thumb.') !== false) {
                 $local = str_replace('.thumb.' . $do->ext, '', $do->saveto);
                 $remote = str_replace('.thumb.' . $do->ext, '', $exp[1]);
                 $ftp->dftp_put($local, $remote);
                 $DT['ftp_save'] or file_del(DT_ROOT . '/' . $local);
                 $local = str_replace('.thumb.' . $do->ext, '.middle.' . $do->ext, $do->saveto);
                 $remote = str_replace('.thumb.' . $do->ext, '.middle.' . $do->ext, $exp[1]);
                 $ftp->dftp_put($local, $remote);
                 $DT['ftp_save'] or file_del(DT_ROOT . '/' . $local);
             }
         }
     }
 }
 $fid = isset($fid) ? $fid : '';
 if (isset($old) && $old && in_array($from, array('thumb', 'photo'))) {
     delete_upload($old, $_userid);
 }
 $_saveto = $swfupload ? str_replace('.thumb.' . $do->ext, '', $saveto) : $saveto;
 $_SESSION['uploads'][] = $_saveto;
 if ($DT['uploadlog']) {
     $db->query("INSERT INTO {$upload_table} (item,fileurl,filesize,fileext,upfrom,width,height,moduleid,username,ip,addtime,itemid) VALUES ('" . md5($saveto) . "','{$saveto}','{$do->file_size}','{$do->ext}','{$from}','{$img_w}','{$img_h}','{$moduleid}','{$_username}','{$DT_IP}','{$do->uptime}','{$itemid}')");
 }
 if ($MG['uploadcredit'] > 0) {
     require DT_ROOT . '/include/module.func.php';
Ejemplo n.º 9
0
            $tmp = array();
            foreach (explode('&', $par) as $v) {
                $t = explode('=', $v);
                $tmp[$t[0]] = $t[1];
            }
            $tmp['pic'] = '@' . $pic;
            $par = $tmp;
        }
    }
    $cur = curl_init('https://graph.qq.com/t/' . ($pic ? 'add_pic_t ' : 'add_t'));
    curl_setopt($cur, CURLOPT_POST, 1);
    curl_setopt($cur, CURLOPT_POSTFIELDS, $par);
    curl_setopt($cur, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($cur, CURLOPT_HEADER, 0);
    curl_setopt($cur, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($cur, CURLOPT_RETURNTRANSFER, 1);
    if ($headers) {
        curl_setopt($cur, CURLOPT_HTTPHEADER, $headers);
    }
    $rec = curl_exec($cur);
    curl_close($cur);
    if ($pic && strpos($pic, 'file/temp') !== false) {
        file_del($pic);
    }
    #log_write($rec, 'qq', 1);
    if (strpos($rec, '<msg>ok</msg>') === false) {
        //fail
    } else {
        //success
    }
}
Ejemplo n.º 10
0
     $itemids = is_array($itemid) ? implode(',', $itemid) : $itemid;
     $db->query("DELETE FROM {$DT_PRE}banip WHERE itemid IN ({$itemids})");
     dmsg('删除成功', '?file=' . $file);
     break;
 case 'clear':
     $db->query("DELETE FROM {$DT_PRE}banip WHERE totime>0 and totime<{$DT_TIME}");
     dmsg('清空成功', '?file=' . $file);
     break;
 case 'unban':
     $ip or msg('IP不能为空');
     if (is_array($ip)) {
         foreach ($ip as $v) {
             file_del(DT_CACHE . '/ban/' . $v . '.php');
         }
     } else {
         file_del(DT_CACHE . '/ban/' . $ip . '.php');
     }
     dmsg('删除成功', '?file=' . $file . '&action=ban');
     break;
 case 'ban':
     $ips = glob(DT_CACHE . '/ban/*.php');
     $lists = array();
     if ($ips) {
         foreach ($ips as $k => $v) {
             $lists[$k]['ip'] = basename($v, '.php');
             $lists[$k]['addtime'] = timetodate(filemtime($v), 5);
         }
     }
     include tpl('banip_ban');
     break;
 default:
Ejemplo n.º 11
0
$w2 = $s2[0];
$h2 = $s2[1];
$s3 = getimagesize($img[3]);
$w3 = $s3[0];
$h3 = $s3[1];
if ($s1 && $s2 && $s3 && $w1 == 128 && $h1 == 128 && $w2 == 48 && $h2 == 48 && $w3 == 20 && $h3 == 20) {
    $md5 = md5($user['username']);
    $dir = DT_ROOT . '/file/avatar/' . substr($md5, 0, 2) . '/' . substr($md5, 2, 2) . '/_' . $user['username'];
    $img[4] = $dir . '.jpg';
    $img[5] = $dir . 'x48.jpg';
    $img[6] = $dir . 'x20.jpg';
    file_put($img[4], base64_decode($pic1));
    file_put($img[5], base64_decode($pic2));
    file_put($img[6], base64_decode($pic3));
    if ($DT['ftp_remote'] && $DT['remote_url']) {
        require DT_ROOT . '/include/ftp.class.php';
        $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
        if ($ftp->connected) {
            foreach ($img as $i) {
                $t = explode("/file/", $i);
                $ftp->dftp_put('file/' . $t[1], $t[1]);
            }
        }
    }
    echo '{"status":1}';
} else {
    file_del($img[1]);
    file_del($img[2]);
    file_del($img[3]);
    exit('{"status":3}');
}
Ejemplo n.º 12
0
     }
     dmsg('备份文件恢复失败');
     break;
 case 'download':
     if (!$fileid) {
         msg('文件名不能为空');
     }
     $file_ext = $bakid ? '.' . $bakid . '.bak' : '.css';
     file_down($skin_root . $fileid . $file_ext);
     break;
 case 'delete':
     if (!$fileid) {
         msg('文件名不能为空');
     }
     $file_ext = $bakid ? '.' . $bakid . '.bak' : '.css';
     file_del($skin_root . $fileid . $file_ext);
     dmsg('文件删除成功', $this_forward);
     break;
 default:
     $files = $skins = $baks = array();
     $files = glob($skin_root . '*.*');
     if (!$files) {
         msg('风格文件不存在,请先创建', "?file={$file}&action=add");
     }
     foreach ($files as $k => $v) {
         $filename = str_replace($skin_root, '', $v);
         if (preg_match("/^[0-9a-z_-]+\\.css\$/", $filename)) {
             $fileid = str_replace('.css', '', $filename);
             $skins[$fileid]['fileid'] = $fileid;
             $skins[$fileid]['filename'] = $filename;
             $skins[$fileid]['filesize'] = round(filesize($v) / 1024, 2);
Ejemplo n.º 13
0
function delete_upload($file, $userid)
{
    global $CFG, $DT, $DT_TIME, $ftp, $db;
    if (!defined('DT_ADMIN') && (!$userid || $userid != match_userid($file))) {
        return false;
    }
    $fileurl = $file;
    if (strpos($file, 'file/upload') === false) {
        //Remote
        if ($DT['ftp_remote'] && $DT['remote_url']) {
            if (strpos($file, $DT['remote_url']) !== false) {
                if (!is_object($ftp)) {
                    require_once DT_ROOT . '/include/ftp.class.php';
                    $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
                }
                $file = str_replace($DT['remote_url'], '', $file);
                $ftp->dftp_delete($file);
                if (strpos($file, '.thumb.') !== false) {
                    $ext = file_ext($file);
                    $F = str_replace('.thumb.' . $ext, '', $file);
                    $ftp->dftp_delete($F);
                    $F = str_replace('.thumb.' . $ext, '.middle.' . $ext, $file);
                    $ftp->dftp_delete($F);
                }
            }
        }
    } else {
        $exp = explode("file/upload/", $file);
        $file = DT_ROOT . '/file/upload/' . $exp[1];
        if (is_file($file) && strpos($exp[1], '..') === false) {
            file_del($file);
            if (strpos($file, '.thumb.') !== false) {
                $ext = file_ext($file);
                file_del(str_replace('.thumb.' . $ext, '', $file));
                file_del(str_replace('.thumb.' . $ext, '.middle.' . $ext, $file));
            }
        }
    }
    if ($DT['uploadlog']) {
        $db->query("DELETE FROM {$db->pre}upload_" . $userid % 10 . " WHERE item='" . md5($fileurl) . "'");
    }
}
Ejemplo n.º 14
0
<?php

/*
	[Destoon B2B System] Copyright (c) 2008-2013 Destoon.COM
	This is NOT a freeware, use is subject to license.txt
*/
defined('IN_DESTOON') or exit('Access Denied');
$menus = array(array('木马扫描', '?file=scan'), array('文件校验', '?file=' . $file));
$sys = array('admin', 'api', 'include', 'javascript', 'lang', 'module', 'template', 'wap');
$fbs = array('file', 'cache');
switch ($action) {
    case 'delete':
        preg_match("/^[0-9]{4}[\\-]{1}[0-9]{2}[\\-]{1}[0-9]{2}[\\s]{1}[0-9]{2}[\\.]{1}[0-9]{2}\$/", $mirror) or msg('请选择镜像文件');
        file_del(DT_ROOT . '/file/md5/' . $mirror . '.php');
        dmsg('删除成功', '?file=' . $file);
        break;
    case 'add':
        $filedir or $filedir = $sys;
        $fileext or $fileext = 'php|js|htm';
        $files = array();
        foreach (glob(DT_ROOT . '/*.*') as $f) {
            if (preg_match("/(config\\.inc\\.php|version\\.inc\\.php)\$/i", $f)) {
                continue;
            }
            if (preg_match("/\\.({$fileext})\$/i", $f)) {
                $files[] = $f;
            }
        }
        foreach ($filedir as $d) {
            $files = array_merge($files, get_file(DT_ROOT . '/' . $d, $fileext));
        }
Ejemplo n.º 15
0
 case 'template_name':
     $fileid or exit('0');
     $name or exit('0');
     $name = convert($name, 'UTF-8', DT_CHARSET);
     template_name($fileid, $name);
     exit('1');
     break;
 case 'download':
     $fileid or msg();
     $file_ext = $bakid ? '.' . $bakid . '.bak' : '.htm';
     file_down($template_root . '/' . $fileid . $file_ext);
     break;
 case 'delete':
     $fileid or msg();
     $file_ext = $bakid ? '.' . $bakid . '.bak' : '.htm';
     file_del($template_root . '/' . $fileid . $file_ext);
     if (!$bakid) {
         template_name();
     }
     dmsg('删除成功', $this_forward);
     break;
 case 'cache':
     cache_clear('php', 'dir', 'tpl');
     dmsg('更新成功', $this_forward);
     break;
 default:
     $dirs = $files = $templates = $baks = array();
     if (substr($template_root, -1) != '/') {
         $template_root .= '/';
     }
     $files = glob($template_root . '*');
Ejemplo n.º 16
0
 function delete($aid)
 {
     if (is_array($aid)) {
         foreach ($aid as $v) {
             $this->delete($v);
         }
     } else {
         $this->aid = $aid;
         $a = $this->get_one();
         $filename = ad_name($a);
         file_del(DT_CACHE . '/htm/' . $filename);
         $userid = get_user($a['username']);
         if ($a['image_src']) {
             delete_upload($a['image_src'], $userid);
         }
         if ($a['flash_src']) {
             delete_upload($a['flash_src'], $userid);
         }
         $this->db->query("DELETE FROM {$this->table} WHERE aid={$aid}");
         $this->db->query("UPDATE {$this->table_place} SET ads=ads-1 WHERE pid={$a['pid']}");
     }
 }
Ejemplo n.º 17
0
 case 'update':
     $t = $avatar ? 1 : 0;
     $db->query("UPDATE {$DT_PRE}member SET avatar={$t} WHERE userid={$_userid}");
     dheader('avatar.php?itemid=' . $DT_TIME);
     break;
 case 'delete':
     if ($avatar) {
         $img = array();
         $img[1] = useravatar($_userid, 'large', 0, 2);
         $img[2] = useravatar($_userid, '', 0, 2);
         $img[3] = useravatar($_userid, 'small', 0, 2);
         $img[4] = useravatar($_username, 'large', 1, 2);
         $img[5] = useravatar($_username, '', 1, 2);
         $img[6] = useravatar($_username, 'small', 1, 2);
         foreach ($img as $i) {
             file_del($i);
         }
         if ($DT['ftp_remote'] && $DT['remote_url']) {
             require DT_ROOT . '/include/ftp.class.php';
             $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
             if ($ftp->connected) {
                 foreach ($img as $i) {
                     $t = explode("/file/", $i);
                     $ftp->dftp_delete($t[1]);
                 }
             }
         }
     }
     $db->query("UPDATE {$DT_PRE}member SET avatar=0 WHERE userid={$_userid}");
     dmsg($L['avatar_delete'], 'avatar.php?itemid=' . $DT_TIME);
     break;
Ejemplo n.º 18
0
        dir_delete($dir);
        msg('成功添加<strong> ' . $i . ' </strong>张图片', '?moduleid=' . $moduleid . '&action=item&itemid=' . $itemid);
        break;
    case 'zip':
        $itemid or msg();
        $_FILES['uploadfile']['size'] or msg('请选择zip文件');
        require DT_ROOT . '/include/upload.class.php';
        $name = date('YmdHis') . mt_rand(10, 99) . $_userid;
        $upload = new upload($_FILES, 'file/temp/', $name . '.zip', 'zip');
        $upload->adduserid = false;
        if ($upload->save()) {
            dir_create(DT_ROOT . '/file/temp/' . $name);
            require DT_ROOT . '/admin/unzip.class.php';
            $zip = new unzip();
            $zip->extract_zip(DT_ROOT . '/file/temp/' . $name . '.zip', DT_ROOT . '/file/temp/' . $name);
            file_del(DT_ROOT . '/file/temp/' . $name . '.zip');
            if (glob(DT_ROOT . '/file/temp/' . $name . '/*.*')) {
                msg('上传并解压缩成功,正在读取..', '?moduleid=' . $moduleid . '&action=dir&name=' . $name . '&itemid=' . $itemid);
            } else {
                msg('解压缩失败,请检查目录权限');
            }
        } else {
            msg($upload->errmsg);
        }
        break;
    default:
        $lists = $do->get_list('status=3' . $condition, $dorder[$order]);
        $menuid = 1;
        include tpl('index', $module);
        break;
}
Ejemplo n.º 19
0
function cache_clear_sql($dir, $all = false)
{
    global $DT_TIME;
    if ($dir) {
        $globs = glob(DT_CACHE . '/sql/' . $dir . '/*.php');
        if ($globs) {
            foreach ($globs as $v) {
                if ($all) {
                    file_del($v);
                } else {
                    $exptime = intval(substr(file_get($v), 8, 18));
                    if ($exptime && $DT_TIME > $exptime) {
                        file_del($v);
                    }
                }
            }
        }
    } else {
        cache_clear('php', 'dir', 'sql');
    }
}
Ejemplo n.º 20
0
 /**
  * function _upload	文件上传
  * $width	最大宽度
  */
 private function _upload($width = 400)
 {
     // 更改公共配置文件
     $this->upload->upload_path = $this->upload_path;
     // 路径
     $this->upload->encrypt_name = 1;
     // 是否重命名
     $this->upload->xss_clean = TRUE;
     // 是否做xss过滤
     // 初始化$file_name
     $file_name = array();
     // 通过遍历判断是否有附件上传
     foreach ($_FILES as $k => $v) {
         // 若有附件上传
         if ($v['error'] == 0) {
             // 图片类型
             if (strpos($k, 'p') === 0) {
                 $this->upload->allowed_types = array('gif', 'jpg', 'jpeg', 'png');
                 $this->upload->max_size = 2000;
                 // 若上传成功
                 if ($this->upload->do_upload($k)) {
                     // 记录上传成功的文件名
                     $file_name[$k] = $this->upload->file_name;
                     // 若需要压缩
                     if ($this->upload->image_width > $width) {
                         $height = $this->upload->image_height * $width / $this->upload->image_width;
                         $this->_resize($this->upload, $width, $height);
                     }
                 } else {
                     // 	1、删除之前上传成功的文件
                     if (!empty($file_name)) {
                         file_del($file_name);
                     }
                     // 2、提示错误
                     jump($this->upload->display_errors('', ''));
                     exit;
                 }
             } else {
                 $this->upload->allowed_types = array('txt', 'doc', 'docx', 'xls', 'xlsx', 'hlp', 'chm', 'rar', 'zip', 'pdf', '7z');
                 $this->upload->max_size = 5000;
                 // 若上传成功
                 if ($this->upload->do_upload($k)) {
                     $file_name[$k] = $this->upload->file_name;
                 } else {
                     // 	1、删除之前上传成功的文件
                     if (!empty($file_name)) {
                         file_del($file_name);
                     }
                     // 2、提示错误
                     jump($this->upload->display_errors('', ''));
                     exit;
                 }
             }
         }
     }
     return $file_name;
 }
Ejemplo n.º 21
0
 function deluser($table, $user, $name = true, $data = false, $moduleid = 0)
 {
     global $DT_PRE, $MODULE;
     if (!$user) {
         return;
     }
     $fields = $name ? 'username' : 'userid';
     if ($data) {
         $result = $this->db->query("SELECT * FROM {$DT_PRE}{$table} WHERE `{$fields}`='{$user}'");
         while ($r = $this->db->fetch_array($result)) {
             $itemid = $r['itemid'];
             $this->db->query("DELETE FROM {$DT_PRE}{$table} WHERE itemid='{$itemid}'");
             $table_data = strpos($table, '_') === false ? $table . '_data' : str_replace('_', '_data_', $table);
             $table_data = $DT_PRE . $table_data;
             if ($moduleid) {
                 $table_data = content_table($moduleid, $itemid, is_file(DT_CACHE . '/' . $moduleid . '.part'), $table_data);
             }
             $this->db->query("DELETE FROM {$table_data} WHERE itemid='{$itemid}'");
             if ($MODULE[$moduleid]['module'] == 'sell') {
                 $this->db->query("DELETE FROM {$this->db->pre}sell_search_{$moduleid} WHERE itemid={$itemid}");
             }
             if ($moduleid && $r['linkurl'] && strpos($r['linkurl'], '://') === false && strpos($r['linkurl'], '.php') === false && strpos($r['linkurl'], 'show-') === false) {
                 $html = DT_ROOT . '/' . $MODULE[$moduleid]['moduledir'] . '/' . $r['linkurl'];
                 if (is_file($html)) {
                     file_del($html);
                 }
             }
         }
     } else {
         $this->db->query("DELETE FROM {$DT_PRE}{$table} WHERE `{$fields}`='{$user}'");
     }
 }
Ejemplo n.º 22
0
 case 'download':
     $file_ext = file_ext($filename);
     if ($file_ext != 'sql') {
         msg('只能下载SQL文件');
     }
     file_down($dir ? $D . $dir . '/' . $filename : $D . $filename);
     break;
 case 'delete':
     if (!is_array($filenames)) {
         $tmp = $filenames;
         $filenames = array();
         $filenames[0] = $tmp;
     }
     foreach ($filenames as $filename) {
         if (file_ext($filename) == 'sql') {
             file_del($dir ? $D . $dir . '/' . $filename : $D . $filename);
         } else {
             if (is_dir($D . $filename)) {
                 dir_delete($D . $filename);
             }
         }
     }
     dmsg('删除成功', $forward);
     break;
 case 'move':
     if ($submit) {
         $condition = str_replace('and', 'AND', trim($condition));
         $condition = strpos($condition, 'AND') === false ? "itemid IN ({$condition})" : substr($condition, 3);
         $condition = stripslashes($condition);
         if ($type == 1) {
             $ftb = $DT_PRE . 'sell_5';
Ejemplo n.º 23
0
                     dir_delete($sub);
                     $cd++;
                     msg('已删除 ' . $cd . ' 个目录,' . $cf . ' 个文件' . progress(0, $cd, $tt), '?action=' . $action . '&dir=' . $dir . '&cd=' . $cd . '&cf=' . $cf . '&job=' . $job . '&tt=' . $tt, 0);
                 }
             } else {
                 dir_delete(DT_CACHE . '/' . $dir);
                 msg('缓存更新成功');
             }
         } else {
             msg('目录名错误');
         }
     } else {
         $dir = $job . timetodate($DT_TIME, 'YmdHis');
         if (rename(DT_CACHE . '/' . $job, DT_CACHE . '/' . $dir)) {
             dir_create(DT_CACHE . '/' . $job);
             file_del(DT_CACHE . '/' . $dir . '/index.html');
             $dirs = glob(DT_CACHE . '/' . $dir . '/*');
             $tt = count($dirs);
             msg('正在更新,此操作可能用时较长,请不要中断..', '?action=' . $action . '&dir=' . $dir . '&job=' . $job . '&tt=' . $tt);
         } else {
             msg('更新失败');
         }
     }
     break;
 case 'html':
     cache_clear_tag(1);
     $db->expires = $CFG['db_expires'] = $CFG['tag_expires'] = 0;
     tohtml('index');
     $filename = $CFG['com_dir'] ? DT_ROOT . '/' . $DT['index'] . '.' . $DT['file_ext'] : DT_CACHE . '/index.inc.html';
     msg('首页更新成功 ' . (is_file($filename) ? dround(filesize($filename) / 1024) . 'Kb ' : '') . '&nbsp;&nbsp;<a href="' . DT_PATH . '" target="_blank">点击查看</a>');
     break;
Ejemplo n.º 24
0
     $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
     if ($ftp->connected) {
         $exp = explode("file/upload/", $saveto);
         $remote = $exp[1];
         if ($ftp->dftp_put($do->saveto, $remote)) {
             $saveto = $DT['remote_url'] . $remote;
             file_del(DT_ROOT . '/' . $do->saveto);
             if (strpos($do->saveto, '.thumb.') !== false) {
                 $local = str_replace('.thumb.' . $do->ext, '', $do->saveto);
                 $remote = str_replace('.thumb.' . $do->ext, '', $exp[1]);
                 $ftp->dftp_put($local, $remote);
                 file_del(DT_ROOT . '/' . $local);
                 $local = str_replace('.thumb.' . $do->ext, '.middle.' . $do->ext, $do->saveto);
                 $remote = str_replace('.thumb.' . $do->ext, '.middle.' . $do->ext, $exp[1]);
                 $ftp->dftp_put($local, $remote);
                 file_del(DT_ROOT . '/' . $local);
             }
         }
     }
 }
 $fid = isset($fid) ? $fid : '';
 if (isset($old) && $old && in_array($from, array('thumb', 'photo'))) {
     delete_upload($old, $_userid);
 }
 $_SESSION['uploads'][] = $swfupload ? str_replace('.thumb.' . $do->ext, '', $saveto) : $saveto;
 if ($DT['uploadlog']) {
     $db->query("INSERT INTO {$upload_table} (item,fileurl,filesize,fileext,upfrom,width,height,moduleid,username,ip,addtime,itemid) VALUES ('" . md5($saveto) . "','{$saveto}','{$do->file_size}','{$do->ext}','{$from}','{$img_w}','{$img_h}','{$moduleid}','{$_username}','{$DT_IP}','{$do->uptime}','{$itemid}')");
 }
 if ($swfupload) {
     exit('FILEID:' . $saveto);
 }
Ejemplo n.º 25
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
if (!$MOD['baidunews']) {
    file_del(DT_ROOT . '/baidunews.xml');
    return false;
}
$news = array();
foreach ($MODULE as $m) {
    if ($m['module'] == 'article') {
        $news[] = $m;
    }
}
$mods_num = count($news);
if ($mods_num < 1) {
    return false;
}
if ($MOD['baidunews_items'] > 100) {
    $MOD['baidunews_items'] = 100;
}
$news_num = intval($MOD['baidunews_items'] / $mods_num);
if ($news_num < 1) {
    return false;
}
$data = '<?xml version="1.0" encoding="' . DT_CHARSET . '"?>';
$data .= '<document>';
$data .= '<webSite>' . DT_PATH . '</webSite>';
$data .= '<webMaster>' . $MOD['baidunews_email'] . '</webMaster>';
$data .= '<updatePeri>' . $MOD['baidunews_update'] . '</updatePeri>';
foreach ($news as $v) {
    $mid = $v['moduleid'];
Ejemplo n.º 26
0
         $zip->extract_zip(DT_ROOT . '/file/temp/' . $name . '.zip', DT_ROOT . '/file/temp/' . $name);
         file_del(DT_ROOT . '/file/temp/' . $name . '.zip');
         $F = get_file(DT_ROOT . '/file/temp/' . $name);
         if ($F) {
             $htm = '';
             $max = 0;
             foreach ($F as $f) {
                 $ext = file_ext($f);
                 if (in_array($ext, array('htm', 'html'))) {
                     $tmp = filesize($f);
                     if ($tmp > $max) {
                         $htm = str_replace(DT_ROOT . '/file/temp/', '', $f);
                     }
                     $max = $tmp;
                 } else {
                     in_array($ext, array('jpg', 'jpeg', 'gif', 'png', 'bmp')) or file_del($f);
                 }
             }
             if ($htm) {
                 dalert('', '', 'parent.Upsuccess("' . $htm . '");');
             } else {
                 dalert('系统未在压缩包内找到HTM文件');
             }
         } else {
             dalert('解压缩失败,请检查目录权限');
         }
     } else {
         dalert($upload->errmsg);
     }
     break;
 case 'read':
Ejemplo n.º 27
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
$filename = DT_CACHE . '/htm/company.htm';
if (!$MOD['index_html']) {
    if (is_file($filename)) {
        file_del($filename);
    }
    return false;
}
if ($DT['rewrite']) {
    defined('DT_REWRITE') or define('DT_REWRITE', true);
    $_SERVER["SCRIPT_NAME"] = 'index.php';
    $_SERVER['QUERY_STRING'] = '';
}
$GLOBALS['DT_URL'] = $DT_URL = 'index.php';
$seo_file = 'index';
include DT_ROOT . '/include/seo.inc.php';
$destoon_task = "moduleid={$moduleid}&html=index";
if ($page == 1) {
    $head_canonical = $MOD['linkurl'];
}
if ($EXT['mobile_enable']) {
    $head_mobile = $EXT['mobile_url'] . mobileurl($moduleid, 0, 0, $page);
}
ob_start();
include template('index', $module);
$data = ob_get_contents();
ob_clean();
file_put($filename, $data);
return true;
Ejemplo n.º 28
0
 function rm($key)
 {
     is_md5($key) or $key = md5($this->pre . $key);
     return file_del(DT_CACHE . '/php/' . substr($key, 0, 2) . '/' . $key . '.php');
 }
Ejemplo n.º 29
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
$F = glob(DT_ROOT . '/file/temp/*');
if ($F) {
    foreach ($F as $k => $v) {
        if (is_dir($v)) {
            dir_delete($v);
        } else {
            if (basename($v) == 'index.html') {
                continue;
            }
            file_del($v);
        }
    }
}