Ejemplo n.º 1
0
 public function getLogsByTime($startTimeObj, $endTimeObj)
 {
     $query = new Query("SELECT");
     $query->where("channel_name = ?", Config::getVal("general", "channel"));
     $startTimeObj->makeTimestamp();
     $endTimeObj->makeTimestamp();
     $query->where("time > ?", $startTimeObj->timestamp);
     $query->where("time < ?", $endTimeObj->timestamp, "AND");
     $messagesArray = ChannelActionBean::select($query);
     return $messagesArray;
 }
Ejemplo n.º 2
0
 /**
  * Gets the number of messages specified in $count
  * that are immediately before the given timestamp
  *
  * @param integer $timestamp unix epoch timestamp
  * @param integer $count number of messages to get
  * @return array array of ChannelActionBean objects latest
  * first
  */
 public function getMessagesBeforeTimestamp($timestamp, $count)
 {
     $query = new Query("SELECT");
     $query->where("channel_name = ?", Config::getVal("general", "channel"));
     $query->where("time < ?", $timestamp);
     $query->orderby("time", "DESC");
     $query->limit($count);
     $messages = ChannelActionBean::select($query);
     return $messages;
 }
Ejemplo n.º 3
0
 public function getWordCount($nick, $time = false)
 {
     $query = new Query("SELECT");
     $query->where("channel_name = ?", Config::getVal("general", "channel"));
     $query->where("nickname = ?", $nick);
     $query->where("type = ?", ReceivedLineTypes::CHANMSG);
     if ($time == "hour") {
         $query->where("time > ?", time() - 60 * 60);
     } else {
         if ($time == "day") {
             $query->where("time > ?", time() - 60 * 60 * 24);
         } else {
             if ($time == "week") {
                 $query->where("time > ?", time() - 60 * 60 * 24 * 7);
             }
         }
     }
     $messages = ChannelActionBean::select($query);
     $wordCount = 0;
     foreach ($messages as $message) {
         $words = str_word_count($message->message);
         $wordCount += $words;
     }
     return $wordCount;
 }