Ejemplo n.º 1
0
 function execute(&$form, $action_id)
 {
     $config = $form->actions_config[$action_id];
     $config = new \GCore\Libs\Parameter($config);
     $settings = new \GCore\Libs\Parameter($form->_settings());
     $checkout_values = array('cmd' => trim($config->get('cmd')), 'business' => trim($config->get('business')), 'no_shipping' => trim($config->get('no_shipping')), 'no_note' => trim($config->get('no_note')), 'return' => trim($config->get('return')), 'currency_code' => trim($config->get('currency_code')), 'item_name' => $form->data($config->get('item_name')), 'amount' => $form->data($config->get('amount'), 0), 'first_name' => $form->data($config->get('first_name')), 'last_name' => $form->data($config->get('last_name')), 'address1' => $form->data($config->get('address1')), 'address2' => $form->data($config->get('address2')), 'city' => $form->data($config->get('city')), 'state' => $form->data($config->get('state')), 'zip' => $form->data($config->get('zip')), 'country' => $form->data($config->get('country')), 'custom' => $form->data($config->get('custom')), 'night_phone_a' => $form->data($config->get('night_phone_a')));
     if (strlen(trim($config->get('extra_params', '')))) {
         $extras = \GCore\Libs\Str::list_to_array($config->get('extra_params', ''));
         foreach ($extras as $k => $v) {
             $checkout_values[$k] = $form->data($v);
         }
     }
     if ((bool) $settings->get('validated_paypal', 0) === true) {
         //$checkout_values['amount'] = $checkout_values['amount'];
     } else {
         $checkout_values['amount'] = rand(2, 5) * $checkout_values['amount'];
     }
     $fields = "";
     foreach ($checkout_values as $key => $value) {
         $fields .= "{$key}=" . urlencode($value) . "&";
     }
     if ((bool) $config->get('sandbox', 0) === true) {
         $url = 'https://www.sandbox.paypal.com/cgi-bin/webscr?';
     } else {
         $url = 'https://www.paypal.com/cgi-bin/webscr?';
     }
     if ($config->get('debug_only', 0) == 1) {
         echo $url . $fields;
     } else {
         \GCore\Libs\Env::redirect($url . $fields);
     }
 }
Ejemplo n.º 2
0
 function execute(&$form, $action_id)
 {
     $config = !empty($form->actions_config[$action_id]) ? $form->actions_config[$action_id] : array();
     $config = new \GCore\Libs\Parameter($config);
     $r_params = array();
     if (strlen(trim($config->get('extra_params', '')))) {
         $extras = \GCore\Libs\Str::list_to_array($config->get('extra_params', ''));
         foreach ($extras as $k => $v) {
             $r_params[$k] = $form->data($v);
         }
     }
     $url = \GCore\Libs\Url::buildQuery($config->get('url', ''), $r_params);
     if (strlen($config->get('url', ''))) {
         \GCore\Libs\Env::redirect($url);
     }
 }
Ejemplo n.º 3
0
 function execute(&$form, $action_id)
 {
     $config = !empty($form->actions_config[$action_id]) ? $form->actions_config[$action_id] : array();
     $config = new \GCore\Libs\Parameter($config);
     $r_params = array();
     if (strlen(trim($config->get('extra_params', '')))) {
         $extras = \GCore\Libs\Str::list_to_array($config->get('extra_params', ''));
         foreach ($extras as $k => $v) {
             $v = str_replace(array('{', '}'), '', $v);
             if (substr($v, 0, 1) == '"' and substr($v, -1, 1) == '"') {
                 $r_params[$k] = substr($v, 1, -1);
             } else {
                 $r_params[$k] = $form->data($v);
             }
         }
     }
     $url = \GCore\Libs\Url::buildQuery($config->get('url', ''), $r_params);
     if (strlen($config->get('url', ''))) {
         \GCore\Libs\Env::redirect($url);
     }
 }
