コード例 #1
0
ファイル: iACP.class.php プロジェクト: World3D/iCMS
 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');
     }
 }
コード例 #2
0
ファイル: comment.app.php プロジェクト: sunhk25/iCMS
 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');
 }
コード例 #3
0
ファイル: user.app.php プロジェクト: sunhk25/iCMS
 public function API_check()
 {
     $name = iS::escapeStr($_GET['name']);
     $value = iS::escapeStr($_GET['value']);
     $a = iPHP::code(1, '', $name);
     switch ($name) {
         case 'username':
             if (!preg_match("/^[\\w\\-\\.]+@[\\w\\-]+(\\.\\w+)+\$/i", $value)) {
                 $a = iPHP::code(0, 'user:register:username:error', 'username');
             } else {
                 user::check($value, 'username') && ($a = iPHP::code(0, 'user:register:username:exist', 'username'));
             }
             break;
         case 'nickname':
             if (preg_match("/\\d/", $value[0]) || cstrlen($value) > 20 || cstrlen($value) < 4) {
                 $a = iPHP::code(0, 'user:register:nickname:error', 'nickname');
             } else {
                 user::check($value, 'nickname') && ($a = iPHP::code(0, 'user:register:nickname:exist', 'nickname'));
             }
             break;
         case 'password':
             strlen($value) < 6 && ($a = iPHP::code(0, 'user:password:error', 'password'));
             break;
         case 'seccode':
             iPHP::seccode($value) or $a = iPHP::code(0, 'iCMS:seccode:error', 'seccode');
             break;
     }
     iPHP::json($a);
 }