예제 #1
0
 public function index()
 {
     Cache::loadPage('', 30);
     $inputData = array();
     $postid = 0;
     $curPage = 0;
     // Model::loadWithPath('home',System::getThemePath().'model/');
     if (!($match = Uri::match('tag\\/(\\w+)\\/?'))) {
         Redirect::to('404page');
     }
     $friendly_url = addslashes($match[1]);
     if ($match = Uri::match('page\\/(\\d+)')) {
         $curPage = (int) $match[1];
     }
     $loadData = Post::get(array('limitShow' => 10, 'limitPage' => $curPage, 'cacheTime' => 30, 'where' => "where postid IN (select postid from post_tags where title='{$friendly_url}')", 'orderby' => "order by postid desc"));
     if (!isset($loadData[0]['postid'])) {
         Redirect::to('404page');
     }
     $inputData['newPost'] = $loadData;
     $inputData['keywords'] = $friendly_url;
     $inputData['listPage'] = Misc::genPage('tag/' . $friendly_url, $curPage);
     System::setTitle('Tag "' . $friendly_url . '" results:');
     self::makeContent('tag', $inputData);
     Cache::savePage();
 }
 public function index()
 {
     $post = array('alert' => '');
     Model::load('admincp/usergroups');
     if ($match = Uri::match('\\/usergroups\\/(\\w+)')) {
         if (method_exists("controlUsergroups", $match[1])) {
             $method = $match[1];
             $this->{$method}();
             die;
         }
     }
     $curPage = 0;
     if ($match = Uri::match('\\/page\\/(\\d+)')) {
         $curPage = $match[1];
     }
     if (Request::has('btnAction')) {
         actionProcess();
     }
     // $valid=UserGroups::getThisPermission('can_addnew_usergroup');
     $post['pages'] = Misc::genPage('admincp/usergroups', $curPage);
     $post['theList'] = UserGroups::get(array('cacheTime' => 1, 'limitShow' => 20, 'limitPage' => $curPage));
     System::setTitle('Usergroups list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('usergroupsList', $post);
     View::make('admincp/footer');
 }
예제 #3
0
 public function index()
 {
     Cache::loadPage('', 30);
     $inputData = array();
     $postid = 0;
     $curPage = 0;
     // Model::loadWithPath('home',System::getThemePath().'model/');
     if ($match = Uri::match('page\\/(\\d+)')) {
         $curPage = (int) $match[1];
     }
     $txtKeywords = addslashes(Request::get('txtKeywords', ''));
     if ($match = Uri::match('\\/keyword\\/(.*?)\\/page')) {
         $txtKeywords = base64_decode($match[1]);
     }
     $loadData = Post::get(array('limitShow' => 10, 'limitPage' => $curPage, 'cacheTime' => 30, 'where' => "where title LIKE '%{$txtKeywords}%'", 'orderby' => "order by postid desc"));
     if (!isset($loadData[0]['postid'])) {
         Redirect::to('404page');
     }
     $inputData['newPost'] = $loadData;
     $inputData['keywords'] = $txtKeywords;
     $inputData['listPage'] = Misc::genPage('search/keyword/' . base64_encode($txtKeywords), $curPage);
     System::setTitle('Search result with keyword "' . $txtKeywords . '" results:');
     self::makeContent('search', $inputData);
     Cache::savePage();
 }
예제 #4
0
function listPage()
{
    $curPage = 0;
    $keywords = '';
    if ($matches = Uri::match('search\\/keyword\\/(.*?)\\/page\\/(\\d+)')) {
        $curPage = $matches[2];
        $keywords = $matches[1];
    } else {
        $keywords = base64_encode(Request::get('txtKeywords'));
    }
    $listPage = Misc::genPage('search/keyword/' . $keywords, $curPage);
    $result = array('pages' => $listPage, 'keywords' => base64_decode($keywords));
    return $result;
}
 public function index()
 {
     $post = array('alert' => '');
     Model::load('admincp/taxrate');
     $curPage = 0;
     if ($match = Uri::match('\\/page\\/(\\d+)')) {
         $curPage = $match[1];
     }
     if (Request::has('btnAction')) {
         actionProcess();
     }
     if (Request::has('btnAdd')) {
         try {
             insertProcess();
             $post['alert'] = '<div class="alert alert-success">Add new category success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     if (Request::has('btnSave')) {
         $match = Uri::match('\\/edit\\/(\\d+)');
         try {
             updateProcess($match[1]);
             $post['alert'] = '<div class="alert alert-success">Update category success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     if (Request::has('btnSearch')) {
         filterProcess();
     } else {
         $post['pages'] = Misc::genPage('admincp/taxrate', $curPage);
         $post['theList'] = Taxrates::get(array('limitShow' => 20, 'limitPage' => $curPage, 'orderby' => 'order by taxid desc', 'cacheTime' => 1));
     }
     if ($match = Uri::match('\\/edit\\/(\\d+)')) {
         $loadData = Taxrates::get(array('where' => "where taxid='" . $match[1] . "'"));
         $post['edit'] = $loadData[0];
         if (strlen($loadData[0]['country_short']) > 0) {
             $post['edit']['countries'] = explode(',', $loadData[0]['country_short']);
         }
         // print_r($post['countries']);die();
     }
     $post['listCountries'] = Country::get();
     System::setTitle('Taxrate list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('taxrateList', $post);
     View::make('admincp/footer');
 }
예제 #6
0
function listPage()
{
    $curPage = 0;
    $id = 0;
    $friendly_url = '';
    if ($matches = Uri::match('category-(\\d+)-([a-zA-Z0-9_-]+)-page-(\\d+)')) {
        $curPage = $matches[3];
        $id = $matches[1];
        $friendly_url = $matches[2];
    } elseif ($matches = Uri::match('category-(\\d+)-([a-zA-Z0-9_-]+)')) {
        $id = $matches[1];
        $friendly_url = $matches[2];
    }
    $listPage = Misc::genPage('category-' . $id . '-' . $friendly_url, $curPage, 5, '-');
    return $listPage;
}
예제 #7
0
 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();
 }
예제 #8
0
 public function index()
 {
     // Cache::loadPage(30);
     $inputData = array();
     $postid = 0;
     $curPage = 0;
     // Model::loadWithPath('home',System::getThemePath().'model/');
     if (!($match = Uri::match('category\\/(\\w+)$'))) {
         Redirect::to('404page');
     }
     $friendly_url = addslashes($match[1]);
     if ($match = Uri::match('page\\/(\\d+)')) {
         $curPage = (int) $match[1];
     }
     $loadData = Post::get(array('limitShow' => 2, 'limitPage' => $curPage, 'cacheTime' => -1, 'query' => "select p.*,c.title as cattitle from post p,categories c where c.friendly_url='{$friendly_url}' AND p.catid=c.catid order by p.postid desc"));
     if (!isset($loadData[0]['postid'])) {
         Redirect::to('404page');
     }
     $inputData['newPost'] = $loadData;
     $inputData['listPage'] = Misc::genPage('', $curPage);
     System::setTitle(ucfirst($loadData[0]['cattitle']));
     self::makeContent('category', $inputData);
     // Cache::savePage();
 }