diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 50d495f6b8..8e80b1de8d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -671,16 +671,22 @@ function redirect($url) $db->sql_close(); } - $protocol = ($config['cookie_secure']) ? 'https://' : 'http://'; - $server = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($config['server_name'])); - $path = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($config['script_path'])); - $port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/'; + $server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://'; + $server_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($config['server_name'])); + $server_port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/'; + $script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($config['script_path'])); + $url = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($url)); + // Redirect via an HTML form for PITA webservers if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) { - header('HTTP/1.0 302 Redirect'); + header('Refresh: 0; URL=' . $server_protocol . $server_name . $server_port . $script_name . $url); + echo 'Redirect
If your browser does not support meta redirection please click HERE to be redirected
'; + exit; } - header('Location: ' . $protocol . $server . $path . $port . $url); + + // Behave as per HTTP/1.1 spec for others + header('Location: ' . $server_protocol . $server_name . $server_port . $script_name . $url); exit; } @@ -691,7 +697,7 @@ function validate_username($username) { global $db, $user; - $username = sql_quote($username); + $username = $db->sql_escape($username); $sql = "SELECT username FROM " . USERS_TABLE . " @@ -719,7 +725,7 @@ function validate_username($username) while ($row = $db->sql_fetchrow($result)) { - if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['disallow_username'])) . ')\b#i', $username)) + if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['disallow_username'], '#')) . ')\b#i', $username)) { return $user->lang['Username_disallowed']; } @@ -731,7 +737,7 @@ function validate_username($username) while ($row = $db->sql_fetchrow($result)) { - if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['word'])) . ')\b#i', $username)) + if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['word'], '#')) . ')\b#i', $username)) { return $user->lang['Username_disallowed']; } @@ -761,7 +767,7 @@ function validate_email($email) while ($row = $db->sql_fetchrow($result)) { - if (preg_match('/^' . str_replace('*', '.*?', $row['ban_email']) . '$/is', $email)) + if (preg_match('#^' . str_replace('*', '.*?', $row['ban_email']) . '$#is', $email)) { return $user->lang['Email_banned']; } diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 3b95658404..c2136d4671 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -170,31 +170,35 @@ function sync($type, $id) return true; } -function prune($forum_id, $prune_date) +function prune($forum_id, $prune_date, $sql_topics = '') { global $db, $lang, $phpEx, $phpbb_root_path; - // Those without polls ... - $sql = "SELECT t.topic_id - FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t - WHERE t.forum_id = $forum_id - AND t.topic_vote = 0 - AND t.topic_type <> " . POST_ANNOUNCE . " - AND ( p.post_id = t.topic_last_post_id - OR t.topic_last_post_id = 0 )"; - if ( $prune_date != '' ) + if ($sql_topics = '') { - $sql .= " AND p.post_time < $prune_date"; - } - $result = $db->sql_query($sql); + // Those without polls ... + $sql = "SELECT t.topic_id + FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t + WHERE t.forum_id = $forum_id + AND t.topic_vote = 0 + AND t.topic_type <> " . POST_ANNOUNCE . " + AND (p.post_id = t.topic_last_post_id + OR t.topic_last_post_id = 0)"; + if ($prune_date != '') + { + $sql .= " AND p.post_time < $prune_date"; + } + $result = $db->sql_query($sql); - $sql_topics = ''; - while ( $row = $db->sql_fetchrow($result) ) - { - $sql_topics .= ( ( $sql_topics != '' ) ? ', ' : '' ) . $row['topic_id']; + $sql_topics = ''; + while ($row = $db->sql_fetchrow($result)) + { + $sql_topics .= (($sql_topics != '') ? ', ' : '') . $row['topic_id']; + } + $db->sql_freeresult($result); } - if ( $sql_topics != '' ) + if ($sql_topics != '') { $sql = "SELECT post_id FROM " . POSTS_TABLE . " @@ -202,16 +206,20 @@ function prune($forum_id, $prune_date) AND topic_id IN ($sql_topics)"; $result = $db->sql_query($sql); - $sql_post = ''; - while ( $row = $db->sql_fetchrow($result) ) + $sql_posts = ''; + while ($row = $db->sql_fetchrow($result)) { - $sql_post .= ( ( $sql_post != '' ) ? ', ' : '' ) . $row['post_id']; + $sql_posts .= (($sql_posts != '') ? ', ' : '') . $row['post_id']; } - if ( $sql_post != '' ) + if ($sql_post != '') { $db->sql_transaction(); + $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " + WHERE topic_id IN ($sql_topics)"; + $db->sql_query($sql); + $sql = "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id IN ($sql_topics)"; $db->sql_query($sql); @@ -219,20 +227,20 @@ function prune($forum_id, $prune_date) $pruned_topics = $db->sql_affectedrows(); $sql = "DELETE FROM " . POSTS_TABLE . " - WHERE post_id IN ($sql_post)"; + WHERE post_id IN ($sql_posts)"; $db->sql_query($sql); $pruned_posts = $db->sql_affectedrows(); $sql = "DELETE FROM " . POSTS_TEXT_TABLE . " - WHERE post_id IN ($sql_post)"; + WHERE post_id IN ($sql_posts)"; $db->sql_query($sql); $sql = "DELETE FROM " . SEARCH_MATCH_TABLE . " - WHERE post_id IN ($sql_post)"; + WHERE post_id IN ($sql_posts)"; $db->sql_query($sql); - remove_search_post($sql_post); + sync('forum', $forum_id); $db->sql_transaction('commit'); @@ -254,15 +262,14 @@ function auto_prune($forum_id = 0) WHERE forum_id = $forum_id"; $result = $db->sql_query($sql); - if ( $row = $db->sql_fetchrow($result) ) + if ($row = $db->sql_fetchrow($result)) { - if ( $row['prune_freq'] && $row['prune_days'] ) + if ($row['prune_freq'] && $row['prune_days']) { - $prune_date = time() - ( $row['prune_days'] * 86400 ); - $next_prune = time() + ( $row['prune_freq'] * 86400 ); + $prune_date = time() - ($row['prune_days'] * 86400); + $next_prune = time() + ($row['prune_freq'] * 86400); prune($forum_id, $prune_date); - sync('forum', $forum_id); $sql = "UPDATE " . FORUMS_TABLE . " SET prune_next = $next_prune @@ -287,17 +294,17 @@ function remove_comments(&$output) $in_comment = false; for($i = 0; $i < $linecount; $i++) { - if ( preg_match('/^\/\*/', preg_quote($lines[$i])) ) + if (preg_match('/^\/\*/', preg_quote($lines[$i]))) { $in_comment = true; } - if ( !$in_comment ) + if (!$in_comment) { $output .= $lines[$i] . "\n"; } - if ( preg_match('/\*\/$/', preg_quote($lines[$i])) ) + if (preg_match('/\*\/$/', preg_quote($lines[$i]))) { $in_comment = false; } @@ -320,9 +327,9 @@ function remove_remarks($sql) for ($i = 0; $i < $linecount; $i++) { - if ( $i != $linecount - 1 || strlen($lines[$i]) > 0 ) + if ($i != $linecount - 1 || strlen($lines[$i]) > 0) { - $output .= ( $lines[$i][0] != '#' ) ? $lines[$i] . "\n" : "\n"; + $output .= ($lines[$i][0] != '#') ? $lines[$i] . "\n" : "\n"; // Trading a bit of speed for lower mem. use here. $lines[$i] = ''; } @@ -351,7 +358,7 @@ function split_sql_file($sql, $delimiter) for ($i = 0; $i < $token_count; $i++) { // Don't wanna add an empty string as the last thing in the array. - if ( $i != $token_count - 1 || strlen($tokens[$i] > 0) ) + if ($i != $token_count - 1 || strlen($tokens[$i] > 0)) { // This is the total number of single quotes in the token. $total_quotes = preg_match_all("/'/", $tokens[$i], $matches); @@ -362,7 +369,7 @@ function split_sql_file($sql, $delimiter) $unescaped_quotes = $total_quotes - $escaped_quotes; // If the number of unescaped quotes is even, then the delimiter did NOT occur inside a string literal. - if ( !($unescaped_quotes % 2) ) + if (!($unescaped_quotes % 2)) { // It's a complete sql statement. $output[] = $tokens[$i]; @@ -390,7 +397,7 @@ function split_sql_file($sql, $delimiter) $unescaped_quotes = $total_quotes - $escaped_quotes; - if ( ($unescaped_quotes % 2) == 1 ) + if (($unescaped_quotes % 2) == 1) { // odd number of unescaped quotes. In combination with the previous incomplete // statement(s), we now have a complete statement. (2 odds always make an even) @@ -426,7 +433,7 @@ function config_config($config = false) { global $db, $phpbb_root_path, $phpEx; - if ( !$config ) + if (!$config) { $config = array(); @@ -444,7 +451,7 @@ function config_config($config = false) $cache_str = "\$config = array(\n"; foreach ($config as $config_name => $config_value) { - $cache_str .= "\t'$config_name' => " . ( ( is_numeric($config_value) ) ? $config_value : '"' . addslashes($config_value) . '"' ) . ",\n"; + $cache_str .= "\t'$config_name' => " . ((is_numeric($config_value)) ? $config_value : '"' . addslashes($config_value) . '"') . ",\n"; } $cache_str .= ");"; @@ -586,7 +593,7 @@ class auth_admin extends auth foreach ($auth as $auth_value => $allow) { $flag = substr($auth_value, 0, strpos($auth_value, '_') + 1); - if ( empty($auth[$flag]) ) + if (empty($auth[$flag])) { $auth[$flag] = $allow; } @@ -603,35 +610,35 @@ class auth_admin extends auth $db->sql_freeresult($result); // One or more forums - if ( !is_array($forum_id) ) + if (!is_array($forum_id)) { $forum_id = array($forum_id); } // NOTE THIS USED TO BE IN ($forum_id, 0) ... $forum_sql = 'AND a.forum_id IN (' . implode(', ', $forum_id) . ')'; - $sql = ( $mode == 'user' ) ? "SELECT o.auth_option_id, o.auth_value, a.forum_id, a.auth_allow_deny FROM " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $forum_sql AND a.user_id = $ug_id" :"SELECT o.auth_option_id, o.auth_value, a.forum_id, a.auth_allow_deny FROM " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $forum_sql AND a.group_id = $ug_id"; + $sql = ($mode == 'user') ? "SELECT o.auth_option_id, o.auth_value, a.forum_id, a.auth_allow_deny FROM " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $forum_sql AND a.user_id = $ug_id" :"SELECT o.auth_option_id, o.auth_value, a.forum_id, a.auth_allow_deny FROM " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $forum_sql AND a.group_id = $ug_id"; $result = $db->sql_query($sql); $cur_auth = array(); - while ( $row = $db->sql_fetchrow($result) ) + while ($row = $db->sql_fetchrow($result)) { $cur_auth[$row['forum_id']][$row['auth_option_id']] = $row['auth_allow_deny']; } $db->sql_freeresult($result); - $table = ( $mode == 'user' ) ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; + $table = ($mode == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; $id_field = $mode . '_id'; - foreach ( $forum_id as $forum) + foreach ($forum_id as $forum) { - foreach ( $auth as $auth_value => $allow ) + foreach ($auth as $auth_value => $allow) { $auth_option_id = $option_ids[$auth_value]; - if ( !empty($cur_auth[$forum]) ) + if (!empty($cur_auth[$forum])) { - $sql_ary[] = ( !isset($cur_auth[$forum][$auth_option_id]) ) ? "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_allow_deny) VALUES ($ug_id, $forum, $auth_option_id, $allow)" : ( ( $cur_auth[$forum][$auth_option_id] != $allow ) ? "UPDATE " . $table . " SET auth_allow_deny = $allow WHERE $id_field = $ug_id AND forum_id = $forum AND auth_option_id = $auth_option_id" : '' ); + $sql_ary[] = (!isset($cur_auth[$forum][$auth_option_id])) ? "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_allow_deny) VALUES ($ug_id, $forum, $auth_option_id, $allow)" : (($cur_auth[$forum][$auth_option_id] != $allow) ? "UPDATE " . $table . " SET auth_allow_deny = $allow WHERE $id_field = $ug_id AND forum_id = $forum AND auth_option_id = $auth_option_id" : ''); } else { @@ -642,9 +649,9 @@ class auth_admin extends auth unset($forum_id); unset($user_auth); - foreach ( $sql_ary as $sql ) + foreach ($sql_ary as $sql) { - if ( $sql != '' ) + if ($sql != '') { $result = $db->sql_query($sql); $db->sql_freeresult($result); @@ -664,12 +671,12 @@ class auth_admin extends auth { for($i = 0; $i < count($auth_ids); $i++) { - $auth_sql .= ( ( $auth_sql != '' ) ? ', ' : '' ) . $auth_ids[$i]; + $auth_sql .= (($auth_sql != '') ? ', ' : '') . $auth_ids[$i]; } $auth_sql = " AND auth_option_id IN ($auth_sql)"; } - $table = ( $mode == 'user' ) ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; + $table = ($mode == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; $id_field = $mode . '_id'; $sql = "DELETE FROM $table @@ -685,7 +692,7 @@ class auth_admin extends auth { global $db; - $where_sql = ( $user_id ) ? "WHERE user_id = $user_id" : ''; + $where_sql = ($user_id) ? "WHERE user_id = $user_id" : ''; $sql = "UPDATE " . USERS_TABLE . " SET user_permissions = '' @@ -699,7 +706,7 @@ class auth_admin extends auth // $options = array( // 'local' => array('option1', 'option2', ...), // 'global' => array('optionA', 'optionB', ...) - // ); + //); function acl_add_option($options) { global $db; @@ -716,13 +723,13 @@ class auth_admin extends auth ORDER BY is_global, is_local, auth_value"; $result = $db->sql_query($sql); - while ( $row = $db->sql_fetchrow($result) ) + while ($row = $db->sql_fetchrow($result)) { - if ( !empty($row['is_global']) ) + if (!empty($row['is_global'])) { $cur_options['global'][] = $row['auth_value']; } - if ( !empty($row['is_local']) ) + if (!empty($row['is_local'])) { $cur_options['local'][] = $row['auth_value']; } @@ -773,10 +780,10 @@ class auth_admin extends auth { case 'mysql': case 'mysql4': - $sql .= ( ($sql != '') ? ', ' : '' ) . "('$option', " . $type_sql[$type] . ")"; + $sql .= (($sql != '') ? ', ' : '') . "('$option', " . $type_sql[$type] . ")"; break; case 'mssql': - $sql .= ( ($sql != '') ? ' UNION ALL ' : '' ) . " SELECT '$option', " . $type_sql[$type]; + $sql .= (($sql != '') ? ' UNION ALL ' : '') . " SELECT '$option', " . $type_sql[$type]; break; default: $sql = "INSERT INTO " . ACL_OPTIONS_TABLE . " (auth_value, is_global, is_local) @@ -788,7 +795,7 @@ class auth_admin extends auth } } - if ( $sql != '' ) + if ($sql != '') { $sql = "INSERT INTO " . ACL_OPTIONS_TABLE . " (auth_value, is_global, is_local) VALUES $sql"; @@ -804,7 +811,7 @@ class auth_admin extends auth $options = array(); - if ( !$options ) + if (!$options) { $sql = "SELECT auth_value, is_global, is_local FROM " . ACL_OPTIONS_TABLE . " @@ -812,13 +819,13 @@ class auth_admin extends auth $result = $db->sql_query($sql); $global = $local = 0; - while ( $row = $db->sql_fetchrow($result) ) + while ($row = $db->sql_fetchrow($result)) { - if ( !empty($row['is_global']) ) + if (!empty($row['is_global'])) { $options['global'][$row['auth_value']] = $global++; } - if ( !empty($row['is_local']) ) + if (!empty($row['is_local'])) { $options['local'][$row['auth_value']] = $local++; } diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php index 6e5a14fcc2..55504d505b 100644 --- a/phpBB/includes/page_header.php +++ b/phpBB/includes/page_header.php @@ -29,7 +29,7 @@ define('HEADER_INC', TRUE); // gzip_compression if ($config['gzip_compress']) { - if (extension_loaded('zlib') && strstr($HTTP_USER_AGENT,'compatible') && !headers_sent()) + if (extension_loaded('zlib') && !headers_sent()) { ob_start('ob_gzhandler'); } @@ -306,7 +306,7 @@ $template->assign_vars(array( 'U_SEARCH' => 'search.'.$phpEx.$SID, 'U_REGISTER' => 'ucp.'.$phpEx.$SID.'&mode=register', 'U_PROFILE' => 'ucp.'.$phpEx.$SID.'&mode=editprofile', - 'U_MODCP' => 'modcp.'.$phpEx.$SID, + 'U_MODCP' => 'mcp.'.$phpEx.$SID, 'U_FAQ' => 'faq.'.$phpEx.$SID, 'U_SEARCH_SELF' => 'search.'.$phpEx.$SID.'&search_id=egosearch', 'U_SEARCH_NEW' => 'search.'.$phpEx.$SID.'&search_id=newposts', diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 9f1d5c8f7c..b87a10b725 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -203,8 +203,6 @@ class session } } while ($row = $db->sql_fetchrow($result)); - - } $db->sql_freeresult($result); diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index 53e559a1c6..44d93b0609 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -37,6 +37,12 @@ to this source */ +// Changes for 2.2: +// +// * Allow use of Smarty plug-ins? +// * Allow use of DB for storage of compiled templates +// * Reduce number of methods and variables + class Template { var $classname = 'Template'; @@ -129,12 +135,12 @@ class Template { // If we don't have a file assigned to this handle, die. if (!isset($this->files[$handle])) { - message_die("Template->loadfile(): No file specified for handle $handle"); + trigger_error("Template->loadfile(): No file specified for handle $handle", E_USER_ERROR); } if (!($fp = @fopen($this->files[$handle], 'r'))) { - message_die("Template->loadfile(): Error - file $filename does not exist or is empty"); + trigger_error("Template->loadfile(): Error - file $filename does not exist or is empty", E_USER_ERROR); } $str = ''; @@ -173,7 +179,7 @@ class Template { { if (!$this->loadfile($handle)) { - message_die("Template->pparse(): Couldn't load template file for handle $handle"); + trigger_error("Template->pparse(): Couldn't load template file for handle $handle", E_USER_ERROR); } // Actually compile the code now. @@ -202,7 +208,7 @@ class Template { { if (!$this->loadfile($handle)) { - message_die("Template->pparse(): Couldn't load template file for handle $handle"); + trigger_error("Template->pparse(): Couldn't load template file for handle $handle", E_USER_ERROR); } $code = $this->compile($this->uncompiled_code[$handle], true, '_str'); @@ -230,7 +236,7 @@ class Template { { if (!$this->loadfile($handle)) { - message_die("Template->pparse(): Couldn't load template file for handle $handle"); + trigger_error("Template->pparse(): Couldn't load template file for handle $handle", E_USER_ERROR); } $this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]); diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index 4277929192..a96d77aded 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -658,7 +658,7 @@ $lang = array_merge($lang, array( 'Auth_Administrators' => 'administrators', 'Not_Moderator' => 'You are not a moderator of this forum', 'Not_Authorised' => 'Not Authorised', - 'You_been_banned' => 'You have been banned from this forum
Please contact the webmaster or board administrator for more information', + 'You_been_banned' => 'You have been banned from this forum
Please contact the %sboard administrator%s for more information', 'Reg_users_zero_online' => 'There are 0 Registered users and ', 'Reg_users_online' => 'There are %d Registered users and ', 'Reg_user_online' => 'There is %d Registered user and ', diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 19e44c3326..7639386bca 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -22,6 +22,7 @@ // TODO for 2.2: // // * Plug-in based? +// * Add session_id checks for all Moderator ops // * Tab based system // * Front page: // * Select box listing all forums to which user has moderator rights @@ -62,13 +63,13 @@ $confirm = (!empty($_POST['confirm'])) ? TRUE : FALSE; // Check if user did or did not confirm // If they did not, forward them to the last page they were on // -if ( isset($_POST['cancel']) ) +if (isset($_POST['cancel'])) { - if ( $topic_id ) + if ($topic_id) { $redirect = "viewtopic.$phpEx$SID&t=$topic_id"; } - else if ( $forum_id ) + else if ($forum_id) { $redirect = "viewforum.$phpEx$SID&f=$forum_id"; } @@ -90,32 +91,32 @@ $auth->acl($user->data); // // Continue var definitions // -$start = ( isset($_GET['start']) ) ? $_GET['start'] : 0; +$start = (isset($_GET['start'])) ? $_GET['start'] : 0; -$delete = ( isset($_POST['delete']) ) ? TRUE : FALSE; -$move = ( isset($_POST['move']) ) ? TRUE : FALSE; -$lock = ( isset($_POST['lock']) ) ? TRUE : FALSE; -$unlock = ( isset($_POST['unlock']) ) ? TRUE : FALSE; +$delete = (isset($_POST['delete'])) ? TRUE : FALSE; +$move = (isset($_POST['move'])) ? TRUE : FALSE; +$lock = (isset($_POST['lock'])) ? TRUE : FALSE; +$unlock = (isset($_POST['unlock'])) ? TRUE : FALSE; -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 { - if ( $delete ) + if ($delete) { $mode = 'delete'; } - else if ( $move ) + else if ($move) { $mode = 'move'; } - else if ( $lock ) + else if ($lock) { $mode = 'lock'; } - else if ( $unlock ) + else if ($unlock) { $mode = 'unlock'; } @@ -128,7 +129,7 @@ else // // Obtain relevant data // -if ( !empty($topic_id) ) +if (!empty($topic_id)) { $sql = "SELECT f.forum_id, f.forum_name, f.forum_topics FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f @@ -137,12 +138,13 @@ if ( !empty($topic_id) ) $result = $db->sql_query($sql); $topic_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - $forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics']; + $forum_topics = ($topic_row['forum_topics'] == 0) ? 1 : $topic_row['forum_topics']; $forum_id = $topic_row['forum_id']; $forum_name = $topic_row['forum_name']; } -else if ( !empty($forum_id) ) +else if (!empty($forum_id)) { $sql = "SELECT forum_name, forum_topics FROM " . FORUMS_TABLE . " @@ -150,8 +152,9 @@ else if ( !empty($forum_id) ) $result = $db->sql_query($sql); $topic_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - $forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics']; + $forum_topics = ($topic_row['forum_topics'] == 0) ? 1 : $topic_row['forum_topics']; $forum_name = $topic_row['forum_name']; } else @@ -162,7 +165,7 @@ else // // Auth check // -if ( !$auth->acl_get('m_', $forum_id) && !$auth->acl_get('a_') ) +if (!$auth->acl_gets('m_', 'a_', $forum_id)) { trigger_error($user->lang['Not_Moderator']); } @@ -170,77 +173,41 @@ if ( !$auth->acl_get('m_', $forum_id) && !$auth->acl_get('a_') ) // // Do major work ... // -switch( $mode ) +switch($mode) { case 'delete': $page_title = $user->lang['Mod_CP']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); - if ( $confirm ) + if ($confirm) { - include($phpbb_root_path . 'includes/functions_search.'.$phpEx); - - $topics = ( isset($_POST['topic_id_list']) ) ? $_POST['topic_id_list'] : array($topic_id); + $topics = (isset($_POST['topic_id_list'])) ? $_POST['topic_id_list'] : array($topic_id); $topic_id_sql = ''; for($i = 0; $i < count($topics); $i++) { - $topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . intval($topics[$i]); + $topic_id_sql .= (($topic_id_sql != '') ? ', ' : '') . intval($topics[$i]); } - $sql = "SELECT post_id - FROM " . POSTS_TABLE . " - WHERE topic_id IN ($topic_id_sql)"; - $result = $db->sql_query($sql); - - $post_id_sql = ''; - while ( $row = $db->sql_fetchrow($result) ) - { - $post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . $row['post_id']; - } - $db->sql_freeresult($result); + // Use prune feature? + prune($forum_id, '', $topic_id_sql); $sql = "SELECT vote_id FROM " . VOTE_DESC_TABLE . " WHERE topic_id IN ($topic_id_sql)"; $result = $db->sql_query($sql); - $vote_id_sql = ''; - while ( $row = $db->sql_fetchrow($result) ) + if ($row = $db->sql_fetchrow($result)) { - $vote_id_sql .= ( ( $vote_id_sql != '' ) ? ', ' : '' ) . $row['vote_id']; - } - $db->sql_freeresult($result); + $vote_id_sql = ''; + do + { + $vote_id_sql .= (($vote_id_sql != '') ? ', ' : '') . intval($row['vote_id']); + } + while ($row = $db->sql_fetchrow($result)); - // - // Got all required info so go ahead and start deleting everything - // - $sql = "DELETE - FROM " . TOPICS_TABLE . " - WHERE topic_id IN ($topic_id_sql) - OR topic_moved_id IN ($topic_id_sql)"; - if ( !$db->sql_query($sql, BEGIN_TRANSACTION) ) - { - message_die(GENERAL_ERROR, 'Could not delete topics', '', __LINE__, __FILE__, $sql); - } + $db->sql_transaction(); - if ( $post_id_sql != '' ) - { - $sql = "DELETE - FROM " . POSTS_TABLE . " - WHERE post_id IN ($post_id_sql)"; - $db->sql_query($sql); - - $sql = "DELETE - FROM " . POSTS_TEXT_TABLE . " - WHERE post_id IN ($post_id_sql)"; - $db->sql_query($sql); - - remove_search_post($post_id_sql); - } - - if ( $vote_id_sql != '' ) - { $sql = "DELETE FROM " . VOTE_DESC_TABLE . " WHERE vote_id IN ($vote_id_sql)"; @@ -255,19 +222,12 @@ switch( $mode ) FROM " . VOTE_USERS_TABLE . " WHERE vote_id IN ($vote_id_sql)"; $db->sql_query($sql); + + $db->sql_transaction('commit'); } + $db->sql_freeresult($result); - $sql = "DELETE - FROM " . TOPICS_WATCH_TABLE . " - WHERE topic_id IN ($topic_id_sql)"; - if ( !$db->sql_query($sql, END_TRANSACTION) ) - { - message_die(GENERAL_ERROR, 'Could not delete watched post list', '', __LINE__, __FILE__, $sql); - } - - sync('forum', $forum_id); - - if ( !empty($topic_id) ) + if (!empty($topic_id)) { $redirect_page = "viewforum.$phpEx$SID&f==$forum_id"; $l_redirect = sprintf($user->lang['Click_return_forum'], '', ''); @@ -287,15 +247,14 @@ switch( $mode ) else { // Not confirmed, show confirmation message - - if ( empty($_POST['topic_id_list']) && empty($topic_id) ) + if (empty($_POST['topic_id_list']) && empty($topic_id)) { - message_die(GENERAL_MESSAGE, $user->lang['None_selected']); + trigger_error($user->lang['None_selected']); } - $hidden_fields = ''; + $hidden_fields = ''; - if ( isset($_POST['topic_id_list']) ) + if (isset($_POST['topic_id_list'])) { $topics = $_POST['topic_id_list']; for($i = 0; $i < count($topics); $i++) @@ -305,14 +264,12 @@ switch( $mode ) } else { - $hidden_fields .= ''; + $hidden_fields .= ''; } - // // Set template files - // $template->set_filenames(array( - 'confirm' => 'confirm_body.tpl') + 'body' => 'confirm_body.html') ); $template->assign_vars(array( @@ -322,12 +279,10 @@ switch( $mode ) 'L_YES' => $user->lang['Yes'], 'L_NO' => $user->lang['No'], - 'S_CONFIRM_ACTION' => append_sid("mcp.$phpEx"), + 'S_CONFIRM_ACTION' => "mcp.$phpEx$SID", 'S_HIDDEN_FIELDS' => $hidden_fields) ); - $template->pparse('confirm'); - include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } break; @@ -336,69 +291,75 @@ switch( $mode ) $page_title = $user->lang['Mod_CP']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); - if ( $confirm ) + if ($confirm) { $new_forum_id = $_POST['new_forum']; $old_forum_id = $forum_id; - if ( $new_forum_id != $old_forum_id ) + if ($new_forum_id != $old_forum_id) { - $topics = ( isset($_POST['topic_id_list']) ) ? $_POST['topic_id_list'] : array($topic_id); + $topics = (isset($_POST['topic_id_list'])) ? $_POST['topic_id_list'] : array($topic_id); $topic_list = ''; for($i = 0; $i < count($topics); $i++) { - $topic_list .= ( ( $topic_list != '' ) ? ', ' : '' ) . intval($topics[$i]); + $topic_list .= (($topic_list != '') ? ', ' : '') . intval($topics[$i]); } $sql = "SELECT * FROM " . TOPICS_TABLE . " WHERE topic_id IN ($topic_list) AND topic_status <> " . ITEM_MOVED; - if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) ) - { - message_die(GENERAL_ERROR, 'Could not select from topic table', '', __LINE__, __FILE__, $sql); - } + $result = $db->sql_query($sql); $row = $db->sql_fetchrowset($result); $db->sql_freeresult($result); + $db->sql_transaction(); + for($i = 0; $i < count($row); $i++) { $topic_id = $row[$i]['topic_id']; - if ( isset($_POST['move_leave_shadow']) ) + if (isset($_POST['move_leave_shadow'])) { + $shadow_sql = array( + 'forum_id' => $old_forum_id, + 'topic_title' => $db->sql_escape($row[$i]['topic_title']), + 'topic_poster' => $row[$i]['topic_poster'], + 'topic_time' => $row[$i]['topic_time'], + 'topic_status' => ITEM_MOVED, + 'topic_type' => POST_NORMAL, + 'topic_vote' => $row[$i]['topic_vote'], + 'topic_views' => $row[$i]['topic_views'], + 'topic_replies' => $row[$i]['topic_replies'], + 'topic_first_post_id' => $row[$i]['topic_first_post_id'], + 'topic_last_post_id' => $row[$i]['topic_last_post_id'], + 'topic_moved_id' => $topic_id, + ); + // Insert topic in the old forum that indicates that the forum has moved. - $sql = "INSERT INTO " . TOPICS_TABLE . " (forum_id, topic_title, topic_poster, topic_time, topic_status, topic_type, topic_vote, topic_views, topic_replies, topic_first_post_id, topic_last_post_id, topic_moved_id) - VALUES ($old_forum_id, '" . addslashes(str_replace("\'", "''", $row[$i]['topic_title'])) . "', '" . str_replace("\'", "''", $row[$i]['topic_poster']) . "', " . $row[$i]['topic_time'] . ", " . ITEM_MOVED . ", " . POST_NORMAL . ", " . $row[$i]['topic_vote'] . ", " . $row[$i]['topic_views'] . ", " . $row[$i]['topic_replies'] . ", " . $row[$i]['topic_first_post_id'] . ", " . $row[$i]['topic_last_post_id'] . ", $topic_id)"; - if ( !$db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, 'Could not insert shadow topic', '', __LINE__, __FILE__, $sql); - } + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $shadow_sql); + $db->sql_query($sql); } $sql = "UPDATE " . TOPICS_TABLE . " SET forum_id = $new_forum_id WHERE topic_id = $topic_id"; - if ( !$db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, 'Could not update old topic', '', __LINE__, __FILE__, $sql); - } + $db->sql_query($sql); $sql = "UPDATE " . POSTS_TABLE . " SET forum_id = $new_forum_id WHERE topic_id = $topic_id"; - if ( !$db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, 'Could not update post topic ids', '', __LINE__, __FILE__, $sql); - } + $db->sql_query($sql); } // Sync the forum indexes sync('forum', $new_forum_id); sync('forum', $old_forum_id); + $db->sql_transaction('commit'); + $message = $user->lang['Topics_Moved'] . '

'; } @@ -407,7 +368,7 @@ switch( $mode ) $message = $user->lang['No_Topics_Moved'] . '

'; } - if ( !empty($topic_id) ) + if (!empty($topic_id)) { $redirect_page = "viewtopic.$phpEx$SID&t=$topic_id"; $message .= sprintf($user->lang['Click_return_topic'], '', ''); @@ -418,24 +379,24 @@ switch( $mode ) $message .= sprintf($user->lang['Click_return_modcp'], '', ''); } - $message = $message . '

' . sprintf($user->lang['Click_return_forum'], '', ''); + $message = $message . '

' . sprintf($user->lang['Click_return_forum'], '', ''); $template->assign_vars(array( 'META' => '') ); - message_die(GENERAL_MESSAGE, $message); + trigger_error($message); } else { - if ( empty($_POST['topic_id_list']) && empty($topic_id) ) + if (empty($_POST['topic_id_list']) && empty($topic_id)) { - message_die(GENERAL_MESSAGE, $user->lang['None_selected']); + trigger_error($user->lang['None_selected']); } - $hidden_fields = ''; + $hidden_fields = ''; - if ( isset($_POST['topic_id_list']) ) + if (isset($_POST['topic_id_list'])) { $topics = $_POST['topic_id_list']; @@ -446,14 +407,12 @@ switch( $mode ) } else { - $hidden_fields .= ''; + $hidden_fields .= ''; } - // // Set template files - // $template->set_filenames(array( - 'movetopic' => 'modcp_move.tpl') + 'body' => 'mcp_move.html') ); $template->assign_vars(array( @@ -461,40 +420,33 @@ switch( $mode ) 'MESSAGE_TEXT' => $user->lang['Confirm_move_topic'], 'L_MOVE_TO_FORUM' => $user->lang['Move_to_forum'], - 'L_LEAVESHADOW' => $user->lang['Leave_shadow_topic'], - 'L_YES' => $user->lang['Yes'], - 'L_NO' => $user->lang['No'], + 'L_LEAVE_SHADOW' => $user->lang['Leave_shadow_topic'], 'S_FORUM_SELECT' => '', - 'S_MODCP_ACTION' => append_sid("mcp.$phpEx"), + 'S_MODCP_ACTION' => "mcp.$phpEx$SID", 'S_HIDDEN_FIELDS' => $hidden_fields) ); - $template->pparse('movetopic'); - include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } break; case 'lock': - $topics = ( !empty($_POST['topic_id_list']) ) ? $_POST['topic_id_list'] : array($topic_id); + $topics = (!empty($_POST['topic_id_list'])) ? $_POST['topic_id_list'] : array($topic_id); $topic_id_sql = ''; for($i = 0; $i < count($topics); $i++) { - $topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . $topics[$i]; + $topic_id_sql .= (($topic_id_sql != '') ? ', ' : '') . $topics[$i]; } $sql = "UPDATE " . TOPICS_TABLE . " SET topic_status = " . ITEM_LOCKED . " WHERE topic_id IN ($topic_id_sql) AND topic_moved_id = 0"; - if ( !($result = $db->sql_query($sql)) ) - { - trigger_error('Could not update topics table'); - } + $db->sql_query($sql); - if ( !empty($topic_id) ) + if (!empty($topic_id)) { $redirect_page = "viewtopic.$phpEx$SID&t=$topic_id"; $message = sprintf($user->lang['Click_return_topic'], '', ''); @@ -516,12 +468,12 @@ switch( $mode ) break; case 'unlock': - $topics = ( isset($_POST['topic_id_list']) ) ? $_POST['topic_id_list'] : array($topic_id); + $topics = (isset($_POST['topic_id_list'])) ? $_POST['topic_id_list'] : array($topic_id); $topic_id_sql = ''; for($i = 0; $i < count($topics); $i++) { - $topic_id_sql .= ( ( $topic_id_sql != "") ? ', ' : '' ) . $topics[$i]; + $topic_id_sql .= (($topic_id_sql != "") ? ', ' : '') . $topics[$i]; } $sql = "UPDATE " . TOPICS_TABLE . " @@ -530,7 +482,7 @@ switch( $mode ) AND topic_moved_id = 0"; $db->sql_query($sql); - if ( !empty($topic_id) ) + if (!empty($topic_id)) { $redirect_page = "viewtopic.$phpEx$SID&t=$topic_id"; $message = sprintf($user->lang['Click_return_topic'], '', ''); @@ -555,7 +507,7 @@ switch( $mode ) $page_title = $user->lang['Mod_CP']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); - if ( isset($_POST['split_type_all']) || isset($_POST['split_type_beyond']) ) + if (isset($_POST['split_type_all']) || isset($_POST['split_type_beyond'])) { $posts = $_POST['post_id_list']; @@ -565,12 +517,14 @@ switch( $mode ) $result = $db->sql_query($sql); $post_rowset = $db->sql_fetchrow($result); - $first_poster = str_replace("\'", "''", $post_rowset['poster_id']); + $db->sql_freeresult($result); + + $first_poster = $post_rowset['poster_id']; $topic_id = $post_rowset['topic_id']; $post_time = $post_rowset['post_time']; - $post_subject = trim(htmlspecialchars($_POST['subject'])); - if ( empty($post_subject) ) + $post_subject = $db->sql_escape(trim(htmlspecialchars($_POST['subject']))); + if (empty($post_subject)) { trigger_error($user->lang['Empty_subject']); } @@ -578,25 +532,27 @@ switch( $mode ) $new_forum_id = intval($_POST['new_forum_id']); $topic_time = time(); + $db->sql_transaction(); + $sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type) - VALUES ('" . str_replace("\'", "''", $post_subject) . "', $first_poster, " . $topic_time . ", $new_forum_id, " . ITEM_UNLOCKED . ", " . POST_NORMAL . ")"; + VALUES ('$post_subject', $first_poster, " . $topic_time . ", $new_forum_id, " . ITEM_UNLOCKED . ", " . POST_NORMAL . ")"; $db->sql_query($sql); $new_topic_id = $db->sql_nextid(); - if( !empty($_POST['split_type_all']) ) + if(!empty($_POST['split_type_all'])) { $post_id_sql = ''; for($i = 0; $i < count($posts); $i++) { - $post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . $posts[$i]; + $post_id_sql .= (($post_id_sql != '') ? ', ' : '') . $posts[$i]; } $sql = "UPDATE " . POSTS_TABLE . " SET topic_id = $new_topic_id, forum_id = $new_forum_id WHERE post_id IN ($post_id_sql)"; } - else if( !empty($_POST['split_type_beyond']) ) + else if(!empty($_POST['split_type_beyond'])) { $sql = "UPDATE " . POSTS_TABLE . " SET topic_id = $new_topic_id, forum_id = $new_forum_id @@ -611,12 +567,13 @@ switch( $mode ) sync('forum', $new_forum_id); sync('forum', $forum_id); + $db->sql_transaction('commit'); + $template->assign_vars(array( 'META' => '') ); - $message = $user->lang['Topic_split'] . '

' . sprintf($user->lang['Click_return_topic'], '', ''); - trigger_error($message); + trigger_error($user->lang['Topic_split'] . '

' . sprintf($user->lang['Click_return_topic'], '', '')); } else { @@ -624,7 +581,7 @@ switch( $mode ) // Set template files // $template->set_filenames(array( - 'split_body' => 'modcp_split.tpl') + 'body' => 'mcp_split.html') ); $sql = "SELECT u.username, p.*, pt.post_text, pt.bbcode_uid, pt.post_subject, p.post_username @@ -637,7 +594,7 @@ switch( $mode ) $s_hidden_fields = ''; - if( ( $total_posts = $db->sql_numrows($result) ) > 0 ) + if(($total_posts = $db->sql_numrows($result)) > 0) { $postrow = $db->sql_fetchrowset($result); @@ -677,48 +634,41 @@ switch( $mode ) $bbcode_uid = $postrow[$i]['bbcode_uid']; $message = $postrow[$i]['post_text']; - $post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : $topic_title; + $post_subject = ($postrow[$i]['post_subject'] != '') ? $postrow[$i]['post_subject'] : $topic_title; - // // If the board has HTML off but the post has HTML // on then we process it, else leave it alone - // - if ( !$config['allow_html'] ) + if (!$config['allow_html']) { - if ( $postrow[$i]['enable_html'] ) + if ($postrow[$i]['enable_html']) { $message = preg_replace('#(<)([\/]?.*?)(>)#is', '<\\2>', $message); } } - if ( $bbcode_uid != '' ) + if ($bbcode_uid != '') { - $message = ( $config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); +// $message = ($config['allow_bbcode']) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); } - // // Define censored word matches - // $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); - if ( count($orig_word) ) + if (count($orig_word)) { $post_subject = preg_replace($orig_word, $replacement_word, $post_subject); $message = preg_replace($orig_word, $replacement_word, $message); } - $message = make_clickable($message); - - if ( $config['allow_smilies'] && $postrow[$i]['enable_smilies'] ) + if ($config['allow_smilies'] && $postrow[$i]['enable_smilies']) { - $message = smilies_pass($message); } - $message = str_replace("\n", '
', $message); + $message = nl2br($message); - $checkbox = ( $i > 0 ) ? '' : ' '; + $checkbox = ($i > 0) ? '' : ' '; $template->assign_block_vars('postrow', array( 'POSTER_NAME' => $poster, @@ -730,8 +680,6 @@ switch( $mode ) 'S_SPLIT_CHECKBOX' => $checkbox) ); } - - $template->pparse('split_body'); } } break; @@ -740,18 +688,16 @@ switch( $mode ) $page_title = $user->lang['Mod_CP']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); - $rdns_ip_num = ( isset($_GET['rdns']) ) ? $_GET['rdns'] : ''; + $rdns_ip_num = (isset($_GET['rdns'])) ? $_GET['rdns'] : ''; - if ( !$post_id ) + if (!$post_id) { trigger_error($user->lang['No_such_post']); } - // // Set template files - // $template->set_filenames(array( - 'viewip' => 'modcp_viewip.tpl') + 'body' => 'mcp_viewip.html') ); // Look up relevent data for this post @@ -760,13 +706,13 @@ switch( $mode ) WHERE post_id = $post_id"; $result = $db->sql_query($sql); - if ( !($post_row = $db->sql_fetchrow($result)) ) + if (!($post_row = $db->sql_fetchrow($result))) { trigger_error($user->lang['No_such_post']); } $ip_this_post = $post_row['poster_ip']; - $ip_this_post = ( $rdns_ip_num == $ip_this_post ) ? gethostbyaddr($ip_this_post) : $ip_this_post; + $ip_this_post = ($rdns_ip_num == $ip_this_post) ? gethostbyaddr($ip_this_post) : $ip_this_post; $poster_id = $post_row['poster_id']; @@ -795,37 +741,36 @@ switch( $mode ) ORDER BY postings DESC"; $result = $db->sql_query($sql); - if ( $row = $db->sql_fetchrow($result) ) + if ($row = $db->sql_fetchrow($result)) { $i = 0; do { - if ( $row['poster_ip'] == $post_row['poster_ip'] ) + if ($row['poster_ip'] == $post_row['poster_ip']) { $template->assign_vars(array( - 'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $user->lang['Post'] : $user->lang['Posts'] )) + 'POSTS' => $row['postings'] . ' ' . (($row['postings'] == 1) ? $user->lang['Post'] : $user->lang['Posts'])) ); continue; } $ip = $row['poster_ip']; - $ip = ( $rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? gethostbyaddr($ip) : $ip; + $ip = ($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? gethostbyaddr($ip) : $ip; $template->assign_block_vars('iprow', array( 'IP' => $ip, - 'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $user->lang['Post'] : $user->lang['Posts'] ), + 'POSTS' => $row['postings'] . ' ' . (($row['postings'] == 1) ? $user->lang['Post'] : $user->lang['Posts']), 'U_LOOKUP_IP' => "mcp.$phpEx$SID&mode=ip&p=$post_id&t=$topic_id&rdns=" . $row['poster_ip']) ); $i++; } - while ( $row = $db->sql_fetchrow($result) ); + while ($row = $db->sql_fetchrow($result)); } + $db->sql_freeresult($result); - // // Get other users who've posted under this IP - // $sql = "SELECT u.user_id, u.username, COUNT(*) as postings FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p WHERE p.poster_id = u.user_id @@ -834,17 +779,17 @@ switch( $mode ) ORDER BY postings DESC"; $result = $db->sql_query($sql); - if ( $row = $db->sql_fetchrow($result) ) + if ($row = $db->sql_fetchrow($result)) { $i = 0; do { $id = $row['user_id']; - $username = ( !$id ) ? $user->lang['Guest'] : $row['username']; + $username = (!$id) ? $user->lang['Guest'] : $row['username']; $template->assign_block_vars('userrow', array( 'USERNAME' => $username, - 'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $user->lang['Post'] : $user->lang['Posts'] ), + 'POSTS' => $row['postings'] . ' ' . (($row['postings'] == 1) ? $user->lang['Post'] : $user->lang['Posts']), 'L_SEARCH_POSTS' => sprintf($user->lang['Search_user_posts'], $username), 'U_PROFILE' => "ucp.$phpEx$SID&mode=viewprofile&u=$id", @@ -853,11 +798,9 @@ switch( $mode ) $i++; } - while ( $row = $db->sql_fetchrow($result) ); + while ($row = $db->sql_fetchrow($result)); } - - $template->pparse('viewip'); - + $db->sql_freeresult($result); break; default: @@ -865,7 +808,7 @@ switch( $mode ) include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( - 'body' => 'modcp_body.html') + 'body' => 'mcp_topics.html') ); make_jumpbox('mcp.'.$phpEx); @@ -889,9 +832,7 @@ switch( $mode ) 'S_MODCP_ACTION' => "mcp.$phpEx$SID") ); - // // Define censored word matches - // $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); @@ -905,23 +846,23 @@ switch( $mode ) LIMIT $start, " . $config['topics_per_page']; $result = $db->sql_query($sql); - while ( $row = $db->sql_fetchrow($result) ) + while ($row = $db->sql_fetchrow($result)) { $topic_title = ''; - if ( $row['topic_status'] == ITEM_LOCKED ) + if ($row['topic_status'] == ITEM_LOCKED) { $folder_img = $user->img('folder_locked'); $folder_alt = $user->lang['Topic_locked']; } else { - if ( $row['topic_type'] == POST_ANNOUNCE ) + if ($row['topic_type'] == POST_ANNOUNCE) { $folder_img = $user->img('folder_announce'); $folder_alt = $user->lang['Announcement']; } - else if ( $row['topic_type'] == POST_STICKY ) + else if ($row['topic_type'] == POST_STICKY) { $folder_img = $user->img('folder_sticky'); $folder_alt = $user->lang['Sticky']; @@ -937,15 +878,15 @@ switch( $mode ) $topic_type = $row['topic_type']; $topic_status = $row['topic_status']; - if ( $topic_type == POST_ANNOUNCE ) + if ($topic_type == POST_ANNOUNCE) { $topic_type = $user->lang['Topic_Announcement'] . ' '; } - else if ( $topic_type == POST_STICKY ) + else if ($topic_type == POST_STICKY) { $topic_type = $user->lang['Topic_Sticky'] . ' '; } - else if ( $topic_status == ITEM_MOVED ) + else if ($topic_status == ITEM_MOVED) { $topic_type = $user->lang['Topic_Moved'] . ' '; } @@ -954,13 +895,13 @@ switch( $mode ) $topic_type = ''; } - if ( $row['topic_vote'] ) + if ($row['topic_vote']) { $topic_type .= $user->lang['Topic_Poll'] . ' '; } $topic_title = $row['topic_title']; - if ( count($orig_word) ) + if (count($orig_word)) { $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); } @@ -987,7 +928,7 @@ switch( $mode ) $template->assign_vars(array( 'PAGINATION' => generate_pagination("mcp.$phpEx$SID&f=$forum_id", $forum_topics, $config['topics_per_page'], $start), - 'PAGE_NUMBER' => sprintf($user->lang['Page_of'], ( floor( $start / $config['topics_per_page'] ) + 1 ), ceil( $forum_topics / $config['topics_per_page'] )), + 'PAGE_NUMBER' => sprintf($user->lang['Page_of'], (floor($start / $config['topics_per_page']) + 1), ceil($forum_topics / $config['topics_per_page'])), 'L_GOTO_PAGE' => $user->lang['Goto_page']) ); diff --git a/phpBB/templates/subSilver/mcp_move.html b/phpBB/templates/subSilver/mcp_move.html new file mode 100644 index 0000000000..6d3a2bbb25 --- /dev/null +++ b/phpBB/templates/subSilver/mcp_move.html @@ -0,0 +1,40 @@ + + +
+ + + + +
+ + + + + + + +
{MESSAGE_TITLE}
+ + + + + + + + + + +
 
{L_MOVE_TO_FORUM}   {S_FORUM_SELECT}

+ {L_LEAVE_SHADOW}
+
+ {MESSAGE_TEXT}

+
+ {S_HIDDEN_FIELDS} + +    + +
 
+
+
+ + \ No newline at end of file diff --git a/phpBB/templates/subSilver/mcp_split.html b/phpBB/templates/subSilver/mcp_split.html new file mode 100644 index 0000000000..254bdc4fbc --- /dev/null +++ b/phpBB/templates/subSilver/mcp_split.html @@ -0,0 +1,90 @@ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_SPLIT_TOPIC}
{L_SPLIT_TOPIC_EXPLAIN}
{L_SPLIT_SUBJECT} + +
{L_SPLIT_FORUM}{S_FORUM_SELECT}
+ + + + + +
+ + + +
+
{L_AUTHOR}{L_MESSAGE}{L_SELECT}
{postrow.POSTER_NAME} + + + + + + + +
{L_POST}{L_POSTED}: + {postrow.POST_DATE}    {L_POST_SUBJECT}: {postrow.POST_SUBJECT}
+
+ {postrow.MESSAGE}
+
{postrow.S_SPLIT_CHECKBOX}
.
+ + + + + +
+ + + + {S_HIDDEN_FIELDS}
+
+ + + + +
{S_TIMEZONE}
+
+ + \ No newline at end of file diff --git a/phpBB/templates/subSilver/mcp_topics.html b/phpBB/templates/subSilver/mcp_topics.html new file mode 100644 index 0000000000..4c89bdcfbc --- /dev/null +++ b/phpBB/templates/subSilver/mcp_topics.html @@ -0,0 +1,70 @@ + + +
+ + + + + + + +
+ + + + + +
 Front Page  Topic Listing 
+
+ + + + +
{L_INDEX}
+
+ + + + + + + + + + + + + + + + + + + + +
  {L_TOPICS}  {L_REPLIES}  {L_LASTPOST}  {L_SELECT} 
{topicrow.L_TOPIC_FOLDER_ALT} {topicrow.TOPIC_TYPE}{topicrow.TOPIC_TITLE}{topicrow.REPLIES}{topicrow.LAST_POST_TIME} + +
{S_HIDDEN_FIELDS} + +   + +   + +   + +
+ + + + + +
{PAGE_NUMBER}{S_TIMEZONE}
{PAGINATION}
+ + + + + +
{JUMPBOX}
+
+ + \ No newline at end of file diff --git a/phpBB/templates/subSilver/mcp_viewip.html b/phpBB/templates/subSilver/mcp_viewip.html new file mode 100644 index 0000000000..5551f7d7cb --- /dev/null +++ b/phpBB/templates/subSilver/mcp_viewip.html @@ -0,0 +1,61 @@ + + + + + + +
{L_INDEX}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_IP_INFO}
{L_THIS_POST_IP}
+ + + + + +
 {IP} [ {POSTS} ][ {L_LOOKUP_IP} + ] 
+
{L_OTHER_USERS}
+ + + + + +
 {userrow.USERNAME} [ {userrow.POSTS} ]{L_SEARCH} +  
+
{L_OTHER_IPS}
+ + + + +
 {iprow.IP} [ {iprow.POSTS} ][ {L_LOOKUP_IP} + ] 
+ +
+ + \ No newline at end of file