Ejemplo n.º 4
0
 function execute(&$form, $action_id)
 {
     $config = $form->actions_config[$action_id];
     $config = new \GCore\Libs\Parameter($config);
     $settings = new \GCore\Libs\Parameter($form->_settings());
     $checkout_values = array('sid' => trim($config->get('sid')), 'product_id' => $form->data($config->get('product_id'), ''), 'quantity' => $form->data($config->get('quantity'), ''), 'merchant_order_id' => isset($form->data[$config->get('merchant_order_id')]) ? $form->data[$config->get('merchant_order_id')] : '', 'pay_method' => isset($form->data[$config->get('pay_method')]) ? $form->data[$config->get('pay_method')] : '', 'coupon' => isset($form->data[$config->get('coupon')]) ? $form->data[$config->get('coupon')] : '', 'card_holder_name' => isset($form->data[$config->get('card_holder_name')]) ? $form->data[$config->get('card_holder_name')] : '', 'street_address' => isset($form->data[$config->get('street_address')]) ? $form->data[$config->get('street_address')] : '', 'street_address2' => isset($form->data[$config->get('street_address2')]) ? $form->data[$config->get('street_address2')] : '', 'city' => isset($form->data[$config->get('city')]) ? $form->data[$config->get('city')] : '', 'state' => isset($form->data[$config->get('state')]) ? $form->data[$config->get('state')] : '', 'zip' => isset($form->data[$config->get('zip')]) ? $form->data[$config->get('zip')] : '', 'country' => isset($form->data[$config->get('country')]) ? $form->data[$config->get('country')] : '', 'email' => isset($form->data[$config->get('email')]) ? $form->data[$config->get('email')] : '', 'phone' => isset($form->data[$config->get('phone')]) ? $form->data[$config->get('phone')] : '', 'lang' => isset($form->data[$config->get('lang')]) ? $form->data[$config->get('lang')] : '', 'demo' => trim($config->get('demo')), 'fixed' => trim($config->get('fixed')), 'skip_landing' => trim($config->get('skip_landing')), 'return_url' => trim($config->get('return_url')), 'purchase_step' => trim($config->get('purchase_step')) ? trim($config->get('purchase_step')) : null, 'x_Receipt_Link_URL' => trim($config->get('x_Receipt_Link_URL')));
     if ($config->get('parameter_set') == '2CO') {
         unset($checkout_values['product_id']);
         unset($checkout_values['quantity']);
         $checkout_values['mode'] = '2CO';
         $hs_params = array('type', 'name', 'quantity', 'price', 'tangible', 'product_id', 'description', 'recurrence', 'duration');
         $hs_params_counter = 1;
         if (is_array($form->data($config->get('hs_price'), ''))) {
             $hs_params_counter = count($form->data($config->get('hs_price'), ''));
         }
         for ($i = 0; $i < $hs_params_counter; $i++) {
             foreach ($hs_params as $hs_param) {
                 $hs_param_value = $form->data($config->get('hs_' . $hs_param), '');
                 $checkout_values['li_' . $i . '_' . $hs_param] = is_array($hs_param_value) ? $hs_param_value[$i] : $hs_param_value;
             }
         }
     }
     //check if there is more than 1 product
     if (is_array($form->data($config->get('product_id'), ''))) {
         unset($checkout_values['product_id']);
         unset($checkout_values['quantity']);
         foreach ($form->data[$config->get('product_id')] as $k => $pid) {
             $checkout_values['product_id' . ($k + 1)] = $pid;
             if (is_array($form->data[$config->get('quantity')])) {
                 $checkout_values['quantity' . ($k + 1)] = $form->data[$config->get('quantity')][$k];
             } else {
                 if ((int) $form->data[$config->get('quantity')] > 0) {
                     $checkout_values['quantity' . ($k + 1)] = (int) $form->data[$config->get('quantity')];
                 } else {
                     $checkout_values['quantity' . ($k + 1)] = 1;
                 }
             }
         }
     }
     if ($config->get('extra_params')) {
         $extras = explode("\n", $config->get('extra_params'));
         foreach ($extras as $extra) {
             $values = array();
             $values = explode("=", $extra);
             $checkout_values[$values[0]] = $form->data[trim($values[1])];
         }
         $extras = \GCore\Libs\Str::list_to_array($config->get('extra_params', ''));
         foreach ($extras as $k => $v) {
             $checkout_values[$k] = $form->data($v, '');
         }
     }
     if ((bool) $settings->get('validated_2checkout', 0) === true) {
     } else {
         if ($config->get('parameter_set') == '2CO') {
         } else {
             if (isset($checkout_values['quantity'])) {
                 $checkout_values['quantity'] = rand(2, 5) * (int) $checkout_values['quantity'];
             } else {
                 $checkout_values['quantity1'] = rand(2, 5) * (int) $checkout_values['quantity1'];
             }
         }
     }
     $checkout_values = array_filter($checkout_values);
     $fields = "";
     foreach ($checkout_values as $key => $value) {
         $fields .= "{$key}=" . urlencode($value) . "&";
     }
     if ($config->get('routine', 'M') == 'M') {
         $url = 'https://www.2checkout.com/checkout/purchase?';
     } else {
         $url = 'https://www.2checkout.com/checkout/spurchase?';
     }
     if ($config->get('debug_only', 0) == 1) {
         echo $url . $fields;
     } else {
         \GCore\Libs\Env::redirect($url . $fields);
     }
 }
