/** * Logs searcher and displayer */ public function index() { if (!$_POST["submit"]) { View::load('logs/form'); return; } if ($_POST["startday"]) { $startTime = new Time(); $startTime->day = $_POST["startday"]; $startTime->month = $_POST["startmonth"]; $startTime->year = $_POST["startyear"]; $startTime->hour = $_POST["starthour"]; $startTime->minute = $_POST["startminute"]; $startTime->second = $_POST["startsecond"]; $endTime = new Time(); $endTime->day = $_POST["endday"]; $endTime->month = $_POST["endmonth"]; $endTime->year = $_POST["endyear"]; $endTime->hour = $_POST["endhour"]; $endTime->minute = $_POST["endminute"]; $endTime->second = $_POST["endsecond"]; $LogsModel = LogsModel::getInstance(); $messages = $LogsModel->getLogsByTime($startTime, $endTime); if ($_POST["plain"]) { View::load('logs/messages', array("messages" => $messages)); } else { $startTime->makeTimestamp(); $endTime->makeTimestamp(); View::load('logs/messages_formatted', array("messages" => $messages, "startTime" => $startTime->timestamp, "endTime" => $endTime->timestamp)); } } }
/** * Leaderboards page * Shows hourly, daily & weekly leaderboards */ public function index() { $UserModel = UserModel::getInstance(); $leaderboardPastWeekArray = $UserModel->getTopUsersByMessageCount(50, "week"); $leaderboardPastDayArray = $UserModel->getTopUsersByMessageCount(50, "day"); $leaderboardPastHourArray = $UserModel->getTopUsersByMessageCount(50, "hour"); View::load("leaderboard", array("leaderboardWeekEntries" => $leaderboardPastWeekArray, "leaderboardDayEntries" => $leaderboardPastDayArray, "leaderboardHourEntries" => $leaderboardPastHourArray)); }
/** * Shows stats for the given user * * @param string nickname to get stats for */ public function user($nick) { $UserModel = UserModel::getInstance(); $ChannelModel = ChannelModel::getInstance(); if ($UserModel->getOnlineStatus($nick)) { $isOnline = "yes"; } View::load("userstats", array("online" => $isOnline, "nickname" => $nick, "hour" => array("messages" => $UserModel->getMessageCount($nick, "hour"), "words" => $UserModel->getWordCount($nick, "hour"), "wordsPerMessage" => $UserModel->getAverageWordsPerMessage($nick, "hour")), "day" => array("messages" => $UserModel->getMessageCount($nick, "day"), "words" => $UserModel->getWordCount($nick, "day"), "wordsPerMessage" => $UserModel->getAverageWordsPerMessage($nick, "day")), "week" => array("messages" => $UserModel->getMessageCount($nick, "week"), "words" => $UserModel->getWordCount($nick, "week"), "wordsPerMessage" => $UserModel->getAverageWordsPerMessage($nick, "week")), "latestUserMessages" => $ChannelModel->getLatestMessages(10, $nick))); }
public function profile() { $um = UserModel::getInstance(); $nick = $um->getLoggedInNick(); if (!$nick) { header("Location: " . Config::getVal("general", "app_url") . "/index.php/user/login"); } else { View::load('user/profile', array("nick" => $nick)); } }
/** * Channel Right Now Page */ public function index() { $ChannelModel = ChannelModel::getInstance(); $onlineUsers = $ChannelModel->getOnlineUsers(); $latestMessages = $ChannelModel->getLatestMessages(75); // find any actions and turn them into a nicer format foreach ($latestMessages as $id => $message) { $split = explode(" ", $message->message); if (strpos($split[0], "ACTION") !== false) { $latestMessages[$id]->message = $message->nickname . str_replace("ACTION", "", $latestMessages[$id]->message); $latestMessages[$id]->nickname = " "; } } $topic = $ChannelModel->getTopic(); View::load('channel', array("topic" => $topic, "latestMessages" => $latestMessages, "latestMessage" => $latestMessages[0], "oldestMessage" => $latestMessages[49], "onlineUsers" => $onlineUsers)); }
* Index page for AwesomeIRCBotWeb * Includes all the library files and dispatches * the request to a controller * * Copyright (c) 2011, Jack Harley * All Rights Reserved */ session_start(); error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); ini_set("display_errors", "On"); date_default_timezone_set('UTC'); require_once __DIR__ . "/lib/hydrogen/hydrogen.inc.php"; require_once __DIR__ . "/lib/awesomeircbotweb/awesomeircbotweb.inc.php"; use hydrogen\controller\Dispatcher; use hydrogen\view\View; use hydrogen\config\Config; use hydrogen\errorhandler\ErrorHandler; use awesomeircbotweb\models\UserModel; use awesomeircbotweb\models\ChannelModel; ErrorHandler::attachErrorPage(); View::setVar("channel", Config::getVal("general", "channel")); View::setVar("ircAddress", Config::getVal("general", "irc_network_address")); $um = UserModel::getInstance(); $nick = $um->getLoggedInNick(); if ($nick) { View::setVar("loggedInUser", $nick); } Dispatcher::addHomeMatchRule("\\awesomeircbotweb\\controllers\\HomeController", "index"); Dispatcher::addPathInfoAutoMapRule("\\awesomeircbotweb\\controllers", "Controller"); Dispatcher::addMatchAllRule("\\awesomeircbotweb\\controllers\\ErrorController", "notFound"); Dispatcher::dispatch();
/** * Loads the specified view within this sandbox, making the current * context available to it. * * @param viewName string The name of the view to display. */ public function loadView($viewName) { View::loadIntoSandbox($viewName, $this); }
/** * Webchat */ public function index() { View::load('chat', array("address" => Config::getVal('general', 'irc_network_address'), "channel" => Config::getVal('general', 'channel'))); }
/** * 404 Not Found Error Page */ public function notFound() { View::load('404'); }
/** * Site homepage */ public function index() { View::load('index'); }