Ejemplo n.º 1
0
 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');
 }
Ejemplo n.º 2
0
<?php

/*
A.I.R.C.O
quotes module
@author #urk team
*/
include 'classes/quotes.class.php';
$quote = new quotes($texts['quotes'], $config['irc']);
$do = $_REQUEST['do'];
$texts = $texts['quotes'];
switch ($do) {
    case 'add':
        $crumbs = "<a href=\"index.php\">home</a> &raquo; <a href=\"index.php?mod=quotes\">quotes</a> &raquo; {$texts['gen']['add']}";
        if (!$quote->quote()) {
            $content = $quote->form_quote();
        }
        break;
    default:
        $quotes = $quote->getQuotes();
        $count = 0;
        $extraButtons = "<a href=\"index.php?mod=quotes&do=add\" title=\"{$texts['gen']['add']}\"><img src=\"images/add.png\" width=\"30\" height=\"30\" alt=\"links\" /></a>";
        if (!empty($quotes)) {
            $quote->rate();
            foreach ($quotes as $key => $val) {
                $count++;
                $postedBy = $quote->getPoster($val['userid']);
                $quoteDate = strftime("%A %d %B %Y", $val['date']);
                if ($quote->checkRating($val['id'])) {
                    $rateForm = $quote->form_rating($val['id'], $count);
                } else {