Well, here are all my changes ... don't blame me if things break :D

git-svn-id: file:///svn/phpbb/trunk@2923 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-10-04 13:09:10 +00:00
parent b5bbc005a5
commit 30aeac65dc
63 changed files with 2217 additions and 2728 deletions

View file

@ -23,7 +23,7 @@ define('IN_PHPBB', 1);
if( !empty($setmodules) ) if( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('ban') ) if ( !$auth->get_acl_admin('ban') )
{ {
return; return;
} }
@ -46,7 +46,7 @@ require('pagestart.' . $phpEx);
// //
// Do we have ban permissions? // Do we have ban permissions?
// //
if ( !$acl->get_acl_admin('ban') ) if ( !$auth->get_acl_admin('ban') )
{ {
return; return;
} }
@ -74,7 +74,7 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
$ban_list = array_unique(explode("\n", $HTTP_POST_VARS['ban'])); $ban_list = array_unique(explode("\n", $HTTP_POST_VARS['ban']));
$ban_list_log = implode(', ', $ban_list); $ban_list_log = implode(', ', $ban_list);
if ( !empty($HTTP_POST_VARS['banlength']) ) if ( !empty($HTTP_POST_VARS['banlength']) )
{ {
if ( $HTTP_POST_VARS['banlength'] != -1 || empty($HTTP_POST_VARS['banlengthother']) ) if ( $HTTP_POST_VARS['banlength'] != -1 || empty($HTTP_POST_VARS['banlengthother']) )
{ {
@ -107,8 +107,8 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
} }
} }
$sql = "SELECT user_id $sql = "SELECT user_id
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE username IN (" . implode(', ', $banlist_tmp) . ")"; WHERE username IN (" . implode(', ', $banlist_tmp) . ")";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -224,8 +224,8 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
break; break;
} }
$sql = "SELECT $type $sql = "SELECT $type
FROM " . BANLIST_TABLE . " FROM " . BANLIST_TABLE . "
WHERE $type <> ''"; WHERE $type <> ''";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -253,13 +253,13 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
$banlist = array_unique(array_diff($banlist, $banlist_tmp)); $banlist = array_unique(array_diff($banlist, $banlist_tmp));
unset($banlist_tmp); unset($banlist_tmp);
} }
if ( sizeof($banlist) ) if ( sizeof($banlist) )
{ {
for($i = 0; $i < count($banlist); $i++) for($i = 0; $i < count($banlist); $i++)
{ {
$sql = "INSERT INTO " . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_reason) $sql = "INSERT INTO " . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_reason)
VALUES (" . $banlist[$i] . ", $current_time, $ban_end, '$ban_reason')"; VALUES (" . $banlist[$i] . ", $current_time, $ban_end, '$ban_reason')";
$db->sql_query($sql); $db->sql_query($sql);
} }
@ -276,8 +276,8 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
break; break;
case 'email': case 'email':
$sql = "SELECT user_id $sql = "SELECT user_id
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_email IN (" . implode(', ', $banlist) . ")"; WHERE user_email IN (" . implode(', ', $banlist) . ")";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -297,7 +297,7 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
if ( $sql != '' ) if ( $sql != '' )
{ {
$sql = "DELETE FROM " . SESSIONS_TABLE . " $sql = "DELETE FROM " . SESSIONS_TABLE . "
$sql"; $sql";
$db->sql_query($sql); $db->sql_query($sql);
} }
@ -322,7 +322,7 @@ else if ( isset($HTTP_POST_VARS['unbansubmit']) )
if ( $unban_sql != '' ) if ( $unban_sql != '' )
{ {
$sql = "DELETE FROM " . BANLIST_TABLE . " $sql = "DELETE FROM " . BANLIST_TABLE . "
WHERE ban_id IN ($unban_sql)"; WHERE ban_id IN ($unban_sql)";
$db->sql_query($sql); $db->sql_query($sql);
@ -339,8 +339,8 @@ else if ( isset($HTTP_POST_VARS['unbansubmit']) )
// //
// Remove timed out bans // Remove timed out bans
// //
$sql = "DELETE FROM " . BANLIST_TABLE . " $sql = "DELETE FROM " . BANLIST_TABLE . "
WHERE ban_end < " . time() . " WHERE ban_end < " . time() . "
AND ban_end <> 0"; AND ban_end <> 0";
$db->sql_query($sql); $db->sql_query($sql);
@ -387,7 +387,7 @@ switch ( $mode )
case 'user': case 'user':
$sql = "SELECT b.*, u.user_id, u.username $sql = "SELECT b.*, u.user_id, u.username
FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u
WHERE ( b.ban_end >= " . time() . " WHERE ( b.ban_end >= " . time() . "
OR b.ban_end = 0 ) OR b.ban_end = 0 )
AND u.user_id = b.ban_userid AND u.user_id = b.ban_userid
AND b.ban_userid <> 0 AND b.ban_userid <> 0
@ -422,10 +422,10 @@ switch ( $mode )
case 'ip': case 'ip':
$sql = "SELECT * $sql = "SELECT *
FROM " . BANLIST_TABLE . " FROM " . BANLIST_TABLE . "
WHERE ( ban_end >= " . time() . " WHERE ( ban_end >= " . time() . "
OR ban_end = 0 ) OR ban_end = 0 )
AND ban_ip <> ''"; AND ban_ip <> ''";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -456,10 +456,10 @@ switch ( $mode )
case 'email': case 'email':
$sql = "SELECT * $sql = "SELECT *
FROM " . BANLIST_TABLE . " FROM " . BANLIST_TABLE . "
WHERE ( ban_end >= " . time() . " WHERE ( ban_end >= " . time() . "
OR ban_end = 0 ) OR ban_end = 0 )
AND ban_email <> ''"; AND ban_email <> ''";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -496,17 +496,17 @@ switch ( $mode )
<p><?php echo $l_ban_explain; ?></p> <p><?php echo $l_ban_explain; ?></p>
<script language="Javascript" type="text/javascript"> <script language="Javascript" type="text/javascript">
<!-- <!--
var ban_length = new Array(<?php echo $banned_length; ?>); var ban_length = new Array(<?php echo $banned_length; ?>);
var ban_reasons = new Array(<?php echo $banned_reasons; ?>); var ban_reasons = new Array(<?php echo $banned_reasons; ?>);
//--> //-->
</script> </script>
<form 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"> <form 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> <tr>
<th colspan="2"><?php echo $l_ban_title; ?></th> <th colspan="2"><?php echo $l_ban_title; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1" width="45%"><?php echo $l_ban_cell; ?>: </td> <td class="row1" width="45%"><?php echo $l_ban_cell; ?>: </td>
<td class="row1"><textarea cols="40" rows="3" name="ban"></textarea></td> <td class="row1"><textarea cols="40" rows="3" name="ban"></textarea></td>
</tr> </tr>
@ -518,7 +518,7 @@ switch ( $mode )
<td class="row2" width="45%"><?php echo $lang['Ban_reason']; ?>:</td> <td class="row2" width="45%"><?php echo $lang['Ban_reason']; ?>:</td>
<td class="row2"><input type="text" name="banreason" maxlength="255" size="40" /></td> <td class="row2"><input type="text" name="banreason" maxlength="255" size="40" /></td>
</tr> </tr>
<tr> <tr>
<td class="cat" colspan="2" align="center"> <input type="submit" name="bansubmit" value="<?php echo $lang['Submit']; ?>" class="mainoption" />&nbsp; <input type="reset" value="<?php echo $lang['Reset']; ?>" class="liteoption" />&nbsp; <?php echo $s_submit_extra; ?></td> <td class="cat" colspan="2" align="center"> <input type="submit" name="bansubmit" value="<?php echo $lang['Submit']; ?>" class="mainoption" />&nbsp; <input type="reset" value="<?php echo $lang['Reset']; ?>" class="liteoption" />&nbsp; <?php echo $s_submit_extra; ?></td>
</tr> </tr>
</table> </table>
@ -528,14 +528,14 @@ switch ( $mode )
<p><?php echo $l_unban_explain; ?></p> <p><?php echo $l_unban_explain; ?></p>
<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> <table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<th colspan="2"><?php echo $l_unban_title; ?></th> <th colspan="2"><?php echo $l_unban_title; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1" width="45%"><?php echo $l_ban_cell; ?>: <br /></td> <td class="row1" width="45%"><?php echo $l_ban_cell; ?>: <br /></td>
<td class="row1"> <?php if ( $banned_options != '' ) { ?><select name="unban[]" multiple="multiple" size="5"><?php echo $banned_options; ?></select><?php } else { echo $l_no_ban_cell; } ?></td> <td class="row1"> <?php if ( $banned_options != '' ) { ?><select name="unban[]" multiple="multiple" size="5"><?php echo $banned_options; ?></select><?php } else { echo $l_no_ban_cell; } ?></td>
</tr> </tr>
<tr> <tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="unbansubmit" value="<?php echo $lang['Submit']; ?>" class="mainoption" /></td> <td class="cat" colspan="2" align="center"><input type="submit" name="unbansubmit" value="<?php echo $lang['Submit']; ?>" class="mainoption" /></td>
</tr> </tr>
</table></form> </table></form>

View file

@ -21,7 +21,7 @@
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
return; return;
} }
@ -45,7 +45,7 @@ $phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc'); require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx); require('pagestart.' . $phpEx);
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
message_die(MESSAGE, $lang['No_admin']); message_die(MESSAGE, $lang['No_admin']);
} }
@ -325,9 +325,6 @@ switch ( $mode )
$activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? 'checked="checked"' : ''; $activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? 'checked="checked"' : '';
$activation_disable = ( $new['require_activation'] == USER_ACTIVATION_DISABLE ) ? 'checked="checked"' : ''; $activation_disable = ( $new['require_activation'] == USER_ACTIVATION_DISABLE ) ? 'checked="checked"' : '';
$gzip_yes = ( $new['gzip_compress'] ) ? 'checked="checked"' : '';
$gzip_no = ( !$new['gzip_compress'] ) ? 'checked="checked"' : '';
$privmsg_on = ( !$new['privmsg_disable'] ) ? 'checked="checked"' : ''; $privmsg_on = ( !$new['privmsg_disable'] ) ? 'checked="checked"' : '';
$privmsg_off = ( $new['privmsg_disable'] ) ? 'checked="checked"' : ''; $privmsg_off = ( $new['privmsg_disable'] ) ? 'checked="checked"' : '';
@ -347,18 +344,6 @@ switch ( $mode )
<td class="row1"><?php echo $lang['Board_disable']; ?>: <br /><span class="gensmall"><?php echo $lang['Board_disable_explain']; ?></span></td> <td class="row1"><?php echo $lang['Board_disable']; ?>: <br /><span class="gensmall"><?php echo $lang['Board_disable_explain']; ?></span></td>
<td class="row2"><input type="radio" name="board_disable" value="1" <?php echo $disable_board_yes; ?> /> <?php echo $lang['Yes']; ?>&nbsp;&nbsp;<input type="radio" name="board_disable" value="0" <?php echo $disable_board_no; ?> /> <?php echo $lang['No']; ?><br /><input type="text" name="board_disable_msg" maxlength="255" size="40" value="<?php echo $new['board_disable_msg']; ?>" /></td> <td class="row2"><input type="radio" name="board_disable" value="1" <?php echo $disable_board_yes; ?> /> <?php echo $lang['Yes']; ?>&nbsp;&nbsp;<input type="radio" name="board_disable" value="0" <?php echo $disable_board_no; ?> /> <?php echo $lang['No']; ?><br /><input type="text" name="board_disable_msg" maxlength="255" size="40" value="<?php echo $new['board_disable_msg']; ?>" /></td>
</tr> </tr>
<tr>
<td class="row1"><?php echo $lang['Limit_load']; ?>: <br /><span class="gensmall"><?php echo $lang['Limit_load_explain']; ?></span></td>
<td class="row2"><input type="text" size="4" maxlength="4" name="limit_load" value="<?php echo $new['limit_load']; ?>" /></td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Limit_sessions']; ?>: <br /><span class="gensmall"><?php echo $lang['Limit_sessions_explain']; ?></span></td>
<td class="row2"><input type="text" size="4" maxlength="4" name="active_sessions" value="<?php echo $new['active_sessions']; ?>" /></td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Enable_gzip']; ?>: </td>
<td class="row2"><input type="radio" name="gzip_compress" value="1" <?php echo $gzip_yes; ?> /> <?php echo $lang['Yes']; ?>&nbsp;&nbsp;<input type="radio" name="gzip_compress" value="0" <?php echo $gzip_no; ?> /> <?php echo $lang['No']; ?></td>
</tr>
<tr> <tr>
<td class="row1"><?php echo $lang['Enable_prune']; ?>: </td> <td class="row1"><?php echo $lang['Enable_prune']; ?>: </td>
<td class="row2"><input type="radio" name="prune_enable" value="1" <?php echo $prune_yes; ?> /> <?php echo $lang['Yes']; ?>&nbsp;&nbsp;<input type="radio" name="prune_enable" value="0" <?php echo $prune_no; ?> /> <?php echo $lang['No']; ?></td> <td class="row2"><input type="radio" name="prune_enable" value="1" <?php echo $prune_yes; ?> /> <?php echo $lang['Yes']; ?>&nbsp;&nbsp;<input type="radio" name="prune_enable" value="0" <?php echo $prune_no; ?> /> <?php echo $lang['No']; ?></td>
@ -407,14 +392,6 @@ switch ( $mode )
<td class="row1"><?php echo $lang['Max_search_chars']; ?>: <br /><span class="gensmall"><?php echo $lang['Max_search_chars_explain']; ?></span</td> <td class="row1"><?php echo $lang['Max_search_chars']; ?>: <br /><span class="gensmall"><?php echo $lang['Max_search_chars_explain']; ?></span</td>
<td class="row2"><input type="text" size="3" maxlength="3" name="max_search_chars" value="<?php echo $new['max_search_chars']; ?>" /></td> <td class="row2"><input type="text" size="3" maxlength="3" name="max_search_chars" value="<?php echo $new['max_search_chars']; ?>" /></td>
</tr> </tr>
<tr>
<td class="row1"><?php echo $lang['Smilies_path']; ?>: <br /><span class="gensmall"><?php echo $lang['Smilies_path_explain']; ?></span></td>
<td class="row2"><input type="text" size="20" maxlength="255" name="smilies_path" value="<?php echo $new['smilies_path']; ?>" /></td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Icons_path']; ?>: <br /><span class="gensmall"><?php echo $lang['Icons_path_explain']; ?></span></td>
<td class="row2"><input type="text" size="20" maxlength="255" name="icons_path" value="<?php echo $new['icons_path']; ?>" /></td>
</tr>
<tr> <tr>
<td class="row1"><?php echo $lang['Topics_per_page']; ?>: </td> <td class="row1"><?php echo $lang['Topics_per_page']; ?>: </td>
<td class="row2"><input type="text" name="topics_per_page" size="3" maxlength="4" value="<?php echo $new['topics_per_page']; ?>" /></td> <td class="row2"><input type="text" name="topics_per_page" size="3" maxlength="4" value="<?php echo $new['topics_per_page']; ?>" /></td>
@ -485,6 +462,13 @@ switch ( $mode )
case 'server': case 'server':
$ip_all = ( $new['ip_check'] == 4 ) ? 'checked="checked"' : '';
$ip_classc = ( $new['ip_check'] == 3 ) ? 'checked="checked"' : '';
$ip_classb = ( $new['ip_check'] == 2 ) ? 'checked="checked"' : '';
$ip_none = ( $new['ip_check'] == 0 ) ? 'checked="checked"' : '';
$gzip_yes = ( $new['gzip_compress'] ) ? 'checked="checked"' : '';
$gzip_no = ( !$new['gzip_compress'] ) ? 'checked="checked"' : '';
?> ?>
<tr> <tr>
<td class="row1"><?php echo $lang['Server_name']; ?>: <br /><span class="gensmall"><?php echo $lang['Server_name_explain']; ?></span></td> <td class="row1"><?php echo $lang['Server_name']; ?>: <br /><span class="gensmall"><?php echo $lang['Server_name_explain']; ?></span></td>
@ -498,6 +482,30 @@ switch ( $mode )
<td class="row1"><?php echo $lang['Script_path']; ?>: <br /><span class="gensmall"><?php echo $lang['Script_path_explain']; ?></span></td> <td class="row1"><?php echo $lang['Script_path']; ?>: <br /><span class="gensmall"><?php echo $lang['Script_path_explain']; ?></span></td>
<td class="row2"><input type="text" maxlength="255" name="script_path" value="<?php echo $new['script_path']; ?>" /></td> <td class="row2"><input type="text" maxlength="255" name="script_path" value="<?php echo $new['script_path']; ?>" /></td>
</tr> </tr>
<tr>
<td class="row1"><?php echo $lang['IP_valid']; ?>: <br /><span class="gensmall"><?php echo $lang['IP_valid_explain']; ?></span></td>
<td class="row2"><input type="radio" name="ip_check" value="4" <?php echo $ip_all; ?> /> <?php echo $lang['All']; ?>&nbsp;&nbsp;<input type="radio" name="ip_check" value="3" <?php echo $ip_classc; ?> /> <?php echo $lang['Class_C']; ?>&nbsp;&nbsp;<input type="radio" name="ip_check" value="2" <?php echo $ip_classb; ?> /> <?php echo $lang['Class_B']; ?>&nbsp;&nbsp;<input type="radio" name="ip_check" value="0" <?php echo $ip_none; ?> /> <?php echo $lang['None']; ?>&nbsp;&nbsp;</td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Limit_load']; ?>: <br /><span class="gensmall"><?php echo $lang['Limit_load_explain']; ?></span></td>
<td class="row2"><input type="text" size="4" maxlength="4" name="limit_load" value="<?php echo $new['limit_load']; ?>" /></td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Limit_sessions']; ?>: <br /><span class="gensmall"><?php echo $lang['Limit_sessions_explain']; ?></span></td>
<td class="row2"><input type="text" size="4" maxlength="4" name="active_sessions" value="<?php echo $new['active_sessions']; ?>" /></td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Enable_gzip']; ?>: </td>
<td class="row2"><input type="radio" name="gzip_compress" value="1" <?php echo $gzip_yes; ?> /> <?php echo $lang['Yes']; ?>&nbsp;&nbsp;<input type="radio" name="gzip_compress" value="0" <?php echo $gzip_no; ?> /> <?php echo $lang['No']; ?></td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Smilies_path']; ?>: <br /><span class="gensmall"><?php echo $lang['Smilies_path_explain']; ?></span></td>
<td class="row2"><input type="text" size="20" maxlength="255" name="smilies_path" value="<?php echo $new['smilies_path']; ?>" /></td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Icons_path']; ?>: <br /><span class="gensmall"><?php echo $lang['Icons_path_explain']; ?></span></td>
<td class="row2"><input type="text" size="20" maxlength="255" name="icons_path" value="<?php echo $new['icons_path']; ?>" /></td>
</tr>
<?php <?php
break; break;
@ -513,7 +521,7 @@ switch ( $mode )
$dp = opendir($phpbb_root_path . 'includes/auth'); $dp = opendir($phpbb_root_path . 'includes/auth');
while ( $file = readdir($dp) ) while ( $file = readdir($dp) )
{ {
if ( preg_match('/^auth_(.*?)\.' . $phpEx . '$/', $file) ) if ( preg_match('/^auth_(.*?)\.' . $phpEx . '$/', $file) )
{ {
$auth_plugins[] = preg_replace('/^auth_(.*?)\.' . $phpEx . '$/', '\1', $file); $auth_plugins[] = preg_replace('/^auth_(.*?)\.' . $phpEx . '$/', '\1', $file);
} }
@ -534,7 +542,7 @@ switch ( $mode )
<td class="row2"><select name="auth_method"><?php echo $auth_select; ?></select></td> <td class="row2"><select name="auth_method"><?php echo $auth_select; ?></select></td>
</tr> </tr>
<?php <?php
foreach ( $auth_plugins as $method ) foreach ( $auth_plugins as $method )
{ {
if ( $method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx) ) if ( $method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx) )
@ -553,7 +561,7 @@ switch ( $mode )
{ {
if ( !isset($board_config[$field]) ) if ( !isset($board_config[$field]) )
{ {
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) $sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('$field', '')"; VALUES ('$field', '')";
$db->sql_query($sql); $db->sql_query($sql);
} }

View file

@ -1,6 +1,6 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* admin_db_utilities.php * admin_database.php
* ------------------- * -------------------
* begin : Thu May 31, 2001 * begin : Thu May 31, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
@ -18,17 +18,14 @@
* (at your option) any later version. * (at your option) any later version.
* *
***************************************************************************/ ***************************************************************************/
//
// Some functions are adapted phpMyAdmin 2.2.0.
//
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
return; return;
} }
$filename = basename(__FILE__); $filename = basename(__FILE__);
$module['DB']['DB_Backup'] = $filename . "$SID&amp;mode=backup"; $module['DB']['DB_Backup'] = $filename . "$SID&amp;mode=backup";
@ -51,9 +48,9 @@ require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
// //
// Do we have DB backup/restore permissions?
// //
// if ( !$auth->get_acl_admin('general') )
if ( !$acl->get_acl_admin('general') )
{ {
message_die(MESSAGE, $lang['No_admin']); message_die(MESSAGE, $lang['No_admin']);
} }
@ -64,46 +61,43 @@ if ( !$acl->get_acl_admin('general') )
// //
@set_time_limit(1200); @set_time_limit(1200);
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : '';
// //
// Begin program proper // Begin program proper
// //
switch( $mode )
if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{ {
$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; case 'backup':
switch( $mode ) if ( SQL_LAYER == 'oracle' || SQL_LAYER == 'odbc' || SQL_LAYER == 'mssql' )
{ {
case 'backup': switch ( SQL_LAYER )
if ( SQL_LAYER == 'oracle' || SQL_LAYER == 'odbc' || SQL_LAYER == 'mssql' )
{ {
switch ( SQL_LAYER ) case 'oracle':
{ $db_type = 'Oracle';
case 'oracle': break;
$db_type = 'Oracle'; case 'odbc':
break; $db_type = 'ODBC';
case 'odbc': break;
$db_type = 'ODBC'; case 'mssql':
break; $db_type = 'MSSQL';
case 'mssql': break;
$db_type = 'MSSQL';
break;
}
message_die(MESSAGE, $lang['Backups_not_supported']);
break;
} }
$additional_tables = ( isset($HTTP_POST_VARS['tables']) ) ? $HTTP_POST_VARS['tables'] : ( ( isset($HTTP_GET_VARS['tables']) ) ? $HTTP_GET_VARS['tables'] : '' ); message_die(MESSAGE, $lang['Backups_not_supported']);
$backup_type = ( isset($HTTP_POST_VARS['type']) ) ? $HTTP_POST_VARS['type'] : ( ( isset($HTTP_GET_VARS['type']) ) ? $HTTP_GET_VARS['type'] : '' ); break;
$search = ( !empty($HTTP_POST_VARS['search']) ) ? intval($HTTP_POST_VARS['search']) : ( ( !empty($HTTP_GET_VARS['search']) ) ? intval($HTTP_GET_VARS['search']) : 0 ); }
$store_path = ( isset($HTTP_POST_VARS['store']) ) ? $HTTP_POST_VARS['store'] : ( ( isset($HTTP_GET_VARS['store']) ) ? $HTTP_GET_VARS['store'] : '' );
$compress = ( !empty($HTTP_POST_VARS['compress']) ) ? $HTTP_POST_VARS['compress'] : ( ( !empty($HTTP_GET_VARS['compress']) ) ? $HTTP_GET_VARS['compress'] : 'none' );
if ( !isset($HTTP_POST_VARS['backupstart']) && !isset($HTTP_GET_VARS['backupstart']) ) $additional_tables = ( isset($HTTP_POST_VARS['tables']) ) ? $HTTP_POST_VARS['tables'] : ( ( isset($HTTP_GET_VARS['tables']) ) ? $HTTP_GET_VARS['tables'] : '' );
{ $backup_type = ( isset($HTTP_POST_VARS['type']) ) ? $HTTP_POST_VARS['type'] : ( ( isset($HTTP_GET_VARS['type']) ) ? $HTTP_GET_VARS['type'] : '' );
page_header($lang['DB_Backup']); $search = ( !empty($HTTP_POST_VARS['search']) ) ? intval($HTTP_POST_VARS['search']) : ( ( !empty($HTTP_GET_VARS['search']) ) ? intval($HTTP_GET_VARS['search']) : 0 );
$store_path = ( isset($HTTP_POST_VARS['store']) ) ? $HTTP_POST_VARS['store'] : ( ( isset($HTTP_GET_VARS['store']) ) ? $HTTP_GET_VARS['store'] : '' );
$compress = ( !empty($HTTP_POST_VARS['compress']) ) ? $HTTP_POST_VARS['compress'] : ( ( !empty($HTTP_GET_VARS['compress']) ) ? $HTTP_GET_VARS['compress'] : 'none' );
if ( !isset($HTTP_POST_VARS['backupstart']) && !isset($HTTP_GET_VARS['backupstart']) )
{
page_header($lang['DB_Backup']);
?> ?>
@ -132,35 +126,35 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
<td class="row2"><input type="text" name="store" size="40" /></td> <td class="row2"><input type="text" name="store" size="40" /></td>
</tr> </tr>
<?php <?php
if ( extension_loaded('zlib') || extension_loaded('bz2') ) if ( extension_loaded('zlib') || extension_loaded('bz2') )
{ {
?> ?>
<tr> <tr>
<td class="row1"><?php echo $lang['Compress_file']; ?>: </td> <td class="row1"><?php echo $lang['Compress_file']; ?>: </td>
<td class="row2"><input type="radio" name="compress" value="none" checked="checked" /> <?php echo $lang['None']; ?><?php <td class="row2"><input type="radio" name="compress" value="none" checked="checked" /> <?php echo $lang['None']; ?><?php
if ( extension_loaded('zlib') ) 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 ?>&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') ) }
{
if ( extension_loaded('bz2') )
{
?>&nbsp;&nbsp;<input type="radio" name="compress" value="bzip" />.bz2<?php ?>&nbsp;&nbsp;<input type="radio" name="compress" value="bzip" />.bz2<?php
} }
?></td> ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
<tr> <tr>
@ -170,229 +164,232 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
<?php <?php
break; break;
}
else if ( !isset($HTTP_POST_VARS['startdownload']) && !isset($HTTP_GET_VARS['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) ) ? $lang['Backup_download'] : $lang['Backup_writing'];
else if ( !isset($HTTP_POST_VARS['startdownload']) && !isset($HTTP_GET_VARS['startdownload']) )
page_header($lang['DB_Backup'], $meta);
page_message($lang['DB_Backup'], $message);
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++)
{ {
$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\">"; $tables[] = trim($additional_tables[$i]);
$message = ( empty($store_path) ) ? $lang['Backup_download'] : $lang['Backup_writing'];
page_header($lang['DB_Backup'], $meta);
page_message($lang['DB_Backup'], $message);
page_footer();
} }
unset($additional_tables);
}
$tables = ( SQL_LAYER != 'postgresql' ) ? mysql_get_tables() : pg_get_tables(); //
@sort($tables); // Enable output buffering
//
@ob_start();
@ob_implicit_flush(0);
if ( !empty($additional_tables) ) //
// 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' )
{ {
$additional_tables = explode(',', $additional_tables); $table_def_function = "get_table_def_" . SQL_LAYER;
$table_content_function = "get_table_content_" . SQL_LAYER;
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->addFile(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();
}
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 else
{ {
if ( !($fp = fopen('./../' . $store_path . "/phpbb_db_backup.$extension", 'wb')) ) $table_def_function = "get_table_def_mysql";
{ $table_content_function = "get_table_content_mysql";
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);
message_die(MESSAGE, $lang['Backup_success']);
} }
exit; if ( $backup_type != 'data' )
break; {
echo "#\n# TABLE: " . $table_name . "\n#\n";
echo $table_def_function($table_name, "\n") . "\n";
}
case 'restore': if ( $backup_type != 'structure' )
if ( isset($HTTP_POST_VARS['restorestart']) )
{ {
// //
// Handle the file upload .... // Skip search table data?
// If no file was uploaded report an error...
// //
if ( !empty($HTTP_POST_VARS['local']) ) if ( $search || ( !$search && !preg_match('/search_word/', $table_name) ) )
{ {
$file_tmpname = './../' . str_replace('\\\\', '/', $HTTP_POST_VARS['local']); $table_content_function($table_name, "output_table_content");
$filename = substr($file_tmpname, strrpos($file_tmpname, '/'));
}
else
{
$filename = ( !empty($HTTP_POST_FILES['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) ) //
{ // Flush the buffer, send the file
message_die(MESSAGE, $lang['Restore_Error_no_file']); //
} switch ( $compress )
{
case 'gzip':
$extension = 'sql.gz';
$contents = gzencode(ob_get_contents());
ob_end_clean();
break;
$ext = substr($filename, strrpos($filename, '.') + 1); case 'zip':
$extension = 'zip';
$zip = new zipfile;
$zip->addFile(ob_get_contents(), "phpbb_db_backup.sql", time());
ob_end_clean();
$contents = $zip->file();
break;
if ( !preg_match('/^(sql|gz|bz2)$/', $ext) ) case 'bzip':
{ $extension = 'bz2';
message_die(MESSAGE, $lang['Restore_Error_filename']); $contents = bzcompress(ob_get_contents());
} ob_end_clean();
break;
if ( ( !extension_loaded('zlib') && $ext == 'gz' ) || ( !extension_loaded('zip') && $ext == 'zip' ) || ( $ext == 'bz2' && !extension_loaded('bz2') ) ) default:
{ $extension = 'sql';
message_die(MESSAGE, $lang['Compress_unsupported']); $contents = ob_get_contents();
} ob_end_clean();
}
$sql_query = ''; add_admin_log('log_db_backup');
switch ( $ext )
{
case 'gz':
$fp = gzopen($file_tmpname, 'rb');
while ( !gzeof($fp) )
{
$sql_query .= gzgets($fp, 100000);
}
gzclose($fp);
break;
case 'bz2': if ( empty($store_path) )
$sql_query = bzdecompress(fread(fopen($file_tmpname, 'rb'), filesize($file_tmpname))); {
break; header("Pragma: no-cache");
header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.$extension\"");
header("Content-disposition: attachment; filename=phpbb_db_backup.$extension");
default; echo $contents;
$sql_query = fread(fopen($file_tmpname, 'r'), filesize($file_tmpname)); unset($contents);
} }
else
if ( $sql_query != '' ) {
{ if ( !($fp = fopen('./../' . $store_path . "/phpbb_db_backup.$extension", 'wb')) )
// Strip out sql comments... {
$sql_query = remove_remarks($sql_query); message_die(ERROR, 'Could not open backup file');
$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);
}
}
}
message_die(MESSAGE, $lang['Restore_success']);
} }
if ( !fwrite($fp, $contents) )
{
message_die(ERROR, 'Could not write backup file content');
}
fclose($fp);
unset($contents);
message_die(MESSAGE, $lang['Backup_success']);
}
exit;
break;
case 'restore':
if ( isset($HTTP_POST_VARS['restorestart']) )
{
// //
// Restore page // Handle the file upload ....
// If no file was uploaded report an error...
// //
page_header($lang['DB_Restore']); if ( !empty($HTTP_POST_VARS['local']) )
{
$file_tmpname = './../' . str_replace('\\\\', '/', $HTTP_POST_VARS['local']);
$filename = substr($file_tmpname, strrpos($file_tmpname, '/'));
}
else
{
$filename = ( !empty($HTTP_POST_FILES['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) )
{
message_die(MESSAGE, $lang['Restore_Error_no_file']);
}
$ext = substr($filename, strrpos($filename, '.') + 1);
if ( !preg_match('/^(sql|gz|bz2)$/', $ext) )
{
message_die(MESSAGE, $lang['Restore_Error_filename']);
}
if ( ( !extension_loaded('zlib') && $ext == 'gz' ) || ( !extension_loaded('zip') && $ext == 'zip' ) || ( $ext == 'bz2' && !extension_loaded('bz2') ) )
{
message_die(MESSAGE, $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;
default;
$sql_query = fread(fopen($file_tmpname, 'r'), filesize($file_tmpname));
}
if ( $sql_query != '' )
{
// Strip out sql comments...
$sql_query = 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_admin_log('log_db_restore');
message_die(MESSAGE, $lang['Restore_success']);
}
//
// Restore page
//
page_header($lang['DB_Restore']);
?> ?>
@ -404,21 +401,21 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
<th colspan="2"><?php echo $lang['Select_file']; ?></th> <th colspan="2"><?php echo $lang['Select_file']; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $lang['Upload_file']; ?>: <br /><span class="gensmall"><?php <td class="row1"><?php echo $lang['Upload_file']; ?>: <br /><span class="gensmall"><?php
echo $lang['Supported_extensions'];
$types = ': <u>sql</u>'; echo $lang['Supported_extensions'];
if ( extension_loaded('zlib') )
{
$types .= ', <u>sql.gz</u>';
}
if ( extension_loaded('bz2') )
{
$types .= ', <u>bz2</u>';
}
echo $types; $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> ?></span></td>
<td class="row2"><input type="file" name="backup_file" /></td> <td class="row2"><input type="file" name="backup_file" /></td>
@ -434,7 +431,11 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
<?php <?php
} break;
default:
exit;
} }
page_footer(); page_footer();
@ -1030,7 +1031,7 @@ function output_table_content($content)
// Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier Müller, Loïc Chapeaux, Marc Delisle // Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier Müller, Loïc Chapeaux, Marc Delisle
// http://www.phpmyadmin.net/ // http://www.phpmyadmin.net/
// //
// Based on work by Eric Mueller and Denis125 // Based on work by Eric Mueller and Denis125
// Official ZIP file format: http://www.pkware.com/appnote.txt // Official ZIP file format: http://www.pkware.com/appnote.txt
// //
class zipfile class zipfile
@ -1138,7 +1139,7 @@ class zipfile
pack('V', strlen($ctrldir)) . // size of central dir pack('V', strlen($ctrldir)) . // size of central dir
pack('V', strlen($data)) . // offset to start of central dir pack('V', strlen($data)) . // offset to start of central dir
"\x00\x00"; // .zip file comment length "\x00\x00"; // .zip file comment length
} }
} }

View file

@ -23,7 +23,7 @@ define('IN_PHPBB', 1);
if( !empty($setmodules) ) if( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('user') ) if ( !$auth->get_acl_admin('user') )
{ {
return; return;
} }
@ -45,7 +45,7 @@ require('pagestart.' . $phpEx);
// //
// Do we have user admin permissions? // Do we have user admin permissions?
// //
if ( !$acl->get_acl_admin('user') ) if ( !$auth->get_acl_admin('user') )
{ {
return; return;
} }
@ -63,7 +63,7 @@ if( isset($HTTP_POST_VARS['add_name']) )
} }
else else
{ {
$sql = "INSERT INTO " . DISALLOW_TABLE . " (disallow_username) $sql = "INSERT INTO " . DISALLOW_TABLE . " (disallow_username)
VALUES('" . str_replace("\'", "''", $disallowed_user) . "')"; VALUES('" . str_replace("\'", "''", $disallowed_user) . "')";
$result = $db->sql_query( $sql ); $result = $db->sql_query( $sql );
@ -79,8 +79,8 @@ if( isset($HTTP_POST_VARS['add_name']) )
else if( isset($HTTP_POST_VARS['delete_name']) ) 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'] ); $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 . " $sql = "DELETE FROM " . DISALLOW_TABLE . "
WHERE disallow_id = $disallowed_id"; WHERE disallow_id = $disallowed_id";
$db->sql_query($sql); $db->sql_query($sql);
@ -95,7 +95,7 @@ else if( isset($HTTP_POST_VARS['delete_name']) )
// //
// Grab the current list of disallowed usernames... // Grab the current list of disallowed usernames...
// //
$sql = "SELECT * $sql = "SELECT *
FROM " . DISALLOW_TABLE; FROM " . DISALLOW_TABLE;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -121,17 +121,17 @@ page_header($lang['Users']);
<p><?php echo $lang['Disallow_explain']; ?></p> <p><?php echo $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"> <form method="post" action="<?php echo "admin_disallow.$phpEx$SID"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<th colspan="2"><?php echo $lang['Add_disallow_title']; ?></th> <th colspan="2"><?php echo $lang['Add_disallow_title']; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $lang['Username']; ?><br /><span class="gensmall"><?php echo $lang['Add_disallow_explain']; ?></span></td> <td class="row1"><?php echo $lang['Username']; ?><br /><span class="gensmall"><?php echo $lang['Add_disallow_explain']; ?></span></td>
<td class="row2"><input type="text" name="disallowed_user" size="30" />&nbsp;<input type="submit" name="add_name" value="<?php echo $lang['Add_disallow']; ?>" class="mainoption" /></td> <td class="row2"><input type="text" name="disallowed_user" size="30" />&nbsp;<input type="submit" name="add_name" value="<?php echo $lang['Add_disallow']; ?>" class="mainoption" /></td>
</tr> </tr>
<tr> <tr>
<th colspan="2"><?php echo $lang['Delete_disallow_title']; ?></th> <th colspan="2"><?php echo $lang['Delete_disallow_title']; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $lang['Username']; ?><br /><span class="gensmall"><?php echo $lang['Delete_disallow_explain']; ?></span></td> <td class="row1"><?php echo $lang['Username']; ?><br /><span class="gensmall"><?php echo $lang['Delete_disallow_explain']; ?></span></td>
<td class="row2"><?php if ( $disallow_select != '' ) { ?><select name="disallowed_id"><?php echo $disallow_select; ?></select>&nbsp;<input type="submit" name="delete_name" value="<?php echo $lang['Delete']; ?>" class="liteoption" /><?php } else { echo $lang['No_disallowed']; } ?></td> <td class="row2"><?php if ( $disallow_select != '' ) { ?><select name="disallowed_id"><?php echo $disallow_select; ?></select>&nbsp;<input type="submit" name="delete_name" value="<?php echo $lang['Delete']; ?>" class="liteoption" /><?php } else { echo $lang['No_disallowed']; } ?></td>
</tr> </tr>

View file

@ -21,14 +21,14 @@
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
return; return;
} }
$filename = basename(__FILE__); $filename = basename(__FILE__);
$module['General']['Mass_Email'] = $filename . $SID; $module['General']['Mass_Email'] = $filename . $SID;
return; return;
} }
@ -43,14 +43,14 @@ require('pagestart.' . $phpEx);
// //
// Do we have general admin permissions? // Do we have general admin permissions?
// //
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
return; return;
} }
// //
// Set some vars // Set some vars
// //
$message = ''; $message = '';
$subject = ''; $subject = '';
@ -80,7 +80,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
$subject = stripslashes($HTTP_POST_VARS['subject']); $subject = stripslashes($HTTP_POST_VARS['subject']);
$message = stripslashes($HTTP_POST_VARS['message']); $message = stripslashes($HTTP_POST_VARS['message']);
// //
// Error checking needs to go here ... if no subject and/or // Error checking needs to go here ... if no subject and/or
// no message then skip over the send and return to the form // no message then skip over the send and return to the form
@ -102,7 +102,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
$board_config['smtp_host'] = get_cfg_var('SMTP'); $board_config['smtp_host'] = get_cfg_var('SMTP');
} }
$emailer = new emailer($board_config['smtp_delivery']); $emailer = new emailer($board_config['smtp_delivery']);
$email_headers = 'From: ' . $board_config['board_email'] . "\n"; $email_headers = 'From: ' . $board_config['board_email'] . "\n";
$bcc_list = ''; $bcc_list = '';
@ -111,7 +111,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
$bcc_list .= ( ( $bcc_list != '' ) ? ', ' : '' ) . $email_list[$i]['user_email']; $bcc_list .= ( ( $bcc_list != '' ) ? ', ' : '' ) . $email_list[$i]['user_email'];
} }
$email_headers .= "Bcc: $bcc_list\n"; $email_headers .= "Bcc: $bcc_list\n";
$email_headers .= 'Return-Path: ' . $userdata['board_email'] . "\n"; $email_headers .= 'Return-Path: ' . $userdata['board_email'] . "\n";
$email_headers .= 'X-AntiAbuse: Board servername - ' . $server_name . "\n"; $email_headers .= 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n"; $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
@ -124,8 +124,8 @@ if ( isset($HTTP_POST_VARS['submit']) )
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'], 'SITENAME' => $board_config['sitename'],
'BOARD_EMAIL' => $board_config['board_email'], 'BOARD_EMAIL' => $board_config['board_email'],
'MESSAGE' => $message) 'MESSAGE' => $message)
); );
@ -134,13 +134,13 @@ if ( isset($HTTP_POST_VARS['submit']) )
message_die(MESSAGE, $lang['Email_sent']); message_die(MESSAGE, $lang['Email_sent']);
} }
} }
// //
// Initial selection // Initial selection
// //
$sql = "SELECT group_id, group_name $sql = "SELECT group_id, group_name
FROM ".GROUPS_TABLE; FROM ".GROUPS_TABLE;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -164,22 +164,22 @@ page_header($lang['Mass_Email']);
<p><?php echo $lang['Mass_email_explain']; ?></p> <p><?php echo $lang['Mass_email_explain']; ?></p>
<form method="post" action="<?php echo "admin_mass_email.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1"> <form method="post" action="<?php echo "admin_mass_email.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1">
<tr> <tr>
<th colspan="2"><?php echo $lang['Compose']; ?></th> <th colspan="2"><?php echo $lang['Compose']; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1" align="right"><b><?php echo $lang['Recipients']; ?></b></td> <td class="row1" align="right"><b><?php echo $lang['Recipients']; ?></b></td>
<td class="row2" align="left"><?php echo $select_list; ?></td> <td class="row2" align="left"><?php echo $select_list; ?></td>
</tr> </tr>
<tr> <tr>
<td class="row1" align="right"><b><?php echo $lang['Subject']; ?></b></td> <td class="row1" align="right"><b><?php echo $lang['Subject']; ?></b></td>
<td class="row2"><span class="gen"><input type="text" name="subject" size="45" maxlength="100" tabindex="2" class="post" value="<?php echo $subject; ?>" /></span></td> <td class="row2"><span class="gen"><input type="text" name="subject" size="45" maxlength="100" tabindex="2" class="post" value="<?php echo $subject; ?>" /></span></td>
</tr> </tr>
<tr> <tr>
<td class="row1" align="right" valign="top"><span class="gen"><b><?php echo $lang['Message']; ?></b></span> <td class="row1" align="right" valign="top"><span class="gen"><b><?php echo $lang['Message']; ?></b></span>
<td class="row2"><textarea class="post" name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3"><?php echo $message; ?></textarea></td> <td class="row2"><textarea class="post" name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3"><?php echo $message; ?></textarea></td>
</tr> </tr>
<tr> <tr>
<td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $lang['Email']; ?>" name="submit" class="mainoption" /></td> <td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $lang['Email']; ?>" name="submit" class="mainoption" /></td>
</tr> </tr>
</table></form> </table></form>