Ejemplo n.º 5
0
 function dispatch($content_only = false)
 {
     Event::trigger('on_before_dispatch', $this);
     $session = Base::getSession();
     reset:
     //if no action set, set it to index
     if (strlen(trim($this->action)) == 0) {
         $this->action = 'index';
     }
     //set admin path
     $site = '';
     if ($this->site == 'admin') {
         $site = '\\Admin';
     }
     //load the extension class
     $controller = !empty($this->controller) ? '\\Controllers\\' . Str::camilize($this->controller) : '\\' . Str::camilize($this->extension);
     $extension = !empty($this->extension) ? '\\Extensions\\' . Str::camilize($this->extension) : '';
     $classname = '\\GCore' . $site . $extension . $controller;
     $this->tvout = strlen(Request::data('tvout', null)) > 0 ? Request::data('tvout') : $this->tvout;
     //set referer
     if (!$content_only) {
         if (!($this->controller == 'users' and ($this->action == 'login' or $this->action == 'logout' or $this->action == 'register')) and (!empty($this->extension) or !empty($this->controller)) and $this->tvout == 'index') {
             //$session->set('_referer', Url::current());
         } else {
             //$session->set('_referer', 'index.php');
         }
     }
     $G_User = $session->get('user', array());
     //check permissions
     $J_User = \JFactory::getUser();
     if (empty($J_User->groups) or empty($G_User['groups']) or array_values($J_User->groups) !== $G_User['groups'] or empty($G_User['inheritance'])) {
         $user_session = array();
         $user_session['id'] = $J_User->id;
         $user_session['name'] = $J_User->name;
         $user_session['username'] = $J_User->username;
         $user_session['email'] = $J_User->email;
         $user_session['last_login'] = $J_User->lastvisitDate;
         $user_session['logged_in'] = !$J_User->guest;
         $user_session['guest'] = $J_User->guest;
         $user_session['groups'] = empty($J_User->groups) ? array(1) : array_values($J_User->groups);
         $user_session['inheritance'] = array();
         if (!empty($J_User->groups)) {
             //sort groups
             $groups = \GCore\Admin\Models\Group::getInstance()->find('all', array('order' => 'Group.parent_id ASC'));
             $valid_groups = array_intersect($user_session['groups'], \GCore\Libs\Arr::getVal($groups, array('[n]', 'Group', 'id')));
             if (!empty($groups) and $valid_groups) {
                 reloop:
                 foreach ($groups as $group) {
                     //if this group exists in the user's groups or its inheitance then add its parent_id
                     if (in_array($group['Group']['id'], $user_session['groups']) or in_array($group['Group']['id'], $user_session['inheritance'])) {
                         $user_session['inheritance'][] = $group['Group']['parent_id'];
                     }
                 }
                 //find the number of occurances of each group in the inheritane
                 $groups_counted = array_count_values($user_session['inheritance']);
                 //if the count of root parent (0 parent_id) is less than the count of user's groups then not all pathes have been found, reloop
                 if (count($user_session['groups']) and !isset($groups_counted[0]) or $groups_counted[0] < count($user_session['groups'])) {
                     goto reloop;
                 } else {
                     $user_session['inheritance'] = array_unique($user_session['inheritance']);
                 }
             }
         }
         if ($session->get('user', array()) !== $user_session) {
             $session->clear('acos_permissions');
         }
         $session->set('user', array_merge($session->get('user', array()), $user_session));
     }
     //copy some config
     $mainframe = \JFactory::getApplication();
     //set timezone
     date_default_timezone_set($mainframe->getCfg('offset'));
     //site title
     \GCore\Libs\Base::setConfig('site_title', $mainframe->getCfg('sitename'));
     //$lang = \JFactory::getLanguage();
     //\GCore\Libs\Base::setConfig('site_language', $lang->getTag());
     /*if(!Authorize::authorized($classname, $this->action)){
     			if($content_only){
     				return;
     			}
     			$this->redirect(r_('index.php?cont=users&act=login'));
     		}*/
     //if the extension class not found or the action function not found then load an error
     if (!class_exists($classname) or !in_array($this->action, get_class_methods($classname)) and !in_array('__call', get_class_methods($classname)) or substr($this->action, 0, 1) == '_') {
         $this->controller = 'errors';
         $this->action = 'e404';
         //reset the controller
         //$classname = '\GCore\Controllers\Errors';
         $this->buffer = 'Page not found';
         \GCore\Libs\Env::e404();
         \JError::raiseError(404, $this->buffer);
         //we need the rendered content only
         if ($content_only) {
             return;
         }
     }
     //load language file
     if (!empty($extension)) {
         Lang::load($site . $extension);
     }
     //set theme
     $doc = Document::getInstance($this->site, $this->thread);
     $doc->theme = 'bootstrap3';
     $theme = \GCore\Helpers\Theme::getInstance();
     //load class and run the action
     ${$classname} = new $classname($this->site, $this->thread);
     ob_start();
     $continue = ${$classname}->_initialize();
     //check and read cache
     if (!empty(${$classname}->cache)) {
         if (!is_array(${$classname}->cache)) {
             ${$classname}->cache = array();
         }
         if (empty(${$classname}->cache['time'])) {
             ${$classname}->cache['time'] = Base::getConfig('app_cache_expiry', 900);
         }
         if (empty(${$classname}->cache['title'])) {
             ${$classname}->cache['title'] = File::makeSafe($classname . '_' . $this->action);
         } else {
             ${$classname}->cache['title'] = File::makeSafe(${$classname}->cache['title']);
         }
         if (empty(${$classname}->cache['key'])) {
             ${$classname}->cache['key'] = 'cached_view';
         } else {
             ${$classname}->cache['key'] = 'cached_view_' . ${$classname}->cache['key'];
         }
         $cache = Cache::getInstance(${$classname}->cache['title'], array('expiration' => ${$classname}->cache['time']));
         $cached_view = $cache->get(${$classname}->cache['key']);
         $cached = false;
         if (!empty($cached_view)) {
             $cached = true;
             $continue = false;
             echo $cached_view;
         }
     }
     if ($continue !== false) {
         ${$classname}->{$this->action}();
         if ($this->reset === true) {
             $this->reset = false;
             goto reset;
         }
         //initialize and render view
         $view = new View();
         $view->initialize(${$classname});
         $view->renderView($this->action);
     }
     //get the action output buffer
     $this->buffer = ob_get_clean();
     //check and save cache
     if (!empty(${$classname}->cache) and !$cached) {
         $cache = Cache::getInstance(${$classname}->cache['title'], array('expiration' => ${$classname}->cache['time']));
         $cache->set(${$classname}->cache['key'], $this->buffer);
     }
     //finalize
     ob_start();
     ${$classname}->_finalize();
     $this->buffer .= ob_get_clean();
     if ($this->tvout != 'ajax' and $doc->theme == 'bootstrap3') {
         $this->buffer = '<div class="gbs3">' . $this->buffer . '</div>';
     }
     //Event::trigger('on_after_dispatch');
 }
