/** * write user message to channel * @access public * @param string * @param IChannel * @param string * @return void * @todo return must return true or false */ public function write($from, IChannel $channel, $data) { $Logger = Logger::getLogger('system.Frameworks.EyeosModules.NetSync'); $sql = "INSERT INTO `netsync_messages` (`id`, `from`, `to`, `data`, `timestamp`) VALUES (NULL, :from, :to, :data, " . time() . ")"; //$Logger->debug($sql); $stmt = $this->db->prepare($sql); $this->db->execute($stmt, array('from' => $from, 'to' => $channel->getName(), 'data' => $data)); }
/** * get password from channel * @access public * @param IChannel * @return false or string * @todo Return string or void string '', never two different types. */ public function getPassword(IChannel $channel) { $channelName = $channel->getName(); $sql = "SELECT `password` FROM `channels` WHERE `channel` = :channel"; $stmt = $this->db->prepare($sql); $stmt = $this->dao->execute($stmt, array('channel' => $channel)); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); if (count($results) > 0) { $row = $results[0]; return $row['password']; } return false; }