Esempio n. 1
0
 /**
  * Gets basic data from the CMS (e.g Joomla) and stores in the #SPConfig instance
  */
 public function getBasicCfg()
 {
     $cfg = SPFactory::config();
     $cfg->set('live_site', JURI::root());
     $cfg->set('live_site_root', JURI::getInstance()->toString(array('scheme', 'host', 'port')));
     $cfg->set('tmp_path', $this->JConfigValue('config.tmp_path'));
     $cfg->set('from', $this->JConfigValue('config.mailfrom'), 'mail');
     $cfg->set('mailer', $this->JConfigValue('config.mailer'), 'mail');
     $cfg->set('fromname', $this->JConfigValue('config.fromname'), 'mail');
     $cfg->set('smtpauth', $this->JConfigValue('config.smtpauth'), 'mail');
     $cfg->set('smtphost', $this->JConfigValue('config.smtphost'), 'mail');
     $cfg->set('smtpuser', $this->JConfigValue('config.smtpuser'), 'mail');
     $cfg->set('smtppass', $this->JConfigValue('config.smtppass'), 'mail');
     $cfg->set('smtpsecure', $this->JConfigValue('config.smtpsecure'), 'mail');
     $cfg->set('smtpport', $this->JConfigValue('config.smtpport'), 'mail');
     $cfg->set('unicode', $this->JConfigValue('unicodeslugs'), 'sef');
     $lang = $this->JConfigValue('language');
     if (!$lang) {
         $lang = SPRequest::cmd('language');
     }
     $cfg->set('language', $lang);
     $cfg->set('secret', $this->JConfigValue('secret'));
     $cfg->set('site_name', $this->JConfigValue('config.sitename'));
     $cfg->set('images_folder', SOBI_ROOT . '/media/sobipro/');
     $cfg->set('img_folder_live', JURI::root() . '/media/sobipro');
     $cfg->set('ftp_mode', $this->JConfigValue('config.ftp_enable'));
     $cfg->set('time_offset', $this->JConfigValue('offset'));
     $cfg->set('root_path', SOBI_PATH);
     $cfg->set('cms_root_path', SOBI_ROOT);
     $cfg->set('live_path', SOBI_LIVE_PATH);
     if (defined('SOBIPRO_ADM')) {
         $cfg->set('adm_img_folder_live', Sobi::FixPath(JURI::root() . '/' . SOBI_ADM_FOLDER . '/images'));
     }
     $cfg->set('img_folder_path', SOBI_ROOT . '/media/sobipro');
     if ($this->JConfigValue('config.ftp_enable')) {
         if (!file_exists($this->JConfigValue('config.tmp_path') . '/SobiPro')) {
             if (!@mkdir($this->JConfigValue('config.tmp_path') . '/SobiPro')) {
                 JFolder::create($this->JConfigValue('config.tmp_path') . '/SobiPro', 0775);
             }
         }
         $cfg->set('temp', $this->JConfigValue('config.tmp_path') . '/SobiPro', 'fs');
     } else {
         $cfg->set('temp', SOBI_PATH . '/tmp', 'fs');
     }
     // try mkdir because it's always used by apache
     if (!Sobi::Cfg('cache.store', false)) {
         if ($this->JConfigValue('config.ftp_enable')) {
             if (!file_exists($this->JConfigValue('config.tmp_path') . '/SobiPro/Cache')) {
                 if (!mkdir($this->JConfigValue('config.tmp_path') . '/SobiPro/Cache')) {
                     // really ;)
                     if (!JFolder::create($this->JConfigValue('config.tmp_path') . '/SobiPro/Cache', 0775)) {
                         SPFactory::message()->setSilentSystemMessage(Sobi::e('CANNOT_CREATE_CACHE_DIRECTORY'), SPC::ERROR_MSG);
                     }
                 }
             }
             $cfg->set('store', $this->JConfigValue('config.tmp_path') . '/SobiPro/Cache/');
         }
     }
     // Mon, Jun 29, 2015 10:52:09 - compat mode
     if ($cfg->get('template.icon_fonts_arr', -1) == -1) {
         $cfg->set('icon_fonts_arr', array('font-awesome-local'), 'template');
     }
     if (!is_array($cfg->get('template.icon_fonts_arr', -1))) {
         $cfg->change('icon_fonts_arr', array($cfg->get('template.icon_fonts_arr', -1)), 'template');
     }
 }