'/quickgetthreads/:type/:limit', 'getthreads' => '/getthreads/:type/:limit', ); } //-------------------------------------------- // This happens when the path is '/list/' //-------------------------------------------- function index(&$reg, &$req, &$resp) { } //-------------------------------------------- // Quick get the popular threads or the new threads. //-------------------------------------------- function quickgetthreads(&$reg, &$req, &$resp) { //-------------------------------------------- // Can this user view the threads? //-------------------------------------------- $user = &$reg->get('user'); $resp->assign('can_view_threads', intval($user->canDo('view', 'threads'))); //-------------------------------------------- // Get the threads. //-------------------------------------------- $limit = intval($req->get('limit')); $cutoff = time() - 604800; $finder = &$this->getFinder('threads'); if($req->get('type') == 'popular') { //-------------------------------------------- // Popular threads. //-------------------------------------------- $threads = &$finder->findAllWhere('created>?', array($cutoff), 'karma_reward DESC', '', $limit); } else { //-------------------------------------------- // Recent threads. //-------------------------------------------- $threads = &$finder->findAllWhere('created>?', array($cutoff), 'created DESC', '', $limit); } //-------------------------------------------- // Do the template stuff. //-------------------------------------------- $resp->assignRef('thread_list', $threads); $this->setLayout('thread_excerpt_view.html'); } //-------------------------------------------- // Get the threads normally. //-------------------------------------------- function getthreads(&$reg, &$req, &$resp) { $this->quickgetthreads($reg, $req, $resp); $type = $req->get('type') == 'popular' ? 'popular' : 'recent'; $resp->assign('content', 'list_'. $type .'_threads.html'); $this->setLayout('forum_base.html'); } } ?>