Esempio n. 1
0
 function do_check()
 {
     if (empty($this->patch)) {
         if ($_GET['ajax']) {
             iPHP::json(array('code' => 0));
         } else {
             iPHP::success("您使用的 iCMS 版本,目前是最新版本<hr />当前版本:iCMS " . iCMS_VER . " [" . iCMS_RELEASE . "]", 0, "5");
         }
     } else {
         switch (iCMS::$config['system']['patch']) {
             case "1":
                 //自动下载,安装时询问
                 $this->msg = iPatch::download($this->patch[1]);
                 $json = array('code' => "1", 'url' => __ADMINCP__ . '=patch&do=install', 'msg' => "发现iCMS最新版本<br /><span class='label label-warning'>iCMS " . $this->patch[0] . " [" . $this->patch[1] . "]</span><br />" . $this->patch[3] . "<hr />您当前使用的版本<br /><span class='label label-info'>iCMS " . iCMS_VER . " [" . iCMS_RELEASE . "]</span><br /><br />新版本已经下载完成!! 是否现在更新?");
                 break;
             case "2":
                 //不自动下载更新,有更新时提示
                 $json = array('code' => "2", 'url' => __ADMINCP__ . '=patch&do=update', 'msg' => "发现iCMS最新版本<br /><span class='label label-warning'>iCMS " . $this->patch[0] . " [" . $this->patch[1] . "]</span><br />" . $this->patch[3] . "<hr />您当前使用的版本<br /><span class='label label-info'>iCMS " . iCMS_VER . " [" . iCMS_RELEASE . "]</span><br /><br />请马上更新您的iCMS!!!");
                 break;
         }
         if ($_GET['ajax']) {
             iPHP::json($json, true);
         }
         $moreBtn = array(array("text" => "马上更新", "url" => $json['url']), array("text" => "以后在说", "js" => 'return true'));
         iPHP::dialog('success:#:check:#:' . $json['msg'], 0, 30, $moreBtn);
     }
 }
Esempio n. 2
0
 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('更新完成');
 }
Esempio n. 3
0
 function do_save()
 {
     $filter = explode("\n", $_POST['filter']);
     $disable = explode("\n", $_POST['disable']);
     $disable = array_unique($disable);
     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);
     $this->cache();
     iPHP::success('更新完成');
 }
Esempio n. 4
0
 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;
     }
 }
