1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-09-09 15:50:45 +02:00

Compare commits

..

1 Commits

Author SHA1 Message Date
(no author)
22bb74f32f This commit was manufactured by cvs2svn to create tag 'milestone_3'.
git-svn-id: file:///svn/phpbb/tags/milestone_3@5258 89ea8834-ac86-4346-8a33-228a782c2dd0
2005-10-04 21:47:20 +00:00
611 changed files with 87362 additions and 48751 deletions

9
phpBB/.htaccess Normal file
View File

@@ -0,0 +1,9 @@
<Files "config.php">
Order Allow,Deny
Deny from All
</Files>
<Files "common.php">
Order Allow,Deny
Deny from All
</Files>

File diff suppressed because it is too large Load Diff

308
phpBB/adm/admin_ban.php Normal file
View File

@@ -0,0 +1,308 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_ban'))
{
return;
}
$filename = basename(__FILE__);
$module['USER']['BAN_USERS'] = $filename . "$SID&amp;mode=user";
$module['USER']['BAN_EMAILS'] = $filename . "$SID&amp;mode=email";
$module['USER']['BAN_IPS'] = $filename . "$SID&amp;mode=ip";
return;
}
define('IN_PHPBB', 1);
// Load default header
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.'.$phpEx);
// Do we have ban permissions?
if (!$auth->acl_get('a_ban'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Mode setting
$mode = request_var('mode', '');
$bansubmit = (isset($_POST['bansubmit'])) ? true : false;
$unbansubmit= (isset($_POST['unbansubmit'])) ? true : false;
// Set some vars
$current_time = time();
// Start program
if ($bansubmit)
{
// Grab the list of entries
$ban = request_var('ban', '');
$ban_len = request_var('banlength', 0);
$ban_len_other = request_var('banlengthother', '');
$ban_exclude = request_var('banexclude', 0);
$ban_reason = request_var('banreason', '');
user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason);
trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']);
}
else if ($unbansubmit)
{
$ban = request_var('unban', '');
user_unban($mode, $ban);
trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']);
}
//
// Output relevant entry page
//
//
// Ban length options
//
$ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['OTHER'] . ' -&gt; ');
$ban_end_options = '';
foreach ($ban_end_text as $length => $text)
{
$ban_end_options .= '<option value="' . $length . '">' . $text . '</option>';
}
// Title
switch ($mode)
{
case 'user':
$l_title = $user->lang['BAN_USERS'];
break;
case 'email':
$l_title = $user->lang['BAN_EMAILS'];
break;
case 'ip':
$l_title = $user->lang['BAN_IPS'];
break;
}
// Output page
adm_page_header($l_title);
?>
<p><?php echo $user->lang['BAN_EXPLAIN']; ?></p>
<?php
switch ($mode)
{
case 'user':
$field = 'username';
$l_ban_title = $user->lang['BAN_USERS'];
$l_ban_explain = $user->lang['BAN_USERNAME_EXPLAIN'];
$l_ban_exclude_explain = $user->lang['BAN_USER_EXCLUDE_EXPLAIN'];
$l_unban_title = $user->lang['UNBAN_USERNAME'];
$l_unban_explain = $user->lang['UNBAN_USERNAME_EXPLAIN'];
$l_ban_cell = $user->lang['USERNAME'] . ': <br /><span class="gensmall">[ <a href="' . "../memberlist.$phpEx$SID&amp;mode=searchuser&amp;form=banning&amp;field=ban\" onclick=\"window.open('../memberlist.$phpEx$SID&amp;mode=searchuser&amp;form=banning&amp;field=ban', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;\">" . $user->lang['FIND_USERNAME'] .'</a> ]</span>';
$l_no_ban_cell = $user->lang['NO_BANNED_USERS'];
$sql = 'SELECT b.*, u.user_id, u.username
FROM ' . BANLIST_TABLE . ' b, ' . USERS_TABLE . ' u
WHERE (b.ban_end >= ' . time() . '
OR b.ban_end = 0)
AND u.user_id = b.ban_userid
AND b.ban_userid <> 0
AND u.user_id <> ' . ANONYMOUS . '
ORDER BY u.user_id ASC';
break;
case 'ip':
$field = 'ban_ip';
$l_ban_title = $user->lang['BAN_IPS'];
$l_ban_explain = $user->lang['BAN_IP_EXPLAIN'];
$l_ban_exclude_explain = $user->lang['BAN_IP_EXCLUDE_EXPLAIN'];
$l_unban_title = $user->lang['UNBAN_IP'];
$l_unban_explain = $user->lang['UNBAN_IP_EXPLAIN'];
$l_ban_cell = $user->lang['IP_HOSTNAME'] . ':';
$l_no_ban_cell = $user->lang['NO_BANNED_IP'];
$sql = 'SELECT *
FROM ' . BANLIST_TABLE . '
WHERE (ban_end >= ' . time() . "
OR ban_end = 0)
AND ban_ip <> ''";
break;
case 'email':
$field = 'ban_email';
$l_ban_title = $user->lang['BAN_EMAILS'];
$l_ban_explain = $user->lang['BAN_EMAIL_EXPLAIN'];
$l_ban_exclude_explain = $user->lang['BAN_EMAIL_EXCLUDE_EXPLAIN'];
$l_unban_title = $user->lang['UNBAN_EMAIL'];
$l_unban_explain = $user->lang['UNBAN_EMAIL_EXPLAIN'];
$l_ban_cell = $user->lang['EMAIL_ADDRESS'] . ':';
$l_no_ban_cell = $user->lang['NO_BANNED_EMAIL'];
$sql = 'SELECT *
FROM ' . BANLIST_TABLE . '
WHERE (ban_end >= ' . time() . "
OR ban_end = 0)
AND ban_email <> ''";
break;
}
$result = $db->sql_query($sql);
$banned_options = '';
$ban_length = $ban_reasons = array();
if ($row = $db->sql_fetchrow($result))
{
do
{
$banned_options .= '<option' . (($row['ban_exclude']) ? ' class="sep"' : '') . ' value="' . $row['ban_id'] . '">' . $row[$field] . '</option>';
$time_length = (!empty($row['ban_end'])) ? ($row['ban_end'] - $row['ban_start']) / 60 : 0;
$ban_length[$row['ban_id']] = (!empty($ban_end_text[$time_length])) ? $ban_end_text[$time_length] : $user->lang['OTHER'] . ' -> ' . gmdate('Y-m-d', $row['ban_end']);
$ban_reasons[$row['ban_id']] = addslashes($row['ban_reason']);
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
?>
<h1><?php echo $l_ban_title; ?></h1>
<p><?php echo $l_ban_explain; ?></p>
<script language="Javascript" type="text/javascript">
<!--
var ban_length = new Array();
<?php
if (sizeof($ban_length))
{
foreach ($ban_length as $ban_id => $length)
{
echo "ban_length['$ban_id'] = \"$length\";\n";
}
}
?>
var ban_reason = new Array();
<?php
if (sizeof($ban_reasons))
{
foreach ($ban_reasons as $ban_id => $reason)
{
echo "ban_reason['$ban_id'] = \"$reason\";\n";
}
}
?>
function display_details(option)
{
document.forms[0].unbanreason.value = ban_reason[option];
document.forms[0].unbanlength.value = ban_length[option];
}
//-->
</script>
<form name="banning" method="post" action="<?php echo "admin_ban.$phpEx$SID&amp;mode=$mode"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $l_ban_title; ?></th>
</tr>
<tr>
<td class="row1" width="45%"><?php echo $l_ban_cell; ?></td>
<td class="row2"><textarea cols="40" rows="3" name="ban"></textarea></td>
</tr>
<tr>
<td class="row1" width="45%"><?php echo $user->lang['BAN_LENGTH']; ?>:</td>
<td class="row2"><select name="banlength"><?php echo $ban_end_options; ?></select>&nbsp; <input class="post" type="text" name="banlengthother" maxlength="10" size="10" /></td>
</tr>
<tr>
<td class="row1" width="45%"><?php echo $user->lang['BAN_EXCLUDE']; ?>: <br /><span class="gensmall"><?php echo $l_ban_exclude_explain;;?></span></td>
<td class="row2"><input type="radio" name="banexclude" value="1" /> <?php echo $user->lang['YES']; ?> &nbsp; <input type="radio" name="banexclude" value="0" checked="checked" /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
<td class="row1" width="45%"><?php echo $user->lang['BAN_REASON']; ?>:</td>
<td class="row2"><input class="post" type="text" name="banreason" maxlength="255" size="40" /></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"> <input type="submit" name="bansubmit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" />&nbsp; <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" />&nbsp;</td>
</tr>
</table>
<h1><?php echo $l_unban_title; ?></h1>
<p><?php echo $l_unban_explain; ?></p>
<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $l_unban_title; ?></th>
</tr>
<?php
if ($banned_options)
{
?>
<tr>
<td class="row1" width="45%"><?php echo $l_ban_cell; ?>: <br /></td>
<td class="row2"> <select name="unban[]" multiple="multiple" size="5" onchange="display_details(this.options[this.selectedIndex].value)"><?php echo $banned_options; ?></select></td>
</tr>
<tr>
<td class="row1" width="45%"><?php echo $user->lang['BAN_REASON']; ?>:</td>
<td class="row2"><input class="row1" style="border:0px" type="text" name="unbanreason" size="40" /></td>
</tr>
<tr>
<td class="row1" width="45%"><?php echo $user->lang['BAN_LENGTH']; ?>:</td>
<td class="row2"><input class="row1" style="border:0px" type="text" name="unbanlength" size="40" /></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="unbansubmit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" />&nbsp; <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td>
</tr>
<?php
}
else
{
?>
<tr>
<td class="row2" colspan="2" align="center"><?php echo $l_no_ban_cell; ?></td>
</tr>
<?php
}
?>
</table></form>
<?php
adm_page_footer();
?>

440
phpBB/adm/admin_bbcodes.php Normal file
View File

@@ -0,0 +1,440 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_bbcode'))
{
return;
}
$module['POST']['BBCODES'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Do we have general permissions?
if (!$auth->acl_get('a_bbcode'))
{
trigger_error('NO_ADMIN');
}
// Set up general vars
$mode = request_var('mode', '');
$bbcode_id = request_var('bbcode', 0);
// Set up mode-specific vars
switch ($mode)
{
case 'add':
$bbcode_match = $bbcode_tpl = '';
break;
case 'edit':
$sql = 'SELECT bbcode_match, bbcode_tpl
FROM ' . BBCODES_TABLE . '
WHERE bbcode_id = ' . $bbcode_id;
$result = $db->sql_query($sql);
if (!$row = $db->sql_fetchrow($result))
{
trigger_error('BBCODE_NOT_EXIST');
}
$db->sql_freeresult($result);
$bbcode_match = $row['bbcode_match'];
$bbcode_tpl = htmlspecialchars($row['bbcode_tpl']);
break;
case 'modify':
$sql = 'SELECT bbcode_id
FROM ' . BBCODES_TABLE . '
WHERE bbcode_id = ' . $bbcode_id;
$result = $db->sql_query($sql);
if (!$row = $db->sql_fetchrow($result))
{
trigger_error('BBCODE_NOT_EXIST');
}
$db->sql_freeresult($result);
// No break here
case 'create':
$bbcode_match = htmlspecialchars(stripslashes($_POST['bbcode_match']));
$bbcode_tpl = stripslashes($_POST['bbcode_tpl']);
break;
}
// Do major work
switch ($mode)
{
case 'edit':
case 'add':
adm_page_header($user->lang['BBCODES']);
?>
<h1><?php echo $user->lang['BBCODES'] ?></h1>
<p><?php echo $user->lang['BBCODES_EXPLAIN'] ?></p>
<form method="post" action="admin_bbcodes.<?php echo $phpEx . $SID . '&amp;mode=' . (($mode == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&amp;bbcode=$bbcode_id" : '') ?>">
<table cellspacing="1" cellpadding="0" border="0" align="center" width="90%">
<tr>
<td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['BBCODE_USAGE'] ?></th>
</tr>
<tr>
<td class="row3" colspan="2"><?php echo $user->lang['BBCODE_USAGE_EXPLAIN'] ?></td>
</tr>
<tr valign="top">
<td class="row1" width="40%"><b><?php echo $user->lang['EXAMPLES'] ?></b><br /><br /><?php echo $user->lang['BBCODE_USAGE_EXAMPLE'] ?></td>
<td class="row2"><textarea name="bbcode_match" cols="60" rows="5"><?php echo $bbcode_match ?></textarea></td>
</tr>
</table></td>
</tr>
</table>
<br clear="all" />
<table cellspacing="1" cellpadding="0" border="0" align="center" width="90%">
<tr>
<td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['HTML_REPLACEMENT'] ?></th>
</tr>
<tr>
<td class="row3" colspan="2"><?php echo $user->lang['HTML_REPLACEMENT_EXPLAIN'] ?></td>
</tr>
<tr valign="top">
<td class="row1" width="40%"><b><?php echo $user->lang['EXAMPLES'] ?></b><br /><br /><?php echo $user->lang['HTML_REPLACEMENT_EXAMPLE'] ?></td>
<td class="row2"><textarea name="bbcode_tpl" cols="60" rows="8"><?php echo $bbcode_tpl ?></textarea></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $user->lang['SUBMIT'] ?>" class="btnmain" /></td>
</tr>
</table></td>
</tr>
</table>
<br clear="all" />
<table cellspacing="1" cellpadding="0" border="0" align="center" width="90%">
<tr>
<td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['TOKENS'] ?></th>
</tr>
<tr>
<td class="row3" colspan="2"><?php echo $user->lang['TOKENS_EXPLAIN'] ?></td>
</tr>
<tr>
<th><?php echo $user->lang['TOKEN'] ?></th>
<th><?php echo $user->lang['TOKEN_DEFINITION'] ?></th>
</tr>
<?php
foreach ($user->lang['tokens'] as $token => $token_explain)
{
?><tr valign="top">
<td class="row1">{<?php echo $token ?>}</td>
<td class="row2"><?php echo $token_explain ?></td>
</tr><?php
}
?>
</table></td>
</tr>
</table>
</form>
<?php
adm_page_footer();
break;
case 'modify':
case 'create':
adm_page_header($user->lang['BBCODES']);
$data = build_regexp($bbcode_match, $bbcode_tpl);
$sql_ary = array(
'bbcode_tag' => $data['bbcode_tag'],
'bbcode_match' => $bbcode_match,
'bbcode_tpl' => $bbcode_tpl,
'first_pass_match' => $data['first_pass_match'],
'first_pass_replace' => $data['first_pass_replace'],
'second_pass_match' => $data['second_pass_match'],
'second_pass_replace' => $data['second_pass_replace']
);
if ($mode == 'create')
{
/* TODO: look for SQL incompatibilities
// NOTE: I'm sure there was another simpler (and obvious) way of finding a suitable bbcode_id
$sql = 'SELECT b1.bbcode_id
FROM ' . BBCODES_TABLE . ' b1, ' . BBCODES_TABLE . ' b2
WHERE b2.bbcode_id > b1.bbcode_id
GROUP BY b1.bbcode_id
HAVING MIN(b2.bbcode_id) > b1.bbcode_id + 1
ORDER BY b1.bbcode_id ASC';
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
*/
$sql = 'SELECT MAX(bbcode_id) as bbcode_id
FROM ' . BBCODES_TABLE;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row)
{
$bbcode_id = $row['bbcode_id'] + 1;
}
else
{
$sql = 'SELECT MIN(bbcode_id) AS min_id, MAX(bbcode_id) AS max_id
FROM ' . BBCODES_TABLE;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (empty($row['min_id']) || $row['min_id'] >= NUM_CORE_BBCODES)
{
$bbcode_id = NUM_CORE_BBCODES + 1;
}
else
{
$bbcode_id = $row['max_id'] + 1;
}
}
if ($bbcode_id > 31)
{
trigger_error('TOO_MANY_BBCODES');
}
$sql_ary['bbcode_id'] = (int) $bbcode_id;
$db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
$lang = 'BBCODE_ADDED';
$log_action = 'LOG_BBCODE_ADD';
}
else
{
$db->sql_query('UPDATE ' . BBCODES_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE bbcode_id = ' . $bbcode_id);
$lang = 'BBCODE_EDITED';
$log_action = 'LOG_BBCODE_EDIT';
}
add_log('admin', $log_action, $data['bbcode_tag']);
trigger_error($lang);
break;
case 'delete':
$sql = 'SELECT bbcode_tag
FROM ' . BBCODES_TABLE . "
WHERE bbcode_id = $bbcode_id";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']);
}
$db->sql_freeresult($result);
// No break here
default:
adm_page_header($user->lang['BBCODES']);
?>
<h1><?php echo $user->lang['BBCODES'] ?></h1>
<p><?php echo $user->lang['BBCODES_EXPLAIN'] ?></p>
<form method="post" action="admin_bbcodes.<?php echo $phpEx . $SID ?>&amp;mode=add"><table cellspacing="1" cellpadding="0" border="0" align="center">
<tr>
<td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th><?php echo $user->lang['BBCODE_TAG'] ?></th>
<th><?php echo $user->lang['ACTION'] ?></th>
</tr><?php
$sql = 'SELECT *
FROM ' . BBCODES_TABLE . '
ORDER BY bbcode_id';
$result = $db->sql_query($sql);
$row_class = '';
while ($row = $db->sql_fetchrow($result))
{
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $row_class ?>" align="center"><?php echo $row['bbcode_tag'] ?></td>
<td class="<?php echo $row_class ?>" align="center"><a href="admin_bbcodes.<?php echo $phpEx . $SID ?>&amp;mode=edit&amp;bbcode=<?php echo $row['bbcode_id'] ?>"><?php echo $user->lang['EDIT'] ?></a> | <a href="admin_bbcodes.<?php echo $phpEx . $SID ?>&amp;mode=delete&amp;bbcode=<?php echo $row['bbcode_id'] ?>"><?php echo $user->lang['DELETE'] ?></a></td>
</tr>
<?php
}
$db->sql_freeresult($result);
?>
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $user->lang['ADD_BBCODE'] ?>" class="btnmain" /></td>
</tr>
</table></td>
</tr>
</table></form>
<?php
adm_page_footer();
}
// -----------------------------
// Functions
function build_regexp($msg_bbcode, $msg_html)
{
$msg_bbcode = trim($msg_bbcode);
$msg_html = trim($msg_html);
$fp_match = preg_quote($msg_bbcode, '!');
$fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $msg_bbcode);
$fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace);
$sp_match = preg_quote($msg_bbcode, '!');
$sp_match = preg_replace('#^\\\\\[(.*?)\\\\\]#', '\[$1:$uid\]', $sp_match);
$sp_match = preg_replace('#\\\\\[/(.*?)\\\\\]$#', '\[/$1:$uid\]', $sp_match);
$sp_replace = $msg_html;
$tokens = array(
'URL' => array(
'!([a-z0-9]+://)?([^?].*?[^ \t\n\r<"]*)!ie' => "(('\$1') ? '\$1\$2' : 'http://\$2')"
),
'LOCAL_URL' => array(
'!([^:]+/[^ \t\n\r<"]*)!' => '$1'
),
'EMAIL' => array(
'!([a-z0-9]+[a-z0-9\-\._]*@(?:(?:[0-9]{1,3}\.){3,5}[0-9]{1,3}|[a-z0-9]+[a-z0-9\-\._]*\.[a-z]+))!i' => '$1'
),
'TEXT' => array(
'!(.*?)!es' => "str_replace('\\\"', '&quot;', str_replace('\\'', '&#39;', '\$1'))"
),
'COLOR' => array(
'!([a-z]+|#[0-9abcdef]+!i' => '$1'
),
'NUMBER' => array(
'!([0-9]+)!' => '$1'
)
);
if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $msg_bbcode, $m))
{
$pad = 0;
$modifiers = 'i';
foreach ($m[0] as $n => $token)
{
$token_type = $m[1][$n];
reset($tokens[$token_type]);
list($match, $replace) = each($tokens[$token_type]);
// Pad backreference numbers from tokens
if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
{
$repad = $pad + count(array_unique($repad[0]));
$replace = preg_replace('/(?<!\\\\)\$([0-9]+)/e', "'\$' . (\$1 + \$pad)", $replace);
$pad = $repad;
}
// Obtain pattern modifiers to use and alter the regex accordingly
$regex = preg_replace('/!(.*)!([a-z]*)/', '$1', $match);
$regex_modifiers = preg_replace('/!(.*)!([a-z]*)/', '$2', $match);
for ($i = 0; $i < strlen($regex_modifiers); ++$i)
{
if (strpos($modifiers, $regex_modifiers[$i]) === FALSE)
{
$modifiers .= $regex_modifiers[$i];
if ($regex_modifiers[$i] == 'e')
{
$fp_replace = "'" . str_replace("'", "\\'", $fp_replace) . "'";
}
}
if ($regex_modifiers[$i] == 'e')
{
$replace = "'.$replace.'";
}
}
$fp_match = str_replace(preg_quote($token, '!'), $regex, $fp_match);
$fp_replace = str_replace($token, $replace, $fp_replace);
$sp_match = str_replace(preg_quote($token, '!'), '(.*?)', $sp_match);
$sp_replace = str_replace($token, '$' . ($n + 1), $sp_replace);
}
$fp_match = '!' . $fp_match . '!' . $modifiers;
$sp_match = '!' . $sp_match . '!s';
if (strpos($fp_match, 'e') !== FALSE)
{
$fp_replace = str_replace("'.'", '', $fp_replace);
$fp_replace = str_replace(".''.", '.', $fp_replace);
}
}
else
{
// No replacement is present, no need for a second-pass pattern replacement
// A simple str_replace will suffice
$fp_match = '!' . $fp_match . '!' . $modifiers;
$sp_match = $fp_replace;
$sp_replace = '';
}
// Lowercase tags
$bbcode_tag = preg_replace('/.*?\[([a-z]+).*/i', '$1', $msg_bbcode);
$fp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_match);
$fp_replace = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_replace);
$sp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $sp_match);
$sp_replace = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $sp_replace);
return array(
'bbcode_tag' => $bbcode_tag,
'first_pass_match' => $fp_match,
'first_pass_replace' => $fp_replace,
'second_pass_match' => $sp_match,
'second_pass_replace' => $sp_replace
);
}
// End Functions
// -----------------------------
?>

517
phpBB/adm/admin_board.php Normal file
View File

@@ -0,0 +1,517 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
$filename = basename(__FILE__);
$module['GENERAL']['AUTH_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&amp;mode=auth" : '';
$module['GENERAL']['AVATAR_SETTINGS'] = ($auth->acl_get('a_board')) ? "$filename$SID&amp;mode=avatar" : '';
$module['GENERAL']['BOARD_DEFAULTS'] = ($auth->acl_get('a_defaults')) ? "$filename$SID&amp;mode=default" : '';
$module['GENERAL']['BOARD_SETTINGS'] = ($auth->acl_get('a_board')) ? "$filename$SID&amp;mode=setting" : '';
$module['GENERAL']['COOKIE_SETTINGS'] = ($auth->acl_get('a_cookies')) ? "$filename$SID&amp;mode=cookie" : '';
$module['GENERAL']['EMAIL_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&amp;mode=email" : '';
$module['GENERAL']['LOAD_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&amp;mode=load" : '';
$module['GENERAL']['SERVER_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&amp;mode=server" : '';
$module['GENERAL']['MESSAGE_SETTINGS'] = ($auth->acl_get('a_defaults')) ? "$filename$SID&amp;mode=message" : '';
return;
}
define('IN_PHPBB', 1);
// Load default header
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Get mode
$mode = request_var('mode', '');
$action = request_var('action', '');
$submit = (isset($_POST['submit'])) ? true : false;
// Set config vars
$display_vars = array(
'cookie' => array(
'auth' => 'a_cookies',
'title' => 'COOKIE_SETTINGS',
'vars' => array(
'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'type' => 'text::255', 'explain' => false),
'cookie_name' => array('lang' => 'COOKIE_NAME', 'type' => 'text::16', 'explain' => false),
'cookie_path' => array('lang' => 'COOKIE_PATH', 'type' => 'text::255', 'explain' => false),
'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'type' => 'radio:disabled_enabled', 'explain' => true)
)
),
'avatar' => array(
'auth' => 'a_board',
'title' => 'AVATAR_SETTINGS',
'vars' => array(
'avatar_min_height' => false, 'avatar_min_width' => false, 'avatar_max_height' => false, 'avatar_max_width' => false,
'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'type' => 'radio:yes_no', 'explain' => false),
'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'type' => 'radio:yes_no', 'explain' => true),
'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'type' => 'radio:yes_no', 'explain' => false),
'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'type' => 'dimension:3:4', 'explain' => true),
'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'type' => 'dimension:3:4', 'explain' => true),
'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'type' => 'text:20:255', 'explain' => true),
'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'type' => 'text:20:255', 'explain' => true)
)
),
'email' => array(
'auth' => 'a_server',
'title' => 'EMAIL_SETTINGS',
'vars' => array(
'email_enable' => array('lang' => 'ENABLE_EMAIL', 'type' => 'radio:enabled_disabled', 'explain' => true),
'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'type' => 'radio:enabled_disabled', 'explain' => true),
'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'type' => 'radio:enabled_disabled', 'explain' => true),
'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'type' => 'text:20:50', 'explain' => true),
'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'type' => 'text:5:5', 'explain' => true),
'board_contact' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => true),
'board_email' => array('lang' => 'ADMIN_EMAIL', 'type' => 'text:25:100', 'explain' => true),
'board_email_sig' => array('lang' => 'EMAIL_SIG', 'type' => 'textarea:5:30', 'explain' => true),
'smtp_delivery' => array('lang' => 'USE_SMTP', 'type' => 'radio:yes_no', 'explain' => true),
'smtp_host' => array('lang' => 'SMTP_SERVER', 'type' => 'text:25:50', 'explain' => false),
'smtp_port' => array('lang' => 'SMTP_PORT', 'type' => 'text:4:5', 'explain' => true),
'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'type' => 'select', 'options' => 'mail_auth_select(\'{VALUE}\')', 'explain' => true),
'smtp_username' => array('lang' => 'SMTP_USERNAME', 'type' => 'text:25:255', 'explain' => true),
'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'type' => 'password:25:255', 'explain' => true)
)
),
'load' => array(
'auth' => 'a_server',
'title' => 'SERVER_SETTINGS',
'vars' => array(
'limit_load' => array('lang' => 'LIMIT_LOAD', 'type' => 'text:4:4', 'explain' => true),
'session_length' => array('lang' => 'SESSION_LENGTH', 'type' => 'text:5:5', 'explain' => true),
'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'type' => 'text:4:4', 'explain' => true),
'load_db_track' => array('lang' => 'YES_POST_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
'load_online' => array('lang' => 'YES_ONLINE', 'type' => 'radio:yes_no', 'explain' => true),
'load_online_guests'=> array('lang' => 'YES_ONLINE_GUESTS', 'type' => 'radio:yes_no', 'explain' => true),
'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'type' => 'radio:yes_no', 'explain' => true),
'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'type' => 'text:4:3', 'explain' => true),
'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'type' => 'radio:yes_no', 'explain' => false),
'load_moderators' => array('lang' => 'YES_MODERATORS', 'type' => 'radio:yes_no', 'explain' => false),
'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'type' => 'radio:yes_no', 'explain' => false),
'load_search' => array('lang' => 'YES_SEARCH', 'type' => 'radio:yes_no', 'explain' => true),
'search_interval' => array('lang' => 'SEARCH_INTERVAL', 'type' => 'text:3:4', 'explain' => true),
'min_search_chars' => array('lang' => 'MIN_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true),
'max_search_chars' => array('lang' => 'MAX_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true),
'load_search_upd' => array('lang' => 'YES_SEARCH_UPDATE', 'type' => 'radio:yes_no', 'explain' => true),
// 'load_search_phr' => array('lang' => 'YES_SEARCH_PHRASE', 'type' => 'radio:yes_no', 'explain' => true),
'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true)
)
),
'default' => array(
'auth' => 'a_defaults',
'title' => 'BOARD_DEFAULTS',
'vars' => array(
'default_style' => array('lang' => 'DEFAULT_STYLE', 'type' => 'select', 'options' => 'style_select(\'{VALUE}\', true)', 'explain' => false),
'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'type' => 'radio:yes_no', 'explain' => true),
'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'type' => 'select', 'options' => 'language_select(\'{VALUE}\')', 'explain' => false),
'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'type' => 'text::255', 'explain' => true),
'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'type' => 'select', 'options' => 'tz_select(\'{VALUE}\')', 'explain' => false),
'board_dst' => array('lang' => 'SYSTEM_DST', 'type' => 'radio:yes_no', 'explain' => false),
'allow_privmsg' => array('lang' => 'BOARD_PM', 'type' => 'radio:yes_no', 'explain' => true),
'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'type' => 'radio:yes_no', 'explain' => false),
'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'type' => 'radio:yes_no', 'explain' => false),
'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'type' => 'radio:yes_no', 'explain' => false),
'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'type' => 'radio:yes_no', 'explain' => false),
'allow_html' => array('lang' => 'ALLOW_HTML', 'type' => 'radio:yes_no', 'explain' => false),
'allow_html_tags' => array('lang' => 'ALLOWED_TAGS', 'type' => 'text:30:255', 'explain' => true),
'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'type' => 'radio:yes_no', 'explain' => false),
'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'type' => 'radio:yes_no', 'explain' => false),
'allow_sig' => array('lang' => 'ALLOW_SIG', 'type' => 'radio:yes_no', 'explain' => false),
'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'type' => 'text:5:4', 'explain' => true),
'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'type' => 'radio:yes_no', 'explain' => true),
'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'type' => 'radio:yes_no', 'explain' => true)
)
),
'message' => array(
'auth' => 'a_defaults',
'title' => 'MESSAGE_SETTINGS',
'lang' => 'ucp',
'vars' => array(
'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'type' => 'text:4:4', 'explain' => true),
'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'type' => 'text:4:4', 'explain' => true),
'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'type' => 'select', 'options' => 'full_folder_select(\'{VALUE}\')', 'explain' => true),
'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'type' => 'text:3:3', 'explain' => true),
'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'type' => 'radio:yes_no', 'explain' => false),
'auth_html_pm' => array('lang' => 'ALLOW_HTML_PM', 'type' => 'radio:yes_no', 'explain' => false),
'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'type' => 'radio:yes_no', 'explain' => false),
'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'type' => 'radio:yes_no', 'explain' => false),
'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'type' => 'radio:yes_no', 'explain' => false),
'auth_download_pm' => array('lang' => 'ALLOW_DOWNLOAD_PM', 'type' => 'radio:yes_no', 'explain' => false),
'auth_report_pm' => array('lang' => 'ALLOW_REPORT_PM', 'type' => 'radio:yes_no', 'explain' => false),
'print_pm' => array('lang' => 'ALLOW_PRINT_PM', 'type' => 'radio:yes_no', 'explain' => false),
'email_pm' => array('lang' => 'ALLOW_EMAIL_PM', 'type' => 'radio:yes_no', 'explain' => false),
'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'type' => 'radio:yes_no', 'explain' => false),
'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'type' => 'radio:yes_no', 'explain' => false),
'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'type' => 'radio:yes_no', 'explain' => false),
'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'type' => 'radio:yes_no', 'explain' => false)
)
),
'server' => array(
'auth' => 'a_server',
'title' => 'SERVER_SETTINGS',
'vars' => array(
'server_name' => array('lang' => 'SERVER_NAME', 'type' => 'text:40:255', 'explain' => true),
'server_port' => array('lang' => 'SERVER_PORT', 'type' => 'text:5:5', 'explain' => true),
'script_path' => array('lang' => 'SCRIPT_PATH', 'type' => 'text::255', 'explain' => true),
'ip_check' => array('lang' => 'IP_VALID', 'type' => 'custom', 'options' => 'select_ip_check(\'{VALUE}\')', 'explain' => true),
'browser_check' => array('lang' => 'BROWSER_VALID', 'type' => 'radio:yes_no', 'explain' => true),
'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'type' => 'radio:yes_no', 'explain' => false),
'smilies_path' => array('lang' => 'SMILIES_PATH', 'type' => 'text:20:255', 'explain' => true),
'icons_path' => array('lang' => 'ICONS_PATH', 'type' => 'text:20:255', 'explain' => true),
'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'type' => 'text:20:255', 'explain' => true),
'ranks_path' => array('lang' => 'RANKS_PATH', 'type' => 'text:20:255', 'explain' => true)
)
),
'setting' => array(
'auth' => 'a_board',
'title' => 'BOARD_SETTINGS',
'vars' => array(
'board_disable_msg' => false, 'max_name_chars' => false, 'max_pass_chars' => false, 'bump_type' => false,
'sitename' => array('lang' => 'SITE_NAME', 'type' => 'text:40:255', 'explain' => false),
'site_desc' => array('lang' => 'SITE_DESC', 'type' => 'text:40:255', 'explain' => false),
'board_disable' => array('lang' => 'DISABLE_BOARD', 'type' => 'custom', 'options' => 'board_disable(\'{VALUE}\')', 'explain' => true),
'require_activation'=> array('lang' => 'ACC_ACTIVATION', 'type' => 'custom', 'options' => 'select_acc_activation(\'{VALUE}\')', 'explain' => true),
'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'type' => 'radio:yes_no', 'explain' => true),
'max_autologin_time'=> array('lang' => 'AUTOLOGIN_LENGTH', 'type' => 'text:3:3', 'explain' => true),
'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'type' => 'radio:yes_no', 'explain' => true),
'coppa_fax' => array('lang' => 'COPPA_FAX', 'type' => 'text:25:100', 'explain' => false),
'coppa_mail' => array('lang' => 'COPPA_MAIL', 'type' => 'textarea:5:40', 'explain' => true),
'enable_confirm' => array('lang' => 'VISUAL_CONFIRM', 'type' => 'radio:yes_no', 'explain' => true),
'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'type' => 'text:4:4', 'explain' => true),
'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'type' => 'custom', 'options' => 'username_length(\'{VALUE}\')', 'explain' => true),
'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'type' => 'select', 'options' => 'select_username_chars(\'{VALUE}\')', 'explain' => true),
'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'type' => 'custom', 'options' => 'password_length(\'{VALUE}\')', 'explain' => true),
'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'type' => 'select', 'options' => 'select_password_chars(\'{VALUE}\')', 'explain' => true),
'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'type' => 'text:3:3', 'explain' => true),
'save_passwd' => array('lang' => 'SAVE_PASSWORDS', 'type' => 'text:2:2', 'explain' => true),
'max_login_attempts'=> array('lang' => 'LOGIN_LIMIT', 'type' => 'text:4:4', 'explain' => true),
'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'type' => 'radio:yes_no', 'explain' => true),
'edit_time' => array('lang' => 'EDIT_TIME', 'type' => 'text:3:3', 'explain' => true),
'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'type' => 'radio:yes_no', 'explain' => true),
'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'type' => 'text:3:4', 'explain' => true),
'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'type' => 'custom', 'options' => 'bump_interval(\'{VALUE}\')', 'explain' => true),
'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'type' => 'text:3:4', 'explain' => false),
'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'type' => 'text:3:4', 'explain' => false),
'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'type' => 'text:3:4', 'explain' => false),
'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'type' => 'text:4:4', 'explain' => false),
'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'type' => 'text:4:6', 'explain' => true),
'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'type' => 'text:4:4', 'explain' => true),
'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'type' => 'text:4:4', 'explain' => true)
)
),
'auth' => array(
'auth' => 'a_server',
'title' => 'AUTH_SETTINGS',
'vars' => array(
'auth_method' => array('lang' => 'AUTH_METHOD', 'type' => 'select', 'options' => 'select_auth_method(\'{VALUE}\')', 'explain' => false)
)
)
);
if (!in_array($mode, array_keys($display_vars)))
{
return;
}
// Perform the current mode
$display_vars = $display_vars[$mode];
// Check permissions
if (!$auth->acl_get($display_vars['auth']))
{
trigger_error($user->lang['NO_ADMIN']);
}
if (isset($display_vars['lang']))
{
$user->add_lang($display_vars['lang']);
}
$new = $config;
$cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => '')) : $new;
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null)
{
if (!isset($cfg_array[$config_name]))
{
continue;
}
$config_value = $cfg_array[$config_name];
$new[$config_name] = $config_value;
if ($config_name == 'email_function_name')
{
$new['email_function_name'] = (empty($new['email_function_name']) || !function_exists($new['email_function_name'])) ? 'mail' : str_replace(array('(', ')'), array('', ''), trim($new['email_function_name']));
}
if ($submit)
{
set_config($config_name, $config_value);
}
}
if ($submit)
{
add_log('admin', 'LOG_' . strtoupper($mode) . '_CONFIG');
trigger_error($user->lang['CONFIG_UPDATED']);
}
adm_page_header($user->lang[$display_vars['title']]);
?>
<h1><?php echo $user->lang[$display_vars['title']]; ?></h1>
<p><?php echo $user->lang[$display_vars['title'] . '_EXPLAIN']; ?></p>
<form action="<?php echo "admin_board.$phpEx$SID&amp;mode=$mode"; ?>" method="post"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang[$display_vars['title']]; ?></th>
</tr>
<?php
// Output relevant page
foreach ($display_vars['vars'] as $config_key => $vars)
{
if (!is_array($vars))
{
continue;
}
$type = explode(':', $vars['type']);
?>
<tr>
<td class="row1" width="50%"><b><?php echo $user->lang[$vars['lang']]; ?>: </b><?php echo ($vars['explain']) ? '<br /><span class="gensmall">' . $user->lang[$vars['lang'] . '_EXPLAIN'] . '</span>' : ''; ?></td>
<td class="row2"><?php echo build_cfg_template($type, $config_key, ((isset($vars['options'])) ? $vars['options'] : '')) . ((isset($vars['append'])) ? str_replace('{VALUE}', $new[$config_key], $vars['append']) : ''); ?></td>
</tr>
<?php
unset($display_vars['vars'][$config_key]);
}
if ($mode == 'auth')
{
$auth_plugins = array();
$dp = opendir($phpbb_root_path . 'includes/auth');
while ($file = readdir($dp))
{
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
{
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
}
}
sort($auth_plugins);
foreach ($auth_plugins as $method)
{
if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
{
include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
$method = 'admin_' . $method;
if (function_exists($method))
{
if ($config_fields = $method($new))
{
// Check if we need to create config fields for this plugin
foreach ($config_fields as $field)
{
if (!isset($config[$field]))
{
set_config($field, '');
}
}
}
unset($config_fields);
}
}
}
}
?>
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" />&nbsp;&nbsp;<input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td>
</tr>
</table></form>
<?php
adm_page_footer();
function select_auth_method($selected_method)
{
global $new, $phpbb_root_path, $phpEx;
$auth_plugins = array();
$dp = opendir($phpbb_root_path . 'includes/auth');
while ($file = readdir($dp))
{
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
{
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
}
}
sort($auth_plugins);
$auth_select = '';
foreach ($auth_plugins as $method)
{
$selected = ($selected_method == $method) ? ' selected="selected"' : '';
$auth_select .= '<option value="' . $method . '"' . $selected . '>' . ucfirst($method) . '</option>';
}
return $auth_select;
}
function mail_auth_select($selected_method)
{
global $user;
$auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP');
$s_smtp_auth_options = '';
foreach ($auth_methods as $method)
{
$s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>';
}
return $s_smtp_auth_options;
}
function full_folder_select($value)
{
global $user;
return '<option value="1"' . (($value == 1) ? ' selected="selected"' : '') . '>' . $user->lang['DELETE_OLDEST_MESSAGES'] . '</option><option value="2"' . (($value == 2) ? ' selected="selected"' : '') . '>' . $user->lang['HOLD_NEW_MESSAGES'] . '</option>';
}
function select_ip_check($value)
{
global $user;
$ip_all = ($value == 4) ? ' checked="checked"' : '';
$ip_classc = ($value == 3) ? ' checked="checked"' : '';
$ip_classb = ($value == 2) ? ' checked="checked"' : '';
$ip_none = ($value == 0) ? ' checked="checked"' : '';
$options = <<<EOT
<input type="radio" name="config[ip_check]" value="4"$ip_all /> {$user->lang['ALL']}&nbsp;&nbsp;<input type="radio" name="config[ip_check]" value="3"$ip_classc /> {$user->lang['CLASS_C']}&nbsp;&nbsp;<input type="radio" name="config[ip_check]" value="2"$ip_classb /> {$user->lang['CLASS_B']}&nbsp;&nbsp;<input type="radio" name="config[ip_check]" value="0"$ip_none /> {$user->lang['NONE']}&nbsp;&nbsp;
EOT;
return $options;
}
function select_acc_activation($value)
{
global $user, $config;
$activation_none = ($value == USER_ACTIVATION_NONE) ? ' checked="checked"' : '';
$activation_user = ($value == USER_ACTIVATION_SELF) ? ' checked="checked"' : '';
$activation_admin = ($value == USER_ACTIVATION_ADMIN) ? ' checked="checked"' : '';
$activation_disable = ($value == USER_ACTIVATION_DISABLE) ? ' checked="checked"' : '';
$options = '<input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_NONE . '"' . $activation_none . ' /> ' . $user->lang['ACC_NONE'];
if ($config['email_enable'])
{
$options .= '&nbsp;&nbsp;<input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_SELF . '"' . $activation_user . ' /> ' . $user->lang['ACC_USER'];
$options .= '&nbsp;&nbsp;<input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_ADMIN . '"' . $activation_admin . ' /> ' . $user->lang['ACC_ADMIN'];
}
$options .= '&nbsp;&nbsp;<input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_DISABLE . '"' . $activation_disable . ' /> ' . $user->lang['ACC_DISABLE'];
return $options;
}
function username_length($value)
{
global $new, $user;
return '<input class="post" type="text" size="3" maxlength="3" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . '&nbsp;&nbsp;<input class="post" type="text" size="3" maxlength="3" name="config[max_name_chars]" value="' . $new['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
}
function select_username_chars($selected_value)
{
global $user;
$user_char_ary = array('USERNAME_CHARS_ANY' => '.*', 'USERNAME_ALPHA_ONLY' => '[\w]+', 'USERNAME_ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+');
$user_char_options = '';
foreach ($user_char_ary as $lang => $value)
{
$selected = ($selected_value == $value) ? ' selected="selected"' : '';
$user_char_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
}
return $user_char_options;
}
function password_length($value)
{
global $new, $user;
return '<input class="post" type="text" size="3" maxlength="3" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . '&nbsp;&nbsp;<input class="post" type="text" size="3" maxlength="3" name="config[max_pass_chars]" value="' . $new['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
}
function select_password_chars($selected_value)
{
global $user;
$pass_type_ary = array('PASS_TYPE_ANY' => '.*', 'PASS_TYPE_CASE' => '[a-zA-Z]', 'PASS_TYPE_ALPHA' => '[a-zA-Z0-9]', 'PASS_TYPE_SYMBOL' => '[a-zA-Z\W]');
$pass_char_options = '';
foreach ($pass_type_ary as $lang => $value)
{
$selected = ($selected_value == $value) ? ' selected="selected"' : '';
$pass_char_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
}
return $pass_char_options;
}
function bump_interval($value)
{
global $new, $user;
$s_bump_type = '';
$types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS');
foreach ($types as $type => $lang)
{
$selected = ($new['bump_type'] == $type) ? 'selected="selected" ' : '';
$s_bump_type .= '<option value="' . $type . '" ' . $selected . '>' . $user->lang[$lang] . '</option>';
}
return '<input class="post" type="text" size="3" maxlength="4" name="config[bump_interval]" value="' . $value . '" />&nbsp;<select name="config[bump_type]">' . $s_bump_type . '</select>';
}
function board_disable($value)
{
global $new, $user;
$board_disable_yes = ($value) ? ' checked="checked"' : '';
$board_disable_no = (!$value) ? ' checked="checked"' : '';
return '<input type="radio" name="config[board_disable]" value="1"' . $board_disable_yes . ' /> ' . $user->lang['YES'] . '&nbsp;&nbsp;<input type="radio" name="config[board_disable]" value="0"' . $board_disable_no . ' /> ' . $user->lang['NO'] . '<br /><input class="post" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $new['board_disable_msg'] . '" />';
}
?>

394
phpBB/adm/admin_bots.php Normal file
View File

@@ -0,0 +1,394 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_server'))
{
return;
}
$module['USER']['BOTS'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Do we have permission?
if (!$auth->acl_get('a_server'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Set various vars
$submit = (isset($_POST['submit'])) ? true : false;
$action = request_var('action', '');
$mark = request_var('mark', 0);
$id = request_var('id', 0);
if (isset($_POST['add']))
{
$action = 'add';
}
$error = array();
// User wants to do something, how inconsiderate of them!
switch ($action)
{
case 'activate':
if ($id || $mark)
{
$id = ($id) ? " = $id" : ' IN (' . implode(', ', $mark) . ')';
$sql = 'UPDATE ' . BOTS_TABLE . "
SET bot_active = 1
WHERE bot_id $id";
$db->sql_query($sql);
}
$cache->destroy('bots');
break;
case 'deactivate':
if ($id || $mark)
{
$id = ($id) ? " = $id" : ' IN (' . implode(', ', $mark) . ')';
$sql = 'UPDATE ' . BOTS_TABLE . "
SET bot_active = 0
WHERE bot_id $id";
$db->sql_query($sql);
}
$cache->destroy('bots');
break;
case 'delete':
if ($id || $mark)
{
// We need to delete the relevant user, usergroup and bot entries ...
$id = ($id) ? " = $id" : ' IN (' . implode(', ', $mark) . ')';
$sql = 'SELECT bot_name, user_id
FROM ' . BOTS_TABLE . "
WHERE bot_id $id";
$result = $db->sql_query($sql);
$user_id_ary = $bot_name_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$user_id_ary[] = (int) $row['user_id'];
$bot_name_ary[] = $row['bot_name'];
}
$db->sql_freeresult($result);
$db->sql_transaction();
$sql = 'DELETE FROM ' . BOTS_TABLE . "
WHERE bot_id $id";
$db->sql_query($sql);
foreach (array(USERS_TABLE, USER_GROUP_TABLE) as $table)
{
$sql = "DELETE FROM $table
WHERE user_id IN (" . implode(', ', $user_id_ary) . ')';
$db->sql_query($sql);
}
$db->sql_transaction('commit');
$cache->destroy('bots');
add_log('admin', 'LOG_BOT_DELETE', implode(', ', $bot_name_ary));
trigger_error($user->lang['BOT_DELETED']);
}
break;
case 'edit':
case 'add':
$bot_name = request_var('bot_name', '');
$bot_agent = request_var('bot_agent', '');
$bot_ip = request_var('bot_ip', '');
$bot_active = request_var('bot_active', true);
$bot_lang = request_var('bot_lang', $config['default_lang']);
$bot_style = request_var('bot_style' , $config['default_style']);
if ($submit)
{
if (!$bot_agent && !$bot_ip)
{
$error[] = $user->lang['ERR_BOT_NO_MATCHES'];
}
if ($bot_ip && !preg_match('#^[\d\.,:]+$#', $bot_ip))
{
if (!$ip_list = gethostbynamel($bot_ip))
{
$error[] = $user->lang['ERR_BOT_NO_IP'];
}
else
{
$bot_ip = implode(',', $ip_list);
}
}
$bot_ip = str_replace(' ', '', $bot_ip);
if (!sizeof($error))
{
$db->sql_transaction();
// New bot? Create a new user and group entry
if ($action == 'add')
{
$sql = 'SELECT group_id, group_colour
FROM ' . GROUPS_TABLE . "
WHERE group_name = 'BOTS'
AND group_type = " . GROUP_SPECIAL;
$result = $db->sql_query($sql);
if (!extract($db->sql_fetchrow($result)))
{
trigger_error($user->lang['NO_GROUP']);
}
$db->sql_freeresult($result);
$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'group_id' => (int) $group_id,
'username' => (string) $bot_name,
'user_type' => (int) USER_IGNORE,
'user_colour' => (string) $group_colour,
'user_lang' => (string) $bot_lang,
'user_style' => (int) $bot_style,
'user_options' => 0)
);
$db->sql_query($sql);
$user_id = $db->sql_nextid();
// Add to Bots usergroup
$sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'user_id' => $user_id,
'group_id' => $group_id)
);
$db->sql_query($sql);
$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'user_id' => (int) $user_id,
'bot_name' => (string) $bot_name,
'bot_active' => (int) $bot_active,
'bot_agent' => (string) $bot_agent,
'bot_ip' => (string) $bot_ip,)
);
$log = 'ADDED';
}
else
{
$sql = 'SELECT user_id
FROM ' . BOTS_TABLE . "
WHERE bot_id = $id";
$result = $db->sql_query($sql);
if (!extract($db->sql_fetchrow($result)))
{
trigger_error($user->lang['NO_BOT']);
}
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
'user_style' => (int) $bot_style,
'user_lang' => (string) $bot_lang,)
) . " WHERE user_id = $user_id";
$db->sql_query($sql);
$sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
'bot_name' => (string) $bot_name,
'bot_active' => (int) $bot_active,
'bot_agent' => (string) $bot_agent,
'bot_ip' => (string) $bot_ip,)
) . " WHERE bot_id = $id";
$log = 'UPDATED';
}
$db->sql_query($sql);
$db->sql_transaction('commit');
$cache->destroy('bots');
add_log('admin', 'LOG_BOT_' . $log, $bot_name);
trigger_error($user->lang['BOT_' . $log]);
}
}
else if ($id)
{
$sql = 'SELECT b.*, u.user_lang, u.user_style
FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . " u
WHERE b.bot_id = $id
AND u.user_id = b.user_id";
$result = $db->sql_query($sql);
if (!extract($db->sql_fetchrow($result)))
{
trigger_error($user->lang['NO_BOT']);
}
$db->sql_freeresult($result);
$bot_lang = $user_lang;
$bot_style = $user_style;
}
$s_active_options = '';
foreach (array('0' => 'NO', '1' => 'YES') as $value => $lang)
{
$selected = ($bot_active == $value) ? ' selected="selected"' : '';
$s_active_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
}
$style_select = style_select($bot_style, true);
$lang_select = language_select($bot_lang);
$l_title = ($action == 'edit') ? 'EDIT' : 'ADD';
// Output relevant page
adm_page_header($user->lang['BOT_' . $l_title]);
?>
<h1><?php echo $user->lang['BOT_' . $l_title]; ?></h1>
<p><?php echo $user->lang['BOT_EDIT_EXPLAIN']; ?></p>
<form method="post" action="<?php echo "admin_bots.$phpEx$SID&amp;action=$action&amp;id=$id"; ?>"><table class="bg" width="90%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['BOT_' . $l_title]; ?></th>
</tr>
<?php
if (sizeof($error))
{
?>
<tr>
<td class="row3" colspan="2" align="center"><span style="color:red"><?php echo implode('<br />', $error); ?></span></td>
</tr>
<?php
}
?>
<tr>
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_NAME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_NAME_EXPLAIN']; ?></span></td>
<td class="row2"><input class="post" type="text" name="bot_name" size="30" maxlength="255" value="<?php echo $bot_name; ?>" /></td>
</tr>
<tr>
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_STYLE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_STYLE_EXPLAIN']; ?></span></td>
<td class="row2"><select name="bot_style"><?php echo $style_select; ?></select></td>
</tr>
<tr>
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_LANG']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_LANG_EXPLAIN']; ?></span></td>
<td class="row2"><select name="bot_lang"><?php echo $lang_select; ?></select></td>
</tr>
<tr>
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_ACTIVE']; ?>: </b></td>
<td class="row2"><select name="bot_active"><?php echo $s_active_options; ?></select></td>
</tr>
<tr>
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_AGENT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_AGENT_EXPLAIN']; ?></span></td>
<td class="row2"><input class="post" type="text" name="bot_agent" size="30" maxlength="255" value="<?php echo $bot_agent; ?>" /></td>
</tr>
<tr>
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_IP']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_IP_EXPLAIN']; ?></span></td>
<td class="row2"><input class="post" type="text" name="bot_ip" size="30" maxlength="255" value="<?php echo $bot_ip; ?>" /></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td>
</tr>
</table></form>
<?php
adm_page_footer();
break;
}
// Output relevant page
adm_page_header($user->lang['BOTS']);
?>
<h1><?php echo $user->lang['BOTS']; ?></h1>
<p><?php echo $user->lang['BOTS_EXPLAIN']; ?></p>
<form method="post" action="<?php "admin_bots.$phpEx$SID"; ?>"><table class="bg" width="90%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th nowrap="nowrap"><?php echo $user->lang['BOT_NAME']; ?></th>
<th nowrap="nowrap"><?php echo $user->lang['BOT_LAST_VISIT']; ?></th>
<th colspan="3" nowrap="nowrap"><?php echo $user->lang['OPTIONS']; ?></th>
<th nowrap="nowrap"><?php echo $user->lang['MARK']; ?></th>
</tr>
<?php
$s_options = '';
foreach (array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE') as $value => $lang)
{
$s_options .= '<option value="' . $value . '">' . $user->lang[$lang] . '</option>';
}
$sql = 'SELECT b.bot_id, b.bot_name, b.bot_active, u.user_lastvisit
FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . ' u
WHERE u.user_id = b.user_id
ORDER BY u.user_lastvisit DESC';
$result = $db->sql_query($sql);
$row_class = '';
while ($row = $db->sql_fetchrow($result))
{
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
$active_lang = (!$row['bot_active']) ? 'BOT_ACTIVATE' : 'BOT_DEACTIVATE';
$active_value = (!$row['bot_active']) ? 'activate' : 'deactivate';
$id = $row['bot_id'];
?>
<tr>
<td class="<?php echo $row_class; ?>" width="50%"><?php echo $row['bot_name']; ?></td>
<td class="<?php echo $row_class; ?>" width="15%" align="center" nowrap="nowrap">&nbsp;<?php echo ($row['user_lastvisit']) ? $user->format_date($row['user_lastvisit']) : $user->lang['BOT_NEVER']; ?>&nbsp;</td>
<td class="<?php echo $row_class; ?>" width="1%"align="center">&nbsp;<a href="<?php echo "admin_bots.$phpEx$SID&amp;id=$id&amp;action=$active_value"; ?>"><?php echo $user->lang[$active_lang]; ?></a>&nbsp;</td>
<td class="<?php echo $row_class; ?>" width="1%" align="center">&nbsp;<a href="<?php echo "admin_bots.$phpEx$SID&amp;id=$id&amp;action=edit"; ?>"><?php echo $user->lang['EDIT']; ?></a>&nbsp;</td>
<td class="<?php echo $row_class; ?>" width="1%" align="center">&nbsp;<a href="<?php echo "admin_bots.$phpEx$SID&amp;id=$id&amp;action=delete"; ?>"><?php echo $user->lang['DELETE']; ?></a>&nbsp;</td>
<td class="<?php echo $row_class; ?>" width="1%" align="center"><input type="checkbox" name="mark[]" value="<?php echo $id; ?>" /></td>
</tr>
<?php
}
$db->sql_freeresult($result);
?>
<tr>
<td class="cat" colspan="6"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><input class="btnlite" type="submit" name="add" value="<?php echo $user->lang['BOT_ADD']; ?>" /></td>
<td align="right"><select name="action"><?php echo $s_options; ?></select> <input class="btnlite" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /></td>
</tr>
</table></td>
</tr>
</table></form>
<?php
adm_page_footer();
?>

View File

@@ -0,0 +1,994 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
$filename = basename(__FILE__);
$module['DB']['DB_BACKUP'] = ($auth->acl_get('a_backup')) ? $filename . "$SID&amp;mode=backup" : '';
$file_uploads = @ini_get('file_uploads');
if (!empty($file_uploads) && $file_uploads !== 0 && strtolower($file_uploads) != 'off' && $auth->acl_get('a_restore'))
{
$module['DB']['DB_RESTORE'] = "$filename$SID&amp;mode=restore";
}
return;
}
define('IN_PHPBB', 1);
// Load default header
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_compress.'.$phpEx);
@set_time_limit(1200);
// Get some vars
$mode = (isset($_GET['mode'])) ? htmlspecialchars($_GET['mode']) : '';
$action = (isset($_REQUEST['action'])) ? htmlspecialchars($_REQUEST['action']) : '';
// --------------------
// Begin program proper
// --------------------
switch($mode)
{
case 'backup':
if (!$auth->acl_get('a_backup'))
{
trigger_error($user->lang['NO_ADMIN']);
}
$db_type = '';
switch (SQL_LAYER)
{
case 'oracle':
$db_type = 'Oracle';
break;
case 'odbc':
$db_type = 'ODBC';
break;
case 'mssql':
$db_type = 'MSSQL';
break;
}
if ($db_type)
{
trigger_error($user->lang['Backups_not_supported']);
}
$additional_tables = (isset($_REQUEST['tables'])) ? htmlspecialchars($_REQUEST['tables']) : '';
$backup_type = (isset($_REQUEST['type'])) ? intval($_REQUEST['type']) : false;
$search = (!empty($_REQUEST['search'])) ? true : false;
$store = (!empty($_REQUEST['store'])) ? true : false;
$compress = (isset($_REQUEST['compress'])) ? htmlspecialchars($_REQUEST['compress']) : '';
if (!isset($_POST['backupstart']) && !isset($_GET['backupstart']))
{
adm_page_header($user->lang['DB_BACKUP']);
?>
<h1><?php echo $user->lang['DB_BACKUP']; ?></h1>
<p><?php echo $user->lang['Backup_explain']; ?></p>
<form method="post" action="<?php echo "admin_database.$phpEx$SID&amp;mode=$mode"; ?>"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['Backup_options']; ?></th>
</tr>
<tr>
<td class="row1" width="40%"><b><?php echo $user->lang['Backup_type']; ?>: </b></td>
<td class="row2"><input type="radio" name="type" value="full" checked="checked" /> <?php echo $user->lang['Full_backup']; ?>&nbsp;&nbsp;<input type="radio" name="type" value="structure" /> <?php echo $user->lang['Structure_only']; ?>&nbsp;&nbsp;<input type="radio" name="type" value="data" /> <?php echo $user->lang['Data_only']; ?></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['Additional_tables']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['Additional_tables_explain']; ?></span></td>
<td class="row2"><input class="post" type="text" name="tables" maxlength="255" size="40" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['INC_SEARCH_INDEX']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['INC_SEARCH_INDEX_EXPLAIN']; ?></span></td>
<td class="row2"><input type="radio" name="search" value="1" checked="checked" /> <?php echo $user->lang['YES']; ?>&nbsp;&nbsp;<input type="radio" name="search" value="0" /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['DOWNLOAD_STORE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['DOWNLOAD_STORE_EXPLAIN']; ?></span></td>
<td class="row2"><input type="radio" name="store" value="0" checked="checked" /> <?php echo $user->lang['EXPORT_DOWNLOAD']; ?>&nbsp;&nbsp;<input type="radio" name="store" value="1" /> <?php echo $user->lang['EXPORT_STORE']; ?></td>
</tr>
<?php
if (@extension_loaded('zlib') || extension_loaded('bz2'))
{
?>
<tr>
<td class="row1"><b><?php echo $user->lang['Compress_file']; ?>: </b></td>
<td class="row2"><input type="radio" name="compress" value="none" checked="checked" /> <?php echo $user->lang['NONE']; ?><?php
if (extension_loaded('zlib'))
{
?>&nbsp;&nbsp;<input type="radio" name="compress" value="gzip" />.gz&nbsp;&nbsp;<input type="radio" name="compress" value="zip" />.zip<?php
}
if (extension_loaded('bz2'))
{
?>&nbsp;&nbsp;<input type="radio" name="compress" value="bzip" />.bz2<?php
}
?></td>
</tr>
<?php
}
?>
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="backupstart" value="<?php echo $user->lang['Start_backup']; ?>" class="btnmain" /></td>
</tr>
</table></form>
<?php
break;
}
else if (!isset($_POST['startdownload']) && !isset($_GET['startdownload']))
{
$meta = "<meta http-equiv=\"refresh\" content=\"0;url=admin_database.$phpEx?mode=backup&amp;type=$backup_type&amp;tables=" . quotemeta($additional_tables) . "&amp;search=$search&amp;store=" . quotemeta($store_path) . "&amp;compress=$compress&amp;backupstart=1&amp;startdownload=1\">";
$message = (empty($store_path)) ? $user->lang['Backup_download'] : $user->lang['Backup_writing'];
adm_page_header($user->lang['DB_Backup'], $meta);
page_message($user->lang['DB_Backup'], $message);
adm_page_footer();
}
$tables = (SQL_LAYER != 'postgresql') ? mysql_get_tables() : pg_get_tables();
@sort($tables);
if (!empty($additional_tables))
{
$additional_tables = explode(',', $additional_tables);
for($i = 0; $i < count($additional_tables); $i++)
{
$tables[] = trim($additional_tables[$i]);
}
unset($additional_tables);
}
// Enable output buffering
@ob_start();
@ob_implicit_flush(0);
// Build the sql script file...
echo "#\n";
echo "# phpBB Backup Script\n";
echo "# Dump of tables for $dbname\n";
echo "#\n# DATE : " . gmdate("d-m-Y H:i:s", time()) . " GMT\n";
echo "#\n";
if (SQL_LAYER == 'postgresql')
{
echo "\n" . pg_get_sequences("\n", $backup_type);
}
for($i = 0; $i < count($tables); $i++)
{
$table_name = $tables[$i];
if (SQL_LAYER != 'mysql4')
{
$table_def_function = "get_table_def_" . SQL_LAYER;
$table_content_function = "get_table_content_" . SQL_LAYER;
}
else
{
$table_def_function = "get_table_def_mysql";
$table_content_function = "get_table_content_mysql";
}
if ($backup_type != 'data')
{
echo "#\n# TABLE: " . $table_name . "\n#\n";
echo $table_def_function($table_name, "\n") . "\n";
}
if ($backup_type != 'structure')
{
//
// Skip search table data?
//
if ($search || (!$search && !preg_match('/search_word/', $table_name)))
{
$table_content_function($table_name, "output_table_content");
}
}
}
// Flush the buffer, send the file
switch ($compress)
{/*
case 'gzip':
$extension = 'sql.gz';
$contents = gzencode(ob_get_contents());
ob_end_clean();
break;
case 'zip':
$extension = 'zip';
$zip = new zipfile;
$zip->add_file(ob_get_contents(), "phpbb_db_backup.sql", time());
ob_end_clean();
$contents = $zip->file();
break;
case 'bzip':
$extension = 'bz2';
$contents = bzcompress(ob_get_contents());
ob_end_clean();
break;*/
default:
$extension = 'sql';
$contents = ob_get_contents();
ob_end_clean();
}
add_log('admin', 'log_db_backup');
if (empty($store_path))
{
header("Pragma: no-cache");
header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.$extension\"");
header("Content-disposition: attachment; filename=phpbb_db_backup.$extension");
echo $contents;
unset($contents);
}
else
{
if (!($fp = fopen('./../' . $store_path . "/phpbb_db_backup.$extension", 'wb')))
{
message_die(ERROR, 'Could not open backup file');
}
if (!fwrite($fp, $contents))
{
message_die(ERROR, 'Could not write backup file content');
}
fclose($fp);
unset($contents);
trigger_error($user->lang['Backup_success']);
}
exit;
break;
case 'restore':
if (!$auth->acl_get('a_restore'))
{
trigger_error($user->lang['NO_ADMIN']);
}
if (isset($_POST['restorestart']))
{
// Handle the file upload ....
// If no file was uploaded report an error...
if (!empty($_POST['local']))
{
$file_tmpname = './../' . str_replace('\\\\', '/', $_POST['local']);
$filename = substr($file_tmpname, strrpos($file_tmpname, '/'));
}
else
{
$filename = (!empty($_POST['backup_file']['name'])) ? $HTTP_POST_FILES['backup_file']['name'] : '';
$file_tmpname = ($HTTP_POST_FILES['backup_file']['tmp_name'] != 'none') ? $HTTP_POST_FILES['backup_file']['tmp_name'] : '';
}
if ($file_tmpname == '' || $filename == '' || !file_exists($file_tmpname))
{
trigger_error($user->lang['Restore_Error_no_file']);
}
$ext = substr($filename, strrpos($filename, '.') + 1);
if (!preg_match('/^(sql|gz|bz2)$/', $ext))
{
trigger_error($user->lang['Restore_Error_filename']);
}
if ((!extension_loaded('zlib') && $ext == 'gz') || (!extension_loaded('zip') && $ext == 'zip') || ($ext == 'bz2' && !extension_loaded('bz2')))
{
trigger_error($user->lang['Compress_unsupported']);
}
$sql_query = '';
switch ($ext)
{
case 'gz':
$fp = gzopen($file_tmpname, 'rb');
while (!gzeof($fp))
{
$sql_query .= gzgets($fp, 100000);
}
gzclose($fp);
break;
case 'bz2':
$sql_query = bzdecompress(fread(fopen($file_tmpname, 'rb'), filesize($file_tmpname)));
break;
case 'zip':
default;
$sql_query = fread(fopen($file_tmpname, 'r'), filesize($file_tmpname));
}
if ($sql_query != '')
{
// Strip out sql comments...
remove_remarks($sql_query);
$pieces = split_sql_file($sql_query, ';');
$sql_count = count($pieces);
for($i = 0; $i < $sql_count; $i++)
{
$sql = trim($pieces[$i]);
if (!empty($sql) && $sql[0] != '#')
{
$db->sql_query($sql);
}
}
}
add_log('admin', 'log_db_restore');
trigger_error($user->lang['Restore_success']);
}
//
// Restore page
//
adm_page_header($user->lang['DB_RESTORE']);
?>
<h1><?php echo $user->lang['DB_RESTORE']; ?></h1>
<p><?php echo $user->lang['Restore_explain']; ?></p>
<form enctype="multipart/form-data" method="post" action="<?php echo "admin_database.$phpEx$SID&amp;mode=$mode"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<th colspan="2"><?php echo $user->lang['Select_file']; ?></th>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['Upload_file']; ?>: <br /><span class="gensmall"><?php
echo $user->lang['Supported_extensions'];
$types = ': <u>sql</u>';
if (extension_loaded('zlib'))
{
$types .= ', <u>sql.gz</u>';
}
if (extension_loaded('bz2'))
{
$types .= ', <u>bz2</u>';
}
echo $types;
?></span></td>
<td class="row2"><input type="file" name="backup_file" /></td>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['Local_backup_file']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Local_backup_file_explain']; ?></span></td>
<td class="row2"><input type="text" name="local" size="40" /></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="restorestart" value="<?php echo $user->lang['Start_Restore']; ?>" class="btnmain" /></td>
</tr>
</table></form>
<?php
break;
default:
trigger_error($user->lang['No_admin']);
exit;
}
adm_page_footer();
// -----------------------------------------------
// Begin Functions
//
//
// Table defns (not from phpMyAdmin)
//
function mysql_get_tables()
{
global $db, $table_prefix;
$tables = array();
$result = mysql_list_tables($db->dbname, $db->db_connect_id);
if ($row = $db->sql_fetchrow($result))
{
do
{
if (preg_match('/^' . $table_prefix . '/', $row[0]))
{
$tables[] = $row[0];
}
}
while ($row = $db->sql_fetchrow($result));
}
return $tables;
}
//
// The following functions are adapted from phpMyAdmin and upgrade_20.php
//
// This function is used for grabbing the sequences for postgres...
//
function pg_get_sequences($crlf, $backup_type)
{
global $db;
$get_seq_sql = "SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*'
AND relkind = 'S' ORDER BY relname";
$seq = $db->sql_query($get_seq_sql);
if (!$num_seq = $db->sql_numrows($seq))
{
$return_val = "# No Sequences Found $crlf";
}
else
{
$return_val = "# Sequences $crlf";
$i_seq = 0;
while($i_seq < $num_seq)
{
$row = $db->sql_fetchrow($seq);
$sequence = $row['relname'];
$get_props_sql = "SELECT * FROM $sequence";
$seq_props = $db->sql_query($get_props_sql);
if ($db->sql_numrows($seq_props) > 0)
{
$row1 = $db->sql_fetchrow($seq_props);
if ($backup_type == 'structure')
{
$row['last_value'] = 1;
}
$return_val .= "CREATE SEQUENCE $sequence start " . $row['last_value'] . ' increment ' . $row['increment_by'] . ' maxvalue ' . $row['max_value'] . ' minvalue ' . $row['min_value'] . ' cache ' . $row['cache_value'] . "; $crlf";
} // End if numrows > 0
if (($row['last_value'] > 1) && ($backup_type != 'structure'))
{
$return_val .= "SELECT NEXTVALE('$sequence'); $crlf";
unset($row['last_value']);
}
$i_seq++;
} // End while..
} // End else...
return $returnval;
} // End function...
//
// The following functions will return the "CREATE TABLE syntax for the
// varying DBMS's
//
// This function returns, will return the table def's for postgres...
//
function get_table_def_postgresql($table, $crlf)
{
global $db;
$schema_create = "";
//
// Get a listing of the fields, with their associated types, etc.
//
$field_query = "SELECT a.attnum, a.attname AS field, t.typname as type, a.attlen AS length, a.atttypmod as lengthvar, a.attnotnull as notnull
FROM pg_class c, pg_attribute a, pg_type t
WHERE c.relname = '$table'
AND a.attnum > 0
AND a.attrelid = c.oid
AND a.atttypid = t.oid
ORDER BY a.attnum";
$result = $db->sql_query($field_query);
if (!$result)
{
message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $field_query);
} // end if..
$schema_create .= "DROP TABLE $table;$crlf";
//
// Ok now we actually start building the SQL statements to restore the tables
//
$schema_create .= "CREATE TABLE $table($crlf";
while ($row = $db->sql_fetchrow($result))
{
//
// Get the data from the table
//
$sql_get_default = "SELECT d.adsrc AS rowdefault
FROM pg_attrdef d, pg_class c
WHERE (c.relname = '$table')
AND (c.oid = d.adrelid)
AND d.adnum = " . $row['attnum'];
$def_res = $db->sql_query($sql_get_default);
if (!$def_res)
{
unset($row['rowdefault']);
}
else
{
$row['rowdefault'] = @pg_result($def_res, 0, 'rowdefault');
}
if ($row['type'] == 'bpchar')
{
// Internally stored as bpchar, but isn't accepted in a CREATE TABLE statement.
$row['type'] = 'char';
}
$schema_create .= ' ' . $row['field'] . ' ' . $row['type'];
if (eregi('char', $row['type']))
{
if ($row['lengthvar'] > 0)
{
$schema_create .= '(' . ($row['lengthvar'] -4) . ')';
}
}
if (eregi('numeric', $row['type']))
{
$schema_create .= '(';
$schema_create .= sprintf("%s,%s", (($row['lengthvar'] >> 16) & 0xffff), (($row['lengthvar'] - 4) & 0xffff));
$schema_create .= ')';
}
if (!empty($row['rowdefault']))
{
$schema_create .= ' DEFAULT ' . $row['rowdefault'];
}
if ($row['notnull'] == 't')
{
$schema_create .= ' NOT NULL';
}
$schema_create .= ",$crlf";
}
//
// Get the listing of primary keys.
//
$sql_pri_keys = "SELECT ic.relname AS index_name, bc.relname AS tab_name, ta.attname AS column_name, i.indisunique AS unique_key, i.indisprimary AS primary_key
FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia
WHERE (bc.oid = i.indrelid)
AND (ic.oid = i.indexrelid)
AND (ia.attrelid = i.indexrelid)
AND (ta.attrelid = bc.oid)
AND (bc.relname = '$table')
AND (ta.attrelid = i.indrelid)
AND (ta.attnum = i.indkey[ia.attnum-1])
ORDER BY index_name, tab_name, column_name ";
$result = $db->sql_query($sql_pri_keys);
if (!$result)
{
message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $sql_pri_keys);
}
while ($row = $db->sql_fetchrow($result))
{
if ($row['primary_key'] == 't')
{
if (!empty($primary_key))
{
$primary_key .= ', ';
}
$primary_key .= $row['column_name'];
$primary_key_name = $row['index_name'];
}
else
{
//
// We have to store this all this info because it is possible to have a multi-column key...
// we can loop through it again and build the statement
//
$index_rows[$row['index_name']]['table'] = $table;
$index_rows[$row['index_name']]['unique'] = ($row['unique_key'] == 't') ? ' UNIQUE ' : '';
$index_rows[$row['index_name']]['column_names'] .= $row['column_name'] . ', ';
}
}
if (!empty($index_rows))
{
while(list($idx_name, $props) = each($index_rows))
{
$props['column_names'] = ereg_replace(", $", "" , $props['column_names']);
$index_create .= 'CREATE ' . $props['unique'] . " INDEX $idx_name ON $table (" . $props['column_names'] . ");$crlf";
}
}
if (!empty($primary_key))
{
$schema_create .= " CONSTRAINT $primary_key_name PRIMARY KEY ($primary_key),$crlf";
}
//
// Generate constraint clauses for CHECK constraints
//
$sql_checks = "SELECT rcname as index_name, rcsrc
FROM pg_relcheck, pg_class bc
WHERE rcrelid = bc.oid
AND bc.relname = '$table'
AND NOT EXISTS (
SELECT *
FROM pg_relcheck as c, pg_inherits as i
WHERE i.inhrelid = pg_relcheck.rcrelid
AND c.rcname = pg_relcheck.rcname
AND c.rcsrc = pg_relcheck.rcsrc
AND c.rcrelid = i.inhparent
)";
$result = $db->sql_query($sql_checks);
if (!$result)
{
message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $sql_checks);
}
//
// Add the constraints to the sql file.
//
while ($row = $db->sql_fetchrow($result))
{
$schema_create .= ' CONSTRAINT ' . $row['index_name'] . ' CHECK ' . $row['rcsrc'] . ",$crlf";
}
$schema_create = ereg_replace(',' . $crlf . '$', '', $schema_create);
$index_create = ereg_replace(',' . $crlf . '$', '', $index_create);
$schema_create .= "$crlf);$crlf";
if (!empty($index_create))
{
$schema_create .= $index_create;
}
//
// Ok now we've built all the sql return it to the calling function.
//
return (stripslashes($schema_create));
}
//
// This function returns the "CREATE TABLE" syntax for mysql dbms...
//
function get_table_def_mysql($table, $crlf)
{
global $db;
$schema_create = "";
$field_query = "SHOW FIELDS FROM $table";
$key_query = "SHOW KEYS FROM $table";
// If the user has selected to drop existing tables when doing a restore.
// Then we add the statement to drop the tables....
$schema_create .= "DROP TABLE IF EXISTS $table;$crlf";
$schema_create .= "CREATE TABLE $table($crlf";
// Ok lets grab the fields...
$result = $db->sql_query($field_query);
while ($row = $db->sql_fetchrow($result))
{
$schema_create .= ' ' . $row['Field'] . ' ' . $row['Type'];
if (!empty($row['Default']))
{
$schema_create .= ' DEFAULT \'' . $row['Default'] . '\'';
}
if ($row['Null'] != "YES")
{
$schema_create .= ' NOT NULL';
}
if ($row['Extra'] != "")
{
$schema_create .= ' ' . $row['Extra'];
}
$schema_create .= ",$crlf";
}
//
// Drop the last ',$crlf' off ;)
//
$schema_create = ereg_replace(',' . $crlf . '$', "", $schema_create);
//
// Get any Indexed fields from the database...
//
$result = $db->sql_query($key_query);
while($row = $db->sql_fetchrow($result))
{
$kname = $row['Key_name'];
if (($kname != 'PRIMARY') && ($row['Non_unique'] == 0))
{
$kname = "UNIQUE|$kname";
}
if (!is_array($index[$kname]))
{
$index[$kname] = array();
}
$index[$kname][] = $row['Column_name'];
}
foreach ($index as $x => $columns)
{
$schema_create .= ", $crlf";
if ($x == 'PRIMARY')
{
$schema_create .= ' PRIMARY KEY (' . implode($columns, ', ') . ')';
}
elseif (substr($x,0,6) == 'UNIQUE')
{
$schema_create .= ' UNIQUE ' . substr($x,7) . ' (' . implode($columns, ', ') . ')';
}
else
{
$schema_create .= " KEY $x (" . implode($columns, ', ') . ')';
}
}
$schema_create .= "$crlf);";
if (get_magic_quotes_runtime())
{
return stripslashes($schema_create);
}
else
{
return $schema_create;
}
} // End get_table_def_mysql
//
// This fuction will return a tables create definition to be used as an sql
// statement.
//
//
// The following functions Get the data from the tables and format it as a
// series of INSERT statements, for each different DBMS...
// After every row a custom callback function $handler gets called.
// $handler must accept one parameter ($sql_insert);
//
//
// Here is the function for postgres...
//
function get_table_content_postgresql($table, $handler)
{
global $db;
// Grab all of the data from current table.
$result = $db->sql_query("SELECT * FROM $table");
$i_num_fields = $db->sql_numfields($result);
for ($i = 0; $i < $i_num_fields; $i++)
{
$aryType[] = $db->sql_fieldtype($i, $result);
$aryName[] = $db->sql_fieldname($i, $result);
}
$iRec = 0;
while ($row = $db->sql_fetchrow($result))
{
unset($schema_vals);
unset($schema_fields);
unset($schema_insert);
// Build the SQL statement to recreate the data.
for($i = 0; $i < $i_num_fields; $i++)
{
$strVal = $row[$aryName[$i]];
if (preg_match('#char|text|bool#i', $aryType[$i]))
{
$strQuote = "'";
$strEmpty = "";
$strVal = addslashes($strVal);
}
elseif (preg_match('#date|timestamp#i', $aryType[$i]))
{
if ($empty($strVal))
{
$strQuote = "";
}
else
{
$strQuote = "'";
}
}
else
{
$strQuote = "";
$strEmpty = "NULL";
}
if (empty($strVal) && $strVal != "0")
{
$strVal = $strEmpty;
}
$schema_vals .= " $strQuote$strVal$strQuote,";
$schema_fields .= " $aryName[$i],";
}
$schema_vals = preg_replace('#,$#', '', $schema_vals);
$schema_vals = preg_replace('#^ #', '', $schema_vals);
$schema_fields = preg_replace('#,$#', '', $schema_fields);
$schema_fields = preg_replace('#^ #', '', $schema_fields);
// Take the ordered fields and their associated data and build it
// into a valid sql statement to recreate that field in the data.
$schema_insert = "INSERT INTO $table ($schema_fields) VALUES($schema_vals);";
$handler(trim($schema_insert));
}
return(true);
}// end function get_table_content_postgres...
//
// This function is for getting the data from a mysql table.
//
function get_table_content_mysql($table, $handler)
{
global $db;
// Grab the data from the table.
$result = $db->sql_query("SELECT * FROM $table");
// Loop through the resulting rows and build the sql statement.
$schema_insert = "";
if ($row = $db->sql_fetchrow($result))
{
$schema_insert = "\n#\n# Table Data for $table\n#\n";
$handler($schema_insert);
do
{
$table_list = '(';
$num_fields = $db->sql_numfields($result);
//
// Grab the list of field names.
//
for ($j = 0; $j < $num_fields; $j++)
{
$table_list .= $db->sql_fieldname($j, $result) . ', ';
}
//
// Get rid of the last comma
//
$table_list = preg_replace('#, $#', '', $table_list);
$table_list .= ')';
//
// Start building the SQL statement.
//
$schema_insert = "INSERT INTO $table $table_list VALUES(";
//
// Loop through the rows and fill in data for each column
//
for ($j = 0; $j < $num_fields; $j++)
{
if (!isset($row[$j]))
{
//
// If there is no data for the column set it to null.
// There was a problem here with an extra space causing the
// sql file not to reimport if the last column was null in
// any table. Should be fixed now :) JLH
//
$schema_insert .= ' NULL,';
}
elseif ($row[$j] != '')
{
$schema_insert .= ' \'' . addslashes($row[$j]) . '\',';
}
else
{
$schema_insert .= '\'\',';
}
}
//
// Get rid of the the last comma.
//
$schema_insert = preg_replace('#,$#', '', $schema_insert);
$schema_insert .= ');';
//
// Go ahead and send the insert statement to the handler function.
//
$handler(trim($schema_insert));
}
while ($row = $db->sql_fetchrow($result));
}
return true;
}
function output_table_content($content)
{
global $tempfile;
//fwrite($tempfile, $content . "\n");
//$backup_sql .= $content . "\n";
echo $content ."\n";
return;
}
//
// End Functions
// -----------------------------------------------
?>

View File

@@ -0,0 +1,157 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_names'))
{
return;
}
$module['USER']['DISALLOW'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
require($phpbb_root_path . 'includes/functions_user.'.$phpEx);
// Check permissions
if (!$auth->acl_get('a_names'))
{
trigger_error($user->lang['NO_ADMIN']);
}
if (isset($_POST['disallow']))
{
$disallowed_user = (isset($_REQUEST['disallowed_user'])) ? htmlspecialchars($_REQUEST['disallowed_user']) : '';
$disallowed_user = str_replace('*', '%', $disallowed_user);
if (validate_username($disallowed_user))
{
$message = $user->lang['Disallowed_already'];
}
else
{
$sql = 'INSERT INTO ' . DISALLOW_TABLE . " (disallow_username)
VALUES('" . $db->sql_escape(stripslashes($disallowed_user)) . "')";
$result = $db->sql_query($sql);
$message = $user->lang['Disallow_successful'];
}
add_log('admin', 'log_disallow_add', str_replace('%', '*', $disallowed_user));
trigger_error($message);
}
else if (isset($_POST['allow']))
{
$disallowed_id = (isset($_REQUEST['disallowed_id'])) ? intval($_REQUEST['disallowed_id']) : '';
if (empty($disallowed_id))
{
trigger_error($user->lang['No_user_selected']);
}
$sql = 'DELETE FROM ' . DISALLOW_TABLE . "
WHERE disallow_id = $disallowed_id";
$db->sql_query($sql);
add_log('admin', 'log_disallow_delete');
trigger_error($user->lang['Disallowed_deleted']);
}
// Grab the current list of disallowed usernames...
$sql = 'SELECT *
FROM ' . DISALLOW_TABLE;
$result = $db->sql_query($sql);
$disallow_select = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$disallow_select .= '<option value="' . $row['disallow_id'] . '">' . str_replace('%', '*', $row['disallow_username']) . '</option>';
}
while ($row = $db->sql_fetchrow($result));
}
// Output page
adm_page_header($user->lang['DISALLOW']);
?>
<h1><?php echo $user->lang['DISALLOW']; ?></h1>
<p><?php echo $user->lang['Disallow_explain']; ?></p>
<form method="post" action="<?php echo "admin_disallow.$phpEx$SID"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['Add_disallow_title']; ?></th>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['USERNAME']; ?><br /><span class="gensmall"><?php echo $user->lang['Add_disallow_explain']; ?></span></td>
<td class="row2"><input class="post" type="text" name="disallowed_user" size="30" />&nbsp;</td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="disallow" value="<?php echo $user->lang['SUBMIT']; ?>" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" />
</tr>
</table>
<h1><?php echo $user->lang['Delete_disallow_title']; ?></h1>
<p><?php echo $user->lang['Delete_disallow_explain']; ?></p>
<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['Delete_disallow_title']; ?></th>
</tr>
<?php
if ($disallow_select != '')
{
?>
<tr>
<td class="row1"><?php echo $user->lang['USERNAME']; ?></td>
<td class="row2"><select class="post" name="disallowed_id"><?php echo $disallow_select; ?></select></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="allow" value="<?php echo $user->lang['SUBMIT']; ?>" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" />
</tr>
<?php
}
else
{
?>
<tr>
<td class="row1" colspan="2" align="center"><?php echo $user->lang['No_disallowed']; ?></td>
</tr>
<?php
}
?>
</table></form>
<?php
adm_page_footer();
?>

274
phpBB/adm/admin_email.php Normal file
View File

@@ -0,0 +1,274 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
$file = basename(__FILE__);
$module['GENERAL']['MASS_EMAIL'] = ($auth->acl_get('a_email')) ? "$file$SID" : '';
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Check permissions
if (!$auth->acl_get('a_email'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Set some vars
$message = $subject = $group_id = '';
// Do the job ...
if (isset($_POST['submit']))
{
// Error checking needs to go here ... if no subject and/or no message then skip
// over the send and return to the form
$group_id = request_var('g', 0);
$usernames = request_var('usernames', '');
$subject = preg_replace('#&(\#[0-9]+;)#', '&\1', strtr(request_var('subject', ''), array_flip(get_html_translation_table(HTML_ENTITIES))));
$message = preg_replace('#&(\#[0-9]+;)#', '&\1', strtr(request_var('message', ''), array_flip(get_html_translation_table(HTML_ENTITIES))));
$use_queue = (isset($_POST['send_immediatly'])) ? false : true;
$priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY);
// NOTE: Only temporary, i do not think this is a good idea for the final code, but i have to test this more than once. ;)
$log_session= (isset($_POST['log_session'])) ? true : false;
$error = array();
if (!$subject)
{
$error[] = $user->lang['NO_EMAIL_SUBJECT'];
}
if (!$message)
{
$error[] = $user->lang['NO_EMAIL_MESSAGE'];
}
if (!sizeof($error))
{
if ($usernames)
{
$usernames = implode(', ', preg_replace('#^[\s]*?(.*?)[\s]*?$#e', "\"'\" . \$db->sql_escape('\\1') . \"'\"", explode("\n", $usernames)));
$sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang
FROM ' . USERS_TABLE . "
WHERE username IN ($usernames)
AND user_allow_massemail = 1
ORDER BY user_lang, user_notify_type, SUBSTRING(user_email FROM INSTR(user_email,'@'))";
}
else
{
$sql = ($group_id) ? 'SELECT u.user_email, u.username, u.user_lang, u.user_jabber, u.user_notify_type FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> 1 AND u.user_id = ug.user_id AND u.user_allow_massemail = 1" : 'SELECT u.username, u.user_email, u.user_jabber, u.user_notify_type, u.user_lang FROM ' . USERS_TABLE . ' u WHERE u.user_allow_massemail = 1';
// TODO: different for other db servers?
$sql .= " ORDER BY u.user_lang, u.user_notify_type, SUBSTRING(u.user_email FROM INSTR(u.user_email,'@'))";
}
$result = $db->sql_query($sql);
if (!($row = $db->sql_fetchrow($result)))
{
trigger_error($user->lang['NO_USER']);
}
$db->sql_freeresult($result);
$i = $j = 0;
// Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
$max_chunk_size = 50;
$email_list = array();
$old_lang = $row['user_lang'];
$old_notify_type = $row['user_notify_type'];
do
{
if (($row['user_notify'] == NOTIFY_EMAIL && $row['user_email']) ||
($row['user_notify'] == NOTIFY_IM && $row['user_jabber']) ||
($row['user_notify'] == NOTIFY_BOTH && $row['user_email'] && $row['user_jabber']))
{
if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type)
{
$i = 0;
$j++;
$old_lang = $row['user_lang'];
$old_notify_type = $row['user_notify_type'];
}
$email_list[$j][$i]['lang'] = $row['user_lang'];
$email_list[$j][$i]['method'] = $row['user_notify_type'];
$email_list[$j][$i]['email'] = $row['user_email'];
$email_list[$j][$i]['name'] = $row['username'];
$email_list[$j][$i]['jabber'] = $row['user_jabber'];
$i++;
}
}
while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
// Send the messages
include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx);
$messenger = new messenger($use_queue);
$errored = false;
for ($i = 0; $i < sizeof($email_list); $i++)
{
$used_lang = $email_list[$i][0]['lang'];
$used_method = $email_list[$i][0]['method'];
for ($j = 0; $j < sizeof($email_list[$i]); $j++)
{
$email_row = $email_list[$i][$j];
$messenger->{((sizeof($email_list[$i]) == 1) ? 'to' : 'bcc')}($email_row['email'], $email_row['name']);
$messenger->im($email_row['jabber'], $email_row['name']);
}
$messenger->template('admin_send_email', $used_lang);
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
$messenger->subject($subject);
$messenger->replyto($config['board_email']);
$messenger->set_mail_priority($priority);
$messenger->assign_vars(array(
'SITENAME' => $config['sitename'],
'CONTACT_EMAIL' => $config['board_contact'],
'MESSAGE' => $message)
);
if (!($messenger->send($used_method, $log_session)))
{
$errored = true;
}
}
unset($email_list);
$messenger->save_queue();
if ($group_id)
{
$sql = 'SELECT group_name
FROM ' . GROUPS_TABLE . "
WHERE group_id = $group_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
extract($row);
}
else
{
// Not great but the logging routine doesn't cope well with localising
// on the fly
$group_name = $user->lang['ALL_USERS'];
}
add_log('admin', 'LOG_MASS_EMAIL', $group_name);
$message = (!$errored) ? $user->lang['EMAIL_SENT'] : sprintf($user->lang['EMAIL_SEND_ERROR'], '<a href="admin_viewlogs.' . $phpEx . $SID . '&amp;mode=critical" class="gen">', '</a>');
trigger_error($message);
}
}
// Initial selection
$sql = 'SELECT group_id, group_type, group_name
FROM ' . GROUPS_TABLE . '
ORDER BY group_type DESC, group_name ASC';
$result = $db->sql_query($sql);
$select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>';
if ($row = $db->sql_fetchrow($result))
{
do
{
$selected = ($group_id == $row['group_id']) ? ' selected="selected"' : '';
$select_list .= '<option value = "' . $row['group_id'] . '"' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="blue"' : '') . $selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
$s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>';
$s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>';
$s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $user->lang['MAIL_HIGH_PRIORITY'] . '</option>';
adm_page_header($user->lang['MASS_EMAIL']);
?>
<h1><?php echo $user->lang['MASS_EMAIL']; ?></h1>
<p><?php echo $user->lang['MASS_EMAIL_EXPLAIN']; ?></p>
<form method="post" action="<?php echo "admin_email.$phpEx$SID"; ?>" name="email"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['COMPOSE']; ?></th>
</tr>
<?php
if (sizeof($error))
{
?>
<tr>
<td class="row3" colspan="2" align="center"><span class="error"><?php echo implode('<br />', $error); ?></span></td>
</tr>
<?php
}
?>
<tr>
<td class="row1" width="40%"><b><?php echo $user->lang['SEND_TO_GROUP']; ?>: </b></td>
<td class="row2"><select name="g"><?php echo $select_list; ?></select></td>
</tr>
<tr>
<td class="row1" valign="top"><b><?php echo $user->lang['SEND_TO_USERS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SEND_TO_USERS_EXPLAIN']; ?><br />[ <a href="" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&amp;mode=searchuser&amp;form=email&amp;field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;"><?php echo $user->lang['FIND_USERNAME']; ?></a> ]</span></td>
<td class="row2" align="left"><textarea name="usernames" rows="5" cols="40"><?php echo $usernames; ?></textarea></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['SUBJECT']; ?>: </b></td>
<td class="row2"><input class="post" type="text" name="subject" size="45" maxlength="100" tabindex="2" value="<?php echo $subject; ?>" /></td>
</tr>
<tr>
<td class="row1" valign="top"><span class="gen"><b><?php echo $user->lang['MASS_MESSAGE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['MASS_MESSAGE_EXPLAIN']; ?></span></td>
<td class="row2"><textarea class="post" name="message" rows="10" cols="60" tabindex="3"><?php echo $message; ?></textarea></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['MAIL_PRIORITY']; ?>: </b></td>
<td class="row2"><select name="mail_priority_flag"><?php echo $s_priority_options; ?></select></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['SEND_IMMEDIATLY']; ?>: </b></td>
<td class="row2"><input type="checkbox" name="send_immediatly" class="text" checked="checked" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['LOG_SESSION']; ?>: </b></td>
<td class="row2"><input type="checkbox" name="log_session" class="text" /></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $user->lang['EMAIL']; ?>" name="submit" class="btnmain" /></td>
</tr>
</table></form>
<?php
adm_page_footer();
?>

1582
phpBB/adm/admin_forums.php Normal file

File diff suppressed because it is too large Load Diff

956
phpBB/adm/admin_groups.php Normal file
View File

@@ -0,0 +1,956 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* @todo Avatar gallery ...
* @todo Mass user pref setting via group membership
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_group'))
{
return;
}
$module['USER']['GROUP_MANAGE'] = basename(__FILE__) . "$SID&amp;mode=manage";
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.'.$phpEx);
// Do we have general permissions?
if (!$auth->acl_get('a_group'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Check and set some common vars
$mode = request_var('mode', '');
$action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['addusers'])) ? 'addusers' : request_var('action', ''));
$group_id = request_var('g', 0);
$mark_ary = request_var('mark', array(0));
$name_ary = request_var('usernames', '');
$leader = request_var('leader', 0);
$default = request_var('default', 0);
$start = request_var('start', 0);
$update = (isset($_POST['update'])) ? true : false;
$confirm = (isset($_POST['confirm'])) ? true : false;
$cancel = (isset($_POST['cancel'])) ? true : false;
// Clear some vars
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
$group_row = array();
// Grab basic data for group, if group_id is set and exists
if ($group_id)
{
$sql = 'SELECT *
FROM ' . GROUPS_TABLE . "
WHERE group_id = $group_id";
$result = $db->sql_query($sql);
$group_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$group_row)
{
trigger_error($user->lang['NO_GROUP']);
}
}
switch ($mode)
{
case 'manage':
// Page header
adm_page_header($user->lang['MANAGE']);
// Common javascript
?>
<script language="javascript" type="text/javascript">
<!--
function marklist(match, status)
{
len = eval('document.' + match + '.length');
for (i = 0; i < len; i++)
{
eval('document.' + match + '.elements[i].checked = ' + status);
}
}
//-->
</script>
<?php
// Which page?
switch ($action)
{
case 'approve':
case 'demote':
case 'promote':
if (!$group_id)
{
trigger_error($user->lang['NO_GROUP']);
}
group_user_attributes($action, $group_id, $mark_ary, false, ($group_id) ? $group_row['group_name'] : false);
switch ($action)
{
case 'demote':
$message = 'GROUP_MODS_DEMOTED';
break;
case 'promote':
$message = 'GROUP_MODS_PROMOTED';
break;
case 'approve':
$message = 'USERS_APPROVED';
break;
}
trigger_error($user->lang[$message]);
break;
case 'default':
if (!$group_id)
{
trigger_error($user->lang['NO_GROUP']);
}
if (!$mark_ary)
{
$start = 0;
do
{
$sql = 'SELECT user_id
FROM ' . USER_GROUP_TABLE . "
WHERE group_id = $group_id
ORDER BY user_id";
$result = $db->sql_query_limit($sql, 200, $start);
$mark_ary = array();
if ($row = $db->sql_fetchrow($result))
{
do
{
$mark_ary[] = $row['user_id'];
}
while ($row = $db->sql_fetchrow($result));
group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);
$start = (sizeof($user_id_ary) < 200) ? 0 : $start + 200;
}
else
{
$start = 0;
}
$db->sql_freeresult($result);
}
while ($start);
}
else
{
group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);
}
trigger_error($user->lang['GROUP_DEFS_UPDATED']);
break;
case 'deleteusers':
case 'delete':
if (!$cancel && !$confirm)
{
adm_page_confirm($user->lang['CONFIRM'], $user->lang['CONFIRM_OPERATION']);
}
else
{
if (!$group_id)
{
trigger_error($user->lang['NO_GROUP']);
}
switch ($action)
{
case 'delete':
$error = group_delete($group_id, $group_row['group_name']);
break;
case 'deleteusers':
$error = group_user_del($group_id, $mark_ary, false, $group_row['group_name']);
break;
}
if ($error)
{
trigger_error($user->lang[$error]);
}
$message = ($action == 'delete') ? 'GROUP_DELETED' : 'GROUP_USERS_REMOVE';
trigger_error($user->lang[$message]);
}
break;
case 'addusers':
if (!$group_id)
{
trigger_error($user->lang['NO_GROUP']);
}
if (!$name_ary)
{
trigger_error($user->lang['NO_USERS']);
}
$name_ary = array_unique(explode("\n", $name_ary));
// Add user/s to group
if ($error = group_user_add($group_id, false, $name_ary, $group_row['group_name'], $default, $leader, $group_row))
{
trigger_error($user->lang[$error]);
}
$message = ($action == 'addleaders') ? 'GROUP_MODS_ADDED' : 'GROUP_USERS_ADDED';
trigger_error($user->lang[$message]);
break;
case 'edit':
case 'add':
$data = $submit_ary = array();
if ($action == 'edit' && !$group_id)
{
trigger_error($user->lang['NO_GROUP']);
}
$error = array();
$user->add_lang('ucp');
// Did we submit?
if ($update)
{
$group_name = request_var('group_name', '');
$group_desc = request_var('group_description', '');
$group_type = request_var('group_type', GROUP_FREE);
$data['uploadurl'] = request_var('uploadurl', '');
$data['remotelink'] = request_var('remotelink', '');
$delete = request_var('delete', '');
$submit_ary = array(
'colour' => request_var('group_colour', ''),
'rank' => request_var('group_rank', 0),
'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0,
'message_limit' => request_var('group_message_limit', 0)
);
$avatar = '';
if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink'])
{
$data['width'] = request_var('width', '');
$data['height'] = request_var('height', '');
// Avatar stuff
$var_ary = array(
'uploadurl' => array('string', true, 5, 255),
'remotelink' => array('string', true, 5, 255),
'width' => array('string', true, 1, 3),
'height' => array('string', true, 1, 3),
);
if (!($error = validate_data($data, $var_ary)))
{
$data['user_id'] = "g$group_id";
if ((!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl']) && $can_upload)
{
list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error);
}
else if ($data['remotelink'])
{
list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_remote($data, $error);
}
}
}
else if ($delete)
{
$submit_ary['avatar'] = '';
$submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
}
if (($submit_ary['avatar'] && (!isset($group_row['group_avatar']) || $group_row['group_avatar'] != $submit_ary['avatar'])) || $delete)
{
if (isset($group_row['group_avatar']) && $group_row['group_avatar'])
{
avatar_delete($group_row['group_avatar']);
}
}
// Only set the rank, colour, etc. if it's changed or if we're adding a new
// group. This prevents existing group members being updated if no changes
// were made.
$group_attributes = array();
foreach (array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'message_limit') as $test)
{
if ($action == 'add' || (isset($group_row['group_' . $test]) && $group_row['group_' . $test] != $submit_ary[$test]))
{
$group_attributes[$test] = $group_row['group_' . $test] = $submit_ary[$test];
}
}
if (!($error = group_create($group_id, $group_type, $group_name, $group_description, $group_attributes)))
{
$message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
trigger_error($message);
}
}
else if (!$group_id)
{
$group_name = request_var('group_name', '');
$group_description = '';
$group_type = GROUP_OPEN;
}
else
{
$group_name = $group_row['group_name'];
$group_description = $group_row['group_description'];
$group_type = $group_row['group_type'];
}
?>
<h1><?php echo $user->lang['MANAGE']; ?></h1>
<p><?php echo $user->lang['GROUP_EDIT_EXPLAIN']; ?></p>
<?php
$sql = 'SELECT *
FROM ' . RANKS_TABLE . '
WHERE rank_special = 1
ORDER BY rank_title';
$result = $db->sql_query($sql);
$rank_options = '<option value="-1"' . ((empty($group_rank)) ? 'selected="selected" ' : '') . '>' . $user->lang['USER_DEFAULT'] . '</option>';
if ($row = $db->sql_fetchrow($result))
{
do
{
$selected = (!empty($group_rank) && $row['rank_id'] == $group_rank) ? ' selected="selected"' : '';
$rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>';
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
$type_free = ($group_type == GROUP_FREE) ? ' checked="checked"' : '';
$type_open = ($group_type == GROUP_OPEN) ? ' checked="checked"' : '';
$type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : '';
$type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : '';
if (isset($group_row['group_avatar']) && $group_row['group_avatar'])
{
switch ($group_row['group_avatar_type'])
{
case AVATAR_UPLOAD:
$avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
break;
case AVATAR_GALLERY:
$avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
break;
}
$avatar_img .= $group_row['group_avatar'];
$avatar_img = '<img src="' . $avatar_img . '" width="' . $group_row['group_avatar_width'] . '" height="' . $group_row['group_avatar_height'] . '" alt="" />';
}
else
{
$avatar_img = '<img src="images/no_avatar.gif" alt="" />';
}
$display_gallery = (isset($_POST['displaygallery'])) ? true : false;
?>
<script language="javascript" type="text/javascript">
<!--
function swatch()
{
window.open('./swatch.<?php echo $phpEx; ?>?form=settings&name=group_colour', '_swatch', 'HEIGHT=115,resizable=yes,scrollbars=no,WIDTH=636');
return false;
}
//-->
</script>
<form name="settings" method="post" action="<?php echo "admin_groups.$phpEx$SID&amp;mode=$mode&amp;action=$action&amp;g=$group_id"; ?>"<?php echo ($can_upload) ? ' enctype="multipart/form-data"' : ''; ?>>
<table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['GROUP_DETAILS']; ?></th>
</tr>
<?php
if (sizeof($error))
{
?>
<tr>
<td class="row1" colspan="2" align="center"><span style="color:red"><?php echo implode('<br />', $error); ?></span></td>
</tr>
<?php
}
?>
<tr>
<td class="row2" width="40%"><b><?php echo $user->lang['GROUP_NAME']; ?>:</b></td>
<td class="row1"><?php
if ($group_type != GROUP_SPECIAL)
{
?><input class="post" type="text" name="group_name" value="<?php echo ($group_name) ? $group_name : ''; ?>" size="40" maxlength="40" /><?php
}
else
{
?><b><?php echo ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name; ?></b><?php
}
?></td>
</tr>
<tr>
<td class="row2"><b><?php echo $user->lang['GROUP_DESC']; ?>:</b></td>
<td class="row1"><input class="post" type="text" name="group_description" value="<?php echo ($group_description) ? $group_description : ''; ?>" size="40" maxlength="255" /></td>
</tr>
<?php
if ($group_type != GROUP_SPECIAL)
{
?>
<tr>
<td class="row2"><b><?php echo $user->lang['GROUP_TYPE']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['GROUP_TYPE_EXPLAIN']; ?></span></td>
<td class="row1" nowrap="nowrap"><input type="radio" name="group_type" value="<?php echo GROUP_FREE . '"' . $type_free; ?> /> <?php echo $user->lang['GROUP_OPEN']; ?> &nbsp; <input type="radio" name="group_type" value="<?php echo GROUP_OPEN . '"' . $type_open; ?> /> <?php echo $user->lang['GROUP_REQUEST']; ?> &nbsp; <input type="radio" name="group_type" value="<?php echo GROUP_CLOSED . '"' . $type_closed; ?> /> <?php echo $user->lang['GROUP_CLOSED']; ?> &nbsp; <input type="radio" name="group_type" value="<?php echo GROUP_HIDDEN . '"' . $type_hidden; ?>" /> <?php echo $user->lang['GROUP_HIDDEN']; ?></td>
</tr>
<?php
}
?>
<tr>
<th colspan="2"><?php echo $user->lang['GROUP_SETTINGS_SAVE']; ?></th>
</tr>
<tr>
<td class="row2"><b><?php echo $user->lang['GROUP_RECEIVE_PM']; ?>:</b></td>
<td class="row1" nowrap="nowrap"><input type="checkbox" name="group_receive_pm"<?php echo (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : ''; ?> /></td>
</tr>
<tr>
<td class="row2"><b><?php echo $user->lang['GROUP_MESSAGE_LIMIT']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['GROUP_MESSAGE_LIMIT_EXPLAIN']; ?></span></td>
<td class="row1" nowrap="nowrap"><input class="post" type="text" maxlength="4" size="4" name="group_message_limit" value="<?php echo (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0; ?>" /></td>
</tr>
<tr>
<td class="row2"><b><?php echo $user->lang['GROUP_COLOR']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['GROUP_COLOR_EXPLAIN']; ?></span></td>
<td class="row1" nowrap="nowrap"><input class="post" type="text" name="group_colour" value="<?php echo (isset($group_row['group_colour'])) ? $group_row['group_colour'] : ''; ?>" size="6" maxlength="6" /> &nbsp; [ <a href="<?php echo "swatch.$phpEx"; ?>" onclick="swatch();return false" target="_swatch"><?php echo $user->lang['COLOUR_SWATCH']; ?></a> ]</td>
</tr>
<tr>
<td class="row2"><b><?php echo $user->lang['GROUP_RANK']; ?>:</b></td>
<td class="row1"><select name="group_rank"><?php echo $rank_options; ?></select></td>
</tr>
<tr>
<th colspan="2"><?php echo $user->lang['GROUP_AVATAR']; ?></th>
</tr>
<tr>
<td class="row2" width="35%"><b><?php echo $user->lang['CURRENT_IMAGE']; ?>: </b><br /><span class="gensmall"><?php echo sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)); ?></span></td>
<td class="row1" align="center"><br /><?php echo $avatar_img; ?><br /><br /><input type="checkbox" name="delete" />&nbsp;<span class="gensmall"><?php echo $user->lang['DELETE_AVATAR']; ?></span></td>
</tr>
<?php
// Can we upload?
if ($can_upload)
{
?>
<tr>
<td class="row2" width="35%"><b><?php echo $user->lang['UPLOAD_AVATAR_FILE']; ?>: </b></td>
<td class="row1"><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $config['avatar_max_filesize']; ?>" /><input class="post" type="file" name="uploadfile" /></td>
</tr>
<tr>
<td class="row2" width="35%"><b><?php echo $user->lang['UPLOAD_AVATAR_URL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['UPLOAD_AVATAR_URL_EXPLAIN']; ?></span></td>
<td class="row1"><input class="post" type="text" name="uploadurl" size="40" value="" /></td>
</tr>
<?php
}
?>
<tr>
<td class="row2" width="35%"><b><?php echo $user->lang['LINK_REMOTE_AVATAR']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['LINK_REMOTE_AVATAR_EXPLAIN']; ?></span></td>
<td class="row1"><input class="post" type="text" name="remotelink" size="40" value="" /></td>
</tr>
<tr>
<td class="row2" width="35%"><b><?php echo $user->lang['LINK_REMOTE_SIZE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['LINK_REMOTE_SIZE_EXPLAIN']; ?></span></td>
<td class="row1"><input class="post" type="text" name="width" size="3" value="<?php echo (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : ''; ?>" /> <span class="gen">px X </span> <input class="post" type="text" name="height" size="3" value="<?php echo (isset($group_row['group_avatar_height'])) ? $group_row['group_avatar_height'] : ''; ?>" /> <span class="gen">px</span></td>
</tr>
<?php
// Do we have a gallery?
if ($config['allow_avatar_local'] && !$display_gallery)
{
?>
<tr>
<td class="row2" width="35%"><b><?php echo $user->lang['AVATAR_GALLERY']; ?>: </b></td>
<td class="row1"><input class="btnlite" type="submit" name="displaygallery" value="<?php echo $user->lang['DISPLAY_GALLERY']; ?>" /></td>
</tr>
<?php
}
// Do we want to display it?
if ($config['allow_avatar_local'] && $display_gallery)
{
?>
<tr>
<th colspan="2"><?php echo $user->lang['AVATAR_GALLERY']; ?></th>
</tr>
<tr>
<td class="cat" colspan="2" align="center" valign="middle"><span class="genmed"><?php echo $user->lang['AVATAR_CATEGORY']; ?>: </span><select name="avatarcat">{S_CAT_OPTIONS}</select>&nbsp; <span class="genmed"><?php echo $user->lang['AVATAR_PAGE']; ?>: </span><select name="avatarpage">{S_PAGE_OPTIONS}</select>&nbsp;<input class="btnlite" type="submit" value="<?php echo $user->lang['GO']; ?>" name="avatargallery" /></td>
</tr>
<tr>
<td class="row1" colspan="2" align="center">
<table cellspacing="1" cellpadding="4" border="0">
<!-- BEGIN avatar_row -->
<tr>
<!-- BEGIN avatar_column -->
<td class="row1" align="center"><img src="{avatar_row.avatar_column.AVATAR_IMAGE}" alt="{avatar_row.avatar_column.AVATAR_NAME}" title="{avatar_row.avatar_column.AVATAR_NAME}" /></td>
<!-- END avatar_column -->
</tr>
<tr>
<!-- BEGIN avatar_option_column -->
<td class="row2" align="center"><input type="radio" name="avatarselect" value="{avatar_row.avatar_option_column.S_OPTIONS_AVATAR}" /></td>
<!-- END avatar_option_column -->
</tr>
<!-- END avatar_row -->
</table>
</td>
</tr>
<?php
}
?>
<tr>
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" /> &nbsp; <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td>
</tr>
</table>
</form>
<?php
adm_page_footer();
break;
}
if ($mode == 'list' || $group_id)
{
if (!$group_id)
{
trigger_error($user->lang['NO_GROUP']);
}
?>
<h1><?php echo $user->lang['GROUP_MEMBERS']; ?></h1>
<p><?php echo $user->lang['GROUP_MEMBERS_EXPLAIN']; ?></p>
<form name="list" method="post" action="<?php echo "admin_groups.$phpEx$SID&amp;mode=$mode&amp;g=$group_id"; ?>">
<table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th width="55%"><?php echo $user->lang['USERNAME']; ?></th>
<th width="3%" nowrap="nowrap"><?php echo $user->lang['GROUP_DEFAULT']; ?></th>
<th width="20%"><?php echo $user->lang['JOINED']; ?></th>
<th width="20%"><?php echo $user->lang['POSTS']; ?></th>
<th width="2%"><?php echo $user->lang['MARK']; ?></th>
</tr>
<?php
// Total number of group leaders
$sql = 'SELECT COUNT(user_id) AS total_leaders
FROM ' . USER_GROUP_TABLE . "
WHERE group_id = $group_id
AND group_leader = 1";
$result = $db->sql_query($sql);
$total_leaders = ($row = $db->sql_fetchrow($result)) ? $row['total_leaders'] : 0;
$db->sql_freeresult($result);
// Total number of group members (non-leaders)
$sql = 'SELECT COUNT(user_id) AS total_members
FROM ' . USER_GROUP_TABLE . "
WHERE group_id = $group_id
AND group_leader <> 1";
$result = $db->sql_query($sql);
$total_members = ($row = $db->sql_fetchrow($result)) ? $row['total_members'] : 0;
$db->sql_freeresult($result);
// Grab the members
$sql = 'SELECT u.user_id, u.username, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id
AND u.user_id = ug.user_id
ORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username ";
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
$leader = $member = 0;
$group_data = array();
if ($row = $db->sql_fetchrow($result))
{
do
{
$type = ($row['group_leader']) ? 'leader' : 'member';
$group_data[$type][$$type]['user_id'] = $row['user_id'];
$group_data[$type][$$type]['group_id'] = $row['group_id'];
$group_data[$type][$$type]['username'] = $row['username'];
$group_data[$type][$$type]['user_regdate'] = $row['user_regdate'];
$group_data[$type][$$type]['user_posts'] = $row['user_posts'];
$group_data[$type][$$type]['user_pending'] = ($row['user_pending']) ? 1 : 0;
$$type++;
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
if ($group_row['group_type'] != GROUP_SPECIAL)
{
?>
<tr>
<td class="row3" colspan="5"><b><?php echo $user->lang['GROUP_LEAD']; ?></b></td>
</tr>
<?php
if (sizeof($group_data['leader']))
{
$row_class = '';
foreach ($group_data['leader'] as $row)
{
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $row_class; ?>"><a href="<?php echo "admin_users.$phpEx$SID&amp;mode=edit&amp;u=" . $row['user_id']; ?>"><?php echo $row['username']; ?></a></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo ($row['group_id'] == $group_id) ? $user->lang['YES'] : $user->lang['NO']; ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['user_posts']; ?></td>
<td class="<?php echo $row_class; ?>" align="center"><input class="checkbox" type="checkbox" name="mark[]" value="<?php echo $row['user_id']; ?>" /></td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td class="row1" colspan="5" align="center"><?php echo $user->lang['GROUPS_NO_MODS']; ?></td>
</tr>
<?php
}
}
?>
<tr>
<td class="row3" colspan="5"><b><?php echo $user->lang['GROUP_APPROVED']; ?></b></td>
</tr>
<?php
if (sizeof($group_data['member']))
{
$row_class = '';
$pending = false;
foreach ($group_data['member'] as $row)
{
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
if ($row['user_pending'] && !$pending)
{
?>
<tr>
<td class="row3" colspan="5"><b><?php echo $user->lang['GROUP_PENDING']; ?></b></td>
</tr>
<?php
$pending = true;
}
?>
<tr class="<?php echo $row_class; ?>">
<td><a href="<?php echo "admin_users.$phpEx$SID&amp;mode=edit&amp;u=" . $row['user_id']; ?>"><?php echo $row['username']; ?></a></td>
<td align="center"><?php echo ($row['group_id'] == $group_id) ? $user->lang['YES'] : $user->lang['NO']; ?></td>
<td align="center"><?php echo ($row['user_regdate']) ? $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']) : '-'; ?></td>
<td align="center"><?php echo $row['user_posts']; ?></td>
<td align="center"><input class="checkbox" type="checkbox" name="mark[]" value="<?php echo $row['user_id']; ?>" /></td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td class="row1" colspan="5" align="center"><?php echo $user->lang['GROUPS_NO_MEMBERS']; ?></td>
</tr>
<?php
}
?>
<tr>
<td class="cat" colspan="5" align="right">
<select name="action"><option class="sep" value=""><?php echo $user->lang['SELECT_OPTION']; ?></option><?php
foreach (array('default' => 'DEFAULT', 'approve' => 'APPROVE', 'demote' => 'DEMOTE', 'promote' => 'PROMOTE', 'deleteusers' => 'DELETE') as $option => $lang)
{
echo '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>';
}
?>
</select> <input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" />&nbsp;
</td>
</tr>
</table>
<table width="95%" cellspacing="1" cellpadding="1" border="0" align="center">
<tr>
<td valign="top"><?php echo on_page($total_members, $config['topics_per_page'], $start); ?></td>
<td align="right">
<b class="gensmall"><a href="javascript:marklist('list', true);"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('list', false);"><?php echo $user->lang['UNMARK_ALL']; ?></a></b>&nbsp;<br />
<span class="nav"><?php echo generate_pagination("admin_groups.$phpEx$SID&amp;action=$action&amp;mode=$mode&amp;g=$group_id", $total_members, $config['topics_per_page'], $start, true); ?></span>
</td>
</tr>
</table>
<h1><?php echo $user->lang['ADD_USERS']; ?></h1>
<p><?php echo $user->lang['ADD_USERS_EXPLAIN']; ?></p>
<table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['ADD_USERS']; ?></th>
</tr>
<tr>
<td class="row1" width="40%"><b><?php echo $user->lang['USER_GROUP_LEADER']; ?>:</b></span></td>
<td class="row2"><input type="radio" name="leader" value="1" /> <?php echo $user->lang['YES']; ?> &nbsp; <input type="radio" name="leader" value="0" checked="checked" /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['USER_GROUP_DEFAULT']; ?>:</b> <br /><span class="gensmall"><?php echo $user->lang['USER_GROUP_DEFAULT_EXPLAIN']; ?></span></td>
<td class="row2"><input type="radio" name="default" value="1" /> <?php echo $user->lang['YES']; ?> &nbsp; <input type="radio" name="default" value="0" checked="checked" /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['USERNAME']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['USERNAMES_EXPLAIN']; ?><br />[ <a href="<?php echo "../memberlist.$phpEx$SID&amp;mode=searchuser&amp;form=list&amp;field=usernames"; ?>" target="usersearch"><?php echo $user->lang['FIND_USERNAME']; ?></a> ]</span></td>
<td class="row2"><textarea name="usernames" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="addusers" value="<?php echo $user->lang['SUBMIT']; ?>" /></td>
</tr>
</table>
</form>
<?php
adm_page_footer();
}
?>
<h1><?php echo $user->lang['GROUP_MANAGE']; ?></h1>
<p><?php echo $user->lang['GROUP_MANAGE_EXPLAIN']; ?></p>
<h1><?php echo $user->lang['USER_DEF_GROUPS']; ?></h1>
<p><?php echo $user->lang['USER_DEF_GROUPS_EXPLAIN']; ?></p>
<form method="post" action="<?php echo "admin_groups.$phpEx$SID&amp;mode=$mode"; ?>">
<table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th width="95%"><?php echo $user->lang['MANAGE']; ?></th>
<th nowrap="nowrap"><?php echo $user->lang['TOTAL_MEMBERS']; ?></th>
<th colspan="3"><?php echo $user->lang['OPTIONS']; ?></th>
</tr>
<?php
$sql = 'SELECT g.group_id, g.group_name, g.group_type, COUNT(ug.user_id) AS total_members
FROM (' . GROUPS_TABLE . ' g
LEFT JOIN ' . USER_GROUP_TABLE . ' ug USING (group_id))
GROUP BY g.group_id
ORDER BY g.group_type ASC, g.group_name';
$result = $db->sql_query($sql);
$special = $normal = 0;
$group_ary = array();
while ($row = $db->sql_fetchrow($result) )
{
$type = ($row['group_type'] == GROUP_SPECIAL) ? 'special' : 'normal';
$group_ary[$type][$$type]['group_id'] = $row['group_id'];
$group_ary[$type][$$type]['group_name'] = $row['group_name'];
$group_ary[$type][$$type]['group_type'] = $row['group_type'];
$group_ary[$type][$$type]['total_members'] = $row['total_members'];
$$type++;
}
$db->sql_freeresult($result);
$special_toggle = false;
foreach ($group_ary as $type => $row_ary)
{
if ($type == 'special')
{
?>
<tr>
<td class="cat" colspan="5" align="right"><?php echo $user->lang['CREATE_GROUP']; ?>: <input class="post" type="text" name="group_name" maxlength="30" /> <input class="btnmain" type="submit" name="add" value="<?php echo $user->lang['SUBMIT']; ?>" /></td>
</tr>
</table>
<h1><?php echo $user->lang['SPECIAL_GROUPS']; ?></h1>
<p><?php echo $user->lang['SPECIAL_GROUPS_EXPLAIN']; ?></p>
<table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th width="95%"><?php echo $user->lang['MANAGE']; ?></th>
<th><?php echo $user->lang['TOTAL_MEMBERS']; ?></th>
<th colspan="3"><?php echo $user->lang['OPTIONS']; ?></th>
</tr>
<?php
}
$row_class = '';
foreach ($row_ary as $row)
{
$row_class = ($row_class != 'row1') ? 'row1' : 'row2';
$group_id = $row['group_id'];
$group_name = (!empty($user->lang['G_' . $row['group_name']]))? $user->lang['G_' . $row['group_name']] : $row['group_name'];
?>
<tr class="<?php echo $row_class; ?>">
<td width="95%"><a href="admin_groups.<?php echo "$phpEx$SID&amp;mode=$mode&amp;action=list&amp;g=$group_id"; ?>"><?php echo $group_name; ?></a></td>
<td align="center" nowrap="nowrap">&nbsp;<?php echo $row['total_members']; ?>&nbsp;</td>
<td align="center" nowrap="nowrap">&nbsp;<a href="<?php echo "admin_groups.$phpEx$SID&amp;mode=$mode&amp;action=default&amp;g=$group_id"; ?>"><?php echo $user->lang['GROUP_DEFAULT']; ?></a>&nbsp;</td>
<td align="center" nowrap="nowrap">&nbsp;<a href="<?php echo "admin_groups.$phpEx$SID&amp;mode=$mode&amp;action=edit&amp;g=$group_id"; ?>"><?php echo $user->lang['EDIT']; ?></a>&nbsp;</td>
<td align="center" nowrap="nowrap">&nbsp;<?php
echo ($row['group_type'] != GROUP_SPECIAL) ? "<a href=\"admin_groups.$phpEx$SID&amp;mode=$mode&amp;action=delete&amp;g=$group_id\">" . $user->lang['DELETE'] . '</a>' : $user->lang['DELETE'];
?>&nbsp;</td>
</tr>
<?php
}
}
?>
<tr>
<td class="cat" colspan="5">&nbsp;</td>
</tr>
</table>
</form>
<?php
adm_page_footer();
break;
// Setting groupwide preferences
case 'prefs':
adm_page_header($user->lang['GROUP_PREFS']);
if ($update)
{
$user_lang = request_var('lang', '');
$user_tz = request_var('tz', 0.0);
$user_dst = request_var('dst', 0);
}
else
{
}
?>
<h1><?php echo $user->lang['GROUP_SETTINGS']; ?></h1>
<p><?php echo $user->lang['GROUP_SETTINGS_EXPLAIN']; ?></p>
<form method="post" action="<?php echo "admin_groups.$phpEx$SID&amp;action=edit&amp;g=$group_id"; ?>"><table class="bg" width="90%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['GROUP_SETTINGS']; ?></th>
</tr>
<tr>
<td class="row2"><?php echo $user->lang['GROUP_LANG']; ?>:</td>
<td class="row1"><select name="user_lang"><?php echo '<option value="-1" selected="selected">' . $user->lang['USER_DEFAULT'] . '</option>' . language_select(); ?></select></td>
</tr>
<tr>
<td class="row2"><?php echo $user->lang['GROUP_TIMEZONE']; ?>:</td>
<td class="row1"><select name="user_tz"><?php echo '<option value="-14" selected="selected">' . $user->lang['USER_DEFAULT'] . '</option>' . tz_select(); ?></select></td>
</tr>
<tr>
<td class="row2"><?php echo $user->lang['GROUP_DST']; ?>:</td>
<td class="row1" nowrap="nowrap"><input type="radio" name="user_dst" value="0" /> <?php echo $user->lang['DISABLED']; ?> &nbsp; <input type="radio" name="user_dst" value="1" /> <?php echo $user->lang['ENABLED']; ?> &nbsp; <input type="radio" name="user_dst" value="-1" checked="checked" /> <?php echo $user->lang['USER_DEFAULT']; ?></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="submitprefs" value="<?php echo $user->lang['SUBMIT']; ?>" /> &nbsp; <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td>
</tr>
</table></form>
<?php
adm_page_footer();
break;
default:
trigger_error($user->lang['NO_MODE']);
}
exit;
?>

776
phpBB/adm/admin_icons.php Normal file
View File

@@ -0,0 +1,776 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_icons'))
{
return;
}
$filename = basename(__FILE__);
$module['POST']['SMILIES'] = "$filename$SID&amp;mode=smilies";
$module['POST']['ICONS'] = "$filename$SID&amp;mode=icons";
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Do we have general permissions?
if (!$auth->acl_get('a_icons'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Grab some basic parameters
$mode = request_var('mode', '');
$action = request_var('action', '');
$action = (isset($_POST['add'])) ? 'add' : $action;
$action = (isset($_POST['edit'])) ? 'edit' : $action;
$id = request_var('id', 0);
// What are we working on?
switch ($mode)
{
case 'smilies':
$table = SMILIES_TABLE;
$lang = 'SMILIES';
$fields = 'smiley';
$img_path = $config['smilies_path'];
break;
case 'icons':
$table = ICONS_TABLE;
$lang = 'ICONS';
$fields = 'icons';
$img_path = $config['icons_path'];
break;
}
// Clear some arrays
$_images = $_paks = array();
$notice = '';
// Grab file list of paks and images
if ($action == 'edit' || $action == 'add' || $action == 'import')
{
$imglist = filelist($phpbb_root_path . $img_path, '');
foreach ($imglist as $path => $img_ary)
{
foreach ($img_ary as $img)
{
$img_size = @getimagesize($phpbb_root_path . $img_path . '/' . $path . $img);
$_images[$path.$img]['file'] = $path.$img;
$_images[$path.$img]['width'] = $img_size[0];
$_images[$path.$img]['height'] = $img_size[1];
}
}
unset($imglist);
$dir = @opendir($phpbb_root_path . $img_path);
while ($file = @readdir($dir))
{
if (is_file($phpbb_root_path . $img_path . '/' . $file) && preg_match('#\.pak$#i', $file))
{
$_paks[] = $file;
}
}
@closedir($dir);
}
// What shall we do today? Oops, I believe that's trademarked ...
switch ($action)
{
case 'edit':
unset($_images);
$_images = array();
case 'add':
$order_list = '';
$sql = "SELECT *
FROM $table
ORDER BY {$fields}_order " . (($id || $action == 'add') ? 'DESC' : 'ASC');
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
do
{
if ($action == 'add')
{
unset($_images[$row[$fields . '_url']]);
}
if ($row[$fields . '_id'] == $id)
{
$after = TRUE;
$data[$row[$fields . '_url']] = $row;
}
else
{
if ($action == 'edit' && !$id)
{
$data[$row[$fields . '_url']] = $row;
}
$selected = '';
if (!empty($after))
{
$selected = ' selected="selected"';
$after = FALSE;
}
$after_txt = ($mode == 'smilies') ? $row['code'] : $row['icons_url'];
$order_list = '<option value="' . ($row[$fields . '_order']) . '"' . $selected . '>' . sprintf($user->lang['AFTER_' . $lang], ' -&gt; ' . htmlspecialchars($after_txt)) . '</option>' . $order_list;
}
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
$order_list = '<option value="1"' . ((!isset($after)) ? ' selected="selected"' : '') . '>' . $user->lang['FIRST'] . '</option>' . $order_list;
if ($action == 'add')
{
$data = $_images;
}
$colspan = (($mode == 'smilies') ? '7' : '5');
$colspan += ($id) ? 1 : 0;
$colspan += ($action == 'add') ? 2 : 0;
adm_page_header($user->lang[$lang]);
?>
<h1><?php echo $user->lang[$lang]; ?></h1>
<p><?php echo $user->lang[$lang .'_EXPLAIN']; ?></p>
<form method="post" action="admin_icons.<?php echo $phpEx . $SID . "&amp;mode=$mode&amp;action=" . (($action == 'add') ? 'create' : 'modify'); ?>">
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="<?php echo $colspan; ?>"><?php echo $user->lang[$lang . '_CONFIG'] ?></th>
</tr>
<tr>
<td class="cat"><?php echo $user->lang[$lang . '_URL'] ?></td>
<td class="cat"><?php echo $user->lang[$lang . '_LOCATION'] ?></td>
<?php
if ($mode == 'smilies')
{
?>
<td class="cat"><?php echo $user->lang[$lang . '_CODE'] ?></td>
<td class="cat"><?php echo $user->lang[$lang . '_EMOTION'] ?></td>
<?php
}
?>
<td class="cat"><?php echo $user->lang[$lang . '_WIDTH'] ?></td>
<td class="cat"><?php echo $user->lang[$lang . '_HEIGHT'] ?></td>
<td class="cat"><?php echo $user->lang['DISPLAY_ON_POSTING'] ?></td>
<?php
if ($id || $action == 'add')
{
?>
<td class="cat"><?php echo $user->lang[$lang . '_ORDER'] ?></td>
<?php
}
?>
<?php
if ($action == 'add')
{
?>
<td class="cat"><?php echo $user->lang['ADD'] ?></td>
<?php
}
?>
</tr>
<?php
$row = 0;
foreach ($data as $img => $img_row)
{
$row_class = (($row % 2) == 0) ? 'row1' : 'row2';
?>
<tr>
<td align="center" class="<?php echo $row_class; ?>"><img src="<?php echo $phpbb_root_path . $img_path . '/' . $img ?>" border="0" alt="" title="" /><input type="hidden" name="image[<?php echo $img; ?>]" value="1" /></td>
<td valign="top" class="<?php echo $row_class; ?>">[<?php echo $img; ?>]</td>
<?php
if ($mode == 'smilies')
{
?>
<td class="<?php echo $row_class; ?>"><input class="post" type="text" name="code[<?php echo $img; ?>]" value="<?php echo (!empty($img_row['code'])) ? $img_row['code'] : '' ?>" size="10" /></td>
<td class="<?php echo $row_class; ?>"><input class="post" type="text" name="emotion[<?php echo $img; ?>]" value="<?php echo (!empty($img_row['emotion'])) ? $img_row['emotion'] : '' ?>" size="10" /></td>
<?php
}
?>
<td class="<?php echo $row_class; ?>"><input class="post" type="text" size="3" name="width[<?php echo $img; ?>]" value="<?php echo (!empty($img_row[$fields .'_width'])) ? $img_row[$fields .'_width'] : $img_row['width'] ?>" /></td>
<td class="<?php echo $row_class; ?>"><input class="post" type="text" size="3" name="height[<?php echo $img; ?>]" value="<?php echo (!empty($img_row[$fields .'_height'])) ? $img_row[$fields .'_height'] : $img_row['height'] ?>" /></td>
<td class="<?php echo $row_class; ?>"><input type="checkbox" name="display_on_posting[<?php echo $img; ?>]"<?php echo (!empty($img_row['display_on_posting']) || $action == 'add') ? ' checked="checked"' : '' ?> /></td>
<?php
if ($id || $action == 'add')
{
?>
<td class="<?php echo $row_class; ?>"><select name="order[<?php echo $img; ?>]"><?php echo $order_list ?></select></td>
<?php
}
if ($action == 'add')
{
?>
<td class="<?php echo $row_class; ?>"><input type="checkbox" name="add_img[<?php echo $img; ?>]" value="1" /><?php
}
?>
</tr>
<?php
if (isset($img_row[$fields . '_id']))
{
?><input type="hidden" name="id[<?php echo $img; ?>]" value="<?php echo $img_row[$fields . '_id'] ?>" /><?php
}
$row++;
}
?>
<tr>
<td class="cat" colspan="<?php echo $colspan; ?>" align="center"><?php
?><input class="btnmain" type="submit" value="<?php echo $user->lang['SUBMIT'] ?>" /></td>
</tr>
</table></form>
<?php
adm_page_footer();
break;
case 'create':
case 'modify':
// Get items to create/modify
$images = (isset($_POST['image'])) ? array_keys($_POST['image']) : array();
// Now really get the items
$image_id = (isset($_POST['id'])) ? array_map('intval', $_POST['id']) : array();
$image_order = (isset($_POST['order'])) ? array_map('intval', $_POST['order']) : array();
$image_width = (isset($_POST['width'])) ? array_map('intval', $_POST['width']) : array();
$image_height = (isset($_POST['height'])) ? array_map('intval', $_POST['height']) : array();
$image_add = (isset($_POST['add_img'])) ? array_map('intval', $_POST['add_img']) : array();
$image_emotion = request_var('emotion', '');
$image_code = request_var('code', '');
$image_display_on_posting = (isset($_POST['display_on_posting'])) ? array_map('intval', $_POST['display_on_posting']) : array();
foreach ($images as $image)
{
if (($mode == 'smilies' && ($image_emotion[$image] == '' || $image_code[$image] == '')) ||
($action == 'create' && !isset($image_add[$image])))
{
}
else
{
if ($image_width[$image] == 0 || $image_height[$image] == 0)
{
$img_size = @getimagesize($phpbb_root_path . $img_path . '/' . $image);
$image_width[$image] = $img_size[0];
$image_height[$image] = $img_size[1];
}
$img_sql = array(
$fields . '_url' => $image,
$fields . '_width' => $image_width[$image],
$fields . '_height' => $image_height[$image],
'display_on_posting'=> (isset($image_display_on_posting[$image])) ? 1 : 0,
);
if ($mode == 'smilies')
{
$img_sql = array_merge($img_sql, array(
'emotion' => $image_emotion[$image],
'code' => $image_code[$image])
);
}
if (!empty($image_order[$image]))
{
$img_sql = array_merge($img_sql, array(
$fields . '_order' => $image_order[$image] . '.5')
);
}
if ($action == 'modify')
{
$sql = "UPDATE $table
SET " . $db->sql_build_array('UPDATE', $img_sql) . "
WHERE {$fields}_id = " . $image_id[$image];
$db->sql_query($sql);
}
else
{
$sql = "INSERT INTO $table " . $db->sql_build_array('INSERT', $img_sql);
$db->sql_query($sql);
}
$update = FALSE;
if ($action == 'modify' && !empty($image_order[$image]))
{
$update = TRUE;
$result = $db->sql_query("SELECT {$fields}_order
FROM $table
WHERE {$fields}_id = " . $image_id[$image]);
$order_old = $db->sql_fetchfield($fields . '_order', 0, $result);
if ($order_old == $image_order[$image])
{
$update = FALSE;
}
if ($order_old > $image_order[$image])
{
$sign = '+';
$where = $fields . '_order >= ' . $image_order[$image] . " AND {$fields}_order < $order_old";
}
else if ($order_old < $image_order[$image])
{
$sign = '-';
$where = "{$fields}_order > $order_old AND {$fields}_order < " . $image_order[$image];
$sql[$fields . '_order'] = $image_order[$image] - 1;
}
}
if ($update)
{
$sql = "UPDATE $table
SET {$fields}_order = {$fields}_order $sign 1
WHERE $where";
$db->sql_query($sql);
}
}
}
$cache->destroy('icons');
if ($action == 'modify')
{
trigger_error($user->lang[$lang . '_EDITED']);
}
else
{
trigger_error($user->lang[$lang . '_ADDED']);
}
break;
case 'import':
$pak = request_var('pak', '');
$current = request_var('current', '');
if ($pak != '')
{
$order = 0;
// The user has already selected a smilies_pak file
if ($current == 'delete')
{
$db->sql_query("TRUNCATE $table");
switch ($mode)
{
case 'smilies':
break;
case 'icons':
// Reset all icon_ids
$db->sql_query('UPDATE ' . TOPICS_TABLE . '
SET icon_id = 0');
$db->sql_query('UPDATE ' . POSTS_TABLE . '
SET icon_id = 0');
break;
}
}
else
{
$cur_img = array();
$field_sql = ($mode == 'smilies') ? 'code' : 'icons_url';
$result = $db->sql_query("SELECT $field_sql FROM $table");
while ($row = $db->sql_fetchrow($result))
{
++$order;
$cur_img[$row[$field_sql]] = 1;
}
$db->sql_freeresult($result);
}
if (!($pak_ary = @file($phpbb_root_path . $img_path . '/' . $pak)))
{
trigger_error('Could not read pak file', E_USER_ERROR);
}
foreach ($pak_ary as $pak_entry)
{
$data = array();
if (preg_match_all("#'(.*?)', #", $pak_entry, $data))
{
if ((sizeof($data[1]) != 3 && $mode == 'icons') ||
(sizeof($data[1]) != 5 && $mode == 'smilies'))
{
trigger_error($user->lang['WRONG_PAK_TYPE']);
}
$img = stripslashes($data[1][0]);
$width = stripslashes($data[1][1]);
$height = stripslashes($data[1][2]);
if (isset($data[1][3]) && isset($data[1][4]))
{
$emotion = stripslashes($data[1][3]);
$code = htmlentities(stripslashes($data[1][4]));
}
if ($current == 'replace' &&
(($mode == 'smilies' && !empty($cur_img[$code])) ||
($mode == 'icons' && !empty($cur_img[$img]))))
{
$replace_sql = ($mode == 'smilies') ? $code : $img;
$sql = array(
$fields . '_url' => $img,
$fields . '_height' => (int) $height,
$fields . '_width' => (int) $width,
);
if ($mode == 'smilies')
{
$sql = array_merge($sql, array(
'emotion' => $emotion
));
}
$db->sql_query("UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql) . "
WHERE $field_sql = '" . $db->sql_escape($replace_sql) . "'");
}
else
{
++$order;
$sql = array(
$fields . '_url' => $img,
$fields . '_height' => (int) $height,
$fields . '_width' => (int) $width,
$fields . '_order' => (int) $order,
);
if ($mode == 'smilies')
{
$sql = array_merge($sql, array(
'code' => $code,
'emotion' => $emotion
));
}
$db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql));
}
}
}
$cache->destroy('icons');
trigger_error($user->lang[$lang . '_IMPORT_SUCCESS']);
}
else
{
$pak_options = '';
foreach ($_paks as $pak)
{
$pak_options .= '<option value="' . $pak . '">' . htmlspecialchars($pak) . '</option>';
}
adm_page_header($user->lang[$lang]);
?>
<h1><?php echo $user->lang[$lang] ?></h1>
<p><?php echo $user->lang[$lang .'_EXPLAIN'] ?></p>
<form method="post" action="admin_icons.<?php echo $phpEx . $SID . '&amp;mode=' . $mode . '&amp;action=import'; ?>">
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang[$lang . '_IMPORT'] ?></th>
</tr>
<?php
if ($pak_options == '')
{
?>
<tr>
<td class="row1" colspan="2"><?php echo $user->lang['NO_' . $lang . '_PAK']; ?></td>
</tr>
<?php
}
else
{
?>
<tr>
<td class="row2"><?php echo $user->lang['SELECT_PACKAGE'] ?></td>
<td class="row1"><select name="pak"><?php echo $pak_options ?></select></td>
</tr>
<tr>
<td class="row2"><?php echo $user->lang['CURRENT_' . $lang] ?><br /><span class="gensmall"><?php echo $user->lang['CURRENT_' . $lang . '_EXPLAIN'] ?></span></td>
<td class="row1"><input type="radio" name="current" value="keep" checked="checked" /> <?php echo $user->lang['KEEP_ALL'] ?>&nbsp; &nbsp;<input type="radio" name="current" value="replace" /> <?php echo $user->lang['REPLACE_MATCHES'] ?>&nbsp; &nbsp;<input type="radio" name="current" value="delete" /> <?php echo $user->lang['DELETE_ALL'] ?>&nbsp;</td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input class="btnmain" name="import" type="submit" value="<?php echo $user->lang['IMPORT_' . $lang] ?>" /></td>
</tr>
<?php
}
?>
</table></form>
<?php
adm_page_footer();
}
break;
case 'export':
adm_page_header($user->lang['EXPORT_' . $lang]);
trigger_error(sprintf($user->lang['EXPORT_' . $lang . '_EXPLAIN'], '<a href="admin_icons.' . $phpEx . $SID . '&amp;mode=' . $mode . '&amp;action=send">', '</a>'));
break;
case 'send':
$sql = "SELECT *
FROM $table
ORDER BY {$fields}_order";
$result = $db->sql_query($sql);
$pak = '';
while ($row = $db->sql_fetchrow($result))
{
$pak .= "'" . addslashes($row[$fields . '_url']) . "', ";
$pak .= "'" . addslashes($row[$fields . '_height']) . "', ";
$pak .= "'" . addslashes($row[$fields . '_width']) . "', ";
if ($mode == 'smilies')
{
$pak .= "'" . addslashes($row['emotion']) . "', ";
$pak .= "'" . addslashes($row['code']) . "', ";
}
$pak .= "\n";
}
$db->sql_freeresult($result);
if ($pak != '')
{
$db->sql_close();
header('Content-Type: text/x-delimtext; name="' . $fields . '.pak"');
header('Content-disposition: attachment; filename=' . $fields . '.pak"');
echo $pak;
exit;
}
else
{
trigger_error($user->lang['NO_' . $fields . '_EXPORT']);
}
break;
case 'delete':
$db->sql_query("DELETE FROM $table
WHERE {$fields}_id = $id");
switch ($mode)
{
case 'smilies':
break;
case 'icons':
// Reset appropriate icon_ids
$db->sql_query('UPDATE ' . TOPICS_TABLE . "
SET icon_id = 0
WHERE icon_id = $id");
$db->sql_query('UPDATE ' . POSTS_TABLE . "
SET icon_id = 0
WHERE icon_id = $id");
break;
}
$notice = $user->lang[$lang . '_DELETED'];
case 'move_up':
case 'move_down':
if ($action != 'delete')
{
$image_order = intval($_GET['order']);
$order_total = $image_order * 2 + (($action == 'move_up') ? -1 : 1);
$sql = 'UPDATE ' . $table . '
SET ' . $fields . "_order = $order_total - " . $fields . '_order
WHERE ' . $fields . "_order IN ($image_order, " . (($action == 'move_up') ? $image_order - 1 : $image_order + 1) . ')';
$db->sql_query($sql);
$cache->destroy('icons');
}
// No break; here, display the smilies admin back
default:
// By default, check that image_order is valid and fix it if necessary
$sql = "SELECT {$fields}_id AS order_id, {$fields}_order AS fields_order
FROM $table
ORDER BY {$fields}_order";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$order = 0;
do
{
++$order;
if ($row['fields_order'] != $order)
{
$db->sql_query("UPDATE $table
SET {$fields}_order = $order
WHERE {$fields}_id = " . $row['order_id']);
}
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
// Output the page
adm_page_header($user->lang[$lang]);
?>
<h1><?php echo $user->lang[$lang]; ?></h1>
<p><?php echo $user->lang[$lang .'_EXPLAIN']; ?></p>
<?php
if ($notice != '')
{
?>
<b style="color:green"><?php echo $notice; ?></b>
<?php
}
?>
<form method="post" action="admin_icons.<?php echo $phpEx . $SID . '&amp;mode=' . $mode ?>">
<table cellspacing="1" cellpadding="0" border="0" align="center">
<tr>
<td align="right"> &nbsp;&nbsp; <a href="admin_icons.<?php echo $phpEx . $SID . '&amp;mode=' . $mode . '&amp;action=import'; ?>"><?php echo $user->lang['IMPORT_' . $lang]; ?></a> | <a href="admin_icons.<?php echo $phpEx . $SID . '&amp;mode=' . $mode . '&amp;action=export'; ?>"><?php echo $user->lang['EXPORT_' . $lang]; ?></a></td>
</tr>
<tr>
<td>
<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th><?php echo $user->lang[$lang]; ?></th>
<?php
if ($mode == 'smilies')
{
?>
<th><?php echo $user->lang['CODE']; ?></th>
<th><?php echo $user->lang['EMOTION']; ?></th>
<?php
}
?>
<th><?php echo $user->lang['ACTION']; ?></th>
<th><?php echo $user->lang['REORDER']; ?></th>
</tr>
<?php
$spacer = FALSE;
$sql = "SELECT *
FROM $table
ORDER BY display_on_posting DESC, {$fields}_order ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if (!$spacer && !$row['display_on_posting'])
{
$spacer = TRUE;
?>
<tr>
<td class="row3" colspan="<?php echo ($mode == 'smilies') ? 5 : 3; ?>" align="center"><?php echo $user->lang[$lang . '_NOT_DISPLAYED'] ?></td>
</tr>
<?php
}
$row_class = ($row_class != 'row1') ? 'row1' : 'row2';
$alt_text = ($mode == 'smilies') ? htmlspecialchars($row['code']) : '';
?>
<tr>
<td class="<?php echo $row_class; ?>" align="center"><img src="<?php echo $phpbb_root_path . $img_path . '/' . $row[$fields . '_url']; ?>" width="<?php echo $row[$fields . '_width']; ?>" height="<?php echo $row[$fields . '_height']; ?>" alt="<?php echo $alt_text; ?>" title="<?php echo $alt_text; ?>" /></td>
<?php
if ($mode == 'smilies')
{
?>
<td class="<?php echo $row_class; ?>" align="center"><?php echo htmlspecialchars($row['code']); ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['emotion']; ?></td>
<?php
}
?>
<td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_icons.$phpEx$SID&amp;mode=$mode&amp;action=edit&amp;id=" . $row[$fields . '_id']; ?>"><?php echo $user->lang['EDIT']; ?></a> | <a href="<?php echo "admin_icons.$phpEx$SID&amp;mode=$mode&amp;action=delete&amp;id=" . $row[$fields . '_id']; ?>"><?php echo $user->lang['DELETE']; ?></a></td>
<td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_icons.$phpEx$SID&amp;mode=$mode&amp;action=move_up&amp;order=" . $row[$fields . '_order']; ?>"><?php echo $user->lang['MOVE_UP']; ?></a> <br /> <a href="<?php echo "admin_icons.$phpEx$SID&amp;mode=$mode&amp;action=move_down&amp;order=" . $row[$fields . '_order']; ?>"><?php echo $user->lang['MOVE_DOWN']; ?></a></td>
</tr>
<?php
}
$db->sql_freeresult($result);
?>
<tr>
<td class="cat" colspan="<?php echo ($mode == 'smilies') ? 5 : 3; ?>" align="center"><input type="submit" name="add" value="<?php echo $user->lang['ADD_' . $lang]; ?>" class="btnmain" />&nbsp;<input type="submit" name="edit" value="<?php echo $user->lang['EDIT_' . $lang]; ?>" class="btnmain" /></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?php
adm_page_footer();
break;
}
?>

212
phpBB/adm/admin_jabber.php Normal file
View File

@@ -0,0 +1,212 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* @todo Check/enter/update transport info
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_server'))
{
return;
}
$module['GENERAL']['IM'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_jabber.'.$phpEx);
// Do we have general permissions?
if (!$auth->acl_get('a_server'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Grab some basic parameters
$submit = (isset($_POST['submit'])) ? true : false;
$jab_enable = request_var('jab_enable', $config['jab_enable']);
$jab_host = request_var('jab_host', $config['jab_host']);
$jab_port = request_var('jab_port', $config['jab_port']);
$jab_username = request_var('jab_username', $config['jab_username']);
$jab_password = request_var('jab_password', $config['jab_password']);
$jab_resource = request_var('jab_resource', $config['jab_resource']);
$jabber = new jabber();
$error = array();
// Setup the basis vars for jabber connection
$jabber->server = $jab_host;
$jabber->port = ($jab_port) ? $jab_port : 5222;
$jabber->username = $jab_username;
$jabber->password = $jab_password;
$jabber->resource = $jab_resource;
// Are changing (or initialising) a new host or username? If so run some checks and
// try to create account if it doesn't exist
if ($jab_enable)
{
if ($jab_host != $config['jab_host'] || $jab_username != $config['jab_username'])
{
if (!$jabber->Connect())
{
trigger_error('Could not connect to Jabber server', E_USER_ERROR);
}
// First we'll try to authorise using this account, if that fails we'll
// try to create it.
if (!($result = $jabber->SendAuth()))
{
if (($result = $jabber->AccountRegistration($config['board_email'], $config['sitename'])) <> 2)
{
$error[] = ($result == 1) ? $user->lang['ERR_JAB_USERNAME'] : sprintf($user->lang['ERR_JAB_REGISTER'], $result);
}
else
{
$message = $user->lang['JAB_REGISTERED'];
$log = 'JAB_REGISTER';
}
}
else
{
$message = $user->lang['JAB_CHANGED'];
$log = 'JAB_CHANGED';
}
sleep(1);
$jabber->Disconnect();
}
else if ($jab_password != $config['jab_password'])
{
if (!$jabber->Connect())
{
trigger_error('Could not connect to Jabber server', E_USER_ERROR);
}
if (!$jabber->SendAuth())
{
trigger_error('Could not authorise on Jabber server', E_USER_ERROR);
}
$jabber->SendPresence(NULL, NULL, 'online');
if (($result = $jabber->ChangePassword($jab_password)) <> 2)
{
$error[] = ($result == 1) ? $user->lang['ERR_JAB_PASSCHG'] : sprintf($user->lang['ERR_JAB_PASSFAIL'], $result);
}
else
{
$message = $user->lang['JAB_PASS_CHANGED'];
$log = 'JAB_PASSCHG';
}
sleep(1);
$jabber->Disconnect();
}
}
// Pull relevant config data
$sql = 'SELECT *
FROM ' . CONFIG_TABLE . "
WHERE config_name LIKE 'jab_%'";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$config_name = $row['config_name'];
$config_value = $row['config_value'];
$default_config[$config_name] = $config_value;
$new[$config_name] = (isset($_POST[$config_name])) ? request_var($config_name, '') : $default_config[$config_name];
if ($submit && !sizeof($error))
{
set_config($config_name, $new[$config_name]);
}
}
if ($submit && !sizeof($error))
{
add_log('admin', 'LOG_' . $log);
trigger_error($message);
}
// Output the page
adm_page_header($user->lang['IM']);
$jab_enable_yes = ($new['jab_enable']) ? 'checked="checked"' : '';
$jab_enable_no = (!$new['jab_enable']) ? 'checked="checked"' : '';
?>
<h1><?php echo $user->lang['IM']; ?></h1>
<p><?php echo $user->lang['IM_EXPLAIN']; ?></p>
<form method="post" action="<?php echo "admin_jabber.$phpEx$SID"; ?>"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['IM']; ?></th>
</tr>
<?php
if (sizeof($error))
{
?>
<tr>
<td class="row3" colspan="2" align="center"><span style="color:red"><?php echo implode('<br />', $error); ?></td>
</tr>
<?php
}
?>
<tr>
<td class="row1" width="40%"><b><?php echo $user->lang['JAB_ENABLE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_ENABLE_EXPLAIN']; ?></span></td>
<td class="row2"><input type="radio" name="jab_enable" value="1"<?php echo $jab_enable_yes; ?> /><?php echo $user->lang['ENABLED']; ?>&nbsp; &nbsp;<input type="radio" name="jab_enable" value="0"<?php echo $jab_enable_no; ?> /><?php echo $user->lang['DISABLED']; ?></td>
</tr>
<tr>
<td class="row1" width="40%"><b><?php echo $user->lang['JAB_SERVER']; ?>: </b><br /><span class="gensmall"><?php echo sprintf($user->lang['JAB_SERVER_EXPLAIN'], '<a href="http://www.jabber.org/user/publicservers.php" target="_blank">', '</a>'); ?></span></td>
<td class="row2"><input class="post" type="text" name="jab_host" value="<?php echo $new['jab_host']; ?>" /></td>
</tr>
<tr>
<td class="row1" width="40%"><b><?php echo $user->lang['JAB_PORT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_PORT_EXPLAIN']; ?></span></td>
<td class="row2"><input class="post" type="text" name="jab_port" value="<?php echo $new['jab_port']; ?>" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['JAB_USERNAME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_USERNAME_EXPLAIN']; ?></span></td>
<td class="row2"><input class="post" type="text" name="jab_username" value="<?php echo $new['jab_username']; ?>" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['JAB_PASSWORD']; ?>: </b></td>
<td class="row2"><input class="post" type="text" name="jab_password" value="<?php echo $new['jab_password']; ?>" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['JAB_RESOURCE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_RESOURCE_EXPLAIN']; ?></span></td>
<td class="row2"><input class="post" type="text" name="jab_resource" value="<?php echo $new['jab_resource']; ?>" /></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td>
</tr>
</table></form>
<?php
adm_page_footer();
?>

1039
phpBB/adm/admin_language.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,85 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
$module['GENERAL']['PHP_INFO'] = ($auth->acl_get('a_server')) ? basename(__FILE__) . $SID : '';
return;
}
define('IN_PHPBB', 1);
// Load default header
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Check permissions
if (!$auth->acl_get('a_server'))
{
trigger_error($user->lang['NO_ADMIN']);
}
ob_start();
phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES);
$phpinfo = ob_get_contents();
ob_end_clean();
// Get used layout
$layout = (preg_match('#bgcolor#i', $phpinfo)) ? 'old' : 'new';
// Here we play around a little with the PHP Info HTML to try and stylise
// it along phpBB's lines ... hopefully without breaking anything. The idea
// for this was nabbed from the PHP annotated manual
preg_match_all('#<body[^>]*>(.*)</body>#siU', $phpinfo, $output);
switch ($layout)
{
case 'old':
$output = preg_replace('#<table#', '<table class="bg"', $output[1][0]);
$output = preg_replace('# bgcolor="\#(\w){6}"#', '', $output);
$output = preg_replace('#(\w),(\w)#', '\1, \2', $output);
$output = preg_replace('#border="0" cellpadding="3" cellspacing="1" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output);
$output = preg_replace('#<tr valign="top"><td align="left">(.*?<a .*?</a>)(.*?)</td></tr>#s', '<tr class="row1"><td style="{background-color: #9999cc;}"><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td style="{background-color: #9999cc;}">\2</td><td style="{background-color: #9999cc;}">\1</td></tr></table></td></tr>', $output);
$output = preg_replace('#<tr valign="baseline"><td[ ]{0,1}><b>(.*?)</b>#', '<tr><td class="row1" nowrap="nowrap">\1', $output);
$output = preg_replace('#<td align="(center|left)">#', '<td class="row2">', $output);
$output = preg_replace('#<td>#', '<td class="row2">', $output);
$output = preg_replace('#valign="middle"#', '', $output);
$output = preg_replace('#<tr >#', '<tr>', $output);
$output = preg_replace('#<hr(.*?)>#', '', $output);
$output = preg_replace('#<h1 align="center">#i', '<h1>', $output);
$output = preg_replace('#<h2 align="center">#i', '<h2>', $output);
break;
case 'new':
$output = preg_replace('#<table#', '<table class="bg" align="center"', $output[1][0]);
$output = preg_replace('#(\w),(\w)#', '\1, \2', $output);
$output = preg_replace('#border="0" cellpadding="3" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output);
$output = preg_replace('#<tr class="v"><td>(.*?<a .*?</a>)(.*?)</td></tr>#s', '<tr class="row1"><td><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td>\2</td><td>\1</td></tr></table></td></tr>', $output);
$output = preg_replace('#<td>#', '<td style="{background-color: #9999cc;}">', $output);
$output = preg_replace('#class="e"#', 'class="row1" nowrap="nowrap"', $output);
$output = preg_replace('#class="v"#', 'class="row2"', $output);
$output = preg_replace('# class="h"#', '', $output);
$output = preg_replace('#<hr />#', '', $output);
preg_match_all('#<div class="center">(.*)</div>#siU', $output, $output);
$output = $output[1][0];
break;
}
adm_page_header($user->lang['PHP_INFO']);
echo '<h1>' . $user->lang['PHP_INFO'] . '</h1>';
echo '<p>' . $user->lang['PHP_INFO_EXPLAIN'] . '</p>';
echo $output;
adm_page_footer();
?>

1335
phpBB/adm/admin_profile.php Normal file

File diff suppressed because it is too large Load Diff

254
phpBB/adm/admin_prune.php Normal file
View File

@@ -0,0 +1,254 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_prune'))
{
return;
}
$module['FORUM']['PRUNE'] = basename(__FILE__) . $SID . '&amp;mode=forums';
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Do we have permission?
if (!$auth->acl_get('a_prune'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Get the forum ID for pruning
$forum_id = (isset($_REQUEST['f'])) ? array_map('intval', $_REQUEST['f']) : array();
// Check for submit to be equal to Prune. If so then proceed with the pruning.
if (isset($_POST['submit']))
{
$prune_posted = (isset($_POST['prune_days'])) ? intval($_POST['prune_days']) : 0;
$prune_viewed = (isset($_POST['prune_vieweddays'])) ? intval($_POST['prune_vieweddays']) : 0;
$prune_all = !$prune_posted && !$prune_viewed;
$prune_flags = 0;
$prune_flags += (!empty($_POST['prune_old_polls'])) ? 2 : 0;
$prune_flags += (!empty($_POST['prune_announce'])) ? 4 : 0;
$prune_flags += (!empty($_POST['prune_sticky'])) ? 8 : 0;
// Convert days to seconds for timestamp functions...
$prunedate_posted = time() - ($prune_posted * 86400);
$prunedate_viewed = time() - ($prune_viewed * 86400);
adm_page_header($user->lang['PRUNE']);
?>
<h1><?php echo $user->lang['PRUNE']; ?></h1>
<p><?php echo $user->lang['PRUNE_SUCCESS']; ?></p>
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th><?php echo $user->lang['FORUM']; ?></th>
<th><?php echo $user->lang['TOPICS_PRUNED']; ?></th>
<th><?php echo $user->lang['POSTS_PRUNED']; ?></th>
</tr>
<?php
$sql_forum = (sizeof($forum_id)) ? ' AND forum_id IN (' . implode(', ', $forum_id) . ')' : '';
// Get a list of forum's or the data for the forum that we are pruning.
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST . "
$sql_forum
ORDER BY left_id ASC";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$prune_ids = array();
$p_result['topics'] = 0;
$p_result['posts'] = 0;
$log_data = '';
do
{
if ($auth->acl_get('f_list', $row['forum_id']))
{
if ($prune_all)
{
$p_result = prune($row['forum_id'], 'posted', time(), $prune_flags, false);
}
else
{
if ($prune_posted)
{
$return = prune($row['forum_id'], 'posted', $prunedate_posted, $prune_flags, false);
$p_result['topics'] += $return['topics'];
$p_result['posts'] += $return['posts'];
}
if ($prune_viewed)
{
$return = prune($row['forum_id'], 'viewed', $prunedate_viewed, $prune_flags, false);
$p_result['topics'] += $return['topics'];
$p_result['posts'] += $return['posts'];
}
}
$prune_ids[] = $row['forum_id'];
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['forum_name']; ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $p_result['topics']; ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $p_result['posts']; ?></td>
</tr>
<?php
$log_data .= (($log_data != '') ? ', ' : '') . $row['forum_name'];
}
}
while ($row = $db->sql_fetchrow($result));
// Sync all pruned forums at once
sync('forum', 'forum_id', $prune_ids, TRUE);
add_log('admin', 'LOG_PRUNE', $log_data);
}
else
{
?>
<tr>
<td class="row1" align="center"><?php echo $user->lang['NO_PRUNE']; ?></td>
</tr>
<?php
}
$db->sql_freeresult($result);
?>
</table>
<br clear="all" />
<?php
adm_page_footer();
}
adm_page_header($user->lang['PRUNE']);
?>
<h1><?php echo $user->lang['PRUNE']; ?></h1>
<p><?php echo $user->lang['FORUM_PRUNE_EXPLAIN']; ?></p>
<?php
// If they haven't selected a forum for pruning yet then
// display a select box to use for pruning.
if (!$forum_id)
{
?>
<form method="post" action="<?php echo "admin_prune.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th align="center"><?php echo $user->lang['SELECT_FORUM']; ?></th>
</tr>
<tr>
<td class="row1" align="center"><select name="f[]" multiple="true" size="5"><?php echo make_forum_select(false, false, false); ?></select></td>
</tr>
<tr>
<td class="cat" align="center"><input class="btnmain" type="submit" value="<?php echo $user->lang['LOOK_UP_FORUM']; ?>" />&nbsp; <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td>
</tr>
</table></form>
<?php
}
else
{
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE . '
WHERE forum_id IN (' . implode(', ', $forum_id) . ')';
$result = $db->sql_query($sql);
if (!($row = $db->sql_fetchrow($result)))
{
trigger_error($user->lang['NO_FORUM']);
}
$forum_list = $s_hidden_fields = '';
do
{
$forum_list .= (($forum_list != '') ? ', ' : '') . '<b>' . $row['forum_name'] . '</b>';
$s_hidden_fields .= '<input type="hidden" name="f[]" value="' . $row['forum_id'] . '" />';
}
while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
$l_selected_forums = (sizeof($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS';
?>
<h2><?php echo $user->lang['FORUM']; ?></h2>
<p><?php echo $user->lang[$l_selected_forums] . ': ' . $forum_list; ?></p>
<form method="post" action="<?php echo "admin_prune.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['FORUM_PRUNE']; ?></th>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['PRUNE_NOT_POSTED']; ?></td>
<td class="row2"><input type="text" name="prune_days" size="4" /></td>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['PRUNE_NOT_VIEWED']; ?></td>
<td class="row2"><input type="text" name="prune_vieweddays" size="4" /></td>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['PRUNE_OLD_POLLS'] ?>: <br /><span class="gensmall"><?php echo $user->lang['PRUNE_OLD_POLLS_EXPLAIN']; ?></span></td>
<td class="row2"><input type="radio" name="prune_old_polls" value="1" /> <?php echo $user->lang['YES']; ?> &nbsp; <input type="radio" name="prune_old_polls" value="0" checked="checked" /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['PRUNE_ANNOUNCEMENTS'] ?>: </td>
<td class="row2"><input type="radio" name="prune_announce" value="1" /> <?php echo $user->lang['YES']; ?> &nbsp; <input type="radio" name="prune_announce" value="0" checked="checked" /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['PRUNE_STICKY'] ?>: </td>
<td class="row2"><input type="radio" name="prune_sticky" value="1" /> <?php echo $user->lang['YES']; ?> &nbsp; <input type="radio" name="prune_sticky" value="0" checked="checked" /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><?php echo $s_hidden_fields; ?><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain"></td>
</tr>
</table></form>
<?php
}
adm_page_footer();
?>

View File

@@ -0,0 +1,254 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_userdel'))
{
return;
}
$module['USER']['PRUNE_USERS'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Do we have forum admin permissions?
if (!$auth->acl_get('a_userdel'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Set mode
$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
// Do prune
if (isset($_POST['prune']))
{
if (empty($_POST['confirm']))
{
$values = array('prune', 'deactivate', 'delete', 'users', 'username', 'email', 'joined_select', 'active_select', 'count_select', 'joined', 'active', 'count', 'deleteposts');
$l_message = '<form method="post" action="admin_prune_users.' . $phpEx . $SID . '">' . $user->lang['Confirm_prune_users'] . '<br /><br /><input class="btnlite" type="submit" name="confirm" value="' . $user->lang['Yes'] . '" />&nbsp;&nbsp;<input class="btnlite" type="submit" name="cancel" value="' . $user->lang['No'] . '" />';
foreach ($values as $field)
{
$l_message .= (!empty($_POST[$field])) ? '<input type="hidden" name="' . $field . '" value="' . urlencode($_POST[$field]) . '" />' : '';
}
$l_message .= '</form>';
adm_page_header($user->lang['Prune_users']);
?>
<h1><?php echo $user->lang['PRUNE_USERS']; ?></h1>
<p><?php echo $user->lang['PRUNE_USERS_EXPLAIN']; ?></p>
<?php
page_message($user->lang['CONFIRM'], $l_message, false);
adm_page_footer();
}
else if (isset($_POST['confirm']))
{
if (!empty($_POST['users']))
{
$users = explode("\n", urldecode($_POST['users']));
$where_sql = '';
foreach ($users as $username)
{
$where_sql .= (($where_sql != '') ? ', ' : '') . '\'' . trim($username) . '\'';
}
$where_sql = " AND username IN ($where_sql)";
}
else
{
$username = (!empty($_POST['username'])) ? urldecode($_POST['username']) : '';
$email = (!empty($_POST['email'])) ? urldecode($_POST['email']) : '';
$joined_select = (!empty($_POST['joined_select'])) ? $_POST['joined_select'] : 'lt';
$active_select = (!empty($_POST['active_select'])) ? $_POST['active_select'] :'lt';
$count_select = (!empty($_POST['count_select'])) ? $_POST['count_select'] : 'eq';
$joined = (!empty($_POST['joined'])) ? explode('-', $_POST['joined']) : array();
$active = (!empty($_POST['active'])) ? explode('-', $_POST['active']) :array();
$count = (!empty($_POST['count'])) ? intval($_POST['count']) : '';
$key_match = array('lt' => '<', 'gt' => '>', 'eq' => '=');
$sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_lastvisit');
$where_sql = '';
$where_sql .= ($username) ? " AND username LIKE '" . str_replace('*', '%', $username) ."'" : '';
$where_sql .= ($email) ? " AND user_email LIKE '" . str_replace('*', '%', $email) ."' " : '';
$where_sql .= ($joined) ? " AND user_regdate " . $key_match[$joined_select] . " " . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : '';
$where_sql .= ($count) ? " AND user_posts " . $key_match[$count_select] . " $count " : '';
$where_sql .= ($active) ? " AND user_lastvisit " . $key_match[$active_select] . " " . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : '';
}
$sql = 'SELECT username, user_id FROM ' . USERS_TABLE . '
WHERE user_id <> ' . ANONYMOUS . "
$where_sql";
$result = $db->sql_query($sql);
$where_sql = '';
$user_ids = array();
$usernames = array();
if ($row = $db->sql_fetchrow($result))
{
do
{
$where_sql .= (($where_sql != '') ? ', ' : '') . $row['user_id'];
$user_ids[] = $row['user_id'];
$usernames[] = $row['username'];
}
while ($row = $db->sql_fetchrow($result));
$where_sql = " AND user_id IN ($where_sql)";
}
$db->sql_freeresult($result);
if ($where_sql != '')
{
$sql = '';
if (!empty($_POST['delete']))
{
if (!empty($_POST['deleteposts']))
{
// Call unified post deletion routine?
$l_log = 'LOG_PRUNE_USER_DEL_DEL';
}
else
{
for($i = 0; $i < sizeof($user_ids); $i++)
{
$sql = 'UPDATE ' . POSTS_TABLE . '
SET poster_id = ' . ANONYMOUS . ", post_username = '" . $usernames[$i] . "'
WHERE user_id = " . $userids[$i];
// $db->sql_query($sql);
}
$l_log = 'LOG_PRUNE_USER_DEL_ANON';
}
$sql = 'DELETE FROM ' . USERS_TABLE;
}
else if (!empty($_POST['deactivate']))
{
$sql = 'UPDATE ' . USERS_TABLE . "
SET user_active = 0";
$l_log = 'LOG_PRUNE_USER_DEAC';
}
$sql .= ' WHERE user_id <> ' . ANONYMOUS . "
$where_sql";
// $db->sql_query($sql);
add_log('admin', $l_log, implode(', ', $usernames));
unset($user_ids);
unset($usernames);
}
trigger_error($user->lang['SUCCESS_USER_PRUNE']);
}
}
// Front end
$find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']);
$s_find_count = '';
foreach ($find_count as $key => $value)
{
$selected = ($key == 'eq') ? ' selected="selected"' : '';
$s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
$find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']);
$s_find_join_time = '';
foreach ($find_time as $key => $value)
{
$s_find_join_time .= '<option value="' . $key . '">' . $value . '</option>';
}
$s_find_active_time = '';
foreach ($find_time as $key => $value)
{
$s_find_active_time .= '<option value="' . $key . '">' . $value . '</option>';
}
//
//
//
adm_page_header($user->lang['PRUNE_USERS']);
?>
<h1><?php echo $user->lang['PRUNE_USERS']; ?></h1>
<p><?php echo $user->lang['PRUNE_USERS_EXPLAIN']; ?></p>
<form method="post" name="post" action="<?php echo "admin_prune_users.$phpEx$SID"; ?>"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['PRUNE_USERS']; ?></th>
</tr>
<tr>
<td class="row1" width="40%"><b><?php echo $user->lang['USERNAME']; ?>: </b></td>
<td class="row2"><input class="post" type="text" name="username" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['EMAIL']; ?>: </b></td>
<td class="row2"><input class="post" type="text" name="email" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['JOINED']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['Joined_explain']; ?></span></td>
<td class="row2"><select name="joined_select"><?php echo $s_find_join_time; ?></select> <input class="post" type="text" name="joined" maxlength="10" size="10" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['LAST_ACTIVE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['Last_active_explain']; ?></span></td>
<td class="row2"><select name="active_select"><?php echo $s_find_active_time; ?></select> <input class="post" type="text" name="active" maxlength="10" size="10" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['POSTS']; ?>: </b></td>
<td class="row2"><select name="count_select"><?php echo $s_find_count; ?></select> <input class="post" type="text" name="count" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['PRUNE_USERS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SELECT_USERS_EXPLAIN']; ?></span></td>
<td class="row2"><textarea name="users" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['DELETE_USER_POSTS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['DELETE_USER_POSTS_EXPLAIN']; ?></span></td>
<td class="row2"><input type="radio" name="deleteposts" value="1" /> <?php echo $user->lang['YES']; ?>&nbsp;&nbsp;<input type="radio" name="deleteposts" value="0" checked="checked" /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['DEACTIVATE_DELETE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['DEACTIVATE_DELETE_EXPLAIN']; ?></span></td>
<td class="row2"><input type="radio" name="action" value="delete" /> <?php echo $user->lang['DELETE_USERS']; ?>&nbsp;&nbsp;<input type="radio" name="action" value="deactivate" checked="checked" /> <?php echo $user->lang['DEACTIVATE']; ?></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input class="btnlite" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" />&nbsp;&nbsp;<input type="submit" name="usersubmit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" class="btnlite" onClick="window.open('<?php echo "../search.$phpEx$SID&amp;mode=searchuser&amp;field=users"; ?>', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650');return false;" /><input type="hidden" name="prune" value="1" /></td>
</tr>
</table></form>
<?php
adm_page_footer();
?>

324
phpBB/adm/admin_ranks.php Normal file
View File

@@ -0,0 +1,324 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_ranks'))
{
return;
}
$module['USER']['RANKS'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
// Let's set the root dir for phpBB
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Do we have permission?
if (!$auth->acl_get('a_ranks'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Check mode
if (isset($_REQUEST['mode']))
{
$mode = $_REQUEST['mode'];
}
else
{
// These could be entered via a form button
if (isset($_POST['add']))
{
$mode = 'add';
}
else if (isset($_POST['save']))
{
$mode = 'save';
}
else
{
$mode = '';
}
}
$rank_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0;
//
switch ($mode)
{
case 'edit':
case 'add':
$data = $ranks = $existing_imgs = array();
$result = $db->sql_query('SELECT *
FROM ' . RANKS_TABLE . '
ORDER BY rank_special DESC, rank_min DESC');
if ($row = $db->sql_fetchrow($result))
{
do
{
$existing_imgs[] = $row['rank_image'];
if ($mode == 'edit' && $rank_id == $row['rank_id'])
{
$ranks = $row;
}
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
$imglist = filelist($phpbb_root_path . $config['ranks_path'], '');
$edit_img = $filename_list = '';
foreach ($imglist as $path => $img_ary)
{
foreach ($img_ary as $img)
{
$img = substr($path, 1) . (($path != '') ? '/' : '') . $img;
if (!in_array($img, $existing_imgs) || $mode == 'edit')
{
if ($ranks && $img == $ranks['rank_image'])
{
$selected = ' selected="selected"';
$edit_img = $img;
}
else
{
$selected = '';
}
$filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>';
}
}
}
$filename_list = '<option value=""' . (($edit_img == '') ? ' selected="selected"' : '') . '>----------</option>' . $filename_list;
unset($existing_imgs);
unset($imglist);
// They want to add a new rank, show the form.
$s_hidden_fields = '<input type="hidden" name="mode" value="save" />';
adm_page_header($user->lang['RANKS']);
?>
<script language="javascript" type="text/javascript" defer="defer">
<!--
function update_image(newimage)
{
document.image.src = (newimage) ? "<?php echo $phpbb_root_path . $config['ranks_path']; ?>/" + newimage : "../images/spacer.gif";
}
function update_image_dimensions()
{
if (document.image.height && document.forms[0].height)
{
document.forms[0].height.value = document.image.height;
document.forms[0].width.value = document.image.width;
}
}
//-->
</script>
<h1><?php echo $user->lang['RANKS']; ?></h1>
<p><?php echo $user->lang['RANKS_EXPLAIN']; ?></p>
<form method="post" action="<?php echo "admin_ranks.$phpEx$SID&amp;id=$rank_id"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['RANKS']; ?></th>
</tr>
<tr>
<td class="row1" width="40%"><?php echo $user->lang['RANK_TITLE']; ?>: </td>
<td class="row2"><input class="post" type="text" name="title" size="25" maxlength="40" value="<?php echo $ranks['rank_title']; ?>" /></td>
</tr>
<tr>
<td class="row1" width="40%"><?php echo $user->lang['RANK_IMAGE']; ?>:</td>
<td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td valign="middle"><select name="rank_image" onchange="update_image(this.options[selectedIndex].value);"><?php echo $filename_list ?></select></td>
<td>&nbsp;&nbsp;</td>
<td valign="middle"><img src="<?php echo ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : '../images/spacer.gif' ?>" name="image" border="0" alt="" title="" onload="update_image_dimensions()" /></td>
</tr>
</table></td>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['RANK_SPECIAL']; ?>: </td>
<td class="row2"><input type="radio" name="special_rank" value="1"<?php echo ($ranks['rank_special']) ? ' checked="checked"' : ''; ?> /><?php echo $user->lang['YES']; ?> &nbsp;&nbsp;<input type="radio" name="special_rank" value="0"<?php echo (!$ranks['rank_special']) ? ' checked="checked"' : ''; ?> /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['RANK_MINIMUM']; ?>: </td>
<td class="row2"><input class="post" type="text" name="min_posts" size="5" maxlength="10" value="<?php echo ($ranks['rank_special']) ? '' : $ranks['rank_min']; ?>" /></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><?php echo $s_hidden_fields; ?><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" />&nbsp;&nbsp;<input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td>
</tr>
</table></form>
<?php
adm_page_footer();
break;
case 'save':
//
// Ok, they sent us our info, let's update it.
//
$rank_id = (isset($_REQUEST['id'])) ? intval($_REQUEST['id']) : 0;
$rank_title = (isset($_POST['title'])) ? trim($_POST['title']) : '';
$special_rank = (!empty($_POST['special_rank'])) ? 1 : 0;
$min_posts = (isset($_POST['min_posts'])) ? intval($_POST['min_posts']) : -1;
$rank_image = (isset($_POST['rank_image'])) ? trim(htmlspecialchars($_POST['rank_image'])) : '';
if ($special_rank == 1)
{
$min_posts = -1;
}
// The rank image has to be a jpg, gif or png
if ($rank_image != '' && !preg_match('#(\.gif|\.png|\.jpg|\.jpeg)$#i', $rank_image))
{
$rank_image = '';
}
if ($rank_id)
{
$sql = "UPDATE " . RANKS_TABLE . "
SET rank_title = '" . $db->sql_escape($rank_title) . "', rank_special = $special_rank, rank_min = $min_posts, rank_image = '" . $db->sql_escape($rank_image) . "'
WHERE rank_id = $rank_id";
$message = $user->lang['RANK_UPDATED'];
}
else
{
$sql = "INSERT INTO " . RANKS_TABLE . " (rank_title, rank_special, rank_min, rank_image)
VALUES ('" . $db->sql_escape($rank_title) . "', $special_rank, $min_posts, '" . $db->sql_escape($rank_image) . "')";
$message = $user->lang['RANK_ADDED'];
}
$db->sql_query($sql);
$cache->destroy('ranks');
trigger_error($message);
break;
case 'delete':
// Ok, they want to delete their rank
$rank_id = (isset($_REQUEST['id'])) ? intval($_REQUEST['id']) : 0;
if ($rank_id)
{
$sql = "DELETE FROM " . RANKS_TABLE . "
WHERE rank_id = $rank_id";
$db->sql_query($sql);
$sql = "UPDATE " . USERS_TABLE . "
SET user_rank = 0
WHERE user_rank = $rank_id";
$db->sql_query($sql);
$cache->destroy('ranks');
trigger_error($user->lang['RANK_REMOVED']);
}
else
{
trigger_error($user->lang['MUST_SELECT_RANK']);
}
break;
default:
adm_page_header($user->lang['RANKS']);
?>
<h1><?php echo $user->lang['RANKS']; ?></h1>
<p><?php echo $user->lang['RANKS_EXPLAIN']; ?></p>
<form method="post" action="<?php echo "admin_ranks.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th><?php echo $user->lang['RANK_IMAGE']; ?></th>
<th><?php echo $user->lang['RANK_TITLE']; ?></th>
<th><?php echo $user->lang['RANK_MINIMUM']; ?></th>
<th><?php echo $user->lang['ACTION']; ?></th>
</tr>
<?php
// Show the default page
$sql = "SELECT * FROM " . RANKS_TABLE . "
ORDER BY rank_min ASC, rank_special ASC";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
do
{
$row_class = ($row_class != 'row1') ? 'row1' : 'row2';
?>
<tr>
<td class="<?php echo $row_class; ?>" align="center"><?php
if ($row['rank_image'])
{
?><img src="<?php echo $phpbb_root_path . $config['ranks_path'] . '/' . $row['rank_image']; ?>"" border="0" alt="<?php echo $row['rank_title']; ?>" title="<?php echo $row['rank_title']; ?>" /><?php
}
else
{
echo '-';
}
?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['rank_title']; ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo ($row['rank_special']) ? '-' : $row['rank_min']; ?></td>
<td class="<?php echo $row_class; ?>" align="center">&nbsp;<a href="<?php echo "admin_ranks.$phpEx$SID&amp;mode=edit&amp;id=" . $row['rank_id']; ?>"><?php echo $user->lang['EDIT']; ?></a> | <a href="<?php echo "admin_ranks.$phpEx$SID&amp;mode=delete&amp;id=" . $row['rank_id']; ?>"><?php echo $user->lang['DELETE']; ?></a>&nbsp;</td>
</tr>
<?php
}
while ($row = $db->sql_fetchrow($result));
}
?>
<tr>
<td class="cat" colspan="5" align="center"><input type="submit" class="btnmain" name="add" value="<?php echo $user->lang['ADD_RANK']; ?>" /></td>
</tr>
</table></form>
<?php
adm_page_footer();
break;
}
?>

175
phpBB/adm/admin_search.php Normal file
View File

@@ -0,0 +1,175 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_search'))
{
return;
}
$module['DB']['SEARCH_INDEX'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/message_parser.'.$phpEx);
// Check permissions
if (!$auth->acl_get('a_search'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Start indexing
if (isset($_POST['start']) || isset($_GET['batchstart']))
{
$batchsize = 5000; // Process this many posts per batch
$batchcount = request_var('batchcount', 1);
$batchstart = request_var('batchstart', 0);
$loopcount = 0;
$fulltext = new fulltext_search();
// Search re-indexing is tough on the server ... so we'll check the load
// each loop and if we're on a 1min load of 3 or more we'll re-load the page
// and try again. No idea how well this will work in practice so we'll see ...
if (file_exists('/proc/loadavg'))
{
if ($load = @file('/proc/loadavg'))
{
list($load) = explode(' ', $load[0]);
if ($load > 3)
{
redirect("adm/admin_search.$phpEx$SID&batchstart=$batchstart&batchcount=$batchcount", 3);
}
}
}
if (!$batchstart)
{
// Take board offline
set_config('board_disable', 1);
// Empty existing tables
$db->sql_query("TRUNCATE " . SEARCH_TABLE);
$db->sql_query("TRUNCATE " . SEARCH_WORD_TABLE);
$db->sql_query("TRUNCATE " . SEARCH_MATCH_TABLE);
}
// Fetch a batch of posts_text entries
$sql = "SELECT COUNT(*) AS total, MAX(post_id) AS max_post_id, MIN(post_id) AS min_post_id
FROM " . POSTS_TABLE;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$totalposts = $row['total'];
$max_post_id = $row['max_post_id'];
$batchstart = (!$batchstart) ? $row['min_post_id'] : $batchstart;
$batchend = $batchstart + $batchsize;
$db->sql_freeresult($result);
$sql = "SELECT *
FROM " . POSTS_TABLE . "
WHERE post_id
BETWEEN $batchstart
AND $batchend";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
do
{
$fulltext->add('admin', $row['post_id'], $row['post_text'], $row['post_subject']);
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
$batchcount++;
if (($batchstart + $batchsize) < $max_post_id)
{
redirect("adm/admin_search.$phpEx$SID&batchstart=" . ($batchstart + $batchsize) . "&batchcount=$batchcount", 3);
}
else
{
set_config('board_disable', 0);
// search tidy
$fulltext->search_tidy();
adm_page_header($user->lang['SEARCH_INDEX']);
?>
<h1><?php echo $user->lang['SEARCH_INDEX']; ?></h1>
<p><?php echo $user->lang['SEARCH_INDEX_COMPLETE']; ?></p>
<?php
adm_page_footer();
}
exit;
}
else if (isset($_POST['cancel']))
{
set_config('board_disable', 0);
adm_page_header($user->lang['SEARCH_INDEX']);
?>
<h1><?php echo $user->lang['SEARCH_INDEX']; ?></h1>
<p><?php echo $user->lang['SEARCH_INDEX_CANCEL']; ?></p>
<?php
adm_page_footer();
}
else
{
adm_page_header($user->lang['SEARCH_INDEX']);
?>
<h1><?php echo $user->lang['SEARCH_INDEX']; ?></h1>
<p><?php echo $user->lang['SEARCH_INDEX_EXPLAIN']; ?></p>
<form method="post" action="<?php echo "admin_search.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1">
<tr>
<td class="cat" height="28" align="center">&nbsp;<input type="submit" name="start" value="<?php echo $user->lang['START']; ?>" class="btnmain" /> &nbsp; <input type="submit" name="cancel" value="<?php echo $user->lang['CANCEL']; ?>" class="btnmain" />&nbsp;</td>
</tr>
</table></form>
<?php
adm_page_footer();
}
?>

3377
phpBB/adm/admin_styles.php Normal file

File diff suppressed because it is too large Load Diff

2032
phpBB/adm/admin_users.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,253 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_'))
{
return;
}
$filename = basename(__FILE__);
$module['LOG']['ADMIN_LOGS'] = $filename . "$SID&amp;mode=admin";
$module['LOG']['MOD_LOGS'] = $filename . "$SID&amp;mode=mod";
$module['LOG']['CRITICAL_LOGS'] = $filename . "$SID&amp;mode=critical";
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Do we have styles admin permissions?
if (!$auth->acl_get('a_'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Set some variables
$mode = request_var('mode', 'admin');
$forum_id = request_var('f', 0);
$start = request_var('start', 0);
$deletemark = (isset($_POST['delmarked'])) ? true : false;
$deleteall = (isset($_POST['delall'])) ? true : false;
$marked = request_var('mark', array(0));
// Sort keys
$sort_days = request_var('st', 0);
$sort_key = request_var('sk', 't');
$sort_dir = request_var('sd', 'd');
// Define some vars depending on which logs we're looking at
$log_type = ($mode == 'admin') ? LOG_ADMIN : (($mode == 'mod') ? LOG_MOD : LOG_CRITICAL);
$user->add_lang('mcp');
// Delete entries if requested and able
if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
{
$where_sql = '';
if ($deletemark && $marked)
{
$sql_in = array();
foreach ($marked as $mark)
{
$sql_in[] = $mark;
}
$where_sql = ' AND log_id IN (' . implode(', ', $sql_in) . ')';
unset($sql_in);
}
$sql = 'DELETE FROM ' . LOG_TABLE . "
WHERE log_type = $log_type
$where_sql";
$db->sql_query($sql);
add_log('admin', 'LOG_' . strtoupper($mode) . '_CLEAR');
}
// Sorting
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
$sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
$sort_by_sql = array('u' => 'l.user_id', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
// Define where and sort sql for use in displaying logs
$sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
$sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
$l_title = $user->lang[strtoupper($mode) . '_LOGS'];
$l_title_explain = $user->lang[strtoupper($mode) . '_LOGS_EXPLAIN'];
// Output page
adm_page_header($l_title);
?>
<h1><?php echo $l_title; ?></h1>
<p><?php echo $l_title_explain; ?></p>
<form name="list" method="post" action="<?php echo "admin_viewlogs.$phpEx$SID&amp;mode=$mode"; ?>">
<?php
// Define forum list if we're looking @ mod logs
if ($mode == 'mod')
{
$forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id);
?>
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td align="right"><?php echo $user->lang['SELECT_FORUM']; ?>: <select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.submit() }"><?php echo $forum_box; ?></select> <input class="btnlite" type="submit" value="<?php echo $user->lang['GO']; ?>" /></td>
</tr>
</table>
<?php
}
//
// Grab log data
//
$log_data = array();
$log_count = 0;
view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort);
?>
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left" valign="top">&nbsp;<span class="nav"><?php echo on_page($log_count, $config['topics_per_page'], $start); ?></span></td>
<td align="right" valign="top" nowrap="nowrap">
<span class="nav"><?php echo generate_pagination("admin_viewlogs.$phpEx$SID&amp;mode=$mode&amp;$u_sort_param", $log_count, $config['topics_per_page'], $start, true); ?></span>
</td>
</tr>
</table>
<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
<tr>
<td class="cat" colspan="5" height="28" align="center"><?php echo $user->lang['DISPLAY_LOG']; ?>: &nbsp;<?php echo $s_limit_days; ?>&nbsp;<?php echo $user->lang['SORT_BY']; ?>: <?php echo $s_sort_key; ?> <?php echo $s_sort_dir; ?>&nbsp;<input class="btnlite" type="submit" value="<?php echo $user->lang['GO']; ?>" name="sort" /></td>
</tr>
<tr>
<th width="15%" height="25" nowrap="nowrap"><?php echo $user->lang['USERNAME']; ?></th>
<th width="15%" nowrap="nowrap"><?php echo $user->lang['IP']; ?></th>
<th width="20%" nowrap="nowrap"><?php echo $user->lang['TIME']; ?></th>
<th width="45%" nowrap="nowrap"><?php echo $user->lang['ACTION']; ?></th>
<th nowrap="nowrap"><?php echo $user->lang['MARK']; ?></th>
</tr>
<?php
$row_class = '';
if ($log_count)
{
for ($i = 0; $i < sizeof($log_data); $i++)
{
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $log_data[$i]['username']; ?></td>
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $log_data[$i]['ip']; ?></td>
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $user->format_date($log_data[$i]['time']); ?></td>
<td class="<?php echo $row_class; ?>"><?php
echo $log_data[$i]['action'];
$data = array();
foreach (array('viewtopic', 'viewlogs', 'viewforum') as $check)
{
if (isset($log_data[$i][$check]) && $log_data[$i][$check])
{
$data[] = '<a href="' . $log_data[$i][$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>';
}
}
if (sizeof($data))
{
echo '<br />&#187; <span class="gensmall">[ ' . implode(' | ', $data) . ' ]</span>';
}
?>
</td>
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><input type="checkbox" name="mark[]" value="<?php echo $log_data[$i]['id']; ?>" /></td>
</tr>
<?php
}
if ($auth->acl_get('a_clearlogs'))
{
?>
<tr>
<td class="cat" colspan="5" height="28" align="right"><input class="btnlite" type="submit" name="delmarked" value="<?php echo $user->lang['DELETE_MARKED']; ?>" />&nbsp; <input class="btnlite" type="submit" name="delall" value="<?php echo $user->lang['DELETE_ALL']; ?>" />&nbsp;</td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td class="row1" colspan="5" align="center" nowrap="nowrap"><?php echo $user->lang['NO_ENTRIES']; ?></td>
</tr>
<?php
}
?>
</table>
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left" valign="top">&nbsp;<span class="nav"><?php echo on_page($log_count, $config['topics_per_page'], $start); ?></span></td>
<td align="right" valign="top" nowrap="nowrap"><span class="nav"><?php
if ($auth->acl_get('a_clearlogs'))
{
?><b><a href="javascript:marklist('list', true);"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('list', false);"><?php echo $user->lang['UNMARK_ALL']; ?></a></b>&nbsp;<br /><br /><?php
}
echo generate_pagination("admin_viewlogs.$phpEx$SID&amp;mode=$mode&amp;$u_sort_param", $log_count, $config['topics_per_page'], $start, true);
?></span></td>
</tr>
</table></form>
<script language="Javascript" type="text/javascript">
<!--
function marklist(match, status)
{
len = eval('document.' + match + '.length');
for (i = 0; i < len; i++)
{
eval('document.' + match + '.elements[i].checked = ' + status);
}
}
//-->
</script>
<?php
adm_page_footer();
?>

200
phpBB/adm/admin_words.php Normal file
View File

@@ -0,0 +1,200 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!empty($setmodules))
{
if (!$auth->acl_get('a_words'))
{
return;
}
$module['POST']['WORD_CENSOR'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Do we have forum admin permissions?
if (!$auth->acl_get('a_words'))
{
trigger_error($user->lang['NO_ADMIN']);
}
$mode = request_var('mode', '');
$mode = (isset($_POST['add'])) ? 'add' : ((isset($_POST['save'])) ? 'save' : $mode);
$s_hidden_fields = '';
$word_info = array();
switch ($mode)
{
case 'edit':
$word_id = request_var('id', 0);
if (!$word_id)
{
trigger_error($user->lang['NO_WORD']);
}
$sql = 'SELECT *
FROM ' . WORDS_TABLE . "
WHERE word_id = $word_id";
$result = $db->sql_query_limit($sql, 1);
$word_info = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $word_id . '" />';
case 'add':
adm_page_header($user->lang['WORDS_TITLE']);
?>
<h1><?php echo $user->lang['WORDS_TITLE']; ?></h1>
<p><?php echo $user->lang['WORDS_EXPLAIN']; ?></p>
<form method="post" action="<?php echo "admin_words.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['EDIT_WORD']; ?></th>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['WORD']; ?>: </b></td>
<td class="row2"><input class="post" type="text" name="word" value="<?php echo $word_info['word']; ?>" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['REPLACEMENT']; ?>: </b></td>
<td class="row2"><input class="post" type="text" name="replacement" value="<?php echo $word_info['replacement']; ?>" /></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><?php echo $s_hidden_fields; ?><input class="btnmain" type="submit" name="save" value="<?php echo $user->lang['SUBMIT']; ?>" /></td>
</tr>
</table></form>
<?php
adm_page_footer();
break;
case 'save':
$word_id = request_var('id', 0);
$word = request_var('word', '');
$replacement = request_var('replacement', '');
if (!$word || !$replacement)
{
trigger_error($user->lang['ENTER_WORD']);
}
$sql = ($word_id) ? "UPDATE " . WORDS_TABLE . " SET word = '" . $db->sql_escape($word) . "', replacement = '" . $db->sql_escape($replacement) . "' WHERE word_id = $word_id" : "INSERT INTO " . WORDS_TABLE . " (word, replacement) VALUES ('" . $db->sql_escape($word) . "', '" . $db->sql_escape($replacement) . "')";
$db->sql_query($sql);
$cache->destroy('word_censors');
$log_action = ($word_id) ? 'LOG_EDIT_WORD' : 'LOG_ADD_WORD';
add_log('admin', $log_action, $word);
$message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED'];
trigger_error($message);
break;
case 'delete':
$word_id = request_var('id', 0);
if (!$word_id)
{
trigger_error($user->lang['NO_WORD']);
}
$sql = 'SELECT word
FROM ' . WORDS_TABLE . "
WHERE word_id = $word_id";
$result = $db->sql_query($sql);
$deleted_word = $db->sql_fetchfield('word', 0, $result);
$db->sql_freeresult($result);
$sql = 'DELETE FROM ' . WORDS_TABLE . "
WHERE word_id = $word_id";
$db->sql_query($sql);
$cache->destroy('word_censors');
add_log('admin', 'LOG_DELETE_WORD', $deleted_word);
$message = $user->lang['WORD_REMOVE'];
trigger_error($message);
break;
default:
adm_page_header($user->lang['WORDS_TITLE']);
?>
<h1><?php echo $user->lang['WORDS_TITLE']; ?></h1>
<p><?php echo $user->lang['WORDS_EXPLAIN']; ?></p>
<form method="post" action="admin_words.<?php echo $phpEx . $SID; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th><?php echo $user->lang['WORD']; ?></th>
<th><?php echo $user->lang['REPLACEMENT']; ?></th>
<th colspan="2"><?php echo $user->lang['ACTION']; ?></th>
</tr>
<?php
$sql = 'SELECT *
FROM ' . WORDS_TABLE . '
ORDER BY word';
$result = $db->sql_query($sql);
$row_class = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['word']; ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['replacement']; ?></td>
<td class="<?php echo $row_class; ?>">&nbsp;<a href="<?php echo "admin_words.$phpEx$SID&amp;mode=edit&amp;id=" . $row['word_id']; ?>"><?php echo $user->lang['EDIT']; ?></a>&nbsp;</td>
<td class="<?php echo $row_class; ?>">&nbsp;<a href="<?php echo "admin_words.$phpEx$SID&amp;mode=delete&amp;id=" . $row['word_id']; ?>"><?php echo $user->lang['DELETE']; ?></a>&nbsp;</td>
</tr>
<?php
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
?>
<tr>
<td class="cat" colspan="5" height="28" align="center"><?php echo $s_hidden_fields; ?><input class="btnmain" type="submit" name="add" value="<?php echo $user->lang['ADD_WORD']; ?>" /></td>
</tr>
</table></form>
<?php
adm_page_footer();
break;
}
?>

306
phpBB/adm/editor.js Normal file
View File

@@ -0,0 +1,306 @@
// bbCode control by subBlue design [ www.subBlue.com ]
// Includes unixsafe colour palette selector by SHS`
// Startup variables
var imageTag = false;
var theSelection = false;
// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
&& (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
&& (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);
// Shows the help messages in the helpline window
function helpline(help) {
document.forms[form_name].helpbox.value = eval(help + "_help");
}
// Replacement for arrayname.length property
function getarraysize(thearray) {
for (i = 0; i < thearray.length; i++) {
if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
return i;
}
return thearray.length;
}
// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
thearray[ getarraysize(thearray) ] = value;
}
// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
thearraysize = getarraysize(thearray);
retval = thearray[thearraysize - 1];
delete thearray[thearraysize - 1];
return retval;
}
function smiley(text) {
text = ' ' + text + ' ';
if (document.forms[form_name].elements[text_name].createTextRange && document.forms[form_name].elements[text_name].caretPos) {
var caretPos = document.forms[form_name].elements[text_name].caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
document.forms[form_name].elements[text_name].focus();
} else {
var selStart = document.forms[form_name].elements[text_name].selectionStart;
var selEnd = document.forms[form_name].elements[text_name].selectionEnd;
mozWrap(document.forms[form_name].elements[text_name], text, '')
document.forms[form_name].elements[text_name].focus();
document.forms[form_name].elements[text_name].selectionStart = selStart + text.length;
document.forms[form_name].elements[text_name].selectionEnd = selEnd + text.length;
}
}
function bbfontstyle(bbopen, bbclose) {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (!theSelection) {
insert_text(bbopen + bbclose);
document.forms[form_name].elements[text_name].focus();
return;
}
document.selection.createRange().text = bbopen + theSelection + bbclose;
document.forms[form_name].elements[text_name].focus();
return;
} else {
insert_text(bbopen + bbclose);
document.forms[form_name].elements[text_name].focus();
return;
}
storeCaret(document.forms[form_name].elements[text_name]);
}
function insert_text(text) {
if (document.forms[form_name].elements[text_name].createTextRange && document.forms[form_name].elements[text_name].caretPos) {
var caretPos = document.forms[form_name].elements[text_name].caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else {
var selStart = document.forms[form_name].elements[text_name].selectionStart;
var selEnd = document.forms[form_name].elements[text_name].selectionEnd;
mozWrap(document.forms[form_name].elements[text_name], text, '')
document.forms[form_name].elements[text_name].selectionStart = selStart + text.length;
document.forms[form_name].elements[text_name].selectionEnd = selEnd + text.length;
}
}
function attach_inline() {
insert_text('[attachment=' + document.forms[form_name].elements['attachments'].value + ']' + document.forms[form_name].elements['attachments'].options[document.forms[form_name].elements['attachments'].selectedIndex].text + '[/attachment]');
}
function bbstyle(bbnumber) {
donotinsert = false;
theSelection = false;
bblast = 0;
document.forms[form_name].elements[text_name].focus();
if (bbnumber == -1) { // Close all open tags & default button names
while (bbcode[0]) {
butnumber = arraypop(bbcode) - 1;
document.forms[form_name].elements[text_name].value += bbtags[butnumber + 1];
buttext = eval('document.forms[form_name].addbbcode' + butnumber + '.value');
if (buttext != "[*]")
{
eval('document.forms[form_name].addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
}
}
document.forms[form_name].addbbcode10.value = "List";
bbtags[10] = "[list]";
document.forms[form_name].addbbcode12.value = "List=";
bbtags[12] = "[list=]";
imageTag = false; // All tags are closed including image tags :D
document.forms[form_name].elements[text_name].focus();
return;
}
if ((clientVer >= 4) && is_ie && is_win)
{
theSelection = document.selection.createRange().text; // Get text selection
if (theSelection) {
// Add tags around selection
document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
document.forms[form_name].elements[text_name].focus();
theSelection = '';
return;
}
}
else if (document.forms[form_name].elements[text_name].selectionEnd && (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0))
{
mozWrap(document.forms[form_name].elements[text_name], bbtags[bbnumber], bbtags[bbnumber+1]);
document.forms[form_name].elements[text_name].focus();
theSelection = '';
return;
}
// Find last occurance of an open tag the same as the one just clicked
for (i = 0; i < bbcode.length; i++) {
if (bbcode[i] == bbnumber+1) {
bblast = i;
donotinsert = true;
}
}
if ((bbnumber == 10) && (bbtags[10] != "[*]"))
{
if (donotinsert)
{
document.forms[form_name].addbbcode12.value = "List=";
tmp_help = o_help;
o_help = e_help;
e_help = tmp_help;
bbtags[12] = "[list=]";
}
else
{
document.forms[form_name].addbbcode12.value = "[*]";
tmp_help = o_help;
o_help = e_help;
e_help = tmp_help;
bbtags[12] = "[*]";
}
}
if ((bbnumber == 12) && (bbtags[12] != "[*]"))
{
if (donotinsert)
{
document.forms[form_name].addbbcode10.value = "List";
tmp_help = l_help;
l_help = e_help;
e_help = tmp_help;
bbtags[10] = "[list]";
}
else
{
document.forms[form_name].addbbcode10.value = "[*]";
tmp_help = l_help;
l_help = e_help;
e_help = tmp_help;
bbtags[10] = "[*]";
}
}
if (donotinsert) { // Close all open tags up to the one just clicked & default button names
while (bbcode[bblast]) {
butnumber = arraypop(bbcode) - 1;
if (bbtags[butnumber] != "[*]")
{
insert_text(bbtags[butnumber + 1]);
}
else
{
insert_text(bbtags[butnumber]);
}
buttext = eval('document.forms[form_name].addbbcode' + butnumber + '.value');
if (bbtags[butnumber] != "[*]")
{
eval('document.forms[form_name].addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
}
imageTag = false;
}
document.forms[form_name].elements[text_name].focus();
return;
} else { // Open tags
if (imageTag && (bbnumber != 14)) { // Close image tag before adding another
insert_text(bbtags[15]);
lastValue = arraypop(bbcode) - 1; // Remove the close image tag from the list
document.forms[form_name].addbbcode14.value = "Img"; // Return button back to normal state
imageTag = false;
}
// Open tag
insert_text(bbtags[bbnumber]);
if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
if (bbtags[bbnumber] != "[*]")
{
arraypush(bbcode,bbnumber+1);
eval('document.forms[form_name].addbbcode'+bbnumber+'.value += "*"');
}
document.forms[form_name].elements[text_name].focus();
return;
}
storeCaret(document.forms[form_name].elements[text_name]);
}
// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2)
selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
return;
}
// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl) {
if (textEl.createTextRange) { textEl.caretPos = document.selection.createRange().duplicate(); }
}
function colorPalette(dir, width, height)
{
var r = 0, g = 0, b = 0;
var numberList = new Array(6);
numberList[0] = "00";
numberList[1] = "40";
numberList[2] = "80";
numberList[3] = "BF";
numberList[4] = "FF";
document.writeln('<table cellspacing="1" cellpadding="0" border="0">');
for(r = 0; r < 5; r++)
{
if (dir == 'h')
{
document.writeln('<tr>');
}
for(g = 0; g < 5; g++)
{
if (dir == 'v')
{
document.writeln('<tr>');
}
for(b = 0; b < 5; b++)
{
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
document.write('<td bgcolor="#' + color + '">');
document.write('<a href="javascript:bbfontstyle(\'[color=#' + color + ']\', \'[/color]\');" onmouseover="helpline(\'s\');"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" border="0" alt="#' + color + '" title="#' + color + '" /></a>');
document.writeln('</td>');
}
if (dir == 'v')
{
document.writeln('</tr>');
}
}
if (dir == 'h')
{
document.writeln('</tr>');
}
}
document.writeln('</table>');
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 826 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 677 B

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

View File

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

730
phpBB/adm/index.php Normal file
View File

@@ -0,0 +1,730 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
// Do we have any admin permissions at all?
if (!$auth->acl_get('a_'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Define some vars
$pane = request_var('pane', '');
// Generate relevant output
if ($pane == 'top')
{
adm_page_header('', '', false);
?>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><a href="<?php echo "{$phpbb_root_path}index.$phpEx$SID"; ?>" target="_top"><img src="images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td>
<td width="100%" background="images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle"><?php echo $user->lang['ADMIN_TITLE']; ?></span> &nbsp; &nbsp; &nbsp;</td>
</tr>
</table>
<?php
adm_page_footer(false);
}
else if ($pane == 'left')
{
// Cheat and use the meta tag to change some stylesheet info
adm_page_header('', '<style type="text/css">body {background-color: #98AAB1}</style>', false);
// Grab module information using Bart's "neat-o-module" system (tm)
$dir = @opendir('.');
$setmodules = 1;
while ($file = readdir($dir))
{
if (preg_match('#^admin_(.*?)\.' . $phpEx . '$#', $file))
{
include($file);
}
}
@closedir($dir);
unset($setmodules);
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="100%"><table width="100%" cellpadding="4" cellspacing="1" border="0">
<tr>
<th class="menu" height="25">&#0187; <?php echo $user->lang['RETURN_TO']; ?></th>
</tr>
<tr>
<td class="row1"><a class="genmed" href="<?php echo "index.$phpEx$SID"; ?>&amp;pane=right" target="main"><?php echo $user->lang['ADMIN_INDEX']; ?></a></td>
</tr>
<tr>
<td class="row2"><a class="genmed" href="<?php echo "../index.$phpEx$SID"; ?>" target="_top"><?php echo $user->lang['FORUM_INDEX']; ?></a></td>
</tr>
<?php
if (is_array($module))
{
@ksort($module);
foreach ($module as $cat => $action_ary)
{
$cat = (!empty($user->lang[$cat . '_CAT'])) ? $user->lang[$cat . '_CAT'] : preg_replace('#_#', ' ', $cat);
?>
<tr>
<th class="menu" height="25">&#0187; <?php echo $cat; ?></th>
</tr>
<?php
@ksort($action_ary);
$row_class = '';
foreach ($action_ary as $action => $file)
{
if (!empty($file))
{
$action = (!empty($user->lang[$action])) ? $user->lang[$action] : preg_replace('#_#', ' ', $action);
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $row_class; ?>"><a class="genmed" href="<?php echo $file; ?>" target="main"><?php echo $action; ?></a></td>
</tr>
<?php
}
}
}
}
?>
</table></td>
</tr>
</table>
</body>
</html>
<?php
// Output footer but don't include copyright info
adm_page_footer(false);
}
elseif ($pane == 'right')
{
$action = request_var('action', '');
$mark = (isset($_REQUEST['mark'])) ? implode(', ', request_var('mark', array(0))) : '';
if ($mark)
{
switch ($action)
{
case 'activate':
case 'delete':
if (!$auth->acl_get('a_user'))
{
trigger_error($user->lang['NO_ADMIN']);
}
$sql = 'SELECT username
FROM ' . USERS_TABLE . "
WHERE user_id IN ($mark)";
$result = $db->sql_query($sql);
$user_affected = array();
while ($row = $db->sql_fetchrow($result))
{
$user_affected[] = $row['username'];
}
$db->sql_freeresult($result);
if ($action == 'activate')
{
include($phpbb_root_path . 'includes/functions_user.php');
$mark_ary = explode(', ', $mark);
foreach ($mark_ary as $user_id)
{
user_active_flip($user_id, USER_INACTIVE);
}
}
else if ($action == 'delete')
{
$sql = 'DELETE FROM ' . USER_GROUP_TABLE . " WHERE user_id IN ($mark)";
$db->sql_query($sql);
$sql = 'DELETE FROM ' . USERS_TABLE . " WHERE user_id IN ($mark)";
$db->sql_query($sql);
add_log('admin', 'LOG_INDEX_' . strtoupper($action), implode(', ', $user_affected));
}
if ($action != 'delete')
{
set_config('num_users', $config['num_users'] + $db->sql_affectedrows(), true);
}
break;
case 'remind':
if (!$auth->acl_get('a_user'))
{
trigger_error($user->lang['NO_ADMIN']);
}
if (empty($config['email_enable']))
{
trigger_error($user->lang['EMAIL_DISABLED']);
}
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey
FROM ' . USERS_TABLE . "
WHERE user_id IN ($mark)";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
// Send the messages
include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx);
$messenger = new messenger();
$board_url = generate_board_url() . "/ucp.$phpEx?mode=activate";
$sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
$usernames = array();
do
{
$messenger->template('user_remind_inactive', $row['user_lang']);
$messenger->replyto($config['board_email']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array(
'EMAIL_SIG' => $sig,
'USERNAME' => $row['username'],
'SITENAME' => $config['sitename'],
'REGISTER_DATE' => $user->format_date($row['user_regdate']),
'U_ACTIVATE' => "$board_url&mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey'])
);
$messenger->send($row['user_notify_type']);
$usernames[] = $row['username'];
}
while ($row = $db->sql_fetchrow($result));
$messenger->save_queue();
unset($email_list);
add_log('admin', 'LOG_INDEX_REMIND', implode(', ', $usernames));
unset($usernames);
}
$db->sql_freeresult($result);
break;
}
}
switch ($action)
{
case 'online':
if (!$auth->acl_get('a_defaults'))
{
trigger_error($user->lang['NO_ADMIN']);
}
set_config('record_online_users', 1, true);
set_config('record_online_date', time(), true);
add_log('admin', 'LOG_RESET_ONLINE');
break;
case 'stats':
if (!$auth->acl_get('a_defaults'))
{
trigger_error($user->lang['NO_ADMIN']);
}
$sql = 'SELECT COUNT(post_id) AS stat
FROM ' . POSTS_TABLE . '
WHERE post_approved = 1';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_posts', (int) $row['stat'], true);
$sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . '
WHERE topic_approved = 1';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_topics', (int) $row['stat'], true);
$sql = 'SELECT COUNT(user_id) AS stat
FROM ' . USERS_TABLE . '
WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_users', (int) $row['stat'], true);
$sql = 'SELECT COUNT(attach_id) as stat
FROM ' . ATTACHMENTS_TABLE;
$result = $db->sql_query($sql);
set_config('num_files', (int) $db->sql_fetchfield('stat', 0, $result), true);
$db->sql_freeresult($result);
$sql = 'SELECT SUM(filesize) as stat
FROM ' . ATTACHMENTS_TABLE;
$result = $db->sql_query($sql);
set_config('upload_dir_size', (int) $db->sql_fetchfield('stat', 0, $result), true);
$db->sql_freeresult($result);
add_log('admin', 'LOG_RESYNC_STATS');
break;
case 'user':
if (!$auth->acl_get('a_defaults'))
{
trigger_error($user->lang['NO_ADMIN']);
}
$post_count_ary = $auth->acl_getf('f_postcount');
$forum_ary = array();
foreach ($post_count_ary as $forum_id => $allowed)
{
if ($allowed['f_postcount'])
{
$forum_ary[] = $forum_id;
}
}
if (!sizeof($forum_ary))
{
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0');
}
else
{
$sql = 'SELECT COUNT(post_id) AS num_posts, poster_id
FROM ' . POSTS_TABLE . '
WHERE poster_id <> ' . ANONYMOUS . '
AND forum_id IN (' . implode(', ', $forum_ary) . ')
GROUP BY poster_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['poster_id']}");
}
$db->sql_freeresult($result);
}
add_log('admin', 'LOG_RESYNC_POSTCOUNTS');
break;
case 'date':
if (!$auth->acl_get('a_defaults'))
{
trigger_error($user->lang['NO_ADMIN']);
}
set_config('board_startdate', time() - 1);
add_log('admin', 'LOG_RESET_DATE');
break;
}
// Get forum statistics
$total_posts = $config['num_posts'];
$total_topics = $config['num_topics'];
$total_users = $config['num_users'];
$total_files = $config['num_files'];
$start_date = $user->format_date($config['board_startdate']);
$boarddays = (time() - $config['board_startdate']) / 86400;
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
$users_per_day = sprintf('%.2f', $total_users / $boarddays);
$files_per_day = sprintf('%.2f', $total_files / $boarddays);
$upload_dir_size = ($config['upload_dir_size'] >= 1048576) ? sprintf('%.2f ' . $user->lang['MB'], ($config['upload_dir_size'] / 1048576)) : (($config['upload_dir_size'] >= 1024) ? sprintf('%.2f ' . $user->lang['KB'], ($config['upload_dir_size'] / 1024)) : sprintf('%.2f ' . $user->lang['BYTES'], $config['upload_dir_size']));
$avatar_dir_size = 0;
if ($avatar_dir = @opendir($phpbb_root_path . $config['avatar_path']))
{
while ($file = readdir($avatar_dir))
{
if ($file{0} != '.')
{
$avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file);
}
}
@closedir($avatar_dir);
// This bit of code translates the avatar directory size into human readable format
// Borrowed the code from the PHP.net annoted manual, origanally written by:
// Jesse (jesse@jess.on.ca)
$avatar_dir_size = ($avatar_dir_size >= 1048576) ? sprintf('%.2f ' . $user->lang['MB'], ($avatar_dir_size / 1048576)) : (($avatar_dir_size >= 1024) ? sprintf('%.2f ' . $user->lang['KB'], ($avatar_dir_size / 1024)) : sprintf('%.2f ' . $user->lang['BYTES'], $avatar_dir_size));
}
else
{
// Couldn't open Avatar dir.
$avatar_dir_size = $user->lang['NOT_AVAILABLE'];
}
if ($posts_per_day > $total_posts)
{
$posts_per_day = $total_posts;
}
if ($topics_per_day > $total_topics)
{
$topics_per_day = $total_topics;
}
if ($users_per_day > $total_users)
{
$users_per_day = $total_users;
}
if ($files_per_day > $total_files)
{
$files_per_day = $total_files;
}
// DB size ... MySQL only
// This code is heavily influenced by a similar routine
// in phpMyAdmin 2.2.0
if (preg_match('#^mysql#', SQL_LAYER))
{
$result = $db->sql_query('SELECT VERSION() AS mysql_version');
if ($row = $db->sql_fetchrow($result))
{
$version = $row['mysql_version'];
if (preg_match('#^(3\.23|4\.)#', $version))
{
$db_name = (preg_match('#^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)#', $version)) ? "`$dbname`" : $dbname;
$sql = "SHOW TABLE STATUS
FROM " . $db_name;
$result = $db->sql_query($sql);
$dbsize = 0;
while ($row = $db->sql_fetchrow($result))
{
if ((isset($row['Type']) && $row['Type'] != 'MRG_MyISAM') || (isset($row['Engine']) && $row['Engine'] == 'MyISAM'))
{
if ($table_prefix != '')
{
if (strstr($row['Name'], $table_prefix))
{
$dbsize += $row['Data_length'] + $row['Index_length'];
}
}
else
{
$dbsize += $row['Data_length'] + $row['Index_length'];
}
}
}
}
else
{
$dbsize = $user->lang['NOT_AVAILABLE'];
}
}
else
{
$dbsize = $user->lang['NOT_AVAILABLE'];
}
}
else if (preg_match('#^mssql#', SQL_LAYER))
{
$sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
FROM sysfiles';
$result = $db->sql_query($sql);
$dbsize = ($row = $db->sql_fetchrow($result)) ? intval($row['dbsize']) : $user->lang['NOT_AVAILABLE'];
}
else
{
$dbsize = $user->lang['NOT_AVAILABLE'];
}
if (is_int($dbsize))
{
$dbsize = ($dbsize >= 1048576) ? sprintf('%.2f ' . $user->lang['MB'], ($dbsize / 1048576)) : (($dbsize >= 1024) ? sprintf('%.2f ' . $user->lang['KB'], ($dbsize / 1024)) : sprintf('%.2f ' . $user->lang['BYTES'], $dbsize));
}
adm_page_header($user->lang['ADMIN_INDEX']);
?>
<script language="Javascript" type="text/javascript">
<!--
function marklist(status)
{
for (i = 0; i < document.inactive.length; i++)
{
document.inactive.elements[i].checked = status;
}
}
//-->
</script>
<h1><?php echo $user->lang['WELCOME_PHPBB']; ?></h1>
<p><?php echo $user->lang['ADMIN_INTRO']; ?></p>
<h1><?php echo $user->lang['FORUM_STATS']; ?></h1>
<form name="statistics" method="post" action="index.<?php echo $phpEx . $SID; ?>&amp;pane=right"><table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
<tr>
<th width="25%" nowrap="nowrap" height="25"><?php echo $user->lang['STATISTIC']; ?></th>
<th width="25%"><?php echo $user->lang['VALUE']; ?></th>
<th width="25%" nowrap="nowrap"><?php echo $user->lang['STATISTIC']; ?></th>
<th width="25%"><?php echo $user->lang['VALUE']; ?></th>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['NUMBER_POSTS']; ?>:</td>
<td class="row2"><b><?php echo $total_posts; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['POSTS_PER_DAY']; ?>:</td>
<td class="row2"><b><?php echo $posts_per_day; ?></b></td>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['NUMBER_TOPICS']; ?>:</td>
<td class="row2"><b><?php echo $total_topics; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['TOPICS_PER_DAY']; ?>:</td>
<td class="row2"><b><?php echo $topics_per_day; ?></b></td>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['NUMBER_USERS']; ?>:</td>
<td class="row2"><b><?php echo $total_users; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['USERS_PER_DAY']; ?>:</td>
<td class="row2"><b><?php echo $users_per_day; ?></b></td>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['NUMBER_FILES']; ?>:</td>
<td class="row2"><b><?php echo $total_files; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['FILES_PER_DAY']; ?>:</td>
<td class="row2"><b><?php echo $files_per_day; ?></b></td>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['BOARD_STARTED']; ?>:</td>
<td class="row2"><b><?php echo $start_date; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['AVATAR_DIR_SIZE']; ?>:</td>
<td class="row2"><b><?php echo $avatar_dir_size; ?></b></td>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['DATABASE_SIZE']; ?>:</td>
<td class="row2"><b><?php echo $dbsize; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['UPLOAD_DIR_SIZE']; ?>:</td>
<td class="row2"><b><?php echo $upload_dir_size; ?></b></td>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $user->lang['GZIP_COMPRESSION']; ?>:</td>
<td class="row2"><b><?php echo ($config['gzip_compress']) ? $user->lang['ON'] : $user->lang['OFF']; ?></b></td>
<td class="row1" nowrap="nowrap">&nbsp;</td>
<td class="row2">&nbsp;</td>
</tr>
<tr>
<td class="cat" colspan="4" align="right"><select name="action"><option value="online"><?php echo $user->lang['RESET_ONLINE']; ?></option><option value="date"><?php echo $user->lang['RESET_DATE']; ?></option><option value="stats"><?php echo $user->lang['RESYNC_STATS']; ?></option><option value="user"><?php echo $user->lang['RESYNC_POSTCOUNTS']; ?></option>
</select> <input class="btnlite" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" />&nbsp;</td>
</tr>
</table></form>
<h1><?php echo $user->lang['ADMIN_LOG']; ?></h1>
<p><?php echo $user->lang['ADMIN_LOG_INDEX_EXPLAIN']; ?></p>
<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
<tr>
<th width="15%" height="25" nowrap="nowrap"><?php echo $user->lang['USERNAME']; ?></th>
<th width="15%"><?php echo $user->lang['IP']; ?></th>
<th width="20%"><?php echo $user->lang['TIME']; ?></th>
<th width="45%" nowrap="nowrap"><?php echo $user->lang['ACTION']; ?></th>
</tr>
<?php
view_log('admin', $log_data, $log_count, 5);
$row_class = 'row2';
for($i = 0; $i < sizeof($log_data); $i++)
{
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $row_class; ?>"><?php echo $log_data[$i]['username']; ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $log_data[$i]['ip']; ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $user->format_date($log_data[$i]['time']); ?></td>
<td class="<?php echo $row_class; ?>"><?php echo $log_data[$i]['action']; ?></td>
</tr>
<?php
}
if ($auth->acl_get('a_user'))
{
?>
</table>
<h1><?php echo $user->lang['INACTIVE_USERS']; ?></h1>
<p><?php echo $user->lang['INACTIVE_USERS_EXPLAIN']; ?></p>
<form method="post" name="inactive" action="<?php echo "index.$phpEx$SID&amp;pane=right"; ?>"><table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
<tr>
<th width="45%" height="25" nowrap="nowrap"><?php echo $user->lang['USERNAME']; ?></th>
<th width="45%"><?php echo $user->lang['JOINED']; ?></th>
<th width="5%" nowrap="nowrap"><?php echo $user->lang['MARK']; ?></th>
</tr>
<?php
$sql = 'SELECT user_id, username, user_regdate
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_INACTIVE . '
ORDER BY user_regdate ASC';
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
do
{
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $row_class; ?>"><a href="<?php echo "admin_users.$phpEx$SID&amp;u=" . $row['user_id']; ?>"><?php echo $row['username']; ?></a></td>
<td class="<?php echo $row_class; ?>"><?php echo $user->format_date($row['user_regdate']); ?></td>
<td class="<?php echo $row_class; ?>">&nbsp;<input type="checkbox" name="mark[]" value="<?php echo $row['user_id']; ?>" />&nbsp;</td>
</tr>
<?php
}
while ($row = $db->sql_fetchrow($result));
?>
<tr>
<td class="cat" colspan="3" height="28" align="right"><select name="action"><option value="activate"><?php echo $user->lang['ACTIVATE']; ?></option><?php
if (!empty($config['email_enable']))
{
?><option value="remind"><?php echo $user->lang['REMIND']; ?></option><?php
}
?><option value="delete"><?php echo $user->lang['DELETE']; ?></option></select> <input class="btnlite" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" />&nbsp;</td>
</tr>
<?php
}
else
{
?>
<tr>
<td class="row1" colspan="3" align="center"><?php echo $user->lang['NO_INACTIVE_USERS']; ?></td>
</tr>
<?php
}
?>
</table>
<table width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<td align="right" valign="top" nowrap="nowrap"><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist(false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b></td>
</tr>
</table></form>
<?php
}
adm_page_footer();
}
else
{
//
// Output the frameset ...
//
header("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Content-type: text/html; charset=" . $user->lang['ENCODING']);
$adm_url = "index.$phpEx$SID&amp;pane=right";
/*
// Allows non-admin pages to link to admin pages
// eg: http://forums.foo.com/adm/index.php?sid=&mod=admin_forums&f=1
if (!empty($_GET['mod']) && preg_match('/admin_([a-z]+)/', $_GET['mod'], $m))
{
if (file_exists($phpbb_root_path . 'adm/admin_' . $m[1] . '.' . $phpEx))
{
$adm_url = 'admin_' . $m[1] . '.' . $phpEx . $SID;
$adm_url .= (!empty($_GET['mode'])) ? '&amp;mode=' . htmlspecialchars($_GET['mode']) : '';
$adm_url .= (!empty($_GET['f'])) ? '&amp;f=' . intval($_GET['f']) : '';
$adm_url .= (!empty($_GET['u'])) ? '&amp;u=' . intval($_GET['u']) : '';
$adm_url .= (!empty($_GET['g'])) ? '&amp;g=' . intval($_GET['g']) : '';
}
}
*/
?>
<html>
<head>
<title><?php echo $user->lang['ADMIN_TITLE']; ?></title>
</head>
<frameset rows="60, *" border="0" framespacing="0" frameborder="NO">
<frame src="<?php echo "index.$phpEx$SID&amp;pane=top"; ?>" name="title" noresize marginwidth="0" marginheight="0" scrolling="NO">
<frameset cols="155,*" rows="*" border="2" framespacing="0" frameborder="yes">
<frame src="<?php echo "index.$phpEx$SID&amp;pane=left"; ?>" name="nav" marginwidth="3" marginheight="3" scrolling="yes">
<frame src="<?php echo $adm_url ?>" name="main" marginwidth="0" marginheight="0" scrolling="auto">
</frameset>
</frameset>
<noframes>
<body bgcolor="white" text="#000000">
<p><?php echo $user->lang['NO_FRAMES']; ?></p>
</body>
</noframes>
</html>
<?php
exit;
}
?>

469
phpBB/adm/pagestart.php Normal file
View File

@@ -0,0 +1,469 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
*/
define('NEED_SID', true);
define('IN_ADMIN', true);
require($phpbb_root_path . 'common.'.$phpEx);
require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('admin');
// End session management
// Did user forget to login? Give 'em a chance to here ...
if (!$user->data['is_registered'])
{
if ($user->data['is_bot'])
{
redirect("../index.$phpEx$SID");
}
login_box('', $user->lang['LOGIN_ADMIN'], $user->lang['LOGIN_ADMIN_SUCCESS'], true);
}
// Have they authenticated (again) as an admin for this session?
if (!$user->data['session_admin'])
{
login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false);
}
// Is user any type of admin? No, then stop here, each script needs to
// check specific permissions but this is a catchall
if (!$auth->acl_get('a_'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Some oft used variables
$safe_mode = (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on') ? true : false;
$file_uploads = (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
// -----------------------------
// Functions
function adm_page_header($sub_title, $meta = '', $table_html = true)
{
global $config, $db, $user, $phpEx;
define('HEADER_INC', true);
// gzip_compression
if ($config['gzip_compress'])
{
if (extension_loaded('zlib') && !headers_sent())
{
ob_start('ob_gzhandler');
}
}
header("Content-type: text/html; charset=" . $user->lang['ENCODING']);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $user->lang['ENCODING']; ?>">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" href="subSilver.css" type="text/css">
<?php
echo $meta;
?>
<style type="text/css">
<!--
th { background-image: url('images/cellpic3.gif') }
td.cat { background-image: url('images/cellpic1.gif') }
//-->
</style>
<title><?php echo $config['sitename'] . ' - ' . $page_title; ?></title>
</head>
<body>
<?php
if ($table_html)
{
?>
<a name="top"></a>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="2" height="25" align="right" nowrap="nowrap"><span class="subtitle">&#0187; <i><?php echo $sub_title; ?></i></span> &nbsp;&nbsp;</td>
</tr>
</table>
<table width="95%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td><br clear="all" />
<?php
}
}
function adm_page_footer($copyright_html = true)
{
global $cache, $config, $db, $phpEx;
if (!empty($cache))
{
$cache->unload();
}
// Close our DB connection.
$db->sql_close();
?>
</td>
</tr>
</table>
<?php
if ($copyright_html)
{
?>
<div class="copyright" align="center">Powered by phpBB <?php echo $config['version']; ?> &copy; 2002 <a href="http://www.phpbb.com/" target="_phpbb">phpBB Group</a></div>
<br clear="all" />
</body>
</html>
<?php
}
exit;
}
function adm_page_message($title, $message, $show_header = false)
{
global $phpEx, $SID, $user;
if ($show_header)
{
?>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><a href="<?php echo "../index.$phpEx$SID"; ?>"><img src="images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td>
<td width="100%" background="images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle"><?php echo $user->lang['ADMIN_TITLE']; ?></span> &nbsp; &nbsp; &nbsp;</td>
</tr>
</table>
<?php
}
?>
<br /><br />
<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th><?php echo $title; ?></th>
</tr>
<tr>
<td class="row1" align="center"><?php echo $message; ?></td>
</tr>
</table>
<br />
<?php
}
function adm_page_confirm($title, $message)
{
global $phpEx, $SID, $user;
// Grab data from GET and POST arrays ... note this is _not_
// validated! Everything is typed as string to ensure no
// funny business on displayed hidden field data. Validation
// will be carried out by whatever processes this form.
$var_ary = array_merge($_GET, $_POST);
$s_hidden_fields = '';
foreach ($var_ary as $key => $var)
{
if (empty($var))
{
continue;
}
if (is_array($var))
{
foreach ($var as $k => $v)
{
if (is_array($v))
{
foreach ($v as $_k => $_v)
{
set_var($var[$k][$_k], $_v, 'string');
$s_hidden_fields .= "<input type=\"hidden\" name=\"${key}[$k][$_k]\" value=\"" . addslashes($_v) . '" />';
}
}
else
{
set_var($var[$k], $v, 'string');
$s_hidden_fields .= "<input type=\"hidden\" name=\"${key}[$k]\" value=\"" . addslashes($v) . '" />';
}
}
}
else
{
set_var($var, $var, 'string');
$s_hidden_fields .= '<input type="hidden" name="' . $key . '" value="' . addslashes($var) . '" />';
}
unset($var_ary[$key]);
}
?>
<br /><br />
<form name="confirm" method="post" action="<?php echo $_SERVER['SCRIPT_NAME'] . $SID; ?>">
<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th><?php echo $title; ?></th>
</tr>
<tr>
<td class="row1" align="center"><?php echo $message; ?><br /><br /><input class="btnlite" type="submit" name="confirm" value="<?php echo $user->lang['YES']; ?>" />&nbsp;&nbsp;<input class="btnmain" type="submit" name="cancel" value="<?php echo $user->lang['NO']; ?>" /></td>
</tr>
</table>
<?php echo $s_hidden_fields; ?>
</form>
<br />
<?php
adm_page_footer();
}
function build_cfg_template($tpl_type, $config_key, $options = '')
{
global $new, $user;
$tpl = '';
$name = 'config[' . $config_key . ']';
switch ($tpl_type[0])
{
case 'text':
case 'password':
$size = (int) $tpl_type[1];
$maxlength = (int) $tpl_type[2];
$tpl = '<input class="post" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '" />';
break;
case 'dimension':
$size = (int) $tpl_type[1];
$maxlength = (int) $tpl_type[2];
$tpl = '<input class="post" type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" /> x <input class="post" type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" />';
break;
case 'textarea':
$rows = (int) $tpl_type[1];
$cols = (int) $tpl_type[2];
$tpl = '<textarea name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $new[$config_key] . '</textarea>';
break;
case 'radio':
$key_yes = ($new[$config_key]) ? ' checked="checked"' : '';
$key_no = (!$new[$config_key]) ? ' checked="checked"' : '';
$tpl_type_cond = explode('_', $tpl_type[1]);
$type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true;
$tpl_no = '<input type="radio" name="' . $name . '" value="0"' . $key_no . ' />' . (($type_no) ? $user->lang['NO'] : $user->lang['DISABLED']);
$tpl_yes = '<input type="radio" name="' . $name . '" value="1"' . $key_yes . ' />' . (($type_no) ? $user->lang['YES'] : $user->lang['ENABLED']);
$tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . '&nbsp;&nbsp;' . $tpl_no : $tpl_no . '&nbsp;&nbsp;' . $tpl_yes;
break;
case 'select':
eval('$s_options = ' . str_replace('{VALUE}', $new[$config_key], $options) . ';');
$tpl = '<select name="' . $name . '">' . $s_options . '</select>';
break;
case 'custom':
eval('$tpl = ' . str_replace('{VALUE}', $new[$config_key], $options) . ';');
break;
default:
break;
}
return $tpl;
}
/**
* @package acp
* General ACP module class
*/
class module
{
var $id = 0;
var $type;
var $name;
var $mode;
// Private methods, should not be overwritten
function create($module_type, $module_url, $selected_mod = false, $selected_submod = false)
{
global $template, $auth, $db, $user, $config;
$sql = 'SELECT module_id, module_title, module_filename, module_subs, module_acl
FROM ' . MODULES_TABLE . "
WHERE module_type = 'acp'
AND module_enabled = 1
ORDER BY module_order ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
// Authorisation is required for the basic module
if ($row['module_acl'])
{
$is_auth = false;
eval('$is_auth = (' . preg_replace(array('#acl_([a-z_]+)#e', '#cfg_([a-z_]+)#e'), array('$auth->acl_get("\\1")', '$config["\\1"]'), $row['module_acl']) . ');');
// The user is not authorised to use this module, skip it
if (!$is_auth)
{
continue;
}
}
$selected = ($row['module_filename'] == $selected_mod || $row['module_id'] == $selected_mod || (!$selected_mod && !$i)) ? true : false;
/*
// Get the localised lang string if available, or make up our own otherwise
$template->assign_block_vars($module_type . '_section', array(
'L_TITLE' => (isset($user->lang[strtoupper($module_type) . '_' . $row['module_title']])) ? $user->lang[strtoupper($module_type) . '_' . $row['module_title']] : ucfirst(str_replace('_', ' ', strtolower($row['module_title']))),
'S_SELECTED' => $selected,
'U_TITLE' => $module_url . '&amp;i=' . $row['module_id'])
);
*/
if ($selected)
{
$module_id = $row['module_id'];
$module_name = $row['module_filename'];
if ($row['module_subs'])
{
$j = 0;
$submodules_ary = explode("\n", $row['module_subs']);
foreach ($submodules_ary as $submodule)
{
$submodule = explode(',', trim($submodule));
$submodule_title = array_shift($submodule);
$is_auth = true;
foreach ($submodule as $auth_option)
{
if (!$auth->acl_get($auth_option))
{
$is_auth = false;
}
}
if (!$is_auth)
{
continue;
}
$selected = ($submodule_title == $selected_submod || (!$selected_submod && !$j)) ? true : false;
/*
// Get the localised lang string if available, or make up our own otherwise
$template->assign_block_vars("{$module_type}_section.{$module_type}_subsection", array(
'L_TITLE' => (isset($user->lang[strtoupper($module_type) . '_' . strtoupper($submodule_title)])) ? $user->lang[strtoupper($module_type) . '_' . strtoupper($submodule_title)] : ucfirst(str_replace('_', ' ', strtolower($submodule_title))),
'S_SELECTED' => $selected,
'U_TITLE' => $module_url . '&amp;i=' . $module_id . '&amp;mode=' . $submodule_title
));
*/
if ($selected)
{
$this->mode = $submodule_title;
}
$j++;
}
}
}
$i++;
}
$db->sql_freeresult($result);
if (!$module_id)
{
trigger_error('MODULE_NOT_EXIST');
}
$this->type = $module_type;
$this->id = $module_id;
$this->name = $module_name;
}
// Public methods to be overwritten by modules
function module()
{
// Module name
// Module filename
// Module description
// Module version
// Module compatibility
return false;
}
function init()
{
return false;
}
function install()
{
return false;
}
function uninstall()
{
return false;
}
}
// End Functions
// -----------------------------
?>

217
phpBB/adm/subSilver.css Normal file
View File

@@ -0,0 +1,217 @@
/*
$Id$
The original "subSilver" theme for phpBB2
Created by subBlue design :: http://www.subBlue.com
Updated for phpBB 2.2 by psoTFX :: phpBB Group
Copyright (c) 2002 phpBB Group
*/
body {
background-color: white;
font-family: Verdana, Arial, Helvetica, sans-serif;
margin: 0px;
border: 0px;
padding: 0px;
scrollbar-face-color: #DEE3E7;
scrollbar-highlight-color: white;
scrollbar-shadow-color: #DEE3E7;
scrollbar-3dlight-color: #D1D7DC;
scrollbar-arrow-color: #006699;
scrollbar-track-color: #EFEFEF;
scrollbar-darkshadow-color: #98AAB1;
}
p {
font-size: 8pt;
}
.maintitle, h1 {
font: bold 18pt 'Trebuchet MS', Verdana, sans-serif;
text-decoration:none;
line-height: 120%;
}
h2 {
font: bold 12pt Arial, Helvetica, sans-serif;
text-decoration:none;
line-height: 120%;
}
.maintitle {
color: #12749B
}
.subtitle {
font: bold 12pt Arial, Helvetica, sans-serif;
}
.blue {
color: #006699;
}
.syntaxbg { color: #FFFFFF; }
.syntaxcomment { color: #FF8000; }
.syntaxdefault { color: #0000BB; }
.syntaxhtml { color: #000000; }
.syntaxkeyword { color: #007700; }
.syntaxstring { color: #DD0000; }
/*
Anchors
*/
a:link, a:active, a:visited { color: #006699; text-decoration: none; }
a:hover { color: #DD6900; text-decoration: underline; }
a.nav { color: #006699; text-decoration: none; }
a.nav:hover { text-decoration: underline; }
a.th:link { color: #FFA34F; text-decoration: none; }
a.th:active { color: #FFA34F; text-decoration: none; }
a.th:visited { color: #FFA34F; text-decoration: none; }
a.th:hover { color: #FFA34F; text-decoration: underline; }
/*
Non-tag specific
*/
.gen, .gensmall {
color: black;
}
.gen {
font-size: 8pt;
}
.gensmall {
font-size: 7pt;
}
.nav {
color: black;
font: bold 7pt;
}
.forumlink {
font: bold 120% Verdana, Arial, Helvetica, sans-serif;
}
.name {
color: black;
font-size: 11px;
}
.postdetails {
color: black;
font-size: 10px;
}
.copyright {
color: #444444;
font: 8pt Verdana, Arial, Helvetica, sans-serif;
letter-spacing: -1px;
}
.error { color: #FF0000 }
/*
Tables
*/
table.bg {
background-color: #ACBBC6
}
th, td {
font: normal 8pt Verdana, Arial, Helvetica, sans-serif;
}
th {
height: 25px;
background-color: #006699;
color: #FFA34F;
font-weight: bold;
font-size: 11px;
}
th.menu {
text-align: left;
}
td.cat {
height: 28px;
background-color: #D1D7DC;
}
.row1 {
background-color: #EFEFEF;
}
.row2 {
background-color: #DEE3E7;
}
.row3 {
background-color: #D1D7DC;
}
.sourcenum {
color: gray;
font-family: 'Courier New', monospace;
font-size: 9pt;
font-weight: bold;
line-height: 160%;
}
.source {
font-family: 'Courier New', monospace;
font-size: 9pt;
line-height: 160%;
}
/*
Misc
*/
hr {
height: 0px;
border: solid #D1D7DC 0px;
border-top-width: 1px;
}
/*
Forms
*/
input {
text-indent: 2px;
}
textarea, select, input.post, input.mainoption, input.liteoption {
border: 1px solid;
}
input, textarea, select {
color: black;
font: normal 8pt Verdana, Arial, Helvetica, sans-serif;
border-color: black;
}
input.text {
font-family: 'Courier New', courier;
}
input.checkbox {
height: 16px;
width: 16px;
}
option.sep {
color: white;
background-color: #006699;
}
textarea.edit {
font: 9pt 'Courier New', courier;
line-height:125%;
}
.btnmain {
background-color: #FAFAFA;
font-weight: bold;
border-width: 1px;
}
.btnlite {
background-color: #FAFAFA;
font-weight: normal;
border-width: 1px;
}
.helpline { background-color: #DEE3E7; border-style: none; }

56
phpBB/adm/swatch.php Normal file
View File

@@ -0,0 +1,56 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<title>phpBB3 Color Swatch</title>
<style type="text/css">
td {
border: solid 1px #333333;
}
.over {
border-color: white;
}
.out {
border-color: #333333;
}
</style>
<body bgcolor="#404040" text="#FFFFFF">
<script language="javascript" type="text/javascript">
<!--
var r = 0, g = 0, b = 0;
var numberList = new Array(6);
numberList[0] = "00";
numberList[1] = "33";
numberList[2] = "66";
numberList[3] = "99";
numberList[4] = "CC";
numberList[5] = "FF";
document.writeln('<table cellspacing="0" cellpadding="0" border="0">');
for(r = 0; r < 6; r++)
{
document.writeln('<tr>');
for(g = 0; g < 6; g++)
{
for(b = 0; b < 6; b++)
{
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
document.write('<td bgcolor="#' + color + '" onmouseover="this.className=\'over\'" onmouseout="this.className=\'out\'">');
document.write('<a href="javascript:cell(\'' + color + '\');"><img src="../images/spacer.gif" width="15" height="12" border="0" alt="#' + color + '" title="#' + color + '" \/><\/a>');
document.writeln('<\/td>');
}
}
document.writeln('<\/tr>');
}
document.writeln('<\/table>');
function cell(color)
{
opener.document.forms['<?php echo htmlspecialchars(addslashes($_GET['form'])); ?>'].<?php echo htmlspecialchars(addslashes($_GET['name'])); ?>.value = color;
}
//-->
</script>
</body>
</html>

View File

@@ -1,366 +0,0 @@
<?php
/***************************************************************************
* admin_board.php
* -------------------
* begin : Thursday, Jul 12, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$file = basename(__FILE__);
$module['General']['Configuration'] = $file;
return;
}
//
// Let's set the root dir for phpBB
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
//
// Pull all config data
//
$sql = "SELECT *
FROM " . CONFIG_TABLE;
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql);
}
else
{
while( $row = $db->sql_fetchrow($result) )
{
$config_name = $row['config_name'];
$config_value = $row['config_value'];
$default_config[$config_name] = isset($HTTP_POST_VARS['submit']) ? str_replace("'", "\'", $config_value) : $config_value;
$new[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name];
if ($config_name == 'cookie_name')
{
$new['cookie_name'] = str_replace('.', '_', $new['cookie_name']);
}
// Attempt to prevent a common mistake with this value,
// http:// is the protocol and not part of the server name
if ($config_name == 'server_name')
{
$new['server_name'] = str_replace('http://', '', $new['server_name']);
}
// Attempt to prevent a mistake with this value.
if ($config_name == 'avatar_path')
{
$new['avatar_path'] = trim($new['avatar_path']);
if (strstr($new['avatar_path'], "\0") || !is_dir($phpbb_root_path . $new['avatar_path']) || !is_writable($phpbb_root_path . $new['avatar_path']))
{
$new['avatar_path'] = $default_config['avatar_path'];
}
}
if( isset($HTTP_POST_VARS['submit']) )
{
$sql = "UPDATE " . CONFIG_TABLE . " SET
config_value = '" . str_replace("\'", "''", $new[$config_name]) . "'
WHERE config_name = '$config_name'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Failed to update general configuration for $config_name", "", __LINE__, __FILE__, $sql);
}
}
}
if( isset($HTTP_POST_VARS['submit']) )
{
$message = $lang['Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_config'], "<a href=\"" . append_sid("admin_board.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
}
$style_select = style_select($new['default_style'], 'default_style', "../templates");
$lang_select = language_select($new['default_lang'], 'default_lang', "language");
$timezone_select = tz_select($new['board_timezone'], 'board_timezone');
$disable_board_yes = ( $new['board_disable'] ) ? "checked=\"checked\"" : "";
$disable_board_no = ( !$new['board_disable'] ) ? "checked=\"checked\"" : "";
$cookie_secure_yes = ( $new['cookie_secure'] ) ? "checked=\"checked\"" : "";
$cookie_secure_no = ( !$new['cookie_secure'] ) ? "checked=\"checked\"" : "";
$html_tags = $new['allow_html_tags'];
$override_user_style_yes = ( $new['override_user_style'] ) ? "checked=\"checked\"" : "";
$override_user_style_no = ( !$new['override_user_style'] ) ? "checked=\"checked\"" : "";
$html_yes = ( $new['allow_html'] ) ? "checked=\"checked\"" : "";
$html_no = ( !$new['allow_html'] ) ? "checked=\"checked\"" : "";
$bbcode_yes = ( $new['allow_bbcode'] ) ? "checked=\"checked\"" : "";
$bbcode_no = ( !$new['allow_bbcode'] ) ? "checked=\"checked\"" : "";
$activation_none = ( $new['require_activation'] == USER_ACTIVATION_NONE ) ? "checked=\"checked\"" : "";
$activation_user = ( $new['require_activation'] == USER_ACTIVATION_SELF ) ? "checked=\"checked\"" : "";
$activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? "checked=\"checked\"" : "";
$confirm_yes = ($new['enable_confirm']) ? 'checked="checked"' : '';
$confirm_no = (!$new['enable_confirm']) ? 'checked="checked"' : '';
$allow_autologin_yes = ($new['allow_autologin']) ? 'checked="checked"' : '';
$allow_autologin_no = (!$new['allow_autologin']) ? 'checked="checked"' : '';
$board_email_form_yes = ( $new['board_email_form'] ) ? "checked=\"checked\"" : "";
$board_email_form_no = ( !$new['board_email_form'] ) ? "checked=\"checked\"" : "";
$gzip_yes = ( $new['gzip_compress'] ) ? "checked=\"checked\"" : "";
$gzip_no = ( !$new['gzip_compress'] ) ? "checked=\"checked\"" : "";
$privmsg_on = ( !$new['privmsg_disable'] ) ? "checked=\"checked\"" : "";
$privmsg_off = ( $new['privmsg_disable'] ) ? "checked=\"checked\"" : "";
$prune_yes = ( $new['prune_enable'] ) ? "checked=\"checked\"" : "";
$prune_no = ( !$new['prune_enable'] ) ? "checked=\"checked\"" : "";
$smile_yes = ( $new['allow_smilies'] ) ? "checked=\"checked\"" : "";
$smile_no = ( !$new['allow_smilies'] ) ? "checked=\"checked\"" : "";
$sig_yes = ( $new['allow_sig'] ) ? "checked=\"checked\"" : "";
$sig_no = ( !$new['allow_sig'] ) ? "checked=\"checked\"" : "";
$namechange_yes = ( $new['allow_namechange'] ) ? "checked=\"checked\"" : "";
$namechange_no = ( !$new['allow_namechange'] ) ? "checked=\"checked\"" : "";
$avatars_local_yes = ( $new['allow_avatar_local'] ) ? "checked=\"checked\"" : "";
$avatars_local_no = ( !$new['allow_avatar_local'] ) ? "checked=\"checked\"" : "";
$avatars_remote_yes = ( $new['allow_avatar_remote'] ) ? "checked=\"checked\"" : "";
$avatars_remote_no = ( !$new['allow_avatar_remote'] ) ? "checked=\"checked\"" : "";
$avatars_upload_yes = ( $new['allow_avatar_upload'] ) ? "checked=\"checked\"" : "";
$avatars_upload_no = ( !$new['allow_avatar_upload'] ) ? "checked=\"checked\"" : "";
$smtp_yes = ( $new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
$smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
$template->set_filenames(array(
"body" => "admin/board_config_body.tpl")
);
//
// Escape any quotes in the site description for proper display in the text
// box on the admin page
//
$new['site_desc'] = str_replace('"', '&quot;', $new['site_desc']);
$new['sitename'] = str_replace('"', '&quot;', strip_tags($new['sitename']));
$template->assign_vars(array(
"S_CONFIG_ACTION" => append_sid("admin_board.$phpEx"),
"L_YES" => $lang['Yes'],
"L_NO" => $lang['No'],
"L_CONFIGURATION_TITLE" => $lang['General_Config'],
"L_CONFIGURATION_EXPLAIN" => $lang['Config_explain'],
"L_GENERAL_SETTINGS" => $lang['General_settings'],
"L_SERVER_NAME" => $lang['Server_name'],
"L_SERVER_NAME_EXPLAIN" => $lang['Server_name_explain'],
"L_SERVER_PORT" => $lang['Server_port'],
"L_SERVER_PORT_EXPLAIN" => $lang['Server_port_explain'],
"L_SCRIPT_PATH" => $lang['Script_path'],
"L_SCRIPT_PATH_EXPLAIN" => $lang['Script_path_explain'],
"L_SITE_NAME" => $lang['Site_name'],
"L_SITE_DESCRIPTION" => $lang['Site_desc'],
"L_DISABLE_BOARD" => $lang['Board_disable'],
"L_DISABLE_BOARD_EXPLAIN" => $lang['Board_disable_explain'],
"L_ACCT_ACTIVATION" => $lang['Acct_activation'],
"L_NONE" => $lang['Acc_None'],
"L_USER" => $lang['Acc_User'],
"L_ADMIN" => $lang['Acc_Admin'],
"L_VISUAL_CONFIRM" => $lang['Visual_confirm'],
"L_VISUAL_CONFIRM_EXPLAIN" => $lang['Visual_confirm_explain'],
"L_ALLOW_AUTOLOGIN" => $lang['Allow_autologin'],
"L_ALLOW_AUTOLOGIN_EXPLAIN" => $lang['Allow_autologin_explain'],
"L_AUTOLOGIN_TIME" => $lang['Autologin_time'],
"L_AUTOLOGIN_TIME_EXPLAIN" => $lang['Autologin_time_explain'],
"L_COOKIE_SETTINGS" => $lang['Cookie_settings'],
"L_COOKIE_SETTINGS_EXPLAIN" => $lang['Cookie_settings_explain'],
"L_COOKIE_DOMAIN" => $lang['Cookie_domain'],
"L_COOKIE_NAME" => $lang['Cookie_name'],
"L_COOKIE_PATH" => $lang['Cookie_path'],
"L_COOKIE_SECURE" => $lang['Cookie_secure'],
"L_COOKIE_SECURE_EXPLAIN" => $lang['Cookie_secure_explain'],
"L_SESSION_LENGTH" => $lang['Session_length'],
"L_PRIVATE_MESSAGING" => $lang['Private_Messaging'],
"L_INBOX_LIMIT" => $lang['Inbox_limits'],
"L_SENTBOX_LIMIT" => $lang['Sentbox_limits'],
"L_SAVEBOX_LIMIT" => $lang['Savebox_limits'],
"L_DISABLE_PRIVATE_MESSAGING" => $lang['Disable_privmsg'],
"L_ENABLED" => $lang['Enabled'],
"L_DISABLED" => $lang['Disabled'],
"L_ABILITIES_SETTINGS" => $lang['Abilities_settings'],
"L_MAX_POLL_OPTIONS" => $lang['Max_poll_options'],
"L_FLOOD_INTERVAL" => $lang['Flood_Interval'],
"L_FLOOD_INTERVAL_EXPLAIN" => $lang['Flood_Interval_explain'],
"L_SEARCH_FLOOD_INTERVAL" => $lang['Search_Flood_Interval'],
"L_SEARCH_FLOOD_INTERVAL_EXPLAIN" => $lang['Search_Flood_Interval_explain'],
'L_MAX_LOGIN_ATTEMPTS' => $lang['Max_login_attempts'],
'L_MAX_LOGIN_ATTEMPTS_EXPLAIN' => $lang['Max_login_attempts_explain'],
'L_LOGIN_RESET_TIME' => $lang['Login_reset_time'],
'L_LOGIN_RESET_TIME_EXPLAIN' => $lang['Login_reset_time_explain'],
'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
'LOGIN_RESET_TIME' => $new['login_reset_time'],
"L_BOARD_EMAIL_FORM" => $lang['Board_email_form'],
"L_BOARD_EMAIL_FORM_EXPLAIN" => $lang['Board_email_form_explain'],
"L_TOPICS_PER_PAGE" => $lang['Topics_per_page'],
"L_POSTS_PER_PAGE" => $lang['Posts_per_page'],
"L_HOT_THRESHOLD" => $lang['Hot_threshold'],
"L_DEFAULT_STYLE" => $lang['Default_style'],
"L_OVERRIDE_STYLE" => $lang['Override_style'],
"L_OVERRIDE_STYLE_EXPLAIN" => $lang['Override_style_explain'],
"L_DEFAULT_LANGUAGE" => $lang['Default_language'],
"L_DATE_FORMAT" => $lang['Date_format'],
"L_SYSTEM_TIMEZONE" => $lang['System_timezone'],
"L_ENABLE_GZIP" => $lang['Enable_gzip'],
"L_ENABLE_PRUNE" => $lang['Enable_prune'],
"L_ALLOW_HTML" => $lang['Allow_HTML'],
"L_ALLOW_BBCODE" => $lang['Allow_BBCode'],
"L_ALLOWED_TAGS" => $lang['Allowed_tags'],
"L_ALLOWED_TAGS_EXPLAIN" => $lang['Allowed_tags_explain'],
"L_ALLOW_SMILIES" => $lang['Allow_smilies'],
"L_SMILIES_PATH" => $lang['Smilies_path'],
"L_SMILIES_PATH_EXPLAIN" => $lang['Smilies_path_explain'],
"L_ALLOW_SIG" => $lang['Allow_sig'],
"L_MAX_SIG_LENGTH" => $lang['Max_sig_length'],
"L_MAX_SIG_LENGTH_EXPLAIN" => $lang['Max_sig_length_explain'],
"L_ALLOW_NAME_CHANGE" => $lang['Allow_name_change'],
"L_AVATAR_SETTINGS" => $lang['Avatar_settings'],
"L_ALLOW_LOCAL" => $lang['Allow_local'],
"L_ALLOW_REMOTE" => $lang['Allow_remote'],
"L_ALLOW_REMOTE_EXPLAIN" => $lang['Allow_remote_explain'],
"L_ALLOW_UPLOAD" => $lang['Allow_upload'],
"L_MAX_FILESIZE" => $lang['Max_filesize'],
"L_MAX_FILESIZE_EXPLAIN" => $lang['Max_filesize_explain'],
"L_MAX_AVATAR_SIZE" => $lang['Max_avatar_size'],
"L_MAX_AVATAR_SIZE_EXPLAIN" => $lang['Max_avatar_size_explain'],
"L_AVATAR_STORAGE_PATH" => $lang['Avatar_storage_path'],
"L_AVATAR_STORAGE_PATH_EXPLAIN" => $lang['Avatar_storage_path_explain'],
"L_AVATAR_GALLERY_PATH" => $lang['Avatar_gallery_path'],
"L_AVATAR_GALLERY_PATH_EXPLAIN" => $lang['Avatar_gallery_path_explain'],
"L_COPPA_SETTINGS" => $lang['COPPA_settings'],
"L_COPPA_FAX" => $lang['COPPA_fax'],
"L_COPPA_MAIL" => $lang['COPPA_mail'],
"L_COPPA_MAIL_EXPLAIN" => $lang['COPPA_mail_explain'],
"L_EMAIL_SETTINGS" => $lang['Email_settings'],
"L_ADMIN_EMAIL" => $lang['Admin_email'],
"L_EMAIL_SIG" => $lang['Email_sig'],
"L_EMAIL_SIG_EXPLAIN" => $lang['Email_sig_explain'],
"L_USE_SMTP" => $lang['Use_SMTP'],
"L_USE_SMTP_EXPLAIN" => $lang['Use_SMTP_explain'],
"L_SMTP_SERVER" => $lang['SMTP_server'],
"L_SMTP_USERNAME" => $lang['SMTP_username'],
"L_SMTP_USERNAME_EXPLAIN" => $lang['SMTP_username_explain'],
"L_SMTP_PASSWORD" => $lang['SMTP_password'],
"L_SMTP_PASSWORD_EXPLAIN" => $lang['SMTP_password_explain'],
"L_SUBMIT" => $lang['Submit'],
"L_RESET" => $lang['Reset'],
"SERVER_NAME" => $new['server_name'],
"SCRIPT_PATH" => $new['script_path'],
"SERVER_PORT" => $new['server_port'],
"SITENAME" => $new['sitename'],
"SITE_DESCRIPTION" => $new['site_desc'],
"S_DISABLE_BOARD_YES" => $disable_board_yes,
"S_DISABLE_BOARD_NO" => $disable_board_no,
"ACTIVATION_NONE" => USER_ACTIVATION_NONE,
"ACTIVATION_NONE_CHECKED" => $activation_none,
"ACTIVATION_USER" => USER_ACTIVATION_SELF,
"ACTIVATION_USER_CHECKED" => $activation_user,
"ACTIVATION_ADMIN" => USER_ACTIVATION_ADMIN,
"ACTIVATION_ADMIN_CHECKED" => $activation_admin,
"CONFIRM_ENABLE" => $confirm_yes,
"CONFIRM_DISABLE" => $confirm_no,
'ALLOW_AUTOLOGIN_YES' => $allow_autologin_yes,
'ALLOW_AUTOLOGIN_NO' => $allow_autologin_no,
'AUTOLOGIN_TIME' => (int) $new['max_autologin_time'],
"BOARD_EMAIL_FORM_ENABLE" => $board_email_form_yes,
"BOARD_EMAIL_FORM_DISABLE" => $board_email_form_no,
"MAX_POLL_OPTIONS" => $new['max_poll_options'],
"FLOOD_INTERVAL" => $new['flood_interval'],
"SEARCH_FLOOD_INTERVAL" => $new['search_flood_interval'],
"TOPICS_PER_PAGE" => $new['topics_per_page'],
"POSTS_PER_PAGE" => $new['posts_per_page'],
"HOT_TOPIC" => $new['hot_threshold'],
"STYLE_SELECT" => $style_select,
"OVERRIDE_STYLE_YES" => $override_user_style_yes,
"OVERRIDE_STYLE_NO" => $override_user_style_no,
"LANG_SELECT" => $lang_select,
"L_DATE_FORMAT_EXPLAIN" => $lang['Date_format_explain'],
"DEFAULT_DATEFORMAT" => $new['default_dateformat'],
"TIMEZONE_SELECT" => $timezone_select,
"S_PRIVMSG_ENABLED" => $privmsg_on,
"S_PRIVMSG_DISABLED" => $privmsg_off,
"INBOX_LIMIT" => $new['max_inbox_privmsgs'],
"SENTBOX_LIMIT" => $new['max_sentbox_privmsgs'],
"SAVEBOX_LIMIT" => $new['max_savebox_privmsgs'],
"COOKIE_DOMAIN" => $new['cookie_domain'],
"COOKIE_NAME" => $new['cookie_name'],
"COOKIE_PATH" => $new['cookie_path'],
"SESSION_LENGTH" => $new['session_length'],
"S_COOKIE_SECURE_ENABLED" => $cookie_secure_yes,
"S_COOKIE_SECURE_DISABLED" => $cookie_secure_no,
"GZIP_YES" => $gzip_yes,
"GZIP_NO" => $gzip_no,
"PRUNE_YES" => $prune_yes,
"PRUNE_NO" => $prune_no,
"HTML_TAGS" => $html_tags,
"HTML_YES" => $html_yes,
"HTML_NO" => $html_no,
"BBCODE_YES" => $bbcode_yes,
"BBCODE_NO" => $bbcode_no,
"SMILE_YES" => $smile_yes,
"SMILE_NO" => $smile_no,
"SIG_YES" => $sig_yes,
"SIG_NO" => $sig_no,
"SIG_SIZE" => $new['max_sig_chars'],
"NAMECHANGE_YES" => $namechange_yes,
"NAMECHANGE_NO" => $namechange_no,
"AVATARS_LOCAL_YES" => $avatars_local_yes,
"AVATARS_LOCAL_NO" => $avatars_local_no,
"AVATARS_REMOTE_YES" => $avatars_remote_yes,
"AVATARS_REMOTE_NO" => $avatars_remote_no,
"AVATARS_UPLOAD_YES" => $avatars_upload_yes,
"AVATARS_UPLOAD_NO" => $avatars_upload_no,
"AVATAR_FILESIZE" => $new['avatar_filesize'],
"AVATAR_MAX_HEIGHT" => $new['avatar_max_height'],
"AVATAR_MAX_WIDTH" => $new['avatar_max_width'],
"AVATAR_PATH" => $new['avatar_path'],
"AVATAR_GALLERY_PATH" => $new['avatar_gallery_path'],
"SMILIES_PATH" => $new['smilies_path'],
"INBOX_PRIVMSGS" => $new['max_inbox_privmsgs'],
"SENTBOX_PRIVMSGS" => $new['max_sentbox_privmsgs'],
"SAVEBOX_PRIVMSGS" => $new['max_savebox_privmsgs'],
"EMAIL_FROM" => $new['board_email'],
"EMAIL_SIG" => $new['board_email_sig'],
"SMTP_YES" => $smtp_yes,
"SMTP_NO" => $smtp_no,
"SMTP_HOST" => $new['smtp_host'],
"SMTP_USERNAME" => $new['smtp_username'],
"SMTP_PASSWORD" => $new['smtp_password'],
"COPPA_MAIL" => $new['coppa_mail'],
"COPPA_FAX" => $new['coppa_fax'])
);
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,146 +0,0 @@
<?php
/***************************************************************************
* admin_disallow.php
* -------------------
* begin : Tuesday, Oct 05, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['Users']['Disallow'] = $filename;
return;
}
//
// Include required files, get $phpEx and check permissions
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
if( isset($HTTP_POST_VARS['add_name']) )
{
include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
$disallowed_user = ( isset($HTTP_POST_VARS['disallowed_user']) ) ? trim($HTTP_POST_VARS['disallowed_user']) : trim($HTTP_GET_VARS['disallowed_user']);
if ($disallowed_user == '')
{
message_die(GENERAL_MESSAGE, $lang['Fields_empty']);
}
if( !validate_username($disallowed_user) )
{
$message = $lang['Disallowed_already'];
}
else
{
$sql = "INSERT INTO " . DISALLOW_TABLE . " (disallow_username)
VALUES('" . str_replace("\'", "''", $disallowed_user) . "')";
$result = $db->sql_query( $sql );
if ( !$result )
{
message_die(GENERAL_ERROR, "Could not add disallowed user.", "",__LINE__, __FILE__, $sql);
}
$message = $lang['Disallow_successful'];
}
$message .= "<br /><br />" . sprintf($lang['Click_return_disallowadmin'], "<a href=\"" . append_sid("admin_disallow.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
else if( isset($HTTP_POST_VARS['delete_name']) )
{
$disallowed_id = ( isset($HTTP_POST_VARS['disallowed_id']) ) ? intval( $HTTP_POST_VARS['disallowed_id'] ) : intval( $HTTP_GET_VARS['disallowed_id'] );
$sql = "DELETE FROM " . DISALLOW_TABLE . "
WHERE disallow_id = $disallowed_id";
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't removed disallowed user.", "",__LINE__, __FILE__, $sql);
}
$message .= $lang['Disallowed_deleted'] . "<br /><br />" . sprintf($lang['Click_return_disallowadmin'], "<a href=\"" . append_sid("admin_disallow.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
//
// Grab the current list of disallowed usernames...
//
$sql = "SELECT *
FROM " . DISALLOW_TABLE;
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't get disallowed users.", "", __LINE__, __FILE__, $sql );
}
$disallowed = $db->sql_fetchrowset($result);
//
// Ok now generate the info for the template, which will be put out no matter
// what mode we are in.
//
$disallow_select = '<select name="disallowed_id">';
if( trim($disallowed) == "" )
{
$disallow_select .= '<option value="">' . $lang['no_disallowed'] . '</option>';
}
else
{
$user = array();
for( $i = 0; $i < count($disallowed); $i++ )
{
$disallow_select .= '<option value="' . $disallowed[$i]['disallow_id'] . '">' . $disallowed[$i]['disallow_username'] . '</option>';
}
}
$disallow_select .= '</select>';
$template->set_filenames(array(
"body" => "admin/disallow_body.tpl")
);
$template->assign_vars(array(
"S_DISALLOW_SELECT" => $disallow_select,
"S_FORM_ACTION" => append_sid("admin_disallow.$phpEx"),
"L_INFO" => $output_info,
"L_DISALLOW_TITLE" => $lang['Disallow_control'],
"L_DISALLOW_EXPLAIN" => $lang['Disallow_explain'],
"L_DELETE" => $lang['Delete_disallow'],
"L_DELETE_DISALLOW" => $lang['Delete_disallow_title'],
"L_DELETE_EXPLAIN" => $lang['Delete_disallow_explain'],
"L_ADD" => $lang['Add_disallow'],
"L_ADD_DISALLOW" => $lang['Add_disallow_title'],
"L_ADD_EXPLAIN" => $lang['Add_disallow_explain'],
"L_USERNAME" => $lang['Username'])
);
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
?>

View File

@@ -1,199 +0,0 @@
<?php
/***************************************************************************
* admin_forum_prune.php
* -------------------
* begin : Mon Jul 31, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
****************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
if ( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['Forums']['Prune'] = $filename;
return;
}
//
// Load default header
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
require($phpbb_root_path . 'includes/prune.'.$phpEx);
require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
//
// Get the forum ID for pruning
//
if( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) )
{
$forum_id = ( isset($HTTP_POST_VARS[POST_FORUM_URL]) ) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
if( $forum_id == -1 )
{
$forum_sql = '';
}
else
{
$forum_id = intval($forum_id);
$forum_sql = "AND forum_id = $forum_id";
}
}
else
{
$forum_id = '';
$forum_sql = '';
}
//
// Get a list of forum's or the data for the forum that we are pruning.
//
$sql = "SELECT f.*
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id
$forum_sql
ORDER BY c.cat_order ASC, f.forum_order ASC";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain list of forums for pruning', '', __LINE__, __FILE__, $sql);
}
$forum_rows = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_rows[] = $row;
}
//
// Check for submit to be equal to Prune. If so then proceed with the pruning.
//
if( isset($HTTP_POST_VARS['doprune']) )
{
$prunedays = ( isset($HTTP_POST_VARS['prunedays']) ) ? intval($HTTP_POST_VARS['prunedays']) : 0;
// Convert days to seconds for timestamp functions...
$prunedate = time() - ( $prunedays * 86400 );
$template->set_filenames(array(
'body' => 'admin/forum_prune_result_body.tpl')
);
for($i = 0; $i < count($forum_rows); $i++)
{
$p_result = prune($forum_rows[$i]['forum_id'], $prunedate);
sync('forum', $forum_rows[$i]['forum_id']);
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('prune_results', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'FORUM_NAME' => $forum_rows[$i]['forum_name'],
'FORUM_TOPICS' => $p_result['topics'],
'FORUM_POSTS' => $p_result['posts'])
);
}
$template->assign_vars(array(
'L_FORUM_PRUNE' => $lang['Forum_Prune'],
'L_FORUM' => $lang['Forum'],
'L_TOPICS_PRUNED' => $lang['Topics_pruned'],
'L_POSTS_PRUNED' => $lang['Posts_pruned'],
'L_PRUNE_RESULT' => $lang['Prune_success'])
);
}
else
{
//
// If they haven't selected a forum for pruning yet then
// display a select box to use for pruning.
//
if( empty($HTTP_POST_VARS[POST_FORUM_URL]) )
{
//
// Output a selection table if no forum id has been specified.
//
$template->set_filenames(array(
'body' => 'admin/forum_prune_select_body.tpl')
);
$select_list = '<select name="' . POST_FORUM_URL . '">';
$select_list .= '<option value="-1">' . $lang['All_Forums'] . '</option>';
for($i = 0; $i < count($forum_rows); $i++)
{
$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
}
$select_list .= '</select>';
//
// Assign the template variables.
//
$template->assign_vars(array(
'L_FORUM_PRUNE' => $lang['Forum_Prune'],
'L_SELECT_FORUM' => $lang['Select_a_Forum'],
'L_LOOK_UP' => $lang['Look_up_Forum'],
'S_FORUMPRUNE_ACTION' => append_sid("admin_forum_prune.$phpEx"),
'S_FORUMS_SELECT' => $select_list)
);
}
else
{
$forum_id = intval($HTTP_POST_VARS[POST_FORUM_URL]);
//
// Output the form to retrieve Prune information.
//
$template->set_filenames(array(
'body' => 'admin/forum_prune_body.tpl')
);
$forum_name = ( $forum_id == -1 ) ? $lang['All_Forums'] : $forum_rows[0]['forum_name'];
$prune_data = $lang['Prune_topics_not_posted'] . " ";
$prune_data .= '<input class="post" type="text" name="prunedays" size="4"> ' . $lang['Days'];
$hidden_input = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
//
// Assign the template variables.
//
$template->assign_vars(array(
'FORUM_NAME' => $forum_name,
'L_FORUM' => $lang['Forum'],
'L_FORUM_PRUNE' => $lang['Forum_Prune'],
'L_FORUM_PRUNE_EXPLAIN' => $lang['Forum_Prune_explain'],
'L_DO_PRUNE' => $lang['Do_Prune'],
'S_FORUMPRUNE_ACTION' => append_sid("admin_forum_prune.$phpEx"),
'S_PRUNE_DATA' => $prune_data,
'S_HIDDEN_VARS' => $hidden_input)
);
}
}
//
// Actually output the page here.
//
$template->pparse('body');
include('./page_footer_admin.'.$phpEx);
?>

View File

@@ -1,328 +0,0 @@
<?php
/***************************************************************************
* admin_forumauth.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['Forums']['Permissions'] = $filename;
return;
}
//
// Load default header
//
$no_page_header = TRUE;
$phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
//
// Start program - define vars
//
// View Read Post Reply Edit Delete Sticky Announce Vote Poll
$simple_auth_ary = array(
0 => array(AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
2 => array(AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
3 => array(AUTH_ALL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL),
4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL),
5 => array(AUTH_ALL, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD),
6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD),
);
$simple_auth_types = array($lang['Public'], $lang['Registered'], $lang['Registered'] . ' [' . $lang['Hidden'] . ']', $lang['Private'], $lang['Private'] . ' [' . $lang['Hidden'] . ']', $lang['Moderators'], $lang['Moderators'] . ' [' . $lang['Hidden'] . ']');
$forum_auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_delete', 'auth_sticky', 'auth_announce', 'auth_vote', 'auth_pollcreate');
$field_names = array(
'auth_view' => $lang['View'],
'auth_read' => $lang['Read'],
'auth_post' => $lang['Post'],
'auth_reply' => $lang['Reply'],
'auth_edit' => $lang['Edit'],
'auth_delete' => $lang['Delete'],
'auth_sticky' => $lang['Sticky'],
'auth_announce' => $lang['Announce'],
'auth_vote' => $lang['Vote'],
'auth_pollcreate' => $lang['Pollcreate']);
$forum_auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN');
$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);
if(isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]))
{
$forum_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? intval($HTTP_POST_VARS[POST_FORUM_URL]) : intval($HTTP_GET_VARS[POST_FORUM_URL]);
$forum_sql = "AND forum_id = $forum_id";
}
else
{
unset($forum_id);
$forum_sql = '';
}
if( isset($HTTP_GET_VARS['adv']) )
{
$adv = intval($HTTP_GET_VARS['adv']);
}
else
{
unset($adv);
}
//
// Start program proper
//
if( isset($HTTP_POST_VARS['submit']) )
{
$sql = '';
if(!empty($forum_id))
{
if(isset($HTTP_POST_VARS['simpleauth']))
{
$simple_ary = $simple_auth_ary[intval($HTTP_POST_VARS['simpleauth'])];
for($i = 0; $i < count($simple_ary); $i++)
{
$sql .= ( ( $sql != '' ) ? ', ' : '' ) . $forum_auth_fields[$i] . ' = ' . $simple_ary[$i];
}
if (is_array($simple_ary))
{
$sql = "UPDATE " . FORUMS_TABLE . " SET $sql WHERE forum_id = $forum_id";
}
}
else
{
for($i = 0; $i < count($forum_auth_fields); $i++)
{
$value = intval($HTTP_POST_VARS[$forum_auth_fields[$i]]);
if ( $forum_auth_fields[$i] == 'auth_vote' )
{
if ( $HTTP_POST_VARS['auth_vote'] == AUTH_ALL )
{
$value = AUTH_REG;
}
}
$sql .= ( ( $sql != '' ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value;
}
$sql = "UPDATE " . FORUMS_TABLE . " SET $sql WHERE forum_id = $forum_id";
}
if ( $sql != '' )
{
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update auth table', '', __LINE__, __FILE__, $sql);
}
}
$forum_sql = '';
$adv = 0;
}
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">')
);
$message = $lang['Forum_auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_forumauth'], '<a href="' . append_sid("admin_forumauth.$phpEx") . '">', "</a>");
message_die(GENERAL_MESSAGE, $message);
} // End of submit
//
// Get required information, either all forums if
// no id was specified or just the requsted if it
// was
//
$sql = "SELECT f.*
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id
$forum_sql
ORDER BY c.cat_order ASC, f.forum_order ASC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain forum list", "", __LINE__, __FILE__, $sql);
}
$forum_rows = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
if( empty($forum_id) )
{
//
// Output the selection table if no forum id was
// specified
//
$template->set_filenames(array(
'body' => 'admin/auth_select_body.tpl')
);
$select_list = '<select name="' . POST_FORUM_URL . '">';
for($i = 0; $i < count($forum_rows); $i++)
{
$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
}
$select_list .= '</select>';
$template->assign_vars(array(
'L_AUTH_TITLE' => $lang['Auth_Control_Forum'],
'L_AUTH_EXPLAIN' => $lang['Forum_auth_explain'],
'L_AUTH_SELECT' => $lang['Select_a_Forum'],
'L_LOOK_UP' => $lang['Look_up_Forum'],
'S_AUTH_ACTION' => append_sid("admin_forumauth.$phpEx"),
'S_AUTH_SELECT' => $select_list)
);
}
else
{
//
// Output the authorisation details if an id was
// specified
//
$template->set_filenames(array(
'body' => 'admin/auth_forum_body.tpl')
);
$forum_name = $forum_rows[0]['forum_name'];
@reset($simple_auth_ary);
while( list($key, $auth_levels) = each($simple_auth_ary))
{
$matched = 1;
for($k = 0; $k < count($auth_levels); $k++)
{
$matched_type = $key;
if ( $forum_rows[0][$forum_auth_fields[$k]] != $auth_levels[$k] )
{
$matched = 0;
}
}
if ( $matched )
{
break;
}
}
//
// If we didn't get a match above then we
// automatically switch into 'advanced' mode
//
if ( !isset($adv) && !$matched )
{
$adv = 1;
}
$s_column_span == 0;
if ( empty($adv) )
{
$simple_auth = '<select name="simpleauth">';
for($j = 0; $j < count($simple_auth_types); $j++)
{
$selected = ( $matched_type == $j ) ? ' selected="selected"' : '';
$simple_auth .= '<option value="' . $j . '"' . $selected . '>' . $simple_auth_types[$j] . '</option>';
}
$simple_auth .= '</select>';
$template->assign_block_vars('forum_auth_titles', array(
'CELL_TITLE' => $lang['Simple_mode'])
);
$template->assign_block_vars('forum_auth_data', array(
'S_AUTH_LEVELS_SELECT' => $simple_auth)
);
$s_column_span++;
}
else
{
//
// Output values of individual
// fields
//
for($j = 0; $j < count($forum_auth_fields); $j++)
{
$custom_auth[$j] = '&nbsp;<select name="' . $forum_auth_fields[$j] . '">';
for($k = 0; $k < count($forum_auth_levels); $k++)
{
$selected = ( $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k] ) ? ' selected="selected"' : '';
$custom_auth[$j] .= '<option value="' . $forum_auth_const[$k] . '"' . $selected . '>' . $lang['Forum_' . $forum_auth_levels[$k]] . '</option>';
}
$custom_auth[$j] .= '</select>&nbsp;';
$cell_title = $field_names[$forum_auth_fields[$j]];
$template->assign_block_vars('forum_auth_titles', array(
'CELL_TITLE' => $cell_title)
);
$template->assign_block_vars('forum_auth_data', array(
'S_AUTH_LEVELS_SELECT' => $custom_auth[$j])
);
$s_column_span++;
}
}
$adv_mode = ( empty($adv) ) ? '1' : '0';
$switch_mode = append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&adv=". $adv_mode);
$switch_mode_text = ( empty($adv) ) ? $lang['Advanced_mode'] : $lang['Simple_mode'];
$u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>';
$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">';
$template->assign_vars(array(
'FORUM_NAME' => $forum_name,
'L_FORUM' => $lang['Forum'],
'L_AUTH_TITLE' => $lang['Auth_Control_Forum'],
'L_AUTH_EXPLAIN' => $lang['Forum_auth_explain'],
'L_SUBMIT' => $lang['Submit'],
'L_RESET' => $lang['Reset'],
'U_SWITCH_MODE' => $u_switch_mode,
'S_FORUMAUTH_ACTION' => append_sid("admin_forumauth.$phpEx"),
'S_COLUMN_SPAN' => $s_column_span,
'S_HIDDEN_FIELDS' => $s_hidden_fields)
);
}
include('./page_header_admin.'.$phpEx);
$template->pparse('body');
include('./page_footer_admin.'.$phpEx);
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,417 +0,0 @@
<?php
/***************************************************************************
* admin_groups.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', 1);
if ( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['Groups']['Manage'] = $filename;
return;
}
//
// Load default header
//
$phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
if ( isset($HTTP_POST_VARS[POST_GROUPS_URL]) || isset($HTTP_GET_VARS[POST_GROUPS_URL]) )
{
$group_id = ( isset($HTTP_POST_VARS[POST_GROUPS_URL]) ) ? intval($HTTP_POST_VARS[POST_GROUPS_URL]) : intval($HTTP_GET_VARS[POST_GROUPS_URL]);
}
else
{
$group_id = 0;
}
if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
{
$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
$mode = htmlspecialchars($mode);
}
else
{
$mode = '';
}
if ( isset($HTTP_POST_VARS['edit']) || isset($HTTP_POST_VARS['new']) )
{
//
// Ok they are editing a group or creating a new group
//
$template->set_filenames(array(
'body' => 'admin/group_edit_body.tpl')
);
if ( isset($HTTP_POST_VARS['edit']) )
{
//
// They're editing. Grab the vars.
//
$sql = "SELECT *
FROM " . GROUPS_TABLE . "
WHERE group_single_user <> " . TRUE . "
AND group_id = $group_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
}
if ( !($group_info = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_MESSAGE, $lang['Group_not_exist']);
}
$mode = 'editgroup';
$template->assign_block_vars('group_edit', array());
}
else if ( isset($HTTP_POST_VARS['new']) )
{
$group_info = array (
'group_name' => '',
'group_description' => '',
'group_moderator' => '',
'group_type' => GROUP_OPEN);
$group_open = ' checked="checked"';
$mode = 'newgroup';
}
//
// Ok, now we know everything about them, let's show the page.
//
if ($group_info['group_moderator'] != '')
{
$sql = "SELECT user_id, username
FROM " . USERS_TABLE . "
WHERE user_id = " . $group_info['group_moderator'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user info for moderator list', '', __LINE__, __FILE__, $sql);
}
if ( !($row = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user info for moderator list', '', __LINE__, __FILE__, $sql);
}
$group_moderator = $row['username'];
}
else
{
$group_moderator = '';
}
$group_open = ( $group_info['group_type'] == GROUP_OPEN ) ? ' checked="checked"' : '';
$group_closed = ( $group_info['group_type'] == GROUP_CLOSED ) ? ' checked="checked"' : '';
$group_hidden = ( $group_info['group_type'] == GROUP_HIDDEN ) ? ' checked="checked"' : '';
$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />';
$template->assign_vars(array(
'GROUP_NAME' => $group_info['group_name'],
'GROUP_DESCRIPTION' => $group_info['group_description'],
'GROUP_MODERATOR' => $group_moderator,
'L_GROUP_TITLE' => $lang['Group_administration'],
'L_GROUP_EDIT_DELETE' => ( isset($HTTP_POST_VARS['new']) ) ? $lang['New_group'] : $lang['Edit_group'],
'L_GROUP_NAME' => $lang['group_name'],
'L_GROUP_DESCRIPTION' => $lang['group_description'],
'L_GROUP_MODERATOR' => $lang['group_moderator'],
'L_FIND_USERNAME' => $lang['Find_username'],
'L_GROUP_STATUS' => $lang['group_status'],
'L_GROUP_OPEN' => $lang['group_open'],
'L_GROUP_CLOSED' => $lang['group_closed'],
'L_GROUP_HIDDEN' => $lang['group_hidden'],
'L_GROUP_DELETE' => $lang['group_delete'],
'L_GROUP_DELETE_CHECK' => $lang['group_delete_check'],
'L_SUBMIT' => $lang['Submit'],
'L_RESET' => $lang['Reset'],
'L_DELETE_MODERATOR' => $lang['delete_group_moderator'],
'L_DELETE_MODERATOR_EXPLAIN' => $lang['delete_moderator_explain'],
'L_YES' => $lang['Yes'],
'U_SEARCH_USER' => append_sid("../search.$phpEx?mode=searchuser"),
'S_GROUP_OPEN_TYPE' => GROUP_OPEN,
'S_GROUP_CLOSED_TYPE' => GROUP_CLOSED,
'S_GROUP_HIDDEN_TYPE' => GROUP_HIDDEN,
'S_GROUP_OPEN_CHECKED' => $group_open,
'S_GROUP_CLOSED_CHECKED' => $group_closed,
'S_GROUP_HIDDEN_CHECKED' => $group_hidden,
'S_GROUP_ACTION' => append_sid("admin_groups.$phpEx"),
'S_HIDDEN_FIELDS' => $s_hidden_fields)
);
$template->pparse('body');
}
else if ( isset($HTTP_POST_VARS['group_update']) )
{
//
// Ok, they are submitting a group, let's save the data based on if it's new or editing
//
if ( isset($HTTP_POST_VARS['group_delete']) )
{
//
// Reset User Moderator Level
//
// Is Group moderating a forum ?
$sql = "SELECT auth_mod FROM " . AUTH_ACCESS_TABLE . "
WHERE group_id = " . $group_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select auth_access', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
if (intval($row['auth_mod']) == 1)
{
// Yes, get the assigned users and update their Permission if they are no longer moderator of one of the forums
$sql = "SELECT user_id FROM " . USER_GROUP_TABLE . "
WHERE group_id = " . $group_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select user_group', '', __LINE__, __FILE__, $sql);
}
$rows = $db->sql_fetchrowset($result);
for ($i = 0; $i < count($rows); $i++)
{
$sql = "SELECT g.group_id FROM " . AUTH_ACCESS_TABLE . " a, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE (a.auth_mod = 1) AND (g.group_id = a.group_id) AND (a.group_id = ug.group_id) AND (g.group_id = ug.group_id)
AND (ug.user_id = " . intval($rows[$i]['user_id']) . ") AND (ug.group_id <> " . $group_id . ")";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain moderator permissions', '', __LINE__, __FILE__, $sql);
}
if ($db->sql_numrows($result) == 0)
{
$sql = "UPDATE " . USERS_TABLE . " SET user_level = " . USER . "
WHERE user_level = " . MOD . " AND user_id = " . intval($rows[$i]['user_id']);
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update moderator permissions', '', __LINE__, __FILE__, $sql);
}
}
}
}
//
// Delete Group
//
$sql = "DELETE FROM " . GROUPS_TABLE . "
WHERE group_id = " . $group_id;
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update group', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE group_id = " . $group_id;
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update user_group', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
WHERE group_id = " . $group_id;
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update auth_access', '', __LINE__, __FILE__, $sql);
}
$message = $lang['Deleted_group'] . '<br /><br />' . sprintf($lang['Click_return_groupsadmin'], '<a href="' . append_sid("admin_groups.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
$group_type = isset($HTTP_POST_VARS['group_type']) ? intval($HTTP_POST_VARS['group_type']) : GROUP_OPEN;
$group_name = isset($HTTP_POST_VARS['group_name']) ? htmlspecialchars(trim($HTTP_POST_VARS['group_name'])) : '';
$group_description = isset($HTTP_POST_VARS['group_description']) ? trim($HTTP_POST_VARS['group_description']) : '';
$group_moderator = isset($HTTP_POST_VARS['username']) ? $HTTP_POST_VARS['username'] : '';
$delete_old_moderator = isset($HTTP_POST_VARS['delete_old_moderator']) ? true : false;
if ( $group_name == '' )
{
message_die(GENERAL_MESSAGE, $lang['No_group_name']);
}
else if ( $group_moderator == '' )
{
message_die(GENERAL_MESSAGE, $lang['No_group_moderator']);
}
$this_userdata = get_userdata($group_moderator, true);
$group_moderator = $this_userdata['user_id'];
if ( !$group_moderator )
{
message_die(GENERAL_MESSAGE, $lang['No_group_moderator']);
}
if( $mode == "editgroup" )
{
$sql = "SELECT *
FROM " . GROUPS_TABLE . "
WHERE group_single_user <> " . TRUE . "
AND group_id = " . $group_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
}
if( !($group_info = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_MESSAGE, $lang['Group_not_exist']);
}
if ( $group_info['group_moderator'] != $group_moderator )
{
if ( $delete_old_moderator )
{
$sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE user_id = " . $group_info['group_moderator'] . "
AND group_id = " . $group_id;
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update group moderator', '', __LINE__, __FILE__, $sql);
}
}
$sql = "SELECT user_id
FROM " . USER_GROUP_TABLE . "
WHERE user_id = $group_moderator
AND group_id = $group_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Failed to obtain current group moderator info', '', __LINE__, __FILE__, $sql);
}
if ( !($row = $db->sql_fetchrow($result)) )
{
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES (" . $group_id . ", " . $group_moderator . ", 0)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update group moderator', '', __LINE__, __FILE__, $sql);
}
}
}
$sql = "UPDATE " . GROUPS_TABLE . "
SET group_type = $group_type, group_name = '" . str_replace("\'", "''", $group_name) . "', group_description = '" . str_replace("\'", "''", $group_description) . "', group_moderator = $group_moderator
WHERE group_id = $group_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update group', '', __LINE__, __FILE__, $sql);
}
$message = $lang['Updated_group'] . '<br /><br />' . sprintf($lang['Click_return_groupsadmin'], '<a href="' . append_sid("admin_groups.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');;
message_die(GENERAL_MESSAGE, $message);
}
else if( $mode == 'newgroup' )
{
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_type, group_name, group_description, group_moderator, group_single_user)
VALUES ($group_type, '" . str_replace("\'", "''", $group_name) . "', '" . str_replace("\'", "''", $group_description) . "', $group_moderator, '0')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not insert new group', '', __LINE__, __FILE__, $sql);
}
$new_group_id = $db->sql_nextid();
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES ($new_group_id, $group_moderator, 0)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not insert new user-group info', '', __LINE__, __FILE__, $sql);
}
$message = $lang['Added_new_group'] . '<br /><br />' . sprintf($lang['Click_return_groupsadmin'], '<a href="' . append_sid("admin_groups.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');;
message_die(GENERAL_MESSAGE, $message);
}
else
{
message_die(GENERAL_MESSAGE, $lang['No_group_action']);
}
}
}
else
{
$sql = "SELECT group_id, group_name
FROM " . GROUPS_TABLE . "
WHERE group_single_user <> " . TRUE . "
ORDER BY group_name";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain group list', '', __LINE__, __FILE__, $sql);
}
$select_list = '';
if ( $row = $db->sql_fetchrow($result) )
{
$select_list .= '<select name="' . POST_GROUPS_URL . '">';
do
{
$select_list .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
}
while ( $row = $db->sql_fetchrow($result) );
$select_list .= '</select>';
}
$template->set_filenames(array(
'body' => 'admin/group_select_body.tpl')
);
$template->assign_vars(array(
'L_GROUP_TITLE' => $lang['Group_administration'],
'L_GROUP_EXPLAIN' => $lang['Group_admin_explain'],
'L_GROUP_SELECT' => $lang['Select_group'],
'L_LOOK_UP' => $lang['Look_up_group'],
'L_CREATE_NEW_GROUP' => $lang['New_group'],
'S_GROUP_ACTION' => append_sid("admin_groups.$phpEx"),
'S_GROUP_SELECT' => $select_list)
);
if ( $select_list != '' )
{
$template->assign_block_vars('select_box', array());
}
$template->pparse('body');
}
include('./page_footer_admin.'.$phpEx);
?>

View File

@@ -1,213 +0,0 @@
<?php
/***************************************************************************
* admin_mass_email.php
* -------------------
* begin : Thu May 31, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
****************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['General']['Mass_Email'] = $filename;
return;
}
//
// Load default header
//
$no_page_header = TRUE;
$phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
//
// Increase maximum execution time in case of a lot of users, but don't complain about it if it isn't
// allowed.
//
@set_time_limit(1200);
$message = '';
$subject = '';
//
// Do the job ...
//
if ( isset($HTTP_POST_VARS['submit']) )
{
$subject = stripslashes(trim($HTTP_POST_VARS['subject']));
$message = stripslashes(trim($HTTP_POST_VARS['message']));
$error = FALSE;
$error_msg = '';
if ( empty($subject) )
{
$error = true;
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_subject'] : $lang['Empty_subject'];
}
if ( empty($message) )
{
$error = true;
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_message'] : $lang['Empty_message'];
}
$group_id = intval($HTTP_POST_VARS[POST_GROUPS_URL]);
$sql = ( $group_id != -1 ) ? "SELECT u.user_email FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select group members', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$bcc_list = array();
do
{
$bcc_list[] = $row['user_email'];
}
while ( $row = $db->sql_fetchrow($result) );
$db->sql_freeresult($result);
}
else
{
$message = ( $group_id != -1 ) ? $lang['Group_not_exist'] : $lang['No_such_user'];
$error = true;
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $message : $message;
}
if ( !$error )
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
//
// Let's do some checking to make sure that mass mail functions
// are working in win32 versions of php.
//
if ( preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery'])
{
$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
// We are running on windows, force delivery to use our smtp functions
// since php's are broken by default
$board_config['smtp_delivery'] = 1;
$board_config['smtp_host'] = @$ini_val('SMTP');
}
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
for ($i = 0; $i < count($bcc_list); $i++)
{
$emailer->bcc($bcc_list[$i]);
}
$email_headers = 'X-AntiAbuse: Board servername - ' . $board_config['server_name'] . "\n";
$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
$email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
$emailer->use_template('admin_send_email');
$emailer->email_address($board_config['board_email']);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'BOARD_EMAIL' => $board_config['board_email'],
'MESSAGE' => $message)
);
$emailer->send();
$emailer->reset();
message_die(GENERAL_MESSAGE, $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'));
}
}
if ( $error )
{
$template->set_filenames(array(
'reg_header' => 'error_body.tpl')
);
$template->assign_vars(array(
'ERROR_MESSAGE' => $error_msg)
);
$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
}
//
// Initial selection
//
$sql = "SELECT group_id, group_name
FROM ".GROUPS_TABLE . "
WHERE group_single_user <> 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain list of groups', '', __LINE__, __FILE__, $sql);
}
$select_list = '<select name = "' . POST_GROUPS_URL . '"><option value = "-1">' . $lang['All_users'] . '</option>';
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$select_list .= '<option value = "' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
}
while ( $row = $db->sql_fetchrow($result) );
}
$select_list .= '</select>';
//
// Generate page
//
include('./page_header_admin.'.$phpEx);
$template->set_filenames(array(
'body' => 'admin/user_email_body.tpl')
);
$template->assign_vars(array(
'MESSAGE' => $message,
'SUBJECT' => $subject,
'L_EMAIL_TITLE' => $lang['Email'],
'L_EMAIL_EXPLAIN' => $lang['Mass_email_explain'],
'L_COMPOSE' => $lang['Compose'],
'L_RECIPIENTS' => $lang['Recipients'],
'L_EMAIL_SUBJECT' => $lang['Subject'],
'L_EMAIL_MSG' => $lang['Message'],
'L_EMAIL' => $lang['Email'],
'L_NOTICE' => $notice,
'S_USER_ACTION' => append_sid('admin_mass_email.'.$phpEx),
'S_GROUP_SELECT' => $select_list)
);
$template->pparse('body');
include('./page_footer_admin.'.$phpEx);
?>

View File

@@ -1,349 +0,0 @@
<?php
/***************************************************************************
* admin_ranks.php
* -------------------
* begin : Thursday, Jul 12, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if( !empty($setmodules) )
{
$file = basename(__FILE__);
$module['Users']['Ranks'] = $file;
return;
}
define('IN_PHPBB', 1);
//
// Let's set the root dir for phpBB
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
$cancel = ( isset($HTTP_POST_VARS['cancel']) || isset($_POST['cancel']) ) ? true : false;
$no_page_header = $cancel;
require('./pagestart.' . $phpEx);
if ($cancel)
{
redirect('admin/' . append_sid("admin_ranks.$phpEx", true));
}
if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
$mode = (isset($HTTP_GET_VARS['mode'])) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
$mode = htmlspecialchars($mode);
}
else
{
//
// These could be entered via a form button
//
if( isset($HTTP_POST_VARS['add']) )
{
$mode = "add";
}
else if( isset($HTTP_POST_VARS['save']) )
{
$mode = "save";
}
else
{
$mode = "";
}
}
// Restrict mode input to valid options
$mode = ( in_array($mode, array('add', 'edit', 'save', 'delete')) ) ? $mode : '';
if( $mode != "" )
{
if( $mode == "edit" || $mode == "add" )
{
//
// They want to add a new rank, show the form.
//
$rank_id = ( isset($HTTP_GET_VARS['id']) ) ? intval($HTTP_GET_VARS['id']) : 0;
$s_hidden_fields = "";
if( $mode == "edit" )
{
if( empty($rank_id) )
{
message_die(GENERAL_MESSAGE, $lang['Must_select_rank']);
}
$sql = "SELECT * FROM " . RANKS_TABLE . "
WHERE rank_id = $rank_id";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain rank data", "", __LINE__, __FILE__, $sql);
}
$rank_info = $db->sql_fetchrow($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $rank_id . '" />';
}
else
{
$rank_info['rank_special'] = 0;
}
$s_hidden_fields .= '<input type="hidden" name="mode" value="save" />';
$rank_is_special = ( $rank_info['rank_special'] ) ? "checked=\"checked\"" : "";
$rank_is_not_special = ( !$rank_info['rank_special'] ) ? "checked=\"checked\"" : "";
$template->set_filenames(array(
"body" => "admin/ranks_edit_body.tpl")
);
$template->assign_vars(array(
"RANK" => $rank_info['rank_title'],
"SPECIAL_RANK" => $rank_is_special,
"NOT_SPECIAL_RANK" => $rank_is_not_special,
"MINIMUM" => ( $rank_is_special ) ? "" : $rank_info['rank_min'],
"IMAGE" => ( $rank_info['rank_image'] != "" ) ? $rank_info['rank_image'] : "",
"IMAGE_DISPLAY" => ( $rank_info['rank_image'] != "" ) ? '<img src="../' . $rank_info['rank_image'] . '" />' : "",
"L_RANKS_TITLE" => $lang['Ranks_title'],
"L_RANKS_TEXT" => $lang['Ranks_explain'],
"L_RANK_TITLE" => $lang['Rank_title'],
"L_RANK_SPECIAL" => $lang['Rank_special'],
"L_RANK_MINIMUM" => $lang['Rank_minimum'],
"L_RANK_IMAGE" => $lang['Rank_image'],
"L_RANK_IMAGE_EXPLAIN" => $lang['Rank_image_explain'],
"L_SUBMIT" => $lang['Submit'],
"L_RESET" => $lang['Reset'],
"L_YES" => $lang['Yes'],
"L_NO" => $lang['No'],
"S_RANK_ACTION" => append_sid("admin_ranks.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields)
);
}
else if( $mode == "save" )
{
//
// Ok, they sent us our info, let's update it.
//
$rank_id = ( isset($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : 0;
$rank_title = ( isset($HTTP_POST_VARS['title']) ) ? trim($HTTP_POST_VARS['title']) : "";
$special_rank = ( $HTTP_POST_VARS['special_rank'] == 1 ) ? TRUE : 0;
$min_posts = ( isset($HTTP_POST_VARS['min_posts']) ) ? intval($HTTP_POST_VARS['min_posts']) : -1;
$rank_image = ( (isset($HTTP_POST_VARS['rank_image'])) ) ? trim($HTTP_POST_VARS['rank_image']) : "";
if( $rank_title == "" )
{
message_die(GENERAL_MESSAGE, $lang['Must_select_rank']);
}
if( $special_rank == 1 )
{
$max_posts = -1;
$min_posts = -1;
}
//
// The rank image has to be a jpg, gif or png
//
if($rank_image != "")
{
if ( !preg_match("/(\.gif|\.png|\.jpg)$/is", $rank_image))
{
$rank_image = "";
}
}
if ($rank_id)
{
if (!$special_rank)
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_rank = 0
WHERE user_rank = $rank_id";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, $lang['No_update_ranks'], "", __LINE__, __FILE__, $sql);
}
}
$sql = "UPDATE " . RANKS_TABLE . "
SET rank_title = '" . str_replace("\'", "''", $rank_title) . "', rank_special = $special_rank, rank_min = $min_posts, rank_image = '" . str_replace("\'", "''", $rank_image) . "'
WHERE rank_id = $rank_id";
$message = $lang['Rank_updated'];
}
else
{
$sql = "INSERT INTO " . RANKS_TABLE . " (rank_title, rank_special, rank_min, rank_image)
VALUES ('" . str_replace("\'", "''", $rank_title) . "', $special_rank, $min_posts, '" . str_replace("\'", "''", $rank_image) . "')";
$message = $lang['Rank_added'];
}
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update/insert into ranks table", "", __LINE__, __FILE__, $sql);
}
$message .= "<br /><br />" . sprintf($lang['Click_return_rankadmin'], "<a href=\"" . append_sid("admin_ranks.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
else if( $mode == "delete" )
{
//
// Ok, they want to delete their rank
//
if( isset($HTTP_POST_VARS['id']) || isset($HTTP_GET_VARS['id']) )
{
$rank_id = ( isset($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : intval($HTTP_GET_VARS['id']);
}
else
{
$rank_id = 0;
}
$confirm = isset($HTTP_POST_VARS['confirm']);
if( $rank_id && $confirm )
{
$sql = "DELETE FROM " . RANKS_TABLE . "
WHERE rank_id = $rank_id";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete rank data", "", __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . USERS_TABLE . "
SET user_rank = 0
WHERE user_rank = $rank_id";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, $lang['No_update_ranks'], "", __LINE__, __FILE__, $sql);
}
$message = $lang['Rank_removed'] . "<br /><br />" . sprintf($lang['Click_return_rankadmin'], "<a href=\"" . append_sid("admin_ranks.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
elseif( $rank_id && !$confirm)
{
// Present the confirmation screen to the user
$template->set_filenames(array(
'body' => 'admin/confirm_body.tpl')
);
$hidden_fields = '<input type="hidden" name="mode" value="delete" /><input type="hidden" name="id" value="' . $rank_id . '" />';
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['Confirm'],
'MESSAGE_TEXT' => $lang['Confirm_delete_rank'],
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_CONFIRM_ACTION' => append_sid("admin_ranks.$phpEx"),
'S_HIDDEN_FIELDS' => $hidden_fields)
);
}
else
{
message_die(GENERAL_MESSAGE, $lang['Must_select_rank']);
}
}
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
}
//
// Show the default page
//
$template->set_filenames(array(
"body" => "admin/ranks_list_body.tpl")
);
$sql = "SELECT * FROM " . RANKS_TABLE . "
ORDER BY rank_min ASC, rank_special ASC";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain ranks data", "", __LINE__, __FILE__, $sql);
}
$rank_count = $db->sql_numrows($result);
$rank_rows = $db->sql_fetchrowset($result);
$template->assign_vars(array(
"L_RANKS_TITLE" => $lang['Ranks_title'],
"L_RANKS_TEXT" => $lang['Ranks_explain'],
"L_RANK" => $lang['Rank_title'],
"L_RANK_MINIMUM" => $lang['Rank_minimum'],
"L_SPECIAL_RANK" => $lang['Rank_special'],
"L_EDIT" => $lang['Edit'],
"L_DELETE" => $lang['Delete'],
"L_ADD_RANK" => $lang['Add_new_rank'],
"L_ACTION" => $lang['Action'],
"S_RANKS_ACTION" => append_sid("admin_ranks.$phpEx"))
);
for($i = 0; $i < $rank_count; $i++)
{
$rank = $rank_rows[$i]['rank_title'];
$special_rank = $rank_rows[$i]['rank_special'];
$rank_id = $rank_rows[$i]['rank_id'];
$rank_min = $rank_rows[$i]['rank_min'];
if( $special_rank == 1 )
{
$rank_min = $rank_max = "-";
}
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$rank_is_special = ( $special_rank ) ? $lang['Yes'] : $lang['No'];
$template->assign_block_vars("ranks", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"RANK" => $rank,
"SPECIAL_RANK" => $rank_is_special,
"RANK_MIN" => $rank_min,
"U_RANK_EDIT" => append_sid("admin_ranks.$phpEx?mode=edit&amp;id=$rank_id"),
"U_RANK_DELETE" => append_sid("admin_ranks.$phpEx?mode=delete&amp;id=$rank_id"))
);
}
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
?>

View File

@@ -1,594 +0,0 @@
<?php
/***************************************************************************
* admin_smilies.php
* -------------------
* begin : Thu May 31, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
****************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
/**************************************************************************
* This file will be used for modifying the smiley settings for a board.
**************************************************************************/
define('IN_PHPBB', 1);
//
// First we do the setmodules stuff for the admin cp.
//
if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['General']['Smilies'] = $filename;
return;
}
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
$cancel = ( isset($HTTP_POST_VARS['cancel']) || isset($_POST['cancel']) ) ? true : false;
$no_page_header = $cancel;
//
// Load default header
//
if ((!empty($HTTP_GET_VARS['export_pack']) && $HTTP_GET_VARS['export_pack'] == 'send') || (!empty($_GET['export_pack']) && $_GET['export_pack'] == 'send'))
{
$no_page_header = true;
}
require('./pagestart.' . $phpEx);
if ($cancel)
{
redirect('admin/' . append_sid("admin_smilies.$phpEx", true));
}
//
// Check to see what mode we should operate in.
//
if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
{
$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
$mode = htmlspecialchars($mode);
}
else
{
$mode = "";
}
$delimeter = '=+:';
//
// Read a listing of uploaded smilies for use in the add or edit smliey code...
//
$dir = @opendir($phpbb_root_path . $board_config['smilies_path']);
while($file = @readdir($dir))
{
if( !@is_dir(phpbb_realpath($phpbb_root_path . $board_config['smilies_path'] . '/' . $file)) )
{
$img_size = @getimagesize($phpbb_root_path . $board_config['smilies_path'] . '/' . $file);
if( $img_size[0] && $img_size[1] )
{
$smiley_images[] = $file;
}
else if( eregi('.pak$', $file) )
{
$smiley_paks[] = $file;
}
}
}
@closedir($dir);
//
// Select main mode
//
if( isset($HTTP_GET_VARS['import_pack']) || isset($HTTP_POST_VARS['import_pack']) )
{
//
// Import a list a "Smiley Pack"
//
$smile_pak = ( isset($HTTP_POST_VARS['smile_pak']) ) ? $HTTP_POST_VARS['smile_pak'] : $HTTP_GET_VARS['smile_pak'];
$clear_current = ( isset($HTTP_POST_VARS['clear_current']) ) ? $HTTP_POST_VARS['clear_current'] : $HTTP_GET_VARS['clear_current'];
$replace_existing = ( isset($HTTP_POST_VARS['replace']) ) ? $HTTP_POST_VARS['replace'] : $HTTP_GET_VARS['replace'];
if ( !empty($smile_pak) )
{
//
// The user has already selected a smile_pak file.. Import it.
//
if( !empty($clear_current) )
{
$sql = "DELETE
FROM " . SMILIES_TABLE;
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete current smilies", "", __LINE__, __FILE__, $sql);
}
}
else
{
$sql = "SELECT code
FROM ". SMILIES_TABLE;
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't get current smilies", "", __LINE__, __FILE__, $sql);
}
$cur_smilies = $db->sql_fetchrowset($result);
for( $i = 0; $i < count($cur_smilies); $i++ )
{
$k = $cur_smilies[$i]['code'];
$smiles[$k] = 1;
}
}
$fcontents = @file($phpbb_root_path . $board_config['smilies_path'] . '/'. $smile_pak);
if( empty($fcontents) )
{
message_die(GENERAL_ERROR, "Couldn't read smiley pak file", "", __LINE__, __FILE__, $sql);
}
for( $i = 0; $i < count($fcontents); $i++ )
{
$smile_data = explode($delimeter, trim(addslashes($fcontents[$i])));
for( $j = 2; $j < count($smile_data); $j++)
{
//
// Replace > and < with the proper html_entities for matching.
//
$smile_data[$j] = str_replace("<", "&lt;", $smile_data[$j]);
$smile_data[$j] = str_replace(">", "&gt;", $smile_data[$j]);
$k = $smile_data[$j];
if( $smiles[$k] == 1 )
{
if( !empty($replace_existing) )
{
$sql = "UPDATE " . SMILIES_TABLE . "
SET smile_url = '" . str_replace("\'", "''", $smile_data[0]) . "', emoticon = '" . str_replace("\'", "''", $smile_data[1]) . "'
WHERE code = '" . str_replace("\'", "''", $smile_data[$j]) . "'";
}
else
{
$sql = '';
}
}
else
{
$sql = "INSERT INTO " . SMILIES_TABLE . " (code, smile_url, emoticon)
VALUES('" . str_replace("\'", "''", $smile_data[$j]) . "', '" . str_replace("\'", "''", $smile_data[0]) . "', '" . str_replace("\'", "''", $smile_data[1]) . "')";
}
if( $sql != '' )
{
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't update smilies!", "", __LINE__, __FILE__, $sql);
}
}
}
}
$message = $lang['smiley_import_success'] . "<br /><br />" . sprintf($lang['Click_return_smileadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
else
{
//
// Display the script to get the smile_pak cfg file...
//
$smile_paks_select = "<select name='smile_pak'><option value=''>" . $lang['Select_pak'] . "</option>";
while( list($key, $value) = @each($smiley_paks) )
{
if ( !empty($value) )
{
$smile_paks_select .= "<option>" . $value . "</option>";
}
}
$smile_paks_select .= "</select>";
$hidden_vars = "<input type='hidden' name='mode' value='import'>";
$template->set_filenames(array(
"body" => "admin/smile_import_body.tpl")
);
$template->assign_vars(array(
"L_SMILEY_TITLE" => $lang['smiley_title'],
"L_SMILEY_EXPLAIN" => $lang['smiley_import_inst'],
"L_SMILEY_IMPORT" => $lang['smiley_import'],
"L_SELECT_LBL" => $lang['choose_smile_pak'],
"L_IMPORT" => $lang['import'],
"L_CONFLICTS" => $lang['smile_conflicts'],
"L_DEL_EXISTING" => $lang['del_existing_smileys'],
"L_REPLACE_EXISTING" => $lang['replace_existing'],
"L_KEEP_EXISTING" => $lang['keep_existing'],
"S_SMILEY_ACTION" => append_sid("admin_smilies.$phpEx"),
"S_SMILE_SELECT" => $smile_paks_select,
"S_HIDDEN_FIELDS" => $hidden_vars)
);
$template->pparse("body");
}
}
else if( isset($HTTP_POST_VARS['export_pack']) || isset($HTTP_GET_VARS['export_pack']) )
{
//
// Export our smiley config as a smiley pak...
//
if ( $HTTP_GET_VARS['export_pack'] == "send" )
{
$sql = "SELECT *
FROM " . SMILIES_TABLE;
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not get smiley list", "", __LINE__, __FILE__, $sql);
}
$resultset = $db->sql_fetchrowset($result);
$smile_pak = "";
for($i = 0; $i < count($resultset); $i++ )
{
$smile_pak .= $resultset[$i]['smile_url'] . $delimeter;
$smile_pak .= $resultset[$i]['emoticon'] . $delimeter;
$smile_pak .= $resultset[$i]['code'] . "\n";
}
header("Content-Type: text/x-delimtext; name=\"smiles.pak\"");
header("Content-disposition: attachment; filename=smiles.pak");
echo $smile_pak;
exit;
}
$message = sprintf($lang['export_smiles'], "<a href=\"" . append_sid("admin_smilies.$phpEx?export_pack=send", true) . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_smileadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
else if( isset($HTTP_POST_VARS['add']) || isset($HTTP_GET_VARS['add']) )
{
//
// Admin has selected to add a smiley.
//
$template->set_filenames(array(
"body" => "admin/smile_edit_body.tpl")
);
$filename_list = "";
for( $i = 0; $i < count($smiley_images); $i++ )
{
$filename_list .= '<option value="' . $smiley_images[$i] . '">' . $smiley_images[$i] . '</option>';
}
$s_hidden_fields = '<input type="hidden" name="mode" value="savenew" />';
$template->assign_vars(array(
"L_SMILEY_TITLE" => $lang['smiley_title'],
"L_SMILEY_CONFIG" => $lang['smiley_config'],
"L_SMILEY_EXPLAIN" => $lang['smile_desc'],
"L_SMILEY_CODE" => $lang['smiley_code'],
"L_SMILEY_URL" => $lang['smiley_url'],
"L_SMILEY_EMOTION" => $lang['smiley_emot'],
"L_SUBMIT" => $lang['Submit'],
"L_RESET" => $lang['Reset'],
"SMILEY_IMG" => $phpbb_root_path . $board_config['smilies_path'] . '/' . $smiley_images[0],
"S_SMILEY_ACTION" => append_sid("admin_smilies.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields,
"S_FILENAME_OPTIONS" => $filename_list,
"S_SMILEY_BASEDIR" => $phpbb_root_path . $board_config['smilies_path'])
);
$template->pparse("body");
}
else if ( $mode != "" )
{
switch( $mode )
{
case 'delete':
//
// Admin has selected to delete a smiley.
//
$smiley_id = ( !empty($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id'];
$smiley_id = intval($smiley_id);
$confirm = isset($HTTP_POST_VARS['confirm']);
if( $confirm )
{
$sql = "DELETE FROM " . SMILIES_TABLE . "
WHERE smilies_id = " . $smiley_id;
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't delete smiley", "", __LINE__, __FILE__, $sql);
}
$message = $lang['smiley_del_success'] . "<br /><br />" . sprintf($lang['Click_return_smileadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
else
{
// Present the confirmation screen to the user
$template->set_filenames(array(
'body' => 'admin/confirm_body.tpl')
);
$hidden_fields = '<input type="hidden" name="mode" value="delete" /><input type="hidden" name="id" value="' . $smiley_id . '" />';
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['Confirm'],
'MESSAGE_TEXT' => $lang['Confirm_delete_smiley'],
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_CONFIRM_ACTION' => append_sid("admin_smilies.$phpEx"),
'S_HIDDEN_FIELDS' => $hidden_fields)
);
$template->pparse('body');
}
break;
case 'edit':
//
// Admin has selected to edit a smiley.
//
$smiley_id = ( !empty($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id'];
$smiley_id = intval($smiley_id);
$sql = "SELECT *
FROM " . SMILIES_TABLE . "
WHERE smilies_id = " . $smiley_id;
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, 'Could not obtain emoticon information', "", __LINE__, __FILE__, $sql);
}
$smile_data = $db->sql_fetchrow($result);
$filename_list = "";
for( $i = 0; $i < count($smiley_images); $i++ )
{
if( $smiley_images[$i] == $smile_data['smile_url'] )
{
$smiley_selected = "selected=\"selected\"";
$smiley_edit_img = $smiley_images[$i];
}
else
{
$smiley_selected = "";
}
$filename_list .= '<option value="' . $smiley_images[$i] . '"' . $smiley_selected . '>' . $smiley_images[$i] . '</option>';
}
$template->set_filenames(array(
"body" => "admin/smile_edit_body.tpl")
);
$s_hidden_fields = '<input type="hidden" name="mode" value="save" /><input type="hidden" name="smile_id" value="' . $smile_data['smilies_id'] . '" />';
$template->assign_vars(array(
"SMILEY_CODE" => $smile_data['code'],
"SMILEY_EMOTICON" => $smile_data['emoticon'],
"L_SMILEY_TITLE" => $lang['smiley_title'],
"L_SMILEY_CONFIG" => $lang['smiley_config'],
"L_SMILEY_EXPLAIN" => $lang['smile_desc'],
"L_SMILEY_CODE" => $lang['smiley_code'],
"L_SMILEY_URL" => $lang['smiley_url'],
"L_SMILEY_EMOTION" => $lang['smiley_emot'],
"L_SUBMIT" => $lang['Submit'],
"L_RESET" => $lang['Reset'],
"SMILEY_IMG" => $phpbb_root_path . $board_config['smilies_path'] . '/' . $smiley_edit_img,
"S_SMILEY_ACTION" => append_sid("admin_smilies.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields,
"S_FILENAME_OPTIONS" => $filename_list,
"S_SMILEY_BASEDIR" => $phpbb_root_path . $board_config['smilies_path'])
);
$template->pparse("body");
break;
case "save":
//
// Admin has submitted changes while editing a smiley.
//
//
// Get the submitted data, being careful to ensure that we only
// accept the data we are looking for.
//
$smile_code = ( isset($HTTP_POST_VARS['smile_code']) ) ? trim($HTTP_POST_VARS['smile_code']) : '';
$smile_url = ( isset($HTTP_POST_VARS['smile_url']) ) ? trim($HTTP_POST_VARS['smile_url']) : '';
$smile_url = phpbb_ltrim(basename($smile_url), "'");
$smile_emotion = ( isset($HTTP_POST_VARS['smile_emotion']) ) ? htmlspecialchars(trim($HTTP_POST_VARS['smile_emotion'])) : '';
$smile_id = ( isset($HTTP_POST_VARS['smile_id']) ) ? intval($HTTP_POST_VARS['smile_id']) : 0;
$smile_code = trim($smile_code);
$smile_url = trim($smile_url);
// If no code was entered complain ...
if ($smile_code == '' || $smile_url == '')
{
message_die(GENERAL_MESSAGE, $lang['Fields_empty']);
}
//
// Convert < and > to proper htmlentities for parsing.
//
$smile_code = str_replace('<', '&lt;', $smile_code);
$smile_code = str_replace('>', '&gt;', $smile_code);
//
// Proceed with updating the smiley table.
//
$sql = "UPDATE " . SMILIES_TABLE . "
SET code = '" . str_replace("\'", "''", $smile_code) . "', smile_url = '" . str_replace("\'", "''", $smile_url) . "', emoticon = '" . str_replace("\'", "''", $smile_emotion) . "'
WHERE smilies_id = $smile_id";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't update smilies info", "", __LINE__, __FILE__, $sql);
}
$message = $lang['smiley_edit_success'] . "<br /><br />" . sprintf($lang['Click_return_smileadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
break;
case "savenew":
//
// Admin has submitted changes while adding a new smiley.
//
//
// Get the submitted data being careful to ensure the the data
// we recieve and process is only the data we are looking for.
//
$smile_code = ( isset($HTTP_POST_VARS['smile_code']) ) ? $HTTP_POST_VARS['smile_code'] : '';
$smile_url = ( isset($HTTP_POST_VARS['smile_url']) ) ? $HTTP_POST_VARS['smile_url'] : '';
$smile_url = phpbb_ltrim(basename($smile_url), "'");
$smile_emotion = ( isset($HTTP_POST_VARS['smile_emotion']) ) ? htmlspecialchars(trim($HTTP_POST_VARS['smile_emotion'])) : '';
$smile_code = trim($smile_code);
$smile_url = trim($smile_url);
// If no code was entered complain ...
if ($smile_code == '' || $smile_url == '')
{
message_die(GENERAL_MESSAGE, $lang['Fields_empty']);
}
//
// Convert < and > to proper htmlentities for parsing.
//
$smile_code = str_replace('<', '&lt;', $smile_code);
$smile_code = str_replace('>', '&gt;', $smile_code);
//
// Save the data to the smiley table.
//
$sql = "INSERT INTO " . SMILIES_TABLE . " (code, smile_url, emoticon)
VALUES ('" . str_replace("\'", "''", $smile_code) . "', '" . str_replace("\'", "''", $smile_url) . "', '" . str_replace("\'", "''", $smile_emotion) . "')";
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't insert new smiley", "", __LINE__, __FILE__, $sql);
}
$message = $lang['smiley_add_success'] . "<br /><br />" . sprintf($lang['Click_return_smileadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
break;
}
}
else
{
//
// This is the main display of the page before the admin has selected
// any options.
//
$sql = "SELECT *
FROM " . SMILIES_TABLE;
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't obtain smileys from database", "", __LINE__, __FILE__, $sql);
}
$smilies = $db->sql_fetchrowset($result);
$template->set_filenames(array(
"body" => "admin/smile_list_body.tpl")
);
$template->assign_vars(array(
"L_ACTION" => $lang['Action'],
"L_SMILEY_TITLE" => $lang['smiley_title'],
"L_SMILEY_TEXT" => $lang['smile_desc'],
"L_DELETE" => $lang['Delete'],
"L_EDIT" => $lang['Edit'],
"L_SMILEY_ADD" => $lang['smile_add'],
"L_CODE" => $lang['Code'],
"L_EMOT" => $lang['Emotion'],
"L_SMILE" => $lang['Smile'],
"L_IMPORT_PACK" => $lang['import_smile_pack'],
"L_EXPORT_PACK" => $lang['export_smile_pack'],
"S_HIDDEN_FIELDS" => $s_hidden_fields,
"S_SMILEY_ACTION" => append_sid("admin_smilies.$phpEx"))
);
//
// Loop throuh the rows of smilies setting block vars for the template.
//
for($i = 0; $i < count($smilies); $i++)
{
//
// Replace htmlentites for < and > with actual character.
//
$smilies[$i]['code'] = str_replace('&lt;', '<', $smilies[$i]['code']);
$smilies[$i]['code'] = str_replace('&gt;', '>', $smilies[$i]['code']);
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars("smiles", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"SMILEY_IMG" => $phpbb_root_path . $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'],
"CODE" => $smilies[$i]['code'],
"EMOT" => $smilies[$i]['emoticon'],
"U_SMILEY_EDIT" => append_sid("admin_smilies.$phpEx?mode=edit&amp;id=" . $smilies[$i]['smilies_id']),
"U_SMILEY_DELETE" => append_sid("admin_smilies.$phpEx?mode=delete&amp;id=" . $smilies[$i]['smilies_id']))
);
}
//
// Spit out the page.
//
$template->pparse("body");
}
//
// Page Footer
//
include('./page_footer_admin.'.$phpEx);
?>

View File

@@ -1,941 +0,0 @@
<?php
/***************************************************************************
* admin_styles.php
* -------------------
* begin : Thursday, Jul 12, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$file = basename(__FILE__);
$module['Styles']['Add_new'] = "$file?mode=addnew";
$module['Styles']['Create_new'] = "$file?mode=create";
$module['Styles']['Manage'] = $file;
$module['Styles']['Export'] = "$file?mode=export";
return;
}
//
// Load default header
//
//
// Check if the user has cancled a confirmation message.
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
$confirm = (isset($HTTP_POST_VARS['confirm']) || isset($_POST['confirm'])) ? TRUE : FALSE;
$cancel = (isset($HTTP_POST_VARS['cancel']) || isset($_POST['cancel'])) ? TRUE : FALSE;
$no_page_header = (!empty($HTTP_POST_VARS['send_file']) || !empty($_POST['send_file']) || $cancel) ? TRUE : FALSE;
require('./pagestart.' . $phpEx);
$confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : FALSE;
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : FALSE;
if ($cancel)
{
redirect('admin/' . append_sid("admin_styles.$phpEx", true));
}
if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
$mode = htmlspecialchars($mode);
}
else
{
$mode = "";
}
switch( $mode )
{
case "addnew":
$install_to = ( isset($HTTP_GET_VARS['install_to']) ) ? urldecode($HTTP_GET_VARS['install_to']) : $HTTP_POST_VARS['install_to'];
$style_name = ( isset($HTTP_GET_VARS['style']) ) ? urldecode($HTTP_GET_VARS['style']) : $HTTP_POST_VARS['style'];
if( isset($install_to) )
{
include($phpbb_root_path. "templates/" . basename($install_to) . "/theme_info.cfg");
$template_name = $$install_to;
$found = FALSE;
for($i = 0; $i < count($template_name) && !$found; $i++)
{
if( $template_name[$i]['style_name'] == $style_name )
{
while(list($key, $val) = each($template_name[$i]))
{
$db_fields[] = $key;
$db_values[] = str_replace("\'", "''" , $val);
}
}
}
$sql = "INSERT INTO " . THEMES_TABLE . " (";
for($i = 0; $i < count($db_fields); $i++)
{
$sql .= $db_fields[$i];
if($i != (count($db_fields) - 1))
{
$sql .= ", ";
}
}
$sql .= ") VALUES (";
for($i = 0; $i < count($db_values); $i++)
{
$sql .= "'" . $db_values[$i] . "'";
if($i != (count($db_values) - 1))
{
$sql .= ", ";
}
}
$sql .= ")";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not insert theme data!", "", __LINE__, __FILE__, $sql);
}
$message = $lang['Theme_installed'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
else
{
$installable_themes = array();
if( $dir = @opendir($phpbb_root_path. "templates/") )
{
while( $sub_dir = @readdir($dir) )
{
if( !is_file(phpbb_realpath($phpbb_root_path . 'templates/' .$sub_dir)) && !is_link(phpbb_realpath($phpbb_root_path . 'templates/' .$sub_dir)) && $sub_dir != "." && $sub_dir != ".." && $sub_dir != "CVS" )
{
if( @file_exists(@phpbb_realpath($phpbb_root_path. "templates/" . $sub_dir . "/theme_info.cfg")) )
{
include($phpbb_root_path. "templates/" . $sub_dir . "/theme_info.cfg");
for($i = 0; $i < count($$sub_dir); $i++)
{
$working_data = $$sub_dir;
$style_name = $working_data[$i]['style_name'];
$sql = "SELECT themes_id
FROM " . THEMES_TABLE . "
WHERE style_name = '" . str_replace("\'", "''", $style_name) . "'";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not query themes table!", "", __LINE__, __FILE__, $sql);
}
if(!$db->sql_numrows($result))
{
$installable_themes[] = $working_data[$i];
}
}
}
}
}
$template->set_filenames(array(
"body" => "admin/styles_addnew_body.tpl")
);
$template->assign_vars(array(
"L_STYLES_TITLE" => $lang['Styles_admin'],
"L_STYLES_ADD_TEXT" => $lang['Styles_addnew_explain'],
"L_STYLE" => $lang['Style'],
"L_TEMPLATE" => $lang['Template'],
"L_INSTALL" => $lang['Install'],
"L_ACTION" => $lang['Action'])
);
for($i = 0; $i < count($installable_themes); $i++)
{
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars("styles", array(
"ROW_CLASS" => $row_class,
"ROW_COLOR" => "#" . $row_color,
"STYLE_NAME" => $installable_themes[$i]['style_name'],
"TEMPLATE_NAME" => $installable_themes[$i]['template_name'],
"U_STYLES_INSTALL" => append_sid("admin_styles.$phpEx?mode=addnew&amp;style=" . urlencode($installable_themes[$i]['style_name']) . "&amp;install_to=" . urlencode($installable_themes[$i]['template_name'])))
);
}
$template->pparse("body");
}
closedir($dir);
}
break;
case "create":
case "edit":
$submit = ( isset($HTTP_POST_VARS['submit']) ) ? TRUE : 0;
if( $submit )
{
//
// DAMN! Thats alot of data to validate...
//
$updated['style_name'] = $HTTP_POST_VARS['style_name'];
$updated['template_name'] = $HTTP_POST_VARS['template_name'];
$updated['head_stylesheet'] = $HTTP_POST_VARS['head_stylesheet'];
$updated['body_background'] = $HTTP_POST_VARS['body_background'];
$updated['body_bgcolor'] = $HTTP_POST_VARS['body_bgcolor'];
$updated['body_text'] = $HTTP_POST_VARS['body_text'];
$updated['body_link'] = $HTTP_POST_VARS['body_link'];
$updated['body_vlink'] = $HTTP_POST_VARS['body_vlink'];
$updated['body_alink'] = $HTTP_POST_VARS['body_alink'];
$updated['body_hlink'] = $HTTP_POST_VARS['body_hlink'];
$updated['tr_color1'] = $HTTP_POST_VARS['tr_color1'];
$updated_name['tr_color1_name'] = $HTTP_POST_VARS['tr_color1_name'];
$updated['tr_color2'] = $HTTP_POST_VARS['tr_color2'];
$updated_name['tr_color2_name'] = $HTTP_POST_VARS['tr_color2_name'];
$updated['tr_color3'] = $HTTP_POST_VARS['tr_color3'];
$updated_name['tr_color3_name'] = $HTTP_POST_VARS['tr_color3_name'];
$updated['tr_class1'] = $HTTP_POST_VARS['tr_class1'];
$updated_name['tr_class1_name'] = $HTTP_POST_VARS['tr_class1_name'];
$updated['tr_class2'] = $HTTP_POST_VARS['tr_class2'];
$updated_name['tr_class2_name'] = $HTTP_POST_VARS['tr_class2_name'];
$updated['tr_class3'] = $HTTP_POST_VARS['tr_class3'];
$updated_name['tr_class3_name'] = $HTTP_POST_VARS['tr_class3_name'];
$updated['th_color1'] = $HTTP_POST_VARS['th_color1'];
$updated_name['th_color1_name'] = $HTTP_POST_VARS['th_color1_name'];
$updated['th_color2'] = $HTTP_POST_VARS['th_color2'];
$updated_name['th_color2_name'] = $HTTP_POST_VARS['th_color2_name'];
$updated['th_color3'] = $HTTP_POST_VARS['th_color3'];
$updated_name['th_color3_name'] = $HTTP_POST_VARS['th_color3_name'];
$updated['th_class1'] = $HTTP_POST_VARS['th_class1'];
$updated_name['th_class1_name'] = $HTTP_POST_VARS['th_class1_name'];
$updated['th_class2'] = $HTTP_POST_VARS['th_class2'];
$updated_name['th_class2_name'] = $HTTP_POST_VARS['th_class2_name'];
$updated['th_class3'] = $HTTP_POST_VARS['th_class3'];
$updated_name['th_class3_name'] = $HTTP_POST_VARS['th_class3_name'];
$updated['td_color1'] = $HTTP_POST_VARS['td_color1'];
$updated_name['td_color1_name'] = $HTTP_POST_VARS['td_color1_name'];
$updated['td_color2'] = $HTTP_POST_VARS['td_color2'];
$updated_name['td_color2_name'] = $HTTP_POST_VARS['td_color2_name'];
$updated['td_color3'] = $HTTP_POST_VARS['td_color3'];
$updated_name['td_color3_name'] = $HTTP_POST_VARS['td_color3_name'];
$updated['td_class1'] = $HTTP_POST_VARS['td_class1'];
$updated_name['td_class1_name'] = $HTTP_POST_VARS['td_class1_name'];
$updated['td_class2'] = $HTTP_POST_VARS['td_class2'];
$updated_name['td_class2_name'] = $HTTP_POST_VARS['td_class2_name'];
$updated['td_class3'] = $HTTP_POST_VARS['td_class3'];
$updated_name['td_class3_name'] = $HTTP_POST_VARS['td_class3_name'];
$updated['fontface1'] = $HTTP_POST_VARS['fontface1'];
$updated_name['fontface1_name'] = $HTTP_POST_VARS['fontface1_name'];
$updated['fontface2'] = $HTTP_POST_VARS['fontface2'];
$updated_name['fontface2_name'] = $HTTP_POST_VARS['fontface2_name'];
$updated['fontface3'] = $HTTP_POST_VARS['fontface3'];
$updated_name['fontface3_name'] = $HTTP_POST_VARS['fontface3_name'];
$updated['fontsize1'] = intval($HTTP_POST_VARS['fontsize1']);
$updated_name['fontsize1_name'] = $HTTP_POST_VARS['fontsize1_name'];
$updated['fontsize2'] = intval($HTTP_POST_VARS['fontsize2']);
$updated_name['fontsize2_name'] = $HTTP_POST_VARS['fontsize2_name'];
$updated['fontsize3'] = intval($HTTP_POST_VARS['fontsize3']);
$updated_name['fontsize3_name'] = $HTTP_POST_VARS['fontsize3_name'];
$updated['fontcolor1'] = $HTTP_POST_VARS['fontcolor1'];
$updated_name['fontcolor1_name'] = $HTTP_POST_VARS['fontcolor1_name'];
$updated['fontcolor2'] = $HTTP_POST_VARS['fontcolor2'];
$updated_name['fontcolor2_name'] = $HTTP_POST_VARS['fontcolor2_name'];
$updated['fontcolor3'] = $HTTP_POST_VARS['fontcolor3'];
$updated_name['fontcolor3_name'] = $HTTP_POST_VARS['fontcolor3_name'];
$updated['span_class1'] = $HTTP_POST_VARS['span_class1'];
$updated_name['span_class1_name'] = $HTTP_POST_VARS['span_class1_name'];
$updated['span_class2'] = $HTTP_POST_VARS['span_class2'];
$updated_name['span_class2_name'] = $HTTP_POST_VARS['span_class2_name'];
$updated['span_class3'] = $HTTP_POST_VARS['span_class3'];
$updated_name['span_class3_name'] = $HTTP_POST_VARS['span_class3_name'];
$style_id = intval($HTTP_POST_VARS['style_id']);
//
// Wheeeew! Thank heavens for copy and paste and search and replace :D
//
if($mode == "edit")
{
$sql = "UPDATE " . THEMES_TABLE . " SET ";
$count = 0;
while(list($key, $val) = each($updated))
{
if($count != 0)
{
$sql .= ", ";
}
//
// I don't like this but it'll keep MSSQL from throwing
// an error and save me alot of typing
//
$sql .= ( stristr($key, "fontsize") ) ? "$key = $val" : "$key = '" . str_replace("\'", "''", $val) . "'";
$count++;
}
$sql .= " WHERE themes_id = $style_id";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not update themes table!", "", __LINE__, __FILE__, $sql);
}
//
// Check if there's a names table entry for this style
//
$sql = "SELECT themes_id
FROM " . THEMES_NAME_TABLE . "
WHERE themes_id = $style_id";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get data from themes_name table", "", __LINE__, __FILE__, $sql);
}
if($db->sql_numrows($result) > 0)
{
$sql = "UPDATE " . THEMES_NAME_TABLE . "
SET ";
$count = 0;
while(list($key, $val) = each($updated_name))
{
if($count != 0)
{
$sql .= ", ";
}
$sql .= "$key = '$val'";
$count++;
}
$sql .= " WHERE themes_id = $style_id";
}
else
{
//
// Nope, no names entry so we create a new one.
//
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, ";
while(list($key, $val) = each($updated_name))
{
$fields[] = $key;
$vals[] = str_replace("\'", "''", $val);
}
for($i = 0; $i < count($fields); $i++)
{
if($i > 0)
{
$sql .= ", ";
}
$sql .= $fields[$i];
}
$sql .= ") VALUES ($style_id, ";
for($i = 0; $i < count($vals); $i++)
{
if($i > 0)
{
$sql .= ", ";
}
$sql .= "'" . $vals[$i] . "'";
}
$sql .= ")";
}
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not update themes name table!", "", __LINE__, __FILE__, $sql);
}
$message = $lang['Theme_updated'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
else
{
//
// First, check if we already have a style by this name
//
$sql = "SELECT themes_id
FROM " . THEMES_TABLE . "
WHERE style_name = '" . str_replace("\'", "''", $updated['style_name']) . "'";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not query themes table", "", __LINE__, __FILE__, $sql);
}
if($db->sql_numrows($result))
{
message_die(GENERAL_ERROR, $lang['Style_exists'], $lang['Error']);
}
while(list($key, $val) = each($updated))
{
$field_names[] = $key;
if(stristr($key, "fontsize"))
{
$values[] = "$val";
}
else
{
$values[] = "'" . str_replace("\'", "''", $val) . "'";
}
}
$sql = "INSERT
INTO " . THEMES_TABLE . " (";
for($i = 0; $i < count($field_names); $i++)
{
if($i != 0)
{
$sql .= ", ";
}
$sql .= $field_names[$i];
}
$sql .= ") VALUES (";
for($i = 0; $i < count($values); $i++)
{
if($i != 0)
{
$sql .= ", ";
}
$sql .= $values[$i];
}
$sql .= ")";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not update themes table!", "", __LINE__, __FILE__, $sql);
}
$style_id = $db->sql_nextid();
//
// Insert names data
//
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, ";
while(list($key, $val) = each($updated_name))
{
$fields[] = $key;
$vals[] = $val;
}
for($i = 0; $i < count($fields); $i++)
{
if($i > 0)
{
$sql .= ", ";
}
$sql .= $fields[$i];
}
$sql .= ") VALUES ($style_id, ";
for($i = 0; $i < count($vals); $i++)
{
if($i > 0)
{
$sql .= ", ";
}
$sql .= "'" . $vals[$i] . "'";
}
$sql .= ")";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not insert themes name table!", "", __LINE__, __FILE__, $sql);
}
$message = $lang['Theme_created'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
}
else
{
if($mode == "edit")
{
$themes_title = $lang['Edit_theme'];
$themes_explain = $lang['Edit_theme_explain'];
$style_id = intval($HTTP_GET_VARS['style_id']);
$selected_names = array();
$selected_values = array();
//
// Fetch the Theme Info from the db
//
$sql = "SELECT *
FROM " . THEMES_TABLE . "
WHERE themes_id = $style_id";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get data from themes table", "", __LINE__, __FILE__, $sql);
}
if ( $selected_values = $db->sql_fetchrow($result) )
{
while(list($key, $val) = @each($selected_values))
{
$selected[$key] = $val;
}
}
//
// Fetch the Themes Name data
//
$sql = "SELECT *
FROM " . THEMES_NAME_TABLE . "
WHERE themes_id = $style_id";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get data from themes name table", "", __LINE__, __FILE__, $sql);
}
if ( $selected_names = $db->sql_fetchrow($result) )
{
while(list($key, $val) = @each($selected_names))
{
$selected[$key] = $val;
}
}
$s_hidden_fields = '<input type="hidden" name="style_id" value="' . $style_id . '" />';
}
else
{
$themes_title = $lang['Create_theme'];
$themes_explain = $lang['Create_theme_explain'];
}
$template->set_filenames(array(
"body" => "admin/styles_edit_body.tpl")
);
if( $dir = @opendir($phpbb_root_path . 'templates/') )
{
$s_template_select = '<select name="template_name">';
while( $file = @readdir($dir) )
{
if( !is_file(phpbb_realpath($phpbb_root_path . 'templates/' . $file)) && !is_link(phpbb_realpath($phpbb_root_path . 'templates/' . $file)) && $file != "." && $file != ".." && $file != "CVS" )
{
if($file == $selected['template_name'])
{
$s_template_select .= '<option value="' . $file . '" selected="selected">' . $file . "</option>\n";
}
else
{
$s_template_select .= '<option value="' . $file . '">' . $file . "</option>\n";
}
}
}
$s_template_select .= '</select>';
}
else
{
message_die(GENERAL_MESSAGE, $lang['No_template_dir']);
}
$s_hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />';
$template->assign_vars(array(
"L_THEMES_TITLE" => $themes_title,
"L_THEMES_EXPLAIN" => $themes_explain,
"L_THEME_NAME" => $lang['Theme_name'],
"L_TEMPLATE" => $lang['Template'],
"L_THEME_SETTINGS" => $lang['Theme_settings'],
"L_THEME_ELEMENT" => $lang['Theme_element'],
"L_SIMPLE_NAME" => $lang['Simple_name'],
"L_VALUE" => $lang['Value'],
"L_STYLESHEET" => $lang['Stylesheet'],
"L_STYLESHEET_EXPLAIN" => $lang['Stylesheet_explain'],
"L_BACKGROUND_IMAGE" => $lang['Background_image'],
"L_BACKGROUND_COLOR" => $lang['Background_color'],
"L_BODY_TEXT_COLOR" => $lang['Text_color'],
"L_BODY_LINK_COLOR" => $lang['Link_color'],
"L_BODY_VLINK_COLOR" => $lang['VLink_color'],
"L_BODY_ALINK_COLOR" => $lang['ALink_color'],
"L_BODY_HLINK_COLOR" => $lang['HLink_color'],
"L_TR_COLOR1" => $lang['Tr_color1'],
"L_TR_COLOR2" => $lang['Tr_color2'],
"L_TR_COLOR3" => $lang['Tr_color3'],
"L_TR_CLASS1" => $lang['Tr_class1'],
"L_TR_CLASS2" => $lang['Tr_class2'],
"L_TR_CLASS3" => $lang['Tr_class3'],
"L_TH_COLOR1" => $lang['Th_color1'],
"L_TH_COLOR2" => $lang['Th_color2'],
"L_TH_COLOR3" => $lang['Th_color3'],
"L_TH_CLASS1" => $lang['Th_class1'],
"L_TH_CLASS2" => $lang['Th_class2'],
"L_TH_CLASS3" => $lang['Th_class3'],
"L_TD_COLOR1" => $lang['Td_color1'],
"L_TD_COLOR2" => $lang['Td_color2'],
"L_TD_COLOR3" => $lang['Td_color3'],
"L_TD_CLASS1" => $lang['Td_class1'],
"L_TD_CLASS2" => $lang['Td_class2'],
"L_TD_CLASS3" => $lang['Td_class3'],
"L_FONTFACE_1" => $lang['fontface1'],
"L_FONTFACE_2" => $lang['fontface2'],
"L_FONTFACE_3" => $lang['fontface3'],
"L_FONTSIZE_1" => $lang['fontsize1'],
"L_FONTSIZE_2" => $lang['fontsize2'],
"L_FONTSIZE_3" => $lang['fontsize3'],
"L_FONTCOLOR_1" => $lang['fontcolor1'],
"L_FONTCOLOR_2" => $lang['fontcolor2'],
"L_FONTCOLOR_3" => $lang['fontcolor3'],
"L_SPAN_CLASS_1" => $lang['span_class1'],
"L_SPAN_CLASS_2" => $lang['span_class2'],
"L_SPAN_CLASS_3" => $lang['span_class3'],
"L_SAVE_SETTINGS" => $lang['Save_Settings'],
"THEME_NAME" => $selected['style_name'],
"HEAD_STYLESHEET" => $selected['head_stylesheet'],
"BODY_BACKGROUND" => $selected['body_background'],
"BODY_BGCOLOR" => $selected['body_bgcolor'],
"BODY_TEXT_COLOR" => $selected['body_text'],
"BODY_LINK_COLOR" => $selected['body_link'],
"BODY_VLINK_COLOR" => $selected['body_vlink'],
"BODY_ALINK_COLOR" => $selected['body_alink'],
"BODY_HLINK_COLOR" => $selected['body_hlink'],
"TR_COLOR1" => $selected['tr_color1'],
"TR_COLOR2" => $selected['tr_color2'],
"TR_COLOR3" => $selected['tr_color3'],
"TR_CLASS1" => $selected['tr_class1'],
"TR_CLASS2" => $selected['tr_class2'],
"TR_CLASS3" => $selected['tr_class3'],
"TH_COLOR1" => $selected['th_color1'],
"TH_COLOR2" => $selected['th_color2'],
"TH_COLOR3" => $selected['th_color3'],
"TH_CLASS1" => $selected['th_class1'],
"TH_CLASS2" => $selected['th_class2'],
"TH_CLASS3" => $selected['th_class3'],
"TD_COLOR1" => $selected['td_color1'],
"TD_COLOR2" => $selected['td_color2'],
"TD_COLOR3" => $selected['td_color3'],
"TD_CLASS1" => $selected['td_class1'],
"TD_CLASS2" => $selected['td_class2'],
"TD_CLASS3" => $selected['td_class3'],
"FONTFACE1" => $selected['fontface1'],
"FONTFACE2" => $selected['fontface2'],
"FONTFACE3" => $selected['fontface3'],
"FONTSIZE1" => $selected['fontsize1'],
"FONTSIZE2" => $selected['fontsize2'],
"FONTSIZE3" => $selected['fontsize3'],
"FONTCOLOR1" => $selected['fontcolor1'],
"FONTCOLOR2" => $selected['fontcolor2'],
"FONTCOLOR3" => $selected['fontcolor3'],
"SPAN_CLASS1" => $selected['span_class1'],
"SPAN_CLASS2" => $selected['span_class2'],
"SPAN_CLASS3" => $selected['span_class3'],
"TR_COLOR1_NAME" => $selected['tr_color1_name'],
"TR_COLOR2_NAME" => $selected['tr_color2_name'],
"TR_COLOR3_NAME" => $selected['tr_color3_name'],
"TR_CLASS1_NAME" => $selected['tr_class1_name'],
"TR_CLASS2_NAME" => $selected['tr_class2_name'],
"TR_CLASS3_NAME" => $selected['tr_class3_name'],
"TH_COLOR1_NAME" => $selected['th_color1_name'],
"TH_COLOR2_NAME" => $selected['th_color2_name'],
"TH_COLOR3_NAME" => $selected['th_color3_name'],
"TH_CLASS1_NAME" => $selected['th_class1_name'],
"TH_CLASS2_NAME" => $selected['th_class2_name'],
"TH_CLASS3_NAME" => $selected['th_class3_name'],
"TD_COLOR1_NAME" => $selected['td_color1_name'],
"TD_COLOR2_NAME" => $selected['td_color2_name'],
"TD_COLOR3_NAME" => $selected['td_color3_name'],
"TD_CLASS1_NAME" => $selected['td_class1_name'],
"TD_CLASS2_NAME" => $selected['td_class2_name'],
"TD_CLASS3_NAME" => $selected['td_class3_name'],
"FONTFACE1_NAME" => $selected['fontface1_name'],
"FONTFACE2_NAME" => $selected['fontface2_name'],
"FONTFACE3_NAME" => $selected['fontface3_name'],
"FONTSIZE1_NAME" => $selected['fontsize1_name'],
"FONTSIZE2_NAME" => $selected['fontsize2_name'],
"FONTSIZE3_NAME" => $selected['fontsize3_name'],
"FONTCOLOR1_NAME" => $selected['fontcolor1_name'],
"FONTCOLOR2_NAME" => $selected['fontcolor2_name'],
"FONTCOLOR3_NAME" => $selected['fontcolor3_name'],
"SPAN_CLASS1_NAME" => $selected['span_class1_name'],
"SPAN_CLASS2_NAME" => $selected['span_class2_name'],
"SPAN_CLASS3_NAME" => $selected['span_class3_name'],
"S_THEME_ACTION" => append_sid("admin_styles.$phpEx"),
"S_TEMPLATE_SELECT" => $s_template_select,
"S_HIDDEN_FIELDS" => $s_hidden_fields)
);
$template->pparse("body");
}
break;
case "export";
if($HTTP_POST_VARS['export_template'])
{
$template_name = $HTTP_POST_VARS['export_template'];
$sql = "SELECT *
FROM " . THEMES_TABLE . "
WHERE template_name = '" . str_replace("\'", "''", $template_name) . "'";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get theme data for selected template", "", __LINE__, __FILE__, $sql);
}
$theme_rowset = $db->sql_fetchrowset($result);
if( count($theme_rowset) == 0 )
{
message_die(GENERAL_MESSAGE, $lang['No_themes']);
}
$theme_data = '<?php'."\n\n";
$theme_data .= "//\n// phpBB 2.x auto-generated theme config file for $template_name\n// Do not change anything in this file!\n//\n\n";
for($i = 0; $i < count($theme_rowset); $i++)
{
while(list($key, $val) = each($theme_rowset[$i]))
{
if(!intval($key) && $key != "0" && $key != "themes_id")
{
$theme_data .= '$' . $template_name . "[$i]['$key'] = \"" . addslashes($val) . "\";\n";
}
}
$theme_data .= "\n";
}
$theme_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!
@umask(0111);
$fp = @fopen($phpbb_root_path . 'templates/' . basename($template_name) . '/theme_info.cfg', 'w');
if( !$fp )
{
//
// Unable to open the file writeable do something here as an attempt
// to get around that...
//
$s_hidden_fields = '<input type="hidden" name="theme_info" value="' . htmlspecialchars($theme_data) . '" />';
$s_hidden_fields .= '<input type="hidden" name="send_file" value="1" /><input type="hidden" name="mode" value="export" />';
$download_form = '<form action="' . append_sid("admin_styles.$phpEx") . '" method="post"><input class="mainoption" type="submit" name="submit" value="' . $lang['Download'] . '" />' . $s_hidden_fields;
$template->set_filenames(array(
"body" => "message_body.tpl")
);
$template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Export_themes'],
"MESSAGE_TEXT" => $lang['Download_theme_cfg'] . "<br /><br />" . $download_form)
);
$template->pparse('body');
exit();
}
$result = @fputs($fp, $theme_data, strlen($theme_data));
fclose($fp);
$message = $lang['Theme_info_saved'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
else if($HTTP_POST_VARS['send_file'])
{
header("Content-Type: text/x-delimtext; name=\"theme_info.cfg\"");
header("Content-disposition: attachment; filename=theme_info.cfg");
echo stripslashes($HTTP_POST_VARS['theme_info']);
}
else
{
$template->set_filenames(array(
"body" => "admin/styles_exporter.tpl")
);
if( $dir = @opendir($phpbb_root_path . 'templates/') )
{
$s_template_select = '<select name="export_template">';
while( $file = @readdir($dir) )
{
if( !is_file(phpbb_realpath($phpbb_root_path . 'templates/' . $file)) && !is_link(phpbb_realpath($phpbb_root_path . 'templates/' .$file)) && $file != "." && $file != ".." && $file != "CVS" )
{
$s_template_select .= '<option value="' . $file . '">' . $file . "</option>\n";
}
}
$s_template_select .= '</select>';
}
else
{
message_die(GENERAL_MESSAGE, $lang['No_template_dir']);
}
$template->assign_vars(array(
"L_STYLE_EXPORTER" => $lang['Export_themes'],
"L_EXPORTER_EXPLAIN" => $lang['Export_explain'],
"L_TEMPLATE_SELECT" => $lang['Select_template'],
"L_SUBMIT" => $lang['Submit'],
"S_EXPORTER_ACTION" => append_sid("admin_styles.$phpEx?mode=export"),
"S_TEMPLATE_SELECT" => $s_template_select)
);
$template->pparse("body");
}
break;
case "delete":
$style_id = ( isset($HTTP_GET_VARS['style_id']) ) ? intval($HTTP_GET_VARS['style_id']) : intval($HTTP_POST_VARS['style_id']);
if( !$confirm )
{
if($style_id == $board_config['default_style'])
{
message_die(GENERAL_MESSAGE, $lang['Cannot_remove_style']);
}
$hidden_fields = '<input type="hidden" name="mode" value="'.$mode.'" /><input type="hidden" name="style_id" value="'.$style_id.'" />';
//
// Set template files
//
$template->set_filenames(array(
"confirm" => "admin/confirm_body.tpl")
);
$template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Confirm'],
"MESSAGE_TEXT" => $lang['Confirm_delete_style'],
"L_YES" => $lang['Yes'],
"L_NO" => $lang['No'],
"S_CONFIRM_ACTION" => append_sid("admin_styles.$phpEx"),
"S_HIDDEN_FIELDS" => $hidden_fields)
);
$template->pparse("confirm");
}
else
{
//
// The user has confirmed the delete. Remove the style, the style element
// names and update any users who might be using this style
//
$sql = "DELETE FROM " . THEMES_TABLE . "
WHERE themes_id = $style_id";
if(!$result = $db->sql_query($sql, BEGIN_TRANSACTION))
{
message_die(GENERAL_ERROR, "Could not remove style data!", "", __LINE__, __FILE__, $sql);
}
//
// There may not be any theme name data so don't throw an error
// if the SQL dosan't work
//
$sql = "DELETE FROM " . THEMES_NAME_TABLE . "
WHERE themes_id = $style_id";
$db->sql_query($sql);
$sql = "UPDATE " . USERS_TABLE . "
SET user_style = " . $board_config['default_style'] . "
WHERE user_style = $style_id";
if(!$result = $db->sql_query($sql, END_TRANSACTION))
{
message_die(GENERAL_ERROR, "Could not update user style information", "", __LINE__, __FILE__, $sql);
}
$message = $lang['Style_removed'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
break;
default:
$sql = "SELECT themes_id, template_name, style_name
FROM " . THEMES_TABLE . "
ORDER BY template_name";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get style information!", "", __LINE__, __FILE__, $sql);
}
$style_rowset = $db->sql_fetchrowset($result);
$template->set_filenames(array(
"body" => "admin/styles_list_body.tpl")
);
$template->assign_vars(array(
"L_STYLES_TITLE" => $lang['Styles_admin'],
"L_STYLES_TEXT" => $lang['Styles_explain'],
"L_STYLE" => $lang['Style'],
"L_TEMPLATE" => $lang['Template'],
"L_EDIT" => $lang['Edit'],
"L_DELETE" => $lang['Delete'])
);
for($i = 0; $i < count($style_rowset); $i++)
{
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars("styles", array(
"ROW_CLASS" => $row_class,
"ROW_COLOR" => $row_color,
"STYLE_NAME" => $style_rowset[$i]['style_name'],
"TEMPLATE_NAME" => $style_rowset[$i]['template_name'],
"U_STYLES_EDIT" => append_sid("admin_styles.$phpEx?mode=edit&amp;style_id=" . $style_rowset[$i]['themes_id']),
"U_STYLES_DELETE" => append_sid("admin_styles.$phpEx?mode=delete&amp;style_id=" . $style_rowset[$i]['themes_id']))
);
}
$template->pparse("body");
break;
}
if (empty($HTTP_POST_VARS['send_file']))
{
include('./page_footer_admin.'.$phpEx);
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,452 +0,0 @@
<?php
/***************************************************************************
* admin_user_ban.php
* -------------------
* begin : Tuesday, Jul 31, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', 1);
if ( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['Users']['Ban_Management'] = $filename;
return;
}
//
// Load default header
//
$phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
//
// Start program
//
if ( isset($HTTP_POST_VARS['submit']) )
{
$user_bansql = '';
$email_bansql = '';
$ip_bansql = '';
$user_list = array();
if ( !empty($HTTP_POST_VARS['username']) )
{
$this_userdata = get_userdata($HTTP_POST_VARS['username'], true);
if( !$this_userdata )
{
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
}
$user_list[] = $this_userdata['user_id'];
}
$ip_list = array();
if ( isset($HTTP_POST_VARS['ban_ip']) )
{
$ip_list_temp = explode(',', $HTTP_POST_VARS['ban_ip']);
for($i = 0; $i < count($ip_list_temp); $i++)
{
if ( preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', trim($ip_list_temp[$i]), $ip_range_explode) )
{
//
// Don't ask about all this, just don't ask ... !
//
$ip_1_counter = $ip_range_explode[1];
$ip_1_end = $ip_range_explode[5];
while ( $ip_1_counter <= $ip_1_end )
{
$ip_2_counter = ( $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[2] : 0;
$ip_2_end = ( $ip_1_counter < $ip_1_end ) ? 254 : $ip_range_explode[6];
if ( $ip_2_counter == 0 && $ip_2_end == 254 )
{
$ip_2_counter = 255;
$ip_2_fragment = 255;
$ip_list[] = encode_ip("$ip_1_counter.255.255.255");
}
while ( $ip_2_counter <= $ip_2_end )
{
$ip_3_counter = ( $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[3] : 0;
$ip_3_end = ( $ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end ) ? 254 : $ip_range_explode[7];
if ( $ip_3_counter == 0 && $ip_3_end == 254 )
{
$ip_3_counter = 255;
$ip_3_fragment = 255;
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.255.255");
}
while ( $ip_3_counter <= $ip_3_end )
{
$ip_4_counter = ( $ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[4] : 0;
$ip_4_end = ( $ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end ) ? 254 : $ip_range_explode[8];
if ( $ip_4_counter == 0 && $ip_4_end == 254 )
{
$ip_4_counter = 255;
$ip_4_fragment = 255;
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.255");
}
while ( $ip_4_counter <= $ip_4_end )
{
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter");
$ip_4_counter++;
}
$ip_3_counter++;
}
$ip_2_counter++;
}
$ip_1_counter++;
}
}
else if ( preg_match('/^([\w\-_]\.?){2,}$/is', trim($ip_list_temp[$i])) )
{
$ip = gethostbynamel(trim($ip_list_temp[$i]));
for($j = 0; $j < count($ip); $j++)
{
if ( !empty($ip[$j]) )
{
$ip_list[] = encode_ip($ip[$j]);
}
}
}
else if ( preg_match('/^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$/', trim($ip_list_temp[$i])) )
{
$ip_list[] = encode_ip(str_replace('*', '255', trim($ip_list_temp[$i])));
}
}
}
$email_list = array();
if ( isset($HTTP_POST_VARS['ban_email']) )
{
$email_list_temp = explode(',', $HTTP_POST_VARS['ban_email']);
for($i = 0; $i < count($email_list_temp); $i++)
{
//
// This ereg match is based on one by php@unreelpro.com
// contained in the annotated php manual at php.com (ereg
// section)
//
if (preg_match('/^(([a-z0-9&\'\.\-_\+])|(\*))+@(([a-z0-9\-])|(\*))+\.([a-z0-9\-]+\.)*?[a-z]+$/is', trim($email_list_temp[$i])))
{
$email_list[] = trim($email_list_temp[$i]);
}
}
}
$sql = "SELECT *
FROM " . BANLIST_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);
}
$current_banlist = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$kill_session_sql = '';
for($i = 0; $i < count($user_list); $i++)
{
$in_banlist = false;
for($j = 0; $j < count($current_banlist); $j++)
{
if ( $user_list[$i] == $current_banlist[$j]['ban_userid'] )
{
$in_banlist = true;
}
}
if ( !$in_banlist )
{
$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . "session_user_id = " . $user_list[$i];
$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_userid)
VALUES (" . $user_list[$i] . ")";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql);
}
}
}
for($i = 0; $i < count($ip_list); $i++)
{
$in_banlist = false;
for($j = 0; $j < count($current_banlist); $j++)
{
if ( $ip_list[$i] == $current_banlist[$j]['ban_ip'] )
{
$in_banlist = true;
}
}
if ( !$in_banlist )
{
if ( preg_match('/(ff\.)|(\.ff)/is', chunk_split($ip_list[$i], 2, '.')) )
{
$kill_ip_sql = "session_ip LIKE '" . str_replace('.', '', preg_replace('/(ff\.)|(\.ff)/is', '%', chunk_split($ip_list[$i], 2, "."))) . "'";
}
else
{
$kill_ip_sql = "session_ip = '" . $ip_list[$i] . "'";
}
$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;
$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_ip)
VALUES ('" . $ip_list[$i] . "')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert ban_ip info into database", "", __LINE__, __FILE__, $sql);
}
}
}
//
// Now we'll delete all entries from the session table with any of the banned
// user or IP info just entered into the ban table ... this will force a session
// initialisation resulting in an instant ban
//
if ( $kill_session_sql != '' )
{
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE $kill_session_sql";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql);
}
}
for($i = 0; $i < count($email_list); $i++)
{
$in_banlist = false;
for($j = 0; $j < count($current_banlist); $j++)
{
if ( $email_list[$i] == $current_banlist[$j]['ban_email'] )
{
$in_banlist = true;
}
}
if ( !$in_banlist )
{
$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_email)
VALUES ('" . str_replace("\'", "''", $email_list[$i]) . "')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert ban_email info into database", "", __LINE__, __FILE__, $sql);
}
}
}
$where_sql = '';
if ( isset($HTTP_POST_VARS['unban_user']) )
{
$user_list = $HTTP_POST_VARS['unban_user'];
for($i = 0; $i < count($user_list); $i++)
{
if ( $user_list[$i] != -1 )
{
$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . intval($user_list[$i]);
}
}
}
if ( isset($HTTP_POST_VARS['unban_ip']) )
{
$ip_list = $HTTP_POST_VARS['unban_ip'];
for($i = 0; $i < count($ip_list); $i++)
{
if ( $ip_list[$i] != -1 )
{
$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . str_replace("\'", "''", $ip_list[$i]);
}
}
}
if ( isset($HTTP_POST_VARS['unban_email']) )
{
$email_list = $HTTP_POST_VARS['unban_email'];
for($i = 0; $i < count($email_list); $i++)
{
if ( $email_list[$i] != -1 )
{
$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . str_replace("\'", "''", $email_list[$i]);
}
}
}
if ( $where_sql != '' )
{
$sql = "DELETE FROM " . BANLIST_TABLE . "
WHERE ban_id IN ($where_sql)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete ban info from database", "", __LINE__, __FILE__, $sql);
}
}
$message = $lang['Ban_update_sucessful'] . '<br /><br />' . sprintf($lang['Click_return_banadmin'], '<a href="' . append_sid("admin_user_ban.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
$template->set_filenames(array(
'body' => 'admin/user_ban_body.tpl')
);
$template->assign_vars(array(
'L_BAN_TITLE' => $lang['Ban_control'],
'L_BAN_EXPLAIN' => $lang['Ban_explain'],
'L_BAN_EXPLAIN_WARN' => $lang['Ban_explain_warn'],
'L_IP_OR_HOSTNAME' => $lang['IP_hostname'],
'L_EMAIL_ADDRESS' => $lang['Email_address'],
'L_SUBMIT' => $lang['Submit'],
'L_RESET' => $lang['Reset'],
'S_BANLIST_ACTION' => append_sid("admin_user_ban.$phpEx"))
);
$template->assign_vars(array(
'L_BAN_USER' => $lang['Ban_username'],
'L_BAN_USER_EXPLAIN' => $lang['Ban_username_explain'],
'L_BAN_IP' => $lang['Ban_IP'],
'L_BAN_IP_EXPLAIN' => $lang['Ban_IP_explain'],
'L_BAN_EMAIL' => $lang['Ban_email'],
'L_BAN_EMAIL_EXPLAIN' => $lang['Ban_email_explain'])
);
$userban_count = 0;
$ipban_count = 0;
$emailban_count = 0;
$sql = "SELECT b.ban_id, u.user_id, u.username
FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u
WHERE u.user_id = b.ban_userid
AND b.ban_userid <> 0
AND u.user_id <> " . ANONYMOUS . "
ORDER BY u.user_id ASC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select current user_id ban list', '', __LINE__, __FILE__, $sql);
}
$user_list = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$select_userlist = '';
for($i = 0; $i < count($user_list); $i++)
{
$select_userlist .= '<option value="' . $user_list[$i]['ban_id'] . '">' . $user_list[$i]['username'] . '</option>';
$userban_count++;
}
if( $select_userlist == '' )
{
$select_userlist = '<option value="-1">' . $lang['No_banned_users'] . '</option>';
}
$select_userlist = '<select name="unban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>';
$sql = "SELECT ban_id, ban_ip, ban_email
FROM " . BANLIST_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select current ip ban list', '', __LINE__, __FILE__, $sql);
}
$banlist = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$select_iplist = '';
$select_emaillist = '';
for($i = 0; $i < count($banlist); $i++)
{
$ban_id = $banlist[$i]['ban_id'];
if ( !empty($banlist[$i]['ban_ip']) )
{
$ban_ip = str_replace('255', '*', decode_ip($banlist[$i]['ban_ip']));
$select_iplist .= '<option value="' . $ban_id . '">' . $ban_ip . '</option>';
$ipban_count++;
}
else if ( !empty($banlist[$i]['ban_email']) )
{
$ban_email = $banlist[$i]['ban_email'];
$select_emaillist .= '<option value="' . $ban_id . '">' . $ban_email . '</option>';
$emailban_count++;
}
}
if ( $select_iplist == '' )
{
$select_iplist = '<option value="-1">' . $lang['No_banned_ip'] . '</option>';
}
if ( $select_emaillist == '' )
{
$select_emaillist = '<option value="-1">' . $lang['No_banned_email'] . '</option>';
}
$select_iplist = '<select name="unban_ip[]" multiple="multiple" size="5">' . $select_iplist . '</select>';
$select_emaillist = '<select name="unban_email[]" multiple="multiple" size="5">' . $select_emaillist . '</select>';
$template->assign_vars(array(
'L_UNBAN_USER' => $lang['Unban_username'],
'L_UNBAN_USER_EXPLAIN' => $lang['Unban_username_explain'],
'L_UNBAN_IP' => $lang['Unban_IP'],
'L_UNBAN_IP_EXPLAIN' => $lang['Unban_IP_explain'],
'L_UNBAN_EMAIL' => $lang['Unban_email'],
'L_UNBAN_EMAIL_EXPLAIN' => $lang['Unban_email_explain'],
'L_USERNAME' => $lang['Username'],
'L_LOOK_UP' => $lang['Look_up_User'],
'L_FIND_USERNAME' => $lang['Find_username'],
'U_SEARCH_USER' => append_sid("./../search.$phpEx?mode=searchuser"),
'S_UNBAN_USERLIST_SELECT' => $select_userlist,
'S_UNBAN_IPLIST_SELECT' => $select_iplist,
'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist,
'S_BAN_ACTION' => append_sid("admin_user_ban.$phpEx"))
);
}
$template->pparse('body');
include('./page_footer_admin.'.$phpEx);
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,273 +0,0 @@
<?php
/***************************************************************************
* admin_words.php
* -------------------
* begin : Thursday, Jul 12, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if( !empty($setmodules) )
{
$file = basename(__FILE__);
$module['General']['Word_Censor'] = $file;
return;
}
define('IN_PHPBB', 1);
//
// Load default header
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
$cancel = (isset($HTTP_POST_VARS['cancel']) || isset($_POST['cancel'])) ? true : false;
$no_page_header = $cancel;
require('./pagestart.' . $phpEx);
if ($cancel)
{
redirect('admin/' . append_sid("admin_words.$phpEx", true));
}
if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
$mode = (isset($HTTP_GET_VARS['mode'])) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
$mode = htmlspecialchars($mode);
}
else
{
//
// These could be entered via a form button
//
if( isset($HTTP_POST_VARS['add']) )
{
$mode = "add";
}
else if( isset($HTTP_POST_VARS['save']) )
{
$mode = "save";
}
else
{
$mode = "";
}
}
// Restrict mode input to valid options
$mode = ( in_array($mode, array('add', 'edit', 'save', 'delete')) ) ? $mode : '';
if( $mode != "" )
{
if( $mode == "edit" || $mode == "add" )
{
$word_id = ( isset($HTTP_GET_VARS['id']) ) ? intval($HTTP_GET_VARS['id']) : 0;
$template->set_filenames(array(
"body" => "admin/words_edit_body.tpl")
);
$word_info = array('word' => '', 'replacement' => '');
$s_hidden_fields = '';
if( $mode == "edit" )
{
if( $word_id )
{
$sql = "SELECT *
FROM " . WORDS_TABLE . "
WHERE word_id = $word_id";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not query words table", "Error", __LINE__, __FILE__, $sql);
}
$word_info = $db->sql_fetchrow($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $word_id . '" />';
}
else
{
message_die(GENERAL_MESSAGE, $lang['No_word_selected']);
}
}
$template->assign_vars(array(
"WORD" => htmlspecialchars($word_info['word']),
"REPLACEMENT" => htmlspecialchars($word_info['replacement']),
"L_WORDS_TITLE" => $lang['Words_title'],
"L_WORDS_TEXT" => $lang['Words_explain'],
"L_WORD_CENSOR" => $lang['Edit_word_censor'],
"L_WORD" => $lang['Word'],
"L_REPLACEMENT" => $lang['Replacement'],
"L_SUBMIT" => $lang['Submit'],
"S_WORDS_ACTION" => append_sid("admin_words.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields)
);
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
}
else if( $mode == "save" )
{
$word_id = ( isset($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : 0;
$word = ( isset($HTTP_POST_VARS['word']) ) ? trim($HTTP_POST_VARS['word']) : "";
$replacement = ( isset($HTTP_POST_VARS['replacement']) ) ? trim($HTTP_POST_VARS['replacement']) : "";
if($word == "" || $replacement == "")
{
message_die(GENERAL_MESSAGE, $lang['Must_enter_word']);
}
if( $word_id )
{
$sql = "UPDATE " . WORDS_TABLE . "
SET word = '" . str_replace("\'", "''", $word) . "', replacement = '" . str_replace("\'", "''", $replacement) . "'
WHERE word_id = $word_id";
$message = $lang['Word_updated'];
}
else
{
$sql = "INSERT INTO " . WORDS_TABLE . " (word, replacement)
VALUES ('" . str_replace("\'", "''", $word) . "', '" . str_replace("\'", "''", $replacement) . "')";
$message = $lang['Word_added'];
}
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not insert data into words table", $lang['Error'], __LINE__, __FILE__, $sql);
}
$message .= "<br /><br />" . sprintf($lang['Click_return_wordadmin'], "<a href=\"" . append_sid("admin_words.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
else if( $mode == "delete" )
{
if( isset($HTTP_POST_VARS['id']) || isset($HTTP_GET_VARS['id']) )
{
$word_id = ( isset($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id'];
$word_id = intval($word_id);
}
else
{
$word_id = 0;
}
$confirm = isset($HTTP_POST_VARS['confirm']);
if( $word_id && $confirm )
{
$sql = "DELETE FROM " . WORDS_TABLE . "
WHERE word_id = $word_id";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not remove data from words table", $lang['Error'], __LINE__, __FILE__, $sql);
}
$message = $lang['Word_removed'] . "<br /><br />" . sprintf($lang['Click_return_wordadmin'], "<a href=\"" . append_sid("admin_words.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
elseif( $word_id && !$confirm)
{
// Present the confirmation screen to the user
$template->set_filenames(array(
'body' => 'admin/confirm_body.tpl')
);
$hidden_fields = '<input type="hidden" name="mode" value="delete" /><input type="hidden" name="id" value="' . $word_id . '" />';
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['Confirm'],
'MESSAGE_TEXT' => $lang['Confirm_delete_word'],
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_CONFIRM_ACTION' => append_sid("admin_words.$phpEx"),
'S_HIDDEN_FIELDS' => $hidden_fields)
);
}
else
{
message_die(GENERAL_MESSAGE, $lang['No_word_selected']);
}
}
}
else
{
$template->set_filenames(array(
"body" => "admin/words_list_body.tpl")
);
$sql = "SELECT *
FROM " . WORDS_TABLE . "
ORDER BY word";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not query words table", $lang['Error'], __LINE__, __FILE__, $sql);
}
$word_rows = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$word_count = count($word_rows);
$template->assign_vars(array(
"L_WORDS_TITLE" => $lang['Words_title'],
"L_WORDS_TEXT" => $lang['Words_explain'],
"L_WORD" => $lang['Word'],
"L_REPLACEMENT" => $lang['Replacement'],
"L_EDIT" => $lang['Edit'],
"L_DELETE" => $lang['Delete'],
"L_ADD_WORD" => $lang['Add_new_word'],
"L_ACTION" => $lang['Action'],
"S_WORDS_ACTION" => append_sid("admin_words.$phpEx"),
"S_HIDDEN_FIELDS" => '')
);
for($i = 0; $i < $word_count; $i++)
{
$word = $word_rows[$i]['word'];
$replacement = $word_rows[$i]['replacement'];
$word_id = $word_rows[$i]['word_id'];
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars("words", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"WORD" => htmlspecialchars($word),
"REPLACEMENT" => htmlspecialchars($replacement),
"U_WORD_EDIT" => append_sid("admin_words.$phpEx?mode=edit&amp;id=$word_id"),
"U_WORD_DELETE" => append_sid("admin_words.$phpEx?mode=delete&amp;id=$word_id"))
);
}
}
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
?>

View File

@@ -1,657 +0,0 @@
<?php
/***************************************************************************
* (admin) index.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', 1);
//
// Load default header
//
$no_page_header = TRUE;
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
// ---------------
// Begin functions
//
function inarray($needle, $haystack)
{
for($i = 0; $i < sizeof($haystack); $i++ )
{
if( $haystack[$i] == $needle )
{
return true;
}
}
return false;
}
//
// End functions
// -------------
//
// Generate relevant output
//
if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' )
{
$dir = @opendir(".");
$setmodules = 1;
while( $file = @readdir($dir) )
{
if( preg_match("/^admin_.*?\." . $phpEx . "$/", $file) )
{
include('./' . $file);
}
}
@closedir($dir);
unset($setmodules);
include('./page_header_admin.'.$phpEx);
$template->set_filenames(array(
"body" => "admin/index_navigate.tpl")
);
$template->assign_vars(array(
"U_FORUM_INDEX" => append_sid("../index.$phpEx"),
"U_ADMIN_INDEX" => append_sid("index.$phpEx?pane=right"),
"L_FORUM_INDEX" => $lang['Main_index'],
"L_ADMIN_INDEX" => $lang['Admin_Index'],
"L_PREVIEW_FORUM" => $lang['Preview_forum'])
);
ksort($module);
while( list($cat, $action_array) = each($module) )
{
$cat = ( !empty($lang[$cat]) ) ? $lang[$cat] : preg_replace("/_/", " ", $cat);
$template->assign_block_vars("catrow", array(
"ADMIN_CATEGORY" => $cat)
);
ksort($action_array);
$row_count = 0;
while( list($action, $file) = each($action_array) )
{
$row_color = ( !($row_count%2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($row_count%2) ) ? $theme['td_class1'] : $theme['td_class2'];
$action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace("/_/", " ", $action);
$template->assign_block_vars("catrow.modulerow", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"ADMIN_MODULE" => $action,
"U_ADMIN_MODULE" => append_sid($file))
);
$row_count++;
}
}
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
}
elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
{
include('./page_header_admin.'.$phpEx);
$template->set_filenames(array(
"body" => "admin/index_body.tpl")
);
$template->assign_vars(array(
"L_WELCOME" => $lang['Welcome_phpBB'],
"L_ADMIN_INTRO" => $lang['Admin_intro'],
"L_FORUM_STATS" => $lang['Forum_stats'],
"L_WHO_IS_ONLINE" => $lang['Who_is_Online'],
"L_USERNAME" => $lang['Username'],
"L_LOCATION" => $lang['Location'],
"L_LAST_UPDATE" => $lang['Last_updated'],
"L_IP_ADDRESS" => $lang['IP_Address'],
"L_STATISTIC" => $lang['Statistic'],
"L_VALUE" => $lang['Value'],
"L_NUMBER_POSTS" => $lang['Number_posts'],
"L_POSTS_PER_DAY" => $lang['Posts_per_day'],
"L_NUMBER_TOPICS" => $lang['Number_topics'],
"L_TOPICS_PER_DAY" => $lang['Topics_per_day'],
"L_NUMBER_USERS" => $lang['Number_users'],
"L_USERS_PER_DAY" => $lang['Users_per_day'],
"L_BOARD_STARTED" => $lang['Board_started'],
"L_AVATAR_DIR_SIZE" => $lang['Avatar_dir_size'],
"L_DB_SIZE" => $lang['Database_size'],
"L_FORUM_LOCATION" => $lang['Forum_Location'],
"L_STARTED" => $lang['Login'],
"L_GZIP_COMPRESSION" => $lang['Gzip_compression'])
);
//
// Get forum statistics
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');
$start_date = create_date($board_config['default_dateformat'], $board_config['board_startdate'], $board_config['board_timezone']);
$boarddays = ( time() - $board_config['board_startdate'] ) / 86400;
$posts_per_day = sprintf("%.2f", $total_posts / $boarddays);
$topics_per_day = sprintf("%.2f", $total_topics / $boarddays);
$users_per_day = sprintf("%.2f", $total_users / $boarddays);
$avatar_dir_size = 0;
if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path']))
{
while( $file = @readdir($avatar_dir) )
{
if( $file != "." && $file != ".." )
{
$avatar_dir_size += @filesize($phpbb_root_path . $board_config['avatar_path'] . "/" . $file);
}
}
@closedir($avatar_dir);
//
// This bit of code translates the avatar directory size into human readable format
// Borrowed the code from the PHP.net annoted manual, origanally written by:
// Jesse (jesse@jess.on.ca)
//
if($avatar_dir_size >= 1048576)
{
$avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB";
}
else if($avatar_dir_size >= 1024)
{
$avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB";
}
else
{
$avatar_dir_size = $avatar_dir_size . " Bytes";
}
}
else
{
// Couldn't open Avatar dir.
$avatar_dir_size = $lang['Not_available'];
}
if($posts_per_day > $total_posts)
{
$posts_per_day = $total_posts;
}
if($topics_per_day > $total_topics)
{
$topics_per_day = $total_topics;
}
if($users_per_day > $total_users)
{
$users_per_day = $total_users;
}
//
// DB size ... MySQL only
//
// This code is heavily influenced by a similar routine
// in phpMyAdmin 2.2.0
//
if( preg_match("/^mysql/", SQL_LAYER) )
{
$sql = "SELECT VERSION() AS mysql_version";
if($result = $db->sql_query($sql))
{
$row = $db->sql_fetchrow($result);
$version = $row['mysql_version'];
if( preg_match("/^(3\.23|4\.|5\.)/", $version) )
{
$db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)|(5\.)/", $version) ) ? "`$dbname`" : $dbname;
$sql = "SHOW TABLE STATUS
FROM " . $db_name;
if($result = $db->sql_query($sql))
{
$tabledata_ary = $db->sql_fetchrowset($result);
$dbsize = 0;
for($i = 0; $i < count($tabledata_ary); $i++)
{
if( $tabledata_ary[$i]['Type'] != "MRG_MyISAM" )
{
if( $table_prefix != "" )
{
if( strstr($tabledata_ary[$i]['Name'], $table_prefix) )
{
$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
}
}
else
{
$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
}
}
}
} // Else we couldn't get the table status.
}
else
{
$dbsize = $lang['Not_available'];
}
}
else
{
$dbsize = $lang['Not_available'];
}
}
else if( preg_match("/^mssql/", SQL_LAYER) )
{
$sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
FROM sysfiles";
if( $result = $db->sql_query($sql) )
{
$dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available'];
}
else
{
$dbsize = $lang['Not_available'];
}
}
else
{
$dbsize = $lang['Not_available'];
}
if ( is_integer($dbsize) )
{
if( $dbsize >= 1048576 )
{
$dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 ));
}
else if( $dbsize >= 1024 )
{
$dbsize = sprintf("%.2f KB", ( $dbsize / 1024 ));
}
else
{
$dbsize = sprintf("%.2f Bytes", $dbsize);
}
}
$template->assign_vars(array(
"NUMBER_OF_POSTS" => $total_posts,
"NUMBER_OF_TOPICS" => $total_topics,
"NUMBER_OF_USERS" => $total_users,
"START_DATE" => $start_date,
"POSTS_PER_DAY" => $posts_per_day,
"TOPICS_PER_DAY" => $topics_per_day,
"USERS_PER_DAY" => $users_per_day,
"AVATAR_DIR_SIZE" => $avatar_dir_size,
"DB_SIZE" => $dbsize,
"GZIP_COMPRESSION" => ( $board_config['gzip_compress'] ) ? $lang['ON'] : $lang['OFF'])
);
//
// End forum statistics
//
//
// Get users online information.
//
$sql = "SELECT u.user_id, u.username, u.user_session_time, u.user_session_page, s.session_logged_in, s.session_ip, s.session_start
FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s
WHERE s.session_logged_in = " . TRUE . "
AND u.user_id = s.session_user_id
AND u.user_id <> " . ANONYMOUS . "
AND s.session_time >= " . ( time() - 300 ) . "
ORDER BY u.user_session_time DESC";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain regd user/online information.", "", __LINE__, __FILE__, $sql);
}
$onlinerow_reg = $db->sql_fetchrowset($result);
$sql = "SELECT session_page, session_logged_in, session_time, session_ip, session_start
FROM " . SESSIONS_TABLE . "
WHERE session_logged_in = 0
AND session_time >= " . ( time() - 300 ) . "
ORDER BY session_time DESC";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain guest user/online information.", "", __LINE__, __FILE__, $sql);
}
$onlinerow_guest = $db->sql_fetchrowset($result);
$sql = "SELECT forum_name, forum_id
FROM " . FORUMS_TABLE;
if($forums_result = $db->sql_query($sql))
{
while($forumsrow = $db->sql_fetchrow($forums_result))
{
$forum_data[$forumsrow['forum_id']] = $forumsrow['forum_name'];
}
}
else
{
message_die(GENERAL_ERROR, "Couldn't obtain user/online forums information.", "", __LINE__, __FILE__, $sql);
}
$reg_userid_ary = array();
if( count($onlinerow_reg) )
{
$registered_users = 0;
for($i = 0; $i < count($onlinerow_reg); $i++)
{
if( !inarray($onlinerow_reg[$i]['user_id'], $reg_userid_ary) )
{
$reg_userid_ary[] = $onlinerow_reg[$i]['user_id'];
$username = $onlinerow_reg[$i]['username'];
if( $onlinerow_reg[$i]['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )
{
$registered_users++;
$hidden = FALSE;
}
else
{
$hidden_users++;
$hidden = TRUE;
}
if( $onlinerow_reg[$i]['user_session_page'] < 1 )
{
switch($onlinerow_reg[$i]['user_session_page'])
{
case PAGE_INDEX:
$location = $lang['Forum_index'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_POSTING:
$location = $lang['Posting_message'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_LOGIN:
$location = $lang['Logging_on'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_SEARCH:
$location = $lang['Searching_forums'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_PROFILE:
$location = $lang['Viewing_profile'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_VIEWONLINE:
$location = $lang['Viewing_online'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_VIEWMEMBERS:
$location = $lang['Viewing_member_list'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_PRIVMSGS:
$location = $lang['Viewing_priv_msgs'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_FAQ:
$location = $lang['Viewing_FAQ'];
$location_url = "index.$phpEx?pane=right";
break;
default:
$location = $lang['Forum_index'];
$location_url = "index.$phpEx?pane=right";
}
}
else
{
$location_url = append_sid("admin_forums.$phpEx?mode=editforum&amp;" . POST_FORUM_URL . "=" . $onlinerow_reg[$i]['user_session_page']);
$location = $forum_data[$onlinerow_reg[$i]['user_session_page']];
}
$row_color = ( $registered_users % 2 ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( $registered_users % 2 ) ? $theme['td_class1'] : $theme['td_class2'];
$reg_ip = decode_ip($onlinerow_reg[$i]['session_ip']);
$template->assign_block_vars("reg_user_row", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"USERNAME" => $username,
"STARTED" => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['session_start'], $board_config['board_timezone']),
"LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['user_session_time'], $board_config['board_timezone']),
"FORUM_LOCATION" => $location,
"IP_ADDRESS" => $reg_ip,
"U_WHOIS_IP" => "http://network-tools.com/default.asp?host=$reg_ip",
"U_USER_PROFILE" => append_sid("admin_users.$phpEx?mode=edit&amp;" . POST_USERS_URL . "=" . $onlinerow_reg[$i]['user_id']),
"U_FORUM_LOCATION" => append_sid($location_url))
);
}
}
}
else
{
$template->assign_vars(array(
"L_NO_REGISTERED_USERS_BROWSING" => $lang['No_users_browsing'])
);
}
//
// Guest users
//
if( count($onlinerow_guest) )
{
$guest_users = 0;
for($i = 0; $i < count($onlinerow_guest); $i++)
{
$guest_userip_ary[] = $onlinerow_guest[$i]['session_ip'];
$guest_users++;
if( $onlinerow_guest[$i]['session_page'] < 1 )
{
switch( $onlinerow_guest[$i]['session_page'] )
{
case PAGE_INDEX:
$location = $lang['Forum_index'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_POSTING:
$location = $lang['Posting_message'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_LOGIN:
$location = $lang['Logging_on'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_SEARCH:
$location = $lang['Searching_forums'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_PROFILE:
$location = $lang['Viewing_profile'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_VIEWONLINE:
$location = $lang['Viewing_online'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_VIEWMEMBERS:
$location = $lang['Viewing_member_list'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_PRIVMSGS:
$location = $lang['Viewing_priv_msgs'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_FAQ:
$location = $lang['Viewing_FAQ'];
$location_url = "index.$phpEx?pane=right";
break;
default:
$location = $lang['Forum_index'];
$location_url = "index.$phpEx?pane=right";
}
}
else
{
$location_url = append_sid("admin_forums.$phpEx?mode=editforum&amp;" . POST_FORUM_URL . "=" . $onlinerow_guest[$i]['session_page']);
$location = $forum_data[$onlinerow_guest[$i]['session_page']];
}
$row_color = ( $guest_users % 2 ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( $guest_users % 2 ) ? $theme['td_class1'] : $theme['td_class2'];
$guest_ip = decode_ip($onlinerow_guest[$i]['session_ip']);
$template->assign_block_vars("guest_user_row", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"USERNAME" => $lang['Guest'],
"STARTED" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_start'], $board_config['board_timezone']),
"LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_time'], $board_config['board_timezone']),
"FORUM_LOCATION" => $location,
"IP_ADDRESS" => $guest_ip,
"U_WHOIS_IP" => "http://network-tools.com/default.asp?host=$guest_ip",
"U_FORUM_LOCATION" => append_sid($location_url))
);
}
}
else
{
$template->assign_vars(array(
"L_NO_GUESTS_BROWSING" => $lang['No_users_browsing'])
);
}
// Check for new version
$current_version = explode('.', '2' . $board_config['version']);
$minor_revision = (int) $current_version[2];
$errno = 0;
$errstr = $version_info = '';
if ($fsock = @fsockopen('www.phpbb.com', 80, $errno, $errstr, 10))
{
@fputs($fsock, "GET /updatecheck/20x.txt HTTP/1.1\r\n");
@fputs($fsock, "HOST: www.phpbb.com\r\n");
@fputs($fsock, "Connection: close\r\n\r\n");
$get_info = false;
while (!@feof($fsock))
{
if ($get_info)
{
$version_info .= @fread($fsock, 1024);
}
else
{
if (@fgets($fsock, 1024) == "\r\n")
{
$get_info = true;
}
}
}
@fclose($fsock);
$version_info = explode("\n", $version_info);
$latest_head_revision = (int) $version_info[0];
$latest_minor_revision = (int) $version_info[2];
$latest_version = (int) $version_info[0] . '.' . (int) $version_info[1] . '.' . (int) $version_info[2];
if ($latest_head_revision == 2 && $minor_revision == $latest_minor_revision)
{
$version_info = '<p style="color:green">' . $lang['Version_up_to_date'] . '</p>';
}
else
{
$version_info = '<p style="color:red">' . $lang['Version_not_up_to_date'];
$version_info .= '<br />' . sprintf($lang['Latest_version_info'], $latest_version) . ' ' . sprintf($lang['Current_version_info'], '2' . $board_config['version']) . '</p>';
}
}
else
{
if ($errstr)
{
$version_info = '<p style="color:red">' . sprintf($lang['Connect_socket_error'], $errstr) . '</p>';
}
else
{
$version_info = '<p>' . $lang['Socket_functions_disabled'] . '</p>';
}
}
$version_info .= '<p>' . $lang['Mailing_list_subscribe_reminder'] . '</p>';
$template->assign_vars(array(
'VERSION_INFO' => $version_info,
'L_VERSION_INFORMATION' => $lang['Version_information'])
);
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
}
else
{
//
// Generate frameset
//
$template->set_filenames(array(
"body" => "admin/index_frameset.tpl")
);
$template->assign_vars(array(
"S_FRAME_NAV" => append_sid("index.$phpEx?pane=left"),
"S_FRAME_MAIN" => append_sid("index.$phpEx?pane=right"))
);
header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
$template->pparse("body");
$db->sql_close();
exit;
}
?>

View File

@@ -1,75 +0,0 @@
<?php
/***************************************************************************
* page_footer_admin.php
* -------------------
* begin : Saturday, Jul 14, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
}
global $do_gzip_compress;
//
// Show the overall footer.
//
$template->set_filenames(array(
'page_footer' => 'admin/page_footer.tpl')
);
$template->assign_vars(array(
'PHPBB_VERSION' => ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) ? '2' . $board_config['version'] : '',
'TRANSLATION_INFO' => (isset($lang['TRANSLATION_INFO'])) ? $lang['TRANSLATION_INFO'] : ((isset($lang['TRANSLATION'])) ? $lang['TRANSLATION'] : ''))
);
$template->pparse('page_footer');
//
// Close our DB connection.
//
$db->sql_close();
//
// Compress buffered output if required
// and send to browser
//
if( $do_gzip_compress )
{
//
// Borrowed from php.net!
//
$gzip_contents = ob_get_contents();
ob_end_clean();
$gzip_size = strlen($gzip_contents);
$gzip_crc = crc32($gzip_contents);
$gzip_contents = gzcompress($gzip_contents, 9);
$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents;
echo pack('V', $gzip_crc);
echo pack('V', $gzip_size);
}
exit;
?>

View File

@@ -1,150 +0,0 @@
<?php
/***************************************************************************
* page_header_admin.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
}
define('HEADER_INC', true);
//
// gzip_compression
//
$do_gzip_compress = FALSE;
if ( $board_config['gzip_compress'] )
{
$phpver = phpversion();
$useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) )
{
if ( extension_loaded('zlib') )
{
ob_start('ob_gzhandler');
}
}
else if ( $phpver > '4.0' )
{
if ( strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') )
{
if ( extension_loaded('zlib') )
{
$do_gzip_compress = TRUE;
ob_start();
ob_implicit_flush(0);
header('Content-Encoding: gzip');
}
}
}
}
$template->set_filenames(array(
'header' => 'admin/page_header.tpl')
);
// Format Timezone. We are unable to use array_pop here, because of PHP3 compatibility
$l_timezone = explode('.', $board_config['board_timezone']);
$l_timezone = (count($l_timezone) > 1 && $l_timezone[count($l_timezone)-1] != 0) ? $lang[sprintf('%.1f', $board_config['board_timezone'])] : $lang[number_format($board_config['board_timezone'])];
//
// The following assigns all _common_ variables that may be used at any point
// in a template. Note that all URL's should be wrapped in append_sid, as
// should all S_x_ACTIONS for forms.
//
$template->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'PAGE_TITLE' => $page_title,
'L_ADMIN' => $lang['Admin'],
'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']),
'L_FAQ' => $lang['FAQ'],
'U_INDEX' => append_sid('../index.'.$phpEx),
'S_TIMEZONE' => sprintf($lang['All_times'], $l_timezone),
'S_LOGIN_ACTION' => append_sid('../login.'.$phpEx),
'S_JUMPBOX_ACTION' => append_sid('../viewforum.'.$phpEx),
'S_CURRENT_TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])),
'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
'S_CONTENT_ENCODING' => $lang['ENCODING'],
'S_CONTENT_DIR_LEFT' => $lang['LEFT'],
'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'],
'T_HEAD_STYLESHEET' => $theme['head_stylesheet'],
'T_BODY_BACKGROUND' => $theme['body_background'],
'T_BODY_BGCOLOR' => '#'.$theme['body_bgcolor'],
'T_BODY_TEXT' => '#'.$theme['body_text'],
'T_BODY_LINK' => '#'.$theme['body_link'],
'T_BODY_VLINK' => '#'.$theme['body_vlink'],
'T_BODY_ALINK' => '#'.$theme['body_alink'],
'T_BODY_HLINK' => '#'.$theme['body_hlink'],
'T_TR_COLOR1' => '#'.$theme['tr_color1'],
'T_TR_COLOR2' => '#'.$theme['tr_color2'],
'T_TR_COLOR3' => '#'.$theme['tr_color3'],
'T_TR_CLASS1' => $theme['tr_class1'],
'T_TR_CLASS2' => $theme['tr_class2'],
'T_TR_CLASS3' => $theme['tr_class3'],
'T_TH_COLOR1' => '#'.$theme['th_color1'],
'T_TH_COLOR2' => '#'.$theme['th_color2'],
'T_TH_COLOR3' => '#'.$theme['th_color3'],
'T_TH_CLASS1' => $theme['th_class1'],
'T_TH_CLASS2' => $theme['th_class2'],
'T_TH_CLASS3' => $theme['th_class3'],
'T_TD_COLOR1' => '#'.$theme['td_color1'],
'T_TD_COLOR2' => '#'.$theme['td_color2'],
'T_TD_COLOR3' => '#'.$theme['td_color3'],
'T_TD_CLASS1' => $theme['td_class1'],
'T_TD_CLASS2' => $theme['td_class2'],
'T_TD_CLASS3' => $theme['td_class3'],
'T_FONTFACE1' => $theme['fontface1'],
'T_FONTFACE2' => $theme['fontface2'],
'T_FONTFACE3' => $theme['fontface3'],
'T_FONTSIZE1' => $theme['fontsize1'],
'T_FONTSIZE2' => $theme['fontsize2'],
'T_FONTSIZE3' => $theme['fontsize3'],
'T_FONTCOLOR1' => '#'.$theme['fontcolor1'],
'T_FONTCOLOR2' => '#'.$theme['fontcolor2'],
'T_FONTCOLOR3' => '#'.$theme['fontcolor3'],
'T_SPAN_CLASS1' => $theme['span_class1'],
'T_SPAN_CLASS2' => $theme['span_class2'],
'T_SPAN_CLASS3' => $theme['span_class3'])
);
// Work around for "current" Apache 2 + PHP module which seems to not
// cope with private cache control setting
if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))
{
header ('Cache-Control: no-cache, pre-check=0, post-check=0');
}
else
{
header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
}
header ('Expires: 0');
header ('Pragma: no-cache');
$template->pparse('header');
?>

View File

@@ -1,67 +0,0 @@
<?php
/***************************************************************************
* pagestart.php
* -------------------
* begin : Thursday, Aug 2, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if (!defined('IN_PHPBB'))
{
die("Hacking attempt");
}
define('IN_ADMIN', true);
// Include files
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if (!$userdata['session_logged_in'])
{
redirect(append_sid("login.$phpEx?redirect=admin/index.$phpEx", true));
}
else if ($userdata['user_level'] != ADMIN)
{
message_die(GENERAL_MESSAGE, $lang['Not_admin']);
}
if ($HTTP_GET_VARS['sid'] != $userdata['session_id'])
{
redirect("index.$phpEx?sid=" . $userdata['session_id']);
}
if (!$userdata['session_admin'])
{
redirect(append_sid("login.$phpEx?redirect=admin/index.$phpEx&admin=1", true));
}
if (empty($no_page_header))
{
// Not including the pageheader can be neccesarry if META tags are
// needed in the calling script.
include('./page_header_admin.'.$phpEx);
}
?>

4
phpBB/cache/.htaccess vendored Normal file
View File

@@ -0,0 +1,4 @@
<Limit GET POST PUT>
Order Allow,Deny
Deny from All
</Limit>

View File

@@ -1,236 +1,108 @@
<?php
/***************************************************************************
* common.php
* -------------------
* begin : Saturday, Feb 23, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/**
*
* @package phpBB3
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
// Remove the following line to enable this software, be sure you note what it
// says before continuing
die('This software is unsupported in any and all respects. By removing this notice (found in common.php) you are noting your acceptance of this. Do not ask support questions of any kind for this release at either area51.phpbb.com or www.phpbb.com. Support for this version will appear when the beta cycle begins');
if ( !defined('IN_PHPBB') )
/**
*/
if (!defined('IN_PHPBB'))
{
die("Hacking attempt");
}
//
error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables
set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
// The following code (unsetting globals)
// Thanks to Matt Kavanagh and Stefan Esser for providing feedback as well as patch files
// PHP5 with register_long_arrays off?
if (@phpversion() >= '5.0.0' && (!@ini_get('register_long_arrays') || @ini_get('register_long_arrays') == '0' || strtolower(@ini_get('register_long_arrays')) == 'off'))
{
$HTTP_POST_VARS = $_POST;
$HTTP_GET_VARS = $_GET;
$HTTP_SERVER_VARS = $_SERVER;
$HTTP_COOKIE_VARS = $_COOKIE;
$HTTP_ENV_VARS = $_ENV;
$HTTP_POST_FILES = $_FILES;
// _SESSION is the only superglobal which is conditionally set
if (isset($_SESSION))
{
$HTTP_SESSION_VARS = $_SESSION;
}
}
// Protect against GLOBALS tricks
if (isset($HTTP_POST_VARS['GLOBALS']) || isset($HTTP_POST_FILES['GLOBALS']) || isset($HTTP_GET_VARS['GLOBALS']) || isset($HTTP_COOKIE_VARS['GLOBALS']))
{
die("Hacking attempt");
}
// Protect against HTTP_SESSION_VARS tricks
if (isset($HTTP_SESSION_VARS) && !is_array($HTTP_SESSION_VARS))
{
die("Hacking attempt");
}
if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{
// PHP4+ path
$not_unset = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_SESSION_VARS', 'HTTP_ENV_VARS', 'HTTP_POST_FILES', 'phpEx', 'phpbb_root_path');
// Not only will array_merge give a warning if a parameter
// is not an array, it will actually fail. So we check if
// HTTP_SESSION_VARS has been initialised.
if (!isset($HTTP_SESSION_VARS) || !is_array($HTTP_SESSION_VARS))
{
$HTTP_SESSION_VARS = array();
}
// Merge all into one extremely huge array; unset
// this later
$input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES);
unset($input['input']);
unset($input['not_unset']);
while (list($var,) = @each($input))
{
if (in_array($var, $not_unset))
{
die('Hacking attempt!');
}
unset($$var);
}
unset($input);
}
//
// addslashes to vars if magic_quotes_gpc is off
// this is a security precaution to prevent someone
// trying to break out of a SQL statement.
//
if( !get_magic_quotes_gpc() )
{
if( is_array($HTTP_GET_VARS) )
{
while( list($k, $v) = each($HTTP_GET_VARS) )
{
if( is_array($HTTP_GET_VARS[$k]) )
{
while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
{
$HTTP_GET_VARS[$k][$k2] = addslashes($v2);
}
@reset($HTTP_GET_VARS[$k]);
}
else
{
$HTTP_GET_VARS[$k] = addslashes($v);
}
}
@reset($HTTP_GET_VARS);
}
if( is_array($HTTP_POST_VARS) )
{
while( list($k, $v) = each($HTTP_POST_VARS) )
{
if( is_array($HTTP_POST_VARS[$k]) )
{
while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) )
{
$HTTP_POST_VARS[$k][$k2] = addslashes($v2);
}
@reset($HTTP_POST_VARS[$k]);
}
else
{
$HTTP_POST_VARS[$k] = addslashes($v);
}
}
@reset($HTTP_POST_VARS);
}
if( is_array($HTTP_COOKIE_VARS) )
{
while( list($k, $v) = each($HTTP_COOKIE_VARS) )
{
if( is_array($HTTP_COOKIE_VARS[$k]) )
{
while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) )
{
$HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2);
}
@reset($HTTP_COOKIE_VARS[$k]);
}
else
{
$HTTP_COOKIE_VARS[$k] = addslashes($v);
}
}
@reset($HTTP_COOKIE_VARS);
}
}
//
// Define some basic configuration arrays this also prevents
// malicious rewriting of language and otherarray values via
// URI params
//
$board_config = array();
$userdata = array();
$theme = array();
$images = array();
$lang = array();
$nav_links = array();
$dss_seeded = false;
$gen_simple_header = FALSE;
include($phpbb_root_path . 'config.'.$phpEx);
if( !defined("PHPBB_INSTALLED") )
{
header('Location: ' . $phpbb_root_path . 'install/install.' . $phpEx);
exit;
}
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/template.'.$phpEx);
include($phpbb_root_path . 'includes/sessions.'.$phpEx);
include($phpbb_root_path . 'includes/auth.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];
error_reporting(E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables
//error_reporting(E_ALL);
set_magic_quotes_runtime(0);
// Be paranoid with passed vars
if (@ini_get('register_globals'))
{
foreach ($_REQUEST as $var_name => $void)
{
unset(${$var_name});
}
}
if (defined('IN_CRON'))
{
chdir($phpbb_root_path);
$phpbb_root_path = getcwd() . '/';
}
require($phpbb_root_path . 'config.'.$phpEx);
if (!defined('PHPBB_INSTALLED'))
{
header('Location: install/install.'.$phpEx);
exit;
}
if (defined('DEBUG_EXTRA'))
{
$base_memory_usage = 0;
if (function_exists('memory_get_usage'))
{
$base_memory_usage = memory_get_usage();
}
}
// Load Extensions
if (!empty($load_extensions))
{
$load_extensions = explode(',', $load_extensions);
foreach ($load_extensions as $extension)
{
@dl(trim($extension));
}
}
define('STRIP', (get_magic_quotes_gpc()) ? true : false);
// Include files
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx);
require($phpbb_root_path . 'includes/acm/acm_main.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/template.' . $phpEx);
require($phpbb_root_path . 'includes/session.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
// Set PHP error handler to ours
set_error_handler('msg_handler');
// Instantiate some basic classes
$user = new user();
$auth = new auth();
$template = new template();
$cache = new cache();
$db = new $sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
// We do not need this any longer, unset for safety purposes
unset($dbpasswd);
//
// Obtain and encode users IP
//
// I'm removing HTTP_X_FORWARDED_FOR ... this may well cause other problems such as
// private range IP's appearing instead of the guilty routable IP, tough, don't
// even bother complaining ... go scream and shout at the idiots out there who feel
// "clever" is doing harm rather than good ... karma is a great thing ... :)
//
$client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') );
$user_ip = encode_ip($client_ip);
// Grab global variables, re-cache if necessary
$config = $cache->obtain_config();
//
// Setup forum wide options, if this fails
// then we output a CRITICAL_ERROR since
// basic forum information is not available
//
$sql = "SELECT *
FROM " . CONFIG_TABLE;
if( !($result = $db->sql_query($sql)) )
// Warn about install/ directory
if (file_exists('install'))
{
message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$board_config[$row['config_name']] = $row['config_value'];
}
if (file_exists('install') || file_exists('contrib'))
{
message_die(GENERAL_MESSAGE, 'Please_remove_install_contrib');
}
//
// Show 'Board is disabled' message if needed.
//
if( $board_config['board_disable'] && !defined("IN_ADMIN") && !defined("IN_LOGIN") )
{
message_die(GENERAL_MESSAGE, 'Board_disable', 'Information');
// trigger_error('REMOVE_INSTALL');
}
?>

85
phpBB/cron.php Normal file
View File

@@ -0,0 +1,85 @@
<?php
/**
*
* @package phpBB3
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
define('IN_PHPBB', true);
define('IN_CRON', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
$cron_type = request_var('cron_type', '');
$use_shutdown_function = (@function_exists('register_shutdown_function')) ? true : false;
// Run cron-like action
// Real cron-based layer will be introduced in 3.2
switch ($cron_type)
{
case 'queue':
include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx);
$queue = new queue();
if ($use_shutdown_function)
{
register_shutdown_function(array(&$queue, 'process'));
}
else
{
$queue->process();
}
break;
case 'tidy_cache':
if ($use_shutdown_function)
{
register_shutdown_function(array(&$cache, 'tidy'));
}
else
{
$cache->tidy();
}
break;
case 'tidy_database':
include_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
if ($use_shutdown_function)
{
register_shutdown_function('tidy_database');
}
else
{
tidy_database();
}
break;
case 'tidy_login_keys':
if ($use_shutdown_function)
{
register_shutdown_function(array(&$user, 'tidy_login_keys'));
}
else
{
$user->tidy_login_keys();
}
}
// Output transparent gif
header('Cache-Control: no-cache');
header('Content-type: image/gif');
header('Content-length: 43');
echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
flush();
exit;
?>

View File

@@ -1,389 +0,0 @@
<?php
/***************************************************************************
* msaccess.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if(!defined("SQL_LAYER"))
{
define("SQL_LAYER","msaccess");
class sql_db
{
var $db_connect_id;
var $result_ids = array();
var $result;
var $next_id;
var $num_rows = array();
var $current_row = array();
var $field_names = array();
var $field_types = array();
var $result_rowset = array();
var $num_queries = 0;
//
// Constructor
//
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->server = $sqlserver;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->dbname = $database;
$this->db_connect_id = ($this->persistency) ? odbc_pconnect($this->server, $this->user, $this->password) : odbc_connect($this->server, $this->user, $this->password);
return ( $this->db_connect_id ) ? $this->db_connect_id : false;
}
//
// Other base methods
//
function sql_close()
{
if($this->db_connect_id)
{
if( $this->in_transaction )
{
@odbc_commit($this->db_connect_id);
}
if( count($this->result_rowset) )
{
unset($this->result_rowset);
unset($this->field_names);
unset($this->field_types);
unset($this->num_rows);
unset($this->current_row);
}
return @odbc_close($this->db_connect_id);
}
else
{
return false;
}
}
//
// Query method
//
function sql_query($query = "", $transaction = FALSE)
{
if( $query != "" )
{
$this->num_queries++;
if( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
if( !odbc_autocommit($this->db_connect_id, false) )
{
return false;
}
$this->in_transaction = TRUE;
}
$query = str_replace("LOWER(", "LCASE(", $query);
if( preg_match("/^SELECT(.*?)(LIMIT ([0-9]+)[, ]*([0-9]+)*)?$/s", $query, $limits) )
{
$query = $limits[1];
if( !empty($limits[2]) )
{
$row_offset = ( $limits[4] ) ? $limits[3] : "";
$num_rows = ( $limits[4] ) ? $limits[4] : $limits[3];
$query = "TOP " . ( $row_offset + $num_rows ) . $query;
}
$this->result = odbc_exec($this->db_connect_id, "SELECT $query");
if( $this->result )
{
if( empty($this->field_names[$this->result]) )
{
for($i = 1; $i < odbc_num_fields($this->result) + 1; $i++)
{
$this->field_names[$this->result][] = odbc_field_name($this->result, $i);
$this->field_types[$this->result][] = odbc_field_type($this->result, $i);
}
}
$this->current_row[$this->result] = 0;
$this->result_rowset[$this->result] = array();
$row_outer = ( isset($row_offset) ) ? $row_offset + 1 : 1;
$row_outer_max = ( isset($num_rows) ) ? $row_offset + $num_rows + 1 : 1E9;
$row_inner = 0;
while( odbc_fetch_row($this->result, $row_outer) && $row_outer < $row_outer_max )
{
for($j = 0; $j < count($this->field_names[$this->result]); $j++)
{
$this->result_rowset[$this->result][$row_inner][$this->field_names[$this->result][$j]] = stripslashes(odbc_result($this->result, $j + 1));
}
$row_outer++;
$row_inner++;
}
$this->num_rows[$this->result] = count($this->result_rowset[$this->result]);
odbc_free_result($this->result);
}
}
else if( eregi("^INSERT ", $query) )
{
$this->result = odbc_exec($this->db_connect_id, $query);
if( $this->result )
{
$result_id = odbc_exec($this->db_connect_id, "SELECT @@IDENTITY");
if( $result_id )
{
if( odbc_fetch_row($result_id) )
{
$this->next_id[$this->db_connect_id] = odbc_result($result_id, 1);
$this->affected_rows[$this->db_connect_id] = odbc_num_rows($this->result);
}
}
}
}
else
{
$this->result = odbc_exec($this->db_connect_id, $query);
if( $this->result )
{
$this->affected_rows[$this->db_connect_id] = odbc_num_rows($this->result);
}
}
if( !$this->result )
{
if( $this->in_transaction )
{
odbc_rollback($this->db_connect_id);
odbc_autocommit($this->db_connect_id, true);
$this->in_transaction = FALSE;
}
return false;
}
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$this->in_transaction = FALSE;
if ( !@odbc_commit($this->db_connect_id) )
{
odbc_rollback($this->db_connect_id);
odbc_autocommit($this->db_connect_id, true);
return false;
}
odbc_autocommit($this->db_connect_id, true);
}
return $this->result;
}
else
{
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$this->in_transaction = FALSE;
if ( !@odbc_commit($this->db_connect_id) )
{
odbc_rollback($this->db_connect_id);
odbc_autocommit($this->db_connect_id, true);
return false;
}
odbc_autocommit($this->db_connect_id, true);
}
return true;
}
}
//
// Other query methods
//
function sql_numrows($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
return ( $query_id ) ? $this->num_rows[$query_id] : false;
}
function sql_numfields($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
return ( $query_id ) ? count($this->field_names[$query_id]) : false;
}
function sql_fieldname($offset, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
return ( $query_id ) ? $this->field_names[$query_id][$offset] : false;
}
function sql_fieldtype($offset, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
return ( $query_id ) ? $this->field_types[$query_id][$offset] : false;
}
function sql_fetchrow($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
return ( $this->num_rows[$query_id] && $this->current_row[$query_id] < $this->num_rows[$query_id] ) ? $this->result_rowset[$query_id][$this->current_row[$query_id]++] : false;
}
else
{
return false;
}
}
function sql_fetchrowset($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
return ( $this->num_rows[$query_id] ) ? $this->result_rowset[$query_id] : false;
}
else
{
return false;
}
}
function sql_fetchfield($field, $row = -1, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
if( $row < $this->num_rows[$query_id] )
{
$getrow = ($row == -1) ? $this->current_row[$query_id] - 1 : $row;
return $this->result_rowset[$query_id][$getrow][$this->field_names[$query_id][$field]];
}
else
{
return false;
}
}
else
{
return false;
}
}
function sql_rowseek($offset, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
$this->current_row[$query_id] = $offset - 1;
return true;
}
else
{
return false;
}
}
function sql_nextid()
{
return ( $this->next_id[$this->db_connect_id] ) ? $this->next_id[$this->db_connect_id] : false;
}
function sql_affectedrows()
{
return ( $this->affected_rows[$this->db_connect_id] ) ? $this->affected_rows[$this->db_connect_id] : false;
}
function sql_freeresult($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
unset($this->num_rows[$query_id]);
unset($this->current_row[$query_id]);
unset($this->result_rowset[$query_id]);
unset($this->field_names[$query_id]);
unset($this->field_types[$query_id]);
return true;
}
function sql_error()
{
$error['code'] = "";//odbc_error($this->db_connect_id);
$error['message'] = "Error";//odbc_errormsg($this->db_connect_id);
return $error;
}
} // class sql_db
} // if ... define
?>

View File

@@ -1,387 +0,0 @@
<?php
/***************************************************************************
* mssql-odbc.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if(!defined("SQL_LAYER"))
{
define("SQL_LAYER","mssql-odbc");
class sql_db
{
var $db_connect_id;
var $result;
var $next_id;
var $num_rows = array();
var $current_row = array();
var $field_names = array();
var $field_types = array();
var $result_rowset = array();
var $num_queries = 0;
//
// Constructor
//
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->server = $sqlserver;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->dbname = $database;
$this->db_connect_id = ($this->persistency) ? odbc_pconnect($this->server, $this->user, $this->password) : odbc_connect($this->server, $this->user, $this->password);
return ( $this->db_connect_id ) ? $this->db_connect_id : false;
}
//
// Other base methods
//
function sql_close()
{
if($this->db_connect_id)
{
if( $this->in_transaction )
{
@odbc_commit($this->db_connect_id);
}
if( count($this->result_rowset) )
{
unset($this->result_rowset);
unset($this->field_names);
unset($this->field_types);
unset($this->num_rows);
unset($this->current_row);
}
return @odbc_close($this->db_connect_id);
}
else
{
return false;
}
}
//
// Query method
//
function sql_query($query = "", $transaction = FALSE)
{
if( $query != "" )
{
$this->num_queries++;
if( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
if( !odbc_autocommit($this->db_connect_id, false) )
{
return false;
}
$this->in_transaction = TRUE;
}
if( preg_match("/^SELECT(.*?)(LIMIT ([0-9]+)[, ]*([0-9]+)*)?$/s", $query, $limits) )
{
$query = $limits[1];
if( !empty($limits[2]) )
{
$row_offset = ( $limits[4] ) ? $limits[3] : "";
$num_rows = ( $limits[4] ) ? $limits[4] : $limits[3];
$query = "TOP " . ( $row_offset + $num_rows ) . $query;
}
$this->result = odbc_exec($this->db_connect_id, "SELECT $query");
if( $this->result )
{
if( empty($this->field_names[$this->result]) )
{
for($i = 1; $i < odbc_num_fields($this->result) + 1; $i++)
{
$this->field_names[$this->result][] = odbc_field_name($this->result, $i);
$this->field_types[$this->result][] = odbc_field_type($this->result, $i);
}
}
$this->current_row[$this->result] = 0;
$this->result_rowset[$this->result] = array();
$row_outer = ( isset($row_offset) ) ? $row_offset + 1 : 1;
$row_outer_max = ( isset($num_rows) ) ? $row_offset + $num_rows + 1 : 1E9;
$row_inner = 0;
while( odbc_fetch_row($this->result, $row_outer) && $row_outer < $row_outer_max )
{
for($j = 0; $j < count($this->field_names[$this->result]); $j++)
{
$this->result_rowset[$this->result][$row_inner][$this->field_names[$this->result][$j]] = stripslashes(odbc_result($this->result, $j + 1));
}
$row_outer++;
$row_inner++;
}
$this->num_rows[$this->result] = count($this->result_rowset[$this->result]);
}
}
else if( eregi("^INSERT ", $query) )
{
$this->result = odbc_exec($this->db_connect_id, $query);
if( $this->result )
{
$result_id = odbc_exec($this->db_connect_id, "SELECT @@IDENTITY");
if( $result_id )
{
if( odbc_fetch_row($result_id) )
{
$this->next_id[$this->db_connect_id] = odbc_result($result_id, 1);
$this->affected_rows[$this->db_connect_id] = odbc_num_rows($this->result);
}
}
}
}
else
{
$this->result = odbc_exec($this->db_connect_id, $query);
if( $this->result )
{
$this->affected_rows[$this->db_connect_id] = odbc_num_rows($this->result);
}
}
if( !$this->result )
{
if( $this->in_transaction )
{
odbc_rollback($this->db_connect_id);
odbc_autocommit($this->db_connect_id, true);
$this->in_transaction = FALSE;
}
return false;
}
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$this->in_transaction = FALSE;
if ( !odbc_commit($this->db_connect_id) )
{
odbc_rollback($this->db_connect_id);
odbc_autocommit($this->db_connect_id, true);
return false;
}
odbc_autocommit($this->db_connect_id, true);
}
odbc_free_result($this->result);
return $this->result;
}
else
{
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$this->in_transaction = FALSE;
if ( !@odbc_commit($this->db_connect_id) )
{
odbc_rollback($this->db_connect_id);
odbc_autocommit($this->db_connect_id, true);
return false;
}
odbc_autocommit($this->db_connect_id, true);
}
return true;
}
}
//
// Other query methods
//
function sql_numrows($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
return ( $query_id ) ? $this->num_rows[$query_id] : false;
}
function sql_numfields($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
return ( $query_id ) ? count($this->field_names[$query_id]) : false;
}
function sql_fieldname($offset, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
return ( $query_id ) ? $this->field_names[$query_id][$offset] : false;
}
function sql_fieldtype($offset, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
return ( $query_id ) ? $this->field_types[$query_id][$offset] : false;
}
function sql_fetchrow($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
return ( $this->num_rows[$query_id] && $this->current_row[$query_id] < $this->num_rows[$query_id] ) ? $this->result_rowset[$query_id][$this->current_row[$query_id]++] : false;
}
else
{
return false;
}
}
function sql_fetchrowset($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
return ( $this->num_rows[$query_id] ) ? $this->result_rowset[$query_id] : false;
}
else
{
return false;
}
}
function sql_fetchfield($field, $row = -1, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
if( $row < $this->num_rows[$query_id] )
{
$getrow = ( $row == -1 ) ? $this->current_row[$query_id] - 1 : $row;
return $this->result_rowset[$query_id][$getrow][$this->field_names[$query_id][$field]];
}
else
{
return false;
}
}
else
{
return false;
}
}
function sql_rowseek($offset, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
$this->current_row[$query_id] = $offset - 1;
return true;
}
else
{
return false;
}
}
function sql_nextid()
{
return ( $this->next_id[$this->db_connect_id] ) ? $this->next_id[$this->db_connect_id] : false;
}
function sql_affectedrows()
{
return ( $this->affected_rows[$this->db_connect_id] ) ? $this->affected_rows[$this->db_connect_id] : false;
}
function sql_freeresult($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
unset($this->num_rows[$query_id]);
unset($this->current_row[$query_id]);
unset($this->result_rowset[$query_id]);
unset($this->field_names[$query_id]);
unset($this->field_types[$query_id]);
return true;
}
function sql_error()
{
$error['code'] = odbc_error($this->db_connect_id);
$error['message'] = odbc_errormsg($this->db_connect_id);
return $error;
}
} // class sql_db
} // if ... define
?>

View File

@@ -1,418 +0,0 @@
<?php
/***************************************************************************
* mssql.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : supportphpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if(!defined("SQL_LAYER"))
{
define("SQL_LAYER","mssql");
class sql_db
{
var $db_connect_id;
var $result;
var $next_id;
var $in_transaction = 0;
var $row = array();
var $rowset = array();
var $limit_offset;
var $query_limit_success;
var $num_queries = 0;
//
// Constructor
//
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver;
$this->dbname = $database;
$this->db_connect_id = ( $this->persistency ) ? @mssql_pconnect($this->server, $this->user, $this->password) : @mssql_connect($this->server, $this->user, $this->password);
if( $this->db_connect_id && $this->dbname != "" )
{
if( !mssql_select_db($this->dbname, $this->db_connect_id) )
{
mssql_close($this->db_connect_id);
return false;
}
}
return $this->db_connect_id;
}
//
// Other base methods
//
function sql_close()
{
if($this->db_connect_id)
{
//
// Commit any remaining transactions
//
if( $this->in_transaction )
{
@mssql_query("COMMIT", $this->db_connect_id);
}
return @mssql_close($this->db_connect_id);
}
else
{
return false;
}
}
//
// Query method
//
function sql_query($query = '', $transaction = FALSE)
{
//
// Remove any pre-existing queries
//
unset($this->result);
unset($this->row);
if ( $query != '' )
{
$this->num_queries++;
if ( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
if ( !@mssql_query('BEGIN TRANSACTION', $this->db_connect_id) )
{
return false;
}
$this->in_transaction = TRUE;
}
//
// Does query contain any LIMIT code? If so pull out relevant start and num_results
// This isn't terribly easy with MSSQL, whatever you do will potentially impact
// performance compared to an 'in-built' limit
//
// Another issue is the 'lack' of a returned true value when a query is valid but has
// no result set (as with all the other DB interfaces). It seems though that it's
// 'fair' to say that if a query returns a false result (ie. no resource id) then the
// SQL was valid but had no result set. If the query returns nothing but the rowcount
// returns something then there's a problem. This may well be a false assumption though
// ... needs checking under Windows itself.
//
if( preg_match('#^SELECT(.*?)(LIMIT ([0-9]+)[, ]*([0-9]+)*)?$#s', $query, $limits) )
{
$query = $limits[1];
if( !empty($limits[2]) )
{
$row_offset = ( $limits[4] ) ? $limits[3] : "";
$num_rows = ( $limits[4] ) ? $limits[4] : $limits[3];
$query = 'TOP ' . ( $row_offset + $num_rows ) . $query;
}
$this->result = @mssql_query("SELECT $query", $this->db_connect_id);
if( $this->result )
{
$this->limit_offset[$this->result] = ( !empty($row_offset) ) ? $row_offset : 0;
if( $row_offset > 0 )
{
@mssql_data_seek($this->result, $row_offset);
}
}
}
else if( preg_match('#^INSERT #i', $query) )
{
if( @mssql_query($query, $this->db_connect_id) )
{
$this->result = time() + microtime();
$result_id = @mssql_query('SELECT @@IDENTITY AS id, @@ROWCOUNT as affected', $this->db_connect_id);
if( $result_id )
{
if( $row = @mssql_fetch_array($result_id) )
{
$this->next_id[$this->db_connect_id] = $row['id'];
$this->affected_rows[$this->db_connect_id] = $row['affected'];
}
}
}
}
else
{
if( @mssql_query($query, $this->db_connect_id) )
{
$this->result = time() + microtime();
$result_id = @mssql_query('SELECT @@ROWCOUNT as affected', $this->db_connect_id);
if( $result_id )
{
if( $row = @mssql_fetch_array($result_id) )
{
$this->affected_rows[$this->db_connect_id] = $row['affected'];
}
}
}
}
if( !$this->result )
{
if( $this->in_transaction )
{
@mssql_query('ROLLBACK', $this->db_connect_id);
$this->in_transaction = FALSE;
}
return false;
}
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$this->in_transaction = FALSE;
if( !@mssql_query('COMMIT', $this->db_connect_id) )
{
@mssql_query("ROLLBACK", $this->db_connect_id);
return false;
}
}
return $this->result;
}
else
{
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$this->in_transaction = FALSE;
if( !@mssql_query('COMMIT', $this->db_connect_id) )
{
@mssql_query('ROLLBACK', $this->db_connect_id);
return false;
}
}
return true;
}
}
//
// Other query methods
//
function sql_numrows($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
return ( !empty($this->limit_offset[$query_id]) ) ? @mssql_num_rows($query_id) - $this->limit_offset[$query_id] : @mssql_num_rows($query_id);
}
else
{
return false;
}
}
function sql_numfields($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
return ( $query_id ) ? @mssql_num_fields($query_id) : false;
}
function sql_fieldname($offset, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
return ( $query_id ) ? @mssql_field_name($query_id, $offset) : false;
}
function sql_fieldtype($offset, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->result;
}
return ( $query_id ) ? @mssql_field_type($query_id, $offset) : false;
}
function sql_fetchrow($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
empty($row);
$row = @mssql_fetch_array($query_id);
while( list($key, $value) = @each($row) )
{
$row[$key] = ($value === ' ') ? '' : stripslashes($value);
}
@reset($row);
return $row;
}
else
{
return false;
}
}
function sql_fetchrowset($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
$i = 0;
empty($rowset);
while( $row = @mssql_fetch_array($query_id))
{
while( list($key, $value) = @each($row) )
{
$rowset[$i][$key] = ($value === ' ') ? '' : stripslashes($value);
}
$i++;
}
@reset($rowset);
return $rowset;
}
else
{
return false;
}
}
function sql_fetchfield($field, $row = -1, $query_id)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
if( $row != -1 )
{
if( $this->limit_offset[$query_id] > 0 )
{
$result = ( !empty($this->limit_offset[$query_id]) ) ? @mssql_result($this->result, ($this->limit_offset[$query_id] + $row), $field) : false;
}
else
{
$result = @mssql_result($this->result, $row, $field);
}
}
else
{
if( empty($this->row[$query_id]) )
{
$this->row[$query_id] = @mssql_fetch_array($query_id);
$result = ($this->row[$query_id][$field] === ' ') ? '' : stripslashes($this->row[$query_id][$field]);
}
}
return $result;
}
else
{
return false;
}
}
function sql_rowseek($rownum, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
if( $query_id )
{
return ( !empty($this->limit_offset[$query_id]) ) ? @mssql_data_seek($query_id, ($this->limit_offset[$query_id] + $rownum)) : @mssql_data_seek($query_id, $rownum);
}
else
{
return false;
}
}
function sql_nextid()
{
return ( $this->next_id[$this->db_connect_id] ) ? $this->next_id[$this->db_connect_id] : false;
}
function sql_affectedrows()
{
return ( $this->affected_rows[$this->db_connect_id] ) ? $this->affected_rows[$this->db_connect_id] : false;
}
function sql_freeresult($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->result;
}
return ( $query_id ) ? @mssql_free_result($query_id) : false;
}
function sql_error($query_id = 0)
{
$result['message'] = @mssql_get_last_message();
return $result;
}
} // class sql_db
} // if ... define
?>

View File

@@ -1,335 +0,0 @@
<?php
/***************************************************************************
* mysql.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if(!defined("SQL_LAYER"))
{
define("SQL_LAYER","mysql");
class sql_db
{
var $db_connect_id;
var $query_result;
var $row = array();
var $rowset = array();
var $num_queries = 0;
//
// Constructor
//
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver;
$this->dbname = $database;
if($this->persistency)
{
$this->db_connect_id = @mysql_pconnect($this->server, $this->user, $this->password);
}
else
{
$this->db_connect_id = @mysql_connect($this->server, $this->user, $this->password);
}
if($this->db_connect_id)
{
if($database != "")
{
$this->dbname = $database;
$dbselect = @mysql_select_db($this->dbname);
if(!$dbselect)
{
@mysql_close($this->db_connect_id);
$this->db_connect_id = $dbselect;
}
}
return $this->db_connect_id;
}
else
{
return false;
}
}
//
// Other base methods
//
function sql_close()
{
if($this->db_connect_id)
{
if($this->query_result)
{
@mysql_free_result($this->query_result);
}
$result = @mysql_close($this->db_connect_id);
return $result;
}
else
{
return false;
}
}
//
// Base query method
//
function sql_query($query = "", $transaction = FALSE)
{
// Remove any pre-existing queries
unset($this->query_result);
if($query != "")
{
$this->num_queries++;
$this->query_result = @mysql_query($query, $this->db_connect_id);
}
if($this->query_result)
{
unset($this->row[$this->query_result]);
unset($this->rowset[$this->query_result]);
return $this->query_result;
}
else
{
return ( $transaction == END_TRANSACTION ) ? true : false;
}
}
//
// Other query methods
//
function sql_numrows($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_num_rows($query_id);
return $result;
}
else
{
return false;
}
}
function sql_affectedrows()
{
if($this->db_connect_id)
{
$result = @mysql_affected_rows($this->db_connect_id);
return $result;
}
else
{
return false;
}
}
function sql_numfields($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_num_fields($query_id);
return $result;
}
else
{
return false;
}
}
function sql_fieldname($offset, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_field_name($query_id, $offset);
return $result;
}
else
{
return false;
}
}
function sql_fieldtype($offset, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_field_type($query_id, $offset);
return $result;
}
else
{
return false;
}
}
function sql_fetchrow($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$this->row[$query_id] = @mysql_fetch_array($query_id);
return $this->row[$query_id];
}
else
{
return false;
}
}
function sql_fetchrowset($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
unset($this->rowset[$query_id]);
unset($this->row[$query_id]);
while($this->rowset[$query_id] = @mysql_fetch_array($query_id))
{
$result[] = $this->rowset[$query_id];
}
return $result;
}
else
{
return false;
}
}
function sql_fetchfield($field, $rownum = -1, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
if($rownum > -1)
{
$result = @mysql_result($query_id, $rownum, $field);
}
else
{
if(empty($this->row[$query_id]) && empty($this->rowset[$query_id]))
{
if($this->sql_fetchrow())
{
$result = $this->row[$query_id][$field];
}
}
else
{
if($this->rowset[$query_id])
{
$result = $this->rowset[$query_id][0][$field];
}
else if($this->row[$query_id])
{
$result = $this->row[$query_id][$field];
}
}
}
return $result;
}
else
{
return false;
}
}
function sql_rowseek($rownum, $query_id = 0){
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_data_seek($query_id, $rownum);
return $result;
}
else
{
return false;
}
}
function sql_nextid(){
if($this->db_connect_id)
{
$result = @mysql_insert_id($this->db_connect_id);
return $result;
}
else
{
return false;
}
}
function sql_freeresult($query_id = 0){
if(!$query_id)
{
$query_id = $this->query_result;
}
if ( $query_id )
{
unset($this->row[$query_id]);
unset($this->rowset[$query_id]);
@mysql_free_result($query_id);
return true;
}
else
{
return false;
}
}
function sql_error($query_id = 0)
{
$result["message"] = @mysql_error($this->db_connect_id);
$result["code"] = @mysql_errno($this->db_connect_id);
return $result;
}
} // class sql_db
} // if ... define
?>

View File

@@ -1,340 +0,0 @@
<?php
/***************************************************************************
* mysql4.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : supportphpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if(!defined("SQL_LAYER"))
{
define("SQL_LAYER","mysql4");
class sql_db
{
var $db_connect_id;
var $query_result;
var $row = array();
var $rowset = array();
var $num_queries = 0;
var $in_transaction = 0;
//
// Constructor
//
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver;
$this->dbname = $database;
$this->db_connect_id = ($this->persistency) ? mysql_pconnect($this->server, $this->user, $this->password) : mysql_connect($this->server, $this->user, $this->password);
if( $this->db_connect_id )
{
if( $database != "" )
{
$this->dbname = $database;
$dbselect = mysql_select_db($this->dbname);
if( !$dbselect )
{
mysql_close($this->db_connect_id);
$this->db_connect_id = $dbselect;
}
}
return $this->db_connect_id;
}
else
{
return false;
}
}
//
// Other base methods
//
function sql_close()
{
if( $this->db_connect_id )
{
//
// Commit any remaining transactions
//
if( $this->in_transaction )
{
mysql_query("COMMIT", $this->db_connect_id);
}
return mysql_close($this->db_connect_id);
}
else
{
return false;
}
}
//
// Base query method
//
function sql_query($query = "", $transaction = FALSE)
{
//
// Remove any pre-existing queries
//
unset($this->query_result);
if( $query != "" )
{
$this->num_queries++;
if( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
$result = mysql_query("BEGIN", $this->db_connect_id);
if(!$result)
{
return false;
}
$this->in_transaction = TRUE;
}
$this->query_result = mysql_query($query, $this->db_connect_id);
}
else
{
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$result = mysql_query("COMMIT", $this->db_connect_id);
}
}
if( $this->query_result )
{
unset($this->row[$this->query_result]);
unset($this->rowset[$this->query_result]);
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$this->in_transaction = FALSE;
if ( !mysql_query("COMMIT", $this->db_connect_id) )
{
mysql_query("ROLLBACK", $this->db_connect_id);
return false;
}
}
return $this->query_result;
}
else
{
if( $this->in_transaction )
{
mysql_query("ROLLBACK", $this->db_connect_id);
$this->in_transaction = FALSE;
}
return false;
}
}
//
// Other query methods
//
function sql_numrows($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
return ( $query_id ) ? mysql_num_rows($query_id) : false;
}
function sql_affectedrows()
{
return ( $this->db_connect_id ) ? mysql_affected_rows($this->db_connect_id) : false;
}
function sql_numfields($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
return ( $query_id ) ? mysql_num_fields($query_id) : false;
}
function sql_fieldname($offset, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
return ( $query_id ) ? mysql_field_name($query_id, $offset) : false;
}
function sql_fieldtype($offset, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
return ( $query_id ) ? mysql_field_type($query_id, $offset) : false;
}
function sql_fetchrow($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
if( $query_id )
{
$this->row[$query_id] = mysql_fetch_array($query_id, MYSQL_ASSOC);
return $this->row[$query_id];
}
else
{
return false;
}
}
function sql_fetchrowset($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
if( $query_id )
{
unset($this->rowset[$query_id]);
unset($this->row[$query_id]);
while($this->rowset[$query_id] = mysql_fetch_array($query_id, MYSQL_ASSOC))
{
$result[] = $this->rowset[$query_id];
}
return $result;
}
else
{
return false;
}
}
function sql_fetchfield($field, $rownum = -1, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
if( $query_id )
{
if( $rownum > -1 )
{
$result = mysql_result($query_id, $rownum, $field);
}
else
{
if( empty($this->row[$query_id]) && empty($this->rowset[$query_id]) )
{
if( $this->sql_fetchrow() )
{
$result = $this->row[$query_id][$field];
}
}
else
{
if( $this->rowset[$query_id] )
{
$result = $this->rowset[$query_id][0][$field];
}
else if( $this->row[$query_id] )
{
$result = $this->row[$query_id][$field];
}
}
}
return $result;
}
else
{
return false;
}
}
function sql_rowseek($rownum, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
return ( $query_id ) ? mysql_data_seek($query_id, $rownum) : false;
}
function sql_nextid()
{
return ( $this->db_connect_id ) ? mysql_insert_id($this->db_connect_id) : false;
}
function sql_freeresult($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
if ( $query_id )
{
unset($this->row[$query_id]);
unset($this->rowset[$query_id]);
mysql_free_result($query_id);
return true;
}
else
{
return false;
}
}
function sql_error()
{
$result['message'] = mysql_error($this->db_connect_id);
$result['code'] = mysql_errno($this->db_connect_id);
return $result;
}
} // class sql_db
} // if ... define
?>

View File

@@ -1,397 +0,0 @@
<?php
/***************************************************************************
* postgres7.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : supportphpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if(!defined("SQL_LAYER"))
{
define("SQL_LAYER","postgresql");
class sql_db
{
var $db_connect_id;
var $query_result;
var $in_transaction = 0;
var $row = array();
var $rowset = array();
var $rownum = array();
var $num_queries = 0;
//
// Constructor
//
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->connect_string = "";
if( $sqluser )
{
$this->connect_string .= "user=$sqluser ";
}
if( $sqlpassword )
{
$this->connect_string .= "password=$sqlpassword ";
}
if( $sqlserver )
{
if( ereg(":", $sqlserver) )
{
list($sqlserver, $sqlport) = split(":", $sqlserver);
$this->connect_string .= "host=$sqlserver port=$sqlport ";
}
else
{
if( $sqlserver != "localhost" )
{
$this->connect_string .= "host=$sqlserver ";
}
}
}
if( $database )
{
$this->dbname = $database;
$this->connect_string .= "dbname=$database";
}
$this->persistency = $persistency;
$this->db_connect_id = ( $this->persistency ) ? pg_pconnect($this->connect_string) : pg_connect($this->connect_string);
return ( $this->db_connect_id ) ? $this->db_connect_id : false;
}
//
// Other base methods
//
function sql_close()
{
if( $this->db_connect_id )
{
//
// Commit any remaining transactions
//
if( $this->in_transaction )
{
@pg_exec($this->db_connect_id, "COMMIT");
}
if( $this->query_result )
{
@pg_freeresult($this->query_result);
}
return @pg_close($this->db_connect_id);
}
else
{
return false;
}
}
//
// Query method
//
function sql_query($query = "", $transaction = false)
{
//
// Remove any pre-existing queries
//
unset($this->query_result);
if( $query != "" )
{
$this->num_queries++;
$query = preg_replace("/LIMIT ([0-9]+),([ 0-9]+)/", "LIMIT \\2 OFFSET \\1", $query);
if( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
$this->in_transaction = TRUE;
if( !@pg_exec($this->db_connect_id, "BEGIN") )
{
return false;
}
}
$this->query_result = @pg_exec($this->db_connect_id, $query);
if( $this->query_result )
{
if( $transaction == END_TRANSACTION )
{
$this->in_transaction = FALSE;
if( !@pg_exec($this->db_connect_id, "COMMIT") )
{
@pg_exec($this->db_connect_id, "ROLLBACK");
return false;
}
}
$this->last_query_text[$this->query_result] = $query;
$this->rownum[$this->query_result] = 0;
unset($this->row[$this->query_result]);
unset($this->rowset[$this->query_result]);
return $this->query_result;
}
else
{
if( $this->in_transaction )
{
@pg_exec($this->db_connect_id, "ROLLBACK");
}
$this->in_transaction = FALSE;
return false;
}
}
else
{
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$this->in_transaction = FALSE;
if( !@pg_exec($this->db_connect_id, "COMMIT") )
{
@pg_exec($this->db_connect_id, "ROLLBACK");
return false;
}
}
return true;
}
}
//
// Other query methods
//
function sql_numrows($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
return ( $query_id ) ? @pg_numrows($query_id) : false;
}
function sql_numfields($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
return ( $query_id ) ? @pg_numfields($query_id) : false;
}
function sql_fieldname($offset, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
return ( $query_id ) ? @pg_fieldname($query_id, $offset) : false;
}
function sql_fieldtype($offset, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
return ( $query_id ) ? @pg_fieldtype($query_id, $offset) : false;
}
function sql_fetchrow($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
if($query_id)
{
$this->row = @pg_fetch_array($query_id, $this->rownum[$query_id]);
if( $this->row )
{
$this->rownum[$query_id]++;
return $this->row;
}
}
return false;
}
function sql_fetchrowset($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
if( $query_id )
{
unset($this->rowset[$query_id]);
unset($this->row[$query_id]);
$this->rownum[$query_id] = 0;
while( $this->rowset = @pg_fetch_array($query_id, $this->rownum[$query_id], PGSQL_ASSOC) )
{
$result[] = $this->rowset;
$this->rownum[$query_id]++;
}
return $result;
}
return false;
}
function sql_fetchfield($field, $row_offset=-1, $query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
if( $query_id )
{
if( $row_offset != -1 )
{
$this->row = @pg_fetch_array($query_id, $row_offset, PGSQL_ASSOC);
}
else
{
if( $this->rownum[$query_id] )
{
$this->row = @pg_fetch_array($query_id, $this->rownum[$query_id]-1, PGSQL_ASSOC);
}
else
{
$this->row = @pg_fetch_array($query_id, $this->rownum[$query_id], PGSQL_ASSOC);
if( $this->row )
{
$this->rownum[$query_id]++;
}
}
}
return $this->row[$field];
}
return false;
}
function sql_rowseek($offset, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if( $query_id )
{
if( $offset > -1 )
{
$this->rownum[$query_id] = $offset;
return true;
}
else
{
return false;
}
}
return false;
}
function sql_nextid()
{
$query_id = $this->query_result;
if($query_id && $this->last_query_text[$query_id] != "")
{
if( preg_match("/^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)/is", $this->last_query_text[$query_id], $tablename) )
{
$query = "SELECT currval('" . $tablename[1] . "_id_seq') AS last_value";
$temp_q_id = @pg_exec($this->db_connect_id, $query);
if( !$temp_q_id )
{
return false;
}
$temp_result = @pg_fetch_array($temp_q_id, 0, PGSQL_ASSOC);
return ( $temp_result ) ? $temp_result['last_value'] : false;
}
}
return false;
}
function sql_affectedrows($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
return ( $query_id ) ? @pg_cmdtuples($query_id) : false;
}
function sql_freeresult($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
return ( $query_id ) ? @pg_freeresult($query_id) : false;
}
function sql_error($query_id = 0)
{
if( !$query_id )
{
$query_id = $this->query_result;
}
$result['message'] = @pg_errormessage($this->db_connect_id);
$result['code'] = -1;
return $result;
}
} // class ... db_sql
} // if ... defined
?>

View File

@@ -0,0 +1,425 @@
<?php
// -------------------------------------------------------------
//
// $Id$
//
// FILENAME : add_permissions.php
// STARTED : Sat Nov 06, 2004
// COPYRIGHT : <20> 2004 phpBB Group
// WWW : http://www.phpbb.com/
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
//
// -------------------------------------------------------------
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
// This script adds missing permissions
$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
define('IN_PHPBB', 1);
define('ANONYMOUS', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'config.'.$phpEx);
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
define('ACL_NO', 0);
define('ACL_YES', 1);
define('ACL_UNSET', -1);
define('ACL_GROUPS_TABLE', $table_prefix.'auth_groups');
define('ACL_OPTIONS_TABLE', $table_prefix.'auth_options');
define('ACL_USERS_TABLE', $table_prefix.'auth_users');
define('GROUPS_TABLE', $table_prefix.'groups');
define('USERS_TABLE', $table_prefix.'users');
$cache = new acm();
$db = new sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
// auth => is_local, is_global
$f_permissions = array(
'f_' => array(1, 0),
'f_list' => array(1, 0),
'f_read' => array(1, 0),
'f_post' => array(1, 0),
'f_reply' => array(1, 0),
'f_quote' => array(1, 0),
'f_edit' => array(1, 0),
'f_user_lock' => array(1, 0),
'f_delete' => array(1, 0),
'f_bump' => array(1, 0),
'f_poll' => array(1, 0),
'f_vote' => array(1, 0),
'f_votechg' => array(1, 0),
'f_announce'=> array(1, 0),
'f_sticky' => array(1, 0),
'f_attach' => array(1, 0),
'f_download'=> array(1, 0),
'f_icons' => array(1, 0),
'f_html' => array(1, 0),
'f_bbcode' => array(1, 0),
'f_smilies' => array(1, 0),
'f_img' => array(1, 0),
'f_flash' => array(1, 0),
'f_sigs' => array(1, 0),
'f_search' => array(1, 0),
'f_email' => array(1, 0),
'f_rate' => array(1, 0),
'f_print' => array(1, 0),
'f_ignoreflood' => array(1, 0),
'f_postcount' => array(1, 0),
'f_moderate'=> array(1, 0),
'f_report' => array(1, 0),
'f_subscribe' => array(1, 0),
);
$m_permissions = array(
'm_' => array(1, 1),
'm_edit' => array(1, 1),
'm_delete' => array(1, 1),
'm_move' => array(1, 1),
'm_lock' => array(1, 1),
'm_split' => array(1, 1),
'm_merge' => array(1, 1),
'm_approve' => array(1, 1),
'm_unrate' => array(1, 1),
'm_auth' => array(1, 1),
'm_ip' => array(1, 1),
'm_info' => array(1, 1),
);
$a_permissions = array(
'a_' => array(0, 1),
'a_server' => array(0, 1),
'a_defaults'=> array(0, 1),
'a_board' => array(0, 1),
'a_cookies' => array(0, 1),
'a_clearlogs' => array(0, 1),
'a_words' => array(0, 1),
'a_icons' => array(0, 1),
'a_bbcode' => array(0, 1),
'a_attach' => array(0, 1),
'a_email' => array(0, 1),
'a_styles' => array(0, 1),
'a_user' => array(0, 1),
'a_useradd' => array(0, 1),
'a_userdel' => array(0, 1),
'a_ranks' => array(0, 1),
'a_ban' => array(0, 1),
'a_names' => array(0, 1),
'a_group' => array(0, 1),
'a_groupadd'=> array(0, 1),
'a_groupdel'=> array(0, 1),
'a_forum' => array(0, 1),
'a_forumadd'=> array(0, 1),
'a_forumdel'=> array(0, 1),
'a_prune' => array(0, 1),
'a_auth' => array(0, 1),
'a_authmods'=> array(0, 1),
'a_authadmins' => array(0, 1),
'a_authusers' => array(0, 1),
'a_authgroups' => array(0, 1),
'a_authdeps'=> array(0, 1),
'a_backup' => array(0, 1),
'a_restore' => array(0, 1),
'a_search' => array(0, 1),
'a_events' => array(0, 1),
'a_cron' => array(0, 1),
);
$u_permissions = array(
'u_' => array(0, 1),
'u_sendemail' => array(0, 1),
'u_readpm' => array(0, 1),
'u_sendpm' => array(0, 1),
'u_sendim' => array(0, 1),
'u_hideonline' => array(0, 1),
'u_viewonline' => array(0, 1),
'u_viewprofile' => array(0, 1),
'u_chgavatar' => array(0, 1),
'u_chggrp' => array(0, 1),
'u_chgemail' => array(0, 1),
'u_chgname' => array(0, 1),
'u_chgpasswd' => array(0, 1),
'u_chgcensors' => array(0, 1),
'u_search' => array(0, 1),
'u_savedrafts' => array(0, 1),
'u_download' => array(0, 1),
'u_attach' => array(0, 1),
'u_sig' => array(0, 1),
'u_pm_attach' => array(0, 1),
'u_pm_html' => array(0, 1),
'u_pm_bbcode' => array(0, 1),
'u_pm_smilies' => array(0, 1),
'u_pm_download' => array(0, 1),
'u_pm_report' => array(0, 1),
'u_pm_edit' => array(0, 1),
'u_pm_printpm' => array(0, 1),
'u_pm_emailpm' => array(0, 1),
'u_pm_forward' => array(0, 1),
'u_pm_delete' => array(0, 1),
'u_pm_img' => array(0, 1),
'u_pm_flash' => array(0, 1),
);
echo "<p><b>Determining existing permissions</b></p>\n";
$sql = 'SELECT auth_option_id, auth_option FROM ' . ACL_OPTIONS_TABLE;
$result = $db->sql_query($sql);
$remove_auth_options = array();
while ($row = $db->sql_fetchrow($result))
{
if (!in_array($row['auth_option'], array_keys(${substr($row['auth_option'], 0, 2) . 'permissions'})))
{
$remove_auth_options[$row['auth_option']] = $row['auth_option_id'];
}
unset(${substr($row['auth_option'], 0, 2) . 'permissions'}[$row['auth_option']]);
}
$db->sql_freeresult($result);
if (sizeof($remove_auth_options))
{
$db->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')');
$db->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')');
$db->sql_query('DELETE FROM ' . ACL_OPTIONS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')');
echo '<p><b>Removed the following auth options... [<i>' . implode(', ', array_keys($remove_auth_options)) . "</i>]</b></p>\n\n";
}
$prefixes = array('f_', 'a_', 'm_', 'u_');
foreach ($prefixes as $prefix)
{
$var = $prefix . 'permissions';
if (sizeof($$var))
{
foreach ($$var as $auth_option => $l_ary)
{
$sql_ary = array(
'auth_option' => $auth_option,
'is_local' => $l_ary[0],
'is_global' => $l_ary[1]
);
$db->sql_query('INSERT INTO ' . ACL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
echo "<p><b>Adding $auth_option...</b></p>\n";
mass_auth('group', 0, 'guests', $auth_option, ACL_NO);
mass_auth('group', 0, 'inactive', $auth_option, ACL_NO);
mass_auth('group', 0, 'inactive_coppa', $auth_option, ACL_NO);
mass_auth('group', 0, 'registered_coppa', $auth_option, ACL_NO);
mass_auth('group', 0, 'registered', $auth_option, (($prefix != 'm_' && $prefix != 'a_') ? ACL_YES : ACL_NO));
mass_auth('group', 0, 'super_moderators', $auth_option, (($prefix != 'a_') ? ACL_YES : ACL_NO));
mass_auth('group', 0, 'administrators', $auth_option, ACL_YES);
mass_auth('group', 0, 'bots', $auth_option, (($prefix != 'm_' && $prefix != 'a_') ? ACL_YES : ACL_NO));
}
}
}
$sql = 'UPDATE ' . USERS_TABLE . " SET user_permissions = ''";
$db->sql_query($sql);
$cache->destroy('acl_options');
$cache->save();
echo "<p><b>Done</b></p>\n";
/*
$ug_type = user|group
$forum_id = forum ids (array|int|0) -> 0 == all forums
$ug_id = [int] user_id|group_id : [string] usergroup name
$acl_list = [string] acl entry : [array] acl entries
$setting = ACL_YES|ACL_NO|ACL_UNSET
*/
function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
{
global $db;
static $acl_option_ids, $group_ids;
if ($ug_type == 'group' && is_string($ug_id))
{
if (!isset($group_ids[$ug_id]))
{
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . "
WHERE group_name = '" . strtoupper($ug_id) . "'";
$result = $db->sql_query_limit($sql, 1);
$id = (int) $db->sql_fetchfield('group_id', 0, $result);
$db->sql_freeresult($result);
if (!$id)
{
return;
}
$group_ids[$ug_id] = $id;
}
$ug_id = (int) $group_ids[$ug_id];
}
// Build correct parameters
$auth = array();
if (!is_array($acl_list))
{
$auth = array($acl_list => $setting);
}
else
{
foreach ($acl_list as $auth_option)
{
$auth[$auth_option] = $setting;
}
}
unset($acl_list);
if (!is_array($forum_id))
{
$forum_id = array($forum_id);
}
// Set any flags as required
foreach ($auth as $auth_option => $acl_setting)
{
$flag = substr($auth_option, 0, strpos($auth_option, '_') + 1);
if (empty($auth[$flag]))
{
$auth[$flag] = $acl_setting;
}
}
if (!is_array($acl_option_ids) || empty($acl_option_ids))
{
$sql = 'SELECT auth_option_id, auth_option
FROM ' . ACL_OPTIONS_TABLE;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$acl_option_ids[$row['auth_option']] = $row['auth_option_id'];
}
$db->sql_freeresult($result);
}
$sql_forum = 'AND a.forum_id IN (' . implode(', ', array_map('intval', $forum_id)) . ')';
$sql = ($ug_type == 'user') ? 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting FROM ' . ACL_USERS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $sql_forum AND a.user_id = $ug_id" : 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting FROM ' . ACL_GROUPS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $sql_forum AND a.group_id = $ug_id";
$result = $db->sql_query($sql);
$cur_auth = array();
while ($row = $db->sql_fetchrow($result))
{
$cur_auth[$row['forum_id']][$row['auth_option_id']] = $row['auth_setting'];
}
$db->sql_freeresult($result);
$table = ($ug_type == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE;
$id_field = $ug_type . '_id';
$sql_ary = array();
foreach ($forum_id as $forum)
{
foreach ($auth as $auth_option => $setting)
{
$auth_option_id = $acl_option_ids[$auth_option];
if (!$auth_option_id)
{
continue;
}
switch ($setting)
{
case ACL_UNSET:
if (isset($cur_auth[$forum][$auth_option_id]))
{
$sql_ary['delete'][] = "DELETE FROM $table
WHERE forum_id = $forum
AND auth_option_id = $auth_option_id
AND $id_field = $ug_id";
}
break;
default:
if (!isset($cur_auth[$forum][$auth_option_id]))
{
$sql_ary['insert'][] = "$ug_id, $forum, $auth_option_id, $setting";
}
else if ($cur_auth[$forum][$auth_option_id] != $setting)
{
$sql_ary['update'][] = "UPDATE " . $table . "
SET auth_setting = $setting
WHERE $id_field = $ug_id
AND forum_id = $forum
AND auth_option_id = $auth_option_id";
}
}
}
}
unset($cur_auth);
$sql = '';
foreach ($sql_ary as $sql_type => $sql_subary)
{
switch ($sql_type)
{
case 'insert':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql = 'VALUES ' . implode(', ', preg_replace('#^(.*?)$#', '(\1)', $sql_subary));
break;
case 'mssql':
case 'sqlite':
$sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary));
break;
default:
foreach ($sql_subary as $sql)
{
$sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) VALUES ($sql)";
$result = $db->sql_query($sql);
$sql = '';
}
}
if ($sql != '')
{
$sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) $sql";
$result = $db->sql_query($sql);
}
break;
case 'update':
case 'delete':
foreach ($sql_subary as $sql)
{
$result = $db->sql_query($sql);
$sql = '';
}
break;
}
unset($sql_ary[$sql_type]);
}
unset($sql_ary);
}
?>

View File

@@ -1,218 +0,0 @@
<?php
/***************************************************************************
* bbcode_conversion.php
* -------------------
* begin : Tuesday, March 20, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id:
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
***************************************************************************/
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
include('../extension.inc');
include('../config.'.$phpEx);
include('../includes/constants.'.$phpEx);
include('../functions/functions.'.$phpEx);
include('../includes/db.'.$phpEx);
include('../functions/bbcode.'.$phpEx);
set_time_limit(60*60); // Increase maximum execution time to 60 minutes.
$backup_name = "backup_post_text";
$table_name = POSTS_TEXT_TABLE;
$sql = "CREATE TABLE $backup_name (
post_id int(10) DEFAULT '0' NOT NULL,
post_text text,
PRIMARY KEY (post_id)
);";
echo "<p>Creating backup table.. </p>\n";
flush();
$result = $db->sql_query($sql);
if (!$result)
{
$db_error = $db->sql_error();
die("Error doing DB backup table creation. Reason: " . $db_error["message"]);
}
$sql = "insert into $backup_name select * from $table_name";
echo "<p>Populating backup table.. </p>\n";
flush();
$result = $db->sql_query($sql);
if (!$result)
{
$db_error = $db->sql_error();
die("Error doing DB backup table data moving. Reason: " . $db_error["message"]);
}
$sql = "SELECT p.post_id, t.post_text FROM " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " t WHERE (p.post_id = t.post_id)";
if(!$result = $db->sql_query($sql))
{
die("error getting posts to work on");
}
if(!$total_rows = $db->sql_numrows($result))
{
die("error getting rowcount");
}
echo "<p><b>Found $total_rows total rows to work on. </b></p>\n";
flush();
$row = $db->sql_fetchrowset($result);
for($i = 0; $i < $total_rows; $i++)
{
$post_id = $row[$i]['post_id'];
$text = $row[$i]['post_text'];
// undo 1.2.x encoding..
$text = bbdecode($text);
$text = undo_make_clickable($text);
$text = str_replace("<BR>", "\n", $text);
// make a uid
$uid = make_bbcode_uid();
// do 2.x first-pass encoding..
$text = bbencode_first_pass($text, $uid);
$text = addslashes($text);
// put the uid in the database.
$sql = "UPDATE " . POSTS_TABLE . " SET bbcode_uid='" . $uid . "' WHERE (post_id = $post_id)";
$result = $db->sql_query($sql);
if (!$result)
{
$db_error = $db->sql_error();
die("Error doing DB update in posts table. Reason: " . $db_error["message"] . " sql: $sql");
}
// Put the post text back in the database.
$sql = "UPDATE " . POSTS_TEXT_TABLE . " SET post_text='" . $text . "' WHERE (post_id = $post_id)";
$result = $db->sql_query($sql);
if (!$result)
{
$db_error = $db->sql_error();
die("Error doing DB update in post text table. Reason: " . $db_error["message"] . " sql: $sql");
}
if (($i % 100) == 0)
{
echo "Done post: <b> $i </b><br>\n";
flush();
}
}
echo "<p><b>Done.</b></p>\n";
// -------------------------------------------------------------------------------
// Everything below here is 1.x BBCode functions.
// -------------------------------------------------------------------------------
function bbdecode($message) {
// Undo [code]
$code_start_html = "<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-1>Code:</font><HR></TD></TR><TR><TD><FONT SIZE=-1><PRE>";
$code_end_html = "</PRE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode End -->";
$message = str_replace($code_start_html, "[code]", $message);
$message = str_replace($code_end_html, "[/code]", $message);
// Undo [quote]
$quote_start_html = "<!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-1>Quote:</font><HR></TD></TR><TR><TD><FONT SIZE=-1><BLOCKQUOTE>";
$quote_end_html = "</BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->";
$message = str_replace($quote_start_html, "[quote]", $message);
$message = str_replace($quote_end_html, "[/quote]", $message);
// Undo [b] and [i]
$message = preg_replace("#<!-- BBCode Start --><B>(.*?)</B><!-- BBCode End -->#s", "[b]\\1[/b]", $message);
$message = preg_replace("#<!-- BBCode Start --><I>(.*?)</I><!-- BBCode End -->#s", "[i]\\1[/i]", $message);
// Undo [url] (long form)
$message = preg_replace("#<!-- BBCode u2 Start --><A HREF=\"([a-z]+?://)(.*?)\" TARGET=\"_blank\">(.*?)</A><!-- BBCode u2 End -->#s", "[url=\\1\\2]\\3[/url]", $message);
// Undo [url] (short form)
$message = preg_replace("#<!-- BBCode u1 Start --><A HREF=\"([a-z]+?://)(.*?)\" TARGET=\"_blank\">(.*?)</A><!-- BBCode u1 End -->#s", "[url]\\3[/url]", $message);
// Undo [email]
$message = preg_replace("#<!-- BBCode Start --><A HREF=\"mailto:(.*?)\">(.*?)</A><!-- BBCode End -->#s", "[email]\\1[/email]", $message);
// Undo [img]
$message = preg_replace("#<!-- BBCode Start --><IMG SRC=\"(.*?)\" BORDER=\"0\"><!-- BBCode End -->#s", "[img]\\1[/img]", $message);
// Undo lists (unordered/ordered)
// <li> tags:
$message = str_replace("<!-- BBCode --><LI>", "[*]", $message);
// [list] tags:
$message = str_replace("<!-- BBCode ulist Start --><UL>", "[list]", $message);
// [list=x] tags:
$message = preg_replace("#<!-- BBCode olist Start --><OL TYPE=([A1])>#si", "[list=\\1]", $message);
// [/list] tags:
$message = str_replace("</UL><!-- BBCode ulist End -->", "[/list]", $message);
$message = str_replace("</OL><!-- BBCode olist End -->", "[/list]", $message);
return($message);
}
/**
* Nathan Codding - Feb 6, 2001
* Reverses the effects of make_clickable(), for use in editpost.
* - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs.
*
*/
function undo_make_clickable($text) {
$text = preg_replace("#<!-- BBCode auto-link start --><a href=\"(.*?)\" target=\"_blank\">.*?</a><!-- BBCode auto-link end -->#i", "\\1", $text);
$text = preg_replace("#<!-- BBcode auto-mailto start --><a href=\"mailto:(.*?)\">.*?</a><!-- BBCode auto-mailto end -->#i", "\\1", $text);
return $text;
}
?>

View File

@@ -13,11 +13,11 @@ die("Please read the first lines of this script for instructions on how to enabl
// Do not change anything below this line.
//
define('IN_PHPBB', true);
$phpbb_root_path = "../";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
include($phpbb_root_path . 'includes/post.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
srand ((double) microtime() * 1000000);
@@ -51,9 +51,6 @@ And a quote!
[/quote]
';
$users = intval($HTTP_GET_VARS['users']);
$posts = intval($HTTP_GET_VARS['posts']);
$size = intval($HTTP_GET_VARS['size']);
// The script expects the ID's in the tables to sequential (1,2,3,4,5),
// so no holes please (1,4,5,8)...
@@ -91,9 +88,7 @@ if ($posts > 0)
$endtime = microtime();
$submit = (isset($HTTP_GET_VARS['submit'])) ? true : false;
if (!$submit)
if ($submit="" || !isset($submit))
{
?>
Hello, welcome to this little phpBB Benchmarking script :)<p>
@@ -224,10 +219,10 @@ function make_topic($user_id, $subject, $forum_id)
$topic_vote = 0;
$current_time = time();
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote)
VALUES ('$subject', $user_id, $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)";
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote)
VALUES ('$subject', $user_id, $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)";
if( $result = $db->sql_query($sql) )
if( $result = $db->sql_query($sql, BEGIN_TRANSACTION) )
{
$new_topic_id = $db->sql_nextid();
}
@@ -243,14 +238,17 @@ function make_topic($user_id, $subject, $forum_id)
function create_posting($userid, $topic_id, $forum, $mode = 'newtopic')
function create_posting($userid, $topic_id, $forum, $mode='newtopic')
{
$message = generatepost();
return make_post($topic_id, $forum, $userid, "", $message, $mode);
}
function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $mode = 'newtopic')
function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $mode='newtopic')
{
global $db;
$current_time = time();
@@ -263,43 +261,54 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
$post_subject = 'random subject';
$post_message = prepare_message($text, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
$post_message = prepare_message($text, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
$sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig)
VALUES ($new_topic_id, $forum_id, $user_id, '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig)";
$sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, attach_id, icon_id, post_username, post_time, poster_ip, post_approved, bbcode_uid, enable_bbcode, enable_html, enable_smilies, enable_sig, post_subject, post_text)
VALUES ($new_topic_id, $forum_id, $user_id, 0, 0, '$post_username', $current_time, '$user_ip', 1, '$bbcode_uid', $bbcode_on, $html_on, $smilies_on, $attach_sig, '$post_subject', '$post_message')";
$result = $db->sql_query($sql);
if($result)
if ($result)
{
$new_post_id = $db->sql_nextid();
$sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text)
VALUES ($new_post_id, '$post_subject', '$bbcode_uid', '$post_message')";
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_last_post_id = $new_post_id";
if($mode == "reply")
{
$sql .= ", topic_replies = topic_replies + 1 ";
}
$sql .= " WHERE topic_id = $new_topic_id";
if($db->sql_query($sql))
{
$post_data = array();
$post_data['first_post'] = false;
$post_data['last_post'] = true;
$sql = "SELECT SUM(post_id) as total FROM " . POSTS_TABLE . " WHERE topic_id = " . $new_topic_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$total = intval($row['total']);
if ($total == 1)
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1";
if($mode == "newtopic")
{
$post_data['first_post'] = true;
$sql .= ", forum_topics = forum_topics + 1";
}
$sql .= " WHERE forum_id = $forum_id";
if($db->sql_query($sql))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts + 1
WHERE user_id = " . $user_id;
if($db->sql_query($sql, END_TRANSACTION))
{
// SUCCESS.
return true;
}
else
{
message_die(GENERAL_ERROR, "Error updating users table", "", __LINE__, __FILE__, $sql);
}
}
else
{
message_die(GENERAL_ERROR, "Error updating forums table", "", __LINE__, __FILE__, $sql);
}
$sql = "SELECT forum_last_post_id
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$post_data['last_topic'] = ( $row['forum_last_post_id'] == $new_post_id ) ? true : false;
update_post_stats($mode, $post_data, $forum_id, $new_topic_id, $new_post_id, $user_id);
}
else
{
@@ -310,7 +319,7 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
WHERE post_id = $new_post_id";
$db->sql_query($sql);
}
message_die(GENERAL_ERROR, "Error inserting data into posts text table", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, "Error updating topics table", "", __LINE__, __FILE__, $sql);
}
}
else
@@ -320,7 +329,7 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
}
function generatepost($size = 850)
function generatepost($size=850)
{
global $bigass_text;
// Returns a string with a length between $size and $size*0.2
@@ -397,7 +406,23 @@ function make_user($username)
message_die(GENERAL_ERROR, "Couldn't obtained next user_id information.", "", __LINE__, __FILE__, $sql);
}
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
$sql = "SELECT MAX(group_id) AS total
FROM " . GROUPS_TABLE;
if($result = $db->sql_query($sql))
{
$row = $db->sql_fetchrow($result);
$new_group_id = $row['total'] + 1;
unset($result);
unset($row);
}
else
{
message_die(GENERAL_ERROR, "Couldn't obtained next user_id information.", "", __LINE__, __FILE__, $sql);
}
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmilies, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
VALUES ($new_user_id, '$username', " . time() . ", '$password', '$email', '$icq', '$website', '$occupation', '$location', '$interests', '$signature', '$signature_bbcode_uid', '$avatar_filename', $viewemail, '$aim', '$yim', '$msn', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', $user_style, 0, 1, ";
@@ -405,14 +430,12 @@ function make_user($username)
if($result = $db->sql_query($sql, BEGIN_TRANSACTION))
{
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
VALUES ('', 'Personal User', 1, 0)";
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_description, group_single_user, group_moderator)
VALUES ($new_group_id, '', 'Personal User', 1, 0)";
if($result = $db->sql_query($sql))
{
$group_id = $db->sql_nextid();
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
VALUES ($new_user_id, $group_id, 0)";
VALUES ($new_user_id, $new_group_id, 0)";
if($result = $db->sql_query($sql, END_TRANSACTION))
{
@@ -436,8 +459,4 @@ function make_user($username)
}
?>

View File

@@ -0,0 +1,76 @@
<?php
// -------------------------------------------------------------
//
// $Id$
//
// FILENAME : calc_email_hash.php
// STARTED : Tue Feb 03, 2004
// COPYRIGHT : <20> 2004 phpBB Group
// WWW : http://www.phpbb.com/
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
//
// -------------------------------------------------------------
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
@set_time_limit(300);
$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
define('IN_PHPBB', 1);
define('ANONYMOUS', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'config.'.$phpEx);
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
$cache = new acm();
$db = new sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
$start = 0;
do
{
// Batch query for group members, call group_user_del
$sql = "SELECT user_id, user_email
FROM {$table_prefix}users
LIMIT $start, 100";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
do
{
$sql = "UPDATE {$table_prefix}users
SET user_email_hash = " . (crc32(strtolower($row['user_email'])) . strlen($row['user_email'])) . '
WHERE user_id = ' . $row['user_id'];
$db->sql_query($sql);
$start++;
}
while ($row = $db->sql_fetchrow($result));
echo "<br />Batch -> $start\n";
flush();
}
else
{
$start = 0;
}
$db->sql_freeresult($result);
}
while ($start);
echo "<p><b>Done</b></p>\n";
?>

View File

@@ -0,0 +1,62 @@
<?php
/***************************************************************************
* merge_clean_posts.php
* -------------------
* begin : Tuesday, February 25, 2003
* copyright : (C) 2003 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
@set_time_limit(2400);
// This script adds missing permissions
$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
define('IN_PHPBB', 1);
define('ANONYMOUS', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'config.'.$phpEx);
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
$cache = new acm();
$db = new $sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
$sql = "SELECT post_id, post_text FROM {$table_prefix}posts WHERE post_text LIKE '%{SMILE_PATH}%'";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$db->sql_query("UPDATE {$table_prefix}posts SET post_text = '" . $db->sql_escape(str_replace('{SMILE_PATH}', '{SMILIES_PATH}', $row['post_text'])) . "' WHERE post_id = " . $row['post_id']);
}
$db->sql_freeresult($result);
echo "<p><b>Done</b></p>\n";
?>

View File

@@ -1,65 +0,0 @@
<?php
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
$phpbb_root_path = "../";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
$sql = "ALTER TABLE " . USERS_TABLE . "
ADD user_avatar_type TINYINT(4) DEFAULT '0' NOT NULL";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't alter users table");
}
$sql = "SELECT user_id, user_avatar
FROM " . USERS_TABLE;
if( $result = $db->sql_query($sql) )
{
$rowset = $db->sql_fetchrowset($result);
for($i = 0; $i < count($rowset); $i++)
{
if( ereg("^http", $rowset[$i]['user_avatar']))
{
$sql_type = USER_AVATAR_REMOTE;
}
else if( $rowset[$i]['user_avatar'] != "" )
{
$sql_type = USER_AVATAR_UPLOAD;
}
else
{
$sql_type = USER_AVATAR_NONE;
}
$sql = "UPDATE " . USERS_TABLE . "
SET user_avatar_type = $sql_type
WHERE user_id = " . $rowset[$i]['user_id'];
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update users table- " . $i);
}
}
}
echo "<BR><BR>COMPLETE<BR>";
?>

View File

@@ -1,96 +0,0 @@
<?php
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
$phpbb_root_path = "../";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
function query($sql, $errormsg)
{
global $db;
if(!$result = $db->sql_query($sql))
{
print "<br><font color=\"red\">\n";
print "$errormsg<br>";
$sql_error = $db->sql_error();
print $sql_error['code'] .": ". $sql_error['message']. "<br>\n";
print "<pre>$sql</pre>";
print "</font>\n";
return FALSE;
}
else
{
return $result;
}
}
if($HTTP_GET_VARS['delete'] == 'true')
{
$sql = "ALTER TABLE ".POSTS_TABLE."
DROP bbcode_uid";
query($sql, "Didn't manage to drop the bbcode_uid table in ".POSTS_TABLE);
print "All done now. Deleted the bbcode_uid column from the posts table.<p>";
exit;
}
$sql = "ALTER TABLE ".POSTS_TEXT_TABLE."
ADD bbcode_uid char(10) NOT NULL";
print "Adding bbcode_uid field to ".POSTS_TEXT_TABLE.".<br>\n";
$result = query($sql, "Couldn't get add bbcode_uid field to ".POSTS_TEXT_TABLE.".");
$sql = "
SELECT
count(*) as total,
max(post_id) as maxid
FROM ". POSTS_TABLE;
$result = query($sql, "Couldn't get max post_id.");
$maxid = $db->sql_fetchrow($result);
$totalposts = $maxid['total'];
$maxid = $maxid['maxid'];
$batchsize = 200;
print "Going to convert BBcode in posts with $batchsize messages at a time and $totalposts in total.<br>\n";
for($i = 0; $i <= $maxid; $i += $batchsize)
{
$batchstart = $i + 1;
$batchend = $i + $batchsize;
print "Moving BBcode UID in post number $batchstart to $batchend<br>\n";
flush();
$sql = "
SELECT
post_id,
bbcode_uid
FROM "
.POSTS_TABLE."
WHERE
post_id BETWEEN $batchstart AND $batchend";
$result = query($sql, "Couldn't get ". POSTS_TABLE .".post_id $batchstart to $batchend");
while($row = mysql_fetch_array($result))
{
query("UPDATE ".POSTS_TEXT_TABLE." set bbcode_uid = '". $row['bbcode_uid']. "' WHERE post_id = ".$row['post_id'], "Was unable to update the posts text table with the BBcode_uid");
}
}
echo "Click <a href=\"$PHP_SELF?delete=true\">HERE</a> to remove the bbcode_uid table from the POSTS table (if you didn't get any serious error messages).<p>";
$db->sql_close();
?>

View File

@@ -1,110 +0,0 @@
<?php
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
$phpbb_root_path = "../";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
$sql = "SELECT *
FROM " . CONFIG_TABLE;
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql);
}
else
{
$board_config = $db->sql_fetchrow($result);
}
$newconfigtable = $table_prefix . "newconfig";
$sql = "SELECT config_name, config_value FROM ". CONFIG_TABLE;
if( $result = $db->sql_query($sql) )
{
die("Don't run this script twice!<br>\n");
}
$sql = " CREATE TABLE $newconfigtable (
config_name varchar(255) NOT NULL,
config_value varchar(255) NOT NULL,
PRIMARY KEY (config_name)
)";
print "Creating temporary table: $newconfigtable<p>\n";
if( !$result = $db->sql_query($sql) )
{
print("Couldn't create new config table<br>\n");
}
$error = 0;
while (list($name, $value) = each($board_config))
{
if(is_int($name))
{
// Skip numeric array elements (we only want the associative array)
continue;
}
// Rename sys_template
if ($name == 'sys_template')
{
$name = 'board_template';
}
// Rename system_timezone
if ($name == 'system_timezone')
{
$name = 'board_timezone';
}
print "$name = $value<br>\n";
$value = addslashes($value);
$sql = "INSERT INTO $newconfigtable (config_name, config_value) VALUES ('$name', '$value')";
if( !$result = $db->sql_query($sql) )
{
print("Couldn't insert '$name' into new config table");
$error = 1;
}
}
if ($error != 1)
{
print "Dropping old table<p>\n";
$sql = "DROP TABLE ". CONFIG_TABLE;
if( !$result = $db->sql_query($sql) )
{
die("Couldn't drop old table");
}
print "Renaming $newconfigtable to ".CONFIG_TABLE."<p>\n";
$sql = "ALTER TABLE $newconfigtable RENAME ".CONFIG_TABLE;
if( !$result = $db->sql_query($sql) )
{
die("Couldn't rename new config table");
}
print "Renaming ".SESSIONS_TABLE." to ".$table_prefix."sessions<br>\n";
$sql = "ALTER TABLE ".SESSIONS_TABLE." RENAME ".$table_prefix."sessions";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't rename session table");
}
}
$db->sql_close();
echo "<BR><BR>COMPLETE<BR>";
?>

View File

@@ -1,181 +0,0 @@
<?php
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
$phpbb_root_path = "../";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
// Alter table ...
//
echo "Alter tables ... ";
echo $sql = "ALTER TABLE " . PRIVMSGS_TABLE . "
ADD privmsgs_enable_bbcode TINYINT(1) DEFAULT '1' NOT NULL,
ADD privmsgs_enable_html TINYINT(1) DEFAULT '0' NOT NULL,
ADD privmsgs_enable_smilies TINYINT(1) DEFAULT '1' NOT NULL,
ADD privmsgs_attach_sig TINYINT(1) DEFAULT '1' NOT NULL";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't alter privmsgs table");
}
echo $sql = "ALTER TABLE " . PRIVMSGS_TEXT_TABLE . "
ADD privmsgs_bbcode_uid CHAR(10) AFTER privmsgs_text_id";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't alter privmsgs text table");
}
echo "COMPLETE<BR>";
//
// Move bbcode ...
//
echo "Move bbcode uid's ... ";
$sql = "SELECT privmsgs_id, privmsgs_bbcode_uid
FROM " . PRIVMSGS_TABLE;
if( $result = $db->sql_query($sql) )
{
$rowset = $db->sql_fetchrowset($result);
for($i = 0; $i < count($rowset); $i++)
{
$sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
SET privmsgs_bbcode_uid = '" . $rowset[$i]['privmsgs_bbcode_uid'] . "'
WHERE privmsgs_text_id = " . $rowset[$i]['privmsgs_id'];
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update privmsgs text bbcode - " . $i);
}
}
$sql = "ALTER TABLE " . PRIVMSGS_TABLE . "
DROP privmsgs_bbcode_uid";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't alter privmsgs table - drop privmsgs_bbcode_uid");
}
}
echo "COMPLETE<BR>";
//
// Stripslashes from titles
//
echo "Strip subject slashes ... ";
$sql = "SELECT privmsgs_subject , privmsgs_id, privmsgs_to_userid, privmsgs_from_userid
FROM " . PRIVMSGS_TABLE;
if( $result = $db->sql_query($sql) )
{
$rowset = $db->sql_fetchrowset($result);
for($i = 0; $i < count($rowset); $i++)
{
$sql = "UPDATE " . PRIVMSGS_TABLE . "
SET privmsgs_subject = '" . addslashes(stripslashes($rowset[$i]['privmsgs_subject'])) . "'
WHERE privmsgs_id = " . $rowset[$i]['privmsgs_id'];
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update subjects - $i");
}
}
}
echo "COMPLETE<BR>";
//
// Update sigs
//
echo "Remove [addsig], stripslashes and update privmsgs table sig enable ...";
$sql = "SELECT privmsgs_text_id , privmsgs_text
FROM " . PRIVMSGS_TEXT_TABLE;
if( $result = $db->sql_query($sql) )
{
$rowset = $db->sql_fetchrowset($result);
$attach_sql = "";
$non_attach_sql = "";
for($i = 0; $i < count($rowset); $i++)
{
if( ereg("\[addsig]$", $rowset[$i]['privmsgs_text']))
{
if( $attach_sql != "" )
{
$attach_sql .= ", ";
}
$attach_sql .= $rowset[$i]['privmsgs_text_id'];
$sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
SET privmsgs_text = '" . addslashes(preg_replace("/\[addsig\]/is", "", stripslashes($rowset[$i]['privmsgs_text']))) . "'
WHERE privmsgs_text_id = " . $rowset[$i]['privmsgs_text_id'];
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update privmsgs text - " . $i);
}
}
else
{
$sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
SET privmsgs_text = '" . addslashes(stripslashes($rowset[$i]['privmsgs_text'])) . "'
WHERE privmsgs_text_id = " . $rowset[$i]['privmsgs_text_id'];
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update privmsgs text - " . $i);
}
if( $non_attach_sql != "" )
{
$non_attach_sql .= ", ";
}
$non_attach_sql .= $rowset[$i]['privmsgs_text_id'];
}
}
if( $attach_sql != "" )
{
$sql = "UPDATE " . PRIVMSGS_TABLE . "
SET privmsgs_attach_sig = 1
WHERE privmsgs_id IN ($attach_sql)";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update privmsgs table attach_sig - ");
}
}
if( $non_attach_sql != "" )
{
$sql = "UPDATE " . PRIVMSGS_TABLE . "
SET privmsgs_attach_sig = 0
WHERE privmsgs_id IN ($non_attach_sql)";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update privmsgs table non_attach_sig - ");
}
}
}
echo "COMPLETE<BR>";
$db->sql_close();
?>

View File

@@ -1,93 +0,0 @@
<?php
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
$phpbb_root_path = "../";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
$sql = "SELECT post_id, post_text
FROM " . POSTS_TEXT_TABLE;
if( $result = $db->sql_query($sql) )
{
$rowset = $db->sql_fetchrowset($result);
$attach_sql = "";
$non_attach_sql = "";
for($i = 0; $i < count($rowset); $i++)
{
if( ereg("\[addsig]$", $rowset[$i]['post_text']))
{
if( $attach_sql != "" )
{
$attach_sql .= ", ";
}
$attach_sql .= $rowset[$i]['post_id'];
$sql = "UPDATE " . POSTS_TEXT_TABLE . "
SET post_text = '" . addslashes(preg_replace("/\[addsig\]/is", "", $rowset[$i]['post_text'])) . "'
WHERE post_id = " . $rowset[$i]['post_id'];
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update post_text - " . $i);
}
}
else
{
if( $non_attach_sql != "" )
{
$non_attach_sql .= ", ";
}
$non_attach_sql .= $rowset[$i]['post_id'];
}
}
echo "<BR>";
if( $attach_sql != "" )
{
echo $sql = "UPDATE " . POSTS_TABLE . "
SET enable_sig = 1
WHERE post_id IN ($attach_sql)";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update post table attach_sig - ");
}
}
echo "<BR>";
if( $non_attach_sql != "" )
{
echo $sql = "UPDATE " . POSTS_TABLE . "
SET enable_sig = 0
WHERE post_id IN ($non_attach_sql)";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update post table non_attach_sig - ");
}
}
}
$db->sql_close();
echo "<BR><BR>COMPLETE<BR>";
?>

View File

@@ -1,84 +0,0 @@
<html>
<body>
<?php
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
chdir("../");
include('extension.inc');
include('config.'.$phpEx);
include('includes/constants.'.$phpEx);
include('includes/db.'.$phpEx);
$months = array(
"Jan" => 1,
"Feb" => 2,
"Mar" => 3,
"Apr" => 4,
"May" => 5,
"Jun" => 6,
"Jul" => 7,
"Aug" => 8,
"Sep" => 9,
"Oct" => 10,
"Nov" => 11,
"Dec" => 12
);
$sql = "SELECT user_id, user_regdate FROM ".USERS_TABLE;
$result = $db->sql_query($sql);
if(!$result)
{
die("OOpppps, that didn't work!");
}
$all_old_dates = $db->sql_fetchrowset($result);
$sql = "ALTER TABLE ".USERS_TABLE."
CHANGE user_regdate user_regdate INT (11) NOT NULL";
$result = $db->sql_query($sql);
if(!$result)
{
die("Opps, that didn't work either ... oh damn!");
}
for($i = 0; $i < count($all_old_dates); $i++)
{
if(is_string($all_old_dates[$i]['user_regdate']))
{
if(eregi("^([a-zA-Z]{3}) ([0-9]+), ([0-9]{4})", $all_old_dates[$i]['user_regdate'], $result))
{
echo $all_old_dates[$i]['user_regdate']." : ";
echo $new_time = gmmktime(0, 1, 0, $months[$result[1]], $result[2], $result[3]);
echo " : ".gmdate("M d, Y", $new_time)."<br>";
$sql = "UPDATE phpbb_users
SET user_regdate = '$new_time'
WHERE user_id = '".$all_old_dates[$i]['user_id']."'";
$result = $db->sql_query($sql);
if(!$result)
{
die("Oh damn it, now that's really broken it!");
}
}
}
}
echo "<br>That's All Folks!";
?>
</body>
</html>

View File

@@ -1,67 +0,0 @@
<html>
<body>
<?php
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
//
// Convert 2.0.x Usernames to the new 2.0.5 Username format.
//
chdir("../");
define('IN_PHPBB', true);
include('extension.inc');
include('config.'.$phpEx);
include('includes/constants.'.$phpEx);
include('includes/db.'.$phpEx);
$sql = "SELECT user_id, username
FROM " . USERS_TABLE;
$result = $db->sql_query($sql);
if(!$result)
{
die("Unable to get users");
}
while ($row = $db->sql_fetchrow($result))
{
if (!preg_match('#(&gt;)|(&lt;)|(&quot)|(&amp;)#', $row['username']))
{
if ($row['username'] != htmlspecialchars($row['username']))
{
flush();
$sql = "UPDATE " . USERS_TABLE . "
SET username = '" . str_replace("'", "''", htmlspecialchars($row['username'])) . "'
WHERE user_id = " . $row['user_id'];
if (!$db->sql_query($sql))
{
echo "ERROR: Unable to rename user " . htmlspecialchars($row['username']) . " with ID " . $row['user_id'] . "<br>";
echo "<pre>" . print_r($db->sql_error()) . "</pre><br />$sql";
}
else
{
echo "Renamed User " . htmlspecialchars($row['username']) . " with ID " . $row['user_id'] . "<br>";
}
}
}
}
echo "<br>That's All Folks!";
?>
</body>
</html>

View File

@@ -0,0 +1,547 @@
<?php
// -------------------------------------------------------------
//
// $Id$
//
// FILENAME : create_variable_overview.php
// STARTED : Fri Aug 15 2003
// COPYRIGHT : <20> 2003 phpBB Group
// WWW : http://www.phpbb.com/
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
//
// -------------------------------------------------------------
/*
This script generates an index of some template vars and their use within the templates.
It writes down all language variables used by various templates.
*/
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
$directory = '../styles/subSilver/template/';
$ext = 'html';
$store_dir = '../store/';
$phpfiles_directories = array('../', '../includes/', '../includes/acm/', '../includes/auth/', '../includes/mcp/', '../includes/ucp/');
// Template Files beginning with this names are merged together
$merge = array('gcp', 'login', 'mcp', 'memberlist', 'posting', 'ucp');
if (!is_writable($store_dir))
{
die("Directory $store_dir is not writeable!");
}
$contents = implode('', file('../adm/subSilver.css', filesize('../adm/subSilver.css')));
$fp = fopen($store_dir . 'subSilver.css', 'w');
fwrite($fp, $contents);
fclose($fp);
$html_skeleton = '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="subSilver.css" type="text/css">
<style type="text/css">
<!--
th { background-image: url(\'cellpic3.gif\') }
td.cat { background-image: url(\'cellpic1.gif\') }
//-->
</style>
<title>{FILENAME}</title>
</head>
<body>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><img src="header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></td>
<td width="100%" background="header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle">File {FILENAME}</span> &nbsp; &nbsp; &nbsp;</td>
</tr>
</table>
<table width="95%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td><br clear="all" />
';
$html_skeleton .= '<br><a href="./index.html" class="gen">Back to Contents</a><br><br>';
$html_skeleton .= '<br><a href="#lang" class="gen">Language Variables</a> :: <a href="#includes" class="gen">Includes</a> :: <a href="#cond" class="gen">Conditionals</a><br><a href="#remain" class="gen">Remaining Vars</a> :: <a href="#usedby" class="gen">phpBB File Usage</a> :: <a href="#ref" class="gen">References</a>';
$html_skeleton .= '<br><br><a name="lang"></a><b>Language Variables</b><br><br>{LANGUAGE_VARIABLES}';
$html_skeleton .= '<br><br><a name="includes"></a><b>Included Files</b><br><br>{INCLUDES}';
$html_skeleton .= '<br><br><a name="cond"></a><b>Used Conditionals</b><br><br>{CONDITIONALS}';
$html_skeleton .= '<br><br><a name="remain"></a><b>Remaining Vars used</b><br><br>{REMAINING_VARS}';
$html_skeleton .= '<br><br><a name="usedby"></a><b>This Template File is used by the following phpBB Files</b><br><br>{USED_BY}';
$html_skeleton .= '<br><br><a name="ref"></a><b>References: </b>{SEE_FILES}';
//$html_skeleton .= "</body>\n</html>\n";
$html_skeleton .= '
<br><br>
<div class="copyright" align="center">Powered by phpBB 2.2 &copy; <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB Group</a>, 2003</div>
<br clear="all" /></td>
</tr>
</table>
</body>
</html>
';
// Open Language File
include('../language/en/lang_main.php');
include('../language/en/lang_admin.php');
$files_to_parse = $php_files = array();
$dhandler = opendir($directory);
if (!$dhandler)
{
die("Unable to open $directory");
}
$num = 0;
while ($file = readdir($dhandler))
{
if (is_file($directory . $file) && preg_match('#\.' . $ext . '$#i', $file))
{
$files_to_parse[$num]['filename'] = $directory . $file;
$files_to_parse[$num]['single_filename'] = $file;
$files_to_parse[$num]['destfile'] = str_replace(".{$ext}", '', $file) . '_' . $num . '.html';
$file_to_destfile[$file] = $files_to_parse[$num]['destfile'];
$num++;
}
}
closedir($dhandler);
$num = 0;
foreach ($phpfiles_directories as $directory)
{
$dhandler = opendir($directory);
if (!$dhandler)
{
die("Unable to open $directory");
}
while ($file = readdir($dhandler))
{
if (is_file($directory . $file) && preg_match('#\.php$#i', $file))
{
$php_files[$num]['filename'] = $directory . $file;
$php_files[$num]['single_filename'] = $file;
$num++;
}
}
closedir($dhandler);
}
$php_files_includes = $lang_references = array();
//$php_files_includes['viewtopic_attach_body.html'][0] = filename
echo '<br>Parsing PHP Files';
// Parse PHP Files and get our filenames
foreach ($php_files as $file_num => $data)
{
echo '.';
flush();
$contents = implode('', file($data['filename'], filesize($data['filename'])));
$html_files = array();
preg_match_all('#([a-zA-Z0-9\-_]*?)\.' . $ext . '#s', $contents, $html_files);
$html_files = array_unique($html_files[1]);
foreach ($html_files as $html_file)
{
$html_file = trim($html_file);
if ($html_file != '')
{
$php_files_includes[$html_file . '.' . $ext][] = $data['filename'];
}
}
}
echo '<br>Parsing HTML Files';
foreach ($files_to_parse as $file_num => $data)
{
echo '.';
flush();
$contents = implode('', file($data['filename'], filesize($data['filename'])));
// Language Variables -> [0]:tpl [1]:lang
$lang_vars = array();
preg_match_all('#{L_([a-z0-9\-_]*?)\}#is', $contents, $lang_vars);
$contents = preg_replace('#{L_([a-z0-9\-_]*?)\}#is', '', $contents);
$lang_vars[0] = array_unique($lang_vars[0]);
$lang_vars[1] = array_unique($lang_vars[1]);
// Includes
$includes = array();
preg_match_all('#<!-- INCLUDE ([a-zA-Z0-9\_\-\+\.]+?) -->#s', $contents, $includes);
$contents = preg_replace('#<!-- INCLUDE ([a-zA-Z0-9\_\-\+\.]+?) -->#', '', $contents);
$includes = $includes[1];
$includes = array_unique($includes);
// IF Conditions
$switches = array();
preg_match_all('#<!-- [IF]|[ELSEIF] ([a-zA-Z0-9\-_\.]+?) (.*?)?[ ]?-->#', $contents, $switches);
$contents = preg_replace('#<!-- [IF]|[ELSEIF] ([a-zA-Z0-9\-_]) (.*?)?[ ]?-->#s', '', $contents);
$switches[0] = array_unique($switches[1]); // No resorting please
$switches[1] = $switches[2];
unset($switches[2]);
// Remaining Vars
$remaining_vars = array();
preg_match_all('#{([a-z0-9\-_\.]*?)\}#is', $contents, $remaining_vars);
$contents = preg_replace('#{([a-z0-9\-_]*?)\}#is', '', $contents);
$remaining_vars = array_unique($remaining_vars[1]);
sort($remaining_vars, SORT_STRING);
// Now build the filename specific site
$fp = fopen($store_dir . $data['destfile'], 'w');
$html_data = $html_skeleton;
$html_data = str_replace('{FILENAME}', $data['single_filename'], $html_data);
// Write up the Language Variables
if (count($lang_vars[0]))
{
$lang_data = '<ul>';
for ($num = 0; $num <= count($lang_vars[0]); $num++)
{
$var = $lang_vars[0][$num];
if ($var != '')
{
$_var = str_replace(array('{', '}'), array('', ''), $var);
$lang_references[$_var][] = $data['single_filename'];
$lang_data .= '<li>' . $var . '<br>' . "\n" . ((isset($lang[$_var])) ? htmlspecialchars(str_replace("\\'", "'", $lang[$_var])) : '<span style="color:red">No Language Variable available</span>') . '<br></li><br>' . "\n";
}
}
$lang_data .= '</ul>';
}
else
{
$lang_data = '<b>NONE</b><br>' . "\n";
}
$html_data = str_replace('{LANGUAGE_VARIABLES}', $lang_data, $html_data);
// Write up the Includes
echo '.';
flush();
if (count($includes))
{
$includes_data = '<ul>';
$see_files = '';
for ($num = 0; $num <= count($includes); $num++)
{
$var = $includes[$num];
if ($var != '')
{
$includes_data .= '<li><a href="./' . $file_to_destfile[$var] . '" class="gen">' . $var . '</a></li><br>' . "\n";
$see_files .= ($see_files != '') ? ' :: ' : '';
$see_files .= '<a href="./' . $file_to_destfile[$var] . '" class="gen">' . $var . '</a>';
}
}
$includes_data .= '</ul>';
}
else
{
$includes_data = '<b>NONE</b><br>' . "\n";
$see_files = '<b>NONE</b>';
}
$html_data = str_replace('{INCLUDES}', $includes_data, $html_data);
$html_data = str_replace('{SEE_FILES}', $see_files, $html_data);
// Write up Conditionals
echo '.';
flush();
if (count($switches[0]))
{
$conditionals = '<ul>';
for ($num = 0; $num <= count($switches[0]); $num++)
{
$var = trim($switches[0][$num]);
if ($var != '')
{
if ($var == 'not')
{
$conditionals .= '<li>' . trim($switches[1][$num]) . '<br><b>Negation</b><br>' . "\n";
$block_var = explode('.', trim($switches[1][$num]));
unset($block_var[0]);
}
else
{
$conditionals .= '<li>' . $var . ((trim($switches[1][$num]) != '') ? '<br>' . "\n" . '<i>Compared with</i> -&gt; <b>' . trim($switches[1][$num]) . '</b>' : '') . '<br>' . "\n";
$block_var = explode('.', $var);
unset($block_var[count($block_var)-1]);
}
if (count($block_var))
{
for ($_num = count($block_var)-1; $_num >= 0; $_num--)
{
$conditionals .= ($_num == count($block_var)-1) ? '<i>Element of Block</i> -&gt; <b>' . $block_var[$_num] . '</b><br>' . "\n" : '<i>...which is an element of</i> -&gt; <b>' . $block_var[$_num] . '</b><br>' . "\n";
}
}
$conditionals .= '<br></li>' . "\n";
}
}
$conditionals .= '</ul>';
}
else
{
$conditionals = '<b>NONE</b><br>' . "\n";
}
$html_data = str_replace('{CONDITIONALS}', $conditionals, $html_data);
// Write up Remaining Vars
echo '.';
flush();
if (count($remaining_vars))
{
$remaining = '<ul>';
for ($num = 0; $num <= count($remaining_vars); $num++)
{
$var = trim($remaining_vars[$num]);
if ($var != '')
{
$remaining .= '<li>' . $var . '<br>' . "\n";
$block_var = explode('.', $var);
unset($block_var[count($block_var)-1]);
if (count($block_var))
{
for ($_num = count($block_var)-1; $_num >= 0; $_num--)
{
$remaining .= ($_num == count($block_var)-1) ? '<i>Element of Block</i> -&gt; <b>' . $block_var[$_num] . '</b><br>' . "\n" : '<i>...which is an element of</i> -&gt; <b>' . $block_var[$_num] . '</b><br>' . "\n";
}
}
$remaining .= '<br></li>' . "\n";
}
}
$remaining .= '</ul>';
}
else
{
$remaining = '<b>NONE</b><br>' . "\n";
}
$html_data = str_replace('{REMAINING_VARS}', $remaining, $html_data);
if (isset($php_files_includes[$data['single_filename']]) && count($php_files_includes[$data['single_filename']]))
{
$usedby = '<ul>';
foreach ($php_files_includes[$data['single_filename']] as $php_filename)
{
$usedby .= '<li>' . str_replace('../', '', $php_filename) . '</li>';
}
$usedby .= '</ul>';
}
else
{
$usedby = '<b>NONE</b><br>' . "\n";
}
$html_data = str_replace('{USED_BY}', $usedby, $html_data);
fwrite($fp, $html_data);
fclose($fp);
}
echo '<br>Store Files';
$fp = fopen($store_dir . 'index.html', 'w');
$html_data = '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="subSilver.css" type="text/css">
<style type="text/css">
<!--
th { background-image: url(\'cellpic3.gif\') }
td.cat { background-image: url(\'cellpic1.gif\') }
//-->
</style>
<title>Contents</title>
</head>
<body>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><img src="header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></td>
<td width="100%" background="header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle">Available Template Files</span> &nbsp; &nbsp; &nbsp;</td>
</tr>
</table>
<table width="95%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td><br clear="all" />
<br>This Style Document is 100% auto-generated... no human interaction included. :D<br>
<h2>phpBB 2.2 Template</h2>
<br>
<ol>
';
sort($files_to_parse);
foreach ($files_to_parse as $file_num => $data)
{
echo '.';
flush();
$var = $data['single_filename'];
$html_data .= '<li><a href="./' . $file_to_destfile[$var] . '" class="gen">' . $var . '</a></li><br>' . "\n";
}
$html_data .= '<br><li><a href="./lang_index.html" class="gen">Appendix A: Language Variable Index</a></li><br>';
$html_data .= '
</ol><br><br>
<div class="copyright" align="center">Powered by phpBB 2.2 &copy; <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB Group</a>, 2003</div>
<br clear="all" /></td>
</tr>
</table>
</body>
</html>
';
fwrite($fp, $html_data);
fclose($fp);
// Not only write down all language files, place them into a specific array, named by the template file
// All Language vars assigned to more than one template will be placed into a common file
$entry = array();
$common_fp = fopen($store_dir . 'lang_common.php', 'w');
fwrite($common_fp, "<?php\n\n \$lang = array(\n");
$fp = fopen($store_dir . 'lang_index.html', 'w');
$html_data = '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="subSilver.css" type="text/css">
<style type="text/css">
<!--
th { background-image: url(\'cellpic3.gif\') }
td.cat { background-image: url(\'cellpic1.gif\') }
//-->
</style>
<title>Appendix A :: Language Variable Index</title>
</head>
<body>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><img src="header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></td>
<td width="100%" background="header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle">Language Variable Index</span> &nbsp; &nbsp; &nbsp;</td>
</tr>
</table>
<table width="95%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td><br clear="all" />
<br><a href="./index.html" class="gen">Back to Contents</a><br><br>
<br>
';
echo '<br>Write Language Files';
asort($lang_references);
ksort($lang_references);
$_index = '';
$old_char = '';
foreach ($lang_references as $lang_var => $filenames)
{
$var = preg_replace('#^L_(.*?)#', '\1', $lang_var);
$char = $var{0};
if ($old_char != $char)
{
$old_char = $char;
$_index .= ($_index != '') ? ' :: ' : '';
$_index .= '<a href="#' . $char . '" class="gen"><b>' . $char . '</b></a>';
}
}
$html_data .= $_index . '<br><br><br>';
$old_char = '';
foreach ($lang_references as $lang_var => $filenames)
{
echo '.';
flush();
$var = preg_replace('#^L_(.*?)#', '\1', $lang_var);
$char = $var{0};
if ($old_char != $char)
{
$old_char = $char;
$html_data .= '<br><hr><br><a name="' . $char . '"></a><h2>Letter ' . $char . '</h2><br><br>';
}
$html_data .= '<b>' . $lang_var . '</b><ul>';
if (sizeof($filenames) != 1)
{
fwrite($common_fp, (($entry['common']) ? ",\n" : '') . "\t'$var' => '" . $lang[$var] . "'");
$entry['common'] = true;
}
else if (sizeof($filenames) == 1)
{
// Merge logical - hardcoded
$fname = (preg_match('#^(' . implode('|', $merge) . ')#', $filenames[0], $match)) ? $match[0] . '.php' : str_replace($ext, 'php', $filenames[0]);
if (!$lang_fp[$fname])
{
$lang_fp[$fname] = fopen($store_dir . 'lang_' . $fname, 'w');
fwrite($lang_fp[$fname], "<?php\n\n\$lang = array(\n");
$entry[$fname] = false;
}
fwrite($lang_fp[$fname], (($entry[$fname]) ? ",\n" : '') . "\t'$var' => '" . $lang[$var] . "'");
$entry[$fname] = true;
}
foreach ($filenames as $f_name)
{
$var = trim($f_name);
$html_data .= '<li><a href="./' . $file_to_destfile[$var] . '" class="gen">' . $var . '</a></li><br>' . "\n";
}
$html_data .= '</ul><br><br>';
}
fwrite($common_fp, ")\n);\n?>");
fclose($common_fp);
foreach ($lang_fp as $filepointer)
{
fwrite($filepointer, ")\n);\n?>");
fclose($filepointer);
}
$html_data .= '
<br><br>
<div class="copyright" align="center">Powered by phpBB 2.2 &copy; <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB Group</a>, 2003</div>
<br clear="all" /></td>
</tr>
</table>
</body>
</html>
';
fwrite($fp, $html_data);
fclose($fp);
echo '<br>Finished!';
flush();
?>

View File

@@ -1,73 +0,0 @@
<?php
/***************************************************************************
* revar_lang_files.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
//die("Please read the first lines of this script for instructions on how to enable it");
$dirname = "./../language";
$dir = opendir($dirname);
while ( $file = readdir($dir) )
{
if ( ereg('^lang_', $file) && !is_file(phpbb_realpath($dirname . '/' . $file)) && !is_link(phpbb_realpath($dirname . '/' . $file)) )
{
include($dirname . '/' . $file . '/lang_main.php');
$lang_dir = opendir($dirname . '/' . $file . '/email');
while ( $email = readdir($lang_dir) )
{
if ( ereg('\.tpl$', $email) && is_file(phpbb_realpath($dirname . '/' . $file . '/email/' . $email)) )
{
$fp = fopen($dirname . '/' . $file . '/email/' . $email, 'r+');
$email_file = "";
while ( $line = fread($fp, 100000) )
{
$email_file .= $line;
}
if ( !preg_match('/^Charset: .*?$/m', $email_file) )
{
$email_file = preg_replace('/^((Subject: .*?\n)(\n))?/i', "\\2Charset: " . $lang['ENCODING'] . "\n\n", $email_file);
}
echo '<b>' . $dirname . '/' . $file . '/email/' . $email . "</b><br />\n";
echo nl2br($email_file);
echo "\n\n<br /><br />\n\n";
fseek($fp, 0);
fwrite($fp, $email_file);
fclose($fp);
}
}
echo "\n\n<hr />\n\n";
}
}
?>

176
phpBB/develop/fill.php Normal file
View File

@@ -0,0 +1,176 @@
<?php
// -------------------------------------------------------------
//
// $Id$
//
// FILENAME : fill.php
// STARTED : Mon Sep 15, 2003
// COPYRIGHT : <20> 2001, 2003 phpBB Group
// WWW : http://www.phpbb.com/
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
//
// -------------------------------------------------------------
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
set_time_limit(0);
header('Expires: 0');
ignore_user_abort(true);
// number of topics to create
$num_topics = 5000000;
// number of topics to be generated per call
$batch_size = 100000;
// max number of posts per topic
$posts_per_topic = 500000;
// general vars
$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : 'generate';
$start = (isset($_REQUEST['start'])) ? intval($_REQUEST['start']) : 0;
switch ($mode)
{
case 'generate':
$user_ids = $forum_ids = $topic_rows = array();
$sql = 'SELECT user_id FROM ' . USERS_TABLE;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$user_ids[] = $row['user_id'];
}
$db->sql_freeresult($result);
$sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . ' WHERE forum_type = ' . FORUM_POST;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_ids[$row['forum_id']] = $row['forum_id'];
}
$db->sql_freeresult($result);
if (!$start)
{
$db->sql_query('TRUNCATE TABLE ' . POSTS_TABLE);
$db->sql_query('TRUNCATE TABLE ' . TOPICS_TABLE);
$db->sql_query('TRUNCATE TABLE ' . TOPICS_TABLE . '_prefetch');
}
$db->sql_query('LOCK TABLES ' . POSTS_TABLE . ' WRITE, ' . TOPICS_TABLE . ' WRITE');
for ($topic_id = $start + 1; $topic_id < min($start + $batch_size, $num_topics + 1); ++$topic_id)
{
$forum_id = array_rand($forum_ids);
if (count($topic_rows) == 10)
{
$sql = 'INSERT IGNORE INTO ' . TOPICS_TABLE . " (topic_id, forum_id, topic_title, topic_reported)
VALUES " . implode(', ', $topic_rows);
$db->sql_query($sql);
$topic_rows = array();
}
$topic_rows[] = "($topic_id, $forum_id, '$forum_id-$topic_id', " . (($topic_id % 34) ? '0' : '1') . ')';
$sql = 'INSERT IGNORE INTO ' . POSTS_TABLE . ' (topic_id, forum_id, poster_id, post_subject, post_text, post_username, post_approved, post_time, post_reported)
VALUES ';
$rows = array();
$post_time = mt_rand(0, time());
$num_posts = mt_rand(1, $posts_per_topic);
for ($i = 0; $i < $num_posts; ++$i)
{
$poster_id = $user_ids[array_rand($user_ids)];
$poster_name = ($poster_id == ANONYMOUS) ? rndm_username() : '';
$rows[] = "($topic_id, $forum_id, $poster_id, '$forum_id-$topic_id-$i', '$forum_id-$topic_id-$i', '$poster_name', " . (mt_rand(0, 12) ? '1' : '0') . ', ' . ($post_time + $i * 60) . ', ' . (mt_rand(0, 32) ? '0' : '1') . ')';
}
$db->sql_query($sql . implode(', ', $rows));
}
if (count($topic_rows))
{
$sql = 'INSERT IGNORE INTO ' . TOPICS_TABLE . " (topic_id, forum_id, topic_title, topic_reported)
VALUES " . implode(', ', $topic_rows);
$db->sql_query($sql);
}
$db->sql_query('UNLOCK TABLES');
if ($topic_id >= $num_topics)
{
echo '<meta http-equiv="refresh" content="0; url=fill.' . $phpEx . '?mode=sync&amp;' . time() . '">And now for something completely different...';
$db->sql_query('ANALYZE TABLES ' . TOPICS_TABLE . ', ' . POSTS_TABLE);
}
else
{
echo '<meta http-equiv="refresh" content="0; url=fill.' . $phpEx . '?start=' . $topic_id . '&amp;' . time() . '">To the next page... (' . $topic_id . '/' . $num_topics . ')';
}
break;
case 'sync':
error_reporting(E_ALL);
$sync_all = TRUE;
if ($sync_all)
{
$s = explode(' ', microtime());
sync('topic', '', '', TRUE, FALSE);
// sync('forum');
$e = explode(' ', microtime());
echo '<pre><b>' . ($e[0] + $e[1] - $s[0] - $s[1]) . '</b></pre>';
echo '<a href="fill.' . $phpEx . '">Here we go again</a>';
}
else
{
$batch_size = $batch_size * 10;
$end = $start + $batch_size;
$s = explode(' ', microtime());
sync('topic', 'range', "topic_id BETWEEN $start AND $end", TRUE, FALSE);
$e = explode(' ', microtime());
echo '<pre>Time taken: <b>' . ($e[0] + $e[1] - $s[0] - $s[1]) . '</b></pre>';
if ($end < $num_topics)
{
$start += $batch_size;
echo '<meta http-equiv="refresh" content="0; url=fill.' . $phpEx . "?mode=sync&amp;start=$start&amp;" . time() . "\">And now for something completely different... ($start/$num_topics)";
}
else
{
echo '<a href="fill.' . $phpEx . '">Here we go again</a>';
}
}
if (isset($_GET['explain']))
{
trigger_error('Done');
}
}
function rndm_username()
{
static $usernames;
if (!isset($usernames))
{
$usernames = get_defined_functions();
$usernames = $usernames['internal'];
}
return $usernames[array_rand($usernames)];
}
?>

View File

@@ -7,18 +7,21 @@
#
# UPDATE: 7/31/2001: fix so that it doesn't touch things in the images directory
#
# UPDATE: 12/15/2003: Fix so that it doesn't touch any "non-text" files
#
find . > FILELIST.$$
grep -sv FILELIST FILELIST.$$ > FILELIST2.$$
grep -sv $(basename $0) FILELIST2.$$ > FILELIST.$$
grep -sv "^\.$" FILELIST.$$ > FILELIST2.$$
grep -sv "images" FILELIST2.$$ > FILELIST
file -f FILELIST2.$$ |grep text | sed -e 's/^\([^\:]*\)\:.*$/\1/' > FILELIST
file -f FILELIST2.$$ |grep -sv text | sed -e 's/^\([^\:]*\)\:.*$/Not Modifying file: \1/'
rm FILELIST2.$$
rm FILELIST.$$
for i in $(cat FILELIST); do
if [ -f $i ]; then
sed -e s/
sed -e s/
//g $i > $i.tmp
mv $i.tmp $i
fi

View File

@@ -1,64 +0,0 @@
<?php
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
$phpbb_root_path = "../";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
echo "Inserting new config vars<br /><br />\n";
echo "server_name :: ";
flush();
$sql = "INSERT INTO " . CONFIG_TABLE . "
(config_name, config_value) VALUES ('server_name', 'www.myserver.tld')";
if( !$db->sql_query($sql) )
{
print "Failed inserting server_name config ... probably exists already<br />\n";
}
else
{
echo "DONE<br />\n";
}
echo "script_path :: ";
flush();
$sql = "INSERT INTO " . CONFIG_TABLE . "
(config_name, config_value) VALUES ('script_path', '/phpBB2/')";
if( !$db->sql_query($sql) )
{
print "Failed inserting script_path config ... probably exists already<br />\n";
}
else
{
echo "DONE<br />\n";
}
echo "server_port :: ";
flush();
$sql = "INSERT INTO " . CONFIG_TABLE . "
(config_name, config_value) VALUES ('server_port', '80')";
if( !$db->sql_query($sql) )
{
print "Failed inserting server_port config ... probably exists already<br />\n";
}
else
{
echo "DONE<br />\n";
}
$db->sql_close();
echo "<br />COMPLETE<br />\n";
?>

View File

@@ -0,0 +1,80 @@
<?php
// -------------------------------------------------------------
//
// $Id$
//
// FILENAME : merge_attachment_tables.php
// STARTED : Tue Nov 04, 2003
// COPYRIGHT : <20> 2001, 2003 phpBB Group
// WWW : http://www.phpbb.com/
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
//
// -------------------------------------------------------------
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
define('IN_PHPBB', 1);
define('ANONYMOUS', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'config.'.$phpEx);
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
$cache = new acm();
$db = new sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
// Rename the attachments table...
$sql = "RENAME TABLE {$table_prefix}attachments TO {$table_prefix}attach_temp";
$db->sql_query($sql);
$sql = "CREATE TABLE {$table_prefix}attachments
SELECT d.*, a.post_id, a.user_id_from as poster_id, p.topic_id
FROM {$table_prefix}attach_desc d, {$table_prefix}attach_temp a, {$table_prefix}posts p
WHERE a.attach_id = d.attach_id
AND a.post_id = p.post_id";
$db->sql_query($sql);
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql = 'ALTER TABLE ' . $table_prefix . 'attachments
ADD PRIMARY KEY (attach_id),
ADD INDEX filetime (filetime),
ADD INDEX post_id (post_id),
ADD INDEX poster_id (poster_id),
ADD INDEX physical_filename (physical_filename(10)),
ADD INDEX filesize (filesize),
ADD INDEX topic_id (topic_id),
MODIFY COLUMN attach_id mediumint(8) UNSIGNED NOT NULL auto_increment';
break;
case 'mssql':
case 'mssql-odbc':
case 'msaccess':
break;
case 'postgresql':
break;
}
$db->sql_query($sql);
//$db->sql_query("DROP TABLE {$table_prefix}attach_temp");
echo "<p><b>Done</b></p>\n";
?>

View File

@@ -0,0 +1,209 @@
<?php
/***************************************************************************
* merge_clean_posts.php
* -------------------
* begin : Tuesday, February 25, 2003
* copyright : (C) 2003 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
@set_time_limit(2400);
$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
define('IN_PHPBB', 1);
define('ANONYMOUS', 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
require($phpbb_root_path . 'includes/acm/cache_' . $acm_type . '.'.$phpEx);
include($phpbb_root_path . 'db/' . $dbms . '.'.$phpEx);
$cache = new acm();
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
// Just Do it (tm)
$sql = "RENAME TABLE {$table_prefix}posts TO {$table_prefix}posts_temp";
$db->sql_query($sql);
$sql = "CREATE TABLE {$table_prefix}posts
SELECT p.*, pt.post_subject, pt.post_text, pt.post_checksum, pt.bbcode_bitfield, pt.bbcode_uid
FROM {$table_prefix}posts_temp p, {$table_prefix}posts_text pt
WHERE pt.post_id = p.post_id";
$db->sql_query($sql);
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql = 'ALTER TABLE ' . $table_prefix . 'posts
ADD PRIMARY KEY (post_id),
ADD INDEX topic_id (topic_id),
ADD INDEX poster_ip (poster_ip),
ADD INDEX post_approved (post_approved),
MODIFY COLUMN post_id mediumint(8) UNSIGNED NOT NULL auto_increment,
ADD COLUMN post_encoding varchar(11) DEFAULT \'iso-8859-15\' NOT NULL';
break;
case 'mssql':
case 'mssql-odbc':
case 'msaccess':
break;
case 'postgresql':
break;
}
$db->sql_query($sql);
$sql = "UPDATE {$table_prefix}topics SET topic_poster = 1 WHERE topic_poster = 0 OR topic_poster IS NULL";
$db->sql_query($sql);
$sql = "UPDATE {$table_prefix}topics SET topic_last_poster_id = 1 WHERE topic_last_poster_id = 0 OR topic_last_poster_id IS NULL";
$db->sql_query($sql);
$sql = "UPDATE {$table_prefix}posts SET poster_id = 1 WHERE poster_id = 0 OR poster_id IS NULL";
$db->sql_query($sql);
$sql = "UPDATE {$table_prefix}users SET user_id = 1 WHERE user_id = 0";
$db->sql_query($sql);
$sql = "SELECT t.topic_id
FROM {$table_prefix}topics t
LEFT JOIN {$table_prefix}posts p ON p.topic_id = t.topic_id
WHERE p.topic_id IS NULL";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$del_sql = '';
do
{
$del_sql .= (($del_sql != '') ? ', ' : '') . $row['topic_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM {$table_prefix}topics
WHERE topic_id IN ($del_sql)";
$db->sql_query($sql);
}
$db->sql_freeresult($result);
$del_sql = '';
$sql = "SELECT topic_id, MIN(post_id) AS first_post_id, MAX(post_id) AS last_post_id, COUNT(post_id) AS total_posts
FROM {$table_prefix}posts
GROUP BY topic_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$del_sql .= (($del_sql != '') ? ', ' : '') . $row['topic_id'];
$sql = "UPDATE {$table_prefix}topics
SET topic_first_post_id = " . $row['first_post_id'] . ", topic_last_post_id = " . $row['last_post_id'] . ", topic_replies = " . ($row['total_posts'] - 1) . "
WHERE topic_id = " . $row['topic_id'];
$db->sql_query($sql);
}
$db->sql_freeresult($result);
$sql = "DELETE FROM {$table_prefix}topics WHERE topic_id NOT IN ($del_sql)";
$db->sql_query($sql);
$topic_count = $post_count = array();
$sql = "SELECT forum_id, COUNT(topic_id) AS topics
FROM {$table_prefix}topics
GROUP BY forum_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$topic_count[$row['forum_id']] = $row['topics'];
}
$db->sql_freeresult($result);
$sql = "SELECT forum_id, COUNT(post_id) AS posts
FROM {$table_prefix}posts
GROUP BY forum_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$post_count[$row['forum_id']] = $row['posts'];
}
$db->sql_freeresult($result);
switch (SQL_LAYER)
{
case 'oracle':
$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
FROM " . $table_prefix . "forums f, " . $table_prefix . "posts p, " . $table_prefix . "users u
WHERE p.post_id = f.forum_last_post_id(+)
AND u.user_id = p.poster_id(+)";
break;
default:
$sql = "SELECT f.forum_id, p.post_time, p.post_username, u.username, u.user_id
FROM ((" . $table_prefix . "forums f
LEFT JOIN " . $table_prefix . "posts p ON p.post_id = f.forum_last_post_id)
LEFT JOIN " . $table_prefix . "users u ON u.user_id = p.poster_id)";
break;
}
$result = $db->sql_query($sql);
$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$forum_id = $row['forum_id'];
$sql_ary[] = "UPDATE " . $table_prefix . "forums
SET forum_last_poster_id = " . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? $row['user_id'] : ANONYMOUS) . ", forum_last_poster_name = '" . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? addslashes($row['username']) : addslashes($row['post_username'])) . "', forum_last_post_time = " . $row['post_time'] . ", forum_posts = " . (($post_count[$forum_id]) ? $post_count[$forum_id] : 0) . ", forum_topics = " . (($topic_count[$forum_id]) ? $topic_count[$forum_id] : 0) . "
WHERE forum_id = $forum_id";
$sql = "SELECT t.topic_id, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
FROM " . $table_prefix . "topics t, " . $table_prefix . "users u, " . $table_prefix . "posts p, " . $table_prefix . "posts p2, " . $table_prefix . "users u2
WHERE t.forum_id = $forum_id
AND u.user_id = t.topic_poster
AND p.post_id = t.topic_first_post_id
AND p2.post_id = t.topic_last_post_id
AND u2.user_id = p2.poster_id";
$result2 = $db->sql_query($sql);
while ($row2 = $db->sql_fetchrow($result2))
{
$sql_ary[] = "UPDATE " . $table_prefix . "topics
SET topic_poster = " . $row2['user_id'] . ", topic_first_poster_name = '" . ((!empty($row2['user_id']) && $row2['user_id'] != ANONYMOUS) ? addslashes($row2['username']) : addslashes($row2['post_username'])) . "', topic_last_poster_id = " . ((!empty($row2['id2']) && $row2['id2'] != ANONYMOUS) ? $row2['id2'] : ANONYMOUS) . ", topic_last_post_time = " . $row2['post_time'] . ", topic_last_poster_name = '" . ((!empty($row2['id2']) && $row2['id2'] != ANONYMOUS) ? addslashes($row2['user2']) : addslashes($row2['post_username2'])) . "'
WHERE topic_id = " . $row2['topic_id'];
}
$db->sql_freeresult($result2);
unset($row2);
}
$db->sql_freeresult($result);
foreach ($sql_ary as $sql)
{
$sql . "<br />";
$db->sql_query($sql);
}
echo "<p><b>Done</b></p>\n";
?>

View File

@@ -1,42 +0,0 @@
<html>
<body>
<?php
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
$phpbb_root_path = "../";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
echo "\n<br >\n" . $sql = "INSERT INTO " . CONFIG_TABLE . "
(config_name, config_value) VALUES ('record_online_users', '1')";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert config key 'record_online_users'", "", __LINE__, __FILE__, $sql);
}
echo "\n<br >\n" . $sql = "INSERT INTO " . CONFIG_TABLE . "
(config_name, config_value) VALUES ('record_online_date', '".time()."')";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert config key 'record_online_date'", "", __LINE__, __FILE__, $sql);
}
echo "\n<br />\nCOMPLETE";
?>
</body>
</html>

View File

@@ -1,82 +0,0 @@
<?php
/***************************************************************************
* revar_lang_files.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
$vars = array('lang_main' => 'lang', 'lang_admin' => 'lang', 'lang_faq' => 'faq', 'lang_bbcode' => 'faq');
$dirname = "./../language";
$dir = opendir($dirname);
while ( $file = readdir($dir) )
{
if ( ereg("^lang_", $file) && !is_file(realpath($dirname . "/" . $file)) && !is_link(realpath($dirname . "/" . $file)) )
{
foreach($vars as $lang_file => $lang_var)
{
$$lang_var = array();
include($dirname . "/" . $file . "/" . $lang_file . '.php');
$store = "";
while( list($key, $value) = each($$lang_var) )
{
if ( !is_array($value) )
{
$key = ( is_string($key) ) ? "'$key'" : $key;
$store .= ( ( $store != "" ) ? ", \n\t" : "" ) . "$key => '" . addslashes($value) . "'";
}
else
{
$key = ( is_string($key) ) ? "'$key'" : $key;
$store .= ( ( $store != "" ) ? ", \n\t" : "" ) . "$key => array(\n\t\t";
$store2 = "";
while( list($key2, $value2) = each($value) )
{
$key2 = ( is_string($key) ) ? "'$key2'" : $key2;
$store2 .= ( ( $store2 != "" ) ? ", \n\t\t" : "" ) . "$key2 => '" . addslashes($value2) . "'";
}
$store .= $store2 . "\n\t)";
}
}
$store = "<?php\n\$$lang_var = array(\n\t$store\n);\n?".">";
$fp = fopen($dirname . "/" . $file . "/" . $lang_file . '.php', 'w');
fwrite($fp, $store);
fclose($fp);
}
}
}
?>

View File

@@ -33,7 +33,7 @@ $synonym_array = file($phpbb_root_path . "language/lang_english/search_synonyms.
// Fetch a batch of posts_text entries
//
$sql = "SELECT COUNT(*) as total, MAX(post_id) as max_post_id
FROM ". POSTS_TEXT_TABLE;
FROM ". POSTS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
$error = $db->sql_error();
@@ -56,7 +56,7 @@ for(;$postcounter <= $max_post_id; $postcounter += $batchsize)
$batchcount++;
$sql = "SELECT *
FROM " . POSTS_TEXT_TABLE . "
FROM " . POSTS_TABLE . "
WHERE post_id
BETWEEN $batchstart
AND $batchend";

View File

@@ -1,6 +1,33 @@
Please see: http://www.phpbb.com/about.php for a list of all the people involved in phpBB.
Please see: http://www.phpbb.com/about.php for a list of people involved within the security audit of phpBB (since phpBB 2.0.17).
/* ********************************************************************** *\
/* *\
/* phpBB 2.2 <20> Copyright 2003 phpBB Group *\
/* *\
/* [ http://www.phpbb.com/ ] *\
/* *\
/* ********************************************************************** *\
[September 2005]
Our special thanks goes to our former developer and manager psoTFX (Paul S. Owen) for being a wonderful teammate and talented programer.
He was a driving force in the project for over 3 years and helped a lot in making phpBB what it is now.
phpBB Project Manager : theFinn (James Atkinson)
phpBB Lead Developer : psoTFX (Paul S. Owen)
phpBB Developers : Ashe (Ludovic Arnaud)
Acyd Burn (Meik Sievertsen)
phpBB Group : theFinn (James Atkinson)
psoTFX (Paul S. Owen)
BartVB (Bart Van Bragt)
ffeingol (Frank Feingold)
Original subSilver by subBlue Design, Tom Beddard, <20> 2001 phpBB Group
phpBB 2.2 contains code from the following applications:
LGPL licenced:
Smarty <20> 2001, 2002 by ispi of Lincoln, Inc, http://smarty.php.net/
GPL licenced:
phpMyAdmin <20> 2001,2003 phpMyAdmin Devel team, http://www.phpmyadmin.net/
Jabber class <20> 2003 Carlo Zottmann, http://phpjabber.g-blog.net
PHP License, version 3.0:
Pear <20> 2001-2004 PHP Group, http://pear.php.net

View File

@@ -1,856 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>phpBB 2.0.x :: Changelog</title>
<link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css" />
<style type="text/css">
<!--
p,ul,td {font-size:10pt;}
.h2 {font-size:15pt;font-weight:bold;color:red}
.h3 {font-size:12pt;color:blue}
//-->
</style>
</head>
<body bgcolor="#E5E5E5" text="#000000" link="#006699" vlink="#006699">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td class="bodyline"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2 : Creating Communities" vspace="1" /></a></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.x CHANGELOG</span></td>
</tr>
</table>
<!-- BEGIN DOCUMENT -->
<ol>
<li><a href="#changelog">Changelog</a></li>
<ol type="i">
<li><a href="#2022">Changes since 2.0.22</a></li>
<li><a href="#2021">Changes since 2.0.21</a></li>
<li><a href="#2020">Changes since 2.0.20</a></li>
<li><a href="#2019">Changes since 2.0.19</a></li>
<li><a href="#2018">Changes since 2.0.18</a></li>
<li><a href="#2017">Changes since 2.0.17</a></li>
<li><a href="#2016">Changes since 2.0.16</a></li>
<li><a href="#2015">Changes since 2.0.15</a></li>
<li><a href="#2014">Changes since 2.0.14</a></li>
<li><a href="#2013">Changes since 2.0.13</a></li>
<li><a href="#2012">Changes since 2.0.12</a></li>
<li><a href="#2011">Changes since 2.0.11</a></li>
<li><a href="#2010">Changes since 2.0.10</a></li>
<li><a href="#209">Changes since 2.0.9</a></li>
<li><a href="#208">Changes since 2.0.8</a></li>
<li><a href="#207">Changes since 2.0.7</a></li>
<li><a href="#206">Changes since 2.0.6</a></li>
<li><a href="#205">Changes since 2.0.5</a></li>
<li><a href="#204">Changes since 2.0.4</a></li>
<li><a href="#203">Changes since 2.0.3</a></li>
<li><a href="#202">Changes since 2.0.2</a></li>
<li><a href="#201">Changes since 2.0.1</a></li>
<li><a href="#200">Changes since 2.0.0</a></li>
<li><a href="#final">Changes since RC-4</a></li>
<li><a href="#rc4">Changes since RC-3</a></li>
<li><a href="#rc3">Changes since RC-2</a></li>
<li><a href="#rc2">Changes since RC-1</a></li>
<li><a href="#rc1">Changes since RC-1 (pre)</a></li>
</ol>
<li><a href="#disclaimer">Disclaimer</a></li>
</ol>
<a name="changelog"></a><h2 class="h2"><u>1. Changelog</u></h2>
<p>This is a non-exhaustive (but still near complete) changelog for phpBB 2.0.x including beta and release candidate versions. Our thanks to all those people who've contributed bug reports and code fixes.</p>
<a name="2022"></a><h3 class="h3">l.i. Changes since 2.0.22</h3>
<ul>
<li>[Fix] Correctly re-assign group moderator on user deletion (Bug #280)</li>
<li>[Fix] Deleting a forum with multiple polls included (Bug #6740)</li>
<li>[Fix] Fixed postgresql query for obtaining group moderator in groupcp.php (Bug #6550)</li>
<li>[Fix] Selected field on first entry by default for font size within posting_body.tpl (Bug #7124)</li>
<li>[Fix] Adjusted maxlength parameters in admin/styles_edit_body.tpl (Bug #81)</li>
<li>[Fix] Fixed html output in make_forum_select if no forums present (Bug #436)</li>
<li>[Fix] Fixed spelling error(s) in lang_admin.php (Bug #7172, #6978)</li>
<li>[Fix] Correctly display censored words in admin panel (Bug #12271)</li>
<li>[Fix] Do not allow soft hyphen \xAD in usernames (reported by Bander00)</li>
<li>[Fix] Fixed the group permission system's use of array access</li>
<li>[Fix] Simple group permissions now work properly</li>
<li>[Sec] Fix possible XSRF Vulnerability in private messaging and groups handling</li>
<li>[Fix] Fix inability to export smilies (Bug #2265)</li>
<li>[Fix] Fixing some problems with PHP5 and register_long_arrays off</li>
</ul>
<a name="2021"></a><h3 class="h3">l.ii. Changes since 2.0.21</h3>
<ul>
<li>[Fix] Check for user's existence prior to showing email form</li>
<li>[Fix] New members of moderator groups should always become moderators (Bug #382)</li>
<li>[Fix] Proper message when replying to non-existant topics (Bug #459)</li>
<li>[Fix] Changed column type of search_array to store more ids (Bug #4058)</li>
<li>[Fix] Fixed annoyance with font-size selector (Bug #4612)</li>
<li>[Fix] Fix optimize line in database updater (Bug #6186)</li>
<li>[Sec] Check for the avatar upload directory reinforced</li>
<li>[Sec] Changes to the criteria for "bad" redirection targets - kellanved</li>
<li>[Sec] Fixed a non-persistent XSS issue in private messaging</li>
<li>[Sec] Fixing possible negative start parameter - SpiderZ.</li>
<li>[Sec] Added session checks to various forms - kellanved</li>
</ul>
<a name="2020"></a><h3 class="h3">l.iii. Changes since 2.0.20</h3>
<ul>
<li>[Fix] Changes to random number generator code to explicitly truncate the length of the string</li>
<li>[Fix] Quoting on boards with HTML enabled</li>
<li>[Fix] Special characters on boards with HTML enabled</li>
<li>[Fix] Redirect to list if cancelling deletion of ranks, smilies or word censors</li>
<li>[Fix] Missing error message if an inactive user tried to login (Bug #1598)</li>
<li>[Fix] Do not alter post counts when just removing a poll (Bug #1602)</li>
<li>[Fix] Correct error in removal of old session keys</li>
<li>[Fix] Changed filtering of short search terms</li>
<li>[Sec] Improved filtering on language selection (also addresses a number of bug reports related to missing languages)</li>
<li>[Change] Backported more efficient highlighting code from Olympus</li>
<li>[Change] Backported zlib emulation code so that there is only a single confirmation image even if zlib is not available</li>
</ul>
<a name="2019"></a><h3 class="h3">l.iv. Changes since 2.0.19</h3>
<ul>
<li>[Fix] Prevent login attempts from incrementing for inactive users</li>
<li>[Fix] Do not check maximum login attempts on re-authentication to the admin panel - tomknight</li>
<li>[Fix] Regenerate session keys on password change</li>
<li>[Fix] retrieving category rows in index.php (Bug #90)</li>
<li>[Fix] improved index performance by determining the permissions before iterating through all forums (Bug #91)</li>
<li>[Fix] Better handling of short usernames within the search (bug #105)</li>
<li>[Fix] Send a no-cache header on admin pages as well as normal board pages (Bug #149)</li>
<li>[Fix] Apply word censors to the message when quoting it (Bug #405)</li>
<li>[Fix] Improved performance of query in admin_groups (Bug #753)</li>
<li>[Fix] Workaround for an issue in either PHP or MSSQL resulting in a space being returned instead of an empty string (bug #830)</li>
<li>[Fix] Correct use of default_style config value (Bug #861)</li>
<li>[Fix] Replace unneeded unset calls in admin_db_utilities.php - vanderaj</li>
<li>[Fix] Improved error handling in modcp.php</li>
<li>[Fix] Improved handling of forums to which the user does not have any explicit permissions - vanderaj</li>
<li>[Fix] Assorted fixes and cleanup of admin_ranks.php, now requires confirmation of deletions</li>
<li>[Fix] Assorted fixes and cleanup of admin_words.php, now requires confirmation of deletions</li>
<li>[Fix] Addition and editing of smilies can no longer be performed via GET, now requires confirmation of deletions</li>
<li>[Fix] Escape group names in admin_groups.php</li>
<li>[Sec] Replace strip_tags with htmlspecialchars in private message subject</li>
<li>[Sec] Some changes to HTML handling if enabled</li>
<li>[Sec] Escape any special characters in reverse dns - Anthrax101</li>
<li>[Sec] Typecast poll id values - Anthrax101</li>
<li>[Sec] Added configurable search flood control to reduce the effect of DoS style attacks</li>
<li>[Sec] Changed the way we create "random" values for use as keys - chinchilla/Anthrax101</li>
<li>[Change] Changed handling of the case where a selected style doesn't exist in the database</li>
<li>[Change] Changed handling of topic pruning to improve performance</li>
<li>[Change] Changed default forum permissions to only allow registered users to post in new forums</li>
</ul>
<a name="2018"></a><h3 class="h3">l.v. Changes since 2.0.18</h3>
<ul>
<li>[Fix] corrected index on session keys table under MS SQL</li>
<li>[Fix] added session keys table to backup</li>
<li>[Fix] delete session keys entries when deleting user</li>
<li>[Fix] changes to support MySQL 5.0</li>
<li>[Fix] changes to some of the admin files to improve efficiency and remove a potential error condition when building the menu</li>
<li>[Fix] change truncation of username length in usercp_register.php - BFUK</li>
<li>[Fix] incorrect path to avatars in admin_users.php (Bug #667)</li>
<li>[Fix] fixed get_userdata to support correct sql escaping (non-mysql dbs) - jarnaez</li>
<li>[Fix] fixed captcha for those not having the zlib extension enabled</li>
<li>[Change] Placed version information above who is online in admin panel for better visual presence</li>
<li>[Sec] fixed XSS issue (only valid for Internet Explorer) within the url bbcode</li>
<li>[Sec] fixed XSS issue if html tags are allowed and enabled</li>
<li>[Sec] added configurable maximum login attempts to prevent dictionary attacks</li>
</ul>
<a name="2017"></a><h3 class="h3">l.vi. Changes since 2.0.17</h3>
<ul>
<li>[Fix] incorrect handling of password resets if admin activation is enabled (Bug #88)</li>
<li>[Fix] wrong topic redirection after login redirect (Bug #94)</li>
<li>[Fix] improved handling of username lists in admin_ug_auth.php (Bug #98)</li>
<li>[Fix] incorrect removal of bbcode_uid values if bbcode has been turned off (Bug #100)</li>
<li>[Fix] correctly preview signature if editing other users posts (Bug #101)</li>
<li>[Fix] incorrect alt tag on generated search images in groupcp.php, viewtopic.php and usercp_viewprofile.php (Bug #102)</li>
<li>[Fix] consistent forum ordering in all dropdown boxes (Bug #106)</li>
<li>[Fix] correctly get compression status in page_tail.php and page_footer_admin.php (Bug #117)</li>
<li>[Fix] set page title on summary page of groupcp.php (bug #125)</li>
<li>[Fix] correctly test style and avatar in usercp_register.php (bug #129 and #317)</li>
<li>[Fix] handling of reactivation notifications if admin activation is enabled (Bug #145)</li>
<li>[Fix] handling of both forms of translation information used in language packs (Bug #159)</li>
<li>[Fix] key length for activation keys fixed in usercp_sendpassword.php (Bug #171)</li>
<li>[Fix] use GENERAL_MESSAGE constant in message_die instead of MESSAGE (Bug #176)</li>
<li>[Fix] incorrect handling of move stubs (Bug #179)</li>
<li>[Fix] wrong mode_type in memberlist (Bug #187)</li>
<li>[Fix] SQL errors when setting maximum PMs to 0 (Bug #188)</li>
<li>[Fix] removed unused variable from topic_notify email template (Bug #210)</li>
<li>[Fix] removed unset variable from smilies popup window title (Bug #224)</li>
<li>[Fix] removed duplicate template assignment from admin_board.php (Bug #226)</li>
<li>[Fix] incorrect search link for guest posts in modcp.php (Bug #254)</li>
<li>[Fix] all users removed from topics watch table on special occassions (Bug #271)</li>
<li>[Fix] correctly check returned value from strpos in append_sid function (Bug #275)</li>
<li>[Fix] correctly display username in private message notification (Bug #278)</li>
<li>[Fix] fixed "var-by-ref" errors (Bug #322)</li>
<li>[Fix] changed redirection to installation (Bug #325)</li>
<li>[Fix] added timout of 10 seconds to version check (Bug #348)</li>
<li>[Fix] fixed user_level default in postgresql schema file (Bug #444)</li>
<li>[Fix] multiple minor HTML issues with subSilver</li>
<li>[Change] deprecated the use of some PHP 3 compatability functions in favour of the native equivalents</li>
<li>[Change] added 60 days limit for grabbing unread topics in index.php</li>
<li>[Sec] backport of session keys system from olympus</li>
<li>[Sec] fixed email bans to use the same pattern as email validation and allow wildcard domain bans</li>
<li>[Sec] fixed validation of topic type when posting</li>
<li>[Sec] unset database password once it is no longer needed</li>
<li>[Sec] fixed potential to select images outside the specified path as avatars or smilies</li>
<li>[Sec] fix globals de-registration code for PHP5 - (Stefan Esser/Matt Kavanagh)</li>
<li>[Sec] changed avatar gallery code sections to prevent possible injection points (AnthraX101)</li>
<li>[Sec] signature field is not properly sanitised for user input when an error occurs while accessing the avatar gallery (AnthraX101)</li>
<li>[Sec] check to_username and ownership when editing a PM (AnthraX101)</li>
<li>[Sec] fixed ability to edit PM's you did not send (depablo84)</li>
<li>[Sec] compare imagetype on avatar uploading to match the file extension from uploaded file</li>
</ul>
<a name="2016"></a><h3 class="h3">l.vii. Changes since 2.0.16</h3>
<ul>
<li>Added extra checks to the deletion code in privmsg.php - reported by party_fan</li>
<li>Fixed XSS issue in IE using the url BBCode</li>
<li>Fixed admin activation so that you must have administrator rights to activate accounts in this mode - reported by ieure</li>
<li>Fixed get_username returning wrong row for usernames beginning with numerics - reported by Ptirhiik</li>
<li>Pass username through phpbb_clean_username within validate_username function - AnthraX101</li>
<li>Fixed PHP error in message_die function</li>
<li>Fixed incorrect generation of {postrow.SEARCH_IMG} tag in viewtopic.php - reported by Double_J</li>
<li>Also fixed above issue in usercp_viewprofile.php</li>
<li>Fixed incorrect setting of user_level on pending members if a group is granted moderator rights - reported by halochat</li>
<li>Fixed ordering of forums on admin_ug_auth.php to be consistant with other pages</li>
<li>Correctly set username on posts when deleting a user from the admin panel</li>
</ul>
<a name="2015"></a><h3 class="h3">l.viii. Changes since 2.0.15</h3>
<ul>
<li>Fixed critical issue with highlighting - <b>Discovered and fix provided by Ron van Daal</b></li>
<li>Url descriptions able to be wrapped over more than one line again</li>
<li>Fixed bug with eAccelerator in admin_ug_auth.php</li>
<li>Check new_forum_id for existence in modcp.php - <b>alessnet</b></li>
<li>Prevent uploading avatars with no dimensions - <b>Xpert</b></li>
<li>Fixed bug in usercp_register.php, forcing avatar file removal without updating avatar informations within the database - <b>HenkPoley</b></li>
<li>Fixed bug in admin re-authentication redirect for servers not having index.php as one of their default files set</li>
</ul>
<a name="2014"></a><h3 class="h3">l.ix. Changes since 2.0.14</h3>
<ul>
<li>Fixed moderator status removal in groupcp.php</li>
<li>Removed newlines after ?&gt; on some files - <b>Thoul</b></li>
<li>Added admin re-authentication (admin needs to login seperatly to access the ACP) - backported from Olympus</li>
<li>Fixed vulnerability in url/bbcode handling functions - <b>PapaDos and Paul/Zhen-Xjell from CastleCops</b></li>
<li>Fixed issue in admin/admin_forums.php</li>
<li>Suppressed warning message for fsockopen in /includes/smtp.php - <b>Thoul</b></li>
<li>Fixed bug in admin/admin_smilies.php (admin is able to add empty smilies) - <b>Exy</b></li>
<li>Adjusted documents to reflect the urgent need to update the files too (not only running the database update script)</li>
<li>Updated the readme file</li>
<li>Added one new language variable</li>
<li>Added general error if accessing profile for a non-existent user</li>
<li>Changed session id generation to be more unique - <b>Henno Joosep</b></li>
<li>Fixed bug in highlight code to escape characters correctly</li>
<li>Reversed the 2.0.14 fix for postgresql because it produced more problems than it solves.</li>
<li>Added reference to article written by R45 about case-sensitivity in postgreSQL to the readme file</li>
<li>Fixed bypassing of validate_username on registration - Yen</li>
<li>Empty url/img bbcodes no longer get parsed</li>
</ul>
<a name="2013"></a><h3 class="h3">l.x. Changes since 2.0.13</h3>
<ul>
<li>Hardened author and keyword search a bit to not allow very server intensive searches</li>
<li>Fixed full path disclosure in bad word parsing</li>
<li>Resetting complete userdata array in session code if authentication fails</li>
<li>Fixed bug in moderator control panel where certain parameters could lead to an "error creating new session" sql error</li>
<li>Fixed bug in session code where empty page ids could lead to an "error creating new session" sql error</li>
<li>Fixed html handling in signatures if html is turned off globally</li>
<li>Fixed install.php problem with PHP5 register_long_arrays option turned off</li>
<li>Fixed potential issues with styling system</li>
<li>Added correct class to login_body template file</li>
<li>Removed file db/oracle.php from package</li>
<li>Removed version number from message body page in /admin (if user is not an admin) - <b>mikelbeck</b></li>
<li>Fixed case-sensitivity issues in postgres7.php - <b>R45</b></li>
</ul>
<a name="2012"></a><h3 class="h3">l.xi. Changes since 2.0.12</h3>
<ul>
<li>Ommitted preg_replace warning in viewtopic due to improper working of preg_quote in PHP - originally reported by matrix_killer, fix submitted by another party</li>
<li>Fixed high severity issue in session handling allowing everyone gaining administrator rights. Please update as soon as possible.</li>
<li>Minimum requirements raised to PHP 4.0.3 or above due to fixing vulnerability issues breaking PHP3 compatibility.</li>
</ul>
<a name="2011"></a><h3 class="h3">l.xii. Changes since 2.0.11</h3>
<ul>
<li>Added confirm table to admin_db_utilities.php</li>
<li>Prevented full path display on critical messages</li>
<li>Fixed full path disclosure in username handling caused by a PHP 4.3.10 bug - <b>AnthraX101</b></li>
<li>Added exclude list to unsetting globals (if register_globals is on) - <b>SpoofedExistence</b></li>
<li>Fixed arbitrary file disclosure vulnerability in avatar handling functions - <b>AnthraX101</b></li>
<li>Fixed arbitrary file unlink vulnerability in avatar handling functions - <b>AnthraX101</b></li>
<li>Removed version number from powered by line</li>
<li>Merged database update files to update_to_latest.php file</li>
<li>Fixed path disclosure bug in search.php caused by a PHP 4.3.10 bug (related to AnthraX101's discovery)</li>
<li>Fixed path disclosure bug in viewtopic.php caused by a PHP 4.3.10 bug - <b>matrix_killer</b></li>
</ul>
<a name="2010"></a><h3 class="h3">l.xiii. Changes since 2.0.10</h3>
<ul>
<li>Fixed vulnerability in highlighting code (<b>very high severity, please update your installation as soon as possible</b>)</li>
<li>Fixed unsetting global vars - <b>Matt Kavanagh</b></li>
<li>Fixed XSS vulnerability in username handling - <b>AnthraX101</b></li>
<li>Fixed not confirmed sql injection in username handling - <b>warmth</b></li>
<li>Added check for empty topic id in topic_review function</li>
<li>Added visual confirmation mod to code base</li>
</ul>
<a name="209"></a><h3 class="h3">l.xiv. Changes since 2.0.9</h3>
<ul>
<li>Fixed deleting of styles in admin_styles.php</li>
<li>Fixed wrong unsetting of variables introduced in phpBB 2.0.9, making the board non-functional for users with specific php.ini settings</li>
<li>Added code to let phpBB work with PHP5 for those having register_long_arrays set to off (default settings) - running phpBB 2.0.x with PHP5 is not supported at http://www.phpbb.com.</li>
<li>Fixed bug in admin_board.php for board settings having single quotes in it</li>
<li>Fixed "search by author" in search.php. Now it is possible to search for users with special chars in their name too</li>
<li>Fixed forum jumpbox propagating session id in moderator control pages</li>
<li>Added check for newlines at redirecting pages, to prevent http response splitting attacks - <b>Ory Segal and Amit Klein</b></li>
<li>Fixed visual confirmation code. The image was not created due to a wrong regular expression.</li>
</ul>
<a name="208"></a><h3 class="h3">l.xv. Changes since 2.0.8</h3>
<ul>
<li>Fixed one vulnerability in admin_board.php - <b>Xore</b></li>
<li>Added checking for proper session id characters to sessions and viewtopic to prevent injections - <b>Bartlomiej Korupczynski</b></li>
<li>Fixed injection vulnerabilities possible with linked avatars</li>
<li>Implemented unsetting globalised variables</li>
<li>Limited confirm switch to POST variable in posting</li>
<li>Changed IP code in common.php to prevent IP spoofing, which might introduce some problems with private IP Ranges showing up. - <b>Wang Products</b></li>
<li>Updated visual confirmation mod [pre-edited files]</li>
<li>Moved obtaining word censors in modcp out of topic generation loop [increased performance/lower query count] - spotted by <b>R45</b></li>
<li>Added the ability to link to https/ftps sites using the img bbcode tag</li>
<li>Fixed user online information in admin/index.php</li>
<li>Fixed getting group moderator in groupcp.php if running oracle backend - spotted by <b>pakman</b></li>
<li>Fixed use of non-existing result variable in modcp (poster_id instead of user_id)</li>
<li>Fixed several vulnerabilities (XSS, SQL Injection and path disclosure) only possible with register_globals enabled - <b>Matthew C. Kavanagh, Janek Vind</b></li>
<li>Fixed problem with SID not delivered to next page in groupcp.php</li>
</ul>
<a name="207"></a><h3 class="h3">l.xvi. Changes since 2.0.7</h3>
<ul>
<li>Fixed several vulnerabilities in admin pages</li>
<li>Fixed sid checking code in admin/pagestart.php</li>
<li>Fixed injection vulnerabilities possible with the img bbcode tag</li>
<li>Limited allowed images in img bbcode tag to jpg, jpeg, gif and png</li>
<li>Fixed redirect problems - 2.0.7a</li>
<li>Fixed sql injection vulnerability in search - 2.0.7a</li>
<li>Fixed sql injection vulnerability in privmsg - 2.0.8a</li>
</ul>
<a name="206"></a><h3 class="h3">1.xvii. Changes since 2.0.6</h3>
<ul>
<li>Fixed several vulnerabilities in modcp - <b>Robert Lavierck</b></li>
<li>Changed whois lookup address within admin index</li>
<li>Fixed potential vulnerability in viewtopic postorder - 2.0.6d</li>
<li>Updates to cope with Zend Optimizer 2.5 problems - 2.0.6d - <b>jetset</b></li>
<li>Force specialcharing of redirect variable in login - <b>Pit</b></li>
<li>Fixed potential vulnerability in viewtopic postdays - <b>GulfTech Security Research</b></li>
<li>Fixed potential vulnerability in viewforum topicdays - <b>GulfTech Security Research</b></li>
<li>Fixed potential vulnerability in modcp</li>
<li>Fixed potential vulnerability in avatar gallery</li>
</ul>
<a name="205"></a><h3 class="h3">1.xviii. Changes since 2.0.5</h3>
<ul>
<li>Fixed various email issues</li>
<li>Fixed registration email bug with Administrator Confirmation used</li>
<li>Fixed mass emailer</li>
<li>Fixed long post time issue</li>
<li>Fixed bug with usernames containing single quotes</li>
<li>Fixed word list bug - Word boundaries were not considered</li>
<li>Fixed vulnerability in style admin</li>
<li>Fixed sql injection vulnerability in viewtopic</li>
<li>Fixed vulnerability allowing server side variable access in search - <b>tendor</b></li>
<li>Fixed potential vulnerability in 2.0.5 login username entry - <b>throw away/eomer</b></li>
<li>Fixed sql injection with reset date format field in profile - <b>tendor</b></li>
</ul>
<a name="204"></a><h3 class="h3">1.xix. Changes since 2.0.4</h3>
<ul>
<li>Removed user facing session_id checks</li>
<li>Fixed user self-activation after deactivation</li>
<li>Fixed incorrect functioning of phpbb_realpath</li>
<li>Fixed wrong path to database schema files within the upgrade script</li>
<li>Fixed double quote problem with username validation</li>
<li>Allow & within email addresses</li>
<li>Fixed email validation for banned email addresses</li>
<li>Removed underline from email domain validation</li>
<li>Fixed redirection for sentbox folder, installation and email</li>
<li>Fixed poll deletion</li>
<li>Fixed Mozilla navigation bar</li>
<li>Fixed URL bbcode parsing</li>
<li>Fixed database timeouts while searching the forums</li>
<li>Fixed wrong email return path in admin mass mailing - <b>netclectic</b></li>
<li>Fixed MS-SQL failures within the update script</li>
<li>Fixed memberlist sort order</li>
<li>Fixed not showing leading spaces within Code BBCode</li>
<li>Fixed problem with adding double quotes to subject titles</li>
<li>Remove username input field from profile when user cannot change name</li>
<li>Fixed pagination error with highlighting</li>
<li>Fixed errors if no smilies are installed</li>
<li>Fixed CSS issues with IE 5.2 on MacOS X</li>
<li>Fixed missing sid propagation problem within the Moderator Control Panel</li>
<li>Fixed language variables within Authentication error output</li>
<li>Removed doubled CSS class definitions within input fields</li>
<li>Fixed username change within the Administration Panel</li>
<li>Added missing &lt;tr&gt; tags to index_body.tpl</li>
<li>Added missing username language variable to admin index page</li>
<li>Fixed moderator status update if a usergroup got deleted</li>
<li>Fixed poll handling upon post edit</li>
<li>Fixed remove common words from search table if post get pruned - <b>Nuttzy99</b></li>
<li>Fixed behaviour on splitting topics if no checkbox is selected</li>
<li>Anonymous is no longer displayed within Username dropdown boxes</li>
<li>Fixed viewprofile redirection if an invalid mode was specified</li>
<li>Fixed fraction settings within determining common words - <b>Novan</b></li>
<li>Prevent admin change usernames to his own within the ACP</li>
<li>Activation email is sent to all admins</li>
<li>Fixed conversion of &amp; to &amp;amp; in appropriate cases</li>
<li>Fixed display of "greater than topics per page" announcements preventing display of normal posts</li>
<li>Added variable checks to database backup and restore screen</li>
<li>Prevented pm popup window from resetting after visiting avatar gallery</li>
<li>Fixed special character handling with word censor</li>
<li>Added SID to jumpbox</li>
<li>Fixed problems with usernames using html special chars</li>
<li>Added GMT + 13 to English lang_main, all translators are encouraged to do likewise</li>
<li>Deleted doubled 'U_MEMBERLIST' assignment from page_header.php</li>
<li>Fixed wrong display of Signature Checkbox while editing Private Message</li>
<li>Fixed disappearing post text if emoticon was inserted directly after pressing a BBCode button</li>
<li>Display correct alt-tag for smilies within postings</li>
<li>Prevented the ability to apply BBCode to website contents</li>
<li>Fixed maxlength issue with password field in login_body.tpl</li>
<li>Fixed possible username duplication issue with validation and username length</li>
<li>Fixed split words function to handle additional foreign characters</li>
<li>Changed empty email To Field to use a non-disclosure delimiter</li>
<li>Fixed wrong language var in install.php - FTP Config screen</li>
<li>Fixed alt tag for locked topic images in viewforum_body.tpl</li>
<li>Fixed typo in groupcp.php - $lang['Unsub_success'] instead of $lang['Usub_success']</li>
<li>Fixed timezone display</li>
<li>Fixed wrong display of author quote tag within profile - <b>Cl1mh4224rd</b></li>
<li>Added deletion of sessions of users whose account is deactivated</li>
<li>Added mail header X-MimeOLE to the emailer class</li>
<li>Prevent registration if user is logged in or user trying to register again</li>
<li>Prevent usage of char(255) in usernames</li>
<li>Added check for additional FORWARDED_FOR IP's - <b>cosmos</b></li>
<li>Fixed handling of non-selection of option when voting</li>
<li>Fixed potential xss issue with memberslist mode</li>
<li>Default English support for visual confirmation - translators are encouraged to support this</li>
</ul>
<a name="203"></a><h3 class="h3">1.xx. Changes since 2.0.3</h3>
<ul>
<li>Fixed cross-browser scripting issue with highlight param</li>
<li>Back-ported highlighting code from phpBB 2.2</li>
<li>Add session id validation to posting, profile, email, voting - <b>Edwin van Vliet</b></li>
<li>Added {S_HIDDEN_FIELDS} template var to profile_send_email.tpl</li>
<li>Added "intval" fix for flood check, may resolve some issues</li>
<li>Added missing index to post_id for search_wordmatch</li>
<li>Fixed spelling error in search add words preventing use of stopword list</li>
<li>Fixed issue with search common words not being run</li>
<li>Introduce viewtopic resync patch by Ashe</li>
<li>Replace a for n in templating code</li>
<li>Fixed ordering in memberslist</li>
<li>Fixed group_id sequence issues with pgsql and msaccess</li>
<li>Fixed assumption of word censors in user notification</li>
<li>Fixed incorrect display of quotes in user management fields</li>
<li>Fixed entry of special chars in all profile fields - note this may cause temporary issues</li>
<li>Fixed incorrect display of quotes when using avatar gallery</li>
<li>Fixed missing username in email sent to users when admin activated</li>
<li>Added check for non-empty smiley code and url in smiley admin</li>
<li>Prevent display of -- sig seperator in emails when no board sig exists</li>
<li>Fixed URL propagated sid issues with jumpbox</li>
<li>Fixed wrong mode name check (polldelete) in functions_post</li>
<li>Added missing root path to l10n image path check</li>
<li>Remove validation of fields when deleting a user</li>
<li>Fixed sort mode select box in memberslist to default to current mode</li>
<li>Deny inline topic review listing to users without auth_read permissions</li>
<li>Prevent display of topic notification checkbox if user cannot read forum</li>
<li>Remove incorrect pre-pending of IP to uploaded avatars</li>
<li>Fixed deletion of uploaded avatars when changing to remote/gallery</li>
<li>Added check for non-blank line during install schema/basic sql ops</li>
<li>Added sort ordering to Top Ten poster listing by request</li>
<li>Fixed incorrect error report when altering case of username</li>
<li>Added jumpbox output to modcp {JUMPBOX} will now work</li>
<li>Fixed non-updating of users with MOD levels when deleting a forum</li>
<li>Remove email to group moderator when approving new members</li>
<li>Fixed non-handling of HTML in poll options</li>
<li>Fixed non-deletion of polls when deleting forum and its posts</li>
<li>Fixed moved shadow topic from being bumped upon reply</li>
<li>Changed field size of timezone to decimal(5,2) where applicable</li>
<li>Fixed missing sid append to URL when redirecting to newest reply</li>
<li>Fixed missing slashes in private IP preg check</li>
<li>Fixed session not setting userdata['user_id'] to ANON as appropriate</li>
<li>Added check for non-empty name in disallow admin</li>
<li>Fixed validation of SSL website addresses in profile</li>
<li>Fixed inability of admins to upload avatars via user admin panel</li>
<li>Fixed non-deletion of private message text upon full box overwrite</li>
<li>Fixed incorrect error message in smiley admin</li>
<li>Fixed incorrect alt-text for "Stop Watching Topic" image</li>
<li>Temporary fix for missing lang strings in forum admin - translators should update their packages if not done already</li>
<li>Use selected localisation during later stages of installation</li>
<li>Fixed non-check of permissions when deleting a topic via Moderator Control Panel</li>
<li>Fixed non-update of banlist upon user deletion</li>
<li>Check approved users boxes by default in usergroup approve form</li>
<li>Fixed non-appending of sid to backup meta refresh</li>
<li>Fixed non-notification of no support for certain databases in backup/restore</li>
<li>Added $images var to message die global declaration</li>
<li>Fixed wrong string, Private_message in Private Messaging</li>
<li>Add mail send result to error output</li>
<li>Fixed non-appending of sid to Mozilla nav bar menu items</li>
<li>Fixed incorrect profile linking from MSNM url in private messaging</li>
<li>Grammatical errors in English lang_main fixed - <b>Cluster</b></li>
<li>Allow deletion of avatar and simultaneous upload/linking/gallery selection</li>
<li>Fixed non-updating of user rank when changing from special to normal rank in rank admin</li>
<li>Changed user topic notification default in schemas to 0 (off)</li>
<li>Fixed non-XHTML compliant img tags in privmsg.php</li>
<li>Fixed non-deletion of announcements and polls when removing forum contents in forum admin</li>
<li>Fixed non-pruning of watched topics table when pruning related topics</li>
<li>Enable GET redirect on logout</li>
<li>Added check for IE6.x to viewtopic ICQ indicator javascript</li>
<li>Fixed empty username quoting with MS-SQL</li>
<li>Fixed BBCode url, magic url and img tags to allow most chars beyond domain names</li>
<li>Prevent parsing of -ve size values in BBCode size tag</li>
<li>Back ported HTML handler from 2.2, this may impact some boards which allow complex HTML - existing parser remains but commented out</li>
<li>Fixed parsing of word censors to not censor words within &lt; and &gt; tag delimiters</li>
<li>Fixed database utilities failing to backup data with MySQL</li>
<li>Fixed signature parsing in User Admin</li>
<li>Fixed missing class="post" tags in subSilver Admin templates</li>
<li>Fixes for paths under Apache2</li>
<li>Added wrap text with tag support for posting in Mozilla 1.1+</li>
<li>Fixed use of missing CSS classes in modcp_split, group_info_body, error_body and agreement</li>
<li>Fixed ability of users to edit polls even after they have received votes</li>
<li>Fixed header Location to be absolute URL as per HTTP 1.1 spec - noted by <b>PhilippK</b></li>
<li>Added additional session_id checks to MCP, topic subscription, PM and similar items</li>
<li>Fixed colour select box in posting_body to reset to Default colour after selection</li>
<li>Altered PM icon to show new image until messages have been read</li>
<li>Fixed incomplete deletion of PMs when removing the associated user</li>
<li>Fixed unread and new PM user counters to decrement appropriately in all situations</li>
<li>Fixed possible cross-site scripting issue with username search</li>
<li>Fixed some problems with gzip in combination with newer PHP versions and Mozilla</li>
<li>Fixed wrong maxlength in modcp_split.tpl subject field</li>
<li>Fixed inability to edit username of guest poster - <b>vHiker</b></li>
<li>Fixed ability for guests to post with certain registered usernames</li>
<li>Fixed various HTML issues to improve XHTML compliance - <b>Daz</b></li>
<li>Fixed missing template var {L_PM} for memberslist - <b>Daz</b></li>
<li>Fixed wrong key name for $images['Topic_un_watch'] - <b>Daz</b></li>
<li>Fixed missing template var {S_WATCH_TOPIC_IMG} for viewtopic - <b>Daz</b></li>
<li>Fixed missing default constraints for post table under MSSQL</li>
<li>Fixed incorrect field size for forum pruning - preventing days > 256</li>
<li>Fixed continuing redirect issues for broken web servers, e.g. IIS+CGI PHP</li>
<li>Fixed inability to use ftp as a protocol for the [img] tag</li>
<li>Fixed incorrect handling of [img] tags containing %20 encoded spaces</li>
<li>Added check for . within cookie_name, change to _ if present</li>
<li>Added SHOW_ONLINE constant to limit "users online" code operation to index and viewforum</li>
<li>Added "temporary" workaround for Apache2 + PHP module ignoring "private" cache header</li>
<li>Added workaround for modcp IP lookup and links to Anonymous user profile</li>
<li>Fixed broken bbcode parsing of quotes containing bbcode in the "username"</li>
<li>Fixed excess slashes in [quote=""] first pass encoding</li>
<li>Fixed rendering issue with quote button under Mozilla - <b>Daz</b></li>
<li>Grammatical errors in remaining core lang files fixed - <b>Cluster</b></li>
<li>Fixed bbcode quote breaking when username contained ] before [</li>
<li>Fixed duplicate group_id error during upgrade of users from phpBB 1.x</li>
<li>Fixed stripslashes() problem with the conversion of the config table from phpBB 1.x</li>
<li>Rejiggled validation code, may eliminate "Username disallowed" issues</li>
<li>Fixed differing initial "public" setting of forum permissions between different files</li>
<li>Added check for invalid (non-compliant) email addresses to upgrade script</li>
<li>Further redirect workarounds for broken servers, please direct further issues to the vendors</li>
<li>Added GMT + 13 to English lang_main, all translators are encouraged to do likewise</li>
<li>Added switch to default_lang email template if user lang template no longer exists</li>
<li>Fixed javascript error when selecting smiley containing a single quote</li>
<li>Update users watched topic if a post they made is split into a new topic</li>
<li>Fixed situations where email templates contain incorrect or missing subject lines</li>
<li>Fixed error when searching for posts and no forums exist</li>
<li>Fixed potential SQL vulnerability with marking of private messages - <b>Ulf Harnhammar</b></li>
</ul>
<a name="202"></a><h3 class="h3">1.xxi. Changes since 2.0.2</h3>
<ul>
<li>Fixed potential cross-site scripting vulnerability with avatars - <b>Showscout</b></li>
<li>Fixed potential SQL rewrite issue in page header - <b>missing contrib</b></li>
<li>Fixed potential CSS/HTML rewrite on viewing in login - <b>Marc Rees</b></li>
<li>Fixed (hopefully) issue with MS Access and multiple pages</li>
</ul>
<a name="201"></a><h3 class="h3">1.xxii. Changes since 2.0.1</h3>
<ul>
<li>Fixed missing "username" lang variable in user admin template</li>
<li>Session work around for users behind rotating IPs - <b>vHiker</b></li>
<li>Fixed potential session user_id re-write - <b>Ashe</b></li>
<li>Fixed potential cross-browser scripting issue with BBCode URLs</li>
<li>Fixed potential gallery avatar exploit - <b>Ashe</b></li>
<li>Fix sorting of smileys on each function call - <b>Ashe/psoTFX</b></li>
<li>Clear topic_mod text output in viewtopic - <b>Lars</b></li>
<li>Fix regex for avatar remote urls</li>
<li>Fix non-updating of user post counts when deleting whole topics</li>
<li>Increase time limit when sending topic reply notifications</li>
<li>Set default forum when splitting topics</li>
<li>Fix non-deletion of uploaded avatars when switching to gallery</li>
<li>Removed various closing newlines from included files</li>
<li>Add MAX_ROWS to HEAP table alter in install/upgrade - <b>Ashe</b></li>
<li>Update username maxlength for subSilver templates</li>
<li>Allow <b>(</b> and <b>)</b> in BBCode [url] tags</li>
<li>Fix non-quoting of <b>#</b> in username validation regexs</li>
<li>Fix overlooked global var in private messaging</li>
<li>Possible fix for \r\n email templates issues</li>
<li>Fix missing str_replace for category title forum admin SQL</li>
<li>Fix trailing <b>,</b> when sending emails via smtp</li>
<li>Fix avatar issues in user admin</li>
<li>Fix improper checking of email address ban in sessions</li>
<li>Fix use of hard coded language strings in forum admin</li>
<li>Fix missing closing <b>)</b> in smilies admin</li>
<li>Fix missing Username label in user admin</li>
<li>Fix upgrade.php bug where conversion would not complete (and updated other scripts to match the changes)</li>
<li>Fix problem with redirect and login.php</li>
<li>Fix typo that could cause problems with sorting in the memberlist</li>
<li>Fix emailer to allow sending emails with language-specific character sets</li>
</ul>
<a name="200"></a><h3 class="h3">1.xxiii. Changes since 2.0.0</h3>
<ul>
<li>Fixed delete image bug for normal users</li>
<li>Fixed group control panel image links</li>
<li>Fixed missing L_POST variable in group control panel</li>
<li>Fixed missing user id when redirecting to email form after login</li>
<li>Fixed (a)ppend_sid function name error in group control panel</li>
<li>Fixed reset of post type when previewing a post</li>
<li>Fixed mass emailer include path error</li>
<li>Fixed potential SQL exploit</li>
<li>Fixed several minor subSilver issues</li>
<li>Fixed [quote] breaking HTML problem</li>
<li>Fixed problem with unclosed nested quotes</li>
<li>Fixed bad handling of automagic links at end of quotes</li>
<li>Fixed potential BBCode and avatar remote exploit</li>
<li>Altered email validation check to allow + in username as per RFC</li>
<li>Fixed incorrect behaviour with wildcards in disallowed usernames</li>
<li>Added missing append_sid for search view results as posts</li>
<li>Fixed incorrect clearing of current sessions for logged in users</li>
<li>Fixed user_timezone (cannot update user profile) problem</li>
<li>Added correct setting of moderator status for users during upgrade</li>
<li>Fixed handling of uploaded avatars if gallery avatar currently used</li>
<li>Fixed use of existing username for uploaded avatars</li>
<li>Fixed updating of topic reply stats when post is deleted</li>
<li>Fixed irrelevant error message when activating already active account</li>
<li>Fixed gzip compression problems with Netscape and some PHP versions</li>
<li>Fixed MS Access layer errors when using latest PHP versions</li>
<li>Fixed styles admin editing problems with MSSQL Server</li>
<li>Fixed logout issue when cancelling certain actions</li>
<li>Fixed missing text in certain admin links</li>
<li>Fixed opening of frame within frame when logging into admin</li>
<li>Fixed incorrect ordering of search results by time</li>
<li>Fixed fulltext searching failure with MS Access</li>
<li>Hopefully fixed fulltext search with non-latin single byte charsets</li>
<li>Enabled work-around support for some multi-byte charsets - <b>OOHOO</b></li>
<li>Re-enabled search indexing of all-numeric character sequences</li>
<li>Updated email banning to properly implement wildcards</li>
<li>Fixed missing extension in links from groupcp</li>
<li>Fixed lack of re-validation when changing email address</li>
<li>Added additional IP check when using HTTP_X_FORWARDED_FOR</li>
<li>Fixed non-display of delete icon when on second or greater topic page</li>
<li>Fixed problems with users/groups assigned multiple permissions</li>
<li>Fixed problem with - and + in search words - <b>Matthijs</b></li>
<li>Fixed improper handling for deletion of words from search table</li>
<li>Fixed support for <b>,</b> in automagic URLs as per RFC</li>
<li>Fixed circular reference SQL errors when deleting posts under MS Access</li>
<li>Fixed nested [code] problems</li>
<li>Added charset encoding headers for emails - <b>romutis</b></li>
<li>Fixed "Copy to self" emails to use correct language</li>
<li>Fixed pagination error when limiting previous days for viewforum</li>
<li>Decreased minimum search word size to 3 chars</li>
<li>Fixed deletion of one or more options from all polls when editing just one</li>
<li>Fixed checking of group memberships when promoting/demoting group moderators</li>
<li>Added database closure to admin frameset page</li>
</ul>
<a name="final"></a><h3 class="h3">1.xxiv. Changes since RC-4</h3>
<ul>
<li>Fixed improper report of general error when posting messages containing errors</li>
<li>Fixed post text being doubled up if it contained one or more &lt; without closing &gt;</li>
<li>Fixed pruning errors due to search function name change</li>
<li>Hopefully fixed various issues which led to incorrect reply and excess page counts</li>
<li>Fixed groupcp not displaying all email buttons to group moderator or admin</li>
<li>Fixed failure to display error notice when uploading oversized avatars</li>
<li>Hopefully corrected problem with viewonline displaying too few/many users online</li>
<li>Partially addressed issue with activation URLs >76 chars</li>
<li>Fixed additional search facilities failing to work or working incorrectly</li>
<li>Fixed search syntax highlighting</li>
<li>Addressed various webservers handling of page redirects</li>
<li>Fixed word censor not replacing first or last words</li>
<li>Fixed avatar height and width check for locally uploaded images</li>
<li>Hopefully fixed cache control header</li>
<li>Added check for PM box size limit of 0 to prevent div0 error</li>
<li>Fixed failure to fully delete PMs in outbox</li>
<li>Fixed display problem with polls</li>
<li>Fixed problem with guest username not being displayed for topic results in search</li>
<li>Fixed problem with quotes in various profile fields</li>
<li>Fixed schema problem with user_timezone</li>
<li>Fixed page display issue with MS Access</li>
<li>Fixed user level issue when altering user from user to admin and vice versa</li>
<li>Fixed incorrect parseing of some email templates</li>
<li>Reduced size of MS Access primer</li>
<li>Fixed various remaining usergroup display issues</li>
</ul>
<a name="rc4"></a><h3 class="h3">1.xxv. Changes since RC-3</h3>
<ul>
<li>Addressed serious security issue with included files</li>
<li>Fixed non-use of database table prefix name during upgrade</li>
<li>Split functions and profile into separate modules</li>
<li>Fixed (hopefully) remaining issues with colourisation of moderator usernames</li>
<li>Updated install to include entry of additional, required, information</li>
<li>Fixed (hopefully) AOL incompatibilities</li>
<li>Fixed non-display of moderators in index/viewforum</li>
<li>Fixed group control panel 'no groups exist' problems</li>
<li>Fix HTTP_X_FORWARDED_FOR spoofing possibility</li>
<li>Fix ignoring of private range IP's in HTTP_X_FORWARDED_FOR</li>
<li>Enable multiple wildcard email banning, eg. *name*@somewhere.tld</li>
<li>Fix problems with posts being truncated if containing &lt; and &gt; characters</li>
<li>Prevent URL, BBCode and most smiley parseing in [code][/code]</li>
<li>Fix problems with use of certain reserved chars in word censor list</li>
<li>Fix default search useage to be as described (was doing AND by default)</li>
<li>Fix various avatar issues with profile, gallery and viewtopic</li>
<li>Enable safe mode support for uploading avatars</li>
<li>Fix broken modcp IP view issue</li>
<li>Fix potential session_id re-write vulnerability</li>
<li>Finish localisation of days and months (AM/PM are not and will not be localised in 2.0)</li>
<li>Remove link to external subSilver stylesheet from default subSilver templates</li>
<li>Handle TRANSACTIONS correctly in MySQL 3.x (by returning correct responses)</li>
<li>Fix checkbox resetting problem while previewing posts</li>
<li>Fix a login redirect issue</li>
<li>Remove some additional unused fields during upgrade</li>
<li>Fix (hopefully) remaining ICQ overlay issue with view profile in subSilver</li>
</ul>
<a name="rc3"></a><h3 class="h3">1.xxvi. Changes since RC-2</h3>
<ul>
<li>Fixed infamous install parse error</li>
<li>Major update of posting and related search functions (fixing various issues and increasing speed)</li>
<li>Fixed display of author and last poster names when both are different guest users</li>
<li>Fixed upgrade stall issues (hopefully!) and improved output</li>
<li>Fixed highlighting code for viewtopic and search</li>
<li>Reduced size of several files and functions</li>
<li>Moved localised images to sub-directories</li>
<li>Improved user feedback of disallowed usernames</li>
<li>Fixed various MSSQL bugs</li>
<li>Fixed installation of MSSQL/MSSQL-ODBC</li>
<li>Fixed security issue with upgrade.php</li>
<li>Finished implemention of various additional features</li>
<li>Fixed various user, group and forum permissions problems</li>
<li>Fixed issues with BBCode [ and ] (hopefully!)</li>
<li>Fixed autologin problems with MS IIS</li>
<li>Hopefully fixed problems with URIs in emails on some server configs</li>
<li>Fixed 'blank' profile and DB utilities problems on submit</li>
<li>Fixed incorrect language being used in email subjects</li>
<li>Fixed issues with incorrect private message new/unread counts</li>
<li>Fixed various PostgreSQL related errors</li>
<li>Automatically forward users to login screen in more situations</li>
<li>AEnabled (coloured) online indication of moderators and admins</li>
<li>Enabled maximum online user count</li>
<li>Altered online user count to ignore duplicate IPs (will now underestimate rather than overestimate)</li>
<li>Enabled viewing of users browsing each forum</li>
<li>Fixed (hopefully) display of overlayed ICQ icon in Netscape using subSilver</li>
<li>Fixed display of guest usernames for last post and author</li>
<li>Hidden usergroups are now completely hidden from view</li>
</ul>
<a name="rc2"></a><h3 class="h3">1.xxvii. Changes since RC-1</h3>
<ul>
<li>Fixed numerous PostgreSQL related issues</li>
<li>Significant updates and additions to the upgrade script</li>
<li>Various (missed) hard coded language strings fixed</li>
<li>Fixed viewforum error when no forum id specified</li>
<li>Fixed old constant name useage in search system</li>
<li>Fixed display of moved posts when viewing unanswered posts</li>
<li>Fixed failure of search for user and keyword when displaying as posts</li>
<li>Fixed PM popup notification</li>
<li>Fixed view more emoticon session page problem</li>
<li>Fixed view profile email links</li>
<li>Fixed display of websites in profile</li>
<li>Fixed backup database failure</li>
<li>Fixed MS Access schema error when posting topics</li>
<li>Fixed problem with hypenated/dotted DB names in MySQL 3.23.6+</li>
<li>Various other fixes and updates</li>
</ul>
<a name="rc1"></a><h3 class="h3">1.xxviii. Changes since RC-1 (pre)</h3>
<ul>
<li>Upgrade script completed for initial fully functional release</li>
<li>Sessions code updated</li>
<li>Mark read code updated and hopefully fixed</li>
<li>Significant changes to properly deal with \' for non-MySQL boards</li>
<li>mssql, msaccess and mssql-odbc DB classes re-written</li>
<li>Avatar issues addressed and fixed</li>
<li>Search (INSERT) bug using MySQL fixed</li>
<li>Search highlighting issues addressed</li>
<li>Search own/other users posts fixed</li>
<li>BBCode fixes for magic URIs and other issues</li>
<li>Template updates for subSilver</li>
<li>User and group permissions problems fixed</li>
<li>Forum management problems (deletion of forum causing category not to display) fixed</li>
<li>Pagination problem with groupcp fixed</li>
<li>Backslash issues with posting and profile fixed</li>
<li>Backslash issues with emails fixed</li>
<li>preg_quote problems fixed</li>
<li>User management updated with full avatar control and missing fields</li>
<li>Private messaging box limits fixed</li>
<li>Private messaging ?folder= strangeness fixed</li>
<li>Forum pruning code updated to cope with search system</li>
<li>Emoticon system in posting updated</li>
<li>BBCode FAQ link added to posting form</li>
<li>Language file updates to address concerns of translators</li>
<li>Various other bug fixes and updates</li>
</ul>
<p>Note that a full list of fixed bugs can be found at the bug tracker (see section on bug reporting <a href="README.html#bugs">here</a>)</p>
<a name="disclaimer"></a><h2 class="h2"><u>2. Copyright and disclaimer</u></h2>
<p>This application is opensource software released under the <a href="http://www.gnu.org/licenses/gpl.html" target="_new">GPL</a>. Please see source code and the Docs directory for more details. This package and its contents are Copyright <20> 2002 <a href="http://www.phpbb.com/" target="_new">phpBB Group</a>, All Rights Reserved.</p>
<!-- END DOCUMENT -->
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

View File

@@ -1,208 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>phpBB 2.0.x :: FAQ</title>
<link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css" />
<style type="text/css">
<!--
p,ul,td {font-size:10pt;}
h2 {font-size:15pt;font-weight:bold;}
h3 {font-size:12pt;}
//-->
</style>
</head>
<body bgcolor="#E5E5E5" text="#000000" link="#006699" vlink="#006699">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td class="bodyline"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2 : Creating Communities" vspace="1" /></a></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.x FAQ</span></td>
</tr>
</table>
<!-- BEGIN DOCUMENT -->
<p>This is a very basic Frequently Asked Questions (FAQ) page which attempts to answer some of the more commonly asked questions. It is by no means exhaustive and should be used in combination with the 'built-in' User FAQ within phpBB2, the community forums (particularly the Tutorials forum) and our IRC channel (see <a href="README.html">README</a> for details).</p>
<ol>
<li><b>I cannot install this it is too difficult! Will you do it?</b></li>
<p>Simple answer, no we will not. We are not being difficult when we say this we are actually trying to help you. phpBB has a reputation for being easy to install, that reputation is we believe well deserved. It is a simple process of unarchiving a single file, uploading the resulting directory/files to their intended location and entering some data in a web based form. The sequence of events, what to type where, etc. is covered in detail in the accompanying <a href="INSTALL.html">INSTALL.html</a> documentation. If you cannot install phpBB 2.0.x the chances are you will be unable to administer or update it.</p>
<p>There are people, companies (unrelated to your hosting provider), etc. that will install your forum, either for free or for a payment. We do not recommend you make use of these offers. Unless the service is provided by your hosting company you will have to divulge passwords and other sensitive details. If you did not know how to use an ATM would you give a passer-by your bank card and PIN and ask them to show you what to do? No, probably not! The same applies to your hosting account details!</p>
<p>We think a better solution is for you to carefully read the enclosed documentation, read our tutorials forum at www.phpbb.com and if necessary ask for help on any thing you get stuck on. However, the decision is yours but please note we may not offer support if we believe you have had the board installed by a third party. In such cases you should direct your questions to that company or person/s.</p>
<li><b>How do I install this board on Lycos/coolfreepages/other free host?</b></li>
<p>The old addage "You get what you pay for" is particularly true for hosting services! However if you must use a free service (and recognise its limitations) you will find details on common pitfalls in our tutorials forum at <a href="http://www.phpbb.com/phpBB/">http://www.phpbb.com/phpBB/</a>.</p>
<li><b>I am having problems with the admin at a certain board, help!</b></li>
<li><b>A board has ripped off my graphics/software/etc., stop them!</b></li>
<li><b>A board is dealing in warez/porn/etc., you need to prevent them doing this!</b></li>
<p>We provide the software, we have absolutely nothing to do with any board that runs it (beyond phpbb.com of course!). The GPL grants the user an unlimited right of use subject to their adherence of that licence. Therefore we cannot prevent, dictate, control or otherwise limit the use of phpBB 2 software. So please do not contact us for such matters.</p>
<p>If you have a problem with a given board please take it up with them, not us. We are not and cannot be held legally responsible for any third party use of this software (much like Microsoft et al cannot be held responsible for the use of Windows in illegal activities, etc.). Additionally we do <b>not</b> track the use of phpBB software in any way. So please do not ask us for details on a "given" board we will not be able to help you. If any law firms or lawyers out there send us writs, Cease and Desist orders, etc. for third party website use of this software we reserve the right to charge for time wasted dealing with such issues ...</p>
<li><b>According to viewonline a user is doing/reading something they should not be able to!</b></li>
<p>No, they probably are not. phpBB uses sessions to keep track of users as they move between pages. The session information tells us who this user is. Therefore in order to determine what a user can do on a page we first need the session details. Once this data is available we can check whether the user is permitted to do whatever it is they are trying to do. This can result in it appearing as if a user is reading a topic in a forum they should not be able to access. Or perhaps viewing private messages when they are only guests, etc. In practice the user is not doing these things, they are viewing a "You are not permitted to do this" type message. The session data has simply been updated before we were able to determine what the user could or could not do.</p>
<p>Of course this only applies where permissions have been set correctly!</p>
<li><b>I keep getting Mail sending errors when I (or my users) post/send PM's/etc.!</b></li>
<p>This error will occur if phpBB cannot send mail. phpBB can send email two ways; using the PHP mail() function or directly via SMTP. Some hosting providers limit the mail() function to prevent its use in spamming, others may rename it or limit its functionality. In either case you may need to make use of SMTP. This requires that you have access to such a facility, e.g. your hosting provider may provide one (perhaps requiring specific written authorisation), etc. Note that if your provider requires authorisation we only support the simple AUTH method using plaintext username/password. We do not support secure sockets layer (SSL), POP3 send or any other method. Please see <a href="http://www.phpbb.com/phpBB/" target="_blank">http://www.phpbb.com/phpBB/</a> for additional help on this matter.</p>
<p>If you do require SMTP services please do not ask (on our forums or elsewhere) for someone to provide you with one. Open relays are now things of the past thanks to the unthinking spammers out there. Therefore you are unlikely to find someone willing to offer you (free) services.</p>
<li><b>My users are complaining that emails are not in their selected language!</b></li>
<p>You must have deleted a language pack or the language pack is incomplete. phpBB will try to send emails in the users selected language. If it cannot find a suitable email template it will switch to the boards default language.</p>
<li><b>The first four letters of my text disappeared when I hit submit!</b></li>
<p>Some forms in phpBB make use of arrays to "post" or submit data, e.g. polls, forum management, etc. A bug exists in PHP 4.2.3 (and perhaps older versions) which can cause such data to lose the first four characters of text. This bug is related to the presence of the mbstring module and certain compile time parameters (the problem exists for both compiled in and modular version of mbstring). Please see: <a href="http://bugs.php.net/bug.php?id=19460" target="_blank">http://bugs.php.net/bug.php?id=19460</a> for more details. Note the bug is fixed in PHP CVS and thus future versions should be immune. Remember, this is <b>not</b> a bug in phpBB 2.</p>
<li><b>My AOL based users keep getting logged out!</b></li>
<p>phpBB2 uses sessions to keep track of users as they browse the board. These sessions use a combination of a unique session id and the users IP to identify each user. We make use of the IP as an extra safe-guard to help prevent sessions being hijacked (by discovering the unique session id).</p>
<p>Unfortunately this only works when the users IP is constant as they browse the board. For most users this will be the case. However certain providers route their users via a cluster of proxys. In some cases, particularly AOL this results in different IPs being forwarded as the user moves between pages. We take account of this by not checking the entire IP but only the first "three quads". Again in most cases this will be fine. However again AOL uses IPs which can vary so much that checking only the first two quads results in a fairly static IP being available for session validation.</p>
<p>If you are experiencing problems related to this you can make a small change to the code. Please note that reducing the IP validation length does potentially increase the risk of sessions being hijacked (this is something for you to consider, phpBB Group takes no responsibility should anything happen!). The change requires you to open the file sessions.php in the includes/ directory of the distribution. Find line 250, it contains the following <pre>$ip_check_s = substr($userdata['session_ip'], 0, 6);</pre>change this to: <pre>$ip_check_s = substr($userdata['session_ip'], 0, <b>4</b>);</pre>You need to make exactly the same change to the number 6 in the next line. Save the file (and upload it if required). This should reduce or eliminate the problem noted.</p></li>
<li><b>I selected X for my timezone but the time is not correct!</b></li>
<p>I suspect the time is correct but that you may have switched (locally) to daylight savings time. At present we do not support daylight savings only standard local times. Therefore during summer months (depending on whether your nation/state switches to daylight savings) the board times may appear to be <b>one hour</b> behind the <i>real</i> local time. The solution is to either put up with it (just let your users know) or to move the timezone of everyone who is affected (remember that not all your users may be from nations who have switched to daylight savings) on one hour, eg. GMT becomes GMT+1. This requires running some SQL and you should search our forums for information.</p>
<p>If this is not the case then I suspect your servers time is at fault. phpBB 2 stores all times in the form of a unix timestamp. This is a 32bit integer value containing the number of seconds since the unix epoch event, 1st January 1970 00:00:00 GMT. This value is global in nature and will be the same wherever you are in the world. So, if your time is incorrect and you have selected the appropriate timezone chances are your server time is off.</p></li>
<li><b>I am seeing &amp;#nnnn; sequences output instead of what I typed!</b></li>
<p>To enable compliance with HTML and XHTML specifications as well as enabling browsers to automatically support a users selected language we enable a <i>charset</i> tag to be output to the browser. This identifies the primary character set the user has selected, eg. iso-8859-1 for Western European languages (English, German, French, etc.), windows-1251 for Cyrillic alphabets (Russian, Bulgarian, etc.) and so on. The downside to doing this is that most modern browsers (such as Internet Explorer) convert any character not present in that character set into what are termed <i>Numerical Character References</i> or NCR's. These take the form of &amp;#nnnn; where nnnn is the hexadecimal number of that characters UNICODE reference.</p>
<p>Unfortunately PHP (which effectively supports only iso-8859-1 at this time) does not appear to attempt to process this data back into normal characters. Therefore phpBB treats them as text the user has entered and wishes to <i>see</i>. phpBB enables this by turning the &amp; into &amp;amp;. This results in the characters appearing as they do. Although we could ignore &amp;#nnnn; (there are pro's and of course con's to doing so) at present we don't.</p>
<p>If you are finding this to be problem the solution is to remove the <pre>charset={S_CONTENT_ENCODING}</pre> text from <b>all</b> the _header.tpl template files in all templates. The downside to this is a users browser will not automatically switch its charset to that selected by the user (however this is unlikely to be a big problem since users typically run their browser by default in the language they wish to use). Alternatively you can modify the $lang['ENCODING'] entry in the appropriate language file. Until PHP (and all browsers!) trully support UNICODE these problems will persist across all boards.</p></li>
<li><b>I cannot search for certain words!</b>
<p>phpBB 2 uses a Fulltext search system, this has both advantages and disadvantages. The advantage is that on large or busy forums it has far less impact on server load than <i>standard</i> search methods as used by many alternative forums (including phpBB 1.x). The disadvantage is that to reduce the size of the database (every post is examined and unique words stored in a table) we have to limit the size and type of words we store. By default words must contain at least three characters but no more than 25, they must be either alpha or combinations of alpha and numerals (numbers alone are not stored). In addition all non-alphanumeric characters are removed, eg. _, +, -, etc. This is standard practice for fulltext search solutions.</p>
<p>A further downside is that non-latin alphabets, eg. Cyrillic, Greek, etc. require proper locale support to be compiled in and available on the server your board is running on. If this is not the case it is quite likely that words will not be properly indexed for storage. In many cases this can be recified by altering the setlocale(LC_ALL, '[LOCALE_HERE]'); statement in the appropriate language file. If you are experiencing problems you should change whatever is currently in place of [LOCALE_HERE] with the locale as available on your server. If you do not know this please ask your hosting provider. Some examples may be ru_RU.WIN_CP_1251 for the codepage used for the Russian translation, ko.KOI8 for Korean, etc.</p>
<p>Please note that support for multibyte character sets remains very limited in PHP4 and therefore Japanese, Chinese, etc. may have difficulty getting the fulltext search working correctly at all.</p>
<li><b>My screen is filled with errors when I try to view the forum!</b>
<p>Are they errors? Are you sure they are not warnings? They probably are ... What you're seeing is PHP warn you about unset variables. Great care has been taken with phpBB 2.0 to ensure it is secure. Unset variables while being a potential security risk really shouldn't be in 2.0. Unfortunately some hosting providers have decided that any unset variables equal security problems and force PHP to output these warnings even though phpBB 2.0 is set to ignore them.</p>
<p>We have worked some way toward checking and/or setting all variables before use but this will take time to complete (if it can be). Therefore I am afraid for the time being you will have to manually modify the code or ask your hosting provider to be more realistic with their setup.</p></li>
<li><b>How do I use the avatar settings?</b>
<p>There are three types of avatar; upload, remote and local.</p>
<p><ul>
<li>Upload types require you to create a directory (the default is images/avatars) and to set this to public read/write (ie. chmod a+rw), users can then upload avatars (subject to width, height and size limits definable by you).</li>
<li>Remote avatars allow the user to supply a URI pointing to an image available on the internet, <b>PLEASE NOTE</b> that size limits do not apply to remote avatars!</li>
<li>Local avatars allow you to upload your own avatars to a set directory, users can then pick from this avatar gallery. The default location for this is images/avatars/gallery. PLEASE NOTE that avatars are categorised according to sub-folders in this location! ie. you <b>MUST</b> place your avatars in subdirectories, eg. images/avatars/gallery/cartoons, images/avatars/gallery/real-life, etc.</li>
</ul></p></li>
<li><b>No matter what I set the uploadable avatars to I cannot upload one from my computer!</b>
<p>There are two possibilities here, the first is you have not created the directory you specified as the storage location for avatars, ie. as specified in the Admin->General Configuration->Avatars section. If the directory does not exist uploadeable avatars are automatically disabled. You should create the required directory (ensuring it has global write access or other appropriate permissions to allow the webserver to write files to it).</p>
<p>The second possibility is that your provider has disabled file_upload support, possibly because of a recently found serious security issue with PHP before version 4.1.2. You should contact your provider and ask them if this is the case. It may be unrelated to the security issue and your provider has simply decided to disable such things in general. In either case I'm afraid there is not a lot you can do, there are still three other avatar settings left to choose from including uploading via a URL which will work fine</p></li>
<li><b>I just cannot get gallery avatars to appear!</b>
<p>Chances are you have not followed our instructions above. phpBB 2 categorises gallery avatars and it does this by reading through folders contained in the location you specified as being the gallery path. For example, if you set the gallery path to "images/avatars/gallery" phpBB 2 will expect to find a series of folders within that path, eg. "images/avatars/gallery/moviestars", "images/avatars/gallery/cartoons", "images/avatars/gallery/misc", etc. Placing images directly in "images/avatars/gallery/" will result in nothing being listed in your gallery.</p></li>
<li><b>How do I set forum permissions?</b>
<p>You set forum permissions from the administration control panel -> Forums -> Permissions. This system has two modes of operation; Simple and Advanced. Simple uses a set of pre-defined authorisation levels, these set each type of authorisation setting to a specific level. Advanced settings allow you to specify individual levels for each operation in each forum. Experiment!</p></li>
<li><b>How do I set user and group permissions?</b>
<p>These are set from Admin -> Users (Groups) -> Permissions. The system may appear strange but it's very powerful. When you look up a user or group it will give you basic information (at the top of the page) followed by the available forum listing and current settings for this user. You can assign moderator status to users and groups and if you have PRIVATE forums (or forums with any of their individual operations set to PRIVATE) you can also assign access.</p></li>
<li><b>How do I set a user (group) as moderator?</b>
<p>See above</p></li>
<li><b>Why are there no entries in the user (group) permission "Allow Access" column?</b>
<p>You can only allow (or deny) users access to PRIVATE forums, or forums which have one or more operations set to PRIVATE</p></li>
<li><b>How come I cannot set "Vote" to ALL?</b></li>
<p>phpBB does not by default allow guest voting. This was done to prevent guest users (who cannot be reliably tracked) from voting time and time again in the same poll. There is a Mod available if you really need this feature, please see our Mod forums at <a href="http://www.phpbb.com/phpBB/">http://www.phpbb.com/phpBB/</a>.</p>
<li><b>I (or my users) cannot stay logged in to the forum!</b>
<p>If you (or your users) are, after attempting a login, being returned to the index (or other page) without appearing to be logged in the most likely problem is incorrect cookie settings. phpBB 2 uses cookies to store a session id and a small amount of user data. For this data to be stored correctly the cookie domain, path and secure settings must be correct. You can check this in Admin->General Configuration->Cookie settings. Typically the cookie domain can be left blank and the cookie path set to / (a single forward slash). Do <b>not</b> set the cookie as being secure unless your board is running over a secure sockets layer connection, ie. https://</p>
<p>If you still have problems try setting the cookie domain to your full domain name, eg. www.mysystem.tld, www.something.mydomain.tld. You <b>must</b> ensure the domain name contains at least two dots or browsers will be unlikely to recognise the cookie, eg. .mydomain.com, mydomain.com. Do <b>not</b> add http:// or anything else to the domain name!</p></li>
<li><b>My users are complaining about being logged out too quickly!</b>
<p>You can increase the default length of sessions (ie. how long before a users session is considered 'dead') in Admin->General->Configuration->Cookie Settings->Session Length. Set it to whatever value your users feel comfortable with, remember that security issues may affect your decision (ie. having too long a session may allow non-users to abuse your board should a user forget to logout or otherwise leave a current session on a public workstation).</p></li>
<li><b>I am having problems with HTML!</b>
<p>If you want to allow your users to make use of HTML in posts you need to do two things. Firstly enable HTML in Admin -> General -> Configuration. Secondly to need to make sure that the tags your users will post are in the Allowed HTML Tags field (again Admin -> General -> Configuration). If users post using tags not on this list they won't be displayed as HTML! eg. to enable someone to post Flash you could add the embed tag to this field. Be careful which tags you allow, it is very easy to break the boards own output if the wrong tags are used in posts. </p></p></li>
<li><b>Can I suggest a feature for phpBB 3.0?</b>
<p>No, the feature list for phpBB 3.0 is now frozen and no new features will be added to that list. At the moment we do not accept new feature requests.</p>
<!--
You may however add requests for the next release after that, 3.2, in our feature tracker:</p>
<p><a href="http://sourceforge.net/tracker/?atid=580201&group_id=7885&func=browse" target="_new">http://sourceforge.net/tracker/?atid=580201&group_id=7885&func=browse</a></p>
<p>Before submitting your idea please <b>ensure</b> you have read through the entries in that list. If your idea is similar to an existing one please feel free to add a comment to it. Please <b>do not</b> submit duplicate suggestions!</p>
<p>We make no promises to the inclusion of features but we will endeavour to introduce the most requested or most interesting ones.</p></li>
//-->
<p>If you wish to follow the progress of phpBB 3.0 you may like to visit our development forum to see how things are progressing:</p>
<p><a href="http://area51.phpbb.com/phpBB/" target="_new">http://area51.phpbb.com/phpBB/</a></p>
<p>Please note that this forum should <b>NOT</b> be used to obtain support for or ask questions about phpBB 2.0.x, the main community forums are the place for this. Any such posts will be locked and go unanswered.</p>
<li><b>Why is phpBB 1.x faster than phpBB 2.0?</b>
<p>The original phpBB 1.0 saw a very large decrease in page generation times from version 1.0/1.2 to 1.4. This was achieved by rewriting many of the SQL queries and splitting the database. These changes came about from work on phpBB 2.0. With phpBB 2.0 we have introduced numerous additional functions and features, not least of which is full templating (the separation of page design from code). This results in a slowdown from phpBB 1.4, we suspect though that the new features will outweigh the small difference in page generation times.</p></p></li>
<li><b>My question isn't answered here!</b>
Feel free to search our community forum for the information you require. <b>PLEASE DO NOT</b> post your question without having first used search, chances are someone has already asked and answered your question. You can find our board here:</p>
<p><a href="http://www.phpbb.com/phpBB/" target="_new">http://www.phpbb.com/phpBB/</a></p></li>
</ol>
<h2><u>Copyright and disclaimer</u></h2>
<p>This application is opensource software released under the <a href="http://www.gnu.org/licenses/gpl.html" target="_new">GPL</a>. Please see source code and the Docs directory for more details. This package and its contents are Copyright <20> 2002 <a href="http://www.phpbb.com/" target="_new">phpBB Group</a>, All Rights Reserved.</p>
<!-- END DOCUMENT -->
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

View File

@@ -1,259 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>phpBB 2.0.x :: Install</title>
<link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css">
<style type="text/css">
<!--
p,ul,td {font-size:10pt;}
.h2 {font-size:15pt;font-weight:bold;color:red}
.h3 {font-size:12pt;color:blue}
//-->
</style>
</head>
<body bgcolor="#E5E5E5" text="#000000" link="#006699" vlink="#006699">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td class="bodyline"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2 : Creating Communities" vspace="1" /></a></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.x INSTALL</span></td>
</tr>
</table>
<!-- BEGIN DOCUMENT -->
<p align="center"><b>Please read this document completely before proceeding with installation.</b></p>
<p>Please note these instructions are not fully comprehensive, a more thorough userguide will be available on the phpBB website in the near future. However, this document will walk you through the basics on installing the forum software.</p>
<p>A basic overview of running phpBB 2.0.x can be found in the accompanying <a href="README.html">README</a> documentation. Please ensure you read that document in addition to this! For more detailed information on using phpBB 2 you should read <a href="http://www.phpbb.com/support/guide/" target="_new">Userguide</a> now available online.</p>
<ol>
<li><a href="#quickinstall">Quick Install</a></li>
<li><a href="#require">Requirements</a></li>
<li><a href="#install">New Installations</a></li>
<ol type="i">
<li><a href="#fileext">Changing the file extension</a></li>
<li><a href="#phpBB1x">Replacing an old phpBB 1.x install</a></li>
<li><a href="#nonaccess">Installing on MySQL 3 and 4, PostgreSQL 7.x, MS SQL 7/2000 (inc. via ODBC)</a></li>
<li><a href="#access">Installing on MS Access 2000/XP</a></li>
<li><a href="#requireddata">Entering required data</a></li>
<li><a href="#completeinstall">Completing installation</a></li>
</ol>
<li><a href="#upgrade1.x">Upgrade from phpBB 1.4.x</a></li>
<li><a href="#upgradeb1">Upgrade from phpBB 2.0 beta-1</a></li>
<li><a href="#upgradeRC">Upgrade from previous Release Candidate versions of phpBB 2</a></li>
<ol type="i">
<li><a href="#langtempchanges">Changes in language pack format and templates</a></li>
</ol>
<li><a href="#upgradeSTABLE">Upgrade from stable releases of phpBB 2.0.x</a></li>
<ol>
<li><a href="#upgradeSTABLE_full">Full package</a></li>
<li><a href="#upgradeSTABLE_files">Changed files only</a></li>
<li><a href="#upgradeSTABLE_patch">Patch file</a></li>
<li><a href="#upgradeSTABLE_all">All package types</a></li>
</ol>
<li><a href="#postinstall">Important (security related) post-Install tasks for all installation methods</a></li>
<ol type="i">
<li><a href="#avatars">Uploadable avatars</a></li>
<li><a href="#safemode">Safe Mode</a></li>
<li><a href="#extras">Optional extras</a></li>
</ol>
<li><a href="#disclaimer">Disclaimer</a></li>
</ol>
<a name="quickinstall"></a><h2 class="h2"><u>1. Quick Install</u></h2>
<p>If you have basic knowledge of using FTP and are sure your hosting service or server will run phpBB 2 you can use these steps to quickly get started. For a more detailed explanation you should skip this and go to <a href="#require">section 2</a> below.</p>
<ol>
<li>Decompress the phpBB 2 archive to a local directory on your system.</li>
<li>Upload all the files contained in this archive (retaining the directory structure) to a web accessible directory on your server or hosting account.
<li>Change the permissions on config.php to be writeable by all (666 or -rw-rw-rw- within your FTP Client)</li>
<li>Using your web browser visit the location you placed phpBB 2 with the addition of install/install.php, e.g. http://www.mydomain.com/phpBB2/install/install.php, http://www.mydomain.com/forum/install/install.php etc.
<li>Fill out all the requested information and hit <i>Submit</i></li>
<li>Change the permissions on config.php to be writeable only by yourself (644 or -rw-r--r-- within your FTP Client)</li>
<li>Click the <i>Complete Installation</i> button or revisit the location you entered above.</li>
<li>phpBB 2 should now be available, please <b>MAKE SURE</b> you read at least <a href="#postinstall">Section 8</a> below for important, security related post-installation instructions.</li>
</ol>
<p>If you experienced problems or do not know how to proceed with any of the steps above please read the rest of this document.</p>
<a name="require"></a><h2 class="h2"><u>2. Requirements</u></h2>
<p>Installation of phpBB2 requires the following:</p>
<ul>
<li>A webserver or web hosting account running on any major Operating System</li>
<li>A SQL database system, <b>one of</b>:
<ul>
<li>MySQL (3.22 or higher)</li>
<li>PostgreSQL 7.0.3 or higher (preferably 7.1.x or 7.2.x)</li>
<li>MS SQL Server (7 or 2000) directly or via ODBC</li>
<li>MS Access (2000 or XP) via ODBC</li>
</ul>
</li>
<li>PHP (4.0.3 and above) with support for the database you intend to use above</li>
</ul>
<p>If your server or hosting account does not meet the requirements above I am afraid phpBB 2.0 is not for you.</p>
<a name="install"></a><h2 class="h2"><u>3. New Installations</u></h2>
<p>Installation of phpBB 2 will vary according to your server and database. If you have <i>shell access</i> to your account (via telnet or ssh for example) you may want to upload the entire phpBB 2 archive (in binary mode!) to a directory on your host and unarchive it there.</p>
<p>If you do not have shell access or do not wish to use it you will need to decompress the phpBB 2 archive to a local directory on your system using your favourite compression program, e.g. winzip, rar, zip, etc. From there you must FTP <b>ALL</b> the files it contains (being sure to retain the directory structure and filenames) to your host. Please ensure that the cases of filenames are retained, do <b>NOT</b> force filenames to all lower or upper case doing so will cause errors later.</p>
<p>All .php, .inc, .sql, .cfg and .htm files should be uploaded in <b>ASCII</b> mode, while all graphics should be uploaded in <b>BINARY</b> mode. If you are unfamiliar with what this means please refer to your FTP client documentation. In most cases this is all handled transparantly by your ftp client but if you encounter problems later you should be sure the files where uploaded correctly as described here.</p>
<p>phpBB2 comes supplied with English as its standard language. However a number of seperate packs for different languages are available. If you are not a native English speaker you may wish to install one or more of these packages before continuing. The installation process below will allow you to select a default language from those available (you can of course change this default at a later stage). For more details of language packs, where to obtain them and how to install them please see the <a href="README.html#i18n">README</a>.</p>
<p>Once all the files have been uploaded to your site you should point your browser at this location with the addition of install/install.php (please note that if you changed the extension from php, see <a href="#fileext">Section 3.i</a> below, you should alter install.php appropriately). For example if your domain name is <i>www.mydomain.tld</i> and you placed phpBB 2 in a directory /phpBB2 off your web root you would enter <i>http://www.mydomain.tld/phpBB2/install/install.php</i> into your browser. When you have done this you should see the phpBB 2 Installation screen appear.</p>
<a name="fileext"></a><h3 class="h3">3.i. Changing the file extension</h3>
<p>If the file extension used to execute PHP scripts on your server is <b>NOT</b> .php but for example .php3 or .phtml you should first rename <b>ALL</b> files ending in .php and change the value of $phpEx in <u>extension.inc</u>. In the vast majority of cases this step will be unncessary.</p>
<a name="phpBB1x"></a><h3 class="h3">3.ii. Replacing an old phpBB 1.x install</h3>
<p><b>NOTE</b>, you should <b>NOT</b> place phpBB 2 files into the same directory as any previous installation of phpBB 1.x! Create a new directory (or move your old phpBB 1.x out of the way), failure to do this will result in runtime errors.</p>
<a name="nonaccess"></a><h3 class="h3">3.iii. Installing on MySQL 3 and 4, PostgreSQL 7.x, MS SQL 7/2000 (inc. via ODBC)</h3>
<p><b>Before proceeding</b> with installation you should ensure you have a database available. Most good hosting accounts now come with at least one database as part of the basic package although it may need to be setup before first use. Ask your provider for details if you are unsure whether you do or not. If you are running your own server and are unsure how to create a database you should refer to your SQL servers documentation or website, e.g. <a href="http://www.mysql.com/doc/" target="_new">http://www.mysql.com/doc/</a>, <a href="http://www.postgresql.org/users-lounge/" target="_new">http://www.postgresql.org/users-lounge/</a>, etc.</p>
<p>If your database server is MySQL <b>PLEASE</b> ensure you select the appropriate version from the dropdown box. Do <b>NOT</b> select MySQL 4.x if you have MySQL 3.x (the most common type) installed, if in doubt select MySQL 3.x.</p>
<a name="access"></a><h3 class="h3">3.iv. Installing on MS Access 2000/XP</h3>
<p>Before you install phpBB 2 you need to create a <b>Data Source Name</b> or <b>DSN</b>. The exact way to do this will depend on your hosting provider, if you are unsure you should check with them before proceeding. In general though you should create a System DSN which points to the location where you have stored an unarchived copy of the ms_access_primer.mdb file (this is contained in the ms_access_primer.zip which can be found in <u>install/schemas/</u>). The name you give this DSN will be used during installation. Do not proceed until this step is complete!</p>
<p>Please note that MS Access support is not designed for busy boards. If you anticipate more than one or two users being online at any given time you should upgrade to a more robust server solution.</p>
<a name="requireddata"></a><h3 class="h3">3.v. Entering required data</h3>
<p>Once you have reached the installation page you need to fill out several fields. Be sure to select the right <u>database type</u>! If you do not have or do not know the <u>database name</u>, <u>database server</u>, etc. please check with your hosting provider. For <b>non-ODBC</b> databases the database server is typically localhost but this is <b>NOT</b> universal! If you are using an ODBC based database (such as MS Access or MSSQL via ODBC) you should enter the DSN here (see 2.iv.).</p>
<p>The <u>database prefix</u> allows you to enter a few characters, short name, etc. which all tables used by this installation will be prefixed with. The default (phpbb_) will usually be fine. However if you have more than one copy of phpBB 2 using the same database be sure to alter it or you will receive errors during installation.</p>
<p>The remaining information is personal to you and your site. You will need to enter a <u>username</u> and <u>password</u> for the initial administration account (more administrators can be created later). The <u>server name</u>, <u>server port</u> and <u>script path</u> are essential because all emails containing URLs will use these values. The installer will guess initial values, however they may not be correct so be sure to check them!</p>
<p>Remember that a domain (or server) name does <b>NOT</b> include http://! Enter just the domain name, eg. <i>www.mydomain.tld</i> and <b>NOT</b> <i>http://www.mydomain.tld/</i>. The server port can, in the great majority of cases be left as 80, this is the standard http port. However if your web server listens to a different port because for example port 80 is blocked then alter this appropriately. The script path is the relative path from your webroot where phpBB 2 is installed, e.g. if you install phpBB 2 into phpBB 2/ in your webroot then enter phpBB 2 (or /phpBB 2/) as the script path.</p>
<a name="completeinstall"></a><h3 class="h3">3.vi. Completing installation</h3>
<p>Once you have checked all the data press submit. The installation script will create and populate all the necessary tables. It will then attempt to write to the <u>config.php</u> file which will contain the basic configuration data used to run phpBB 2. If the installer cannot write <u>config.php</u> directly you will be given the option of either downloading the file or even FTPing it to the correct location. If you choose to download you should then re-upload the file to your server, overwriting the existing <u>config.php</u> in the process. If you attempt to FTP via the install script you should supply the requested information. Should FTP fail you will be able to download the file and then re-upload as described earlier.</p>
<p>During the installation procedure phpBB 2 will check to ensure the relevant PHP database module is available and will not proceed if it cannot be found. Should this happen be sure to check you have selected the correct database and/or ask your hosting provider for advice.</p>
<p><b>Do not</b> proceed untill the installation is completed and (if necessary) you have uploaded the <u>config.php</u> file.</p>
<a name="upgrade1.x"></a><h2 class="h2"><u>4. Upgrade from phpBB 1.4.x</u></h2>
<p>Before upgrading we heavily recommend you do a <u>full backup of your database</u>! If you are unsure how to achieve this please ask your hosting provider for advice. One you have backed up your database you should follow the basic instructions given for <a href="#install">New Installations</a> above. <b>However</b> instead of selecting <u>Install</u> as the <i>Installation Method</i> you should select <u>Upgrade</u>.</p>
<p>As with install the upgrade is automated. The config.php will be written automatically (if possible, else you will be able to download a copy as with New Installation above). Once the config.php is in place everything should proceed without error. Please note that this upgrading process may take quite some time and depending on your hosting provider this may result in it failing (due to web server or other timeout issues). If this is the case you should ask your provider if they are willing to allow the upgrade script to temporarily exceed their limits (be nice and they will probably be quite helpful).</p>
<p>Once completed your board should be immediately available. If you encountered errors you should restore your original database and report the problems to our bug tracker or seek help via our forums (see <a href="README.html">README</a> for details).</p>
<a name="upgradeb1"></a><h2 class="h2"><u>5. Upgrade from phpBB 2.0 beta-1</u></h2>
<p>Sorry but no direct upgrade is available from beta-1 (we did warn you!). If you are reasonably confident with the use of SQL, etc. you may be able to make the required changes to the database manually. You will need to examine the CVS check-ins to determine what needs changing where.</p>
<a name="upgradeRC"></a><h2 class="h2"><u>6. Upgrade from previous Release Candidate versions of phpBB 2</u></h2>
<p>Upgrading from these versions is generally quite easy. First you should make a copy of your existing <u>config.php</u>, keep it in a safe place! Next delete all the existing phpBB 2 files, do not leave any in place otherwise you may encounter errors later. You can leave alternative templates in-place but you should note they may not function correctly with the final release. It is therefore recommended you switch back to subSilver if you are currently using a different style. With this complete you can upload the new phpBB 2.0.0 files (see <a href="#install">New Installations</a> for details if necessary). Once complete copy back your saved <u>config.php</u>, replacing the new one.</p>
<p>You should now run <b>install/update_to_latest.php</b> which, depending on your previous version, will make a number of database changes. You may receive <u>FAILURES</u> during this procedure, they should not be a cause for concern unless you see an actual <u>ERROR</u>, in which case the script will stop (in this case you should seek help via our forums or bug tracker).</p>
<p><b>RC-2 and below MSSQL users</b>, please note that during the update procedure your existing forums table will be dropped and re-created. All data in standard fields will be retained. However if you have modified the forums table and added additional fields or altered existing ones these changes <b>WILL</b> be lost. If this is a significant issue for you we advise you comment out the "DROP FORUM TABLE" section in update_to_latest.php and instead, manually alter the forum_id column to remove the IDENTITY setting (if it exists).</p>
<p>Once the update_to_latest.php has completed you <b>MUST</b> proceed to the Administration General Configuration panel and check all the values in General Configuration. This is essential if you were running any version before RC-3 since extra information needs to be entered to enable correct URLs to be output in emails.</p>
<a name="langtempchanges"></a><h3 class="h3">6.i. Changes in language pack format and templates</h3>
<p>Please note that changes have been made to the format of language, image localisations and templates from previous RC's to FINAL. If you were running a release candidate prior to RC-3 you will <b>need</b> to download new language and image localisation packs. You can safely delete any existing <u>*_lang.gif</u> files in the subSilver/images directory since these are no longer utilised. If you are using or have installed any 3rd party template set you must either remove it or update it. Changes have been made to a number of template variables which will result in these not working unless they have been updated to meet phpBB 2.0.x standards.</p>
<a name="upgradeSTABLE"></a><h2 class="h2"><u>7. Upgrade from previous stable (released) versions of phpBB 2</u></h2>
<p>If you are currently using a stable release of phpBB 2 updating to this version is straightforward. You would have downloaded one of three packages and your choice determines what you need to do. <b>Please Note</b>: That before upgrading we heavily recommend you do a <u>full backup of your database and existing phpBB2 source files</u>! If you are unsure how to achieve this please ask your hosting provider for advice.</p>
<p><b>MySQL Users Please Note</b>: Changes introduced in 2.0.4 may increase the size of your database, more specifically the search_wordmatch table. There are other changes in that release which are designed to reduce the database size. However these additional changes may not apply to all types of forum (particularly non-English boards). While any increases will be relatively small compared to the overall database size it may be an issue for some users. In particular users on hosting plans which limit database size and where the database is near that limit.</p>
<p><b>Please make sure you update your phpBB2 source files too, even if you run the update_to_latest.php file.</b></p>
<a name="upgradeSTABLE_full"></a><h3 class="h3">7.i. Full package</h3>
<p>If you have downloaded the full package you should follow the same general upgrade path as for "<a href="#upgradeRC">Upgrade from previous Release Candidate versions of phpBB 2</a>". The exception to this being the need to switch or update styles. In addition there is generally little need to visit the admin panel (though it is adviseable).</p>
<a name="upgradeSTABLE_files"></a><h3 class="h3">7.ii. Changed files only</h3>
<p>This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 2.0.22 you should select the phpBB-2.0.22_to_2.0.23.zip/tar.gz file.</p>
<p>The directory structure has been preserved enabling you (if you wish) to simply upload the contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any Mods these files will overwrite the originals possibly destroying them in the process. You will need to re-add Mods to any affected file before uploading.</p>
<p>As for the other upgrade procedures you should run <b>install/update_to_latest.php</b> after you have finished updating the files. This will update your database schema and increment the version number.</p>
<a name="upgradeSTABLE_patch"></a><h3 class="h3">7.iii. Patch file</h3>
<p>The patch file is probably the best solution for those with many Mods or other changes who do not want to re-add them back to all the changed files. To use this you will need command line access to a standard UNIX type <b>patch</b> application.</p>
<p>A number of patch files are provided to allow you to upgrade from previous stable releases. Select the correct patch, e.g. if your current version is 2.0.22 you need the phpBB-2.0.22_to_2.0.23.patch. Place the correct patch in the parent directory containing the phpBB 2 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: <b>patch -cl -d [PHPBB DIRECTORY] -p1 &lt; [PATCH NAME]</b> (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB2, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.</p>
<p>If you do get failures you should look at using the <a href="#upgradeSTABLE_files">Changed files only</a> package to replace the files which failed to patch, please note that you will need to manually re-add any Mods to these particular files. Alternatively if you know how you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source.</p>
<p>You should of course delete the patch file (or files) after use. As for the other upgrade procedures you should run <b>install/update_to_latest.php</b> after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number.</p>
<a name="upgradeSTABLE_all"></a><h3 class="h3">7.iv. All package types</h3>
<p>If you have non-English language packs installed you may want to see if a new version has been made available. A number of missing strings have been added which, though not essential, may be beneficial to users. Please note that at this time not all language packs have been updated so you should be prepared to periodically check for updates.</p>
<a name="postinstall"></a><h2 class="h2"><u>8. Important (security related) post-Install tasks for all installation methods</u></h2>
<p>Once you have succssfully installed phpBB 2.0.x you <b>MUST</b> ensure you remove the entire install/ and contrib/ directories. Leaving these in place is a <u>very serious potential security issue</u> which may lead to deletion or alteration of files, etc. Please note that until these directories are remove phpBB2 will not operate and a warning message will be displayed. Beyond these <b>essential</b> deletions you may also wish to delete the docs/ directories if you wish.</p>
<p>With these directories deleted you should proceed to the administration panel. Depending on how the installation completed you may have been directed there automatically. If not, login as the administrator you specified during install/upgrade and click the "<b>Administration Panel</b>" link at the bottom of any page. Ensure that details specified in General -> Configuration are correct!</p>
<a name="avatars"></a><h3 class="h3">8.i. Uploadable avatars</h3>
<p>phpBB 2 supports several methods for allowing users to select their own <i>avatar</i> (an avatar is a small image generally unique to a user and displayed just below their username in posts).</p>
<p>Two of these options allow users to upload an avatar from their machine or a remote location (via a URL). If you wish to enable this function you should first ensure the correct paths for uploadeable avatars is set in Admin -> General -> Configuration -> Avatars. By default this is <u>images/avatars</u> but you can set it to whatever you like, just ensure the configuration setting is updated. You must also ensure this directory can be written to by the webserver. Usually this means you have to alter its permissions to allow anyone to read and write to. Exactly how you should do this depends on your ftp client or server operating system.</p>
<p>On UNIX systems for example you set the directory to a+rwx (or ugo+rwx or even 777). This can be done from a command line on your server using chmod or via your FTP client (using the Change Permissions, chmod or other Permissions dialoge box, see your FTP clients documentation for help). Most FTP clients list permissions in the form of User (Read, Write, Execute), Group (Read, Write, Execute) and Other (Read, Write, Execute). You need to tick all of these boxes to set correct permissions.</p>
<p>On Windows system you need to ensure the directory is not write-protected and that it has global write permissions (see your servers documentation or contact your hosting provider if you are unsure on how to achieve this).</p>
<p>Please be aware that setting a directories permissions to global write access is a potential security issue. While it is unlikely that anything nasty will occur (such as all the avatars being deleted) there are always people out there out to cause trouble. Therefore you should monitor this directory and if possible make regular backups.</p>
<a name="safemode"></a><h3 class="h3">8.ii. Safe Mode</h3>
<p>phpBB 2.0.x includes support for using uploadable avatars on systems running PHP in safe mode. If this applies to your hosting service you will need to create a sub-directory called <u>tmp</u> in the directory you specified for storage of uploaded avatars (by default this is images/avatars as explained above). Give it the same access rights as for uploadable avatars above.</p>
<p>This safe mode support includes compatibility with various directory restrictions your host may impose (assuming they are not too restrictive and that the PHP installed is version 4.0.3 or later). There is generally no need for any manual setup for safe mode support it is typically handled transparantly.</p>
<a name="extras"></a><h3 class="h3">8.iii. Optional extras</h3>
<p>Included with this package are two extra (optional) files, you will find them in the <u>contrib/</u> directory. These extras, <i>template_file_cache.php</i> and <i>template_db_cache.php</i> address concerns over server load and page generation times on slower or heavily loaded systems. These updated template modules compile each template and uses this rather than compiling each file everytime it is viewed. Tests seem to indicate a noticeable decrease in page generation times and more importantly a significant decrease in overall server load in virtual hosting environments.</p>
<p>You should see the <a href="../contrib/README.html">README</a> contained within the contrib directory for more details.</p>
<a name="disclaimer"></a><h2 class="h2"><u>9. Copyright and disclaimer</u></h2>
<p>This application is opensource software released under the <a href="http://www.gnu.org/licenses/gpl.html" target="_new">GPL</a>. Please see source code and the Docs directory for more details. This package and its contents are Copyright <20> 2002 <a href="http://www.phpbb.com/" target="_new">phpBB Group</a>, All Rights Reserved.</p>
<!-- END DOCUMENT -->
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

View File

@@ -1,224 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>phpBB 2.0.x :: Readme</title>
<link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css" />
<style type="text/css">
<!--
p,ul,td {font-size:10pt;}
.h2 {font-size:15pt;font-weight:bold;color:red}
.h3 {font-size:12pt;color:blue}
//-->
</style>
</head>
<body bgcolor="#E5E5E5" text="#000000" link="#006699" vlink="#006699">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td class="bodyline"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2 : Creating Communities" vspace="1" /></a></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.x README</span></td>
</tr>
</table>
<!-- BEGIN DOCUMENT -->
<p>Thank you for downloading phpBB 2, the long awaited re-write of the popular phpBB 1.x online community forum. This README will guide through the basics of installation and operation of phpBB 2. Please ensure you read this and the accompanying documentation fully <b>before</b> proceeding with the installation.</p>
<ol>
<li><a href="#install">Installing phpBB 2</a></li>
<li><a href="#run">Running phpBB 2</a></li>
<ol type="i">
<li><a href="#i18n">Internationalisation (i18n)</a></li>
<li><a href="#styles">Styles</a></li>
<li><a href="#mods">Mods</a></li>
</ol>
<li><a href="#help">Getting help with phpBB 2</a></li>
<ol type="i">
<li><a href="#userguide">Userguide</a></li>
<li><a href="#website">Community Forums</a></li>
<li><a href="#irc">Internet Relay Chat</a></li>
</ol>
<li><a href="#status">Status of this version</a></li>
<li><a href="#bugs">Reporting Bugs</a></li>
<ol>
<li><a href="#securitybugs">Security related bugs</a></li>
</ol>
<li><a href="#curbugs">Overview of current bug list</a></li>
<li><a href="#php">PHP compatibility issues</a></li>
<ol type="i">
<li><a href="#phpsec">Notice on PHP security issues</a></li>
</ol>
<li><a href="#disclaimer">Disclaimer</a></li>
</ol>
<a name="install"></a><h2 class="h2"><u>1. Installing phpBB 2</u></h2>
<p>Installation and upgrade instructions can be found in the <a href="INSTALL.html">INSTALL</a> document contained in this distribution. If you are intending to upgrade from a previous phpBB 1.4.x installation we highly recommend you backup any existing data before proceeding!</p>
<p><b>Please note</b> that users of Release Candidate (RC) versions of phpBB 2 should run the update_to_latest.php script <b>BEFORE</b> attempting to access your board. Failing to do so may result in errors and unexpected behaviour! While these won't do any damage they will prevent you using your board.</p>
<p>If you are using RC-1 (pre) you may find some other DB changes have occured and should examine the schemas to see if your installation requires any modifications (note that most of these have already been discussed on the phpBB 2 forums and are handled by the update script). If you are uncomfortable doing any of this we recommend you re-install (you may backup your existing data if you wish, re-install phpBB 2 and then insert your backup).</p>
<p>Users of phpBB 2.0 Beta-1 cannot directly upgrade to phpBB 2.0 RC-2, 3 or 4, sorry.</p>
<a name="run"></a><h2 class="h2"><u>2. Running phpBB 2</u></h2>
<p>Once installed phpBB 2.0 is easily managed by both admin and moderator control panels. If you need help or advice with phpBB 2 please see <a href="#help">Section 3</a> below.</p>
<a name="i18n"></a><h3 class="h3">2.i. Internationalisation, i18n</h3>
<p>A number of language packs and subSilver localisations are now available. You can find them on our official download page:</p>
<p><a href="http://www.phpbb.com/downloads.php#lang" target="_new">http://www.phpbb.com/downloads.php</a></p>
<p>This is the <i>Official</i> location for all support language sets. If you download a package from a 3rd party site you do so with the understanding that we cannot offer support. So please, do not ask for help in these cases!</p>
<p>Installation of these packages is straightforward, simply download the required language pack and unarchive it into the languages/ folder. Please ensure you retain the directory structure when doing this! To install the subSilver image packs you should unarchive the file/s into the templates/subSilver/images directory, again you must retain the directory structure. Once installed the languages will become immediately available.</p>
<p>If your language is not available please visit our forums where you will find a topic listing translations currently available or in preparation. This topic also gives you information should you wish to volunteer to translate a language not currently listed</p>
<p><b>Please note</b> that users who have upgraded to the latest version from versions prior to RC-3 should will <b>need</b> to download new versions of the language/subSilver image packs. Any package downloaded prior to the availability of RC-3 will <b>not</b> function correctly with this version of phpBB 2.</p>
<p>If you have upgraded from 2.0.0 and make use of non-English language packs you will benefit from downloading updated versions which will become available shortly. These introduce a number of strings which went missing from the first version plus a few updates and additions.</p>
<a name="styles"></a><h3 class="h3">2.ii. Styles</h3>
<p>Although phpBB Group are rather proud of the subSilver style (which has influenced many of our competitors boards <i>updated</i> designs!) we realise that it may not be to everyones tastes. Therefore phpBB 2 allows styles to be switched with relative ease. Firstly you need to locate and download a style you like. We maintain such a site at</p>
<p><a href="http://www.phpbb.com/styles/" target="_new">http://www.phpbb.com/styles/</a></p>
<p><b>Please note</b> that 3rd party styles downloaded for versions of phpBB 2 prior to its final (2.0.x) release will <b>not</b> function correctly. You should either remove these styles or (if available) update them to meet changes in 2.0.x.</p>
<p>Once you have downloaded a style the usual next step is to unarchive (or upload the unarchived contents of) the package into your templates/ directory. You then need to visit Administration -> Styles -> Add, you should see the new style available, click add and it will become available for all your users.</p>
<a name="mods"></a><h3 class="h3">2.iii. Mods</h3>
<p>Although not officially supported by phpBB Group, phpBB 2 has a thriving mod (formerly known as <i>hacks</i>) scene. These third party modifications to the standard phpBB 2 extend its capabilities still further and can be found at:</p>
<p><a href="http://www.phpbb.com/mods" target="_new">http://www.phpbb.com/mods</a></p>
<p><b>Please remember</b> that any bugs or other issues that occur after you have added any modification should <b>NOT</b> be reported to the bug tracker (see below). First remove the modification and see if the problem is resolved.</p>
<p>Also remember that any modifications which modify the database in any way may render upgrading your forum to future versions more difficult unless we state otherwise. With all this said many users have and continue to utilise many of the mods already available with great success</p>
<a name="help"></a><h2 class="h2"><u>3. Getting help with phpBB 2</u></h2>
<p>phpBB 2 can seem a little daunting to new users in places, particularly with regard the permission system. The first thing you should do is check the <a href="FAQ.html">FAQ</a> which covers a few basic getting started questions. If you need additional help there are several places you should look.</p>
<a name="userguide"></a><h3 class="h3">3.i. phpBB 2 Userguide</h3>
<p>A comprehensive userguide is now available online and can be accessed from the following location:</p>
<p><a href="http://www.phpbb.com/support/guide/" target="_new">http://www.phpbb.com/support/guide/</a></p>
<p>This covers everything from installation through setting permissions and managing users.</p>
<a name="website"></a><h3 class="h3">3.ii. Community Forums</h3>
<p>phpBB Group maintains a thriving community where a number of people have generously decided to donate their time to help support users. This site can be found at:</p>
<p><a href="http://www.phpbb.com/" target="_new">http://www.phpbb.com/</a></p>
<p>If you do seek help via our forums please be sure to do a Search before posting. This may well save both you and us time and allow the developer, moderator and support groups to spend more time responding to people with unknown issues and problems. Please also remember that phpBB is an entirely volunteer effort, no one receives any compensation for the time they give, this includes moderators as well as developers. So please be respectful and mindful when awaiting responses.</p>
<a name="irc"></a><h3 class="h3">3.iii Internet Relay Chat</h3>
<p>Another place you may find help is our IRC channel. This operates on the Freenode IRC network, <b>irc.freenode.net</b> and the channel is <b>#phpbb</b> and can be accessed by any good IRC client such as mIRC, XChat, etc. Again, please do not abuse this service and be respectful of other users.</p>
<a name="status"></a><h2 class="h2"><u>4. Status of this version</u></h2>
<p>This is the second stable release of phpBB 2. The 2.0.x line is essentially feature frozen, point releases will see only bugs and such like fixed. Our next major release will be phpBB 3.0 and work is progressing on this (the unstable development version is 2.1). Please do not post questions asking when 3.0 will be available, no release date has been set. phpBB 3.0 is now feature frozen, please feel free to suggest new features for phpBB 3.2 using our feature request tracker. We do not guarantee that all these will appear in 3.2 but we will do our best!:</p>
<p><a href="http://sourceforge.net/tracker/?atid=580201&group_id=7885&func=browse" target="_new">http://sourceforge.net/tracker/?atid=580201&group_id=7885&func=browse</a></p>
<p>Before submitting your idea please <b>ensure</b> you have read through the entries in that list. If your idea is similar to an existing one please feel free to add a comment to it. Please <b>do not</b> submit duplicate suggestions!</p>
<p>For some suggestions we may ask for your feedback via our forums. For those interested in the development of phpBB 3.0 you should keep an eye on the community forums (particularly the Feature Discussion forum) where you may be able to influence the direction we take with certain new features. Finally you may like to visit our development forum to see how things are progressing:</p>
<p><a href="http://area51.phpbb.com/phpBB/" target="_new">http://area51.phpbb.com/phpBB/</a></p>
<p>Please note that this forum should <b>NOT</b> be used to obtain support for or ask questions about phpBB 2.0.x, the main community forums are the place for this. Any such posts will be locked and go unanswered.</p>
<a name="bugs"></a><h2 class="h2"><u>5. Reporting Bugs</u></h2>
<p>The phpBB Group uses a bug tracking system to store, list and manage all reported bugs, it can be found at the location listed below. Please <b>DO NOT</b> post bug reports to our forums, they will be locked. In addition please <b>DO NOT</b> use the bug tracker for support requests. Posting such a request will only see you directed to the support forums (while taking time away from working on real bugs).</p>
<p><a href="http://www.phpbb.com/bugs/" target="_new">http://www.phpbb.com/bugs/</a></p>
<p>While we very much appreciate receiving bug reports (the more reports the more stable phpBB 2 will be) we ask you carry out a few steps before adding new entries:</p>
<ul>
<li>Firstly determine if your bug is reproduceable, how to determine this depends on the bug in question. Only if the bug is reproduceable is it likely to be a problem with phpBB 2.0 (or in some way connected). If something cannot be reproduced it may turn out to have been your hosting provider working on something, a user doing something silly, etc. Bug reports for non-reproduceable events can slow down our attempts to fix real, reproduceable issues<br /><br /></li>
<li>Next please read or search through the existing bug reports (remember to check open <b>AND</b> closed reports!) to see if <i>your</i> bug (or one very similar to it) is already listed. If it is please add to that existing bug rather than creating a new duplicate entry (all this does is slow us down).<br /><br /></li>
<li>Check the forums (use search!) to see if people have discussed anything that sounds similar to what you are seeing. However, as noted above please <b>DO NOT</b> post your particular bug to the forum unless it's non-reproduceable or you are sure it's related to something you have done rather phpBB 2.0<br /><br /></li>
<li>If no existing bug exists then please feel free to add it</li>
</ul>
<p>If you do post a new bug (i.e. one that isn't already listed in the bug tracker) firstly make sure you have logged in (your username and password are the same as for the community forums) then please include the following details:</p>
<ul>
<li>Your server type/version, eg. Apache 1.2.22, IIS 4, Sambar, etc.</li>
<li>PHP version and mode of operation, eg. PHP 4.1.1 as a module, PHP 4.0.1 running as CGI, etc.</li>
<li>DB type/version, eg. MySQL 3.23.32, PostgreSQL 7.1.2, MSSQL Server 2000 SP1, etc.</li>
</ul>
<p>Please also be as detailed as you can in your report, if possible list the steps required to duplicate the problem. If you have a fix which you are <b>VERY SURE</b> works (and is consistent with our coding guidelines) and does not introduce further problems or incompatibilities please let us know. However only include it in the bug report if you really must, if we need it we'll ask you for it.</p>
<p>Once a bug has been submitted you will be emailed any follow up comments added to it. <b>Please</b> if you are requested to supply additional information, <b>do so</b>! It is <u>extremely frustrating</u> for us to receive bug reports, ask for additional information but get nothing. In these cases we have a policy of <u>closing the bug</u>, which may leave a very real problem in place. Obviously we would rather not have this situation arise.</p>
<a name="securitybugs"></a><h3 class="h3">5.i. Security related bugs</h3>
<p>If you find a potential security related vulnerability in phpBB 2 please <b>DO NOT</b> post it to the bug tracker, public forums, mailing lists, etc.! Doing so may allow unscrupulous users to take advantage of it before we have time to put a fix in place. All security related bugs should be sent to our security tracker:</p>
<p><a href="http://www.phpbb.com/security/" target="_new">http://www.phpbb.com/security/</a></p>
<a name="curbugs"></a><h2 class="h2"><u>6. Overview of current bug list</u></h2>
<p>This list is not complete (see above link for full list) but does represent those bugs which may effect users on a wider scale. Other bugs listed in the tracker have typically been shown to be limited to certain setups or methods of installation/upgrade.</p>
<ul>
<li>First four characters of some posted content disappears - this is an issue with PHP not phpBB</li>
<li>Cannot post very large messages when using PostgreSQL 7.0.x (limitation of Postgresql 7.0.x)</li>
<li>By default cannot post very large messages with MSSQL (this can be configured within MSSQL)</li>
<li>Use of non-latin charsets with MSSQL may result in post data being cropped unexpectedly</li>
<li>Upgrade may fail to complete on large boards under some hosts</li>
<li>Case-sensitivity on usernames and emails with PostgreSQL 7.x. A fix is provided by a user <a href="http://www.phpbb.com/kb/article.php?article_id=201" target="_new">within our knowledge base</a></li>
</ul>
<a name="php"></a><h2 class="h2"><u>7. PHP compatibility issues</u></h2>
<p>phpBB is no longer supported on PHP3 due to several compatibility issues and we recommend that you upgrade to the latest stable release of PHP4 to run phpBB.</p>
<p>Please remember that running any application on a developmental version of PHP can lead to strange/unexpected results which may appear to be bugs in the application (which may not be true). Therefore we recommend you upgrade to the newest stable version of PHP before running phpBB 2. If you are running a developmental version of PHP please check any bugs you find on a system running a stable release before submitting.</p>
<p>This board has been developed and tested under Linux and Windows (amongst others) running IIS and Apache using MySQL 3.23 and 4.0.0, MSSQL Server 2000, MS Access 2000 and XP and PostgreSQL 7.x. Versions of PHP used range from 4.0.6 to 4.3.8 without problem. There may be unconfirmed issues with PHP 4.0.1 including patch level releases. If you experience problems with phpBB and have this PHP version installed it is recommended you upgrade it before posting bug reports.</p>
<p>With the recent release of the official version of PHP 5, people and hosts may be switching to the latest PHP version. At this moment, the phpBB Team does not officially support running phpBB on PHP 5, as phpBB2.0.x was not written with PHP 5 in mind. However, many users have reported using it sucessfully on PHP 5 having made a configuration change in PHP to enable support for the deprecated HTTP_*_VARS arrays which is turned off by default in new PHP 5 installations. The relevant configuration option is register_long_arrays and it is decribed in the PHP Manual. phpBB 2.0.x makes use of these arrays in order to maintain backwards compatibility with early versions of PHP 4.x which is part of the original specification.<br />
For this reason we do not support PHP 5 as platform for phpBB. It has been reported working, so you can try it. It's a risk you will be taking though.</p>
<a name="phpsec"></a><h3 class="h3">7.i. Notice on PHP security issues</h3>
<p>At the end of February 2002 a <a href="http://security.e-matters.de/advisories/012002.html" target="_new">major security issue</a> was found with PHP 3 and 4 which has resulted in many hosting providers disabling file uploads (although patches fixing the security issues are available and new versions of PHP 4 have been released).</p>
<p>Because of this, and to cope with situations where hosts didn't allow such uploads anyway we have implemented various checks in phpBB 2. These checks prevent you from enabling or making use of functions which will not operate correctly on PHP as installed on your server. At this time this includes locally uploaded avatars and DB restore.</p>
<p>Third party mods may also be effected but these are outside our control, you should contact the mod writer for more information.</p>
<a name="disclaimer"></a><h2 class="h2"><u>8. Copyright and disclaimer</u></h2>
<p>This application is opensource software released under the <a href="http://www.gnu.org/licenses/gpl.html" target="_new">GPL</a>. Please see source code and the Docs directory for more details. This package and its contents are Copyright <20> 2002 <a href="http://www.phpbb.com/" target="_new">phpBB Group</a>, All Rights Reserved.</p>
<!-- END DOCUMENT -->
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

88
phpBB/docs/auth_api.html Normal file
View File

@@ -0,0 +1,88 @@
<html>
<head>
<link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css" />
<style type="text/css">
<!--
p,ul,td {font-size:10pt;}
h2 {font-size:15pt;font-weight:bold;color:red}
h3 {font-size:12pt;color:blue}
//-->
</style>
</head>
<body bgcolor="#E5E5E5" text="#000000" link="#006699" vlink="#006699">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td class="bodyline"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<h1>Using the <i><u>auth</u></i> class</h1>
<h2>What is it?</h2>
<p>The <i><u>auth</u></i> class contains methods related to authorisation users to access various board functions, e.g. posting, viewing, replying, logging in (and out), etc. If you need to check whether a user can carry out a task or handle user login/logouts this class is required.</p>
<h2>Initialisation</h2>
<p>To use any methods contained with the <i><u>auth</u></i> class it first needs to be instantiated. This is best achieved early in the execution of the script in the following manner:
<pre>$auth = new auth();</pre>
<p>Once an instance of the object has been created you are free to call the various methods it contains. Please note that should you wish to use the <i><u>auth_admin</u></i> methods you will need to instantiate this seperately but in the same way.</p>
<h3><i>acl</i></h3>
<p>The <i>acl</i> method is the initialisation routine for all the acl functions. If you intend calling any acl method you must first call this. The method takes as its one and only required parameter a hash of userdata. This hash must contain at least the following information; user_id, user_permissions and user_founder. It is called in the following way:
<pre>$auth->acl(<i>userdata</i>);</pre>
<p>Where userdata is the hash containing the aforementioned data.</p>
<h3><i>acl_get</i></h3>
<p>This method is the primary way of determining what a user can and cannot do for a given option in, optionally, a given forum. The method should be called in the following way:</p>
<pre>$result = $auth->acl_get(<i>option</i>[, <i>forum</i>]);</pre>
<p>Where option is a string representing the required option, e.g. 'f_list', 'm_edit', 'a_adduser', etc. The optional forum term is the integer forum_id.</p>
<pThe method returns a positive integer when the user is allowed to carry out the option and a zero if denied.</p>
<h3><i>acl_gets</i></h3>
<p>This method is funtionally similar to <i>acl_get</i> in that it returns information on whether a user can or cannot carry out a given task. The difference here is the ability to test several different options in one go. This may be useful for testing whether a user is a moderator or an admin in one call. Rather than having to call and check <i>acl_get</i> twice.</p>
<p>The method should be called thus:</p>
<pre>$result = $auth->acl_gets(<i>option1</i>[, <i>option2</i>, ..., <i>optionN</i>, <i>forum</i>]);</pre>
<p>As with the <i>acl_get</i> method the options are strings representing the required permissions to check. The forum again is an integer representing a given forum_id.</p>
<h3><i>acl_cache</i></h3>
<p>This should be considered a private method and not be called externally. It handles the generation of the user_permissions data from the basic user and group authorisation data. When necessary this method is called automatically by <i>acl</i>.</p>
<h3><i>login</i></h3>
<p></p>
<h2>Admin related functions</h2>
<p>A number of additional methods are available related to <i><u>auth</u></i>. These handle more basic functions such as adding user and group permissions, new options and clearing the user cache. These methods are contained within a seperate class, <i><u>auth_admin</u></i>. This can be found in the functions_admin source.</p>
<p>To use any methods this class contains it first needs to be instantiated seperately from <i><u>auth</u></i>. This is achieved in the same way as <i><u>auth</u></i>:</p>
<pre>$authadmin = new auth_admin();</pre>
<p>This instance gives you access to both the methods of this specific class and that of <i><u>auth</u></i>.</p>
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,26 +0,0 @@
CODING GUIDELINES : Initials by psoTFX (July 2001)
-----------------
* The coding style is defined in the codingstandards.html file, all attempts should be made to follow it as closely as possible
* All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL, MSSQL (7.0 and 2000), PostgreSQL (7.0+), Oracle8, ODBC (generalised if possible, otherwise MS Access, DB2))
* All SQL commands should utilise the DataBase Abstraction Layer (DBAL)
* All URL's (and form actions) _must_ be wrapped in append_sid, this ensures the session_id is propagated when cookies aren't available
* The minimum amount of data should be passed via GET or POST, checking should occur within individual scripts (to prevent spoofing of information)
* The auth function should be used for all authorisation checking
* Sessions should be initiated on each page, as near the top as possible using the session_pagestart function (userdata should be obtained by calling the init_userprefs immediately after session initialisation)
* Login checks should be forwarded to the login page (supplying a page to forward onto once check is complete if required)
* All template variables should be named appropriately (using underscores for spaces), language entries should be prefixed with L_, system data with S_, urls with U_, all other variables should be presented 'as is'.
* Functions used by more than page should be placed in functions.php, functions specific to one page should be placed on that page (at the top to maintain compatibility with PHP3) surrounded by comments indicating the start and end of the function block
* All messages/errors should be output by the message_die function using the appropriate message type (see function for details)
* No attempt should be made to remove any copyright information (either contained within the source or displayed interactively when the source is run/compiled), neither should the copyright information be altered in any way (it may be added to)

View File

@@ -1,327 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0044) -->
<HTML><HEAD><TITLE>phpBB Coding Standard Guidelines</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR></HEAD>
<BODY aLink=#cccccc bgColor=#ffffff link=#0000ff text=#000000
vLink=#0000ff><FONT face=verdana,arial,tahoma size=-1><A name=top></A>
<H2>phpBB Coding Standard Guidelines</H2>Comments or suggestions? email <A
href="mailto:nate@phpbb.com">nate@phpbb.com</A><BR><BR><A
href="#editor">Editor
Settings</A><BR><A
href="#naming">Naming
Conventions</A><BR><A
href="#layout">Code Layout</A><BR><A
href="#general">General
Guidelines</A><BR><BR><BR><A name=editor></A><A
href="#top">top</A>
<H3>Editor Settings</H3>
<P><B>Tabs vs Spaces:</B> In order to make this as simple as possible, we will
be using tabs, not spaces. Feel free to set how many spaces your editor uses
when it <B>displays</B> tabs, but make sure that when you <B>save</B> the file,
it's saving tabs and not spaces. This way, we can each have the code be
displayed the way we like it, without breaking the layout of the actual files.
</P>
<P><B>Linefeeds:</B> Ensure that your editor is saving files in the UNIX format.
This means lines are terminated with a newline, not with a CR/LF combo as they
are on Win32, or whatever the Mac uses. Any decent Win32 editor should be able
to do this, but it might not always be the default. Know your editor. If you
want advice on Windows text editors, just ask one of the developers. Some of
them do their editing on Win32. </P><BR><BR><A name=naming></A><A
href="#top">top</A>
<H3>Naming Conventions</H3>
<P>We will not be using any form of hungarian notation in our naming
conventions. Many of us believe that hungarian naming is one of the primary code
obfuscation techniques currently in use. </P>
<P><B>Variable Names:</B> Variable names should be in all lowercase, with words
separated by an underscore. <BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;Example: <CODE><FONT
size=+1>$current_user</FONT></CODE> is right, but <CODE><FONT
size=+1>$currentuser</FONT></CODE> and <CODE><FONT
size=+1>$currentUser</FONT></CODE> are not. <BR><BR>Names should be descriptive,
but concise. We don't want huge sentences as our variable names, but typing an
extra couple of characters is always better than wondering what exactly a
certain variable is for. </P>
<P><B>Loop Indices:</B> The <I>only</I> situation where a one-character variable
name is allowed is when it's the index for some looping construct. In this case,
the index of the outer loop should always be $i. If there's a loop inside that
loop, its index should be $j, followed by $k, and so on. If the loop is being
indexed by some already-existing variable with a meaningful name, this guideline
does not apply. <BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;Example: <PRE><FONT size=+1>
for ($i = 0; $i &lt; $outer_size; $i++)
{
for ($j = 0; $j &lt; $inner_size; $j++)
{
foo($i, $j);
}
} </FONT></PRE>
<P></P>
<P><B>Function Names:</B> Functions should also be named descriptively. We're
not programming in C here, we don't want to write functions called things like
"stristr()". Again, all lower-case names with words separated by a single
underscore character. Function names should preferably have a verb in them
somewhere. Good function names are <CODE><FONT
size=+1>print_login_status()</FONT></CODE>, <CODE><FONT
size=+1>get_user_data()</FONT></CODE>, etc.. </P>
<P><B>Function Arguments:</B> Arguments are subject to the same guidelines as
variable names. We don't want a bunch of functions like: <CODE><FONT
size=+1>do_stuff($a, $b, $c)</FONT></CODE>. In most cases, we'd like to be able
to tell how to use a function by just looking at its declaration. </P>
<P><B>Summary:</B> The basic philosophy here is to not hurt code clarity for the
sake of laziness. This has to be balanced by a little bit of common sense,
though; <CODE><FONT size=+1>print_login_status_for_a_given_user()</FONT></CODE>
goes too far, for example -- that function would be better named <CODE><FONT
size=+1>print_user_login_status()</FONT></CODE> , or just <CODE><FONT
size=+1>print_login_status()</FONT></CODE>. </P><BR><BR><A name=layout></A><A
href="#top">top</A>
<H3>Code Layout</H3>
<P><B>Standard header for new files:</B> Here a template of the header that must
be included at the start of all phpBB files: <PRE><FONT size=+1>
/***************************************************************************
filename.php
-------------------
begin : Sat June 17 2000
copyright : (C) 2000 The phpBB Group
email : support@phpBB.com
$Id$
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
</FONT></PRE>
<P></P>
<P><B>Always include the braces:</B> This is another case of being too lazy to
type 2 extra characters causing problems with code clarity. Even if the body of
some construct is only one line long, do <I>not</I> drop the braces. Just don't.
<BR><BR>&nbsp;&nbsp;&nbsp;Examples:<PRE><FONT size=+1>
/* These are all wrong. */
if (condition) do_stuff();
if (condition)
do_stuff();
while (condition)
do_stuff();
for ($i = 0; $i &lt; size; $i++)
do_stuff($i);
/* These are right. */
if (condition)
{
do_stuff();
}
while (condition)
{
do_stuff();
}
for ($i = 0; $i &lt; size; $i++)
{
do_stuff();
}
</FONT></PRE>
<P></P>
<P><B>Where to put the braces:</B> This one is a bit of a holy war, but we're
going to use a style that can be summed up in one sentence: Braces always go on
their own line. The closing brace should also always be at the same column as
the corresponding opening brace. <BR><BR>&nbsp;&nbsp;&nbsp;Examples:<PRE><FONT size=+1>
if (condition)
{
while (condition2)
{
...
}
}
else
{
...
}
for ($i = 0; $i &lt; $size; $i++)
{
...
}
while (condition)
{
...
}
function do_stuff()
{
...
}
</FONT></PRE>
<P></P>
<P><B>Use spaces between tokens:</B> This is another simple, easy step that
helps keep code readable without much effort. Whenever you write an assignment,
expression, etc.. Always leave <I>one</I> space between the tokens. Basically,
write code as if it was English. Put spaces between variable names and
operators. Don't put spaces just after an opening bracket or before a closing
bracket. Don't put spaces just before a comma or a semicolon. This is best shown
with a few examples. <BR><BR>&nbsp;&nbsp;&nbsp;Examples:<PRE><FONT size=+1>
/* Each pair shows the wrong way followed by the right way. */
$i=0;
$i = 0;
if($i&lt;7) ...
if ($i &lt; 7) ...
if ( ($i &lt; 7)&amp;&amp;($j &gt; 8) ) ...
if (($i &lt; 7) &amp;&amp; ($j &gt; 8)) ...
do_stuff( $i, "foo", $b );
do_stuff($i, "foo", $b);
for($i=0; $i&lt;$size; $i++) ...
for($i = 0; $i &lt; $size; $i++) ...
$i=($j &lt; $size)?0:1;
$i = ($j &lt; $size) ? 0 : 1;
</FONT></PRE>
<P></P>
<P><B>Operator precedence:</B> Do you know the exact precedence of all the
operators in PHP? Neither do I. Don't guess. Always make it obvious by using
brackets to force the precedence of an equation so you know what it does.
<BR><BR>&nbsp;&nbsp;&nbsp;Examples:<PRE><FONT size=+1>
/* what's the result? who knows. */
$bool = ($i &lt; 7 &amp;&amp; $j &gt; 8 || $k == 4);
/* now you can be certain what I'm doing here. */
$bool = (($i &lt; 7) &amp;&amp; (($j &lt; 8) || ($k == 4)))
</FONT></PRE>
<P></P>
<P><B>SQL code layout:</B> Since we'll all be using different editor settings,
don't try to do anything complex like aligning columns in SQL code. Do, however,
break statements onto their own lines. Here's a sample of how SQL code should
look. Note where the lines break, the capitalization, and the use of brackets.
<BR><BR>&nbsp;&nbsp;&nbsp;Examples:<PRE><FONT size=+1>
SELECT field1 AS something, field2, field3
FROM table a, table b
WHERE (this = that) AND (this2 = that2)
</FONT></PRE>
<P></P>
<P><B>SQL insert statements:</B> SQL INSERT statements can be written in two
different ways. Either you specify explicitly the columns being inserted, or
you rely on knowing the order of the columns in the database and do not
specify them. We want to use the former approach, where it is explicitly
stated whcih columns are being inserted. This means our application-level code
will not depend on the order of the fields in the database, and will not be broken
if we add additional fields (unless they're specified as NOT NULL, of course).
<BR><BR>&nbsp;&nbsp;&nbsp;Examples:<PRE><FONT size=+1>
# This is not what we want.
INSERT INTO mytable
VALUES ('something', 1, 'else')
# This is correct.
INSERT INTO mytable (column1, column2, column3)
VALUES ('something', 1, 'else')
</FONT></PRE>
<P></P><BR><BR><A name=general></A><A
href="#top">top</A>
<H3>General Guidelines</H3>
<P><B>Quoting strings:</B> There are two different ways to quote strings in PHP
- either with single quotes or with double quotes. The main difference is that
the parser does variable interpolation in double-quoted strings, but not in
single quoted strings. Because of this, you should <I>always</I> use single
quotes <I>unless</I> you specifically need variable interpolation to be done on
that string. This way, we can save the parser the trouble of parsing a bunch of
strings where no interpolation needs to be done. Also, if you are using a string
variable as part of a function call, you do not need to enclose that variable in
quotes. Again, this will just make unnecessary work for the parser. Note,
however, that nearly all of the escape sequences that exist for double-quoted
strings will not work with single-quoted strings. Be careful, and feel free to
break this guideline if it's making your code harder to read.
<BR><BR>&nbsp;&nbsp;&nbsp;Examples:<PRE><FONT size=+1>
/* wrong */
$str = "This is a really long string with no variables for the parser to find.";
do_stuff("$str");
/* right */
$str = 'This is a really long string with no variables for the parser to find.';
do_stuff($str);
</FONT></PRE>
<P></P>
<P><B>Associative array keys:</B> In PHP, it's legal to use a literal string as
a key to an associative array without quoting that string. We don't want to do
this -- the string should always be quoted to avoid confusion. Note that this is
only when we're using a literal, not when we're using a variable.
<BR><BR>&nbsp;&nbsp;&nbsp;Examples:<PRE><FONT size=+1>
/* wrong */
$foo = $assoc_array[blah];
/* right */
$foo = $assoc_array['blah'];
</FONT></PRE>
<P></P>
<P><B>Comments:</B> Each function should be preceded by a comment that tells a
programmer everything they need to know to use that function. The meaning of
every parameter, the expected input, and the output are required as a minimal
comment. The function's behaviour in error conditions (and what those error
conditions are) should also be present. Nobody should have to look at the actual
source of a function in order to be able to call it with confidence in their own
code. <BR><BR>In addition, commenting any tricky, obscure, or otherwise
not-immediately-obvious code is clearly something we should be doing. Especially
important to document are any assumptions your code makes, or preconditions for
its proper operation. Any one of the developers should be able to look at any
part of the application and figure out what's going on in a reasonable amount of
time. </P>
<P><B>Magic numbers:</B> Don't use them. Use named constants for any literal
value other than obvious special cases. Basically, it's OK to check if an array
has 0 elements by using the literal 0. It's not OK to assign some special
meaning to a number and then use it everywhere as a literal. This hurts
readability AND maintainability. Included in this guideline is that we should be
using the constants TRUE and FALSE in place of the literals 1 and 0 -- even
though they have the same values, it's more obvious what the actual logic is
when you use the named constants. </P>
<P><B>Shortcut operators:</B> The only shortcut operators that cause readability
problems are the shortcut increment ($i++) and decrement ($j--) operators. These
operators should not be used as part of an expression. They can, however, be
used on their own line. Using them in expressions is just not worth the
headaches when debugging. <BR><BR>&nbsp;&nbsp;&nbsp;Examples:<PRE><FONT size=+1>
/* wrong */
$array[++$i] = $j;
$array[$i++] = $k;
/* right */
$i++;
$array[$i] = $j;
$array[$i] = $k;
$i++;
</FONT></PRE>
<P></P>
<P><B>Inline conditionals:</B> Inline conditionals should only be used to do
very simple things. Preferably, they will only be used to do assignments, and
not for function calls or anything complex at all. They can be harmful to
readability if used incorrectly, so don't fall in love with saving typing by
using them. <BR><BR>&nbsp;&nbsp;&nbsp;Examples:<PRE><FONT size=+1>
/* Bad place to use them */
(($i &lt; $size) &amp;&amp; ($j &gt; $size)) ? do_stuff($foo) : do_stuff($bar);
/* OK place to use them */
$min = ($i &lt; $j) ? $i : $j;
</FONT></PRE>
<P></P>
<P><B>Don't use uninitialized variables.</B> for phpBB 2, we intend to use a
higher level of run-time error reporting. This will mean that the use of an
uninitialized variable will be reported as an error. This will come up most
often when checking which HTML form variables were passed. These errors can be
avoided by using the built-in isset() function to check whether a variable has
been set. <BR><BR>&nbsp;&nbsp;&nbsp;Examples:<PRE><FONT size=+1>
/* Old way */
if ($forum) ...
/* New way */
if (isset($forum)) ...
</FONT></PRE>
<P></P><BR><BR><A href="#top">Return
to top</A> </FONT></BODY></HTML>

BIN
phpBB/docs/header_bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Some files were not shown because too many files have changed in this diff Show More