Example #1
0
 public static function get($foldername)
 {
     if (!($match = Uri::match($foldername . '\\/(\\w+)'))) {
         throw new Exception("Not match valid route.");
     }
     $routeName = $match[1];
     $pluginPath = ROOT_PATH . 'contents/themes/' . $foldername . '/api.php';
     define("THIS_URL", ROOT_URL . 'contents/themes/' . $foldername . '/');
     define("THIS_PATH", ROOT_PATH . 'contents/themes/' . $foldername . '/');
     if (!file_exists($pluginPath)) {
         return false;
     }
     include $pluginPath;
     $routes = SelfApi::route();
     if (!isset($routes[$routeName])) {
         throw new Exception("Theme not support this route.");
     }
     $func = $routes[$routeName];
     if (!method_exists('SelfApi', $func)) {
         throw new Exception('Route ' . $routeName . ' not ready for runc.');
     }
     try {
         $result = SelfApi::$func();
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
     return $result;
 }
 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');
 }
Example #3
0
function listRss()
{
    header("Content-Type: application/xml; charset=UTF-8");
    $location = Url::rss();
    if ($match = Uri::match('^(.*?)$')) {
        $location = ROOT_URL . $match[1];
        $reLocation = base64_encode($location);
        if ($loadData = Cache::loadKey($reLocation, 60)) {
            $loadData = json_decode($loadData, true);
            return $loadData;
        }
    }
    $inputData = array('limitShow' => 15, 'limitPage' => 0);
    if ($match = Uri::match('\\/page\\/(\\d+)')) {
        $inputData['limitPage'] = $match[1];
    }
    if ($match = Uri::match('\\/category\\/(\\d+)')) {
        $id = $match[1];
        $inputData['where'] = "where catid='{$id}'";
    }
    if ($match = Uri::match('rss\\/products')) {
        $loadData = Products::get($inputData);
    } else {
        $loadData = Post::get($inputData);
    }
    $reLocation = base64_encode($location);
    Cache::saveKey($reLocation, json_encode($loadData));
    return $loadData;
}
Example #4
0
function searchResult()
{
    $curPage = 0;
    $keywords = '';
    if ($matches = Uri::match('tag\\/(.*?)\\/page\\/(\\d+)')) {
        $curPage = $matches[2];
        $keywords = $matches[1];
    } elseif ($matches = Uri::match('tag\\/(.*?)$')) {
        $curPage = 0;
        $keywords = $matches[1];
    }
    // $loadPostNode=PostTags::get(array(
    //     'limitShow'=>10,
    //     'limitPage'=>$curPage,
    // 	'where'=>"where tag_title LIKE '%$keywords%'"
    // 	));
    // // print_r($loadPostNode);die();
    // $total=count($loadPostNode);
    // $listID='';
    // for($i=0;$i<$total;$i++)
    // {
    // 	$listID.="'".$loadPostNode[$i]['postid']."', ";
    // }
    // $listID=substr($listID, 0, strlen($listID)-2);
    $loadData = Post::get(array('where' => "where postid IN (select postid from post_tags where title='{$keywords}')", 'orderby' => "group by postid order by date_added"));
    return $loadData;
}
 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();
 }
 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();
 }
Example #8
0
function loadApi($action)
{
    switch ($action) {
        case 'post_image':
            if (!($match = Uri::match('post_image\\/(\\d+)\\.(jpg|png)'))) {
                throw new Exception('Data not valid');
            }
            $fileUrl = '';
            try {
                $fileUrl = Post::getImageFromContent($match[1]);
            } catch (Exception $e) {
                throw new Exception($e->getMessage());
            }
            Redirect::to($fileUrl, 301);
            exit;
            break;
        case 'post_thumb':
            if (!($match = Uri::match('post_thumb\\/(\\d+)\\.(jpg|png)'))) {
                throw new Exception('Data not valid');
            }
            $fileUrl = '';
            try {
                $fileUrl = System::getUrl() . Post::getThumb($match[1]);
            } catch (Exception $e) {
                throw new Exception($e->getMessage());
            }
            Redirect::to($fileUrl, 301);
            exit;
            break;
    }
}
Example #9
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()
 {
     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');
 }