Esempio n. 5
0
 private function __action_profile_base()
 {
     $nickname = iS::escapeStr($_POST['nickname']);
     $gender = iS::escapeStr($_POST['gender']);
     $weibo = iS::escapeStr($_POST['weibo']);
     $province = iS::escapeStr($_POST['province']);
     $city = iS::escapeStr($_POST['city']);
     $year = iS::escapeStr($_POST['year']);
     $month = iS::escapeStr($_POST['month']);
     $day = iS::escapeStr($_POST['day']);
     $constellation = iS::escapeStr($_POST['constellation']);
     $profession = iS::escapeStr($_POST['profession']);
     $isSeeFigure = iS::escapeStr($_POST['isSeeFigure']);
     $height = iS::escapeStr($_POST['height']);
     $weight = iS::escapeStr($_POST['weight']);
     $bwhB = iS::escapeStr($_POST['bwhB']);
     $bwhW = iS::escapeStr($_POST['bwhW']);
     $bwhH = iS::escapeStr($_POST['bwhH']);
     $pskin = iS::escapeStr($_POST['pskin']);
     $phair = iS::escapeStr($_POST['phair']);
     $shoesize = iS::escapeStr($_POST['shoesize']);
     $personstyle = iS::escapeStr($_POST['personstyle']);
     $slogan = iS::escapeStr($_POST['slogan']);
     $personstyle == iPHP::lang('user:profile:personstyle') && ($personstyle = "");
     $slogan == iPHP::lang('user:profile:slogan') && ($slogan = "");
     $pskin == iPHP::lang('user:profile:pskin') && ($pskin = "");
     $phair == iPHP::lang('user:profile:phair') && ($phair = "");
     // if($nickname!=user::$nickname){
     //     $has_nick = iDB::value("SELECT uid FROM `#iCMS@__user` where `nickname`='{$nickname}' AND `uid` <> '".user::$userid."'");
     //     $has_nick && iPHP::alert('user:profile:nickname');
     //     $userdata = user::data(user::$userid);
     //     if($userdata->unickEdit>1){
     //         iPHP::alert('user:profile:unickEdit');
     //     }
     //     if($nickname){
     //         iDB::update('user',array('nickname'=>$nickname),array('uid'=>user::$userid));
     //         $unickEdit = 1;
     //     }
     // }
     if ($gender != $this->me->gender) {
         iDB::update('user', array('gender' => $gender), array('uid' => user::$userid));
     }
     $uid = iDB::value("SELECT `uid` FROM `#iCMS@__user_data` where `uid`='" . user::$userid . "' limit 1");
     $fields = array('weibo', 'province', 'city', 'year', 'month', 'day', 'constellation', 'profession', 'isSeeFigure', 'height', 'weight', 'bwhB', 'bwhW', 'bwhH', 'pskin', 'phair', 'shoesize', 'personstyle', 'slogan', 'coverpic');
     if ($uid) {
         $data = compact($fields);
         $unickEdit && ($data['unickEdit'] = 1);
         iDB::update('user_data', $data, array('uid' => user::$userid));
     } else {
         $unickEdit = 0;
         $uid = user::$userid;
         $_fields = array('uid', 'realname', 'unickEdit', 'mobile', 'enterprise', 'address', 'zip', 'tb_nick', 'tb_buyer_credit', 'tb_seller_credit', 'tb_type', 'is_golden_seller');
         $fields = array_merge($fields, $_fields);
         $data = compact($fields);
         iDB::insert('user_data', $data);
     }
     iPHP::success('user:profile:success');
 }
Esempio n. 6
0
 function do_logout()
 {
     iMember::logout();
     iACP::destroy_seccode();
     iPHP::success('注销成功!', 'url:' . __SELF__);
 }
Esempio n. 7
0
 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);
 }
Esempio n. 8
0
 /**
  * [save 其它应用配置保存]
  * @param  integer $appid [应用ID]
  * @param  [sting] $app   [应用名]
  */
 function save($appid = 0, $name = null)
 {
     $name === null && ($name = iACP::$app_name);
     empty($appid) && iPHP::alert("配置程序出错缺少APPID!");
     $config = iS::escapeStr($_POST['config']);
     $this->set($config, $name, $appid, false);
     $this->cache();
     iPHP::success('配置更新完成', 'js:1');
 }
