function do_save() { $id = (int) $_POST['id']; $cid = (int) $_POST['cid']; $pid = (int) $_POST['pid']; $name = iS::escapeStr($_POST['name']); $key = iS::escapeStr($_POST['key']); $data = $_POST['data']; $status = (int) $_POST['status']; $name or iPHP::alert('标记名称不能为空!'); // $key OR iPHP::alert('标记key值不能为空!'); $key or $key = pinyin($name); $fields = array('cid', 'pid', 'name', 'key', 'data', 'status'); $data = compact($fields); if ($id) { iDB::update('marker', $data, array('id' => $id)); $msg = "标记更新完成!"; } else { iDB::value("SELECT `id` FROM `#iCMS@__marker` where `key` ='{$key}'") && iPHP::alert('该标记已经存在!请另选一个'); $id = iDB::insert('marker', $data); $msg = "新标记添加完成!"; } $this->cache($id); iPHP::success($msg, 'url:' . APP_URI); }
function do_save() { $pid = (int) $_POST['pid']; $cid = (int) $_POST['cid']; $ordernum = (int) $_POST['ordernum']; $field = iS::escapeStr($_POST['field']); $name = iS::escapeStr($_POST['name']); $type = iS::escapeStr($_POST['type']); $val = iS::escapeStr($_POST['val']); $field == 'pid' && !is_numeric($val) && iPHP::alert('pid字段的值只能用数字'); $field or iPHP::alert('属性字段不能为空!'); $name or iPHP::alert('属性名称不能为空!'); $type or iPHP::alert('类型不能为空!'); $field == 'pid' && ($val = (int) $val); $fields = array('rootid', 'cid', 'field', 'type', 'ordernum', 'name', 'val'); $data = compact($fields); if ($pid) { iDB::update('prop', $data, array('pid' => $pid)); $msg = "属性更新完成!"; } else { iDB::value("SELECT `pid` FROM `#iCMS@__prop` where `type` ='{$type}' AND `val` ='{$val}' AND `field` ='{$field}' AND `cid` ='{$cid}'") && iPHP::alert('该类型属性值已经存在!请另选一个'); iDB::insert('prop', $data); $msg = "新属性添加完成!"; } $this->cache(); iPHP::success($msg, 'url:' . APP_URI); }
public static function send($a = array("send_uid" => 0, "send_name" => NULL, "receiv_uid" => 0, "receiv_name" => NULL, "content" => NULL), $type = 1) { // $userid = (int)$a['userid']; // $friend = (int)$a['friend']; $send_uid = (int) $a['send_uid']; $send_name = iS::escapeStr($a['send_name']); $receiv_uid = (int) $a['receiv_uid']; $receiv_name = iS::escapeStr($a['receiv_name']); $content = iS::escapeStr($a['content']); $sendtime = time(); if ($send_uid && $send_uid == $receiv_uid && !$a['self']) { return; } $fields = array('userid', 'friend', 'send_uid', 'send_name', 'receiv_uid', 'receiv_name', 'content', 'type', 'sendtime', 'readtime', 'status'); $data = compact($fields); $data['userid'] = $send_uid; $data['friend'] = $receiv_uid; $data['readtime'] = "0"; $data['status'] = "1"; iDB::insert('message', $data); if ($type == "1") { $data['userid'] = $receiv_uid; $data['friend'] = $send_uid; iDB::insert('message', $data); } }
public function do_iCMS($a = null) { if ($_GET['name']) { $name = $_GET['name']; $encode = mb_detect_encoding($name, array("ASCII", "UTF-8", "GB2312", "GBK", "BIG5")); if (strtoupper($encode) != 'UTF-8') { if (function_exists('iconv')) { $name = iconv($encode, 'UTF-8//IGNORE', $name); } elseif (function_exists('mb_convert_encoding')) { $name = mb_convert_encoding($name, 'UTF-8//IGNORE', $encode); } } $val = iS::escapeStr($name); $field = 'name'; } elseif ($_GET['tkey']) { $field = 'tkey'; $val = iS::escapeStr($_GET['tkey']); } elseif ($_GET['id']) { $field = 'id'; $val = (int) $_GET['id']; } else { iPHP::throw404('标签请求出错', 30001); } return $this->tag($val, $field); }
public static function check_seccode() { if ($_POST['username'] && $_POST['password']) { $seccode = iS::escapeStr($_POST['iACP_seccode']); iPHP::seccode($seccode, true, 'iACP_seccode') or iPHP::code(0, 'iCMS:seccode:error', 'seccode', 'json'); } }
public function do_iCMS($tpl = 'index') { $cid = (int) $_GET['cid']; $dir = iS::escapeStr($_GET['dir']); if (empty($cid) && $dir) { $cid = iCache::get('iCMS/category/dir2cid', $dir); $cid or iPHP::throw404('运行出错!找不到该栏目<b>dir:' . $dir . '</b> 请更新栏目缓存或者确认栏目是否存在', 20002); } return $this->category($cid, $tpl); }
function do_save() { $disable = explode("\n", iS::escapeStr($_POST['disable'])); $filter = explode("\n", iS::escapeStr($_POST['filter'])); foreach ($filter as $k => $val) { $filterArray[$k] = explode("=", $val); } $this->setting->set($filterArray, 'word.filter', 0, true); $this->setting->set($disable, 'word.disable', 0, true); iPHP::success('更新完成'); }
public function category($id, $tpl = 'index') { $category = iCache::get('iCMS/category/' . $id); if (empty($category) && $tpl) { iPHP::throw404('运行出错!找不到该栏目<b>cid:' . $id . '</b> 请更新栏目缓存或者确认栏目是否存在', 20001); } if ($category['status'] == 0) { return false; } $iurl = iURL::get('category', $category); if ($tpl) { if (iPHP::$iTPL_MODE == "html" && (strstr($category['contentRule'], '{PHP}') || $category['outurl'] || empty($category['mode']))) { return false; } $category['url'] && iPHP::gotourl($category['url']); $category['mode'] == '1' && iCMS::gotohtml($iurl->path, $iurl->href); } $category['iurl'] = (array) $iurl; $category['subid'] = iCache::get('iCMS/category/rootid', $id); $category['subids'] = implode(',', (array) $category['subid']); $category = array_merge($category, $this->get_lite($category)); if ($category['hasbody']) { $category['body'] = iCache::get('iCMS/category/' . $category['cid'] . '.body'); $category['body'] && ($category['body'] = stripslashes($category['body'])); } $category['appid'] = iCMS_APP_CATEGORY; $category['param'] = array("appid" => $category['appid'], "iid" => $category['cid'], "cid" => $category['rootid'], "suid" => $category['userid'], "title" => $category['name'], "url" => $category['url']); if ($tpl) { $category['mode'] && iCMS::set_html_url($iurl); iCMS::hooks('enable_comment', true); iPHP::assign('category', $category); if (isset($_GET['tpl'])) { $tpl = iS::escapeStr($_GET['tpl']); if (strpos($tpl, '..') !== false) { exit('what the f**k!!'); } else { $tpl = $tpl . '.htm'; } } if (strpos($tpl, '.htm') !== false) { return iPHP::view($tpl, 'category'); } $GLOBALS['page'] > 1 && ($tpl = 'list'); $html = iPHP::view($category[$tpl . 'TPL'], 'category.' . $tpl); if (iPHP::$iTPL_MODE == "html") { return array($html, $category); } } else { return $category; } }
function do_save() { $uid = (int) $_POST['uid']; $gender = (int) $_POST['gender']; $type = $_POST['type']; $username = iS::escapeStr($_POST['uname']); $nickname = iS::escapeStr($_POST['nickname']); $realname = iS::escapeStr($_POST['realname']); $power = $_POST['power'] ? json_encode($_POST['power']) : ''; $cpower = $_POST['cpower'] ? json_encode($_POST['cpower']) : ''; $gid = 0; $info = array(); $info['icq'] = iS::escapeStr($_POST['icq']); $info['home'] = iS::escapeStr($_POST['home']); $info['year'] = intval($_POST['year']); $info['month'] = intval($_POST['month']); $info['day'] = intval($_POST['day']); $info['from'] = iS::escapeStr($_POST['from']); $info['signature'] = iS::escapeStr($_POST['signature']); $info = addslashes(serialize($info)); $_POST['pwd'] && ($password = md5($_POST['pwd'])); $username or iPHP::alert('账号不能为空'); if (iACP::is_superadmin()) { $gid = (int) $_POST['gid']; } else { isset($_POST['gid']) && iPHP::alert('您没有权限更改角色'); } $fields = array('gid', 'gender', 'username', 'nickname', 'realname', 'power', 'cpower', 'info'); $data = compact($fields); if (empty($uid)) { iDB::value("SELECT `uid` FROM `#iCMS@__members` where `username` ='{$username}' LIMIT 1") && iPHP::alert('该账号已经存在'); $_data = compact(array('password', 'regtime', 'lastip', 'lastlogintime', 'logintimes', 'post', 'type', 'status')); $_data['regtime'] = time(); $_data['lastip'] = iPHP::getIp(); $_data['lastlogintime'] = time(); $_data['status'] = '1'; $data = array_merge($data, $_data); iDB::insert('members', $data); $msg = "账号添加完成!"; } else { iDB::value("SELECT `uid` FROM `#iCMS@__members` where `username` ='{$username}' AND `uid` !='{$uid}' LIMIT 1") && iPHP::alert('该账号已经存在'); iDB::update('members', $data, array('uid' => $uid)); $password && iDB::query("UPDATE `#iCMS@__members` SET `password`='{$password}' WHERE `uid` ='" . $uid . "'"); $msg = "账号修改完成!"; } iPHP::success($msg, 'url:' . APP_URI); }
public static function run($app = NULL, $do = NULL, $args = NULL, $prefix = "do_") { //empty($app) && $app = $_GET['app']; //单一入口 if (empty($app)) { $fi = iFS::name(__SELF__); $app = $fi['name']; } if (!in_array($app, self::$apps) && iPHP_DEBUG) { iPHP::throw404('运行出错!找不到应用程序: <b>' . $app . '</b>', '0001'); } self::$app_path = iPHP_APP_DIR . '/' . $app; self::$app_file = self::$app_path . '/' . $app . '.app.php'; is_file(self::$app_file) or iPHP::throw404('运行出错!找不到文件: <b>' . $app . '.app.php</b>', '0002'); if ($do === NULL) { $do = iPHP_APP; $_GET['do'] && ($do = iS::escapeStr($_GET['do'])); } if ($_POST['action']) { $do = iS::escapeStr($_POST['action']); $prefix = 'ACTION_'; } self::$app_name = $app; self::$app_do = $do; self::$app_method = $prefix . $do; self::$app_tpl = iPHP_APP_DIR . '/' . $app . '/template'; self::$app_vars = array("MOBILE" => iPHP::$mobile, 'COOKIE_PRE' => iPHP_COOKIE_PRE, 'REFER' => __REF__, 'CONFIG' => self::$config, "APP" => array('NAME' => self::$app_name, 'DO' => self::$app_do, 'METHOD' => self::$app_method)); iPHP::$iTPL->_iTPL_VARS['SAPI'] .= self::$app_name; iPHP::$iTPL->_iTPL_VARS += self::$app_vars; self::$app = iPHP::app($app); if (self::$app_do && self::$app->methods) { in_array(self::$app_do, self::$app->methods) or iPHP::throw404('运行出错! <b>' . self::$app_name . '</b> 类中找不到方法定义: <b>' . self::$app_method . '</b>', '0003'); $method = self::$app_method; $args === null && ($args = self::$app_args); if ($args) { if ($args === 'object') { return self::$app; } return call_user_func_array(array(self::$app, $method), (array) $args); } else { method_exists(self::$app, self::$app_method) or iPHP::throw404('运行出错! <b>' . self::$app_name . '</b> 类中 <b>' . self::$app_method . '</b> 方法不存在', '0004'); return self::$app->{$method}(); } } else { iPHP::throw404('运行出错! <b>' . self::$app_name . '</b> 类中 <b>' . self::$app_method . '</b> 方法不存在', '0005'); } }
function do_save() { $gid = intval($_POST['gid']); $type = intval($_POST['type']); $name = iS::escapeStr($_POST['name']); $power = $_POST['power'] ? json_encode($_POST['power']) : ''; $cpower = $_POST['cpower'] ? json_encode($_POST['cpower']) : ''; $name or iPHP::alert('角色名不能为空'); $fields = array('name', 'ordernum', 'power', 'cpower', 'type'); $data = compact($fields); if ($gid) { iDB::update('group', $data, array('gid' => $gid)); $msg = "角色修改完成!"; } else { iDB::insert('group', $data); $msg = "角色添加完成!"; } iPHP::success($msg, 'url:' . APP_URI); }
public static function checkLogin() { // self::$LOGIN_COUNT = (int)authcode(get_cookie('iCMS_LOGIN_COUNT'),'DECODE'); // if(self::$LOGIN_COUNT>iCMS_LOGIN_COUNT) exit(); $a = iS::escapeStr($_POST['username']); $p = iS::escapeStr($_POST['password']); $ip = iPHP::getIp(); $sep = iPHP_AUTH_IP ? '#=iCMS[' . $ip . ']=#' : '#=iCMS=#'; if (empty($a) && empty($p)) { $auth = iPHP::get_cookie(self::$AUTH); list($a, $p) = explode($sep, authcode($auth, 'DECODE')); return self::check($a, $p); } else { $p = md5($p); $crs = self::check($a, $p); iDB::query("UPDATE `#iCMS@__members` SET `lastip`='" . $ip . "',`lastlogintime`='" . time() . "',`logintimes`=logintimes+1 WHERE `uid`='" . self::$userid . "'"); iPHP::set_cookie(self::$AUTH, authcode($a . $sep . $p, 'ENCODE')); self::$AJAX && iPHP::json(array('code' => 1)); return $crs; } }
public function search($tpl = false) { $q = htmlspecialchars(rawurldecode($_GET['q'])); $encode = mb_detect_encoding($q, array("ASCII", "UTF-8", "GB2312", "GBK", "BIG5")); if (strtoupper($encode) != 'UTF-8') { if (function_exists('iconv')) { $q = iconv($encode, 'UTF-8//IGNORE', $q); } elseif (function_exists('mb_convert_encoding')) { $q = mb_convert_encoding($q, 'UTF-8//IGNORE', $encode); } } $q = iS::escapeStr($q); //empty($q) && iPHP::throw404('应用程序运行出错.亲!搜点什么吧!!', 60001); $fwd = iCMS::filter($q); $fwd && iPHP::throw404('非法搜索词!', 60002); $search['title'] = stripslashes($q); $search['keyword'] = $q; $tpl === false && ($tpl = '{iTPL}/search.htm'); $q && $this->slog($q); iPHP::assign("search", $search); return iPHP::view($tpl, 'search'); }
function do_save() { $id = (int) $_POST['id']; $keyword = iS::escapeStr($_POST['keyword']); $url = iS::escapeStr($_POST['url']); $times = (int) $_POST['times']; $keyword or iPHP::alert('关键词不能为空!'); $url or iPHP::alert('链接不能为空!'); $fields = array('keyword', 'url', 'times'); $data = compact($fields); if (empty($id)) { iDB::value("SELECT `id` FROM `#iCMS@__keywords` where `keyword` ='{$keyword}'") && iPHP::alert('该关键词已经存在!'); iDB::insert('keywords', $data); $this->cache(); $msg = "关键词添加完成!"; } else { iDB::value("SELECT `id` FROM `#iCMS@__keywords` where `keyword` ='{$keyword}' AND `id` !='{$id}'") && iPHP::alert('该关键词已经存在!'); iDB::update('keywords', $data, array('id' => $id)); $this->cache(); $msg = "关键词编辑完成!"; } iPHP::success($msg, 'url:' . APP_URI); }
function do_save() { $id = (int) $_POST['id']; $cid = (int) $_POST['cid']; $name = iS::escapeStr($_POST['name']); $logo = iS::escapeStr($_POST['logo']); $url = iS::escapeStr($_POST['url']); $desc = iS::escapeStr($_POST['desc']); $ordernum = (int) $_POST['ordernum']; $name or iPHP::alert('网站不能为空!'); $url or iPHP::alert('链接不能为空!'); $fields = array('cid', 'name', 'logo', 'url', 'desc', 'ordernum'); $data = compact($fields); if (empty($id)) { iDB::value("SELECT `id` FROM `#iCMS@__links` where `name` ='{$name}'") && iPHP::alert('该网站已经存在!'); iDB::insert('links', $data); $msg = "网站添加完成!"; } else { iDB::value("SELECT `id` FROM `#iCMS@__links` where `name` ='{$name}' AND `id` !='{$id}'") && iPHP::alert('该网站已经存在!'); iDB::update('links', $data, array('id' => $id)); $msg = "网站编辑完成!"; } iPHP::success($msg, 'url:' . APP_URI); }
public static function publish($work = null) { $_POST = spiderData::crawl(); if (spider::$work == 'shell') { if (empty($_POST['title'])) { echo "标题不能为空\n"; return false; } if (empty($_POST['body'])) { echo "内容不能为空\n"; return false; } } $checker = spider::checker($work, spider::$pid, $_POST['reurl'], $_POST['title']); if ($checker !== true) { return $checker; } $project = spider::project(spider::$pid); if (!isset($_POST['cid'])) { $_POST['cid'] = $project['cid']; } $postArgs = spider::postArgs($project['poid']); if ($_GET['indexid']) { $aid = (int) $_GET['indexid']; $_POST['aid'] = $aid; $_POST['adid'] = iDB::value("SELECT `id` FROM `#iCMS@__article_data` WHERE aid='{$aid}'"); } $title = iS::escapeStr($_POST['title']); $url = iS::escapeStr($_POST['reurl']); $hash = md5($url); if (empty(spider::$sid)) { $spider_url = iDB::row("SELECT `id`,`publish`,`indexid` FROM `#iCMS@__spider_url` where `url`='{$url}'", ARRAY_A); if (empty($spider_url)) { $spider_url_data = array('cid' => $project['cid'], 'rid' => spider::$rid, 'pid' => spider::$pid, 'title' => addslashes($title), 'url' => $url, 'hash' => $hash, 'status' => '1', 'addtime' => time(), 'publish' => '0', 'indexid' => '0', 'pubdate' => ''); $suid = iDB::insert('spider_url', $spider_url_data); } else { if ($spider_url['indexid']) { $_POST['aid'] = $spider_url['indexid']; $_POST['adid'] = iDB::value("SELECT `id` FROM `#iCMS@__article_data` WHERE aid='" . $spider_url['indexid'] . "'"); } $suid = $spider_url['id']; } } else { $suid = spider::$sid; } if (spider::$callback['post'] && is_callable(spider::$callback['post'])) { $_POST = call_user_func_array(spider::$callback['post'], array($_POST)); } iS::slashes($_POST); $app = iACP::app($postArgs->app); $fun = $postArgs->fun; $app->callback['code'] = '1001'; /** * 主表 回调 更新关联ID */ $app->callback['primary'] = array(array('spider', 'update_spider_url_indexid'), array('suid' => $suid)); /** * 数据表 回调 成功发布 */ $app->callback['data'] = array(array('spider', 'update_spider_url_publish'), array('suid' => $suid)); $callback = $app->{$fun}(); if ($callback['code'] == $app->callback['code']) { if (spider::$sid) { $work === NULL && iPHP::success("发布成功!", 'js:1'); } else { $work === NULL && iPHP::success("发布成功!", 'js:parent.$("#' . $hash . '").remove();'); } } if ($work == "shell" || $work == "WEB@AUTO") { $callback['work'] = $work; return $callback; } }
public static function API($app = NULL, $do = NULL) { $app or $app = iS::escapeStr($_GET['app']); return self::run($app, null, null, 'API_'); }
/** * 字符转换 * @param $string * @return string */ public static function escapeStr($string) { if (is_array($string)) { foreach ($string as $key => $val) { $string[$key] = iS::escapeStr($val); } } else { $string = str_replace(array('%00', '\\0'), '', $string); //modified@2010-7-5 $string = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $string); $string = preg_replace('/&((#(\\d{3,5}|x[a-fA-F0-9]{4})|[a-zA-Z][a-z0-9]{2,5});)/', '&\\1', $string); } return $string; }
function do_batch() { $_POST['id'] or iPHP::alert("请选择要操作的" . $this->category_name); $id_array = (array) $_POST['id']; $ids = implode(',', $id_array); $batch = $_POST['batch']; switch ($batch) { case 'move': $tocid = (int) $_POST['tocid']; $key = array_search($tocid, $id_array); if ($tocid) { unset($id_array[$key]); } //清除同ID foreach ($id_array as $k => $cid) { iDB::query("UPDATE `#iCMS@__category` SET `rootid` ='{$tocid}' WHERE `cid` ='{$cid}'"); } $this->cache(true, $this->appid); iPHP::success('更新完成!', 'js:1'); break; case 'merge': $tocid = (int) $_POST['tocid']; $key = array_search($tocid, $id_array); unset($id_array[$key]); //清除同ID foreach ($id_array as $k => $cid) { $this->mergecontent($tocid, $cid); $this->do_del($cid, false); } $this->update_count($tocid); $this->cache(true, $this->appid); iPHP::success('更新完成!', 'js:1'); break; case 'name': foreach ($id_array as $k => $cid) { $name = iS::escapeStr($_POST['name'][$cid]); iDB::query("UPDATE `#iCMS@__category` SET `name` = '{$name}' WHERE `cid` ='" . (int) $cid . "' LIMIT 1"); $this->cahce_one($cid); } iPHP::success('更新完成!', 'js:1'); break; case 'status': $val = (int) $_POST['status']; $sql = "`status` = '{$val}'"; break; case 'mode': $val = (int) $_POST['mode']; $sql = "`mode` = '{$val}'"; break; case 'categoryRule': $val = iS::escapeStr($_POST['categoryRule']); $sql = "`categoryRule` = '{$val}'"; break; case 'contentRule': $val = iS::escapeStr($_POST['contentRule']); $sql = "`contentRule` = '{$val}'"; break; case 'urlRule': $val = iS::escapeStr($_POST['urlRule']); $sql = "`urlRule` = '{$val}'"; break; case 'indexTPL': $val = iS::escapeStr($_POST['indexTPL']); $sql = "`indexTPL` = '{$val}'"; break; case 'listTPL': $val = iS::escapeStr($_POST['listTPL']); $sql = "`listTPL` = '{$val}'"; break; case 'contentTPL': $val = iS::escapeStr($_POST['contentTPL']); $sql = "`contentTPL` = '{$val}'"; break; case 'recount': foreach ($id_array as $k => $cid) { $this->update_count($cid); } iPHP::success('操作成功!', 'js:1'); break; case 'dels': iPHP::$break = false; foreach ($id_array as $cid) { iACP::CP($cid, 'd', 'alert'); $this->do_del($cid, false); $this->cahce_one($cid); } iPHP::$break = true; iPHP::success('全部删除完成!', 'js:1'); break; } $sql && iDB::query("UPDATE `#iCMS@__category` SET {$sql} WHERE `cid` IN ({$ids})"); $this->cache(true, $this->appid); iPHP::success('操作成功!', 'js:1'); }
function getpic($path) { $uri = parse_url(iCMS_FS_URL); $pic = iS::escapeStr($path); if (stripos($pic, $uri['host']) === false) { stripos($pic, 'http://') === false or $pic = iFS::http($pic); } else { $pic = iFS::fp($pic, "-http"); } return $pic; }
function do_saveproject() { $id = (int) $_POST['id']; $name = iS::escapeStr($_POST['name']); $urls = iS::escapeStr($_POST['urls']); $list_url = $_POST['list_url']; $cid = iS::escapeStr($_POST['cid']); $rid = iS::escapeStr($_POST['rid']); $poid = iS::escapeStr($_POST['poid']); $poid = iS::escapeStr($_POST['poid']); $checker = iS::escapeStr($_POST['checker']); $self = isset($_POST['self']) ? '1' : '0'; $sleep = (int) $_POST['sleep']; $auto = iS::escapeStr($_POST['auto']); $psleep = (int) $_POST['psleep']; $lastupdate = $_POST['lastupdate'] ? iPHP::str2time($_POST['lastupdate']) : ''; empty($name) && iPHP::alert('名称不能为空!'); empty($cid) && iPHP::alert('请选择绑定的栏目'); empty($rid) && iPHP::alert('请选择采集规则'); //empty($poid) && iPHP::alert('请选择发布规则'); $fields = array('name', 'urls', 'list_url', 'cid', 'rid', 'poid', 'checker', 'self', 'sleep', 'auto', 'lastupdate', 'psleep'); $data = compact($fields); if ($id) { iDB::update('spider_project', $data, array('id' => $id)); } else { iDB::insert('spider_project', $data); } iPHP::success('完成', 'url:' . APP_URI . '&do=project'); }
public function do_clink($a = null) { $clink = iS::escapeStr($_GET['clink']); $id = iDB::value("SELECT `id` FROM `#iCMS@__article` WHERE `clink`='" . $clink . "' AND `status` ='1';"); return $this->article((int) $id, isset($_GET['p']) ? (int) $_GET['p'] : 1); }
/** * 抓取资源 * @param [string] $html [抓取结果] * @param [array] $data [数据项] * @param [array] $rule [规则] * @param [array] $responses [已经抓取资源] * @return [array] [返回处理结果] */ public static function crawl($html, $data, $rule, $responses) { if (trim($data['rule']) === '') { return; } $name = $data['name']; if (spider::$dataTest) { print_r('<b>[' . $name . ']规则:</b>' . iS::escapeStr($data['rule'])); echo "<hr />"; } if (strpos($data['rule'], 'RULE@') !== false) { spider::$rid = str_replace('RULE@', '', $data['rule']); $_urls = trim($html); if (spider::$dataTest) { print_r('<b>使用[rid:' . spider::$rid . ']规则抓取</b>:' . $_urls); echo "<hr />"; } return spiderUrls::crawl('DATA@RULE', false, spider::$rid, $_urls); } /** * RAND@10,0 * 返回随机数 */ if (strpos($data['rule'], 'RAND@') !== false) { $random = str_replace('RAND@', '', $data['rule']); list($length, $numeric) = explode(',', $random); return random($length, empty($numeric) ? 0 : 1); } $contentArray = array(); $contentHash = array(); $_content = null; $_content = spiderContent::match($html, $data, $rule); $cmd5 = md5($_content); $contentArray[] = $_content; $contentHash[$cmd5] = true; if ($data['page']) { if (empty($rule['page_url'])) { $rule['page_url'] = $rule['list_url']; } if (empty(spider::$allHtml)) { $page_url_array = array(); $page_area_rule = trim($rule['page_area_rule']); if ($page_area_rule) { if (strpos($page_area_rule, 'DOM::') !== false) { iPHP::import(iPHP_LIB . '/phpQuery.php'); $doc = phpQuery::newDocumentHTML($html, 'UTF-8'); $pq_dom = str_replace('DOM::', '', $page_area_rule); $pq_array = phpQuery::pq($pq_dom); foreach ($pq_array as $pn => $pq_val) { $href = phpQuery::pq($pq_val)->attr('href'); if ($href) { if ($rule['page_url_rule']) { if (strpos($rule['page_url_rule'], '<%') !== false) { $page_url_rule = spiderTools::pregTag($rule['page_url_rule']); if (!preg_match('|' . $page_url_rule . '|is', $href)) { continue; } } else { $cleanhref = spiderTools::dataClean($rule['page_url_rule'], $href); if ($cleanhref) { $href = $cleanhref; unset($cleanhref); } else { continue; } } } $href = str_replace('<%url%>', $href, $rule['page_url']); $page_url_array[$pn] = spiderTools::url_complement($rule['__url__'], $href); } } phpQuery::unloadDocuments($doc->getDocumentID()); } else { $page_area_rule = spiderTools::pregTag($page_area_rule); if ($page_area_rule) { preg_match('|' . $page_area_rule . '|is', $html, $matches, $PREG_SET_ORDER); $page_area = $matches['content']; } else { $page_area = $html; } if ($rule['page_url_rule']) { $page_url_rule = spiderTools::pregTag($rule['page_url_rule']); preg_match_all('|' . $page_url_rule . '|is', $page_area, $page_url_matches, PREG_SET_ORDER); foreach ($page_url_matches as $pn => $row) { $href = str_replace('<%url%>', $row['url'], $rule['page_url']); $page_url_array[$pn] = spiderTools::url_complement($rule['__url__'], $href); gc_collect_cycles(); } } unset($page_area); } } else { // 逻辑方式 if ($rule['page_url_parse'] == '<%url%>') { $page_url = str_replace('<%url%>', $rule['__url__'], $rule['page_url']); } else { $page_url_rule = spiderTools::pregTag($rule['page_url_parse']); preg_match('|' . $page_url_rule . '|is', $rule['__url__'], $matches, $PREG_SET_ORDER); $page_url = str_replace('<%url%>', $matches['url'], $rule['page_url']); } if (stripos($page_url, '<%step%>') !== false) { for ($pn = $rule['page_no_start']; $pn <= $rule['page_no_end']; $pn = $pn + $rule['page_no_step']) { $page_url_array[$pn] = str_replace('<%step%>', $pn, $page_url); gc_collect_cycles(); } } } //URL去重清理 if ($page_url_array) { $page_url_array = array_filter($page_url_array); $page_url_array = array_unique($page_url_array); $puk = array_search($rule['__url__'], $page_url_array); if ($puk !== false) { unset($page_url_array[$puk]); } } if (spider::$dataTest) { echo "<b>内容页网址:</b>" . $rule['__url__'] . "<br />"; echo "<b>分页:</b>" . $rule['page_url'] . "<br />"; echo iS::escapeStr($page_url_rule); echo "<hr />"; } if (spider::$dataTest) { echo "<b>分页列表:</b><pre>"; print_r($page_url_array); echo "</pre><hr />"; } spider::$content_right_code = trim($rule['page_url_right']); spider::$content_error_code = trim($rule['page_url_error']); spider::$curl_proxy = $rule['proxy']; $pageurl = array(); foreach ($page_url_array as $pukey => $purl) { //usleep(100); $phtml = spiderTools::remote($purl); if (empty($phtml)) { break; } $md5 = md5($phtml); if ($pageurl[$md5]) { break; } $check_content = spiderTools::check_content_code($phtml); if ($check_content === false) { unset($check_content, $phtml); break; } $_content = spiderContent::match($phtml, $data, $rule); $cmd5 = md5($_content); if ($contentHash[$cmd5]) { break; } $contentArray[] = $_content; $contentHash[$cmd5] = true; $pageurl[$md5] = $purl; spider::$allHtml[$md5] = $phtml; } gc_collect_cycles(); unset($check_content, $phtml); if (spider::$dataTest) { echo "<b>最终分页列表:</b><pre>"; print_r($pageurl); echo "</pre><hr />"; } } else { foreach ((array) spider::$allHtml as $ahkey => $phtml) { $contentArray[] = spiderContent::match($phtml, $data, $rule); } } } $content = implode('#--iCMS.PageBreak--#', $contentArray); $html = null; unset($html, $contentArray, $contentHash, $_content); $content = stripslashes($content); if (spider::$dataTest) { print_r('<b>[' . $name . ']匹配结果:</b>' . htmlspecialchars($content)); echo "<hr />"; } if ($data['cleanbefor']) { $content = spiderTools::dataClean($data['cleanbefor'], $content); } /** * 在数据项里调用之前采集的数据[DATA@name][DATA@name.key] */ if (strpos($content, '[DATA@') !== false) { $content = spiderTools::getDATA($responses, $content); } if ($data['cleanhtml']) { $content = stripslashes($content); $content = preg_replace('/<[\\/\\!]*?[^<>]*?>/is', '', $content); } if ($data['format'] && $content) { $content = autoformat($content); } if ($data['img_absolute'] && $content) { // $content = stripslashes($content); preg_match_all("/<img.*?src\\s*=[\"|'](.*?)[\"|']/is", $content, $img_match); if ($img_match[1]) { $_img_array = array_unique($img_match[1]); $_img_urls = array(); foreach ((array) $_img_array as $_img_key => $_img_src) { $_img_urls[$_img_key] = spiderTools::url_complement($rule['__url__'], $_img_src); } $content = str_replace($_img_array, $_img_urls, $content); } unset($img_match, $_img_array, $_img_urls, $_img_src); } if ($data['trim']) { $content = trim($content); } if ($data['capture']) { // $content = stripslashes($content); $content = spiderTools::remote($content); } if ($data['download']) { // $content = stripslashes($content); $content = iFS::http($content); } if ($data['cleanafter']) { $content = spiderTools::dataClean($data['cleanafter'], $content); // $content = stripslashes($content); } if ($data['autobreakpage']) { $content = spiderTools::autoBreakPage($content); } if ($data['mergepage']) { $content = spiderTools::mergePage($content); } if ($data['empty'] && empty($content)) { $emptyMsg = '[' . $name . ']规则设置了不允许为空.当前抓取结果为空!请检查,规则是否正确!'; if (spider::$dataTest) { exit('<h1>' . $emptyMsg . '</h1>'); } if (spider::$work) { echo "\n{$emptyMsg}\n"; return false; } else { iPHP::alert($emptyMsg); } } if ($data['json_decode']) { $content = json_decode($content, true); } if ($data['array']) { return (array) $content; } if (spider::$callback['content'] && is_callable(spider::$callback['content'])) { $content = call_user_func_array(spider::$callback['content'], array($content)); } return $content; }
function do_batch() { $idArray = (array) $_POST['id']; $idArray or iPHP::alert("请选择要操作的标签"); $ids = implode(',', $idArray); $batch = $_POST['batch']; switch ($batch) { case 'dels': iPHP::$break = false; foreach ($idArray as $id) { $this->do_del($id, false); } iPHP::$break = true; iPHP::success('标签全部删除完成!', 'js:1'); break; case 'move': $_POST['cid'] or iPHP::alert("请选择目标栏目!"); iPHP::import(iPHP_APP_CORE . '/iMAP.class.php'); map::init('category', $this->appid); $cid = (int) $_POST['cid']; foreach ($idArray as $id) { $_cid = iDB::value("SELECT `cid` FROM `#iCMS@__tags` where `id` ='{$id}'"); iDB::update("tags", compact('cid'), compact('id')); if ($_cid != $cid) { map::diff($cid, $_cid, $id); $this->categoryApp->update_count_one($_cid, '-'); $this->categoryApp->update_count_one($cid); } } iPHP::success('成功移动到目标栏目!', 'js:1'); break; case 'mvtcid': $_POST['tcid'] or iPHP::alert("请选择目标分类!"); iPHP::import(iPHP_APP_CORE . '/iMAP.class.php'); map::init('category', $this->appid); $tcid = (int) $_POST['tcid']; foreach ($idArray as $id) { $_tcid = iDB::value("SELECT `tcid` FROM `#iCMS@__tags` where `id` ='{$id}'"); iDB::update("tags", compact('tcid'), compact('id')); if ($_tcid != $tcid) { map::diff($tcid, $_tcid, $id); $this->categoryApp->update_count_one($_tcid, '-'); $this->categoryApp->update_count_one($tcid); } } iPHP::success('成功移动到目标分类!', 'js:1'); break; case 'prop': iPHP::import(iPHP_APP_CORE . '/iMAP.class.php'); map::init('prop', $this->appid); $pid = implode(',', (array) $_POST['pid']); foreach ((array) $_POST['id'] as $id) { $_pid = iDB::value("SELECT pid FROM `#iCMS@__tags` WHERE `id`='{$id}'"); iDB::update("tags", compact('pid'), compact('id')); map::diff($pid, $_pid, $id); } iPHP::success('属性设置完成!', 'js:1'); break; case 'weight': $weight = _int($_POST['mweight']); $sql = "`weight` = '{$weight}'"; break; case 'tpl': $tpl = iS::escapeStr($_POST['mtpl']); $sql = "`tpl` = '{$tpl}'"; break; case 'keyword': if ($_POST['pattern'] == 'replace') { $sql = "`keywords` = '" . iS::escapeStr($_POST['mkeyword']) . "'"; } elseif ($_POST['pattern'] == 'addto') { foreach ($idArray as $id) { $keywords = iDB::value("SELECT keywords FROM `#iCMS@__tags` WHERE `id`='{$id}'"); $sql = "`keywords` = '" . ($keywords ? $keywords . ',' . iS::escapeStr($_POST['mkeyword']) : iS::escapeStr($_POST['mkeyword'])) . "'"; iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id`='{$id}'"); } iPHP::success('关键字更改完成!', 'js:1'); } break; case 'tag': if ($_POST['pattern'] == 'replace') { $sql = "`related` = '" . iS::escapeStr($_POST['mtag']) . "'"; } elseif ($_POST['pattern'] == 'addto') { foreach ($idArray as $id) { $keywords = iDB::value("SELECT related FROM `#iCMS@__tags` WHERE `id`='{$id}'"); $sql = "`related` = '" . ($keywords ? $keywords . ',' . iS::escapeStr($_POST['mtag']) : iS::escapeStr($_POST['mtag'])) . "'"; iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id`='{$id}'"); } iPHP::success('相关标签更改完成!', 'js:1'); } break; default: if (strpos($batch, ':')) { $data = iACP::fields($batch); foreach ($idArray as $id) { $data && iDB::update("tags", $data, array('id' => $id)); } iPHP::success('操作成功!', 'js:1'); } else { iPHP::alert('请选择要操作项!', 'js:1'); } } $sql && iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id` IN ({$ids})"); iPHP::success('操作成功!', 'js:1'); }
public function ACTION_add() { if (!iCMS::$config['comment']['enable']) { iPHP::code(0, 'iCMS:comment:close', 0, 'json'); } iPHP::app('user.class', 'static'); user::get_cookie() or iPHP::code(0, 'iCMS:!login', 0, 'json'); $seccode = iS::escapeStr($_POST['seccode']); if (iCMS::$config['comment']['seccode']) { iPHP::seccode($seccode, true) or iPHP::code(0, 'iCMS:seccode:error', 'seccode', 'json'); } iPHP::app('user.msg.class', 'static'); $appid = (int) $_POST['appid']; $iid = (int) $_POST['iid']; $cid = (int) $_POST['cid']; $suid = (int) $_POST['suid']; $reply_id = (int) $_POST['id']; $reply_uid = (int) $_POST['userid']; $reply_name = iS::escapeStr($_POST['name']); $title = iS::escapeStr($_POST['title']); $content = iS::escapeStr($_POST['content']); $iid or iPHP::code(0, 'iCMS:article:empty_id', 0, 'json'); $content or iPHP::code(0, 'iCMS:comment:empty', 0, 'json'); $fwd = iCMS::filter($content); $fwd && iPHP::code(0, 'iCMS:comment:filter', 0, 'json'); $appid or $appid = iCMS_APP_ARTICLE; $addtime = $_SERVER['REQUEST_TIME']; $ip = iPHP::getIp(); $userid = user::$userid; $username = user::$nickname; $status = iCMS::$config['comment']['examine'] ? '0' : '1'; $up = '0'; $down = '0'; $quote = '0'; $floor = '0'; $fields = array('appid', 'cid', 'iid', 'suid', 'title', 'userid', 'username', 'content', 'reply_id', 'reply_uid', 'reply_name', 'addtime', 'status', 'up', 'down', 'ip', 'quote', 'floor'); $data = compact($fields); $id = iDB::insert('comment', $data); iDB::query("UPDATE `#iCMS@__article` SET comments=comments+1 WHERE `id` ='{$iid}' limit 1"); user::update_count($userid, 1, 'comments'); if (iCMS::$config['comment']['examine']) { iPHP::code(0, 'iCMS:comment:examine', $id, 'json'); } iPHP::code(1, 'iCMS:comment:success', $id, 'json'); }
public function API_findpwd() { $auth = iS::escapeStr($_GET['auth']); if ($auth) { $authcode = rawurldecode($auth); $authcode = base64_decode($authcode); $authcode = authcode($authcode); if (empty($authcode)) { exit; } list($uid, $username, $password, $timeline) = explode(USER_AUTHASH, $authcode); $now = time(); if ($now - $timeline > 86400) { exit; } $user = user::get($uid, false); if ($username != $user->username || $password != $user->password) { exit; } unset($user->password); iPHP::assign('auth', $auth); iPHP::assign('user', (array) $user); iPHP::view('iCMS://user/resetpwd.htm'); } else { iPHP::view('iCMS://user/findpwd.htm'); } }
function do_uploadimage() { $F = iFS::upload('upfile'); $F === false && exit(iFS::$ERROR); $F['path'] && ($url = iFS::fp($F['path'], '+http')); iPHP::json(array('title' => iS::escapeStr($_POST['pictitle']), 'original' => $F['oname'], 'url' => $url, 'code' => $F['code'], 'state' => 'SUCCESS')); }
function do_editpic() { iACP::MP('FILE.EDIT', 'page'); $pic = iS::escapeStr($_GET['pic']); //$pic OR iPHP::alert("请选择图片!"); if ($pic) { $src = iFS::fp($pic, '+http') . "?" . time(); $srcPath = iFS::fp($pic, '+iPATH'); $fsInfo = iFS::info($pic); $file_name = $fsInfo->filename; $file_path = $fsInfo->dirname; $file_ext = $fsInfo->extension; $file_id = 0; $rs = iFS::getFileData('filename', $file_name); if ($rs) { $file_path = $rs->path; $file_id = $rs->id; $file_ext = $rs->ext; } } else { $file_name = md5(uniqid()); $src = false; $file_ext = 'jpg'; } if ($_GET['indexid']) { $rs = iDB::all("SELECT * FROM `#iCMS@__filedata` where `indexid`='{$_GET['indexid']}' order by `id` ASC LIMIT 100"); foreach ((array) $rs as $key => $value) { $filepath = $value['path'] . $value['filename'] . '.' . $value['ext']; $src[] = iFS::fp($filepath, '+http') . "?" . time(); } } if ($_GET['pics']) { $src = explode(',', $_GET['pics']); if (count($src) == 1) { $src = $_GET['pics']; } } $max_size = (int) $this->upload_max_filesize; stristr($this->upload_max_filesize, 'm') && ($max_size = $max_size * 1024 * 1024); include iACP::view("files.editpic"); }
public static function crawl($_pid = NULL, $_rid = NULL, $_url = NULL, $_title = NULL) { ini_get('safe_mode') or set_time_limit(0); $sid = spider::$sid; if ($sid) { $sRs = iDB::row("SELECT * FROM `#iCMS@__spider_url` WHERE `id`='{$sid}' LIMIT 1;"); $title = $sRs->title; $cid = $sRs->cid; $pid = $sRs->pid; $url = $sRs->url; $rid = $sRs->rid; } else { $rid = spider::$rid; $pid = spider::$pid; $title = spider::$title; $url = spider::$url; $_rid === NULL or $rid = $_rid; $_pid === NULL or $pid = $_pid; $_title === NULL or $title = $_title; $_url === NULL or $url = $_url; } if ($pid) { $project = spider::project($pid); $prule_list_url = $project['list_url']; } $ruleA = spider::rule($rid); $rule = $ruleA['rule']; $dataArray = $rule['data']; if ($prule_list_url) { $rule['list_url'] = $prule_list_url; } if (spider::$dataTest) { echo "<b>抓取规则信息</b><pre>"; print_r(iS::escapeStr($ruleA)); print_r(iS::escapeStr($project)); echo "</pre><hr />"; } spider::$curl_proxy = $rule['proxy']; $responses = array(); $html = spiderTools::remote($url); if (empty($html)) { $msg = '错误:001..采集 ' . $url . '文件内容为空!请检查采集规则'; if (spider::$work == 'shell') { echo "{$msg}\n"; return false; } else { iPHP::alert($msg); } } // $http = spider::check_content_code($html); // // if($http['match']==false){ // return false; // } // $content = $http['content']; spider::$allHtml = ""; $rule['__url__'] = spider::$url; $responses['reurl'] = spider::$url; $responses['__title__'] = $title; foreach ((array) $dataArray as $key => $data) { $content_html = $html; $dname = $data['name']; /** * [UNSET:name] * 注销[name] * @var string */ if (strpos($dname, 'UNSET:') !== false) { $_dname = str_replace('UNSET:', '', $dname); unset($responses[$_dname]); continue; } /** * [DATA:name] * 把之前[name]处理完的数据当作原始数据 * 如果之前有数据会叠加 * 用于数据多次处理 * @var string */ if (strpos($dname, 'DATA:') !== false) { $_dname = str_replace('DATA:', '', $dname); $content_html = $responses[$_dname]; unset($responses[$dname]); } /** * [PRE:name] * 把PRE:name采集到的数据 当做原始数据 * 一般用于下载内容 * @var string */ $pre_dname = 'PRE:' . $dname; if (isset($responses[$pre_dname])) { $content_html = $responses[$pre_dname]; unset($responses[$pre_dname]); } /** * [EMPTY:name] * 如果[name]之前抓取结果数据为空使用这个数据项替换 * @var string */ if (strpos($dname, 'EMPTY:') !== false) { $_dname = str_replace('EMPTY:', '', $dname); if (empty($responses[$_dname])) { $dname = $_dname; } else { //有值不执行抓取 continue; } } $content = spiderContent::crawl($content_html, $data, $rule, $responses); unset($content_html); if (strpos($dname, 'ARRAY:') !== false) { // if(strpos($data['rule'], 'RULE@')!==false){ $dname = str_replace('ARRAY:', '', $dname); // $contentArray = $responses[$dname]; // // $contentArray = $responses[$dname]; $cArray = array(); foreach ((array) $content as $k => $value) { foreach ((array) $value as $key => $val) { $cArray[$key][$k] = $val; } } if ($cArray) { $content = $cArray; unset($cArray); } } /** * [name.xxx] * 采集内容做为数组 */ if (strpos($dname, '.') !== false) { $f_key = substr($dname, 0, stripos($dname, ".")); $s_key = substr(strrchr($dname, "."), 1); if (isset($responses[$f_key][$s_key])) { if (is_array($responses[$f_key][$s_key])) { $responses[$f_key][$s_key] = array_merge($responses[$f_key][$s_key], $content); } else { $responses[$f_key][$s_key] .= $content; } } else { $responses[$f_key][$s_key] = $content; } } else { /** * 多个name 内容合并 */ if (isset($responses[$dname])) { if (is_array($responses[$dname])) { $responses[$dname] = array_merge($responses[$dname], $content); } else { $responses[$dname] .= $content; } } else { $responses[$dname] = $content; } } /** * 对匹配多条的数据去重过滤 */ if (!is_array($responses[$dname]) && $data['multi']) { if (strpos($responses[$dname], ',') !== false) { $_dnameArray = explode(',', $responses[$dname]); $dnameArray = array(); foreach ((array) $_dnameArray as $key => $value) { $value = trim($value); $value && ($dnameArray[] = $value); } $dnameArray = array_filter($dnameArray); $dnameArray = array_unique($dnameArray); $responses[$dname] = implode(',', $dnameArray); unset($dnameArray, $_dnameArray); } } gc_collect_cycles(); } if (isset($responses['title']) && empty($responses['title'])) { $responses['title'] = $responses['__title__']; } spider::$allHtml = null; unset($html); gc_collect_cycles(); if (spider::$dataTest) { echo "<pre style='width:99%;word-wrap: break-word;'>"; print_r(iS::escapeStr($responses)); echo '<hr />'; echo '使用内存:' . iFS::sizeUnit(memory_get_usage()) . ' 执行时间:' . iPHP::timer_stop() . 's'; echo "</pre>"; } iFS::$CURLOPT_ENCODING = ''; iFS::$CURLOPT_REFERER = ''; iFS::$watermark_config['pos'] = iCMS::$config['watermark']['pos']; iFS::$watermark_config['x'] = iCMS::$config['watermark']['x']; iFS::$watermark_config['y'] = iCMS::$config['watermark']['y']; iFS::$watermark_config['img'] = iCMS::$config['watermark']['img']; $rule['fs']['encoding'] && (iFS::$CURLOPT_ENCODING = $rule['fs']['encoding']); $rule['fs']['referer'] && (iFS::$CURLOPT_REFERER = $rule['fs']['referer']); if ($rule['watermark_mode']) { iFS::$watermark_config['pos'] = $rule['watermark']['pos']; iFS::$watermark_config['x'] = $rule['watermark']['x']; iFS::$watermark_config['y'] = $rule['watermark']['y']; $rule['watermark']['img'] && (iFS::$watermark_config['img'] = $rule['watermark']['img']); } if (spider::$callback['data'] && is_callable(spider::$callback['data'])) { $responses = call_user_func_array(spider::$callback['data'], array($responses)); } return $responses; }
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); }