mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-03-11 05:28:48 +01:00
Use GLOBALS
This commit is contained in:
parent
0f4192e582
commit
4be7d21958
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
if (empty($phpgw_info['server']['translation_system'])){$phpgw_info['server']['translation_system'] = 'sql';}
|
if (empty($GLOBALS['phpgw_info']['server']['translation_system']))
|
||||||
include(PHPGW_API_INC.'/class.translation_'.$phpgw_info['server']['translation_system'].'.inc.php');
|
{
|
||||||
?>
|
$GLOBALS['phpgw_info']['server']['translation_system'] = 'sql';
|
||||||
|
}
|
||||||
|
include(PHPGW_API_INC.'/class.translation_' . $GLOBALS['phpgw_info']['server']['translation_system'].'.inc.php');
|
||||||
|
?>
|
||||||
|
@ -29,23 +29,22 @@
|
|||||||
function translate($key, $vars=false )
|
function translate($key, $vars=false )
|
||||||
{
|
{
|
||||||
if ( ! $vars ) $vars = array();
|
if ( ! $vars ) $vars = array();
|
||||||
global $phpgw, $phpgw_info, $lang;
|
|
||||||
$ret = $key;
|
$ret = $key;
|
||||||
if (!isset($lang) || !$lang)
|
if (!isset($GLOBALS['lang']) || !$GLOBALS['lang'])
|
||||||
{
|
{
|
||||||
if (isset($phpgw_info['user']['preferences']['common']['lang']) &&
|
if (isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) &&
|
||||||
$phpgw_info['user']['preferences']['common']['lang'])
|
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
|
||||||
{
|
{
|
||||||
$userlang = $phpgw_info['user']['preferences']['common']['lang'];
|
$userlang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$userlang = 'en';
|
$userlang = 'en';
|
||||||
}
|
}
|
||||||
$sql = "select message_id,content from lang where lang like '".$userlang."' ".
|
$sql = "select message_id,content from lang where lang like '".$userlang."' ".
|
||||||
"and (app_name like '".$phpgw_info['flags']['currentapp']."' or app_name like 'common' or app_name like 'all')";
|
"and (app_name like '".$GLOBALS['phpgw_info']['flags']['currentapp']."' or app_name like 'common' or app_name like 'all')";
|
||||||
|
|
||||||
if (strcasecmp ($phpgw_info['flags']['currentapp'], 'common')>0)
|
if (strcasecmp ($GLOBALS['phpgw_info']['flags']['currentapp'], 'common')>0)
|
||||||
{
|
{
|
||||||
$sql .= ' order by app_name asc';
|
$sql .= ' order by app_name asc';
|
||||||
}
|
}
|
||||||
@ -54,22 +53,22 @@
|
|||||||
$sql .= ' order by app_name desc';
|
$sql .= ' order by app_name desc';
|
||||||
}
|
}
|
||||||
|
|
||||||
$phpgw->db->query($sql,__LINE__,__FILE__);
|
$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
|
||||||
$phpgw->db->next_record();
|
$GLOBALS['phpgw']->db->next_record();
|
||||||
$count = $phpgw->db->num_rows();
|
$count = $GLOBALS['phpgw']->db->num_rows();
|
||||||
for ($idx = 0; $idx < $count; ++$idx)
|
for ($idx = 0; $idx < $count; ++$idx)
|
||||||
{
|
{
|
||||||
$lang[strtolower ($phpgw->db->f('message_id'))] = $phpgw->db->f('content');
|
$GLOBALS['lang'][strtolower ($GLOBALS['phpgw']->db->f('message_id'))] = $GLOBALS['phpgw']->db->f('content');
|
||||||
$phpgw->db->next_record();
|
$GLOBALS['phpgw']->db->next_record();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($lang[strtolower ($key)]) && $lang[strtolower ($key)])
|
if (isset($GLOBALS['lang'][strtolower ($key)]) && $GLOBALS['lang'][strtolower ($key)])
|
||||||
{
|
{
|
||||||
$ret = $lang[strtolower ($key)];
|
$ret = $GLOBALS['lang'][strtolower ($key)];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ret = $key."*";
|
$ret = $key . '*';
|
||||||
}
|
}
|
||||||
$ndx = 1;
|
$ndx = 1;
|
||||||
while( list($key,$val) = each( $vars ) )
|
while( list($key,$val) = each( $vars ) )
|
||||||
@ -82,23 +81,22 @@
|
|||||||
|
|
||||||
function add_app($app)
|
function add_app($app)
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info, $lang;
|
if ($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
|
||||||
if ($phpgw_info['user']['preferences']['common']['lang'])
|
|
||||||
{
|
{
|
||||||
$userlang = $phpgw_info['user']['preferences']['common']['lang'];
|
$userlang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$userlang = 'en';
|
$userlang = 'en';
|
||||||
}
|
}
|
||||||
$sql = "select message_id,content from lang where lang like '".$userlang."' and app_name like '".$app."'";
|
$sql = "select message_id,content from lang where lang like '".$userlang."' and app_name like '".$app."'";
|
||||||
$phpgw->db->query($sql,__LINE__,__FILE__);
|
$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
|
||||||
$phpgw->db->next_record();
|
$GLOBALS['phpgw']->db->next_record();
|
||||||
$count = $phpgw->db->num_rows();
|
$count = $GLOBALS['phpgw']->db->num_rows();
|
||||||
for ($idx = 0; $idx < $count; ++$idx)
|
for ($idx = 0; $idx < $count; ++$idx)
|
||||||
{
|
{
|
||||||
$lang[strtolower ($phpgw->db->f('message_id'))] = $phpgw->db->f('content');
|
$GLOBALS['lang'][strtolower ($GLOBALS['phpgw']->db->f('message_id'))] = $GLOBALS['phpgw']->db->f('content');
|
||||||
$phpgw->db->next_record();
|
$GLOBALS['phpgw']->db->next_record();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user