Beispiel #1
0
 public function ActionDefault()
 {
     if (isset($_REQUEST['details'])) {
         return $this->Details(intval($_REQUEST['details']));
     }
     $template = new Template();
     $template->rss = static::$config['url']['rss'];
     $template->searchbox = new Template('searchbox');
     $template->menu = new Template('menu');
     if (isset($_REQUEST['q']) || isset($_REQUEST['cat']) || isset($_REQUEST['p'])) {
         $render = new PostRender(static::$config['url']['base']);
         // Title
         if (isset($_REQUEST['q']) && !empty($_REQUEST['q'])) {
             $template->title = SafeHTML(trim($_REQUEST['q']));
         } elseif (isset($_REQUEST['cat']) && !empty($_REQUEST['cat'])) {
             $cat = trim($_REQUEST['cat']);
             $template->title = SafeHTML($cat != 'dvd' ? ucfirst($cat) : strtoupper($cat));
         } else {
             $template->title = 'All';
         }
         $template->title .= ' :: ';
         // Search box variables
         $template->searchbox->query = isset($_REQUEST['q']) ? trim($_REQUEST['q']) : '';
         if (isset($_REQUEST['cat']) && !empty($_REQUEST['cat'])) {
             $template->searchbox->cat = array(strtolower(trim($_REQUEST['cat'])) => ' selected="selected"');
         } else {
             $template->searchbox->cat = array('all' => ' selected="selected"');
         }
         // RSS
         if (count($render->link) > 0) {
             $template->rss .= '?' . http_build_query($render->link, '', '&');
         }
         $template->searchbox->rss = '<a href="' . $template->rss . '" title="RSS"><img src="' . static::$config['url']['base'] . 'images/rss.png" width="14" height="14" alt="RSS" /></a>';
         // Result
         $template->body = $render->View();
         // Stop search engines (Google) from complaining a page with no results should return 404
         if ($render->rowcount == 0) {
             $template->meta = '<meta name="robots" content="noindex,nofollow">';
         }
         $template->footer = new Template('footer');
         $template->Display('layout');
     } else {
         $template->Display('layout_splash');
     }
 }