コード例 #1
0
ファイル: marker.app.php プロジェクト: sunhk25/iCMS
 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);
 }
コード例 #2
0
ファイル: iSession.class.php プロジェクト: Junred/iCMS
 public static function write($session_id, $data)
 {
     // new session-expire-time
     $expires = time() + iSession::$lifeTime;
     // is a session with this id in the database?
     $res = iDB::value("\n            SELECT `expires` FROM " . iPHP_DB_PREFIX_TAG . "sessions\n            WHERE session_id = '{$session_id}'");
     // if yes,
     if ($res) {
         // ...update session-data
         $return = iDB::query("\n                UPDATE " . iPHP_DB_PREFIX_TAG . "sessions\n                SET expires = '{$expires}',\n                data = '{$data}'\n                WHERE session_id = '{$session_id}'");
         // if something happened, return true
         if ($return) {
             return true;
         }
     } else {
         // create a new row
         iDB::query("\n                INSERT INTO " . iPHP_DB_PREFIX_TAG . "sessions\n                (session_id,expires,data)\n                VALUES('{$session_id}','{$expires}','{$data}')");
         // if row was created, return true
         if (iDB::$insert_id) {
             return true;
         }
     }
     // an unknown error occured
     return false;
 }
コード例 #3
0
ファイル: prop.app.php プロジェクト: sunhk25/iCMS
 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);
 }
コード例 #4
0
ファイル: iMAP.class.php プロジェクト: sunhk25/iCMS
 public static function addnew($node, $iid = "0")
 {
     $has = iDB::value("SELECT `id` FROM `" . self::table() . "` WHERE `" . self::$field . "`='{$node}' AND `iid`='{$iid}' AND `appid`='" . self::$appid . "' LIMIT 1");
     if (!$has) {
         iDB::query("INSERT INTO `" . self::table() . "` (`" . self::$field . "`,`iid`, `appid`) VALUES ('{$node}','{$iid}','" . self::$appid . "')");
     }
     //return array($vars,$tid,$cid,$tcid);
 }
コード例 #5
0
ファイル: search.app.php プロジェクト: sunhk25/iCMS
 private function slog($search)
 {
     $sid = iDB::value("SELECT `id` FROM `#iCMS@__search_log` WHERE `search` = '{$search}' LIMIT 1");
     if ($sid) {
         iDB::query("UPDATE `#iCMS@__search_log` SET `times` = times+1 WHERE `id` = '{$sid}';");
     } else {
         iDB::query("INSERT INTO `#iCMS@__search_log` (`search`, `times`, `addtime`) VALUES ('{$search}', '1', '" . time() . "');");
     }
 }
コード例 #6
0
ファイル: home.app.php プロジェクト: sunhk25/iCMS
 function do_iCMS()
 {
     //数据统计
     $rs = iDB::all("SHOW FULL TABLES FROM `" . iPHP_DB_NAME . "` WHERE table_type = 'BASE TABLE';");
     foreach ($rs as $k => $val) {
         if (strstr(iPHP_DB_PREFIX, $val['Tables_in_' . iPHP_DB_NAME]) === false) {
             $iTable[] = strtoupper($val['Tables_in_' . iPHP_DB_NAME]);
         } else {
             $oTable[] = $val['Tables_in_' . iPHP_DB_NAME];
         }
     }
     $content_datasize = 0;
     $tables = iDB::all("SHOW TABLE STATUS");
     $_count = count($tables);
     for ($i = 0; $i < $_count; $i++) {
         $tableName = strtoupper($tables[$i]['Name']);
         if (in_array($tableName, $iTable)) {
             $datasize += $tables[$i]['Data_length'];
             $indexsize += $tables[$i]['Index_length'];
             if (stristr(strtoupper(iPHP_DB_PREFIX . "article," . iPHP_DB_PREFIX . "category," . iPHP_DB_PREFIX . "comment," . iPHP_DB_PREFIX . "article_data"), $tableName)) {
                 $content_datasize += $tables[$i]['Data_length'] + $tables[$i]['Index_length'];
             }
         }
     }
     $acc = iDB::value("SELECT count(*) FROM `#iCMS@__category` WHERE `appid`='" . iCMS_APP_ARTICLE . "'");
     $tac = iDB::value("SELECT count(*) FROM `#iCMS@__category` WHERE `appid`='" . iCMS_APP_TAG . "'");
     $pac = iDB::value("SELECT count(*) FROM `#iCMS@__category` WHERE `appid`='" . iCMS_APP_PUSH . "'");
     $ac = iDB::value("SELECT count(*) FROM `#iCMS@__article`");
     $ac0 = iDB::value("SELECT count(*) FROM `#iCMS@__article` WHERE `status`='0'");
     $ac2 = iDB::value("SELECT count(*) FROM `#iCMS@__article` WHERE `status`='2'");
     $ctc = iDB::value("SELECT count(*) FROM `#iCMS@__comment`");
     $tc = iDB::value("SELECT count(*) FROM `#iCMS@__tags`");
     $kc = iDB::value("SELECT count(*) FROM `#iCMS@__keywords`");
     $pc = iDB::value("SELECT count(*) FROM `#iCMS@__push`");
     $uc = iDB::value("SELECT count(*) FROM `#iCMS@__user`");
     $fdc = iDB::value("SELECT count(*) FROM `#iCMS@__filedata`");
     $lc = iDB::value("SELECT count(*) FROM `#iCMS@__links`");
     include iACP::view("home");
 }
