public function messageViewer(MessageStack $stack) { $content = new StringBuffer(); while (!$stack->isEmpty()) { $msg = $stack->pop(); $content->append($msg->getMessage()->toString()); } return $content; }
public function checkAttempts(MessageStack $stack) { $query = $this->db->query('select distinct userId from ' . $this->config->get('prefix') . '_attempts where userId > 0'); while ($row = $query->fetchObject()) { $attempts = $this->db->query('select id from ' . $this->config->get('prefix') . '_attempts where userId=\'' . $row->userId . '\'')->rowCount(); if ($attempts >= $this->config->get('maxAttempts')) { $name = $this->db->query('select user from ' . $this->config->get('prefix') . '_user where id=\'' . $row->userId . '\'')->fetchObject(); $stack->push(new Message($name->user . '\'s account is currently locked from attempting too many false logins.', 3)); } } }
public static function run(MessageStack $stack) { // Class will be in the format of <something>Command, like CategoryCommand $class = "blargon\\command\\" . ucfirst(isset($_GET['go']) && $_GET['go'] != null ? $_GET['go'] : 'news') . 'Command'; $method = isset($_GET['page']) ? $_GET['page'] : 'show'; if (!isset($_GET['go']) || !$_GET['go']) { $method = 'edit'; } // default page is news::edit $command = new $class($method, $stack); $command->execute(); $view = $command->getView(); $view->setHeader(self::$header); $view->setPanel(self::$panel); $messages = $stack->isEmpty() ? null : $view->messageViewer($stack); $view->setMessages($messages); $view->setFooter(self::$footer); $view->render(); }