Пример #1
0
 public function get_user_info()
 {
     $this->openid = authcode(iPHP::get_cookie("QQ_OPENID"), 'DECODE');
     $access_token = authcode(iPHP::get_cookie("QQ_ACCESS_TOKEN"), 'DECODE');
     $get_user_info = "https://graph.qq.com/user/get_user_info?" . "access_token=" . $access_token . "&oauth_consumer_key=" . $this->appid . "&openid=" . $this->openid . "&format=json";
     $info = $this->get_url_contents($get_user_info);
     $arr = json_decode($info, true);
     $arr['avatar'] = $arr['figureurl_2'];
     $arr['gender'] = $arr['gender'] == "??" ? '1' : 0;
     return $arr;
 }
Пример #2
0
 public function get_user_info()
 {
     $access_token = authcode(iPHP::get_cookie("WX_ACCESS_TOKEN"), 'DECODE');
     $openid = authcode(iPHP::get_cookie("WX_OPENID"), 'DECODE');
     $get_user_info = "https://api.weixin.qq.com/sns/userinfo?" . "access_token=" . $access_token . "&openid=" . $openid;
     $info = $this->get_url_contents($get_user_info);
     $arr = json_decode($info, true);
     $arr['avatar'] = $arr['headimgurl'];
     $arr['gender'] = $arr['sex'];
     return $arr;
 }
Пример #3
0
 public function __construct()
 {
     $this->auth = user::get_cookie();
     $this->uid = (int) $_GET['uid'];
     $this->forward = iS::escapeStr($_GET['forward']);
     $this->forward or iPHP::get_cookie('forward');
     $this->forward or $this->forward = iCMS_URL;
     // iFS::config($GLOBALS['iCONFIG']['user_fs_conf'])
     iFS::$userid = user::$userid;
     iPHP::assign('forward', $this->forward);
 }
Пример #4
0
 public function API_like()
 {
     // iPHP::app('user.class','static');
     // user::get_cookie() OR iPHP::code(0,'iCMS:!login',0,'json');
     $this->id or iPHP::code(0, 'iCMS:article:empty_id', 0, 'json');
     $lckey = 'like_comment_' . $this->id;
     $like = iPHP::get_cookie($lckey);
     $like && iPHP::code(0, 'iCMS:comment:!like', 0, 'json');
     //$ip = iPHP::getIp();
     iDB::query("UPDATE `#iCMS@__comment` SET `up`=up+1 WHERE `id`='{$this->id}'");
     iPHP::set_cookie($lckey, $_SERVER['REQUEST_TIME'], 86400);
     iPHP::code(1, 'iCMS:comment:like', 0, 'json');
 }
Пример #5
0
 public function get_user_info()
 {
     $access_token = authcode(iPHP::get_cookie("WB_ACCESS_TOKEN"), 'DECODE');
     $refresh_token = authcode(iPHP::get_cookie("WB_REFRESH_TOKEN"), 'DECODE');
     $this->openid = authcode(iPHP::get_cookie("WB_OPENID"), 'DECODE');
     $url = "https://api.weibo.com/2/users/show.json?uid=" . $this->openid;
     $info = $this->get_url_contents($url, $access_token);
     $arr = json_decode($info, true);
     $arr['nickname'] = $arr['screen_name'];
     $arr['avatar'] = $arr['avatar_large'];
     $arr['gender'] = $arr['gender'] == "m" ? '1' : '0';
     return $arr;
 }
Пример #6
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');
 }
Пример #7
0
 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;
     }
 }
Пример #8
0
 function do_iCMS()
 {
     $tabs = iPHP::get_cookie(iACP::$app_name . '_tabs');
     $tabs == "list" ? $this->do_list() : $this->do_tree();
 }
Пример #9
0
 public static function head($navbar = true)
 {
     $body_class = '';
     if (iCMS::$config['other']['sidebar_enable']) {
         iCMS::$config['other']['sidebar'] or $body_class = 'sidebar-mini';
         $body_class = iPHP::get_cookie('ACP_sidebar_mini') ? 'sidebar-mini' : '';
     } else {
         $body_class = 'sidebar-display';
     }
     $navbar === false && ($body_class = 'iframe ');
     include self::view("admincp.header");
     $navbar === true && (include self::view("admincp.navbar"));
 }
Пример #10
0
 public function get_openid()
 {
     $this->openid = authcode(iPHP::get_cookie("TB_OPENID"), 'DECODE');
     return $this->openid;
 }
Пример #11
0
 public static function get_cookie($unpw = false)
 {
     $auth = authcode(iPHP::get_cookie(self::$AUTH));
     $userid = authcode(iPHP::get_cookie('userid'));
     $nickname = authcode(iPHP::get_cookie('nickname'));
     list($_userid, $_username, $_password, $_nickname) = explode(USER_AUTHASH, $auth);
     if ((int) $userid === (int) $_userid && $nickname === $_nickname) {
         self::$userid = (int) $_userid;
         self::$nickname = $_nickname;
         $u = array('userid' => self::$userid, 'nickname' => self::$nickname);
         if ($unpw) {
             $u['username'] = $_username;
             $u['password'] = $_password;
         }
         return $u;
     }
     //self::logout();
     return false;
 }