function load_language_file($lang, $module = 'lcm', $force = false) { $name = $module . '_' . $lang; if (@is_readable('inc/lang/' . $name . '.php')) { $GLOBALS['idx_lang'] = 'i18n_' . $name; include_lcm('lang/' . $name); lcm_debug($name . ": Language file loaded", 5); } else { // If the language file of the module does not exist, we fallback // on English, which *by definition* must exist. We then recopy the // 'en' table in the variable related to the requested language if (@is_readable('inc/lang/' . $module . '_en.php')) { $GLOBALS['idx_lang'] = 'i18n_' . $module . '_en'; include_lcm('lang/' . $module . '_en'); } $GLOBALS['i18n_' . $name] = $GLOBALS['i18n_' . $module . '_en']; lcm_log("Translation does not exist or file not readable. Fellback on English"); } lcm_debug($name . ": " . count($GLOBALS['i18n_' . $name]) . " string(s)", 5); // The local system administrator can overload official strings if (include_config_exists('perso')) { lcm_debug("Loading inc/lang/perso.php", 5); overload_lang('perso'); } if (include_config_exists('perso_' . $lang)) { lcm_debug("Loading inc/lang/perso_" . $lang . ".php", 5); overload_lang('perso_' . $lang); } }
$textbox .= "</form>\n"; return $textbox; } function get_number_admins() { $query = "SELECT name_first, name_middle, name_last, username\n\t\t\t FROM lcm_author\n\t\t\t WHERE status = 'admin'"; $result = lcm_query($query); $number = lcm_num_rows($result); return $number; } // // Main program // use_language_of_visitor(); // Test if the software is already installed if (include_config_exists('inc_connect')) { install_html_start(); // forbidden area echo "<div class='box_error'>\n"; echo "<h3>" . _T('warning_forbidden_area') . "</h3>\n"; echo "<p>" . _T('warning_already_installed') . "</p>\n"; echo "</div>\n"; install_html_end(); exit; } // // Main installation steps // $step = $_REQUEST['step']; function install_step_5() {
$err = $dt . ": {$filename},{$linenum} " . $errortype[$errno] . " ({$errno}) {$errmsg}\n" . lcm_getbacktrace(false); // false = without html if (in_array($errno, $log_errors)) { lcm_log($err); } else { // [ML] Annoying errors. We are not limiting LCM to PHP5 syntax for now. if (preg_match('/^var: Deprecated. Please use the public\\/private\\/protected modifiers/', $errmsg)) { return; } lcm_debug("[dbg] " . $err, 2); } // set our custom errno, because PHP doesn't seem to have one! $GLOBALS['lcm_errormsg'] = $errmsg; } $old_error_handler = set_error_handler("userErrorHandler"); $flag_connect = include_config_exists('inc_connect'); function lcm_query($query, $accept_fail = false) { include_lcm('inc_db'); // We silently fail if there is no database, this avoids // many warnings while installation, for example. if ($GLOBALS['flag_connect']) { include_config('inc_connect'); if (!$GLOBALS['db_ok']) { return; } } $GLOBALS['db_query_count']++; return lcm_query_db($query, $accept_fail); } function spip_query($query)
lcm_query("UPDATE lcm_author \n\t\t\t\tSET prefs = '" . addslashes(serialize($prefs)) . "' \n\t\t\t\tWHERE id_author = " . $row_author['id_author']); } // Change the language of the private area (or login) // [ML] I once wanted to put this in a function, and it did a hell // of a mess because of the session handling stuff.. if (isset($_REQUEST['var_lang_lcm'])) { // ex: bg, fr, en, en_uk, etc. nothing else is accepted if (preg_match("/^[_A-Za-z]+[0-9]*\$/", $_REQUEST['var_lang_lcm'])) { include_lcm('inc_lang'); include_lcm('inc_session'); $new_lang = clean_input($_REQUEST['var_lang_lcm']); $valid_author = verifier_visiteur(); if (lcm_set_language($new_lang)) { lcm_setcookie('lcm_lang', $new_lang, time() + 365 * 24 * 3600); // Save language preference only if we are installed and if author connected if ($valid_author && include_config_exists('inc_connect')) { include_lcm('inc_admin'); lcm_query("UPDATE lcm_author \n\t\t\t\t\t\tSET lang = '" . $new_lang . "' \n\t\t\t\t\t\tWHERE id_author = " . $GLOBALS['author_session']['id_author']); $author_session['lang'] = $new_lang; lcm_add_session($author_session, $_COOKIE['lcm_session']); } else { lcm_log("Not valid_author ({$valid_author}) or not yet installed"); } $cible->delvar('lang'); $cible->addvar('lang', $new_lang); } else { lcm_log("lcm_set_language() is not happy, wrong lang code?"); } } } // Redirection