Beispiel #1
0
 public static function loadLanguage($langCode = null)
 {
     if (is_null($langCode)) {
         $langCode = self::detectLanguage();
     }
     // If we are asked to load a non-default language, load the English (Great Britain) base translation first
     if ($langCode != 'en-GB') {
         static::loadLanguage('en-GB');
     }
     // Main file
     $filename = APATH_INSTALLATION . '/' . AApplication::getInstance()->getName() . '/language/' . $langCode . '.ini';
     $strings = AngieHelperIni::parse_ini_file($filename, false);
     self::$strings = array_merge(self::$strings, $strings);
     // Platform override file
     $filename = APATH_INSTALLATION . '/' . AApplication::getInstance()->getName() . '/platform/language/' . $langCode . '.ini';
     if (!@file_exists($filename)) {
         $filename = APATH_INSTALLATION . '/platform/language/' . $langCode . '.ini';
     }
     if (@file_exists($filename)) {
         $strings = AngieHelperIni::parse_ini_file($filename, false);
         self::$strings = array_merge(self::$strings, $strings);
     }
     // Performs callback on loaded strings
     if (!empty(static::$iniProcessCallbacks) && !empty(self::$strings)) {
         foreach (static::$iniProcessCallbacks as $callback) {
             $ret = call_user_func($callback, $filename, self::$strings);
             if ($ret === false) {
                 return;
             } elseif (is_array($ret)) {
                 self::$strings = $ret;
             }
         }
     }
 }
Beispiel #2
0
 /**
  * Returns the cached databases.ini information, parsing the databases.ini
  * file if necessary.
  *
  * @return array
  */
 public function getDatabasesIni()
 {
     if (empty($this->dbini)) {
         $this->dbini = $this->container->session->get('databases.dbini', null);
         if (empty($this->dbini)) {
             $filename = APATH_INSTALLATION . '/sql/databases.ini';
             if (file_exists($filename)) {
                 $this->dbini = AngieHelperIni::parse_ini_file($filename, true);
             }
             if (!empty($this->dbini)) {
                 // Add the custom options
                 $temp = array();
                 $siteSQL = null;
                 foreach ($this->dbini as $key => $data) {
                     if (!array_key_exists('dbtech', $data)) {
                         $data['dbtech'] = null;
                     }
                     if (!array_key_exists('existing', $data)) {
                         $data['existing'] = 'drop';
                     }
                     if (!array_key_exists('prefix', $data)) {
                         $data['prefix'] = 'jos_';
                     }
                     if (!array_key_exists('foreignkey', $data)) {
                         $data['foreignkey'] = true;
                     }
                     if (!array_key_exists('noautovalue', $data)) {
                         $data['noautovalue'] = true;
                     }
                     if (!array_key_exists('replace', $data)) {
                         $data['replace'] = false;
                     }
                     if (!array_key_exists('utf8db', $data)) {
                         $data['utf8db'] = false;
                     }
                     if (!array_key_exists('utf8tables', $data)) {
                         $data['utf8tables'] = false;
                     }
                     if (!array_key_exists('utf8mb4', $data)) {
                         $data['utf8mb4'] = defined('ANGIE_ALLOW_UTF8MB4_DEFAULT') ? ANGIE_ALLOW_UTF8MB4_DEFAULT : false;
                     }
                     if (!array_key_exists('maxexectime', $data)) {
                         $data['maxexectime'] = 5;
                     }
                     if (!array_key_exists('throttle', $data)) {
                         $data['throttle'] = 250;
                     }
                     // If we are using SQLite, let's replace any token we found inside the dbname index
                     if ($data['dbtype'] == 'sqlite') {
                         $data['dbname'] = str_replace('#SITEROOT#', APATH_ROOT, $data['dbname']);
                     }
                     if ($key == 'site.sql') {
                         $siteSQL = $data;
                     } else {
                         $temp[$key] = $data;
                     }
                 }
                 $temp = array_merge(array('site.sql' => $siteSQL), $temp);
                 $this->dbini = $temp;
             }
             $this->container->session->set('databases.dbini', $this->dbini);
         }
     }
     return $this->dbini;
 }
