Esempio n. 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', $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();
         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;
     }
 }
 function getModules($position, $container = false)
 {
     $modules = $this->fetchModules();
     $output = '';
     //ob_start();
     if (!empty($modules)) {
         foreach ($modules as $module) {
             if (!empty($module['Module']['position']) and $module['Module']['position'] == $position) {
                 //check if the module is enabled in the current page
                 if ($this->site != 'admin' and !in_array('0', $module['Module']['pages'], true) and !in_array(Request::data('_Route.index'), $module['Module']['pages'], true)) {
                     continue;
                 }
                 //check permissions
                 if (!empty($module['Module']['rules']['display']) and !Authorize::check_rules($module['Module']['rules']['display'])) {
                     continue;
                 }
                 $output .= \GCore\Helpers\Module::render($module['Module'], $container);
             }
         }
     }
     //$output = ob_get_clean();
     return $output;
 }