Beispiel #1
0
 /**
  * _log
  *
  * Actual workhorse method that does the logging.
  *
  * @param Phergie_Event_Request $event The event we are operating on
  * @param string $nick Who did this?
  * @param string $message What was said?
  * @author Eli White <*****@*****.**>
  * @return boolean
  */
 private function _log(Phergie_Event_Request $event, $nick, $message = NULL)
 {
     // Read in a few pieces of data from the connection
     $connection = $this->getConnection();
     $host = $connection->getHost() . ':' . $connection->getPort();
     // Now from the event
     $type = $event->getType();
     $channel = $event->getSource();
     // Attempt to write to the database
     $table = $this->getConfig('logging.table');
     $sql = "INSERT INTO `{$table}` (`host`, `channel`, `type`, `nick`, `message`) \n                VALUES (?, ?, ?, ?, ?)";
     $success = false;
     if ($this->db) {
         if ($stmt = $this->db->prepare($sql)) {
             $success = $stmt->execute(array($host, $channel, $type, $nick, $message));
         }
     }
     return $success;
 }