Ejemplo n.º 1
0
 /**
  * Init config of the module
  */
 public function saveConfig()
 {
     $configObj = new \config(PROFILE_PATH . '/' . $this->name . '/config.php', TRUE);
     $config = array();
     include $this->name . '/config.php';
     $config = array_intersect_key(\app::$config, $config);
     $configObj->saveConfig($config);
 }
Ejemplo n.º 2
0
 /**
  * Save configuration in the file
  * @param string $file
  * @param string $config
  * @return string 
  */
 protected function saveConfigAction($file, $config)
 {
     $configObj = new \config($file, TRUE);
     $action = 'ParsimonyAdmin.loadBlock(\'modules\');';
     if ($_SESSION['permissions'] & 2) {
         if (isset($config['sitename']) && $config['sitename'] != \app::$config['sitename']) {
             $action = 'top.window.location.reload()';
         }
     } else {
         if (isset($config['sitename']) && $config['sitename'] != \app::$config['sitename']) {
             $action = 'top.window.location.reload()';
         }
         $config = array('sitename' => $config['sitename']);
     }
     $configObj->saveConfig($config);
     return $this->returnResult(array('eval' => $action, 'notification' => t('The Config has been saved'), 'notificationType' => 'positive'));
 }
Ejemplo n.º 3
0
 /**
  * Detetermine Locale from current HTTP request
  */
 protected function determineLocale()
 {
     if (isset($_COOKIE['locale']) && isset(self::$locales[$_COOKIE['locale']])) {
         $this->locale = $_COOKIE['locale'];
     } else {
         $this->locale = app::$config['localization']['default_language'];
     }
     setlocale(LC_ALL, $this->locale);
     date_default_timezone_set(app::$config['localization']['timezone']);
     $pathCache = 'var/cache/' . $this->locale . '-lang';
     $lang = '';
     if (is_file($pathCache . '.php')) {
         include $pathCache . '.php';
     } else {
         foreach (app::$activeModules as $moduleName => $type) {
             if (is_file('modules/' . $moduleName . '/locale/' . $this->locale . '.php')) {
                 include 'modules/' . $moduleName . '/locale/' . $this->locale . '.php';
             }
         }
         $config = new \config($pathCache . '.php', TRUE);
         $config->setVariable('lang');
         $config->saveConfig($lang);
         \tools::file_put_contents($pathCache . '.js', substr($config->getContent(), 5, false));
     }
     app::$lang = $lang;
 }