コード例 #7
0
ファイル: keywords.app.php プロジェクト: sunhk25/iCMS
 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);
 }
コード例 #8
0
ファイル: links.app.php プロジェクト: sunhk25/iCMS
 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);
 }
コード例 #9
0
ファイル: category.app.php プロジェクト: World3D/iCMS
 function update_count($cid)
 {
     $cc = iDB::value("SELECT count(*) FROM `#iCMS@__" . $this->_app_table . "` where `" . $this->_app_cid . "`='{$cid}'");
     iDB::query("UPDATE `#iCMS@__category` SET `count` ='{$cc}' WHERE `cid` ='{$cid}'");
 }
コード例 #10
0
ファイル: tag.class.php プロジェクト: World3D/iCMS
 public static function update($tag, $uid = "0", $iid = "0", $cid = '0', $tcid = '0')
 {
     if (empty($tag)) {
         return;
     }
     $tag = htmlspecialchars_decode($tag);
     $tag = preg_replace('/<[\\/\\!]*?[^<>]*?>/is', '', $tag);
     $tid = iDB::value("SELECT `id` FROM `#iCMS@__tags` WHERE `name`='{$tag}'");
     if ($tid) {
         $tlid = iDB::value("SELECT `id` FROM `#iCMS@__tags_map` WHERE `iid`='{$iid}' and `node`='{$tid}' and `appid`='" . TAG_APPID . "'");
         if (empty($tlid)) {
             iDB::query("INSERT INTO `#iCMS@__tags_map` (`node`, `iid`, `appid`) VALUES ('{$tid}', '{$iid}', '" . TAG_APPID . "')");
             iDB::query("UPDATE `#iCMS@__tags` SET  `count`=count+1,`pubdate`='" . time() . "'  WHERE `id`='{$tid}'");
         }
     } else {
         $tkey = pinyin($tag, iCMS::$config['other']['py_split']);
         // $fields = array('uid', 'cid', 'tcid', 'pid', 'tkey', 'name', 'seotitle', 'subtitle', 'keywords', 'description', 'haspic', 'pic', 'url', 'related', 'count', 'weight', 'tpl', 'ordernum', 'pubdate', 'status');
         // $data   = compact ($fields);
         // $data['pid'] = '0';
         // iDB::insert('tags',$data);
         iDB::query("INSERT INTO `#iCMS@__tags`\n            (`uid`, `cid`, `tcid`, `pid`, `tkey`, `name`, `seotitle`, `subtitle`, `keywords`, `description`, `haspic`, `pic`, `url`, `related`, `count`, `weight`, `tpl`, `ordernum`, `pubdate`, `status`)\nVALUES ('{$uid}', '{$cid}', '{$tcid}', '0', '{$tkey}', '{$tag}', '', '', '', '', '', '', '', '', '1', '0', '', '0', '" . time() . "', '1');");
         $tid = iDB::$insert_id;
         self::cache($tag);
         iDB::query("INSERT INTO `#iCMS@__tags_map` (`node`, `iid`, `appid`) VALUES ('{$tid}', '{$iid}', '" . TAG_APPID . "')");
         $tmid = iDB::$insert_id;
     }
     return $tag;
 }
