public function index($arguments) { $news = new news(ConnectionFactory::get('mongo')); $articles = new articles(ConnectionFactory::get('mongo')); $notices = new notices(ConnectionFactory::get('redis')); $irc = new irc(ConnectionFactory::get('redis')); $quotes = new quotes(ConnectionFactory::get('mongo')); $forums = new forums(ConnectionFactory::get('redis')); // Set all site-wide notices. foreach ($notices->getAll() as $notice) { Error::set($notice, true); } // Fetch the easy data. $this->view['news'] = $news->getNewPosts(); $this->view['shortNews'] = $news->getNewPosts(true); $this->view['newArticles'] = $articles->getNewPosts('new', 1, 5); $this->view['ircOnline'] = $irc->getOnline(); $this->view['randomQuote'] = $quotes->getRandom(); $this->view['fPosts'] = $forums->getNew(); // Get online users. $apc = new APCIterator('user', '/' . Cache::PREFIX . 'user_.*/'); $this->view['onlineUsers'] = array(); while ($apc->valid()) { $current = $apc->current(); array_push($this->view['onlineUsers'], substr($current['key'], strlen(Cache::PREFIX) + 5)); $apc->next(); } // Set title. Layout::set('title', 'Home'); }
public function delete($arguments) { if (!CheckAcl::can('deleteNotices')) { return Error::set('You are not allowed to delete notices!'); } if (empty($arguments[0])) { return Error::set('No notice id was found!'); } $notices = new notices(ConnectionFactory::get('redis')); $return = $notices->delete($arguments[0]); if (is_string($return)) { return Error::set($return); } header('Location: ' . Url::format('/notice/')); }
public static function render($group = 'default') { if (!notices::session_exists()) { return; } $notices = Session::instance()->get_once('notices_' . $group); if (!empty($notices)) { $view = empty($notices['view']) ? 'notices' : $notices['view']; return View::factory($view, $notices)->render(); } }
<?php /** * HTML5 Form Class * * A simple form class to make building / validating forms easier. * * @author Mike Rogers <*****@*****.**> * @since 21/08/2011 */ include('func/functions.func.php'); include('class/notices.class.php'); include('class/form.class.php'); // Set up the classes. $notices = new notices(); $myForm = new form(); // Add some fields to the form. // This is a standard text input field, with a label of "Your Name" $myForm->setInputField(array('name'=>'your-name', 'required'=>true), 'Your Name', true); // This is an email field. $myForm->setInputField(array('name'=>'your-email', 'type'=>'email'), 'Your Email (Optional)', true); // This is a select field. $options = $myForm->setSelectField(array('name'=>'your-gender'), 'Your Gender', TRUE); // You can add options like this: $options->addOption('male', 'Male', false); // Or if you don't want to create a new variable, like this: $myForm->fields['your-gender']->addOption('female', 'Female', false);