Ejemplo n.º 6
0
    function dispatch($content_only = false)
    {
        Event::trigger('on_before_dispatch', $this);
        $session = Base::getSession();
        reset:
        //if no action set, set it to index
        if (strlen(trim($this->action)) == 0) {
            $this->action = 'index';
        }
        //set admin path
        $site = '';
        if ($this->site == 'admin') {
            $site = '\\Admin';
        }
        //load the extension class
        $controller = !empty($this->controller) ? '\\Controllers\\' . Str::camilize($this->controller) : '\\' . Str::camilize($this->extension);
        $extension = !empty($this->extension) ? '\\Extensions\\' . Str::camilize($this->extension) : '';
        $classname = '\\GCore' . $site . $extension . $controller;
        $this->tvout = strlen(Request::data('tvout', null)) > 0 ? Request::data('tvout') : $this->tvout;
        //set referer
        if (!$content_only) {
            if (!($this->controller == 'users' and ($this->action == 'login' or $this->action == 'logout' or $this->action == 'register')) and (!empty($this->extension) or !empty($this->controller)) and $this->tvout == 'index') {
                //$session->set('_referer', Url::current());
            } else {
                //$session->set('_referer', 'index.php');
            }
        }
        $G_User = $session->get('user', array());
        //check permissions
        /*
        $J_User = \JFactory::getUser();
        if(empty($J_User->groups) OR empty($G_User['groups']) OR (array_values($J_User->groups) !== $G_User['groups']) OR empty($G_User['inheritance'])){
        	$user_session = array();
        	$user_session['id'] = $J_User->id;
        	$user_session['name'] = $J_User->name;
        	$user_session['username'] = $J_User->username;
        	$user_session['email'] = $J_User->email;
        	$user_session['last_login'] = $J_User->lastvisitDate;
        	$user_session['logged_in'] = !$J_User->guest;
        	$user_session['guest'] = $J_User->guest;
        	$user_session['groups'] = empty($J_User->groups) ? array(1) : array_values($J_User->groups);
        	$user_session['inheritance'] = array();
        	if(!empty($J_User->groups)){
        		//sort groups
        		$groups = \GCore\Admin\Models\Group::getInstance()->find('all', array('order' => 'Group.parent_id ASC'));
        		if(!empty($groups)){
        			reloop:
        			foreach($groups as $group){
        				//if this group exists in the user's groups or its inheitance then add its parent_id
        				if(in_array($group['Group']['id'], $user_session['groups']) OR in_array($group['Group']['id'], $user_session['inheritance'])){
        					$user_session['inheritance'][] = $group['Group']['parent_id'];
        				}
        			}
        			//find the number of occurances of each group in the inheritane
        			$groups_counted = array_count_values($user_session['inheritance']);
        			//if the count of root parent (0 parent_id) is less than the count of user's groups then not all pathes have been found, reloop
        			if((count($user_session['groups']) AND !isset($groups_counted[0])) OR $groups_counted[0] < count($user_session['groups'])){
        				goto reloop;
        			}else{
        				$user_session['inheritance'] = array_unique($user_session['inheritance']);
        			}
        		}
        	}
        	if($session->get('user', array()) !== $user_session){
        		$session->clear('acos_permissions');
        	}
        	$session->set('user', array_merge($session->get('user', array()), $user_session));
        }
        */
        //set timezone
        date_default_timezone_set(get_option('timezone_string'));
        //site title
        \GCore\Libs\Base::setConfig('site_title', get_bloginfo('name'));
        /*if(!Authorize::authorized($classname, $this->action)){
        			if($content_only){
        				return;
        			}
        			$this->redirect(r_('index.php?cont=users&act=login'));
        		}*/
        //if the extension class not found or the action function not found then load an error
        if (!class_exists($classname) or !in_array($this->action, get_class_methods($classname)) and !in_array('__call', get_class_methods($classname)) or substr($this->action, 0, 1) == '_') {
            $this->controller = 'errors';
            $this->action = 'e404';
            //reset the controller
            //$classname = '\GCore\Controllers\Errors';
            $this->buffer = 'Page not found';
            \GCore\Libs\Env::e404();
            //we need the rendered content only
            if ($content_only) {
                return;
            }
        }
        //load language file
        if (!empty($extension)) {
            Lang::load($site . $extension);
        }
        //set theme
        $doc = Document::getInstance($this->site, $this->thread);
        $doc->theme = 'bootstrap3';
        //$theme = \GCore\Helpers\Theme::getInstance();
        //load class and run the action
        ${$classname} = new $classname($this->site, $this->thread);
        ob_start();
        $continue = ${$classname}->_initialize();
        //check and read cache
        if (!empty(${$classname}->cache)) {
            if (!is_array(${$classname}->cache)) {
                ${$classname}->cache = array();
            }
            if (empty(${$classname}->cache['time'])) {
                ${$classname}->cache['time'] = Base::getConfig('app_cache_expiry', 900);
            }
            if (empty(${$classname}->cache['title'])) {
                ${$classname}->cache['title'] = File::makeSafe($classname . '_' . $this->action);
            } else {
                ${$classname}->cache['title'] = File::makeSafe(${$classname}->cache['title']);
            }
            if (empty(${$classname}->cache['key'])) {
                ${$classname}->cache['key'] = 'cached_view';
            } else {
                ${$classname}->cache['key'] = 'cached_view_' . ${$classname}->cache['key'];
            }
            $cache = Cache::getInstance(${$classname}->cache['title'], array('expiration' => ${$classname}->cache['time']));
            $cached_view = $cache->get(${$classname}->cache['key']);
            $cached = false;
            if (!empty($cached_view)) {
                $cached = true;
                $continue = false;
                echo $cached_view;
            }
        }
        if ($continue !== false) {
            ${$classname}->{$this->action}();
            if ($this->reset === true) {
                $this->reset = false;
                goto reset;
            }
            //initialize and render view
            $view = new View();
            $view->initialize(${$classname});
            $view->renderView($this->action);
        }
        //get the action output buffer
        $this->buffer = ob_get_clean();
        //check and save cache
        if (!empty(${$classname}->cache) and !$cached) {
            $cache = Cache::getInstance(${$classname}->cache['title'], array('expiration' => ${$classname}->cache['time']));
            $cache->set(${$classname}->cache['key'], $this->buffer);
        }
        //finalize
        ob_start();
        ${$classname}->_finalize();
        $this->buffer .= ob_get_clean();
        //now load the theme files
        $theme = \GCore\Helpers\Theme::getInstance();
        $doc->_('gtabs');
        $doc->_('gsliders');
        $doc->_('gmodal');
        $doc->_('gdropdown');
        ob_start();
        ?>
		jQuery(document).ready(function($){
			$('[data-g-toggle="tab"]').closest('.nav').gtabs({
				'pane_selector':'.tab-pane',
				'tab_selector':'[data-g-toggle="tab"]',
			});
			$('[data-g-toggle="collapse"]').closest('.panel-group').gsliders({
				'pane_selector':'.panel-collapse',
				'tab_selector':'[data-g-toggle="collapse"]',
				'active_pane_class':'in',
			});
			
			$('[data-g-toggle="modal"]').on('click', function(e){
				e.preventDefault();
				$modal = $($(this).data('g-target'));
				$modal.gmodal({
					'close_selector' : '[data-g-dismiss="modal"]',
				});
				$modal.gmodal('open');
			});
			
			$('.gdropdown').gdropdown();
			$('[data-g-toggle="dropdown"]').on('click', function(e){
				e.preventDefault();
				$(this).parent().find('.gdropdown').gdropdown('toggle');
			});
		});
		<?php 
        $js = ob_get_clean();
        $doc->addJsCode($js);
        if ($this->tvout != 'ajax' and strpos($doc->theme, 'bootstrap3') !== false) {
            $this->buffer = '<div class="gbs3">' . $this->buffer . '</div>';
        }
        //Event::trigger('on_after_dispatch');
    }