コード例 #11
0
ファイル: user.app.php プロジェクト: sunhk25/iCMS
 public function openid()
 {
     if (!isset($_GET['sign'])) {
         return;
     }
     $sign = $_GET['sign'];
     $code = $_GET['code'];
     $state = $_GET['state'];
     $platform_map = array('WX' => 1, 'QQ' => 2, 'WB' => 3, 'TB' => 4);
     $class_name = strtoupper($sign);
     $platform = $platform_map[$class_name];
     $bind = $sign;
     if ($platform) {
         iPHP::app('user.open/' . $class_name . '.class', 'static');
         $api = new $class_name();
         $api->appid = iCMS::$config['open'][$class_name]['appid'];
         $api->appkey = iCMS::$config['open'][$class_name]['appkey'];
         $redirect_uri = rtrim(iCMS::$config['open'][$class_name]['redirect'], '/');
         $api->url = user::login_uri($redirect_uri) . 'sign=' . $sign;
         if (isset($_GET['bind']) && $_GET['bind'] == $sign) {
             $api->get_openid();
         } else {
             $api->callback();
         }
         $userid = user::openid($api->openid, $platform);
         if ($userid) {
             $user = user::get($userid, false);
             user::set_cookie($user->username, $user->password, array('uid' => $userid, 'username' => $user->username, 'nickname' => $user->nickname, 'status' => $user->status));
             $api->cleancookie();
             iPHP::gotourl($this->forward);
         } else {
             if (isset($_GET['bind'])) {
                 $user = array();
                 $user['openid'] = $api->openid;
                 $user['platform'] = $platform;
                 $api->cleancookie();
                 iPHP::assign('user', $user);
                 iPHP::view('iCMS://user/login.htm');
             } else {
                 $user = $api->get_user_info();
                 $user['openid'] = $api->openid;
                 $user['platform'] = $platform;
                 iDB::value("SELECT `uid` FROM `#iCMS@__user` where `nickname`='" . $user['nickname'] . "' LIMIT 1") && ($user['nickname'] = $sign . '_' . $user['nickname']);
                 iPHP::assign('user', $user);
                 iPHP::assign('query', compact(array('sign', 'code', 'state', 'bind')));
                 iPHP::view('iCMS://user/register.htm');
             }
             exit;
         }
     }
 }
コード例 #12
0
ファイル: user.app.php プロジェクト: sunhk25/iCMS
 function do_batch()
 {
     $idA = (array) $_POST['id'];
     $idA or iPHP::alert("请选择要操作的用户");
     $ids = implode(',', (array) $_POST['id']);
     $batch = $_POST['batch'];
     switch ($batch) {
         case 'prop':
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('prop', iCMS_APP_USER);
             $pid = implode(',', (array) $_POST['pid']);
             foreach ((array) $_POST['id'] as $id) {
                 $_pid = iDB::value("SELECT `pid` FROM `#iCMS@__user` where `uid`='{$id}' LIMIT 1");
                 iDB::update('user', compact('pid'), array('uid' => $id));
                 map::diff($pid, $_pid, $id);
             }
             iPHP::success('用户属性设置完成!', 'js:1');
             break;
         case 'dels':
             iPHP::$break = false;
             foreach ($idA as $id) {
                 $this->do_del($id, false);
             }
             iPHP::$break = true;
             iPHP::success('用户全部删除完成!', 'js:1');
             break;
     }
 }