Example #11
0
function searchResult()
{
    $curPage = 0;
    $keywords = '';
    if ($matches = Uri::match('search\\/keyword\\/(.*?)\\/page\\/(\\d+)')) {
        $curPage = $matches[2];
        $keywords = base64_decode($matches[1]);
    } else {
        $keywords = Request::get('txtKeywords', '');
    }
    $loadData = Post::get(array('limitShow' => 24, 'limitPage' => $curPage, 'where' => "where title LIKE '%{$keywords}%'"));
    return $loadData;
}
 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');
 }
 public function index()
 {
     $post = array('alert' => '');
     // Model::load('admincp/dbstore');
     if ($match = Uri::match('\\/dbstore\\/(\\w+)')) {
         if (method_exists("controlDBStore", $match[1])) {
             $method = $match[1];
             $this->{$method}();
             die;
         }
     }
     Redirect::to(ADMINCP_URL);
 }
 public function index()
 {
     if ($match = Uri::match('^api\\/(\\w+)')) {
         Model::load('api');
         try {
             apiProcess();
         } catch (Exception $e) {
             echo $e->getMessage();
         }
     } else {
         echo json_encode(array('error' => 'yes'));
     }
 }
 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');
 }
 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');
 }
Example #17
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;
}
Example #18
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();
 }
 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 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');
 }
Example #21
0
function pageProcess($inputData)
{
    $match = Uri::match('^page-(\\d+)-(.*?)\\.html');
    if (!$match) {
        Redirect::to('404page');
        // Alert::make('Page not found');
    }
    $id = $match[1];
    $friendly_url = $match[2];
    $loadData = Pages::get(array('where' => "where pageid='{$id}' AND friendly_url='{$friendly_url}' AND status='1'"));
    if (!isset($loadData[0]['title'])) {
        Redirect::to('404page');
        // Alert::make('Page not found');
    }
    $inputData['title'] = $loadData[0]['title'];
    $inputData['content'] = $loadData[0]['content'];
    $inputData['page_type'] = $loadData[0]['page_type'];
    if (strlen($loadData[0]['keywords']) > 5) {
        $inputData['keywords'] = $loadData[0]['keywords'];
    }
    return $inputData;
}
 public function index()
 {
     $controlName = 'admincp/controlDashboard';
     if (Cookie::has('userid')) {
         $valid = UserGroups::getPermission(Users::getCookieGroupId(), 'can_view_admincp');
         if ($valid != 'yes') {
             Alert::make('You not have permission to view this page');
         }
         $controlName = 'admincp/controlDashboard';
         $default_adminpage_method = trim(System::getSetting('default_adminpage_method', 'none'));
         if ($default_adminpage_method == 'url') {
             $default_adminpage = trim(System::getSetting('default_adminpage_url', 'admincp/'));
             if ($default_adminpage != 'admincp/' && System::getUri() == 'admincp/') {
                 $beginUri = 'admincp';
                 if ($default_adminpage[0] != '/') {
                     $beginUri .= '/';
                 }
                 System::setUri($beginUri . $default_adminpage);
             }
         }
         if ($match = Uri::match('^admincp\\/(\\w+)')) {
             $controlName = 'admincp/control' . ucfirst($match[1]);
         }
     } else {
         $controlName = 'admincp/controlLogin';
         if ($match = Uri::match('^admincp\\/forgotpass')) {
             $controlName = 'admincp/controlForgotpass';
         }
     }
     $codeHead = Plugins::load('admincp_header');
     $codeHead = is_array($codeHead) ? '' : $codeHead;
     $codeFooter = Plugins::load('admincp_footer');
     $codeFooter = is_array($codeFooter) ? '' : $codeFooter;
     // print_r($codeHead);die();
     System::defineGlobalVar('admincp_header', $codeHead);
     System::defineGlobalVar('admincp_footer', $codeFooter);
     Controller::load($controlName);
 }
 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');
 }
 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();
 }
