Esempio n. 1
0
 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');
     }
 }
Esempio n. 2
0
 private function vote($_do)
 {
     // iPHP::app('user.class','static');
     // user::get_cookie() OR iPHP::code(0,'iCMS:!login',0,'json');
     $aid = (int) $_GET['iid'];
     $aid or iPHP::code(0, 'iCMS:article:empty_id', 0, 'json');
     $ackey = 'article_' . $_do . '_' . $aid;
     $vote = iPHP::get_cookie($ackey);
     $vote && iPHP::code(0, 'iCMS:article:!' . $_do, 0, 'json');
     if ($_do == 'good') {
         $sql = '`good`=good+1';
     } else {
         $sql = '`bad`=bad+1';
     }
     iDB::query("UPDATE `#iCMS@__article` SET {$sql} WHERE `id` ='{$aid}' limit 1");
     iPHP::set_cookie($ackey, time(), 86400);
     iPHP::code(1, 'iCMS:article:' . $_do, 0, 'json');
 }
Esempio n. 3
0
 public function API_mobileUp()
 {
     $this->auth or iPHP::code(0, 'iCMS:!login', 0, 'json');
     $F = iFS::upload('upfile');
     $F['path'] && ($url = iFS::fp($F['path'], '+http'));
     iPHP::js_callback(array('url' => $url, 'code' => $F['code']));
 }
Esempio n. 4
0
 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');
 }
Esempio n. 5
0
 public static function status($url = null, $st = null)
 {
     $status = false;
     $auth = self::get_cookie(true);
     if ($auth) {
         $user = self::get($auth['userid'], false);
         if ($auth['username'] == $user->username && $auth['password'] == $user->password) {
             $status = true;
         }
         unset($user->password);
     }
     unset($auth);
     if ($status) {
         if ($url && $st == "login") {
             if (self::$format == 'json') {
                 return iPHP::code(1, 0, $url, 'json');
             }
             iPHP::gotourl($url);
         }
         return $user;
     } else {
         if ($url && $st == "nologin") {
             if (self::$format == 'json') {
                 return iPHP::code(0, 0, $url, 'json');
             }
             iPHP::gotourl($url);
         }
         return false;
     }
 }
Esempio n. 6
0
 /**
  * [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');
 }