Example #1
0
 function __construct($area, $joption, $extension, $setup = null, $cont_vars = array())
 {
     require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'gcloader.php';
     if (phpversion('pdo') !== false and in_array('mysql', PDO::getAvailableDrivers())) {
         //good, we use PDO
         \GCore\Libs\Base::setConfig('db_adapter', 'joomla');
     } else {
         \GCore\Libs\Base::setConfig('db_adapter', 'joomla');
     }
     \GCore\C::set('EXTENSIONS_PATHS', array(dirname(__FILE__) . DS . 'admin' . DS . 'extensions' . DS => JPATH_SITE . DS . 'administrator' . DS . 'components' . DS, dirname(__FILE__) . DS . 'extensions' . DS => JPATH_SITE . DS . 'components' . DS));
     \GCore\C::set('EXTENSIONS_URLS', array(\JFactory::getURI()->root() . 'libraries/cegcore/admin/extensions/' => \JFactory::getURI()->root() . 'administrator/components/', \JFactory::getURI()->root() . 'libraries/cegcore/extensions/' => \JFactory::getURI()->root() . 'components/'));
     \GCore\C::set('EXTENSIONS_NAMES', array('chronomigrator' => 'com_chronomigrator', 'chronoforms' => 'com_chronoforms5', 'chronoconnectivity' => 'com_chronoconnectivity5', 'chronoforums' => 'com_chronoforums', 'chronolistings' => 'com_chronolistings', 'chronocommunity' => 'com_chronocommunity', 'chronosearch' => 'com_chronosearch', 'chronocontact' => 'com_chronocontact', $extension => 'com_' . $joption));
     //GCore\Libs\Url::$root_ext = array('components', 'com_'.$joption);
     \GCore\Bootstrap::initialize('joomla', array('component' => 'com_' . $joption, 'ext' => $extension));
     $tvout = strlen(\GCore\Libs\Request::data('tvout', null)) > 0 ? \GCore\Libs\Request::data('tvout') : '';
     $controller = \GCore\Libs\Request::data('cont', '');
     $action = \GCore\Libs\Request::data('act', '');
     if (is_callable($setup)) {
         $return_vars = $setup();
         if (!empty($return_vars)) {
             $cont_vars = array_merge($cont_vars, $return_vars);
         }
     }
     if (isset($cont_vars['controller'])) {
         $controller = $cont_vars['controller'];
     }
     if (isset($cont_vars['action'])) {
         $action = $cont_vars['action'];
     }
     $cont_vars['_app_thread'] = 'gcore';
     ob_start();
     echo \GCore\Libs\AppJ::call($area, $extension, $controller, $action, $cont_vars);
     $output = ob_get_clean();
     $output = \GCore\C::fix_urls($output);
     if ($tvout == 'ajax') {
         echo $output;
         $mainframe = \JFactory::getApplication();
         $mainframe->close();
     } else {
         ob_start();
         $toolbar = \GCore\Helpers\Module::render(array('type' => 'toolbar', 'site' => 'admin', 'params' => ''));
         $messages = \GCore\Libs\AppJ::getSystemMessages();
         echo \GCore\Libs\AppJ::getHeader();
         if ($toolbar) {
             echo $toolbar;
             echo '<div style="clear:both;"></div>';
         }
         echo $messages;
         //echo \GCore\Libs\AppJ::getHeader();
         $system_output = ob_get_clean();
         $system_output = \GCore\C::fix_urls($system_output);
         echo $system_output;
         echo $output;
     }
 }
Example #2
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');
 }