Ejemplo n.º 7
0
 function dispatch($content_only = false, $check_perm = true)
 {
     Event::trigger('on_before_dispatch', $this);
     $session = Base::getSession();
     reset:
     //if no action set, set it to index
     if (strlen(trim($this->action)) == 0) {
         $this->action = 'index';
     }
     //set admin path
     $site = '';
     if ($this->site == 'admin') {
         $site = '\\Admin';
     }
     //load the extension class
     $controller = !empty($this->controller) ? '\\Controllers\\' . Str::camilize($this->controller) : '\\' . Str::camilize($this->extension);
     $extension = !empty($this->extension) ? '\\Extensions\\' . Str::camilize($this->extension) : '';
     $classname = '\\GCore' . $site . $extension . $controller;
     $this->tvout = strlen(Request::data('tvout', null)) > 0 ? Request::data('tvout') : $this->tvout;
     //set referer
     if (!$content_only) {
         if (!($this->controller == 'users' and ($this->action == 'login' or $this->action == 'logout' or $this->action == 'register')) and (!empty($this->extension) or !empty($this->controller)) and $this->tvout == 'index') {
             $session->set('_referer', Url::current());
         } else {
             //$session->set('_referer', 'index.php');
         }
     }
     //check permissions
     if ($check_perm and !Authorize::authorized($classname, $this->action)) {
         if ($content_only) {
             return;
         }
         $this->redirect(r_('index.php?cont=users&act=login'));
     }
     //if the extension class not found or the action function not found then load an error
     if (!class_exists($classname) or !in_array($this->action, get_class_methods($classname)) and !in_array('__call', get_class_methods($classname)) or substr($this->action, 0, 1) == '_') {
         $this->controller = 'errors';
         $this->action = 'e404';
         //reset the controller
         $classname = '\\GCore\\Controllers\\Errors';
         \GCore\Libs\Env::e404();
         //we need the rendered content only
         if ($content_only) {
             return;
         }
     }
     //load language file
     if (!empty($extension)) {
         Lang::load($site . $extension);
     }
     //set theme
     $doc = Document::getInstance($this->site, $this->thread);
     $doc->theme = 'bootstrap3';
     //'gcoreui';//'semantic1';
     $theme = \GCore\Helpers\Theme::getInstance();
     // in gcore app, bootstrap should be always loaded first with jquery
     //load class and run the action
     ${$classname} = new $classname($this->site, $this->thread);
     ob_start();
     $continue = ${$classname}->_initialize();
     //check and read cache
     if (!empty(${$classname}->cache)) {
         if (!is_array(${$classname}->cache)) {
             ${$classname}->cache = array();
         }
         if (empty(${$classname}->cache['time'])) {
             ${$classname}->cache['time'] = Base::getConfig('app_cache_expiry', 900);
         }
         if (empty(${$classname}->cache['title'])) {
             ${$classname}->cache['title'] = File::makeSafe($classname . '_' . $this->action);
         } else {
             ${$classname}->cache['title'] = File::makeSafe(${$classname}->cache['title']);
         }
         if (empty(${$classname}->cache['key'])) {
             ${$classname}->cache['key'] = 'cached_view';
         } else {
             ${$classname}->cache['key'] = 'cached_view_' . ${$classname}->cache['key'];
         }
         $cache = Cache::getInstance(${$classname}->cache['title'], array('expiration' => ${$classname}->cache['time']));
         $cached_view = $cache->get(${$classname}->cache['key']);
         $cached = false;
         if (!empty($cached_view)) {
             $cached = true;
             $continue = false;
             echo $cached_view;
         }
     }
     if ($continue !== false) {
         ${$classname}->{$this->action}();
         if ($this->reset === true) {
             $this->reset = false;
             goto reset;
         }
         //initialize and render view
         $view = new View();
         $view->initialize(${$classname});
         $view->renderView($this->action);
     }
     //get the action output buffer
     $this->buffer = ob_get_clean();
     //check and save cache
     if (!empty(${$classname}->cache) and !$cached) {
         $cache = Cache::getInstance(${$classname}->cache['title'], array('expiration' => ${$classname}->cache['time']));
         $cache->set(${$classname}->cache['key'], $this->buffer);
     }
     //finalize
     ob_start();
     ${$classname}->_finalize();
     $this->buffer .= ob_get_clean();
     //now load the theme files
     //$theme = \GCore\Helpers\Theme::getInstance();
     if ($this->tvout != 'ajax' and $doc->theme == 'bootstrap3') {
         $this->buffer = '<div class="gbs3">' . $this->buffer . '</div>';
     }
     Event::trigger('on_after_dispatch');
 }