Example #25
0
function apiProcess()
{
    if (!($match = Uri::match('^api\\/(\\w+)\\/(\\w+)'))) {
        $result = json_encode(array('error' => 'yes', 'message' => 'Api not valid'));
        echo $result;
        die;
    }
    $method = strtolower($match[1]);
    $action = strtolower($match[2]);
    $result = array('error' => 'no', 'message' => '');
    switch ($method) {
        case 'image':
            Model::load('api/image');
            try {
                $result['data'] = loadApi($action);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'user':
            try {
                $result['data'] = Users::api($action);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'category':
            try {
                $result['data'] = Categories::api($action);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'plugin':
            try {
                $foldername = $action;
                $result['data'] = PluginsApi::get($foldername);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'payment':
            try {
                $foldername = $action;
                $result['data'] = PaymentApi::get($foldername);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'theme':
            try {
                $foldername = $action;
                $result['data'] = ThemeApi::get($foldername);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'cronjob':
            if (!($match = Uri::match('run\\.php$'))) {
                // throw new Exception("Error Processing Request");
                $result = array('error' => 'yes', 'message' => "Error Processing Request");
            }
            Cronjobs::run();
            break;
        case 'pluginstore':
            try {
                $result['data'] = PluginStoreApi::api($action);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'system':
            Model::load('api/system.php');
            try {
                $result['data'] = loadApi($action);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
    }
    echo json_encode($result);
}
Example #26
0
<?php

$pageData = array();
$pageName = System::getCurrentPage();
$pageName = $pageName == '' ? 'home' : $pageName;
if ($matches = Uri::match('^(\\w+)\\/?')) {
    $pageName = $matches[1];
}
if ($matches = Uri::match('^page\\/(\\d+)')) {
    $pageName = 'home';
}
// Theme::view('head');
$codeHead = Plugins::load('site_header');
$codeHead = is_array($codeHead) ? '' : $codeHead;
$codeFooter = Plugins::load('site_footer');
$codeFooter = is_array($codeFooter) ? '' : $codeFooter;
// print_r($codeHead);die();
System::defineGlobalVar('site_header', $codeHead);
System::defineGlobalVar('site_footer', $codeFooter);
$links = Links::get(array('cacheTime' => 3, 'orderby' => 'order by sort_order asc'));
System::defineVar('linkList', $links, 'head');
Controller::loadWithPath('theme' . ucfirst($pageName), 'index', System::getThemePath() . 'controller/');
// Theme::view('footer');
Example #27
0
<?php

if (!($match = Uri::match('category-(\\d+)\\/?'))) {
    Redirect::to('404page');
    // Alert::make('Page not found');
}
$pageName = 'category';
$pageData = array();
$pageData['content_top'] = Render::content_top($pageName);
$pageData['content_left'] = Render::content_left($pageName);
$pageData['content_right'] = Render::content_right($pageName);
$pageData['content_bottom'] = Render::content_bottom($pageName);
Theme::model('category');
$headData = GlobalCMS::$setting;
$pageData['newPost'] = searchResult($match[1]);
$pageData['listPage'] = listPage();
Theme::view('head', $headData);
Theme::view($pageName, $pageData);
Theme::view('footer');
Example #28
0
<?php

if (!($match = Uri::match('\\/setting\\/payza\\/'))) {
    Redirect::to(ROOT_URL);
}
$post = array('alert' => '');
Model::load(PAYMENTMETHOD_PATH . 'model/setting', 1);
if (Request::has('btnSend')) {
    $post['alert'] = settingProcess();
}
$post['data'] = settingData();
View::make(PAYMENTMETHOD_PATH . 'view/setting', $post, 1);
 public function deactivate()
 {
     if (!($match = Uri::match('\\/deactivate\\/(\\w+)'))) {
         Redirect::to(ADMINCP_URL);
     }
     $foldername = $match[1];
     Database::query("update plugins set status='0' where foldername='{$foldername}'");
     Database::query("update plugins_meta set status='0' where foldername='{$foldername}'");
     PluginsZone::saveCache();
     Redirect::to(ADMINCP_URL . 'plugins');
 }
Example #30
0
                </div>     
        <!-- Author -->

            </div>
            <!-- /.container-fluid -->
        </div>
        <!-- /#page-wrapper -->
    </div>
    <!-- /#wrapper -->

    <script type="text/javascript">

    var control='<?php 
if ($match = Uri::match("plugins\\/controller\\/(\\w+)")) {
    echo $match[1];
} elseif ($match = Uri::match("admincp\\/(\\w+)")) {
    echo $match[1];
}
?>
';


    $(document).ready(function(){
        var target='li-'+control;

        if($('.'+target).length==1)
        {
            $('.'+target).children('a').removeClass('collapsed').attr('aria-expanded','true');
            $('.'+target).children('ul').removeClass('collapse').addClass('collapse in').attr('aria-expanded','true');
      
        }