Ejemplo n.º 1
0
 public function message_opt_friend_apply($data, $message_id, $mini)
 {
     $location = '';
     $sex = 0;
     $together_count = 0;
     $same_friend = array();
     $result = $this->getNoticeInfo(array('id' => $message_id, 'authorid' => $this->uid), true);
     if ($result) {
         $tmp = $result['body'] ? json_decode($result['body'], true) : array("explain" => "");
         //取得共同好友
         $friendModel = new Friend_Model();
         $ffids = $friendModel->getAllFriendIDs($result['authorid'], false);
         $mfids = $friendModel->getAllFriendIDs($this->uid, false);
         $together = array_intersect($ffids, $mfids);
         $data = sns::getuser($result['authorid']);
         $tmp['reside'] = '';
         if ($data['resideprovince'] || $data['residecity']) {
             $config = Kohana::config_load('cityarray');
             //加载城市数组
             $province = isset($data['resideprovince']) ? isset($config['province'][$data['resideprovince']]) ? $config['province'][$data['resideprovince']] : '' : "";
             $city = isset($data['residecity']) ? isset($config['city'][$data['residecity']]) ? $config['city'][$data['residecity']] : '' : "";
             $location = $province . " " . $city;
         }
         $sex = $data['sex'] == 1 ? "男" : "女";
         $tmp['fid'] = $result['authorid'];
         $tmp['explain'] = $tmp['explain'] ? str::unhtmlspecialchars($tmp['explain']) : '';
         unset($data, $ffids, $mfids, $config);
         $str = "";
         $urlpre = url::base();
         $avatar = sns::getavatar($result['authorid']);
         if (!empty($together)) {
             $together_count = count($together);
             $i = 0;
             foreach ($together as $val) {
                 $item = array();
                 $item['id'] = $val;
                 $item['name'] = sns::getrealname($val);
                 $same_friend[] = $item;
                 if (9 < ++$i) {
                     break;
                 }
             }
         }
     }
     return array('location' => $location, 'sex' => $sex, 'together_count' => $together_count, 'together' => $same_friend);
 }
Ejemplo n.º 2
0
 public function format_title($text, $source = 0)
 {
     if ($text == null) {
         return '';
     }
     $text = $this->clear_link($text);
     if (empty($source)) {
         $text = htmlspecialchars($text);
     } else {
         $text = str::unhtmlspecialchars($text);
     }
     return trim($text);
 }