Example #3
0
 function execute(&$form, $action_id)
 {
     $config = $form->actions_config[$action_id];
     $config = new \GCore\Libs\Parameter($config);
     ob_start();
     eval('?>' . $config->get('template', ''));
     $body = ob_get_clean();
     $others = array();
     //get recipient
     $tos = array();
     if (strlen(trim($config->get('to', '')))) {
         $tos = explode(',', \GCore\Libs\Str::replacer(trim($config->get('to', '')), $form->data));
     }
     if (strlen(trim($config->get('dto', '')))) {
         $dtos = explode(',', trim($config->get('dto', '')));
         foreach ($dtos as $dto) {
             $d_email = explode(',', $form->data($dto));
             $tos = array_merge((array) $d_email, $tos);
         }
     }
     $ccs = array();
     if (strlen(trim($config->get('cc', '')))) {
         $ccs = explode(',', \GCore\Libs\Str::replacer(trim($config->get('cc', '')), $form->data));
     }
     if (strlen(trim($config->get('dcc', '')))) {
         $dccs = explode(',', trim($config->get('dcc', '')));
         foreach ($dccs as $dcc) {
             $d_email = explode(',', $form->data($dcc));
             $ccs = array_merge((array) $d_email, $ccs);
         }
     }
     $others['cc'] = $ccs;
     $bccs = array();
     if (strlen(trim($config->get('bcc', '')))) {
         $bccs = explode(',', \GCore\Libs\Str::replacer(trim($config->get('bcc', '')), $form->data));
     }
     if (strlen(trim($config->get('dbcc', '')))) {
         $dbccs = explode(',', trim($config->get('dbcc', '')));
         foreach ($dbccs as $dbcc) {
             $d_email = explode(',', $form->data($dbcc));
             $bccs = array_merge((array) $d_email, $bccs);
         }
     }
     $others['bcc'] = $bccs;
     //subject
     $subject = trim($config->get('subject', '')) ? \GCore\Libs\Str::replacer($config->get('subject', ''), $form->data) : $form->data($config->get('dsubject', ''));
     //from
     $others['from_name'] = trim($config->get('from_name', '')) ? \GCore\Libs\Str::replacer($config->get('from_name', ''), $form->data) : $form->data($config->get('dfrom_name'), null);
     $others['from_email'] = trim($config->get('from_email', '')) ? \GCore\Libs\Str::replacer($config->get('from_email', ''), $form->data) : $form->data($config->get('dfrom_email'), null);
     //reply to
     $others['reply_name'] = trim($config->get('reply_name', '')) ? \GCore\Libs\Str::replacer($config->get('reply_name', ''), $form->data) : $form->data($config->get('dreply_name'), null);
     $others['reply_email'] = trim($config->get('reply_email', '')) ? \GCore\Libs\Str::replacer($config->get('reply_email', ''), $form->data) : $form->data($config->get('dreply_email'), null);
     $others['type'] = $config->get('email_type', 'html');
     $form->data['ip_address'] = $_SERVER['REMOTE_ADDR'];
     if ($others['type'] == 'html') {
         if ($config->get('append_ip_address', 1)) {
             $body = $body . "<br /><br />" . "IP: {ip_address}";
         }
         $body = \GCore\Libs\Str::replacer($body, $form->data, array('replace_null' => true, 'nl2br' => true, 'repeater' => 'repeater'));
     } else {
         if ($config->get('append_ip_address', 1)) {
             $body = $body . "\n\n" . "IP: {ip_address}";
         }
         $body = \GCore\Libs\Str::replacer($body, $form->data, array('replace_null' => true, 'repeater' => 'repeater'));
     }
     //attach
     $attachments = array();
     if (strlen(trim($config->get('attach', '')))) {
         ob_start();
         $attach_fields = eval('?>' . trim($config->get('attach', '')));
         ob_end_clean();
         if (is_array($attach_fields)) {
             $attachs = array_keys($attach_fields);
             foreach ($form->files as $name => $file) {
                 if (in_array($name, $attachs)) {
                     if (\GCore\Libs\Arr::is_assoc($file)) {
                         $attachments[] = array_merge($attach_fields[$name], array('path' => $file['path']));
                     } else {
                         foreach ($file as $fi => $fv) {
                             //$attachments[] = $fv['path'];
                             $attachments[] = array_merge($attach_fields[$name], array('path' => $fv['path']));
                         }
                     }
                 }
             }
         } else {
             $attachs = explode(',', trim($config->get('attach', '')));
             foreach ($form->files as $name => $file) {
                 if (in_array($name, $attachs)) {
                     if (\GCore\Libs\Arr::is_assoc($file)) {
                         $attachments[] = $file['path'];
                     } else {
                         foreach ($file as $fi => $fv) {
                             $attachments[] = $fv['path'];
                         }
                     }
                 }
             }
         }
     }
     //load global settings
     $settings = $form::_settings();
     if (!empty($settings['mail'])) {
         if (!empty($settings['mail']['smtp']) and empty($settings['mail']['mail_method'])) {
             $settings['mail']['mail_method'] = 'smtp';
         }
         foreach ($settings['mail'] as $k => $v) {
             \GCore\Libs\Base::setConfig($k, $v);
         }
     }
     //encrypt the email
     if ($config->get('encrypt_enabled', 0) == 1 and class_exists('Crypt_GPG')) {
         $mySecretKeyId = trim($config->get('gpg_sec_key', ''));
         //Add Encryption key here
         $gpg = new Crypt_GPG();
         $gpg->addEncryptKey($mySecretKeyId);
         $body = $gpg->encrypt($body);
     }
     $sent = \GCore\Libs\Mailer::send($tos, $subject, $body, $attachments, $others);
     if ($sent) {
         $form->debug[$action_id][self::$title][] = "An email with the details below was sent successfully:";
     } else {
         $form->debug[$action_id][self::$title][] = "An email with the details below could NOT be sent:";
     }
     $form->debug[$action_id][self::$title][] = "To:" . implode(", ", $tos);
     $form->debug[$action_id][self::$title][] = "Subject:" . $subject;
     $form->debug[$action_id][self::$title][] = "From name:" . $others['from_name'];
     $form->debug[$action_id][self::$title][] = "From email:" . $others['from_email'];
     $form->debug[$action_id][self::$title][] = "CC:" . implode(", ", $ccs);
     $form->debug[$action_id][self::$title][] = "BCC:" . implode(", ", $bccs);
     $form->debug[$action_id][self::$title][] = "Reply name:" . $others['reply_name'];
     $form->debug[$action_id][self::$title][] = "Reply email:" . $others['reply_email'];
     $form->debug[$action_id][self::$title][] = "Attachments:";
     $form->debug[$action_id][self::$title][] = $attachments;
     $form->debug[$action_id][self::$title][] = "Body:\n" . $body;
 }