コード例 #13
0
ファイル: iPHP.class.php プロジェクト: sunhk25/iCMS
 public static function total($tnkey, $sql, $type = null)
 {
     $tnkey == 'sql.md5' && ($tnkey = md5($sql));
     $tnkey = substr($tnkey, 8, 16);
     $total = (int) $_GET['total_num'];
     if (empty($total) && $type === null && !isset($_GET['total_cahce'])) {
         $total = (int) iCache::get('total/' . $tnkey);
     }
     if (empty($total) || $type === 'nocache' || isset($_GET['total_cahce'])) {
         $total = iDB::value($sql);
         if ($type === null) {
             iCache::set('total/' . $tnkey, $total);
         }
     }
     return $total;
 }
コード例 #14
0
ファイル: article.app.php プロジェクト: World3D/iCMS
 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);
 }
コード例 #15
0
ファイル: iSpider.class.php プロジェクト: Junred/iCMS
 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;
     }
 }
コード例 #16
0
ファイル: user.class.php プロジェクト: sunhk25/iCMS
 public static function openid($openid = 0, $platform = 0)
 {
     $uid = iDB::value("SELECT `uid` FROM `#iCMS@__user_openid` where `openid`='{$openid}' AND `platform`='{$platform}'");
     return $uid;
 }
コード例 #17
0
ファイル: spider.app.php プロジェクト: World3D/iCMS
 function checkurl($hash)
 {
     $id = iDB::value("SELECT `id` FROM `#iCMS@__spider_url` WHERE `hash`='{$hash}'");
     return $id ? true : false;
 }
コード例 #18
0
ファイル: account.app.php プロジェクト: sunhk25/iCMS
 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);
 }
コード例 #19
0
ファイル: tags.app.php プロジェクト: sunhk25/iCMS
 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');
 }
コード例 #20
0
ファイル: favorite.app.php プロジェクト: sunhk25/iCMS
 /**
  * [ACTION_create 创建新收藏夹]
  */
 public function ACTION_create()
 {
     $this->__login();
     $uid = user::$userid;
     $nickname = user::$nickname;
     $title = iS::escapeStr($_POST['title']);
     $description = iS::escapeStr($_POST['description']);
     $mode = (int) $_POST['mode'];
     empty($title) && iPHP::code(0, 'iCMS:favorite:create_empty', 0, 'json');
     $fwd = iCMS::filter($title);
     $fwd && iPHP::code(0, 'iCMS:favorite:create_filter', 0, 'json');
     if ($description) {
         $fwd = iCMS::filter($description);
         $fwd && iPHP::code(0, 'iCMS:favorite:create_filter', 0, 'json');
     }
     $max = iDB::value("SELECT COUNT(id) FROM `#iCMS@__favorite` WHERE `uid`='{$uid}'");
     $max >= 10 && iPHP::code(0, 'iCMS:favorite:create_max', 0, 'json');
     $count = 0;
     $follow = 0;
     $fields = array('uid', 'nickname', 'title', 'description', 'follow', 'count', 'mode');
     $data = compact($fields);
     $cid = iDB::insert('favorite', $data);
     $cid && iPHP::code(1, 'iCMS:favorite:create_success', $cid, 'json');
     iPHP::code(0, 'iCMS:favorite:create_failure', 0, 'json');
 }
コード例 #21
0
ファイル: article.table.php プロジェクト: sunhk25/iCMS
 public static function filedata_value($var = '', $field = 'filename', $var_field = 'indexid')
 {
     return iDB::value("SELECT `{$var_field}` FROM `#iCMS@__filedata` WHERE `{$field}` ='{$var}'");
 }
コード例 #22
0
ファイル: setting.app.php プロジェクト: sunhk25/iCMS
 /**
  * [set 更新配置]
  * @param [type]  $v     [description]
  * @param [type]  $n     [description]
  * @param [type]  $appid   [description]
  * @param boolean $cache [description]
  */
 function set($value, $name, $appid, $cache = false)
 {
     $cache && iCache::set('iCMS/config/' . $name, $value, 0);
     is_array($value) && ($value = addslashes(serialize($value)));
     $check = iDB::value("SELECT `name` FROM `#iCMS@__config` WHERE `appid` ='{$appid}' AND `name` ='{$name}'");
     $fields = array('appid', 'name', 'value');
     $data = compact($fields);
     if ($check === null) {
         iDB::insert('config', $data);
     } else {
         iDB::update('config', $data, array('appid' => $appid, 'name' => $name));
     }
 }