Esempio n. 9
0
 function do_createArticle($aid = null)
 {
     $category = $this->PG['cid'];
     $startime = $this->PG['startime'];
     $endtime = $this->PG['endtime'];
     $startid = $this->PG['startid'];
     $endid = $this->PG['endid'];
     $perpage = (int) $this->PG['perpage'];
     $offset = (int) $this->PG['offset'];
     $orderby = $this->PG['orderby'];
     $whereSQL = "WHERE `status` ='1'";
     $aid === null && ($aid = $this->PG['aid']);
     if ($aid) {
         $title = self::Article($aid);
         iPHP::success($title . '<hr />生成静态完成!');
     }
     $category[0] == 'all' && ($category = $this->get_category(iCMS_APP_ARTICLE));
     if ($category) {
         $cids = implode(',', (array) $category);
         $whereSQL .= " AND `cid` IN({$cids})";
     }
     $startime && ($whereSQL .= " AND `pubdate`>=UNIX_TIMESTAMP('{$startime} 00:00:00')");
     $endtime && ($whereSQL .= " AND `pubdate`<=UNIX_TIMESTAMP('{$endtime} 23:59:59')");
     $startid && ($whereSQL .= " AND `id`>='{$startid}'");
     $endid && ($whereSQL .= " AND `id`<='{$endid}'");
     $perpage or $perpage = $this->CP;
     $orderby or $orderby = "id DESC";
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__article` {$whereSQL}", "G");
     $looptimes = ceil($total / $perpage);
     $offset = $this->page * $perpage;
     $rs = iDB::all("SELECT `id` FROM `#iCMS@__article` {$whereSQL} order by {$orderby} LIMIT {$offset},{$perpage}");
     $_count = count($rs);
     $msg = "共<span class='label label-info'>{$total}</span>篇文章,将分成<span class='label label-info'>{$looptimes}</span>次完成<hr />开始执行第<span class='label label-info'>" . ($this->page + 1) . "</span>次生成,共<span class='label label-info'>{$_count}</span>篇<hr />";
     for ($i = 0; $i < $_count; $i++) {
         self::Article($rs[$i]['id']);
         $msg .= '<span class="label label-success">' . $rs[$i]['id'] . ' <i class="fa fa-check"></i></span> ';
     }
     $GLOBALS['page']++;
     $use_time = iPHP::timer_stop();
     $msg .= "<hr />用时<span class='label label-info'>{$use_time}</span>秒";
     $query["total_num"] = $total;
     $query["alltime"] = $this->alltime + $use_time;
     $loopurl = $this->loopurl($looptimes, $query);
     if ($loopurl) {
         $moreBtn = array(array("id" => "btn_stop", "text" => "停止", "url" => APP_URI . "&do=article"), array("id" => "btn_next", "text" => "继续", "src" => $loopurl, "next" => true));
         $dtime = 1;
         $all_time = $looptimes * $use_time + $looptimes + 1;
         $msg .= "<hr />预计全部生成还需要<span class='label label-info'>{$all_time}</span>秒";
     } else {
         $moreBtn = array(array("id" => "btn_next", "text" => "完成", "url" => APP_URI . "&do=article"));
         $dtime = 5;
         $msg .= "<hr />已全部生成完成<hr />总共用时<span class='label label-info'>" . $query["alltime"] . "</span>秒";
     }
     $updateMsg = $this->page ? true : false;
     iPHP::dialog($msg, $loopurl ? "src:" . $loopurl : '', $dtime, $moreBtn, $updateMsg);
 }
Esempio n. 10
0
 function do_cache($dialog = true)
 {
     $this->cache(true, $this->appid);
     $dialog && iPHP::success('更新完成');
 }
Esempio n. 11
0
 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;
     }
 }
Esempio n. 12
0
 function do_save()
 {
     $id = $_POST['id'];
     $rootid = $_POST['rootid'];
     $app = $_POST['app'];
     $name = $_POST['name'];
     $title = $_POST['title'];
     $href = $_POST['href'];
     $a_class = $_POST['a_class'];
     $icon = $_POST['icon'];
     $target = $_POST['target'];
     $data_toggle = $_POST['data-toggle'];
     $ordernum = $_POST['ordernum'];
     $class = '';
     $caret = '';
     $data_meta = $_POST['data-meta'];
     $data_target = '';
     if ($data_toggle == "dropdown") {
         $class = 'dropdown';
         $a_class = 'dropdown-toggle';
         $caret = '<b class="caret"></b>';
     } else {
         if ($data_toggle == "modal") {
             $data_meta or $data_meta = '{"width":"800px","height":"600px"}';
             $data_target = '#iCMS-MODAL';
         }
     }
     $fields = array('rootid', 'ordernum', 'app', 'name', 'title', 'href', 'icon', 'class', 'a_class', 'target', 'caret', 'data-toggle', 'data-meta', 'data-target');
     $data = compact($fields);
     $data['data-toggle'] = $data_toggle;
     $data['data-meta'] = $data_meta;
     $data['data-target'] = $data_target;
     if ($id) {
         iDB::update('menu', $data, array('id' => $id));
         $msg = "编辑完成!";
     } else {
         iDB::insert('menu', $data);
         $msg = "添加完成!";
     }
     iACP::$menu->cache();
     iPHP::success($msg, 'url:' . APP_URI . '&do=manage');
 }
