diff --git a/phpBB/admin/admin_ban.php b/phpBB/admin/admin_ban.php
index bd4c9775d1..058e32102f 100644
--- a/phpBB/admin/admin_ban.php
+++ b/phpBB/admin/admin_ban.php
@@ -21,9 +21,9 @@
define('IN_PHPBB', 1);
-if( !empty($setmodules) )
+if(!empty($setmodules))
{
- if ( !$auth->acl_get('a_ban') )
+ if (!$auth->acl_get('a_ban'))
{
return;
}
@@ -42,15 +42,15 @@ require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
// Do we have ban permissions?
-if ( !$auth->acl_get('a_ban') )
+if (!$auth->acl_get('a_ban'))
{
- return;
+ trigger_error($user->lang['NO_ADMIN']);
}
// Mode setting
-if ( isset($_POST['mode']) || isset($_GET['mode']) )
+if (isset($_POST['mode']) || isset($_GET['mode']))
{
- $mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : $_GET['mode'];
+ $mode = (isset($_POST['mode'])) ? $_POST['mode'] : $_GET['mode'];
}
else
{
@@ -60,19 +60,19 @@ else
$current_time = time();
// Start program
-if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
+if (isset($_POST['bansubmit']) || isset($_GET['bansubmit']))
{
- $ban = ( !empty($_POST['ban']) ) ? $_POST['ban'] : $_GET['ban'];
+ $ban = (!empty($_POST['ban'])) ? $_POST['ban'] : $_GET['ban'];
$ban_list = array_unique(explode("\n", $ban));
$ban_list_log = implode(', ', $ban_list);
- $ban_reason = ( isset($_POST['banreason']) ) ? $_POST['banreason'] : '';
+ $ban_reason = (isset($_POST['banreason'])) ? $_POST['banreason'] : '';
- if ( !empty($_POST['banlength']) )
+ if (!empty($_POST['banlength']))
{
- if ( $_POST['banlength'] != -1 || empty($_POST['banlengthother']) )
+ if ($_POST['banlength'] != -1 || empty($_POST['banlengthother']))
{
- $ban_end = max($current_time, $current_time + ( intval($_POST['banlength']) * 60 ));
+ $ban_end = max($current_time, $current_time + (intval($_POST['banlength']) * 60));
}
else
{
@@ -87,7 +87,7 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
$banlist = array();
- switch ( $mode )
+ switch ($mode)
{
case 'user':
$type = 'ban_userid';
@@ -95,7 +95,7 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
$banlist_tmp = array();
for($i = 0; $i < count($ban_list); $i++)
{
- if ( trim($ban_list[$i]) != '' )
+ if (trim($ban_list[$i]) != '')
{
$banlist_tmp[] = '\'' . trim($ban_list[$i]) . '\'';
}
@@ -106,13 +106,13 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
WHERE username IN (" . implode(', ', $banlist_tmp) . ")";
$result = $db->sql_query($sql);
- if ( $row = $db->sql_fetchrow($result) )
+ if ($row = $db->sql_fetchrow($result))
{
do
{
$banlist[] = $row['user_id'];
}
- while ( $row = $db->sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
}
unset($banlist_tmp);
break;
@@ -122,18 +122,18 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
for($i = 0; $i < count($ban_list); $i++)
{
- if ( preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', trim($ban_list[$i]), $ip_range_explode) )
+ if (preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', trim($ban_list[$i]), $ip_range_explode))
{
// Don't ask about all this, just don't ask ... !
$ip_1_counter = $ip_range_explode[1];
$ip_1_end = $ip_range_explode[5];
- while ( $ip_1_counter <= $ip_1_end )
+ while ($ip_1_counter <= $ip_1_end)
{
- $ip_2_counter = ( $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[2] : 0;
+ $ip_2_counter = ($ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[2] : 0;
$ip_2_end = ($ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[6];
- if( $ip_2_counter == 0 && $ip_2_end == 254 )
+ if($ip_2_counter == 0 && $ip_2_end == 254)
{
$ip_2_counter = 256;
$ip_2_fragment = 256;
@@ -141,12 +141,12 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
$banlist[] = "'$ip_1_counter.*'";
}
- while ( $ip_2_counter <= $ip_2_end )
+ while ($ip_2_counter <= $ip_2_end)
{
- $ip_3_counter = ( $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[3] : 0;
+ $ip_3_counter = ($ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[3] : 0;
$ip_3_end = ($ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[7];
- if ( $ip_3_counter == 0 && $ip_3_end == 254 )
+ if ($ip_3_counter == 0 && $ip_3_end == 254)
{
$ip_3_counter = 256;
$ip_3_fragment = 256;
@@ -154,12 +154,12 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
$banlist[] = "'$ip_1_counter.$ip_2_counter.*'";
}
- while ( $ip_3_counter <= $ip_3_end )
+ while ($ip_3_counter <= $ip_3_end)
{
- $ip_4_counter = ( $ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[4] : 0;
+ $ip_4_counter = ($ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[4] : 0;
$ip_4_end = ($ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end) ? 254 : $ip_range_explode[8];
- if ( $ip_4_counter == 0 && $ip_4_end == 254 )
+ if ($ip_4_counter == 0 && $ip_4_end == 254)
{
$ip_4_counter = 256;
$ip_4_fragment = 256;
@@ -167,7 +167,7 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
$banlist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.*'";
}
- while ( $ip_4_counter <= $ip_4_end )
+ while ($ip_4_counter <= $ip_4_end)
{
$banlist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter'";
$ip_4_counter++;
@@ -179,19 +179,19 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
$ip_1_counter++;
}
}
- else if ( preg_match('/^([\w\-_]\.?){2,}$/is', trim($ban_list[$i])) )
+ else if (preg_match('/^([\w\-_]\.?){2,}$/is', trim($ban_list[$i])))
{
$ip = gethostbynamel(trim($ban_list[$i]));
for($j = 0; $j < count($ip); $j++)
{
- if ( !empty($ip[$j]) )
+ if (!empty($ip[$j]))
{
$banlist[] = '\'' . $ip[$j] . '\'';
}
}
}
- else if ( preg_match('/^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$/', trim($ban_list[$i])) || preg_match('/^[a-f0-9:]+\*?$/i', trim($ban_list[$i])) )
+ else if (preg_match('/^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$/', trim($ban_list[$i])) || preg_match('/^[a-f0-9:]+\*?$/i', trim($ban_list[$i])))
{
$banlist[] = '\'' . trim($ban_list[$i]) . '\'';
}
@@ -206,7 +206,7 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
// This ereg match is based on one by php@unreelpro.com
// contained in the annotated php manual at php.com (ereg
// section)
- if ( eregi('^(([[:alnum:]\*]+([-_.][[:alnum:]\*]+)*\.?)|(\*))@([[:alnum:]]+([-_]?[[:alnum:]]+)*\.){1,3}([[:alnum:]]{2,6})$', trim($ban_list[$i])) )
+ if (eregi('^(([[:alnum:]\*]+([-_.][[:alnum:]\*]+)*\.?)|(\*))@([[:alnum:]]+([-_]?[[:alnum:]]+)*\.){1,3}([[:alnum:]]{2,6})$', trim($ban_list[$i])))
{
$banlist[] = '\'' . trim($ban_list[$i]) . '\'';
}
@@ -219,12 +219,12 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
WHERE $type <> ''";
$result = $db->sql_query($sql);
- if ( $row = $db->sql_fetchrow($result) )
+ if ($row = $db->sql_fetchrow($result))
{
$banlist_tmp = array();
do
{
- switch ( $mode )
+ switch ($mode)
{
case 'user':
$banlist_tmp[] = $row['ban_userid'];
@@ -239,13 +239,13 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
break;
}
}
- while ( $row = $db->sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
$banlist = array_unique(array_diff($banlist, $banlist_tmp));
unset($banlist_tmp);
}
- if ( sizeof($banlist) )
+ if (sizeof($banlist))
{
for($i = 0; $i < count($banlist); $i++)
{
@@ -255,7 +255,7 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
}
$sql = '';
- switch ( $mode )
+ switch ($mode)
{
case 'user':
$sql = "WHERE session_user_id IN (" . implode(', ', $banlist) . ")";
@@ -272,20 +272,20 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
$result = $db->sql_query($sql);
$sql = '';
- if ( $row = $db->sql_fetchrow($result) )
+ if ($row = $db->sql_fetchrow($result))
{
do
{
- $sql .= ( ( $sql != '' ) ? ', ' : '' ) . $row['user_id'];
+ $sql .= (($sql != '') ? ', ' : '') . $row['user_id'];
}
- while ( $row = $db->sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
$sql = "WHERE session_user_id IN (" . str_replace('*', '%', $sql) . ")";
}
break;
}
- if ( $sql != '' )
+ if ($sql != '')
{
$sql = "DELETE FROM " . SESSIONS_TABLE . "
$sql";
@@ -302,15 +302,15 @@ if ( isset($_POST['bansubmit']) || isset($_GET['bansubmit']) )
message_die(MESSAGE, $message);
}
-else if ( isset($_POST['unbansubmit']) )
+else if (isset($_POST['unbansubmit']))
{
$unban_sql = '';
- for($i = 0; $i < count($_POST['unban']); $i++ )
+ for($i = 0; $i < count($_POST['unban']); $i++)
{
- $unban_sql .= ( ( $unban_sql != '' ) ? ', ' : '' ) . intval($_POST['unban'][$i]);
+ $unban_sql .= (($unban_sql != '') ? ', ' : '') . intval($_POST['unban'][$i]);
}
- if ( $unban_sql != '' )
+ if ($unban_sql != '')
{
$sql = "DELETE FROM " . BANLIST_TABLE . "
WHERE ban_id IN ($unban_sql)";
@@ -340,7 +340,7 @@ $db->sql_query($sql);
$ban_end_text = array(0 => $user->lang['Permanent'], 30 => $user->lang['30_Mins'], 60 => $user->lang['1_Hour'], 360 => $user->lang['6_Hours'], 1440 => $user->lang['1_Day'], 10080 => $user->lang['7_Days'], 20160 => $user->lang['2_Weeks'], 40320 => $user->lang['1_Month'], -1 => $user->lang['Other']);
$ban_end_options = '';
-foreach ( $ban_end_text as $length => $text )
+foreach ($ban_end_text as $length => $text)
{
$ban_end_options .= '';
}
@@ -348,7 +348,7 @@ foreach ( $ban_end_text as $length => $text )
//
// Title
//
-switch ( $mode )
+switch ($mode)
{
case 'user':
$l_title = $user->lang['Ban_users'];
@@ -372,13 +372,13 @@ page_header($l_title);
= " . time() . "
- OR b.ban_end = 0 )
+ WHERE (b.ban_end >= " . time() . "
+ OR b.ban_end = 0)
AND u.user_id = b.ban_userid
AND b.ban_userid <> 0
AND u.user_id <> " . ANONYMOUS . "
@@ -388,15 +388,15 @@ switch ( $mode )
$banned_options = '';
$banned_length = '';
$banned_options = '';
- if ( $row = $db->sql_fetchrow($result) )
+ if ($row = $db->sql_fetchrow($result))
{
do
{
$banned_options .= '';
- $banned_length .= ( ( $banned_length != '' ) ? ', ' : '' ) . '\'' . ( $ban_end_text[(($row['ban_end'] - $row['ban_start']) / 60)] ) . '\'';
- $banned_reasons .= ( ( $banned_reasons != '' ) ? ', ' : '' ) . '\'' . addslashes($row['ban_reason']) . '\'';
+ $banned_length .= (($banned_length != '') ? ', ' : '') . '\'' . ($ban_end_text[(($row['ban_end'] - $row['ban_start']) / 60)]) . '\'';
+ $banned_reasons .= (($banned_reasons != '') ? ', ' : '') . '\'' . addslashes($row['ban_reason']) . '\'';
}
- while ( $row = $db->sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
@@ -414,23 +414,23 @@ switch ( $mode )
$sql = "SELECT *
FROM " . BANLIST_TABLE . "
- WHERE ( ban_end >= " . time() . "
- OR ban_end = 0 )
+ WHERE (ban_end >= " . time() . "
+ OR ban_end = 0)
AND ban_ip <> ''";
$result = $db->sql_query($sql);
$banned_reasons = '';
$banned_length = '';
$banned_options = '';
- if ( $row = $db->sql_fetchrow($result) )
+ if ($row = $db->sql_fetchrow($result))
{
do
{
$banned_options .= '';
- $banned_length .= ( ( $banned_length != '' ) ? ', ' : '' ) . '\'' . ( $ban_end_text[(($row['ban_end'] - $row['ban_start']) / 60)] ) . '\'';
- $banned_reasons .= ( ( $banned_reasons != '' ) ? ', ' : '' ) . '\'' . addslashes($row['ban_reason']) . '\'';
+ $banned_length .= (($banned_length != '') ? ', ' : '') . '\'' . ($ban_end_text[(($row['ban_end'] - $row['ban_start']) / 60)]) . '\'';
+ $banned_reasons .= (($banned_reasons != '') ? ', ' : '') . '\'' . addslashes($row['ban_reason']) . '\'';
}
- while ( $row = $db->sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
@@ -448,23 +448,23 @@ switch ( $mode )
$sql = "SELECT *
FROM " . BANLIST_TABLE . "
- WHERE ( ban_end >= " . time() . "
- OR ban_end = 0 )
+ WHERE (ban_end >= " . time() . "
+ OR ban_end = 0)
AND ban_email <> ''";
$result = $db->sql_query($sql);
$banned_options = '';
$banned_length = '';
$banned_options = '';
- if ( $row = $db->sql_fetchrow($result) )
+ if ($row = $db->sql_fetchrow($result))
{
do
{
$banned_options .= '';
- $banned_length .= ( ( $banned_length != '' ) ? ', ' : '' ) . '\'' . ( $ban_end_text[(($row['ban_end'] - $row['ban_start']) / 60)] ) . '\'';
- $banned_reasons .= ( ( $banned_reasons != '' ) ? ', ' : '' ) . '\'' . addslashes($row['ban_reason']) . '\'';
+ $banned_length .= (($banned_length != '') ? ', ' : '') . '\'' . ($ban_end_text[(($row['ban_end'] - $row['ban_start']) / 60)]) . '\'';
+ $banned_reasons .= (($banned_reasons != '') ? ', ' : '') . '\'' . addslashes($row['ban_reason']) . '\'';
}
- while ( $row = $db->sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
@@ -509,7 +509,7 @@ switch ( $mode )
|
- |
+ |
@@ -524,7 +524,7 @@ switch ( $mode )
@@ -545,7 +545,7 @@ switch ( $mode )
?>
- |
+ |
diff --git a/phpBB/admin/admin_board.php b/phpBB/admin/admin_board.php
index 0656654d77..099514f680 100644
--- a/phpBB/admin/admin_board.php
+++ b/phpBB/admin/admin_board.php
@@ -19,45 +19,68 @@
*
***************************************************************************/
-if ( !empty($setmodules) )
+if (!empty($setmodules))
{
- if ( !$auth->acl_get('a_general') )
- {
- return;
- }
-
$file = basename(__FILE__);
- $module['General']['Avatar_settings'] = "$file$SID&mode=avatar";
- $module['General']['Cookie_settings'] = "$file$SID&mode=cookie";
- $module['General']['Board_defaults'] = "$file$SID&mode=default";
- $module['General']['Board_settings'] = "$file$SID&mode=setting";
- $module['General']['Email_settings'] = "$file$SID&mode=email";
- $module['General']['Server_settings'] = "$file$SID&mode=server";
- $module['General']['Auth_settings'] = "$file$SID&mode=auth";
+ $module['General']['Cookie_settings'] = ($auth->acl_get('a_cookies')) ? "$file$SID&mode=cookie" : '';
+ $module['General']['Board_defaults'] = ($auth->acl_get('a_defaults')) ? "$file$SID&mode=default" : '';
+ $module['General']['Board_settings'] = ($auth->acl_get('a_board')) ? "$file$SID&mode=setting" : '';
+ $module['General']['Avatar_settings'] = ($auth->acl_get('a_board')) ? "$file$SID&mode=avatar" : '';
+ $module['General']['Email_settings'] = ($auth->acl_get('a_server')) ? "$file$SID&mode=email" : '';
+ $module['General']['Server_settings'] = ($auth->acl_get('a_server')) ? "$file$SID&mode=server" : '';
+ $module['General']['Auth_settings'] = ($auth->acl_get('a_server')) ? "$file$SID&mode=auth" : '';
return;
}
-// Let's set the root dir for phpBB
define('IN_PHPBB', 1);
+// Load default header
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
-// Are we authed?
-if ( !$auth->acl_get('a_general') )
+// Get mode
+$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : '';
+
+// Check permissions/set title
+switch ($mode)
{
- trigger_error($user->lang['No_admin']);
+ case 'cookie':
+ $l_title = 'Cookie_settings';
+ $which_auth = 'a_cookies';
+ break;
+ case 'default':
+ $l_title = 'Board_defaults';
+ $which_auth = 'a_defaults';
+ break;
+ case 'avatar':
+ $l_title = 'Avatar_settings';
+ $which_auth = 'a_board';
+ break;
+ case 'setting':
+ $l_title = 'Board_settings';
+ $which_auth = 'a_board';
+ break;
+ case 'email':
+ $l_title = 'Email_settings';
+ $which_auth = 'a_server';
+ break;
+ case 'server':
+ $l_title = 'Server_settings';
+ $which_auth = 'a_server';
+ break;
+ case 'auth':
+ $l_title = 'Auth_settings';
+ $which_auth = 'a_server';
+ break;
+ default:
+ return;
}
-// Get mod
-if ( isset($_POST['mode']) || isset($_GET['mode']) )
+// Check permissions
+if (!$auth->acl_get($which_acl))
{
- $mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : $_GET['mode'];
-}
-else
-{
- $mode = '';
+ trigger_error($user->lang['NO_ADMIN']);
}
// Pull all config data
@@ -65,15 +88,15 @@ $sql = "SELECT *
FROM " . CONFIG_TABLE;
$result = $db->sql_query($sql);
-while ( $row = $db->sql_fetchrow($result) )
+while ($row = $db->sql_fetchrow($result))
{
$config_name = $row['config_name'];
$config_value = $row['config_value'];
$default_config[$config_name] = $config_value;
- $new[$config_name] = ( isset($_POST[$config_name]) ) ? $_POST[$config_name] : $default_config[$config_name];
+ $new[$config_name] = (isset($_POST[$config_name])) ? $_POST[$config_name] : $default_config[$config_name];
- if ( isset($_POST['submit']) )
+ if (isset($_POST['submit']))
{
$sql = "UPDATE " . CONFIG_TABLE . " SET
config_value = '" . str_replace("\'", "''", $new[$config_name]) . "'
@@ -82,7 +105,7 @@ while ( $row = $db->sql_fetchrow($result) )
}
}
-if ( isset($_POST['submit']) )
+if (isset($_POST['submit']))
{
// Re-cache config data
config_config($new);
@@ -91,39 +114,6 @@ if ( isset($_POST['submit']) )
trigger_error($user->lang['Config_updated']);
}
-//
-// Which title?
-//
-switch ( $mode )
-{
- case 'cookie':
- $l_title = 'Cookie_settings';
- break;
- case 'avatar':
- $l_title = 'Avatar_settings';
- break;
- case 'default':
- $l_title = 'Board_defaults';
- break;
- case 'setting':
- $l_title = 'Board_settings';
- break;
- case 'email':
- $l_title = 'Email_settings';
- break;
- case 'server':
- $l_title = 'Server_settings';
- break;
- case 'login':
- $l_title = 'Server_settings';
- break;
- case 'auth':
- $l_title = 'Auth_settings';
- break;
- default:
- return;
-}
-
page_header($user->lang[$l_title]);
?>
@@ -141,12 +131,12 @@ page_header($user->lang[$l_title]);
//
// Output relevant page
//
-switch ( $mode )
+switch ($mode)
{
case 'cookie':
- $cookie_secure_yes = ( $new['cookie_secure'] ) ? 'checked="checked"' : '';
- $cookie_secure_no = ( !$new['cookie_secure'] ) ? 'checked="checked"' : '';
+ $cookie_secure_yes = ($new['cookie_secure']) ? 'checked="checked"' : '';
+ $cookie_secure_no = (!$new['cookie_secure']) ? 'checked="checked"' : '';
?>
@@ -171,12 +161,12 @@ switch ( $mode )
case 'avatar':
- $avatars_local_yes = ( $new['allow_avatar_local'] ) ? 'checked="checked"' : '';
- $avatars_local_no = ( !$new['allow_avatar_local'] ) ? 'checked="checked"' : '';
- $avatars_remote_yes = ( $new['allow_avatar_remote'] ) ? 'checked="checked"' : '';
- $avatars_remote_no = ( !$new['allow_avatar_remote'] ) ? 'checked="checked"' : '';
- $avatars_upload_yes = ( $new['allow_avatar_upload'] ) ? 'checked="checked"' : '';
- $avatars_upload_no = ( !$new['allow_avatar_upload'] ) ? 'checked="checked"' : '';
+ $avatars_local_yes = ($new['allow_avatar_local']) ? 'checked="checked"' : '';
+ $avatars_local_no = (!$new['allow_avatar_local']) ? 'checked="checked"' : '';
+ $avatars_remote_yes = ($new['allow_avatar_remote']) ? 'checked="checked"' : '';
+ $avatars_remote_no = (!$new['allow_avatar_remote']) ? 'checked="checked"' : '';
+ $avatars_upload_yes = ($new['allow_avatar_upload']) ? 'checked="checked"' : '';
+ $avatars_upload_no = (!$new['allow_avatar_upload']) ? 'checked="checked"' : '';
?>
@@ -217,29 +207,29 @@ switch ( $mode )
$lang_select = language_select($new['default_lang'], 'default_lang', '../language');
$timezone_select = tz_select($new['board_timezone'], 'board_timezone');
- $override_user_style_yes = ( $new['override_user_style'] ) ? 'checked="checked"' : '';
- $override_user_style_no = ( !$new['override_user_style'] ) ? 'checked="checked"' : '';
+ $override_user_style_yes = ($new['override_user_style']) ? 'checked="checked"' : '';
+ $override_user_style_no = (!$new['override_user_style']) ? 'checked="checked"' : '';
- $topic_notify_yes = ( $new['allow_topic_notify'] ) ? 'checked="checked"' : '';
- $topic_notify_no = ( !$new['allow_topic_notify'] ) ? 'checked="checked"' : '';
+ $topic_notify_yes = ($new['allow_topic_notify']) ? 'checked="checked"' : '';
+ $topic_notify_no = (!$new['allow_topic_notify']) ? 'checked="checked"' : '';
- $forum_notify_yes = ( $new['allow_forum_notify'] ) ? 'checked="checked"' : '';
- $forum_notify_no = ( !$new['allow_forum_notify'] ) ? 'checked="checked"' : '';
+ $forum_notify_yes = ($new['allow_forum_notify']) ? 'checked="checked"' : '';
+ $forum_notify_no = (!$new['allow_forum_notify']) ? 'checked="checked"' : '';
- $html_yes = ( $new['allow_html'] ) ? 'checked="checked"' : '';
- $html_no = ( !$new['allow_html'] ) ? 'checked="checked"' : '';
+ $html_yes = ($new['allow_html']) ? 'checked="checked"' : '';
+ $html_no = (!$new['allow_html']) ? 'checked="checked"' : '';
- $bbcode_yes = ( $new['allow_bbcode'] ) ? 'checked="checked"' : '';
- $bbcode_no = ( !$new['allow_bbcode'] ) ? 'checked="checked"' : '';
+ $bbcode_yes = ($new['allow_bbcode']) ? 'checked="checked"' : '';
+ $bbcode_no = (!$new['allow_bbcode']) ? 'checked="checked"' : '';
- $smile_yes = ( $new['allow_smilies'] ) ? 'checked="checked"' : '';
- $smile_no = ( !$new['allow_smilies'] ) ? 'checked="checked"' : '';
+ $smile_yes = ($new['allow_smilies']) ? 'checked="checked"' : '';
+ $smile_no = (!$new['allow_smilies']) ? 'checked="checked"' : '';
- $sig_yes = ( $new['allow_sig'] ) ? 'checked="checked"' : '';
- $sig_no = ( !$new['allow_sig'] ) ? 'checked="checked"' : '';
+ $sig_yes = ($new['allow_sig']) ? 'checked="checked"' : '';
+ $sig_no = (!$new['allow_sig']) ? 'checked="checked"' : '';
- $namechange_yes = ( $new['allow_namechange'] ) ? 'checked="checked"' : '';
- $namechange_no = ( !$new['allow_namechange'] ) ? 'checked="checked"' : '';
+ $namechange_yes = ($new['allow_namechange']) ? 'checked="checked"' : '';
+ $namechange_no = (!$new['allow_namechange']) ? 'checked="checked"' : '';
?>
@@ -312,22 +302,22 @@ switch ( $mode )
case 'setting':
- $disable_board_yes = ( $new['board_disable'] ) ? 'checked="checked"' : '';
- $disable_board_no = ( !$new['board_disable'] ) ? 'checked="checked"' : '';
+ $disable_board_yes = ($new['board_disable']) ? 'checked="checked"' : '';
+ $disable_board_no = (!$new['board_disable']) ? 'checked="checked"' : '';
- $coppa_enable_yes = ( $new['coppa_enable'] ) ? 'checked="checked"' : '';
- $coppa_enable_no = ( !$new['coppa_enable'] ) ? 'checked="checked"' : '';
+ $coppa_enable_yes = ($new['coppa_enable']) ? 'checked="checked"' : '';
+ $coppa_enable_no = (!$new['coppa_enable']) ? 'checked="checked"' : '';
- $activation_none = ( $new['require_activation'] == USER_ACTIVATION_NONE ) ? 'checked="checked"' : '';
- $activation_user = ( $new['require_activation'] == USER_ACTIVATION_SELF ) ? 'checked="checked"' : '';
- $activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? 'checked="checked"' : '';
- $activation_disable = ( $new['require_activation'] == USER_ACTIVATION_DISABLE ) ? 'checked="checked"' : '';
+ $activation_none = ($new['require_activation'] == USER_ACTIVATION_NONE) ? 'checked="checked"' : '';
+ $activation_user = ($new['require_activation'] == USER_ACTIVATION_SELF) ? 'checked="checked"' : '';
+ $activation_admin = ($new['require_activation'] == USER_ACTIVATION_ADMIN) ? 'checked="checked"' : '';
+ $activation_disable = ($new['require_activation'] == USER_ACTIVATION_DISABLE) ? 'checked="checked"' : '';
- $privmsg_on = ( !$new['privmsg_disable'] ) ? 'checked="checked"' : '';
- $privmsg_off = ( $new['privmsg_disable'] ) ? 'checked="checked"' : '';
+ $privmsg_on = (!$new['privmsg_disable']) ? 'checked="checked"' : '';
+ $privmsg_off = ($new['privmsg_disable']) ? 'checked="checked"' : '';
- $prune_yes = ( $new['prune_enable'] ) ? 'checked="checked"' : '';
- $prune_no = ( !$new['prune_enable'] ) ? 'checked="checked"' : '';
+ $prune_yes = ($new['prune_enable']) ? 'checked="checked"' : '';
+ $prune_no = (!$new['prune_enable']) ? 'checked="checked"' : '';
?>
@@ -412,14 +402,14 @@ switch ( $mode )
case 'email':
- $email_yes = ( $new['email_enable'] ) ? 'checked="checked"' : '';
- $email_no = ( !$new['email_enable'] ) ? 'checked="checked"' : '';
+ $email_yes = ($new['email_enable']) ? 'checked="checked"' : '';
+ $email_no = (!$new['email_enable']) ? 'checked="checked"' : '';
- $board_email_form_yes = ( $new['board_email_form'] ) ? 'checked="checked"' : '';
- $board_email_form_no = ( !$new['board_email_form'] ) ? 'checked="checked"' : '';
+ $board_email_form_yes = ($new['board_email_form']) ? 'checked="checked"' : '';
+ $board_email_form_no = (!$new['board_email_form']) ? 'checked="checked"' : '';
- $smtp_yes = ( $new['smtp_delivery'] ) ? 'checked="checked"' : '';
- $smtp_no = ( !$new['smtp_delivery'] ) ? 'checked="checked"' : '';
+ $smtp_yes = ($new['smtp_delivery']) ? 'checked="checked"' : '';
+ $smtp_no = (!$new['smtp_delivery']) ? 'checked="checked"' : '';
?>
@@ -460,13 +450,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"' : '';
+ $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"' : '';
+ $gzip_yes = ($new['gzip_compress']) ? 'checked="checked"' : '';
+ $gzip_no = (!$new['gzip_compress']) ? 'checked="checked"' : '';
?>
lang['Server_name']; ?>: lang['Server_name_explain']; ?> |
@@ -517,9 +507,9 @@ switch ( $mode )
$auth_plugins = array();
$dp = opendir($phpbb_root_path . 'includes/auth');
- while ( $file = readdir($dp) )
+ while ($file = readdir($dp))
{
- if ( preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file) )
+ if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
{
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
}
@@ -528,9 +518,9 @@ switch ( $mode )
sort($auth_plugins);
$auth_select = '';
- foreach ( $auth_plugins as $method )
+ foreach ($auth_plugins as $method)
{
- $selected = ( $config['auth_method'] == $method ) ? ' selected="selected"' : '';
+ $selected = ($config['auth_method'] == $method) ? ' selected="selected"' : '';
$auth_select .= '';
}
@@ -541,23 +531,23 @@ switch ( $mode )
- |
+ |
diff --git a/phpBB/admin/admin_database.php b/phpBB/admin/admin_database.php
index 162a7ae653..812e1050db 100644
--- a/phpBB/admin/admin_database.php
+++ b/phpBB/admin/admin_database.php
@@ -19,18 +19,13 @@
*
***************************************************************************/
-if ( !empty($setmodules) )
+if (!empty($setmodules))
{
- if ( !$auth->acl_get('a_general') )
- {
- return;
- }
-
$filename = basename(__FILE__);
- $module['DB']['DB_Backup'] = $filename . "$SID&mode=backup";
+ $module['DB']['DB_Backup'] = ($auth->acl_get('a_backup')) ? $filename . "$SID&mode=backup" : '';
$file_uploads = @ini_get('file_uploads');
- if (!empty($file_uploads) && $file_uploads !== 0 && strtolower($file_uploads) != 'off' && @phpversion() != '4.0.4pl1' )
+ if (!empty($file_uploads) && $file_uploads !== 0 && strtolower($file_uploads) != 'off' && @phpversion() != '4.0.4pl1' && $auth->acl_get('a_restore'))
{
$module['DB']['DB_Restore'] = $filename . "$SID&mode=restore";
}
@@ -39,40 +34,30 @@ if ( !empty($setmodules) )
}
define('IN_PHPBB', 1);
-//
// Load default header
-//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
-//
-// Do we have DB backup/restore permissions?
-//
-if ( !$auth->acl_get('a_general') )
-{
- message_die(MESSAGE, $user->lang['No_admin']);
-}
+$mode = (isset($_GET['mode'])) ? $_GET['mode'] : '';
-//
// Increase maximum execution time, but don't complain about it if it isn't
// allowed.
-//
@set_time_limit(1200);
-$mode = ( isset($_GET['mode']) ) ? $_GET['mode'] : '';
-
-//
// Begin program proper
-//
-switch( $mode )
+switch($mode)
{
case 'backup':
-
- if ( SQL_LAYER == 'oracle' || SQL_LAYER == 'odbc' || SQL_LAYER == 'mssql' )
+ if (!$auth->acl_get('a_backup'))
{
- switch ( SQL_LAYER )
+ trigger_error($user->lang['NO_ADMIN']);
+ }
+
+ if (SQL_LAYER == 'oracle' || SQL_LAYER == 'odbc' || SQL_LAYER == 'mssql')
+ {
+ switch (SQL_LAYER)
{
case 'oracle':
$db_type = 'Oracle';
@@ -85,17 +70,17 @@ switch( $mode )
break;
}
- message_die(MESSAGE, $user->lang['Backups_not_supported']);
+ trigger_error($user->lang['Backups_not_supported']);
break;
}
- $additional_tables = ( isset($_POST['tables']) ) ? $_POST['tables'] : ( ( isset($_GET['tables']) ) ? $_GET['tables'] : '' );
- $backup_type = ( isset($_POST['type']) ) ? $_POST['type'] : ( ( isset($_GET['type']) ) ? $_GET['type'] : '' );
- $search = ( !empty($_POST['search']) ) ? intval($_POST['search']) : ( ( !empty($_GET['search']) ) ? intval($_GET['search']) : 0 );
- $store_path = ( isset($_POST['store']) ) ? $_POST['store'] : ( ( isset($_GET['store']) ) ? $_GET['store'] : '' );
- $compress = ( !empty($_POST['compress']) ) ? $_POST['compress'] : ( ( !empty($_GET['compress']) ) ? $_GET['compress'] : 'none' );
+ $additional_tables = (isset($_POST['tables'])) ? $_POST['tables'] : ((isset($_GET['tables'])) ? $_GET['tables'] : '');
+ $backup_type = (isset($_POST['type'])) ? $_POST['type'] : ((isset($_GET['type'])) ? $_GET['type'] : '');
+ $search = (!empty($_POST['search'])) ? intval($_POST['search']) : ((!empty($_GET['search'])) ? intval($_GET['search']) : 0);
+ $store_path = (isset($_POST['store'])) ? $_POST['store'] : ((isset($_GET['store'])) ? $_GET['store'] : '');
+ $compress = (!empty($_POST['compress'])) ? $_POST['compress'] : ((!empty($_GET['compress'])) ? $_GET['compress'] : 'none');
- if ( !isset($_POST['backupstart']) && !isset($_GET['backupstart']) )
+ if (!isset($_POST['backupstart']) && !isset($_GET['backupstart']))
{
page_header($user->lang['DB_Backup']);
@@ -127,7 +112,7 @@ switch( $mode )
@@ -135,7 +120,7 @@ switch( $mode )
lang['Compress_file']; ?>: |
lang['None']; ?> .bz2";
- $message = ( empty($store_path) ) ? $user->lang['Backup_download'] : $user->lang['Backup_writing'];
+ $message = (empty($store_path)) ? $user->lang['Backup_download'] : $user->lang['Backup_writing'];
page_header($user->lang['DB_Backup'], $meta);
page_message($user->lang['DB_Backup'], $message);
page_footer();
}
- $tables = ( SQL_LAYER != 'postgresql' ) ? mysql_get_tables() : pg_get_tables();
+ $tables = (SQL_LAYER != 'postgresql') ? mysql_get_tables() : pg_get_tables();
@sort($tables);
- if ( !empty($additional_tables) )
+ if (!empty($additional_tables))
{
$additional_tables = explode(',', $additional_tables);
@@ -206,7 +191,7 @@ switch( $mode )
echo "#\n# DATE : " . gmdate("d-m-Y H:i:s", time()) . " GMT\n";
echo "#\n";
- if ( SQL_LAYER == 'postgresql' )
+ if (SQL_LAYER == 'postgresql')
{
echo "\n" . pg_get_sequences("\n", $backup_type);
}
@@ -215,7 +200,7 @@ switch( $mode )
{
$table_name = $tables[$i];
- if ( SQL_LAYER != 'mysql4' )
+ if (SQL_LAYER != 'mysql4')
{
$table_def_function = "get_table_def_" . SQL_LAYER;
$table_content_function = "get_table_content_" . SQL_LAYER;
@@ -226,18 +211,18 @@ switch( $mode )
$table_content_function = "get_table_content_mysql";
}
- if ( $backup_type != 'data' )
+ if ($backup_type != 'data')
{
echo "#\n# TABLE: " . $table_name . "\n#\n";
echo $table_def_function($table_name, "\n") . "\n";
}
- if ( $backup_type != 'structure' )
+ if ($backup_type != 'structure')
{
//
// Skip search table data?
//
- if ( $search || ( !$search && !preg_match('/search_word/', $table_name) ) )
+ if ($search || (!$search && !preg_match('/search_word/', $table_name)))
{
$table_content_function($table_name, "output_table_content");
}
@@ -247,7 +232,7 @@ switch( $mode )
//
// Flush the buffer, send the file
//
- switch ( $compress )
+ switch ($compress)
{
case 'gzip':
$extension = 'sql.gz';
@@ -258,7 +243,7 @@ switch( $mode )
case 'zip':
$extension = 'zip';
$zip = new zipfile;
- $zip->addFile(ob_get_contents(), "phpbb_db_backup.sql", time());
+ $zip->add_file(ob_get_contents(), "phpbb_db_backup.sql", time());
ob_end_clean();
$contents = $zip->file();
break;
@@ -277,7 +262,7 @@ switch( $mode )
add_admin_log('log_db_backup');
- if ( empty($store_path) )
+ if (empty($store_path))
{
header("Pragma: no-cache");
header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.$extension\"");
@@ -288,12 +273,12 @@ switch( $mode )
}
else
{
- if ( !($fp = fopen('./../' . $store_path . "/phpbb_db_backup.$extension", 'wb')) )
+ if (!($fp = fopen('./../' . $store_path . "/phpbb_db_backup.$extension", 'wb')))
{
message_die(ERROR, 'Could not open backup file');
}
- if ( !fwrite($fp, $contents) )
+ if (!fwrite($fp, $contents))
{
message_die(ERROR, 'Could not write backup file content');
}
@@ -301,54 +286,58 @@ switch( $mode )
fclose($fp);
unset($contents);
- message_die(MESSAGE, $user->lang['Backup_success']);
+ trigger_error($user->lang['Backup_success']);
}
exit;
break;
case 'restore':
+ if (!$auth->acl_get('a_restore'))
+ {
+ trigger_error($user->lang['No_admin']);
+ }
- if ( isset($_POST['restorestart']) )
+ if (isset($_POST['restorestart']))
{
//
// Handle the file upload ....
// If no file was uploaded report an error...
//
- if ( !empty($_POST['local']) )
+ if (!empty($_POST['local']))
{
$file_tmpname = './../' . str_replace('\\\\', '/', $_POST['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'] : '';
+ $filename = (!empty($HTTP_POST_FILES['backup_file']['name'])) ? $HTTP_POST_FILES['backup_file']['name'] : '';
+ $file_tmpname = ($HTTP_POST_FILES['backup_file']['tmp_name'] != 'none') ? $HTTP_POST_FILES['backup_file']['tmp_name'] : '';
}
- if ( $file_tmpname == '' || $filename == '' || !file_exists($file_tmpname) )
+ if ($file_tmpname == '' || $filename == '' || !file_exists($file_tmpname))
{
- message_die(MESSAGE, $user->lang['Restore_Error_no_file']);
+ trigger_error($user->lang['Restore_Error_no_file']);
}
$ext = substr($filename, strrpos($filename, '.') + 1);
- if ( !preg_match('/^(sql|gz|bz2)$/', $ext) )
+ if (!preg_match('/^(sql|gz|bz2)$/', $ext))
{
- message_die(MESSAGE, $user->lang['Restore_Error_filename']);
+ trigger_error($user->lang['Restore_Error_filename']);
}
- if ( ( !extension_loaded('zlib') && $ext == 'gz' ) || ( !extension_loaded('zip') && $ext == 'zip' ) || ( $ext == 'bz2' && !extension_loaded('bz2') ) )
+ if ((!extension_loaded('zlib') && $ext == 'gz') || (!extension_loaded('zip') && $ext == 'zip') || ($ext == 'bz2' && !extension_loaded('bz2')))
{
- message_die(MESSAGE, $user->lang['Compress_unsupported']);
+ trigger_error($user->lang['Compress_unsupported']);
}
$sql_query = '';
- switch ( $ext )
+ switch ($ext)
{
case 'gz':
$fp = gzopen($file_tmpname, 'rb');
- while ( !gzeof($fp) )
+ while (!gzeof($fp))
{
$sql_query .= gzgets($fp, 100000);
}
@@ -359,11 +348,14 @@ switch( $mode )
$sql_query = bzdecompress(fread(fopen($file_tmpname, 'rb'), filesize($file_tmpname)));
break;
+ case 'zip':
+
+
default;
$sql_query = fread(fopen($file_tmpname, 'r'), filesize($file_tmpname));
}
- if ( $sql_query != '' )
+ if ($sql_query != '')
{
// Strip out sql comments...
$sql_query = remove_remarks($sql_query);
@@ -374,7 +366,7 @@ switch( $mode )
{
$sql = trim($pieces[$i]);
- if ( !empty($sql) && $sql[0] != '#' )
+ if (!empty($sql) && $sql[0] != '#')
{
$db->sql_query($sql);
}
@@ -383,7 +375,7 @@ switch( $mode )
add_admin_log('log_db_restore');
- message_die(MESSAGE, $user->lang['Restore_success']);
+ trigger_error($user->lang['Restore_success']);
}
//
@@ -406,11 +398,11 @@ switch( $mode )
echo $user->lang['Supported_extensions'];
$types = ': sql';
- if ( extension_loaded('zlib') )
+ if (extension_loaded('zlib'))
{
$types .= ', sql.gz';
}
- if ( extension_loaded('bz2') )
+ if (extension_loaded('bz2'))
{
$types .= ', bz2';
}
@@ -434,6 +426,7 @@ switch( $mode )
break;
default:
+ trigger_error($user->lang['No_admin']);
exit;
}
@@ -454,16 +447,16 @@ function mysql_get_tables()
$tables = array();
$result = mysql_list_tables($db->dbname, $db->db_connect_id);
- if ( $row = $db->sql_fetchrow($result) )
+ if ($row = $db->sql_fetchrow($result))
{
do
{
- if ( preg_match('/^' . $table_prefix . '/', $row[0]) )
+ if (preg_match('/^' . $table_prefix . '/', $row[0]))
{
$tables[] = $row[0];
}
}
- while ( $row = $db->sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
}
return $tables;
@@ -483,7 +476,7 @@ function pg_get_sequences($crlf, $backup_type)
$seq = $db->sql_query($get_seq_sql);
- if( !$num_seq = $db->sql_numrows($seq) )
+ if (!$num_seq = $db->sql_numrows($seq))
{
$return_val = "# No Sequences Found $crlf";
@@ -502,11 +495,11 @@ function pg_get_sequences($crlf, $backup_type)
$get_props_sql = "SELECT * FROM $sequence";
$seq_props = $db->sql_query($get_props_sql);
- if($db->sql_numrows($seq_props) > 0)
+ if ($db->sql_numrows($seq_props) > 0)
{
$row1 = $db->sql_fetchrow($seq_props);
- if($backup_type == 'structure')
+ if ($backup_type == 'structure')
{
$row['last_value'] = 1;
}
@@ -515,7 +508,7 @@ function pg_get_sequences($crlf, $backup_type)
} // End if numrows > 0
- if(($row['last_value'] > 1) && ($backup_type != 'structure'))
+ if (($row['last_value'] > 1) && ($backup_type != 'structure'))
{
$return_val .= "SELECT NEXTVALE('$sequence'); $crlf";
unset($row['last_value']);
@@ -555,7 +548,7 @@ function get_table_def_postgresql($table, $crlf)
ORDER BY a.attnum";
$result = $db->sql_query($field_query);
- if(!$result)
+ if (!$result)
{
message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $field_query);
} // end if..
@@ -641,12 +634,12 @@ function get_table_def_postgresql($table, $crlf)
ORDER BY index_name, tab_name, column_name ";
$result = $db->sql_query($sql_pri_keys);
- if(!$result)
+ if (!$result)
{
message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $sql_pri_keys);
}
- while ( $row = $db->sql_fetchrow($result))
+ while ($row = $db->sql_fetchrow($result))
{
if ($row['primary_key'] == 't')
{
@@ -743,37 +736,29 @@ function get_table_def_mysql($table, $crlf)
$field_query = "SHOW FIELDS FROM $table";
$key_query = "SHOW KEYS FROM $table";
- //
// If the user has selected to drop existing tables when doing a restore.
// Then we add the statement to drop the tables....
- //
$schema_create .= "DROP TABLE IF EXISTS $table;$crlf";
$schema_create .= "CREATE TABLE $table($crlf";
- //
// Ok lets grab the fields...
- //
$result = $db->sql_query($field_query);
- if(!result)
- {
- message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $field_query);
- }
while ($row = $db->sql_fetchrow($result))
{
$schema_create .= ' ' . $row['Field'] . ' ' . $row['Type'];
- if(!empty($row['Default']))
+ if (!empty($row['Default']))
{
$schema_create .= ' DEFAULT \'' . $row['Default'] . '\'';
}
- if($row['Null'] != "YES")
+ if ($row['Null'] != "YES")
{
$schema_create .= ' NOT NULL';
}
- if($row['Extra'] != "")
+ if ($row['Extra'] != "")
{
$schema_create .= ' ' . $row['Extra'];
}
@@ -794,12 +779,12 @@ function get_table_def_mysql($table, $crlf)
{
$kname = $row['Key_name'];
- if(($kname != 'PRIMARY') && ($row['Non_unique'] == 0))
+ if (($kname != 'PRIMARY') && ($row['Non_unique'] == 0))
{
$kname = "UNIQUE|$kname";
}
- if(!is_array($index[$kname]))
+ if (!is_array($index[$kname]))
{
$index[$kname] = array();
}
@@ -807,11 +792,11 @@ function get_table_def_mysql($table, $crlf)
$index[$kname][] = $row['Column_name'];
}
- while(list($x, $columns) = @each($index))
+ foreach ($index as $x => $columns)
{
$schema_create .= ", $crlf";
- if($x == 'PRIMARY')
+ if ($x == 'PRIMARY')
{
$schema_create .= ' PRIMARY KEY (' . implode($columns, ', ') . ')';
}
@@ -827,7 +812,7 @@ function get_table_def_mysql($table, $crlf)
$schema_create .= "$crlf);";
- if(get_magic_quotes_runtime())
+ if (get_magic_quotes_runtime())
{
return(stripslashes($schema_create));
}
@@ -856,10 +841,7 @@ function get_table_content_postgresql($table, $handler)
{
global $db;
- //
// Grab all of the data from current table.
- //
-
$result = $db->sql_query("SELECT * FROM $table");
$i_num_fields = $db->sql_numfields($result);
@@ -872,24 +854,23 @@ function get_table_content_postgresql($table, $handler)
$iRec = 0;
- while ( $row = $db->sql_fetchrow($result) )
+ while ($row = $db->sql_fetchrow($result))
{
unset($schema_vals);
unset($schema_fields);
unset($schema_insert);
- //
+
// Build the SQL statement to recreate the data.
- //
for($i = 0; $i < $i_num_fields; $i++)
{
$strVal = $row[$aryName[$i]];
- if (eregi("char|text|bool", $aryType[$i]))
+ if (preg_match('#char|text|bool#i', $aryType[$i]))
{
$strQuote = "'";
$strEmpty = "";
$strVal = addslashes($strVal);
}
- elseif (eregi("date|timestamp", $aryType[$i]))
+ elseif (preg_match('#date|timestamp#i', $aryType[$i]))
{
if ($empty($strVal))
{
@@ -913,18 +894,15 @@ function get_table_content_postgresql($table, $handler)
$schema_vals .= " $strQuote$strVal$strQuote,";
$schema_fields .= " $aryName[$i],";
-
}
- $schema_vals = ereg_replace(",$", "", $schema_vals);
- $schema_vals = ereg_replace("^ ", "", $schema_vals);
- $schema_fields = ereg_replace(",$", "", $schema_fields);
- $schema_fields = ereg_replace("^ ", "", $schema_fields);
+ $schema_vals = preg_replace('#,$#', '', $schema_vals);
+ $schema_vals = preg_replace('#^ #', '', $schema_vals);
+ $schema_fields = preg_replace('#,$#', '', $schema_fields);
+ $schema_fields = preg_replace('#^ #', '', $schema_fields);
- //
// Take the ordered fields and their associated data and build it
// into a valid sql statement to recreate that field in the data.
- //
$schema_insert = "INSERT INTO $table ($schema_fields) VALUES($schema_vals);";
$handler(trim($schema_insert));
@@ -941,16 +919,13 @@ function get_table_content_postgresql($table, $handler)
function get_table_content_mysql($table, $handler)
{
global $db;
- //
+
// Grab the data from the table.
- //
$result = $db->sql_query("SELECT * FROM $table");
- //
// Loop through the resulting rows and build the sql statement.
- //
$schema_insert = "";
- if ( $row = $db->sql_fetchrow($result) )
+ if ($row = $db->sql_fetchrow($result))
{
$schema_insert = "\n#\n# Table Data for $table\n#\n";
@@ -970,7 +945,7 @@ function get_table_content_mysql($table, $handler)
//
// Get rid of the last comma
//
- $table_list = ereg_replace(', $', '', $table_list);
+ $table_list = preg_replace('#, $#', '', $table_list);
$table_list .= ')';
//
// Start building the SQL statement.
@@ -981,7 +956,7 @@ function get_table_content_mysql($table, $handler)
//
for ($j = 0; $j < $num_fields; $j++)
{
- if(!isset($row[$j]))
+ if (!isset($row[$j]))
{
//
// If there is no data for the column set it to null.
@@ -1003,14 +978,14 @@ function get_table_content_mysql($table, $handler)
//
// Get rid of the the last comma.
//
- $schema_insert = ereg_replace(',$', '', $schema_insert);
+ $schema_insert = preg_replace('#,$#', '', $schema_insert);
$schema_insert .= ');';
//
// Go ahead and send the insert statement to the handler function.
//
$handler(trim($schema_insert));
}
- while ( $row = $db->sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
}
return true;
@@ -1041,9 +1016,9 @@ class zipfile
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
var $old_offset = 0;
- function unix2DosTime($unixtime = 0)
+ function unix_to_dos_time($unixtime = 0)
{
- $timearray = ( $unixtime == 0 ) ? getdate() : getdate($unixtime);
+ $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);
if ($timearray['year'] < 1980)
{
@@ -1055,15 +1030,15 @@ class zipfile
$timearray['seconds'] = 0;
}
- return ( ( $timearray['year'] - 1980) << 25 ) | ( $timearray['mon'] << 21 ) | ( $timearray['mday'] << 16 ) |
- ( $timearray['hours'] << 11 ) | ( $timearray['minutes'] << 5 ) | ( $timearray['seconds'] >> 1 );
+ return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) |
+ ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1);
}
- function addFile($data, $name, $time = 0)
+ function add_file($data, $name, $time = 0)
{
$name = str_replace('\\', '/', $name);
- $dtime = dechex($this->unix2DosTime($time));
+ $dtime = dechex($this->unix_to_dos_time($time));
$hexdtime = '\x' . $dtime[6] . $dtime[7]
. '\x' . $dtime[4] . $dtime[5]
. '\x' . $dtime[2] . $dtime[3]
@@ -1111,14 +1086,14 @@ class zipfile
$cdrec .= pack('V', $crc); // crc32
$cdrec .= pack('V', $c_len); // compressed filesize
$cdrec .= pack('V', $unc_len); // uncompressed filesize
- $cdrec .= pack('v', strlen($name) ); // length of filename
- $cdrec .= pack('v', 0 ); // extra field length
- $cdrec .= pack('v', 0 ); // file comment length
- $cdrec .= pack('v', 0 ); // disk number start
- $cdrec .= pack('v', 0 ); // internal file attributes
- $cdrec .= pack('V', 32 ); // external file attributes - 'archive' bit set
+ $cdrec .= pack('v', strlen($name)); // length of filename
+ $cdrec .= pack('v', 0); // extra field length
+ $cdrec .= pack('v', 0); // file comment length
+ $cdrec .= pack('v', 0); // disk number start
+ $cdrec .= pack('v', 0); // internal file attributes
+ $cdrec .= pack('V', 32); // external file attributes - 'archive' bit set
- $cdrec .= pack('V', $this -> old_offset ); // relative offset of local header
+ $cdrec .= pack('V', $this -> old_offset); // relative offset of local header
$this -> old_offset = $new_offset;
$cdrec .= $name;
@@ -1140,7 +1115,6 @@ class zipfile
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 4bd6a88170..3061a069fa 100644
--- a/phpBB/admin/admin_disallow.php
+++ b/phpBB/admin/admin_disallow.php
@@ -21,43 +21,36 @@
define('IN_PHPBB', 1);
-if( !empty($setmodules) )
+if(!empty($setmodules))
{
- if ( !$auth->acl_get('a_user') )
+ if (!$auth->acl_get('a_names'))
{
return;
}
- $filename = basename(__FILE__);
- $module['Users']['Disallow'] = $filename . $SID;
+ $module['Users']['Disallow'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
-//
// Include files
-//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
-//
-// Do we have user admin permissions?
-//
-if ( !$auth->acl_get('a_user') )
+// Check permissions
+if (!$auth->acl_get('a_names'))
{
- return;
+ trigger_error($user->lang['NO_ADMIN']);
}
-if( isset($_POST['add_name']) )
+if (isset($_POST['add_name']))
{
- include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
-
- $disallowed_user = ( isset($_POST['disallowed_user']) ) ? $_POST['disallowed_user'] : $_GET['disallowed_user'];
+ $disallowed_user = (isset($_POST['disallowed_user'])) ? $_POST['disallowed_user'] : $_GET['disallowed_user'];
$disallowed_user = str_replace('*', '%', $disallowed_user);
- if ( !validate_username($disallowed_user) )
+ if (validate_username($disallowed_user))
{
$message = $user->lang['Disallowed_already'];
}
@@ -65,7 +58,7 @@ if( isset($_POST['add_name']) )
{
$sql = "INSERT INTO " . DISALLOW_TABLE . " (disallow_username)
VALUES('" . str_replace("\'", "''", $disallowed_user) . "')";
- $result = $db->sql_query( $sql );
+ $result = $db->sql_query($sql);
$message = $user->lang['Disallow_successful'];
}
@@ -76,9 +69,9 @@ if( isset($_POST['add_name']) )
message_die(MESSAGE, $message);
}
-else if( isset($_POST['delete_name']) )
+else if (isset($_POST['delete_name']))
{
- $disallowed_id = ( isset($_POST['disallowed_id']) ) ? intval( $_POST['disallowed_id'] ) : intval( $_GET['disallowed_id'] );
+ $disallowed_id = (isset($_POST['disallowed_id'])) ? intval($_POST['disallowed_id']) : intval($_GET['disallowed_id']);
$sql = "DELETE FROM " . DISALLOW_TABLE . "
WHERE disallow_id = $disallowed_id";
@@ -92,21 +85,19 @@ else if( isset($_POST['delete_name']) )
}
-//
// Grab the current list of disallowed usernames...
-//
$sql = "SELECT *
FROM " . DISALLOW_TABLE;
$result = $db->sql_query($sql);
$disallow_select = '';
-if ( $row = $db->sql_fetchrow($result) )
+if ($row = $db->sql_fetchrow($result))
{
do
{
$disallow_select .= '';
}
- while ( $row = $db->sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
}
//
@@ -133,7 +124,7 @@ page_header($user->lang['Users']);
|
lang['Username']; ?> lang['Delete_disallow_explain']; ?> |
- lang['No_disallowed']; } ?> |
+ lang['No_disallowed']; } ?> |
diff --git a/phpBB/admin/admin_email.php b/phpBB/admin/admin_email.php
index 41e3ca55cd..ada237a912 100644
--- a/phpBB/admin/admin_email.php
+++ b/phpBB/admin/admin_email.php
@@ -19,33 +19,28 @@
*
***************************************************************************/
-if ( !empty($setmodules) )
+if (!empty($setmodules))
{
- if ( !$auth->acl_get('a_general') )
+ if (!$auth->acl_get('a_email'))
{
return;
}
- $filename = basename(__FILE__);
- $module['General']['Mass_Email'] = $filename . $SID;
+ $module['General']['Mass_Email'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
-//
// Include files
-//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
-//
-// Do we have general admin permissions?
-//
-if ( !$auth->acl_get('a_general') )
+// Check permissions
+if (!$auth->acl_get('a_email'))
{
- return;
+ trigger_error($user->lang['NO_ADMIN']);
}
//
@@ -57,7 +52,7 @@ $subject = '';
//
// Do the job ...
//
-if ( isset($_POST['submit']) )
+if (isset($_POST['submit']))
{
//
// Increase maximum execution time in case of a lot of users, but don't complain about it if it isn't
@@ -67,10 +62,10 @@ if ( isset($_POST['submit']) )
$group_id = intval($_POST['g']);
- $sql = ( $group_id != -1 ) ? "SELECT u.user_email FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE;
+ $sql = ($group_id != -1) ? "SELECT u.user_email FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE;
$result = $db->sql_query($sql);
- if ( !($email_list = $db->sql_fetchrowset($g_result)) )
+ if (!($email_list = $db->sql_fetchrowset($g_result)))
{
//
// Output a relevant GENERAL_MESSAGE about users/group
@@ -87,14 +82,14 @@ if ( isset($_POST['submit']) )
//
$error = FALSE;
- if ( !$error )
+ if (!$error)
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
//
// Let's do some checking to make sure that mass mail functions
// are working in win32 versions of php.
//
- if ( preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$config['smtp_delivery'])
+ if (preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$config['smtp_delivery'])
{
// We are running on windows, force delivery to use
// our smtp functions since php's are broken by default
@@ -108,7 +103,7 @@ if ( isset($_POST['submit']) )
$bcc_list = '';
for($i = 0; $i < count($email_list); $i++)
{
- $bcc_list .= ( ( $bcc_list != '' ) ? ', ' : '' ) . $email_list[$i]['user_email'];
+ $bcc_list .= (($bcc_list != '') ? ', ' : '') . $email_list[$i]['user_email'];
}
$email_headers .= "Bcc: $bcc_list\n";
@@ -145,13 +140,13 @@ $sql = "SELECT group_id, group_name
$result = $db->sql_query($sql);
$select_list = '';
@@ -163,7 +158,7 @@ page_header($user->lang['Mass_Email']);
lang['Mass_email_explain']; ?>
-
@@ -328,7 +316,7 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
// Founder only operations ... these operations can
// only be altered by someone with founder status
- $founder_sql = ( !$userdata['user_founder'] ) ? ' AND founder_only <> 1' : '';
+ $founder_sql = (!$userdata['user_founder']) ? ' AND founder_only <> 1' : '';
$sql = "SELECT auth_option_id, auth_value
FROM " . ACL_OPTIONS_TABLE . "
@@ -338,35 +326,35 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
$result = $db->sql_query($sql);
$auth_options = array();
- while ( $row = $db->sql_fetchrow($result) )
+ while ($row = $db->sql_fetchrow($result))
{
$auth_options[] = $row;
}
$db->sql_freeresult($result);
- if ( $_POST['type'] == 'user' && !empty($_POST['new']) )
+ if ($_POST['type'] == 'user' && !empty($_POST['new']))
{
$_POST['entries'] = explode("\n", $_POST['entries']);
}
$where_sql = '';
- foreach ( $_POST['entries'] as $value )
+ foreach ($_POST['entries'] as $value)
{
- $where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . ( ( $_POST['type'] == 'user' && !empty($_POST['new']) ) ? '\'' . $value . '\'' : intval($value) );
+ $where_sql .= (($where_sql != '') ? ', ' : '') . (($_POST['type'] == 'user' && !empty($_POST['new'])) ? '\'' . $value . '\'' : intval($value));
}
- switch ( $_POST['type'] )
+ switch ($_POST['type'])
{
case 'group':
$l_type = 'Group';
- $sql = ( empty($_POST['new']) ) ? "SELECT g.group_id AS id, g.group_name AS name, o.auth_value, a.auth_allow_deny FROM " . GROUPS_TABLE . " g, " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id $forum_sql AND g.group_id = a.group_id AND g.group_id IN ($where_sql) ORDER BY g.group_name ASC" : "SELECT group_id AS id, group_name AS name FROM " . GROUPS_TABLE . " WHERE group_id IN ($where_sql) ORDER BY group_name ASC";
+ $sql = (empty($_POST['new'])) ? "SELECT g.group_id AS id, g.group_name AS name, o.auth_value, a.auth_allow_deny FROM " . GROUPS_TABLE . " g, " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id $forum_sql AND g.group_id = a.group_id AND g.group_id IN ($where_sql) ORDER BY g.group_name ASC" : "SELECT group_id AS id, group_name AS name FROM " . GROUPS_TABLE . " WHERE group_id IN ($where_sql) ORDER BY group_name ASC";
break;
case 'user':
$l_type = 'User';
- $sql = ( empty($_POST['new']) ) ? "SELECT u.user_id AS id, u.username AS name, u.user_founder, o.auth_value, a.auth_allow_deny FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id $forum_sql AND u.user_id = a.user_id AND u.user_id IN ($where_sql) ORDER BY u.username, u.user_regdate ASC" : "SELECT user_id AS id, username AS name, user_founder FROM " . USERS_TABLE . " WHERE username IN ($where_sql) ORDER BY username, user_regdate ASC";
+ $sql = (empty($_POST['new'])) ? "SELECT u.user_id AS id, u.username AS name, u.user_founder, o.auth_value, a.auth_allow_deny FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id $forum_sql AND u.user_id = a.user_id AND u.user_id IN ($where_sql) ORDER BY u.username, u.user_regdate ASC" : "SELECT user_id AS id, username AS name, user_founder FROM " . USERS_TABLE . " WHERE username IN ($where_sql) ORDER BY username, user_regdate ASC";
break;
}
@@ -375,15 +363,15 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
$ug = '';;
$ug_hidden = '';
$auth = array();
- while ( $row = $db->sql_fetchrow($result) )
+ while ($row = $db->sql_fetchrow($result))
{
- $ug_test = ( !empty($user->lang[$row['name']]) ) ? $user->lang[$row['name']] : $row['name'];
- $ug .= ( !strstr($ug, $ug_test) ) ? $ug_test . "\n" : '';
+ $ug_test = (!empty($user->lang[$row['name']])) ? $user->lang[$row['name']] : $row['name'];
+ $ug .= (!strstr($ug, $ug_test)) ? $ug_test . "\n" : '';
$ug_test = '';
- $ug_hidden .= ( !strstr($ug_hidden, $ug_test) ) ? $ug_test : '';
+ $ug_hidden .= (!strstr($ug_hidden, $ug_test)) ? $ug_test : '';
- $auth[$row['auth_value']] = ( isset($auth_group[$row['auth_value']]) ) ? min($auth_group[$row['auth_value']], $row['auth_allow_deny']) : $row['auth_allow_deny'];
+ $auth[$row['auth_value']] = (isset($auth_group[$row['auth_value']])) ? min($auth_group[$row['auth_value']], $row['auth_allow_deny']) : $row['auth_allow_deny'];
}
$db->sql_freeresult($result);
@@ -451,7 +439,7 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
//-->
-lang['ACL_explain']; ?>
+lang['ACL_EXPLAIN']; ?>
';
@@ -92,40 +76,40 @@ if ( isset($_POST['prune']) )
page_footer();
}
- else if ( isset($_POST['confirm']) )
+ else if (isset($_POST['confirm']))
{
- if ( !empty($_POST['users']) )
+ if (!empty($_POST['users']))
{
$users = explode("\n", urldecode($_POST['users']));
$where_sql = '';
- foreach ( $users as $username )
+ foreach ($users as $username)
{
- $where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . '\'' . trim($username) . '\'';
+ $where_sql .= (($where_sql != '') ? ', ' : '') . '\'' . trim($username) . '\'';
}
$where_sql = " AND username IN ($where_sql)";
}
else
{
- $username = ( !empty($_POST['username']) ) ? urldecode($_POST['username']) : '';
- $email = ( !empty($_POST['email']) ) ? urldecode($_POST['email']) : '';
+ $username = (!empty($_POST['username'])) ? urldecode($_POST['username']) : '';
+ $email = (!empty($_POST['email'])) ? urldecode($_POST['email']) : '';
- $joined_select = ( !empty($_POST['joined_select']) ) ? $_POST['joined_select'] : 'lt';
- $active_select = ( !empty($_POST['active_select']) ) ? $_POST['active_select'] :'lt';
- $count_select = ( !empty($_POST['count_select']) ) ? $_POST['count_select'] : 'eq';
- $joined = ( !empty($_POST['joined']) ) ? explode('-', $_POST['joined']) : array();
- $active = ( !empty($_POST['active']) ) ? explode('-', $_POST['active']) :array();
- $count = ( !empty($_POST['count']) ) ? intval($_POST['count']) : '';
+ $joined_select = (!empty($_POST['joined_select'])) ? $_POST['joined_select'] : 'lt';
+ $active_select = (!empty($_POST['active_select'])) ? $_POST['active_select'] :'lt';
+ $count_select = (!empty($_POST['count_select'])) ? $_POST['count_select'] : 'eq';
+ $joined = (!empty($_POST['joined'])) ? explode('-', $_POST['joined']) : array();
+ $active = (!empty($_POST['active'])) ? explode('-', $_POST['active']) :array();
+ $count = (!empty($_POST['count'])) ? intval($_POST['count']) : '';
$key_match = array('lt' => '<', 'gt' => '>', 'eq' => '=');
$sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_lastvisit');
$where_sql = '';
- $where_sql .= ( $username ) ? " AND username LIKE '" . str_replace('*', '%', $username) ."'" : '';
- $where_sql .= ( $email ) ? " AND user_email LIKE '" . str_replace('*', '%', $email) ."' " : '';
- $where_sql .= ( $joined ) ? " AND user_regdate " . $key_match[$joined_select] . " " . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : '';
- $where_sql .= ( $count ) ? " AND user_posts " . $key_match[$count_select] . " $count " : '';
- $where_sql .= ( $active ) ? " AND user_lastvisit " . $key_match[$active_select] . " " . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : '';
+ $where_sql .= ($username) ? " AND username LIKE '" . str_replace('*', '%', $username) ."'" : '';
+ $where_sql .= ($email) ? " AND user_email LIKE '" . str_replace('*', '%', $email) ."' " : '';
+ $where_sql .= ($joined) ? " AND user_regdate " . $key_match[$joined_select] . " " . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : '';
+ $where_sql .= ($count) ? " AND user_posts " . $key_match[$count_select] . " $count " : '';
+ $where_sql .= ($active) ? " AND user_lastvisit " . $key_match[$active_select] . " " . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : '';
}
$sql = "SELECT username, user_id FROM " . USERS_TABLE . "
@@ -136,26 +120,26 @@ if ( isset($_POST['prune']) )
$where_sql = '';
$user_ids = array();
$usernames = array();
- if ( $row = $db->sql_fetchrow($result) )
+ if ($row = $db->sql_fetchrow($result))
{
do
{
- $where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . $row['user_id'];
+ $where_sql .= (($where_sql != '') ? ', ' : '') . $row['user_id'];
$user_ids[] = $row['user_id'];
$usernames[] = $row['username'];
}
- while ( $row = $db->sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
$where_sql = " AND user_id IN ($where_sql)";
}
$db->sql_freeresult($result);
- if ( $where_sql != '' )
+ if ($where_sql != '')
{
$sql = '';
- if ( !empty($_POST['delete']) )
+ if (!empty($_POST['delete']))
{
- if ( !empty($_POST['deleteposts']) )
+ if (!empty($_POST['deleteposts']))
{
$l_admin_log = 'log_prune_user_del_del';
@@ -178,7 +162,7 @@ if ( isset($_POST['prune']) )
$sql = "DELETE FROM " . USERS_TABLE;
}
- else if ( !empty($_POST['deactivate']) )
+ else if (!empty($_POST['deactivate']))
{
$l_admin_log = 'log_prune_user_deac';
@@ -203,20 +187,20 @@ if ( isset($_POST['prune']) )
//
$find_count = array('lt' => $user->lang['Less_than'], 'eq' => $user->lang['Equal_to'], 'gt' => $user->lang['More_than']);
$s_find_count = '';
-foreach ( $find_count as $key => $value )
+foreach ($find_count as $key => $value)
{
- $selected = ( $key == 'eq' ) ? ' selected="selected"' : '';
+ $selected = ($key == 'eq') ? ' selected="selected"' : '';
$s_find_count .= '';
}
$find_time = array('lt' => $user->lang['Before'], 'gt' => $user->lang['After']);
$s_find_join_time = '';
-foreach ( $find_time as $key => $value )
+foreach ($find_time as $key => $value)
{
$s_find_join_time .= '';
}
$s_find_active_time = '';
-foreach ( $find_time as $key => $value )
+foreach ($find_time as $key => $value)
{
$s_find_active_time .= '';
}
@@ -237,7 +221,7 @@ page_header($user->lang['Prune_users']);
lang['Prune_users']; ?> |
- lang['Username']; ?>: |
+ lang['USERNAME']; ?>: |
|
diff --git a/phpBB/admin/admin_ranks.php b/phpBB/admin/admin_ranks.php
index ff3424f9f2..52c5d4e98b 100644
--- a/phpBB/admin/admin_ranks.php
+++ b/phpBB/admin/admin_ranks.php
@@ -19,52 +19,42 @@
*
***************************************************************************/
-define('IN_PHPBB', 1);
-
-if( !empty($setmodules) )
+if (!empty($setmodules))
{
- if ( !$auth->acl_get('a_user') )
+ if (!$auth->acl_get('a_ranks'))
{
return;
}
- $file = basename(__FILE__);
- $module['Users']['Ranks'] = "$file$SID";
+ $module['Users']['Ranks'] = basename(__FILE__) . $SID;
return;
}
-//
+define('IN_PHPBB', 1);
// Let's set the root dir for phpBB
-//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
-//
-//
-//
-if ( !$auth->acl_get('a_user') )
+// Do we have permission?
+if (!$auth->acl_get('a_ranks'))
{
- return;
+ trigger_error($user->lang['NO_ADMIN']);
}
-//
-//
-//
-if ( isset($_GET['mode']) || isset($_POST['mode']) )
+// Check mode
+if (isset($_REQUEST['mode']))
{
- $mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : $_GET['mode'];
+ $mode = $_REQUEST['mode'];
}
else
{
- //
// These could be entered via a form button
- //
- if ( isset($_POST['add']) )
+ if (isset($_POST['add']))
{
$mode = 'add';
}
- else if ( isset($_POST['save']) )
+ else if (isset($_POST['save']))
{
$mode = 'save';
}
@@ -74,23 +64,21 @@ else
}
}
-//
-//
-//
-if ( $mode != '' )
+// Process mode
+if ($mode != '')
{
- if ( $mode == 'edit' || $mode == 'add' )
+ if ($mode == 'edit' || $mode == 'add')
{
//
// They want to add a new rank, show the form.
//
- $rank_id = ( isset($_GET['id']) ) ? intval($_GET['id']) : 0;
+ $rank_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0;
$s_hidden_fields = '';
- if ( $mode == 'edit' )
+ if ($mode == 'edit')
{
- if ( empty($rank_id) )
+ if (empty($rank_id))
{
message_die(MESSAGE, $user->lang['Must_select_rank']);
}
@@ -126,15 +114,15 @@ if ( $mode != '' )
lang['Rank_special']; ?>: |
- />lang['Yes']; ?> /> lang['No']; ?> |
+ />lang['Yes']; ?> /> lang['No']; ?> |
lang['Rank_minimum']; ?>: |
- |
+ |
lang['Rank_image']; ?>: lang['Rank_image_explain']; ?> |
- ' : ''; ?> |
+ ' : ''; ?> |
|
@@ -146,24 +134,24 @@ if ( $mode != '' )
page_footer();
}
- else if ( $mode == 'save' )
+ else if ($mode == 'save')
{
//
// Ok, they sent us our info, let's update it.
//
- $rank_id = ( isset($_POST['id']) ) ? intval($_POST['id']) : 0;
- $rank_title = ( isset($_POST['title']) ) ? trim($_POST['title']) : '';
- $special_rank = ( $_POST['special_rank'] == 1 ) ? TRUE : 0;
- $min_posts = ( isset($_POST['min_posts']) ) ? intval($_POST['min_posts']) : -1;
- $rank_image = ( (isset($_POST['rank_image'])) ) ? trim($_POST['rank_image']) : '';
+ $rank_id = (isset($_POST['id'])) ? intval($_POST['id']) : 0;
+ $rank_title = (isset($_POST['title'])) ? trim($_POST['title']) : '';
+ $special_rank = ($_POST['special_rank'] == 1) ? TRUE : 0;
+ $min_posts = (isset($_POST['min_posts'])) ? intval($_POST['min_posts']) : -1;
+ $rank_image = ((isset($_POST['rank_image']))) ? trim($_POST['rank_image']) : '';
- if ( $rank_title == '' )
+ if ($rank_title == '')
{
message_die(MESSAGE, $user->lang['Must_select_rank']);
}
- if ( $special_rank == 1 )
+ if ($special_rank == 1)
{
$min_posts = -1;
}
@@ -171,15 +159,15 @@ if ( $mode != '' )
//
// The rank image has to be a jpg, gif or png
//
- if ( $rank_image != '' )
+ if ($rank_image != '')
{
- if ( !preg_match('/(\.gif|\.png|\.jpg|\.jpeg)$/is', $rank_image))
+ if (!preg_match('/(\.gif|\.png|\.jpg|\.jpeg)$/is', $rank_image))
{
$rank_image = '';
}
}
- if ( $rank_id )
+ if ($rank_id)
{
$sql = "UPDATE " . RANKS_TABLE . "
SET rank_title = '" . str_replace("\'", "''", $rank_title) . "', rank_special = $special_rank, rank_min = $min_posts, rank_image = '" . str_replace("\'", "''", $rank_image) . "'
@@ -202,22 +190,22 @@ if ( $mode != '' )
message_die(MESSAGE, $message);
}
- else if ( $mode == 'delete' )
+ else if ($mode == 'delete')
{
//
// Ok, they want to delete their rank
//
- if ( isset($_POST['id']) || isset($_GET['id']) )
+ if (isset($_POST['id']) || isset($_GET['id']))
{
- $rank_id = ( isset($_POST['id']) ) ? intval($_POST['id']) : intval($_GET['id']);
+ $rank_id = (isset($_POST['id'])) ? intval($_POST['id']) : intval($_GET['id']);
}
else
{
$rank_id = 0;
}
- if ( $rank_id )
+ if ($rank_id)
{
$sql = "DELETE FROM " . RANKS_TABLE . "
WHERE rank_id = $rank_id";
@@ -265,23 +253,23 @@ $sql = "SELECT * FROM " . RANKS_TABLE . "
ORDER BY rank_min ASC, rank_special ASC";
$result = $db->sql_query($sql);
-if ( $row = $db->sql_fetchrow($result) )
+if ($row = $db->sql_fetchrow($result))
{
do
{
- $row_class = ( $row_class != 'row1' ) ? 'row1' : 'row2';
+ $row_class = ($row_class != 'row1') ? 'row1' : 'row2';
?>
|
- |
- lang['Yes'] : $user->lang['No']; ?> |
+ |
+ lang['Yes'] : $user->lang['No']; ?> |
">lang['Edit']; ?> |
">lang['Delete']; ?> |
sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
}
?>
diff --git a/phpBB/admin/admin_search.php b/phpBB/admin/admin_search.php
index 158e13a96e..07b150c89f 100644
--- a/phpBB/admin/admin_search.php
+++ b/phpBB/admin/admin_search.php
@@ -19,59 +19,50 @@
*
***************************************************************************/
-if ( !empty($setmodules) )
+if (!empty($setmodules))
{
- if ( !$auth->acl_get('a_general') )
+ if (!$auth->acl_get('a_search'))
{
return;
}
- $filename = basename(__FILE__);
- $module['DB']['Search_indexing'] = $filename . $SID;
+ $module['DB']['Search_indexing'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
-//
// Include files
-//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
-//
-// Do we have forum admin permissions?
-//
-if ( !$auth->acl_get('a_general') )
+// Check permissions
+if (!$auth->acl_get('a_search'))
{
- message_die(MESSAGE, $user->lang['No_admin']);
+ trigger_error($user->lang['NO_ADMIN']);
}
-//
// Start indexing
-//
-if ( isset($_POST['start']) || isset($_GET['batchstart']) )
+if (isset($_POST['start']) || isset($_GET['batchstart']))
{
$batchsize = 200; // Process this many posts per batch
- $batchstart = ( !isset($_GET['batchstart']) ) ? $row['min_post_id'] : $_GET['batchstart'];
- $batchcount = ( !isset($_GET['batchcount']) ) ? 1 : $_GET['batchcount'];
+ $batchstart = (!isset($_GET['batchstart'])) ? $row['min_post_id'] : $_GET['batchstart'];
+ $batchcount = (!isset($_GET['batchcount'])) ? 1 : $_GET['batchcount'];
$loopcount = 0;
$batchend = $batchstart + $batchsize;
- //
// Search re-indexing is tough on the server ... so we'll check the load
// each loop and if we're on a 1min load of 3 or more we'll re-load the page
// and try again. No idea how well this will work in practice so we'll see ...
- //
- if ( file_exists('/proc/loadavg') )
+ if (file_exists('/proc/loadavg'))
{
- if ( $load = @file('/proc/loadavg') )
+ if ($load = @file('/proc/loadavg'))
{
list($load) = explode(' ', $load[0]);
- if ( $load > 3 )
+ if ($load > 3)
{
header("Location: admin_search.$phpEx$SID&batchstart=$batchstart&batchcount=$batch_count");
exit;
@@ -79,27 +70,25 @@ if ( isset($_POST['start']) || isset($_GET['batchstart']) )
}
}
- //
// Try and load stopword and synonym files
- //
$stopword_array = array();
$synonym_array = array();
$dir = opendir($phpbb_root_path . 'language/');
- while ( $file = readdir($dir) )
+ while ($file = readdir($dir))
{
- if ( preg_match('#^lang_#', $file) && !is_file($phpbb_root_path . 'language/' . $file) && !is_link($phpbb_root_path . 'language/' . $file) )
+ if (preg_match('#^lang_#', $file) && !is_file($phpbb_root_path . 'language/' . $file) && !is_link($phpbb_root_path . 'language/' . $file))
{
unset($tmp_array);
$tmp_array = @file($phpbb_root_path . 'language/' . $file . '/search_stopwords.txt');
- if ( is_array($tmp_array) )
+ if (is_array($tmp_array))
{
$stopword_array = array_unique(array_merge($stopword_array, $tmp_array));
}
unset($tmp_array);
$tmp_array = @file($phpbb_root_path . 'language/' . $file . '/search_synonyms.txt');
- if ( is_array($tmp_array) )
+ if (is_array($tmp_array))
{
$synonym_array = array_unique(array_merge($synonym_array, $tmp_array));
}
@@ -108,7 +97,7 @@ if ( isset($_POST['start']) || isset($_GET['batchstart']) )
closedir($dir);
- if ( !isset($_GET['batchstart']) )
+ if (!isset($_GET['batchstart']))
{
//
// Take board offline
@@ -146,7 +135,7 @@ if ( isset($_POST['start']) || isset($_GET['batchstart']) )
AND $batchend";
$result = $db->sql_query($sql);
- if ( $row = $db->sql_fetchrow($result) )
+ if ($row = $db->sql_fetchrow($result))
{
do
{
@@ -158,36 +147,36 @@ if ( isset($_POST['start']) || isset($_GET['batchstart']) )
$word = array();
$word_insert_sql = array();
- foreach ( $search_raw_words as $word_in => $search_matches )
+ foreach ($search_raw_words as $word_in => $search_matches)
{
$word_insert_sql[$word_in] = '';
- if ( !empty($search_matches) )
+ 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] . "'";
+ $word_insert_sql[$word_in] .= ($word_insert_sql[$word_in] != '') ? ", '" . $search_matches[$i] . "'" : "'" . $search_matches[$i] . "'";
}
}
}
}
- if ( count($word) )
+ if (count($word))
{
$word_text_sql = '';
$word = array_unique($word);
for($i = 0; $i < count($word); $i++)
{
- $word_text_sql .= ( ( $word_text_sql != '' ) ? ', ' : '' ) . "'" . $word[$i] . "'";
+ $word_text_sql .= (($word_text_sql != '') ? ', ' : '') . "'" . $word[$i] . "'";
}
$check_words = array();
- switch( SQL_LAYER )
+ switch(SQL_LAYER)
{
case 'postgresql':
case 'msaccess':
@@ -199,7 +188,7 @@ if ( isset($_POST['start']) || isset($_GET['batchstart']) )
WHERE word_text IN ($word_text_sql)";
$result = $db->sql_query($sql);
- while ( $row = $db->sql_fetchrow($result) )
+ while ($row = $db->sql_fetchrow($result))
{
$check_words[$row['word_text']] = $row['word_id'];
}
@@ -211,21 +200,21 @@ if ( isset($_POST['start']) || isset($_GET['batchstart']) )
for ($i = 0; $i < count($word); $i++)
{
$new_match = true;
- if ( isset($check_words[$word[$i]]) )
+ if (isset($check_words[$word[$i]]))
{
$new_match = false;
}
- if ( $new_match )
+ if ($new_match)
{
- switch( SQL_LAYER )
+ switch(SQL_LAYER)
{
case 'mysql':
case 'mysql4':
- $value_sql .= ( ( $value_sql != '' ) ? ', ' : '' ) . '(\'' . $word[$i] . '\')';
+ $value_sql .= (($value_sql != '') ? ', ' : '') . '(\'' . $word[$i] . '\')';
break;
case 'mssql':
- $value_sql .= ( ( $value_sql != '' ) ? ' UNION ALL ' : '' ) . "SELECT '" . $word[$i] . "'";
+ $value_sql .= (($value_sql != '') ? ' UNION ALL ' : '') . "SELECT '" . $word[$i] . "'";
break;
default:
$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
@@ -236,9 +225,9 @@ if ( isset($_POST['start']) || isset($_GET['batchstart']) )
}
}
- if ( $value_sql != '' )
+ if ($value_sql != '')
{
- switch ( SQL_LAYER )
+ switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
@@ -255,11 +244,11 @@ if ( isset($_POST['start']) || isset($_GET['batchstart']) )
}
}
- foreach ( $word_insert_sql as $word_in => $match_sql )
+ foreach ($word_insert_sql as $word_in => $match_sql)
{
- $title_match = ( $word_in == 'title' ) ? 1 : 0;
+ $title_match = ($word_in == 'title') ? 1 : 0;
- if ( $match_sql != '' )
+ if ($match_sql != '')
{
$sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match)
SELECT $post_id, word_id, $title_match
@@ -270,22 +259,22 @@ if ( isset($_POST['start']) || isset($_GET['batchstart']) )
}
}
- while ( $row = $db->sql_fetchrow($result) );
+ while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
// Remove common words after the first 2 batches and after every 4th batch after that.
- if ( $batchcount % 4 == 3 )
+ if ($batchcount % 4 == 3)
{
// remove_common('global', $config['common_search']);
}
$batchcount++;
- if ( ( $batchstart + $batchsize ) < $max_post_id )
+ if (($batchstart + $batchsize) < $max_post_id)
{
- header("Location: admin_search.$phpEx$SID&batchstart=" . ( $batchstart + $batchsize ) . "&batchcount=$batch_count");
+ header("Location: admin_search.$phpEx$SID&batchstart=" . ($batchstart + $batchsize) . "&batchcount=$batch_count");
exit;
}
else
@@ -312,7 +301,7 @@ if ( isset($_POST['start']) || isset($_GET['batchstart']) )
exit;
}
-else if ( isset($_POST['cancel']) )
+else if (isset($_POST['cancel']))
{
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '0'
diff --git a/phpBB/admin/admin_smilies.php b/phpBB/admin/admin_smilies.php
index 0aa6d7a9c1..b3fdb8071b 100644
--- a/phpBB/admin/admin_smilies.php
+++ b/phpBB/admin/admin_smilies.php
@@ -19,9 +19,9 @@
*
***************************************************************************/
-if ( !empty($setmodules) )
+if (!empty($setmodules))
{
- if ( !$auth->acl_get('a_general') )
+ if (!$auth->acl_get('a_icons'))
{
return;
}
@@ -34,42 +34,22 @@ if ( !empty($setmodules) )
}
define('IN_PHPBB', 1);
-//
// Include files
-//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
-//
// Do we have general permissions?
-//
-if (!$auth->acl_get('a_general'))
+if (!$auth->acl_get('a_icons'))
{
message_die(MESSAGE, $user->lang['No_admin']);
}
-//
// Check to see what mode we should operate in.
-//
-if (isset($_POST['type']) || isset($_GET['type']))
-{
- $type = (!empty($_POST['type'])) ? $_POST['type'] : $_GET['type'];
-}
-else
-{
- $type = '';
-}
-
-if (isset($_POST['mode']) || isset($_GET['mode']))
-{
- $mode = (!empty($_POST['mode'])) ? $_POST['mode'] : $_GET['mode'];
-}
-else
-{
- $mode = '';
-}
+$type = (!empty($_REQUEST['type'])) ? $_REQUEST['type'] : '';
+$mode = (!empty($_REQUEST['mode'])) ? $_REQUEST['mode'] : '';
+// What are we doing?
switch ($type)
{
case 'emoticons':
@@ -603,7 +583,7 @@ function update_smile_dimensions()
acl_get('a_user') )
+ if (!$auth->acl_gets('a_user', 'a_useradd', 'a_userdel'))
{
return;
}
- $filename = basename(__FILE__);
- $module['Users']['Manage'] = $filename . $SID;
+ $module['Users']['Manage'] = basename(__FILE__) . $SID;
return;
}
define('IN_PHPBB', 1);
-
// Include files
$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_validate.'.$phpEx);
-
-// Do we have forum admin permissions?
-if ( !$auth->acl_get('a_user') )
-{
- trigger_error($user->lang['No_admin']);
-}
-
-echo $mode;
// Set mode
-if( isset( $_POST['mode'] ) || isset( $_GET['mode'] ) )
-{
- $mode = ( isset( $_POST['mode']) ) ? $_POST['mode'] : $_GET['mode'];
-}
-else
-{
- $mode = 'main';
-}
+$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : 'main';
// Begin program
-if ( isset($_POST['username']) || isset($_GET['u']) || isset( $_POST['u']) )
+if (isset($_POST['username']) || isset($_GET['u']) || isset($_POST['u']))
{
-
// Grab relevant userdata
- if( isset( $_GET['u']) || isset( $_POST['u']) )
+ if(isset($_REQUEST['u']))
{
- $user_id = ( isset( $_POST['u']) ) ? intval( $_POST['u']) : intval( $_GET['u']);
+ $user_id = intval($_REQUEST['u']);
- if( !($userdata = get_userdata($user_id)) )
+ if(!($userdata = get_userdata($user_id)))
{
- trigger_error($user->lang['No_user_id_specified'] );
+ trigger_error($user->lang['No_user_id_specified']);
}
}
else
{
- if( !$userdata = get_userdata( $_POST['username'] ) )
+ if(!$userdata = get_userdata($_POST['username']))
{
- trigger_error($user->lang['No_user_id_specified'] );
+ trigger_error($user->lang['No_user_id_specified']);
}
}
// Update entry in DB
- if( $_POST['deleteuser'] && !$userdata['user_founder'] && $auth->acl_get('a_userdel') )
+ if ($_POST['deleteuser'] && !$userdata['user_founder'])
{
+ if (!$auth->acl_get('a_userdel'))
+ {
+ trigger_error($user->lang['NO_ADMIN']);
+ }
+
$db->sql_transaction();
$sql = "UPDATE " . POSTS_TABLE . "
@@ -108,6 +94,10 @@ if ( isset($_POST['username']) || isset($_GET['u']) || isset( $_POST['u']) )
WHERE user_id = $user_id";
$db->sql_query($sql);
+ $sql = "DELETE FROM " . FORUMS_WATCH_TABLE . "
+ WHERE user_id = $user_id";
+ $db->sql_query($sql);
+
$sql = "DELETE FROM " . ACL_USERS_TABLE . "
WHERE user_id = $user_id";
$db->sql_query($sql);
@@ -149,13 +139,13 @@ if ( isset($_POST['username']) || isset($_GET['u']) || isset( $_POST['u']) )
Registered from IP: |
- [ Lookup | Ban ] |
+ [ Lookup | Ban ] |
@@ -164,7 +154,7 @@ if ( isset($_POST['username']) || isset($_GET['u']) || isset( $_POST['u']) )
' . trim($ipwhois) . ' ';
}
@@ -199,7 +189,7 @@ if ( isset($_POST['username']) || isset($_GET['u']) || isset( $_POST['u']) )
foreach ($acl_options['global'] as $option_name => $option_id)
{
- $type = substr($option_name, 0, strpos('_', $option_name) +1 );
+ $type = substr($option_name, 0, strpos('_', $option_name) +1);
$global[$type][$option_name] = $userauth->acl_get($option_name);
}
@@ -209,7 +199,7 @@ if ( isset($_POST['username']) || isset($_GET['u']) || isset( $_POST['u']) )
$result = $db->sql_query($sql);
$permissions = array();
- while( $row = $db->sql_fetchrow($result) )
+ while($row = $db->sql_fetchrow($result))
{
$forum_data[$row['forum_id']] = $row['forum_name'];
@@ -245,14 +235,14 @@ if ( isset($_POST['username']) || isset($_GET['u']) || isset( $_POST['u']) )
foreach ($auth_ary as $option => $allow)
{
- if ( $option != $type .'_' )
+ if ($option != $type .'_')
{
- $row_class = ( $row_class == 'row1' ) ? 'row2' : 'row1';
+ $row_class = ($row_class == 'row1') ? 'row2' : 'row1';
- $l_can_cell = ( !empty($user->lang['acl_' . $option]) ) ? $user->lang['acl_' . $option] : ucfirst(preg_replace('#.*?_#', '', $option));
+ $l_can_cell = (!empty($user->lang['acl_' . $option])) ? $user->lang['acl_' . $option] : ucfirst(preg_replace('#.*?_#', '', $option));
- $allow_type = ( $allow == ACL_ALLOW ) ? ' checked="checked"' : '';
- $deny_type = ( $allow == ACL_DENY ) ? ' checked="checked"' : '';
+ $allow_type = ($allow == ACL_ALLOW) ? ' checked="checked"' : '';
+ $deny_type = ($allow == ACL_DENY) ? ' checked="checked"' : '';
?>
|
|
@@ -280,7 +270,7 @@ if ( isset($_POST['username']) || isset($_GET['u']) || isset( $_POST['u']) )
foreach ($auth_ary as $option => $allow)
{
- echo '
' . $user->lang['acl_' . $option] . ' => ' . ( ( $allow ) ? 'Allowed' : 'Denied' ) . ' |
';
+ echo '' . $user->lang['acl_' . $option] . ' => ' . (($allow) ? 'Allowed' : 'Denied') . ' |
';
}
?>
@@ -297,10 +287,14 @@ if ( isset($_POST['username']) || isset($_GET['u']) || isset( $_POST['u']) )
page_footer();
}
-else
-{
- page_header($user->lang['Manage']);
+// Do we have permission?
+if (!$auth->acl_get('a_user'))
+{
+ trigger_error($user->lang['No_admin']);
+}
+
+page_header($user->lang['Manage']);
?>
@@ -308,7 +302,7 @@ else
lang['User_admin_explain']; ?>
-