예제 #1
0
파일: files.app.php 프로젝트: sunhk25/iCMS
 function do_download()
 {
     iFS::$userid = false;
     $rs = iFS::getFileData('id', $this->id);
     iFS::$redirect = true;
     $FileRootPath = iFS::fp($rs->filepath, "+iPATH");
     iFS::check_ext($rs->filepath, true) or iPHP::alert('文件类型不合法!');
     iFS::$userid = iMember::$userid;
     $fileresults = iFS::remote($rs->ofilename);
     if ($fileresults) {
         iFS::mkdir(dirname($FileRootPath));
         iFS::write($FileRootPath, $fileresults);
         iFS::$watermark = !isset($_GET['unwatermark']);
         iFS::watermark($rs->ext, $FileRootPath);
         iFS::yun_write($FileRootPath);
         $_FileSize = strlen($fileresults);
         if ($_FileSize != $rs->size) {
             iDB::query("update `#iCMS@__filedata` SET `size`='{$_FileSize}' WHERE `id` = '{$this->id}'");
         }
         iPHP::success("{$rs->ofilename} <br />重新下载到<br /> {$rs->filepath} <br />完成", 'js:1', 3);
     } else {
         iPHP::alert("下载远程文件失败!", 'js:1', 3);
     }
 }
예제 #2
0
 function article_data($bodyArray, $aid = 0, $haspic = 0)
 {
     $id = (int) $_POST['adid'];
     $subtitle = iS::escapeStr($_POST['subtitle']);
     $body = implode('#--iCMS.PageBreak--#', $bodyArray);
     $body = preg_replace(array('/<script.+?<\\/script>/is', '/<form.+?<\\/form>/is'), '', $body);
     isset($_POST['dellink']) && ($body = preg_replace("/<a[^>].*?>(.*?)<\\/a>/si", "\\1", $body));
     iCMS::$config['publish']['autoformat'] && ($body = autoformat($body));
     articleTable::$ID = $aid;
     $fields = articleTable::data_fields($id);
     $data = compact($fields);
     if ($id) {
         articleTable::data_update($data, compact('id'));
     } else {
         $id = articleTable::data_insert($data);
     }
     if ($this->callback['data']) {
         $DCB = $this->callback['data'];
         $handler = $DCB[0];
         $params = (array) $DCB[1];
         if (is_callable($handler)) {
             call_user_func_array($handler, $params);
         }
     }
     $_POST['isredirect'] && (iFS::$redirect = true);
     $_POST['iswatermark'] && (iFS::$watermark = false);
     if (isset($_POST['remote'])) {
         $body = $this->remotepic($body, true, $aid);
         $body = $this->remotepic($body, true, $aid);
         $body = $this->remotepic($body, true, $aid);
         if ($body && $id) {
             articleTable::data_update(array('body' => $body), compact('id'));
         }
     }
     if (isset($_POST['autopic']) && empty($haspic)) {
         $picurl = $this->remotepic($body, 'autopic', $aid);
         $this->pic($picurl, $aid);
     }
     $this->pic_indexid($body, $aid);
 }
예제 #3
0
파일: article.app.php 프로젝트: Junred/iCMS
 function body($body, $subtitle, $aid = 0, $id = 0, &$haspic = 0)
 {
     $body = preg_replace(array('/<script.+?<\\/script>/is', '/<form.+?<\\/form>/is'), '', $body);
     isset($_POST['dellink']) && ($body = preg_replace("/<a[^>].*?>(.*?)<\\/a>/si", "\\1", $body));
     if (isset($_POST['markdown'])) {
         $body = '#--iCMS.Markdown--#' . $body;
     } else {
         iCMS::$config['publish']['autoformat'] && ($body = addslashes(autoformat($body)));
     }
     articleTable::$ID = $aid;
     $fields = articleTable::data_fields($id);
     $data = compact($fields);
     if ($id) {
         articleTable::data_update($data, compact('id'));
     } else {
         $id = articleTable::data_insert($data);
     }
     $_POST['isredirect'] && (iFS::$redirect = true);
     $_POST['iswatermark'] && (iFS::$watermark = false);
     if (isset($_POST['remote'])) {
         $body = $this->remotepic($body, true, $aid);
         $body = $this->remotepic($body, true, $aid);
         $body = $this->remotepic($body, true, $aid);
         if ($body && $id) {
             articleTable::data_update(array('body' => $body), compact('id'));
         }
     }
     if (isset($_POST['autopic']) && empty($haspic)) {
         if ($picurl = $this->remotepic($body, 'autopic', $aid)) {
             $this->pic($picurl, $aid);
             $haspic = true;
         }
     }
     $this->pic_indexid($body, $aid);
 }