Esempio n. 13
0
    $setting['router']['tag_url'] = $router_url;
    $setting['FS']['url'] = $router_url . '/res/';
    $setting['template']['mobile']['domain'] = $router_url;
    $setting['template']['device'][0]['domain'] = $router_url;
    foreach ($setting as $n => $v) {
        is_array($v) && ($v = addslashes(serialize($v)));
        iDB::query("UPDATE `#iCMS@__config` SET `value` = '{$v}' WHERE `appid` ='0' AND `name` ='{$n}'");
    }
    $output = "<?php\ndefined('iPHP') OR exit('Access Denied');\nreturn ";
    $output .= var_export($setting, true);
    $output .= ';';
    iFS::write(iPATH . 'conf/iCMS/config.php', $output, false);
    //写入数据库配置<hr />开始安装数据库<hr />数据库安装完成<hr />设置超级管理员<hr />更新网站缓存<hr />
    iFS::write($lock_file, 'iCMS.' . time(), false);
    iFS::rmdir(iPATH . 'install');
    iPHP::success("安装完成", 'js:top.install.step4();');
}
function run_query($sql)
{
    $sql = str_replace("\r", "\n", $sql);
    $resource = array();
    $num = 0;
    $sql_array = explode(";\n", trim($sql));
    foreach ($sql_array as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $resource[$num] .= $query[0] == '#' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
Esempio n. 14
0
 function do_artCount($dialog = true)
 {
     $app = iACP::app('category');
     $app->recount();
     $dialog && iPHP::success('更新完成');
 }
Esempio n. 15
0
 function do_del($uid = null, $dialog = true)
 {
     $uid === null && ($uid = $this->uid);
     $uid or iPHP::alert('请选择要删除的用户');
     iDB::query("DELETE FROM `#iCMS@__user` WHERE `uid` = '{$uid}'");
     iDB::query("DELETE FROM `#iCMS@__prop_map` WHERE `iid` = '{$uid}' AND `appid` = '" . iCMS_APP_USER . "' ;");
     $dialog && iPHP::success('用户删除完成', 'js:parent.$("#tr' . $uid . '").remove();');
 }
Esempio n. 16
0
 function do_cache()
 {
     $this->cache();
     iPHP::success('缓存更新完成!', 'js:1');
 }
Esempio n. 17
0
 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');
 }
Esempio n. 18
0
 function do_query()
 {
     $field = $_POST["field"];
     $pattern = $_POST["pattern"];
     $replacement = $_POST["replacement"];
     $where = $_POST["where"];
     $pattern or iPHP::alert("查找项不能为空~!");
     if ($field == "body") {
         $rows_affected = iDB::query("UPDATE `#iCMS@__article_data` SET `body` = REPLACE(`body`, '{$pattern}', '{$replacement}') {$where}");
     } else {
         if ($field == "tkd") {
             $rows_affected = iDB::query("UPDATE `#iCMS@__article` SET `title` = REPLACE(`title`, '{$pattern}', '{$replacement}'),\n\t\t    \t`keywords` = REPLACE(`keywords`, '{$pattern}', '{$replacement}'),\n\t\t    \t`description` = REPLACE(`description`, '{$pattern}', '{$replacement}'){$where}");
         } else {
             $rows_affected = iDB::query("UPDATE `#iCMS@__article` SET `{$field}` = REPLACE(`{$field}`, '{$pattern}', '{$replacement}'){$where}");
         }
     }
     iPHP::success($rows_affected . "条记录被替换<hr />操作完成!!");
 }
Esempio n. 19
0
 function do_del($uid = null, $dialog = true)
 {
     $uid === null && ($uid = $this->uid);
     $uid or iPHP::alert('请选择要删除的用户');
     $uid == "1" && iPHP::alert('不能删除超级管理员');
     iDB::query("DELETE FROM `#iCMS@__members` WHERE `uid` = '{$uid}'");
     $dialog && iPHP::success('用户删除完成', 'js:parent.$("#tr' . $uid . '").remove();');
 }
Esempio n. 20
0
 function do_save($callback = false)
 {
     $aid = (int) $_POST['aid'];
     $cid = (int) $_POST['cid'];
     $userid = (int) $_POST['userid'];
     $scid = implode(',', (array) $_POST['scid']);
     $pid = implode(',', (array) $_POST['pid']);
     $status = (int) $_POST['status'];
     $chapter = (int) $_POST['chapter'];
     $ordernum = _int($_POST['ordernum']);
     $_cid = iS::escapeStr($_POST['_cid']);
     $_pid = iS::escapeStr($_POST['_pid']);
     $_scid = iS::escapeStr($_POST['_scid']);
     $_tags = iS::escapeStr($_POST['_tags']);
     $title = iS::escapeStr($_POST['title']);
     $stitle = iS::escapeStr($_POST['stitle']);
     $pic = iS::escapeStr($_POST['pic']);
     $mpic = iS::escapeStr($_POST['mpic']);
     $spic = iS::escapeStr($_POST['spic']);
     $source = iS::escapeStr($_POST['source']);
     $author = iS::escapeStr($_POST['author']);
     $editor = iS::escapeStr($_POST['editor']);
     $description = iS::escapeStr($_POST['description']);
     $keywords = iS::escapeStr($_POST['keywords']);
     $tags = str_replace(',', ',', iS::escapeStr($_POST['tags']));
     $clink = iS::escapeStr($_POST['clink']);
     $url = iS::escapeStr($_POST['url']);
     $tpl = iS::escapeStr($_POST['tpl']);
     $metadata = iS::escapeStr($_POST['metadata']);
     $metadata = $metadata ? addslashes(serialize($metadata)) : '';
     $body = (array) $_POST['body'];
     $creative = (int) $_POST['creative'];
     iACP::CP($cid, $aid ? 'ce' : 'ca', 'alert');
     empty($_POST['pubdate']) && ($_POST['pubdate'] = get_date(0, 'Y-m-d H:i:s'));
     $pubdate = iPHP::str2time($_POST['pubdate']);
     $weight = _int($_POST['weight']);
     $postype = $_POST['postype'] ? $_POST['postype'] : 0;
     $ischapter = isset($_POST['ischapter']) ? 1 : 0;
     isset($_POST['inbox']) && ($status = "0");
     $tags && ($tags = preg_replace('/<[\\/\\!]*?[^<>]*?>/is', '', $tags));
     empty($title) && iPHP::alert('标题不能为空!');
     empty($cid) && iPHP::alert('请选择所属栏目');
     empty($body) && empty($url) && iPHP::alert('文章内容不能为空!');
     $userid or $userid = iMember::$userid;
     iFS::$userid = $userid;
     if (empty($aid) && iCMS::$config['publish']['repeatitle']) {
         articleTable::check_title($title) && iPHP::alert('该标题的文章已经存在!请检查是否重复');
     }
     if (strstr($this->category[$cid]['contentRule'], '{LINK}') !== false) {
         empty($clink) && ($clink = strtolower(pinyin($title)));
         if (empty($aid) && $clink) {
             articleTable::check_clink($clink) && iPHP::alert('该文章自定义链接已经存在!请检查是否重复');
         }
     }
     if (empty($description) && empty($url)) {
         $description = $this->autodesc($body);
     }
     stripos($pic, 'http://') === false or $pic = iFS::http($pic);
     stripos($mpic, 'http://') === false or $mpic = iFS::http($mpic);
     stripos($spic, 'http://') === false or $spic = iFS::http($spic);
     $haspic = empty($pic) ? 0 : 1;
     $SELFURL = __SELF__ . $_POST['REFERER'];
     if (empty($_POST['REFERER']) || strstr($_POST['REFERER'], '=save')) {
         $SELFURL = __SELF__ . '?app=article&do=manage';
     }
     $editor or $editor = empty(iMember::$data->nickname) ? iMember::$data->username : iMember::$data->nickname;
     // if($aid && $ischapter){
     //     $this->article_data($body,$aid);
     //     iDB::query("UPDATE `#iCMS@__article` SET `chapter`=chapter+1  WHERE `id` = '$aid'");
     //     iPHP::success('章节添加完成!','url:'.$SELFURL);
     // }
     iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
     $picdata = '';
     $ucid = 0;
     $fields = articleTable::fields($aid);
     if (empty($aid)) {
         $postime = $pubdate;
         $hits = 0;
         $good = $bad = $comments = 0;
         $ischapter && ($chapter = 1);
         $mobile = 0;
         $aid = articleTable::insert(compact($fields));
         if ($this->callback['primary']) {
             $PCB = $this->callback['primary'];
             $handler = $PCB[0];
             $params = (array) $PCB[1] + array('indexid' => $aid);
             if (is_callable($handler)) {
                 call_user_func_array($handler, $params);
             }
         }
         if ($tags) {
             iPHP::app('tag.class', 'static');
             tag::add($tags, $userid, $aid, $cid);
             //articleTable::update(compact('tags'),array('id'=>$aid));
         }
         map::init('prop', $this->appid);
         $pid && map::add($pid, $aid);
         map::init('category', $this->appid);
         map::add($cid, $aid);
         $scid && map::add($scid, $aid);
         $tagArray && tag::map_iid($tagArray, $aid);
         $url or $this->article_data($body, $aid, $haspic);
         $this->categoryApp->update_count_one($cid);
         $article_url = iURL::get('article', array(array('id' => $aid, 'url' => $url, 'cid' => $cid, 'pubdate' => $pubdate), $this->category[$cid]))->href;
         if ($status && iCMS::$config['api']['baidu']['sitemap']['sync']) {
             baidu_ping($article_url);
         }
         if ($callback) {
             return array("code" => $callback, 'indexid' => $aid);
         }
         $moreBtn = array(array("text" => "查看该文章", "target" => '_blank', "url" => $article_url, "o" => 'target="_blank"'), array("text" => "编辑该文章", "url" => APP_URI . "&do=add&id=" . $aid), array("text" => "继续添加文章", "url" => APP_URI . "&do=add&cid=" . $cid), array("text" => "返回文章列表", "url" => $SELFURL), array("text" => "查看网站首页", "url" => iCMS_URL, "target" => '_blank'));
         iPHP::$dialog['lock'] = true;
         iPHP::dialog('success:#:check:#:文章添加完成!<br />10秒后返回文章列表', 'url:' . $SELFURL, 10, $moreBtn);
     } else {
         if ($tags) {
             iPHP::app('tag.class', 'static');
             tag::diff($tags, $_tags, iMember::$userid, $aid, $cid);
         }
         $picdata = $this->picdata($pic, $mpic, $spic);
         articleTable::update(compact($fields), array('id' => $aid));
         if ($this->callback['primary']) {
             $PCB = $this->callback['primary'];
             $handler = $PCB[0];
             $params = (array) $PCB[1] + array('indexid' => $aid);
             if (is_callable($handler)) {
                 call_user_func_array($handler, $params);
             }
         }
         map::init('prop', $this->appid);
         map::diff($pid, $_pid, $aid);
         map::init('category', $this->appid);
         map::diff($cid, $_cid, $aid);
         map::diff($scid, $_scid, $aid);
         $url or $this->article_data($body, $aid, $haspic);
         //$ischapter && $this->chapter_count($aid);
         if ($_cid != $cid) {
             $this->categoryApp->update_count_one($_cid, '-');
             $this->categoryApp->update_count_one($cid);
         }
         if ($callback) {
             return array("code" => $callback, 'indexid' => $aid);
         }
         //       if(!strstr($this->category[$cid]['contentRule'],'{PHP}')&&!$this->category[$cid]['url']&&$this->category[$cid]['mode']=="1" && $status) {
         // 	$htmlApp = iACP::app('html');
         // 	$htmlApp->Article($aid);
         // }
         iPHP::success('文章编辑完成!<br />3秒后返回文章列表', 'url:' . $SELFURL);
     }
 }
Esempio n. 21
0
 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');
 }
Esempio n. 22
0
 function do_update()
 {
     if ($this->id) {
         $data = iACP::fields($_GET['iDT']);
         $data && iDB::update("comment", $data, array('id' => $this->id));
         iPHP::success('操作成功!', 'js:1');
     }
 }