function setLang($lang) { // read global var $app global $app; // check if given lang exists if (in_array($lang, $app['param']['available_trans'])) { $_SESSION['lang'] = $lang; } else { // set the default language $_SESSION['lang'] = getDefaultLang(); } }
public function testGetDefaultLang() { //test get default testLang $this->assertEquals(getDefaultLang(), "testLang"); }
* @global (str) $HTMLEDITOR htmleditor toggle for auth user * @global (str) $TIMEZONE timezone for auth user * @global (str) $LANG language for auth user */ // grab cookie user data from userid.xml global $datau, $USR, $HTMLEDITOR, $USRTIMEZONE, $USRLANG; extract(getUserData(true)); /** * Global Language Data * * @global (array) $i18n i18n token keyed translation array * @global (str) $LANG IETF langcode (w/underscore delim) [tag]_[subtag] */ global $i18n, $LANG; // load language $LANG = getDefaultLang(); // set global language from config heirarchy i18n_merge(null); // load $LANG file into $i18n i18n_mergeDefault(); // load GSDEFAULTLANG or GSMERGELANG lang into $i18n to override ugly missing {} tokens if set //save php locale setOldLocale(); /** * Globals for salt and authentication data * * @global (obj) $dataa, authorization xml raw obj from GSDATAOTHERPATH.GSAUTHFILE * @global (str) $SALT, salt from gsconfig else authorization file * @global (str) $SESSIONHASH used for stateless session confirmation, or as non-expiring nonce for certain operations */ global $dataa, $SALT, $SESSIONHASH;
$note = $xmls->addChild('TEMPLATE'); $note->addCData($TEMPLATE); $xmls->addChild('PRETTYURLS', $PRETTYURLS); $xmls->addChild('PERMALINK', $PERMALINK); $xmls->addChild('EMAIL', $SITEEMAIL); $xmls->addChild('TIMEZONE', $SITETIMEZONE); $xmls->addChild('LANG', $SITELANG); $xmls->addChild('SITEUSR', $SITEUSR); $xmls->addChild('SITEABOUT', $SITEABOUT); exec_action('settings-website'); // @hook settings-website website data file before save if (!XMLsave($xmls, GSDATAOTHERPATH . GSWEBSITEFILE)) { $error = i18n_r('CHMOD_ERROR'); } # see new language file immediately $newlang = getDefaultLang(); include GSLANGPATH . $newlang . '.php'; if (!$error) { $success = i18n_r('ER_SETTINGS_UPD') . '. <a href="settings.php?undo&nonce=' . get_nonce("undo") . '">' . i18n_r('UNDO') . '</a>'; generate_sitemap(); } } # are any of the control panel checkboxes checked? if ($PRETTYURLS != '') { $prettychck = 'checked'; } # get all available language files if ($LANG == '') { $LANG = GSDEFAULTLANG; } if (count($lang_array) != 0) {