View file

@ -21,7 +21,7 @@
if (!empty($setmodules)) if (!empty($setmodules))
{ {
if (!$acl->get_acl_admin('forum')) if (!$auth->get_acl_admin('forum'))
{ {
return; return;
} }
@ -43,7 +43,7 @@ include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
// //
// Do we have forum admin permissions? // Do we have forum admin permissions?
// //
if (!$acl->get_acl_admin('forum')) if (!$auth->get_acl_admin('forum'))
{ {
message_die(MESSAGE, $lang['No_admin']); message_die(MESSAGE, $lang['No_admin']);
} }
@ -535,7 +535,7 @@ switch ($mode)
</tr> </tr>
</table> </table>
</form> </form>
<br clear="all" /> <br clear="all" />
<?php <?php
@ -562,10 +562,10 @@ switch ($mode)
<form action="admin_forums.<?php echo $phpEx . $SID ?>&mode=remove&f=<?php echo $forum_id ?>" method="post"> <form action="admin_forums.<?php echo $phpEx . $SID ?>&mode=remove&f=<?php echo $forum_id ?>" method="post">
<table cellpadding="4" cellspacing="1" border="0" class="forumline" align="center"> <table cellpadding="4" cellspacing="1" border="0" class="forumline" align="center">
<tr> <tr>
<th colspan="2" class="thHead"><?php echo $lang['Forum_delete'] ?></th> <th colspan="2" class="thHead"><?php echo $lang['Forum_delete'] ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo ($forum_status == ITEM_CATEGORY) ? $lang['Category_name'] : $lang['Forum_name'] ?></td> <td class="row1"><?php echo ($forum_status == ITEM_CATEGORY) ? $lang['Category_name'] : $lang['Forum_name'] ?></td>
<td class="row1"><span class="row1"><?php echo $forum_name ?></span></td> <td class="row1"><span class="row1"><?php echo $forum_name ?></span></td>
</tr> </tr>
@ -573,11 +573,11 @@ switch ($mode)
if ($forum_status != ITEM_CATEGORY) if ($forum_status != ITEM_CATEGORY)
{ {
?> ?>
<tr> <tr>
<td class="row1"><?php echo $lang['Action'] ?></td> <td class="row1"><?php echo $lang['Action'] ?></td>
<td class="row1"><input type="radio" name="action_posts" value="delete" checked="checked" /> <?php echo $lang['Delete_all_posts'] ?></td> <td class="row1"><input type="radio" name="action_posts" value="delete" checked="checked" /> <?php echo $lang['Delete_all_posts'] ?></td>
</tr> </tr>
<tr> <tr>
<td class="row1"></td> <td class="row1"></td>
<td class="row1"><input type="radio" name="action_posts" value="move" /> <?php echo $lang['Move_posts_to'] ?> <select name="posts_to_id" ?><option value="0"></option><?php echo $move_posts_list ?></select></td> <td class="row1"><input type="radio" name="action_posts" value="move" /> <?php echo $lang['Move_posts_to'] ?> <select name="posts_to_id" ?><option value="0"></option><?php echo $move_posts_list ?></select></td>
</tr> </tr>
@ -586,18 +586,18 @@ switch ($mode)
if ($right_id - $left_id > 1) if ($right_id - $left_id > 1)
{ {
?> ?>
<tr> <tr>
<td class="row1"><?php echo $lang['Action'] ?></td> <td class="row1"><?php echo $lang['Action'] ?></td>
<td class="row1"><input type="radio" name="action_subforums" value="delete" checked="checked" /> <?php echo $lang['Delete_subforums'] ?></td> <td class="row1"><input type="radio" name="action_subforums" value="delete" checked="checked" /> <?php echo $lang['Delete_subforums'] ?></td>
</tr> </tr>
<tr> <tr>
<td class="row1"></td> <td class="row1"></td>
<td class="row1"><input type="radio" name="action_subforums" value="move" /> <?php echo $lang['Move_subforums_to'] ?> <select name="subforums_to_id" ?><option value="0"></option><?php echo $forums_list ?></select></td> <td class="row1"><input type="radio" name="action_subforums" value="move" /> <?php echo $lang['Move_subforums_to'] ?> <select name="subforums_to_id" ?><option value="0"></option><?php echo $forums_list ?></select></td>
</tr> </tr>
<?php <?php
} }
?> ?>
<tr> <tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="submit" value="<?php echo $lang['Move_and_Delete'] ?>" class="mainoption" /></td> <td class="cat" colspan="2" align="center"><input type="submit" name="submit" value="<?php echo $lang['Move_and_Delete'] ?>" class="mainoption" /></td>
</tr> </tr>
</table> </table>
@ -705,7 +705,7 @@ while ($row = $db->sql_fetchrow($result))
$forum_title = htmlspecialchars($sub_row['forum_name']); $forum_title = htmlspecialchars($sub_row['forum_name']);
$forum_desc = htmlspecialchars($sub_row['forum_desc']); $forum_desc = htmlspecialchars($sub_row['forum_desc']);
$subforums = ($sub_row['right_id'] - $sub_row['left_id'] - 1) / 2; $subforums = ($sub_row['right_id'] - $sub_row['left_id'] - 1) / 2;
if ($sub_row['forum_status'] != ITEM_CATEGORY) if ($sub_row['forum_status'] != ITEM_CATEGORY)
{ {
$colspan = ''; $colspan = '';

View file

@ -19,10 +19,13 @@
* *
***************************************************************************/ ***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) ) if( !empty($setmodules) )
{ {
if ( !$auth->get_acl_admin('group') )
{
return;
}
$filename = basename(__FILE__); $filename = basename(__FILE__);
$module['Groups']['Create'] = $filename . "$SID&amp;mode=create"; $module['Groups']['Create'] = $filename . "$SID&amp;mode=create";
$module['Groups']['Delete'] = $filename . "$SID&amp;mode=delete"; $module['Groups']['Delete'] = $filename . "$SID&amp;mode=delete";
@ -31,20 +34,29 @@ if( !empty($setmodules) )
return; return;
} }
define('IN_PHPBB', 1);
// //
// Load default header // Include files
// //
$phpbb_root_path = "../"; $phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc'); require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx); require('pagestart.' . $phpEx);
//
// Do we have general permissions?
//
if ( !$auth->get_acl_admin('group') )
{
message_die(MESSAGE, $lang['No_admin']);
}
if( isset($HTTP_POST_VARS[POST_GROUPS_URL]) || isset($HTTP_GET_VARS[POST_GROUPS_URL]) ) 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]); $group_id = ( isset($HTTP_POST_VARS[POST_GROUPS_URL]) ) ? intval($HTTP_POST_VARS[POST_GROUPS_URL]) : intval($HTTP_GET_VARS[POST_GROUPS_URL]);
} }
else else
{ {
$group_id = ""; $group_id = '';
} }
// //
@ -122,7 +134,7 @@ if( isset($HTTP_POST_VARS['edit']) || isset($HTTP_POST_VARS['new']) )
for($i = 0; $i < count($user_list); $i++) for($i = 0; $i < count($user_list); $i++)
{ {
if( $user_list[$i]['user_id'] == $group_info['group_moderator'] ) if( $user_list[$i]['user_id'] == $group_info['group_moderator'] )
{ {
$group_moderator = $user_list[$i]['username']; $group_moderator = $user_list[$i]['username'];
} }
@ -136,15 +148,15 @@ if( isset($HTTP_POST_VARS['edit']) || isset($HTTP_POST_VARS['new']) )
$template->assign_vars(array( $template->assign_vars(array(
"GROUP_NAME" => $group_info['group_name'], "GROUP_NAME" => $group_info['group_name'],
"GROUP_DESCRIPTION" => $group_info['group_description'], "GROUP_DESCRIPTION" => $group_info['group_description'],
"GROUP_MODERATOR" => $group_moderator, "GROUP_MODERATOR" => $group_moderator,
"L_GROUP_TITLE" => $lang['Group_administration'], "L_GROUP_TITLE" => $lang['Group_administration'],
"L_GROUP_EDIT_DELETE" => ( isset($HTTP_POST_VARS['new']) ) ? $lang['New_group'] : $lang['Edit_group'], "L_GROUP_EDIT_DELETE" => ( isset($HTTP_POST_VARS['new']) ) ? $lang['New_group'] : $lang['Edit_group'],
"L_GROUP_NAME" => $lang['group_name'], "L_GROUP_NAME" => $lang['group_name'],
"L_GROUP_DESCRIPTION" => $lang['group_description'], "L_GROUP_DESCRIPTION" => $lang['group_description'],
"L_GROUP_MODERATOR" => $lang['group_moderator'], "L_GROUP_MODERATOR" => $lang['group_moderator'],
"L_FIND_USERNAME" => $lang['Find_username'], "L_FIND_USERNAME" => $lang['Find_username'],
"L_GROUP_STATUS" => $lang['group_status'], "L_GROUP_STATUS" => $lang['group_status'],
"L_GROUP_OPEN" => $lang['group_open'], "L_GROUP_OPEN" => $lang['group_open'],
"L_GROUP_CLOSED" => $lang['group_closed'], "L_GROUP_CLOSED" => $lang['group_closed'],
@ -157,7 +169,7 @@ if( isset($HTTP_POST_VARS['edit']) || isset($HTTP_POST_VARS['new']) )
"L_DELETE_MODERATOR_EXPLAIN" => $lang['delete_moderator_explain'], "L_DELETE_MODERATOR_EXPLAIN" => $lang['delete_moderator_explain'],
"L_YES" => $lang['Yes'], "L_YES" => $lang['Yes'],
"U_SEARCH_USER" => append_sid("../search.$phpEx?mode=searchuser"), "U_SEARCH_USER" => append_sid("../search.$phpEx?mode=searchuser"),
"S_GROUP_OPEN_TYPE" => GROUP_OPEN, "S_GROUP_OPEN_TYPE" => GROUP_OPEN,
"S_GROUP_CLOSED_TYPE" => GROUP_CLOSED, "S_GROUP_CLOSED_TYPE" => GROUP_CLOSED,
@ -220,7 +232,7 @@ else if( isset($HTTP_POST_VARS['group_update']) )
{ {
message_die(GENERAL_MESSAGE, $lang['No_group_moderator']); message_die(GENERAL_MESSAGE, $lang['No_group_moderator']);
} }
$this_userdata = get_userdata($group_moderator); $this_userdata = get_userdata($group_moderator);
$group_moderator = $this_userdata['user_id']; $group_moderator = $this_userdata['user_id'];
@ -228,7 +240,7 @@ else if( isset($HTTP_POST_VARS['group_update']) )
{ {
message_die(GENERAL_MESSAGE, $lang['No_group_moderator']); message_die(GENERAL_MESSAGE, $lang['No_group_moderator']);
} }
if( $mode == "editgroup" ) if( $mode == "editgroup" )
{ {
$sql = "SELECT * $sql = "SELECT *
@ -243,14 +255,14 @@ else if( isset($HTTP_POST_VARS['group_update']) )
{ {
message_die(GENERAL_MESSAGE, $lang['Group_not_exist']); message_die(GENERAL_MESSAGE, $lang['Group_not_exist']);
} }
$group_info = $db->sql_fetchrow($result); $group_info = $db->sql_fetchrow($result);
if ( $group_info['group_moderator'] != $group_moderator ) if ( $group_info['group_moderator'] != $group_moderator )
{ {
if ( $delete_old_moderator != "" ) if ( $delete_old_moderator != "" )
{ {
$sql = "DELETE FROM " . USER_GROUP_TABLE . " $sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE user_id = " . $group_info['group_moderator'] . " WHERE user_id = " . $group_info['group_moderator'] . "
AND group_id = " . $group_id; AND group_id = " . $group_id;
if ( !$result = $db->sql_query($sql) ) if ( !$result = $db->sql_query($sql) )
{ {
@ -265,20 +277,20 @@ else if( isset($HTTP_POST_VARS['group_update']) )
} }
} }
$sql = "UPDATE " . GROUPS_TABLE . " $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 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"; WHERE group_id = $group_id";
if ( !$result = $db->sql_query($sql) ) if ( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't update group", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't 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 = $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); message_die(GENERAL_MESSAGE, $message);
} }
else if( $mode == "newgroup" ) else if( $mode == "newgroup" )
{ {
$sql = "SELECT MAX(group_id) AS new_group_id $sql = "SELECT MAX(group_id) AS new_group_id
FROM " . GROUPS_TABLE; FROM " . GROUPS_TABLE;
if ( !$result = $db->sql_query($sql) ) if ( !$result = $db->sql_query($sql) )
{ {
@ -288,7 +300,7 @@ else if( isset($HTTP_POST_VARS['group_update']) )
$new_group_id = $row['new_group_id'] + 1; $new_group_id = $row['new_group_id'] + 1;
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user) $sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
VALUES ($new_group_id, $group_type, '" . str_replace("\'", "''", $group_name) . "', '" . str_replace("\'", "''", $group_description) . "', $group_moderator, '0')"; VALUES ($new_group_id, $group_type, '" . str_replace("\'", "''", $group_name) . "', '" . str_replace("\'", "''", $group_description) . "', $group_moderator, '0')";
if ( !$result = $db->sql_query($sql) ) if ( !$result = $db->sql_query($sql) )
{ {
@ -301,7 +313,7 @@ else if( isset($HTTP_POST_VARS['group_update']) )
{ {
message_die(GENERAL_ERROR, "Couldn't insert new user-group info", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't 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 = $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); message_die(GENERAL_MESSAGE, $message);
@ -313,48 +325,97 @@ else if( isset($HTTP_POST_VARS['group_update']) )
} }
} }
} }
else
{
$sql = "SELECT group_id, group_name
FROM " . GROUPS_TABLE . "
WHERE group_single_user <> " . TRUE . "
ORDER BY group_name";
$g_result = $db->sql_query($sql);
$group_list = $db->sql_fetchrowset($g_result);
$select_list = "<select name=\"" . POST_GROUPS_URL . "\">"; page_header($lang['Manage']);
for($i = 0; $i < count($group_list); $i++)
{ ?>
$select_list .= "<option value=\"" . $group_list[$i]['group_id'] . "\">" . $group_list[$i]['group_name'] . "</option>";
} <h1><?php echo $lang['Manage']; ?></h1>
$select_list .= "</select>";
<p><?php echo $lang['Group_manage_explain']; ?></p>
$template->set_filenames(array(
"body" => "admin/group_select_body.tpl") <form method="post" action="<?php echo "admin_groups.$phpEx$SID&amp;mode=$mode"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
); <tr>
<th colspan="3"><?php echo $lang['Manage']; ?></th>
$template->assign_vars(array( </tr>
"L_GROUP_TITLE" => $lang['Group_administration'], <?php
"L_GROUP_EXPLAIN" => $lang['Group_admin_explain'],
"L_GROUP_SELECT" => $lang['Select_group'], $sql = "SELECT group_id, group_name
"L_LOOK_UP" => $lang['Look_up_group'], FROM " . GROUPS_TABLE . "
"L_CREATE_NEW_GROUP" => $lang['New_group'], ORDER BY group_name";
$result = $db->sql_query($sql);
"S_GROUP_ACTION" => append_sid("admin_groups.$phpEx"),
"S_GROUP_SELECT" => $select_list) $groups = array();
); if ( $row = $db->sql_fetchrow($result) )
{
// do
// Faking the IF... ELSE statements again... {
// $groups[] = $row;
if( count($group_list) > 0 ) }
{ while ( $row = $db->sql_fetchrow($result) );
$template->assign_block_vars("select_box", array()); }
}
$sql = "SELECT ug.group_id, u.user_id, u.username
$template->pparse('body'); FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug
} WHERE ug.user_pending = 1
AND u.user_id = ug.user_id
include('page_footer_admin.'.$phpEx); ORDER BY ug.group_id";
$result = $db->sql_query($sql);
$pending = array();
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$pending[$row['group_id']][] = $row;
}
while ( $row = $db->sql_fetchrow($result) );
}
foreach ( $groups as $group_ary )
{
$group_id = $group_ary['group_id'];
$group_name = ( !empty($lang[$group_ary['group_name']]) ) ? $lang[$group_ary['group_name']] : $group_ary['group_name'];
?>
<tr>
<td class="cat"><span class="cattitle"><?php echo $group_name;?></span></td>
<td class="cat" align="center">&nbsp;<input class="liteoption" type="submit" name="edit[<?php echo $group_id; ?>]" value="<?php echo $lang['Edit'];?>" />&nbsp;</td>
<td class="cat" align="center">&nbsp;<input class="liteoption" type="submit" name="delete[<?php echo $group_id; ?>]" value="<?php echo $lang['Delete'];?>" />&nbsp;</td>
</tr>
<?php
if ( is_array($pending[$group_id]) )
{
$row_class = '';
foreach( $pending[$group_id] as $pending_ary )
{
$row_class = ( $row_class != 'row1' ) ? 'row1' : 'row2';
?>
<tr>
<td class="<?php echo $row_class; ?>"><?php echo $pending_ary['username'];?></td>
<td class="<?php echo $row_class; ?>" align="center"><input class="liteoption" type="submit" name="approve[<?php echo $pending_ary['user_id']; ?>]" value="<?php echo $lang['Approve_selected'];?>" /></td>
<td class="<?php echo $row_class; ?>" align="center"><input class="liteoption" type="submit" name="decline[<?php echo $pending_ary['user_id']; ?>]" value="<?php echo $lang['Deny_selected'];?>" /></td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td class="row1" colspan="4" align="center">No pending users</td>
</tr>
<?php
}
}
?>
</table></form>
<?php
page_footer();
?> ?>

View file

@ -21,7 +21,7 @@
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('auth') ) if ( !$auth->get_acl_admin('auth') )
{ {
return; return;
} }
@ -46,7 +46,7 @@ require('pagestart.' . $phpEx);
// //
// Do we have forum admin permissions? // Do we have forum admin permissions?
// //
if ( !$acl->get_acl_admin('auth') ) if ( !$auth->get_acl_admin('auth') )
{ {
message_die(MESSAGE, $lang['No_admin']); message_die(MESSAGE, $lang['No_admin']);
} }
@ -101,6 +101,13 @@ switch ( $mode )
break; break;
} }
//
// Brief explanation of how things work when updating ...
//
// Granting someone any admin permissions grants them permissions
// to all other options, e.g. Moderator and Forums across the board.
// This is done via the acl class
//
if ( isset($HTTP_POST_VARS['update']) ) if ( isset($HTTP_POST_VARS['update']) )
{ {
switch ( $HTTP_POST_VARS['type'] ) switch ( $HTTP_POST_VARS['type'] )
@ -116,7 +123,7 @@ if ( isset($HTTP_POST_VARS['update']) )
foreach ( $HTTP_POST_VARS['entries'] as $id ) foreach ( $HTTP_POST_VARS['entries'] as $id )
{ {
$acl->$set($forum_id, $id, $HTTP_POST_VARS['option']); $auth->$set($forum_id, $id, $HTTP_POST_VARS['option']);
} }
message_die(MESSAGE, 'Permissions updated successfully'); message_die(MESSAGE, 'Permissions updated successfully');
@ -156,7 +163,7 @@ else if ( isset($HTTP_POST_VARS['delete']) )
foreach ( $HTTP_POST_VARS['entries'] as $id ) foreach ( $HTTP_POST_VARS['entries'] as $id )
{ {
$acl->$set($forum_id, $id, $option_ids); $auth->$set($forum_id, $id, $option_ids);
} }
message_die(MESSAGE, 'Permissions updated successfully'); message_die(MESSAGE, 'Permissions updated successfully');
@ -344,9 +351,16 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
else else
{ {
//
// Founder only operations ... these operations can
// only be altered by someone with founder status
//
$founder_sql = ( !$userdata['user_founder'] ) ? ' AND founder_only <> 1' : '';
$sql = "SELECT auth_option_id, auth_value $sql = "SELECT auth_option_id, auth_value
FROM " . ACL_OPTIONS_TABLE . " FROM " . ACL_OPTIONS_TABLE . "
WHERE auth_value LIKE '" . $type_sql . "_%'"; WHERE auth_value LIKE '" . $type_sql . "_%'
$founder_sql";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$auth_options = array(); $auth_options = array();

View file

@ -21,11 +21,11 @@
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('forum') ) if ( !$auth->get_acl_admin('forum') )
{ {
return; return;
} }
$filename = basename(__FILE__); $filename = basename(__FILE__);
$module['Forums']['Prune'] = $filename . $SID . '&amp;mode=forums'; $module['Forums']['Prune'] = $filename . $SID . '&amp;mode=forums';
@ -39,12 +39,12 @@ define('IN_PHPBB', 1);
$phpbb_root_path = '../'; $phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc'); require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx); require('pagestart.' . $phpEx);
require($phpbb_root_path . 'includes/functions_admin.'.$phpEx); require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
// //
// Do we have forum admin permissions? // Do we have forum admin permissions?
// //
if ( !$acl->get_acl_admin('forum') ) if ( !$auth->get_acl_admin('forum') )
{ {
message_die(MESSAGE, $lang['No_admin']); message_die(MESSAGE, $lang['No_admin']);
} }
@ -97,10 +97,10 @@ if ( isset($HTTP_POST_VARS['doprune']) )
{ {
$p_result = prune($forum_rows[$i]['forum_id'], $prunedate); $p_result = prune($forum_rows[$i]['forum_id'], $prunedate);
sync('forum', $forum_rows[$i]['forum_id']); sync('forum', $forum_rows[$i]['forum_id']);
$template->assign_block_vars('prune_results', array( $template->assign_block_vars('prune_results', array(
'ROW_COLOR' => '#' . $row_color, 'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'FORUM_NAME' => $forum_rows[$i]['forum_name'], 'FORUM_NAME' => $forum_rows[$i]['forum_name'],
'FORUM_TOPICS' => $p_result['topics'], 'FORUM_TOPICS' => $p_result['topics'],
'FORUM_POSTS' => $p_result['posts']) 'FORUM_POSTS' => $p_result['posts'])
@ -161,7 +161,7 @@ else
{ {
$forum_name = ( $forum_id == -1 ) ? $lang['All_Forums'] : $forum_rows[0]['forum_name']; $forum_name = ( $forum_id == -1 ) ? $lang['All_Forums'] : $forum_rows[0]['forum_name'];
$prune_data = $lang['Prune_topics_not_posted'] . " "; $prune_data = $lang['Prune_topics_not_posted'] . " ";
$prune_data .= '<input type="text" name="prunedays" size="4"> ' . $lang['Days']; $prune_data .= '<input type="text" name="prunedays" size="4"> ' . $lang['Days'];
$s_hidden_fields = '<input type="hidden" name="f" value="' . $forum_id . '">'; $s_hidden_fields = '<input type="hidden" name="f" value="' . $forum_id . '">';
@ -175,13 +175,13 @@ else
<h2><?php echo $lang['Forum'] . ': ' . $forum_name; ?></h2> <h2><?php echo $lang['Forum'] . ': ' . $forum_name; ?></h2>
<form method="post" action="<?php echo "admin_prune.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> <form method="post" action="<?php echo "admin_prune.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<th class="th"><?php echo $lang['Forum_Prune']; ?></th> <th class="th"><?php echo $lang['Forum_Prune']; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $prune_data; ?></td> <td class="row1"><?php echo $prune_data; ?></td>
</tr> </tr>
<tr> <tr>
<td class="cat" align="center"><?php echo $s_hidden_fields; ?><input type="submit" name="doprune" value="<?php echo $lang['Do_Prune']; ?>" class="mainoption"></td> <td class="cat" align="center"><?php echo $s_hidden_fields; ?><input type="submit" name="doprune" value="<?php echo $lang['Do_Prune']; ?>" class="mainoption"></td>
</tr> </tr>
</table></form> </table></form>

View file

@ -21,7 +21,7 @@
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('user') ) if ( !$auth->get_acl_admin('user') )
{ {
return; return;
} }
@ -43,7 +43,7 @@ require('pagestart.' . $phpEx);
// //
// Do we have forum admin permissions? // Do we have forum admin permissions?
// //
if ( !$acl->get_acl_admin('user') ) if ( !$auth->get_acl_admin('user') )
{ {
return; return;
} }
@ -75,7 +75,7 @@ if ( isset($HTTP_POST_VARS['prune']) )
{ {
$l_message .= ( !empty($HTTP_POST_VARS[$field]) ) ? '<input type="hidden" name="' . $field . '" value="' . urlencode($HTTP_POST_VARS[$field]) . '" />' : ''; $l_message .= ( !empty($HTTP_POST_VARS[$field]) ) ? '<input type="hidden" name="' . $field . '" value="' . urlencode($HTTP_POST_VARS[$field]) . '" />' : '';
} }
$l_message .= '</form>'; $l_message .= '</form>';
page_header($lang['Prune_users']); page_header($lang['Prune_users']);
@ -90,7 +90,7 @@ if ( isset($HTTP_POST_VARS['prune']) )
page_message($lang['Confirm'], $l_message, false); page_message($lang['Confirm'], $l_message, false);
page_footer(); page_footer();
} }
else if ( isset($HTTP_POST_VARS['confirm']) ) else if ( isset($HTTP_POST_VARS['confirm']) )
{ {
@ -128,8 +128,8 @@ if ( isset($HTTP_POST_VARS['prune']) )
$where_sql .= ( $active ) ? " AND user_lastvisit " . $key_match[$active_select] . " " . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : ''; $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 . " $sql = "SELECT username, user_id FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . " WHERE user_id <> " . ANONYMOUS . "
$where_sql"; $where_sql";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -169,8 +169,8 @@ if ( isset($HTTP_POST_VARS['prune']) )
for($i = 0; $i < sizeof($user_ids); $i++) for($i = 0; $i < sizeof($user_ids); $i++)
{ {
$sql = "UPDATE " . POSTS_TABLE . " $sql = "UPDATE " . POSTS_TABLE . "
SET poster_id = " . ANONYMOUS . ", post_username = '" . $usernames[$i] . "' SET poster_id = " . ANONYMOUS . ", post_username = '" . $usernames[$i] . "'
WHERE user_id = " . $userids[$i]; WHERE user_id = " . $userids[$i];
// $db->sql_query($sql); // $db->sql_query($sql);
} }
@ -184,7 +184,7 @@ if ( isset($HTTP_POST_VARS['prune']) )
$sql = "UPDATE " . USERS_TABLE . " SET user_active = 0"; $sql = "UPDATE " . USERS_TABLE . " SET user_active = 0";
} }
$sql .= " WHERE user_id <> " . ANONYMOUS . " $sql .= " WHERE user_id <> " . ANONYMOUS . "
$where_sql"; $where_sql";
// $db->sql_query($sql); // $db->sql_query($sql);
@ -233,26 +233,26 @@ page_header($lang['Prune_users']);
<p><?php echo $lang['Prune_users_explain']; ?></p> <p><?php echo $lang['Prune_users_explain']; ?></p>
<form method="post" name="post" action="<?php echo "admin_prune_users.$phpEx$SID"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> <form method="post" name="post" action="<?php echo "admin_prune_users.$phpEx$SID"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<th colspan="2"><?php echo $lang['Prune_users']; ?></th> <th colspan="2"><?php echo $lang['Prune_users']; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $lang['Username']; ?>: </td> <td class="row1"><?php echo $lang['Username']; ?>: </td>
<td class="row2"><input class="post" type="text" name="username" /></td> <td class="row2"><input class="post" type="text" name="username" /></td>
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $lang['Email']; ?>: </td> <td class="row1"><?php echo $lang['Email']; ?>: </td>
<td class="row2"><input class="post" type="text" name="email" /></td> <td class="row2"><input class="post" type="text" name="email" /></td>
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $lang['Joined']; ?>: <br /><span class="gensmall"><?php echo $lang['Joined_explain']; ?></span></td> <td class="row1"><?php echo $lang['Joined']; ?>: <br /><span class="gensmall"><?php echo $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> <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>
<tr> <tr>
<td class="row1"><?php echo $lang['Last_active']; ?>: <br /><span class="gensmall"><?php echo $lang['Last_active_explain']; ?></span></td> <td class="row1"><?php echo $lang['Last_active']; ?>: <br /><span class="gensmall"><?php echo $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> <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>
<tr> <tr>
<td class="row1"><?php echo $lang['Posts']; ?>: </td> <td class="row1"><?php echo $lang['Posts']; ?>: </td>
<td class="row2"><select name="count_select"><?php echo $s_find_count; ?></select> <input class="post" type="text" name="count" /></td> <td class="row2"><select name="count_select"><?php echo $s_find_count; ?></select> <input class="post" type="text" name="count" /></td>
</tr> </tr>

View file

@ -23,7 +23,7 @@ define('IN_PHPBB', 1);
if( !empty($setmodules) ) if( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('user') ) if ( !$auth->get_acl_admin('user') )
{ {
return; return;
} }
@ -43,7 +43,7 @@ require('pagestart.' . $phpEx);
// //
// //
// //
if ( !$acl->get_acl_admin('user') ) if ( !$auth->get_acl_admin('user') )
{ {
return; return;
} }
@ -55,7 +55,7 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{ {
$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
} }
else else
{ {
// //
// These could be entered via a form button // These could be entered via a form button
@ -85,9 +85,9 @@ if ( $mode != '' )
// They want to add a new rank, show the form. // They want to add a new rank, show the form.
// //
$rank_id = ( isset($HTTP_GET_VARS['id']) ) ? intval($HTTP_GET_VARS['id']) : 0; $rank_id = ( isset($HTTP_GET_VARS['id']) ) ? intval($HTTP_GET_VARS['id']) : 0;
$s_hidden_fields = '<input type="hidden" name="mode" value="save" />'; $s_hidden_fields = '<input type="hidden" name="mode" value="save" />';
if ( $mode == 'edit' ) if ( $mode == 'edit' )
{ {
if ( empty($rank_id) ) if ( empty($rank_id) )
@ -98,7 +98,7 @@ if ( $mode != '' )
$sql = "SELECT * FROM " . RANKS_TABLE . " $sql = "SELECT * FROM " . RANKS_TABLE . "
WHERE rank_id = $rank_id"; WHERE rank_id = $rank_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$rank_info = $db->sql_fetchrow($result); $rank_info = $db->sql_fetchrow($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $rank_id . '" />'; $s_hidden_fields .= '<input type="hidden" name="id" value="' . $rank_id . '" />';
@ -151,7 +151,7 @@ if ( $mode != '' )
// //
// Ok, they sent us our info, let's update it. // Ok, they sent us our info, let's update it.
// //
$rank_id = ( isset($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : 0; $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']) : ''; $rank_title = ( isset($HTTP_POST_VARS['title']) ) ? trim($HTTP_POST_VARS['title']) : '';
$special_rank = ( $HTTP_POST_VARS['special_rank'] == 1 ) ? TRUE : 0; $special_rank = ( $HTTP_POST_VARS['special_rank'] == 1 ) ? TRUE : 0;
@ -194,7 +194,7 @@ if ( $mode != '' )
$message = $lang['Rank_added']; $message = $lang['Rank_added'];
} }
$db->sql_query($sql); $db->sql_query($sql);
$message .= '<br /><br />' . sprintf($lang['Click_return_rankadmin'], '<a href="' . "admin_ranks.$phpEx$SID" . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . "index.$phpEx$SID&amp;pane=right" . '">', '</a>'); $message .= '<br /><br />' . sprintf($lang['Click_return_rankadmin'], '<a href="' . "admin_ranks.$phpEx$SID" . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . "index.$phpEx$SID&amp;pane=right" . '">', '</a>');
@ -207,7 +207,7 @@ if ( $mode != '' )
// //
// Ok, they want to delete their rank // Ok, they want to delete their rank
// //
if ( isset($HTTP_POST_VARS['id']) || isset($HTTP_GET_VARS['id']) ) 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']); $rank_id = ( isset($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : intval($HTTP_GET_VARS['id']);
@ -216,15 +216,15 @@ if ( $mode != '' )
{ {
$rank_id = 0; $rank_id = 0;
} }
if ( $rank_id ) if ( $rank_id )
{ {
$sql = "DELETE FROM " . RANKS_TABLE . " $sql = "DELETE FROM " . RANKS_TABLE . "
WHERE rank_id = $rank_id"; WHERE rank_id = $rank_id";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_rank = 0 SET user_rank = 0
WHERE user_rank = $rank_id"; WHERE user_rank = $rank_id";
$db->sql_query($sql); $db->sql_query($sql);

View file

@ -1,4 +1,4 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* admin_search.php * admin_search.php
* ------------------- * -------------------
@ -21,7 +21,7 @@
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
return; return;
} }
@ -44,7 +44,7 @@ include($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
// //
// Do we have forum admin permissions? // Do we have forum admin permissions?
// //
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
message_die(MESSAGE, $lang['No_admin']); message_die(MESSAGE, $lang['No_admin']);
} }
@ -113,8 +113,8 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
// //
// Take board offline // Take board offline
// //
$sql = "UPDATE " . CONFIG_TABLE . " $sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '1' SET config_value = '1'
WHERE config_name = 'board_disable'"; WHERE config_name = 'board_disable'";
$db->sql_query($sql); $db->sql_query($sql);
@ -129,7 +129,7 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
// //
// Fetch a batch of posts_text entries // 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 $sql = "SELECT COUNT(*) AS total, MAX(post_id) AS max_post_id, MIN(post_id) AS min_post_id
FROM " . POSTS_TEXT_TABLE; FROM " . POSTS_TEXT_TABLE;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -139,18 +139,18 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
$db->sql_freeresult($result); $db->sql_freeresult($result);
$sql = "SELECT * $sql = "SELECT *
FROM " . POSTS_TEXT_TABLE . " FROM " . POSTS_TEXT_TABLE . "
WHERE post_id WHERE post_id
BETWEEN $batchstart BETWEEN $batchstart
AND $batchend"; AND $batchend";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
{ {
do do
{ {
$post_id = $row['post_id']; $post_id = $row['post_id'];
$search_raw_words = array(); $search_raw_words = array();
$search_raw_words['text'] = split_words(clean_words('post', $row['post_text'], $stopword_array, $synonym_array)); $search_raw_words['text'] = split_words(clean_words('post', $row['post_text'], $stopword_array, $synonym_array));
@ -164,14 +164,14 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
if ( !empty($search_matches) ) if ( !empty($search_matches) )
{ {
for ($i = 0; $i < count($search_matches); $i++) for ($i = 0; $i < count($search_matches); $i++)
{ {
$search_matches[$i] = trim($search_matches[$i]); $search_matches[$i] = trim($search_matches[$i]);
if ( $search_matches[$i] != '' ) if ( $search_matches[$i] != '' )
{ {
$word[] = $search_matches[$i]; $word[] = $search_matches[$i];
$word_insert_sql[$word_in] .= ( $word_insert_sql[$word_in] != '' ) ? ", '" . $search_matches[$i] . "'" : "'" . $search_matches[$i] . "'"; $word_insert_sql[$word_in] .= ( $word_insert_sql[$word_in] != '' ) ? ", '" . $search_matches[$i] . "'" : "'" . $search_matches[$i] . "'";
} }
} }
} }
} }
@ -194,8 +194,8 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
case 'mssql-odbc': case 'mssql-odbc':
case 'oracle': case 'oracle':
case 'db2': case 'db2':
$sql = "SELECT word_id, word_text $sql = "SELECT word_id, word_text
FROM " . SEARCH_WORD_TABLE . " FROM " . SEARCH_WORD_TABLE . "
WHERE word_text IN ($word_text_sql)"; WHERE word_text IN ($word_text_sql)";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -209,7 +209,7 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
$value_sql = ''; $value_sql = '';
$match_word = array(); $match_word = array();
for ($i = 0; $i < count($word); $i++) for ($i = 0; $i < count($word); $i++)
{ {
$new_match = true; $new_match = true;
if ( isset($check_words[$word[$i]]) ) if ( isset($check_words[$word[$i]]) )
{ {
@ -228,8 +228,8 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
$value_sql .= ( ( $value_sql != '' ) ? ' UNION ALL ' : '' ) . "SELECT '" . $word[$i] . "'"; $value_sql .= ( ( $value_sql != '' ) ? ' UNION ALL ' : '' ) . "SELECT '" . $word[$i] . "'";
break; break;
default: default:
$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
VALUES ('" . $word[$i] . "')"; VALUES ('" . $word[$i] . "')";
$db->sql_query($sql); $db->sql_query($sql);
break; break;
} }
@ -242,12 +242,12 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
{ {
case 'mysql': case 'mysql':
case 'mysql4': case 'mysql4':
$sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text) $sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text)
VALUES $value_sql"; VALUES $value_sql";
break; break;
case 'mssql': case 'mssql':
$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
$value_sql"; $value_sql";
break; break;
} }
@ -261,10 +261,10 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
if ( $match_sql != '' ) if ( $match_sql != '' )
{ {
$sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match)
SELECT $post_id, word_id, $title_match SELECT $post_id, word_id, $title_match
FROM " . SEARCH_WORD_TABLE . " FROM " . SEARCH_WORD_TABLE . "
WHERE word_text IN ($match_sql)"; WHERE word_text IN ($match_sql)";
$db->sql_query($sql); $db->sql_query($sql);
} }
} }
@ -290,8 +290,8 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
} }
else else
{ {
$sql = "UPDATE " . CONFIG_TABLE . " $sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '0' SET config_value = '0'
WHERE config_name = 'board_disable'"; WHERE config_name = 'board_disable'";
$db->sql_query($sql); $db->sql_query($sql);
@ -314,8 +314,8 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
} }
else if ( isset($HTTP_POST_VARS['cancel']) ) else if ( isset($HTTP_POST_VARS['cancel']) )
{ {
$sql = "UPDATE " . CONFIG_TABLE . " $sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '0' SET config_value = '0'
WHERE config_name = 'board_disable'"; WHERE config_name = 'board_disable'";
$db->sql_query($sql); $db->sql_query($sql);

View file

@ -21,7 +21,7 @@
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
return; return;
} }
@ -43,7 +43,7 @@ require('pagestart.' . $phpEx);
// //
// Do we have general permissions? // Do we have general permissions?
// //
if (!$acl->get_acl_admin('general')) if (!$auth->get_acl_admin('general'))
{ {
message_die(MESSAGE, $lang['No_admin']); message_die(MESSAGE, $lang['No_admin']);
} }
@ -79,7 +79,7 @@ if ($mode == 'edit' || !empty($HTTP_POST_VARS['add']) || !empty($HTTP_POST_VARS[
$smilies_images[] = $file; $smilies_images[] = $file;
} }
elseif (preg_match('/\.pak$/i', $file)) elseif (preg_match('/\.pak$/i', $file))
{ {
$smilies_paks[] = $file; $smilies_paks[] = $file;
} }
} }
@ -175,7 +175,7 @@ if (isset($HTTP_POST_VARS['import_pak']))
} }
} }
message_die(MESSAGE, $lang['Smilies_import_success'] . $click_return); message_die(MESSAGE, $lang['Smilies_import_success'] . $click_return);
} }
else else
{ {
@ -200,7 +200,7 @@ if (isset($HTTP_POST_VARS['import_pak']))
<p><?php echo $lang['Import_smilies_explain'] ?></p> <p><?php echo $lang['Import_smilies_explain'] ?></p>
<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>"><table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center"> <form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<th class="thHead" colspan="2"><?php echo $lang['Smilies_import'] ?></th> <th class="thHead" colspan="2"><?php echo $lang['Smilies_import'] ?></th>
</tr> </tr>
@ -220,7 +220,7 @@ if (isset($HTTP_POST_VARS['import_pak']))
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="catBottom" colspan="2" align="center"><input class="mainoption" name="import_pak" type="submit" value="<?php echo $lang['Import_smilies'] ?>" /></td> <td class="cat" colspan="2" align="center"><input class="mainoption" name="import_pak" type="submit" value="<?php echo $lang['Import_smilies'] ?>" /></td>
</tr> </tr>
</table></form> </table></form>
<?php <?php
@ -288,7 +288,7 @@ function update_smile_dimensions()
//--> //-->
</script> </script>
<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>&amp;mode=create"><table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center"> <form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>&amp;mode=create"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<th class="thHead" colspan="2"><?php echo $lang['smile_config'] ?></th> <th class="thHead" colspan="2"><?php echo $lang['smile_config'] ?></th>
</tr> </tr>
@ -313,7 +313,7 @@ function update_smile_dimensions()
<td class="row2"><input type="text" name="smile_emotion" /></td> <td class="row2"><input type="text" name="smile_emotion" /></td>
</tr> </tr>
<tr> <tr>
<td class="catBottom" colspan="2" align="center"><input class="mainoption" type="submit" value="<?php echo $lang['Submit'] ?>" /></td> <td class="cat" colspan="2" align="center"><input class="mainoption" type="submit" value="<?php echo $lang['Submit'] ?>" /></td>
</tr> </tr>
</table></form> </table></form>
<?php <?php
@ -397,9 +397,9 @@ function update_smile_dimensions()
//--> //-->
</script> </script>
<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>&amp;mode=modify"><table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center"> <form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>&amp;mode=modify"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<th class="thHead" colspan="2"><?php echo $lang['Smile_config'] ?></th> <th class="th" colspan="2"><?php echo $lang['Smile_config'] ?></th>
</tr> </tr>
<tr> <tr>
<td class="row2"><?php echo $lang['Smile_code'] ?></td> <td class="row2"><?php echo $lang['Smile_code'] ?></td>
@ -430,7 +430,7 @@ function update_smile_dimensions()
<td class="row2"><select name="smile_order"><?php echo $order_list ?></select></td> <td class="row2"><select name="smile_order"><?php echo $order_list ?></select></td>
</tr> </tr>
<tr> <tr>
<td class="catBottom" colspan="2" align="center"><input type="hidden" name="smile_id" value="<?php echo $smile_data['smilies_id'] ?>" /><input class="mainoption" type="submit" value="<?php echo $lang['Submit'] ?>" /></td> <td class="cat" colspan="2" align="center"><input type="hidden" name="smile_id" value="<?php echo $smile_data['smilies_id'] ?>" /><input class="mainoption" type="submit" value="<?php echo $lang['Submit'] ?>" /></td>
</tr> </tr>
</table></form> </table></form>
<?php <?php
@ -458,7 +458,7 @@ function update_smile_dimensions()
'emoticon' => stripslashes($HTTP_POST_VARS['smile_emotion']), 'emoticon' => stripslashes($HTTP_POST_VARS['smile_emotion']),
'smile_on_posting' => (!empty($HTTP_POST_VARS['smile_on_posting'])) ? 1 : 0 'smile_on_posting' => (!empty($HTTP_POST_VARS['smile_on_posting'])) ? 1 : 0
); );
$smile_id = $HTTP_POST_VARS['smile_id']; $smile_id = $HTTP_POST_VARS['smile_id'];
$smile_order = $HTTP_POST_VARS['smile_order']; $smile_order = $HTTP_POST_VARS['smile_order'];

View file

@ -2,7 +2,7 @@
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('styles') ) if ( !$auth->get_acl_admin('styles') )
{ {
return; return;
} }
@ -27,7 +27,7 @@ require('pagestart.' . $phpEx);
// //
// Do we have styles admin permissions? // Do we have styles admin permissions?
// //
if ( !$acl->get_acl_admin('styles') ) if ( !$auth->get_acl_admin('styles') )
{ {
message_die(MESSAGE, $lang['No_admin']); message_die(MESSAGE, $lang['No_admin']);
} }
@ -57,8 +57,8 @@ switch ( $mode )
if ( isset($HTTP_POST_VARS['img_root']) ) if ( isset($HTTP_POST_VARS['img_root']) )
{ {
$sql = "SELECT * $sql = "SELECT *
FROM " . STYLES_IMAGE_TABLE . " FROM " . STYLES_IMAGE_TABLE . "
WHERE imageset_path LIKE '" . $HTTP_POST_VARS['imgroot'] . "'"; WHERE imageset_path LIKE '" . $HTTP_POST_VARS['imgroot'] . "'";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -74,7 +74,7 @@ switch ( $mode )
$imageset = array('imageset_path', 'post_new', 'post_locked', 'post_pm', 'reply_new', 'reply_pm', 'reply_locked', 'icon_profile', 'icon_pm', 'icon_delete', 'icon_ip', 'icon_quote', 'icon_search', 'icon_edit', 'icon_email', 'icon_www', 'icon_icq', 'icon_aim', 'icon_yim', 'icon_msnm', 'icon_no_email', 'icon_no_www', 'icon_no_icq', 'icon_no_aim', 'icon_no_yim', 'icon_no_msnm', 'goto_post', 'goto_post_new', 'goto_post_latest', 'goto_post_newest', 'forum', 'forum_new', 'forum_locked', 'folder', 'folder_new', 'folder_hot', 'folder_hot_new', 'folder_locked', 'folder_locked_new', 'folder_sticky', 'folder_sticky_new', 'folder_announce', 'folder_announce_new', 'topic_watch', 'topic_unwatch', 'poll_left', 'poll_center', 'poll_right', 'rating'); $imageset = array('imageset_path', 'post_new', 'post_locked', 'post_pm', 'reply_new', 'reply_pm', 'reply_locked', 'icon_profile', 'icon_pm', 'icon_delete', 'icon_ip', 'icon_quote', 'icon_search', 'icon_edit', 'icon_email', 'icon_www', 'icon_icq', 'icon_aim', 'icon_yim', 'icon_msnm', 'icon_no_email', 'icon_no_www', 'icon_no_icq', 'icon_no_aim', 'icon_no_yim', 'icon_no_msnm', 'goto_post', 'goto_post_new', 'goto_post_latest', 'goto_post_newest', 'forum', 'forum_new', 'forum_locked', 'folder', 'folder_new', 'folder_hot', 'folder_hot_new', 'folder_locked', 'folder_locked_new', 'folder_sticky', 'folder_sticky_new', 'folder_announce', 'folder_announce_new', 'topic_watch', 'topic_unwatch', 'poll_left', 'poll_center', 'poll_right', 'rating');
$sql = "SELECT imageset_name, imageset_path $sql = "SELECT imageset_name, imageset_path
FROM " . STYLES_IMAGE_TABLE . " FROM " . STYLES_IMAGE_TABLE . "
ORDER BY imageset_name"; ORDER BY imageset_name";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -117,7 +117,7 @@ switch ( $mode )
echo '<tr>'; echo '<tr>';
echo '<th height="25">Image</th><th>Source</th><th>Width</th><th>Height</th><th>Border</th><th>&nbsp;</th>'; echo '<th height="25">Image</th><th>Source</th><th>Width</th><th>Height</th><th>Border</th><th>&nbsp;</th>';
echo '</tr>'; echo '</tr>';
for($i = 0; $i < count($imageset); $i++) for($i = 0; $i < count($imageset); $i++)
{ {
$class = ( !($i%2) ) ? 'row1' : 'row2'; $class = ( !($i%2) ) ? 'row1' : 'row2';
@ -246,8 +246,8 @@ switch ( $mode )
if ( isset($HTTP_POST_VARS['update']) ) if ( isset($HTTP_POST_VARS['update']) )
{ {
$sql = "SELECT theme_id, theme_name $sql = "SELECT theme_id, theme_name
FROM " . STYLES_CSS_TABLE . " FROM " . STYLES_CSS_TABLE . "
WHERE theme_id = $theme_id"; WHERE theme_id = $theme_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -258,8 +258,8 @@ switch ( $mode )
$css_data = ( !empty($HTTP_POST_VARS['css_data']) ) ? htmlentities($HTTP_POST_VARS['css_data']) : ''; $css_data = ( !empty($HTTP_POST_VARS['css_data']) ) ? htmlentities($HTTP_POST_VARS['css_data']) : '';
$css_external = ( !empty($HTTP_POST_VARS['css_data']) ) ? $HTTP_POST_VARS['css_data'] : ''; $css_external = ( !empty($HTTP_POST_VARS['css_data']) ) ? $HTTP_POST_VARS['css_data'] : '';
$sql = "UPDATE " > STYLES_CSS_TABLE . " $sql = "UPDATE " > STYLES_CSS_TABLE . "
SET css_data = '$css_data', css_external = '$css_external' SET css_data = '$css_data', css_external = '$css_external'
WHERE theme_id = $theme_id"; WHERE theme_id = $theme_id";
$db->sql_query($sql); $db->sql_query($sql);
@ -271,7 +271,7 @@ switch ( $mode )
page_header($lang['Edit_theme']); page_header($lang['Edit_theme']);
$sql = "SELECT theme_id, theme_name $sql = "SELECT theme_id, theme_name
FROM " . STYLES_CSS_TABLE; FROM " . STYLES_CSS_TABLE;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -290,7 +290,7 @@ switch ( $mode )
$css_external = ''; $css_external = '';
if ( $theme_id ) if ( $theme_id )
{ {
$sql = "SELECT css_data, css_external $sql = "SELECT css_data, css_external
FROM " . STYLES_CSS_TABLE . " FROM " . STYLES_CSS_TABLE . "
WHERE theme_id = $theme_id"; WHERE theme_id = $theme_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -343,7 +343,7 @@ function get_templates($tplroot = '')
global $db; global $db;
$sql = "SELECT template_name, template_path $sql = "SELECT template_name, template_path
FROM " . STYLES_TPL_TABLE . " FROM " . STYLES_TPL_TABLE . "
ORDER BY template_name"; ORDER BY template_name";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -353,7 +353,7 @@ function get_templates($tplroot = '')
$selected = ( $tplroot == $row['template_path'] ) ? ' selected="selected"' : ''; $selected = ( $tplroot == $row['template_path'] ) ? ' selected="selected"' : '';
$tplroot_options .= '<option value="' . $row['template_path'] . '"' . $selected . '>' . $row['template_path'] . '</option>'; $tplroot_options .= '<option value="' . $row['template_path'] . '"' . $selected . '>' . $row['template_path'] . '</option>';
} }
return $tplroot_options; return $tplroot_options;
} }

View file

@ -21,7 +21,7 @@
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('user') ) if ( !$auth->get_acl_admin('user') )
{ {
return; return;
} }
@ -46,7 +46,7 @@ require($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
// //
// Do we have forum admin permissions? // Do we have forum admin permissions?
// //
if ( !$acl->get_acl_admin('user') ) if ( !$auth->get_acl_admin('user') )
{ {
return; return;
} }
@ -127,7 +127,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
$user_avatar_filetype = ( !empty($HTTP_POST_FILES['avatar']['type']) ) ? $HTTP_POST_FILES['avatar']['type'] : ''; $user_avatar_filetype = ( !empty($HTTP_POST_FILES['avatar']['type']) ) ? $HTTP_POST_FILES['avatar']['type'] : '';
$user_avatar = ( empty($user_avatar_loc) ) ? $this_userdata['user_avatar'] : ''; $user_avatar = ( empty($user_avatar_loc) ) ? $this_userdata['user_avatar'] : '';
$user_avatar_type = ( empty($user_avatar_loc) ) ? $this_userdata['user_avatar_type'] : ''; $user_avatar_type = ( empty($user_avatar_loc) ) ? $this_userdata['user_avatar_type'] : '';
$user_status = ( !empty($HTTP_POST_VARS['user_status']) ) ? intval( $HTTP_POST_VARS['user_status'] ) : 0; $user_status = ( !empty($HTTP_POST_VARS['user_status']) ) ? intval( $HTTP_POST_VARS['user_status'] ) : 0;
$user_allowpm = ( !empty($HTTP_POST_VARS['user_allowpm']) ) ? intval( $HTTP_POST_VARS['user_allowpm'] ) : 0; $user_allowpm = ( !empty($HTTP_POST_VARS['user_allowpm']) ) ? intval( $HTTP_POST_VARS['user_allowpm'] ) : 0;
@ -155,7 +155,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
$user_lang = stripslashes($user_lang); $user_lang = stripslashes($user_lang);
$user_dateformat = stripslashes($user_dateformat); $user_dateformat = stripslashes($user_dateformat);
if ( !isset($HTTP_POST_VARS['cancelavatar'])) if ( !isset($HTTP_POST_VARS['cancelavatar']))
{ {
$user_avatar = $user_avatar_local; $user_avatar = $user_avatar_local;
$user_avatar_type = USER_AVATAR_GALLERY; $user_avatar_type = USER_AVATAR_GALLERY;
@ -215,7 +215,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
if( $user_status == 0 ) if( $user_status == 0 )
{ {
// User is (made) inactive. Delete all their sessions. // User is (made) inactive. Delete all their sessions.
$sql = "DELETE FROM " . SESSIONS_TABLE . " $sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_user_id = $user_id"; WHERE session_user_id = $user_id";
$db->sql_query($sql); $db->sql_query($sql);
} }
@ -237,7 +237,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid); $signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
if ( strlen($sig_length_check) > $board_config['max_sig_chars'] ) if ( strlen($sig_length_check) > $board_config['max_sig_chars'] )
{ {
$error = TRUE; $error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long']; $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
} }
@ -388,7 +388,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
if( preg_match("/Content-Length\: ([0-9]+)[^\/ ][\s]+/i", $avatar_data, $file_data1) && preg_match("/Content-Type\: image\/[x\-]*([a-z]+)[\s]+/i", $avatar_data, $file_data2) ) if( preg_match("/Content-Length\: ([0-9]+)[^\/ ][\s]+/i", $avatar_data, $file_data1) && preg_match("/Content-Type\: image\/[x\-]*([a-z]+)[\s]+/i", $avatar_data, $file_data2) )
{ {
$file_size = $file_data1[1]; $file_size = $file_data1[1];
$file_type = $file_data2[1]; $file_type = $file_data2[1];
switch( $file_type ) switch( $file_type )
@ -512,7 +512,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
{ {
$avatar_sql = ", user_avatar = '" . str_replace("\'", "''", $user_avatar_local) . "', user_avatar_type = " . USER_AVATAR_GALLERY; $avatar_sql = ", user_avatar = '" . str_replace("\'", "''", $user_avatar_local) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
} }
// //
// Update entry in DB // Update entry in DB
// //
@ -520,10 +520,10 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
{ {
if( $HTTP_POST_VARS['deleteuser'] ) if( $HTTP_POST_VARS['deleteuser'] )
{ {
$sql = "SELECT g.group_id $sql = "SELECT g.group_id
FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
WHERE ug.user_id = $user_id WHERE ug.user_id = $user_id
AND g.group_id = ug.group_id AND g.group_id = ug.group_id
AND g.group_single_user = 1"; AND g.group_single_user = 1";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -533,12 +533,12 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
$db->sql_transaction(); $db->sql_transaction();
$sql = "UPDATE " . POSTS_TABLE . " $sql = "UPDATE " . POSTS_TABLE . "
SET poster_id = " . ANONYMOUS . ", post_username = '$username' SET poster_id = " . ANONYMOUS . ", post_username = '$username'
WHERE poster_id = $user_id"; WHERE poster_id = $user_id";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "UPDATE " . TOPICS_TABLE . " $sql = "UPDATE " . TOPICS_TABLE . "
SET topic_poster = " . ANONYMOUS . " SET topic_poster = " . ANONYMOUS . "
WHERE topic_poster = $user_id"; WHERE topic_poster = $user_id";
$db->sql_query($sql); $db->sql_query($sql);
@ -677,11 +677,11 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
$user_lang = $this_userdata['user_lang']; $user_lang = $this_userdata['user_lang'];
$user_timezone = $this_userdata['user_timezone']; $user_timezone = $this_userdata['user_timezone'];
$user_dateformat = $this_userdata['user_dateformat']; $user_dateformat = $this_userdata['user_dateformat'];
$user_status = $this_userdata['user_active']; $user_status = $this_userdata['user_active'];
$user_allowavatar = $this_userdata['user_allowavatar']; $user_allowavatar = $this_userdata['user_allowavatar'];
$user_allowpm = $this_userdata['user_allow_pm']; $user_allowpm = $this_userdata['user_allow_pm'];
$COPPA = false; $COPPA = false;
$html_status = ($this_userdata['user_allowhtml'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF']; $html_status = ($this_userdata['user_allowhtml'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
@ -727,7 +727,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
} }
} }
} }
@closedir($dir); @closedir($dir);
if( isset($HTTP_POST_VARS['avatarcategory']) ) if( isset($HTTP_POST_VARS['avatarcategory']) )
@ -794,7 +794,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
$s_hidden_fields .= '<input type="hidden" name="allowbbcode" value="' . $allowbbcode . '" />'; $s_hidden_fields .= '<input type="hidden" name="allowbbcode" value="' . $allowbbcode . '" />';
$s_hidden_fields .= '<input type="hidden" name="allowsmilies" value="' . $allowsmilies . '" />'; $s_hidden_fields .= '<input type="hidden" name="allowsmilies" value="' . $allowsmilies . '" />';
$s_hidden_fields .= '<input type="hidden" name="hideonline" value="' . !$allowviewonline . '" />'; $s_hidden_fields .= '<input type="hidden" name="hideonline" value="' . !$allowviewonline . '" />';
$s_hidden_fields .= '<input type="hidden" name="style" value="' . $user_style . '" />'; $s_hidden_fields .= '<input type="hidden" name="style" value="' . $user_style . '" />';
$s_hidden_fields .= '<input type="hidden" name="language" value="' . $user_lang . '" />'; $s_hidden_fields .= '<input type="hidden" name="language" value="' . $user_lang . '" />';
$s_hidden_fields .= '<input type="hidden" name="timezone" value="' . $user_timezone . '" />'; $s_hidden_fields .= '<input type="hidden" name="timezone" value="' . $user_timezone . '" />';
$s_hidden_fields .= '<input type="hidden" name="dateformat" value="' . str_replace("\"", "&quot;", $user_dateformat) . '" />'; $s_hidden_fields .= '<input type="hidden" name="dateformat" value="' . str_replace("\"", "&quot;", $user_dateformat) . '" />';
@ -807,15 +807,15 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
$template->assign_vars(array( $template->assign_vars(array(
"L_USER_TITLE" => $lang['User_admin'], "L_USER_TITLE" => $lang['User_admin'],
"L_USER_EXPLAIN" => $lang['User_admin_explain'], "L_USER_EXPLAIN" => $lang['User_admin_explain'],
"L_AVATAR_GALLERY" => $lang['Avatar_gallery'], "L_AVATAR_GALLERY" => $lang['Avatar_gallery'],
"L_SELECT_AVATAR" => $lang['Select_avatar'], "L_SELECT_AVATAR" => $lang['Select_avatar'],
"L_RETURN_PROFILE" => $lang['Return_profile'], "L_RETURN_PROFILE" => $lang['Return_profile'],
"L_CATEGORY" => $lang['Select_category'], "L_CATEGORY" => $lang['Select_category'],
"L_GO" => $lang['Go'], "L_GO" => $lang['Go'],
"S_OPTIONS_CATEGORIES" => $s_categories, "S_OPTIONS_CATEGORIES" => $s_categories,
"S_COLSPAN" => $s_colspan, "S_COLSPAN" => $s_colspan,
"S_PROFILE_ACTION" => append_sid("admin_users.$phpEx?mode=$mode"), "S_PROFILE_ACTION" => append_sid("admin_users.$phpEx?mode=$mode"),
"S_HIDDEN_FIELDS" => $s_hidden_fields) "S_HIDDEN_FIELDS" => $s_hidden_fields)
); );
} }
@ -860,17 +860,17 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
{ {
$rank = $row['rank_title']; $rank = $row['rank_title'];
$rank_id = $row['rank_id']; $rank_id = $row['rank_id'];
$selected = ( $this_userdata['user_rank'] == $rank_id ) ? ' selected="selected"' : ''; $selected = ( $this_userdata['user_rank'] == $rank_id ) ? ' selected="selected"' : '';
$rank_select_box .= '<option value="' . $rank_id . '"' . $selected . '>' . $rank . '</option>'; $rank_select_box .= '<option value="' . $rank_id . '"' . $selected . '>' . $rank . '</option>';
} }
$signature = preg_replace('/\:[0-9a-z\:]*?\]/si', ']', $signature); $signature = preg_replace('/\:[0-9a-z\:]*?\]/si', ']', $signature);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/user_edit_body.tpl") "body" => "admin/user_edit_body.tpl")
); );
// //
// Let's do an overall check for settings/versions which would prevent // Let's do an overall check for settings/versions which would prevent
// us from doing file uploads.... // us from doing file uploads....
@ -918,12 +918,12 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
'ALLOW_AVATAR_YES' => ($user_allowavatar) ? 'checked="checked"' : '', 'ALLOW_AVATAR_YES' => ($user_allowavatar) ? 'checked="checked"' : '',
'ALLOW_AVATAR_NO' => (!$user_allowavatar) ? 'checked="checked"' : '', 'ALLOW_AVATAR_NO' => (!$user_allowavatar) ? 'checked="checked"' : '',
'USER_ACTIVE_YES' => ($user_status) ? 'checked="checked"' : '', 'USER_ACTIVE_YES' => ($user_status) ? 'checked="checked"' : '',
'USER_ACTIVE_NO' => (!$user_status) ? 'checked="checked"' : '', 'USER_ACTIVE_NO' => (!$user_status) ? 'checked="checked"' : '',
'RANK_SELECT_BOX' => $rank_select_box, 'RANK_SELECT_BOX' => $rank_select_box,
'L_USER_TITLE' => $lang['User_admin'], 'L_USER_TITLE' => $lang['User_admin'],
'L_USER_EXPLAIN' => $lang['User_admin_explain'], 'L_USER_EXPLAIN' => $lang['User_admin_explain'],
'L_NEW_PASSWORD' => $lang['New_password'], 'L_NEW_PASSWORD' => $lang['New_password'],
'L_PASSWORD_IF_CHANGED' => $lang['password_if_changed'], 'L_PASSWORD_IF_CHANGED' => $lang['password_if_changed'],
'L_CONFIRM_PASSWORD' => $lang['Confirm_password'], 'L_CONFIRM_PASSWORD' => $lang['Confirm_password'],
'L_PASSWORD_CONFIRM_IF_CHANGED' => $lang['password_confirm_if_changed'], 'L_PASSWORD_CONFIRM_IF_CHANGED' => $lang['password_confirm_if_changed'],
@ -949,13 +949,13 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'], 'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'],
'L_HIDE_USER' => $lang['Hide_user'], 'L_HIDE_USER' => $lang['Hide_user'],
'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'], 'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
'L_SPECIAL' => $lang['User_special'], 'L_SPECIAL' => $lang['User_special'],
'L_SPECIAL_EXPLAIN' => $lang['User_specail_explain'], 'L_SPECIAL_EXPLAIN' => $lang['User_specail_explain'],
'L_USER_ACTIVE' => $lang['User_status'], 'L_USER_ACTIVE' => $lang['User_status'],
'L_ALLOW_PM' => $lang['User_allowpm'], 'L_ALLOW_PM' => $lang['User_allowpm'],
'L_ALLOW_AVATAR' => $lang['User_allowavatar'], 'L_ALLOW_AVATAR' => $lang['User_allowavatar'],
'L_AVATAR_PANEL' => $lang['Avatar_panel'], 'L_AVATAR_PANEL' => $lang['Avatar_panel'],
'L_AVATAR_EXPLAIN' => $lang['Admin_avatar_explain'], 'L_AVATAR_EXPLAIN' => $lang['Admin_avatar_explain'],
'L_DELETE_AVATAR' => $lang['Delete_Image'], 'L_DELETE_AVATAR' => $lang['Delete_Image'],
@ -981,7 +981,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
'S_FORM_ENCTYPE' => $form_enctype, 'S_FORM_ENCTYPE' => $form_enctype,
'HTML_STATUS' => $html_status, 'HTML_STATUS' => $html_status,
'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="../' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>'), 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="../' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>'),
'SMILIES_STATUS' => $smilies_status, 'SMILIES_STATUS' => $smilies_status,
'L_DELETE_USER' => $lang['User_delete'], 'L_DELETE_USER' => $lang['User_delete'],

View file

@ -21,7 +21,7 @@
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
return; return;
} }
@ -44,7 +44,7 @@ require('pagestart.' . $phpEx);
// //
// Do we have styles admin permissions? // Do we have styles admin permissions?
// //
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
message_die(MESSAGE, $lang['No_admin']); message_die(MESSAGE, $lang['No_admin']);
} }
@ -73,7 +73,7 @@ $l_title_explain = ( $mode == 'admin' ) ? $lang['Admin_logs_explain'] : $lang['M
// //
// Delete entries if requested and able // Delete entries if requested and able
// //
if ( ( isset($HTTP_POST_VARS['delmarked']) || isset($HTTP_POST_VARS['delall']) ) && $acl->get_acl_admin('clearlogs')) if ( ( isset($HTTP_POST_VARS['delmarked']) || isset($HTTP_POST_VARS['delall']) ) && $auth->get_acl_admin('clearlogs'))
{ {
$where_sql = ''; $where_sql = '';
if ( isset($HTTP_POST_VARS['delmarked']) && isset($HTTP_POST_VARS['mark']) ) if ( isset($HTTP_POST_VARS['delmarked']) && isset($HTTP_POST_VARS['mark']) )
@ -85,7 +85,7 @@ if ( ( isset($HTTP_POST_VARS['delmarked']) || isset($HTTP_POST_VARS['delall']) )
$where_sql = "WHERE log_id IN ($where_sql)"; $where_sql = "WHERE log_id IN ($where_sql)";
} }
$sql = "DELETE FROM $table_sql $sql = "DELETE FROM $table_sql
$where_sql"; $where_sql";
$db->sql_query($sql); $db->sql_query($sql);
@ -148,7 +148,7 @@ $forum_options = '';
if ( $mode == 'mod' ) if ( $mode == 'mod' )
{ {
$sql = "SELECT forum_id, forum_name $sql = "SELECT forum_id, forum_name
FROM " . FORUMS_TABLE . " FROM " . FORUMS_TABLE . "
ORDER BY cat_id, forum_order"; ORDER BY cat_id, forum_order";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -203,7 +203,7 @@ if ( $mode == 'mod' )
<tr> <tr>
<td class="cat" colspan="5" height="28" align="center"><span class="gensmall"><?php echo $lang['Display_log']; ?>: &nbsp;<select name="sort_days"><?php echo $sort_day_options; ?></select>&nbsp;<?php echo $lang['Sort_by']; ?> <select name="sort_key"><?php echo $sort_key_options; ?></select> <select name="sort_dir"><?php echo $sort_order_options; ?></select>&nbsp;<input class="liteoption" type="submit" value="<?php echo $lang['Go']; ?>" name="sort" /></span></td> <td class="cat" colspan="5" height="28" align="center"><span class="gensmall"><?php echo $lang['Display_log']; ?>: &nbsp;<select name="sort_days"><?php echo $sort_day_options; ?></select>&nbsp;<?php echo $lang['Sort_by']; ?> <select name="sort_key"><?php echo $sort_key_options; ?></select> <select name="sort_dir"><?php echo $sort_order_options; ?></select>&nbsp;<input class="liteoption" type="submit" value="<?php echo $lang['Go']; ?>" name="sort" /></span></td>
</tr> </tr>
<tr> <tr>
<th width="15%" height="25" nowrap="nowrap"><?php echo $lang['Username']; ?></th> <th width="15%" height="25" nowrap="nowrap"><?php echo $lang['Username']; ?></th>
<th width="15%" nowrap="nowrap"><?php echo $lang['IP']; ?></th> <th width="15%" nowrap="nowrap"><?php echo $lang['IP']; ?></th>
<th width="20%" nowrap="nowrap"><?php echo $lang['Time']; ?></th> <th width="20%" nowrap="nowrap"><?php echo $lang['Time']; ?></th>
@ -224,7 +224,7 @@ if ( $log_count )
for($i = 0; $i < sizeof($log_data); $i++) for($i = 0; $i < sizeof($log_data); $i++)
{ {
$row_class = ( $row_class == 'row1' ) ? 'row2' : 'row1'; $row_class = ( $row_class == 'row1' ) ? 'row2' : 'row1';
?> ?>
<tr> <tr>
<td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $log_data[$i]['username']; ?></td> <td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $log_data[$i]['username']; ?></td>
@ -237,7 +237,7 @@ if ( $log_count )
} }
if ( $acl->get_acl_admin('clearlogs') ) if ( $auth->get_acl_admin('clearlogs') )
{ {
?> ?>
@ -262,14 +262,14 @@ else
</table> </table>
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr> <tr>
<td align="left" valign="top">&nbsp;<span class="nav"><?php echo on_page($log_count, $board_config['topics_per_page'], $start); ?></span></td> <td align="left" valign="top">&nbsp;<span class="nav"><?php echo on_page($log_count, $board_config['topics_per_page'], $start); ?></span></td>
<td align="right" valign="top" nowrap="nowrap"><?php <td align="right" valign="top" nowrap="nowrap"><?php
if ( $acl->get_acl_admin('clearlogs') ) if ( $auth->get_acl_admin('clearlogs') )
{ {
?><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall"><?php echo $lang['Mark_all']; ?></a> :: <a href="javascript:marklist(false);" class="gensmall"><?php echo $lang['Unmark_all']; ?></a></span></b>&nbsp;<br /><br /><?php ?><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall"><?php echo $lang['Mark_all']; ?></a> :: <a href="javascript:marklist(false);" class="gensmall"><?php echo $lang['Unmark_all']; ?></a></span></b>&nbsp;<br /><br /><?php
} }

View file

@ -21,7 +21,7 @@
if ( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
return; return;
} }
@ -42,7 +42,7 @@ require('pagestart.' . $phpEx);
// //
// Do we have forum admin permissions? // Do we have forum admin permissions?
// //
if ( !$acl->get_acl_admin('general') ) if ( !$auth->get_acl_admin('general') )
{ {
return; return;
} }
@ -54,7 +54,7 @@ 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 = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
} }
else else
{ {
// //
// These could be entered via a form button // These could be entered via a form button
@ -89,8 +89,8 @@ if( $mode != '' )
message_die(MESSAGE, $lang['No_word_selected']); message_die(MESSAGE, $lang['No_word_selected']);
} }
$sql = "SELECT * $sql = "SELECT *
FROM " . WORDS_TABLE . " FROM " . WORDS_TABLE . "
WHERE word_id = $word_id"; WHERE word_id = $word_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -158,7 +158,7 @@ if( $mode != '' )
message_die(MESSAGE, $lang['Must_specify_word']); message_die(MESSAGE, $lang['Must_specify_word']);
} }
$sql = "DELETE FROM " . WORDS_TABLE . " $sql = "DELETE FROM " . WORDS_TABLE . "
WHERE word_id = $word_id"; WHERE word_id = $word_id";
$db->sql_query($sql); $db->sql_query($sql);
@ -189,8 +189,8 @@ else
<?php <?php
$sql = "SELECT * $sql = "SELECT *
FROM " . WORDS_TABLE . " FROM " . WORDS_TABLE . "
ORDER BY word"; ORDER BY word";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);

View file

@ -37,7 +37,7 @@ require('pagestart.' . $phpEx);
// //
// Do we have any admin permissions at all? // Do we have any admin permissions at all?
// //
if ( !$acl->get_acl_admin() ) if ( !$auth->get_acl_admin() )
{ {
message_die(MESSAGE, 'No_admin', '', true); message_die(MESSAGE, 'No_admin', '', true);
} }
@ -112,20 +112,20 @@ else if ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' )
$cat = ( !empty($lang[$cat . '_cat']) ) ? $lang[$cat . '_cat'] : preg_replace('/_/', ' ', $cat); $cat = ( !empty($lang[$cat . '_cat']) ) ? $lang[$cat . '_cat'] : preg_replace('/_/', ' ', $cat);
?> ?>
<tr> <tr>
<th class="menu" height="25">&#0187; <?php echo $cat; ?></th> <th class="menu" height="25">&#0187; <?php echo $cat; ?></th>
</tr> </tr>
<?php <?php
@ksort($action_ary); @ksort($action_ary);
foreach ( $action_ary as $action => $file ) foreach ( $action_ary as $action => $file )
{ {
$action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace('/_/', ' ', $action); $action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace('/_/', ' ', $action);
$cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1'; $cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1';
?> ?>
<tr> <tr>
<td class="<?php echo $cell_bg; ?>"><a class="genmed" href="<?php echo $file; ?>" target="main"><?php echo $action; ?></a></td> <td class="<?php echo $cell_bg; ?>"><a class="genmed" href="<?php echo $file; ?>" target="main"><?php echo $action; ?></a></td>
</tr> </tr>
<?php <?php
@ -167,13 +167,13 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
if ( isset($HTTP_POST_VARS['delete']) ) if ( isset($HTTP_POST_VARS['delete']) )
{ {
$sql = "UPDATE " . CONFIG_TABLE . " $sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = config_value - " . sizeof($HTTP_POST_VARS['mark']) . " SET config_value = config_value - " . sizeof($HTTP_POST_VARS['mark']) . "
WHERE config_name = 'num_users'"; WHERE config_name = 'num_users'";
$db->sql_query($sql); $db->sql_query($sql);
} }
$log_action = ( isset($HTTP_POST_VARS['activate']) ) ? 'log_index_activate' : 'log_index_delete'; $log_action = ( isset($HTTP_POST_VARS['activate']) ) ? 'log_index_activate' : 'log_index_delete';
add_admin_log($log_action, sizeof($HTTP_POST_VARS['mark'])); add_admin_log($log_action, sizeof($HTTP_POST_VARS['mark']));
} }
} }
@ -264,7 +264,7 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
if ( preg_match('/^mysql/', SQL_LAYER) ) if ( preg_match('/^mysql/', SQL_LAYER) )
{ {
$result = $db->sql_query('SELECT VERSION() AS mysql_version'); $result = $db->sql_query('SELECT VERSION() AS mysql_version');
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
{ {
$version = $row['mysql_version']; $version = $row['mysql_version'];
@ -273,10 +273,10 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
{ {
$db_name = ( preg_match('/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/', $version) ) ? "`$dbname`" : $dbname; $db_name = ( preg_match('/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/', $version) ) ? "`$dbname`" : $dbname;
$sql = "SHOW TABLE STATUS $sql = "SHOW TABLE STATUS
FROM " . $db_name; FROM " . $db_name;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$dbsize = 0; $dbsize = 0;
while ( $row = $db->sql_fetchrow($result) ) while ( $row = $db->sql_fetchrow($result) )
{ {
@ -308,10 +308,10 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
} }
else if ( preg_match('/^mssql/', SQL_LAYER) ) else if ( preg_match('/^mssql/', SQL_LAYER) )
{ {
$sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize $sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
FROM sysfiles"; FROM sysfiles";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available']; $dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available'];
} }
else else
@ -347,37 +347,37 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
<h1><?php echo $lang['Forum_stats']; ?></h1> <h1><?php echo $lang['Forum_stats']; ?></h1>
<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0"> <table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
<tr> <tr>
<th width="25%" nowrap="nowrap" height="25"><?php echo $lang['Statistic']; ?></th> <th width="25%" nowrap="nowrap" height="25"><?php echo $lang['Statistic']; ?></th>
<th width="25%"><?php echo $lang['Value']; ?></th> <th width="25%"><?php echo $lang['Value']; ?></th>
<th width="25%" nowrap="nowrap"><?php echo $lang['Statistic']; ?></th> <th width="25%" nowrap="nowrap"><?php echo $lang['Statistic']; ?></th>
<th width="25%"><?php echo $lang['Value']; ?></th> <th width="25%"><?php echo $lang['Value']; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Number_posts']; ?>:</td> <td class="row1" nowrap="nowrap"><?php echo $lang['Number_posts']; ?>:</td>
<td class="row2"><b><?php echo $total_posts; ?></b></td> <td class="row2"><b><?php echo $total_posts; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $lang['Posts_per_day']; ?>:</td> <td class="row1" nowrap="nowrap"><?php echo $lang['Posts_per_day']; ?>:</td>
<td class="row2"><b><?php echo $posts_per_day; ?></b></td> <td class="row2"><b><?php echo $posts_per_day; ?></b></td>
</tr> </tr>
<tr> <tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Number_topics']; ?>:</td> <td class="row1" nowrap="nowrap"><?php echo $lang['Number_topics']; ?>:</td>
<td class="row2"><b><?php echo $total_topics; ?></b></td> <td class="row2"><b><?php echo $total_topics; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $lang['Topics_per_day']; ?>:</td> <td class="row1" nowrap="nowrap"><?php echo $lang['Topics_per_day']; ?>:</td>
<td class="row2"><b><?php echo $topics_per_day; ?></b></td> <td class="row2"><b><?php echo $topics_per_day; ?></b></td>
</tr> </tr>
<tr> <tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Number_users']; ?>:</td> <td class="row1" nowrap="nowrap"><?php echo $lang['Number_users']; ?>:</td>
<td class="row2"><b><?php echo $total_users; ?></b></td> <td class="row2"><b><?php echo $total_users; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $lang['Users_per_day']; ?>:</td> <td class="row1" nowrap="nowrap"><?php echo $lang['Users_per_day']; ?>:</td>
<td class="row2"><b><?php echo $users_per_day; ?></b></td> <td class="row2"><b><?php echo $users_per_day; ?></b></td>
</tr> </tr>
<tr> <tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Board_started']; ?>:</td> <td class="row1" nowrap="nowrap"><?php echo $lang['Board_started']; ?>:</td>
<td class="row2"><b><?php echo $start_date; ?></b></td> <td class="row2"><b><?php echo $start_date; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $lang['Avatar_dir_size']; ?>:</td> <td class="row1" nowrap="nowrap"><?php echo $lang['Avatar_dir_size']; ?>:</td>
<td class="row2"><b><?php echo $avatar_dir_size; ?></b></td> <td class="row2"><b><?php echo $avatar_dir_size; ?></b></td>
</tr> </tr>
<tr> <tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Database_size']; ?>:</td> <td class="row1" nowrap="nowrap"><?php echo $lang['Database_size']; ?>:</td>
<td class="row2"><b><?php echo $dbsize; ?></b></td> <td class="row2"><b><?php echo $dbsize; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $lang['Gzip_compression']; ?>:</td> <td class="row1" nowrap="nowrap"><?php echo $lang['Gzip_compression']; ?>:</td>
@ -393,7 +393,7 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
<p><?php echo $lang['Admin_log_index_explain']; ?></p> <p><?php echo $lang['Admin_log_index_explain']; ?></p>
<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0"> <table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
<tr> <tr>
<th width="15%" height="25" nowrap="nowrap"><?php echo $lang['Username']; ?></th> <th width="15%" height="25" nowrap="nowrap"><?php echo $lang['Username']; ?></th>
<th width="15%"><?php echo $lang['IP']; ?></th> <th width="15%"><?php echo $lang['IP']; ?></th>
<th width="20%"><?php echo $lang['Time']; ?></th> <th width="20%"><?php echo $lang['Time']; ?></th>
@ -406,7 +406,7 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
for($i = 0; $i < sizeof($log_data); $i++) for($i = 0; $i < sizeof($log_data); $i++)
{ {
$row_class = ( $row_class == 'row1' ) ? 'row2' : 'row1'; $row_class = ( $row_class == 'row1' ) ? 'row2' : 'row1';
?> ?>
<tr> <tr>
<td class="<?php echo $row_class; ?>"><?php echo $log_data[$i]['username']; ?></td> <td class="<?php echo $row_class; ?>"><?php echo $log_data[$i]['username']; ?></td>
@ -426,17 +426,17 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
<p><?php echo $lang['Inactive_users_explain']; ?></p> <p><?php echo $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"> <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> <tr>
<th width="45%" height="25" nowrap="nowrap"><?php echo $lang['Username']; ?></th> <th width="45%" height="25" nowrap="nowrap"><?php echo $lang['Username']; ?></th>
<th width="45%"><?php echo $lang['Joined']; ?></th> <th width="45%"><?php echo $lang['Joined']; ?></th>
<th width="5%" nowrap="nowrap"><?php echo $lang['Mark']; ?></th> <th width="5%" nowrap="nowrap"><?php echo $lang['Mark']; ?></th>
</tr> </tr>
<?php <?php
$sql = "SELECT user_id, username, user_regdate $sql = "SELECT user_id, username, user_regdate
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_active = 0 WHERE user_active = 0
AND user_id <> " . ANONYMOUS . " AND user_id <> " . ANONYMOUS . "
ORDER BY user_regdate ASC"; ORDER BY user_regdate ASC";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -479,7 +479,7 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
</table> </table>
<table width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> <table width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<td align="right" valign="top" nowrap="nowrap"><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall"><?php echo $lang['Mark_all']; ?></a> :: <a href="javascript:marklist(false);" class="gensmall"><?php echo $lang['Unmark_all']; ?></a></span></b></td> <td align="right" valign="top" nowrap="nowrap"><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall"><?php echo $lang['Mark_all']; ?></a> :: <a href="javascript:marklist(false);" class="gensmall"><?php echo $lang['Unmark_all']; ?></a></span></b></td>
</tr> </tr>
</table></form> </table></form>
@ -506,7 +506,7 @@ else
<frameset rows="60, *" border="0" framespacing="0" frameborder="NO"> <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"> <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"> <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 "index.$phpEx$SID&amp;pane=left"; ?>" name="nav" marginwidth="3" marginheight="3" scrolling="yes">
<frame src="<?php echo "index.$phpEx$SID&amp;pane=right"; ?>" name="main" marginwidth="0" marginheight="0" scrolling="auto"> <frame src="<?php echo "index.$phpEx$SID&amp;pane=right"; ?>" name="main" marginwidth="0" marginheight="0" scrolling="auto">
</frameset> </frameset>

View file

@ -31,7 +31,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management // Start session management
// //
$userdata = $session->start($update); $userdata = $session->start($update);
$acl = new acl($userdata); $auth->acl($userdata);
// //
// End session management // End session management
// //

View file

@ -25,7 +25,7 @@ if ( !defined('IN_PHPBB') )
} }
error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables
set_magic_quotes_runtime(0); // Disable magic_quotes_runtime set_magic_quotes_runtime(0);
require($phpbb_root_path . 'config.'.$phpEx); require($phpbb_root_path . 'config.'.$phpEx);
@ -35,9 +35,9 @@ if ( !defined('PHPBB_INSTALLED') )
exit; exit;
} }
// //set_error_handler('message');
// Define some constants/variables // Define some constants/variables
//
define('ANONYMOUS', 0); define('ANONYMOUS', 0);
// User related // User related
@ -122,6 +122,7 @@ define('VOTE_DESC_TABLE', $table_prefix.'vote_desc');
define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results'); define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results');
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters'); define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
// If magic quotes is off, addslashes
if ( !get_magic_quotes_gpc() ) if ( !get_magic_quotes_gpc() )
{ {
$HTTP_GET_VARS = slash_input_data($HTTP_GET_VARS); $HTTP_GET_VARS = slash_input_data($HTTP_GET_VARS);
@ -135,25 +136,23 @@ $theme = array();
$images = array(); $images = array();
$lang = array(); $lang = array();
//
// Include files // Include files
//
require($phpbb_root_path . 'includes/template.'.$phpEx); require($phpbb_root_path . 'includes/template.'.$phpEx);
require($phpbb_root_path . 'includes/session.'.$phpEx); require($phpbb_root_path . 'includes/session.'.$phpEx);
require($phpbb_root_path . 'includes/functions.'.$phpEx); require($phpbb_root_path . 'includes/functions.'.$phpEx);
require($phpbb_root_path . 'db/' . $dbms . '.'.$phpEx); require($phpbb_root_path . 'db/' . $dbms . '.'.$phpEx);
// Instantiate some basic classes
$session = new session(); $session = new session();
$auth = new auth();
$template = new Template(); $template = new Template();
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
// // Obtain users IP
// Obtain users IP, not encoded in 2.2 if ( $_SERVER['HTTP_X_FORWARDED_FOR'] != '' || $_ENV['HTTP_X_FORWARDED_FOR'] != '' )
//
if ( $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] != '' || $HTTP_ENV_VARS['HTTP_X_FORWARDED_FOR'] != '' )
{ {
$user_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR ); $user_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );
$x_ip = ( !empty($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']) ) ? $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] : $HTTP_ENV_VARS['HTTP_X_FORWARDED_FOR']; $x_ip = ( !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_ENV['HTTP_X_FORWARDED_FOR'];
if ( preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $x_ip, $ip_list) ) if ( preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $x_ip, $ip_list) )
{ {
@ -163,35 +162,29 @@ if ( $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] != '' || $HTTP_ENV_VARS['HTTP_X_F
} }
else else
{ {
$user_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR ); $user_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );
} }
//
// Setup forum wide options, if this fails we output a CRITICAL_ERROR since // Setup forum wide options, if this fails we output a CRITICAL_ERROR since
// basic forum information is not available // basic forum information is not available
//
$sql = "SELECT * $sql = "SELECT *
FROM " . CONFIG_TABLE; FROM " . CONFIG_TABLE;
$result = $db->sql_query($sql); $result = $db->sql_query($sql, false);
while ( $row = $db->sql_fetchrow($result) ) while ( $row = $db->sql_fetchrow($result) )
{ {
$board_config[$row['config_name']] = $row['config_value']; $board_config[$row['config_name']] = $row['config_value'];
} }
// // Show 'Board is disabled' message
// Show 'Board is disabled' message if needed.
//
if ( $board_config['board_disable'] && !defined('IN_ADMIN') && !defined('IN_LOGIN') ) if ( $board_config['board_disable'] && !defined('IN_ADMIN') && !defined('IN_LOGIN') )
{ {
$message = ( !empty($board_config['board_disable_msg']) ) ? $board_config['board_disable_msg'] : 'Board_disable'; $message = ( !empty($board_config['board_disable_msg']) ) ? $board_config['board_disable_msg'] : 'Board_disable';
message_die(MESSAGE, $message, 'Information'); message_die(MESSAGE, $message, 'Information');
//trigger_error($message);
} }
// // addslashes to vars if magic_quotes_gpc is off
// 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.
//
function slash_input_data(&$data) function slash_input_data(&$data)
{ {
if ( is_array($data) ) if ( is_array($data) )

View file

@ -28,7 +28,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new acl($userdata); $auth->acl($userdata);
// //
// End session management // End session management
// //

View file

@ -112,7 +112,7 @@ function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new acl($userdata); $auth->acl($userdata);
// //
// End session management // End session management
// //

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -2,7 +2,7 @@
// //
// Authentication plug-ins is largely down to // Authentication plug-ins is largely down to
// Sergey Kanareykin, our thanks to him. // Sergey Kanareykin, our thanks to him.
// //
function login_ldap(&$username, &$password) function login_ldap(&$username, &$password)
{ {
@ -13,7 +13,7 @@ function login_ldap(&$username, &$password)
return 'LDAP extension not available'; return 'LDAP extension not available';
} }
if ( !($ldap = @ldap_connect($board_config['ldap_server'])) ) if ( !($ldap = @ldap_connect($board_config['ldap_server'])) )
{ {
return 'Could not connect to LDAP server'; return 'Could not connect to LDAP server';
} }
@ -21,26 +21,30 @@ function login_ldap(&$username, &$password)
$search = @ldap_search($ldap, $board_config['ldap_base_dn'], $board_config['ldap_uid'] . '=' . $username, array($board_config['ldap_uid'])); $search = @ldap_search($ldap, $board_config['ldap_base_dn'], $board_config['ldap_uid'] . '=' . $username, array($board_config['ldap_uid']));
$result = @ldap_get_entries($ldap, $search); $result = @ldap_get_entries($ldap, $search);
if ( is_array($result) && count($result) > 1 ) if ( is_array($result) && count($result) > 1 )
{ {
if ( @ldap_bind($ldap, $result[0]['dn'], $password) ) if ( @ldap_bind($ldap, $result[0]['dn'], $password) )
{ {
@ldap_close($ldap); @ldap_close($ldap);
$sql = "SELECT user_id, username, user_password, user_email, user_active $sql = "SELECT user_id, username, user_password, user_email, user_active
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE username = '" . str_replace("\'", "''", $username) . "'"; WHERE username = '" . str_replace("\'", "''", $username) . "'";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
return ( $row = $db->sql_fetchrow($result) ) ? $row : false; return ( $row = $db->sql_fetchrow($result) ) ? $row : false;
} }
} }
@ldap_close($ldap); @ldap_close($ldap);
return false; return false;
} }
//
// This function is used to output any required fields in the authentication
// admin panel. It also defines any required configuration table fields.
//
function admin_ldap(&$new) function admin_ldap(&$new)
{ {
global $lang; global $lang;
@ -59,7 +63,7 @@ function admin_ldap(&$new)
<td class="row2"><input type="text" size="40" name="ldap_uid" value="<?php echo $new['ldap_uid']; ?>" /></td> <td class="row2"><input type="text" size="40" name="ldap_uid" value="<?php echo $new['ldap_uid']; ?>" /></td>
</tr> </tr>
<?php <?php
// //
// These are fields required in the config table // These are fields required in the config table
// //
@ -67,4 +71,16 @@ function admin_ldap(&$new)
} }
//
// Would be nice to allow syncing of 'appropriate' data when user updates
// their username, password, etc. ... should be up to the plugin what data
// is updated.
//
// $mode perhaps being one of NEW, UPDATE, DELETE
//
function usercp_ldap($mode)
{
}
?> ?>

View file

@ -88,7 +88,7 @@ class emailer
$template_lang = $board_config['default_lang']; $template_lang = $board_config['default_lang'];
} }
$this->tpl_file = $phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl'; $this->tpl_file = $phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.txt';
if ( !file_exists($this->tpl_file) ) if ( !file_exists($this->tpl_file) )
{ {
message_die(ERROR, 'Could not find email template file ' . $template_file); message_die(ERROR, 'Could not find email template file ' . $template_file);
@ -177,7 +177,7 @@ class emailer
// Add date and encoding type // Add date and encoding type
// //
$universal_extra = "MIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . gmdate('D, d M Y H:i:s', time()) . " UT\n"; $universal_extra = "MIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . gmdate('D, d M Y H:i:s', time()) . " UT\n";
$this->extra_headers = $universal_extra . $this->extra_headers; $this->extra_headers = $universal_extra . $this->extra_headers;
$result = ( $this->use_smtp ) ? smtpmail($this->address, $this->subject, $this->msg, $this->extra_headers) : @mail($this->address, $this->subject, $this->msg, $this->extra_headers); $result = ( $this->use_smtp ) ? smtpmail($this->address, $this->subject, $this->msg, $this->extra_headers) : @mail($this->address, $this->subject, $this->msg, $this->extra_headers);
@ -295,24 +295,24 @@ class emailer
// //
// This function has been modified as provided // This function has been modified as provided
// by SirSir to allow multiline responses when // by SirSir to allow multiline responses when
// using SMTP Extensions // using SMTP Extensions
// //
function server_parse($socket, $response) function server_parse($socket, $response)
{ {
while ( substr($server_response,3,1) != ' ' ) while ( substr($server_response,3,1) != ' ' )
{ {
if( !( $server_response = fgets($socket, 256) ) ) if( !( $server_response = fgets($socket, 256) ) )
{ {
message_die(ERROR, 'Could not get mail server response codes'); message_die(ERROR, 'Could not get mail server response codes');
} }
} }
if( !( substr($server_response, 0, 3) == $response ) ) if( !( substr($server_response, 0, 3) == $response ) )
{ {
message_die(ERROR, "Ran into problems sending Mail. Response: $server_response"); message_die(ERROR, "Ran into problems sending Mail. Response: $server_response");
} }
} }
/**************************************************************************** /****************************************************************************
* Function: smtpmail * Function: smtpmail
@ -403,25 +403,25 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
server_parse($socket, "220"); server_parse($socket, "220");
if( !empty($board_config['smtp_username']) && !empty($board_config['smtp_password']) ) if( !empty($board_config['smtp_username']) && !empty($board_config['smtp_password']) )
{ {
// Send the RFC2554 specified EHLO. // Send the RFC2554 specified EHLO.
// This improved as provided by SirSir to accomodate // This improved as provided by SirSir to accomodate
// both SMTP AND ESMTP capable servers // both SMTP AND ESMTP capable servers
fputs($socket, "EHLO " . $board_config['smtp_host'] . "\r\n"); fputs($socket, "EHLO " . $board_config['smtp_host'] . "\r\n");
server_parse($socket, "250"); server_parse($socket, "250");
fputs($socket, "AUTH LOGIN\r\n"); fputs($socket, "AUTH LOGIN\r\n");
server_parse($socket, "334"); server_parse($socket, "334");
fputs($socket, base64_encode($board_config['smtp_username']) . "\r\n"); fputs($socket, base64_encode($board_config['smtp_username']) . "\r\n");
server_parse($socket, "334"); server_parse($socket, "334");
fputs($socket, base64_encode($board_config['smtp_password']) . "\r\n"); fputs($socket, base64_encode($board_config['smtp_password']) . "\r\n");
server_parse($socket, "235"); server_parse($socket, "235");
} }
else else
{ {
// Send the RFC821 specified HELO. // Send the RFC821 specified HELO.
fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n"); fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n");
server_parse($socket, "250"); server_parse($socket, "250");
} }
// From this point onward most server response codes should be 250 // From this point onward most server response codes should be 250

View file

@ -44,8 +44,8 @@ foreach ($forum_rows as $row)
)); ));
unset($stored_cat); unset($stored_cat);
} }
if ($acl->get_acl($forum_id, 'forum', 'list')) if ($auth->get_acl($forum_id, 'forum', 'list'))
{ {
switch ($forum_status) switch ($forum_status)
{ {

View file

@ -165,15 +165,15 @@ function get_moderators(&$forum_moderators, $forum_id = false)
// //
function get_forum_rules($mode, &$rules, &$forum_id) function get_forum_rules($mode, &$rules, &$forum_id)
{ {
global $SID, $acl, $lang, $phpEx; global $SID, $auth, $lang, $phpEx;
$rules .= ( ( $acl->get_acl($forum_id, 'forum', 'post') ) ? $lang['Rules_post_can'] : $lang['Rules_post_cannot'] ) . '<br />'; $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'post') ) ? $lang['Rules_post_can'] : $lang['Rules_post_cannot'] ) . '<br />';
$rules .= ( ( $acl->get_acl($forum_id, 'forum', 'reply') ) ? $lang['Rules_reply_can'] : $lang['Rules_reply_cannot'] ) . '<br />'; $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'reply') ) ? $lang['Rules_reply_can'] : $lang['Rules_reply_cannot'] ) . '<br />';
$rules .= ( ( $acl->get_acl($forum_id, 'forum', 'edit') ) ? $lang['Rules_edit_can'] : $lang['Rules_edit_cannot'] ) . '<br />'; $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'edit') ) ? $lang['Rules_edit_can'] : $lang['Rules_edit_cannot'] ) . '<br />';
$rules .= ( ( $acl->get_acl($forum_id, 'forum', 'delete') || $acl->get_acl($forum_id, 'mod', 'delete') ) ? $lang['Rules_delete_can'] : $lang['Rules_delete_cannot'] ) . '<br />'; $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'delete') || $auth->get_acl($forum_id, 'mod', 'delete') ) ? $lang['Rules_delete_can'] : $lang['Rules_delete_cannot'] ) . '<br />';
$rules .= ( ( $acl->get_acl($forum_id, 'forum', 'attach') ) ? $lang['Rules_attach_can'] : $lang['Rules_attach_cannot'] ) . '<br />'; $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'attach') ) ? $lang['Rules_attach_can'] : $lang['Rules_attach_cannot'] ) . '<br />';
if ( $acl->get_acl($forum_id, 'mod') ) if ( $auth->get_acl($forum_id, 'mod') )
{ {
$rules .= sprintf($lang['Rules_moderate'], '<a href="modcp.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">', '</a>'); $rules .= sprintf($lang['Rules_moderate'], '<a href="modcp.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">', '</a>');
} }
@ -183,7 +183,7 @@ function get_forum_rules($mode, &$rules, &$forum_id)
function make_jumpbox($action, $match_forum_id = 0) function make_jumpbox($action, $match_forum_id = 0)
{ {
global $SID, $acl, $template, $lang, $db, $nav_links, $phpEx; global $SID, $auth, $template, $lang, $db, $nav_links, $phpEx;
// $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id // $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
// FROM (( " . FORUMS_TABLE . " f // FROM (( " . FORUMS_TABLE . " f
@ -209,7 +209,7 @@ function make_jumpbox($action, $match_forum_id = 0)
{ {
if ( $row['forum_left_id'] > $last_forum_right_id ) if ( $row['forum_left_id'] > $last_forum_right_id )
{ {
if ( $acl->get_acl($row['forum_id'], 'forum', 'list') ) if ( $auth->get_acl($row['forum_id'], 'forum', 'list') )
{ {
$selected = ( $row['forum_id'] == $match_forum_id ) ? 'selected="selected"' : ''; $selected = ( $row['forum_id'] == $match_forum_id ) ? 'selected="selected"' : '';
$boxstring .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $row['forum_name'] . '</option>'; $boxstring .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $row['forum_name'] . '</option>';
@ -496,80 +496,41 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
$on_page = floor($start_item / $per_page) + 1; $on_page = floor($start_item / $per_page) + 1;
$page_string = ''; $page_string = ( $on_page == 1 ) ? '<b>1</b>' : '<a href="' . $base_url . "&amp;start=" . ( ( $on_page - 2 ) * $per_page ) . '">' . $lang['Previous'] . '</a>&nbsp;&nbsp;<a href="' . $base_url . '">1</a>';
if ( $total_pages > 10 )
{
$init_page_max = ( $total_pages > 3 ) ? 3 : $total_pages;
for($i = 1; $i < $init_page_max + 1; $i++) if ( $total_pages > 5 )
{
$start_cnt = min(max(1, $on_page - 4), $total_pages - 5);
$end_cnt = max(min($total_pages, $on_page + 4), 6);
$page_string .= ( $start_cnt > 1 ) ? ' ... ' : ', ';
for($i = $start_cnt + 1; $i < $end_cnt; $i++)
{ {
$page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "&amp;start=" . ( ( $i - 1 ) * $per_page ) . '">' . $i . '</a>'; $page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "&amp;start=" . ( ( $i - 1 ) * $per_page ) . '">' . $i . '</a>';
if ( $i < $init_page_max ) if ( $i < $end_cnt - 1 )
{ {
$page_string .= ", "; $page_string .= ', ';
} }
} }
if ( $total_pages > 3 ) $page_string .= ( $end_cnt < $total_pages ) ? ' ... ' : ', ';
{
if ( $on_page > 1 && $on_page < $total_pages )
{
$page_string .= ( $on_page > 5 ) ? ' ... ' : ', ';
$init_page_min = ( $on_page > 4 ) ? $on_page : 5;
$init_page_max = ( $on_page < $total_pages - 4 ) ? $on_page : $total_pages - 4;
for($i = $init_page_min - 1; $i < $init_page_max + 2; $i++)
{
$page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "&amp;start=" . ( ( $i - 1 ) * $per_page ) . '">' . $i . '</a>';
if ( $i < $init_page_max + 1 )
{
$page_string .= ', ';
}
}
$page_string .= ( $on_page < $total_pages - 4 ) ? ' ... ' : ', ';
}
else
{
$page_string .= ' ... ';
}
for($i = $total_pages - 2; $i < $total_pages + 1; $i++)
{
$page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "&amp;start=" . ( ( $i - 1 ) * $per_page ) . '">' . $i . '</a>';
if( $i < $total_pages )
{
$page_string .= ", ";
}
}
}
} }
else else
{ {
for($i = 1; $i < $total_pages + 1; $i++) $page_string .= ', ';
for($i = 2; $i < $total_pages; $i++)
{ {
$page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "&amp;start=" . ( ( $i - 1 ) * $per_page ) . '">' . $i . '</a>'; $page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "&amp;start=" . ( ( $i - 1 ) * $per_page ) . '">' . $i . '</a>';
if ( $i < $total_pages ) if ( $i < $total_pages )
{ {
$page_string .= ', '; $page_string .= ', ';
} }
} }
} }
if ( $add_prevnext_text ) $page_string .= ( $on_page == $total_pages ) ? '<b>' . $total_pages . '</b>' : '<a href="' . $base_url . '&amp;start=' . ( ( $total_pages - 1 ) * $per_page ) . '">' . $total_pages . '</a>&nbsp;&nbsp;<a href="' . $base_url . "&amp;start=" . ( $on_page * $per_page ) . '">' . $lang['Next'] . '</a>';
{
if ( $on_page > 1 )
{
$page_string = ' <a href="' . $base_url . "&amp;start=" . ( ( $on_page - 2 ) * $per_page ) . '">' . $lang['Previous'] . '</a>&nbsp;&nbsp;' . $page_string;
}
if ( $on_page < $total_pages )
{
$page_string .= '&nbsp;&nbsp;<a href="' . $base_url . "&amp;start=" . ( $on_page * $per_page ) . '">' . $lang['Next'] . '</a>';
}
}
$page_string = $lang['Goto_page'] . ' ' . $page_string; $page_string = $lang['Goto_page'] . ' ' . $page_string;
@ -640,9 +601,10 @@ function obtain_word_list(&$orig_word, &$replacement_word)
// failures, etc. // failures, etc.
// -> ERROR : Use for any error, a simple page will be output // -> ERROR : Use for any error, a simple page will be output
// //
// $errno, $errstr, $errfile, $errline
function message_die($msg_code, $msg_text = '', $msg_title = '') function message_die($msg_code, $msg_text = '', $msg_title = '')
{ {
global $db, $session, $acl, $template, $board_config, $theme, $lang, $userdata, $user_ip; global $db, $session, $auth, $template, $board_config, $theme, $lang, $userdata, $user_ip;
global $phpEx, $phpbb_root_path, $nav_links, $starttime; global $phpEx, $phpbb_root_path, $nav_links, $starttime;
switch ( $msg_code ) switch ( $msg_code )

File diff suppressed because it is too large Load diff

View file

@ -26,9 +26,7 @@ if ( !defined('IN_PHPBB') )
define('HEADER_INC', TRUE); define('HEADER_INC', TRUE);
//
// gzip_compression // gzip_compression
//
if ( $board_config['gzip_compress'] ) if ( $board_config['gzip_compress'] )
{ {
if ( extension_loaded('zlib') && strstr($HTTP_USER_AGENT,'compatible') && !headers_sent() ) if ( extension_loaded('zlib') && strstr($HTTP_USER_AGENT,'compatible') && !headers_sent() )
@ -37,35 +35,25 @@ if ( $board_config['gzip_compress'] )
} }
} }
//
// Generate logged in/logged out status // Generate logged in/logged out status
// if ( $userdata['user_id'] )
if ( $userdata['user_id'] != ANONYMOUS )
{ {
$u_login_logout = 'login.'.$phpEx.'?logout=true'; $u_login_logout = 'login.'.$phpEx. $SID . '&amp;logout=true';
$l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]'; $l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';
} }
else else
{ {
$u_login_logout = 'login.'.$phpEx; $u_login_logout = 'login.'.$phpEx . $SID;
$l_login_logout = $lang['Login']; $l_login_logout = $lang['Login'];
} }
$s_last_visit = ( $userdata['user_id'] != ANONYMOUS ) ? create_date($board_config['default_dateformat'], $userdata['user_lastvisit'], $board_config['board_timezone']) : ''; // Last visit date/time
$s_last_visit = ( $userdata['user_id'] ) ? create_date($board_config['default_dateformat'], $userdata['session_last_visit'], $board_config['board_timezone']) : '';
// // Timezone : $user->dst
// Get basic (usernames + totals) online $s_timezone = ( $userdata['user_dst'] ) ? sprintf($lang['All_times'], $lang[floatval($board_config['board_timezone'])], $lang['tz']['dst']) : sprintf($lang['All_times'], $lang[floatval($board_config['board_timezone'])], '');
// situation
//
$user_forum_sql = ( !empty($forum_id) ) ? "AND s.session_page LIKE '%f=$forum_id%'" : '';
$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_colour, s.session_ip
FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE ." s
WHERE u.user_id = s.session_user_id
AND s.session_time >= ".( time() - 300 ) . "
$user_forum_sql
ORDER BY u.username ASC, s.session_ip ASC";
$result = $db->sql_query($sql);
// Get users online list
$userlist_ary = array(); $userlist_ary = array();
$userlist_visible = array(); $userlist_visible = array();
@ -76,11 +64,20 @@ $online_userlist = '';
$prev_user_id = 0; $prev_user_id = 0;
$prev_user_ip = ''; $prev_user_ip = '';
// && $auth->get_acl('forum', 'read', $forum_id)
$user_forum_sql = ( is_int($forum_id)) ? '' : "AND s.session_page LIKE '%f=$forum_id%'";
$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_colour, s.session_ip
FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE ." s
WHERE s.session_time >= ".( time() - 300 ) . "
$user_forum_sql
AND u.user_id = s.session_user_id
ORDER BY u.username ASC, s.session_ip ASC";
$result = $db->sql_query($sql, false);
while( $row = $db->sql_fetchrow($result) ) while( $row = $db->sql_fetchrow($result) )
{ {
// User is logged in and therefor not a guest // User is logged in and therefor not a guest
if ( $row['user_id'] != ANONYMOUS ) if ( $row['user_id'] )
{ {
// Skip multiple sessions for one user // Skip multiple sessions for one user
if ( $row['user_id'] != $prev_user_id ) if ( $row['user_id'] != $prev_user_id )
@ -101,7 +98,7 @@ while( $row = $db->sql_fetchrow($result) )
$logged_hidden_online++; $logged_hidden_online++;
} }
if ( $row['user_allow_viewonline'] || $acl->get_acl_admin() ) if ( $row['user_allow_viewonline'] || $auth->get_acl_admin() )
{ {
$online_userlist .= ( $online_userlist != '' ) ? ', ' . $user_online_link : $user_online_link; $online_userlist .= ( $online_userlist != '' ) ? ', ' . $user_online_link : $user_online_link;
} }
@ -215,17 +212,17 @@ $l_online_users .= sprintf($l_g_user_s, $guests_online);
// Obtain number of new private messages // Obtain number of new private messages
// if user is logged in // if user is logged in
// //
if ( $userdata['user_id'] != ANONYMOUS ) if ( $userdata['user_id'] )
{ {
if ( $userdata['user_new_privmsg'] ) if ( $userdata['user_new_privmsg'] )
{ {
$l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms']; $l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms'];
$l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']); $l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']);
if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] ) if ( $userdata['user_last_privmsg'] > $userdata['session_last_visit'] )
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_last_privmsg = " . $userdata['user_lastvisit'] . " SET user_last_privmsg = " . $userdata['session_last_visit'] . "
WHERE user_id = " . $userdata['user_id']; WHERE user_id = " . $userdata['user_id'];
$db->sql_query($sql); $db->sql_query($sql);
@ -341,14 +338,14 @@ $template->assign_vars(array(
'U_MEMBERSLIST' => 'memberlist.'.$phpEx.$SID, 'U_MEMBERSLIST' => 'memberlist.'.$phpEx.$SID,
'U_GROUP_CP' => 'groupcp.'.$phpEx.$SID, 'U_GROUP_CP' => 'groupcp.'.$phpEx.$SID,
'S_USER_LOGGED_IN' => ( $userdata['user_id'] == ANONYMOUS ) ? false : true, 'S_USER_LOGGED_IN' => ( $userdata['user_id'] ) ? true : false,
'S_USER_PM_POPUP' => ( !empty($userdata['user_popup_pm']) ) ? true : false, 'S_USER_PM_POPUP' => ( !empty($userdata['user_popup_pm']) ) ? true : false,
'S_USER_BROWSER' => $userdata['session_browser'], 'S_USER_BROWSER' => $userdata['session_browser'],
'S_CONTENT_DIRECTION' => $lang['DIRECTION'], 'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
'S_CONTENT_ENCODING' => $lang['ENCODING'], 'S_CONTENT_ENCODING' => $lang['ENCODING'],
'S_CONTENT_DIR_LEFT' => $lang['LEFT'], 'S_CONTENT_DIR_LEFT' => $lang['LEFT'],
'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'], 'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'],
'S_TIMEZONE' => sprintf($lang['All_times'], $lang[floatval($board_config['board_timezone'])]), 'S_TIMEZONE' => $s_timezone,
'S_LOGIN_ACTION' => 'login.'.$phpEx.$SID, 'S_LOGIN_ACTION' => 'login.'.$phpEx.$SID,
'T_STYLESHEET_DATA' => $theme['css_data'], 'T_STYLESHEET_DATA' => $theme['css_data'],

View file

@ -40,12 +40,12 @@ if (defined('DEBUG'))
exit; exit;
} }
$debug_output = sprintf('<br /><br />[ Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ( ( $board_config['gzip_compress'] ) ? 'On' : 'Off' ) . ' | Load : ' . ( ( $session->load ) ? $session->load : 'N/A') . ' | <a href="' . $_SERVER['REQUEST_URI'] . '&explain=1">Explain</a> ]', $totaltime); $debug_output = sprintf('<br /><br />[ Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ( ( $board_config['gzip_compress'] ) ? 'On' : 'Off' ) . ' | Load : ' . ( ( $session->load ) ? $session->load : 'N/A') . ' | <a href="' . $_SERVER['REQUEST_URI'] . '&amp;explain=1">Explain</a> ]', $totaltime);
} }
$template->assign_vars(array( $template->assign_vars(array(
'PHPBB_VERSION' => $board_config['version'], 'PHPBB_VERSION' => $board_config['version'],
'ADMIN_LINK' => ( $acl->get_acl_admin() ) ? '<a href="' . "admin/index.$phpEx$SID" . '">' . $lang['Admin_panel'] . '</a><br /><br />' : '', 'ADMIN_LINK' => ( $auth->get_acl_admin() ) ? '<a href="' . "admin/index.$phpEx$SID" . '">' . $lang['Admin_panel'] . '</a><br /><br />' : '',
'DEBUG_OUTPUT' => ( defined('DEBUG') ) ? $debug_output : '') 'DEBUG_OUTPUT' => ( defined('DEBUG') ) ? $debug_output : '')
); );

View file

@ -22,34 +22,34 @@
class session { class session {
var $session_id = ''; var $session_id = '';
var $browser = '';
var $page = '';
var $load; var $load;
// Called at each page start ... checks for, updates and/or creates a session
function start($update = true) function start($update = true)
{ {
global $SID, $db, $board_config, $user_ip; global $SID, $db, $board_config, $user_ip;
global $HTTP_SERVER_VARS, $HTTP_ENV_VARS, $HTTP_COOKIE_VARS, $HTTP_GET_VARS;
$user_browser = ( !empty($HTTP_SERVER_VARS['HTTP_USER_AGENT']) ) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : $HTTP_ENV_VARS['HTTP_USER_AGENT'];
$user_page = ( !empty($HTTP_SERVER_VARS['PHP_SELF']) ) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_ENV_VARS['PHP_SELF'];
$user_page .= '&' . ( ( !empty($HTTP_SERVER_VARS['QUERY_STRING']) ) ? $HTTP_SERVER_VARS['QUERY_STRING'] : $HTTP_ENV_VARS['QUERY_STRING'] );
$current_time = time(); $current_time = time();
$this->browser = ( !empty($_SERVER['HTTP_USER_AGENT']) ) ? $_SERVER['HTTP_USER_AGENT'] : $_ENV['HTTP_USER_AGENT'];
$this->page = ( !empty($_SERVER['PHP_SELF']) ) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF'];
$this->page .= '&' . ( ( !empty($_SERVER['QUERY_STRING']) ) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING'] );
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_data']) ) if ( isset($_COOKIE[$board_config['cookie_name'] . '_sid']) || isset($_COOKIE[$board_config['cookie_name'] . '_data']) )
{ {
$sessiondata = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_data']) ) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_data'])) : ''; $sessiondata = ( isset($_COOKIE[$board_config['cookie_name'] . '_data']) ) ? unserialize(stripslashes($_COOKIE[$board_config['cookie_name'] . '_data'])) : '';
$this->session_id = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) ) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid'] : ''; $this->session_id = ( isset($_COOKIE[$board_config['cookie_name'] . '_sid']) ) ? $_COOKIE[$board_config['cookie_name'] . '_sid'] : '';
$SID = '?sid='; $SID = '?sid=';
} }
else else
{ {
$sessiondata = ''; $sessiondata = '';
$this->session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : ''; $this->session_id = ( isset($_GET['sid']) ) ? $_GET['sid'] : '';
$SID = '?sid=' . $this->session_id; $SID = '?sid=' . $this->session_id;
} }
//
// Load limit check (if applicable) // Load limit check (if applicable)
//
if ( !empty($board_config['limit_load']) && file_exists('/proc/loadavg') ) if ( !empty($board_config['limit_load']) && file_exists('/proc/loadavg') )
{ {
if ( $load = @file('/proc/loadavg') ) if ( $load = @file('/proc/loadavg') )
@ -63,18 +63,7 @@ class session {
} }
} }
//
// Garbage collection ... remove old sessions updating user information
// if necessary. It means (potentially) lots of queries but only infrequently
//
if ( $current_time - $board_config['session_gc'] > $board_config['session_last_gc'] )
{
$this->gc($current_time);
}
//
// session_id exists so go ahead and attempt to grab all data in preparation // session_id exists so go ahead and attempt to grab all data in preparation
//
if ( !empty($this->session_id) ) if ( !empty($this->session_id) )
{ {
$sql = "SELECT u.*, s.* $sql = "SELECT u.*, s.*
@ -86,28 +75,27 @@ class session {
$userdata = $db->sql_fetchrow($result); $userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result); $db->sql_freeresult($result);
//
// Did the session exist in the DB? // Did the session exist in the DB?
//
if ( isset($userdata['user_id']) ) if ( isset($userdata['user_id']) )
{ {
// // Validate IP length according to admin ... has no effect on IPv6
// Do not check IP assuming equivalence, if IPv4 we'll check only first 24
// bits ... I've been told (by vHiker) this should alleviate problems with
// load balanced et al proxies while retaining some reliance on IP security.
//
$ip_check_s = explode('.', $userdata['session_ip']); $ip_check_s = explode('.', $userdata['session_ip']);
$ip_check_u = explode('.', $user_ip); $ip_check_u = explode('.', $user_ip);
if ( $ip_check_s[0].'.'.$ip_check_s[1].'.'.$ip_check_s[2] == $ip_check_u[0].'.'.$ip_check_u[1].'.'.$ip_check_u[2] ) $u_ip = $s_ip = '';
for($i = 0; $i < $board_config['ip_check']; $i++)
{
$u_ip .= $ip_check_u[$i] . '.';
$s_ip .= $ip_check_s[$i] . '.';
}
if ( $u_ip == $s_ip )
{ {
//
// Only update session DB a minute or so after last update or if page changes // Only update session DB a minute or so after last update or if page changes
//
if ( ( $current_time - $userdata['session_time'] > 60 || $userdata['session_page'] != $user_page ) && $update ) if ( ( $current_time - $userdata['session_time'] > 60 || $userdata['session_page'] != $user_page ) && $update )
{ {
$sql = "UPDATE " . SESSIONS_TABLE . " $sql = "UPDATE " . SESSIONS_TABLE . "
SET session_time = $current_time, session_page = '$user_page' SET session_time = $current_time, session_page = '$this->page'
WHERE session_id = '" . $this->session_id . "'"; WHERE session_id = '" . $this->session_id . "'";
$db->sql_query($sql); $db->sql_query($sql);
} }
@ -117,29 +105,23 @@ class session {
} }
} }
//
// If we reach here then no (valid) session exists. So we'll create a new one, // If we reach here then no (valid) session exists. So we'll create a new one,
// using the cookie user_id if available to pull basic user prefs. // using the cookie user_id if available to pull basic user prefs.
//
$autologin = ( isset($sessiondata['autologinid']) ) ? $sessiondata['autologinid'] : ''; $autologin = ( isset($sessiondata['autologinid']) ) ? $sessiondata['autologinid'] : '';
$user_id = ( isset($sessiondata['userid']) ) ? intval($sessiondata['userid']) : ANONYMOUS; $user_id = ( isset($sessiondata['userid']) ) ? intval($sessiondata['userid']) : ANONYMOUS;
return $this->create($user_id, $autologin, $user_page, $user_browser); return $this->create($user_id, $autologin);
} }
//
// Create a new session // Create a new session
// function create(&$user_id, &$autologin)
function create(&$user_id, &$autologin, &$user_page, &$user_browser)
{ {
global $SID, $db, $board_config, $user_ip; global $SID, $db, $board_config, $user_ip;
$sessiondata = array(); $sessiondata = array();
$current_time = time(); $current_time = time();
//
// Limit sessions in 1 minute period // Limit sessions in 1 minute period
//
$sql = "SELECT COUNT(*) AS sessions $sql = "SELECT COUNT(*) AS sessions
FROM " . SESSIONS_TABLE . " FROM " . SESSIONS_TABLE . "
WHERE session_time >= " . ( $current_time - 60 ); WHERE session_time >= " . ( $current_time - 60 );
@ -153,9 +135,14 @@ class session {
message_die(MESSAGE, 'Board_unavailable'); message_die(MESSAGE, 'Board_unavailable');
} }
// // Garbage collection ... remove old sessions updating user information
// if necessary. It means (potentially) 22 queries but only infrequently
if ( $current_time - $board_config['session_gc'] > $board_config['session_last_gc'] )
{
$this->gc($current_time);
}
// Grab user data // Grab user data
//
$sql = "SELECT * $sql = "SELECT *
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_id = $user_id"; WHERE user_id = $user_id";
@ -164,9 +151,7 @@ class session {
$userdata = $db->sql_fetchrow($result); $userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result); $db->sql_freeresult($result);
//
// Check autologin request, is it valid? // Check autologin request, is it valid?
//
if ( $userdata['user_password'] != $autologin || !$userdata['user_active'] || $user_id == ANONYMOUS ) if ( $userdata['user_password'] != $autologin || !$userdata['user_active'] || $user_id == ANONYMOUS )
{ {
$autologin = ''; $autologin = '';
@ -195,13 +180,11 @@ class session {
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
//
// Create or update the session // Create or update the session
//
$db->sql_return_on_error(true); $db->sql_return_on_error(true);
$sql = "UPDATE " . SESSIONS_TABLE . " $sql = "UPDATE " . SESSIONS_TABLE . "
SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_browser = '$user_browser', session_page = '$user_page' SET session_user_id = $user_id, session_last_visit = " . $userdata['user_lastvisit'] . ", session_start = $current_time, session_time = $current_time, session_browser = '$this->browser', session_page = '$this->page'
WHERE session_id = '" . $this->session_id . "'"; WHERE session_id = '" . $this->session_id . "'";
if ( !($result = $db->sql_query($sql)) || !$db->sql_affectedrows() ) if ( !($result = $db->sql_query($sql)) || !$db->sql_affectedrows() )
{ {
@ -209,8 +192,8 @@ class session {
$this->session_id = md5(uniqid($user_ip)); $this->session_id = md5(uniqid($user_ip));
$sql = "INSERT INTO " . SESSIONS_TABLE . " $sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_start, session_time, session_ip, session_browser, session_page) (session_id, session_user_id, session_last_visit, session_start, session_time, session_ip, session_browser, session_page)
VALUES ('" . $this->session_id . "', $user_id, $current_time, $current_time, '$user_ip', '$user_browser', '$user_page')"; VALUES ('" . $this->session_id . "', $user_id, " . $userdata['user_lastvisit'] . ", $current_time, $current_time, '$user_ip', '$this->browser', '$this->page')";
$db->sql_query($sql); $db->sql_query($sql);
} }
$db->sql_return_on_error(false); $db->sql_return_on_error(false);
@ -220,29 +203,31 @@ class session {
$sessiondata['autologinid'] = ( $autologin && $user_id != ANONYMOUS ) ? $autologin : ''; $sessiondata['autologinid'] = ( $autologin && $user_id != ANONYMOUS ) ? $autologin : '';
$sessiondata['userid'] = $user_id; $sessiondata['userid'] = $user_id;
setcookie($board_config['cookie_name'] . '_data', serialize($sessiondata), $current_time + 31536000, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); $this->set_cookie('data', serialize($sessiondata), $current_time + 31536000);
setcookie($board_config['cookie_name'] . '_sid', $this->session_id, 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); $this->set_cookie('sid', $this->session_id, 0);
$SID = '?sid=' . $this->session_id; $SID = '?sid=' . $this->session_id;
// Events ...
if ( $userdata['user_id'] )
{
// do_events();
}
return $userdata; return $userdata;
} }
//
// Destroy a session // Destroy a session
//
function destroy(&$userdata) function destroy(&$userdata)
{ {
global $SID, $db, $board_config; global $SID, $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS;
$current_time = time(); $current_time = time();
setcookie($board_config['cookie_name'] . '_data', '', $current_time - 31536000, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); $this->set_cookie('data', '', $current_time - 31536000);
setcookie($board_config['cookie_name'] . '_sid', '', $current_time - 31536000, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); $this->set_cookie('sid', '', $current_time - 31536000);
$SID = '?sid=';
//
// Delete existing session, update last visit info first! // Delete existing session, update last visit info first!
//
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_lastvisit = " . $userdata['session_time'] . ", user_session_page = '" . $userdata['session_page'] . "' SET user_lastvisit = " . $userdata['session_time'] . ", user_session_page = '" . $userdata['session_page'] . "'
WHERE user_id = " . $userdata['user_id']; WHERE user_id = " . $userdata['user_id'];
@ -253,15 +238,34 @@ class session {
AND session_user_id = " . $userdata['user_id']; AND session_user_id = " . $userdata['user_id'];
$db->sql_query($sql); $db->sql_query($sql);
$SID = '?sid=';
$this->session_id = ''; $this->session_id = '';
return true; return true;
} }
// Set a cookie
function set_cookie($name, $cookiedata, $cookietime)
{
global $board_config;
setcookie($board_config['cookie_name'] . '_' . $name, $cookiedata, $cookietime, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
}
// This just won't work correctly as it stands ... if a user has more than one session in
// the DB and gc subsequently runs, updating their user_lastvisit time it will screw up
// marking of forums, etc. since it will be reflected immediately in the users current session
// //
// One way around this would be to store the last visit time within each session and use
// that rather than user_lastvisit in the relevant places. However, the 'problem' still
// persists of a user creating a new session (after leaving the board) before gc has run
// and not having their "true" last visit time be used (i.e. their user_lastvisit won't
// have yet been updated). This behaviour seems to be that of vB and our users seemed to
// dislike this approach when a similar issue arose during 2.0.0 development ... could
// possibly check sessions table before creating new session to see if user is already
// listed ... if they are then use the last session_time from there ... adds another
// query during create though
// Garbage collection // Garbage collection
//
function gc(&$current_time) function gc(&$current_time)
{ {
global $db, $board_config, $user_ip; global $db, $board_config, $user_ip;
@ -269,6 +273,7 @@ class session {
$sql = "SELECT * $sql = "SELECT *
FROM " . SESSIONS_TABLE . " FROM " . SESSIONS_TABLE . "
WHERE session_time < " . ( $current_time - $board_config['session_length'] ) . " WHERE session_time < " . ( $current_time - $board_config['session_length'] ) . "
ORDER BY session_user_id, session_time
LIMIT 10"; LIMIT 10";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -290,9 +295,7 @@ class session {
if ( $del_session_id != '' ) if ( $del_session_id != '' )
{ {
//
// Delete expired sessions // Delete expired sessions
//
$sql = "DELETE FROM " . SESSIONS_TABLE . " $sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_id IN ($del_session_id)"; WHERE session_id IN ($del_session_id)";
$db->sql_query($sql); $db->sql_query($sql);
@ -300,10 +303,8 @@ class session {
if ( $del_sessions < 10 ) if ( $del_sessions < 10 )
{ {
//
// Less than 10 sessions, update gc timer ... else we want gc // Less than 10 sessions, update gc timer ... else we want gc
// called again to delete other sessions // called again to delete other sessions
//
$sql = "UPDATE " . CONFIG_TABLE . " $sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$current_time' SET config_value = '$current_time'
WHERE config_name = 'session_last_gc'"; WHERE config_name = 'session_last_gc'";
@ -313,9 +314,7 @@ class session {
return; return;
} }
// // Taken over by user class ... for now at least
//
//
function configure($userdata, $lang_set = false) function configure($userdata, $lang_set = false)
{ {
global $db, $template, $lang, $board_config, $theme, $images; global $db, $template, $lang, $board_config, $theme, $images;
@ -323,25 +322,14 @@ class session {
if ( $userdata['user_id'] ) if ( $userdata['user_id'] )
{ {
$board_config['default_lang'] = $userdata['user_lang']; $board_config['default_lang'] = ( file_exists($phpbb_root_path . 'language/lang_' . $userdata['user_lang']) ) ? $userdata['user_lang'] : $board_config['default_lang'];
$board_config['default_dateformat'] = $userdata['user_dateformat']; $board_config['default_dateformat'] = $userdata['user_dateformat'];
$board_config['board_timezone'] = $userdata['user_timezone']; $board_config['board_timezone'] = $userdata['user_timezone'];
} }
if ( !file_exists($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx) )
{
$board_config['default_lang'] = 'english';
}
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx); include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx);
if ( defined('IN_ADMIN') ) if ( defined('IN_ADMIN') )
{ {
if ( !file_exists($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.'.$phpEx) )
{
$board_config['default_lang'] = 'english';
}
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx); include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx);
} }
@ -369,22 +357,128 @@ class session {
$i10n = array('post_new', 'post_locked', 'post_pm', 'reply_new', 'reply_pm', 'reply_locked', 'icon_quote', 'icon_edit', 'icon_search', 'icon_profile', 'icon_pm', 'icon_email', 'icon_www', 'icon_icq', 'icon_aim', 'icon_yim', 'icon_msnm', 'icon_delete', 'icon_ip', 'icon_no_email', 'icon_no_www', 'icon_no_icq', 'icon_no_aim', 'icon_no_yim', 'icon_no_msnm'); $i10n = array('post_new', 'post_locked', 'post_pm', 'reply_new', 'reply_pm', 'reply_locked', 'icon_quote', 'icon_edit', 'icon_search', 'icon_profile', 'icon_pm', 'icon_email', 'icon_www', 'icon_icq', 'icon_aim', 'icon_yim', 'icon_msnm', 'icon_delete', 'icon_ip', 'icon_no_email', 'icon_no_www', 'icon_no_icq', 'icon_no_aim', 'icon_no_yim', 'icon_no_msnm');
for($i = 0; $i < sizeof($i10n); $i++) foreach ( $i10n as $icon )
{ {
$theme[$i10n[$i]] = str_replace('{LANG}', 'lang_' . $img_lang, $theme[$i10n[$i]]); $theme[$icon] = str_replace('{LANG}', 'lang_' . $img_lang, $theme[$icon]);
} }
return; return;
} }
} }
// Contains (at present) basic user methods such as configuration
// creating date/time ... keep this?
class user
{
var $lang_name;
var $lang_path;
var $date_format;
var $timezone;
var $dst;
function user(&$userdata, $lang_set = false, $style = false)
{
global $db, $template, $lang, $board_config, $theme, $images;
global $phpEx, $phpbb_root_path;
if ( $userdata['user_id'] )
{
$this->lang_name = ( file_exists($phpbb_root_path . 'language/' . $userdata['user_lang']) ) ? $userdata['user_lang'] : $board_config['default_lang'];
$this->lang_path = $phpbb_root_path . 'language/' . $this->lang_name;
$this->date_format = $userdata['user_dateformat'];
$this->timezone = $userdata['user_timezone'];
$this->dst = $userdata['user_dst'] * 3600;
}
else if ( isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) )
{
$accept_lang_ary = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach ( $accept_lang_ary as $accept_lang )
{
// Set correct format ... guess full xx_YY form
$accept_lang = substr($accept_lang, 0, 2) . '_' . strtoupper(substr($accept_lang, 3, 2));
if ( file_exists($phpbb_root_path . 'language/' . $accept_lang) )
{
$this->lang_name = $accept_lang;
$this->lang_path = $phpbb_root_path . 'language/' . $accept_lang;
break;
}
else
{
// No match on xx_YY so try xx
$accept_lang = substr($accept_lang, 0, 2);
if ( file_exists($phpbb_root_path . 'language/' . $accept_lang) )
{
$this->lang_name = $accept_lang;
$this->lang_path = $phpbb_root_path . 'language/' . $accept_lang;
break;
}
}
}
$this->date_format = $board_config['default_dateformat'];
$this->timezone = $board_config['board_timezone'];
$this->dst = 0;
}
include($this->lang_path . '/lang_main.' . $phpEx);
if ( defined('IN_ADMIN') )
{
include($this->lang_path . '/lang_admin.' . $phpEx);
}
// Set up style
$style = ( $style ) ? $style : ( ( !$board_config['override_user_style'] && $userdata['user_id'] ) ? $userdata['user_style'] : $board_config['default_style'] );
$sql = "SELECT t.template_path, t.poll_length, t.pm_box_length, c.css_data, c.css_external, i.*
FROM " . STYLES_TABLE . " s, " . STYLES_TPL_TABLE . " t, " . STYLES_CSS_TABLE . " c, " . STYLES_IMAGE_TABLE . " i
WHERE s.style_id = $style
AND t.template_id = s.template_id
AND c.theme_id = s.style_id
AND i.imageset_id = s.imageset_id";
$result = $db->sql_query($sql);
if ( !($theme = $db->sql_fetchrow($result)) )
{
message_die(ERROR, 'Could not get style data');
}
$template->set_template($theme['template_path']);
$img_lang = ( file_exists('imageset/' . $theme['imageset_path'] . '/' . $this->lang_name) ) ? $this->lang_name : $board_config['default_lang'];
$i10n = array('post_new', 'post_locked', 'post_pm', 'reply_new', 'reply_pm', 'reply_locked', 'icon_quote', 'icon_edit', 'icon_search', 'icon_profile', 'icon_pm', 'icon_email', 'icon_www', 'icon_icq', 'icon_aim', 'icon_yim', 'icon_msnm', 'icon_delete', 'icon_ip', 'icon_no_email', 'icon_no_www', 'icon_no_icq', 'icon_no_aim', 'icon_no_yim', 'icon_no_msnm');
foreach ( $i10n as $icon )
{
$theme[$icon] = str_replace('{LANG}', $img_lang, $theme[$icon]);
}
return;
}
function format_date($gmepoch)
{
global $lang;
static $lang_dates;
if ( empty($lang_dates) )
{
foreach ( $lang['datetime'] as $match => $replace )
{
$lang_dates[$match] = $replace;
}
}
return strtr(@gmdate($this->date_format, $gmepoch + (3600 * $this->timezone) + $this->dst), $lang_dates);
}
}
//
// Will be keeping my eye of 'other products' to ensure these things don't // Will be keeping my eye of 'other products' to ensure these things don't
// mysteriously appear elsewhere, think up your own solutions! // mysteriously appear elsewhere, think up your own solutions!
// class auth
class acl
{ {
var $founder = false; var $founder = false;
var $acl = false; var $acl = false;
@ -636,22 +730,11 @@ class acl
$auth_sql"; $auth_sql";
$db->sql_query($sql); $db->sql_query($sql);
} }
}
// // Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
// Authentication plug-ins is largely down to
// Sergey Kanareykin, our thanks to him.
//
class login
{
function login($username, $password, $autologin = false) function login($username, $password, $autologin = false)
{ {
global $SID, $db, $board_config, $lang, $user_ip, $session; global $board_config, $session, $phpEx;
global $HTTP_SERVER_VARS, $HTTP_ENV_VARS, $phpEx;
$user_page = ( !empty($HTTP_SERVER_VARS['PHP_SELF']) ) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_ENV_VARS['PHP_SELF'];
$user_page .= '&' . ( ( !empty($HTTP_SERVER_VARS['QUERY_STRING']) ) ? $HTTP_SERVER_VARS['QUERY_STRING'] : $HTTP_ENV_VARS['QUERY_STRING'] );
$this_browser = ( !empty($HTTP_SERVER_VARS['HTTP_USER_AGENT']) ) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : $HTTP_ENV_VARS['HTTP_USER_AGENT'];
$method = trim($board_config['auth_method']); $method = trim($board_config['auth_method']);
@ -669,7 +752,7 @@ class login
$autologin = ( isset($autologin) ) ? md5($password) : ''; $autologin = ( isset($autologin) ) ? md5($password) : '';
return ( $user['user_active'] ) ? $session->create($user['user_id'], $autologin, $user_page, $this_browser) : false; return ( $user['user_active'] ) ? $session->create($user['user_id'], $autologin) : false;
} }
} }

View file

@ -138,11 +138,7 @@ class Template {
} }
$str = ''; $str = '';
while ( !feof($fp) ) $str = fread($fp, filesize($this->files[$handle]));
{
$str .= fread($fp, 4096);
}
@fclose($fp); @fclose($fp);
$this->uncompiled_code[$handle] = trim($str); $this->uncompiled_code[$handle] = trim($str);
@ -177,6 +173,7 @@ class Template {
echo $db->sql_report; echo $db->sql_report;
return TRUE; return TRUE;
} }
$_str = ''; $_str = '';
if (!$this->compile_load($_str, $handle, true)) if (!$this->compile_load($_str, $handle, true))
@ -186,9 +183,7 @@ class Template {
message_die("Template->pparse(): Couldn't load template file for handle $handle"); message_die("Template->pparse(): Couldn't load template file for handle $handle");
} }
//
// Actually compile the code now. // Actually compile the code now.
//
$this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]); $this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]);
$this->compile_write($handle, $this->compiled_code[$handle]); $this->compile_write($handle, $this->compiled_code[$handle]);
@ -561,9 +556,7 @@ class Template {
return "include('" . $this->root . '/' . $tag_args . "');\n"; return "include('" . $this->root . '/' . $tag_args . "');\n";
} }
//
// This is from Smarty // This is from Smarty
//
function _parse_is_expr($is_arg, $tokens) function _parse_is_expr($is_arg, $tokens)
{ {
$expr_end = 0; $expr_end = 0;
@ -697,9 +690,7 @@ class Template {
$filename = $this->cachedir . $this->filename[$handle] . '.' . $phpEx; $filename = $this->cachedir . $this->filename[$handle] . '.' . $phpEx;
//
// Recompile page if the original template is newer, otherwise load the compiled version // Recompile page if the original template is newer, otherwise load the compiled version
//
if ( file_exists($filename) && @filemtime($filename) >= @filemtime($this->files[$handle]) ) if ( file_exists($filename) && @filemtime($filename) >= @filemtime($this->files[$handle]) )
{ {
$_str = ''; $_str = '';

View file

@ -113,7 +113,7 @@ else
} }
} }
if ( $profiledata['user_viewemail'] || $acl->get_acl_admin() ) if ( $profiledata['user_viewemail'] || $auth->get_acl_admin() )
{ {
$email_uri = ( $board_config['board_email_form'] ) ? "profile.$phpEx$SID&amp;mode=email&amp;u=" . $profiledata['user_id'] : 'mailto:' . $profiledata['user_email']; $email_uri = ( $board_config['board_email_form'] ) ? "profile.$phpEx$SID&amp;mode=email&amp;u=" . $profiledata['user_id'] : 'mailto:' . $profiledata['user_email'];
@ -177,9 +177,9 @@ $template->assign_vars(array(
'RANK_IMAGE' => $rank_image, 'RANK_IMAGE' => $rank_image,
'POSTS_PER_DAY' => $posts_per_day, 'POSTS_PER_DAY' => $posts_per_day,
'POSTS' => $profiledata['user_posts'], 'POSTS' => $profiledata['user_posts'],
'PERCENTAGE' => $percentage . '%', 'PERCENTAGE' => $percentage . '%',
'POST_DAY_STATS' => sprintf($lang['User_post_day_stats'], $posts_per_day), 'POST_DAY_STATS' => sprintf($lang['User_post_day_stats'], $posts_per_day),
'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage), 'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage),
'SEARCH_IMG' => $search_img, 'SEARCH_IMG' => $search_img,
'SEARCH' => $search, 'SEARCH' => $search,
@ -190,8 +190,8 @@ $template->assign_vars(array(
'WWW_IMG' => $www_img, 'WWW_IMG' => $www_img,
'WWW' => $www, 'WWW' => $www,
'ICQ_STATUS_IMG' => $icq_status_img, 'ICQ_STATUS_IMG' => $icq_status_img,
'ICQ_IMG' => $icq_img, 'ICQ_IMG' => $icq_img,
'ICQ' => $icq, 'ICQ' => $icq,
'AIM_IMG' => $aim_img, 'AIM_IMG' => $aim_img,
'AIM' => $aim, 'AIM' => $aim,
'MSN_IMG' => $msn_img, 'MSN_IMG' => $msn_img,
@ -204,13 +204,13 @@ $template->assign_vars(array(
'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '&nbsp;', 'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '&nbsp;',
'AVATAR_IMG' => $avatar_img, 'AVATAR_IMG' => $avatar_img,
'L_VIEWING_PROFILE' => sprintf($lang['Viewing_user_profile'], $profiledata['username']), 'L_VIEWING_PROFILE' => sprintf($lang['Viewing_user_profile'], $profiledata['username']),
'L_ABOUT_USER' => sprintf($lang['About_user'], $profiledata['username']), 'L_ABOUT_USER' => sprintf($lang['About_user'], $profiledata['username']),
'L_AVATAR' => $lang['Avatar'], 'L_AVATAR' => $lang['Avatar'],
'L_POSTER_RANK' => $lang['Poster_rank'], 'L_POSTER_RANK' => $lang['Poster_rank'],
'L_JOINED' => $lang['Joined'], 'L_JOINED' => $lang['Joined'],
'L_TOTAL_POSTS' => $lang['Total_posts'], 'L_TOTAL_POSTS' => $lang['Total_posts'],
'L_SEARCH_USER_POSTS' => sprintf($lang['Search_user_posts'], $profiledata['username']), 'L_SEARCH_USER_POSTS' => sprintf($lang['Search_user_posts'], $profiledata['username']),
'L_CONTACT' => $lang['Contact'], 'L_CONTACT' => $lang['Contact'],
'L_EMAIL_ADDRESS' => $lang['Email_address'], 'L_EMAIL_ADDRESS' => $lang['Email_address'],
'L_EMAIL' => $lang['Email'], 'L_EMAIL' => $lang['Email'],

View file

@ -24,6 +24,9 @@ $phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
// Get posted/get info
$cat_id = (!empty($_GET['c'])) ? intval($_GET['c']) : 0;
if (isset($_GET['mark']) || isset($_POST['mark'])) if (isset($_GET['mark']) || isset($_POST['mark']))
{ {
$mark_read = (isset($_POST['mark'])) ? $_POST['mark'] : $_GET['mark']; $mark_read = (isset($_POST['mark'])) ? $_POST['mark'] : $_GET['mark'];
@ -33,23 +36,15 @@ else
$mark_read = ''; $mark_read = '';
} }
//
// Start session management // Start session management
//
$userdata = $session->start(); $userdata = $session->start();
$acl = new acl($userdata); $auth->acl($userdata);
//
// End session management // End session management
//
//
// Configure style, language, etc. // Configure style, language, etc.
//
$session->configure($userdata); $session->configure($userdata);
//
// Handle marking posts // Handle marking posts
//
if ($mark_read == 'forums') if ($mark_read == 'forums')
{ {
if ($userdata['user_id']) if ($userdata['user_id'])
@ -64,16 +59,13 @@ if ($mark_read == 'forums')
$message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . "index.$phpEx$SID" . '">', '</a> '); $message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . "index.$phpEx$SID" . '">', '</a> ');
message_die(MESSAGE, $message); message_die(MESSAGE, $message);
} }
//
// End handle marking posts // End handle marking posts
//
// Topic/forum marked read info
$mark_topics = (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t'])) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t'])) : array(); $mark_topics = (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t'])) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t'])) : array();
$mark_forums = (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f'])) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f'])) : array(); $mark_forums = (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f'])) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f'])) : array();
//
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data // Set some stats, get posts count from forums data if we... hum... retrieve all forums data
//
$total_users = $board_config['num_users']; $total_users = $board_config['num_users'];
$newest_user = $board_config['newest_username']; $newest_user = $board_config['newest_username'];
$newest_uid = $board_config['newest_user_id']; $newest_uid = $board_config['newest_user_id'];
@ -91,10 +83,12 @@ else
$l_total_user_s = $lang['Registered_users_total']; $l_total_user_s = $lang['Registered_users_total'];
} }
// Forum moderators ... a static template var could allow us
// to drop these queries ...
$forum_moderators = array(); $forum_moderators = array();
get_moderators($forum_moderators); get_moderators($forum_moderators);
$cat_id = (!empty($_GET['c'])) ? intval($_GET['c']) : 0; // Set some vars
$root_id = $branch_root_id = $cat_id; $root_id = $branch_root_id = $cat_id;
$forum_rows = $subforums = $nav_forums = array(); $forum_rows = $subforums = $nav_forums = array();
@ -109,7 +103,7 @@ if ($cat_id == 0)
FROM ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . 'u FROM ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . 'u
WHERE f.forum_last_poster_id = u.user_id(+) WHERE f.forum_last_poster_id = u.user_id(+)
ORDER BY f.left_id'; ORDER BY f.left_id';
break; break;
default: default:
$sql = 'SELECT f.*, u.username $sql = 'SELECT f.*, u.username
@ -122,24 +116,20 @@ else
{ {
$is_nav = TRUE; $is_nav = TRUE;
if (!$acl->get_acl($cat_id, 'forum', 'list')) if (!$auth->get_acl($cat_id, 'forum', 'list'))
{ {
//
// TODO: Deal with hidden categories // TODO: Deal with hidden categories
//
message_die(ERROR, $lang['Category_not_exist']); message_die(ERROR, $lang['Category_not_exist']);
} }
//
// NOTE: make sure that categories post count is set to 0 // NOTE: make sure that categories post count is set to 0
//
$sql = 'SELECT SUM(forum_posts) AS total $sql = 'SELECT SUM(forum_posts) AS total
FROM ' . FORUMS_TABLE . ' FROM ' . FORUMS_TABLE . '
WHERE post_count_inc = 1'; WHERE post_count_inc = 1';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$total_posts = $db->sql_fetchfield('total', 0, $result); $total_posts = $db->sql_fetchfield('total', 0, $result);
$result = $db->sql_query('SELECT left_id, right_id, parent_id FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . $cat_id); $result = $db->sql_query('SELECT left_id, right_id, parent_id FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . $cat_id);
$catrow = $db->sql_fetchrow($result); $catrow = $db->sql_fetchrow($result);
@ -186,9 +176,7 @@ while ($row = $db->sql_fetchrow($result))
{ {
if ($row['parent_id'] == $cat_id) if ($row['parent_id'] == $cat_id)
{ {
//
// Root-level forum // Root-level forum
//
$forum_rows[] = $row; $forum_rows[] = $row;
$parent_id = $row['forum_id']; $parent_id = $row['forum_id'];
@ -199,18 +187,14 @@ while ($row = $db->sql_fetchrow($result))
} }
elseif ($row['parent_id'] == $branch_root_id) elseif ($row['parent_id'] == $branch_root_id)
{ {
//
// Forum directly under a category // Forum directly under a category
//
$forum_rows[] = $row; $forum_rows[] = $row;
$parent_id = $row['forum_id']; $parent_id = $row['forum_id'];
} }
elseif ($row['display_on_index'] && $row['forum_status'] != ITEM_CATEGORY) elseif ($row['display_on_index'] && $row['forum_status'] != ITEM_CATEGORY)
{ {
//
// Subforum, store it for direct linking // Subforum, store it for direct linking
// if ($auth->get_acl($row['forum_id'], 'forum', 'list'))
if ($acl->get_acl($row['forum_id'], 'forum', 'list'))
{ {
$subforums[$parent_id][] = $row; $subforums[$parent_id][] = $row;
} }
@ -282,9 +266,7 @@ foreach ($nav_forums as $row)
)); ));
} }
//
// Start output of page // Start output of page
//
$page_title = $lang['Index']; $page_title = $lang['Index'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);

View file

@ -5,7 +5,6 @@
# #
# -- Config # -- Config
INSERT INTO phpbb_config (config_name, config_value) VALUES ('config_id','1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable_msg',''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable_msg','');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sitename','yourdomain.com'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('sitename','yourdomain.com');
@ -34,28 +33,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_styl
INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page','10'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page','10');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page','30'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page','30');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('hot_threshold','25'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('hot_threshold','25');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_chars', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_smilies', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_chars','255');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_poll_options','10');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_chars','3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_search_chars','20');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes','4');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs','50');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','youraddress@yourdomain.com');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host','');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username','');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password','');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_method','db');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize','6144');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_width','90');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_height','90');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_path','images/avatars/upload'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_path','images/avatars/upload');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_gallery_path','images/avatars/gallery'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_gallery_path','images/avatars/gallery');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_path','images/smiles'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_path','images/smiles');
@ -64,9 +42,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('prune_enable','1')
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable','1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable','1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('privmsg_disable','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('privmsg_disable','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_enable','1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_users', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_users', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_date', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_date', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', '');
@ -81,12 +56,38 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_load', '2.0'
INSERT INTO phpbb_config (config_name, config_value) VALUES ('active_sessions', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('active_sessions', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_gc', '3600'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_gc', '3600');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_last_gc', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_last_gc', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_check', '4');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '2.1.0 [20020926]');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_chars', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_smilies', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_chars','255');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_poll_options','10');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_chars','3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_search_chars','20');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes','4');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs','50');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','youraddress@yourdomain.com');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host','');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username','');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password','');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize','6144');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_width','90');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_height','90');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_enable','1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_method','db');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_server', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_server', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_base_dn', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_base_dn', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_uid', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_uid', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '2.1.0 [20021003]'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '2.1.0 [20021004]');
# -- auth options # -- auth options
INSERT INTO phpbb_auth_options (auth_value) VALUES ('forum_list'); INSERT INTO phpbb_auth_options (auth_value) VALUES ('forum_list');
@ -211,39 +212,27 @@ INSERT INTO phpbb_icons (icons_id, icons_url, icons_width, icons_height) VALUES
# -- Smilies # -- Smilies
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':D', 'icon_biggrin.gif', 'Very Happy'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':D', 'icon_biggrin.gif', 'Very Happy');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':-D', 'icon_biggrin.gif', 'Very Happy');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':grin:', 'icon_biggrin.gif', 'Very Happy');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':)', 'icon_smile.gif', 'Smile'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':)', 'icon_smile.gif', 'Smile');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':smile:', 'icon_smile.gif', 'Smile');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':(', 'icon_sad.gif', 'Sad'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':(', 'icon_sad.gif', 'Sad');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':sad:', 'icon_sad.gif', 'Sad');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':o', 'icon_surprised.gif', 'Surprised'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':o', 'icon_surprised.gif', 'Surprised');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':eek:', 'icon_surprised.gif', 'Surprised'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':eek:', 'icon_surprised.gif', 'Surprised');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( '8O', 'icon_eek.gif', 'Shocked'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( '8O', 'icon_eek.gif', 'Shocked');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( '8-O', 'icon_eek.gif', 'Shocked');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':shock:', 'icon_eek.gif', 'Shocked');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':?', 'icon_confused.gif', 'Confused'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':?', 'icon_confused.gif', 'Confused');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':???:', 'icon_confused.gif', 'Confused');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( '8)', 'icon_cool.gif', 'Cool'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( '8)', 'icon_cool.gif', 'Cool');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':cool:', 'icon_cool.gif', 'Cool');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':lol:', 'icon_lol.gif', 'Laughing'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':lol:', 'icon_lol.gif', 'Laughing');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':x', 'icon_mad.gif', 'Mad'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':x', 'icon_mad.gif', 'Mad');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':mad:', 'icon_mad.gif', 'Mad');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':P', 'icon_razz.gif', 'Razz'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':P', 'icon_razz.gif', 'Razz');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':razz:', 'icon_razz.gif', 'Razz');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':oops:', 'icon_redface.gif', 'Embarassed'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':oops:', 'icon_redface.gif', 'Embarassed');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':cry:', 'icon_cry.gif', 'Crying or Very sad'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':cry:', 'icon_cry.gif', 'Crying or Very sad');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':evil:', 'icon_evil.gif', 'Evil or Very Mad'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':evil:', 'icon_evil.gif', 'Evil or Very Mad');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':twisted:', 'icon_twisted.gif', 'Twisted Evil'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':twisted:', 'icon_twisted.gif', 'Twisted Evil');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':roll:', 'icon_rolleyes.gif', 'Rolling Eyes'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':roll:', 'icon_rolleyes.gif', 'Rolling Eyes');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':wink:', 'icon_wink.gif', 'Wink');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ';)', 'icon_wink.gif', 'Wink'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ';)', 'icon_wink.gif', 'Wink');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':!:', 'icon_exclaim.gif', 'Exclamation'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':!:', 'icon_exclaim.gif', 'Exclamation');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':?:', 'icon_question.gif', 'Question'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':?:', 'icon_question.gif', 'Question');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':idea:', 'icon_idea.gif', 'Idea'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':idea:', 'icon_idea.gif', 'Idea');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':arrow:', 'icon_arrow.gif', 'Arrow'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':arrow:', 'icon_arrow.gif', 'Arrow');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':|', 'icon_neutral.gif', 'Neutral'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':|', 'icon_neutral.gif', 'Neutral');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':neutral:', 'icon_neutral.gif', 'Neutral');
INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':mrgreen:', 'icon_mrgreen.gif', 'Mr. Green'); INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':mrgreen:', 'icon_mrgreen.gif', 'Mr. Green');

View file

@ -40,7 +40,7 @@ CREATE TABLE phpbb_auth_groups (
CREATE TABLE phpbb_auth_options ( CREATE TABLE phpbb_auth_options (
auth_option_id tinyint(4) NOT NULL auto_increment, auth_option_id tinyint(4) NOT NULL auto_increment,
auth_value char(20) NOT NULL, auth_value char(20) NOT NULL,
auth_founder_only tinyint(1) DEFAULT '0' NOT NULL, founder_only tinyint(1) DEFAULT '0' NOT NULL,
PRIMARY KEY (auth_option_id), PRIMARY KEY (auth_option_id),
KEY auth_value (auth_value) KEY auth_value (auth_value)
); );
@ -157,7 +157,7 @@ CREATE TABLE phpbb_forums (
KEY left_id (left_id), KEY left_id (left_id),
KEY forum_last_post_id (forum_last_post_id) KEY forum_last_post_id (forum_last_post_id)
); );
# forum_last_topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
# -------------------------------------------------------- # --------------------------------------------------------
# #
@ -310,6 +310,7 @@ CREATE TABLE phpbb_posts (
CREATE TABLE phpbb_posts_text ( CREATE TABLE phpbb_posts_text (
post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
bbcode_uid varchar(10) NOT NULL, bbcode_uid varchar(10) NOT NULL,
bbcode_bitfield int(11) UNSIGNED DEFAULT '0' NOT NULL,
post_checksum varchar(32) NOT NULL, post_checksum varchar(32) NOT NULL,
post_subject varchar(60), post_subject varchar(60),
post_text text, post_text text,
@ -412,6 +413,7 @@ CREATE TABLE phpbb_search_wordmatch (
CREATE TABLE phpbb_sessions ( CREATE TABLE phpbb_sessions (
session_id varchar(32) DEFAULT '' NOT NULL, session_id varchar(32) DEFAULT '' NOT NULL,
session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
session_last_visit int(11) DEFAULT '0' NOT NULL,
session_start int(11) DEFAULT '0' NOT NULL, session_start int(11) DEFAULT '0' NOT NULL,
session_time int(11) DEFAULT '0' NOT NULL, session_time int(11) DEFAULT '0' NOT NULL,
session_ip varchar(40) DEFAULT '0' NOT NULL, session_ip varchar(40) DEFAULT '0' NOT NULL,

View file

@ -30,7 +30,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Set page ID for session management // Set page ID for session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new acl($userdata); $auth = new auth($userdata);
$session->configure($userdata); $session->configure($userdata);
// //
@ -60,13 +60,13 @@ if ( isset($login) || isset($logout) )
// //
// Is the board disabled? Are we an admin? No, then back to the index we go // Is the board disabled? Are we an admin? No, then back to the index we go
// //
if ( $board_config['board_disable'] && !$acl->get_acl_admin() ) if ( $board_config['board_disable'] && !$auth->get_acl_admin() )
{ {
header($header_location . "index.$phpEx$SID"); header($header_location . "index.$phpEx$SID");
exit; exit;
} }
if ( new login($username, $password, $autologin) ) if ( !$auth->login($username, $password, $autologin) )
{ {
$template->assign_vars(array( $template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . "login.$phpEx$SID&amp;redirect=$redirect" . '">') 'META' => '<meta http-equiv="refresh" content="3;url=' . "login.$phpEx$SID&amp;redirect=$redirect" . '">')

View file

@ -28,7 +28,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new acl($userdata); $auth->acl($userdata);
$session->configure($userdata); $session->configure($userdata);
// //
@ -201,7 +201,7 @@ if ( $row = $db->sql_fetchrow($result) )
} }
} }
if ( $row['user_viewemail'] || $acl->get_acl_admin() ) if ( $row['user_viewemail'] || $auth->get_acl_admin() )
{ {
$email_uri = ( $board_config['board_email_form'] ) ? "profile.$phpEx$SID&amp;mode=email&amp;u=" . $user_id : 'mailto:' . $row['user_email']; $email_uri = ( $board_config['board_email_form'] ) ? "profile.$phpEx$SID&amp;mode=email&amp;u=" . $user_id : 'mailto:' . $row['user_email'];
@ -299,4 +299,201 @@ make_jumpbox('viewforum.'.$phpEx);
include($phpbb_root_path . 'includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
// Username search
function username_search()
{
global $SID, $HTTP_GET_VARS, $HTTP_POST_VARS, $phpEx, $phpbb_root_path;
global $db, $board_config, $template, $auth, $lang, $theme;
global $starttime;
$form = ( !empty($HTTP_GET_VARS['form']) ) ? $HTTP_GET_VARS['form'] : 0;
$field = ( isset($HTTP_GET_VARS['field']) ) ? $HTTP_GET_VARS['field'] : 'username';
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$sort_by = ( !empty($HTTP_POST_VARS['sort_by']) ) ? intval($HTTP_POST_VARS['sort_by']) : ( ( !empty($HTTP_GET_VARS['sort_by']) ) ? $HTTP_GET_VARS['sort_by'] : '4' );
$sort_order = ( !empty($HTTP_POST_VARS['sort_order']) ) ? $HTTP_POST_VARS['sort_order'] : ( ( !empty($HTTP_GET_VARS['sort_order']) ) ? $HTTP_GET_VARS['sort_order'] : 'd' );
$username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : ( ( !empty($HTTP_GET_VARS['username']) ) ? $HTTP_GET_VARS['username'] : '' );
$email = ( !empty($HTTP_POST_VARS['email']) ) ? $HTTP_POST_VARS['email'] : ( ( !empty($HTTP_GET_VARS['email']) ) ? $HTTP_GET_VARS['email'] : '' );
$icq = ( !empty($HTTP_POST_VARS['icq']) ) ? intval($HTTP_POST_VARS['icq']) : ( ( !empty($HTTP_GET_VARS['icq']) ) ? $HTTP_GET_VARS['icq'] : '' );
$aim = ( !empty($HTTP_POST_VARS['aim']) ) ? $HTTP_POST_VARS['aim'] : ( ( !empty($HTTP_GET_VARS['aim']) ) ? $HTTP_GET_VARS['aim'] : '' );
$yahoo = ( !empty($HTTP_POST_VARS['yahoo']) ) ? $HTTP_POST_VARS['yahoo'] : ( ( !empty($HTTP_GET_VARS['yahoo']) ) ? $HTTP_GET_VARS['yahoo'] : '' );
$msn = ( !empty($HTTP_POST_VARS['msn']) ) ? $HTTP_POST_VARS['msn'] : ( ( !empty($HTTP_GET_VARS['msn']) ) ? $HTTP_GET_VARS['msn'] : '' );
$joined_select = ( !empty($HTTP_POST_VARS['joined_select']) ) ? $HTTP_POST_VARS['joined_select'] : ( ( !empty($HTTP_GET_VARS['joined_select']) ) ? $HTTP_GET_VARS['joined_select'] : 'lt' );
$active_select = ( !empty($HTTP_POST_VARS['active_select']) ) ? $HTTP_POST_VARS['active_select'] : ( ( !empty($HTTP_GET_VARS['active_select']) ) ? $HTTP_GET_VARS['active_select'] : 'lt' );
$count_select = ( !empty($HTTP_POST_VARS['count_select']) ) ? $HTTP_POST_VARS['count_select'] : ( ( !empty($HTTP_GET_VARS['count_select']) ) ? $HTTP_GET_VARS['count_select'] : 'eq' );
$joined = ( !empty($HTTP_POST_VARS['joined']) ) ? explode('-', $HTTP_POST_VARS['joined']) : ( ( !empty($HTTP_GET_VARS['joined']) ) ? explode('-', $HTTP_GET_VARS['joined']) : array() );
$active = ( !empty($HTTP_POST_VARS['active']) ) ? explode('-', $HTTP_POST_VARS['active']) : ( ( !empty($HTTP_GET_VARS['active']) ) ? explode('-', $HTTP_GET_VARS['active']) : array() );
$count = ( !empty($HTTP_POST_VARS['count']) ) ? intval($HTTP_POST_VARS['count']) : ( ( !empty($HTTP_GET_VARS['count']) ) ? $HTTP_GET_VARS['count'] : '' );
//
//
//
$sort_by_types_text = array($lang['Sort_Username'], $lang['Sort_Email'], $lang['Sort_Post_count'], $lang['Sort_Joined'], $lang['Sort_Last_active']);
$s_sort_by = '';
for($i = 0; $i < count($sort_by_types_text); $i++)
{
$selected = ( $sort_by == $i ) ? ' selected="selected"' : '';
$s_sort_by .= '<option value="' . $i . '"' . $selected . '>' . $sort_by_types_text[$i] . '</option>';
}
$sort_order_text = array('a' => $lang['Ascending'], 'd' => $lang['Descending']);
$s_sort_order = '';
foreach ( $sort_order_text as $key => $value )
{
$selected = ( $sort_order == $key ) ? ' selected="selected"' : '';
$s_sort_order .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
$find_count = array('lt' => $lang['Less_than'], 'eq' => $lang['Equal_to'], 'gt' => $lang['More_than']);
$s_find_count = '';
foreach ( $find_count as $key => $value )
{
$selected = ( $count_select == $key ) ? ' selected="selected"' : '';
$s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
$find_time = array('lt' => $lang['Before'], 'gt' => $lang['After']);
$s_find_join_time = '';
foreach ( $find_time as $key => $value )
{
$selected = ( $joined_select == $key ) ? ' selected="selected"' : '';
$s_find_join_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
$s_find_active_time = '';
foreach ( $find_time as $key => $value )
{
$selected = ( $active_select == $key ) ? ' selected="selected"' : '';
$s_find_active_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
//
//
//
$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 .= ( $icq ) ? " AND user_icq LIKE '" . str_replace('*', '%', $icq) ."' " : '';
$where_sql .= ( $aim ) ? " AND user_aim LIKE '" . str_replace('*', '%', $aim) ."' " : '';
$where_sql .= ( $yahoo ) ? " AND user_yim LIKE '" . str_replace('*', '%', $yahoo) ."' " : '';
$where_sql .= ( $msn ) ? " AND user_msnm LIKE '" . str_replace('*', '%', $msn) ."' " : '';
$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])) : '';
$order_by = $sort_by_types[$sort_by] . ' ' . ( ( $sort_order == 'a' ) ? 'ASC' : 'DESC' );
$sql = "SELECT COUNT(user_id) AS total_users
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
$where_sql";
$result = $db->sql_query($sql);
$total_users = ( $row = $db->sql_fetchrow($result) ) ? $row['total_users'] : 0;
$pagination = generate_pagination("search.$phpEx$SID&amp;mode=searchuser&amp;form=$form&amp;field=$field&amp;username=" . urlencode($username) . "&amp;email=" . urlencode($email) . "&amp;icq=$icq&amp;aim=" . urlencode($aim) . "&amp;yahoo=" . urlencode($yahoo) . "&amp;msn=" . urlencode($msn) . "&amp;joined=" . urlencode(implode('-', $joined)) . "&amp;active=" . urlencode(implode('-', $active)) . "&amp;count=$count&amp;sort_order=$sort_order&amp;sort_by=$sort_by&amp;joined_select=$joined_select&amp;active_select=$active_select&amp;count_select=$count_select", $total_users, $board_config['topics_per_page'], $start);
//
//
//
$page_title = $lang['Search'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'search_user_body' => 'search_username.html')
);
$template->assign_vars(array(
'USERNAME' => $username,
'EMAIL' => $email,
'ICQ' => $icq,
'AIM' => $aim,
'YAHOO' => $yahoo,
'MSNM' => $msn,
'JOINED' => implode('-', $joined),
'ACTIVE' => implode('-', $active),
'COUNT' => $count,
'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_users / $board_config['topics_per_page'] )),
'L_SEARCH_USERNAME' => $lang['Find_username'],
'L_SEARCH_EXPLAIN' => $lang['Find_username_explain'],
'L_RESET' => $lang['Reset'],
'L_EMAIL' => $lang['Email'],
'L_ICQ_NUMBER' => $lang['ICQ'],
'L_MESSENGER' => $lang['MSNM'],
'L_YAHOO' => $lang['YIM'],
'L_AIM' => $lang['AIM'],
'L_JOINED' => $lang['Joined'],
'L_ACTIVE' => $lang['Last_active'],
'L_POSTS' => $lang['Posts'],
'L_SORT_BY' => $lang['Sort_by'],
'L_SORT_ASCENDING' => $lang['Sort_Ascending'],
'L_SORT_DESCENDING' => $lang['Sort_Descending'],
'L_SELECT_MARKED' => $lang['Select_marked'],
'L_MARK' => $lang['Mark'],
'L_MARK_ALL' => $lang['Mark_all'],
'L_UNMARK_ALL' => $lang['Unmark_all'],
'S_FORM_NAME' => $form,
'S_FIELD_NAME' => $field,
'S_COUNT_OPTIONS' => $s_find_count,
'S_JOINED_TIME_OPTIONS' => $s_find_join_time,
'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time,
'S_SORT_OPTIONS' => $s_sort_by,
'S_SORT_ORDER' => $s_sort_order,
'S_USERNAME_OPTIONS' => $username_list,
'S_SEARCH_ACTION' => "search.$phpEx$SID&amp;mode=searchuser&amp;field=$field")
);
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_email, user_lastvisit
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
$where_sql
ORDER BY $order_by
LIMIT $start, " . $board_config['topics_per_page'];
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
$i = 0;
do
{
$username = $row['username'];
$user_id = $row['user_id'];
$joined = create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']);
$posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;
$active = ( !$row['user_lastvisit'] ) ? $lang['Never'] : create_date($lang['DATE_FORMAT'], $row['user_lastvisit'], $board_config['board_timezone']);
$temp_url = "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=$user_id";
$profile_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_profile'], $lang['Read_profile']) . '</a>';
$profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';
$template->assign_block_vars('memberrow', array(
'ROW_NUMBER' => $i + ( $start + 1 ),
'USERNAME' => $username,
'JOINED' => $joined,
'POSTS' => $posts,
'ACTIVE' => $active,
'PROFILE_IMG' => $profile_img,
'PROFILE' => $profile)
);
$i++;
}
while ( $row = $db->sql_fetchrow($result) );
}
$template->display('search_user_body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
exit;
}
?> ?>

View file

@ -124,7 +124,7 @@ else
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new acl($userdata, $forum_id); $auth->acl($userdata, $forum_id);
// //
// End session management // End session management
// //
@ -167,7 +167,7 @@ else
// //
// Auth check // Auth check
// //
if ( !$acl->get_acl($forum_id, 'mod') ) if ( !$auth->get_acl($forum_id, 'mod') )
{ {
message_die(MESSAGE, $lang['Not_Moderator'], $lang['Not_Authorised']); message_die(MESSAGE, $lang['Not_Moderator'], $lang['Not_Authorised']);
} }

File diff suppressed because it is too large Load diff

View file

@ -82,7 +82,7 @@ if ( $cancel )
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new acl($userdata); $auth->acl($userdata);
// //
// End session management // End session management
// //

View file

@ -29,7 +29,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new acl($userdata); $auth->acl($userdata);
// //
// End session management // End session management
// //

View file

@ -30,7 +30,7 @@ include($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new acl($userdata, false, 'read'); $auth->acl($userdata);
// //
// End session management // End session management
// //
@ -121,16 +121,7 @@ $sort_by_types = array($lang['Sort_Time'], $lang['Sort_Post_Subject'], $lang['So
// //
// Begin core code // Begin core code
// //
if ( $mode == 'searchuser' ) if ( $search_keywords != '' || $search_author != '' || $search_id )
{
//
// This handles the simple windowed user search functions called from various other scripts
//
username_search();
exit;
}
else if ( $search_keywords != '' || $search_author != '' || $search_id )
{ {
$store_vars = array('search_results', 'total_match_count', 'split_search', 'sort_by', 'sort_dir', 'show_results', 'return_chars'); $store_vars = array('search_results', 'total_match_count', 'split_search', 'sort_by', 'sort_dir', 'show_results', 'return_chars');
@ -143,11 +134,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{ {
if ( $search_id == 'newposts' ) if ( $search_id == 'newposts' )
{ {
if ( $userdata['session_logged_in'] ) if ( $userdata['user_id'] )
{ {
$sql = "SELECT post_id $sql = "SELECT post_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE post_time >= " . $userdata['user_lastvisit']; WHERE post_time >= " . $userdata['session_last_visit'];
} }
else else
{ {
@ -184,10 +175,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$sql = "SELECT user_id $sql = "SELECT user_id
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE username LIKE '" . str_replace("\'", "''", $search_author) . "'"; WHERE username LIKE '" . str_replace("\'", "''", $search_author) . "'";
if ( !($result = $db->sql_query($sql)) ) $result = $db->sql_query($sql);
{
message_die(ERROR, "Couldn't obtain list of matching users (searching for: $search_author)", "", __LINE__, __FILE__, $sql);
}
$matching_userids = ''; $matching_userids = '';
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
@ -336,12 +324,12 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$auth_sql = ''; $auth_sql = '';
if ( $search_forum != -1 ) if ( $search_forum != -1 )
{ {
if ( !$acl->get_acl($search_forum, 'forum', 'read') ) if ( !$auth->get_acl($search_forum, 'forum', 'read') )
{ {
message_die(MESSAGE, $lang['No_searchable_forums']); message_die(MESSAGE, $lang['No_searchable_forums']);
} }
$auth_sql = "f.forum_id = $search_forum"; // $auth_sql = "f.forum_id = $search_forum";
} }
else else
{ {
@ -349,8 +337,8 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{ {
$auth_sql = "f.cat_id = $search_cat"; $auth_sql = "f.cat_id = $search_cat";
} }
/*
$auth_ary = $acl->get_acl(); $auth_ary = $auth->get_acl();
@reset($auth_ary); @reset($auth_ary);
$allowed_forum_sql = ''; $allowed_forum_sql = '';
@ -363,7 +351,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
} }
$auth_sql .= ( $auth_sql != '' ) ? " AND f.forum_id IN ($allowed_forum_sql) " : "f.forum_id IN ($allowed_forum_sql) "; $auth_sql .= ( $auth_sql != '' ) ? " AND f.forum_id IN ($allowed_forum_sql) " : "f.forum_id IN ($allowed_forum_sql) ";
} */ }
// //
// Author name search // Author name search
@ -415,7 +403,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
GROUP BY p.topic_id"; GROUP BY p.topic_id";
} }
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql, false)) )
{ {
message_die(ERROR, 'Could not obtain topic ids', '', __LINE__, __FILE__, $sql); message_die(ERROR, 'Could not obtain topic ids', '', __LINE__, __FILE__, $sql);
} }
@ -455,7 +443,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$sql = "SELECT p.post_id $sql = "SELECT p.post_id
FROM $from_sql FROM $from_sql
WHERE $where_sql"; WHERE $where_sql";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql, false)) )
{ {
message_die(ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql); message_die(ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
} }
@ -490,7 +478,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
AND topic_moved_id = 0"; AND topic_moved_id = 0";
} }
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql, false)) )
{ {
message_die(ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql); message_die(ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
} }
@ -650,7 +638,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
} }
$sql .= " $sort_dir LIMIT $start, " . $per_page; $sql .= " $sort_dir LIMIT $start, " . $per_page;
if ( !$result = $db->sql_query($sql) ) if ( !$result = $db->sql_query($sql, false) )
{ {
message_die(ERROR, 'Could not obtain search results', '', __LINE__, __FILE__, $sql); message_die(ERROR, 'Could not obtain search results', '', __LINE__, __FILE__, $sql);
} }
@ -673,22 +661,6 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
// //
// Output header // Output header
// //
$page_title = $lang['Search'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if ( $show_results == 'posts' )
{
$template->set_filenames(array(
'body' => 'search_results_posts.tpl')
);
}
else
{
$template->set_filenames(array(
'body' => 'search_results_topics.tpl')
);
}
make_jumpbox('viewforum.'.$phpEx);
$l_search_matches = ( $total_match_count == 1 ) ? sprintf($lang['Found_search_match'], $total_match_count) : sprintf($lang['Found_search_matches'], $total_match_count); $l_search_matches = ( $total_match_count == 1 ) ? sprintf($lang['Found_search_match'], $total_match_count) : sprintf($lang['Found_search_matches'], $total_match_count);
@ -728,9 +700,9 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
for($i = 0; $i < count($searchset); $i++) for($i = 0; $i < count($searchset); $i++)
{ {
$forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $searchset[$i]['forum_id']); $forum_url = "viewforum.$phpEx$SID&amp;f=" . $searchset[$i]['forum_id'];
$topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $searchset[$i]['topic_id'] . "&amp;highlight=$highlight_active"); $topic_url = "viewtopic.$phpEx$SID&amp;t=" . $searchset[$i]['topic_id'] . "&amp;highlight=$highlight_active";
$post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['post_id'] . "&amp;highlight=$highlight_active") . '#' . $searchset[$i]['post_id']; $post_url = "viewtopic.$phpEx$SID&amp;p=" . $searchset[$i]['post_id'] . "&amp;highlight=$highlight_active" . '#' . $searchset[$i]['post_id'];
$post_date = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']); $post_date = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']);
@ -876,11 +848,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
} }
$poster = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $searchset[$i]['user_id']) . '">' : ''; $poster = ( !$searchset[$i]['user_id'] ) ? '<a href="' . "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $searchset[$i]['user_id'] . '">' : '';
$poster .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != "" ) ? $searchset[$i]['post_username'] : $lang['Guest'] ); $poster .= ( $searchset[$i]['user_id'] ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != "" ) ? $searchset[$i]['post_username'] : $lang['Guest'] );
$poster .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : ''; $poster .= ( $searchset[$i]['user_id'] ) ? '</a>' : '';
if ( $userdata['session_logged_in'] && $searchset[$i]['post_time'] > $userdata['user_lastvisit'] ) if ( $userdata['session_logged_in'] && $searchset[$i]['post_time'] > $userdata['session_last_visit'] )
{ {
if ( !empty($tracking_topics[$topic_id]) && !empty($tracking_forums[$forum_id]) ) if ( !empty($tracking_topics[$topic_id]) && !empty($tracking_forums[$forum_id]) )
{ {
@ -966,7 +938,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$times = 1; $times = 1;
for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page']) for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
{ {
$goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&amp;start=$j") . '">' . $times . '</a>'; $goto_page .= '<a href="' . "viewtopic.$phpEx$SID&amp;t=" . $topic_id . "&amp;start=$j" . '">' . $times . '</a>';
if ( $times == 1 && $total_pages > 4 ) if ( $times == 1 && $total_pages > 4 )
{ {
$goto_page .= ' ... '; $goto_page .= ' ... ';
@ -1027,7 +999,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
if ( $userdata['session_logged_in'] ) if ( $userdata['session_logged_in'] )
{ {
if ( $searchset[$i]['post_time'] > $userdata['user_lastvisit'] ) if ( $searchset[$i]['post_time'] > $userdata['session_last_visit'] )
{ {
if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{ {
@ -1063,7 +1035,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$folder_image = $folder_new; $folder_image = $folder_new;
$folder_alt = $lang['New_posts']; $folder_alt = $lang['New_posts'];
$newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; $newest_post_img = '<a href="' . "viewtopic.$phpEx$SID&amp;t=$topic_id&amp;view=newest" . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
} }
else else
{ {
@ -1075,12 +1047,12 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
} }
} }
else if ( $searchset[$i]['post_time'] > $userdata['user_lastvisit'] ) else if ( $searchset[$i]['post_time'] > $userdata['session_last_visit'] )
{ {
$folder_image = $folder_new; $folder_image = $folder_new;
$folder_alt = $lang['New_posts']; $folder_alt = $lang['New_posts'];
$newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; $newest_post_img = '<a href="' . "viewtopic.$phpEx$SID&amp;t=$topic_id&amp;view=newest" . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
} }
else else
{ {
@ -1105,18 +1077,18 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
} }
$topic_author = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $searchset[$i]['user_id']) . '">' : ''; $topic_author = ( $searchset[$i]['user_id'] ) ? '<a href="' . "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $searchset[$i]['user_id'] . '">' : '';
$topic_author .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != '' ) ? $searchset[$i]['post_username'] : $lang['Guest'] ); $topic_author .= ( $searchset[$i]['user_id'] ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != '' ) ? $searchset[$i]['post_username'] : $lang['Guest'] );
$topic_author .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : ''; $topic_author .= ( $searchset[$i]['user_id'] ) ? '</a>' : '';
$first_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['topic_time'], $board_config['board_timezone']); $first_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['topic_time'], $board_config['board_timezone']);
$last_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']); $last_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']);
$last_post_author = ( $searchset[$i]['id2'] == ANONYMOUS ) ? ( ($searchset[$i]['post_username2'] != '' ) ? $searchset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $searchset[$i]['id2']) . '">' . $searchset[$i]['user2'] . '</a>'; $last_post_author = ( $searchset[$i]['id2'] ) ? ( ($searchset[$i]['post_username2'] != '' ) ? $searchset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $searchset[$i]['id2'] . '">' . $searchset[$i]['user2'] . '</a>';
$last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['topic_last_post_id']) . '#' . $searchset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>'; $last_post_url = '<a href="' . "viewtopic.$phpEx$SID&amp;p=" . $searchset[$i]['topic_last_post_id'] . '#' . $searchset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';
$template->assign_block_vars('searchresults', array( $template->assign_block_vars('searchresults', array(
'FORUM_NAME' => $searchset[$i]['forum_name'], 'FORUM_NAME' => $searchset[$i]['forum_name'],
@ -1164,7 +1136,13 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
'L_GOTO_PAGE' => $lang['Goto_page']) 'L_GOTO_PAGE' => $lang['Goto_page'])
); );
$template->pparse('body'); $page_title = $lang['Search'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => ( $show_results == 'posts' ) ? 'search_results_posts.html' : 'search_results_topics.html')
);
make_jumpbox('viewforum.'.$phpEx);
include($phpbb_root_path . 'includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
@ -1186,7 +1164,7 @@ $result = $db->sql_query($sql);
$s_forums = ''; $s_forums = '';
while( $row = $db->sql_fetchrow($result) ) while( $row = $db->sql_fetchrow($result) )
{ {
if ( $acl->get_acl($row['forum_id'], 'forum', 'read') ) if ( $auth->get_acl($row['forum_id'], 'forum', 'read') )
{ {
$s_forums .= '<option value="' . $row['forum_id'] . '">' . $row['forum_name'] . '</option>'; $s_forums .= '<option value="' . $row['forum_id'] . '">' . $row['forum_name'] . '</option>';
if ( empty($list_cat[$row['cat_id']]) ) if ( empty($list_cat[$row['cat_id']]) )
@ -1295,203 +1273,4 @@ make_jumpbox('viewforum.'.$phpEx);
include($phpbb_root_path . 'includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
//
// Username search
//
function username_search()
{
global $SID, $HTTP_GET_VARS, $HTTP_POST_VARS, $phpEx, $phpbb_root_path;
global $db, $board_config, $template, $acl, $lang, $theme;
global $starttime;
$form = ( !empty($HTTP_GET_VARS['form']) ) ? $HTTP_GET_VARS['form'] : 0;
$field = ( isset($HTTP_GET_VARS['field']) ) ? $HTTP_GET_VARS['field'] : 'username';
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$sort_by = ( !empty($HTTP_POST_VARS['sort_by']) ) ? intval($HTTP_POST_VARS['sort_by']) : ( ( !empty($HTTP_GET_VARS['sort_by']) ) ? $HTTP_GET_VARS['sort_by'] : '4' );
$sort_order = ( !empty($HTTP_POST_VARS['sort_order']) ) ? $HTTP_POST_VARS['sort_order'] : ( ( !empty($HTTP_GET_VARS['sort_order']) ) ? $HTTP_GET_VARS['sort_order'] : 'd' );
$username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : ( ( !empty($HTTP_GET_VARS['username']) ) ? $HTTP_GET_VARS['username'] : '' );
$email = ( !empty($HTTP_POST_VARS['email']) ) ? $HTTP_POST_VARS['email'] : ( ( !empty($HTTP_GET_VARS['email']) ) ? $HTTP_GET_VARS['email'] : '' );
$icq = ( !empty($HTTP_POST_VARS['icq']) ) ? intval($HTTP_POST_VARS['icq']) : ( ( !empty($HTTP_GET_VARS['icq']) ) ? $HTTP_GET_VARS['icq'] : '' );
$aim = ( !empty($HTTP_POST_VARS['aim']) ) ? $HTTP_POST_VARS['aim'] : ( ( !empty($HTTP_GET_VARS['aim']) ) ? $HTTP_GET_VARS['aim'] : '' );
$yahoo = ( !empty($HTTP_POST_VARS['yahoo']) ) ? $HTTP_POST_VARS['yahoo'] : ( ( !empty($HTTP_GET_VARS['yahoo']) ) ? $HTTP_GET_VARS['yahoo'] : '' );
$msn = ( !empty($HTTP_POST_VARS['msn']) ) ? $HTTP_POST_VARS['msn'] : ( ( !empty($HTTP_GET_VARS['msn']) ) ? $HTTP_GET_VARS['msn'] : '' );
$joined_select = ( !empty($HTTP_POST_VARS['joined_select']) ) ? $HTTP_POST_VARS['joined_select'] : ( ( !empty($HTTP_GET_VARS['joined_select']) ) ? $HTTP_GET_VARS['joined_select'] : 'lt' );
$active_select = ( !empty($HTTP_POST_VARS['active_select']) ) ? $HTTP_POST_VARS['active_select'] : ( ( !empty($HTTP_GET_VARS['active_select']) ) ? $HTTP_GET_VARS['active_select'] : 'lt' );
$count_select = ( !empty($HTTP_POST_VARS['count_select']) ) ? $HTTP_POST_VARS['count_select'] : ( ( !empty($HTTP_GET_VARS['count_select']) ) ? $HTTP_GET_VARS['count_select'] : 'eq' );
$joined = ( !empty($HTTP_POST_VARS['joined']) ) ? explode('-', $HTTP_POST_VARS['joined']) : ( ( !empty($HTTP_GET_VARS['joined']) ) ? explode('-', $HTTP_GET_VARS['joined']) : array() );
$active = ( !empty($HTTP_POST_VARS['active']) ) ? explode('-', $HTTP_POST_VARS['active']) : ( ( !empty($HTTP_GET_VARS['active']) ) ? explode('-', $HTTP_GET_VARS['active']) : array() );
$count = ( !empty($HTTP_POST_VARS['count']) ) ? intval($HTTP_POST_VARS['count']) : ( ( !empty($HTTP_GET_VARS['count']) ) ? $HTTP_GET_VARS['count'] : '' );
//
//
//
$sort_by_types_text = array($lang['Sort_Username'], $lang['Sort_Email'], $lang['Sort_Post_count'], $lang['Sort_Joined'], $lang['Sort_Last_active']);
$s_sort_by = '';
for($i = 0; $i < count($sort_by_types_text); $i++)
{
$selected = ( $sort_by == $i ) ? ' selected="selected"' : '';
$s_sort_by .= '<option value="' . $i . '"' . $selected . '>' . $sort_by_types_text[$i] . '</option>';
}
$sort_order_text = array('a' => $lang['Ascending'], 'd' => $lang['Descending']);
$s_sort_order = '';
foreach ( $sort_order_text as $key => $value )
{
$selected = ( $sort_order == $key ) ? ' selected="selected"' : '';
$s_sort_order .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
$find_count = array('lt' => $lang['Less_than'], 'eq' => $lang['Equal_to'], 'gt' => $lang['More_than']);
$s_find_count = '';
foreach ( $find_count as $key => $value )
{
$selected = ( $count_select == $key ) ? ' selected="selected"' : '';
$s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
$find_time = array('lt' => $lang['Before'], 'gt' => $lang['After']);
$s_find_join_time = '';
foreach ( $find_time as $key => $value )
{
$selected = ( $joined_select == $key ) ? ' selected="selected"' : '';
$s_find_join_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
$s_find_active_time = '';
foreach ( $find_time as $key => $value )
{
$selected = ( $active_select == $key ) ? ' selected="selected"' : '';
$s_find_active_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
//
//
//
$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 .= ( $icq ) ? " AND user_icq LIKE '" . str_replace('*', '%', $icq) ."' " : '';
$where_sql .= ( $aim ) ? " AND user_aim LIKE '" . str_replace('*', '%', $aim) ."' " : '';
$where_sql .= ( $yahoo ) ? " AND user_yim LIKE '" . str_replace('*', '%', $yahoo) ."' " : '';
$where_sql .= ( $msn ) ? " AND user_msnm LIKE '" . str_replace('*', '%', $msn) ."' " : '';
$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])) : '';
$order_by = $sort_by_types[$sort_by] . ' ' . ( ( $sort_order == 'a' ) ? 'ASC' : 'DESC' );
$sql = "SELECT COUNT(user_id) AS total_users
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
$where_sql";
$result = $db->sql_query($sql);
$total_users = ( $row = $db->sql_fetchrow($result) ) ? $row['total_users'] : 0;
$pagination = generate_pagination("search.$phpEx$SID&amp;mode=searchuser&amp;form=$form&amp;field=$field&amp;username=" . urlencode($username) . "&amp;email=" . urlencode($email) . "&amp;icq=$icq&amp;aim=" . urlencode($aim) . "&amp;yahoo=" . urlencode($yahoo) . "&amp;msn=" . urlencode($msn) . "&amp;joined=" . urlencode(implode('-', $joined)) . "&amp;active=" . urlencode(implode('-', $active)) . "&amp;count=$count&amp;sort_order=$sort_order&amp;sort_by=$sort_by&amp;joined_select=$joined_select&amp;active_select=$active_select&amp;count_select=$count_select", $total_users, $board_config['topics_per_page'], $start);
//
//
//
$page_title = $lang['Search'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'search_user_body' => 'search_username.html')
);
$template->assign_vars(array(
'USERNAME' => $username,
'EMAIL' => $email,
'ICQ' => $icq,
'AIM' => $aim,
'YAHOO' => $yahoo,
'MSNM' => $msn,
'JOINED' => implode('-', $joined),
'ACTIVE' => implode('-', $active),
'COUNT' => $count,
'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_users / $board_config['topics_per_page'] )),
'L_SEARCH_USERNAME' => $lang['Find_username'],
'L_SEARCH_EXPLAIN' => $lang['Find_username_explain'],
'L_RESET' => $lang['Reset'],
'L_EMAIL' => $lang['Email'],
'L_ICQ_NUMBER' => $lang['ICQ'],
'L_MESSENGER' => $lang['MSNM'],
'L_YAHOO' => $lang['YIM'],
'L_AIM' => $lang['AIM'],
'L_JOINED' => $lang['Joined'],
'L_ACTIVE' => $lang['Last_active'],
'L_POSTS' => $lang['Posts'],
'L_SORT_BY' => $lang['Sort_by'],
'L_SORT_ASCENDING' => $lang['Sort_Ascending'],
'L_SORT_DESCENDING' => $lang['Sort_Descending'],
'L_SELECT_MARKED' => $lang['Select_marked'],
'L_MARK' => $lang['Mark'],
'L_MARK_ALL' => $lang['Mark_all'],
'L_UNMARK_ALL' => $lang['Unmark_all'],
'S_FORM_NAME' => $form,
'S_FIELD_NAME' => $field,
'S_COUNT_OPTIONS' => $s_find_count,
'S_JOINED_TIME_OPTIONS' => $s_find_join_time,
'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time,
'S_SORT_OPTIONS' => $s_sort_by,
'S_SORT_ORDER' => $s_sort_order,
'S_USERNAME_OPTIONS' => $username_list,
'S_SEARCH_ACTION' => "search.$phpEx$SID&amp;mode=searchuser&amp;field=$field")
);
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_email, user_lastvisit
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
$where_sql
ORDER BY $order_by
LIMIT $start, " . $board_config['topics_per_page'];
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
$i = 0;
do
{
$username = $row['username'];
$user_id = $row['user_id'];
$joined = create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']);
$posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;
$active = ( !$row['user_lastvisit'] ) ? $lang['Never'] : create_date($lang['DATE_FORMAT'], $row['user_lastvisit'], $board_config['board_timezone']);
$temp_url = "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=$user_id";
$profile_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_profile'], $lang['Read_profile']) . '</a>';
$profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';
$template->assign_block_vars('memberrow', array(
'ROW_NUMBER' => $i + ( $start + 1 ),
'USERNAME' => $username,
'JOINED' => $joined,
'POSTS' => $posts,
'ACTIVE' => $active,
'PROFILE_IMG' => $profile_img,
'PROFILE' => $profile)
);
$i++;
}
while ( $row = $db->sql_fetchrow($result) );
}
$template->display('search_user_body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
exit;
}
?> ?>

View file

@ -1,4 +1,3 @@
<tr> <tr>
<th class="thHead" colspan="2">{L_ADD_A_POLL}</th> <th class="thHead" colspan="2">{L_ADD_A_POLL}</th>
</tr> </tr>
@ -23,9 +22,9 @@
<td class="row1"><span class="gen"><b>{L_POLL_LENGTH}</b></span></td> <td class="row1"><span class="gen"><b>{L_POLL_LENGTH}</b></span></td>
<td class="row2"><span class="genmed"><input type="text" name="poll_length" size="3" maxlength="3" class="post" value="{POLL_LENGTH}" /></span>&nbsp;<span class="gen"><b>{L_DAYS}</b></span> &nbsp; <span class="gensmall">{L_POLL_LENGTH_EXPLAIN}</span></td> <td class="row2"><span class="genmed"><input type="text" name="poll_length" size="3" maxlength="3" class="post" value="{POLL_LENGTH}" /></span>&nbsp;<span class="gen"><b>{L_DAYS}</b></span> &nbsp; <span class="gensmall">{L_POLL_LENGTH_EXPLAIN}</span></td>
</tr> </tr>
<!-- BEGIN switch_poll_delete_toggle --> <!-- IF S_POLL_DELETE -->
<tr> <tr>
<td class="row1"><span class="gen"><b>{L_POLL_DELETE}</b></span></td> <td class="row1"><span class="gen"><b>{L_POLL_DELETE}</b></span></td>
<td class="row2"><input type="checkbox" name="poll_delete" /></td> <td class="row2"><input type="checkbox" name="poll_delete" /></td>
</tr> </tr>
<!-- END switch_poll_delete_toggle --> <!-- ENDIF -->

View file

@ -1,8 +1,10 @@
<!-- INCLUDE simple_header.html -->
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
<!-- <!--
function emoticon(text) { function emoticon(text) {
text = ' ' + text + ' '; text = ' ' + text + ' ';
if (opener.document.forms['post'].message.createTextRange && opener.document.forms['post'].message.caretPos) { if (opener.document.forms['post'].message.createTextRange && opener.document.forms['post'].message.caretPos) {
var caretPos = opener.document.forms['post'].message.caretPos; var caretPos = opener.document.forms['post'].message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
@ -15,27 +17,14 @@ function emoticon(text) {
//--> //-->
</script> </script>
<table width="100%" border="0" cellspacing="0" cellpadding="10"> <table width="100%" cellspacing="0" cellpadding="10" border="0">
<tr> <tr>
<td><table width="100%" border="0" cellspacing="1" cellpadding="4" class="forumline"> <td><table class="forumline" width="100%" cellspacing="1" cellpadding="4" border="0">
<tr> <tr>
<th class="thHead" height="25">{L_EMOTICONS}</th> <th class="thHead" height="25">{L_EMOTICONS}</th>
</tr> </tr>
<tr> <tr>
<td><table width="100" border="0" cellspacing="0" cellpadding="5"> <td align="center" valign="middle"><!-- BEGIN emoticon --> <a href="javascript:emoticon('{emoticon.SMILEY_CODE}')"><img src="{emoticon.SMILEY_IMG}" width="{emoticon.SMILEY_WIDTH}" height="{emoticon.SMILEY_HEIGHT}" border="0" alt="{emoticon.SMILEY_DESC}" title="{emoticon.SMILEY_DESC}" hspace="2" vspace="2" onclick="emoticon('{emoticon.SMILEY_CODE}');return false" /></a> <!-- END emoticon --></td>
<!-- BEGIN smilies_row -->
<tr align="center" valign="middle">
<!-- BEGIN smilies_col -->
<td><a href="javascript:emoticon('{smilies_row.smilies_col.SMILEY_CODE}')"><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></a></td>
<!-- END smilies_col -->
</tr>
<!-- END smilies_row -->
<!-- BEGIN switch_smilies_extra -->
<tr align="center">
<td colspan="{S_SMILIES_COLSPAN}"><span class="nav"><a href="{U_MORE_SMILIES}" onclick="open_window('{U_MORE_SMILIES}', 250, 300);return false" target="_smilies" class="nav">{L_MORE_SMILIES}</a></td>
</tr>
<!-- END switch_smilies_extra -->
</table></td>
</tr> </tr>
<tr> <tr>
<td align="center"><br /><span class="genmed"><a href="javascript:window.close();" class="genmed">{L_CLOSE_WINDOW}</a></span></td> <td align="center"><br /><span class="genmed"><a href="javascript:window.close();" class="genmed">{L_CLOSE_WINDOW}</a></span></td>
@ -43,3 +32,5 @@ function emoticon(text) {
</table></td> </table></td>
</tr> </tr>
</table> </table>
<!-- INCLUDE simple_footer.html -->

View file

@ -54,7 +54,7 @@ $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) :
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new acl($userdata, $forum_id); $auth->acl($userdata, $forum_id);
// //
// End session management // End session management
// //
@ -83,7 +83,7 @@ $session->configure($userdata);
// //
// Auth check // Auth check
// //
if (!$acl->get_acl($forum_id, 'forum', 'read')) if (!$auth->get_acl($forum_id, 'forum', 'read'))
{ {
if ( $userdata['user_id'] ) if ( $userdata['user_id'] )
{ {
@ -155,7 +155,7 @@ foreach ($forum_branch as $row)
} }
elseif ($row['forum_status'] != ITEM_CATEGORY) elseif ($row['forum_status'] != ITEM_CATEGORY)
{ {
if ($acl->get_acl($row['forum_id'], 'forum', 'list')) if ($auth->get_acl($row['forum_id'], 'forum', 'list'))
{ {
$subforums[$parent_id][] = $row; $subforums[$parent_id][] = $row;
} }
@ -195,7 +195,7 @@ if ( $mark_read == 'topics' )
// //
// Do the forum Prune // Do the forum Prune
// //
if ( $acl->get_acl($forum_id, 'mod', 'prune') && $board_config['prune_enable'] ) if ( $auth->get_acl($forum_id, 'mod', 'prune') && $board_config['prune_enable'] )
{ {
if ( $forum_data['prune_next'] < time() && $forum_data['prune_enable'] ) if ( $forum_data['prune_next'] < time() && $forum_data['prune_enable'] )
{ {

View file

@ -24,19 +24,11 @@ $phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management // Start session management
//
$userdata = $session->start(); $userdata = $session->start();
$acl = new acl($userdata); $auth->acl($userdata);
// $user = new user($userdata);
// End session management // End session management
//
//
// Configure style, language, etc.
//
$session->configure($userdata);
// //
// Forum info // Forum info
@ -88,7 +80,7 @@ while ( $row = $db->sql_fetchrow($result) )
if ( !$row['user_allow_viewonline'] ) if ( !$row['user_allow_viewonline'] )
{ {
$view_online = ( $acl->get_acl_admin() ) ? true : false; $view_online = ( $auth->get_acl_admin() ) ? true : false;
$hidden_users++; $hidden_users++;
$username = '<i>' . $username . '</i>'; $username = '<i>' . $username . '</i>';
@ -136,7 +128,7 @@ while ( $row = $db->sql_fetchrow($result) )
preg_match('/f=([0-9]+)/', $row['session_page'], $forum_id); preg_match('/f=([0-9]+)/', $row['session_page'], $forum_id);
$forum_id = $forum_id[1]; $forum_id = $forum_id[1];
if ( $acl->get_acl($forum_id, 'forum' , 'list') ) if ( $auth->get_acl($forum_id, 'forum' , 'list') )
{ {
$location = ''; $location = '';
switch ( $on_page[1] ) switch ( $on_page[1] )
@ -193,7 +185,7 @@ while ( $row = $db->sql_fetchrow($result) )
$template->assign_block_vars("$which_row", array( $template->assign_block_vars("$which_row", array(
'USERNAME' => $username, 'USERNAME' => $username,
'LASTUPDATE' => create_date($board_config['default_dateformat'], $row['session_time'], $board_config['board_timezone']), 'LASTUPDATE' => $user->format_date($row['session_time']),
'FORUM_LOCATION' => $location, 'FORUM_LOCATION' => $location,
'S_ROW_COUNT' => $$which_counter, 'S_ROW_COUNT' => $$which_counter,

View file

@ -161,12 +161,12 @@ if ( !(extract($db->sql_fetchrow($result))) )
$userdata['user_style'] = ( $forum_style ) ? $forum_style : $userdata['user_style']; $userdata['user_style'] = ( $forum_style ) ? $forum_style : $userdata['user_style'];
$session->configure($userdata); $session->configure($userdata);
$acl = new acl($userdata, $forum_id); $auth->acl($userdata, $forum_id);
// //
// Start auth check // Start auth check
// //
if ( !$acl->get_acl($forum_id, 'forum', 'read') ) if ( !$auth->get_acl($forum_id, 'forum', 'read') )
{ {
if ( $userdata['user_id'] != ANONYMOUS ) if ( $userdata['user_id'] != ANONYMOUS )
{ {
@ -343,11 +343,11 @@ $s_forum_rules = '';
get_forum_rules('topic', $s_forum_rules, $forum_id); get_forum_rules('topic', $s_forum_rules, $forum_id);
$topic_mod = ''; $topic_mod = '';
$topic_mod .= ( $acl->get_acl($forum_id, 'mod', 'lock') ) ? ( ( $topic_status == TOPIC_UNLOCKED ) ? '<option value="lock">' . $lang['Lock_topic'] . '</option>' : '<option value="unlock">' . $lang['Unlock_topic'] . '</option>' ) : ''; $topic_mod .= ( $auth->get_acl($forum_id, 'mod', 'lock') ) ? ( ( $topic_status == TOPIC_UNLOCKED ) ? '<option value="lock">' . $lang['Lock_topic'] . '</option>' : '<option value="unlock">' . $lang['Unlock_topic'] . '</option>' ) : '';
$topic_mod .= ( $acl->get_acl($forum_id, 'mod', 'delete') ) ? '<option value="delete">' . $lang['Delete_topic'] . '</option>' : ''; $topic_mod .= ( $auth->get_acl($forum_id, 'mod', 'delete') ) ? '<option value="delete">' . $lang['Delete_topic'] . '</option>' : '';
$topic_mod .= ( $acl->get_acl($forum_id, 'mod', 'move') ) ? '<option value="move">' . $lang['Move_topic'] . '</option>' : ''; $topic_mod .= ( $auth->get_acl($forum_id, 'mod', 'move') ) ? '<option value="move">' . $lang['Move_topic'] . '</option>' : '';
$topic_mod .= ( $acl->get_acl($forum_id, 'mod', 'split') ) ? '<option value="split">' . $lang['Split_topic'] . '</option>' : ''; $topic_mod .= ( $auth->get_acl($forum_id, 'mod', 'split') ) ? '<option value="split">' . $lang['Split_topic'] . '</option>' : '';
$topic_mod .= ( $acl->get_acl($forum_id, 'mod', 'merge') ) ? '<option value="merge">' . $lang['Merge_topic'] . '</option>' : ''; $topic_mod .= ( $auth->get_acl($forum_id, 'mod', 'merge') ) ? '<option value="merge">' . $lang['Merge_topic'] . '</option>' : '';
// //
// If we've got a hightlight set pass it on to pagination. // If we've got a hightlight set pass it on to pagination.
@ -505,7 +505,7 @@ if ( !empty($poll_start) )
$poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0; $poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0;
if ( $user_voted || $view_result || $poll_expired || !$acl->get_acl($forum_id, 'forum', 'vote') || $topic_status == TOPIC_LOCKED ) if ( $user_voted || $view_result || $poll_expired || !$auth->get_acl($forum_id, 'forum', 'vote') || $topic_status == TOPIC_LOCKED )
{ {
$vote_results_sum = 0; $vote_results_sum = 0;
for($i = 0; $i < $vote_options; $i++) for($i = 0; $i < $vote_options; $i++)
@ -695,7 +695,7 @@ if ( $row = $db->sql_fetchrow($result) )
$poster_details[$poster_id]['pm_img'] = '<a href="' . $temp_url . '">' . create_img($theme['icon_pm'], $lang['Send_private_message']) . '</a>'; $poster_details[$poster_id]['pm_img'] = '<a href="' . $temp_url . '">' . create_img($theme['icon_pm'], $lang['Send_private_message']) . '</a>';
$poster_details[$poster_id]['pm'] = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>'; $poster_details[$poster_id]['pm'] = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';
if ( !empty($row['user_viewemail']) || $acl->get_acl($forum_id, 'mod') ) if ( !empty($row['user_viewemail']) || $auth->get_acl($forum_id, 'mod') )
{ {
$email_uri = ( $board_config['board_email_form'] ) ? "profile.$phpEx$SID&amp;mode=email&amp;u=" . $poster_id : 'mailto:' . $row['user_email']; $email_uri = ( $board_config['board_email_form'] ) ? "profile.$phpEx$SID&amp;mode=email&amp;u=" . $poster_id : 'mailto:' . $row['user_email'];
@ -734,7 +734,7 @@ if ( $row = $db->sql_fetchrow($result) )
$poster_details[$poster_id]['yim_img'] = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&amp;.src=pg">' . create_img($theme['icon_yim'], $lang['YIM']) . '</a>' : ''; $poster_details[$poster_id]['yim_img'] = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&amp;.src=pg">' . create_img($theme['icon_yim'], $lang['YIM']) . '</a>' : '';
$poster_details[$poster_id]['yim'] = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : ''; $poster_details[$poster_id]['yim'] = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';
if ( $acl->get_acl($forum_id, 'forum', 'search') ) if ( $auth->get_acl($forum_id, 'forum', 'search') )
{ {
$temp_url = 'search.' . $phpEx . $SID . '&amp;search_author=' . urlencode($row['username']) .'"&amp;showresults=posts'; $temp_url = 'search.' . $phpEx . $SID . '&amp;search_author=' . urlencode($row['username']) .'"&amp;showresults=posts';
$search_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_search'], $lang['Search_user_posts']) . '</a>'; $search_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_search'], $lang['Search_user_posts']) . '</a>';
@ -775,7 +775,7 @@ if ( $row = $db->sql_fetchrow($result) )
$quote_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_quote'], $lang['Reply_with_quote']) . '</a>'; $quote_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_quote'], $lang['Reply_with_quote']) . '</a>';
$quote = '<a href="' . $temp_url . '">' . $lang['Reply_with_quote'] . '</a>'; $quote = '<a href="' . $temp_url . '">' . $lang['Reply_with_quote'] . '</a>';
if ( ( $userdata['user_id'] == $poster_id && $acl->get_acl($forum_id, 'forum', 'edit') ) || $acl->get_acl($forum_id, 'mod', 'edit') ) if ( ( $userdata['user_id'] == $poster_id && $auth->get_acl($forum_id, 'forum', 'edit') ) || $auth->get_acl($forum_id, 'mod', 'edit') )
{ {
$temp_url = "posting.$phpEx$SID&amp;mode=editpost&amp;p=" . $row['post_id']; $temp_url = "posting.$phpEx$SID&amp;mode=editpost&amp;p=" . $row['post_id'];
$edit_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_edit'], $lang['Edit_delete_post']) . '</a>'; $edit_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_edit'], $lang['Edit_delete_post']) . '</a>';
@ -787,7 +787,7 @@ if ( $row = $db->sql_fetchrow($result) )
$edit = ''; $edit = '';
} }
if ( $acl->get_acl($forum_id, 'mod', 'ip') ) if ( $auth->get_acl($forum_id, 'mod', 'ip') )
{ {
$temp_url = "modcp.$phpEx$SID&amp;mode=ip&amp;p=" . $row['post_id'] . "&amp;t=" . $topic_id; $temp_url = "modcp.$phpEx$SID&amp;mode=ip&amp;p=" . $row['post_id'] . "&amp;t=" . $topic_id;
$ip_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_ip'], $lang['View_IP']) . '</a>'; $ip_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_ip'], $lang['View_IP']) . '</a>';
@ -799,7 +799,7 @@ if ( $row = $db->sql_fetchrow($result) )
$ip = ''; $ip = '';
} }
if ( ( $userdata['user_id'] == $poster_id && $acl->get_acl($forum_id, 'forum', 'delete') && $forum_topic_data['topic_last_post_id'] == $row['post_id'] ) || $acl->get_acl($forum_id, 'mod', 'delete') ) if ( ( $userdata['user_id'] == $poster_id && $auth->get_acl($forum_id, 'forum', 'delete') && $forum_topic_data['topic_last_post_id'] == $row['post_id'] ) || $auth->get_acl($forum_id, 'mod', 'delete') )
{ {
$temp_url = "posting.$phpEx$SID&amp;mode=delete&amp;p=" . $row['post_id']; $temp_url = "posting.$phpEx$SID&amp;mode=delete&amp;p=" . $row['post_id'];
$delpost_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_delete'], $lang['Delete_post']) . '</a>'; $delpost_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_delete'], $lang['Delete_post']) . '</a>';
@ -825,9 +825,9 @@ if ( $row = $db->sql_fetchrow($result) )
// If the board has HTML off but the post has HTML // If the board has HTML off but the post has HTML
// on then we process it, else leave it alone // on then we process it, else leave it alone
// //
if ( !$acl->get_acl($forum_id, 'forum', 'html') ) if ( !$auth->get_acl($forum_id, 'forum', 'html') )
{ {
if ( $row['enable_html'] && $acl->get_acl($forum_id, 'forum', 'bbcode') ) if ( $row['enable_html'] && $auth->get_acl($forum_id, 'forum', 'bbcode') )
{ {
$message = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $message); $message = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $message);
} }
@ -838,7 +838,7 @@ if ( $row = $db->sql_fetchrow($result) )
// //
if ( $bbcode_uid != '' ) if ( $bbcode_uid != '' )
{ {
$message = ( $acl->get_acl($forum_id, 'forum', 'bbcode') ) ? bbencode_second_pass($message, $bbcode_uid, $acl->get_acl($forum_id, 'forum', 'img')) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); $message = ( $auth->get_acl($forum_id, 'forum', 'bbcode') ) ? bbencode_second_pass($message, $bbcode_uid, $auth->get_acl($forum_id, 'forum', 'img')) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
} }
if ( $row['enable_magic_url'] ) if ( $row['enable_magic_url'] )
@ -933,7 +933,7 @@ if ( $row = $db->sql_fetchrow($result) )
$message = preg_replace($orig_word, $replacement_word, $message); $message = preg_replace($orig_word, $replacement_word, $message);
} }
if ( $row['enable_smilies'] && $acl->get_acl($forum_id, 'forum', 'smilies') ) if ( $row['enable_smilies'] && $auth->get_acl($forum_id, 'forum', 'smilies') )
{ {
$message = smilies_pass($message); $message = smilies_pass($message);
} }
@ -962,14 +962,14 @@ if ( $row = $db->sql_fetchrow($result) )
$user_sig = ( $row['enable_sig'] && $row['user_sig'] != '' && $board_config['allow_sig'] ) ? $row['user_sig'] : ''; $user_sig = ( $row['enable_sig'] && $row['user_sig'] != '' && $board_config['allow_sig'] ) ? $row['user_sig'] : '';
$user_sig_bbcode_uid = $row['user_sig_bbcode_uid']; $user_sig_bbcode_uid = $row['user_sig_bbcode_uid'];
if ( $user_sig != '' && $user_sig_bbcode_uid != '' && $acl->get_acl($forum_id, 'forum', 'sigs') ) if ( $user_sig != '' && $user_sig_bbcode_uid != '' && $auth->get_acl($forum_id, 'forum', 'sigs') )
{ {
if ( !$acl->get_acl($forum_id, 'forum', 'html') && $userdata['user_allowhtml'] ) if ( !$auth->get_acl($forum_id, 'forum', 'html') && $userdata['user_allowhtml'] )
{ {
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig); $user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
} }
$poster_details[$poster_id]['sig'] = bbencode_second_pass($user_sig, $user_sig_bbcode_uid, $acl->get_acl($forum_id, 'forum', 'img')); $poster_details[$poster_id]['sig'] = bbencode_second_pass($user_sig, $user_sig_bbcode_uid, $auth->get_acl($forum_id, 'forum', 'img'));
$poster_details[$poster_id]['sig'] = make_clickable($poster_details[$poster_id]['sig']); $poster_details[$poster_id]['sig'] = make_clickable($poster_details[$poster_id]['sig']);