//-----------------------------------------------------------------------------------------------
function show_users_online()
{
- global $show_users_online, $db;
+ global $show_users_online, $db, $GetText;
if (!isset($show_users_online) || $show_users_online == 0 || !defined('TB_PREF') ||
- !isset($_SESSION['get_text']) || !isset($db))
+ !isset($GetText) || !isset($db))
return "";
$result = db_query("SHOW TABLES LIKE '".TB_PREF."useronline'");
if (db_num_rows($result) == 1)
//
function display_languages()
{
- global $table_style, $installed_languages, $dflt_lang;
+ global $table_style, $installed_languages, $dflt_lang, $GetText;
$th = array(_("Language"), _("Name"), _("Encoding"), _("Right To Left"),
_("Installed"), _("Available"), _("Default"), "", "");
else
alt_table_row_color($k);
- $support = $_SESSION['get_text']->check_support($lang, $charset);
+ $support = $GetText->check_support($lang, $charset);
if (function_exists('gettext') && !$support && !get_post('DisplayAll')) continue;
define('GETTEXT_PHP', 2);
function get_text_init($managerType = GETTEXT_NATIVE) {
-
- if (!isset($_SESSION['get_text'])) {
+ global $GetText;
+ if (!isset($GetText)) {
if ($managerType == GETTEXT_NATIVE)
{
if (function_exists('gettext'))
{
- $_SESSION['get_text'] = new gettext_native_support();
+ $GetText = new gettext_native_support();
return;
}
}
// fail back to php support
- $_SESSION['get_text'] = new gettext_php_support();
+ $GetText = new gettext_php_support();
}
}
*/
function gettext($key)
{
- $value = $this->_get_translation($key);
+ $value = $this->_get_translation($key);
if ($value === false) {
$str = sprintf('Unable to locate gettext key "%s"', $key);
//$err = new GetText_Error($str);
$this->_jobs[] = array($domain, $path);
return;
}
- // Don't fill the domains with false data
+ // Don't fill the domains with false data, it increased the error.log
if (strpos($domain, $this->_lang_code) === false)
return;
$d = new gettext_domain();
$d->name = $domain;
$d->path = $path;
-
if (!file_exists($php_domain) || (filemtime($php_domain) < filemtime($src_domain)))
{
Set current gettext domain path
*/
function set_ext_domain($path='') {
- global $path_to_root;
+ global $path_to_root, $GetText;
static $domain_stack = array('');
if ($path) // save path on domain stack
}
$lang_path = $path_to_root . ($path ? '/' : '') .$path.'/lang';
- // ignore change when extension does not provide translation structure and test for valid session.
- if (file_exists($lang_path) && isset($_SESSION['get_text']))
- $_SESSION['get_text']->add_domain($_SESSION['language']->code,
+ // ignore change when extension does not provide translation structure and test for valid gettext.
+ if (file_exists($lang_path) && isset($GetText))
+ $GetText->add_domain($_SESSION['language']->code,
$lang_path, $path ? '' : $_SESSION['language']->version);
}
?>
function set_language($code)
{
- global $path_to_root, $installed_languages;
+ global $path_to_root, $installed_languages, $GetText;
$lang = array_search_value($code, $installed_languages, 'code');
$changed = $this->code != $code || $this->version != @$lang['version'];
$this->is_locale_file = file_exists($locale);
}
- $_SESSION['get_text']->set_language($this->code, $this->encoding);
- $_SESSION['get_text']->add_domain($this->code, $path_to_root . "/lang", $this->version);
+ $GetText->set_language($this->code, $this->encoding);
+ $GetText->add_domain($this->code, $path_to_root . "/lang", $this->version);
// Necessary for ajax calls. Due to bug in php 4.3.10 for this
// version set globally in php.ini
}
}
-function _set($key,$value)
-{
- $_SESSION['get_text']->set_var($key,$value);
-}
-
if (!function_exists("_"))
{
function _($text)
{
- if (!isset($_SESSION['get_text'])) // Don't allow using session if not is net.
+ global $GetText;
+ if (!isset($GetText)) // Don't allow using gettext if not is net.
return $text;
- $retVal = $_SESSION['get_text']->gettext($text);
+
+ $retVal = $GetText->gettext($text);
if ($retVal == "")
return $text;
return $retVal;
$_SESSION['OBSOLETE'] = true;
$_SESSION['EXPIRES'] = time() + 10;
- // Create new session destroying the old one if posiible
- if (phpversion() >= "5.1.0")
- session_regenerate_id(true);
- else
- session_regenerate_id();
+ // Create new session without destroying the old one
+ session_regenerate_id();
// Grab current session ID and close both sessions to allow other scripts to use them
$newSession = session_id();
$Session_manager = new SessionManager();
$Session_manager->sessionStart('FA'.md5(dirname(__FILE__)));
-//session_name('FA'.md5(dirname(__FILE__)));
-//session_start();
// this is to fix the "back-do-you-want-to-refresh" issue - thanx PHPFreaks
header("Cache-control: private");
$installed_languages = array();
$_SESSION['language']->set_language($_SESSION['language']->code);
-$_SESSION['get_text']->add_domain( $_SESSION['language']->code, $path_to_root."/install/lang");
+$GetText->add_domain( $_SESSION['language']->code, $path_to_root."/install/lang");
include_once($path_to_root . "/version.php");
include_once($path_to_root . "/includes/main.inc");
*/
function SetLang($code=null)
{
- global $installed_languages, $dflt_lang, $path_to_root, $local_path_to_root;
+ global $installed_languages, $dflt_lang, $path_to_root, $local_path_to_root, $GetText;
if (!$code)
$code = $dflt_lang;
$lang = array_search_value($code, $installed_languages, 'code');
- $_SESSION['get_text']->set_language($lang['code'], strtoupper($lang['encoding']));
+ $GetText->set_language($lang['code'], strtoupper($lang['encoding']));
// $local_path_to_root is set inside find_custom_file.
// Select extension domain if po file is provided
// otherwise use global translation.
if (file_exists($local_path_to_root.'/lang/'.$lang['code'].'/LC_MESSAGES/'.$lang['code'].'.po'))
- $_SESSION['get_text']->add_domain($lang['code'], $local_path_to_root . "/lang");
+ $GetText->add_domain($lang['code'], $local_path_to_root . "/lang");
else
- $_SESSION['get_text']->add_domain($lang['code'], $path_to_root . "/lang", @$lang['version']);
+ $GetText->add_domain($lang['code'], $path_to_root . "/lang", @$lang['version']);
// re-read translated sys names.
include($path_to_root.'/includes/sysnames.inc');