1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-08 17:56:52 +02:00

- added acp_language (language pack management)

- minor adjustments to cope with PHP5.x


git-svn-id: file:///svn/phpbb/trunk@5315 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2005-11-30 17:48:06 +00:00
parent ba6f40ce25
commit 1bf18e23ed
18 changed files with 1334 additions and 108 deletions

View File

@@ -92,7 +92,8 @@ class acp_bots
WHERE bot_id $sql_id";
$db->sql_query($sql);
foreach (array(USERS_TABLE, USER_GROUP_TABLE) as $table)
$_tables = array(USERS_TABLE, USER_GROUP_TABLE);
foreach ($_tables as $table)
{
$sql = "DELETE FROM $table
WHERE user_id IN (" . implode(', ', $user_id_ary) . ')';
@@ -250,7 +251,8 @@ class acp_bots
}
$s_active_options = '';
foreach (array('0' => 'NO', '1' => 'YES') as $value => $lang)
$_options = array('0' => 'NO', '1' => 'YES');
foreach ($_options as $value => $lang)
{
$selected = ($bot_row['bot_active'] == $value) ? ' selected="selected"' : '';
$s_active_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
@@ -285,7 +287,8 @@ class acp_bots
}
$s_options = '';
foreach (array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE') as $value => $lang)
$_options = array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE');
foreach ($_options as $value => $lang)
{
$s_options .= '<option value="' . $value . '">' . $user->lang[$lang] . '</option>';
}

File diff suppressed because it is too large Load Diff

View File

@@ -60,7 +60,7 @@ class acp_logs
$where_sql";
$db->sql_query($sql);
add_log('admin', 'LOG_' . strtoupper($mode) . '_CLEAR');
add_log('admin', 'LOG_CLEAR_' . strtoupper($mode));
}
}
@@ -117,7 +117,8 @@ class acp_logs
{
$data = array();
foreach (array('viewtopic', 'viewlogs', 'viewforum') as $check)
$checks = array('viewtopic', 'viewlogs', 'viewforum');
foreach ($checks as $check)
{
if (isset($row[$check]) && $row[$check])
{

View File

@@ -323,7 +323,7 @@ class bbcode
}
else
{
$this->bbcode_cache[$bbcode_id] = FALSE;
$this->bbcode_cache[$bbcode_id] = false;
}
}
}
@@ -349,7 +349,7 @@ class bbcode
if ($bbcode_id != -1 && !($this->template_bitfield & (1 << $bbcode_id)))
{
return (isset($bbcode_hardtpl[$tpl_name])) ? $bbcode_hardtpl[$tpl_name] : FALSE;
return (isset($bbcode_hardtpl[$tpl_name])) ? $bbcode_hardtpl[$tpl_name] : false;
}
if (empty($this->bbcode_template))
@@ -375,7 +375,7 @@ class bbcode
eval($tpl);
}
return (isset($this->bbcode_template[$tpl_name])) ? $this->bbcode_template[$tpl_name] : ((isset($bbcode_hardtpl[$tpl_name])) ? $bbcode_hardtpl[$tpl_name] : FALSE);
return (isset($this->bbcode_template[$tpl_name])) ? $this->bbcode_template[$tpl_name] : ((isset($bbcode_hardtpl[$tpl_name])) ? $bbcode_hardtpl[$tpl_name] : false);
}
function bbcode_tpl_replace($tpl_name, $tpl)
@@ -410,37 +410,37 @@ class bbcode
$type = 'default';
$start = 0;
}
elseif ($type == 'i')
else if ($type == 'i')
{
$tpl = 'olist_open';
$type = 'lower-roman';
$start = 1;
}
elseif ($type == 'I')
else if ($type == 'I')
{
$tpl = 'olist_open';
$type = 'upper-roman';
$start = 1;
}
elseif (preg_match('#^(disc|circle|square)$#i', $type))
else if (preg_match('#^(disc|circle|square)$#i', $type))
{
$tpl = 'ulist_open';
$type = strtolower($type);
$start = 1;
}
elseif (preg_match('#^[a-z]$#', $type))
else if (preg_match('#^[a-z]$#', $type))
{
$tpl = 'olist_open';
$type = 'lower-alpha';
$start = ord($type) - 96;
}
elseif (preg_match('#[A-Z]#', $type))
else if (preg_match('#[A-Z]#', $type))
{
$tpl = 'olist_open';
$type = 'upper-alpha';
$start = ord($type) - 64;
}
elseif (is_numeric($type))
else if (is_numeric($type))
{
$tpl = 'olist_open';
$type = 'arabic-numbers';

View File

@@ -354,7 +354,7 @@ function tz_select($default = '')
global $sys_timezone, $user;
$tz_select = '';
foreach ($user->lang['tz']['zones'] as $offset => $zone)
foreach ($user->lang['tz_zones'] as $offset => $zone)
{
if (is_numeric($offset))
{
@@ -380,7 +380,7 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
// Is user watching this thread?
if ($user_id != ANONYMOUS)
{
$can_watch = TRUE;
$can_watch = true;
if ($notify_status == 'unset')
{
@@ -415,7 +415,7 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
}
else
{
$is_watching = TRUE;
$is_watching = true;
if ($notify_status)
{
@@ -433,7 +433,7 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
{
if ($_GET['watch'] == $mode)
{
$is_watching = TRUE;
$is_watching = true;
$sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status)
VALUES ($user_id, $match_id, 0)";
@@ -977,7 +977,9 @@ function on_page($num_items, $per_page, $start)
$on_page = floor($start / $per_page) + 1;
$template->assign_var('ON_PAGE', $on_page);
$template->assign_vars(array(
'ON_PAGE' => $on_page)
);
return sprintf($user->lang['PAGE_OF'], $on_page, max(ceil($num_items / $per_page), 1));
}
@@ -1121,10 +1123,10 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
return false;
}
// re-add $SID
$use_page = ($u_action) ? $phpbb_root_path . $u_action : $phpbb_root_path . $user->page;
$u_action = (strpos($use_page, ".{$phpEx}?") !== false) ? str_replace(".{$phpEx}?", ".$phpEx$SID&", $use_page) . '&' : $use_page . '?';
$u_action .= 'confirm_key=' . $confirm_key;
// re-add $SID / transform & to &amp; for user->page (user->page is always using &
$use_page = ($u_action) ? $phpbb_root_path . $u_action : $phpbb_root_path . str_replace('&', '&amp;', $user->page);
$u_action = (strpos($use_page, ".{$phpEx}?") !== false) ? str_replace(".{$phpEx}?", ".$phpEx$SID&amp;", $use_page) : $use_page . '?';
$u_action .= '&amp;confirm_key=' . $confirm_key;
$template->assign_vars(array(
'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title],
@@ -1162,7 +1164,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
{
$username = request_var('username', '');
$password = request_var('password', '');
$autologin = (!empty($_POST['autologin'])) ? TRUE : FALSE;
$autologin = (!empty($_POST['autologin'])) ? true : false;
$viewonline = (!empty($_POST['viewonline'])) ? 0 : 1;
$admin = ($admin) ? 1 : 0;
@@ -1568,7 +1570,7 @@ function page_header($page_title = '')
{
global $db, $config, $template, $SID, $user, $auth, $phpEx, $phpbb_root_path;
define('HEADER_INC', TRUE);
define('HEADER_INC', true);
// gzip_compression
if ($config['gzip_compress'])
@@ -1695,8 +1697,8 @@ function page_header($page_title = '')
if ($total_online_users > $config['record_online_users'])
{
set_config('record_online_users', $total_online_users, TRUE);
set_config('record_online_date', time(), TRUE);
set_config('record_online_users', $total_online_users, true);
set_config('record_online_date', time(), true);
}
// Build online listing

View File

@@ -300,6 +300,11 @@ function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png')
// Add closing / if present
$dir = ($dir && substr($dir, -1) != '/') ? $dir . '/' : $dir;
if (!is_dir($rootdir . $dir))
{
return false;
}
$dh = opendir($rootdir . $dir);
while (($fname = readdir($dh)) !== false)
{

View File

@@ -15,14 +15,14 @@
class compress
{
var $fp = 0;
function add_file($src, $src_rm_prefix = '', $src_add_prefix = '', $skip_files = '')
{
global $phpbb_root_path;
$skip_files = explode(',', $skip_files);
// Remove rm prefix from src path
// Remove rm prefix from src path
$src_path = ($src_rm_prefix) ? preg_replace('#^(' . preg_quote($src_rm_prefix) . ')#', '', $src) : $src;
// Add src prefix
$src_path = ($src_add_prefix) ? ($src_add_prefix . ((substr($src_add_prefix, -1) != '/') ? '/' : '') . $src_path) : $src_path;
@@ -82,6 +82,12 @@ class compress
return true;
}
function add_custom_file($src, $filename)
{
$this->data($filename, implode('', file($src)));
return true;
}
function add_data($src, $name)
{
$this->data($name, $src);
@@ -91,12 +97,13 @@ class compress
function methods()
{
$methods = array('tar');
$available_methods = array('tar.gz' => 'zlib', 'tar.bz2' => 'bz2', 'zip' => 'zlib');
foreach (array('tar.gz' => 'zlib', 'tar.bz2' => 'bz2', 'zip' => 'zlib') as $type => $module)
foreach ($available_methods as $type => $module)
{
if (!@extension_loaded($module))
{
break;
continue;
}
$methods[] = $type;
}
@@ -312,7 +319,7 @@ class compress_zip extends compress
unset($data);
// If we didn't compress set method to store, else deflate
$c_method = ($c_len == $unc_len) ? "\x00\x00" : "\x08\x00";
$c_method = ($c_len == $unc_len) ? "\x00\x00" : "\x08\x00";
// Are we a file or a directory? Set archive for file
$attrib = ($is_dir) ? 16 : 32;
@@ -348,7 +355,7 @@ class compress_zip extends compress
$cdrec .= "\x00\x00"; // version made by
$cdrec .= "$var_ext\x00"; // version needed to extract
$cdrec .= "\x00\x00"; // gen purpose bit flag
$cdrec .= $c_method; // compression method
$cdrec .= $c_method; // compression method
$cdrec .= $hexdtime; // last mod time & date
$cdrec .= pack('V', $crc); // crc32
$cdrec .= pack('V', $c_len); // compressed filesize
@@ -372,7 +379,7 @@ class compress_zip extends compress
{
$ctrldir = implode('', $this->ctrl_dir);
return $ctrldir . $this->eof_cdh .
return $ctrldir . $this->eof_cdh .
pack('v', sizeof($this->ctrl_dir)) . // total # of entries "on this disk"
pack('v', sizeof($this->ctrl_dir)) . // total # of entries overall
pack('V', strlen($ctrldir)) . // size of central dir
@@ -548,7 +555,7 @@ class compress_tar extends compress
$header .= pack("a8", sprintf("%07o", 0));
$header .= pack("a8", sprintf("%07o", 0));
$header .= pack("a12", sprintf("%011o", $filesize));
$header .= pack("a12", sprintf("%011o", $mtime));
$header .= pack("A12", sprintf("%011o", $mtime)); // From a12 to A12
$header .= ' ';
$header .= pack("a", $typeflag);
$header .= pack("a100", '');
@@ -581,7 +588,12 @@ class compress_tar extends compress
function open()
{
$fzopen = ($this->isbz && function_exists('bzopen')) ? 'bzopen' : (($this->isgz && extension_loaded('zlib')) ? 'gzopen' : 'fopen');
return $this->fp = @$fzopen($this->file, $this->mode . 'b');
$this->fp = @$fzopen($this->file, $this->mode . 'b' . (($fzopen == 'gzopen') ? '9' : ''));
if (!$this->fp)
{
trigger_error('Unable to open file ' . $this->file . ' [' . $fzopen . ' - ' . $this->mode . 'b]');
}
}
function download($filename)
@@ -601,7 +613,7 @@ class compress_tar extends compress
case 'tar.bz2':
$mimetype = 'application/x-bzip2';
break;
default:
$mimetype = 'application/octet-stream';
break;

View File

@@ -163,7 +163,7 @@ class jabber
//EVENT: Disconnected
}
$this->returned_keep_alive = FALSE;
$this->returned_keep_alive = false;
$this->keep_alive_id = 'keep_alive_' . time();
$this->send_packet("<iq id='{$this->keep_alive_id}'/>", 'cruise_control');
$this->last_ping_time = date('H:i');
@@ -190,12 +190,12 @@ class jabber
// auth_0k
return $this->_sendauth_ok($packet['iq']['#']['query'][0]['#']['token'][0]['#'], $packet['iq']['#']['query'][0]['#']['sequence'][0]['#']);
}
elseif (@function_exists('mhash') && isset($packet['iq']['#']['query'][0]['#']['digest']))
else if (@function_exists('mhash') && isset($packet['iq']['#']['query'][0]['#']['digest']))
{
// digest
return $this->_sendauth_digest();
}
elseif ($packet['iq']['#']['query'][0]['#']['password'])
else if ($packet['iq']['#']['query'][0]['#']['password'])
{
// plain text
return $this->_sendauth_plaintext();
@@ -231,7 +231,7 @@ class jabber
$return_code = (isset($packet['iq']['#']['query'][0]['#']['registered'][0]['#'])) ? 1 : 2;
$this->jid = ($this->resource) ? "{$this->username}@{$this->server}/{$this->resource}" : "{$this->username}@{$this->server}";
}
elseif ($this->get_info_from_iq_type($packet) == 'error' && isset($packet['iq']['#']['error'][0]['#']))
else if ($this->get_info_from_iq_type($packet) == 'error' && isset($packet['iq']['#']['error'][0]['#']))
{
// "conflict" error, i.e. already registered
if ($packet['iq']['#']['error'][0]['@']['code'] == '409')
@@ -271,7 +271,7 @@ class jabber
{
$return_code = (isset($packet['iq']['#']['query'][0]['#']['registered'][0]['#'])) ? 1 : 2;
}
elseif ($this->get_info_from_iq_type($packet) == 'error' && isset($packet['iq']['#']['error'][0]['#']))
else if ($this->get_info_from_iq_type($packet) == 'error' && isset($packet['iq']['#']['error'][0]['#']))
{
// "conflict" error, i.e. already registered
if ($packet['iq']['#']['error'][0]['@']['code'] == '409')
@@ -357,7 +357,7 @@ class jabber
$return_code = 2;
}
}
elseif ($this->get_info_from_iq_type($packet) == 'error')
else if ($this->get_info_from_iq_type($packet) == 'error')
{
if (isset($packet['iq']['#']['error'][0]['#']))
{
@@ -508,13 +508,13 @@ class jabber
$type = ($type != '') ? $type : 'normal';
$funcmeth = "handler_message_$type";
}
elseif ($packet_type == 'iq')
else if ($packet_type == 'iq')
{
$namespace = $packet['iq']['#']['query'][0]['@']['xmlns'];
$namespace = str_replace(':', '_', $namespace);
$funcmeth = "handler_iq_$namespace";
}
elseif ($packet_type == 'presence')
else if ($packet_type == 'presence')
{
$type = $packet['presence']['@']['type'];
$type = ($type != '') ? $type : 'available';
@@ -527,7 +527,7 @@ class jabber
{
call_user_func($funcmeth, $packet);
}
elseif (method_exists($this, $funcmeth))
else if (method_exists($this, $funcmeth))
{
call_user_func(array(&$this, $funcmeth), $packet);
}
@@ -995,11 +995,11 @@ class make_xml extends jabber
$text .= ">\n";
}
elseif ($key == '#')
else if ($key == '#')
{
$text .= htmlspecialchars($value);
}
elseif (is_array($value))
else if (is_array($value))
{
for ($a = 0, $size = sizeof($value); $a < $size; $a++)
{

View File

@@ -640,13 +640,13 @@ class queue
{
$lines[] = "'$k'=>" . $this->format_array($v);
}
elseif (is_int($v))
else if (is_int($v))
{
$lines[] = "'$k'=>$v";
}
elseif (is_bool($v))
else if (is_bool($v))
{
$lines[] = "'$k'=>" . (($v) ? 'TRUE' : 'FALSE');
$lines[] = "'$k'=>" . (($v) ? 'true' : 'false');
}
else
{

View File

@@ -126,7 +126,9 @@ function get_folder($user_id, &$folder, $folder_id = false)
$db->sql_freeresult($result);
// Make sure the default boxes are defined
foreach (array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX) as $default_folder)
$available_folder = array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX);
foreach ($available_folder as $default_folder)
{
if (!isset($num_messages[$default_folder]))
{
@@ -904,8 +906,9 @@ function rebuild_header($check_ary)
{
${$type}[] = (int) $match[2][$id];
}
foreach (array('u', 'g') as $type)
$_types = array('u', 'g');
foreach ($_types as $type)
{
if (sizeof($$type))
{
@@ -1098,7 +1101,8 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr
{
// Build Recipient List
// u|g => array($user_id => 'to'|'bcc')
foreach (array('u', 'g') as $ug_type)
$_types = array('u', 'g');
foreach ($_types as $ug_type)
{
if (isset($data['address_list'][$ug_type]) && sizeof($data['address_list'][$ug_type]))
{

View File

@@ -202,7 +202,7 @@ function user_delete($mode, $user_id)
$db->freeresult($result);
}
set_config('num_users', $config['num_users'] - 1, TRUE);
set_config('num_users', $config['num_users'] - 1, true);
$db->sql_transaction('commit');

View File

@@ -139,7 +139,8 @@ class fulltext_phpbb
$sql_find_in = (sizeof($pid_ary)) ? 'AND ' . (($type == 'topics') ? 't.topic_id' : 'm.post_id') . ' IN (' . implode(', ', $pid_ary) . ')' : '';
$result_ary = array();
foreach (array('AND', 'OR', 'NOT') as $bool)
$_bool = array('AND', 'OR', 'NOT');
foreach ($_bool as $bool)
{
if (isset($sql_words[$bool]) && is_array($sql_words[$bool]))
{

View File

@@ -666,7 +666,8 @@ function compose_pm($id, $mode, $action)
}
$u = $g = array();
foreach (array('u', 'g') as $type)
$_types = array('u', 'g');
foreach ($_types as $type)
{
if (isset($result[$type]) && $result[$type])
{

View File

@@ -74,7 +74,8 @@ function view_folder($id, $mode, $folder_id, $folder, $type)
foreach ($folder_info['rowset'] as $message_id => $row)
{
$address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address']));
foreach (array('u', 'g') as $save)
$_save = array('u', 'g');
foreach ($_save as $save)
{
if (isset($address[$message_id][$save]) && sizeof($address[$message_id][$save]))
{
@@ -86,7 +87,8 @@ function view_folder($id, $mode, $folder_id, $folder, $type)
}
}
foreach (array('u', 'g') as $ug_type)
$_types = array('u', 'g');
foreach ($_types as $ug_type)
{
if (isset($recipient_list[$ug_type]) && sizeof($recipient_list[$ug_type]))
{

View File

@@ -279,7 +279,8 @@ class ucp_prefs
$sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
$sort_by_post_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'p.post_subject');
foreach (array('topic', 'post') as $sort_option)
$_options = array('topic', 'post');
foreach ($_options as $sort_option)
{
${'s_limit_' . $sort_option . '_days'} = '<select name="' . $sort_option . '_st">';
foreach (${'limit_' . $sort_option . '_days'} as $day => $text)