Exemple #1
0
 /**
  * load_settings()
  * 
  * Initialisation des pr�f�rences et du moteur de templates
  * 
  * @param array $admindata    Donn�es utilisateur
  * 
  * @return void
  */
 function load_settings($admindata = array())
 {
     global $nl_config, $lang, $datetime;
     if (!defined('IN_COMMANDLINE')) {
         global $output;
         $template_path = WA_ROOTDIR . '/templates/' . (defined('IN_ADMIN') ? 'admin/' : '');
         $output = new output($template_path);
         $output->addScript(WA_ROOTDIR . '/templates/DOM-Compat/DOM-Compat.js');
         if (defined('IN_ADMIN')) {
             $output->addScript(WA_ROOTDIR . '/templates/admin/admin.js');
         }
     }
     if (!is_array($admindata)) {
         $admindata = array();
     }
     if (!empty($admindata['admin_lang'])) {
         $nl_config['language'] = $admindata['admin_lang'];
     }
     if (!empty($admindata['admin_dateformat'])) {
         $nl_config['date_format'] = $admindata['admin_dateformat'];
     }
     $language_path = wa_realpath(WA_ROOTDIR . '/language/lang_' . $nl_config['language'] . '.php');
     if (!file_exists($language_path)) {
         $nl_config['language'] = 'francais';
         $language_path = wa_realpath(WA_ROOTDIR . '/language/lang_' . $nl_config['language'] . '.php');
         if (!file_exists($language_path)) {
             trigger_error('<b>Les fichiers de localisation sont introuvables !</b>', CRITICAL_ERROR);
         }
     }
     require $language_path;
     $lang['CHARSET'] = strtoupper($lang['CHARSET']);
 }