private function __action_profile_avatar() { iFS::$watermark = false; iFS::$checkFileData = false; $dir = get_user_dir(user::$userid); $F = iFS::upload('upfile', $dir, user::$userid, 'jpg'); if (empty($F)) { if ($_POST['format'] == 'json') { iPHP::code(0, 'user:iCMS:error', 0, 'json'); } else { iPHP::js_callback(array("code" => 0)); } } $url = iFS::fp($F['path'], '+http'); if ($_POST['format'] == 'json') { iPHP::code(1, 'user:profile:avatar', $url, 'json'); } $array = array("code" => $F["code"], "value" => $F["path"], "url" => $url, "fid" => $F["fid"], "fileType" => $F["ext"], "image" => in_array($F["ext"], array('gif', 'jpg', 'jpeg', 'png')) ? 1 : 0, "original" => $F["oname"], "state" => $F['code'] ? 'SUCCESS' : $F['state']); iPHP::js_callback($array); }
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); } }
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); }
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); }