aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/admin/admin_ban.php62
-rw-r--r--phpBB/admin/admin_board.php64
-rw-r--r--phpBB/admin/admin_database.php493
-rw-r--r--phpBB/admin/admin_disallow.php20
-rw-r--r--phpBB/admin/admin_email.php36
-rw-r--r--phpBB/admin/admin_forums.php22
-rw-r--r--phpBB/admin/admin_groups.php165
-rw-r--r--phpBB/admin/admin_permissions.php24
-rw-r--r--phpBB/admin/admin_prune.php20
-rw-r--r--phpBB/admin/admin_prune_users.php30
-rw-r--r--phpBB/admin/admin_ranks.php26
-rw-r--r--phpBB/admin/admin_search.php64
-rw-r--r--phpBB/admin/admin_smilies.php24
-rw-r--r--phpBB/admin/admin_styles.php28
-rw-r--r--phpBB/admin/admin_users.php66
-rw-r--r--phpBB/admin/admin_viewlogs.php24
-rw-r--r--phpBB/admin/admin_words.php16
-rw-r--r--phpBB/admin/index.php56
-rw-r--r--phpBB/admin/pagestart.php2
-rw-r--r--phpBB/common.php37
-rw-r--r--phpBB/faq.php2
-rw-r--r--phpBB/groupcp.php2
-rw-r--r--phpBB/imagesets/subSilver/en/icon_aim.gifbin0 -> 753 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/icon_edit.gifbin0 -> 798 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/icon_email.gifbin0 -> 820 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/icon_icq_add.gifbin0 -> 724 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/icon_ip.gifbin0 -> 275 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/icon_msnm.gifbin0 -> 783 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/icon_pm.gifbin0 -> 833 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/icon_profile.gifbin0 -> 801 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/icon_quote.gifbin0 -> 794 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/icon_search.gifbin0 -> 758 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/icon_www.gifbin0 -> 733 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/icon_yim.gifbin0 -> 799 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/msg_newpost.gifbin0 -> 1588 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/post.gifbin0 -> 1627 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/reply-locked.gifbin0 -> 1515 bytes
-rw-r--r--phpBB/imagesets/subSilver/en/reply.gifbin0 -> 1693 bytes
-rw-r--r--phpBB/includes/auth/auth_ldap.php34
-rwxr-xr-xphpBB/includes/emailer.php70
-rw-r--r--phpBB/includes/forums_display.php4
-rw-r--r--phpBB/includes/functions.php92
-rw-r--r--phpBB/includes/functions_posting.php1221
-rw-r--r--phpBB/includes/page_header.php51
-rw-r--r--phpBB/includes/page_tail.php4
-rw-r--r--phpBB/includes/session.php279
-rw-r--r--phpBB/includes/template.php13
-rw-r--r--phpBB/includes/usercp_viewprofile.php26
-rw-r--r--phpBB/index.php42
-rw-r--r--phpBB/install/schemas/mysql_basic.sql67
-rw-r--r--phpBB/install/schemas/mysql_schema.sql6
-rw-r--r--phpBB/login.php6
-rw-r--r--phpBB/memberlist.php201
-rw-r--r--phpBB/modcp.php4
-rw-r--r--phpBB/posting.php1043
-rw-r--r--phpBB/privmsg.php2
-rw-r--r--phpBB/profile.php2
-rw-r--r--phpBB/search.php299
-rw-r--r--phpBB/templates/subSilver/posting_poll_body.html5
-rw-r--r--phpBB/templates/subSilver/posting_smilies.html23
-rw-r--r--phpBB/viewforum.php8
-rw-r--r--phpBB/viewonline.php18
-rw-r--r--phpBB/viewtopic.php40
63 files changed, 2166 insertions, 2677 deletions
diff --git a/phpBB/admin/admin_ban.php b/phpBB/admin/admin_ban.php
index 3214c38589..a4f22c2481 100644
--- a/phpBB/admin/admin_ban.php
+++ b/phpBB/admin/admin_ban.php
@@ -23,7 +23,7 @@ define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('ban') )
+ if ( !$auth->get_acl_admin('ban') )
{
return;
}
@@ -46,7 +46,7 @@ require('pagestart.' . $phpEx);
//
// Do we have ban permissions?
//
-if ( !$acl->get_acl_admin('ban') )
+if ( !$auth->get_acl_admin('ban') )
{
return;
}
@@ -74,7 +74,7 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
$ban_list = array_unique(explode("\n", $HTTP_POST_VARS['ban']));
$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']) )
{
@@ -107,8 +107,8 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
}
}
- $sql = "SELECT user_id
- FROM " . USERS_TABLE . "
+ $sql = "SELECT user_id
+ FROM " . USERS_TABLE . "
WHERE username IN (" . implode(', ', $banlist_tmp) . ")";
$result = $db->sql_query($sql);
@@ -224,8 +224,8 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
break;
}
- $sql = "SELECT $type
- FROM " . BANLIST_TABLE . "
+ $sql = "SELECT $type
+ FROM " . BANLIST_TABLE . "
WHERE $type <> ''";
$result = $db->sql_query($sql);
@@ -253,13 +253,13 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
$banlist = array_unique(array_diff($banlist, $banlist_tmp));
unset($banlist_tmp);
- }
+ }
if ( sizeof($banlist) )
{
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')";
$db->sql_query($sql);
}
@@ -276,8 +276,8 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
break;
case 'email':
- $sql = "SELECT user_id
- FROM " . USERS_TABLE . "
+ $sql = "SELECT user_id
+ FROM " . USERS_TABLE . "
WHERE user_email IN (" . implode(', ', $banlist) . ")";
$result = $db->sql_query($sql);
@@ -297,7 +297,7 @@ if ( isset($HTTP_POST_VARS['bansubmit']) )
if ( $sql != '' )
{
- $sql = "DELETE FROM " . SESSIONS_TABLE . "
+ $sql = "DELETE FROM " . SESSIONS_TABLE . "
$sql";
$db->sql_query($sql);
}
@@ -322,7 +322,7 @@ else if ( isset($HTTP_POST_VARS['unbansubmit']) )
if ( $unban_sql != '' )
{
- $sql = "DELETE FROM " . BANLIST_TABLE . "
+ $sql = "DELETE FROM " . BANLIST_TABLE . "
WHERE ban_id IN ($unban_sql)";
$db->sql_query($sql);
@@ -339,8 +339,8 @@ else if ( isset($HTTP_POST_VARS['unbansubmit']) )
//
// Remove timed out bans
//
-$sql = "DELETE FROM " . BANLIST_TABLE . "
- WHERE ban_end < " . time() . "
+$sql = "DELETE FROM " . BANLIST_TABLE . "
+ WHERE ban_end < " . time() . "
AND ban_end <> 0";
$db->sql_query($sql);
@@ -387,7 +387,7 @@ switch ( $mode )
case 'user':
$sql = "SELECT b.*, u.user_id, u.username
FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u
- WHERE ( b.ban_end >= " . time() . "
+ WHERE ( b.ban_end >= " . time() . "
OR b.ban_end = 0 )
AND u.user_id = b.ban_userid
AND b.ban_userid <> 0
@@ -422,10 +422,10 @@ switch ( $mode )
case 'ip':
- $sql = "SELECT *
- FROM " . BANLIST_TABLE . "
- WHERE ( ban_end >= " . time() . "
- OR ban_end = 0 )
+ $sql = "SELECT *
+ FROM " . BANLIST_TABLE . "
+ WHERE ( ban_end >= " . time() . "
+ OR ban_end = 0 )
AND ban_ip <> ''";
$result = $db->sql_query($sql);
@@ -456,10 +456,10 @@ switch ( $mode )
case 'email':
- $sql = "SELECT *
- FROM " . BANLIST_TABLE . "
- WHERE ( ban_end >= " . time() . "
- OR ban_end = 0 )
+ $sql = "SELECT *
+ FROM " . BANLIST_TABLE . "
+ WHERE ( ban_end >= " . time() . "
+ OR ban_end = 0 )
AND ban_email <> ''";
$result = $db->sql_query($sql);
@@ -496,17 +496,17 @@ switch ( $mode )
<p><?php echo $l_ban_explain; ?></p>
<script language="Javascript" type="text/javascript">
-<!--
+<!--
var ban_length = new Array(<?php echo $banned_length; ?>);
var ban_reasons = new Array(<?php echo $banned_reasons; ?>);
//-->
</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">
- <tr>
+ <tr>
<th colspan="2"><?php echo $l_ban_title; ?></th>
</tr>
- <tr>
+ <tr>
<td class="row1" width="45%"><?php echo $l_ban_cell; ?>: </td>
<td class="row1"><textarea cols="40" rows="3" name="ban"></textarea></td>
</tr>
@@ -518,7 +518,7 @@ switch ( $mode )
<td class="row2" width="45%"><?php echo $lang['Ban_reason']; ?>:</td>
<td class="row2"><input type="text" name="banreason" maxlength="255" size="40" /></td>
</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>
</tr>
</table>
@@ -528,14 +528,14 @@ switch ( $mode )
<p><?php echo $l_unban_explain; ?></p>
<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
- <tr>
+ <tr>
<th colspan="2"><?php echo $l_unban_title; ?></th>
</tr>
- <tr>
+ <tr>
<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>
</tr>
- <tr>
+ <tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="unbansubmit" value="<?php echo $lang['Submit']; ?>" class="mainoption" /></td>
</tr>
</table></form>
diff --git a/phpBB/admin/admin_board.php b/phpBB/admin/admin_board.php
index bb4061ba1f..e6d62fcfac 100644
--- a/phpBB/admin/admin_board.php
+++ b/phpBB/admin/admin_board.php
@@ -21,7 +21,7 @@
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('general') )
+ if ( !$auth->get_acl_admin('general') )
{
return;
}
@@ -45,7 +45,7 @@ $phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
-if ( !$acl->get_acl_admin('general') )
+if ( !$auth->get_acl_admin('general') )
{
message_die(MESSAGE, $lang['No_admin']);
}
@@ -325,9 +325,6 @@ switch ( $mode )
$activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? '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_off = ( $new['privmsg_disable'] ) ? 'checked="checked"' : '';
@@ -348,18 +345,6 @@ switch ( $mode )
<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>
- <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['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>
</tr>
@@ -408,14 +393,6 @@ switch ( $mode )
<td class="row2"><input type="text" size="3" maxlength="3" name="max_search_chars" value="<?php echo $new['max_search_chars']; ?>" /></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>
- <tr>
<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>
</tr>
@@ -485,6 +462,13 @@ switch ( $mode )
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>
<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="row2"><input type="text" maxlength="255" name="script_path" value="<?php echo $new['script_path']; ?>" /></td>
</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
break;
@@ -513,7 +521,7 @@ switch ( $mode )
$dp = opendir($phpbb_root_path . 'includes/auth');
while ( $file = readdir($dp) )
{
- if ( preg_match('/^auth_(.*?)\.' . $phpEx . '$/', $file) )
+ if ( preg_match('/^auth_(.*?)\.' . $phpEx . '$/', $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>
</tr>
<?php
-
+
foreach ( $auth_plugins as $method )
{
if ( $method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx) )
@@ -553,7 +561,7 @@ switch ( $mode )
{
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', '')";
$db->sql_query($sql);
}
diff --git a/phpBB/admin/admin_database.php b/phpBB/admin/admin_database.php
index 74783b1c2a..bedb91efff 100644
--- a/phpBB/admin/admin_database.php
+++ b/phpBB/admin/admin_database.php
@@ -1,6 +1,6 @@
<?php
/***************************************************************************
-* admin_db_utilities.php
+* admin_database.php
* -------------------
* begin : Thu May 31, 2001
* copyright : (C) 2001 The phpBB Group
@@ -18,17 +18,14 @@
* (at your option) any later version.
*
***************************************************************************/
-//
-// Some functions are adapted phpMyAdmin 2.2.0.
-//
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('general') )
+ if ( !$auth->get_acl_admin('general') )
{
return;
}
-
+
$filename = basename(__FILE__);
$module['DB']['DB_Backup'] = $filename . "$SID&amp;mode=backup";
@@ -51,9 +48,9 @@ require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
//
+// Do we have DB backup/restore permissions?
//
-//
-if ( !$acl->get_acl_admin('general') )
+if ( !$auth->get_acl_admin('general') )
{
message_die(MESSAGE, $lang['No_admin']);
}
@@ -64,46 +61,43 @@ if ( !$acl->get_acl_admin('general') )
//
@set_time_limit(1200);
+$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : '';
+
//
// Begin program proper
//
-
-if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
+switch( $mode )
{
- $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
+ case 'backup':
- switch( $mode )
- {
- case 'backup':
-
- if ( SQL_LAYER == 'oracle' || SQL_LAYER == 'odbc' || SQL_LAYER == 'mssql' )
+ if ( SQL_LAYER == 'oracle' || SQL_LAYER == 'odbc' || SQL_LAYER == 'mssql' )
+ {
+ switch ( SQL_LAYER )
{
- switch ( SQL_LAYER )
- {
- case 'oracle':
- $db_type = 'Oracle';
- break;
- case 'odbc':
- $db_type = 'ODBC';
- break;
- case 'mssql':
- $db_type = 'MSSQL';
- break;
- }
-
- message_die(MESSAGE, $lang['Backups_not_supported']);
- break;
+ case 'oracle':
+ $db_type = 'Oracle';
+ break;
+ case 'odbc':
+ $db_type = 'ODBC';
+ break;
+ case 'mssql':
+ $db_type = 'MSSQL';
+ break;
}
- $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'] : '' );
- $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' );
+ message_die(MESSAGE, $lang['Backups_not_supported']);
+ break;
+ }
- if ( !isset($HTTP_POST_VARS['backupstart']) && !isset($HTTP_GET_VARS['backupstart']) )
- {
- page_header($lang['DB_Backup']);
+ $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'] : '' );
+ $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>
</tr>
<?php
-
- if ( extension_loaded('zlib') || extension_loaded('bz2') )
- {
+
+ if ( extension_loaded('zlib') || extension_loaded('bz2') )
+ {
?>
<tr>
<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
-
- 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
-
- }
- if ( extension_loaded('bz2') )
- {
+ }
+
+ if ( extension_loaded('bz2') )
+ {
?>&nbsp;&nbsp;<input type="radio" name="compress" value="bzip" />.bz2<?php
-
- }
-
+
+ }
+
?></td>
</tr>
<?php
-
- }
+
+ }
?>
<tr>
@@ -170,229 +164,232 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
<?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\">";
- }
- 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'];
- $message = ( empty($store_path) ) ? $lang['Backup_download'] : $lang['Backup_writing'];
+ page_header($lang['DB_Backup'], $meta);
+ page_message($lang['DB_Backup'], $message);
+ page_footer();
+ }
- 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);
- $tables = ( SQL_LAYER != 'postgresql' ) ? mysql_get_tables() : pg_get_tables();
- @sort($tables);
+ if ( !empty($additional_tables) )
+ {
+ $additional_tables = explode(',', $additional_tables);
- if ( !empty($additional_tables) )
+ for($i = 0; $i < count($additional_tables); $i++)
{
- $additional_tables = explode(',', $additional_tables);
-
- for($i = 0; $i < count($additional_tables); $i++)
- {
- $tables[] = trim($additional_tables[$i]);
- }
- unset($additional_tables);
+ $tables[] = trim($additional_tables[$i]);
}
+ unset($additional_tables);
+ }
- //
- // Enable output buffering
- //
- @ob_start();
- @ob_implicit_flush(0);
+ //
+ // 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";
+ //
+ // 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 == 'postgresql' )
+ if ( SQL_LAYER != 'mysql4' )
{
- echo "\n" . pg_get_sequences("\n", $backup_type);
+ $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";
}
- for($i = 0; $i < count($tables); $i++)
+ if ( $backup_type != 'data' )
{
- $table_name = $tables[$i];
+ echo "#\n# TABLE: " . $table_name . "\n#\n";
+ echo $table_def_function($table_name, "\n") . "\n";
+ }
- if ( SQL_LAYER != 'mysql4' )
- {
- $table_def_function = "get_table_def_" . SQL_LAYER;
- $table_content_function = "get_table_content_" . SQL_LAYER;
- }
- else
+ if ( $backup_type != 'structure' )
+ {
+ //
+ // Skip search table data?
+ //
+ if ( $search || ( !$search && !preg_match('/search_word/', $table_name) ) )
{
- $table_def_function = "get_table_def_mysql";
- $table_content_function = "get_table_content_mysql";
+ $table_content_function($table_name, "output_table_content");
}
+ }
+ }
- if ( $backup_type != 'data' )
- {
- echo "#\n# TABLE: " . $table_name . "\n#\n";
- echo $table_def_function($table_name, "\n") . "\n";
- }
+ //
+ // Flush the buffer, send the file
+ //
+ switch ( $compress )
+ {
+ case 'gzip':
+ $extension = 'sql.gz';
+ $contents = gzencode(ob_get_contents());
+ ob_end_clean();
+ break;
- 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 '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;
- case 'bzip':
- $extension = 'bz2';
- $contents = bzcompress(ob_get_contents());
- ob_end_clean();
- break;
+ default:
+ $extension = 'sql';
+ $contents = ob_get_contents();
+ ob_end_clean();
+ }
- default:
- $extension = 'sql';
- $contents = ob_get_contents();
- ob_end_clean();
- }
+ add_admin_log('log_db_backup');
- if ( empty($store_path) )
- {
- header("Pragma: no-cache");
- header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.$extension\"");
- header("Content-disposition: attachment; filename=phpbb_db_backup.$extension");
+ 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);
+ echo $contents;
+ unset($contents);
+ }
+ else
+ {
+ if ( !($fp = fopen('./../' . $store_path . "/phpbb_db_backup.$extension", 'wb')) )
+ {
+ message_die(ERROR, 'Could not open backup file');
}
- else
+
+ if ( !fwrite($fp, $contents) )
{
- if ( !($fp = fopen('./../' . $store_path . "/phpbb_db_backup.$extension", 'wb')) )
- {
- message_die(ERROR, 'Could not open backup file');
- }
+ message_die(ERROR, 'Could not write backup file content');
+ }
- if ( !fwrite($fp, $contents) )
- {
- message_die(ERROR, 'Could not write backup file content');
- }
+ fclose($fp);
+ unset($contents);
+
+ message_die(MESSAGE, $lang['Backup_success']);
+ }
- fclose($fp);
- unset($contents);
+ exit;
+ break;
- message_die(MESSAGE, $lang['Backup_success']);
+ case 'restore':
+
+ if ( isset($HTTP_POST_VARS['restorestart']) )
+ {
+ //
+ // Handle the file upload ....
+ // If no file was uploaded report an error...
+ //
+ 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'] : '';
}
- exit;
- break;
+ if ( $file_tmpname == '' || $filename == '' || !file_exists($file_tmpname) )
+ {
+ message_die(MESSAGE, $lang['Restore_Error_no_file']);
+ }
- case 'restore':
+ $ext = substr($filename, strrpos($filename, '.') + 1);
- if ( isset($HTTP_POST_VARS['restorestart']) )
+ if ( !preg_match('/^(sql|gz|bz2)$/', $ext) )
{
- //
- // Handle the file upload ....
- // If no file was uploaded report an error...
- //
- 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'] : '';
- }
+ message_die(MESSAGE, $lang['Restore_Error_filename']);
+ }
- if ( $file_tmpname == '' || $filename == '' || !file_exists($file_tmpname) )
- {
- message_die(MESSAGE, $lang['Restore_Error_no_file']);
- }
+ if ( ( !extension_loaded('zlib') && $ext == 'gz' ) || ( !extension_loaded('zip') && $ext == 'zip' ) || ( $ext == 'bz2' && !extension_loaded('bz2') ) )
+ {
+ message_die(MESSAGE, $lang['Compress_unsupported']);
+ }
- $ext = substr($filename, strrpos($filename, '.') + 1);
+ $sql_query = '';
+ switch ( $ext )
+ {
+ case 'gz':
+ $fp = gzopen($file_tmpname, 'rb');
+ while ( !gzeof($fp) )
+ {
+ $sql_query .= gzgets($fp, 100000);
+ }
+ gzclose($fp);
+ break;
- if ( !preg_match('/^(sql|gz|bz2)$/', $ext) )
- {
- message_die(MESSAGE, $lang['Restore_Error_filename']);
- }
+ case 'bz2':
+ $sql_query = bzdecompress(fread(fopen($file_tmpname, 'rb'), filesize($file_tmpname)));
+ break;
- if ( ( !extension_loaded('zlib') && $ext == 'gz' ) || ( !extension_loaded('zip') && $ext == 'zip' ) || ( $ext == 'bz2' && !extension_loaded('bz2') ) )
- {
- message_die(MESSAGE, $lang['Compress_unsupported']);
- }
+ default;
+ $sql_query = fread(fopen($file_tmpname, 'r'), filesize($file_tmpname));
+ }
- $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, ';');
- if ( $sql_query != '' )
+ $sql_count = count($pieces);
+ for($i = 0; $i < $sql_count; $i++)
{
- // Strip out sql comments...
- $sql_query = remove_remarks($sql_query);
- $pieces = split_sql_file($sql_query, ';');
+ $sql = trim($pieces[$i]);
- $sql_count = count($pieces);
- for($i = 0; $i < $sql_count; $i++)
+ if ( !empty($sql) && $sql[0] != '#' )
{
- $sql = trim($pieces[$i]);
-
- if ( !empty($sql) && $sql[0] != '#' )
- {
- $db->sql_query($sql);
- }
+ $db->sql_query($sql);
}
}
-
- message_die(MESSAGE, $lang['Restore_success']);
}
- //
- // Restore page
- //
- page_header($lang['DB_Restore']);
+ 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>
</tr>
<tr>
- <td class="row1"><?php echo $lang['Upload_file']; ?>: <br /><span class="gensmall"><?php
-
- echo $lang['Supported_extensions'];
+ <td class="row1"><?php echo $lang['Upload_file']; ?>: <br /><span class="gensmall"><?php
- $types = ': <u>sql</u>';
- if ( extension_loaded('zlib') )
- {
- $types .= ', <u>sql.gz</u>';
- }
- if ( extension_loaded('bz2') )
- {
- $types .= ', <u>bz2</u>';
- }
+ echo $lang['Supported_extensions'];
- 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>
<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
- }
+ break;
+
+ default:
+ exit;
+
}
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
// 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
//
class zipfile
@@ -1138,7 +1139,7 @@ class zipfile
pack('V', strlen($ctrldir)) . // size of central dir
pack('V', strlen($data)) . // offset to start of central dir
"\x00\x00"; // .zip file comment length
- }
+ }
}
diff --git a/phpBB/admin/admin_disallow.php b/phpBB/admin/admin_disallow.php
index 83caf18e9c..83f9a48a8e 100644
--- a/phpBB/admin/admin_disallow.php
+++ b/phpBB/admin/admin_disallow.php
@@ -23,7 +23,7 @@ define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('user') )
+ if ( !$auth->get_acl_admin('user') )
{
return;
}
@@ -45,7 +45,7 @@ require('pagestart.' . $phpEx);
//
// Do we have user admin permissions?
//
-if ( !$acl->get_acl_admin('user') )
+if ( !$auth->get_acl_admin('user') )
{
return;
}
@@ -63,7 +63,7 @@ if( isset($HTTP_POST_VARS['add_name']) )
}
else
{
- $sql = "INSERT INTO " . DISALLOW_TABLE . " (disallow_username)
+ $sql = "INSERT INTO " . DISALLOW_TABLE . " (disallow_username)
VALUES('" . str_replace("\'", "''", $disallowed_user) . "')";
$result = $db->sql_query( $sql );
@@ -79,8 +79,8 @@ if( isset($HTTP_POST_VARS['add_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'] );
-
- $sql = "DELETE FROM " . DISALLOW_TABLE . "
+
+ $sql = "DELETE FROM " . DISALLOW_TABLE . "
WHERE disallow_id = $disallowed_id";
$db->sql_query($sql);
@@ -95,7 +95,7 @@ else if( isset($HTTP_POST_VARS['delete_name']) )
//
// Grab the current list of disallowed usernames...
//
-$sql = "SELECT *
+$sql = "SELECT *
FROM " . DISALLOW_TABLE;
$result = $db->sql_query($sql);
@@ -121,17 +121,17 @@ page_header($lang['Users']);
<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">
- <tr>
+ <tr>
<th colspan="2"><?php echo $lang['Add_disallow_title']; ?></th>
</tr>
- <tr>
+ <tr>
<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>
</tr>
- <tr>
+ <tr>
<th colspan="2"><?php echo $lang['Delete_disallow_title']; ?></th>
</tr>
- <tr>
+ <tr>
<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>
</tr>
diff --git a/phpBB/admin/admin_email.php b/phpBB/admin/admin_email.php
index e1e6af523d..27dd13e2db 100644
--- a/phpBB/admin/admin_email.php
+++ b/phpBB/admin/admin_email.php
@@ -21,14 +21,14 @@
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('general') )
+ if ( !$auth->get_acl_admin('general') )
{
return;
}
$filename = basename(__FILE__);
$module['General']['Mass_Email'] = $filename . $SID;
-
+
return;
}
@@ -43,14 +43,14 @@ require('pagestart.' . $phpEx);
//
// Do we have general admin permissions?
//
-if ( !$acl->get_acl_admin('general') )
+if ( !$auth->get_acl_admin('general') )
{
return;
}
//
// Set some vars
-//
+//
$message = '';
$subject = '';
@@ -80,7 +80,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
$subject = stripslashes($HTTP_POST_VARS['subject']);
$message = stripslashes($HTTP_POST_VARS['message']);
-
+
//
// Error checking needs to go here ... if no subject and/or
// 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');
}
$emailer = new emailer($board_config['smtp_delivery']);
-
+
$email_headers = 'From: ' . $board_config['board_email'] . "\n";
$bcc_list = '';
@@ -111,7 +111,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
$bcc_list .= ( ( $bcc_list != '' ) ? ', ' : '' ) . $email_list[$i]['user_email'];
}
$email_headers .= "Bcc: $bcc_list\n";
-
+
$email_headers .= 'Return-Path: ' . $userdata['board_email'] . "\n";
$email_headers .= 'X-AntiAbuse: Board servername - ' . $server_name . "\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->assign_vars(array(
- 'SITENAME' => $board_config['sitename'],
- 'BOARD_EMAIL' => $board_config['board_email'],
+ 'SITENAME' => $board_config['sitename'],
+ 'BOARD_EMAIL' => $board_config['board_email'],
'MESSAGE' => $message)
);
@@ -134,13 +134,13 @@ if ( isset($HTTP_POST_VARS['submit']) )
message_die(MESSAGE, $lang['Email_sent']);
}
-}
+}
//
// Initial selection
//
-$sql = "SELECT group_id, group_name
+$sql = "SELECT group_id, group_name
FROM ".GROUPS_TABLE;
$result = $db->sql_query($sql);
@@ -164,22 +164,22 @@ page_header($lang['Mass_Email']);
<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">
- <tr>
+ <tr>
<th colspan="2"><?php echo $lang['Compose']; ?></th>
</tr>
- <tr>
+ <tr>
<td class="row1" align="right"><b><?php echo $lang['Recipients']; ?></b></td>
<td class="row2" align="left"><?php echo $select_list; ?></td>
</tr>
- <tr>
+ <tr>
<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>
</tr>
- <tr>
- <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>
+ <tr>
+ <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>
</tr>
- <tr>
+ <tr>
<td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $lang['Email']; ?>" name="submit" class="mainoption" /></td>
</tr>
</table></form>
diff --git a/phpBB/admin/admin_forums.php b/phpBB/admin/admin_forums.php
index a15fb902c6..34e842b0fb 100644
--- a/phpBB/admin/admin_forums.php
+++ b/phpBB/admin/admin_forums.php
@@ -21,7 +21,7 @@
if (!empty($setmodules))
{
- if (!$acl->get_acl_admin('forum'))
+ if (!$auth->get_acl_admin('forum'))
{
return;
}
@@ -43,7 +43,7 @@ include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
//
// Do we have forum admin permissions?
//
-if (!$acl->get_acl_admin('forum'))
+if (!$auth->get_acl_admin('forum'))
{
message_die(MESSAGE, $lang['No_admin']);
}
@@ -535,7 +535,7 @@ switch ($mode)
</tr>
</table>
</form>
-
+
<br clear="all" />
<?php
@@ -562,10 +562,10 @@ switch ($mode)
<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">
- <tr>
+ <tr>
<th colspan="2" class="thHead"><?php echo $lang['Forum_delete'] ?></th>
</tr>
- <tr>
+ <tr>
<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>
</tr>
@@ -573,11 +573,11 @@ switch ($mode)
if ($forum_status != ITEM_CATEGORY)
{
?>
- <tr>
+ <tr>
<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>
</tr>
- <tr>
+ <tr>
<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>
</tr>
@@ -586,18 +586,18 @@ switch ($mode)
if ($right_id - $left_id > 1)
{
?>
- <tr>
+ <tr>
<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>
</tr>
- <tr>
+ <tr>
<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>
</tr>
<?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>
</tr>
</table>
@@ -705,7 +705,7 @@ while ($row = $db->sql_fetchrow($result))
$forum_title = htmlspecialchars($sub_row['forum_name']);
$forum_desc = htmlspecialchars($sub_row['forum_desc']);
$subforums = ($sub_row['right_id'] - $sub_row['left_id'] - 1) / 2;
-
+
if ($sub_row['forum_status'] != ITEM_CATEGORY)
{
$colspan = '';
diff --git a/phpBB/admin/admin_groups.php b/phpBB/admin/admin_groups.php
index e3c35f1d93..3a7e7a95fe 100644
--- a/phpBB/admin/admin_groups.php
+++ b/phpBB/admin/admin_groups.php
@@ -19,10 +19,13 @@
*
***************************************************************************/
-define('IN_PHPBB', 1);
-
if( !empty($setmodules) )
{
+ if ( !$auth->get_acl_admin('group') )
+ {
+ return;
+ }
+
$filename = basename(__FILE__);
$module['Groups']['Create'] = $filename . "$SID&amp;mode=create";
$module['Groups']['Delete'] = $filename . "$SID&amp;mode=delete";
@@ -31,20 +34,29 @@ if( !empty($setmodules) )
return;
}
+define('IN_PHPBB', 1);
//
-// Load default header
+// Include files
//
-$phpbb_root_path = "../";
+$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
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]) )
{
$group_id = ( isset($HTTP_POST_VARS[POST_GROUPS_URL]) ) ? intval($HTTP_POST_VARS[POST_GROUPS_URL]) : intval($HTTP_GET_VARS[POST_GROUPS_URL]);
}
else
{
- $group_id = "";
+ $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++)
{
- 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'];
}
@@ -136,15 +148,15 @@ if( isset($HTTP_POST_VARS['edit']) || isset($HTTP_POST_VARS['new']) )
$template->assign_vars(array(
"GROUP_NAME" => $group_info['group_name'],
- "GROUP_DESCRIPTION" => $group_info['group_description'],
- "GROUP_MODERATOR" => $group_moderator,
+ "GROUP_DESCRIPTION" => $group_info['group_description'],
+ "GROUP_MODERATOR" => $group_moderator,
"L_GROUP_TITLE" => $lang['Group_administration'],
- "L_GROUP_EDIT_DELETE" => ( isset($HTTP_POST_VARS['new']) ) ? $lang['New_group'] : $lang['Edit_group'],
+ "L_GROUP_EDIT_DELETE" => ( isset($HTTP_POST_VARS['new']) ) ? $lang['New_group'] : $lang['Edit_group'],
"L_GROUP_NAME" => $lang['group_name'],
"L_GROUP_DESCRIPTION" => $lang['group_description'],
- "L_GROUP_MODERATOR" => $lang['group_moderator'],
- "L_FIND_USERNAME" => $lang['Find_username'],
+ "L_GROUP_MODERATOR" => $lang['group_moderator'],
+ "L_FIND_USERNAME" => $lang['Find_username'],
"L_GROUP_STATUS" => $lang['group_status'],
"L_GROUP_OPEN" => $lang['group_open'],
"L_GROUP_CLOSED" => $lang['group_closed'],
@@ -157,7 +169,7 @@ if( isset($HTTP_POST_VARS['edit']) || isset($HTTP_POST_VARS['new']) )
"L_DELETE_MODERATOR_EXPLAIN" => $lang['delete_moderator_explain'],
"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_CLOSED_TYPE" => GROUP_CLOSED,
@@ -220,7 +232,7 @@ else if( isset($HTTP_POST_VARS['group_update']) )
{
message_die(GENERAL_MESSAGE, $lang['No_group_moderator']);
}
-
+
$this_userdata = get_userdata($group_moderator);
$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']);
}
-
+
if( $mode == "editgroup" )
{
$sql = "SELECT *
@@ -243,14 +255,14 @@ else if( isset($HTTP_POST_VARS['group_update']) )
{
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 ( $delete_old_moderator != "" )
{
$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;
if ( !$result = $db->sql_query($sql) )
{
@@ -265,20 +277,20 @@ else if( isset($HTTP_POST_VARS['group_update']) )
}
}
$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";
if ( !$result = $db->sql_query($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_die(GENERAL_MESSAGE, $message);
}
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;
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;
- $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')";
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 = $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);
@@ -313,48 +325,97 @@ else if( isset($HTTP_POST_VARS['group_update']) )
}
}
}
-else
-{
+
+page_header($lang['Manage']);
+
+?>
+
+<h1><?php echo $lang['Manage']; ?></h1>
+
+<p><?php echo $lang['Group_manage_explain']; ?></p>
+
+<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>
+ </tr>
+<?php
+
$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);
+ $result = $db->sql_query($sql);
- $select_list = "<select name=\"" . POST_GROUPS_URL . "\">";
- for($i = 0; $i < count($group_list); $i++)
+ $groups = array();
+ if ( $row = $db->sql_fetchrow($result) )
{
- $select_list .= "<option value=\"" . $group_list[$i]['group_id'] . "\">" . $group_list[$i]['group_name'] . "</option>";
+ do
+ {
+ $groups[] = $row;
+ }
+ while ( $row = $db->sql_fetchrow($result) );
}
- $select_list .= "</select>";
-
- $template->set_filenames(array(
- "body" => "admin/group_select_body.tpl")
- );
- $template->assign_vars(array(
- "L_GROUP_TITLE" => $lang['Group_administration'],
- "L_GROUP_EXPLAIN" => $lang['Group_admin_explain'],
- "L_GROUP_SELECT" => $lang['Select_group'],
- "L_LOOK_UP" => $lang['Look_up_group'],
- "L_CREATE_NEW_GROUP" => $lang['New_group'],
+ $sql = "SELECT ug.group_id, u.user_id, u.username
+ FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug
+ WHERE ug.user_pending = 1
+ AND u.user_id = ug.user_id
+ ORDER BY ug.group_id";
+ $result = $db->sql_query($sql);
- "S_GROUP_ACTION" => append_sid("admin_groups.$phpEx"),
- "S_GROUP_SELECT" => $select_list)
- );
+ $pending = array();
+ if ( $row = $db->sql_fetchrow($result) )
+ {
+ do
+ {
+ $pending[$row['group_id']][] = $row;
+ }
+ while ( $row = $db->sql_fetchrow($result) );
+ }
- //
- // Faking the IF... ELSE statements again...
- //
- if( count($group_list) > 0 )
+ foreach ( $groups as $group_ary )
{
- $template->assign_block_vars("select_box", array());
+ $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
+
+ }
}
- $template->pparse('body');
-}
+?>
+</table></form>
+
+<?php
-include('page_footer_admin.'.$phpEx);
+page_footer();
?>
diff --git a/phpBB/admin/admin_permissions.php b/phpBB/admin/admin_permissions.php
index 43d79d4709..656ddcedcd 100644
--- a/phpBB/admin/admin_permissions.php
+++ b/phpBB/admin/admin_permissions.php
@@ -21,7 +21,7 @@
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('auth') )
+ if ( !$auth->get_acl_admin('auth') )
{
return;
}
@@ -46,7 +46,7 @@ require('pagestart.' . $phpEx);
//
// Do we have forum admin permissions?
//
-if ( !$acl->get_acl_admin('auth') )
+if ( !$auth->get_acl_admin('auth') )
{
message_die(MESSAGE, $lang['No_admin']);
}
@@ -101,6 +101,13 @@ switch ( $mode )
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']) )
{
switch ( $HTTP_POST_VARS['type'] )
@@ -116,7 +123,7 @@ if ( isset($HTTP_POST_VARS['update']) )
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');
@@ -156,7 +163,7 @@ else if ( isset($HTTP_POST_VARS['delete']) )
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');
@@ -344,9 +351,16 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
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
FROM " . ACL_OPTIONS_TABLE . "
- WHERE auth_value LIKE '" . $type_sql . "_%'";
+ WHERE auth_value LIKE '" . $type_sql . "_%'
+ $founder_sql";
$result = $db->sql_query($sql);
$auth_options = array();
diff --git a/phpBB/admin/admin_prune.php b/phpBB/admin/admin_prune.php
index f1b531cb7d..12bebe7c0c 100644
--- a/phpBB/admin/admin_prune.php
+++ b/phpBB/admin/admin_prune.php
@@ -21,11 +21,11 @@
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('forum') )
+ if ( !$auth->get_acl_admin('forum') )
{
return;
}
-
+
$filename = basename(__FILE__);
$module['Forums']['Prune'] = $filename . $SID . '&amp;mode=forums';
@@ -39,12 +39,12 @@ define('IN_PHPBB', 1);
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
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?
//
-if ( !$acl->get_acl_admin('forum') )
+if ( !$auth->get_acl_admin('forum') )
{
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);
sync('forum', $forum_rows[$i]['forum_id']);
-
+
$template->assign_block_vars('prune_results', array(
- 'ROW_COLOR' => '#' . $row_color,
- 'ROW_CLASS' => $row_class,
+ 'ROW_COLOR' => '#' . $row_color,
+ 'ROW_CLASS' => $row_class,
'FORUM_NAME' => $forum_rows[$i]['forum_name'],
'FORUM_TOPICS' => $p_result['topics'],
'FORUM_POSTS' => $p_result['posts'])
@@ -161,7 +161,7 @@ else
{
$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'];
$s_hidden_fields = '<input type="hidden" name="f" value="' . $forum_id . '">';
@@ -175,13 +175,13 @@ else
<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">
- <tr>
+ <tr>
<th class="th"><?php echo $lang['Forum_Prune']; ?></th>
</tr>
<tr>
<td class="row1"><?php echo $prune_data; ?></td>
</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>
</tr>
</table></form>
diff --git a/phpBB/admin/admin_prune_users.php b/phpBB/admin/admin_prune_users.php
index 1169c4415d..ec744510a8 100644
--- a/phpBB/admin/admin_prune_users.php
+++ b/phpBB/admin/admin_prune_users.php
@@ -21,7 +21,7 @@
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('user') )
+ if ( !$auth->get_acl_admin('user') )
{
return;
}
@@ -43,7 +43,7 @@ require('pagestart.' . $phpEx);
//
// Do we have forum admin permissions?
//
-if ( !$acl->get_acl_admin('user') )
+if ( !$auth->get_acl_admin('user') )
{
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 .= '</form>';
page_header($lang['Prune_users']);
@@ -90,7 +90,7 @@ if ( isset($HTTP_POST_VARS['prune']) )
page_message($lang['Confirm'], $l_message, false);
page_footer();
-
+
}
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])) : '';
}
- $sql = "SELECT username, user_id FROM " . USERS_TABLE . "
- WHERE user_id <> " . ANONYMOUS . "
+ $sql = "SELECT username, user_id FROM " . USERS_TABLE . "
+ WHERE user_id <> " . ANONYMOUS . "
$where_sql";
$result = $db->sql_query($sql);
@@ -169,8 +169,8 @@ if ( isset($HTTP_POST_VARS['prune']) )
for($i = 0; $i < sizeof($user_ids); $i++)
{
- $sql = "UPDATE " . POSTS_TABLE . "
- SET poster_id = " . ANONYMOUS . ", post_username = '" . $usernames[$i] . "'
+ $sql = "UPDATE " . POSTS_TABLE . "
+ SET poster_id = " . ANONYMOUS . ", post_username = '" . $usernames[$i] . "'
WHERE user_id = " . $userids[$i];
// $db->sql_query($sql);
}
@@ -184,7 +184,7 @@ if ( isset($HTTP_POST_VARS['prune']) )
$sql = "UPDATE " . USERS_TABLE . " SET user_active = 0";
}
- $sql .= " WHERE user_id <> " . ANONYMOUS . "
+ $sql .= " WHERE user_id <> " . ANONYMOUS . "
$where_sql";
// $db->sql_query($sql);
@@ -233,26 +233,26 @@ page_header($lang['Prune_users']);
<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">
- <tr>
+ <tr>
<th colspan="2"><?php echo $lang['Prune_users']; ?></th>
</tr>
- <tr>
+ <tr>
<td class="row1"><?php echo $lang['Username']; ?>: </td>
<td class="row2"><input class="post" type="text" name="username" /></td>
</tr>
- <tr>
+ <tr>
<td class="row1"><?php echo $lang['Email']; ?>: </td>
<td class="row2"><input class="post" type="text" name="email" /></td>
</tr>
- <tr>
+ <tr>
<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>
</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="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>
<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>
</tr>
diff --git a/phpBB/admin/admin_ranks.php b/phpBB/admin/admin_ranks.php
index fd87887456..176aa50cf4 100644
--- a/phpBB/admin/admin_ranks.php
+++ b/phpBB/admin/admin_ranks.php
@@ -23,7 +23,7 @@ define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('user') )
+ if ( !$auth->get_acl_admin('user') )
{
return;
}
@@ -43,7 +43,7 @@ require('pagestart.' . $phpEx);
//
//
//
-if ( !$acl->get_acl_admin('user') )
+if ( !$auth->get_acl_admin('user') )
{
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'];
}
-else
+else
{
//
// These could be entered via a form button
@@ -85,9 +85,9 @@ if ( $mode != '' )
// They want to add a new rank, show the form.
//
$rank_id = ( isset($HTTP_GET_VARS['id']) ) ? intval($HTTP_GET_VARS['id']) : 0;
-
+
$s_hidden_fields = '<input type="hidden" name="mode" value="save" />';
-
+
if ( $mode == 'edit' )
{
if ( empty($rank_id) )
@@ -98,7 +98,7 @@ if ( $mode != '' )
$sql = "SELECT * FROM " . RANKS_TABLE . "
WHERE rank_id = $rank_id";
$result = $db->sql_query($sql);
-
+
$rank_info = $db->sql_fetchrow($result);
$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.
//
-
+
$rank_id = ( isset($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : 0;
$rank_title = ( isset($HTTP_POST_VARS['title']) ) ? trim($HTTP_POST_VARS['title']) : '';
$special_rank = ( $HTTP_POST_VARS['special_rank'] == 1 ) ? TRUE : 0;
@@ -194,7 +194,7 @@ if ( $mode != '' )
$message = $lang['Rank_added'];
}
-
+
$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>');
@@ -207,7 +207,7 @@ if ( $mode != '' )
//
// Ok, they want to delete their rank
//
-
+
if ( isset($HTTP_POST_VARS['id']) || isset($HTTP_GET_VARS['id']) )
{
$rank_id = ( isset($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : intval($HTTP_GET_VARS['id']);
@@ -216,15 +216,15 @@ if ( $mode != '' )
{
$rank_id = 0;
}
-
+
if ( $rank_id )
{
$sql = "DELETE FROM " . RANKS_TABLE . "
WHERE rank_id = $rank_id";
$db->sql_query($sql);
-
- $sql = "UPDATE " . USERS_TABLE . "
- SET user_rank = 0
+
+ $sql = "UPDATE " . USERS_TABLE . "
+ SET user_rank = 0
WHERE user_rank = $rank_id";
$db->sql_query($sql);
diff --git a/phpBB/admin/admin_search.php b/phpBB/admin/admin_search.php
index 9adfa2cae4..86d7b820b2 100644
--- a/phpBB/admin/admin_search.php
+++ b/phpBB/admin/admin_search.php
@@ -1,4 +1,4 @@
-<?php
+<?php
/***************************************************************************
* admin_search.php
* -------------------
@@ -21,7 +21,7 @@
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('general') )
+ if ( !$auth->get_acl_admin('general') )
{
return;
}
@@ -44,7 +44,7 @@ include($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
//
// Do we have forum admin permissions?
//
-if ( !$acl->get_acl_admin('general') )
+if ( !$auth->get_acl_admin('general') )
{
message_die(MESSAGE, $lang['No_admin']);
}
@@ -113,8 +113,8 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
//
// Take board offline
//
- $sql = "UPDATE " . CONFIG_TABLE . "
- SET config_value = '1'
+ $sql = "UPDATE " . CONFIG_TABLE . "
+ SET config_value = '1'
WHERE config_name = 'board_disable'";
$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
//
- $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;
$result = $db->sql_query($sql);
@@ -139,18 +139,18 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
$db->sql_freeresult($result);
- $sql = "SELECT *
- FROM " . POSTS_TEXT_TABLE . "
- WHERE post_id
- BETWEEN $batchstart
+ $sql = "SELECT *
+ FROM " . POSTS_TEXT_TABLE . "
+ WHERE post_id
+ BETWEEN $batchstart
AND $batchend";
$result = $db->sql_query($sql);
-
+
if ( $row = $db->sql_fetchrow($result) )
{
do
{
- $post_id = $row['post_id'];
+ $post_id = $row['post_id'];
$search_raw_words = 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) )
{
for ($i = 0; $i < count($search_matches); $i++)
- {
+ {
$search_matches[$i] = trim($search_matches[$i]);
- if ( $search_matches[$i] != '' )
+ if ( $search_matches[$i] != '' )
{
$word[] = $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 'oracle':
case 'db2':
- $sql = "SELECT word_id, word_text
- FROM " . SEARCH_WORD_TABLE . "
+ $sql = "SELECT word_id, word_text
+ FROM " . SEARCH_WORD_TABLE . "
WHERE word_text IN ($word_text_sql)";
$result = $db->sql_query($sql);
@@ -209,7 +209,7 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
$value_sql = '';
$match_word = array();
for ($i = 0; $i < count($word); $i++)
- {
+ {
$new_match = true;
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] . "'";
break;
default:
- $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
- VALUES ('" . $word[$i] . "')";
+ $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
+ VALUES ('" . $word[$i] . "')";
$db->sql_query($sql);
break;
}
@@ -242,12 +242,12 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
{
case 'mysql':
case 'mysql4':
- $sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text)
- VALUES $value_sql";
+ $sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text)
+ VALUES $value_sql";
break;
case 'mssql':
- $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
- $value_sql";
+ $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
+ $value_sql";
break;
}
@@ -261,10 +261,10 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
if ( $match_sql != '' )
{
- $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match)
- SELECT $post_id, word_id, $title_match
- FROM " . SEARCH_WORD_TABLE . "
- WHERE word_text IN ($match_sql)";
+ $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match)
+ SELECT $post_id, word_id, $title_match
+ FROM " . SEARCH_WORD_TABLE . "
+ WHERE word_text IN ($match_sql)";
$db->sql_query($sql);
}
}
@@ -290,8 +290,8 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
}
else
{
- $sql = "UPDATE " . CONFIG_TABLE . "
- SET config_value = '0'
+ $sql = "UPDATE " . CONFIG_TABLE . "
+ SET config_value = '0'
WHERE config_name = 'board_disable'";
$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']) )
{
- $sql = "UPDATE " . CONFIG_TABLE . "
- SET config_value = '0'
+ $sql = "UPDATE " . CONFIG_TABLE . "
+ SET config_value = '0'
WHERE config_name = 'board_disable'";
$db->sql_query($sql);
diff --git a/phpBB/admin/admin_smilies.php b/phpBB/admin/admin_smilies.php
index 549bac5831..0c832bb3ea 100644
--- a/phpBB/admin/admin_smilies.php
+++ b/phpBB/admin/admin_smilies.php
@@ -21,7 +21,7 @@
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('general') )
+ if ( !$auth->get_acl_admin('general') )
{
return;
}
@@ -43,7 +43,7 @@ require('pagestart.' . $phpEx);
//
// Do we have general permissions?
//
-if (!$acl->get_acl_admin('general'))
+if (!$auth->get_acl_admin('general'))
{
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;
}
elseif (preg_match('/\.pak$/i', $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
{
@@ -200,7 +200,7 @@ if (isset($HTTP_POST_VARS['import_pak']))
<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>
<th class="thHead" colspan="2"><?php echo $lang['Smilies_import'] ?></th>
</tr>
@@ -220,7 +220,7 @@ if (isset($HTTP_POST_VARS['import_pak']))
</td>
</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>
</table></form>
<?php
@@ -288,7 +288,7 @@ function update_smile_dimensions()
//-->
</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>
<th class="thHead" colspan="2"><?php echo $lang['smile_config'] ?></th>
</tr>
@@ -313,7 +313,7 @@ function update_smile_dimensions()
<td class="row2"><input type="text" name="smile_emotion" /></td>
</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>
</table></form>
<?php
@@ -397,9 +397,9 @@ function update_smile_dimensions()
//-->
</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>
- <th class="thHead" colspan="2"><?php echo $lang['Smile_config'] ?></th>
+ <th class="th" colspan="2"><?php echo $lang['Smile_config'] ?></th>
</tr>
<tr>
<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>
</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>
</table></form>
<?php
@@ -458,7 +458,7 @@ function update_smile_dimensions()
'emoticon' => stripslashes($HTTP_POST_VARS['smile_emotion']),
'smile_on_posting' => (!empty($HTTP_POST_VARS['smile_on_posting'])) ? 1 : 0
);
-
+
$smile_id = $HTTP_POST_VARS['smile_id'];
$smile_order = $HTTP_POST_VARS['smile_order'];
diff --git a/phpBB/admin/admin_styles.php b/phpBB/admin/admin_styles.php
index afe37454c4..1f6a020b58 100644
--- a/phpBB/admin/admin_styles.php
+++ b/phpBB/admin/admin_styles.php
@@ -2,7 +2,7 @@
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('styles') )
+ if ( !$auth->get_acl_admin('styles') )
{
return;
}
@@ -27,7 +27,7 @@ require('pagestart.' . $phpEx);
//
// Do we have styles admin permissions?
//
-if ( !$acl->get_acl_admin('styles') )
+if ( !$auth->get_acl_admin('styles') )
{
message_die(MESSAGE, $lang['No_admin']);
}
@@ -57,8 +57,8 @@ switch ( $mode )
if ( isset($HTTP_POST_VARS['img_root']) )
{
- $sql = "SELECT *
- FROM " . STYLES_IMAGE_TABLE . "
+ $sql = "SELECT *
+ FROM " . STYLES_IMAGE_TABLE . "
WHERE imageset_path LIKE '" . $HTTP_POST_VARS['imgroot'] . "'";
$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');
$sql = "SELECT imageset_name, imageset_path
- FROM " . STYLES_IMAGE_TABLE . "
+ FROM " . STYLES_IMAGE_TABLE . "
ORDER BY imageset_name";
$result = $db->sql_query($sql);
@@ -117,7 +117,7 @@ switch ( $mode )
echo '<tr>';
echo '<th height="25">Image</th><th>Source</th><th>Width</th><th>Height</th><th>Border</th><th>&nbsp;</th>';
echo '</tr>';
-
+
for($i = 0; $i < count($imageset); $i++)
{
$class = ( !($i%2) ) ? 'row1' : 'row2';
@@ -246,8 +246,8 @@ switch ( $mode )
if ( isset($HTTP_POST_VARS['update']) )
{
- $sql = "SELECT theme_id, theme_name
- FROM " . STYLES_CSS_TABLE . "
+ $sql = "SELECT theme_id, theme_name
+ FROM " . STYLES_CSS_TABLE . "
WHERE theme_id = $theme_id";
$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_external = ( !empty($HTTP_POST_VARS['css_data']) ) ? $HTTP_POST_VARS['css_data'] : '';
- $sql = "UPDATE " > STYLES_CSS_TABLE . "
- SET css_data = '$css_data', css_external = '$css_external'
+ $sql = "UPDATE " > STYLES_CSS_TABLE . "
+ SET css_data = '$css_data', css_external = '$css_external'
WHERE theme_id = $theme_id";
$db->sql_query($sql);
@@ -271,7 +271,7 @@ switch ( $mode )
page_header($lang['Edit_theme']);
- $sql = "SELECT theme_id, theme_name
+ $sql = "SELECT theme_id, theme_name
FROM " . STYLES_CSS_TABLE;
$result = $db->sql_query($sql);
@@ -290,7 +290,7 @@ switch ( $mode )
$css_external = '';
if ( $theme_id )
{
- $sql = "SELECT css_data, css_external
+ $sql = "SELECT css_data, css_external
FROM " . STYLES_CSS_TABLE . "
WHERE theme_id = $theme_id";
$result = $db->sql_query($sql);
@@ -343,7 +343,7 @@ function get_templates($tplroot = '')
global $db;
$sql = "SELECT template_name, template_path
- FROM " . STYLES_TPL_TABLE . "
+ FROM " . STYLES_TPL_TABLE . "
ORDER BY template_name";
$result = $db->sql_query($sql);
@@ -353,7 +353,7 @@ function get_templates($tplroot = '')
$selected = ( $tplroot == $row['template_path'] ) ? ' selected="selected"' : '';
$tplroot_options .= '<option value="' . $row['template_path'] . '"' . $selected . '>' . $row['template_path'] . '</option>';
}
-
+
return $tplroot_options;
}
diff --git a/phpBB/admin/admin_users.php b/phpBB/admin/admin_users.php
index 378636dbd9..9776106e86 100644
--- a/phpBB/admin/admin_users.php
+++ b/phpBB/admin/admin_users.php
@@ -21,7 +21,7 @@
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('user') )
+ if ( !$auth->get_acl_admin('user') )
{
return;
}
@@ -46,7 +46,7 @@ require($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
//
// Do we have forum admin permissions?
//
-if ( !$acl->get_acl_admin('user') )
+if ( !$auth->get_acl_admin('user') )
{
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 = ( 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_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_dateformat = stripslashes($user_dateformat);
- if ( !isset($HTTP_POST_VARS['cancelavatar']))
+ if ( !isset($HTTP_POST_VARS['cancelavatar']))
{
$user_avatar = $user_avatar_local;
$user_avatar_type = USER_AVATAR_GALLERY;
@@ -215,7 +215,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
if( $user_status == 0 )
{
// User is (made) inactive. Delete all their sessions.
- $sql = "DELETE FROM " . SESSIONS_TABLE . "
+ $sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_user_id = $user_id";
$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);
if ( strlen($sig_length_check) > $board_config['max_sig_chars'] )
- {
+ {
$error = TRUE;
$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) )
{
- $file_size = $file_data1[1];
+ $file_size = $file_data1[1];
$file_type = $file_data2[1];
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;
}
-
+
//
// Update entry in DB
//
@@ -520,10 +520,10 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
{
if( $HTTP_POST_VARS['deleteuser'] )
{
- $sql = "SELECT g.group_id
- FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
- WHERE ug.user_id = $user_id
- AND g.group_id = ug.group_id
+ $sql = "SELECT g.group_id
+ FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
+ WHERE ug.user_id = $user_id
+ AND g.group_id = ug.group_id
AND g.group_single_user = 1";
$result = $db->sql_query($sql);
@@ -533,12 +533,12 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
$db->sql_transaction();
$sql = "UPDATE " . POSTS_TABLE . "
- SET poster_id = " . ANONYMOUS . ", post_username = '$username'
+ SET poster_id = " . ANONYMOUS . ", post_username = '$username'
WHERE poster_id = $user_id";
$db->sql_query($sql);
$sql = "UPDATE " . TOPICS_TABLE . "
- SET topic_poster = " . ANONYMOUS . "
+ SET topic_poster = " . ANONYMOUS . "
WHERE topic_poster = $user_id";
$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_timezone = $this_userdata['user_timezone'];
$user_dateformat = $this_userdata['user_dateformat'];
-
+
$user_status = $this_userdata['user_active'];
$user_allowavatar = $this_userdata['user_allowavatar'];
$user_allowpm = $this_userdata['user_allow_pm'];
-
+
$COPPA = false;
$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);
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="allowsmilies" value="' . $allowsmilies . '" />';
$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="timezone" value="' . $user_timezone . '" />';
$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(
"L_USER_TITLE" => $lang['User_admin'],
"L_USER_EXPLAIN" => $lang['User_admin_explain'],
- "L_AVATAR_GALLERY" => $lang['Avatar_gallery'],
- "L_SELECT_AVATAR" => $lang['Select_avatar'],
- "L_RETURN_PROFILE" => $lang['Return_profile'],
- "L_CATEGORY" => $lang['Select_category'],
+ "L_AVATAR_GALLERY" => $lang['Avatar_gallery'],
+ "L_SELECT_AVATAR" => $lang['Select_avatar'],
+ "L_RETURN_PROFILE" => $lang['Return_profile'],
+ "L_CATEGORY" => $lang['Select_category'],
"L_GO" => $lang['Go'],
- "S_OPTIONS_CATEGORIES" => $s_categories,
- "S_COLSPAN" => $s_colspan,
- "S_PROFILE_ACTION" => append_sid("admin_users.$phpEx?mode=$mode"),
+ "S_OPTIONS_CATEGORIES" => $s_categories,
+ "S_COLSPAN" => $s_colspan,
+ "S_PROFILE_ACTION" => append_sid("admin_users.$phpEx?mode=$mode"),
"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_id = $row['rank_id'];
-
+
$selected = ( $this_userdata['user_rank'] == $rank_id ) ? ' selected="selected"' : '';
$rank_select_box .= '<option value="' . $rank_id . '"' . $selected . '>' . $rank . '</option>';
}
$signature = preg_replace('/\:[0-9a-z\:]*?\]/si', ']', $signature);
-
+
$template->set_filenames(array(
"body" => "admin/user_edit_body.tpl")
);
-
+
//
// Let's do an overall check for settings/versions which would prevent
// 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_NO' => (!$user_allowavatar) ? '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,
'L_USER_TITLE' => $lang['User_admin'],
'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_CONFIRM_PASSWORD' => $lang['Confirm_password'],
'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_HIDE_USER' => $lang['Hide_user'],
'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
-
+
'L_SPECIAL' => $lang['User_special'],
'L_SPECIAL_EXPLAIN' => $lang['User_specail_explain'],
'L_USER_ACTIVE' => $lang['User_status'],
'L_ALLOW_PM' => $lang['User_allowpm'],
'L_ALLOW_AVATAR' => $lang['User_allowavatar'],
-
+
'L_AVATAR_PANEL' => $lang['Avatar_panel'],
'L_AVATAR_EXPLAIN' => $lang['Admin_avatar_explain'],
'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,
'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,
'L_DELETE_USER' => $lang['User_delete'],
diff --git a/phpBB/admin/admin_viewlogs.php b/phpBB/admin/admin_viewlogs.php
index e09a98030f..acc8844fe3 100644
--- a/phpBB/admin/admin_viewlogs.php
+++ b/phpBB/admin/admin_viewlogs.php
@@ -21,7 +21,7 @@
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('general') )
+ if ( !$auth->get_acl_admin('general') )
{
return;
}
@@ -44,7 +44,7 @@ require('pagestart.' . $phpEx);
//
// Do we have styles admin permissions?
//
-if ( !$acl->get_acl_admin('general') )
+if ( !$auth->get_acl_admin('general') )
{
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
//
-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 = '';
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)";
}
- $sql = "DELETE FROM $table_sql
+ $sql = "DELETE FROM $table_sql
$where_sql";
$db->sql_query($sql);
@@ -148,7 +148,7 @@ $forum_options = '';
if ( $mode == 'mod' )
{
$sql = "SELECT forum_id, forum_name
- FROM " . FORUMS_TABLE . "
+ FROM " . FORUMS_TABLE . "
ORDER BY cat_id, forum_order";
$result = $db->sql_query($sql);
@@ -203,7 +203,7 @@ if ( $mode == 'mod' )
<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>
</tr>
- <tr>
+ <tr>
<th width="15%" height="25" nowrap="nowrap"><?php echo $lang['Username']; ?></th>
<th width="15%" nowrap="nowrap"><?php echo $lang['IP']; ?></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++)
{
$row_class = ( $row_class == 'row1' ) ? 'row2' : 'row1';
-
+
?>
<tr>
<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 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="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
}
diff --git a/phpBB/admin/admin_words.php b/phpBB/admin/admin_words.php
index 384c83fd3c..ec152d47d7 100644
--- a/phpBB/admin/admin_words.php
+++ b/phpBB/admin/admin_words.php
@@ -21,7 +21,7 @@
if ( !empty($setmodules) )
{
- if ( !$acl->get_acl_admin('general') )
+ if ( !$auth->get_acl_admin('general') )
{
return;
}
@@ -42,7 +42,7 @@ require('pagestart.' . $phpEx);
//
// Do we have forum admin permissions?
//
-if ( !$acl->get_acl_admin('general') )
+if ( !$auth->get_acl_admin('general') )
{
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'];
}
-else
+else
{
//
// These could be entered via a form button
@@ -89,8 +89,8 @@ if( $mode != '' )
message_die(MESSAGE, $lang['No_word_selected']);
}
- $sql = "SELECT *
- FROM " . WORDS_TABLE . "
+ $sql = "SELECT *
+ FROM " . WORDS_TABLE . "
WHERE word_id = $word_id";
$result = $db->sql_query($sql);
@@ -158,7 +158,7 @@ if( $mode != '' )
message_die(MESSAGE, $lang['Must_specify_word']);
}
- $sql = "DELETE FROM " . WORDS_TABLE . "
+ $sql = "DELETE FROM " . WORDS_TABLE . "
WHERE word_id = $word_id";
$db->sql_query($sql);
@@ -189,8 +189,8 @@ else
<?php
- $sql = "SELECT *
- FROM " . WORDS_TABLE . "
+ $sql = "SELECT *
+ FROM " . WORDS_TABLE . "
ORDER BY word";
$result = $db->sql_query($sql);
diff --git a/phpBB/admin/index.php b/phpBB/admin/index.php
index 6a6651df6f..115b1199e4 100644
--- a/phpBB/admin/index.php
+++ b/phpBB/admin/index.php
@@ -37,7 +37,7 @@ require('pagestart.' . $phpEx);
//
// Do we have any admin permissions at all?
//
-if ( !$acl->get_acl_admin() )
+if ( !$auth->get_acl_admin() )
{
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);
?>
- <tr>
+ <tr>
<th class="menu" height="25">&#0187; <?php echo $cat; ?></th>
</tr>
<?php
@ksort($action_ary);
- foreach ( $action_ary as $action => $file )
+ foreach ( $action_ary as $action => $file )
{
$action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace('/_/', ' ', $action);
$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>
</tr>
<?php
@@ -167,13 +167,13 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
if ( isset($HTTP_POST_VARS['delete']) )
{
- $sql = "UPDATE " . CONFIG_TABLE . "
- SET config_value = config_value - " . sizeof($HTTP_POST_VARS['mark']) . "
+ $sql = "UPDATE " . CONFIG_TABLE . "
+ SET config_value = config_value - " . sizeof($HTTP_POST_VARS['mark']) . "
WHERE config_name = 'num_users'";
$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']));
}
}
@@ -264,7 +264,7 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
if ( preg_match('/^mysql/', SQL_LAYER) )
{
$result = $db->sql_query('SELECT VERSION() AS mysql_version');
-
+
if ( $row = $db->sql_fetchrow($result) )
{
$version = $row['mysql_version'];
@@ -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;
- $sql = "SHOW TABLE STATUS
+ $sql = "SHOW TABLE STATUS
FROM " . $db_name;
$result = $db->sql_query($sql);
-
+
$dbsize = 0;
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) )
{
- $sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
- FROM sysfiles";
+ $sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
+ FROM sysfiles";
$result = $db->sql_query($sql);
-
+
$dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available'];
}
else
@@ -347,37 +347,37 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
<h1><?php echo $lang['Forum_stats']; ?></h1>
<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%"><?php echo $lang['Value']; ?></th>
<th width="25%" nowrap="nowrap"><?php echo $lang['Statistic']; ?></th>
<th width="25%"><?php echo $lang['Value']; ?></th>
</tr>
- <tr>
+ <tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Number_posts']; ?>:</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="row2"><b><?php echo $posts_per_day; ?></b></td>
</tr>
- <tr>
+ <tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Number_topics']; ?>:</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="row2"><b><?php echo $topics_per_day; ?></b></td>
</tr>
- <tr>
+ <tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Number_users']; ?>:</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="row2"><b><?php echo $users_per_day; ?></b></td>
</tr>
- <tr>
+ <tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Board_started']; ?>:</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="row2"><b><?php echo $avatar_dir_size; ?></b></td>
</tr>
- <tr>
+ <tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Database_size']; ?>:</td>
<td class="row2"><b><?php echo $dbsize; ?></b></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>
<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%"><?php echo $lang['IP']; ?></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++)
{
$row_class = ( $row_class == 'row1' ) ? 'row2' : 'row1';
-
+
?>
<tr>
<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>
<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%"><?php echo $lang['Joined']; ?></th>
<th width="5%" nowrap="nowrap"><?php echo $lang['Mark']; ?></th>
</tr>
<?php
- $sql = "SELECT user_id, username, user_regdate
- FROM " . USERS_TABLE . "
- WHERE user_active = 0
- AND user_id <> " . ANONYMOUS . "
+ $sql = "SELECT user_id, username, user_regdate
+ FROM " . USERS_TABLE . "
+ WHERE user_active = 0
+ AND user_id <> " . ANONYMOUS . "
ORDER BY user_regdate ASC";
$result = $db->sql_query($sql);
@@ -479,7 +479,7 @@ elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
</table>
<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>
</tr>
</table></form>
@@ -506,7 +506,7 @@ else
<frameset rows="60, *" border="0" framespacing="0" frameborder="NO">
<frame src="<?php echo "index.$phpEx$SID&amp;pane=top"; ?>" name="title" noresize marginwidth="0" marginheight="0" scrolling="NO">
- <frameset cols="155,*" rows="*" border="2" framespacing="0" frameborder="yes">
+ <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=right"; ?>" name="main" marginwidth="0" marginheight="0" scrolling="auto">
</frameset>
diff --git a/phpBB/admin/pagestart.php b/phpBB/admin/pagestart.php
index 4a02f21154..f1a844a962 100644
--- a/phpBB/admin/pagestart.php
+++ b/phpBB/admin/pagestart.php
@@ -31,7 +31,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management
//
$userdata = $session->start($update);
-$acl = new acl($userdata);
+$auth->acl($userdata);
//
// End session management
//
diff --git a/phpBB/common.php b/phpBB/common.php
index 3d7a1c7734..ccc468c451 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -25,7 +25,7 @@ if ( !defined('IN_PHPBB') )
}
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);
@@ -35,9 +35,9 @@ if ( !defined('PHPBB_INSTALLED') )
exit;
}
-//
+//set_error_handler('message');
+
// Define some constants/variables
-//
define('ANONYMOUS', 0);
// User related
@@ -122,6 +122,7 @@ define('VOTE_DESC_TABLE', $table_prefix.'vote_desc');
define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results');
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
+// If magic quotes is off, addslashes
if ( !get_magic_quotes_gpc() )
{
$HTTP_GET_VARS = slash_input_data($HTTP_GET_VARS);
@@ -135,25 +136,23 @@ $theme = array();
$images = array();
$lang = array();
-//
// Include files
-//
require($phpbb_root_path . 'includes/template.'.$phpEx);
require($phpbb_root_path . 'includes/session.'.$phpEx);
require($phpbb_root_path . 'includes/functions.'.$phpEx);
require($phpbb_root_path . 'db/' . $dbms . '.'.$phpEx);
+// Instantiate some basic classes
$session = new session();
+$auth = new auth();
$template = new Template();
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
-//
-// Obtain users IP, not encoded in 2.2
-//
-if ( $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] != '' || $HTTP_ENV_VARS['HTTP_X_FORWARDED_FOR'] != '' )
+// Obtain users IP
+if ( $_SERVER['HTTP_X_FORWARDED_FOR'] != '' || $_ENV['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 );
- $x_ip = ( !empty($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']) ) ? $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] : $HTTP_ENV_VARS['HTTP_X_FORWARDED_FOR'];
+ $user_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );
+ $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) )
{
@@ -163,35 +162,29 @@ if ( $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] != '' || $HTTP_ENV_VARS['HTTP_X_F
}
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
// basic forum information is not available
-//
$sql = "SELECT *
FROM " . CONFIG_TABLE;
-$result = $db->sql_query($sql);
+$result = $db->sql_query($sql, false);
while ( $row = $db->sql_fetchrow($result) )
{
$board_config[$row['config_name']] = $row['config_value'];
}
-//
-// Show 'Board is disabled' message if needed.
-//
+// Show 'Board is disabled' message
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_die(MESSAGE, $message, 'Information');
+ //trigger_error($message);
}
-//
-// 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.
-//
+// addslashes to vars if magic_quotes_gpc is off
function slash_input_data(&$data)
{
if ( is_array($data) )
diff --git a/phpBB/faq.php b/phpBB/faq.php
index c34d71fdc3..e326fb0833 100644
--- a/phpBB/faq.php
+++ b/phpBB/faq.php
@@ -28,7 +28,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management
//
$userdata = $session->start();
-$acl = new acl($userdata);
+$auth->acl($userdata);
//
// End session management
//
diff --git a/phpBB/groupcp.php b/phpBB/groupcp.php
index 8df2172db3..38c0193c66 100644
--- a/phpBB/groupcp.php
+++ b/phpBB/groupcp.php
@@ -112,7 +112,7 @@ function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$
// Start session management
//
$userdata = $session->start();
-$acl = new acl($userdata);
+$auth->acl($userdata);
//
// End session management
//
diff --git a/phpBB/imagesets/subSilver/en/icon_aim.gif b/phpBB/imagesets/subSilver/en/icon_aim.gif
new file mode 100644
index 0000000000..4b6a858c34
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_aim.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/icon_edit.gif b/phpBB/imagesets/subSilver/en/icon_edit.gif
new file mode 100644
index 0000000000..bb70004b93
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_edit.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/icon_email.gif b/phpBB/imagesets/subSilver/en/icon_email.gif
new file mode 100644
index 0000000000..3d359c2a24
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_email.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/icon_icq_add.gif b/phpBB/imagesets/subSilver/en/icon_icq_add.gif
new file mode 100644
index 0000000000..4bf276df58
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_icq_add.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/icon_ip.gif b/phpBB/imagesets/subSilver/en/icon_ip.gif
new file mode 100644
index 0000000000..bf17a5141f
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_ip.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/icon_msnm.gif b/phpBB/imagesets/subSilver/en/icon_msnm.gif
new file mode 100644
index 0000000000..651841555b
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_msnm.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/icon_pm.gif b/phpBB/imagesets/subSilver/en/icon_pm.gif
new file mode 100644
index 0000000000..f87b4f57fd
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_pm.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/icon_profile.gif b/phpBB/imagesets/subSilver/en/icon_profile.gif
new file mode 100644
index 0000000000..2bd32d2d73
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_profile.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/icon_quote.gif b/phpBB/imagesets/subSilver/en/icon_quote.gif
new file mode 100644
index 0000000000..3dec6756b3
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_quote.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/icon_search.gif b/phpBB/imagesets/subSilver/en/icon_search.gif
new file mode 100644
index 0000000000..8dd38a3666
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_search.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/icon_www.gif b/phpBB/imagesets/subSilver/en/icon_www.gif
new file mode 100644
index 0000000000..8c1731f3a7
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_www.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/icon_yim.gif b/phpBB/imagesets/subSilver/en/icon_yim.gif
new file mode 100644
index 0000000000..57e75b3b5a
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/icon_yim.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/msg_newpost.gif b/phpBB/imagesets/subSilver/en/msg_newpost.gif
new file mode 100644
index 0000000000..ce2c1a87fd
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/msg_newpost.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/post.gif b/phpBB/imagesets/subSilver/en/post.gif
new file mode 100644
index 0000000000..4b7cb20642
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/post.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/reply-locked.gif b/phpBB/imagesets/subSilver/en/reply-locked.gif
new file mode 100644
index 0000000000..5ab1d7a1b1
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/reply-locked.gif
Binary files differ
diff --git a/phpBB/imagesets/subSilver/en/reply.gif b/phpBB/imagesets/subSilver/en/reply.gif
new file mode 100644
index 0000000000..cb385af629
--- /dev/null
+++ b/phpBB/imagesets/subSilver/en/reply.gif
Binary files differ
diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php
index c897f90cf0..d715dc837e 100644
--- a/phpBB/includes/auth/auth_ldap.php
+++ b/phpBB/includes/auth/auth_ldap.php
@@ -2,7 +2,7 @@
//
// Authentication plug-ins is largely down to
-// Sergey Kanareykin, our thanks to him.
+// Sergey Kanareykin, our thanks to him.
//
function login_ldap(&$username, &$password)
{
@@ -13,7 +13,7 @@ function login_ldap(&$username, &$password)
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';
}
@@ -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']));
$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);
- $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 . "
WHERE username = '" . str_replace("\'", "''", $username) . "'";
$result = $db->sql_query($sql);
return ( $row = $db->sql_fetchrow($result) ) ? $row : false;
}
- }
-
+ }
+
@ldap_close($ldap);
-
+
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)
{
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>
</tr>
<?php
-
+
//
// 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)
+{
+
+}
+
?> \ No newline at end of file
diff --git a/phpBB/includes/emailer.php b/phpBB/includes/emailer.php
index c52b2df0dc..cabe89b944 100755
--- a/phpBB/includes/emailer.php
+++ b/phpBB/includes/emailer.php
@@ -88,7 +88,7 @@ class emailer
$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) )
{
message_die(ERROR, 'Could not find email template file ' . $template_file);
@@ -177,7 +177,7 @@ class emailer
// 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";
- $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);
@@ -295,24 +295,24 @@ class emailer
//
// This function has been modified as provided
-// by SirSir to allow multiline responses when
+// by SirSir to allow multiline responses when
// using SMTP Extensions
//
-function server_parse($socket, $response)
-{
- while ( substr($server_response,3,1) != ' ' )
- {
- if( !( $server_response = fgets($socket, 256) ) )
- {
- message_die(ERROR, 'Could not get mail server response codes');
- }
- }
-
- if( !( substr($server_response, 0, 3) == $response ) )
- {
- message_die(ERROR, "Ran into problems sending Mail. Response: $server_response");
- }
-}
+function server_parse($socket, $response)
+{
+ while ( substr($server_response,3,1) != ' ' )
+ {
+ if( !( $server_response = fgets($socket, 256) ) )
+ {
+ message_die(ERROR, 'Could not get mail server response codes');
+ }
+ }
+
+ if( !( substr($server_response, 0, 3) == $response ) )
+ {
+ message_die(ERROR, "Ran into problems sending Mail. Response: $server_response");
+ }
+}
/****************************************************************************
* Function: smtpmail
@@ -403,25 +403,25 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
server_parse($socket, "220");
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
// both SMTP AND ESMTP capable servers
- fputs($socket, "EHLO " . $board_config['smtp_host'] . "\r\n");
- server_parse($socket, "250");
-
- fputs($socket, "AUTH LOGIN\r\n");
- server_parse($socket, "334");
- fputs($socket, base64_encode($board_config['smtp_username']) . "\r\n");
- server_parse($socket, "334");
- fputs($socket, base64_encode($board_config['smtp_password']) . "\r\n");
- server_parse($socket, "235");
- }
- else
- {
- // Send the RFC821 specified HELO.
- fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n");
- server_parse($socket, "250");
+ fputs($socket, "EHLO " . $board_config['smtp_host'] . "\r\n");
+ server_parse($socket, "250");
+
+ fputs($socket, "AUTH LOGIN\r\n");
+ server_parse($socket, "334");
+ fputs($socket, base64_encode($board_config['smtp_username']) . "\r\n");
+ server_parse($socket, "334");
+ fputs($socket, base64_encode($board_config['smtp_password']) . "\r\n");
+ server_parse($socket, "235");
+ }
+ else
+ {
+ // Send the RFC821 specified HELO.
+ fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n");
+ server_parse($socket, "250");
}
// From this point onward most server response codes should be 250
diff --git a/phpBB/includes/forums_display.php b/phpBB/includes/forums_display.php
index b6fa96a073..8120576aea 100644
--- a/phpBB/includes/forums_display.php
+++ b/phpBB/includes/forums_display.php
@@ -44,8 +44,8 @@ foreach ($forum_rows as $row)
));
unset($stored_cat);
}
-
- if ($acl->get_acl($forum_id, 'forum', 'list'))
+
+ if ($auth->get_acl($forum_id, 'forum', 'list'))
{
switch ($forum_status)
{
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 9b3d079e31..7ba27c61c2 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -165,15 +165,15 @@ function get_moderators(&$forum_moderators, $forum_id = false)
//
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 .= ( ( $acl->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 .= ( ( $acl->get_acl($forum_id, 'forum', 'delete') || $acl->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', 'post') ) ? $lang['Rules_post_can'] : $lang['Rules_post_cannot'] ) . '<br />';
+ $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'reply') ) ? $lang['Rules_reply_can'] : $lang['Rules_reply_cannot'] ) . '<br />';
+ $rules .= ( ( $auth->get_acl($forum_id, 'forum', 'edit') ) ? $lang['Rules_edit_can'] : $lang['Rules_edit_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 .= ( ( $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>');
}
@@ -183,7 +183,7 @@ function get_forum_rules($mode, &$rules, &$forum_id)
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
// 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 ( $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"' : '';
$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;
- $page_string = '';
- if ( $total_pages > 10 )
+ $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 > 5 )
{
- $init_page_max = ( $total_pages > 3 ) ? 3 : $total_pages;
+ $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 = 1; $i < $init_page_max + 1; $i++)
+ 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>';
- if ( $i < $init_page_max )
+ if ( $i < $end_cnt - 1 )
{
- $page_string .= ", ";
+ $page_string .= ', ';
}
}
- if ( $total_pages > 3 )
- {
- 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 .= ", ";
- }
- }
- }
+ $page_string .= ( $end_cnt < $total_pages ) ? ' ... ' : ', ';
}
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>';
- if ( $i < $total_pages )
+ if ( $i < $total_pages )
{
$page_string .= ', ';
}
}
}
- if ( $add_prevnext_text )
- {
- 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 .= ( $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>';
$page_string = $lang['Goto_page'] . ' ' . $page_string;
@@ -640,9 +601,10 @@ function obtain_word_list(&$orig_word, &$replacement_word)
// failures, etc.
// -> ERROR : Use for any error, a simple page will be output
//
+// $errno, $errstr, $errfile, $errline
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;
switch ( $msg_code )
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index bae5a9674c..fcbb40894d 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -19,6 +19,539 @@
*
***************************************************************************/
+// Main message parser for posting, pm, etc. takes raw message
+// and parses it for attachments, html, bbcode and smilies
+class parse_message
+{
+ var $bbcode_tpl = null;
+
+ function parse(&$message, $html, $bbcode, $uid, $url, $smilies)
+ {
+ global $board_config, $db, $lang;
+
+ $warn_msg = '';
+
+ // Do some general 'cleanup' first before processing message,
+ // e.g. remove excessive newlines(?), smilies(?)
+ $match = array();
+ $replace = array();
+
+ $match[] = '#sid=[a-z0-9]+&?#';
+ $replace[] = '';
+ $match[] = "#([\r\n][\s]+){3,}#";
+ $replace[] = "\n\n";
+
+ $message = preg_replace($match, $replace, $message);
+
+ // Message length check
+ if ( !strlen($message) || ( $board_config['max_post_chars'] && strlen($message) > $board_config['max_post_chars'] ) )
+ {
+ $warn_msg .= ( !strlen($message) ) ? $lang['Too_few_chars'] . '<br />' : $lang['Too_many_chars'] . '<br />';
+ }
+
+ // Smiley check
+ if ( $board_config['max_post_smilies'] && $smilies )
+ {
+ $sql = "SELECT code
+ FROM " . SMILIES_TABLE;
+ $result = $db->sql_query($sql);
+
+ $match = 0;
+ while ( $row = $db->sql_fetchrow($result))
+ {
+ if ( preg_match_all('#('. preg_quote($row['code'], '#') . ')#', $message, $matches) )
+ {
+ $match++;
+ }
+
+ if ( $match > $board_config['max_post_smilies'] )
+ {
+ $warn_msg .= $lang['Too_many_smilies'] . '<br />';
+ break;
+ }
+ }
+ $db->sql_freeresult($result);
+ unset($matches);
+ }
+
+ // Specialchars message here ... ?
+ $message = htmlspecialchars($message, ENT_COMPAT, $lang['ENCODING']);
+
+ if ( $warn_msg )
+ {
+// return $warn_msg;
+ }
+
+ $warn_msg .= $this->html($message, $html);
+ $warn_msg .= $this->bbcode($message, $bbcode, $uid);
+ $warn_msg .= $this->magic_url($message, $url);
+ $warn_msg .= $this->attach($_FILE);
+
+ return $warn_msg;
+ }
+
+ function html(&$message, $html)
+ {
+ global $board_config, $lang;
+
+ if ( $html )
+ {
+ // If $html is true then "allowed_tags" are converted back from entity
+ // form, others remain
+ $allowed_tags = split(',', str_replace(' ', '', $board_config['allow_html_tags']));
+
+ $match = array();
+ $replace = array();
+
+ foreach ( $allowed_tags as $tag )
+ {
+ $match[] = '#&lt;(\/?' . str_replace('*', '.*?', $tag) . ')&gt;#i';
+ $replace[] = '<\1>';
+ }
+
+ $message = preg_replace($match, $replace, $message);
+ }
+
+ return;
+ }
+
+ function bbcode(&$message, $bbcode, $uid)
+ {
+ global $board_config;
+
+ }
+
+ // Replace magic urls of form http://xxx.xxx., www.xxx. and xxx@xxx.xxx.
+ // Cuts down displayed size of link if over 50 chars, turns absolute links
+ // into relative versions when the server/script path matches the link
+ function magic_url(&$message, $url)
+ {
+ global $board_config;
+
+ if ( $url )
+ {
+ $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
+ $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
+
+ $match = array();
+ $replace = array();
+
+ // relative urls for this board
+ $match[] = '#' . $server_protocol . trim($board_config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '\1', trim($board_config['script_path'])) . '/([^\t <\n\r\"]+)#i';
+ $replace[] = '<a href="\1" target="_blank">\1</a>';
+
+ // matches a xxxx://aaaaa.bbb.cccc. ...
+ $match[] = '#([\n ])([\w]+?://.*?)([\t\n\r <"\'])#ie';
+ $replace[] = "'\\1<!-- m --><a href=\"\\2\" target=\"_blank\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- m -->\\3'";
+
+ // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
+ $match[] = '#(^|[\n ])(www\.[\w\-]+\.[\w\-.\~]+(?:/[^\t <\n\r\"]*)?)#ie';
+ $replace[] = "'\\1<!-- m --><a href=\"http://\\2\" target=\"_blank\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- m -->'";
+
+ // matches an email@domain type address at the start of a line, or after a space.
+ $match[] = '#(^|[\n ])([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)#ie';
+ $replace[] = "'\\1<!-- m --><a href=\"mailto:\\2\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- m -->'";
+
+ $message = preg_replace($match, $replace, $message);
+ }
+ }
+
+ // Based off of Acyd Burns Mod
+ function attach($file_ary)
+ {
+ global $board_config;
+
+ $allowed_ext = explode(',', $board_config['attach_ext']);
+ }
+}
+
+// Will parse poll info ... probably
+class parse_poll extends parse_message
+{
+ function parse_poll()
+ {
+ global $board_config;
+
+ }
+}
+
+// Parses a given message and updates/maintains
+// the fulltext word indexes NOTE this is not complete
+// nor 'entirely' (!) functional ...
+class fulltext_search
+{
+ function split_words(&$text)
+ {
+ global $phpbb_root_path, $board_config;
+
+ static $drop_char_match = array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!', '*');
+ static $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' , ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+ $stopwords_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_stopwords.txt');
+ $synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt');
+
+ $match = array();
+ // New lines, carriage returns
+ $match[] = "#[\n\r]+#";
+ // HTML and NCRs like &nbsp; etc.
+ $match[] = '#<(.*?)>.*?<\/\1>#'; // BAD!
+ $match[] = '#\b&\#?[a-z0-9]+;\b#';
+ // URL's
+ $match[] = '#\b[\w]+:\/\/[a-z0-9\.\-]+(\/[a-z0-9\?\.%_\-\+=&\/]+)?#';
+ // BBcode
+ $match[] = '#\[img:[a-z0-9]{10,}\].*?\[\/img:[a-z0-9]{10,}\]#';
+ $match[] = '#\[\/?url(=.*?)?\]#';
+ $match[] = '#\[\/?[a-z\*=\+\-]+(\:?[0-9a-z]+)?:[a-z0-9]{10,}(\:[a-z0-9]+)?=?.*?\]#';
+ // Sequences < min_search_chars & < max_search_chars
+ $match[] = '#\b([a-z0-9]{1,' . $board_config['min_search_chars'] . '}|[a-z0-9]{' . $board_config['max_search_chars'] . ',})\b#';
+
+ $text = preg_replace($match, ' ', ' ' . strtolower($text) . ' ');
+
+ // Filter out non-alphabetical chars
+ for($i = 0; $i < count($drop_char_match); $i++)
+ {
+ $text = str_replace($drop_char_match[$i], $drop_char_replace[$i], $text);
+ }
+
+ if ( !empty($stopword_list) )
+ {
+ $text = str_replace($stopword_list, '', $text);
+ }
+
+ if ( !empty($synonym_list) )
+ {
+ for ($j = 0; $j < count($synonym_list); $j++)
+ {
+ list($replace_synonym, $match_synonym) = split(' ', trim(strtolower($synonym_list[$j])));
+ if ( $mode == 'post' || ( $match_synonym != 'not' && $match_synonym != 'and' && $match_synonym != 'or' ) )
+ {
+ $text = preg_replace('#\b' . trim($match_synonym) . '\b#', ' ' . trim($replace_synonym) . ' ', $text);
+ }
+ }
+ }
+
+ echo "<br /><br />\n\n";
+ echo "cleaned_text => " . htmlentities($text);
+ echo "<br /><br />\n\n";
+ preg_match_all('/\b([\w]+)\b/', $text, $split_entries);
+
+ return array_unique($split_entries[1]);
+ }
+
+ function add(&$post_id, &$new_msg, &$new_title, $old_msg = '', $old_title = '')
+ {
+ global $board_config, $db;
+
+ $mtime = explode(' ', microtime());
+ $starttime = $mtime[1] + $mtime[0];
+
+ //
+ // Split old and new post/subject to obtain array of 'words'
+ //
+ $split_text_new = $this->split_words($new_msg);
+ $split_text_old = $this->split_words(addslashes($old_msg));
+ $split_title_new = ( $new_title ) ? $this->split_words($new_title) : array();
+ $split_title_old = ( $old_title ) ? $this->split_words(addslashes($old_title)) : array();
+
+ //
+ // Define new words to be added and old words to be removed
+ //
+ $words = array();
+ $words['add']['text'] = array_diff($split_text_new, $split_text_old);
+ $words['del']['text'] = array_diff($split_text_old, $split_text_new);
+ $words['add']['title'] = array_diff($split_title_new, $split_title_old);
+ $words['del']['title'] = array_diff($split_title_old, $split_title_new);
+
+ //
+ // Get unique words from the above arrays
+ //
+ $unique_add_words = array_unique(array_merge($words['add']['text'], $words['add']['title']));
+
+ //
+ // We now have unique arrays of all words to be added and removed and
+ // individual arrays of added and removed words for text and title. What
+ // we need to do now is add the new words (if they don't already exist)
+ // and then add (or remove) matches between the words and this post
+ //
+ if ( sizeof($unique_add_words) )
+ {
+ $word_id = array();
+ $new_word = array();
+
+ $sql = "SELECT word_id, word_text
+ FROM " . SEARCH_WORD_TABLE . "
+ WHERE word_text IN (" . implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $unique_words)) . ")";
+ $result = $db->sql_query($sql);
+
+ while ( $row = $db->sql_fetchrow($result) )
+ {
+ $word_id[$row['word_text']] = $row['word_id'];
+ }
+ $db->sql_freeresult($result);
+
+ foreach ( $unique_words as $word )
+ {
+ if ( empty($word_id[$word]) )
+ {
+ $new_words[] = $row['word_text'];
+ }
+ }
+ unset($unique_words);
+
+ switch( SQL_LAYER )
+ {
+ case 'postgresql':
+ case 'msaccess':
+ case 'mssql-odbc':
+ case 'oracle':
+ case 'db2':
+ foreach ( $new_words as $word )
+ {
+ $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
+ VALUES ('" . $word . "')";
+ $db->sql_query($sql);
+ }
+
+ break;
+
+ default:
+ switch( SQL_LAYER )
+ {
+ case 'mysql':
+ case 'mysql4':
+ $value_sql = implode(', ', preg_replace('#^(.*)$#', '(\'\1\')', $new_words));
+ break;
+
+ case mssql:
+ $value_sql = implode(' UNION ALL ', preg_replace('#^(.*)$#', 'SELECT \'\1\'', $new_words));
+ break;
+
+ }
+
+ if ( $value_sql )
+ {
+ $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
+ VALUES $value_sql";
+ $db->sql_query($sql);
+ }
+ }
+ }
+
+ $unique_words = array_unique(array_merge($words['del']['text'], $words['del']['title']));
+
+ $word_id = array();
+ if ( count($unique_words) )
+ {
+ $sql = "SELECT word_id, word_text
+ FROM " . SEARCH_WORD_TABLE . "
+ WHERE word_text IN (" . implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $unique_words)) . ")";
+ $result = $db->sql_query($sql);
+
+ while ( $row = $db->sql_fetchrow($result) )
+ {
+ if ( !empty($words['del']['title']) )
+ {
+ $words['del']['title'][] = $row['word_id'];
+ }
+
+ if ( !empty($words['del']['text']) )
+ {
+ $words['del']['text'][] = $row['word_id'];
+ }
+ }
+ $db->sql_freeresult($result);
+
+ unset($unique_words);
+ }
+
+ foreach ( $words as $sql_type => $word_in_ary )
+ {
+ foreach ( $word_in_ary as $word_in => $word_ary )
+ {
+ $word_sql = ( $sql_type == 'add' ) ? implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $word_ary)) : implode(', ', $word_id);
+ $title_match = ( $word_in == 'title' ) ? 1 : 0;
+
+ if ( $word_sql != '' )
+ {
+ echo "<br />" . $sql = ( $sql_type == 'add' ) ? "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) SELECT $post_id, word_id, $title_match FROM " . SEARCH_WORD_TABLE . " WHERE word_text IN ($word_sql)" : "DELETE FROM " . SEARCH_MATCH_TABLE . " WHERE post_id = $post_id AND title_match = $title_match AND word_id IN ($word_sql)";
+ $db->sql_query($sql);
+ }
+ }
+ }
+
+ unset($words);
+ unset($word_in_ary);
+
+ $mtime = explode(' ', microtime());
+ echo "<br /><br />";
+ echo $mtime[1] + $mtime[0] - $starttime;
+ echo "<br /><br />";
+ print_r($new_words);
+ echo "<br /><br />";
+ print_r($del_words);
+ echo "<br /><br />";
+
+ // Run the cleanup infrequently, once per session cleanup
+ if ( $board_config['session_last_gc'] < time - ( $board_config['session_gc'] / 2 ) )
+ {
+ $this->search_tidy();
+ }
+ }
+
+ //
+ // Tidy up indexes, tag 'common words', remove
+ // words no longer referenced in the match table, etc.
+ //
+ function search_tidy()
+ {
+ global $db;
+
+ // Remove common (> 60% of posts ) words
+ $result = $db->sql_query("SELECT SUM(forum_posts) AS total_posts FROM " . FORUMS_TABLE);
+
+ $row = $db->sql_fetchrow($result);
+
+ if ( $row['total_posts'] >= 100 )
+ {
+ $sql = "SELECT word_id
+ FROM " . SEARCH_MATCH_TABLE . "
+ GROUP BY word_id
+ HAVING COUNT(word_id) > " . floor($row['total_posts'] * 0.6);
+ $result = $db->sql_query($sql);
+
+ $in_sql = '';
+ while ( $row = $db->sql_fetchrow($result) )
+ {
+ $in_sql .= ( ( $in_sql != '' ) ? ', ' : '' ) . $row['word_id'];
+ }
+ $db->sql_freeresult($result);
+
+ if ( $in_sql )
+ {
+ $sql = "UPDATE " . SEARCH_WORD_TABLE . "
+ SET word_common = " . TRUE . "
+ WHERE word_id IN ($in_sql)";
+ $db->sql_query($sql);
+
+ $sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
+ WHERE word_id IN ($in_sql)";
+ $db->sql_query($sql);
+ }
+ }
+
+ // Remove words with no matches ... this is a potentially nasty query
+ $sql = "SELECT w.word_id
+ FROM ( " . SEARCH_WORD_TABLE . " w
+ LEFT JOIN " . SEARCH_MATCH_TABLE . " m ON w.word_id = m.word_id
+ AND m.word_id IS NULL
+ GROUP BY m.word_id";
+ $result = $db->sql_query($sql);
+
+ if ( $row = $db->sql_fetchrow($result) )
+ {
+ $in_sql = '';
+ while ( $row = $db->sql_fetchrow($result) )
+ {
+ $in_sql .= ( ( $in_sql != '' ) ? ', ' : '' ) . $row['word_id'];
+ }
+ $db->sql_freeresult($result);
+
+ if ( $in_sql )
+ {
+ $sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
+ WHERE word_id IN ($in_sql)";
+ $db->sql_query($sql);
+ }
+ }
+ }
+}
+
+//
+// Fill smiley templates (or just the variables) with smileys
+// Either in a window or inline
+//
+function generate_smilies($mode)
+{
+ global $SID, $auth, $db, $session, $board_config, $template, $theme, $lang;
+ global $user_ip, $starttime;
+ global $phpEx, $phpbb_root_path;
+ global $userdata;
+
+ if ( $mode == 'window' )
+ {
+ $page_title = $lang['Review_topic'] . " - $topic_title";
+ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+
+ $template->set_filenames(array(
+ 'smiliesbody' => 'posting_smilies.html')
+ );
+ }
+
+ $where_sql = ( $mode == 'inline' ) ? 'WHERE smile_on_posting = 1 ' : '';
+ $sql = "SELECT emoticon, code, smile_url, smile_width, smile_height
+ FROM " . SMILIES_TABLE . "
+ $where_sql
+ ORDER BY smile_order, smile_width, smile_height, smilies_id";
+ $result = $db->sql_query($sql);
+
+ $num_smilies = 0;
+ $smile_array = array();
+ if ( $row = $db->sql_fetchrow($result) )
+ {
+ do
+ {
+ if ( !in_array($row['smile_url'], $smile_array) )
+ {
+ if ( $mode == 'window' || ( $mode == 'inline' && $num_smilies < 20 ) )
+ {
+ $template->assign_block_vars('emoticon', array(
+ 'SMILEY_CODE' => $row['code'],
+ 'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $row['smile_url'],
+ 'SMILEY_WIDTH' => $row['smile_width'],
+ 'SMILEY_HEIGHT' => $row['smile_height'],
+ 'SMILEY_DESC' => $row['emoticon'])
+ );
+ }
+
+ $smile_array[] = $row['smile_url'];
+ $num_smilies++;
+ }
+ }
+ while ( ( $row = $db->sql_fetchrow($result) ) );
+
+ $db->sql_freeresult($result);
+
+ if ( $mode == 'inline' && $num_smilies >= 20 )
+ {
+ $template->assign_vars(array(
+ 'S_SHOW_EMOTICON_LINK' => true,
+ 'L_MORE_SMILIES' => $lang['More_emoticons'],
+ 'U_MORE_SMILIES' => "posting.$phpEx$SID&amp;mode=smilies")
+ );
+ }
+
+ $template->assign_vars(array(
+ 'L_EMOTICONS' => $lang['Emoticons'],
+ 'L_CLOSE_WINDOW' => $lang['Close_window'],
+ 'S_SMILIES_COLSPAN' => $s_colspan)
+ );
+ }
+
+ if ( $mode == 'window' )
+ {
+ $template->display('smiliesbody');
+
+ include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
+ }
+}
+//
+// END NEW CODE
+// ---------------------------------------------
+
+// ---------------------------------------------
+// OLD CODE FROM 2.0.x
+//
+define('BBCODE_UID_LEN', 10);
+
$html_entities_match = array('#&#', '#<#', '#>#');
$html_entities_replace = array('&amp;', '&lt;', '&gt;');
@@ -42,13 +575,17 @@ function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid
if ( $html_on )
{
- $allowed_html_tags = split(',', $board_config['allow_html_tags']);
+
$end_html = 0;
$start_html = 1;
$tmp_message = '';
$message = ' ' . $message . ' ';
+
+
+
+
while ( $start_html = strpos($message, '<', $start_html) )
{
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1, ( $start_html - $end_html - 1 )));
@@ -109,7 +646,7 @@ function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid
$code_entities_replace = array('&lt;', '&gt;', '&quot;', '&#58;', '&#91;', '&#93;', '&#40;', '&#41;', '&#123;', '&#125;');
$message = '';
-
+
for($i = 0; $i < $match_count; $i++)
{
$message .= $match[1][$i] . '[code]' . preg_replace($code_entities_match, $code_entities_replace, $match[2][$i]) . '[/code]';
@@ -118,7 +655,7 @@ function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid
$message .= $tmp_message;
}
-
+
$message = bbencode_first_pass($message, $bbcode_uid);
}
@@ -134,7 +671,7 @@ function unprepare_message($message)
//
// Prepare a message for posting
-//
+//
function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on, &$error_msg, &$username, &$bbcode_uid, &$subject, &$message, &$poll_title, &$poll_options, &$poll_length)
{
global $board_config, $userdata, $lang, $phpEx, $phpbb_root_path;
@@ -172,7 +709,7 @@ function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on,
$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
$message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
}
- else if ( $mode != 'delete' && $mode != 'polldelete' )
+ else if ( $mode != 'delete' && $mode != 'polldelete' )
{
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_message'] : $lang['Empty_message'];
}
@@ -206,7 +743,7 @@ function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on,
{
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['To_few_poll_options'] : $lang['To_few_poll_options'];
}
- else if ( count($poll_options) > $board_config['max_poll_options'] )
+ else if ( count($poll_options) > $board_config['max_poll_options'] )
{
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['To_many_poll_options'] : $lang['To_many_poll_options'];
}
@@ -230,7 +767,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
$current_time = time();
- if ( $mode == 'newtopic' || $mode == 'reply' )
+ if ( $mode == 'newtopic' || $mode == 'reply' )
{
//
// Flood control
@@ -292,7 +829,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
//
// Add poll
- //
+ //
if ( ( $mode == 'newtopic' || $mode == 'editpost' ) && !empty($poll_title) && count($poll_options) >= 2 )
{
$sql = ( !$post_data['has_poll'] ) ? "INSERT INTO " . VOTE_DESC_TABLE . " (topic_id, vote_text, vote_start, vote_length) VALUES ($topic_id, '$poll_title', $current_time, " . ( $poll_length * 86400 ) . ")" : "UPDATE " . VOTE_DESC_TABLE . " SET vote_text = '$poll_title', vote_length = " . ( $poll_length * 86400 ) . " WHERE topic_id = $topic_id";
@@ -305,9 +842,9 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
$old_poll_result = array();
if ( $mode == 'editpost' && $post_data['has_poll'] )
{
- $sql = "SELECT vote_option_id, vote_result
- FROM " . VOTE_RESULTS_TABLE . "
- WHERE vote_id = $poll_id
+ $sql = "SELECT vote_option_id, vote_result
+ FROM " . VOTE_RESULTS_TABLE . "
+ WHERE vote_id = $poll_id
ORDER BY vote_option_id ASC";
if ( !($result = $db->sql_query($sql)) )
{
@@ -350,7 +887,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
if( $delete_option_sql != '' )
{
- $sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
+ $sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_option_id IN ($delete_option_sql)";
if ( !($result = $db->sql_query($sql)) )
{
@@ -390,7 +927,7 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
$topic_update_sql .= "topic_replies = topic_replies - 1";
$sql = "SELECT MAX(post_id) AS post_id
- FROM " . POSTS_TABLE . "
+ FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_id";
if ( !($db->sql_query($sql)) )
{
@@ -406,8 +943,8 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
if ( $post_data['last_topic'] )
{
$sql = "SELECT MAX(post_id) AS post_id
- FROM " . POSTS_TABLE . "
- WHERE forum_id = $forum_id";
+ FROM " . POSTS_TABLE . "
+ WHERE forum_id = $forum_id";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
@@ -419,10 +956,10 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
}
}
}
- else if ( $post_data['first_post'] )
+ else if ( $post_data['first_post'] )
{
$sql = "SELECT MIN(post_id) AS post_id
- FROM " . POSTS_TABLE . "
+ FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_id";
if ( !($db->sql_query($sql)) )
{
@@ -441,16 +978,16 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
}
else if ( $mode != 'poll_delete' )
{
- $forum_update_sql .= ", forum_last_post_id = $post_id" . ( ( $mode == 'newtopic' ) ? ", forum_topics = forum_topics $sign" : "" );
+ $forum_update_sql .= ", forum_last_post_id = $post_id" . ( ( $mode == 'newtopic' ) ? ", forum_topics = forum_topics $sign" : "" );
$topic_update_sql = "topic_last_post_id = $post_id" . ( ( $mode == 'reply' ) ? ", topic_replies = topic_replies $sign" : ", topic_first_post_id = $post_id" );
}
- else
+ else
{
$topic_update_sql .= 'topic_vote = 0';
}
- $sql = "UPDATE " . FORUMS_TABLE . " SET
- $forum_update_sql
+ $sql = "UPDATE " . FORUMS_TABLE . " SET
+ $forum_update_sql
WHERE forum_id = $forum_id";
if ( !($result = $db->sql_query($sql)) )
{
@@ -459,8 +996,8 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
if ( $topic_update_sql != '' )
{
- $sql = "UPDATE " . TOPICS_TABLE . " SET
- $topic_update_sql
+ $sql = "UPDATE " . TOPICS_TABLE . " SET
+ $topic_update_sql
WHERE topic_id = $topic_id";
if ( !($result = $db->sql_query($sql)) )
{
@@ -471,7 +1008,7 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
if ( $mode != 'poll_delete' )
{
$sql = "UPDATE " . USERS_TABLE . "
- SET user_posts = user_posts $sign
+ SET user_posts = user_posts $sign
WHERE user_id = $user_id";
if ( !($result = $db->sql_query($sql, END_TRANSACTION)) )
{
@@ -493,35 +1030,35 @@ function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
$topic_update_sql = '';
if ( $mode != 'poll_delete' )
{
- $sql = "DELETE FROM " . POSTS_TABLE . "
+ $sql = "DELETE FROM " . POSTS_TABLE . "
WHERE post_id = $post_id";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
- $sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
+ $sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
WHERE post_id = $post_id";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
- $sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
+ $sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE post_id = $post_id";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
- $forum_update_sql = 'forum_posts = forum_posts - 1';
+ $forum_update_sql = 'forum_posts = forum_posts - 1';
$topic_update_sql .= 'topic_replies = topic_replies - 1';
if ( $post_data['last_post'] )
{
if ( $post_data['first_post'] )
{
- $sql = "DELETE FROM " . TOPICS_TABLE . "
- WHERE topic_id = $topic_id
+ $sql = "DELETE FROM " . TOPICS_TABLE . "
+ WHERE topic_id = $topic_id
OR topic_moved_id = $topic_id";
if ( !($db->sql_query($sql)) )
{
@@ -540,21 +1077,21 @@ function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
if( $mode == 'poll_delete' || ( $mode == 'delete' && $post_data['first_post'] && $post_data['last_post'] ) && $post_data['has_poll'] && $post_data['edit_poll'] )
{
- $sql = "DELETE FROM " . VOTE_DESC_TABLE . "
+ $sql = "DELETE FROM " . VOTE_DESC_TABLE . "
WHERE vote_id = $poll_id";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
}
- $sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
+ $sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_id = $poll_id";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
}
- $sql = "DELETE FROM " . VOTE_USERS_TABLE . "
+ $sql = "DELETE FROM " . VOTE_USERS_TABLE . "
WHERE vote_id = $poll_id";
if ( !($db->sql_query($sql)) )
{
@@ -599,11 +1136,11 @@ function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id
message_die(GENERAL_ERROR, 'Could not change topic notify data', '', __LINE__, __FILE__, $sql);
}
}
- else
+ else
{
if ( $mode == 'reply' || $mode == 'newtopic' )
{
- $sql = "SELECT ban_userid
+ $sql = "SELECT ban_userid
FROM " . BANLIST_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
@@ -619,12 +1156,12 @@ function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id
}
}
- $sql = "SELECT u.user_id, u.username, u.user_email, u.user_lang, f.forum_name
- FROM " . FORUMS_WATCH_TABLE . " w, " . FORUMS_TABLE . " f, " . USERS_TABLE . " u
- WHERE w.forum_id = $forum_id
- AND w.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . " )
- AND w.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "
- AND f.forum_id = w.forum_id
+ $sql = "SELECT u.user_id, u.username, u.user_email, u.user_lang, f.forum_name
+ FROM " . FORUMS_WATCH_TABLE . " w, " . FORUMS_TABLE . " f, " . USERS_TABLE . " u
+ WHERE w.forum_id = $forum_id
+ AND w.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . " )
+ AND w.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "
+ AND f.forum_id = w.forum_id
AND u.user_id = w.user_id";
if ( !($result = $db->sql_query($sql)) )
{
@@ -664,7 +1201,7 @@ function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
'USERNAME' => $row['username'],
'SITENAME' => $board_config['sitename'],
- 'FORUM_NAME' => $forum_name,
+ 'FORUM_NAME' => $forum_name,
'U_FORUM' => $server_protocol . $server_name . $server_port . $script_name_f . '?' . POST_FORUM_URL . "=$forum_id",
'U_STOP_WATCHING_FORUM' => $server_protocol . $server_name . $server_port . $script_name_f . '?' . POST_FORUM_URL . "=$forum_id&unwatch=forum")
@@ -690,12 +1227,12 @@ function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id
if ( $mode == 'reply' )
{
- $sql = "SELECT u.user_id, u.username, u.user_email, u.user_lang, t.topic_title
- FROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
- WHERE tw.topic_id = $topic_id
- AND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . " )
- AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "
- AND t.topic_id = tw.topic_id
+ $sql = "SELECT u.user_id, u.username, u.user_email, u.user_lang, t.topic_title
+ FROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
+ WHERE tw.topic_id = $topic_id
+ AND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . " )
+ AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "
+ AND t.topic_id = tw.topic_id
AND u.user_id = tw.user_id";
if ( !($result = $db->sql_query($sql)) )
{
@@ -723,7 +1260,7 @@ function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
'USERNAME' => $row['username'],
'SITENAME' => $board_config['sitename'],
- 'TOPIC_TITLE' => $topic_title,
+ 'TOPIC_TITLE' => $topic_title,
'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name_t . '?' . POST_POST_URL . "=$post_id#$post_id",
'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name_t . '?' . POST_TOPIC_URL . "=$topic_id&unwatch=topic")
@@ -750,7 +1287,7 @@ function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id
}
- $sql = "SELECT topic_id
+ $sql = "SELECT topic_id
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
@@ -783,588 +1320,4 @@ function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id
}
}
-function clean_words($mode, &$entry, &$stopword_list, &$synonym_list)
-{
- // Weird, $init_match doesn't work with static when double quotes (") are used...
- static $drop_char_match = array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!');
- static $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' , ' ', ' ', ' ', ' ', ' ', ' ');
-
- $entry = ' ' . strip_tags(strtolower($entry)) . ' ';
-
- if ( $mode == 'post' )
- {
- // Replace line endings by a space
- $entry = preg_replace('/[\n\r]/is', ' ', $entry);
- // HTML entities like &nbsp;
- $entry = preg_replace('/\b&[a-z]+;\b/', ' ', $entry);
- // Remove URL's
- $entry = preg_replace('/\b[a-z0-9]+:\/\/[a-z0-9\.\-]+(\/[a-z0-9\?\.%_\-\+=&\/]+)?/', ' ', $entry);
- // Quickly remove BBcode.
- $entry = preg_replace('/\[img:[a-z0-9]{10,}\].*?\[\/img:[a-z0-9]{10,}\]/', ' ', $entry);
- $entry = preg_replace('/\[\/?url(=.*?)?\]/', ' ', $entry);
- $entry = preg_replace('/\[\/?[a-z\*=\+\-]+(\:?[0-9a-z]+)?:[a-z0-9]{10,}(\:[a-z0-9]+)?=?.*?\]/', ' ', $entry);
- }
- else if ( $mode == 'search' )
- {
- $entry = str_replace('+', ' and ', $entry);
- $entry = str_replace('-', ' not ', $entry);
- }
-
- //
- // Filter out strange characters like ^, $, &, change "it's" to "its"
- //
- for($i = 0; $i < count($drop_char_match); $i++)
- {
- $entry = str_replace($drop_char_match[$i], $drop_char_replace[$i], $entry);
- }
-
- if ( $mode == 'post' )
- {
- $entry = str_replace('*', ' ', $entry);
-
- // 'words' that consist of <=2 or >=20 characters are removed.
- $entry = preg_replace('/\b([a-z0-9]{1,2}|[a-z0-9]{20,})\b/',' ', $entry);
- }
-
- if ( !empty($stopword_list) )
- {
- for ($j = 0; $j < count($stopword_list); $j++)
- {
- $stopword = trim($stopword_list[$j]);
-
- if ( $mode == 'post' || ( $stopword != 'not' && $stopword != 'and' && $stopword != 'or' ) )
- {
- $entry = preg_replace('#\b' . preg_quote($stopword) . '\b#', ' ', $entry);
- }
- }
- }
-
- if ( !empty($synonym_list) )
- {
- for ($j = 0; $j < count($synonym_list); $j++)
- {
- list($replace_synonym, $match_synonym) = split(' ', trim(strtolower($synonym_list[$j])));
- if ( $mode == 'post' || ( $match_synonym != 'not' && $match_synonym != 'and' && $match_synonym != 'or' ) )
- {
- $entry = preg_replace('#\b' . trim($match_synonym) . '\b#', ' ' . trim($replace_synonym) . ' ', $entry);
- }
- }
- }
-
- return $entry;
-}
-
-function split_words(&$entry, $mode = 'post')
-{
- $match = ( $mode == 'post' ) ? '/\b(\w[\w\']*\w+|\w+?)\b/' : '/(\*?[\w]+\*?)|\b([\w]+)\b/';
- preg_match_all($match, $entry, $split_entries);
-
- return array_unique($split_entries[1]);
-}
-
-function add_search_words($post_id, $post_text, $post_title = '')
-{
- global $db, $phpbb_root_path, $board_config, $lang;
-
- $stopwords_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_stopwords.txt');
- $synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt');
-
- $search_raw_words = array();
- $search_raw_words['text'] = split_words(clean_words('post', $post_text, $stopword_array, $synonym_array));
- $search_raw_words['title'] = split_words(clean_words('post', $post_title, $stopword_array, $synonym_array));
-
- $word = array();
- $word_insert_sql = array();
- foreach ( $search_raw_words as $word_in => $search_matches )
- {
- $word_insert_sql[$word_in] = '';
- if ( !empty($search_matches) )
- {
- for ($i = 0; $i < count($search_matches); $i++)
- {
- $search_matches[$i] = trim($search_matches[$i]);
-
- if( $search_matches[$i] != '' )
- {
- $word[] = $search_matches[$i];
- if ( !strstr($word_insert_sql[$word_in], "'" . $search_matches[$i] . "'") )
- {
- $word_insert_sql[$word_in] .= ( $word_insert_sql[$word_in] != '' ) ? ", '" . $search_matches[$i] . "'" : "'" . $search_matches[$i] . "'";
- }
- }
- }
- }
- }
-
- if ( count($word) )
- {
- sort($word);
-
- $prev_word = '';
- $word_text_sql = '';
- $temp_word = array();
- for($i = 0; $i < count($word); $i++)
- {
- if ( $word[$i] != $prev_word )
- {
- $temp_word[] = $word[$i];
- $word_text_sql .= ( ( $word_text_sql != '' ) ? ', ' : '' ) . "'" . $word[$i] . "'";
- }
- $prev_word = $word[$i];
- }
- $word = $temp_word;
-
- $check_words = array();
- switch( SQL_LAYER )
- {
- case 'postgresql':
- case 'msaccess':
- case 'mssql-odbc':
- case 'oracle':
- case 'db2':
- $sql = "SELECT word_id, word_text
- FROM " . SEARCH_WORD_TABLE . "
- WHERE word_text IN ($word_text_sql)";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, 'Could not select words', '', __LINE__, __FILE__, $sql);
- }
-
- while ( $row = $db->sql_fetchrow($result) )
- {
- $check_words[$row['word_text']] = $row['word_id'];
- }
- break;
- }
-
- $value_sql = '';
- $match_word = array();
- for ($i = 0; $i < count($word); $i++)
- {
- $new_match = true;
- if ( isset($check_words[$word[$i]]) )
- {
- $new_match = false;
- }
-
- if ( $new_match )
- {
- switch( SQL_LAYER )
- {
- case 'mysql':
- case 'mysql4':
- $value_sql .= ( ( $value_sql != '' ) ? ', ' : '' ) . '(\'' . $word[$i] . '\')';
- break;
- case 'mssql':
- $value_sql .= ( ( $value_sql != '' ) ? ' UNION ALL ' : '' ) . "SELECT '" . $word[$i] . "'";
- break;
- default:
- $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
- VALUES ('" . $word[$i] . "')";
- if( !$db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql);
- }
- break;
- }
- }
- }
-
- if ( $value_sql != '' )
- {
- switch ( SQL_LAYER )
- {
- case 'mysql':
- case 'mysql4':
- $sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text)
- VALUES $value_sql";
- break;
- case 'mssql':
- $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
- $value_sql";
- break;
- }
-
- if ( !$db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql);
- }
- }
- }
-
- while( list($word_in, $match_sql) = @each($word_insert_sql) )
- {
- $title_match = ( $word_in == 'title' ) ? 1 : 0;
-
- if ( $match_sql != '' )
- {
- $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match)
- SELECT $post_id, word_id, $title_match
- FROM " . SEARCH_WORD_TABLE . "
- WHERE word_text IN ($match_sql)";
- if ( !$db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, 'Could not insert new word matches', '', __LINE__, __FILE__, $sql);
- }
- }
- }
-
- if ( $mode == 'single' )
- {
- remove_common('single', 0.4, $word);
- }
-
- return;
-}
-
-//
-// Check if specified words are too common now
-//
-function remove_common($mode, $fraction, $word_id_list = array())
-{
- global $db;
-
- $sql = ( $mode == 'global' ) ? "SELECT COUNT(post_id) AS total_posts FROM " . SEARCH_MATCH_TABLE . " GROUP BY post_id" : "SELECT SUM(forum_posts) AS total_posts FROM " . FORUMS_TABLE;
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, 'Could not obtain post count', '', __LINE__, __FILE__, $sql);
- }
-
- $row = $db->sql_fetchrow($result);
-
- if ( $row['total_posts'] >= 100 )
- {
- $common_threshold = floor($row['total_posts'] * $fraction);
-
- if ( $mode == 'single' && count($word_id_list) )
- {
- $word_id_sql = '';
- for($i = 0; $i < count($word_id_list); $i++)
- {
- $word_id_sql .= ( ( $word_id_sql != '' ) ? ', ' : '' ) . "'" . $word_id_list[$i] . "'";
- }
-
- $sql = "SELECT m.word_id
- FROM " . SEARCH_MATCH_TABLE . " m, " . SEARCH_WORD_TABLE . " w
- WHERE w.word_text IN ($word_id_sql)
- AND m.word_id = w.word_id
- GROUP BY m.word_id
- HAVING COUNT(m.word_id) > $common_threshold";
- }
- else
- {
- $sql = "SELECT word_id
- FROM " . SEARCH_MATCH_TABLE . "
- GROUP BY word_id
- HAVING COUNT(word_id) > $common_threshold";
- }
-
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, 'Could not obtain common word list', '', __LINE__, __FILE__, $sql);
- }
-
- $common_word_id = '';
- while ( $row = $db->sql_fetchrow($result) )
- {
- $common_word_id .= ( ( $common_word_id != '' ) ? ', ' : '' ) . $row['word_id'];
- }
- $db->sql_freeresult($result);
-
- if ( $common_word_id != '' )
- {
- $sql = "UPDATE " . SEARCH_WORD_TABLE . "
- SET word_common = " . TRUE . "
- WHERE word_id IN ($common_word_id)";
- if ( !$db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, 'Could not delete word list entry', '', __LINE__, __FILE__, $sql);
- }
-
- $sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
- WHERE word_id IN ($common_word_id)";
- if ( !$db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, 'Could not delete word match entry', '', __LINE__, __FILE__, $sql);
- }
- }
- }
-
- return $word_count;
-}
-
-function remove_search_post($post_id_sql)
-{
- global $db;
-
- $words_removed = false;
-
- switch ( SQL_LAYER )
- {
- case 'mysql':
- case 'mysql4':
- $sql = "SELECT word_id
- FROM " . SEARCH_MATCH_TABLE . "
- WHERE post_id IN ($post_id_sql)
- GROUP BY word_id";
- if ( $result = $db->sql_query($sql) )
- {
- $word_id_sql = '';
- while ( $row = $db->sql_fetchrow($result) )
- {
- $word_id_sql .= ( $word_id_sql != '' ) ? ', ' . $row['word_id'] : $row['word_id'];
- }
-
- $sql = "SELECT word_id
- FROM " . SEARCH_MATCH_TABLE . "
- WHERE word_id IN ($word_id_sql)
- GROUP BY word_id
- HAVING COUNT(word_id) = 1";
- if ( $result = $db->sql_query($sql) )
- {
- $word_id_sql = '';
- while ( $row = $db->sql_fetchrow($result) )
- {
- $word_id_sql .= ( $word_id_sql != '' ) ? ', ' . $row['word_id'] : $row['word_id'];
- }
-
- if ( $word_id_sql != '' )
- {
- $sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
- WHERE word_id IN ($word_id_sql)";
- if ( !$db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, 'Could not delete word list entry', '', __LINE__, __FILE__, $sql);
- }
-
- $words_removed = $db->sql_affectedrows();
- }
- }
- }
- break;
-
- default:
- $sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
- WHERE word_id IN (
- SELECT word_id
- FROM " . SEARCH_MATCH_TABLE . "
- WHERE word_id IN (
- SELECT word_id
- FROM " . SEARCH_MATCH_TABLE . "
- WHERE post_id IN ($post_id_sql)
- GROUP BY word_id
- )
- GROUP BY word_id
- HAVING COUNT(word_id) = 1
- )";
- if ( !$db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, 'Could not delete old words from word table', '', __LINE__, __FILE__, $sql);
- }
-
- $words_removed = $db->sql_affectedrows();
-
- break;
- }
-
- $sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
- WHERE post_id IN ($post_id_sql)";
- if ( !$db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
- }
-
- return $words_removed;
-}
-
-//
-// Fill smiley templates (or just the variables) with smileys
-// Either in a window or inline
-//
-function generate_smilies($mode, $page_id)
-{
- global $db, $session, $board_config, $template, $lang, $theme, $phpEx, $phpbb_root_path;
- global $user_ip, $starttime;
- global $userdata;
-
- $inline_columns = 4;
- $inline_rows = 5;
- $window_columns = 8;
-
- if ( $mode == 'window' )
- {
- $userdata = $session->start();
- $session->configure($userdata);
-
- $page_title = $lang['Review_topic'] . " - $topic_title";
- include($phpbb_root_path . 'includes/page_header.'.$phpEx);
-
- $template->set_filenames(array(
- 'smiliesbody' => 'posting_smilies.tpl')
- );
- }
-
- $sql = "SELECT emoticon, code, smile_url
- FROM " . SMILIES_TABLE . "
- ORDER BY smilies_id";
- $result = $db->sql_query($sql);
-
- $num_smilies = 0;
- $rowset = array();
- while ( $row = $db->sql_fetchrow($result) )
- {
- if ( empty($rowset[$row['smile_url']]) )
- {
- $rowset[$row['smile_url']]['code'] = str_replace('\\', '\\\\', str_replace("'", "\\'", $row['code']));
- $rowset[$row['smile_url']]['emoticon'] = $row['emoticon'];
- $num_smilies++;
- }
- }
-
- if ( $num_smilies )
- {
- $smilies_count = ( $mode == 'inline' ) ? min(19, $num_smilies) : $num_smilies;
- $smilies_split_row = ( $mode == 'inline' ) ? $inline_columns - 1 : $window_columns - 1;
-
- $s_colspan = 0;
- $row = 0;
- $col = 0;
-
- foreach( $rowset as $smile_url => $data )
- {
- if ( !$col )
- {
- $template->assign_block_vars('smilies_row', array());
- }
-
- $template->assign_block_vars('smilies_row.smilies_col', array(
- 'SMILEY_CODE' => $data['code'],
- 'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $smile_url,
- 'SMILEY_DESC' => $data['emoticon'])
- );
-
- $s_colspan = max($s_colspan, $col + 1);
-
- if ( $col == $smilies_split_row )
- {
- if ( $mode == 'inline' && $row == $inline_rows - 1 )
- {
- break;
- }
- $col = 0;
- $row++;
- }
- else
- {
- $col++;
- }
- }
-
- if ( $mode == 'inline' && $num_smilies > $inline_rows * $inline_columns )
- {
- $template->assign_block_vars('switch_smilies_extra', array());
-
- $template->assign_vars(array(
- 'L_MORE_SMILIES' => $lang['More_emoticons'],
- 'U_MORE_SMILIES' => "posting.$phpEx$SID&amp;mode=smilies")
- );
- }
-
- $template->assign_vars(array(
- 'L_EMOTICONS' => $lang['Emoticons'],
- 'L_CLOSE_WINDOW' => $lang['Close_window'],
- 'S_SMILIES_COLSPAN' => $s_colspan)
- );
- }
-
- if ( $mode == 'window' )
- {
- $template->display('smiliesbody');
-
- include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
- }
-}
-
-//
-//
-//
-define('BBCODE_UID_LEN', 10);
-
-//
-//
-//
-class parse_message
-{
- var $message;
- var $bbcode_tpl = null;
-
- function parse_message($message, $html, $bbcode, $emoticons)
- {
- global $board_config;
-
- $this->message = $message;
- unset($message);
-
- $this->html($html);
- $this->bbcode($bbcode);
- $this->emoticons($emoticons);
-
- return $this->message;
- }
-
- function html($html)
- {
- global $board_config;
-
- }
-
- function bbcode($bbcode)
- {
- global $board_config;
-
- }
-
- function emoticons($emoticons)
- {
- global $board_config;
-
- }
-
- function attachments()
- {
-
- }
-}
-
-class parse_poll
-{
-
- function parse_poll()
- {
- global $board_config;
-
- }
-
-}
-
-class parse_search
-{
-
- function parse_search()
- {
-
- }
-
- function add()
- {
-
- }
-
- function delete()
- {
-
- }
-
-}
-
?> \ No newline at end of file
diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php
index fe33ff252c..176df6cb17 100644
--- a/phpBB/includes/page_header.php
+++ b/phpBB/includes/page_header.php
@@ -26,9 +26,7 @@ if ( !defined('IN_PHPBB') )
define('HEADER_INC', TRUE);
-//
// gzip_compression
-//
if ( $board_config['gzip_compress'] )
{
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
-//
-if ( $userdata['user_id'] != ANONYMOUS )
+if ( $userdata['user_id'] )
{
- $u_login_logout = 'login.'.$phpEx.'?logout=true';
+ $u_login_logout = 'login.'.$phpEx. $SID . '&amp;logout=true';
$l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';
}
else
{
- $u_login_logout = 'login.'.$phpEx;
+ $u_login_logout = 'login.'.$phpEx . $SID;
$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']) : '';
-//
-// Get basic (usernames + totals) online
-// 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);
+// Timezone : $user->dst
+$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'])], '');
+// Get users online list
$userlist_ary = array();
$userlist_visible = array();
@@ -76,11 +64,20 @@ $online_userlist = '';
$prev_user_id = 0;
$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) )
{
// User is logged in and therefor not a guest
- if ( $row['user_id'] != ANONYMOUS )
+ if ( $row['user_id'] )
{
// Skip multiple sessions for one user
if ( $row['user_id'] != $prev_user_id )
@@ -101,7 +98,7 @@ while( $row = $db->sql_fetchrow($result) )
$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;
}
@@ -215,17 +212,17 @@ $l_online_users .= sprintf($l_g_user_s, $guests_online);
// Obtain number of new private messages
// if user is logged in
//
-if ( $userdata['user_id'] != ANONYMOUS )
+if ( $userdata['user_id'] )
{
if ( $userdata['user_new_privmsg'] )
{
$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']);
- if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
+ if ( $userdata['user_last_privmsg'] > $userdata['session_last_visit'] )
{
$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'];
$db->sql_query($sql);
@@ -341,14 +338,14 @@ $template->assign_vars(array(
'U_MEMBERSLIST' => 'memberlist.'.$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_BROWSER' => $userdata['session_browser'],
'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
'S_CONTENT_ENCODING' => $lang['ENCODING'],
'S_CONTENT_DIR_LEFT' => $lang['LEFT'],
'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,
'T_STYLESHEET_DATA' => $theme['css_data'],
diff --git a/phpBB/includes/page_tail.php b/phpBB/includes/page_tail.php
index 1c91e48399..80742d05f7 100644
--- a/phpBB/includes/page_tail.php
+++ b/phpBB/includes/page_tail.php
@@ -40,12 +40,12 @@ if (defined('DEBUG'))
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(
'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 : '')
);
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 3d69043e61..779244a32d 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -22,34 +22,34 @@
class session {
var $session_id = '';
+ var $browser = '';
+ var $page = '';
var $load;
+ // Called at each page start ... checks for, updates and/or creates a session
function start($update = true)
{
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();
+ $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'])) : '';
- $this->session_id = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) ) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid'] : '';
+ $sessiondata = ( isset($_COOKIE[$board_config['cookie_name'] . '_data']) ) ? unserialize(stripslashes($_COOKIE[$board_config['cookie_name'] . '_data'])) : '';
+ $this->session_id = ( isset($_COOKIE[$board_config['cookie_name'] . '_sid']) ) ? $_COOKIE[$board_config['cookie_name'] . '_sid'] : '';
$SID = '?sid=';
}
else
{
$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;
}
- //
// Load limit check (if applicable)
- //
if ( !empty($board_config['limit_load']) && file_exists('/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
- //
if ( !empty($this->session_id) )
{
$sql = "SELECT u.*, s.*
@@ -86,28 +75,27 @@ class session {
$userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- //
// Did the session exist in the DB?
- //
if ( isset($userdata['user_id']) )
{
- //
- // 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.
- //
+ // Validate IP length according to admin ... has no effect on IPv6
$ip_check_s = explode('.', $userdata['session_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
- //
if ( ( $current_time - $userdata['session_time'] > 60 || $userdata['session_page'] != $user_page ) && $update )
{
$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 . "'";
$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,
// using the cookie user_id if available to pull basic user prefs.
- //
$autologin = ( isset($sessiondata['autologinid']) ) ? $sessiondata['autologinid'] : '';
$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
- //
- function create(&$user_id, &$autologin, &$user_page, &$user_browser)
+ function create(&$user_id, &$autologin)
{
global $SID, $db, $board_config, $user_ip;
$sessiondata = array();
$current_time = time();
- //
// Limit sessions in 1 minute period
- //
$sql = "SELECT COUNT(*) AS sessions
FROM " . SESSIONS_TABLE . "
WHERE session_time >= " . ( $current_time - 60 );
@@ -153,9 +135,14 @@ class session {
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
- //
$sql = "SELECT *
FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
@@ -164,9 +151,7 @@ class session {
$userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- //
// Check autologin request, is it valid?
- //
if ( $userdata['user_password'] != $autologin || !$userdata['user_active'] || $user_id == ANONYMOUS )
{
$autologin = '';
@@ -195,13 +180,11 @@ class session {
}
$db->sql_freeresult($result);
- //
// Create or update the session
- //
$db->sql_return_on_error(true);
$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 . "'";
if ( !($result = $db->sql_query($sql)) || !$db->sql_affectedrows() )
{
@@ -209,8 +192,8 @@ class session {
$this->session_id = md5(uniqid($user_ip));
$sql = "INSERT INTO " . SESSIONS_TABLE . "
- (session_id, session_user_id, 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')";
+ (session_id, session_user_id, session_last_visit, session_start, session_time, session_ip, session_browser, session_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_return_on_error(false);
@@ -220,29 +203,31 @@ class session {
$sessiondata['autologinid'] = ( $autologin && $user_id != ANONYMOUS ) ? $autologin : '';
$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']);
- 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('data', serialize($sessiondata), $current_time + 31536000);
+ $this->set_cookie('sid', $this->session_id, 0);
$SID = '?sid=' . $this->session_id;
+ // Events ...
+ if ( $userdata['user_id'] )
+ {
+// do_events();
+ }
+
return $userdata;
}
- //
// Destroy a session
- //
function destroy(&$userdata)
{
global $SID, $db, $board_config;
- global $HTTP_COOKIE_VARS, $HTTP_GET_VARS;
$current_time = time();
- setcookie($board_config['cookie_name'] . '_data', '', $current_time - 31536000, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
- setcookie($board_config['cookie_name'] . '_sid', '', $current_time - 31536000, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
+ $this->set_cookie('data', '', $current_time - 31536000);
+ $this->set_cookie('sid', '', $current_time - 31536000);
+ $SID = '?sid=';
- //
// Delete existing session, update last visit info first!
- //
$sql = "UPDATE " . USERS_TABLE . "
SET user_lastvisit = " . $userdata['session_time'] . ", user_session_page = '" . $userdata['session_page'] . "'
WHERE user_id = " . $userdata['user_id'];
@@ -253,15 +238,34 @@ class session {
AND session_user_id = " . $userdata['user_id'];
$db->sql_query($sql);
- $SID = '?sid=';
$this->session_id = '';
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
- //
function gc(&$current_time)
{
global $db, $board_config, $user_ip;
@@ -269,6 +273,7 @@ class session {
$sql = "SELECT *
FROM " . SESSIONS_TABLE . "
WHERE session_time < " . ( $current_time - $board_config['session_length'] ) . "
+ ORDER BY session_user_id, session_time
LIMIT 10";
$result = $db->sql_query($sql);
@@ -290,9 +295,7 @@ class session {
if ( $del_session_id != '' )
{
- //
// Delete expired sessions
- //
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_id IN ($del_session_id)";
$db->sql_query($sql);
@@ -300,10 +303,8 @@ class session {
if ( $del_sessions < 10 )
{
- //
// Less than 10 sessions, update gc timer ... else we want gc
// called again to delete other sessions
- //
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$current_time'
WHERE config_name = 'session_last_gc'";
@@ -313,9 +314,7 @@ class session {
return;
}
- //
- //
- //
+ // Taken over by user class ... for now at least
function configure($userdata, $lang_set = false)
{
global $db, $template, $lang, $board_config, $theme, $images;
@@ -323,25 +322,14 @@ class session {
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['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);
-
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);
}
@@ -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');
- 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;
}
}
+// 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
// mysteriously appear elsewhere, think up your own solutions!
-//
-class acl
+class auth
{
var $founder = false;
var $acl = false;
@@ -636,22 +730,11 @@ class acl
$auth_sql";
$db->sql_query($sql);
}
-}
-//
-// Authentication plug-ins is largely down to
-// Sergey Kanareykin, our thanks to him.
-//
-class login
-{
+ // Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
function login($username, $password, $autologin = false)
{
- global $SID, $db, $board_config, $lang, $user_ip, $session;
- 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'];
+ global $board_config, $session, $phpEx;
$method = trim($board_config['auth_method']);
@@ -669,7 +752,7 @@ class login
$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;
}
}
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index acb4b357ed..60f6551ce5 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -138,11 +138,7 @@ class Template {
}
$str = '';
- while ( !feof($fp) )
- {
- $str .= fread($fp, 4096);
- }
-
+ $str = fread($fp, filesize($this->files[$handle]));
@fclose($fp);
$this->uncompiled_code[$handle] = trim($str);
@@ -177,6 +173,7 @@ class Template {
echo $db->sql_report;
return TRUE;
}
+
$_str = '';
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");
}
- //
// Actually compile the code now.
- //
$this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]);
$this->compile_write($handle, $this->compiled_code[$handle]);
@@ -561,9 +556,7 @@ class Template {
return "include('" . $this->root . '/' . $tag_args . "');\n";
}
- //
// This is from Smarty
- //
function _parse_is_expr($is_arg, $tokens)
{
$expr_end = 0;
@@ -697,9 +690,7 @@ class Template {
$filename = $this->cachedir . $this->filename[$handle] . '.' . $phpEx;
- //
// Recompile page if the original template is newer, otherwise load the compiled version
- //
if ( file_exists($filename) && @filemtime($filename) >= @filemtime($this->files[$handle]) )
{
$_str = '';
diff --git a/phpBB/includes/usercp_viewprofile.php b/phpBB/includes/usercp_viewprofile.php
index a280a6ae5e..05e899da00 100644
--- a/phpBB/includes/usercp_viewprofile.php
+++ b/phpBB/includes/usercp_viewprofile.php
@@ -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'];
@@ -177,9 +177,9 @@ $template->assign_vars(array(
'RANK_IMAGE' => $rank_image,
'POSTS_PER_DAY' => $posts_per_day,
'POSTS' => $profiledata['user_posts'],
- 'PERCENTAGE' => $percentage . '%',
- 'POST_DAY_STATS' => sprintf($lang['User_post_day_stats'], $posts_per_day),
- 'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage),
+ 'PERCENTAGE' => $percentage . '%',
+ 'POST_DAY_STATS' => sprintf($lang['User_post_day_stats'], $posts_per_day),
+ 'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage),
'SEARCH_IMG' => $search_img,
'SEARCH' => $search,
@@ -190,8 +190,8 @@ $template->assign_vars(array(
'WWW_IMG' => $www_img,
'WWW' => $www,
'ICQ_STATUS_IMG' => $icq_status_img,
- 'ICQ_IMG' => $icq_img,
- 'ICQ' => $icq,
+ 'ICQ_IMG' => $icq_img,
+ 'ICQ' => $icq,
'AIM_IMG' => $aim_img,
'AIM' => $aim,
'MSN_IMG' => $msn_img,
@@ -204,13 +204,13 @@ $template->assign_vars(array(
'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '&nbsp;',
'AVATAR_IMG' => $avatar_img,
- 'L_VIEWING_PROFILE' => sprintf($lang['Viewing_user_profile'], $profiledata['username']),
- 'L_ABOUT_USER' => sprintf($lang['About_user'], $profiledata['username']),
- 'L_AVATAR' => $lang['Avatar'],
- 'L_POSTER_RANK' => $lang['Poster_rank'],
- 'L_JOINED' => $lang['Joined'],
- 'L_TOTAL_POSTS' => $lang['Total_posts'],
- 'L_SEARCH_USER_POSTS' => sprintf($lang['Search_user_posts'], $profiledata['username']),
+ 'L_VIEWING_PROFILE' => sprintf($lang['Viewing_user_profile'], $profiledata['username']),
+ 'L_ABOUT_USER' => sprintf($lang['About_user'], $profiledata['username']),
+ 'L_AVATAR' => $lang['Avatar'],
+ 'L_POSTER_RANK' => $lang['Poster_rank'],
+ 'L_JOINED' => $lang['Joined'],
+ 'L_TOTAL_POSTS' => $lang['Total_posts'],
+ 'L_SEARCH_USER_POSTS' => sprintf($lang['Search_user_posts'], $profiledata['username']),
'L_CONTACT' => $lang['Contact'],
'L_EMAIL_ADDRESS' => $lang['Email_address'],
'L_EMAIL' => $lang['Email'],
diff --git a/phpBB/index.php b/phpBB/index.php
index 5dd654e637..a36ef5e66a 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -24,6 +24,9 @@ $phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
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']))
{
$mark_read = (isset($_POST['mark'])) ? $_POST['mark'] : $_GET['mark'];
@@ -33,23 +36,15 @@ else
$mark_read = '';
}
-//
// Start session management
-//
$userdata = $session->start();
-$acl = new acl($userdata);
-//
+$auth->acl($userdata);
// End session management
-//
-//
// Configure style, language, etc.
-//
$session->configure($userdata);
-//
// Handle marking posts
-//
if ($mark_read == 'forums')
{
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_die(MESSAGE, $message);
}
-//
// 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_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
-//
$total_users = $board_config['num_users'];
$newest_user = $board_config['newest_username'];
$newest_uid = $board_config['newest_user_id'];
@@ -91,10 +83,12 @@ else
$l_total_user_s = $lang['Registered_users_total'];
}
+// Forum moderators ... a static template var could allow us
+// to drop these queries ...
$forum_moderators = array();
get_moderators($forum_moderators);
-$cat_id = (!empty($_GET['c'])) ? intval($_GET['c']) : 0;
+// Set some vars
$root_id = $branch_root_id = $cat_id;
$forum_rows = $subforums = $nav_forums = array();
@@ -109,7 +103,7 @@ if ($cat_id == 0)
FROM ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . 'u
WHERE f.forum_last_poster_id = u.user_id(+)
ORDER BY f.left_id';
- break;
+ break;
default:
$sql = 'SELECT f.*, u.username
@@ -122,24 +116,20 @@ else
{
$is_nav = TRUE;
- if (!$acl->get_acl($cat_id, 'forum', 'list'))
+ if (!$auth->get_acl($cat_id, 'forum', 'list'))
{
- //
// TODO: Deal with hidden categories
- //
message_die(ERROR, $lang['Category_not_exist']);
}
- //
// NOTE: make sure that categories post count is set to 0
- //
$sql = 'SELECT SUM(forum_posts) AS total
FROM ' . FORUMS_TABLE . '
WHERE post_count_inc = 1';
$result = $db->sql_query($sql);
$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);
$catrow = $db->sql_fetchrow($result);
@@ -186,9 +176,7 @@ while ($row = $db->sql_fetchrow($result))
{
if ($row['parent_id'] == $cat_id)
{
- //
// Root-level forum
- //
$forum_rows[] = $row;
$parent_id = $row['forum_id'];
@@ -199,18 +187,14 @@ while ($row = $db->sql_fetchrow($result))
}
elseif ($row['parent_id'] == $branch_root_id)
{
- //
// Forum directly under a category
- //
$forum_rows[] = $row;
$parent_id = $row['forum_id'];
}
elseif ($row['display_on_index'] && $row['forum_status'] != ITEM_CATEGORY)
{
- //
// Subforum, store it for direct linking
- //
- if ($acl->get_acl($row['forum_id'], 'forum', 'list'))
+ if ($auth->get_acl($row['forum_id'], 'forum', 'list'))
{
$subforums[$parent_id][] = $row;
}
@@ -282,9 +266,7 @@ foreach ($nav_forums as $row)
));
}
-//
// Start output of page
-//
$page_title = $lang['Index'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
diff --git a/phpBB/install/schemas/mysql_basic.sql b/phpBB/install/schemas/mysql_basic.sql
index 34bb1cff45..6bb4065264 100644
--- a/phpBB/install/schemas/mysql_basic.sql
+++ b/phpBB/install/schemas/mysql_basic.sql
@@ -5,7 +5,6 @@
#
# -- 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_msg','');
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 ('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 ('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 ('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_gallery_path','images/avatars/gallery');
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 ('privmsg_disable','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_date', '0');
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 ('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 ('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_base_dn', '');
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
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
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 ( ':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 ( ':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 ( ':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 ( '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 ( '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 ( ':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 ( ':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 ( ':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 ( ':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 ( ':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_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 ( ':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 ( ':|', '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');
diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql
index 8f482385a5..cc2a253bac 100644
--- a/phpBB/install/schemas/mysql_schema.sql
+++ b/phpBB/install/schemas/mysql_schema.sql
@@ -40,7 +40,7 @@ CREATE TABLE phpbb_auth_groups (
CREATE TABLE phpbb_auth_options (
auth_option_id tinyint(4) NOT NULL auto_increment,
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),
KEY auth_value (auth_value)
);
@@ -157,7 +157,7 @@ CREATE TABLE phpbb_forums (
KEY left_id (left_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 (
post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
bbcode_uid varchar(10) NOT NULL,
+ bbcode_bitfield int(11) UNSIGNED DEFAULT '0' NOT NULL,
post_checksum varchar(32) NOT NULL,
post_subject varchar(60),
post_text text,
@@ -412,6 +413,7 @@ CREATE TABLE phpbb_search_wordmatch (
CREATE TABLE phpbb_sessions (
session_id varchar(32) DEFAULT '' 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_time int(11) DEFAULT '0' NOT NULL,
session_ip varchar(40) DEFAULT '0' NOT NULL,
diff --git a/phpBB/login.php b/phpBB/login.php
index 30a460d70c..b1c3a9f952 100644
--- a/phpBB/login.php
+++ b/phpBB/login.php
@@ -30,7 +30,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Set page ID for session management
//
$userdata = $session->start();
-$acl = new acl($userdata);
+$auth = new auth($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
//
- if ( $board_config['board_disable'] && !$acl->get_acl_admin() )
+ if ( $board_config['board_disable'] && !$auth->get_acl_admin() )
{
header($header_location . "index.$phpEx$SID");
exit;
}
- if ( new login($username, $password, $autologin) )
+ if ( !$auth->login($username, $password, $autologin) )
{
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . "login.$phpEx$SID&amp;redirect=$redirect" . '">')
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index b4833be052..4c0d7dd2a1 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -28,7 +28,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management
//
$userdata = $session->start();
-$acl = new acl($userdata);
+$auth->acl($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'];
@@ -299,4 +299,201 @@ make_jumpbox('viewforum.'.$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;
+}
+
?> \ No newline at end of file
diff --git a/phpBB/modcp.php b/phpBB/modcp.php
index cc264708d5..e64953eb0d 100644
--- a/phpBB/modcp.php
+++ b/phpBB/modcp.php
@@ -124,7 +124,7 @@ else
// Start session management
//
$userdata = $session->start();
-$acl = new acl($userdata, $forum_id);
+$auth->acl($userdata, $forum_id);
//
// End session management
//
@@ -167,7 +167,7 @@ else
//
// 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']);
}
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 3b21718326..61c8e3aa73 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -8,7 +8,6 @@
*
* $Id$
*
- *
***************************************************************************/
/***************************************************************************
@@ -24,842 +23,316 @@ define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
-include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
include($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
+include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
-//
-// Check and set various parameters
-//
-$params = array('submit' => 'post', 'confirm' => 'confirm', 'preview' => 'preview', 'delete' => 'delete', 'poll_delete' => 'poll_delete', 'poll_add' => 'add_poll_option', 'poll_edit' => 'edit_poll_option', 'mode' => 'mode', 'forum_id' => 'f', 'topic_id' => 't', 'post_id' => 'p');
-while( list($var, $param) = @each($params) )
+// Check and impose var types?
+$vars = array(
+ 'intval' => array(
+ 'forum_id' => 'f',
+ 'post_id' => 'p'
+ )
+);
+
+foreach ( $vars as $vartype => $varcheck)
{
- if ( !empty($HTTP_POST_VARS[$param]) || !empty($HTTP_GET_VARS[$param]) )
+ foreach ( $varcheck as $varname => $varparse )
{
- $$var = ( !empty($HTTP_POST_VARS[$param]) ) ? $HTTP_POST_VARS[$param] : $HTTP_GET_VARS[$param];
- }
- else
- {
- $$var = '';
+ $$varname = ( isset($_POST[$varparse]) ) ? $vartype($_POST[$varparse]) : ( ( isset($_GET[$varparse]) ) ? $vartype($_GET[$varparse]) : false );
}
}
-$refresh = $preview || $poll_add || $poll_edit || $poll_delete;
-//
-// Set topic type
-//
-$topic_type = ( !empty($HTTP_POST_VARS['topictype']) ) ? $HTTP_POST_VARS['topictype'] : POST_NORMAL;
-//
-// If the mode is set to topic review then output
-// that review ...
-//
-if ( $mode == 'topicreview' )
-{
- require($phpbb_root_path . 'includes/topic_review.'.$phpEx);
- topic_review($topic_id, false);
- exit;
-}
-else if ( $mode == 'smilies' )
-{
- generate_smilies('window', PAGE_POSTING);
- exit;
-}
+extract($_GET);
+extract($_POST);
-//
-// Was cancel pressed? If so then redirect to the appropriate
-// page, no point in continuing with any further checks
-//
-if ( isset($HTTP_POST_VARS['cancel']) )
-{
- if ( $post_id )
- {
- $redirect = "viewtopic.$phpEx$SID&p=$post_id";
- $post_append = "#$post_id";
- }
- else if ( $topic_id )
- {
- $redirect = "viewtopic.$phpEx$SID&t=$topic_id";
- $post_append = '';
- }
- else if ( $forum_id )
- {
- $redirect = "viewforum.$phpEx$SID&f=$forum_id";
- $post_append = '';
- }
- else
- {
- $redirect = "index.$phpEx$SID";
- $post_append = '';
- }
+$refresh = $preview || $poll_add || $poll_edit || $poll_delete;
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . $redirect . $post_append, true);
- exit;
-}
+// ------------------------------------------------
+// NOTE --> No data validation at present! <-- NOTE
+// ------------------------------------------------
-//
// Start session management
-//
$userdata = $session->start();
-$acl = new acl($userdata);
+$auth->acl($userdata, $f);
+$session->configure($userdata);
//
// End session management
//
-//
-// What auth type do we need to check?
-//
-$is_auth = array();
-switch( $mode )
+// Was cancel pressed? If so then redirect to the appropriate
+// page, no point in continuing with any further checks
+if ( !empty($cancel) )
{
- case 'newtopic':
- if ( $topic_type == POST_ANNOUNCE )
- {
- $is_auth_type = 'auth_announce';
- }
- else if ( $topic_type == POST_STICKY )
- {
- $is_auth_type = 'auth_sticky';
- }
- else
- {
- $is_auth_type = 'auth_post';
- }
- break;
- case 'reply':
- case 'quote':
- $is_auth_type = 'auth_reply';
- break;
- case 'editpost':
- $is_auth_type = 'auth_edit';
- break;
- case 'delete':
- case 'poll_delete':
- $is_auth_type = 'auth_delete';
- break;
- case 'vote':
- $is_auth_type = 'auth_vote';
- break;
- case 'topicreview':
- $is_auth_type = 'auth_read';
- break;
- default:
- message_die(MESSAGE, $lang['No_post_mode']);
- break;
+ $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
+ $redirect = ( $p ) ? "viewtopic.$phpEx$SID&p=$p#$p" : ( ( $t ) ? "viewtopic.$phpEx$SID&t=$t" : ( ( $f ) ? "viewforum.$phpEx$SID&f=$f" : "index.$phpEx$SID" ) );
+ header($header_location . $redirect);
+ exit;
}
-//
-// Here we do various lookups to find topic_id, forum_id, post_id etc.
-// Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id
-//
-$error_msg = '';
-$post_data = array();
-switch ( $mode )
-{
- case 'newtopic':
- if ( empty($forum_id) )
- {
- message_die(MESSAGE, $lang['Forum_not_exist']);
- }
- $sql = "SELECT *
- FROM " . FORUMS_TABLE . "
- WHERE forum_id = $forum_id";
- break;
- case 'reply':
- case 'vote':
- if ( empty( $topic_id) )
- {
- message_die(MESSAGE, $lang['No_topic_id']);
- }
- $sql = "SELECT f.*, t.topic_status
- FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
- WHERE t.topic_id = $topic_id
- AND f.forum_id = t.forum_id";
- break;
- case 'quote':
- case 'editpost':
- case 'delete':
- case 'poll_delete':
- if ( empty($post_id) )
- {
- message_die(MESSAGE, $lang['No_post_id']);
- }
- $select_sql = ( !$submit ) ? ", t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig" : '';
- $from_sql = ( !$submit ) ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : '';
- $where_sql = ( !$submit ) ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : '';
- $sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . "
- FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . "
- WHERE p.post_id = $post_id
- AND t.topic_id = p.topic_id
- AND f.forum_id = p.forum_id
- $where_sql";
- break;
- default:
- message_die(MESSAGE, $lang['No_valid_mode']);
-}
-if ( $result = $db->sql_query($sql) )
+// If the mode is set to topic review then output that review ...
+switch ( $mode )
{
- $post_info = $db->sql_fetchrow($result);
+ case 'topicreview':
+ require($phpbb_root_path . 'includes/topic_review.'.$phpEx);
+ topic_review($t, false);
+ break;
- //
- // Configure style, language, etc.
- //
- $userdata['user_style'] = ( $post_info['forum_style'] ) ? $post_info['user_style'] : $userdata['user_style'];
- $session->configure($userdata);
+ case 'smilies':
+ generate_smilies('window', PAGE_POSTING);
+ break;
+}
- $forum_id = $post_info['forum_id'];
- $forum_name = $post_info['forum_name'];
- if ( $post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod'])
- {
- message_die(MESSAGE, $lang['Forum_locked']);
- }
- else if ( $mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod'])
- {
- message_die(MESSAGE, $lang['Topic_locked']);
- }
- if ( $mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete' )
- {
- $topic_id = $post_info['topic_id'];
- $post_data['poster_post'] = ( $post_info['poster_id'] == $userdata['user_id'] ) ? true : false;
- $post_data['first_post'] = ( $post_info['topic_first_post_id'] == $post_id ) ? true : false;
- $post_data['last_post'] = ( $post_info['topic_last_post_id'] == $post_id ) ? true : false;
- $post_data['last_topic'] = ( $post_info['forum_last_post_id'] == $post_id ) ? true : false;
- $post_data['has_poll'] = ( $post_info['topic_vote'] ) ? true : false;
- $post_data['topic_type'] = $post_info['topic_type'];
- $post_data['poster_id'] = $post_info['poster_id'];
- if ( $post_data['first_post'] && $post_data['has_poll'] )
- {
- $sql = "SELECT *
- FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
- WHERE vd.topic_id = $topic_id
- AND vr.vote_id = vd.vote_id
- ORDER BY vr.vote_option_id";
- $result = $db->sql_query($sql);
-
- $poll_options = array();
- $poll_results_sum = 0;
- if ( $row = $db->sql_fetchrow($result) )
- {
- $poll_title = $row['vote_text'];
- $poll_id = $row['vote_id'];
- $poll_length = $row['vote_length'] / 86400;
-
- do
- {
- $poll_options[$row['vote_option_id']] = $row['vote_option_text'];
- $poll_results_sum += $row['vote_result'];
- }
- while ( $row = $db->sql_fetchrow($result) );
- }
-
- $post_data['edit_poll'] = ( ( !$poll_results_sum || $is_auth['auth_mod'] ) && $post_data['first_post'] ) ? true : 0;
- }
- else
- {
- $post_data['edit_poll'] = false;
- }
- //
- // Can this user edit/delete the post/poll?
- //
- if ( $post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'] )
- {
- $message = ( $delete || $mode == 'delete' ) ? $lang['Delete_own_posts'] : $lang['Edit_own_posts'];
- $message .= '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . "viewtopic.$phpEx$SID&amp;t=$topic_id" . '">', '</a>');
- message_die(MESSAGE, $message);
- }
- else if ( !$post_data['last_post'] && !$is_auth['auth_mod'] && ( $mode == 'delete' || $delete ) )
- {
- message_die(MESSAGE, $lang['Cannot_delete_replied']);
- }
- else if ( !$post_data['edit_poll'] && !$is_auth['auth_mod'] && ( $mode == 'poll_delete' || $poll_delete ) )
- {
- message_die(MESSAGE, $lang['Cannot_delete_poll']);
- }
- }
- else
- {
- if ( $mode == 'quote' )
- {
- $topic_id = $post_info['topic_id'];
- }
- $post_data['first_post'] = ( $mode == 'newtopic' ) ? true : 0;
- $post_data['last_post'] = false;
- $post_data['has_poll'] = false;
- $post_data['edit_poll'] = false;
- }
-}
-else
-{
- message_die(MESSAGE, $lang['No_such_post']);
-}
-
-//
-// The user is not authed, if they're not logged in then redirect
-// them, else show them an error message
-//
-/*
-if ( !$is_auth[$is_auth_type] )
-{
- if ( $userdata['session_logged_in'] )
- {
- message_die(MESSAGE, sprintf($lang['Sorry_' . $is_auth_type], $is_auth[$is_auth_type . "_type"]));
- }
-
- switch( $mode )
- {
- case 'newtopic':
- $redirect = "mode=newtopic&" . POST_FORUM_URL . "=" . $forum_id;
- break;
- case 'reply':
- case 'topicreview':
- $redirect = "mode=reply&" . POST_TOPIC_URL . "=" . $topic_id;
- break;
- case 'quote':
- case 'editpost':
- $redirect = "mode=quote&" . POST_POST_URL ."=" . $post_id;
- break;
- }
-
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . "login.$phpEx$SID&redirect=posting.$phpEx&" . $redirect);
- exit;
-}
-*/
-//
// Set toggles for various options
-//
-if( !$board_config['allow_html'] )
+if ( !$board_config['allow_html'] )
{
$html_on = 0;
}
else
{
- $html_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
+ $html_on = ( $post || $refresh ) ? ( ( !empty($disable_html) ) ? 0 : TRUE ) : ( ( !$userdata['user_id'] ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
}
-if( !$board_config['allow_bbcode'] )
+if ( !$board_config['allow_bbcode'] )
{
$bbcode_on = 0;
}
else
{
- $bbcode_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] );
+ $bbcode_on = ( $post || $refresh ) ? ( ( !empty($disable_bbcode) ) ? 0 : TRUE ) : ( ( !$userdata['user_id'] ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] );
}
-if( !$board_config['allow_smilies'] )
+$magic_urls_on = ( $post || $refresh ) ? ( ( !empty($disable_magic_url) ) ? 0 : TRUE ) : TRUE;
+
+if ( !$board_config['allow_smilies'] )
{
$smilies_on = 0;
}
else
{
- $smilies_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] );
+ $smilies_on = ( $post || $refresh ) ? ( ( !empty($disable_smilies) ) ? 0 : TRUE ) : ( ( !$userdata['user_id'] ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] );
}
-if ( $submit || $refresh )
-{
- $notify_user = ( !empty($HTTP_POST_VARS['notify']) ) ? TRUE : 0;
-}
-else
-{
- if ( $mode != 'newtopic' && $userdata['session_logged_in'] )
- {
- $sql = "SELECT topic_id
- FROM " . TOPICS_WATCH_TABLE . "
- WHERE topic_id = $topic_id
- AND user_id = " . $userdata['user_id'];
- $result = $db->sql_query($sql);
-
- $notify_user = ( $db->sql_fetchrow($result) ) ? TRUE : $userdata['user_notify'];
- }
- else
- {
- $notify_user = ( $userdata['session_logged_in'] ) ? $userdata['user_notify'] : 0;
- }
-}
-
-$attach_sig = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? 0 : $userdata['user_attachsig'] );
-
-// --------------------
-// What shall we do?
-//
-if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm )
-{
- //
- // Confirm deletion
- //
- $s_hidden_fields = '<input type="hidden" name="p" value="' . $post_id . '" />';
- $s_hidden_fields .= ( $delete || $mode == "delete" ) ? '<input type="hidden" name="mode" value="delete" />' : '<input type="hidden" name="mode" value="poll_delete" />';
-
- $l_confirm = ( $delete || $mode == 'delete' ) ? $lang['Confirm_delete'] : $lang['Confirm_delete_poll'];
+$attach_sig = ( $post || $refresh ) ? ( ( !empty($attach_sig) ) ? TRUE : 0 ) : ( ( !$userdata['user_id'] ) ? 0 : $userdata['user_attachsig'] );
- //
- // Output confirmation page
- //
- include($phpbb_root_path . 'includes/page_header.'.$phpEx);
- $template->set_filenames(array(
- 'body' => 'confirm_body.html')
- );
- $template->assign_vars(array(
- 'MESSAGE_TITLE' => $lang['Information'],
- 'MESSAGE_TEXT' => $l_confirm,
-
- 'L_YES' => $lang['Yes'],
- 'L_NO' => $lang['No'],
- 'S_CONFIRM_ACTION' => "posting.$phpEx$SID",
- 'S_HIDDEN_FIELDS' => $s_hidden_fields)
- );
- include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
-}
-else if ( $mode == 'vote' )
+// Create appropriate SQL for this mode ...
+switch ( $mode )
{
- //
- // Vote in a poll
- //
- if ( !empty($HTTP_POST_VARS['vote_id']) )
- {
- $vote_option_id = intval($HTTP_POST_VARS['vote_id']);
-
- $sql = "SELECT vd.vote_id
- FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
- WHERE vd.topic_id = $topic_id
- AND vr.vote_id = vd.vote_id
- AND vr.vote_option_id = $vote_option_id
- GROUP BY vd.vote_id";
- $result = $db->sql_query($sql);
-
- if ( $vote_info = $db->sql_fetchrow($result) )
- {
- $vote_id = $vote_info['vote_id'];
-
- $sql = "SELECT *
- FROM " . VOTE_USERS_TABLE . "
- WHERE vote_id = $vote_id
- AND vote_user_id = " . $userdata['user_id'];
- $result = $db->sql_query($sql);
-
- if ( !($row = $db->sql_fetchrow($result)) )
- {
- $sql = "UPDATE " . VOTE_RESULTS_TABLE . "
- SET vote_result = vote_result + 1
- WHERE vote_id = $vote_id
- AND vote_option_id = $vote_option_id";
- if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
- {
- message_die(GENERAL_ERROR, 'Could not update poll result', '', __LINE__, __FILE__, $sql);
- }
-
- $sql = "INSERT INTO " . VOTE_USERS_TABLE . " (vote_id, vote_user_id, vote_user_ip)
- VALUES ($vote_id, " . $userdata['user_id'] . ", '$user_ip')";
- if ( !$db->sql_query($sql, END_TRANSACTION) )
- {
- message_die(GENERAL_ERROR, "Could not insert user_id for poll", "", __LINE__, __FILE__, $sql);
- }
-
- $message = $lang['Vote_cast'];
- }
- else
- {
- $message = $lang['Already_voted'];
- }
- }
- else
+ case 'newtopic':
+ if ( empty($f) )
{
- $message = $lang['No_vote_option'];
+ message_die(MESSAGE, $lang['Forum_not_exist']);
}
- $template->assign_vars(array(
- 'META' => '<meta http-equiv="refresh" content="3;url=' . "viewtopic.$phpEx$SID&amp;" . POST_TOPIC_URL . "=$topic_id" . '">')
- );
- $message .= '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . "viewtopic.$phpEx$SID&amp;" . POST_TOPIC_URL . "=$topic_id" . '">', '</a>');
- message_die(MESSAGE, $message);
- }
-}
-else if ( $submit || $confirm )
-{
- //
- // Submit post/vote (newtopic, edit, reply, etc.)
- //
- $return_message = '';
- $return_meta = '';
-
- switch ( $mode )
- {
- case 'editpost':
- case 'newtopic':
- case 'reply':
- $username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : '';
- $subject = ( !empty($HTTP_POST_VARS['subject']) ) ? trim($HTTP_POST_VARS['subject']) : '';
- $message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : '';
- $poll_title = ( isset($HTTP_POST_VARS['poll_title']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_title'] : '';
- $poll_options = ( isset($HTTP_POST_VARS['poll_option_text']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_option_text'] : '';
- $poll_length = ( isset($HTTP_POST_VARS['poll_length']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_length'] : '';
- $bbcode_uid = '';
-
- prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length);
-
- if ( $error_msg == '' )
- {
- $topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type;
-
- submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
- if ( $error_msg == '' )
- user_notification($mode, $post_data, $forum_id, $topic_id, $post_id, $notify_user);
- }
- break;
-
- case 'delete':
- case 'poll_delete':
- delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id);
- break;
- }
+ $sql = "SELECT *
+ FROM " . FORUMS_TABLE . "
+ WHERE forum_id = $f";
+ break;
- if ( $error_msg == '' )
- {
- if ( $mode != 'editpost' )
+ case 'reply':
+ case 'vote':
+ if ( empty( $t) )
{
- $user_id = ( $mode == 'reply' || $mode == 'newtopic' ) ? $userdata['user_id'] : $post_data['poster_id'];
- update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
+ message_die(MESSAGE, $lang['No_topic_id']);
}
- if ( $mode == 'newtopic' || $mode == 'reply' )
- {
- $tracking_topics = ( !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
- $tracking_forums = ( !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
+ $sql = "SELECT f.*, t.*
+ FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
+ WHERE t.topic_id = $t
+ AND f.forum_id = t.forum_id";
+ break;
- if ( count($tracking_topics) + count($tracking_forums) == 100 && empty($tracking_topics[$topic_id]) )
- {
- asort($tracking_topics);
- unset($tracking_topics[key($tracking_topics)]);
- }
+ case 'quote':
+ case 'editpost':
+ case 'delete':
+ case 'poll_delete':
+ if ( empty($p) )
+ {
+ message_die(MESSAGE, $lang['No_post_id']);
+ }
- $tracking_topics[$topic_id] = time();
+ $select_sql = ( !$submit ) ? ', t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig' : ', pt.post_subject, pt.post_text';
+ $from_sql = ( !$submit ) ? ', ' . POSTS_TEXT_TABLE . ' pt, ' . USERS_TABLE . ' u' : ', ' . POSTS_TEXT_TABLE . ' pt';
+ $where_sql = ( !$submit ) ? 'AND pt.post_id = p.post_id AND u.user_id = p.poster_id' : 'AND pt.post_id = p.post_id';
- setcookie($board_config['cookie_name'] . '_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
- }
+ $sql = "SELECT f.*, t.*, p.post_id, p.poster_id" . $select_sql . "
+ FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . "
+ WHERE p.post_id = $p
+ AND t.topic_id = p.topic_id
+ AND f.forum_id = p.forum_id
+ $where_sql";
+ break;
- $template->assign_vars(array(
- "META" => $return_meta)
- );
- message_die(MESSAGE, $return_message);
- }
+ default:
+ message_die(MESSAGE, $lang['No_valid_mode']);
}
-if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' )
+if ( $result = $db->sql_query($sql) )
{
- $username = ( !empty($HTTP_POST_VARS['username']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['username']))) : '';
- $subject = ( !empty($HTTP_POST_VARS['subject']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['subject']))) : '';
- $message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';
-
- $poll_title = ( !empty($HTTP_POST_VARS['poll_title']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['poll_title']))) : '';
- $poll_length = ( isset($HTTP_POST_VARS['poll_length']) ) ? max(0, intval($HTTP_POST_VARS['poll_length'])) : 0;
+ $post_info = $db->sql_fetchrow($result);
- $poll_options = array();
- if ( !empty($HTTP_POST_VARS['poll_option_text']) )
- {
- while( list($option_id, $option_text) = @each($HTTP_POST_VARS['poll_option_text']) )
- {
- if( isset($HTTP_POST_VARS['del_poll_option'][$option_id]) )
- {
- unset($poll_options[$option_id]);
- }
- else if ( !empty($option_text) )
- {
- $poll_options[$option_id] = htmlspecialchars(trim(stripslashes($option_text)));
- }
- }
- }
+ $forum_id = $post_info['forum_id'];
+ $forum_name = $post_info['forum_name'];
- if ( isset($poll_add) && !empty($HTTP_POST_VARS['add_poll_option_text']) )
- {
- $poll_options[] = htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['add_poll_option_text'])));
- }
+ $topic_title = $post_info['topic_title'];
+ $topic_id = $post_info['topic_id'];
- if ( $mode == 'newtopic' || $mode == 'reply')
- {
- $user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : '';
- }
- else if ( $mode == 'editpost' )
- {
- $user_sig = ( $post_info['user_sig'] != '' ) ? $post_info['user_sig'] : '';
- }
- if( $preview )
- {
- $orig_word = array();
- $replacement_word = array();
- obtain_word_list($orig_word, $replacement_word);
-
- $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
- $preview_message = stripslashes(prepare_message(addslashes(unprepare_message($message)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid));
- $preview_subject = $subject;
- $preview_username = $username;
-
- //
- // Finalise processing as per viewtopic
- //
- if( !$html_on )
- {
- if( $user_sig != '' || !$userdata['user_allowhtml'] )
- {
- $user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', '&lt;\2&gt;', $user_sig);
- }
- }
+}
- if( $attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid'] )
- {
- $user_sig = bbencode_second_pass($user_sig, $userdata['user_sig_bbcode_uid']);
- }
- if( $bbcode_on )
- {
- $preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
- }
- if( !empty($orig_word) )
- {
- $preview_username = ( !empty($username) ) ? preg_replace($orig_word, $replacement_word, $preview_username) : '';
- $preview_subject = ( !empty($subject) ) ? preg_replace($orig_word, $replacement_word, $preview_subject) : '';
- $preview_message = ( !empty($preview_message) ) ? preg_replace($orig_word, $replacement_word, $preview_message) : '';
- }
+// User has submitted a post, process it
+if ( isset($post) )
+{
- if( $user_sig != '' )
- {
- $user_sig = make_clickable($user_sig);
- }
- $preview_message = make_clickable($preview_message);
+ // First check if message has changed (if editing), if not
+ // don't parse at all else ...
+ //
+ // Need to parse message, parse search words, parse polls,
+ // parse attachments, check whether forum is moderated or
+ // if msg is being saved (and if it is whether user has run
+ // out of save quota) if not topic/forum needs syncing, if
+ // replying notifications need sending as appropriate.
- if( $smilies_on )
- {
- if( $userdata['user_allowsmile'] && $user_sig != '' )
- {
- $user_sig = smilies_pass($user_sig);
- }
+ echo "\$_POST >> ";
+ print_r(htmlentities($message));
+ echo "<br /><hr /><br />\n\n";
- $preview_message = smilies_pass($preview_message);
- }
+ // Check checksum
+ if ( $mode != 'editpost' || md5($_POST['message']) != $post_info['post_checksum'] )
+ {
+ $parse_msg = new parse_message();
+ $search = new fulltext_search();
- if( $attach_sig && $user_sig != '' )
- {
- $preview_message = $preview_message . '<br /><br />_________________<br />' . $user_sig;
- }
+ $mtime = explode(' ', microtime());
+ $starttime = $mtime[1] + $mtime[0];
- $preview_message = str_replace("\n", '<br />', $preview_message);
+ $result = $parse_msg->parse($message, $html_on, $bbcode_on, $post_info['bbcode_uid'], $magic_urls_on, $smilies_on);
- $template->set_filenames(array(
- 'preview' => 'posting_preview.html')
- );
+ $mtime = explode(' ', microtime());
+ echo "<br />\nParsed [ '$result' :: " . ( $mtime[1] + $mtime[0] - $starttime ) . " ] >> ";
+// print_r(htmlentities($message));
+ print_r($message);
+ echo "<br /><hr /><br />\n\n";
- $template->assign_vars(array(
- 'TOPIC_TITLE' => $preview_subject,
- 'POST_SUBJECT' => $preview_subject,
- 'POSTER_NAME' => $preview_username,
- 'POST_DATE' => create_date($board_config['default_dateformat'], time(), $board_config['board_timezone']),
- 'MESSAGE' => $preview_message,
-
- 'L_POST_SUBJECT' => $lang['Post_subject'],
- 'L_PREVIEW' => $lang['Preview'],
- 'L_POSTED' => $lang['Posted'],
- 'L_POST' => $lang['Post'])
- );
- $template->assign_var_from_handle('POST_PREVIEW_BOX', 'preview');
- }
- else if( $error_msg != '' )
- {
- $template->set_filenames(array(
- 'reg_header' => 'error_body.html')
- );
- $template->assign_vars(array(
- 'ERROR_MESSAGE' => $error_msg)
- );
- $template->assign_var_from_handle('ERROR_BOX', 'reg_header');
+ $result = $search->add($p, $message, $post_subject, $post_info['post_text'], $post_info['post_subject']);
}
-}
-else
-{
- //
- // User default entry point
- //
- if ( $mode == 'newtopic' )
- {
- $user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : '';
- $username = ($userdata['session_logged_in']) ? $userdata['username'] : '';
- $poll_title = '';
- $poll_length = '';
- $subject = '';
- $message = '';
- }
- else if ( $mode == 'reply' )
- {
- $user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : '';
+ exit;
- $username = ( $userdata['session_logged_in'] ) ? $userdata['username'] : '';
- $subject = '';
- $message = '';
- }
- else if ( $mode == 'quote' || $mode == 'editpost' )
- {
- $subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : $post_info['post_subject'];
- $message = $post_info['post_text'];
+}
- if ( $mode == 'editpost' )
- {
- $attach_sig = ( $post_info['enable_sig'] && $post_info['user_sig'] != '' ) ? TRUE : 0;
- $user_sig = $post_info['user_sig'];
- $html_on = ( $post_info['enable_html'] ) ? true : false;
- $bbcode_on = ( $post_info['enable_bbcode'] ) ? true : false;
- $smilies_on = ( $post_info['enable_smilies'] ) ? true : false;
- }
- else
- {
- $attach_sig = ( $userdata['user_attachsig'] ) ? TRUE : 0;
- $user_sig = $userdata['user_sig'];
- }
- if ( $post_info['bbcode_uid'] != '' )
- {
- $message = preg_replace('/\:(([a-z0-9]:)?)' . $post_info['bbcode_uid'] . '/s', '', $message);
- }
- $message = str_replace('<', '&lt;', $message);
- $message = str_replace('>', '&gt;', $message);
- $message = str_replace('<br />', "\n", $message);
+// TEMPORARY :D
+$message = $post_info['post_text'];
- if ( $mode == 'quote' )
- {
- $orig_word = array();
- $replacement_word = array();
- obtain_word_list($orig_word, $replace_word);
+// Remove encoded bbcode, urls, etc.
+$match = array(
+ '#<!\-\- b \-\-><b>(.*?)</b><!\-\- b \-\->#s',
+ '#<!\-\- b \-\-><u>(.*?)</u><!\-\- b \-\->#s',
+ '#\[b:([0-9a-z]+)\](.*?)\[/b:\1\]#s',
+ '#<!\-\- b \-\-><a href="mailto:(.*?)">.*?</a><!\-\- b \-\->#',
+ '#<!\-\- b \-\-><a href="(.*?)" target="_blank">.*?</a><!\-\- b \-\->#',
+);
- $msg_date = create_date($board_config['default_dateformat'], $postrow['post_time'], $board_config['board_timezone']);
+$replace = array(
+ '[b]\1[/b]',
+ '[u]\1[/u]',
+ '[b]\2[/b]',
+ '\1',
+ '\1',
+);
- $quote_username = ( !empty($post_info['post_username']) ) ? $post_info['post_username'] : $post_info['username'];
- $message = '[quote="' . $quote_username . '"]' . $message . '[/quote]';
+$message = preg_replace($match, $replace, $message);
- if ( !empty($orig_word) )
- {
- $subject = ( !empty($subject) ) ? preg_replace($orig_word, $replace_word, $subject) : '';
- $message = ( !empty($message) ) ? preg_replace($orig_word, $replace_word, $message) : '';
- }
- if ( !preg_match('/^Re:/', $subject) && strlen($subject) > 0 )
- {
- $subject = 'Re: ' . $subject;
- }
- $mode = 'reply';
- }
- else
- {
- $username = ( $post_info['user_id'] == ANONYMOUS && !empty($post_info['post_username']) ) ? $post_info['post_username'] : '';
- }
- }
-}
-//
-// Signature toggle selection
-//
-if( $user_sig != '' )
-{
- $template->assign_block_vars('switch_signature_checkbox', array());
-}
+// -----------------------------
+// MAIN POSTING PAGE BEGINS HERE
//
-// HTML toggle selection
-//
-if ( $board_config['allow_html'] )
-{
- $html_status = $lang['HTML_is_ON'];
- $template->assign_block_vars('switch_html_checkbox', array());
-}
-else
-{
- $html_status = $lang['HTML_is_OFF'];
-}
-//
-// BBCode toggle selection
-//
-if ( $board_config['allow_bbcode'] )
+// Notify user checkbox
+if ( $post || $refresh )
{
- $bbcode_status = $lang['BBCode_is_ON'];
- $template->assign_block_vars('switch_bbcode_checkbox', array());
+ $notify_user = ( !empty($notify) ) ? TRUE : 0;
}
else
{
- $bbcode_status = $lang['BBCode_is_OFF'];
-}
+ if ( $mode != 'newtopic' && $userdata['user_id'] )
+ {
+ $sql = "SELECT topic_id
+ FROM " . TOPICS_WATCH_TABLE . "
+ WHERE topic_id = $topic_id
+ AND user_id = " . $userdata['user_id'];
+ $result = $db->sql_query($sql);
-//
-// Smilies toggle selection
-//
-if ( $board_config['allow_smilies'] )
-{
- $smilies_status = $lang['Smilies_are_ON'];
- $template->assign_block_vars('switch_smilies_checkbox', array());
-}
-else
-{
- $smilies_status = $lang['Smilies_are_OFF'];
+ $notify_user = ( $db->sql_fetchrow($result) ) ? TRUE : $userdata['user_notify'];
+ }
+ else
+ {
+ $notify_user = ( $user_id['user_id'] ) ? $userdata['user_notify'] : 0;
+ }
}
-if( !$userdata['session_logged_in'] || ( $mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS ) )
-{
- $template->assign_block_vars('switch_username_select', array());
-}
+// Generate smilies and topic icon listings
+generate_smilies('inline');
-//
-// Notify checkbox - only show if user is logged in
-//
-if ( $userdata['session_logged_in'] )
+// Topic icons
+$sql = "SELECT *
+ FROM " . ICONS_TABLE . "
+ WHERE icons_id > 1";
+$result = $db->sql_query($sql);
+
+$s_topic_icons = false;
+if ( $row = $db->sql_fetchrow($result) )
{
- if ( $mode != 'editpost' || ( $mode == 'editpost' && $post_info['poster_id'] != ANONYMOUS ) )
+ $s_topic_icons = true;
+
+ do
{
- $template->assign_block_vars('switch_notify_checkbox', array());
+ $template->assign_block_vars('topic_icon', array(
+ 'ICON_ID' => $row['icons_id'],
+ 'ICON_IMG' => $board_config['icons_path'] . '/' . $row['icons_url'],
+ 'ICON_WIDTH' => $row['icons_width'],
+ 'ICON_HEIGHT' => $row['icons_height'])
+ );
}
+ while ( $row = $db->sql_fetchrow($result) );
}
-//
-// Delete selection
-//
-if ( $mode == 'editpost' && ( ( $is_auth['auth_delete'] && $post_data['last_post'] && ( !$post_data['has_poll'] || $post_data['edit_poll'] ) ) || $is_auth['auth_mod'] ) )
-{
- $template->assign_block_vars('switch_delete_checkbox', array());
-}
-
-//
// Topic type selection
-//
$topic_type_toggle = '';
if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) )
{
- $template->assign_block_vars('switch_type_toggle', array());
-
- if( $acl->get_acl($forum_id, 'forum', 'sticky') )
+ if ( $auth->get_acl($f, 'forum', 'sticky') )
{
$topic_type_toggle .= '<input type="radio" name="topictype" value="' . POST_STICKY . '"';
if ( $post_data['topic_type'] == POST_STICKY || $topic_type == POST_STICKY )
@@ -869,7 +342,7 @@ if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] )
$topic_type_toggle .= ' /> ' . $lang['Post_Sticky'] . '&nbsp;&nbsp;';
}
- if ( $acl->get_acl($forum_id, 'forum', 'announce') )
+ if ( $auth->get_acl($f, 'forum', 'announce') )
{
$topic_type_toggle .= '<input type="radio" name="topictype" value="' . POST_ANNOUNCE . '"';
if ( $post_data['topic_type'] == POST_ANNOUNCE || $topic_type == POST_ANNOUNCE )
@@ -885,81 +358,71 @@ if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] )
}
}
-$hidden_form_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
+// HTML, BBCode, Smilies, Images and Flash status
+$html_status = ( $board_config['allow_html'] && $auth->get_acl($f, 'forum', 'html') ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
+$bbcode_status = ( $board_config['allow_bbcode'] && $auth->get_acl($f, 'forum', 'bbcode') ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF'];
+$smilies_status = ( $board_config['allow_smilies'] && $auth->get_acl($f, 'forum', 'smilies') ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];
+$img_status = ( $board_config['allow_img'] && $auth->get_acl($f, 'forum', 'img') ) ? $lang['Images_are_ON'] : $lang['Images_are_OFF'];
+$flash_status = ( $board_config['allow_flash'] && $auth->get_acl($f, 'forum', 'flash') ) ? $lang['Flash_is_ON'] : $lang['Flash_is_OFF'];
+
+// Page title/hidden fields
+$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
switch( $mode )
{
case 'newtopic':
$page_title = $lang['Post_a_new_topic'];
- $hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
+ $s_hidden_fields .= '<input type="hidden" name="f" value="' . $f . '" />';
break;
case 'reply':
$page_title = $lang['Post_a_reply'];
- $hidden_form_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />';
+ $s_hidden_fields .= '<input type="hidden" name="t" value="' . $t . '" />';
break;
case 'editpost':
$page_title = $lang['Edit_Post'];
- $hidden_form_fields .= '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />';
+ $s_hidden_fields .= '<input type="hidden" name="p" value="' . $p . '" />';
break;
}
-// Generate smilies listing for page output
-generate_smilies('inline', PAGE_POSTING);
-
-//
-// Include page header
-//
-include($phpbb_root_path . 'includes/page_header.'.$phpEx);
-
-$template->set_filenames(array(
- 'body' => 'posting_body.html',
- 'pollbody' => 'posting_poll_body.html',
- 'reviewbody' => 'posting_topic_review.html')
-);
-make_jumpbox('viewforum.'.$phpEx);
-
+// Start assigning vars for main posting page ...
$template->assign_vars(array(
'FORUM_NAME' => $forum_name,
- 'L_POST_A' => $page_title,
- 'L_POST_SUBJECT' => $lang['Post_subject'],
-
- 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;" . POST_FORUM_URL . "=$forum_id")
-);
-
-//
-// This enables the forum/topic title to be output for posting
-// but not for privmsg (where it makes no sense)
-//
-$template->assign_block_vars('switch_not_privmsg', array());
-
-//
-// Output the data to the template
-//
-$template->assign_vars(array(
+ 'TOPIC_TITLE' => ( $mode != 'newtopic' ) ? $topic_title : '',
'USERNAME' => $username,
'SUBJECT' => $subject,
'MESSAGE' => $message,
'HTML_STATUS' => $html_status,
'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>'),
'SMILIES_STATUS' => $smilies_status,
+ 'IMG_STATUS' => $img_status,
+ 'FLASH_STATUS' => $flash_status,
+ 'L_POST_A' => $page_title,
+ 'L_POST_SUBJECT' => $lang['Post_subject'],
+ 'L_VIEW_MODERATORS' => $lang['View_moderators'],
+ 'L_TOPIC_ICON' => $lang['Topic_icon'],
'L_SUBJECT' => $lang['Subject'],
'L_MESSAGE_BODY' => $lang['Message_body'],
'L_OPTIONS' => $lang['Options'],
'L_PREVIEW' => $lang['Preview'],
'L_SPELLCHECK' => $lang['Spellcheck'],
'L_SUBMIT' => $lang['Submit'],
+ 'L_SAVE' => $lang['Save'],
'L_CANCEL' => $lang['Cancel'],
'L_CONFIRM_DELETE' => $lang['Confirm_delete'],
'L_DISABLE_HTML' => $lang['Disable_HTML_post'],
'L_DISABLE_BBCODE' => $lang['Disable_BBCode_post'],
'L_DISABLE_SMILIES' => $lang['Disable_Smilies_post'],
+ 'L_DISABLE_MAGIC_URL' => $lang['Disable_magic_url'],
'L_ATTACH_SIGNATURE' => $lang['Attach_signature'],
'L_NOTIFY_ON_REPLY' => $lang['Notify'],
'L_DELETE_POST' => $lang['Delete_post'],
-
+ 'L_NONE' => $lang['None'],
+ 'L_EMPTY_MESSAGE' => $lang['Empty_message'],
+ 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'],
+ 'L_STYLES_TIP' => $lang['Styles_tip'],
'L_BBCODE_B_HELP' => $lang['bbcode_b_help'],
'L_BBCODE_I_HELP' => $lang['bbcode_i_help'],
'L_BBCODE_U_HELP' => $lang['bbcode_u_help'],
@@ -972,25 +435,7 @@ $template->assign_vars(array(
'L_BBCODE_A_HELP' => $lang['bbcode_a_help'],
'L_BBCODE_S_HELP' => $lang['bbcode_s_help'],
'L_BBCODE_F_HELP' => $lang['bbcode_f_help'],
- 'L_EMPTY_MESSAGE' => $lang['Empty_message'],
-
'L_FONT_COLOR' => $lang['Font_color'],
- 'L_COLOR_DEFAULT' => $lang['color_default'],
- 'L_COLOR_DARK_RED' => $lang['color_dark_red'],
- 'L_COLOR_RED' => $lang['color_red'],
- 'L_COLOR_ORANGE' => $lang['color_orange'],
- 'L_COLOR_BROWN' => $lang['color_brown'],
- 'L_COLOR_YELLOW' => $lang['color_yellow'],
- 'L_COLOR_GREEN' => $lang['color_green'],
- 'L_COLOR_OLIVE' => $lang['color_olive'],
- 'L_COLOR_CYAN' => $lang['color_cyan'],
- 'L_COLOR_BLUE' => $lang['color_blue'],
- 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'],
- 'L_COLOR_INDIGO' => $lang['color_indigo'],
- 'L_COLOR_VIOLET' => $lang['color_violet'],
- 'L_COLOR_WHITE' => $lang['color_white'],
- 'L_COLOR_BLACK' => $lang['color_black'],
-
'L_FONT_SIZE' => $lang['Font_size'],
'L_FONT_TINY' => $lang['font_tiny'],
'L_FONT_SMALL' => $lang['font_small'],
@@ -998,29 +443,43 @@ $template->assign_vars(array(
'L_FONT_LARGE' => $lang['font_large'],
'L_FONT_HUGE' => $lang['font_huge'],
- 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'],
- 'L_STYLES_TIP' => $lang['Styles_tip'],
-
- 'U_VIEWTOPIC' => ( $mode == 'reply' ) ? "viewtopic.$phpEx$SID&amp;m" . POST_TOPIC_URL . "=$topic_id&amp;postorder=desc" : '',
- 'U_REVIEW_TOPIC' => ( $mode == 'reply' ) ? "posting.$phpEx$SID&amp;mmode=topicreview&amp;" . POST_TOPIC_URL . "=$topic_id" : '',
+ 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=$forum_id",
+ 'U_VIEWTOPIC' => ( $mode != 'newtopic' ) ? "viewtopic.$phpEx$SID&amp;t=$topic_id" : '',
+ 'U_REVIEW_TOPIC' => ( $mode != 'newtopic' ) ? "posting.$phpEx$SID&amp;mmode=topicreview&amp;t=$topic_id" : '',
+ 'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&amp;mode=moderators&amp;f=' . $f,
+ 'S_SHOW_TOPIC_ICONS' => $s_topic_icons,
'S_HTML_CHECKED' => ( !$html_on ) ? 'checked="checked"' : '',
'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? 'checked="checked"' : '',
'S_SMILIES_CHECKED' => ( !$smilies_on ) ? 'checked="checked"' : '',
+ 'S_MAGIC_URL_CHECKED' => ( !$magic_urls_on ) ? 'checked="checked"' : '',
'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? 'checked="checked"' : '',
'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '',
+ 'S_DISPLAY_USERNAME' => ( !$userdata['user_id'] || ( $mode == 'editpost' && $post_info['post_username'] ) ) ? true : false,
+
+ 'S_SAVE_ALLOWED' => ( $auth->get_acl($f, 'forum', 'save') ) ? true : false,
+ 'S_HTML_ALLOWED' => ( $board_config['allow_html'] && $auth->get_acl($f, 'forum', 'html') ) ? true : false,
+ 'S_BBCODE_ALLOWED' => ( $board_config['allow_bbcode'] && $auth->get_acl($f, 'forum', 'bbcode') ) ? true : false,
+ 'S_SMILIES_ALLOWED' => ( $board_config['allow_smilies'] && $auth->get_acl($f, 'forum', 'smilies') ) ? true : false,
+ 'S_SIG_ALLOWED' => ( $auth->get_acl($f, 'forum', 'sigs') ) ? true : false,
+ 'S_NOTIFY_ALLOWED' => ( $userdata['user_id'] ) ? true : false,
+ 'S_DELETE_ALLOWED' => ( $mode == 'editpost' && ( ( $auth->get_acl($f, 'forum', 'delete') && $post_data['last_post'] && ( !$post_data['has_poll'] || $post_data['edit_poll'] ) ) || $auth->get_acl($f, 'mod') ) ) ? true : false,
'S_TYPE_TOGGLE' => $topic_type_toggle,
- 'S_TOPIC_ID' => $topic_id,
+
+ 'S_TOPIC_ID' => $t,
'S_POST_ACTION' => "posting.$phpEx$SID",
- 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields)
+ 'S_HIDDEN_FIELDS' => $s_hidden_fields)
);
//
-// Poll entry switch/output
+// Poll entry
//
-if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) && $is_auth['auth_pollcreate'] )
+if ( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) && $auth->get_acl($f, 'forum', 'poll') )
{
$template->assign_vars(array(
+ 'S_SHOW_POLL_BOX' => true,
+ 'S_POLL_DELETE' => ( $mode == 'editpost' && $post_data['edit_poll'] ) ? true : false,
+
'L_ADD_A_POLL' => $lang['Add_poll'],
'L_ADD_POLL_EXPLAIN' => $lang['Add_poll_explain'],
'L_POLL_QUESTION' => $lang['Poll_question'],
@@ -1037,35 +496,55 @@ if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] )
'POLL_LENGTH' => $poll_length)
);
- if( $mode == 'editpost' && $post_data['edit_poll'] )
- {
- $template->assign_block_vars('switch_poll_delete_toggle', array());
- }
-
- if( !empty($poll_options) )
+ if ( !empty($poll_options) )
{
- while( list($option_id, $option_text) = each($poll_options) )
+ foreach ( $poll_options as $option_id => $option_text )
{
- $template->assign_block_vars('poll_option_rows', array(
- 'POLL_OPTION' => str_replace('"', '&quot;', $option_text),
+ $template->assign_block_vars('poll_options', array(
+ 'POLL_OPTION' => htmlspecialchars($option_text),
'S_POLL_OPTION_NUM' => $option_id)
);
}
}
+}
+
+//
+// Attachment entry
+//
+if ( $auth->get_acl($f, 'forum', 'attach') )
+{
+ $template->assign_vars(array(
+ 'S_SHOW_ATTACH_BOX' => true,
+ 'L_ADD_ATTACHMENT' => $lang['Add_attach'],
+ 'L_ADD_ATTACHMENT_EXPLAIN' => $lang['Add_attach_explain'],
- $template->assign_var_from_handle('POLLBOX', 'pollbody');
+ 'L_ADD_FILE' => $lang['Add_file'],
+ 'L_FILE_NAME' => $lang['Filename'],
+ 'L_FILE_COMMENT' => $lang['File_comment'],)
+ );
}
//
+// Output page ...
+//
+include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+
+
+$template->set_filenames(array(
+ 'body' => 'posting_body.html',
+ 'reviewbody' => 'posting_topic_review.html')
+);
+make_jumpbox('viewforum.'.$phpEx);
+
+//
// Topic review
//
-if( $mode == 'reply' )
+if ( $mode == 'reply' )
{
require($phpbb_root_path . 'includes/topic_review.'.$phpEx);
- topic_review($topic_id, true);
+ topic_review($t, true);
- $template->assign_block_vars('switch_inline_mode', array());
$template->assign_var_from_handle('TOPIC_REVIEW_BOX', 'reviewbody');
}
diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php
index 830fea47e3..8beee81fae 100644
--- a/phpBB/privmsg.php
+++ b/phpBB/privmsg.php
@@ -82,7 +82,7 @@ if ( $cancel )
// Start session management
//
$userdata = $session->start();
-$acl = new acl($userdata);
+$auth->acl($userdata);
//
// End session management
//
diff --git a/phpBB/profile.php b/phpBB/profile.php
index 3c82036e64..7a17ac4d91 100644
--- a/phpBB/profile.php
+++ b/phpBB/profile.php
@@ -29,7 +29,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management
//
$userdata = $session->start();
-$acl = new acl($userdata);
+$auth->acl($userdata);
//
// End session management
//
diff --git a/phpBB/search.php b/phpBB/search.php
index 0ff128a37e..61e1ebef75 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -30,7 +30,7 @@ include($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
// Start session management
//
$userdata = $session->start();
-$acl = new acl($userdata, false, 'read');
+$auth->acl($userdata);
//
// End session management
//
@@ -121,16 +121,7 @@ $sort_by_types = array($lang['Sort_Time'], $lang['Sort_Post_Subject'], $lang['So
//
// Begin core code
//
-if ( $mode == 'searchuser' )
-{
- //
- // This handles the simple windowed user search functions called from various other scripts
- //
- username_search();
-
- exit;
-}
-else if ( $search_keywords != '' || $search_author != '' || $search_id )
+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');
@@ -143,11 +134,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{
if ( $search_id == 'newposts' )
{
- if ( $userdata['session_logged_in'] )
+ if ( $userdata['user_id'] )
{
$sql = "SELECT post_id
FROM " . POSTS_TABLE . "
- WHERE post_time >= " . $userdata['user_lastvisit'];
+ WHERE post_time >= " . $userdata['session_last_visit'];
}
else
{
@@ -184,10 +175,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$sql = "SELECT user_id
FROM " . USERS_TABLE . "
WHERE username LIKE '" . str_replace("\'", "''", $search_author) . "'";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(ERROR, "Couldn't obtain list of matching users (searching for: $search_author)", "", __LINE__, __FILE__, $sql);
- }
+ $result = $db->sql_query($sql);
$matching_userids = '';
if ( $row = $db->sql_fetchrow($result) )
@@ -336,12 +324,12 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$auth_sql = '';
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']);
}
- $auth_sql = "f.forum_id = $search_forum";
+// $auth_sql = "f.forum_id = $search_forum";
}
else
{
@@ -349,8 +337,8 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{
$auth_sql = "f.cat_id = $search_cat";
}
-
- $auth_ary = $acl->get_acl();
+/*
+ $auth_ary = $auth->get_acl();
@reset($auth_ary);
$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) ";
- }
+*/ }
//
// Author name search
@@ -415,7 +403,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_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);
}
@@ -455,7 +443,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$sql = "SELECT p.post_id
FROM $from_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);
}
@@ -490,7 +478,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
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);
}
@@ -650,7 +638,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
}
$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);
}
@@ -673,22 +661,6 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
//
// 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);
@@ -728,9 +700,9 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
for($i = 0; $i < count($searchset); $i++)
{
- $forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $searchset[$i]['forum_id']);
- $topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $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'];
+ $forum_url = "viewforum.$phpEx$SID&amp;f=" . $searchset[$i]['forum_id'];
+ $topic_url = "viewtopic.$phpEx$SID&amp;t=" . $searchset[$i]['topic_id'] . "&amp;highlight=$highlight_active";
+ $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']);
@@ -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'] != ANONYMOUS ) ? $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 href="' . "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $searchset[$i]['user_id'] . '">' : '';
+ $poster .= ( $searchset[$i]['user_id'] ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != "" ) ? $searchset[$i]['post_username'] : $lang['Guest'] );
+ $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]) )
{
@@ -966,7 +938,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$times = 1;
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 )
{
$goto_page .= ' ... ';
@@ -1027,7 +999,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
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']) )
{
@@ -1063,7 +1035,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$folder_image = $folder_new;
$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
{
@@ -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_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
{
@@ -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'] != ANONYMOUS ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != '' ) ? $searchset[$i]['post_username'] : $lang['Guest'] );
+ $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'] ) ? $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']);
$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(
'FORUM_NAME' => $searchset[$i]['forum_name'],
@@ -1164,7 +1136,13 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
'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);
}
@@ -1186,7 +1164,7 @@ $result = $db->sql_query($sql);
$s_forums = '';
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>';
if ( empty($list_cat[$row['cat_id']]) )
@@ -1295,203 +1273,4 @@ make_jumpbox('viewforum.'.$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;
-}
-
?> \ No newline at end of file
diff --git a/phpBB/templates/subSilver/posting_poll_body.html b/phpBB/templates/subSilver/posting_poll_body.html
index 4391393208..165b57e5a5 100644
--- a/phpBB/templates/subSilver/posting_poll_body.html
+++ b/phpBB/templates/subSilver/posting_poll_body.html
@@ -1,4 +1,3 @@
-
<tr>
<th class="thHead" colspan="2">{L_ADD_A_POLL}</th>
</tr>
@@ -23,9 +22,9 @@
<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>
</tr>
- <!-- BEGIN switch_poll_delete_toggle -->
+ <!-- IF S_POLL_DELETE -->
<tr>
<td class="row1"><span class="gen"><b>{L_POLL_DELETE}</b></span></td>
<td class="row2"><input type="checkbox" name="poll_delete" /></td>
</tr>
- <!-- END switch_poll_delete_toggle -->
+ <!-- ENDIF --> \ No newline at end of file
diff --git a/phpBB/templates/subSilver/posting_smilies.html b/phpBB/templates/subSilver/posting_smilies.html
index 7028535c49..583bfca64b 100644
--- a/phpBB/templates/subSilver/posting_smilies.html
+++ b/phpBB/templates/subSilver/posting_smilies.html
@@ -1,8 +1,10 @@
+<!-- INCLUDE simple_header.html -->
<script language="javascript" type="text/javascript">
<!--
function emoticon(text) {
text = ' ' + text + ' ';
+
if (opener.document.forms['post'].message.createTextRange && 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;
@@ -15,27 +17,14 @@ function emoticon(text) {
//-->
</script>
-<table width="100%" border="0" cellspacing="0" cellpadding="10">
+<table width="100%" cellspacing="0" cellpadding="10" border="0">
<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>
<th class="thHead" height="25">{L_EMOTICONS}</th>
</tr>
<tr>
- <td><table width="100" border="0" cellspacing="0" cellpadding="5">
- <!-- 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>
+ <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>
</tr>
<tr>
<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>
</tr>
</table>
+
+<!-- INCLUDE simple_footer.html --> \ No newline at end of file
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index cd7defe107..f32d2b96e2 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -54,7 +54,7 @@ $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) :
// Start session management
//
$userdata = $session->start();
-$acl = new acl($userdata, $forum_id);
+$auth->acl($userdata, $forum_id);
//
// End session management
//
@@ -83,7 +83,7 @@ $session->configure($userdata);
//
// Auth check
//
-if (!$acl->get_acl($forum_id, 'forum', 'read'))
+if (!$auth->get_acl($forum_id, 'forum', 'read'))
{
if ( $userdata['user_id'] )
{
@@ -155,7 +155,7 @@ foreach ($forum_branch as $row)
}
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;
}
@@ -195,7 +195,7 @@ if ( $mark_read == 'topics' )
//
// 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'] )
{
diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php
index 5df863843c..89ae2fe2f6 100644
--- a/phpBB/viewonline.php
+++ b/phpBB/viewonline.php
@@ -24,19 +24,11 @@ $phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
-//
// Start session management
-//
$userdata = $session->start();
-$acl = new acl($userdata);
-//
+$auth->acl($userdata);
+$user = new user($userdata);
// End session management
-//
-
-//
-// Configure style, language, etc.
-//
-$session->configure($userdata);
//
// Forum info
@@ -88,7 +80,7 @@ while ( $row = $db->sql_fetchrow($result) )
if ( !$row['user_allow_viewonline'] )
{
- $view_online = ( $acl->get_acl_admin() ) ? true : false;
+ $view_online = ( $auth->get_acl_admin() ) ? true : false;
$hidden_users++;
$username = '<i>' . $username . '</i>';
@@ -136,7 +128,7 @@ while ( $row = $db->sql_fetchrow($result) )
preg_match('/f=([0-9]+)/', $row['session_page'], $forum_id);
$forum_id = $forum_id[1];
- if ( $acl->get_acl($forum_id, 'forum' , 'list') )
+ if ( $auth->get_acl($forum_id, 'forum' , 'list') )
{
$location = '';
switch ( $on_page[1] )
@@ -193,7 +185,7 @@ while ( $row = $db->sql_fetchrow($result) )
$template->assign_block_vars("$which_row", array(
'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,
'S_ROW_COUNT' => $$which_counter,
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index fdd337e760..76a4cd7f2a 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -161,12 +161,12 @@ if ( !(extract($db->sql_fetchrow($result))) )
$userdata['user_style'] = ( $forum_style ) ? $forum_style : $userdata['user_style'];
$session->configure($userdata);
-$acl = new acl($userdata, $forum_id);
+$auth->acl($userdata, $forum_id);
//
// Start auth check
//
-if ( !$acl->get_acl($forum_id, 'forum', 'read') )
+if ( !$auth->get_acl($forum_id, 'forum', 'read') )
{
if ( $userdata['user_id'] != ANONYMOUS )
{
@@ -343,11 +343,11 @@ $s_forum_rules = '';
get_forum_rules('topic', $s_forum_rules, $forum_id);
$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 .= ( $acl->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 .= ( $acl->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', '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', 'delete') ) ? '<option value="delete">' . $lang['Delete_topic'] . '</option>' : '';
+$topic_mod .= ( $auth->get_acl($forum_id, 'mod', 'move') ) ? '<option value="move">' . $lang['Move_topic'] . '</option>' : '';
+$topic_mod .= ( $auth->get_acl($forum_id, 'mod', 'split') ) ? '<option value="split">' . $lang['Split_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.
@@ -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;
- 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;
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'] = '<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'];
@@ -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'] = ( $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';
$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 = '<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'];
$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 = '';
}
- 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;
$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 = '';
}
- 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'];
$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
// 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);
}
@@ -838,7 +838,7 @@ if ( $row = $db->sql_fetchrow($result) )
//
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'] )
@@ -933,7 +933,7 @@ if ( $row = $db->sql_fetchrow($result) )
$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);
}
@@ -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_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);
}
- $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']);