コード例 #1
0
 public function roomsByIds($uid, $ids)
 {
     if (empty($ids)) {
         return array();
     }
     $ids = implode("','", $ids);
     $rows = $this->where("name in ('{$ids}')")->select();
     $rooms = array();
     foreach ($rows as $row) {
         $rooms[] = (object) array('id' => $row['name'], 'name' => $row['name'], 'nick' => $row['nick'], "url" => $row['url'], "avatar" => WEBIM_IMAGE("room.png"), "status" => "", "temporary" => true, "blocked" => false);
     }
     return $rooms;
 }
コード例 #2
0
 /**
  * visitors by vids
  */
 public function visitorsByIds($vids)
 {
     if (count($vids) == 0) {
         return array();
     }
     $vids = implode("','", $vids);
     $rows = $this->where("name in ('{$vids}')")->select();
     $visitors = array();
     foreach ($rows as $v) {
         $v = (object) $v;
         $status = $v->location;
         if ($v->ipaddr) {
             $status = $status . '(' . $v->ipaddr . ')';
         }
         $visitors[] = (object) array("id" => $v->name, "nick" => "v" . substr($v->name, 4), "group" => "visitor", "url" => "#", "avatar" => WEBIM_IMAGE('male.png'), "status" => $status);
     }
     return $visitors;
 }
コード例 #3
0
ファイル: Model.php プロジェクト: vanloswang/webim-for-php5
 /**
  * visitors by vids
  */
 function visitors($vids)
 {
     if (count($vids) == 0) {
         return array();
     }
     $vids = implode("','", $vids);
     $rows = $this->T('visitors')->select('name')->select('ipaddr')->select('location')->whereIn('name', $vids)->findMany();
     $visitors = array();
     foreach ($rows as $v) {
         $status = $v->location;
         if ($v->ipaddr) {
             $status = $status . '(' . $v->ipaddr . ')';
         }
         $visitors[] = (object) array("id" => $v->name, "nick" => "v" . substr($v->name, 4), "group" => "visitor", "url" => "#", "avatar" => WEBIM_IMAGE('male.png'), "status" => $status);
     }
     return $visitors;
 }
コード例 #4
0
ファイル: Router.php プロジェクト: vanloswang/webim-for-php5
 /**
  * Join room
  */
 public function join()
 {
     $uid = $this->user->id;
     $roomId = $this->input('id');
     $nick = $this->input('nick');
     $room = $this->findRoom($this->plugin, $roomId);
     if (!$room) {
         $room = $this->findRoom($this->model, $roomId);
     }
     if (!$room) {
         header("HTTP/1.0 404 Not Found");
         exit("Can't found room: {$roomId}");
     }
     $this->model->joinRoom($roomId, $uid, $this->user->nick);
     $data = $this->client->join($roomId);
     $this->jsonReply(array('id' => $roomId, 'nick' => $nick, 'temporary' => true, 'avatar' => WEBIM_IMAGE('room.png')));
 }
コード例 #5
0
ファイル: Plugin.php プロジェクト: vanloswang/webim-for-php5
 public function roomsByIds($uid, $ids)
 {
     $rooms = array();
     foreach ($ids as $id) {
         if ($id === 'room') {
             $rooms[] = (object) array('id' => $id, 'name' => $id, 'nick' => 'room' . $id, 'url' => "#", 'avatar' => WEBIM_IMAGE('room.png'));
         }
     }
     return $rooms;
 }
コード例 #6
0
 /**
  * visitors by vids
  */
 function visitors($vids)
 {
     if (count($vids) == 0) {
         return array();
     }
     $vids = implode("','", $vids);
     $query = $this->db->prepare("SELECT name, ipaddr, location from {$this->db->visitors} where name in (%s)", $vids);
     $visitors = array();
     foreach ($this->db->get_results($query) as $v) {
         $status = $v->location;
         if ($v->ipaddr) {
             $status = $status . '(' . $v->ipaddr . ')';
         }
         $visitors[] = (object) array("id" => $v->name, "nick" => "v" . substr($v->name, 4), "group" => "visitor", "url" => "#", "avatar" => WEBIM_IMAGE('male.png'), "status" => $status);
     }
     return $visitors;
 }