Example #1
0
 public function remoteinstall()
 {
     //安全验证 $this->checksafeauth();
     $url = $this->_get('url');
     $ext = strtolower(strrchr($url, '.'));
     $filepath = ltrim(strrchr($url, '/'), '/');
     if ($ext != '.zip') {
         //兼容旧版本
         $url = xbase64_decode($url);
         $ext = strtolower(strrchr($url, '.'));
         $filepath = ltrim(strrchr($url, '/'), '/');
         if ($ext != '.zip') {
             $this->error('远程文件格式必须为.zip');
         }
     }
     $content = fopen_url($url);
     if (empty($content)) {
         $this->error('远程获取文件失败!');
     }
     $filename = substr($filepath, 0, -4);
     File::write_file($filepath, $content);
     import('ORG.PclZip');
     $zip = new PclZip($filepath);
     $zip->extract(PCLZIP_OPT_PATH, './');
     @unlink($filepath);
     //删除安装文件
     $this->success('操作成功!', U('App/index'));
 }
Example #2
0
 static function remotedownload()
 {
     import('ORG.File');
     import('ORG.PclZip');
     $url = "http://oss.aliyuncs.com/waikucms/htaccess.zip";
     File::write_file('htaccess.zip', fopen_url($url));
     $zip = new PclZip('htaccess.zip');
     $zip->extract(PCLZIP_OPT_PATH, './');
     @unlink('htaccess.zip');
     return 1;
 }
