Example #1
0
 function onrec_info()
 {
     if ($this->user['admin'] == 1) {
         include ROOT_PATH . 'lib/class/status.class.php';
         include ROOT_PATH . 'lib/user/user.class.php';
         include_once ROOT_PATH . 'lib/func/functions.php';
         $id = getgpc('id', 'P');
         $r = getgpc('r', 'P');
         if ($r == 0) {
             //如果为再次请求cms,不要获取
             ini_set("soap.wsdl_cache_enabled", "0");
             $objSoapClient = new SoapClient($this->gSoapConfig['wsdl_url']);
             $columns = $objSoapClient->fetch_column_data($this->gSoapConfig['u'], $this->gSoapConfig['p']);
             //取栏目
             $xml = simplexml_load_string($columns, 'SimpleXMLElement', LIBXML_NOCDATA);
             //print_r($xml);
             $arr = $xml->node;
             $xmlArr = array();
             $str = '';
             $j = 0;
             foreach ($arr as $key => $value) {
                 $find[intval($value->columnid)] = $j++;
                 if ($value->fatherid == -1) {
                     $xmlArr[0][(string) $value->columnid] = (string) $value->columnname;
                 } else {
                     $pre = '';
                     for ($i = 0; $i < intval($value->depth); $i++) {
                         $pre .= ' -';
                     }
                     if ($pre) {
                         $pre .= ' ';
                     }
                     $ffs = explode(',', (string) $value->colparents);
                     if (count($ffs) == 2) {
                         $ffid = $value->fatherid;
                     } else {
                         $combination = array((string) $value->columnid, (string) $value->fatherid);
                         $diff = array_diff($ffs, $combination);
                         $ffid = $diff[2];
                     }
                     $xmlArr[1][(string) $ffid]['a' . (string) $value->columnid] = $pre . (string) $value->columnname;
                 }
             }
             $return['soap'] = $xmlArr;
         }
         //获得用户信息
         $user = new user();
         $userInfo = $user->getUserById($id);
         $userInfo = $userInfo[0];
         $return['username'] = $userInfo['username'];
         $return['id'] = $userInfo['id'];
         $return['avatar'] = $userInfo['middle_avatar'];
         $return['img'] = $userInfo['larger_avatar'];
         $status = new status();
         //获得用户最后一条微博的信息
         $blog = $status->show($userInfo['last_status_id']);
         $blog = $blog[0];
         $return['blog'] = $blog['text'];
         echo json_encode($return);
     } else {
         echo "没有权限";
     }
 }