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');
 }
 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');
 }
Пример #3
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');
 }
Пример #4
0
 public function edit()
 {
     if (!($match = Uri::match('\\/edit\\/(\\d+)'))) {
         Redirect::to(ADMINCP_URL . 'pages/');
     }
     $pageid = $match[1];
     $post = array('alert' => '');
     if (Request::has('btnSave')) {
         try {
             updateProcess($pageid);
             $post['alert'] = '<div class="alert alert-success">Save changes success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     $loadData = Pages::get(array('where' => "where pageid='{$pageid}'", 'isHook' => 'no', 'cache' => 'no'));
     $post['edit'] = $loadData[0];
     System::setTitle('Edit page - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('pagesEdit', $post);
     View::make('admincp/footer');
 }
Пример #5
0
 public function edit()
 {
     if (!($match = Uri::match('\\/edit\\/(\\d+)'))) {
         Redirect::to(ADMINCP_URL . 'post/');
     }
     $postid = $match[1];
     $post = array('alert' => '');
     if (Request::has('btnSave')) {
         try {
             updateProcess($postid);
             $post['alert'] = '<div class="alert alert-success">Save changes success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     $loadData = Post::get(array('cache' => 'no', 'isHook' => 'no', 'query' => "select p.*,c.title as cattitle from " . Database::getPrefix() . "post p," . Database::getPrefix() . "categories c where p.catid=c.catid AND p.postid='{$postid}'"));
     $post['edit'] = $loadData[0];
     $post['tags'] = PostTags::renderToText($postid);
     System::setTitle('Edit post - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('postEdit', $post);
     View::make('admincp/footer');
 }
Пример #6
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');
 }