Example #1
0
 /**
  * Filter a channel through whitelist.
  * This checks if a history exists for a user and a src.
  * @param $channel string wanted channel
  * @return string 
  */
 public function getWhitelistedChannel($channel)
 {
     if ($channel === '') {
         return '';
         # Public is allways allowed
     }
     if (false === ($nick = $this->getNickname())) {
         return '';
         # No Nick => only public
     }
     $msgs = new GWF_ChatMsg(false);
     $enick = $msgs->escape($nick);
     $echannel = $msgs->escape($channel);
     if (false === $msgs->selectFirst("(chatmsg_to='{$enick}' AND chatmsg_from='{$echannel}') OR (chatmsg_from='{$enick}' AND chatmsg_to='{$echannel}')")) {
         return '';
         # Does not exist
     }
     return $channel;
     # All fine!
 }