Beispiel #3
0
 /**
  * Returns the cached databases.ini information, parsing the databases.ini
  * file if necessary.
  *
  * @return array
  */
 public function getDatabasesIni()
 {
     if (empty($this->dbini)) {
         $this->dbini = ASession::getInstance()->get('databases.dbini', null);
         if (empty($this->dbini)) {
             $filename = APATH_INSTALLATION . '/sql/databases.ini';
             if (file_exists($filename)) {
                 $this->dbini = AngieHelperIni::parse_ini_file($filename, true);
             }
             if (!empty($this->dbini)) {
                 // Add the custom options
                 $temp = array();
                 $siteSQL = null;
                 foreach ($this->dbini as $key => $data) {
                     if (!array_key_exists('dbtech', $data)) {
                         $data['dbtech'] = null;
                     }
                     if (!array_key_exists('existing', $data)) {
                         $data['existing'] = 'drop';
                     }
                     if (!array_key_exists('prefix', $data)) {
                         $data['prefix'] = 'jos_';
                     }
                     if (!array_key_exists('foreignkey', $data)) {
                         $data['foreignkey'] = true;
                     }
                     if (!array_key_exists('noautovalue', $data)) {
                         $data['noautovalue'] = true;
                     }
                     if (!array_key_exists('replace', $data)) {
                         $data['replace'] = false;
                     }
                     if (!array_key_exists('utf8db', $data)) {
                         $data['utf8db'] = false;
                     }
                     if (!array_key_exists('utf8tables', $data)) {
                         $data['utf8tables'] = false;
                     }
                     if (!array_key_exists('utf8mb4', $data)) {
                         $data['utf8mb4'] = defined('ANGIE_ALLOW_UTF8MB4_DEFAULT') ? ANGIE_ALLOW_UTF8MB4_DEFAULT : false;
                     }
                     if (!array_key_exists('maxexectime', $data)) {
                         $data['maxexectime'] = 5;
                     }
                     if (!array_key_exists('throttle', $data)) {
                         $data['throttle'] = 250;
                     }
                     if ($key == 'site.sql') {
                         $siteSQL = $data;
                     } else {
                         $temp[$key] = $data;
                     }
                 }
                 $temp = array_merge(array('site.sql' => $siteSQL), $temp);
                 $this->dbini = $temp;
             }
             ASession::getInstance()->set('databases.dbini', $this->dbini);
         }
     }
     return $this->dbini;
 }
Beispiel #4
0
 public function getExtraInfo()
 {
     static $extraInfo = null;
     if (is_null($extraInfo)) {
         $filename = APATH_INSTALLATION . '/extrainfo.ini';
         if (file_exists($filename)) {
             $parsedData = AngieHelperIni::parse_ini_file($filename, false);
             $extraInfo = array();
             if (array_key_exists('host', $parsedData)) {
                 $extraInfo['host'] = array('label' => AText::_('MAIN_EXTRAINFO_HOST'), 'current' => $parsedData['host']);
             }
             if (array_key_exists('backup_date', $parsedData)) {
                 $extraInfo['backup_date'] = array('label' => AText::_('MAIN_EXTRAINFO_BACKUPDATE'), 'current' => $parsedData['backup_date'] . ' UTC');
             }
             if (array_key_exists('akeeba_version', $parsedData)) {
                 $extraInfo['akeeba_version'] = array('label' => AText::_('MAIN_EXTRAINFO_AKEEBAVERSION'), 'current' => $parsedData['akeeba_version']);
             }
             if (array_key_exists('php_version', $parsedData)) {
                 $extraInfo['php_version'] = array('label' => AText::_('MAIN_EXTRAINFO_PHPVERSION'), 'current' => $parsedData['php_version']);
             }
         }
     }
     return $extraInfo;
 }