Example #3
0
    private function parsefieldsetmode($tag, $mode, $display = false)
    {
        $tagvar = '';
        if ($tag['group'] == $mode) {
            if ($tag['tag'] == 'input') {
                $tag['value'] = $display == true ? "<field name='{$tag['name']}' prefix='addonlist'/>" : $tag['value'];
                $tagvar = "<input type='{$tag['type']}' group='{$mode}' name='{$tag['name']}' id='{$tag['id']}' size='{$tag['size']}'  style='{$tag['style']}' value='{$tag['value']}' {$tag['extend']}/>";
            } elseif ($tag['tag'] == 'inserturl') {
                $tag['value'] = $display == true ? "<field name='{$tag['name']}' prefix='addonlist'/>" : $tag['value'];
                $tagvar = "<input type='{$tag['type']}' group='{$mode}' name='{$tag['name']}' id='{$tag['id']}' size='{$tag['size']}'  style='{$tag['style']}' value='{$tag['value']}' {$tag['extend']}/>";
                $tagvar .= <<<DATA
\t\t\t\t<script>
\t\t\t\tKindEditor.ready(function(K){
\t\t\t\tK('#{$tag['id']}').click(function() {
\t\t\t\tif(K('#{$tag['id']}').val() ==''){url ='http://';}else{url=K('#{$tag['id']}').val();} 
\t\t\t\t\t\$.dialog.prompt('请输入网址', function (val) {
\t\t\tif(val =='' || val=='http://'){K('#{$tag['id']}').val('http://');}else{K('#{$tag['id']}').val(val);}
}, url);});
\t\t\t\t});
\t\t\t\t</script>
DATA;
            } elseif ($tag['tag'] == 'insertfile') {
                $tag['value'] = $display == true ? "<field name='{$tag['name']}' prefix='addonlist'/>" : $tag['value'];
                $tagvar = "<input type='{$tag['type']}' group='{$mode}' name='{$tag['name']}' id='{$tag['id']}' size='{$tag['size']}'  style='{$tag['style']}' value='{$tag['value']}' {$tag['extend']}/>";
                $tagvar .= <<<DATA
\t\t\t\t<script>
\t\t\t\tKindEditor.ready(function(K) {
\t\t\t\tK('#{$tag['id']}').click(function() {
\t\t\t\t\tvar editor = K.editor({
\t\t\t\t\tallowFileManager : false,
\t\t\t\t\tkeepOriginName : false,
\t\t\t\t\tuserAllowUpload:true,
\t\t\t\t\tremoveTitle:true
\t\t\t\t});
\t\t\t\t\teditor.loadPlugin('insertfile', function() {
\t\t\t\t\t\teditor.plugin.fileDialog({
\t\t\t\t\t\t\tfileUrl : K('#{$tag['id']}').val(),
\t\t\t\t\t\t\tclickFn : function(url, title) {
\t\t\t\t\t\t\t\tK('#{$tag['id']}').val(url);
\t\t\t\t\t\t\t\teditor.hideDialog();
\t\t\t\t\t\t\t}
\t\t\t\t\t\t});
\t\t\t\t\t});
\t\t\t\t});
\t\t\t});
\t\t\t\t</script>
DATA;
            } elseif ($tag['tag'] == 'insertpic') {
                $tag['value'] = $display == true ? "<field name='{$tag['name']}' prefix='addonlist'/>" : '';
                $tagvar = "<input type='{$tag['type']}' group='{$mode}' name='{$tag['name']}' id='{$tag['id']}' size='{$tag['size']}'  style='{$tag['style']}' value='{$tag['value']}' {$tag['extend']}/>";
                $tagvar .= <<<DATA
\t\t\t\t<script>
\t\t\t\tKindEditor.ready(function(K) {
\t\t\t\tK('#{$tag['id']}').click(function() {
\t\t\t\t\tvar editor = K.editor({
\t\t\t\t\tallowFileManager : false,
\t\t\t\t\tallowImageUpload : true,
\t\t\t\t\tuserAllowUpload : true,
\t\t\t\t\tremoveSize:true,
\t\t\t\t\tremoveAlign:true,
\t\t\t\t\tresizeWidth:true,
\t\t\t\t\tresizeHeight:true,
\t\t\t\t\tremoveTitle:true
\t\t\t\t});
\t\t\t\t\teditor.loadPlugin('image', function() {
\t\t\t\t\t\teditor.plugin.imageDialog({
\t\t\t\t\t\t\timageUrl : K('#{$tag['id']}').val(),
\t\t\t\t\t\t\tclickFn : function(url, title, width, height, border, align) {
\t\t\t\t\t\t\t\t\tK('#{$tag['id']}').val(url);
\t\t\t\t\t\t\t\t\teditor.hideDialog();
\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t});
\t\t\t\t\t\t
\t\t\t\t\t});
\t\t\t\t});
\t\t\t});
\t\t\t\t</script>
DATA;
            } elseif ($tag['tag'] == 'checkbox') {
                $values = explode(",", $tag['value']);
                foreach ($values as $k => $v) {
                    $value_set = $display == true ? "<field name='{$tag['name']}' prefix='addonlist' function=\"in_array('{$k}',explode(',',@me))?'checked':''\"/>" : '';
                    $tagvar .= $v . "<input name='{$tag['name']}-{$k}' group='{$mode}' type='checkbox' class='noborder' id='{$tag['name']}-{$k}' value='{$k}' style='{$tag['style']}' {$tag['extend']} {$value_set}/>";
                }
            } elseif ($tag['tag'] == 'textarea') {
                $tag['value'] = $display == true ? "<field name='{$tag['name']}' prefix='addonlist'/>" : $tag['value'];
                $tagvar = "<textarea name='{$tag['name']}' group='{$mode}'  id='{$tag['id']}' cols='60' rows='60' style='{$tag['style']}' {$tag['extend']} >{$tag['value']}</textarea>";
            } elseif ($tag['tag'] == 'editor') {
                $tag['value'] = $display == true ? "<field name='{$tag['name']}' prefix='addonlist'/>" : $tag['value'];
                $tagvar .= "<script charset='utf-8' src='" . __ROOT__ . "/Public/Editor/kindeditor/editor.php?theme={$tag['theme']}&fm={$tag['fm']}&id={$tag['id']}'></script>";
                $tagvar .= "<textarea name='{$tag['name']}' id='{$tag['id']}' group='{$mode}' cols='60' rows='60' style='{$tag['style']}' {$tag['extend']}>{$tag['value']}</textarea>";
            } elseif ($tag['tag'] == 'radio') {
                $values = explode(",", $tag['value']);
                foreach ($values as $k => $v) {
                    $value_set = $display == true ? "<field name='{$tag['name']}' prefix='addonlist' function=\"@me=='{$k}'?'checked':''\"/>" : '';
                    if (!$display && $k == 0) {
                        $value_set = 'checked';
                    }
                    $tagvar .= $v . "<input name='{$tag['name']}' group='{$mode}' type='radio' class='noborder' id='{$tag['name']}-{$k}' value='{$k}' style='{$tag['style']}' {$tag['extend']} {$value_set}/>";
                }
            } elseif ($tag['tag'] == 'select') {
                $tagvar .= "<select name='{$tag['name']}' group='{$mode}' style='{$tag['style']}' {$tag['extend']}>";
                $values = explode(",", $tag['value']);
                foreach ($values as $k => $v) {
                    $value_set = $display == true ? "<field name='{$tag['name']}' prefix='addonlist' function=\"@me=='{$k}'?'selected=selected':''\"/>" : '';
                    $tagvar .= "<option value='{$k}'{$value_set}>{$v}</option>";
                }
                $tagvar .= "</select>";
            }
            if ($display && !empty($tag['editsrc'])) {
                $editcontent = substr($tag['editsrc'], 0, 1) == '.' ? File::read_file($tag['editsrc']) : fopen_url($tag['editsrc']);
                if ($tag['srcdisplayed'] == 1) {
                    $editcontent = $this->fetch('', $editcontent . ' ');
                }
                $tagvar .= $editcontent;
            }
            if (!$display && !empty($tag['addsrc'])) {
                $content = substr($tag['addsrc'], 0, 1) == '.' ? File::read_file($tag['addsrc']) : fopen_url($tag['addsrc']);
                if ($tag['srcdisplayed'] == 1) {
                    $content = $this->fetch('', $content . ' ');
                }
                $tagvar .= $content;
            }
            return $tagvar;
        }
    }
 public function remoteinstall()
 {
     $url = $this->_get('url');
     if ($ext != '.zip') {
         //兼容旧版本
         $url = xbase64_decode($url);
         $ext = strtolower(strrchr($url, '.'));
         $filepath = ltrim(strrchr($url, '/'), '/');
         if ($ext != '.zip') {
             $this->error('远程文件格式必须为.zip');
         }
     }
     $content = fopen_url($url);
     if (empty($content)) {
         $this->assign('waitSecond', 20);
         $this->error('远程获取文件失败!,<a href="' . $url . '" target="_blank">本地下载安装</a>');
     }
     $filename = substr($filepath, 0, -4);
     //检测是否已经安装
     $model = M('arcmodel');
     $id = $model->order('id desc')->getField('id') + 1;
     if ($model->where("nid='" . $filename . "'")->find()) {
         $this->error('系统已安装当前模型!');
     }
     //获取数据并解压缩
     $tplpath = './Public/Model/' . $filename;
     File::write_file($filepath, $content);
     import('ORG.PclZip');
     $zip = new PclZip($filepath);
     $zip->extract(PCLZIP_OPT_PATH, $tplpath);
     //删除压缩包
     @unlink($filepath);
     //导入数据
     $sqlfile = $tplpath . '/data.sql';
     if (is_file($sqlfile)) {
         $sql = explode('###', strtr(File::read_file($sqlfile), array('#@__' => C('DB_PREFIX'), '__LINE__' => $id)));
         foreach ($sql as $v) {
             $model->execute(trim($v));
         }
     }
     //刷新缓存
     jump(U('Arcmodel/over'));
 }
Example #5
0
 public function remoteinstall()
 {
     //安全验证 $this->checksafeauth();
     $url = $this->_get('url');
     $ext = strtolower(strrchr($url, '.'));
     $filepath = ltrim(strrchr($url, '/'), '/');
     if ($ext != '.zip') {
         //兼容旧版本
         $url = xbase64_decode($url);
         $ext = strtolower(strrchr($url, '.'));
         $filepath = ltrim(strrchr($url, '/'), '/');
         if ($ext != '.zip') {
             $this->error('远程文件格式必须为.zip');
         }
     }
     $content = fopen_url($url);
     if (empty($content)) {
         $this->assign('waitSecond', 20);
         $this->error('远程获取文件失败!,<a href="' . $url . '" target="_blank">本地下载安装</a>');
     }
     $filename = substr($filepath, 0, -4);
     $tplpath = './Public/Wap/' . $filename;
     if (is_dir($tplpath)) {
         $this->error('模板目录已存在!');
     }
     File::write_file($filepath, $content);
     import('ORG.PclZip');
     $zip = new PclZip($filepath);
     $zip->extract(PCLZIP_OPT_PATH, $tplpath);
     @unlink($filepath);
     //删除安装文件
     $this->success('操作成功!', U('Wap/index'));
 }
}
if (!$title || !$excerpt || !$url || !$blog_name) {
    showxml('参数不正确');
} elseif (substr($url, 0, 7) != 'http://') {
    showxml('参数不正确');
}
// 检查Spam
// 定义发送来的此条Trackback初始分数
$point = 0;
$options['tb_spam_level'] = in_array($options['tb_spam_level'], array('strong', 'weak', 'never')) ? $options['tb_spam_level'] : 'weak';
if ($options['audit_trackback']) {
    //如果人工审核
    $visible = '0';
} elseif ($options['tb_spam_level'] != 'never') {
    $source_content = '';
    $source_content = fopen_url($url);
    $this_server = str_replace(array('www.', 'http://'), '', $_SERVER['HTTP_HOST']);
    //获取接受来的url原代码和本服务器的hostname
    if (empty($source_content)) {
        //没有获得原代码就-1分
        $point -= 1;
    } else {
        if (strpos(strtolower($source_content), strtolower($this_server)) !== FALSE) {
            //对比链接,如果原代码中包含本站的hostname就+1分,这个未必成立
            $point += 1;
        }
        if (strpos(strtolower($source_content), strtolower($title)) !== FALSE) {
            //对比标题,如果原代码中包含发送来的title就+1分,这个基本可以成立
            $point += 1;
        }
        if (strpos(strtolower($source_content), strtolower($excerpt)) !== FALSE) {
Example #7
0
 public function remoteinstall()
 {
     //安全验证 $this->checksafeauth();
     $url = $this->_get('url');
     $ext = strtolower(strrchr($url, '.'));
     $filepath = ltrim(strrchr($url, '/'), '/');
     if ($ext != '.zip') {
         //兼容旧版本
         $url = xbase64_decode($url);
         $ext = strtolower(strrchr($url, '.'));
         $filepath = ltrim(strrchr($url, '/'), '/');
         if ($ext != '.zip') {
             $this->error('远程文件格式必须为.zip');
         }
     }
     $content = fopen_url($url);
     if (empty($content)) {
         $this->assign('waitSecond', 20);
         $this->error('远程获取文件失败!,<a href="' . $url . '" target="_blank">本地下载安装</a>');
     }
     $filename = substr($filepath, 0, -4);
     $tplpath = './Public/Special/' . $filename;
     if (is_dir($tplpath)) {
         $this->error('专题目录已存在!');
     }
     File::write_file($filepath, $content);
     import('ORG.PclZip');
     $zip = new PclZip($filepath);
     $zip->extract(PCLZIP_OPT_PATH, $tplpath);
     @unlink($filepath);
     //删除安装文件
     //导入数据
     $xmlpath = './Public/Special/' . $filename . '/special.xml';
     if (is_file($xmlpath)) {
         $xml = simplexml_load_file($xmlpath);
         $data['title'] = (string) $xml->title;
         $data['seotitle'] = (string) $xml->seotitle;
         $data['keywords'] = (string) $xml->keywords;
         $data['description'] = (string) $xml->description;
         $data['content'] = (string) $xml->content;
         $data['tempindex'] = (string) $xml->tempindex;
         $data['waptempindex'] = (string) $xml->waptempindex;
         $data['pubdate'] = time();
         $model = M('special');
         $model->add($data);
     }
     $this->success('操作成功!', U('Special/index'));
 }
Example #8
0
 public function update()
 {
     $date = date('YmdHis');
     $logcontent = '歪酷CMS在线更新日志###';
     $logcontent .= '更新时间:' . date('Y-m-d H:i:s') . '###';
     $logcontent .= '系统原始版本:' . C('SOFT_VERSION') . '###';
     $backupall = isset($_GET['backupall']) ? $_GET['backupall'] : 0;
     $backupsql = isset($_GET['backupsql']) ? $_GET['backupsql'] : 0;
     $logcontent .= '正在执行系统版本检测...###';
     G('run1');
     $msg = fopen_url('http://cloud.waikucms.net/update.php?version=' . substr(C('SOFT_VERSION'), -8));
     $msg = $msg != 0 && $msg != 1 ? 2 : $msg;
     //$msg=1;
     if ($msg == 0) {
         $this->error('当前系统已经是最新版!');
     }
     $nowversion = fopen_url('http://cloud.waikucms.net/update.php?fullversion=1');
     if ($msg == 2) {
         $this->error('更新检测失败!');
     }
     $updateurl = fopen_url('http://cloud.waikucms.net/update.php?updateurl=1');
     $logcontent .= '系统更新版本:' . $nowversion . '###';
     $logcontent .= '系统版本检测完毕,区间耗时:' . G('run1', 'end1') . 's' . '###';
     //清理缓存
     $logcontent .= '清理系统缓存...###';
     G('run2');
     $this->clear();
     $logcontent .= '清理系统缓存完毕!,区间耗时:' . G('run2', 'end2') . 's' . ' ###';
     import('ORG.PclZip');
     File::mk_dir('./_update');
     File::mk_dir('./_update/' . $date);
     if ($backupall == 1) {
         //备份整站
         $logcontent .= '开始备份整站内容...###';
         G('run3');
         $backupallurl = './_update/' . $date . '/backupall.zip';
         $zip = new PclZip($backupallurl);
         $zip->create('Public/Config,Admin,User,Web,Core,index.php,admin.php,user.php');
         $logcontent .= '成功完成整站数据备份,备份文件路径:<a href=\'' . __ROOT__ . ltrim($backupallurl, '.') . '\'>' . $backupallurl . '</a>, 区间耗时:' . G('run3', 'end3') . 's' . ' ###';
     }
     if ($backupsql == 1) {
         //备份数据库
         $logcontent .= '准备执行数据库备份...###';
         G('run4');
         $backupsqlurl = $this->backupsql($date);
         $logcontent .= '成功完成系统数据库备份,备份文件路径:' . $backupsqlurl . ', 区间耗时:' . G('run4', 'end4') . 's' . ' ###';
     }
     //获取更新包
     $logcontent .= '开始获取远程更新包...###';
     G('run5');
     $updatedzipurl = './_update/' . $date . '/update.zip';
     File::write_file($updatedzipurl, fopen_url($updateurl));
     $logcontent .= '获取远程更新包成功,更新包路径:<a href=\'' . __ROOT__ . ltrim($updatedzipurl, '.') . '\'>' . $updatedzipurl . '</a>' . '区间耗时:' . G('run5', 'end5') . 's' . '###';
     //解压缩更新包
     $logcontent .= '更新包解压缩...###';
     G('run6');
     $zip = new PclZip($updatedzipurl);
     $zip->extract(PCLZIP_OPT_PATH, './');
     $logcontent .= '更新包解压缩成功...' . '区间耗时:' . G('run6', 'end6') . 's' . '###';
     //更新数据库
     $updatesqlurl = './update.sql';
     if (is_file($updatesqlurl)) {
         $logcontent .= '更新数据库开始...###';
         G('run7');
         if (file_exists($updatesqlurl)) {
             $rs = new Model();
             $sql = File::read_file($updatesqlurl);
             $sql = str_replace("\r\n", "\n", $sql);
             foreach (explode(";\n", trim($sql)) as $query) {
                 $rs->query(trim($query));
             }
         }
         unlink($updatesqlurl);
         $logcontent .= '更新数据库完毕...' . '区间耗时:' . G('run7', 'end7') . 's' . '###';
     }
     //系统版本号更新
     G('run8');
     $config = File::read_file('./Public/Config/config.ini.php');
     $config = str_replace(C('SOFT_VERSION'), $nowversion, $config);
     File::write_file('./Public/Config/config.ini.php', $config);
     $logcontent .= '更新系统版本号,记录更新日志,日志文件路径:<a href=\'' . __ROOT__ . '/_update/' . $date . '/log.txt\'>./_update/' . $date . '/log.txt</a>,';
     $logcontent .= '区间耗时:' . G('run8', 'end8') . 's';
     //beta 20130221 to 20120226 临时更新设置,下次更新则省略这段代码
     if (!strpos($config, 'SOFT_VERIFY')) {
         $config = str_replace("'DEFAULT_CHARSET'=>'utf8',", "'DEFAULT_CHARSET'=>'utf8','SOFT_VERIFY'=>0,", $config);
         File::write_file('./Public/Config/config.ini.php', $config);
     }
     //记录更新日志
     File::write_file('./_update/' . $date . '/log.txt', $logcontent);
     //清空cookie
     cookie('updatenotice', null);
     //跳转到更新展示页面
     $this->success('更新完毕!', U('Update/over?date=' . $date));
 }
Example #9
0
function remote(&$content, $one = false)
{
    global $DreamCMS, $title;
    $content = stripslashes($content);
    $img = array();
    preg_match_all("/(src|SRC)=[\"|'| ]{0,}(http:\\/\\/(.*)\\.(gif|jpg|jpeg|bmp|png))/isU", $content, $img);
    $_array = array_unique($img[2]);
    foreach ($_array as $_k => $imgurl) {
        if (strstr(strtolower($imgurl), $DreamCMS->config['url'])) {
            unset($_array[$_k]);
        }
    }
    set_time_limit(0);
    $UploadDir = $DreamCMS->config['uploadfiledir'] . "/";
    $RelativePath = $DreamCMS->dir . $UploadDir;
    //相对路径
    $RootPath = DCPATH . $UploadDir;
    //绝对路径
    switch ($DreamCMS->config['savedir']) {
        case "0":
            $_CreateDir = "";
            break;
            //全部保存在一起
        //全部保存在一起
        case 'ym':
            $_CreateDir = _getdate("Ym") . "/";
            break;
            //按年月
        //按年月
        case 'ymd':
            $_CreateDir = _getdate("Ymd") . "/";
            break;
            //按年月日
        //按年月日
        case 'ext':
            $_CreateDir = $FileExt . "/";
            break;
            //按文件类型
    }
    $RelativePath = $RelativePath . $_CreateDir;
    $RootPath = $RootPath . $_CreateDir;
    $milliSecond = 'remote_' . _getdate("YmdHis") . rand(1, 99999);
    createdir($RootPath);
    foreach ($_array as $key => $value) {
        $value = trim($value);
        preg_match("/\\.([a-zA-Z0-9]{2,4})\$/", $value, $exts);
        $FileExt = strtolower($exts[1]);
        //&#316;&#701;
        CheckValidExt($FileExt);
        //判断文件类型
        //过滤文件;
        strstr($FileExt, 'ph') && ($FileExt = "phpfile");
        in_array($FileExt, array('cer', 'htr', 'cdx', 'asa', 'asp', 'jsp', 'aspx', 'cgi')) && ($FileExt .= "file");
        $sFileName = $milliSecond . $key . "." . $FileExt;
        $RootPath_FileName = $RootPath . $sFileName;
        $RelativePath_FileName = $RelativePath . $sFileName;
        $get_file = fopen_url($value);
        $get_file && writefile($RootPath_FileName, $get_file);
        if (in_array($FileExt, array('gif', 'jpg', 'png')) && $DreamCMS->config['isthumb'] && ($DreamCMS->config['thumbwidth'] || $DreamCMS->config['thumbhight'])) {
            list($width, $height, $imagetype) = GetImageSize($RootPath_FileName);
            if ($width > $DreamCMS->config['thumbwidth'] || $height > $DreamCMS->config['thumbhight']) {
                createdir($RootPath . "thumb");
            }
            $Thumbnail = MakeThumbnail($RootPath, $RootPath_FileName, $milliSecond . $key);
            if (!empty($Thumbnail['filepath'])) {
                $SmallImagePath_FileName = str_replace($RootPath, $RelativePath, $Thumbnail['filepath']);
                imageWaterMark($Thumbnail['filepath']);
            }
            imageWaterMark($RootPath_FileName);
        } else {
            $SmallImagePathFile = '';
        }
        $_FileSize = @filesize($RootPath_FileName);
        $RelativePath_FileName = str_replace($DreamCMS->dir . $UploadDir, $UploadDir, $RelativePath_FileName);
        $SmallImagePath_FileName = str_replace($DreamCMS->dir . $UploadDir, $UploadDir, $SmallImagePath_FileName);
        $DreamCMS->db->query("INSERT INTO `#DC@__file` (`filename`,`ofilename`,`path`,`thumbpath`,`intro`,`ext`,`size` ,`time`,`type`) VALUES ('{$sFileName}', '{$value}', '{$RelativePath_FileName}','{$SmallImagePath_FileName}', '{$title}', '{$FileExt}', '{$_FileSize}', '" . time() . "', 'remote') ");
        $content = str_replace($value, $DreamCMS->dir . $RelativePath_FileName, $content);
        if ($one && $key == 0) {
            break;
        }
    }
    $content = add_magic_quotes($content);
}
Example #10
0
     $catalog = $iCMS->db->getRow("SELECT * FROM `#iCMS@__catalog` WHERE id='{$cid}'");
     $rs = $iCMS->db->getRow("SELECT * FROM `#iCMS@__page` WHERE cid='{$cid}'");
     if (empty($rs)) {
         $rs->createtime = $rs->updatetime = time();
         $rs->creater = $rs->updater = $administrator;
         $rs->body = '';
     }
     $rs->createtime = get_date($rs->createtime, 'Y-m-d H:i:s');
     $rs->updatetime = get_date($rs->updatetime, 'Y-m-d H:i:s');
     include iCMS_admincp_tpl("file.page");
     break;
 case 'delete':
     deletefile((int) $_GET['fid']) && _header();
     break;
 case 'reremote':
     $get_file = fopen_url(urldecode($_GET['url']));
     $path = urldecode($_GET['path']);
     writefile(iPATH . $path, $get_file);
     redirect("下载完成!", $_SERVER['HTTP_REFERER']);
     break;
 case 'reupload':
     $fid = (int) $_GET['fid'];
     $rs = $iCMS->db->getRow("SELECT * FROM `#iCMS@__file` WHERE `id`='{$fid}' LIMIT 1");
     $path = str_replace($rs->filename, '', $rs->path);
     include iCMS_admincp_tpl("file.reupload");
     break;
 case 'swfupload':
     $F = uploadfile("Filedata");
     echo '<div><ul><li>文件:' . $F["OriginalFileName"] . '上传成功!</li><li>路径:' . $F["FilePath"] . '</ul></div>';
     break;
 case 'upload':
Example #11
0
}
if (replace_filter($excerpt) || replace_filter($title) || replace_filter($blog_name)) {
    tb_xml_error("The trackback content contains some words that are not welcomed on our site. You may edit your post and send it again. Sorry for the inconvenience.");
}
$trytb = $DMF->numRows($DMF->query("SELECT * FROM " . $DBPrefix . "trackbacks WHERE ip='" . getip() . "' AND postTime+30>='" . time() . "'"));
if ($trytb > 0) {
    tb_xml_error("Error.");
}
$spam = $settingInfo['isTbApp'];
// 1为开启审核
if ($spam == 0 or strpos($url, ";" . $settingInfo['ttSiteList']) >= 1) {
    $isApp = 1;
} else {
    $isApp = 0;
}
@fopen_url($url);
$sql = "INSERT INTO " . $DBPrefix . "trackbacks (logId,tbTitle,blogSite,blogUrl,content,postTime,ip,isApp) VALUES ('{$tid}',\"{$title}\",\"{$blog_name}\",\"{$url}\",\"{$excerpt}\"," . time() . ",'" . getip() . "','{$isApp}')";
$DMF->query($sql);
if ($isApp == 1) {
    add_bloginfo("tbNums", "adding", 1);
    $DMF->query("UPDATE " . $DBPrefix . "logs SET quoteNums=quoteNums+1 WHERE id='{$tid}'");
    settings_recache();
}
tb_xml_success();
function tb_xml_error($error)
{
    header("Content-type:application/xml");
    echo "<?xml version=\"1.0\" ?>";
    print "<response><error>1</error><message>{$error}</message></response>";
    exit;
}
Example #12
0
function app_cache($cmspath)
{
    fopen_url($cmspath . '/index.php');
    fopen_url($cmspath . '/admin.php');
    fopen_url($cmspath . '/user.php');
    File::del_dir('../Web/Runtime');
    File::del_dir('../Admin/Runtime');
    File::del_dir('../User/Runtime');
}