Example #4
0
 public static function initialize($plathform = '', $params = array())
 {
     switch ($plathform) {
         default:
             //CONSTANTS
             \GCore\C::set('GCORE_FRONT_PATH', dirname(__FILE__) . DS);
             \GCore\C::set('GCORE_ADMIN_PATH', dirname(__FILE__) . DS . 'admin' . DS);
             //initialize language
             \GCore\Libs\Lang::initialize();
             //SET ERROR CONFIG
             if ((int) Libs\Base::getConfig('error_reporting') != 1) {
                 error_reporting((int) Libs\Base::getConfig('error_reporting'));
             }
             if ((bool) Libs\Base::getConfig('debug') === true) {
                 \GCore\Libs\Error::initialize();
             }
             //timezone
             date_default_timezone_set(Libs\Base::getConfig('timezone', 'UTC'));
             break;
     }
     if ($plathform == 'joomla') {
         $mainframe = \JFactory::getApplication();
         \GCore\Libs\Base::setConfig('db_host', $mainframe->getCfg('host'));
         $dbtype = $mainframe->getCfg('dbtype') == 'mysqli' ? 'mysql' : $mainframe->getCfg('dbtype');
         \GCore\Libs\Base::setConfig('db_type', $dbtype);
         \GCore\Libs\Base::setConfig('db_name', $mainframe->getCfg('db'));
         \GCore\Libs\Base::setConfig('db_user', $mainframe->getCfg('user'));
         \GCore\Libs\Base::setConfig('db_pass', $mainframe->getCfg('password'));
         \GCore\Libs\Base::setConfig('db_prefix', $mainframe->getCfg('dbprefix'));
         \GCore\C::set('GSITE_PLATFORM', 'joomla');
         \GCore\C::set('GCORE_FRONT_URL', \JFactory::getURI()->root() . 'libraries/cegcore/');
         \GCore\C::set('GCORE_ADMIN_URL', \JFactory::getURI()->root() . 'libraries/cegcore/admin/');
         \GCore\C::set('GCORE_ROOT_URL', \JFactory::getURI()->root());
         \GCore\C::set('GCORE_ROOT_PATH', dirname(dirname(dirname(__FILE__))) . DS);
         $lang = \JFactory::getLanguage();
         \GCore\Libs\Base::setConfig('site_language', $lang->getTag());
     } else {
         if ($plathform == 'wordpress') {
             global $wpdb;
             \GCore\Libs\Base::setConfig('db_host', DB_HOST);
             $dbtype = 'mysql';
             \GCore\Libs\Base::setConfig('db_type', $dbtype);
             \GCore\Libs\Base::setConfig('db_name', DB_NAME);
             \GCore\Libs\Base::setConfig('db_user', DB_USER);
             \GCore\Libs\Base::setConfig('db_pass', DB_PASSWORD);
             \GCore\Libs\Base::setConfig('db_prefix', $wpdb->prefix);
             \GCore\C::set('GSITE_PLATFORM', 'wordpress');
             \GCore\C::set('GCORE_FRONT_URL', plugins_url() . '/' . $params['component'] . '/cegcore/');
             \GCore\C::set('GCORE_ADMIN_URL', plugins_url() . '/' . $params['component'] . '/cegcore/admin/');
             \GCore\C::set('GCORE_ROOT_URL', site_url() . '/');
             \GCore\C::set('GCORE_ROOT_PATH', dirname(dirname(dirname(__FILE__))) . DS);
             \GCore\Libs\Base::setConfig('site_language', get_bloginfo('language'));
             //change the default page parameter string because WP uses the param "page"
             \GCore\Libs\Base::setConfig('page_url_param_name', 'page_num');
             if (function_exists('wp_magic_quotes')) {
                 $stripslashes_wp = function (&$value) {
                     $value = stripslashes($value);
                 };
                 array_walk_recursive($_GET, $stripslashes_wp);
                 array_walk_recursive($_POST, $stripslashes_wp);
                 array_walk_recursive($_COOKIE, $stripslashes_wp);
                 array_walk_recursive($_REQUEST, $stripslashes_wp);
             }
         } else {
             \GCore\C::set('GSITE_PLATFORM', '');
             \GCore\C::set('GCORE_FRONT_URL', \GCore\Libs\Url::root());
             \GCore\C::set('GCORE_ADMIN_URL', \GCore\Libs\Url::root() . 'admin/');
             \GCore\C::set('GCORE_ROOT_URL', \GCore\C::get('GCORE_FRONT_URL'));
             \GCore\C::set('GCORE_ROOT_PATH', dirname(__FILE__) . DS);
         }
     }
     \GCore\C::set('GSITE_PATH', \GCore\C::get('GCORE_' . strtoupper(GCORE_SITE) . '_PATH'));
     \GCore\C::set('GSITE_URL', \GCore\C::get('GCORE_' . strtoupper(GCORE_SITE) . '_URL'));
 }
Example #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'));
        		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');
    }