public function index()
 {
     Cache::loadPage('', 30);
     $inputData = array();
     $postid = 0;
     Model::loadWithPath('page', System::getThemePath() . 'model/');
     if (!($match = Uri::match('page\\/(.*?)\\.html$'))) {
         Redirect::to('404page');
     }
     $friendly_url = addslashes($match[1]);
     $loadData = Pages::get(array('cacheTime' => 30, 'where' => "where friendly_url='{$friendly_url}'"));
     if (!isset($loadData[0]['pageid'])) {
         Redirect::to('404page');
     }
     $inputData = $loadData[0];
     $postid = $loadData[0]['pageid'];
     if (Uri::isNull()) {
         System::setTitle(ucfirst($loadData[0]['title']));
     }
     $keywords = isset($loadData[0]['keywords'][4]) ? $loadData[0]['keywords'] : System::getKeywords();
     System::setKeywords($keywords);
     if ($loadData[0]['page_type'] == 'fullwidth') {
         self::makeContent('pageFullWidth', $inputData);
     } else {
         self::makeContent('page', $inputData);
     }
     Cache::savePage();
 }
 public function index()
 {
     Cache::loadPage('', 30);
     $inputData = array();
     $postid = 0;
     Model::loadWithPath('post', System::getThemePath() . 'model/');
     if (!($match = Uri::match('post\\/(.*?)\\.html$'))) {
         Redirect::to('404page');
     }
     $friendly_url = addslashes($match[1]);
     $loadData = Post::get(array('cacheTime' => 30, 'where' => "where friendly_url='{$friendly_url}'"));
     if (!isset($loadData[0]['postid'])) {
         Redirect::to('404page');
     }
     $inputData = $loadData[0];
     if (Request::has('btnComment')) {
         try {
             sendComment($loadData[0]['postid']);
             $inputData['commentAlert'] = '<div class="alert alert-success">Send comment success.</div>';
         } catch (Exception $e) {
             $inputData['commentAlert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     $postid = $loadData[0]['postid'];
     $listTag = PostTags::renderToLink($postid);
     $inputData['listTag'] = $listTag;
     $inputData['listComments'] = Comments::get(array('where' => "where postid='{$postid}' AND status='1'", 'orderby' => "order by postid desc"));
     Post::upView($postid);
     System::setTitle(ucfirst($loadData[0]['title']));
     $keywords = isset($loadData[0]['keywords'][4]) ? $loadData[0]['keywords'] : System::getKeywords();
     System::setKeywords($keywords);
     self::makeContent('post', $inputData);
     Cache::savePage();
 }
 public function index()
 {
     // Cache::loadPage(30);
     $inputData = array('alert' => '');
     Model::loadWithPath('contactus', System::getThemePath() . 'model/');
     if (Request::has('btnSend')) {
         try {
             contactProcess();
             $inputData['alert'] = '<div class="alert alert-success">Send contact success.</div>';
         } catch (Exception $e) {
             $inputData['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     System::setTitle('Contact us');
     self::makeContent('contactus', $inputData);
     // Cache::savePage();
 }
 public function index()
 {
     Cache::loadPage('', 30);
     $inputData = array();
     $curPage = 0;
     Model::loadWithPath('home', System::getThemePath() . 'model/');
     if ($match = Uri::match('page\\/(\\d+)')) {
         $curPage = (int) $match[1];
     }
     $curPage = (int) $curPage >= 0 ? $curPage : 0;
     $inputData['newPost'] = Post::get(array('limitShow' => 2, 'limitPage' => $curPage));
     if (!isset($inputData['newPost'][0]['postid'])) {
         Redirect::to('404page');
     }
     $inputData['listPage'] = Misc::genPage('', $curPage);
     self::makeContent('home', $inputData);
     Cache::savePage();
 }
Example #5
0
 public static function model($pageName, $otherPath = '')
 {
     $themePath = System::getThemePath() . 'model/';
     if (isset($otherPath[1])) {
         $themePath = $otherPath;
     }
     Model::loadWithPath($pageName, $themePath);
 }