Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
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();
 }
Ejemplo n.º 3
0
 public function plugin()
 {
     System::setTitle('Plugin list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('pluginsStore', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 4
0
 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();
 }
Ejemplo n.º 5
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();
 }
Ejemplo n.º 6
0
 public function index()
 {
     $post = array('alert' => '');
     // Model::load('admincp/setting');
     if ($match = Uri::match('\\/setting\\/(\\w+)')) {
         if (method_exists("controlSetting", $match[1])) {
             $method = $match[1];
             $this->{$method}();
             die;
         }
     }
     if (Request::has('btnSave')) {
         System::saveSetting(Request::get('general'));
     }
     $data = array();
     if (!($data = Cache::loadKey('systemSetting', -1))) {
         $data = System::makeSetting();
     } else {
         $data = unserialize($data);
     }
     $post = $data;
     $post['usergroups'] = UserGroups::get();
     System::setTitle('Setting System - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('settingGeneral', $post);
     View::make('admincp/footer');
 }
 public function index()
 {
     Model::load('admincp/dashboard');
     $post = countStats();
     // $headData=array('title'=>'Dashboard - '.ADMINCP_TITLE);
     System::setTitle('Dashboard - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('dashboard', $post);
     View::make('admincp/footer');
 }
 public function index()
 {
     $post = array('alert' => '');
     // Model::load('admincp/dbstore');
     $post['theList'] = PluginStoreApi::getHtml();
     System::setTitle('Plugin list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('pluginsStore', $post);
     View::make('admincp/footer');
 }
 public function index()
 {
     if ($match = Uri::match('\\/jsonCategory')) {
         $keyword = String::encode(Request::get('keyword', ''));
         $loadData = Categories::get(array('where' => "where title LIKE '%{$keyword}%'", 'orderby' => 'order by title asc'));
         $total = count($loadData);
         $li = '';
         for ($i = 0; $i < $total; $i++) {
             $li .= '<li><span data-method="category" data-id="' . $loadData[$i]['catid'] . '" >' . $loadData[$i]['title'] . '</span></li>';
         }
         echo $li;
         die;
     }
     $post = array('alert' => '');
     Model::load('admincp/categories');
     $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::genSmallPage('admincp/categories', $curPage);
         $post['theList'] = Categories::get(array('limitShow' => 20, 'limitPage' => $curPage, 'orderby' => 'order by catid desc', 'cache' => 'no'));
     }
     if ($match = Uri::match('\\/edit\\/(\\d+)')) {
         $loadData = Categories::get(array('where' => "where catid='" . $match[1] . "'", 'cache' => 'no'));
         $post['edit'] = $loadData[0];
     }
     System::setTitle('Categories list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('categoriesList', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 10
0
 public function view()
 {
     if (!($match = Uri::match('\\/view\\/(\\d+)'))) {
         Redirect::to(ADMINCP_URL . 'comments/');
     }
     $commentid = $match[1];
     $loadData = Comments::get(array('query' => "select p.title,c.* from " . Database::getPrefix() . "post p," . Database::getPrefix() . "comments c where p.postid=c.postid AND c.commentid='{$commentid}'"));
     $post['edit'] = $loadData[0];
     System::setTitle('View comment - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('commentView', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 11
0
 public function view()
 {
     if (!($match = Uri::match('\\/view\\/(\\d+)'))) {
         Redirect::to(ADMINCP_URL . 'contacts/');
     }
     $postid = $match[1];
     $post = array('alert' => '');
     $loadData = Contactus::get(array('where' => "where contactid='{$postid}'"));
     $post = $loadData[0];
     System::setTitle('View contact - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('contactView', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 12
0
 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');
 }
Ejemplo n.º 13
0
 public function addnew()
 {
     $post = array('alert' => '');
     if (Request::has('btnAdd')) {
         try {
             insertProcess();
             $post['alert'] = '<div class="alert alert-success">Add new page success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     System::setTitle('Add new page - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('pagesAdd', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 14
0
 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();
 }
Ejemplo n.º 15
0
 public function index()
 {
     $post = array('alert' => '');
     Model::load('admincp/links');
     $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 link 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 link success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     if (Request::has('btnSearch')) {
         filterProcess();
     } else {
         $post['pages'] = Misc::genSmallPage('admincp/links', $curPage);
         $post['theList'] = Links::get(array('limitShow' => 20, 'limitPage' => $curPage, 'orderby' => 'order by sort_order asc', 'cache' => 'no'));
     }
     if ($match = Uri::match('\\/edit\\/(\\d+)')) {
         $loadData = Links::get(array('where' => "where id='" . $match[1] . "'", 'cache' => 'no'));
         $post['edit'] = $loadData[0];
     }
     $post['listLinks'] = Links::get(array('orderby' => 'order by sort_order asc', 'cache' => 'no'));
     System::setTitle('Links list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('linksList', $post);
     View::make('admincp/footer');
 }
 public function index()
 {
     $post = array('alert' => '');
     Model::load('admincp/paymentmethods');
     if ($match = Uri::match('\\/paymentmethods\\/(\\w+)')) {
         if (method_exists("controlPaymentmethods", $match[1])) {
             $method = $match[1];
             $this->{$method}();
             die;
         }
     }
     $curPage = 0;
     if ($match = Uri::match('\\/page\\/(\\d+)')) {
         $curPage = $match[1];
     }
     $post['theList'] = Paymentmethods::getDirs();
     System::setTitle('Paymentmethods list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('paymentmethodsList', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 17
0
 public function run()
 {
     if (!($match = Uri::match('\\/run\\/(\\w+)'))) {
         Redirect::to(ADMINCP_URL);
     }
     $funcName = base64_decode($match[1]);
     $parse = explode(':', $funcName);
     $foldername = $parse[0];
     $funcName = $parse[1];
     $path = PLUGINS_PATH . $foldername . '/index.php';
     if (!file_exists($path)) {
         Redirect::to(ADMINCP_URL);
     }
     define("THIS_URL", PLUGINS_URL . $foldername . '/');
     $post['title'] = ucfirst($foldername);
     $post['filePath'] = $path;
     $post['func'] = $funcName;
     System::setTitle(ucfirst($foldername) . ' - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('pluginRunFunc', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 18
0
 public function index()
 {
     $postData = array('alert' => '');
     Model::load('admincp/login');
     // if(Session::has('userid'))
     // {
     //     Redirect::to(ADMINCP_URL);
     // }
     if (Request::has('btnLogin')) {
         try {
             loginProcess();
             Redirect::to(ADMINCP_URL);
         } catch (Exception $e) {
             $postData['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     $postData['captchaHTML'] = Captcha::makeForm();
     System::setTitle('Login - ' . ADMINCP_TITLE);
     View::make('admincp/headNonSB');
     View::make('admincp/login', $postData);
     View::make('admincp/footerNonSB');
 }
 public function index()
 {
     $postData = array('alert' => '');
     Model::load('admincp/forgotpass');
     // if(Session::has('userid'))
     // {
     //     Redirect::to(ADMINCP_URL);
     // }
     if (Request::has('btnSend')) {
         try {
             forgotProcess();
             $postData['alert'] = '<div class="alert alert-success">We have been send your new password to your email.</div>';
         } catch (Exception $e) {
             $postData['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     $postData['captchaHTML'] = Captcha::makeForm();
     System::setTitle('Forgot Password - ' . ADMINCP_TITLE);
     View::make('admincp/headNonSB');
     View::make('admincp/forgotpass', $postData);
     View::make('admincp/footerNonSB');
 }
Ejemplo n.º 20
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();
 }
Ejemplo n.º 21
0
 public function profile()
 {
     $post = array('alert' => '');
     $match = Uri::match('\\/profile$');
     $userid = Users::getCookieUserId();
     if (Request::has('btnSave')) {
         try {
             updateProcess($userid);
             $post['alert'] = '<div class="alert alert-success">Save changes success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     if (Request::has('btnChangePassword')) {
         Users::changePassword($userid, Request::get('password', ''));
     }
     $prefix = '';
     $prefixall = Database::isPrefixAll();
     if ($prefixall != false || $prefixall == 'no') {
         $prefix = Database::getPrefix();
     }
     $loadData = Users::get(array('query' => "select u.*,ug.*,a.* from " . $prefix . "users u," . $prefix . "usergroups ug," . $prefix . "address a where u.groupid=ug.groupid AND u.userid=a.userid AND u.userid='{$userid}' order by u.userid desc"));
     $post['edit'] = $loadData[0];
     $post['listGroups'] = UserGroups::get();
     System::setTitle('Profile - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('userEdit', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 22
0
 public function setting()
 {
     if (!($match = Uri::match('\\/setting\\/(\\w+)'))) {
         Redirect::to(ADMINCP_URL);
     }
     if ($matchCtr = Uri::match('\\/setting\\/(\\w+)\\/controller\\/(\\w+)')) {
         $this->controller();
         die;
     }
     $theName = $match[1];
     $post['title'] = ucfirst($theName);
     $thePath = THEMES_PATH . $theName . '/';
     if (!is_dir($thePath)) {
         Redirect::to(ADMINCP_URL);
     }
     $info = $thePath . 'setting.php';
     if (!file_exists($info)) {
         Redirect::to(ADMINCP_URL);
     }
     $post['filePath'] = $info;
     System::setTitle('Setting theme ' . $theName . ' - ' . ADMINCP_TITLE);
     View::make('admincp/head', array());
     self::makeContents('themeSetting', $post);
     View::make('admincp/footer');
 }