Beispiel #1
0
 public function __construct($config = array(), AContainer $container = null)
 {
     // Call the parent constructor
     parent::__construct($config, $container);
     // Get the Joomla! version from the configuration or the session
     if (array_key_exists('jversion', $config)) {
         $jVersion = $config['jversion'];
     } else {
         $jVersion = $this->container->session->get('jversion', '2.5.0');
     }
     // Load the configuration variables from the session or the default configuration shipped with ANGIE
     $this->configvars = $this->container->session->get('configuration.variables');
     if (empty($this->configvars)) {
         // Get default configuration based on the Joomla! version
         if (version_compare($jVersion, '2.5.0', 'ge') && version_compare($jVersion, '3.0.0', 'lt')) {
             $v = '25';
         } else {
             $v = '30';
         }
         $className = 'J' . $v . 'Config';
         $filename = APATH_INSTALLATION . '/platform/models/jconfig/j' . $v . '.php';
         $this->configvars = $this->loadFromFile($filename, $className);
         if (!empty($this->configvars)) {
             $this->saveToSession();
         }
     }
 }
Beispiel #2
0
 public function __construct($config = array(), AContainer $container = null)
 {
     // Call the parent constructor
     parent::__construct($config, $container);
     // Load the configuration variables from the session or the default configuration shipped with ANGIE
     $this->configvars = $this->container->session->get('configuration.variables');
     if (empty($this->configvars)) {
         $this->configvars = $this->loadFromFile(APATH_ROOT . '/app/config/local.php');
         if (!empty($this->configvars)) {
             $this->saveToSession();
         }
     }
 }
 public function __construct($config = array(), AContainer $container = null)
 {
     // Call the parent constructor
     parent::__construct($config, $container);
     // Load the configuration variables from the session or the default configuration shipped with ANGIE
     $this->configvars = $this->container->session->get('configuration.variables');
     if (empty($this->configvars)) {
         $this->configvars = $this->getDefaultConfig();
         $realConfig = $this->loadFromFile(APATH_CONFIGURATION . '/config/settings.inc.php');
         $this->configvars = array_merge($this->configvars, $realConfig);
         if (!empty($this->configvars)) {
             $this->saveToSession();
         }
     }
 }
Beispiel #4
0
 public function __construct($config = array(), AContainer $container = null)
 {
     // Call the parent constructor
     parent::__construct($config, $container);
     // Load the configuration variables from the session or the default configuration shipped with ANGIE
     $this->configvars = $this->container->session->get('configuration.variables');
     if (empty($this->configvars) || empty($this->configvars['default']['sitename'])) {
         $this->configvars = $this->getDefaultConfig();
         $realConfig = array();
         if (empty($this->configvars['default']['sitename'])) {
             $folders = $this->getSettingsFolders();
             // For each folder, read its settings.php file
             foreach ($folders as $folder) {
                 $realConfig[$folder] = $this->loadFromFile(APATH_ROOT . '/sites/' . $folder . '/settings.php');
             }
             // Let's assign these partial info to the class, so I can use them later
             $this->configvars = array_merge($this->configvars, $realConfig);
             // Ok I got all the database configuration, let's detect if I have a monodb or a multidb environment
             $master = $realConfig['default'];
             $multidb = false;
             foreach ($realConfig as $folder => $settings) {
                 if ($folder == 'default') {
                     continue;
                 }
                 // If the host or the db name is different, this is a multidb environment
                 if ($settings['dbhost'] != $master['dbhost'] || $settings['dbname'] != $master['dbname']) {
                     $multidb = true;
                     break;
                 }
             }
             $this->configvars['multidb'] = $multidb;
             // Great, now that I know how the whole database is structured, I can actually start reading the options
             // of every site stored inside the database
             foreach ($folders as $folder) {
                 $this->getOptionsFromDatabase($folder, $realConfig[$folder]);
             }
         }
         $this->configvars = array_merge($this->configvars, $realConfig);
         if (!empty($this->configvars)) {
             $this->saveToSession();
         }
     }
 }
Beispiel #5
0
 public function __construct($config = array(), AContainer $container = null)
 {
     // Call the parent constructor
     parent::__construct($config, $container);
     // Get the Moodle version from the configuration or the session
     if (array_key_exists('version', $config)) {
         $moodleVersion = $config['version'];
     } else {
         $moodleVersion = $this->container->session->get('version', '2.0.0');
     }
     // Load the configuration variables from the session or the default configuration shipped with ANGIE
     $this->configvars = $this->container->session->get('configuration.variables');
     if (empty($this->configvars)) {
         $this->configvars = $this->getDefaultConfig();
         $realConfig = $this->loadFromFile(APATH_CONFIGURATION . '/config.php');
         $this->configvars = array_merge($this->configvars, $realConfig);
         if (!empty($this->configvars)) {
             $this->saveToSession();
         }
     }
 }