From b9ece6bdfe65b2e63c42d4a83fd831b4377e1b90 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 2 Jun 2009 13:51:19 +0000 Subject: [PATCH 001/607] #44875 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9523 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 2bc8086efe..e0584f3dc3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -394,7 +394,8 @@ if (!isset($topic_tracking_info)) $limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); -$sort_by_sql = array('a' => 'u.username_clean', 't' => 'p.post_time', 's' => 'p.post_subject'); +$sort_by_sql = array('a' => array('u.username_clean', 'p.post_id'), 't' => 'p.post_time', 's' => array('p.post_subject', 'p.post_id')); +$join_user_sql = array('a' => true, 't' => false, 's' => false); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -858,6 +859,7 @@ if (!empty($topic_data['poll_start'])) // If the user is trying to reach the second half of the topic, fetch it starting from the end $store_reverse = false; $sql_limit = $config['posts_per_page']; +$sql_sort_order = $direction = ''; if ($start > $total_posts / 2) { @@ -869,15 +871,24 @@ if ($start > $total_posts / 2) } // Select the sort order - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC'); + $direction = (($sort_dir == 'd') ? 'ASC' : 'DESC'); $sql_start = max(0, $total_posts - $sql_limit - $start); } else { // Select the sort order - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + $direction = (($sort_dir == 'd') ? 'DESC' : 'ASC'); $sql_start = $start; } +if (is_array($sort_by_sql[$sort_key])) +{ + $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; +} +else +{ + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; +} + // Container for user details, only process once $post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = array(); @@ -887,10 +898,10 @@ $i = $i_total = 0; // Go ahead and pull all data for this topic $sql = 'SELECT p.post_id - FROM ' . POSTS_TABLE . ' p' . (($sort_by_sql[$sort_key][0] == 'u') ? ', ' . USERS_TABLE . ' u': '') . " + FROM ' . POSTS_TABLE . ' p' . (($join_user_sql[$sort_key]) ? ', ' . USERS_TABLE . ' u': '') . " WHERE p.topic_id = $topic_id " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . " - " . (($sort_by_sql[$sort_key][0] == 'u') ? 'AND u.user_id = p.poster_id': '') . " + " . (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id': '') . " $limit_posts_time ORDER BY $sql_sort_order"; $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); From b776d02682492077a4fafd8835d7c4a17e50762d Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 2 Jun 2009 14:12:23 +0000 Subject: [PATCH 002/607] Okay, a first ci of the new captcha plugins. We'll add dynamic template includes later, as well as documentation on how to use this. I'm prepared to get yelled at for bugs (oh, I know that there are plenty); but please blame spammers for broken styles and MODs. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9524 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_captcha.html | 74 +- phpBB/adm/style/captcha_default_acp_demo.html | 5 + phpBB/adm/style/captcha_gd_acp.html | 74 ++ phpBB/adm/style/captcha_recaptcha.html | 19 + phpBB/adm/style/captcha_recaptcha_acp.html | 48 + phpBB/docs/CHANGELOG.html | 32 +- phpBB/includes/acp/acp_captcha.php | 187 ++-- phpBB/includes/auth/auth_db.php | 41 +- phpBB/includes/captcha/captcha_factory.php | 92 ++ phpBB/includes/captcha/captcha_gd_wave.php | 842 ++++++++++++++++++ phpBB/includes/captcha/captcha_plugin.php | 97 ++ .../captcha/plugins/captcha_abstract.php | 332 +++++++ .../plugins/phpbb_captcha_gd_plugin.php | 122 +++ .../plugins/phpbb_captcha_gd_wave_plugin.php | 66 ++ .../plugins/phpbb_captcha_nogd_plugin.php | 68 ++ .../plugins/phpbb_recaptcha_plugin.php | 312 +++++++ phpBB/includes/functions.php | 33 +- phpBB/includes/session.php | 40 +- phpBB/includes/ucp/ucp_confirm.php | 42 +- phpBB/includes/ucp/ucp_register.php | 168 +--- phpBB/install/database_update.php | 13 +- phpBB/install/install_install.php | 4 +- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/language/en/acp/board.php | 18 +- phpBB/language/en/recaptcha.php | 51 ++ phpBB/posting.php | 61 +- .../prosilver/template/captcha_default.html | 9 + .../prosilver/template/captcha_recaptcha.html | 19 + .../styles/prosilver/template/login_body.html | 10 +- .../prosilver/template/posting_editor.html | 6 +- .../prosilver/template/ucp_register.html | 16 +- .../subsilver2/template/captcha_default.html | 19 + .../template/captcha_recaptcha.html | 21 + .../subsilver2/template/login_body.html | 23 +- .../subsilver2/template/posting_body.html | 22 +- .../subsilver2/template/ucp_register.html | 18 +- 36 files changed, 2472 insertions(+), 534 deletions(-) create mode 100755 phpBB/adm/style/captcha_default_acp_demo.html create mode 100755 phpBB/adm/style/captcha_gd_acp.html create mode 100644 phpBB/adm/style/captcha_recaptcha.html create mode 100644 phpBB/adm/style/captcha_recaptcha_acp.html create mode 100755 phpBB/includes/captcha/captcha_factory.php create mode 100755 phpBB/includes/captcha/captcha_gd_wave.php create mode 100755 phpBB/includes/captcha/captcha_plugin.php create mode 100755 phpBB/includes/captcha/plugins/captcha_abstract.php create mode 100755 phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php create mode 100755 phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php create mode 100755 phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php create mode 100644 phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php create mode 100644 phpBB/language/en/recaptcha.php create mode 100755 phpBB/styles/prosilver/template/captcha_default.html create mode 100644 phpBB/styles/prosilver/template/captcha_recaptcha.html create mode 100755 phpBB/styles/subsilver2/template/captcha_default.html create mode 100755 phpBB/styles/subsilver2/template/captcha_recaptcha.html diff --git a/phpBB/adm/style/acp_captcha.html b/phpBB/adm/style/acp_captcha.html index 8a067cda66..68909e4012 100644 --- a/phpBB/adm/style/acp_captcha.html +++ b/phpBB/adm/style/acp_captcha.html @@ -25,69 +25,33 @@

{L_VISUAL_CONFIRM_REFRESH_EXPLAIN}
-
+
- -
-

{L_CAPTCHA_GD_EXPLAIN}
-
-
-
-
-

{L_CAPTCHA_GD_FOREGROUND_NOISE_EXPLAIN}
-
-
-
-
-

{L_CAPTCHA_GD_X_GRID_EXPLAIN}
-
-
-
-

{L_CAPTCHA_GD_Y_GRID_EXPLAIN}
-
-
-
-

{L_CAPTCHA_GD_WAVE_EXPLAIN}
-
- -
-
-
-

{L_CAPTCHA_GD_3D_NOISE_EXPLAIN}
-
- -
-
-
-

{L_CAPTCHA_GD_FONTS_EXPLAIN}
-
- - - -
-
- - + +
+{L_AVAILABLE_CAPTCHAS} +
+

{L_CAPTCHA_SELECT_EXPLAIN}
+
+
+
+

{L_CAPTCHA_CONFIGURE_EXPLAIN}
+
+
+
+ +
{L_PREVIEW} - -
-

{L_WARNING}

-

{L_CAPTCHA_PREVIEW_MSG}

-
- -
-

{L_CAPTCHA_PREVIEW_EXPLAIN}
-
{L_PREVIEW}width="360" height="96" width="320" height="50" id="captcha_preview" />
-
+{CAPTCHA_PREVIEW}
+
{L_SUBMIT} -   -   - +   +   {S_FORM_TOKEN}
diff --git a/phpBB/adm/style/captcha_default_acp_demo.html b/phpBB/adm/style/captcha_default_acp_demo.html new file mode 100755 index 0000000000..a714386e51 --- /dev/null +++ b/phpBB/adm/style/captcha_default_acp_demo.html @@ -0,0 +1,5 @@ + +
+

{L_CAPTCHA_PREVIEW_EXPLAIN}
+
{L_PREVIEW}
+
\ No newline at end of file diff --git a/phpBB/adm/style/captcha_gd_acp.html b/phpBB/adm/style/captcha_gd_acp.html new file mode 100755 index 0000000000..ea7a851be3 --- /dev/null +++ b/phpBB/adm/style/captcha_gd_acp.html @@ -0,0 +1,74 @@ + + + + +

{L_ACP_VC_SETTINGS}

+ +

{L_ACP_VC_SETTINGS_EXPLAIN}

+ + +
+ +
+{L_GENERAL_OPTIONS} + +
+

{L_CAPTCHA_GD_FOREGROUND_NOISE_EXPLAIN}
+
+
+
+
+

{L_CAPTCHA_GD_X_GRID_EXPLAIN}
+
+
+
+

{L_CAPTCHA_GD_Y_GRID_EXPLAIN}
+
+
+
+

{L_CAPTCHA_GD_WAVE_EXPLAIN}
+
+ +
+
+
+

{L_CAPTCHA_GD_3D_NOISE_EXPLAIN}
+
+ +
+
+
+

{L_CAPTCHA_GD_FONTS_EXPLAIN}
+
+ + + +
+
+ +
+
+ {L_PREVIEW} + +
+

{L_WARNING}

+

{L_CAPTCHA_PREVIEW_MSG}

+
+ +{CAPTCHA_PREVIEW} +
+ +
+ {L_SUBMIT} +   +   +   + + + + + {S_FORM_TOKEN} +
+
+ + diff --git a/phpBB/adm/style/captcha_recaptcha.html b/phpBB/adm/style/captcha_recaptcha.html new file mode 100644 index 0000000000..f325c3727d --- /dev/null +++ b/phpBB/adm/style/captcha_recaptcha.html @@ -0,0 +1,19 @@ + +
+ + + +
+ +{L_RECAPTCHA_NOT_AVAILABLE} + \ No newline at end of file diff --git a/phpBB/adm/style/captcha_recaptcha_acp.html b/phpBB/adm/style/captcha_recaptcha_acp.html new file mode 100644 index 0000000000..07751d1d03 --- /dev/null +++ b/phpBB/adm/style/captcha_recaptcha_acp.html @@ -0,0 +1,48 @@ + + + + +

{L_ACP_VC_SETTINGS}

+ +

{L_ACP_VC_SETTINGS_EXPLAIN}

+ + +
+ +
+{L_GENERAL_OPTIONS} + +
+

{L_RECAPTCHA_PUBLIC_EXPLAIN}
+
+
+
+

{L_RECAPTCHA_PRIVATE_EXPLAIN}
+
+
+ + +
+
+ {L_PREVIEW} + +
+

{L_WARNING}

+

{L_CAPTCHA_PREVIEW_MSG}

+
+ +{CAPTCHA_PREVIEW} +
+ +
+ {L_SUBMIT} +   +   + + + + {S_FORM_TOKEN} +
+
+ + diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 60a0b9ddfc..9f751c701a 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -53,6 +53,7 @@
  1. Changelog
      +
    1. Changes since 3.0.5
    2. Changes since 3.0.4
    3. Changes since 3.0.3
    4. Changes since 3.0.2
    5. @@ -84,7 +85,12 @@
      -

      1.i. Changes since 3.0.4

      +

      1.i. Changes since 3.0.5

      + +
        +
      • [Feature] Backported 3.2 cpatcha plugins.
      • +
      +

      1.ii. Changes since 3.0.4

      • [Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)
      • @@ -173,7 +179,7 @@
      • [Sec] Only use forum id supplied for posting if global announcement detected. (Reported by nickvergessen)
      -

      1.ii. Changes since 3.0.3

      +

      1.iii. Changes since 3.0.3

      • [Fix] Allow mixed-case template directories to be inherited (Bug #36725)
      • @@ -205,7 +211,7 @@
      • [Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)
      -

      1.iii. Changes since 3.0.2

      +

      1.iv. Changes since 3.0.2

      • [Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)
      • @@ -304,7 +310,7 @@
      • [Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)
      -

      1.iv. Changes since 3.0.1

      +

      1.v. Changes since 3.0.1

      • [Fix] Ability to set permissions on non-mysql dbms (Bug #24955)
      • @@ -352,7 +358,7 @@
      • [Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)
      -

      1.v. Changes since 3.0.0

      +

      1.vi Changes since 3.0.0

      • [Change] Validate birthdays (Bug #15004)
      • @@ -423,7 +429,7 @@
      • [Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)
      -

      1.vi. Changes since 3.0.RC8

      +

      1.vii. Changes since 3.0.RC8

      • [Fix] Cleaned usernames contain only single spaces, so "a_name" and "a__name" are treated as the same name (Bug #15634)
      • @@ -432,7 +438,7 @@
      • [Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)
      -

      1.vii. Changes since 3.0.RC7

      +

      1.viii. Changes since 3.0.RC7

      • [Fix] Fixed MSSQL related bug in the update system
      • @@ -467,7 +473,7 @@
      • [Fix] No duplication of active topics (Bug #15474)
      -

      1.viii. Changes since 3.0.RC6

      +

      1.ix. Changes since 3.0.RC6

      • [Fix] Submitting language changes using acp_language (Bug #14736)
      • @@ -477,7 +483,7 @@
      • [Fix] Able to request new password (Bug #14743)
      -

      1.ix. Changes since 3.0.RC5

      +

      1.x. Changes since 3.0.RC5

      • [Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.
      • @@ -540,7 +546,7 @@
      • [Sec] New password hashing mechanism for storing passwords (#i42)
      -

      1.x. Changes since 3.0.RC4

      +

      1.xi. Changes since 3.0.RC4

      • [Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)
      • @@ -591,7 +597,7 @@
      • [Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)
      -

      1.xi. Changes since 3.0.RC3

      +

      1.xii. Changes since 3.0.RC3

      • [Fix] Fixing some subsilver2 and prosilver style issues
      • @@ -700,7 +706,7 @@
      -

      1.xii. Changes since 3.0.RC2

      +

      1.xiii. Changes since 3.0.RC2

      • [Fix] Re-allow searching within the memberlist
      • @@ -746,7 +752,7 @@
      -

      1.xiii. Changes since 3.0.RC1

      +

      1.xiv. Changes since 3.0.RC1

      • [Fix] (X)HTML issues within the templates (Bug #11255, #11255)
      • diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 93505e1590..ed2ccf6ccc 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -10,6 +10,8 @@ /** * @ignore */ + + if (!defined('IN_PHPBB')) { exit; @@ -28,108 +30,119 @@ class acp_captcha global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; $user->add_lang('acp/board'); - $captcha_vars = array( - 'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', - 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', - 'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE', - 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED', - 'captcha_gd_wave' => 'CAPTCHA_GD_WAVE', - 'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE', - 'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS', - ); + include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - if (isset($_GET['demo'])) + $selected = request_var('select_captcha', $config['captcha_plugin']); + $configure = request_var('configure', false); + + // Oh, they are just here for the view + if (isset($_GET['captcha_demo'])) { - $captcha_vars = array_keys($captcha_vars); - - foreach ($captcha_vars as $captcha_var) - { - $config[$captcha_var] = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var]; - } - - if ($config['captcha_gd']) - { - include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx); - } - else - { - include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx); - } - - $captcha = new captcha(); - $captcha->execute(gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)), time()); - exit; + $this->deliver_demo($selected); } - - $config_vars = array( - 'enable_confirm' => 'REG_ENABLE', - 'enable_post_confirm' => 'POST_ENABLE', - 'confirm_refresh' => 'CONFIRM_REFRESH', - 'captcha_gd' => 'CAPTCHA_GD', - ); - - $this->tpl_name = 'acp_captcha'; - $this->page_title = 'ACP_VC_SETTINGS'; - $form_key = 'acp_captcha'; - add_form_key($form_key); - - $submit = request_var('submit', ''); - - if ($submit && check_form_key($form_key)) + + // Delegate + if ($configure) { - $config_vars = array_keys($config_vars); - - foreach ($config_vars as $config_var) - { - set_config($config_var, request_var($config_var, '')); - } - - $captcha_vars = array_keys($captcha_vars); - - foreach ($captcha_vars as $captcha_var) - { - $value = request_var($captcha_var, 0); - if ($value >= 0) - { - set_config($captcha_var, $value); - } - } - + $config_captcha = phpbb_captcha_factory::get_instance($selected); + $config_captcha->acp_page($id, $this); add_log('admin', 'LOG_CONFIG_VISUAL'); - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); - } - else if ($submit) - { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action)); } else { - $preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&demo=demo")); + $captchas = phpbb_captcha_factory::get_captcha_types(); + $config_vars = array( + 'enable_confirm' => 'REG_ENABLE', + 'enable_post_confirm' => 'POST_ENABLE', + 'confirm_refresh' => 'CONFIRM_REFRESH', + ); - if (@extension_loaded('gd')) + $this->tpl_name = 'acp_captcha'; + $this->page_title = 'ACP_VC_SETTINGS'; + $form_key = 'acp_captcha'; + add_form_key($form_key); + + $submit = request_var('main_submit', false); + + if ($submit && check_form_key($form_key)) { - $template->assign_var('GD', true); + $config_vars = array_keys($config_vars); + foreach ($config_vars as $config_var) + { + set_config($config_var, request_var($config_var, false)); + } + if ($selected !== $config['captcha_plugin']) + { + // sanity check + if (isset($captchas['available'][$selected])) + { + $old_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $old_captcha->uninstall(); + set_config('captcha_plugin', $selected); + $new_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $old_captcha->install(); + add_log('admin', 'LOG_CONFIG_VISUAL'); + } + else + { + trigger_error($user->lang['CAPTCHA_UNAVAILABLE'] . adm_back_link($this->u_action)); + } + } + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + } + else if ($submit) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link()); + } + else + { + $captcha_select = ''; + foreach ($captchas['available'] as $value => $title) + { + $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : ''; + $captcha_select .= ''; + } + foreach ($captchas['unavailable'] as $value => $title) + { + $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : ''; + $captcha_select .= ''; + } + + $demo_captcha = phpbb_captcha_factory::get_instance($selected); + + foreach ($config_vars as $config_var => $template_var) + { + $template->assign_var($template_var, (isset($_REQUEST[$config_var])) ? request_var($config_var, '') : $config[$config_var]) ; + } + + $template->assign_vars(array( + 'CAPTCHA_PREVIEW' => $demo_captcha->get_demo_template($id), + 'CAPTCHA_SELECT' => $captcha_select, + )); } - foreach ($config_vars as $config_var => $template_var) - { - $template->assign_var($template_var, (isset($_REQUEST[$config_var])) ? request_var($config_var, '') : $config[$config_var]) ; - } - - foreach ($captcha_vars as $captcha_var => $template_var) - { - $var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var]; - $template->assign_var($template_var, $var); - $preview_image_src .= "&$captcha_var=" . $var; - } - - $template->assign_vars(array( - 'CAPTCHA_PREVIEW' => $preview_image_src, - 'PREVIEW' => isset($_POST['preview']), - )); } } + + + /** + * Entry point for delivering image CAPTCHAs in the ACP. + */ + function deliver_demo($selected) + { + global $db, $user, $config; + + $captcha = phpbb_captcha_factory::get_instance($selected); + $captcha->init(CONFIRM_REG); + $captcha->execute_demo(); + garbage_collection(); + exit_handler(); + } + + + + } ?> \ No newline at end of file diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php index 24d4c56614..bdafefa70b 100644 --- a/phpBB/includes/auth/auth_db.php +++ b/phpBB/includes/auth/auth_db.php @@ -81,42 +81,15 @@ function login_db(&$username, &$password) } else { - global $user; - - $sql = 'SELECT code - FROM ' . CONFIRM_TABLE . " - WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . CONFIRM_LOGIN; - $result = $db->sql_query($sql); - $confirm_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($confirm_row) - { - if (strcasecmp($confirm_row['code'], $confirm_code) === 0) - { - $sql = 'DELETE FROM ' . CONFIRM_TABLE . " - WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . CONFIRM_LOGIN; - $db->sql_query($sql); - } - else - { - return array( - 'status' => LOGIN_ERROR_ATTEMPTS, - 'error_msg' => 'CONFIRM_CODE_WRONG', - 'user_row' => $row, - ); - } - } - else + $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_LOGIN); + $vc_response = $captcha->validate(); + if ($vc_response) { return array( - 'status' => LOGIN_ERROR_ATTEMPTS, - 'error_msg' => 'CONFIRM_CODE_WRONG', - 'user_row' => $row, + 'status' => LOGIN_ERROR_ATTEMPTS, + 'error_msg' => 'LOGIN_ERROR_ATTEMPTS', + 'user_row' => $row, ); } } diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php new file mode 100755 index 0000000000..e6f56172ec --- /dev/null +++ b/phpBB/includes/captcha/captcha_factory.php @@ -0,0 +1,92 @@ +width; + $img_y = $this->height; + + // Generate image + $img = imagecreatetruecolor($img_x, $img_y); + $x_grid = mt_rand(6, 10); + $y_grid = mt_rand(6, 10); + + // Ok, so lets cut to the chase. We could accurately represent this in 3d and + // do all the appropriate linear transforms. my questions is... why bother? + // The computational overhead is unnecessary when you consider the simple fact: + // we're not here to accurately represent a model, but to just show off some random-ish + // polygons + + // Conceive of 3 spaces. + // 1) planar-space (discrete "pixel" grid) + // 2) 3-space. (planar-space with z/height aspect) + // 3) image space (pixels on the screen) + // resolution of the planar-space we're embedding the text code in + $plane_x = 100; + $plane_y = 30; + + $subdivision_factor = 3; + // $box is the 4 points in img_space that correspond to the corners of the plane in 3-space + $box = array( + 'upper_left' => array( + 'x' => mt_rand(5, 15), + 'y' => mt_rand(10, 15) + ), + 'upper_right' => array( + 'x' => mt_rand($img_x - 35, $img_x - 19), + 'y' => mt_rand(10, 17) + ), + 'lower_left' => array( + 'x' => mt_rand($img_x - 5, $img_x - 45), + 'y' => mt_rand($img_y - 0, $img_y - 15) + ), + ); + $box['lower_right'] = array( + 'x' => $box['lower_left']['x'] + $box['upper_left']['x'] - $box['upper_right']['x'], + 'y' => $box['lower_left']['y'] + $box['upper_left']['y'] - $box['upper_right']['y'], + ); + + + // TODO + $background = imagecolorallocate($img, mt_rand(155, 255), mt_rand(155, 255), mt_rand(155, 255)); + imagefill($img, 0, 0, $background); + $black = imagecolorallocate($img, 0, 0, 0); + + $random = array(); + $fontcolors = array(); + + for ($i = 0; $i < 15; ++$i) + { + $random[$i] = imagecolorallocate($img, mt_rand(120, 255), mt_rand(120, 255), mt_rand(120, 255)); + } + + $fontcolors[0] = imagecolorallocate($img, mt_rand(0, 120), mt_rand(0, 120), mt_rand(0, 120)); + + $colors = array(); + + $minr = mt_rand(20, 30); + $ming = mt_rand(20, 30); + $minb = mt_rand(20, 30); + + $maxr = mt_rand(150, 230); + $maxg = mt_rand(150, 230); + $maxb = mt_rand(150, 230); + + for ($i = -30; $i <= 30; ++$i) + { + $coeff1 = ($i + 12) / 45; + $coeff2 = 1 - $coeff1; + $colors[$i] = imagecolorallocate($img, ($coeff2 * $maxr) + ($coeff1 * $minr), ($coeff2 * $maxg) + ($coeff1 * $ming), ($coeff2 * $maxb) + ($coeff1 * $minb)); + } + + // $img_buffer is the last row of 3-space positions (converted to img-space), cached + // (using this means we don't need to recalculate all 4 positions for each new polygon, + // merely the newest point that we're adding, which is then cached. + $img_buffer = array(array(), array()); + + // In image-space, the x- and y-offset necessary to move one unit in the x-direction in planar-space + $dxx = ($box['upper_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_x); + $dxy = ($box['upper_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_x); + + // In image-space, the x- and y-offset necessary to move one unit in the y-direction in planar-space + $dyx = ($box['lower_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_y); + $dyy = ($box['lower_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_y); + + // Initial captcha-letter offset in planar-space + $plane_offset_x = mt_rand(3, 8); + $plane_offset_y = mt_rand( 12, 15); + + // character map + $map = $this->captcha_bitmaps(); + + // matrix + $plane = array(); + + // for each character, we'll silkscreen it into our boolean pixel plane + for ($c = 0, $code_num = strlen($code); $c < $code_num; ++$c) + { + $letter = $code[$c]; + + for ($x = $map['width'] - 1; $x >= 0; --$x) + { + for ($y = $map['height'] - 1; $y >= 0; --$y) + { + if ($map['data'][$letter][$y][$x]) + { + $plane[$y + $plane_offset_y + (($c & 1) ? 1 : -1)][$x + $plane_offset_x] = true; + } + } + } + $plane_offset_x += 11; + } + + // calculate our first buffer, we can't actually draw polys with these yet + // img_pos_prev == screen x,y location to our immediate left. + // img_pos_cur == current screen x,y location + // we calculate screen position of our + // current cell based on the difference from the previous cell + // rather than recalculating from absolute coordinates + // What we cache into the $img_buffer contains the raised text coordinates. + $img_pos_prev = $img_buffer[0][0] = array($box['upper_left']['x'], $box['upper_left']['y']); + $cur_height = $prev_height = $this->wave_height(0, 0, $subdivision_factor); + $full_x = $plane_x * $subdivision_factor; + $full_y = $plane_y * $subdivision_factor; + + for ($x = 1; $x <= $full_x; ++$x) + { + $cur_height = $this->wave_height($x, 0, $subdivision_factor); + $offset = $cur_height - $prev_height; + $img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset); + + $img_buffer[0][$x] = $img_pos_cur; + $img_pos_prev = $img_pos_cur; + $prev_height = $cur_height; + } + + for ($y = 1; $y <= $full_y; ++$y) + { + // swap buffers + $buffer_cur = $y & 1; + $buffer_prev = 1 - $buffer_cur; + + $prev_height = $this->wave_height(0, $y, $subdivision_factor); + $offset = $prev_height - $this->wave_height(0, $y - 1, $subdivision_factor); + $img_pos_cur = array($img_buffer[$buffer_prev][0][0] + $dyx, min($img_buffer[$buffer_prev][0][1] + $dyy + $offset, $img_y - 1)); + + // make sure we don't try to write off the page + $img_pos_prev = $img_pos_cur; + + $img_buffer[$buffer_cur][0] = $img_pos_cur; + + for ($x = 1; $x <= $full_x; ++$x) + { + $cur_height = $this->wave_height($x, $y, $subdivision_factor) + $this->grid_height($x, $y, 1, $x_grid, $y_grid); + + // height is a z-factor, not a y-factor + $offset = $cur_height - $prev_height; + $img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset); + + // height is float, index it to an int, get closest color + $color = $colors[intval($cur_height)]; + $img_pos_prev = $img_pos_cur; + $prev_height = $cur_height; + + $y_index_old = intval(($y - 1) / $subdivision_factor); + $y_index_new = intval($y / $subdivision_factor); + $x_index_old = intval(($x - 1) / $subdivision_factor); + $x_index_new = intval($x / $subdivision_factor); + + if (!empty($plane[$y_index_new][$x_index_new])) + { + $img_pos_cur[1] += $this->wave_height($x, $y, $subdivision_factor, 1) - 30 - $cur_height; + $color = $colors[20]; + } + $img_pos_cur[1] = min($img_pos_cur[1], $img_y - 1); + $img_buffer[$buffer_cur][$x] = $img_pos_cur; + + // Smooth the edges as much as possible by having not more than one low<->high traingle per square + // Otherwise, just + $diag_down = (empty($plane[$y_index_old][$x_index_old]) == empty($plane[$y_index_new][$x_index_new])); + $diag_up = (empty($plane[$y_index_old][$x_index_new]) == empty($plane[$y_index_new][$x_index_old])); + + // natural switching + $mode = ($x + $y) & 1; + + // override if it requires it + if ($diag_down != $diag_up) + { + $mode = $diag_up; + } + + if ($mode) + { + // +-/ / + // 1 |/ 2 /| + // / /-+ + $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x]); + $poly2 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_cur][$x], $img_buffer[$buffer_prev][$x]); + } + else + { + // \ \-+ + // 1 |\ 2 \| + // +-\ \ + $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_cur][$x]); + $poly2 = array_merge($img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x], $img_buffer[$buffer_cur][$x]); + } + + imagefilledpolygon($img, $poly1, 3, $color); + imagefilledpolygon($img, $poly2, 3, $color); + } + } + + // Output image + header('Content-Type: image/png'); + header('Cache-control: no-cache, no-store'); + //$mtime = explode(' ', microtime()); + //$totaltime = $mtime[0] + $mtime[1] - $starttime; + + //echo $totaltime . "
        \n"; + //echo memory_get_usage() - $tmp; + imagepng($img); + imagedestroy($img); + } + + function wave_height($x, $y, $factor = 1, $tweak = 0.7) + { + // stretch the wave. TODO: pretty it up + $x = $x/5 + 180; + $y = $y/4; + return ((sin($x / (3 * $factor)) + sin($y / (3 * $factor))) * 10 * $tweak); + } + + function grid_height($x, $y, $factor = 1, $x_grid, $y_grid) + { + return ((!($x % ($x_grid * $factor)) || !($y % ($y_grid * $factor))) ? 3 : 0); + } + + function captcha_bitmaps() + { + return array( + 'width' => 9, + 'height' => 13, + 'data' => array( + 'A' => array( + array(0,0,1,1,1,1,0,0,0), + array(0,1,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'B' => array( + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'C' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'D' => array( + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'E' => array( + array(0,0,1,1,1,1,1,1,1), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'F' => array( + array(0,0,1,1,1,1,1,1,0), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'G' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'H' => array( + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'I' => array( + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'J' => array( + array(0,0,0,0,0,0,1,1,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,1,0), + array(0,0,0,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'K' => array( + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,1,0,0,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'L' => array( + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'M' => array( + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'N' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,1,0,0,0,0,0,0,1), + array(1,0,1,0,0,0,0,0,1), + array(1,0,0,1,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,0,1,0,0,1), + array(1,0,0,0,0,0,1,0,1), + array(1,0,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'O' => array( + array(0,0,0,1,1,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,1,1,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'P' => array( + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'Q' => array( + array(0,0,1,1,1,1,0,0,0), + array(0,1,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,1,0,0,1,0), + array(1,0,0,0,0,1,0,1,0), + array(0,1,0,0,0,0,1,0,0), + array(0,0,1,1,1,1,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'R' => array( + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'S' => array( + array(0,0,1,1,1,1,1,1,1), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'T' => array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'U' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'V' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'W' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'X' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'Y' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'Z' => array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '1' => array( + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,0,0,0,0), + array(0,0,1,0,1,0,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '2' => array( + array(0,0,0,1,1,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,0), + ), + '3' => array( + array(0,0,0,1,1,1,1,0,0), + array(0,0,1,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,1,0), + array(0,0,0,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '4' => array( + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,1,0), + array(0,0,0,0,0,1,0,1,0), + array(0,0,0,0,1,0,0,1,0), + array(0,0,0,1,0,0,0,1,0), + array(0,0,1,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '5' => array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '6' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,1,1,1,1,0,0), + array(1,0,1,0,0,0,0,1,0), + array(1,1,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '7' => array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '8' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '9' => array( + array(0,0,0,1,1,1,1,0,0), + array(0,0,1,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,1), + array(0,0,1,1,1,1,1,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,1,0), + array(0,0,0,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + ) + ); + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/captcha/captcha_plugin.php b/phpBB/includes/captcha/captcha_plugin.php new file mode 100755 index 0000000000..08a149764c --- /dev/null +++ b/phpBB/includes/captcha/captcha_plugin.php @@ -0,0 +1,97 @@ +confirm_id = request_var('confirm_id', ''); + $this->confirm_code = request_var('confirm_code', ''); + $refresh = request_var('refresh_vc', false) && $config['confirm_refresh']; + + $this->type = (int) $type; + + if (!strlen($this->confirm_id)) + { + // we have no confirm ID, better get ready to display something + $this->generate_code(); + } + else if ($refresh) + { + $this->regenerate_code(); + } + + } + + function execute_demo() + { + global $user; + + $this->code = gen_rand_string(mt_rand(5, 8)); + $this->seed = hexdec(substr(unique_id(), 4, 10)); + + // compute $seed % 0x7fffffff + $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); + + $captcha = new captcha(); + $captcha->execute($this->code, $this->seed); + } + + + function execute() + { + if (empty($this->code)) + { + if (!$this->load_code()) + { + // invalid request, bail out + return false; + } + } + $captcha = new captcha(); + $captcha->execute($this->code, $this->seed); + } + + + function get_template() + { + global $config, $user, $template, $phpEx, $phpbb_root_path; + + $template->set_filenames(array( + 'captcha' => 'captcha_default.html') + ); + + $template->assign_vars(array( + 'CONFIRM_IMAGE' => append_sid($phpbb_root_path . 'ucp.' . $phpEx . '?mode=confirm&confirm_id=' . $this->confirm_id . '&type=' . $this->type), + 'CONFIRM_ID' => $this->confirm_id, + 'S_REFRESH' => (bool) $config['confirm_refresh'], + + )); + + return $template->assign_display('captcha'); + } + + function get_demo_template($id) + { + global $config, $user, $template, $phpbb_admin_path, $phpEx; + + $template->set_filenames(array( + 'captcha_demo' => 'captcha_default_acp_demo.html') + ); + // acp_captcha has a delivery function; let's use it + $template->assign_vars(array( + 'CONFIRM_IMAGE' => append_sid($phpbb_admin_path . 'index.' . $phpEx . '?captcha_demo=1&mode=visual&i=' . $id . '&select_captcha=' . $this->get_class_name()), + 'CONFIRM_ID' => $this->confirm_id, + )); + + return $template->assign_display('captcha_demo'); + } + + function get_hidden_fields() + { + $hidden_fields = array(); + + // this is required for postig.php - otherwise we would forget about the captcha being already solved + if ($this->solved) + { + $hidden_fields['confirm_code'] = $this->confirm_code; + } + $hidden_fields['confirm_id'] = $this->confirm_id; + return $hidden_fields; + } + + function garbage_collect($type) + { + global $db, $config; + + $sql = 'SELECT DISTINCT c.session_id + FROM ' . CONFIRM_TABLE . ' c + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) + WHERE s.session_id IS NULL' . + ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $sql_in = array(); + do + { + $sql_in[] = (string) $row['session_id']; + } + while ($row = $db->sql_fetchrow($result)); + + if (sizeof($sql_in)) + { + $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' + WHERE ' . $db->sql_in_set('session_id', $sql_in); + $db->sql_query($sql); + } + } + $db->sql_freeresult($result); + } + + function uninstall() + { + self::garbage_collect(0); + } + + function install() + { + return; + } + + function validate() + { + global $config, $db, $user; + + $this->confirm_code = request_var('confirm_code', ''); + if (!$this->confirm_id) + { + $error = $user->lang['CONFIRM_CODE_WRONG']; + } + else + { + if ($this->check_code()) + { + // $this->delete_code(); commented out to allow posting.php to repeat the question + $this->solved = true; + } + else + { + $error = $user->lang['CONFIRM_CODE_WRONG']; + } + } + + if (strlen($error)) + { + // okay, inorect answer. Let's ask a new question + $this->generate_code(); + return $error; + } + else + { + return false; + } + } + + + /** + * The old way to generate code, suitable for GD and non-GD. Resets the internal state. + */ + function generate_code() + { + global $db, $user; + + $this->code = gen_rand_string(mt_rand(5, 8)); + $this->confirm_id = md5(unique_id($user->ip)); + $this->seed = hexdec(substr(unique_id(), 4, 10)); + $this->solved = false; + // compute $seed % 0x7fffffff + $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); + + $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'confirm_id' => (string) $this->confirm_id, + 'session_id' => (string) $user->session_id, + 'confirm_type' => (int) $this->type, + 'code' => (string) $this->code, + 'seed' => (int) $this->seed) + ); + $db->sql_query($sql); + } + + /** + * New Question, if desired. + */ + function regenerate_code() + { + global $db, $user; + + $this->code = gen_rand_string(mt_rand(5, 8)); + $this->seed = hexdec(substr(unique_id(), 4, 10)); + $this->solved = false; + // compute $seed % 0x7fffffff + $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); + $sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + 'code' => (string) $this->code, + 'seed' => (int) $this->seed)) . ' + WHERE + confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' AND + session_id = \'' . $db->sql_escape($user->session_id) . '\''; + $db->sql_query($sql); + } + + /** + * Look up everything we need for painting&checking. + */ + function load_code() + { + global $db, $user; + $sql = 'SELECT code, seed + FROM ' . CONFIRM_TABLE . " + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . $this->type; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + if ($row) + { + $this->code = $row['code']; + $this->seed = $row['seed']; + return true; + } + return false; + + } + + function check_code() + { + global $db; + + if (empty($this->code)) + { + if (!$this->load_code()) + { + return false; + } + } + return (strcasecmp($this->code, $this->confirm_code) === 0); + } + + function delete_code() + { + global $db, $user; + + $sql = 'DELETE FROM ' . CONFIRM_TABLE . " + WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . $this->type; + $db->sql_query($sql); + } + + function get_attempt_count() + { + global $db, $user; + + $sql = 'SELECT COUNT(session_id) AS attempts + FROM ' . CONFIRM_TABLE . " + WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . $this->type; + $result = $db->sql_query($sql); + $attempts = (int) $db->sql_fetchfield('attempts'); + $db->sql_freeresult($result); + + return $attempts; + } + + + function reset() + { + global $db, $user; + + $sql = 'DELETE FROM ' . CONFIRM_TABLE . " + WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . (int) $this->type; + $db->sql_query($sql); + + // we leave the class usable by generating a new question + $this->generate_code(); + } + +} + diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php new file mode 100755 index 0000000000..850794e133 --- /dev/null +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php @@ -0,0 +1,122 @@ +add_lang('acp/board'); + $captcha_vars = array( + 'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', + 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', + 'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE', + 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED', + 'captcha_gd_wave' => 'CAPTCHA_GD_WAVE', + 'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE', + 'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS', + + ); + + $config_vars = array( + 'enable_confirm' => 'REG_ENABLE', + 'enable_post_confirm' => 'POST_ENABLE', + 'confirm_refresh' => 'CONFIRM_REFRESH', + 'captcha_gd' => 'CAPTCHA_GD', + ); + + + $module->tpl_name = 'captcha_gd_acp'; + $module->page_title = 'ACP_VC_SETTINGS'; + $form_key = 'acp_captcha'; + add_form_key($form_key); + + $submit = request_var('submit', ''); + + if ($submit && check_form_key($form_key)) + { + $captcha_vars = array_keys($captcha_vars); + foreach ($captcha_vars as $captcha_var) + { + $value = request_var($captcha_var, 0); + if ($value >= 0) + { + set_config($captcha_var, $value); + } + } + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action)); + } + else if ($submit) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($module->u_action)); + } + else + { + foreach ($captcha_vars as $captcha_var => $template_var) + { + $var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var]; + $template->assign_var($template_var, $var); + } + $template->assign_vars(array( + 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), + 'CAPTCHA_NAME' => $this->get_class_name(), + )); + + } + } +} + diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php new file mode 100755 index 0000000000..769867655c --- /dev/null +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php @@ -0,0 +1,66 @@ +lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php new file mode 100755 index 0000000000..c5a32137d7 --- /dev/null +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php @@ -0,0 +1,68 @@ +lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); + } +} + diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php new file mode 100644 index 0000000000..7a3c406324 --- /dev/null +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -0,0 +1,312 @@ +add_lang('recaptcha'); + parent::init($type); + $this->challenge = request_var('recaptcha_challenge_field', ''); + $this->response = request_var('recaptcha_response_field', ''); + } + + + function get_instance() + { + return new phpbb_recaptcha(); + } + + function is_available() + { + global $config, $user; + $user->add_lang('recaptcha'); + return (isset($config['recaptcha_pubkey']) && !empty($config['recaptcha_pubkey'])); + } + + function get_name() + { + return 'CAPTCHA_RECAPTCHA'; + } + + function get_class_name() + { + return 'phpbb_recaptcha'; + } + + function acp_page($id, &$module) + { + global $config, $db, $template, $user; + + $captcha_vars = array( + 'recaptcha_pubkey' => 'RECAPTCHA_PUBKEY', + 'recaptcha_privkey' => 'RECAPTCHA_PRIVKEY', + ); + + $module->tpl_name = 'captcha_recaptcha_acp'; + $module->page_title = 'ACP_VC_SETTINGS'; + $form_key = 'acp_captcha'; + add_form_key($form_key); + + $submit = request_var('submit', ''); + + if ($submit && check_form_key($form_key)) + { + $captcha_vars = array_keys($captcha_vars); + foreach ($captcha_vars as $captcha_var) + { + $value = request_var($captcha_var, ''); + if ($value) + { + set_config($captcha_var, $value); + } + } + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action)); + } + else if ($submit) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($module->u_action)); + } + else + { + foreach ($captcha_vars as $captcha_var => $template_var) + { + $var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, '') : ((isset($config[$captcha_var])) ? $config[$captcha_var] : ''); + $template->assign_var($template_var, $var); + } + $template->assign_vars(array( + 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), + 'CAPTCHA_NAME' => $this->get_class_name(), + )); + + } + } + + + // not needed + function execute_demo() + { + } + + + // not needed + function execute() + { + } + + + function get_template() + { + global $config, $user, $template; + + $template->set_filenames(array( + 'captcha' => 'captcha_recaptcha.html') + ); + + $template->assign_vars(array( + 'RECAPTCHA_SERVER' => $this->recaptcha_server, + 'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '', + 'RECAPTCHA_ERRORGET' => '', + 'S_RECAPTCHA_AVAILABLE' => $this->is_available(), + )); + + return $template->assign_display('captcha'); + } + + function get_demo_template($id) + { + return $this->get_template(); + } + + function get_hidden_fields() + { + $hidden_fields = array(); + + // this is required for postig.php - otherwise we would forget about the captcha being already solved + if ($this->solved) + { + $hidden_fields['confirm_code'] = $this->confirm_code; + } + $hidden_fields['confirm_id'] = $this->confirm_id; + return $hidden_fields; + } + + function uninstall() + { + self::garbage_collect(0); + } + + function install() + { + return; + } + + function validate() + { + if (!parent::validate()) + { + return false; + } + else + { + return $this->recaptcha_check_answer(); + } + } + + +// Code from here on is based on recaptchalib.php +/* + * This is a PHP library that handles calling reCAPTCHA. + * - Documentation and latest version + * http://recaptcha.net/plugins/php/ + * - Get a reCAPTCHA API Key + * http://recaptcha.net/api/getkey + * - Discussion group + * http://groups.google.com/group/recaptcha + * + * Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net + * AUTHORS: + * Mike Crawford + * Ben Maurer + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + + /** + * Submits an HTTP POST to a reCAPTCHA server + * @param string $host + * @param string $path + * @param array $data + * @param int port + * @return array response + */ + function _recaptcha_http_post($host, $path, $data, $port = 80) + { + $req = $this->_recaptcha_qsencode ($data); + + $http_request = "POST $path HTTP/1.0\r\n"; + $http_request .= "Host: $host\r\n"; + $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; + $http_request .= "Content-Length: " . strlen($req) . "\r\n"; + $http_request .= "User-Agent: reCAPTCHA/PHP/phpBB\r\n"; + $http_request .= "\r\n"; + $http_request .= $req; + + $response = ''; + if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { + die ('Could not open socket'); + } + + fwrite($fs, $http_request); + + while ( !feof($fs) ) + $response .= fgets($fs, 1160); // One TCP-IP packet + fclose($fs); + $response = explode("\r\n\r\n", $response, 2); + + return $response; + } + + + /** + * Calls an HTTP POST function to verify if the user's guess was correct + * @param array $extra_params an array of extra variables to post to the server + * @return ReCaptchaResponse + */ + function recaptcha_check_answer ($extra_params = array()) + { + global $config, $user; + //discard spam submissions + if ($this->challenge == null || strlen($this->challenge) == 0 || $this->response == null || strlen($this->response) == 0) + { + return $user->lang['RECAPTCHA_INCORRECT']; + } + + $response = $this->_recaptcha_http_post ($this->recaptcha_verify_server, "/verify", + array ( + 'privatekey' => $config['recaptcha_privkey'], + 'remoteip' => $user->ip, + 'challenge' => $this->challenge, + 'response' => $this->response + ) + $extra_params + ); + + $answers = explode ("\n", $response[1]); + + if (trim ($answers[0]) === 'true') + { + $this->solved = true; + return false; + } + else + { + if ($answers[1] === 'incorrect-captcha-sol') + { + return $user->lang['RECAPTCHA_INCORRECT']; + } + } + } + + /** + * Encodes the given data into a query string format + * @param $data - array of string elements to be encoded + * @return string - encoded request + */ + function _recaptcha_qsencode ($data) + { + $req = ''; + foreach ( $data as $key => $value ) + { + $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; + } + // Cut the last '&' + $req=substr($req,0,strlen($req)-1); + return $req; + } +} + diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 476565452c..58601be65b 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2520,6 +2520,11 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa { global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config; + if (!class_exists('phpbb_captcha_factory')) + { + include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); + } + $err = ''; // Make sure user->setup() has been called @@ -2630,34 +2635,14 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa { case LOGIN_ERROR_ATTEMPTS: - // Show confirm image - $sql = 'DELETE FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . CONFIRM_LOGIN; - $db->sql_query($sql); + $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_LOGIN); + $captcha->reset(); - // Generate code - $code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); - $confirm_id = md5(unique_id($user->ip)); - $seed = hexdec(substr(unique_id(), 4, 10)); - - // compute $seed % 0x7fffffff - $seed -= 0x7fffffff * floor($seed / 0x7fffffff); - - $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'confirm_id' => (string) $confirm_id, - 'session_id' => (string) $user->session_id, - 'confirm_type' => (int) CONFIRM_LOGIN, - 'code' => (string) $code, - 'seed' => (int) $seed) - ); - $db->sql_query($sql); $template->assign_vars(array( 'S_CONFIRM_CODE' => true, - 'CONFIRM_ID' => $confirm_id, - 'CONFIRM_IMAGE' => '', - 'L_LOGIN_CONFIRM_EXPLAIN' => sprintf($user->lang['LOGIN_CONFIRM_EXPLAIN'], '', ''), + 'CONFIRM' => $captcha->get_template(''), )); $err = $user->lang[$result['error_msg']]; diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 043a637584..e039fce6e1 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -891,7 +891,7 @@ class session */ function session_gc() { - global $db, $config; + global $db, $config, $phpbb_root_path, $phpEx; $batch_size = 10; @@ -949,42 +949,18 @@ class session WHERE last_login < ' . (time() - (86400 * (int) $config['max_autologin_time'])); $db->sql_query($sql); } - $this->confirm_gc(); + + // only called from CRON; should be a safe workaround until the infrastructure gets going + if (!class_exists('captcha_factory')) + { + include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx); + } + captcha_factory::garbage_collect($config['captcha_plugin']); } return; } - function confirm_gc($type = 0) - { - global $db, $config; - - $sql = 'SELECT DISTINCT c.session_id - FROM ' . CONFIRM_TABLE . ' c - LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) - WHERE s.session_id IS NULL' . - ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $sql_in = array(); - do - { - $sql_in[] = (string) $row['session_id']; - } - while ($row = $db->sql_fetchrow($result)); - - if (sizeof($sql_in)) - { - $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' - WHERE ' . $db->sql_in_set('session_id', $sql_in); - $db->sql_query($sql); - } - } - $db->sql_freeresult($result); - } - /** * Sets a cookie diff --git a/phpBB/includes/ucp/ucp_confirm.php b/phpBB/includes/ucp/ucp_confirm.php index b91c88b7e8..445f7c7d2a 100644 --- a/phpBB/includes/ucp/ucp_confirm.php +++ b/phpBB/includes/ucp/ucp_confirm.php @@ -3,7 +3,7 @@ * * @package VC * @version $Id$ -* @copyright (c) 2005 phpBB Group +* @copyright (c) 2005 2008 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ @@ -37,42 +37,10 @@ class ucp_confirm { global $db, $user, $phpbb_root_path, $config, $phpEx; - // Do we have an id? No, then just exit - $confirm_id = request_var('id', ''); - $type = request_var('type', 0); - - if (!$confirm_id || !$type) - { - exit; - } - - // Try and grab code for this id and session - $sql = 'SELECT code, seed - FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_id = '" . $db->sql_escape($confirm_id) . "' - AND confirm_type = $type"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - // If we have a row then grab data else create a new id - if (!$row) - { - exit; - } - - if ($config['captcha_gd']) - { - include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx); - } - else - { - include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx); - } - - $captcha = new captcha(); - $captcha->execute($row['code'], $row['seed']); + include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); + $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha->init(request_var('type', 0)); + $captcha->execute(); garbage_collection(); exit_handler(); diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index e42ad8369d..958369a03e 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -37,14 +37,12 @@ class ucp_register include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); - $confirm_id = request_var('confirm_id', ''); - $confirm_refresh = (isset($_POST['confirm_refresh']) && $config['confirm_refresh']) ? ((!empty($_POST['confirm_refresh'])) ? 1 : 0) : false; - $coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; - $agreed = (!empty($_POST['agreed'])) ? 1 : 0; - $submit = (isset($_POST['submit'])) ? true : false; - $change_lang = request_var('change_lang', ''); - $user_lang = request_var('lang', $user->lang_name); - + $coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; + $agreed = (!empty($_POST['agreed'])) ? 1 : 0; + $submit = (isset($_POST['submit'])) ? true : false; + $change_lang = request_var('change_lang', ''); + $user_lang = request_var('lang', $user->lang_name); + $confirm_refresh = (isset($_POST['confirm_refresh']) && $config['confirm_refresh']) ? ((!empty($_POST['confirm_refresh'])) ? 1 : 0) : false; if ($agreed) { add_form_key('ucp_register'); @@ -54,7 +52,14 @@ class ucp_register add_form_key('ucp_register_terms'); } - + + if ($config['enable_confirm']) + { + include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); + $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_REG); + } + if ($change_lang || $user_lang != $config['default_lang']) { $use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang); @@ -89,8 +94,8 @@ class ucp_register { $add_lang = ($change_lang) ? '&change_lang=' . urlencode($change_lang) : ''; $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : ''; - - $s_hidden_fields = ($confirm_id) ? array('confirm_id' => $confirm_id) : array(); + + $s_hidden_fields = array(); // If we change the language, we want to pass on some more possible parameter. if ($change_lang) @@ -100,11 +105,14 @@ class ucp_register 'username' => utf8_normalize_nfc(request_var('username', '', true)), 'email' => strtolower(request_var('email', '')), 'email_confirm' => strtolower(request_var('email_confirm', '')), - 'confirm_code' => request_var('confirm_code', ''), - 'confirm_id' => request_var('confirm_id', ''), 'lang' => $user->lang_name, 'tz' => request_var('tz', (float) $config['board_timezone']), )); + + if ($config['enable_confirm']) + { + $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields()); + } } if ($coppa === false && $config['coppa_enable']) @@ -168,7 +176,6 @@ class ucp_register 'password_confirm' => request_var('password_confirm', '', true), 'email' => strtolower(request_var('email', '')), 'email_confirm' => strtolower(request_var('email_confirm', '')), - 'confirm_code' => request_var('confirm_code', ''), 'lang' => basename(request_var('lang', $user->lang_name)), 'tz' => request_var('tz', (float) $timezone), ); @@ -188,7 +195,6 @@ class ucp_register array('string', false, 6, 60), array('email')), 'email_confirm' => array('string', false, 6, 60), - 'confirm_code' => array('string', !$config['enable_confirm'], CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS), 'tz' => array('num', false, -14, 14), 'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'), )); @@ -199,6 +205,22 @@ class ucp_register // Replace "error" strings with their real, localised form $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + if ($config['enable_confirm']) + { + $vc_response = $captcha->validate(); + if ($vc_response) + { + $error[] = $vc_response; + } + else + { + $captcha->reset(); + } + if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts']) + { + $error[] = $user->lang['TOO_MANY_REGISTERS']; + } + } // DNSBL check if ($config['check_dnsbl']) { @@ -211,50 +233,6 @@ class ucp_register // validate custom profile fields $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error); - // Visual Confirmation handling - $wrong_confirm = false; - if ($config['enable_confirm']) - { - if (!$confirm_id) - { - $error[] = $user->lang['CONFIRM_CODE_WRONG']; - $wrong_confirm = true; - } - else - { - $sql = 'SELECT code - FROM ' . CONFIRM_TABLE . " - WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . CONFIRM_REG; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($row) - { - if (strcasecmp($row['code'], $data['confirm_code']) === 0) - { - $sql = 'DELETE FROM ' . CONFIRM_TABLE . " - WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . CONFIRM_REG; - $db->sql_query($sql); - } - else - { - $error[] = $user->lang['CONFIRM_CODE_WRONG']; - $wrong_confirm = true; - } - } - else - { - $error[] = $user->lang['CONFIRM_CODE_WRONG']; - $wrong_confirm = true; - } - } - } - if (!sizeof($error)) { if ($data['new_password'] != $data['password_confirm']) @@ -452,74 +430,17 @@ class ucp_register if ($change_lang || $confirm_refresh) { $str = '&change_lang=' . $change_lang; - $sql = 'SELECT code - FROM ' . CONFIRM_TABLE . " - WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . CONFIRM_REG; - $result = $db->sql_query($sql); - if (!$row = $db->sql_fetchrow($result)) - { - $confirm_id = ''; - } - $db->sql_freeresult($result); } else { $str = ''; + } - if (!$change_lang || !$confirm_id || !$confirm_refresh) - { - $user->confirm_gc(CONFIRM_REG); + $template->assign_vars(array( + 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''), + 'S_CAPTCHA' => $captcha->get_template(), + )); - $sql = 'SELECT COUNT(session_id) AS attempts - FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . CONFIRM_REG; - $result = $db->sql_query($sql); - $attempts = (int) $db->sql_fetchfield('attempts'); - $db->sql_freeresult($result); - - if ($config['max_reg_attempts'] && $attempts > $config['max_reg_attempts']) - { - trigger_error('TOO_MANY_REGISTERS'); - } - - $code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); - $confirm_id = md5(unique_id($user->ip)); - $seed = hexdec(substr(unique_id(), 4, 10)); - - // compute $seed % 0x7fffffff - $seed -= 0x7fffffff * floor($seed / 0x7fffffff); - - $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'confirm_id' => (string) $confirm_id, - 'session_id' => (string) $user->session_id, - 'confirm_type' => (int) CONFIRM_REG, - 'code' => (string) $code, - 'seed' => (int) $seed) - ); - $db->sql_query($sql); - } - else if ($confirm_refresh) - { - $code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); - $confirm_id = md5(unique_id($user->ip)); - $seed = hexdec(substr(unique_id(), 4, 10)); - // compute $seed % 0x7fffffff - $seed -= 0x7fffffff * floor($seed / 0x7fffffff); - $sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( - 'confirm_type' => (int) CONFIRM_REG, - 'code' => (string) $code, - 'seed' => (int) $seed)) . " - WHERE - confirm_id = '" . $db->sql_escape($confirm_id) . "' AND - session_id = '" . $db->sql_escape($session_id) . "' AND - confirm_type = " . (int) CONFIRM_REG; - $db->sql_query($sql); - } - $confirm_image = ''; - $s_hidden_fields .= ''; } // @@ -534,7 +455,7 @@ class ucp_register $l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE']; break; } - + $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('
        ', $error) : '', 'USERNAME' => $data['username'], @@ -542,16 +463,13 @@ class ucp_register 'PASSWORD_CONFIRM' => $data['password_confirm'], 'EMAIL' => $data['email'], 'EMAIL_CONFIRM' => $data['email_confirm'], - 'CONFIRM_IMG' => $confirm_image, - 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''), 'L_REG_COND' => $l_reg_cond, 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), 'L_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_TZ_OPTIONS' => tz_select($data['tz']), - 'S_CONFIRM_CODE' => ($config['enable_confirm']) ? true : false, 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false, 'S_COPPA' => $coppa, 'S_HIDDEN_FIELDS' => $s_hidden_fields, diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index c66ac859cf..fe855496e4 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.5'; +$updates_to_version = '3.0.6-dev'; // Enter any version to update from to test updates. The version within the db will not be updated. $debug_from_version = false; @@ -677,6 +677,9 @@ function database_update_info() // No changes from 3.0.5-RC1 to 3.0.5 '3.0.5-RC1' => array(), + + // No changes from 3.0.5 + '3.0.5' => array(), ); } @@ -1012,6 +1015,14 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.5-RC1 to 3.0.5 case '3.0.5-RC1': break; + + + + case '3.0.5': + // TODO: smarter detection here; problem without GD. + set_config('captcha_plugin', 'phpbb_captcha_nogd'); + + break; } } diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index adb0fb9623..5ce18b37cd 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1373,8 +1373,8 @@ class install_install extends module if (@extension_loaded('gd') || can_load_dll('gd')) { $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '1' - WHERE config_name = 'captcha_gd'"; + SET config_value = 'phpbb_captcha_gd' + WHERE config_name = 'captcha_plugin'"; } $ref = substr($referer, strpos($referer, '://') + 3); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 8b6c6d7189..e41cf6794c 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -60,7 +60,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('browser_check', '1 INSERT INTO phpbb_config (config_name, config_value) VALUES ('bump_interval', '10'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('bump_type', 'd'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('cache_gc', '7200'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_plugin', 'phpbb_captcha_nogd'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_foreground_noise', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_x_grid', '25'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_y_grid', '25'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 7c2f3a24bb..fec608ed80 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -233,9 +233,11 @@ $lang = array_merge($lang, array( // Visual Confirmation Settings $lang = array_merge($lang, array( - 'ACP_VC_SETTINGS_EXPLAIN' => 'Here you are able to define visual confirmation defaults and CAPTCHA settings.', - + 'ACP_VC_SETTINGS_EXPLAIN' => 'Here you are able to define visual confirmation defaults and CAPTCHA settings.', + 'AVAILABLE_CAPTCHAS' => 'Available plugins', + 'CAPTCHA_UNAVAILABLE' => 'The CAPTCHA cannot be selected as its requirements are not met.', 'CAPTCHA_GD' => 'GD CAPTCHA', + 'CAPTCHA_GD_WAVE' => 'GD Wave Captcha', 'CAPTCHA_GD_FOREGROUND_NOISE' => 'GD CAPTCHA foreground noise', 'CAPTCHA_GD_EXPLAIN' => 'Use GD to make a more advanced CAPTCHA.', 'CAPTCHA_GD_FOREGROUND_NOISE_EXPLAIN' => 'Use foreground noise to make the GD based CAPTCHA harder.', @@ -252,10 +254,16 @@ $lang = array_merge($lang, array( 'CAPTCHA_FONT_DEFAULT' => 'Default', 'CAPTCHA_FONT_NEW' => 'New Shapes', 'CAPTCHA_FONT_LOWER' => 'Also use lowercase', - - + 'CAPTCHA_NO_GD' => 'CAPTCHA without GD', 'CAPTCHA_PREVIEW_MSG' => 'Your changes to the visual confirmation setting were not saved. This is just a preview.', - 'CAPTCHA_PREVIEW_EXPLAIN' => 'The CAPTCHA as it will look like using the current settings. Use the preview button to refresh. Note that captchas are randomized and will differ from one view to the next.', + 'CAPTCHA_PREVIEW_EXPLAIN' => 'The CAPTCHA as it would look like using the current selection.', + + 'CAPTCHA_SELECT' => 'Installed CAPTCHA plugins', + 'CAPTCHA_SELECT_EXPLAIN' => 'The dropdown holds the CAPTCHA plugins recognized by the board. Gray entries are not available right now and might need configuration prior to use.', + 'CAPTCHA_CONFIGURE' => 'Configure CAPTCHAs', + 'CAPTCHA_CONFIGURE_EXPLAIN' => 'Change the settings for the selected CAPTCHA.', + 'CONFIGURE' => 'Configure', + 'CAPTCHA_NO_OPTIONS' => 'This CAPTCHA has no configuration options.', 'VISUAL_CONFIRM_POST' => 'Enable visual confirmation for guest postings', 'VISUAL_CONFIRM_POST_EXPLAIN' => 'Requires anonymous users to enter a random code matching an image to help prevent mass postings.', 'VISUAL_CONFIRM_REG' => 'Enable visual confirmation for registrations', diff --git a/phpBB/language/en/recaptcha.php b/phpBB/language/en/recaptcha.php new file mode 100644 index 0000000000..140e300b7b --- /dev/null +++ b/phpBB/language/en/recaptcha.php @@ -0,0 +1,51 @@ + 'en', + 'RECAPTCHA_NOT_AVAILABLE' => 'You have to register for reCaptcha at reCaptcha.net.', + 'CAPTCHA_RECAPTCHA' => 'reCaptcha', + 'RECAPTCHA_INCORRECT' => 'The entered visual confirmation was incorrect', + + 'RECAPTCHA_PUBLIC' => 'Public reCaptcha key', + 'RECAPTCHA_PUBLIC_EXPLAIN' => 'Your public reCaptcha key. You can obtain keys from reCaptcha.net.', + 'RECAPTCHA_PRIVATE' => 'Private reCaptcha key', + 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. You can obtain keys from reCaptcha.net.', + +)); + +?> \ No newline at end of file diff --git a/phpBB/posting.php b/phpBB/posting.php index c16c55111a..18c5b2fa7c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -45,7 +45,13 @@ $mode = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var $error = $post_data = array(); $current_time = time(); - +if ($config['enable_post_confirm'] && !$user->data['is_registered']) +{ + include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); + $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_POST); +} + // Was cancel pressed? If so then redirect to the appropriate page if ($cancel || ($current_time - $lastclick < 2 && $submit)) { @@ -763,21 +769,10 @@ if ($submit || $preview || $refresh) if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) { - $confirm_id = request_var('confirm_id', ''); - $confirm_code = request_var('confirm_code', ''); - - $sql = 'SELECT code - FROM ' . CONFIRM_TABLE . " - WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . CONFIRM_POST; - $result = $db->sql_query($sql); - $confirm_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (empty($confirm_row['code']) || strcasecmp($confirm_row['code'], $confirm_code) !== 0) + $vc_response = $captcha->validate(); + if ($vc_response) { - $error[] = $user->lang['CONFIRM_CODE_WRONG']; + $error[] = $vc_response; } else { @@ -1021,7 +1016,10 @@ if ($submit || $preview || $refresh) } $redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message); - + if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) + { + $captcha->reset(); + } // Check the permissions for post approval, as well as the queue trigger where users are put on approval with a post count lower than specified. Moderators are not affected. if ((($config['enable_queue_trigger'] && $user->data['user_posts'] < $config['queue_trigger_posts']) || !$auth->acl_get('f_noapprove', $data['forum_id'])) && !$auth->acl_get('m_approve', $data['forum_id'])) { @@ -1242,34 +1240,12 @@ generate_forum_rules($post_data); if ($config['enable_post_confirm'] && !$user->data['is_registered'] && $solved_captcha === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) { - // Show confirm image - $sql = 'DELETE FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . CONFIRM_POST; - $db->sql_query($sql); + $captcha->reset(); - // Generate code - $code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); - $confirm_id = md5(unique_id($user->ip)); - $seed = hexdec(substr(unique_id(), 4, 10)); - - // compute $seed % 0x7fffffff - $seed -= 0x7fffffff * floor($seed / 0x7fffffff); - - $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'confirm_id' => (string) $confirm_id, - 'session_id' => (string) $user->session_id, - 'confirm_type' => (int) CONFIRM_POST, - 'code' => (string) $code, - 'seed' => (int) $seed) - ); - $db->sql_query($sql); $template->assign_vars(array( 'S_CONFIRM_CODE' => true, - 'CONFIRM_ID' => $confirm_id, - 'CONFIRM_IMAGE' => '', - 'L_POST_CONFIRM_EXPLAIN' => sprintf($user->lang['POST_CONFIRM_EXPLAIN'], '', ''), + 'CONFIRM' => $captcha->get_template(), )); } @@ -1280,10 +1256,7 @@ $s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? ' request_var('confirm_id', ''), - 'confirm_code' => request_var('confirm_code', '')) - ); + $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields()); } $form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"'; diff --git a/phpBB/styles/prosilver/template/captcha_default.html b/phpBB/styles/prosilver/template/captcha_default.html new file mode 100755 index 0000000000..399c978898 --- /dev/null +++ b/phpBB/styles/prosilver/template/captcha_default.html @@ -0,0 +1,9 @@ + +
        +
        +
        +
        + +
        +
        {L_CONFIRM_CODE_EXPLAIN}
        +
        \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html new file mode 100644 index 0000000000..f325c3727d --- /dev/null +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -0,0 +1,19 @@ + +
        + + + +
        + +{L_RECAPTCHA_NOT_AVAILABLE} + \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/login_body.html b/phpBB/styles/prosilver/template/login_body.html index ac7ada28c9..a32c2d1e42 100644 --- a/phpBB/styles/prosilver/template/login_body.html +++ b/phpBB/styles/prosilver/template/login_body.html @@ -21,21 +21,16 @@
        {L_RESEND_ACTIVATION}
        - -
        -

        {L_CONFIRM_CODE_EXPLAIN}
        -
        {CONFIRM_IMAGE}
        -
        -
        + {CONFIRM} -
        +
         
        {S_HIDDEN_FIELDS}
        @@ -46,6 +41,7 @@
      +
      diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 248d1ea72c..315fbaee2b 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -100,11 +100,7 @@
      -
      -

      {L_CONFIRM_CODE_EXPLAIN}
      -
      {CONFIRM_IMAGE}
      -
      -
      + {CONFIRM} diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index 3aeb92a5b0..468b131c4b 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -71,8 +71,7 @@ - - +
      @@ -83,16 +82,11 @@

      {L_CONFIRM_EXPLAIN}

      -
      -
      -
      {CONFIRM_IMG}
      -
      -
      {L_CONFIRM_CODE_EXPLAIN} {L_VC_REFRESH_EXPLAIN}
      -
      -
      -
      - + {S_CAPTCHA} + + + diff --git a/phpBB/styles/subsilver2/template/captcha_default.html b/phpBB/styles/subsilver2/template/captcha_default.html new file mode 100755 index 0000000000..a1bc6cd6dc --- /dev/null +++ b/phpBB/styles/subsilver2/template/captcha_default.html @@ -0,0 +1,19 @@ + + {L_CONFIRM_CODE} + + + {L_CONFIRM_CODE_EXPLAIN} + + + {L_CONFIRM_CODE} + + + + + {L_CONFIRM_CODE}:
      {L_CONFIRM_CODE_EXPLAIN} + + + + + + diff --git a/phpBB/styles/subsilver2/template/captcha_recaptcha.html b/phpBB/styles/subsilver2/template/captcha_recaptcha.html new file mode 100755 index 0000000000..106a5cce2a --- /dev/null +++ b/phpBB/styles/subsilver2/template/captcha_recaptcha.html @@ -0,0 +1,21 @@ + + + // + + + + + +{L_RECAPTCHA_NOT_AVAILABLE} + + + \ No newline at end of file diff --git a/phpBB/styles/subsilver2/template/login_body.html b/phpBB/styles/subsilver2/template/login_body.html index 86eed2dfc6..406ab3a293 100644 --- a/phpBB/styles/subsilver2/template/login_body.html +++ b/phpBB/styles/subsilver2/template/login_body.html @@ -65,26 +65,13 @@ - + - - - - - - - - - - - - - - + + {S_CAPTCHA} + + diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html index da1fbf4e30..162227b7e5 100644 --- a/phpBB/styles/subsilver2/template/posting_body.html +++ b/phpBB/styles/subsilver2/template/posting_body.html @@ -332,24 +332,10 @@ - - - - - - - - - - - - - - - + + {S_CAPTCHA} + + diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html index fd987f2d73..dc47323836 100644 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ b/phpBB/styles/subsilver2/template/ucp_register.html @@ -77,21 +77,9 @@ - - - - - - - - - - - - - - - + + {S_CAPTCHA} + From 1a9202b1647d67223a16d39cf3c0e0a387188fef Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 2 Jun 2009 14:25:11 +0000 Subject: [PATCH 003/607] Okay... git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9525 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/captcha_default.html | 0 phpBB/styles/subsilver2/template/captcha_default.html | 0 phpBB/styles/subsilver2/template/captcha_recaptcha.html | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 phpBB/styles/prosilver/template/captcha_default.html mode change 100755 => 100644 phpBB/styles/subsilver2/template/captcha_default.html mode change 100755 => 100644 phpBB/styles/subsilver2/template/captcha_recaptcha.html diff --git a/phpBB/styles/prosilver/template/captcha_default.html b/phpBB/styles/prosilver/template/captcha_default.html old mode 100755 new mode 100644 diff --git a/phpBB/styles/subsilver2/template/captcha_default.html b/phpBB/styles/subsilver2/template/captcha_default.html old mode 100755 new mode 100644 diff --git a/phpBB/styles/subsilver2/template/captcha_recaptcha.html b/phpBB/styles/subsilver2/template/captcha_recaptcha.html old mode 100755 new mode 100644 From ffbc25e17a64146cb988ba01e536e10a75b8322d Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 2 Jun 2009 21:29:51 +0000 Subject: [PATCH 004/607] New caching plugin, won't cache anything git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9526 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acm/acm_null.php | 163 ++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 phpBB/includes/acm/acm_null.php diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 9f751c701a..3cd2116ddb 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -89,6 +89,7 @@
      • [Feature] Backported 3.2 cpatcha plugins.
      • +
      • [Feature] Introduced new ACM plugins: null

      1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acm/acm_null.php b/phpBB/includes/acm/acm_null.php new file mode 100644 index 0000000000..c2363b9ddf --- /dev/null +++ b/phpBB/includes/acm/acm_null.php @@ -0,0 +1,163 @@ + \ No newline at end of file From 62aa26c9a6681956bfb8af61447cd078271cc0a0 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 2 Jun 2009 22:12:37 +0000 Subject: [PATCH 005/607] - Stop people messing around #45935 - Ensure the Accept-Language header actually picks up a directory. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9527 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/install/index.php b/phpBB/install/index.php index b1eba60af5..47f1787030 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -175,7 +175,7 @@ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language) // Set correct format ... guess full xx_yy form $accept_lang = substr($accept_lang, 0, 2) . '_' . substr($accept_lang, 3, 2); - if (file_exists($phpbb_root_path . 'language/' . $accept_lang)) + if (file_exists($phpbb_root_path . 'language/' . $accept_lang) && is_dir($phpbb_root_path . 'language/' . $accept_lang)) { $language = $accept_lang; break; @@ -184,7 +184,7 @@ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language) { // No match on xx_yy so try xx $accept_lang = substr($accept_lang, 0, 2); - if (file_exists($phpbb_root_path . 'language/' . $accept_lang)) + if (file_exists($phpbb_root_path . 'language/' . $accept_lang) && is_dir($phpbb_root_path . 'language/' . $accept_lang)) { $language = $accept_lang; break; @@ -218,7 +218,7 @@ if (!$language) closedir($dir); } -if (!file_exists($phpbb_root_path . 'language/' . $language)) +if (!file_exists($phpbb_root_path . 'language/' . $language) || !is_dir($phpbb_root_path . 'language/' . $language)) { die('No language found!'); } From be8457d3c418441317177bfcdf7378410ac28d55 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 3 Jun 2009 10:19:17 +0000 Subject: [PATCH 006/607] Correctly determine writable status of files on Windows operating system. #39035 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9528 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_main.php | 2 +- phpBB/includes/functions.php | 61 +++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3cd2116ddb..93c47b0477 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -88,6 +88,7 @@

      1.i. Changes since 3.0.5

        +
      • [Fix] Correctly determine writable status of files on Windows operating system. (Bug #39035)
      • [Feature] Backported 3.2 cpatcha plugins.
      • [Feature] Introduced new ACM plugins: null
      diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 8a92c06e04..365290e909 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -504,7 +504,7 @@ class acp_main $template->assign_var('S_REMOVE_INSTALL', true); } - if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && is_writable($phpbb_root_path . 'config.' . $phpEx)) + if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx)) { // World-Writable? (000x) $template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002)); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 58601be65b..78905beff6 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -669,6 +669,67 @@ function phpbb_chmod($filename, $perms = CHMOD_READ) return $result; } +/** + * Test if a file/directory is writable + * + * This function calls the native is_writable() when not running under + * Windows and it is not disabled. + * + * @param string $file Path to perform write test on + * @return bool True when the path is writable, otherwise false. + */ +function phpbb_is_writable($file) +{ + if (substr(PHP_OS, 0, 3) === 'WIN' || !function_exists('is_writable')) + { + if (file_exists($file)) + { + // Canonicalise path to absolute path + $file = phpbb_realpath($file); + + if (is_dir($file)) + { + // Test directory by creating a file inside the directory + $result = @tempnam($file, 'i_w'); + + if (is_string($result) && file_exists($result)) + { + unlink($result); + + // Ensure the file is actually in the directory (returned realpathed) + return (strpos($result, $file) === 0) ? true : false; + } + } + else + { + $handle = @fopen($file, 'r+'); + + if (is_resource($handle)) + { + fclose($handle); + return true; + } + } + } + else + { + // file does not exist test if we can write to the directory + + $dir = dirname($file); + + if (file_exists($dir) && is_dir($dir) && phpbb_is_writable($dir)) + { + return true; + } + } + return false; + } + else + { + return is_writable($file); + } +} + // Compatibility functions if (!function_exists('array_combine')) From 8fc412f26aa1b6e580b8aa200db79608b19aeae9 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 3 Jun 2009 12:13:01 +0000 Subject: [PATCH 007/607] #44955 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9529 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 4 +++- phpBB/includes/functions_user.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 93c47b0477..ca2ac55ecb 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -88,8 +88,10 @@

      1.i. Changes since 3.0.5

        +
      • [Fix] Allow whitespaces in avatar gallery names. (Bug #44955)
      • +
      • [Fix] Sorting by author or subject on viewtopic now preserves the order. (Bug #44875)
      • [Fix] Correctly determine writable status of files on Windows operating system. (Bug #39035)
      • -
      • [Feature] Backported 3.2 cpatcha plugins.
      • +
      • [Feature] Backported 3.2 captcha plugins.
      • [Feature] Introduced new ACM plugins: null

      1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 027db39751..ee9867b1f1 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2077,8 +2077,8 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var if (preg_match('#^[^&\'"<>]+\.(?:gif|png|jpe?g)$#i', $sub_file)) { $avatar_list[$file][$avatar_row_count][$avatar_col_count] = array( - 'file' => "$file/$sub_file", - 'filename' => $sub_file, + 'file' => rawurlencode ($file) . '/' . rawurlencode ($sub_file), + 'filename' => rawurlencode ($sub_file), 'name' => ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $sub_file))), ); $avatar_col_count++; From 05548f8f05d1f64945a4fdb615f0e4e1620323c2 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 3 Jun 2009 16:29:26 +0000 Subject: [PATCH 008/607] Correctly split UTF-8 encoded strings when using mail(). #45815 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9530 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_messenger.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 4fd5fd19e0..4916ee41d7 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -408,6 +408,8 @@ class messenger $this->from = '<' . $config['board_contact'] . '>'; } + $encode_eol = ($config['smtp_delivery']) ? "\r\n" : $this->eol; + // Build to, cc and bcc strings $to = $cc = $bcc = ''; foreach ($this->addresses as $type => $address_ary) @@ -419,7 +421,7 @@ class messenger foreach ($address_ary as $which_ary) { - $$type .= (($$type != '') ? ', ' : '') . (($which_ary['name'] != '') ? '"' . mail_encode($which_ary['name']) . '" <' . $which_ary['email'] . '>' : $which_ary['email']); + $$type .= (($$type != '') ? ', ' : '') . (($which_ary['name'] != '') ? '"' . mail_encode($which_ary['name'], $encode_eol) . '" <' . $which_ary['email'] . '>' : $which_ary['email']); } } @@ -443,7 +445,7 @@ class messenger $headers = implode($this->eol, $headers); ob_start(); - $result = $config['email_function_name']($mail_to, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $headers); + $result = $config['email_function_name']($mail_to, mail_encode($this->subject, $this->eol), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $headers); $err_msg = ob_get_clean(); } @@ -688,7 +690,7 @@ class queue else { ob_start(); - $result = $config['email_function_name']($to, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), implode($this->eol, $headers)); + $result = $config['email_function_name']($to, mail_encode($subject, $this->eol), wordwrap(utf8_wordwrap($msg), 997, "\n", true), implode($this->eol, $headers)); $err_msg = ob_get_clean(); } @@ -1441,13 +1443,15 @@ class smtp_class * is basically doomed with an unreadable subject. * * Please note that this version fully supports RFC 2045 section 6.8. +* +* @param string $eol End of line we are using (optional to be backwards compatible) */ -function mail_encode($str) +function mail_encode($str, $eol = "\r\n") { // define start delimimter, end delimiter and spacer $start = "=?UTF-8?B?"; $end = "?="; - $delimiter = "\r\n "; + $delimiter = "$eol "; // Maximum length is 75. $split_length *must* be a multiple of 4, but <= 75 - strlen($start . $delimiter . $end)!!! $split_length = 60; From 5478ef15d33eec696ded6a5402a329b77916597e Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 4 Jun 2009 12:29:34 +0000 Subject: [PATCH 009/607] Backport memcache ACM module from Ascraeus git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9531 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/includes/acm/acm_memcache.php | 419 ++++++++++++++++++++++++++++ 2 files changed, 420 insertions(+), 1 deletion(-) create mode 100644 phpBB/includes/acm/acm_memcache.php diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ca2ac55ecb..90ff74a2b1 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -92,7 +92,7 @@
    6. [Fix] Sorting by author or subject on viewtopic now preserves the order. (Bug #44875)
    7. [Fix] Correctly determine writable status of files on Windows operating system. (Bug #39035)
    8. [Feature] Backported 3.2 captcha plugins.
    9. -
    10. [Feature] Introduced new ACM plugins: null
    11. +
    12. [Feature] Introduced new ACM plugins: null, memcache.
    13. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php new file mode 100644 index 0000000000..1fe9218104 --- /dev/null +++ b/phpBB/includes/acm/acm_memcache.php @@ -0,0 +1,419 @@ +memcache = new Memcache; + $this->memcache->connect(PHPBB_ACM_MEMCACHE_HOST, PHPBB_ACM_MEMCACHE_PORT); + $this->flags = (PHPBB_ACM_MEMCACHE_COMPRESS) ? MEMCACHE_COMPRESSED : 0; + + $this->cache_dir = $phpbb_root_path . 'cache/'; + } + + /** + * Load global cache + */ + function load() + { + // grab the global cache + $this->vars = $this->memcache->get('global'); + + if ($this->vars !== false) + { + return true; + } + + return false; + } + + /** + * Unload cache object + */ + function unload() + { + $this->save(); + unset($this->vars); + unset($this->sql_rowset); + unset($this->sql_row_pointer); + + $this->vars = array(); + $this->sql_rowset = array(); + $this->sql_row_pointer = array(); + + $this->memcache->close(); + } + + /** + * Save modified objects + */ + function save() + { + if (!$this->is_modified) + { + return; + } + + $this->memcache->set('global', $this->vars, $this->flags, 2592000); + + $this->is_modified = false; + } + + /** + * Tidy cache + */ + function tidy() + { + // cache has auto GC, no need to have any code here :) + + set_config('cache_last_gc', time(), true); + } + + /** + * Get saved cache object + */ + function get($var_name) + { + if ($var_name[0] == '_') + { + return $this->memcache->get($var_name); + } + else + { + return ($this->_exists($var_name)) ? $this->vars[$var_name] : false; + } + } + + /** + * Put data into cache + */ + function put($var_name, $var, $ttl = 2592000) + { + if ($var_name[0] == '_') + { + $this->memcache->set($var_name, $var, $this->flags, $ttl); + } + else + { + $this->vars[$var_name] = $var; + $this->is_modified = true; + } + } + + /** + * Purge cache data + */ + function purge() + { + // Purge all phpbb cache files + $dir = @opendir($this->cache_dir); + + if (!$dir) + { + return; + } + + while (($entry = readdir($dir)) !== false) + { + if (strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0) + { + continue; + } + + $this->remove_file($this->cache_dir . $entry); + } + closedir($dir); + + $this->memcache->flush(); + + unset($this->vars); + unset($this->sql_rowset); + unset($this->sql_row_pointer); + + $this->vars = array(); + $this->sql_rowset = array(); + $this->sql_row_pointer = array(); + + $this->is_modified = false; + } + + + /** + * Destroy cache data + */ + function destroy($var_name, $table = '') + { + if ($var_name == 'sql' && !empty($table)) + { + if (!is_array($table)) + { + $table = array($table); + } + + foreach ($table as $table_name) + { + // gives us the md5s that we want + $temp = $this->memcache->get('sql_' . $table_name); + + if ($temp === false) + { + continue; + } + + // delete each query ref + foreach ($temp as $md5_id => $void) + { + $this->memcache->delete('sql_' . $md5_id); + } + + // delete the table ref + $this->memcache->delete('sql_' . $table_name); + } + + return; + } + + if (!$this->_exists($var_name)) + { + return; + } + + if ($var_name[0] == '_') + { + $this->memcache->delete($var_name); + } + else + { + $this->is_modified = true; + unset($this->vars[$var_name]); + + // We save here to let the following cache hits succeed + $this->save(); + } + } + + /** + * Check if a given cache entry exist + */ + function _exists($var_name) + { + if ($var_name[0] == '_') + { + return true; + } + else + { + if (!sizeof($this->vars)) + { + $this->load(); + } + + return isset($this->vars[$var_name]); + } + } + + /** + * Load cached sql query + */ + function sql_load($query) + { + // Remove extra spaces and tabs + $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); + $query_id = sizeof($this->sql_rowset); + + if (($result = $this->memcache->get('sql_' . md5($query))) === false) + { + return false; + } + + $this->sql_rowset[$query_id] = $result; + $this->sql_row_pointer[$query_id] = 0; + + return $query_id; + } + + /** + * Save sql query + */ + function sql_save($query, &$query_result, $ttl) + { + global $db; + + // Remove extra spaces and tabs + $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); + $hash = md5($query); + + // determine which tables this query belongs to + preg_match('/FROM \\(?(\\w+(?: \\w+)?(?:, ?\\w+(?: \\w+)?)*)\\)?/', $query, $regs); + $tables = array_map('trim', explode(',', $regs[1])); + + foreach ($tables as $table_name) + { + if (($pos = strpos($table_name, ' ')) !== false) + { + $table_name = substr($table_name, 0, $pos); + } + + $temp = $this->memcache->get('sql_' . $table_name); + + if ($temp === false) + { + $temp = array(); + } + + $temp[$hash] = true; + + $this->memcache->set('sql_' . $table_name, $temp, $this->flags, $ttl); + } + + // store them in the right place + $query_id = sizeof($this->sql_rowset); + $this->sql_rowset[$query_id] = array(); + $this->sql_row_pointer[$query_id] = 0; + + while ($row = $db->sql_fetchrow($query_result)) + { + $this->sql_rowset[$query_id][] = $row; + } + $db->sql_freeresult($query_result); + + $this->memcache->set('sql_' . $hash, $this->sql_rowset[$query_id], $this->flags, $ttl); + + $query_result = $query_id; + } + + /** + * Ceck if a given sql query exist in cache + */ + function sql_exists($query_id) + { + return isset($this->sql_rowset[$query_id]); + } + + /** + * Fetch row from cache (database) + */ + function sql_fetchrow($query_id) + { + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; + } + + return false; + } + + /** + * Fetch a field from the current row of a cached database result (database) + */ + function sql_fetchfield($query_id, $field) + { + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field] : false; + } + + return false; + } + + /** + * Seek a specific row in an a cached database result (database) + */ + function sql_rowseek($rownum, $query_id) + { + if ($rownum >= sizeof($this->sql_rowset[$query_id])) + { + return false; + } + + $this->sql_row_pointer[$query_id] = $rownum; + return true; + } + + /** + * Free memory used for a cached database result (database) + */ + function sql_freeresult($query_id) + { + if (!isset($this->sql_rowset[$query_id])) + { + return false; + } + + unset($this->sql_rowset[$query_id]); + unset($this->sql_row_pointer[$query_id]); + + return true; + } + + /** + * Removes/unlinks file + */ + function remove_file($filename, $check = false) + { + if ($check && !@is_writable($this->cache_dir)) + { + // E_USER_ERROR - not using language entry - intended. + trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); + } + + return @unlink($filename); + } +} + +?> \ No newline at end of file From a975f8454aea77f1e42332b8fb52e66a77415e76 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 4 Jun 2009 13:30:01 +0000 Subject: [PATCH 010/607] Fix up and tidy :) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9532 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/captcha_factory.php | 8 +++++--- phpBB/includes/captcha/captcha_gd_wave.php | 12 ++++++------ phpBB/includes/captcha/captcha_plugin.php | 6 ++++-- .../includes/captcha/plugins/captcha_abstract.php | 7 ++++--- .../captcha/plugins/phpbb_captcha_gd_plugin.php | 14 ++++++++------ .../plugins/phpbb_captcha_gd_wave_plugin.php | 4 +++- .../captcha/plugins/phpbb_captcha_nogd_plugin.php | 12 +++++++----- .../captcha/plugins/phpbb_recaptcha_plugin.php | 8 ++++---- 8 files changed, 41 insertions(+), 30 deletions(-) mode change 100755 => 100644 phpBB/includes/captcha/captcha_factory.php mode change 100755 => 100644 phpBB/includes/captcha/captcha_gd_wave.php mode change 100755 => 100644 phpBB/includes/captcha/captcha_plugin.php mode change 100755 => 100644 phpBB/includes/captcha/plugins/captcha_abstract.php mode change 100755 => 100644 phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php mode change 100755 => 100644 phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php mode change 100755 => 100644 phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php old mode 100755 new mode 100644 index e6f56172ec..fbe615a043 --- a/phpBB/includes/captcha/captcha_factory.php +++ b/phpBB/includes/captcha/captcha_factory.php @@ -1,8 +1,8 @@ - \ No newline at end of file diff --git a/phpBB/includes/captcha/captcha_gd_wave.php b/phpBB/includes/captcha/captcha_gd_wave.php old mode 100755 new mode 100644 index 0356538a4d..41dfcdd9d4 --- a/phpBB/includes/captcha/captcha_gd_wave.php +++ b/phpBB/includes/captcha/captcha_gd_wave.php @@ -2,15 +2,15 @@ /** * * @package VC -* @version $Id: captcha_gd.php,v 1.19 2007/01/26 16:07:43 acydburn Exp $ +* @version $Id$ * @copyright (c) 2006 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ - - -/** -Wave3D CAPTCHA by Robert Hetzler + + +/** +* Wave3D CAPTCHA by Robert Hetzler */ class captcha { @@ -836,7 +836,7 @@ class captcha ), ) ); - } + } } ?> \ No newline at end of file diff --git a/phpBB/includes/captcha/captcha_plugin.php b/phpBB/includes/captcha/captcha_plugin.php old mode 100755 new mode 100644 index 08a149764c..7c601caa93 --- a/phpBB/includes/captcha/captcha_plugin.php +++ b/phpBB/includes/captcha/captcha_plugin.php @@ -1,4 +1,4 @@ - \ No newline at end of file diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php old mode 100755 new mode 100644 index f5c135dc74..f88d82b2a0 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -1,9 +1,9 @@ - \ No newline at end of file diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php old mode 100755 new mode 100644 index 850794e133..5b3c09f32d --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php @@ -1,12 +1,13 @@ - \ No newline at end of file diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php old mode 100755 new mode 100644 index 769867655c..38e5aabedd --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php @@ -3,10 +3,11 @@ * * @package VC * @version $Id$ -* @copyright (c) 2006 2008 phpBB Group +* @copyright (c) 2006, 2008 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ + /** * @ignore */ @@ -29,6 +30,7 @@ class phpbb_captcha_gd_wave extends phpbb_default_captcha function phpbb_captcha_gd_wave() { global $phpbb_root_path, $phpEx; + if (!class_exists('captcha')) { include_once($phpbb_root_path . 'includes/captcha/captcha_gd_wave.' . $phpEx); diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php old mode 100755 new mode 100644 index c5a32137d7..8df11bfe8a --- a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php @@ -1,12 +1,13 @@ - Date: Thu, 4 Jun 2009 13:52:37 +0000 Subject: [PATCH 011/607] ACM memory abstract class git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9533 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acm/acm_memory.php | 401 ++++++++++++++++++++++++++++++ 1 file changed, 401 insertions(+) create mode 100644 phpBB/includes/acm/acm_memory.php diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php new file mode 100644 index 0000000000..964fdb2db4 --- /dev/null +++ b/phpBB/includes/acm/acm_memory.php @@ -0,0 +1,401 @@ +cache_dir = $phpbb_root_path . 'cache/'; + } + + /** + * Load global cache + */ + function load() + { + // grab the global cache + $this->vars = $this->read('global'); + + if ($this->vars !== false) + { + return true; + } + + return false; + } + + /** + * Unload cache object + */ + function unload() + { + $this->save(); + unset($this->vars); + unset($this->sql_rowset); + unset($this->sql_row_pointer); + + $this->vars = array(); + $this->sql_rowset = array(); + $this->sql_row_pointer = array(); + } + + /** + * Save modified objects + */ + function save() + { + if (!$this->is_modified) + { + return; + } + + $this->write('global', $this->vars, 2592000); + + $this->is_modified = false; + } + + /** + * Tidy cache + */ + function tidy() + { + // cache has auto GC, no need to have any code here :) + + set_config('cache_last_gc', time(), true); + } + + /** + * Get saved cache object + */ + function get($var_name) + { + if ($var_name[0] == '_') + { + if (!$this->_exists($var_name)) + { + return false; + } + + return $this->read($var_name); + } + else + { + return ($this->_exists($var_name)) ? $this->vars[$var_name] : false; + } + } + + /** + * Put data into cache + */ + function put($var_name, $var, $ttl = 2592000) + { + if ($var_name[0] == '_') + { + $this->write($var_name, $var, $ttl); + } + else + { + $this->vars[$var_name] = $var; + $this->is_modified = true; + } + } + + /** + * Purge cache data + */ + function purge() + { + // Purge all phpbb cache files + $dir = @opendir($this->cache_dir); + + if (!$dir) + { + return; + } + + while (($entry = readdir($dir)) !== false) + { + if (strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0) + { + continue; + } + + $this->remove_file($this->cache_dir . $entry); + } + closedir($dir); + + unset($this->vars); + unset($this->sql_rowset); + unset($this->sql_row_pointer); + + $this->vars = array(); + $this->sql_rowset = array(); + $this->sql_row_pointer = array(); + + $this->is_modified = false; + } + + + /** + * Destroy cache data + */ + function destroy($var_name, $table = '') + { + if ($var_name == 'sql' && !empty($table)) + { + if (!is_array($table)) + { + $table = array($table); + } + + foreach ($table as $table_name) + { + // gives us the md5s that we want + $temp = $this->read('sql_' . $table_name); + + if ($temp === false) + { + continue; + } + + // delete each query ref + foreach ($temp as $md5_id => $void) + { + $this->delete('sql_' . $md5_id); + } + + // delete the table ref + $this->delete('sql_' . $table_name); + } + + return; + } + + if (!$this->_exists($var_name)) + { + return; + } + + if ($var_name[0] == '_') + { + $this->delete($var_name); + } + else if (isset($this->vars[$var_name])) + { + $this->is_modified = true; + unset($this->vars[$var_name]); + + // We save here to let the following cache hits succeed + $this->save(); + } + } + + /** + * Check if a given cache entry exist + */ + function _exists($var_name) + { + if ($var_name[0] == '_') + { + return true; + } + else + { + if (!sizeof($this->vars)) + { + $this->load(); + } + + return isset($this->vars[$var_name]); + } + } + + /** + * Load cached sql query + */ + function sql_load($query) + { + // Remove extra spaces and tabs + $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); + $query_id = sizeof($this->sql_rowset); + + if (($result = $this->read('sql_' . md5($query))) === false) + { + return false; + } + + $this->sql_rowset[$query_id] = $result; + $this->sql_row_pointer[$query_id] = 0; + + return $query_id; + } + + /** + * Save sql query + */ + function sql_save($query, &$query_result, $ttl) + { + global $db; + + // Remove extra spaces and tabs + $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); + $hash = md5($query); + + // determine which tables this query belongs to + // Some queries use backticks, namely the get_database_size() query + // don't check for conformity, the SQL would error and not reach here. + if (!preg_match('/FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?/', $query, $regs)) + { + // Bail out if the match fails. + return; + } + $tables = array_map('trim', explode(',', $regs[1])); + + foreach ($tables as $table_name) + { + // Remove backticks + $table_name = ($table_name[0] == '`') ? substr($table_name, 1, -1) : $table_name; + + if (($pos = strpos($table_name, ' ')) !== false) + { + $table_name = substr($table_name, 0, $pos); + } + + $temp = $this->read('sql_' . $table_name); + + if ($temp === false) + { + $temp = array(); + } + + $temp[$hash] = true; + + // This must never expire + $this->write('sql_' . $table_name, $temp, 0); + } + + // store them in the right place + $query_id = sizeof($this->sql_rowset); + $this->sql_rowset[$query_id] = array(); + $this->sql_row_pointer[$query_id] = 0; + + while ($row = $db->sql_fetchrow($query_result)) + { + $this->sql_rowset[$query_id][] = $row; + } + $db->sql_freeresult($query_result); + + $this->write('sql_' . $hash, $this->sql_rowset[$query_id], $ttl); + + $query_result = $query_id; + } + + /** + * Ceck if a given sql query exist in cache + */ + function sql_exists($query_id) + { + return isset($this->sql_rowset[$query_id]); + } + + /** + * Fetch row from cache (database) + */ + function sql_fetchrow($query_id) + { + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; + } + + return false; + } + + /** + * Fetch a field from the current row of a cached database result (database) + */ + function sql_fetchfield($query_id, $field) + { + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field] : false; + } + + return false; + } + + /** + * Seek a specific row in an a cached database result (database) + */ + function sql_rowseek($rownum, $query_id) + { + if ($rownum >= sizeof($this->sql_rowset[$query_id])) + { + return false; + } + + $this->sql_row_pointer[$query_id] = $rownum; + return true; + } + + /** + * Free memory used for a cached database result (database) + */ + function sql_freeresult($query_id) + { + if (!isset($this->sql_rowset[$query_id])) + { + return false; + } + + unset($this->sql_rowset[$query_id]); + unset($this->sql_row_pointer[$query_id]); + + return true; + } + + /** + * Removes/unlinks file + */ + function remove_file($filename, $check = false) + { + if ($check && !@is_writable($this->cache_dir)) + { + // E_USER_ERROR - not using language entry - intended. + trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); + } + + return @unlink($filename); + } +} + +?> \ No newline at end of file From 6c025db9ec5754c4a66b88ed0e5a7041f15065b3 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 4 Jun 2009 14:00:34 +0000 Subject: [PATCH 012/607] Add APC Modify Memcache to use the memory abstract git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9534 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/includes/acm/acm_apc.php | 63 +++++ phpBB/includes/acm/acm_memcache.php | 358 ++-------------------------- 3 files changed, 82 insertions(+), 341 deletions(-) create mode 100644 phpBB/includes/acm/acm_apc.php diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 90ff74a2b1..69ae879ebb 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -92,7 +92,7 @@
    14. [Fix] Sorting by author or subject on viewtopic now preserves the order. (Bug #44875)
    15. [Fix] Correctly determine writable status of files on Windows operating system. (Bug #39035)
    16. [Feature] Backported 3.2 captcha plugins.
    17. -
    18. [Feature] Introduced new ACM plugins: null, memcache.
    19. +
    20. [Feature] Introduced new ACM plugins: null, memcache, APC.
    21. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acm/acm_apc.php b/phpBB/includes/acm/acm_apc.php new file mode 100644 index 0000000000..409854bc26 --- /dev/null +++ b/phpBB/includes/acm/acm_apc.php @@ -0,0 +1,63 @@ + \ No newline at end of file diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php index 1fe9218104..4950738522 100644 --- a/phpBB/includes/acm/acm_memcache.php +++ b/phpBB/includes/acm/acm_memcache.php @@ -3,7 +3,7 @@ * * @package acm * @version $Id$ -* @copyright (c) 2005 phpBB Group +* @copyright (c) 2005, 2009 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ @@ -26,6 +26,12 @@ if (!extension_loaded('memcache') || !defined('PHPBB_ACM_MEMCACHE_HOST')) return; } +// Include the abstract base +if (!class_exists('acm_memory')) +{ + require("${phpbb_root_path}includes/acm/acm_memory.$phpEx"); +} + if (!defined('PHPBB_ACM_MEMCACHE_PORT')) { define('PHPBB_ACM_MEMCACHE_PORT', 11211); @@ -40,379 +46,51 @@ if (!defined('PHPBB_ACM_MEMCACHE_COMPRESS')) * ACM for Memcached * @package acm */ -class acm +class acm extends acm_memory { - var $vars = array(); - var $is_modified = false; - - var $sql_rowset = array(); - var $sql_row_pointer = array(); - var $cache_dir = ''; - var $memcache; var $flags = 0; - /** - * Set cache path - */ function acm() { - global $phpbb_root_path; + // Call the parent constructor + parent::acm_memory(); $this->memcache = new Memcache; $this->memcache->connect(PHPBB_ACM_MEMCACHE_HOST, PHPBB_ACM_MEMCACHE_PORT); $this->flags = (PHPBB_ACM_MEMCACHE_COMPRESS) ? MEMCACHE_COMPRESSED : 0; - - $this->cache_dir = $phpbb_root_path . 'cache/'; } - /** - * Load global cache - */ - function load() - { - // grab the global cache - $this->vars = $this->memcache->get('global'); - - if ($this->vars !== false) - { - return true; - } - - return false; - } - - /** - * Unload cache object - */ function unload() { - $this->save(); - unset($this->vars); - unset($this->sql_rowset); - unset($this->sql_row_pointer); - - $this->vars = array(); - $this->sql_rowset = array(); - $this->sql_row_pointer = array(); + parent::unload(); $this->memcache->close(); } - /** - * Save modified objects - */ - function save() - { - if (!$this->is_modified) - { - return; - } - - $this->memcache->set('global', $this->vars, $this->flags, 2592000); - - $this->is_modified = false; - } - - /** - * Tidy cache - */ - function tidy() - { - // cache has auto GC, no need to have any code here :) - - set_config('cache_last_gc', time(), true); - } - - /** - * Get saved cache object - */ - function get($var_name) - { - if ($var_name[0] == '_') - { - return $this->memcache->get($var_name); - } - else - { - return ($this->_exists($var_name)) ? $this->vars[$var_name] : false; - } - } - - /** - * Put data into cache - */ - function put($var_name, $var, $ttl = 2592000) - { - if ($var_name[0] == '_') - { - $this->memcache->set($var_name, $var, $this->flags, $ttl); - } - else - { - $this->vars[$var_name] = $var; - $this->is_modified = true; - } - } - /** * Purge cache data */ function purge() { - // Purge all phpbb cache files - $dir = @opendir($this->cache_dir); - - if (!$dir) - { - return; - } - - while (($entry = readdir($dir)) !== false) - { - if (strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0) - { - continue; - } - - $this->remove_file($this->cache_dir . $entry); - } - closedir($dir); - $this->memcache->flush(); - unset($this->vars); - unset($this->sql_rowset); - unset($this->sql_row_pointer); - - $this->vars = array(); - $this->sql_rowset = array(); - $this->sql_row_pointer = array(); - - $this->is_modified = false; + parent::purge(); } - - /** - * Destroy cache data - */ - function destroy($var_name, $table = '') + function read($var) { - if ($var_name == 'sql' && !empty($table)) - { - if (!is_array($table)) - { - $table = array($table); - } - - foreach ($table as $table_name) - { - // gives us the md5s that we want - $temp = $this->memcache->get('sql_' . $table_name); - - if ($temp === false) - { - continue; - } - - // delete each query ref - foreach ($temp as $md5_id => $void) - { - $this->memcache->delete('sql_' . $md5_id); - } - - // delete the table ref - $this->memcache->delete('sql_' . $table_name); - } - - return; - } - - if (!$this->_exists($var_name)) - { - return; - } - - if ($var_name[0] == '_') - { - $this->memcache->delete($var_name); - } - else - { - $this->is_modified = true; - unset($this->vars[$var_name]); - - // We save here to let the following cache hits succeed - $this->save(); - } + return $this->memcache->get($var); } - /** - * Check if a given cache entry exist - */ - function _exists($var_name) + function write($var, $data, $ttl = 2592000) { - if ($var_name[0] == '_') - { - return true; - } - else - { - if (!sizeof($this->vars)) - { - $this->load(); - } - - return isset($this->vars[$var_name]); - } + return $this->memcache->set($var, $data, $this->flags, $ttl); } - /** - * Load cached sql query - */ - function sql_load($query) + function delete($var) { - // Remove extra spaces and tabs - $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - $query_id = sizeof($this->sql_rowset); - - if (($result = $this->memcache->get('sql_' . md5($query))) === false) - { - return false; - } - - $this->sql_rowset[$query_id] = $result; - $this->sql_row_pointer[$query_id] = 0; - - return $query_id; - } - - /** - * Save sql query - */ - function sql_save($query, &$query_result, $ttl) - { - global $db; - - // Remove extra spaces and tabs - $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - $hash = md5($query); - - // determine which tables this query belongs to - preg_match('/FROM \\(?(\\w+(?: \\w+)?(?:, ?\\w+(?: \\w+)?)*)\\)?/', $query, $regs); - $tables = array_map('trim', explode(',', $regs[1])); - - foreach ($tables as $table_name) - { - if (($pos = strpos($table_name, ' ')) !== false) - { - $table_name = substr($table_name, 0, $pos); - } - - $temp = $this->memcache->get('sql_' . $table_name); - - if ($temp === false) - { - $temp = array(); - } - - $temp[$hash] = true; - - $this->memcache->set('sql_' . $table_name, $temp, $this->flags, $ttl); - } - - // store them in the right place - $query_id = sizeof($this->sql_rowset); - $this->sql_rowset[$query_id] = array(); - $this->sql_row_pointer[$query_id] = 0; - - while ($row = $db->sql_fetchrow($query_result)) - { - $this->sql_rowset[$query_id][] = $row; - } - $db->sql_freeresult($query_result); - - $this->memcache->set('sql_' . $hash, $this->sql_rowset[$query_id], $this->flags, $ttl); - - $query_result = $query_id; - } - - /** - * Ceck if a given sql query exist in cache - */ - function sql_exists($query_id) - { - return isset($this->sql_rowset[$query_id]); - } - - /** - * Fetch row from cache (database) - */ - function sql_fetchrow($query_id) - { - if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) - { - return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; - } - - return false; - } - - /** - * Fetch a field from the current row of a cached database result (database) - */ - function sql_fetchfield($query_id, $field) - { - if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) - { - return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field] : false; - } - - return false; - } - - /** - * Seek a specific row in an a cached database result (database) - */ - function sql_rowseek($rownum, $query_id) - { - if ($rownum >= sizeof($this->sql_rowset[$query_id])) - { - return false; - } - - $this->sql_row_pointer[$query_id] = $rownum; - return true; - } - - /** - * Free memory used for a cached database result (database) - */ - function sql_freeresult($query_id) - { - if (!isset($this->sql_rowset[$query_id])) - { - return false; - } - - unset($this->sql_rowset[$query_id]); - unset($this->sql_row_pointer[$query_id]); - - return true; - } - - /** - * Removes/unlinks file - */ - function remove_file($filename, $check = false) - { - if ($check && !@is_writable($this->cache_dir)) - { - // E_USER_ERROR - not using language entry - intended. - trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); - } - - return @unlink($filename); + return $this->memcache->delete($var); } } From aec3a498de31b380d0eb48154de0b2bd56054dfa Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 4 Jun 2009 14:34:07 +0000 Subject: [PATCH 014/607] Lets follow some PHP4 conventions underscores for internal methods. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9536 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acm/acm_apc.php | 31 ++++++++++++++++++++++--- phpBB/includes/acm/acm_memcache.php | 36 ++++++++++++++++++++++++++--- phpBB/includes/acm/acm_memory.php | 26 +++++++++++---------- 3 files changed, 75 insertions(+), 18 deletions(-) diff --git a/phpBB/includes/acm/acm_apc.php b/phpBB/includes/acm/acm_apc.php index 409854bc26..cbda86bec0 100644 --- a/phpBB/includes/acm/acm_apc.php +++ b/phpBB/includes/acm/acm_apc.php @@ -36,6 +36,8 @@ class acm extends acm_memory /** * Purge cache data + * + * @return void */ function purge() { @@ -44,17 +46,40 @@ class acm extends acm_memory parent::purge(); } - function read($var) + /** + * Fetch an item from the cache + * + * @access protected + * @param string $var Cache key + * @return mixed Cached data + */ + function _read($var) { return apc_fetch($var); } - function write($var, $data, $ttl = 2592000) + /** + * Store data in the cache + * + * @access protected + * @param string $var Cache key + * @param mixed $data Data to store + * @param int $ttl Time-to-live of cached data + * @return bool True if the operation succeeded + */ + function _write($var, $data, $ttl = 2592000) { return apc_store($var, $data, $ttl); } - function delete($var) + /** + * Remove an item from the cache + * + * @access protected + * @param string $var Cache key + * @return bool True if the operation succeeded + */ + function _delete($var) { return apc_delete($var); } diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php index 4950738522..1ec37f1b3b 100644 --- a/phpBB/includes/acm/acm_memcache.php +++ b/phpBB/includes/acm/acm_memcache.php @@ -61,6 +61,11 @@ class acm extends acm_memory $this->flags = (PHPBB_ACM_MEMCACHE_COMPRESS) ? MEMCACHE_COMPRESSED : 0; } + /** + * Unload the cache resources + * + * @return void + */ function unload() { parent::unload(); @@ -70,6 +75,8 @@ class acm extends acm_memory /** * Purge cache data + * + * @return void */ function purge() { @@ -78,17 +85,40 @@ class acm extends acm_memory parent::purge(); } - function read($var) + /** + * Fetch an item from the cache + * + * @access protected + * @param string $var Cache key + * @return mixed Cached data + */ + function _read($var) { return $this->memcache->get($var); } - function write($var, $data, $ttl = 2592000) + /** + * Store data in the cache + * + * @access protected + * @param string $var Cache key + * @param mixed $data Data to store + * @param int $ttl Time-to-live of cached data + * @return bool True if the operation succeeded + */ + function _write($var, $data, $ttl = 2592000) { return $this->memcache->set($var, $data, $this->flags, $ttl); } - function delete($var) + /** + * Remove an item from the cache + * + * @access protected + * @param string $var Cache key + * @return bool True if the operation succeeded + */ + function _delete($var) { return $this->memcache->delete($var); } diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index 964fdb2db4..7875c3441e 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -34,6 +34,8 @@ class acm_memory */ function acm_memory() { + global $phpbb_root_path; + $this->cache_dir = $phpbb_root_path . 'cache/'; } @@ -43,7 +45,7 @@ class acm_memory function load() { // grab the global cache - $this->vars = $this->read('global'); + $this->vars = $this->_read('global'); if ($this->vars !== false) { @@ -78,7 +80,7 @@ class acm_memory return; } - $this->write('global', $this->vars, 2592000); + $this->_write('global', $this->vars, 2592000); $this->is_modified = false; } @@ -105,7 +107,7 @@ class acm_memory return false; } - return $this->read($var_name); + return $this->_read($var_name); } else { @@ -120,7 +122,7 @@ class acm_memory { if ($var_name[0] == '_') { - $this->write($var_name, $var, $ttl); + $this->_write($var_name, $var, $ttl); } else { @@ -180,7 +182,7 @@ class acm_memory foreach ($table as $table_name) { // gives us the md5s that we want - $temp = $this->read('sql_' . $table_name); + $temp = $this->_read('sql_' . $table_name); if ($temp === false) { @@ -190,11 +192,11 @@ class acm_memory // delete each query ref foreach ($temp as $md5_id => $void) { - $this->delete('sql_' . $md5_id); + $this->_delete('sql_' . $md5_id); } // delete the table ref - $this->delete('sql_' . $table_name); + $this->_delete('sql_' . $table_name); } return; @@ -207,7 +209,7 @@ class acm_memory if ($var_name[0] == '_') { - $this->delete($var_name); + $this->_delete($var_name); } else if (isset($this->vars[$var_name])) { @@ -248,7 +250,7 @@ class acm_memory $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); $query_id = sizeof($this->sql_rowset); - if (($result = $this->read('sql_' . md5($query))) === false) + if (($result = $this->_read('sql_' . md5($query))) === false) { return false; } @@ -290,7 +292,7 @@ class acm_memory $table_name = substr($table_name, 0, $pos); } - $temp = $this->read('sql_' . $table_name); + $temp = $this->_read('sql_' . $table_name); if ($temp === false) { @@ -300,7 +302,7 @@ class acm_memory $temp[$hash] = true; // This must never expire - $this->write('sql_' . $table_name, $temp, 0); + $this->_write('sql_' . $table_name, $temp, 0); } // store them in the right place @@ -314,7 +316,7 @@ class acm_memory } $db->sql_freeresult($query_result); - $this->write('sql_' . $hash, $this->sql_rowset[$query_id], $ttl); + $this->_write('sql_' . $hash, $this->sql_rowset[$query_id], $ttl); $query_result = $query_id; } From 2230e325140dd2cc77d273f77d63b4c1afdc4ed5 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 4 Jun 2009 15:04:14 +0000 Subject: [PATCH 015/607] Introduce XCache and eAccelerator, make some small changes to the abstract git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9537 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 69ae879ebb..6df3240e01 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -92,7 +92,15 @@
    22. [Fix] Sorting by author or subject on viewtopic now preserves the order. (Bug #44875)
    23. [Fix] Correctly determine writable status of files on Windows operating system. (Bug #39035)
    24. [Feature] Backported 3.2 captcha plugins.
    25. -
    26. [Feature] Introduced new ACM plugins: null, memcache, APC.
    27. +
    28. [Feature] Introduced new ACM plugins: + +
    29. 1.ii. Changes since 3.0.4

      From 0cdad21cb38337255761b53513d5626674ab7986 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 4 Jun 2009 15:04:36 +0000 Subject: [PATCH 016/607] Introduce XCache and eAccelerator, make some small changes to the abstract, forgot a period in the command for r9537 :( git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9538 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acm/acm_eaccelerator.php | 123 ++++++++++++++++++++++++ phpBB/includes/acm/acm_memory.php | 15 ++- phpBB/includes/acm/acm_xcache.php | 106 ++++++++++++++++++++ 3 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 phpBB/includes/acm/acm_eaccelerator.php create mode 100644 phpBB/includes/acm/acm_xcache.php diff --git a/phpBB/includes/acm/acm_eaccelerator.php b/phpBB/includes/acm/acm_eaccelerator.php new file mode 100644 index 0000000000..3697fb5202 --- /dev/null +++ b/phpBB/includes/acm/acm_eaccelerator.php @@ -0,0 +1,123 @@ +serialize_header . 'O:') === 0) + { + $result = unserialize(substr($result, strlen($this->serialize_header))); + } + + return $result; + } + + /** + * Store data in the cache + * + * @access protected + * @param string $var Cache key + * @param mixed $data Data to store + * @param int $ttl Time-to-live of cached data + * @return bool True if the operation succeeded + */ + function _write($var, $data, $ttl = 2592000) + { + // Serialize objects and make them easy to detect + $data = (is_object($data)) ? $this->serialize_header . serialize($data) : $data; + + return eaccelerator_put($var, $data, $ttl); + } + + /** + * Remove an item from the cache + * + * @access protected + * @param string $var Cache key + * @return bool True if the operation succeeded + */ + function _delete($var) + { + return eaccelerator_rm($var); + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index 7875c3441e..a97f680d1e 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -228,7 +228,7 @@ class acm_memory { if ($var_name[0] == '_') { - return true; + return $this->_isset($var_name); } else { @@ -398,6 +398,19 @@ class acm_memory return @unlink($filename); } + + /** + * Check if a cache var exists + * + * @access protected + * @param string $var Cache key + * @return bool True if it exists, otherwise false + */ + function _isset($var) + { + // Most caches don't need to check + return true; + } } ?> \ No newline at end of file diff --git a/phpBB/includes/acm/acm_xcache.php b/phpBB/includes/acm/acm_xcache.php new file mode 100644 index 0000000000..36a32c167e --- /dev/null +++ b/phpBB/includes/acm/acm_xcache.php @@ -0,0 +1,106 @@ + \ No newline at end of file From 710604caa328be820d6240cb9cfccf568bc874d2 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 4 Jun 2009 15:09:59 +0000 Subject: [PATCH 017/607] Fix DOS line endings, evil<3 this doesn't count as spam you told me to :P git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9539 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/captcha_gd_wave.php | 1682 ++++++++++---------- 1 file changed, 841 insertions(+), 841 deletions(-) diff --git a/phpBB/includes/captcha/captcha_gd_wave.php b/phpBB/includes/captcha/captcha_gd_wave.php index 41dfcdd9d4..d911d574f7 100644 --- a/phpBB/includes/captcha/captcha_gd_wave.php +++ b/phpBB/includes/captcha/captcha_gd_wave.php @@ -1,842 +1,842 @@ -width; - $img_y = $this->height; - - // Generate image - $img = imagecreatetruecolor($img_x, $img_y); - $x_grid = mt_rand(6, 10); - $y_grid = mt_rand(6, 10); - - // Ok, so lets cut to the chase. We could accurately represent this in 3d and - // do all the appropriate linear transforms. my questions is... why bother? - // The computational overhead is unnecessary when you consider the simple fact: - // we're not here to accurately represent a model, but to just show off some random-ish - // polygons - - // Conceive of 3 spaces. - // 1) planar-space (discrete "pixel" grid) - // 2) 3-space. (planar-space with z/height aspect) - // 3) image space (pixels on the screen) - // resolution of the planar-space we're embedding the text code in - $plane_x = 100; - $plane_y = 30; - - $subdivision_factor = 3; - // $box is the 4 points in img_space that correspond to the corners of the plane in 3-space - $box = array( - 'upper_left' => array( - 'x' => mt_rand(5, 15), - 'y' => mt_rand(10, 15) - ), - 'upper_right' => array( - 'x' => mt_rand($img_x - 35, $img_x - 19), - 'y' => mt_rand(10, 17) - ), - 'lower_left' => array( - 'x' => mt_rand($img_x - 5, $img_x - 45), - 'y' => mt_rand($img_y - 0, $img_y - 15) - ), - ); - $box['lower_right'] = array( - 'x' => $box['lower_left']['x'] + $box['upper_left']['x'] - $box['upper_right']['x'], - 'y' => $box['lower_left']['y'] + $box['upper_left']['y'] - $box['upper_right']['y'], - ); - - - // TODO - $background = imagecolorallocate($img, mt_rand(155, 255), mt_rand(155, 255), mt_rand(155, 255)); - imagefill($img, 0, 0, $background); - $black = imagecolorallocate($img, 0, 0, 0); - - $random = array(); - $fontcolors = array(); - - for ($i = 0; $i < 15; ++$i) - { - $random[$i] = imagecolorallocate($img, mt_rand(120, 255), mt_rand(120, 255), mt_rand(120, 255)); - } - - $fontcolors[0] = imagecolorallocate($img, mt_rand(0, 120), mt_rand(0, 120), mt_rand(0, 120)); - - $colors = array(); - - $minr = mt_rand(20, 30); - $ming = mt_rand(20, 30); - $minb = mt_rand(20, 30); - - $maxr = mt_rand(150, 230); - $maxg = mt_rand(150, 230); - $maxb = mt_rand(150, 230); - - for ($i = -30; $i <= 30; ++$i) - { - $coeff1 = ($i + 12) / 45; - $coeff2 = 1 - $coeff1; - $colors[$i] = imagecolorallocate($img, ($coeff2 * $maxr) + ($coeff1 * $minr), ($coeff2 * $maxg) + ($coeff1 * $ming), ($coeff2 * $maxb) + ($coeff1 * $minb)); - } - - // $img_buffer is the last row of 3-space positions (converted to img-space), cached - // (using this means we don't need to recalculate all 4 positions for each new polygon, - // merely the newest point that we're adding, which is then cached. - $img_buffer = array(array(), array()); - - // In image-space, the x- and y-offset necessary to move one unit in the x-direction in planar-space - $dxx = ($box['upper_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_x); - $dxy = ($box['upper_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_x); - - // In image-space, the x- and y-offset necessary to move one unit in the y-direction in planar-space - $dyx = ($box['lower_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_y); - $dyy = ($box['lower_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_y); - - // Initial captcha-letter offset in planar-space - $plane_offset_x = mt_rand(3, 8); - $plane_offset_y = mt_rand( 12, 15); - - // character map - $map = $this->captcha_bitmaps(); - - // matrix - $plane = array(); - - // for each character, we'll silkscreen it into our boolean pixel plane - for ($c = 0, $code_num = strlen($code); $c < $code_num; ++$c) - { - $letter = $code[$c]; - - for ($x = $map['width'] - 1; $x >= 0; --$x) - { - for ($y = $map['height'] - 1; $y >= 0; --$y) - { - if ($map['data'][$letter][$y][$x]) - { - $plane[$y + $plane_offset_y + (($c & 1) ? 1 : -1)][$x + $plane_offset_x] = true; - } - } - } - $plane_offset_x += 11; - } - - // calculate our first buffer, we can't actually draw polys with these yet - // img_pos_prev == screen x,y location to our immediate left. - // img_pos_cur == current screen x,y location - // we calculate screen position of our - // current cell based on the difference from the previous cell - // rather than recalculating from absolute coordinates - // What we cache into the $img_buffer contains the raised text coordinates. - $img_pos_prev = $img_buffer[0][0] = array($box['upper_left']['x'], $box['upper_left']['y']); - $cur_height = $prev_height = $this->wave_height(0, 0, $subdivision_factor); - $full_x = $plane_x * $subdivision_factor; - $full_y = $plane_y * $subdivision_factor; - - for ($x = 1; $x <= $full_x; ++$x) - { - $cur_height = $this->wave_height($x, 0, $subdivision_factor); - $offset = $cur_height - $prev_height; - $img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset); - - $img_buffer[0][$x] = $img_pos_cur; - $img_pos_prev = $img_pos_cur; - $prev_height = $cur_height; - } - - for ($y = 1; $y <= $full_y; ++$y) - { - // swap buffers - $buffer_cur = $y & 1; - $buffer_prev = 1 - $buffer_cur; - - $prev_height = $this->wave_height(0, $y, $subdivision_factor); - $offset = $prev_height - $this->wave_height(0, $y - 1, $subdivision_factor); - $img_pos_cur = array($img_buffer[$buffer_prev][0][0] + $dyx, min($img_buffer[$buffer_prev][0][1] + $dyy + $offset, $img_y - 1)); - - // make sure we don't try to write off the page - $img_pos_prev = $img_pos_cur; - - $img_buffer[$buffer_cur][0] = $img_pos_cur; - - for ($x = 1; $x <= $full_x; ++$x) - { - $cur_height = $this->wave_height($x, $y, $subdivision_factor) + $this->grid_height($x, $y, 1, $x_grid, $y_grid); - - // height is a z-factor, not a y-factor - $offset = $cur_height - $prev_height; - $img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset); - - // height is float, index it to an int, get closest color - $color = $colors[intval($cur_height)]; - $img_pos_prev = $img_pos_cur; - $prev_height = $cur_height; - - $y_index_old = intval(($y - 1) / $subdivision_factor); - $y_index_new = intval($y / $subdivision_factor); - $x_index_old = intval(($x - 1) / $subdivision_factor); - $x_index_new = intval($x / $subdivision_factor); - - if (!empty($plane[$y_index_new][$x_index_new])) - { - $img_pos_cur[1] += $this->wave_height($x, $y, $subdivision_factor, 1) - 30 - $cur_height; - $color = $colors[20]; - } - $img_pos_cur[1] = min($img_pos_cur[1], $img_y - 1); - $img_buffer[$buffer_cur][$x] = $img_pos_cur; - - // Smooth the edges as much as possible by having not more than one low<->high traingle per square - // Otherwise, just - $diag_down = (empty($plane[$y_index_old][$x_index_old]) == empty($plane[$y_index_new][$x_index_new])); - $diag_up = (empty($plane[$y_index_old][$x_index_new]) == empty($plane[$y_index_new][$x_index_old])); - - // natural switching - $mode = ($x + $y) & 1; - - // override if it requires it - if ($diag_down != $diag_up) - { - $mode = $diag_up; - } - - if ($mode) - { - // +-/ / - // 1 |/ 2 /| - // / /-+ - $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x]); - $poly2 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_cur][$x], $img_buffer[$buffer_prev][$x]); - } - else - { - // \ \-+ - // 1 |\ 2 \| - // +-\ \ - $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_cur][$x]); - $poly2 = array_merge($img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x], $img_buffer[$buffer_cur][$x]); - } - - imagefilledpolygon($img, $poly1, 3, $color); - imagefilledpolygon($img, $poly2, 3, $color); - } - } - - // Output image - header('Content-Type: image/png'); - header('Cache-control: no-cache, no-store'); - //$mtime = explode(' ', microtime()); - //$totaltime = $mtime[0] + $mtime[1] - $starttime; - - //echo $totaltime . "
      \n"; - //echo memory_get_usage() - $tmp; - imagepng($img); - imagedestroy($img); - } - - function wave_height($x, $y, $factor = 1, $tweak = 0.7) - { - // stretch the wave. TODO: pretty it up - $x = $x/5 + 180; - $y = $y/4; - return ((sin($x / (3 * $factor)) + sin($y / (3 * $factor))) * 10 * $tweak); - } - - function grid_height($x, $y, $factor = 1, $x_grid, $y_grid) - { - return ((!($x % ($x_grid * $factor)) || !($y % ($y_grid * $factor))) ? 3 : 0); - } - - function captcha_bitmaps() - { - return array( - 'width' => 9, - 'height' => 13, - 'data' => array( - 'A' => array( - array(0,0,1,1,1,1,0,0,0), - array(0,1,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'B' => array( - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,1,0,0), - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,1,0,0), - array(1,1,1,1,1,1,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'C' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'D' => array( - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'E' => array( - array(0,0,1,1,1,1,1,1,1), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'F' => array( - array(0,0,1,1,1,1,1,1,0), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'G' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'H' => array( - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'I' => array( - array(0,1,1,1,1,1,1,1,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,1,1,1,1,1,1,1,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'J' => array( - array(0,0,0,0,0,0,1,1,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,0,1,0,0,0,0,1,0), - array(0,0,0,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'K' => array( - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,1,0,0,0,0,0,0), - array(1,1,0,0,0,0,0,0,0), - array(1,0,1,0,0,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'L' => array( - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'M' => array( - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,0,0,0,1,1,0), - array(0,1,0,1,0,1,0,1,0), - array(0,1,0,0,1,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'N' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,1,0,0,0,0,0,0,1), - array(1,0,1,0,0,0,0,0,1), - array(1,0,0,1,0,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,0,1,0,0,1), - array(1,0,0,0,0,0,1,0,1), - array(1,0,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'O' => array( - array(0,0,0,1,1,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,1,1,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'P' => array( - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,1,0,0), - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'Q' => array( - array(0,0,1,1,1,1,0,0,0), - array(0,1,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,1,0,0,1,0), - array(1,0,0,0,0,1,0,1,0), - array(0,1,0,0,0,0,1,0,0), - array(0,0,1,1,1,1,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'R' => array( - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,1,0,0), - array(1,1,1,1,1,1,0,0,0), - array(1,0,1,0,0,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'S' => array( - array(0,0,1,1,1,1,1,1,1), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'T' => array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'U' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'V' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'W' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,1,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'X' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'Y' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'Z' => array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,1,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,1), - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '1' => array( - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,1,0,0,0,0), - array(0,0,1,0,1,0,0,0,0), - array(0,1,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,1,1,1,1,1,1,1,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '2' => array( - array(0,0,0,1,1,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,1,0,0,0,0,0,0), - array(0,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,0,0), - ), - '3' => array( - array(0,0,0,1,1,1,1,0,0), - array(0,0,1,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,1,1,0,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,0,1,0,0,0,0,1,0), - array(0,0,0,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '4' => array( - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,1,0), - array(0,0,0,0,0,1,0,1,0), - array(0,0,0,0,1,0,0,1,0), - array(0,0,0,1,0,0,0,1,0), - array(0,0,1,0,0,0,0,1,0), - array(0,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '5' => array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '6' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,1,1,1,1,0,0), - array(1,0,1,0,0,0,0,1,0), - array(1,1,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '7' => array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '8' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '9' => array( - array(0,0,0,1,1,1,1,0,0), - array(0,0,1,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,1), - array(0,0,1,1,1,1,1,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,0,1,0,0,0,0,1,0), - array(0,0,0,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - ) - ); - } -} - +width; + $img_y = $this->height; + + // Generate image + $img = imagecreatetruecolor($img_x, $img_y); + $x_grid = mt_rand(6, 10); + $y_grid = mt_rand(6, 10); + + // Ok, so lets cut to the chase. We could accurately represent this in 3d and + // do all the appropriate linear transforms. my questions is... why bother? + // The computational overhead is unnecessary when you consider the simple fact: + // we're not here to accurately represent a model, but to just show off some random-ish + // polygons + + // Conceive of 3 spaces. + // 1) planar-space (discrete "pixel" grid) + // 2) 3-space. (planar-space with z/height aspect) + // 3) image space (pixels on the screen) + // resolution of the planar-space we're embedding the text code in + $plane_x = 100; + $plane_y = 30; + + $subdivision_factor = 3; + // $box is the 4 points in img_space that correspond to the corners of the plane in 3-space + $box = array( + 'upper_left' => array( + 'x' => mt_rand(5, 15), + 'y' => mt_rand(10, 15) + ), + 'upper_right' => array( + 'x' => mt_rand($img_x - 35, $img_x - 19), + 'y' => mt_rand(10, 17) + ), + 'lower_left' => array( + 'x' => mt_rand($img_x - 5, $img_x - 45), + 'y' => mt_rand($img_y - 0, $img_y - 15) + ), + ); + $box['lower_right'] = array( + 'x' => $box['lower_left']['x'] + $box['upper_left']['x'] - $box['upper_right']['x'], + 'y' => $box['lower_left']['y'] + $box['upper_left']['y'] - $box['upper_right']['y'], + ); + + + // TODO + $background = imagecolorallocate($img, mt_rand(155, 255), mt_rand(155, 255), mt_rand(155, 255)); + imagefill($img, 0, 0, $background); + $black = imagecolorallocate($img, 0, 0, 0); + + $random = array(); + $fontcolors = array(); + + for ($i = 0; $i < 15; ++$i) + { + $random[$i] = imagecolorallocate($img, mt_rand(120, 255), mt_rand(120, 255), mt_rand(120, 255)); + } + + $fontcolors[0] = imagecolorallocate($img, mt_rand(0, 120), mt_rand(0, 120), mt_rand(0, 120)); + + $colors = array(); + + $minr = mt_rand(20, 30); + $ming = mt_rand(20, 30); + $minb = mt_rand(20, 30); + + $maxr = mt_rand(150, 230); + $maxg = mt_rand(150, 230); + $maxb = mt_rand(150, 230); + + for ($i = -30; $i <= 30; ++$i) + { + $coeff1 = ($i + 12) / 45; + $coeff2 = 1 - $coeff1; + $colors[$i] = imagecolorallocate($img, ($coeff2 * $maxr) + ($coeff1 * $minr), ($coeff2 * $maxg) + ($coeff1 * $ming), ($coeff2 * $maxb) + ($coeff1 * $minb)); + } + + // $img_buffer is the last row of 3-space positions (converted to img-space), cached + // (using this means we don't need to recalculate all 4 positions for each new polygon, + // merely the newest point that we're adding, which is then cached. + $img_buffer = array(array(), array()); + + // In image-space, the x- and y-offset necessary to move one unit in the x-direction in planar-space + $dxx = ($box['upper_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_x); + $dxy = ($box['upper_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_x); + + // In image-space, the x- and y-offset necessary to move one unit in the y-direction in planar-space + $dyx = ($box['lower_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_y); + $dyy = ($box['lower_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_y); + + // Initial captcha-letter offset in planar-space + $plane_offset_x = mt_rand(3, 8); + $plane_offset_y = mt_rand( 12, 15); + + // character map + $map = $this->captcha_bitmaps(); + + // matrix + $plane = array(); + + // for each character, we'll silkscreen it into our boolean pixel plane + for ($c = 0, $code_num = strlen($code); $c < $code_num; ++$c) + { + $letter = $code[$c]; + + for ($x = $map['width'] - 1; $x >= 0; --$x) + { + for ($y = $map['height'] - 1; $y >= 0; --$y) + { + if ($map['data'][$letter][$y][$x]) + { + $plane[$y + $plane_offset_y + (($c & 1) ? 1 : -1)][$x + $plane_offset_x] = true; + } + } + } + $plane_offset_x += 11; + } + + // calculate our first buffer, we can't actually draw polys with these yet + // img_pos_prev == screen x,y location to our immediate left. + // img_pos_cur == current screen x,y location + // we calculate screen position of our + // current cell based on the difference from the previous cell + // rather than recalculating from absolute coordinates + // What we cache into the $img_buffer contains the raised text coordinates. + $img_pos_prev = $img_buffer[0][0] = array($box['upper_left']['x'], $box['upper_left']['y']); + $cur_height = $prev_height = $this->wave_height(0, 0, $subdivision_factor); + $full_x = $plane_x * $subdivision_factor; + $full_y = $plane_y * $subdivision_factor; + + for ($x = 1; $x <= $full_x; ++$x) + { + $cur_height = $this->wave_height($x, 0, $subdivision_factor); + $offset = $cur_height - $prev_height; + $img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset); + + $img_buffer[0][$x] = $img_pos_cur; + $img_pos_prev = $img_pos_cur; + $prev_height = $cur_height; + } + + for ($y = 1; $y <= $full_y; ++$y) + { + // swap buffers + $buffer_cur = $y & 1; + $buffer_prev = 1 - $buffer_cur; + + $prev_height = $this->wave_height(0, $y, $subdivision_factor); + $offset = $prev_height - $this->wave_height(0, $y - 1, $subdivision_factor); + $img_pos_cur = array($img_buffer[$buffer_prev][0][0] + $dyx, min($img_buffer[$buffer_prev][0][1] + $dyy + $offset, $img_y - 1)); + + // make sure we don't try to write off the page + $img_pos_prev = $img_pos_cur; + + $img_buffer[$buffer_cur][0] = $img_pos_cur; + + for ($x = 1; $x <= $full_x; ++$x) + { + $cur_height = $this->wave_height($x, $y, $subdivision_factor) + $this->grid_height($x, $y, 1, $x_grid, $y_grid); + + // height is a z-factor, not a y-factor + $offset = $cur_height - $prev_height; + $img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset); + + // height is float, index it to an int, get closest color + $color = $colors[intval($cur_height)]; + $img_pos_prev = $img_pos_cur; + $prev_height = $cur_height; + + $y_index_old = intval(($y - 1) / $subdivision_factor); + $y_index_new = intval($y / $subdivision_factor); + $x_index_old = intval(($x - 1) / $subdivision_factor); + $x_index_new = intval($x / $subdivision_factor); + + if (!empty($plane[$y_index_new][$x_index_new])) + { + $img_pos_cur[1] += $this->wave_height($x, $y, $subdivision_factor, 1) - 30 - $cur_height; + $color = $colors[20]; + } + $img_pos_cur[1] = min($img_pos_cur[1], $img_y - 1); + $img_buffer[$buffer_cur][$x] = $img_pos_cur; + + // Smooth the edges as much as possible by having not more than one low<->high traingle per square + // Otherwise, just + $diag_down = (empty($plane[$y_index_old][$x_index_old]) == empty($plane[$y_index_new][$x_index_new])); + $diag_up = (empty($plane[$y_index_old][$x_index_new]) == empty($plane[$y_index_new][$x_index_old])); + + // natural switching + $mode = ($x + $y) & 1; + + // override if it requires it + if ($diag_down != $diag_up) + { + $mode = $diag_up; + } + + if ($mode) + { + // +-/ / + // 1 |/ 2 /| + // / /-+ + $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x]); + $poly2 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_cur][$x], $img_buffer[$buffer_prev][$x]); + } + else + { + // \ \-+ + // 1 |\ 2 \| + // +-\ \ + $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_cur][$x]); + $poly2 = array_merge($img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x], $img_buffer[$buffer_cur][$x]); + } + + imagefilledpolygon($img, $poly1, 3, $color); + imagefilledpolygon($img, $poly2, 3, $color); + } + } + + // Output image + header('Content-Type: image/png'); + header('Cache-control: no-cache, no-store'); + //$mtime = explode(' ', microtime()); + //$totaltime = $mtime[0] + $mtime[1] - $starttime; + + //echo $totaltime . "
      \n"; + //echo memory_get_usage() - $tmp; + imagepng($img); + imagedestroy($img); + } + + function wave_height($x, $y, $factor = 1, $tweak = 0.7) + { + // stretch the wave. TODO: pretty it up + $x = $x/5 + 180; + $y = $y/4; + return ((sin($x / (3 * $factor)) + sin($y / (3 * $factor))) * 10 * $tweak); + } + + function grid_height($x, $y, $factor = 1, $x_grid, $y_grid) + { + return ((!($x % ($x_grid * $factor)) || !($y % ($y_grid * $factor))) ? 3 : 0); + } + + function captcha_bitmaps() + { + return array( + 'width' => 9, + 'height' => 13, + 'data' => array( + 'A' => array( + array(0,0,1,1,1,1,0,0,0), + array(0,1,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'B' => array( + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'C' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'D' => array( + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'E' => array( + array(0,0,1,1,1,1,1,1,1), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'F' => array( + array(0,0,1,1,1,1,1,1,0), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'G' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'H' => array( + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'I' => array( + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'J' => array( + array(0,0,0,0,0,0,1,1,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,1,0), + array(0,0,0,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'K' => array( + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,1,0,0,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'L' => array( + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'M' => array( + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'N' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,1,0,0,0,0,0,0,1), + array(1,0,1,0,0,0,0,0,1), + array(1,0,0,1,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,0,1,0,0,1), + array(1,0,0,0,0,0,1,0,1), + array(1,0,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'O' => array( + array(0,0,0,1,1,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,1,1,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'P' => array( + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'Q' => array( + array(0,0,1,1,1,1,0,0,0), + array(0,1,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,1,0,0,1,0), + array(1,0,0,0,0,1,0,1,0), + array(0,1,0,0,0,0,1,0,0), + array(0,0,1,1,1,1,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'R' => array( + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'S' => array( + array(0,0,1,1,1,1,1,1,1), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'T' => array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'U' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'V' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'W' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'X' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'Y' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'Z' => array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '1' => array( + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,0,0,0,0), + array(0,0,1,0,1,0,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '2' => array( + array(0,0,0,1,1,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,0), + ), + '3' => array( + array(0,0,0,1,1,1,1,0,0), + array(0,0,1,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,1,0), + array(0,0,0,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '4' => array( + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,1,0), + array(0,0,0,0,0,1,0,1,0), + array(0,0,0,0,1,0,0,1,0), + array(0,0,0,1,0,0,0,1,0), + array(0,0,1,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '5' => array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '6' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,1,1,1,1,0,0), + array(1,0,1,0,0,0,0,1,0), + array(1,1,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '7' => array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '8' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '9' => array( + array(0,0,0,1,1,1,1,0,0), + array(0,0,1,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,1), + array(0,0,1,1,1,1,1,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,1,0), + array(0,0,0,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + ) + ); + } +} + ?> \ No newline at end of file From cd1c5de3a508ec851b11baf4095449c66ee6c770 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 4 Jun 2009 15:37:53 +0000 Subject: [PATCH 018/607] Finished I hope, appropriate errors when modules are missing. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9540 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acm/acm_apc.php | 2 ++ phpBB/includes/acm/acm_eaccelerator.php | 2 ++ phpBB/includes/acm/acm_memcache.php | 17 +++++++---------- phpBB/includes/acm/acm_memory.php | 7 +++++++ phpBB/includes/acm/acm_xcache.php | 2 ++ 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/acm/acm_apc.php b/phpBB/includes/acm/acm_apc.php index cbda86bec0..14159f6826 100644 --- a/phpBB/includes/acm/acm_apc.php +++ b/phpBB/includes/acm/acm_apc.php @@ -28,6 +28,8 @@ if (!class_exists('acm_memory')) */ class acm extends acm_memory { + var $extension = 'apc'; + function acm() { // Call the parent constructor diff --git a/phpBB/includes/acm/acm_eaccelerator.php b/phpBB/includes/acm/acm_eaccelerator.php index 3697fb5202..bce6c53f1c 100644 --- a/phpBB/includes/acm/acm_eaccelerator.php +++ b/phpBB/includes/acm/acm_eaccelerator.php @@ -29,6 +29,8 @@ if (!class_exists('acm_memory')) */ class acm extends acm_memory { + var $extension = 'eaccelerator'; + var $serialize_header = '#phpbb-serialized#'; function acm() diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php index 1ec37f1b3b..0544d23996 100644 --- a/phpBB/includes/acm/acm_memcache.php +++ b/phpBB/includes/acm/acm_memcache.php @@ -16,16 +16,6 @@ if (!defined('IN_PHPBB')) exit; } -if (!extension_loaded('memcache') || !defined('PHPBB_ACM_MEMCACHE_HOST')) -{ - // Memcached will not work, include the null ACM at least the - // board will still work. - // @todo Could change this for a simple error though. - require("${phpbb_root_path}includes/acm/acm_null.$phpEx"); - - return; -} - // Include the abstract base if (!class_exists('acm_memory')) { @@ -48,6 +38,8 @@ if (!defined('PHPBB_ACM_MEMCACHE_COMPRESS')) */ class acm extends acm_memory { + var $extension = 'memcache'; + var $memcache; var $flags = 0; @@ -56,6 +48,11 @@ class acm extends acm_memory // Call the parent constructor parent::acm_memory(); + if (!defined('PHPBB_ACM_MEMCACHE_HOST')) + { + trigger_error('Missing required constant [PHPBB_ACM_MEMCACHE_HOST] for memcache ACM module.', E_USER_ERROR); + } + $this->memcache = new Memcache; $this->memcache->connect(PHPBB_ACM_MEMCACHE_HOST, PHPBB_ACM_MEMCACHE_PORT); $this->flags = (PHPBB_ACM_MEMCACHE_COMPRESS) ? MEMCACHE_COMPRESSED : 0; diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index a97f680d1e..85e7a7b9d7 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -37,6 +37,13 @@ class acm_memory global $phpbb_root_path; $this->cache_dir = $phpbb_root_path . 'cache/'; + + if (!isset($this->extension) || !extension_loaded($this->extension)) + { + global $acm_type; + + trigger_error("Could not find required extension [{$this->extension}] for the ACM module $acm_type.", E_USER_ERROR); + } } /** diff --git a/phpBB/includes/acm/acm_xcache.php b/phpBB/includes/acm/acm_xcache.php index 36a32c167e..5b4ecd68d8 100644 --- a/phpBB/includes/acm/acm_xcache.php +++ b/phpBB/includes/acm/acm_xcache.php @@ -28,6 +28,8 @@ if (!class_exists('acm_memory')) */ class acm extends acm_memory { + var $extension = 'xcache'; + function acm() { // Call the parent constructor From 832c6b2f62917b0c456c7a9f33f40d2ebeb75387 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 4 Jun 2009 15:59:42 +0000 Subject: [PATCH 019/607] Use unique per board cache keys per [1] important when using shared memory from opcode caches with multiple boards on one server. [1] http://area51.phpbb.com/phpBB/viewtopic.php?p=201739#p201739 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9541 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acm/acm_apc.php | 6 +++--- phpBB/includes/acm/acm_eaccelerator.php | 7 ++++--- phpBB/includes/acm/acm_memcache.php | 6 +++--- phpBB/includes/acm/acm_memory.php | 7 +++++-- phpBB/includes/acm/acm_xcache.php | 8 ++++---- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/phpBB/includes/acm/acm_apc.php b/phpBB/includes/acm/acm_apc.php index 14159f6826..ff24dfa0d8 100644 --- a/phpBB/includes/acm/acm_apc.php +++ b/phpBB/includes/acm/acm_apc.php @@ -57,7 +57,7 @@ class acm extends acm_memory */ function _read($var) { - return apc_fetch($var); + return apc_fetch($this->key_prefix . $var); } /** @@ -71,7 +71,7 @@ class acm extends acm_memory */ function _write($var, $data, $ttl = 2592000) { - return apc_store($var, $data, $ttl); + return apc_store($this->key_prefix . $var, $data, $ttl); } /** @@ -83,7 +83,7 @@ class acm extends acm_memory */ function _delete($var) { - return apc_delete($var); + return apc_delete($this->key_prefix . $var); } } diff --git a/phpBB/includes/acm/acm_eaccelerator.php b/phpBB/includes/acm/acm_eaccelerator.php index bce6c53f1c..7530043e83 100644 --- a/phpBB/includes/acm/acm_eaccelerator.php +++ b/phpBB/includes/acm/acm_eaccelerator.php @@ -49,6 +49,7 @@ class acm extends acm_memory foreach (eaccelerator_list_keys() as $var) { // @todo Check why the substr() + // @todo Only unset vars matching $this->key_prefix eaccelerator_rm(substr($var['name'], 1)); } @@ -76,7 +77,7 @@ class acm extends acm_memory */ function _read($var) { - $result = eaccelerator_get($var); + $result = eaccelerator_get($this->key_prefix . $var); if ($result === null) { @@ -106,7 +107,7 @@ class acm extends acm_memory // Serialize objects and make them easy to detect $data = (is_object($data)) ? $this->serialize_header . serialize($data) : $data; - return eaccelerator_put($var, $data, $ttl); + return eaccelerator_put($this->key_prefix . $var, $data, $ttl); } /** @@ -118,7 +119,7 @@ class acm extends acm_memory */ function _delete($var) { - return eaccelerator_rm($var); + return eaccelerator_rm($this->key_prefix . $var); } } diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php index 0544d23996..b22205578e 100644 --- a/phpBB/includes/acm/acm_memcache.php +++ b/phpBB/includes/acm/acm_memcache.php @@ -91,7 +91,7 @@ class acm extends acm_memory */ function _read($var) { - return $this->memcache->get($var); + return $this->memcache->get($this->key_prefix . $var); } /** @@ -105,7 +105,7 @@ class acm extends acm_memory */ function _write($var, $data, $ttl = 2592000) { - return $this->memcache->set($var, $data, $this->flags, $ttl); + return $this->memcache->set($this->key_prefix . $var, $data, $this->flags, $ttl); } /** @@ -117,7 +117,7 @@ class acm extends acm_memory */ function _delete($var) { - return $this->memcache->delete($var); + return $this->memcache->delete($this->key_prefix . $var); } } diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index 85e7a7b9d7..c7b5d34a47 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -22,6 +22,8 @@ if (!defined('IN_PHPBB')) */ class acm_memory { + var $key_prefix; + var $vars = array(); var $is_modified = false; @@ -34,9 +36,10 @@ class acm_memory */ function acm_memory() { - global $phpbb_root_path; + global $phpbb_root_path, $dbname, $table_prefix; - $this->cache_dir = $phpbb_root_path . 'cache/'; + $this->cache_dir = $phpbb_root_path . 'cache/'; + $this->key_prefix = md5($dbname, $table_prefix) . '_'; if (!isset($this->extension) || !extension_loaded($this->extension)) { diff --git a/phpBB/includes/acm/acm_xcache.php b/phpBB/includes/acm/acm_xcache.php index 5b4ecd68d8..9cb8eae272 100644 --- a/phpBB/includes/acm/acm_xcache.php +++ b/phpBB/includes/acm/acm_xcache.php @@ -62,7 +62,7 @@ class acm extends acm_memory */ function _read($var) { - return xcache_get($var); + return xcache_get($this->key_prefix . $var); } /** @@ -76,7 +76,7 @@ class acm extends acm_memory */ function _write($var, $data, $ttl = 2592000) { - return xcache_set($var, $data, $ttl); + return xcache_set($this->key_prefix . $var, $data, $ttl); } /** @@ -88,7 +88,7 @@ class acm extends acm_memory */ function _delete($var) { - return xcache_unset($var); + return xcache_unset($this->key_prefix . $var); } /** @@ -101,7 +101,7 @@ class acm extends acm_memory function _isset($var) { // Most caches don't need to check - return xcache_isset($var); + return xcache_isset($this->key_prefix . $var); } } From 9961ea9c2ab89923f6af8ba3b0e78d7dc30f7b0b Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 5 Jun 2009 11:22:43 +0000 Subject: [PATCH 020/607] adjust authors file to reflect current state. ;) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9542 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/AUTHORS | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/AUTHORS b/phpBB/docs/AUTHORS index 49281e2297..b471a3846c 100644 --- a/phpBB/docs/AUTHORS +++ b/phpBB/docs/AUTHORS @@ -27,8 +27,8 @@ phpBB Developers : APTX (Marek A. R.) dhn (Dominik Drscher) kellanved (Henry Sudhof) naderman (Nils Adermann) + Terrafrost (Jim Wigginton) ToonArmy (Chris Smith) - Vic D'Elfant (Vic D'Elfant) -- Previous Contributors -- @@ -38,9 +38,10 @@ phpBB Project Manager : theFinn (James Atkinson) [Founder - 04/2007] phpBB Lead Developer : psoTFX (Paul S. Owen) [2001 - 09/2005] -phpBB Developers : Ashe (Ludovic Arnaud) [10/2002 - 11/2003, 06/2006 - 10/2006] - BartVB (Bart van Bragt) [11/2000 - 03/2006] - GrahamJE (Graham Eames) [09/2005 - 11/2006] +phpBB Developers : Ashe (Ludovic Arnaud) [10/2002 - 11/2003, 06/2006 - 10/2006] + BartVB (Bart van Bragt) [11/2000 - 03/2006] + GrahamJE (Graham Eames) [09/2005 - 11/2006] + Vic D'Elfant (Vic D'Elfant) [04/2007 - 04/2009] -- Copyrights -- From a7c7f6a6a80f99dfd6443d5bd905987361812318 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 5 Jun 2009 14:51:17 +0000 Subject: [PATCH 021/607] Here we go! New data format for the file ACM module: - No longer PHP files that are included - Contain a simple PHP header to stop people attempting to read them - Read using file system functions only reading as much data as required Result is: - Better performance by minimising file system reads - Injected HTML from nasty scripts no longer contaminates the board - Opcode caches are no longer thrashed and fragmented by the many files we generate git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9543 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acm/acm_file.php | 423 +++++++++++++++++++++++--------- 2 files changed, 310 insertions(+), 114 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6df3240e01..1991f77b45 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -91,6 +91,7 @@
    30. [Fix] Allow whitespaces in avatar gallery names. (Bug #44955)
    31. [Fix] Sorting by author or subject on viewtopic now preserves the order. (Bug #44875)
    32. [Fix] Correctly determine writable status of files on Windows operating system. (Bug #39035)
    33. +
    34. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    35. [Feature] Backported 3.2 captcha plugins.
    36. [Feature] Introduced new ACM plugins:
        diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index f9ff92e19d..234be5c5d1 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -3,7 +3,7 @@ * * @package acm * @version $Id$ -* @copyright (c) 2005 phpBB Group +* @copyright (c) 2005, 2009 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ @@ -44,17 +44,7 @@ class acm */ function load() { - global $phpEx; - if (file_exists($this->cache_dir . 'data_global.' . $phpEx)) - { - @include($this->cache_dir . 'data_global.' . $phpEx); - } - else - { - return false; - } - - return true; + return $this->_read('data_global'); } /** @@ -86,22 +76,7 @@ class acm global $phpEx; - if ($fp = @fopen($this->cache_dir . 'data_global.' . $phpEx, 'wb')) - { - @flock($fp, LOCK_EX); - fwrite($fp, "vars = " . var_export($this->vars, true) . ";\n\n\$this->var_expires = " . var_export($this->var_expires, true) . "\n?>"); - @flock($fp, LOCK_UN); - fclose($fp); - - if (!function_exists('phpbb_chmod')) - { - global $phpbb_root_path; - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } - - phpbb_chmod($this->cache_dir . 'data_global.' . $phpEx, CHMOD_READ | CHMOD_WRITE); - } - else + if (!$this->_write('data_global')) { // Now, this occurred how often? ... phew, just tell the user then... if (!@is_writable($this->cache_dir)) @@ -132,6 +107,8 @@ class acm return; } + $time = time(); + while (($entry = readdir($dir)) !== false) { if (!preg_match('/^(sql_|data_(?!global))/', $entry)) @@ -139,9 +116,20 @@ class acm continue; } - $expired = true; - @include($this->cache_dir . $entry); - if ($expired) + if (!($handle = @fopen($this->cache_dir . $entry, 'rb'))) + { + continue; + } + + // Skip the PHP header + fgets($handle); + + // Skip expiration + $expires = (int) fgets($handle); + + fclose($handle); + + if ($time >= $expires) { $this->remove_file($this->cache_dir . $entry); } @@ -157,7 +145,7 @@ class acm foreach ($this->var_expires as $var_name => $expires) { - if (time() > $expires) + if ($time >= $expires) { $this->destroy($var_name); } @@ -181,8 +169,7 @@ class acm return false; } - @include($this->cache_dir . "data{$var_name}.$phpEx"); - return (isset($data)) ? $data : false; + return $this->_read('data' . $var_name); } else { @@ -197,23 +184,7 @@ class acm { if ($var_name[0] == '_') { - global $phpEx; - - if ($fp = @fopen($this->cache_dir . "data{$var_name}.$phpEx", 'wb')) - { - @flock($fp, LOCK_EX); - fwrite($fp, " " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\n\$data = " . (sizeof($var) ? "unserialize(" . var_export(serialize($var), true) . ");" : 'array();') . "\n\n?>"); - @flock($fp, LOCK_UN); - fclose($fp); - - if (!function_exists('phpbb_chmod')) - { - global $phpbb_root_path; - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } - - phpbb_chmod($this->cache_dir . "data{$var_name}.$phpEx", CHMOD_READ | CHMOD_WRITE); - } + $this->_write('data' . $var_name, $var, time() + $ttl); } else { @@ -288,32 +259,31 @@ class acm continue; } - // The following method is more failproof than simply assuming the query is on line 3 (which it should be) - $check_line = @file_get_contents($this->cache_dir . $entry); - - if (empty($check_line)) + if (!($handle = @fopen($this->cache_dir . $entry, 'rb'))) { continue; } - // Now get the contents between /* and */ - $check_line = substr($check_line, strpos($check_line, '/* ') + 3, strpos($check_line, ' */') - strpos($check_line, '/* ') - 3); + // Skip the PHP header + fgets($handle); + + // Skip expiration + fgets($handle); + + // Grab the query, remove the LF + $query = substr(fgets($handle), 0, -1); + + fclose($handle); - $found = false; foreach ($table as $check_table) { // Better catch partial table names than no table names. ;) - if (strpos($check_line, $check_table) !== false) + if (strpos($query, $check_table) !== false) { - $found = true; + $this->remove_file($this->cache_dir . $entry); break; } } - - if ($found) - { - $this->remove_file($this->cache_dir . $entry); - } } closedir($dir); @@ -371,29 +341,16 @@ class acm */ function sql_load($query) { - global $phpEx; - // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); + + if (($rowset = $this->_read('sql_' . md5($query))) === false) + { + return false; + } + $query_id = sizeof($this->sql_rowset); - - if (!file_exists($this->cache_dir . 'sql_' . md5($query) . ".$phpEx")) - { - return false; - } - - @include($this->cache_dir . 'sql_' . md5($query) . ".$phpEx"); - - if (!isset($expired)) - { - return false; - } - else if ($expired) - { - $this->remove_file($this->cache_dir . 'sql_' . md5($query) . ".$phpEx", true); - return false; - } - + $this->sql_rowset[$query_id] = $rowset; $this->sql_row_pointer[$query_id] = 0; return $query_id; @@ -404,41 +361,23 @@ class acm */ function sql_save($query, &$query_result, $ttl) { - global $db, $phpEx; + global $db; // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - $filename = $this->cache_dir . 'sql_' . md5($query) . '.' . $phpEx; - if ($fp = @fopen($filename, 'wb')) + $query_id = sizeof($this->sql_rowset); + $this->sql_rowset[$query_id] = array(); + $this->sql_row_pointer[$query_id] = 0; + + while ($row = $db->sql_fetchrow($query_result)) { - @flock($fp, LOCK_EX); - - $query_id = sizeof($this->sql_rowset); - $this->sql_rowset[$query_id] = array(); - $this->sql_row_pointer[$query_id] = 0; - - while ($row = $db->sql_fetchrow($query_result)) - { - $this->sql_rowset[$query_id][] = $row; - } - $db->sql_freeresult($query_result); - - $file = " " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n"; - - fwrite($fp, $file . "\n\$this->sql_rowset[\$query_id] = " . (sizeof($this->sql_rowset[$query_id]) ? "unserialize(" . var_export(serialize($this->sql_rowset[$query_id]), true) . ");" : 'array();') . "\n\n?>"); - @flock($fp, LOCK_UN); - fclose($fp); - - if (!function_exists('phpbb_chmod')) - { - global $phpbb_root_path; - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } - - phpbb_chmod($filename, CHMOD_READ | CHMOD_WRITE); + $this->sql_rowset[$query_id][] = $row; + } + $db->sql_freeresult($query_result); + if ($this->_write('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl + time(), $query)) + { $query_result = $query_id; } } @@ -507,6 +446,262 @@ class acm return true; } + /** + * Read cached data from a specified file + * + * @access private + * @param string $filename Filename to write + * @return mixed False if an error was encountered, otherwise the data type of the cached data + */ + function _read($filename) + { + global $phpEx; + + $file = "{$this->cache_dir}$filename.$phpEx"; + + $type = substr($filename, 0, strpos($filename, '_')); + + if (!file_exists($file)) + { + return false; + } + + if (!($handle = @fopen($file, 'rb'))) + { + return false; + } + + // Skip the PHP header + fgets($handle); + + if ($filename == 'data_global') + { + $this->vars = $this->var_expires = array(); + + $time = time(); + + while (($expires = (int) fgets($handle)) && !feof($handle)) + { + // Number of bytes of data + $bytes = substr(fgets($handle), 0, -1); + + if (!is_numeric($bytes) || ($bytes = (int) $bytes) === 0) + { + // We cannot process the file without a valid number of bytes + // so we discard it + fclose($handle); + + $this->vars = $this->var_expires = array(); + $this->is_modified = false; + + $this->remove_file($file); + + return false; + } + + if ($time >= $expires) + { + fseek($handle, $bytes, SEEK_CUR); + + continue; + } + + $var_name = substr(fgets($handle), 0, -1); + + // Read the length of bytes that consists of data. + $data = fread($handle, $bytes - strlen($var_name)); + $data = @unserialize($data); + + // Don't use the data if it was invalid + if ($data !== false) + { + $this->vars[$var_name] = $data; + $this->var_expires[$var_name] = $expires; + } + + // Absorb the LF + fgets($handle); + } + + fclose($handle); + + $this->is_modified = false; + + return true; + } + else + { + $data = false; + $line = 0; + + while (($buffer = fgets($handle)) && !feof($handle)) + { + $buffer = substr($buffer, 0, -1); // Remove the LF + + // $buffer is only used to read integers + // if it is non numeric we have an invalid + // cache file, which we will now remove. + if (!is_numeric($buffer)) + { + break; + } + + if ($line == 0) + { + $expires = (int) $buffer; + + if (time() >= $expires) + { + break; + } + + if ($type == 'sql') + { + // Skip the query + fgets($handle); + } + } + else if ($line == 1) + { + $bytes = (int) $buffer; + + // Never should have 0 bytes + if (!$bytes) + { + break; + } + + // Grab the serialized data + $data = fread($handle, $bytes); + + // Read 1 byte, to trigger EOF + fread($handle, 1); + + if (!feof($handle)) + { + // Somebody tampered with our data + $data = false; + } + break; + } + else + { + // Something went wrong + break; + } + $line++; + } + fclose($handle); + + // unserialize if we got some data + $data = ($data !== false) ? @unserialize($data) : $data; + + if ($data === false) + { + $this->remove_file($file); + return false; + } + + return $data; + } + } + + /** + * Write cache data to a specified file + * + * 'data_global' is a special case and the generated format is different for this file: + * + * + * (expiration) + * (length of var and serialised data) + * (var) + * (serialised data) + * ... (repeat) + * + * + * The other files have a similar format: + * + * + * (expiration) + * (query) [SQL files only] + * (length of serialised data) + * (serialised data) + * + * + * @access private + * @param string $filename Filename to write + * @param mixed $data Data to store + * @param int $expires Timestamp when the data expires + * @param string $query Query when caching SQL queries + * @return bool True if the file was successfully created, otherwise false + */ + function _write($filename, $data = null, $expires = 0, $query = '') + { + global $phpEx; + + $file = "{$this->cache_dir}$filename.$phpEx"; + + if ($handle = @fopen($file, 'wb')) + { + @flock($handle, LOCK_EX); + + // File header + fwrite($handle, '<' . '?php exit; ?' . '>'); + + if ($filename == 'data_global') + { + // Global data is a different format + foreach ($this->vars as $var => $data) + { + if (strpos($var, "\r") !== false || strpos($var, "\n") !== false) + { + // CR/LF would cause fgets() to read the cache file incorrectly + // do not cache test entries, they probably won't be read back + // the cache keys should really be alphanumeric with a few symbols. + continue; + } + $data = serialize($data); + + // Write out the expiration time + fwrite($handle, "\n" . $this->var_expires[$var] . "\n"); + + // Length of the remaining data for this var (ignoring two LF's) + fwrite($handle, strlen($data . $var) . "\n"); + fwrite($handle, $var . "\n"); + fwrite($handle, $data); + } + } + else + { + fwrite($handle, "\n" . $expires . "\n"); + + if (strpos($filename, 'sql_') === 0) + { + fwrite($handle, $query . "\n"); + } + $data = serialize($data); + + fwrite($handle, strlen($data) . "\n"); + fwrite($handle, $data); + } + + @flock($handle, LOCK_UN); + fclose($handle); + + if (!function_exists('phpbb_chmod')) + { + global $phpbb_root_path; + include($phpbb_root_path . 'includes/functions.' . $phpEx); + } + + phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE); + + return true; + } + + return false; + } + /** * Removes/unlinks file */ From 9c00496ff5f5d940d34692c4800e209887d7e9fa Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 5 Jun 2009 15:40:56 +0000 Subject: [PATCH 022/607] Fix a small bug with xcache (thanks bantu), and some code consistency changes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9544 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acm/acm_apc.php | 8 +------- phpBB/includes/acm/acm_eaccelerator.php | 8 +------- phpBB/includes/acm/acm_memcache.php | 2 +- phpBB/includes/acm/acm_xcache.php | 13 ++++--------- 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/phpBB/includes/acm/acm_apc.php b/phpBB/includes/acm/acm_apc.php index ff24dfa0d8..1a487f94ad 100644 --- a/phpBB/includes/acm/acm_apc.php +++ b/phpBB/includes/acm/acm_apc.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) // Include the abstract base if (!class_exists('acm_memory')) { - require("${phpbb_root_path}includes/acm/acm_memory.$phpEx"); + require("{$phpbb_root_path}includes/acm/acm_memory.$phpEx"); } /** @@ -30,12 +30,6 @@ class acm extends acm_memory { var $extension = 'apc'; - function acm() - { - // Call the parent constructor - parent::acm_memory(); - } - /** * Purge cache data * diff --git a/phpBB/includes/acm/acm_eaccelerator.php b/phpBB/includes/acm/acm_eaccelerator.php index 7530043e83..1a3cf3c0f7 100644 --- a/phpBB/includes/acm/acm_eaccelerator.php +++ b/phpBB/includes/acm/acm_eaccelerator.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) // Include the abstract base if (!class_exists('acm_memory')) { - require("${phpbb_root_path}includes/acm/acm_memory.$phpEx"); + require("{$phpbb_root_path}includes/acm/acm_memory.$phpEx"); } /** @@ -33,12 +33,6 @@ class acm extends acm_memory var $serialize_header = '#phpbb-serialized#'; - function acm() - { - // Call the parent constructor - parent::acm_memory(); - } - /** * Purge cache data * diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php index b22205578e..5a34a2a51d 100644 --- a/phpBB/includes/acm/acm_memcache.php +++ b/phpBB/includes/acm/acm_memcache.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) // Include the abstract base if (!class_exists('acm_memory')) { - require("${phpbb_root_path}includes/acm/acm_memory.$phpEx"); + require("{$phpbb_root_path}includes/acm/acm_memory.$phpEx"); } if (!defined('PHPBB_ACM_MEMCACHE_PORT')) diff --git a/phpBB/includes/acm/acm_xcache.php b/phpBB/includes/acm/acm_xcache.php index 9cb8eae272..ad527b8220 100644 --- a/phpBB/includes/acm/acm_xcache.php +++ b/phpBB/includes/acm/acm_xcache.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) // Include the abstract base if (!class_exists('acm_memory')) { - require("${phpbb_root_path}includes/acm/acm_memory.$phpEx"); + require("{$phpbb_root_path}includes/acm/acm_memory.$phpEx"); } /** @@ -30,12 +30,6 @@ class acm extends acm_memory { var $extension = 'xcache'; - function acm() - { - // Call the parent constructor - parent::acm_memory(); - } - /** * Purge cache data * @@ -62,7 +56,9 @@ class acm extends acm_memory */ function _read($var) { - return xcache_get($this->key_prefix . $var); + $result = xcache_get($this->key_prefix . $var); + + return ($result !== null) ? $result : false; } /** @@ -100,7 +96,6 @@ class acm extends acm_memory */ function _isset($var) { - // Most caches don't need to check return xcache_isset($this->key_prefix . $var); } } From f9c6ced06476d1ef612d06f1e2249d23284b6aff Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 5 Jun 2009 23:00:53 +0000 Subject: [PATCH 023/607] Fixed bug #45695 - Guests can't report posts in prosilver Authorised by: naderman git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9545 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/viewtopic_body.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 1991f77b45..8fdbf83b4d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -91,6 +91,7 @@
      • [Fix] Allow whitespaces in avatar gallery names. (Bug #44955)
      • [Fix] Sorting by author or subject on viewtopic now preserves the order. (Bug #44875)
      • [Fix] Correctly determine writable status of files on Windows operating system. (Bug #39035)
      • +
      • [Fix] Show report button in prosilver for guests who are allowed to report posts. (Bug #45695 - Patch by bantu)
      • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
      • [Feature] Backported 3.2 captcha plugins.
      • [Feature] Introduced new ACM plugins: diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 17088bb16a..de59578c6b 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -123,7 +123,7 @@ - +
        • {L_EDIT_POST}
        • {L_DELETE_POST}
        • From e63b76b22af4ef2d67abb4799a225e0ce38787cf Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 6 Jun 2009 22:07:59 +0000 Subject: [PATCH 029/607] copy of Zend's base Exception file, needs to be updated manually :/ git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9551 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/Zend/Exception.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 phpBB/includes/Zend/Exception.php diff --git a/phpBB/includes/Zend/Exception.php b/phpBB/includes/Zend/Exception.php new file mode 100644 index 0000000000..599d8a033e --- /dev/null +++ b/phpBB/includes/Zend/Exception.php @@ -0,0 +1,30 @@ + Date: Sat, 6 Jun 2009 23:20:10 +0000 Subject: [PATCH 030/607] - Class loaders for both frameworks: eZComponents through a loader object Zend Framework with an autoload function Example usage: require("{$phpbb_root_path}includes/ezcomponents/loader.$phpEx"); require("{$phpbb_root_path}includes/Zend/loader.$phpEx"); $loader = new phpbb_ezcomponents_loader(); $loader->load_component('search'); $handler = new ezcSearchZendLuceneHandler( '/tmp/lucene' ); git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9552 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/Zend/loader.php | 58 ++++++++++++++++++++ phpBB/includes/ezcomponents/loader.php | 73 ++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 phpBB/includes/Zend/loader.php create mode 100644 phpBB/includes/ezcomponents/loader.php diff --git a/phpBB/includes/Zend/loader.php b/phpBB/includes/Zend/loader.php new file mode 100644 index 0000000000..99a5543901 --- /dev/null +++ b/phpBB/includes/Zend/loader.php @@ -0,0 +1,58 @@ += 5.2.4 and spl_autoload_register() required', E_USER_ERROR); +} + +/** +* Autoload function for Zend framework classes +*/ +function phpbb_zend_autoload($class_name) +{ + global $phpbb_root_path; + + if (strpos($class_name, '_') !== false) + { + $path = str_replace('_', '/', $class_name) . '.php'; + require("{$phpbb_root_path}includes/" . $path); + return true; + } +} + +/** +* @ignore +*/ +// make sure Zend is in the include path +ini_set( 'include_path', ini_get( 'include_path' ) . PATH_SEPARATOR . $phpbb_root_path . 'includes' ); + +// check whether a regular autoload function already exists, so we can load it into the spl stack afterwards +$register_autoload = false; +if (function_exists('__autoload')) +{ + $register_autoload = true; +} + +spl_autoload_register('phpbb_zend_autoload'); + +// load the old autoload function into the spl stack if necessary +if ($register_autoload) +{ + spl_autoload_register('__autoload'); +} \ No newline at end of file diff --git a/phpBB/includes/ezcomponents/loader.php b/phpBB/includes/ezcomponents/loader.php new file mode 100644 index 0000000000..62aaa7667d --- /dev/null +++ b/phpBB/includes/ezcomponents/loader.php @@ -0,0 +1,73 @@ +loaded = array(); + if (version_compare(PHP_VERSION, '5.2.1', '<')) + { + trigger_error('PHP >= 5.2.1 required', E_USER_ERROR); + } + } + + /** + * Loads all classes of a particular component. + * The base component is always loaded first. + * + * @param $component string Lower case component name + */ + function load_component($component) + { + global $phpbb_root_path; + + // don't allow loading the same component twice + if (isset($this->loaded[$component]) && $this->loaded[$component]) + { + return; + } + + // make sure base is always loaded first + if ($component != 'base' && !isset($this->loaded['base'])) + { + $this->load_component('base'); + } + + $ezc_path = $phpbb_root_path . 'includes/ezcomponents/'; + + // retrieve the autoload list + $classes = include($ezc_path . ucfirst($component) . '/' . $component . '_autoload.php'); + + // include all files related to this component + foreach ($classes as $class => $path) + { + include($ezc_path . $path); + } + } +} \ No newline at end of file From a539fca62b10f53a5f5dadf07f9ab07340fdabf9 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 7 Jun 2009 11:34:01 +0000 Subject: [PATCH 031/607] some corrections, only very minor things. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9554 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acm/acm_memcache.php | 10 +- phpBB/includes/acm/acm_memory.php | 4 +- phpBB/includes/acm/acm_null.php | 7 - phpBB/includes/acp/acp_captcha.php | 29 ++-- phpBB/includes/auth/auth_db.php | 10 +- phpBB/includes/captcha/captcha_factory.php | 25 ++-- phpBB/includes/captcha/captcha_gd_wave.php | 47 +++--- .../captcha/plugins/captcha_abstract.php | 139 +++++++++-------- .../plugins/phpbb_captcha_gd_plugin.php | 16 +- .../plugins/phpbb_captcha_gd_wave_plugin.php | 5 +- .../plugins/phpbb_captcha_nogd_plugin.php | 21 +-- .../plugins/phpbb_recaptcha_plugin.php | 140 +++++++++--------- phpBB/includes/functions.php | 24 ++- phpBB/includes/functions_user.php | 4 +- phpBB/includes/session.php | 3 +- phpBB/includes/ucp/ucp_register.php | 23 +-- phpBB/install/database_update.php | 7 +- phpBB/language/en/acp/board.php | 2 +- phpBB/posting.php | 5 +- 19 files changed, 264 insertions(+), 257 deletions(-) diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php index 5a34a2a51d..3077ee9615 100644 --- a/phpBB/includes/acm/acm_memcache.php +++ b/phpBB/includes/acm/acm_memcache.php @@ -32,6 +32,11 @@ if (!defined('PHPBB_ACM_MEMCACHE_COMPRESS')) define('PHPBB_ACM_MEMCACHE_COMPRESS', false); } +if (!defined('PHPBB_ACM_MEMCACHE_HOST')) +{ + define('PHPBB_ACM_MEMCACHE_HOST', 'localhost'); +} + /** * ACM for Memcached * @package acm @@ -48,11 +53,6 @@ class acm extends acm_memory // Call the parent constructor parent::acm_memory(); - if (!defined('PHPBB_ACM_MEMCACHE_HOST')) - { - trigger_error('Missing required constant [PHPBB_ACM_MEMCACHE_HOST] for memcache ACM module.', E_USER_ERROR); - } - $this->memcache = new Memcache; $this->memcache->connect(PHPBB_ACM_MEMCACHE_HOST, PHPBB_ACM_MEMCACHE_PORT); $this->flags = (PHPBB_ACM_MEMCACHE_COMPRESS) ? MEMCACHE_COMPRESSED : 0; diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index c7b5d34a47..fd9b9ff342 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -156,7 +156,7 @@ class acm_memory while (($entry = readdir($dir)) !== false) { - if (strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0) + if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0) { continue; } @@ -415,7 +415,7 @@ class acm_memory * @access protected * @param string $var Cache key * @return bool True if it exists, otherwise false - */ + */ function _isset($var) { // Most caches don't need to check diff --git a/phpBB/includes/acm/acm_null.php b/phpBB/includes/acm/acm_null.php index c2363b9ddf..fca67115a7 100644 --- a/phpBB/includes/acm/acm_null.php +++ b/phpBB/includes/acm/acm_null.php @@ -27,7 +27,6 @@ class acm */ function acm() { - } /** @@ -43,7 +42,6 @@ class acm */ function unload() { - } /** @@ -51,7 +49,6 @@ class acm */ function save() { - } /** @@ -76,7 +73,6 @@ class acm */ function put($var_name, $var, $ttl = 0) { - } /** @@ -84,7 +80,6 @@ class acm */ function purge() { - } /** @@ -92,7 +87,6 @@ class acm */ function destroy($var_name, $table = '') { - } /** @@ -116,7 +110,6 @@ class acm */ function sql_save($query, &$query_result, $ttl) { - } /** diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index ed2ccf6ccc..7c7a5acc9f 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -10,8 +10,6 @@ /** * @ignore */ - - if (!defined('IN_PHPBB')) { exit; @@ -35,13 +33,13 @@ class acp_captcha $selected = request_var('select_captcha', $config['captcha_plugin']); $configure = request_var('configure', false); - + // Oh, they are just here for the view if (isset($_GET['captcha_demo'])) { $this->deliver_demo($selected); } - + // Delegate if ($configure) { @@ -52,6 +50,7 @@ class acp_captcha else { $captchas = phpbb_captcha_factory::get_captcha_types(); + $config_vars = array( 'enable_confirm' => 'REG_ENABLE', 'enable_post_confirm' => 'POST_ENABLE', @@ -68,10 +67,12 @@ class acp_captcha if ($submit && check_form_key($form_key)) { $config_vars = array_keys($config_vars); + foreach ($config_vars as $config_var) { set_config($config_var, request_var($config_var, false)); } + if ($selected !== $config['captcha_plugin']) { // sanity check @@ -79,9 +80,11 @@ class acp_captcha { $old_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); $old_captcha->uninstall(); + set_config('captcha_plugin', $selected); $new_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); - $old_captcha->install(); + $new_captcha->install(); + add_log('admin', 'LOG_CONFIG_VISUAL'); } else @@ -103,14 +106,15 @@ class acp_captcha $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : ''; $captcha_select .= ''; } + foreach ($captchas['unavailable'] as $value => $title) { $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : ''; - $captcha_select .= ''; + $captcha_select .= ''; } $demo_captcha = phpbb_captcha_factory::get_instance($selected); - + foreach ($config_vars as $config_var => $template_var) { $template->assign_var($template_var, (isset($_REQUEST[$config_var])) ? request_var($config_var, '') : $config[$config_var]) ; @@ -121,28 +125,23 @@ class acp_captcha 'CAPTCHA_SELECT' => $captcha_select, )); } - } } - - + /** * Entry point for delivering image CAPTCHAs in the ACP. */ function deliver_demo($selected) { global $db, $user, $config; - + $captcha = phpbb_captcha_factory::get_instance($selected); $captcha->init(CONFIRM_REG); $captcha->execute_demo(); + garbage_collection(); exit_handler(); } - - - - } ?> \ No newline at end of file diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php index bdafefa70b..f798264ada 100644 --- a/phpBB/includes/auth/auth_db.php +++ b/phpBB/includes/auth/auth_db.php @@ -68,7 +68,6 @@ function login_db(&$username, &$password) if ($config['max_login_attempts'] && $row['user_login_attempts'] >= $config['max_login_attempts']) { $confirm_id = request_var('confirm_id', ''); - $confirm_code = request_var('confirm_code', ''); // Visual Confirmation handling if (!$confirm_id) @@ -84,12 +83,13 @@ function login_db(&$username, &$password) $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_LOGIN); $vc_response = $captcha->validate(); + if ($vc_response) { return array( - 'status' => LOGIN_ERROR_ATTEMPTS, - 'error_msg' => 'LOGIN_ERROR_ATTEMPTS', - 'user_row' => $row, + 'status' => LOGIN_ERROR_ATTEMPTS, + 'error_msg' => 'LOGIN_ERROR_ATTEMPTS', + 'user_row' => $row, ); } } @@ -130,7 +130,7 @@ function login_db(&$username, &$password) $row['user_pass_convert'] = 0; $row['user_password'] = $hash; } - else + else { // Although we weren't able to convert this password we have to // increase login attempt count to make sure this cannot be exploited diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php index fbe615a043..b5fa69990d 100644 --- a/phpBB/includes/captcha/captcha_factory.php +++ b/phpBB/includes/captcha/captcha_factory.php @@ -16,8 +16,11 @@ if (!defined('IN_PHPBB')) exit; } - -/** A small class until we get the autoloader done */ +/** +* A small class for 3.0.x (no autoloader in 3.0.x) +* +* @package VC +*/ class phpbb_captcha_factory { /** @@ -26,7 +29,7 @@ class phpbb_captcha_factory function get_instance($name) { global $phpbb_root_path, $phpEx; - + $name = basename($name); if (!class_exists($name)) { @@ -34,7 +37,7 @@ class phpbb_captcha_factory } return call_user_func(array($name, 'get_instance')); } - + /** * Call the garbage collector */ @@ -49,18 +52,19 @@ class phpbb_captcha_factory } call_user_func(array($name, 'garbage_collect'), 0); } - + /** * return a list of all discovered CAPTCHA plugins */ function get_captcha_types() { global $phpbb_root_path, $phpEx; - - $captchas = array(); - $captchas['available'] = array(); - $captchas['unavailable'] = array(); - + + $captchas = array( + 'available' => array(), + 'unavailable' => array(), + ); + $dp = @opendir($phpbb_root_path . 'includes/captcha/plugins'); if ($dp) @@ -74,6 +78,7 @@ class phpbb_captcha_factory { include($phpbb_root_path . "includes/captcha/plugins/$file"); } + if (call_user_func(array($name, 'is_available'))) { $captchas['available'][$name] = call_user_func(array($name, 'get_name')); diff --git a/phpBB/includes/captcha/captcha_gd_wave.php b/phpBB/includes/captcha/captcha_gd_wave.php index d911d574f7..f706c98d43 100644 --- a/phpBB/includes/captcha/captcha_gd_wave.php +++ b/phpBB/includes/captcha/captcha_gd_wave.php @@ -1,16 +1,18 @@ width; $img_y = $this->height; @@ -32,7 +34,7 @@ class captcha $img = imagecreatetruecolor($img_x, $img_y); $x_grid = mt_rand(6, 10); $y_grid = mt_rand(6, 10); - + // Ok, so lets cut to the chase. We could accurately represent this in 3d and // do all the appropriate linear transforms. my questions is... why bother? // The computational overhead is unnecessary when you consider the simple fact: @@ -47,27 +49,28 @@ class captcha $plane_x = 100; $plane_y = 30; - $subdivision_factor = 3; + $subdivision_factor = 3; + // $box is the 4 points in img_space that correspond to the corners of the plane in 3-space $box = array( 'upper_left' => array( 'x' => mt_rand(5, 15), 'y' => mt_rand(10, 15) - ), + ), 'upper_right' => array( 'x' => mt_rand($img_x - 35, $img_x - 19), 'y' => mt_rand(10, 17) - ), + ), 'lower_left' => array( 'x' => mt_rand($img_x - 5, $img_x - 45), 'y' => mt_rand($img_y - 0, $img_y - 15) - ), - ); - $box['lower_right'] = array( - 'x' => $box['lower_left']['x'] + $box['upper_left']['x'] - $box['upper_right']['x'], - 'y' => $box['lower_left']['y'] + $box['upper_left']['y'] - $box['upper_right']['y'], + ), ); + $box['lower_right'] = array( + 'x' => $box['lower_left']['x'] + $box['upper_left']['x'] - $box['upper_right']['x'], + 'y' => $box['lower_left']['y'] + $box['upper_left']['y'] - $box['upper_right']['y'], + ); // TODO $background = imagecolorallocate($img, mt_rand(155, 255), mt_rand(155, 255), mt_rand(155, 255)); @@ -83,7 +86,7 @@ class captcha } $fontcolors[0] = imagecolorallocate($img, mt_rand(0, 120), mt_rand(0, 120), mt_rand(0, 120)); - + $colors = array(); $minr = mt_rand(20, 30); @@ -159,7 +162,7 @@ class captcha $cur_height = $this->wave_height($x, 0, $subdivision_factor); $offset = $cur_height - $prev_height; $img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset); - + $img_buffer[0][$x] = $img_pos_cur; $img_pos_prev = $img_pos_cur; $prev_height = $cur_height; @@ -170,7 +173,7 @@ class captcha // swap buffers $buffer_cur = $y & 1; $buffer_prev = 1 - $buffer_cur; - + $prev_height = $this->wave_height(0, $y, $subdivision_factor); $offset = $prev_height - $this->wave_height(0, $y - 1, $subdivision_factor); $img_pos_cur = array($img_buffer[$buffer_prev][0][0] + $dyx, min($img_buffer[$buffer_prev][0][1] + $dyy + $offset, $img_y - 1)); @@ -179,7 +182,7 @@ class captcha $img_pos_prev = $img_pos_cur; $img_buffer[$buffer_cur][0] = $img_pos_cur; - + for ($x = 1; $x <= $full_x; ++$x) { $cur_height = $this->wave_height($x, $y, $subdivision_factor) + $this->grid_height($x, $y, 1, $x_grid, $y_grid); @@ -496,7 +499,7 @@ class captcha array(0,0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0,0), - ), + ), 'O' => array( array(0,0,0,1,1,1,0,0,0), array(0,0,1,0,0,0,1,0,0), diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index f88d82b2a0..0666a3ca67 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -18,7 +18,9 @@ if (!defined('IN_PHPBB')) /** -* This class holds the code shared by the two default 3.0 CAPTCHAs. +* This class holds the code shared by the two default 3.0.x CAPTCHAs. +* +* @package VC */ class phpbb_default_captcha { @@ -29,18 +31,17 @@ class phpbb_default_captcha var $type; var $solved = false; - function init($type) { global $config, $db, $user; - + // read input $this->confirm_id = request_var('confirm_id', ''); $this->confirm_code = request_var('confirm_code', ''); $refresh = request_var('refresh_vc', false) && $config['confirm_refresh']; - + $this->type = (int) $type; - + if (!strlen($this->confirm_id)) { // we have no confirm ID, better get ready to display something @@ -50,24 +51,22 @@ class phpbb_default_captcha { $this->regenerate_code(); } - } - + function execute_demo() { global $user; - - $this->code = gen_rand_string(mt_rand(5, 8)); + + $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->seed = hexdec(substr(unique_id(), 4, 10)); - + // compute $seed % 0x7fffffff $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); - + $captcha = new captcha(); $captcha->execute($this->code, $this->seed); } - - + function execute() { if (empty($this->code)) @@ -81,46 +80,46 @@ class phpbb_default_captcha $captcha = new captcha(); $captcha->execute($this->code, $this->seed); } - - + function get_template() { global $config, $user, $template, $phpEx, $phpbb_root_path; - + $template->set_filenames(array( 'captcha' => 'captcha_default.html') ); - + $template->assign_vars(array( 'CONFIRM_IMAGE' => append_sid($phpbb_root_path . 'ucp.' . $phpEx . '?mode=confirm&confirm_id=' . $this->confirm_id . '&type=' . $this->type), - 'CONFIRM_ID' => $this->confirm_id, + 'CONFIRM_ID' => $this->confirm_id, 'S_REFRESH' => (bool) $config['confirm_refresh'], )); - + return $template->assign_display('captcha'); } - + function get_demo_template($id) { global $config, $user, $template, $phpbb_admin_path, $phpEx; - + $template->set_filenames(array( 'captcha_demo' => 'captcha_default_acp_demo.html') ); + // acp_captcha has a delivery function; let's use it $template->assign_vars(array( 'CONFIRM_IMAGE' => append_sid($phpbb_admin_path . 'index.' . $phpEx . '?captcha_demo=1&mode=visual&i=' . $id . '&select_captcha=' . $this->get_class_name()), 'CONFIRM_ID' => $this->confirm_id, )); - + return $template->assign_display('captcha_demo'); } - + function get_hidden_fields() { $hidden_fields = array(); - + // this is required for postig.php - otherwise we would forget about the captcha being already solved if ($this->solved) { @@ -129,16 +128,16 @@ class phpbb_default_captcha $hidden_fields['confirm_id'] = $this->confirm_id; return $hidden_fields; } - + function garbage_collect($type) { global $db, $config; $sql = 'SELECT DISTINCT c.session_id - FROM ' . CONFIRM_TABLE . ' c - LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) - WHERE s.session_id IS NULL' . - ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); + FROM ' . CONFIRM_TABLE . ' c + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) + WHERE s.session_id IS NULL' . + ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) @@ -159,21 +158,21 @@ class phpbb_default_captcha } $db->sql_freeresult($result); } - + function uninstall() { - self::garbage_collect(0); + $this->garbage_collect(0); } - + function install() { return; } - + function validate() { global $config, $db, $user; - + $this->confirm_code = request_var('confirm_code', ''); if (!$this->confirm_id) { @@ -191,10 +190,10 @@ class phpbb_default_captcha $error = $user->lang['CONFIRM_CODE_WRONG']; } } - + if (strlen($error)) { - // okay, inorect answer. Let's ask a new question + // okay, incorrect answer. Let's ask a new question. $this->generate_code(); return $error; } @@ -203,16 +202,15 @@ class phpbb_default_captcha return false; } } - - + /** * The old way to generate code, suitable for GD and non-GD. Resets the internal state. */ function generate_code() { global $db, $user; - - $this->code = gen_rand_string(mt_rand(5, 8)); + + $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->confirm_id = md5(unique_id($user->ip)); $this->seed = hexdec(substr(unique_id(), 4, 10)); $this->solved = false; @@ -228,19 +226,20 @@ class phpbb_default_captcha ); $db->sql_query($sql); } - + /** * New Question, if desired. */ function regenerate_code() { global $db, $user; - - $this->code = gen_rand_string(mt_rand(5, 8)); + + $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->seed = hexdec(substr(unique_id(), 4, 10)); $this->solved = false; // compute $seed % 0x7fffffff $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); + $sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( 'code' => (string) $this->code, 'seed' => (int) $this->seed)) . ' @@ -249,35 +248,37 @@ class phpbb_default_captcha session_id = \'' . $db->sql_escape($user->session_id) . '\''; $db->sql_query($sql); } - + /** - * Look up everything we need for painting&checking. + * Look up everything we need for painting&checking. */ function load_code() { global $db, $user; + $sql = 'SELECT code, seed - FROM ' . CONFIRM_TABLE . " - WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . $this->type; + FROM ' . CONFIRM_TABLE . " + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . $this->type; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); + if ($row) { $this->code = $row['code']; $this->seed = $row['seed']; return true; } + return false; - } - + function check_code() { global $db; - + if (empty($this->code)) { if (!$this->load_code()) @@ -287,47 +288,45 @@ class phpbb_default_captcha } return (strcasecmp($this->code, $this->confirm_code) === 0); } - + function delete_code() { global $db, $user; - + $sql = 'DELETE FROM ' . CONFIRM_TABLE . " - WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . $this->type; + WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . $this->type; $db->sql_query($sql); } - + function get_attempt_count() { global $db, $user; - + $sql = 'SELECT COUNT(session_id) AS attempts - FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . $this->type; + FROM ' . CONFIRM_TABLE . " + WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . $this->type; $result = $db->sql_query($sql); $attempts = (int) $db->sql_fetchfield('attempts'); $db->sql_freeresult($result); - + return $attempts; } - - + function reset() { global $db, $user; - + $sql = 'DELETE FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . (int) $this->type; + WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . (int) $this->type; $db->sql_query($sql); - + // we leave the class usable by generating a new question $this->generate_code(); } - } ?> \ No newline at end of file diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php index 5b3c09f32d..ac78b3d1c4 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -/** +/** * Placeholder for autoload */ if (!class_exists('phpbb_default_captcha')) @@ -24,6 +24,9 @@ if (!class_exists('phpbb_default_captcha')) include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); } +/** +* @package VC +*/ class phpbb_captcha_gd extends phpbb_default_captcha { function phpbb_captcha_gd() @@ -35,7 +38,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx); } } - + function get_instance() { return new phpbb_captcha_gd(); @@ -45,17 +48,17 @@ class phpbb_captcha_gd extends phpbb_default_captcha { return (@extension_loaded('gd') || can_load_dll('gd')); } - + function get_name() { return 'CAPTCHA_GD'; } - + function get_class_name() { return 'phpbb_captcha_gd'; } - + function acp_page($id, &$module) { global $db, $user, $auth, $template; @@ -80,7 +83,6 @@ class phpbb_captcha_gd extends phpbb_default_captcha 'captcha_gd' => 'CAPTCHA_GD', ); - $module->tpl_name = 'captcha_gd_acp'; $module->page_title = 'ACP_VC_SETTINGS'; $form_key = 'acp_captcha'; @@ -112,11 +114,11 @@ class phpbb_captcha_gd extends phpbb_default_captcha $var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var]; $template->assign_var($template_var, $var); } + $template->assign_vars(array( 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), 'CAPTCHA_NAME' => $this->get_class_name(), )); - } } } diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php index 38e5aabedd..36cbaf7d79 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php @@ -24,6 +24,9 @@ if (!class_exists('captcha_abstract')) include_once($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); } +/** +* @package VC +*/ class phpbb_captcha_gd_wave extends phpbb_default_captcha { @@ -60,7 +63,7 @@ class phpbb_captcha_gd_wave extends phpbb_default_captcha function acp_page($id, &$module) { global $config, $db, $template, $user; - + trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); } } diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php index 8df11bfe8a..517b55f09e 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -/** +/** * Placeholder for autoload */ if (!class_exists('phpbb_default_captcha')) @@ -24,6 +24,9 @@ if (!class_exists('phpbb_default_captcha')) include_once($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); } +/** +* @package VC +*/ class phpbb_captcha_nogd extends phpbb_default_captcha { @@ -36,7 +39,7 @@ class phpbb_captcha_nogd extends phpbb_default_captcha include_once($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx); } } - + function get_instance() { return new phpbb_captcha_nogd(); @@ -46,25 +49,23 @@ class phpbb_captcha_nogd extends phpbb_default_captcha { return true; } - + function get_name() { - global $user; - - return 'CAPTCHA_NO_GD'; + return 'CAPTCHA_NO_GD'; } - + function get_class_name() { return 'phpbb_captcha_nogd'; } - - + function acp_page($id, &$module) { global $user; - + trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); } } +?> \ No newline at end of file diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index 42ca25ae54..a96f5ef9c6 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -22,6 +22,9 @@ if (!class_exists('phpbb_default_captcha')) include_once($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); } +/** +* @package VC +*/ class phpbb_recaptcha extends phpbb_default_captcha { var $recaptcha_server = 'http://api.recaptcha.net'; @@ -29,18 +32,16 @@ class phpbb_recaptcha extends phpbb_default_captcha var $challenge; var $response; - function init($type) { global $config, $db, $user; - + $user->add_lang('recaptcha'); parent::init($type); $this->challenge = request_var('recaptcha_challenge_field', ''); $this->response = request_var('recaptcha_response_field', ''); } - - + function get_instance() { return new phpbb_recaptcha(); @@ -48,25 +49,25 @@ class phpbb_recaptcha extends phpbb_default_captcha function is_available() { - global $config, $user; + global $config, $user; $user->add_lang('recaptcha'); return (isset($config['recaptcha_pubkey']) && !empty($config['recaptcha_pubkey'])); } - + function get_name() { return 'CAPTCHA_RECAPTCHA'; } - + function get_class_name() { return 'phpbb_recaptcha'; } - + function acp_page($id, &$module) { global $config, $db, $template, $user; - + $captcha_vars = array( 'recaptcha_pubkey' => 'RECAPTCHA_PUBKEY', 'recaptcha_privkey' => 'RECAPTCHA_PRIVKEY', @@ -103,6 +104,7 @@ class phpbb_recaptcha extends phpbb_default_captcha $var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, '') : ((isset($config[$captcha_var])) ? $config[$captcha_var] : ''); $template->assign_var($template_var, $var); } + $template->assign_vars(array( 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), 'CAPTCHA_NAME' => $this->get_class_name(), @@ -110,47 +112,44 @@ class phpbb_recaptcha extends phpbb_default_captcha } } - - + // not needed function execute_demo() { } - - + // not needed function execute() { } - - + function get_template() { global $config, $user, $template; - + $template->set_filenames(array( 'captcha' => 'captcha_recaptcha.html') ); - + $template->assign_vars(array( 'RECAPTCHA_SERVER' => $this->recaptcha_server, 'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '', 'RECAPTCHA_ERRORGET' => '', 'S_RECAPTCHA_AVAILABLE' => $this->is_available(), )); - + return $template->assign_display('captcha'); } - + function get_demo_template($id) { return $this->get_template(); } - + function get_hidden_fields() { $hidden_fields = array(); - + // this is required for postig.php - otherwise we would forget about the captcha being already solved if ($this->solved) { @@ -159,17 +158,17 @@ class phpbb_recaptcha extends phpbb_default_captcha $hidden_fields['confirm_id'] = $this->confirm_id; return $hidden_fields; } - + function uninstall() { - self::garbage_collect(0); + $this->garbage_collect(0); } - + function install() { return; } - + function validate() { if (!parent::validate()) @@ -181,7 +180,6 @@ class phpbb_recaptcha extends phpbb_default_captcha return $this->recaptcha_check_answer(); } } - // Code from here on is based on recaptchalib.php /* @@ -218,14 +216,14 @@ class phpbb_recaptcha extends phpbb_default_captcha */ /** - * Submits an HTTP POST to a reCAPTCHA server - * @param string $host - * @param string $path - * @param array $data - * @param int port - * @return array response - */ - function _recaptcha_http_post($host, $path, $data, $port = 80) + * Submits an HTTP POST to a reCAPTCHA server + * @param string $host + * @param string $path + * @param array $data + * @param int port + * @return array response + */ + function _recaptcha_http_post($host, $path, $data, $port = 80) { $req = $this->_recaptcha_qsencode ($data); @@ -238,52 +236,56 @@ class phpbb_recaptcha extends phpbb_default_captcha $http_request .= $req; $response = ''; - if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { - die ('Could not open socket'); + if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) + { + trigger_error('Could not open socket', E_USER_ERROR); } fwrite($fs, $http_request); - while ( !feof($fs) ) - $response .= fgets($fs, 1160); // One TCP-IP packet + while (!feof($fs)) + { + // One TCP-IP packet + $response .= fgets($fs, 1160); + } fclose($fs); $response = explode("\r\n\r\n", $response, 2); return $response; } - /** - * Calls an HTTP POST function to verify if the user's guess was correct - * @param array $extra_params an array of extra variables to post to the server - * @return ReCaptchaResponse - */ - function recaptcha_check_answer ($extra_params = array()) + * Calls an HTTP POST function to verify if the user's guess was correct + * @param array $extra_params an array of extra variables to post to the server + * @return ReCaptchaResponse + */ + function recaptcha_check_answer($extra_params = array()) { global $config, $user; + //discard spam submissions - if ($this->challenge == null || strlen($this->challenge) == 0 || $this->response == null || strlen($this->response) == 0) + if ($this->challenge == null || strlen($this->challenge) == 0 || $this->response == null || strlen($this->response) == 0) { - return $user->lang['RECAPTCHA_INCORRECT']; + return $user->lang['RECAPTCHA_INCORRECT']; } - $response = $this->_recaptcha_http_post ($this->recaptcha_verify_server, "/verify", - array ( - 'privatekey' => $config['recaptcha_privkey'], - 'remoteip' => $user->ip, - 'challenge' => $this->challenge, - 'response' => $this->response - ) + $extra_params - ); + $response = $this->_recaptcha_http_post($this->recaptcha_verify_server, '/verify', + array( + 'privatekey' => $config['recaptcha_privkey'], + 'remoteip' => $user->ip, + 'challenge' => $this->challenge, + 'response' => $this->response + ) + $extra_params + ); - $answers = explode ("\n", $response[1]); - - if (trim ($answers[0]) === 'true') + $answers = explode("\n", $response[1]); + + if (trim($answers[0]) === 'true') { $this->solved = true; return false; } - else + else { if ($answers[1] === 'incorrect-captcha-sol') { @@ -291,22 +293,24 @@ class phpbb_recaptcha extends phpbb_default_captcha } } } - - /** - * Encodes the given data into a query string format - * @param $data - array of string elements to be encoded - * @return string - encoded request - */ - function _recaptcha_qsencode ($data) + + /** + * Encodes the given data into a query string format + * @param $data - array of string elements to be encoded + * @return string - encoded request + */ + function _recaptcha_qsencode($data) { $req = ''; - foreach ( $data as $key => $value ) + foreach ($data as $key => $value) { - $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; + $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; } + // Cut the last '&' - $req=substr($req,0,strlen($req)-1); + $req = substr($req, 0, strlen($req) - 1); return $req; } } +?> \ No newline at end of file diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 78905beff6..f958a204b6 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -670,17 +670,17 @@ function phpbb_chmod($filename, $perms = CHMOD_READ) } /** - * Test if a file/directory is writable - * - * This function calls the native is_writable() when not running under - * Windows and it is not disabled. - * - * @param string $file Path to perform write test on - * @return bool True when the path is writable, otherwise false. - */ +* Test if a file/directory is writable +* +* This function calls the native is_writable() when not running under +* Windows and it is not disabled. +* +* @param string $file Path to perform write test on +* @return bool True when the path is writable, otherwise false. +*/ function phpbb_is_writable($file) { - if (substr(PHP_OS, 0, 3) === 'WIN' || !function_exists('is_writable')) + if (strtolower(substr(PHP_OS, 0, 3)) === 'win' || !function_exists('is_writable')) { if (file_exists($file)) { @@ -714,7 +714,6 @@ function phpbb_is_writable($file) else { // file does not exist test if we can write to the directory - $dir = dirname($file); if (file_exists($dir) && is_dir($dir) && phpbb_is_writable($dir)) @@ -722,6 +721,7 @@ function phpbb_is_writable($file) return true; } } + return false; } else @@ -2585,7 +2585,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa { include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); } - + $err = ''; // Make sure user->setup() has been called @@ -2700,14 +2700,12 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $captcha->init(CONFIRM_LOGIN); $captcha->reset(); - $template->assign_vars(array( 'S_CONFIRM_CODE' => true, 'CONFIRM' => $captcha->get_template(''), )); $err = $user->lang[$result['error_msg']]; - break; case LOGIN_ERROR_PASSWORD_CONVERT: diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index ee9867b1f1..0345f039a3 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2077,8 +2077,8 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var if (preg_match('#^[^&\'"<>]+\.(?:gif|png|jpe?g)$#i', $sub_file)) { $avatar_list[$file][$avatar_row_count][$avatar_col_count] = array( - 'file' => rawurlencode ($file) . '/' . rawurlencode ($sub_file), - 'filename' => rawurlencode ($sub_file), + 'file' => rawurlencode($file) . '/' . rawurlencode($sub_file), + 'filename' => rawurlencode($sub_file), 'name' => ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $sub_file))), ); $avatar_col_count++; diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index e039fce6e1..8c6606d680 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -949,7 +949,7 @@ class session WHERE last_login < ' . (time() - (86400 * (int) $config['max_autologin_time'])); $db->sql_query($sql); } - + // only called from CRON; should be a safe workaround until the infrastructure gets going if (!class_exists('captcha_factory')) { @@ -961,7 +961,6 @@ class session return; } - /** * Sets a cookie * diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 958369a03e..06606f602f 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -42,7 +42,8 @@ class ucp_register $submit = (isset($_POST['submit'])) ? true : false; $change_lang = request_var('change_lang', ''); $user_lang = request_var('lang', $user->lang_name); - $confirm_refresh = (isset($_POST['confirm_refresh']) && $config['confirm_refresh']) ? ((!empty($_POST['confirm_refresh'])) ? 1 : 0) : false; + $confirm_refresh= (isset($_POST['confirm_refresh']) && $config['confirm_refresh']) ? ((!empty($_POST['confirm_refresh'])) ? 1 : 0) : false; + if ($agreed) { add_form_key('ucp_register'); @@ -52,14 +53,13 @@ class ucp_register add_form_key('ucp_register_terms'); } - if ($config['enable_confirm']) { include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_REG); } - + if ($change_lang || $user_lang != $config['default_lang']) { $use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang); @@ -94,7 +94,7 @@ class ucp_register { $add_lang = ($change_lang) ? '&change_lang=' . urlencode($change_lang) : ''; $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : ''; - + $s_hidden_fields = array(); // If we change the language, we want to pass on some more possible parameter. @@ -108,7 +108,7 @@ class ucp_register 'lang' => $user->lang_name, 'tz' => request_var('tz', (float) $config['board_timezone']), )); - + if ($config['enable_confirm']) { $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields()); @@ -198,10 +198,12 @@ class ucp_register 'tz' => array('num', false, -14, 14), 'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'), )); + if (!check_form_key('ucp_register')) { $error[] = $user->lang['FORM_INVALID']; } + // Replace "error" strings with their real, localised form $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); @@ -216,11 +218,13 @@ class ucp_register { $captcha->reset(); } + if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts']) { $error[] = $user->lang['TOO_MANY_REGISTERS']; } } + // DNSBL check if ($config['check_dnsbl']) { @@ -424,7 +428,6 @@ class ucp_register $confirm_image = ''; // Visual Confirmation - Show images - if ($config['enable_confirm']) { if ($change_lang || $confirm_refresh) @@ -434,13 +437,12 @@ class ucp_register else { $str = ''; - } + $template->assign_vars(array( 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''), 'S_CAPTCHA' => $captcha->get_template(), )); - } // @@ -455,7 +457,7 @@ class ucp_register $l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE']; break; } - + $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('
          ', $error) : '', 'USERNAME' => $data['username'], @@ -474,8 +476,7 @@ class ucp_register 'S_COPPA' => $coppa, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), - ) - ); + )); // $user->profile_fields = array(); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index fe855496e4..a77896c470 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -677,7 +677,7 @@ function database_update_info() // No changes from 3.0.5-RC1 to 3.0.5 '3.0.5-RC1' => array(), - + // No changes from 3.0.5 '3.0.5' => array(), ); @@ -1015,13 +1015,12 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.5-RC1 to 3.0.5 case '3.0.5-RC1': break; - - - + case '3.0.5': // TODO: smarter detection here; problem without GD. set_config('captcha_plugin', 'phpbb_captcha_nogd'); + $no_updates = false; break; } } diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index fec608ed80..c1d6e7fbeb 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -257,7 +257,7 @@ $lang = array_merge($lang, array( 'CAPTCHA_NO_GD' => 'CAPTCHA without GD', 'CAPTCHA_PREVIEW_MSG' => 'Your changes to the visual confirmation setting were not saved. This is just a preview.', 'CAPTCHA_PREVIEW_EXPLAIN' => 'The CAPTCHA as it would look like using the current selection.', - + 'CAPTCHA_SELECT' => 'Installed CAPTCHA plugins', 'CAPTCHA_SELECT_EXPLAIN' => 'The dropdown holds the CAPTCHA plugins recognized by the board. Gray entries are not available right now and might need configuration prior to use.', 'CAPTCHA_CONFIGURE' => 'Configure CAPTCHAs', diff --git a/phpBB/posting.php b/phpBB/posting.php index 18c5b2fa7c..99d9a59925 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -51,7 +51,7 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered']) $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_POST); } - + // Was cancel pressed? If so then redirect to the appropriate page if ($cancel || ($current_time - $lastclick < 2 && $submit)) { @@ -1016,10 +1016,12 @@ if ($submit || $preview || $refresh) } $redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message); + if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) { $captcha->reset(); } + // Check the permissions for post approval, as well as the queue trigger where users are put on approval with a post count lower than specified. Moderators are not affected. if ((($config['enable_queue_trigger'] && $user->data['user_posts'] < $config['queue_trigger_posts']) || !$auth->acl_get('f_noapprove', $data['forum_id'])) && !$auth->acl_get('m_approve', $data['forum_id'])) { @@ -1242,7 +1244,6 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered'] && $solved_c { $captcha->reset(); - $template->assign_vars(array( 'S_CONFIRM_CODE' => true, 'CONFIRM' => $captcha->get_template(), From 0c19784ab9e5dae7828b3ebca619ec9fd1c301a7 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 7 Jun 2009 18:09:51 +0000 Subject: [PATCH 032/607] for the time being pushed to 3.2.x git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9560 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/Zend/Exception.php | 30 ----------- phpBB/includes/Zend/loader.php | 58 -------------------- phpBB/includes/ezcomponents/loader.php | 73 -------------------------- 3 files changed, 161 deletions(-) delete mode 100644 phpBB/includes/Zend/Exception.php delete mode 100644 phpBB/includes/Zend/loader.php delete mode 100644 phpBB/includes/ezcomponents/loader.php diff --git a/phpBB/includes/Zend/Exception.php b/phpBB/includes/Zend/Exception.php deleted file mode 100644 index 599d8a033e..0000000000 --- a/phpBB/includes/Zend/Exception.php +++ /dev/null @@ -1,30 +0,0 @@ -= 5.2.4 and spl_autoload_register() required', E_USER_ERROR); -} - -/** -* Autoload function for Zend framework classes -*/ -function phpbb_zend_autoload($class_name) -{ - global $phpbb_root_path; - - if (strpos($class_name, '_') !== false) - { - $path = str_replace('_', '/', $class_name) . '.php'; - require("{$phpbb_root_path}includes/" . $path); - return true; - } -} - -/** -* @ignore -*/ -// make sure Zend is in the include path -ini_set( 'include_path', ini_get( 'include_path' ) . PATH_SEPARATOR . $phpbb_root_path . 'includes' ); - -// check whether a regular autoload function already exists, so we can load it into the spl stack afterwards -$register_autoload = false; -if (function_exists('__autoload')) -{ - $register_autoload = true; -} - -spl_autoload_register('phpbb_zend_autoload'); - -// load the old autoload function into the spl stack if necessary -if ($register_autoload) -{ - spl_autoload_register('__autoload'); -} \ No newline at end of file diff --git a/phpBB/includes/ezcomponents/loader.php b/phpBB/includes/ezcomponents/loader.php deleted file mode 100644 index 62aaa7667d..0000000000 --- a/phpBB/includes/ezcomponents/loader.php +++ /dev/null @@ -1,73 +0,0 @@ -loaded = array(); - if (version_compare(PHP_VERSION, '5.2.1', '<')) - { - trigger_error('PHP >= 5.2.1 required', E_USER_ERROR); - } - } - - /** - * Loads all classes of a particular component. - * The base component is always loaded first. - * - * @param $component string Lower case component name - */ - function load_component($component) - { - global $phpbb_root_path; - - // don't allow loading the same component twice - if (isset($this->loaded[$component]) && $this->loaded[$component]) - { - return; - } - - // make sure base is always loaded first - if ($component != 'base' && !isset($this->loaded['base'])) - { - $this->load_component('base'); - } - - $ezc_path = $phpbb_root_path . 'includes/ezcomponents/'; - - // retrieve the autoload list - $classes = include($ezc_path . ucfirst($component) . '/' . $component . '_autoload.php'); - - // include all files related to this component - foreach ($classes as $class => $path) - { - include($ezc_path . $path); - } - } -} \ No newline at end of file From 0c57363fbc8769ef3e0774a9a03878553540bf9a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 8 Jun 2009 10:05:44 +0000 Subject: [PATCH 033/607] Fix bug #46065 - Correctly show private message history Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9561 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_privmsgs.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8fdbf83b4d..878ae3d23f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -92,6 +92,7 @@
        • [Fix] Sorting by author or subject on viewtopic now preserves the order. (Bug #44875)
        • [Fix] Correctly determine writable status of files on Windows operating system. (Bug #39035)
        • [Fix] Show report button in prosilver for guests who are allowed to report posts. (Bug #45695 - Patch by bantu)
        • +
        • [Fix] Correctly show private message history (Bug #46065 - Patch by bantu)
        • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
        • [Feature] Backported 3.2 captcha plugins.
        • [Feature] Introduced new ACM plugins: diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 05653f7e3b..96400ad70d 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1827,7 +1827,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') ); - unset($rowset[$id]); + unset($rowset[$i]); $prev_id = $id; } From a3c5562a0d8674c0a513d25855b082c726b26f5b Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 8 Jun 2009 10:11:43 +0000 Subject: [PATCH 034/607] Fix Bugs #38555, #45505, #45785 and #45865 - Various XHTML mistakes in prosilver and subsilver2. Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9562 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/memberlist_im.html | 5 +++-- phpBB/styles/prosilver/template/posting_preview.html | 10 +++++----- phpBB/styles/subsilver2/template/memberlist_im.html | 2 +- phpBB/styles/subsilver2/template/search_results.html | 2 +- phpBB/styles/subsilver2/template/viewtopic_body.html | 11 ++++++++--- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 878ae3d23f..6a456b3b94 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -93,6 +93,7 @@
        • [Fix] Correctly determine writable status of files on Windows operating system. (Bug #39035)
        • [Fix] Show report button in prosilver for guests who are allowed to report posts. (Bug #45695 - Patch by bantu)
        • [Fix] Correctly show private message history (Bug #46065 - Patch by bantu) +
        • [Fix] Various XHTML mistakes in prosilver and subsilver2. (Bugs #38555, #45505 - Patch by Raimon, #45785, #45865)
        • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
        • [Feature] Backported 3.2 captcha plugins.
        • [Feature] Introduced new ACM plugins: diff --git a/phpBB/styles/prosilver/template/memberlist_im.html b/phpBB/styles/prosilver/template/memberlist_im.html index 9bb1f90a58..a99d487f4f 100644 --- a/phpBB/styles/prosilver/template/memberlist_im.html +++ b/phpBB/styles/prosilver/template/memberlist_im.html @@ -7,7 +7,7 @@
          - +

          {L_SEND_IM_EXPLAIN}

          @@ -81,9 +81,10 @@
          -{L_CLOSE_WINDOW} +{L_CLOSE_WINDOW} +
    37. - + - + - - - + + \ No newline at end of file diff --git a/phpBB/styles/subsilver2/template/login_body.html b/phpBB/styles/subsilver2/template/login_body.html index 406ab3a293..b8a789bfe7 100644 --- a/phpBB/styles/subsilver2/template/login_body.html +++ b/phpBB/styles/subsilver2/template/login_body.html @@ -65,12 +65,12 @@ - +
      {L_LOGIN_CONFIRMATION}
      {L_LOGIN_CONFIRM_EXPLAIN}
      - - {CONFIRM_IMAGE} -
      {L_CONFIRM_CODE}:
      {L_CONFIRM_CODE_EXPLAIN}
      colspan="2" align="center">{S_HIDDEN_FIELDS}
      {L_POST_CONFIRMATION}
      {L_POST_CONFIRM_EXPLAIN}
      - - {CONFIRM_IMAGE} -
      {L_CONFIRM_CODE}:
      {L_CONFIRM_CODE_EXPLAIN}
      {L_CONFIRMATION}
      {L_CONFIRM_EXPLAIN}
      {CONFIRM_IMG}
      {L_CONFIRM_CODE}:
      {L_CONFIRM_CODE_EXPLAIN} {L_VC_REFRESH_EXPLAIN}
       
      {L_CONFIRM_CODE}
      {L_CONFIRM_CODE_EXPLAIN}{L_CONFIRM_EXPLAIN}
      {L_CONFIRM_CODE} - -{L_CONFIRM_CODE} +
      {L_CONFIRM_CODE}:
      {L_CONFIRM_CODE_EXPLAIN}
      -
      - {S_CAPTCHA} - + + diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html index 162227b7e5..356972f707 100644 --- a/phpBB/styles/subsilver2/template/posting_body.html +++ b/phpBB/styles/subsilver2/template/posting_body.html @@ -332,8 +332,8 @@ - - {S_CAPTCHA} + + diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html index dc47323836..fc3e4c119f 100644 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ b/phpBB/styles/subsilver2/template/ucp_register.html @@ -75,10 +75,11 @@ + - - {S_CAPTCHA} + + From 5943407cdcb66a03b8afdcf7273e21116f8fd890 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 17 Jun 2009 13:30:55 +0000 Subject: [PATCH 080/607] This will need some further work git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9610 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/captcha_recaptcha.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index 10f24b1d7a..5272fa50ef 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -7,9 +7,9 @@ }; // ]]> - -
      colspan="2" align="center">{S_HIDDEN_FIELDS}
      {profile_fields.FIELD}
      {profile_fields.ERROR}
      From 815bbac230917ae2110bd9d719f763d5bba1c52f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Jun 2009 11:04:54 +0000 Subject: [PATCH 084/607] fix r9604 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9614 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/index.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/index.php b/phpBB/index.php index 9dffade44c..c3dbbd346e 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -84,10 +84,11 @@ $birthday_list = ''; if ($config['load_birthdays'] && $config['allow_birthdays']) { $now = getdate(time() + $user->timezone + $user->dst - date('Z')); - $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday, b.ban_id + $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday FROM ' . USERS_TABLE . ' u LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid) - WHERE b.ban_id IS NULL + WHERE (b.ban_id IS NULL + OR b.ban_exclude = 1) AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')'; $result = $db->sql_query($sql); From ab33dd2b08b384c85c8d22b8fb481b248491fc93 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Jun 2009 11:07:22 +0000 Subject: [PATCH 085/607] Change bug #26545 - Smilies no longer require the f_bbcode permission. Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9615 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/posting.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index d5930bfd58..e42d5b6d0c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -123,6 +123,7 @@
    38. [Change] Template engine now permits to a limited extent variable includes.
    39. [Change] Quote BBCode no longer requires the f_reply permission. (Bug #16079)
    40. [Change] Banning/unbanning users now generates an entry in their user notes (Bug #21825 - Patch by nickvergessen)
    41. +
    42. [Change] Smilies no longer require the f_bbcode permission. (Bug #26545)
    43. [Feature] Backported 3.2 captcha plugins.
    44. [Feature] Introduced new ACM plugins:
        diff --git a/phpBB/posting.php b/phpBB/posting.php index 013e4da633..4b715a66a2 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -494,7 +494,7 @@ if ($mode == 'edit' && $post_data['bbcode_uid']) // HTML, BBCode, Smilies, Images and Flash status $bbcode_status = ($config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id)) ? true : false; -$smilies_status = ($bbcode_status && $config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id)) ? true : false; +$smilies_status = ($config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id)) ? true : false; $img_status = ($bbcode_status && $auth->acl_get('f_img', $forum_id)) ? true : false; $url_status = ($config['allow_post_links']) ? true : false; $flash_status = ($bbcode_status && $auth->acl_get('f_flash', $forum_id) && $config['allow_post_flash']) ? true : false; From 7bee180a785a698818a3078f1791e3409bbed8d8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Jun 2009 11:23:30 +0000 Subject: [PATCH 086/607] Fix bug #45995 - Prune mutiple users instructions Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9616 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/prune.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/prune.php b/phpBB/language/en/acp/prune.php index 31e14d62a1..5217bd4416 100644 --- a/phpBB/language/en/acp/prune.php +++ b/phpBB/language/en/acp/prune.php @@ -37,7 +37,7 @@ if (empty($lang) || !is_array($lang)) // User pruning $lang = array_merge($lang, array( - 'ACP_PRUNE_USERS_EXPLAIN' => 'Here you can delete (or deactivate) users from your board. This can be done in a variety of ways; by post count, last activity, etc. Each of these criteria can be combined, i.e. you can prune users last active before 2002-01-01 with fewer than 10 posts. Alternatively you can enter a list of users directly into the text box, any criteria entered will be ignored. Take care with this facility! Once a user is deleted there is no way back.', + 'ACP_PRUNE_USERS_EXPLAIN' => 'Here you can delete (or deactivate) users from your board. This can be done in a variety of ways; by post count, last activity, etc. Each of these criteria can be combined, i.e. you can prune users last active before 2002-01-01 with fewer than 10 posts. Alternatively you can enter a list of users directly into the text box, each on a separate line - any criteria entered will be ignored. Take care with this facility! Once a user is deleted there is no way back.', 'DEACTIVATE_DELETE' => 'Deactivate or delete', 'DEACTIVATE_DELETE_EXPLAIN' => 'Choose whether to deactivate users or delete them entirely, note there is no undo!', From a4e817e32286125ccc3d85a11b0c8e990ab8697a Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Thu, 18 Jun 2009 11:43:16 +0000 Subject: [PATCH 087/607] Fix bug #10519 - "View user notes" and "Warn user" links shown even if modules disabled Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9617 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/memberlist.php | 26 +++++++++++-------- .../prosilver/template/memberlist_view.html | 2 +- .../subsilver2/template/memberlist_view.html | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e42d5b6d0c..afa25c6548 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -116,6 +116,7 @@
      • [Fix] Do not display birthdays of banned users (Bug #20625 - Patch by nickvergessen)
      • [Fix] Fix function to recalculate Nested Sets (Bug #41555 - Patch by EXreaction)
      • [Fix] Display and highlight already used rank images while assigning new rank (Bug #22665 - Patch by nickvergessen)
      • +
      • [Fix] Do not display "View user notes" and "Warn user" links in user profile if corresponding MCP modules are disabled. (Bug #10519 - Patch by rxu)
      • [Fix] Empty error message in UCP folder management when creating folder without name (Bug #39875 - Patch by nickvergessen)
      • [Fix] Wrong description in UCP group managment implicates missing feature (Bug #19945 - Patch by nickvergessen)
      • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
      • diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 298164be9e..d8e6d99471 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -512,20 +512,22 @@ switch ($mode) $profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array(); } - // We need to check if the module 'zebra' is accessible - $zebra_enabled = false; + // We need to check if the modules 'zebra', 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links + $zebra_enabled = $user_notes_enabled = $warn_user_enabled = false; - if ($user->data['user_id'] != $user_id && $user->data['is_registered']) + if (!class_exists('p_master')) { - include_once($phpbb_root_path . 'includes/functions_module.' . $phpEx); - $module = new p_master(); - $module->list_modules('ucp'); - $module->set_active('zebra'); - - $zebra_enabled = ($module->active_module === false) ? false : true; - - unset($module); + include($phpbb_root_path . 'includes/functions_module.' . $phpEx); } + $module = new p_master(); + + $module->list_modules('ucp'); + $module->list_modules('mcp'); + $user_notes_enabled = ($module->loaded('notes', 'user_notes')) ? true : false; + $warn_user_enabled = ($module->loaded('warn', 'warn_user')) ? true : false; + $zebra_enabled = ($module->loaded('zebra')) ? true : false; + + unset($module); // If the user has m_approve permission or a_user permission, then list then display unapproved posts if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user')) @@ -575,6 +577,8 @@ switch ($mode) 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}") : '', + 'S_USER_NOTES' => ($user_notes_enabled) ? true : false, + 'S_WARN_USER' => ($warn_user_enabled) ? true : false, 'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false, 'U_ADD_FRIEND' => (!$friend) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', 'U_ADD_FOE' => (!$foe) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index 8f2e1734a4..8352583d2a 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -80,7 +80,7 @@
        {L_VISITED}:
        {VISITED}
        {L_WARNINGS}:
        -
        {WARNINGS} [ {L_VIEW_NOTES} | {L_WARN_USER} ]
        +
        {WARNINGS} [ {L_VIEW_NOTES} | {L_WARN_USER} ]
        {L_TOTAL_POSTS}:
        {POSTS} | {L_SEARCH_USER_POSTS} diff --git a/phpBB/styles/subsilver2/template/memberlist_view.html b/phpBB/styles/subsilver2/template/memberlist_view.html index 15d43e60c1..8cfe4d9276 100644 --- a/phpBB/styles/subsilver2/template/memberlist_view.html +++ b/phpBB/styles/subsilver2/template/memberlist_view.html @@ -69,7 +69,7 @@
    45. - + From e3af3015231c9c8baf58f55081b2068d2dad89b0 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 18 Jun 2009 12:56:59 +0000 Subject: [PATCH 088/607] Finally stop this annoyance, if PDO is shared module it must be loaded for the SQLite extension to work git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9618 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_install.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index afa25c6548..2c8fc97731 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -119,6 +119,7 @@
    46. [Fix] Do not display "View user notes" and "Warn user" links in user profile if corresponding MCP modules are disabled. (Bug #10519 - Patch by rxu)
    47. [Fix] Empty error message in UCP folder management when creating folder without name (Bug #39875 - Patch by nickvergessen)
    48. [Fix] Wrong description in UCP group managment implicates missing feature (Bug #19945 - Patch by nickvergessen)
    49. +
    50. [Fix] Do not throw an error when PDO is a shared module and not loaded preventing SQLite from being loaded.
    51. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    52. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    53. [Change] Template engine now permits to a limited extent variable includes.
    54. diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 611b0a7bc3..42b9b4e318 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -21,6 +21,12 @@ if (!defined('IN_PHPBB')) */ function can_load_dll($dll) { + // SQLite2 is a tricky thing, from 5.0.0 it requires PDO; if PDO is not loaded we must state that SQLite is unavailable + // as the installer doesn't understand that the extension has a prerequisite. + if ($dll == 'sqlite' && version_compare(PHP_VERSION, '5.0.0', '>=') && !extension_loaded('pdo')) + { + return false; + } return ((@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'on') && (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') && function_exists('dl') && @dl($dll . '.' . PHP_SHLIB_SUFFIX)) ? true : false; } From 11d8d3455a97bae1945bb578c761eaa67292622f Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 18 Jun 2009 12:59:43 +0000 Subject: [PATCH 089/607] Changes to r9617 Fix a template compilation issue, and reshuffle the code. The added template complexity made it more of a problem to check the variables correctly, hence simplification. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9619 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/memberlist.php | 49 +++++++++++-------- .../prosilver/template/memberlist_view.html | 4 +- .../subsilver2/template/memberlist_view.html | 4 +- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index d8e6d99471..08451ac6b2 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -500,7 +500,29 @@ switch ($mode) $poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']); - $template->assign_vars(show_profile($member)); + // We need to check if the modules 'zebra', 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links + $zebra_enabled = $user_notes_enabled = $warn_user_enabled = false; + + // Only check if the user is logged in + if ($user->data['is_registered']) + { + if (!class_exists('p_master')) + { + include($phpbb_root_path . 'includes/functions_module.' . $phpEx); + } + $module = new p_master(); + + $module->list_modules('ucp'); + $module->list_modules('mcp'); + + $user_notes_enabled = ($module->loaded('notes', 'user_notes')) ? true : false; + $warn_user_enabled = ($module->loaded('warn', 'warn_user')) ? true : false; + $zebra_enabled = ($module->loaded('zebra')) ? true : false; + + unset($module); + } + + $template->assign_vars(show_profile($member, $user_notes_enabled, $warn_user_enabled)); // Custom Profile Fields $profile_fields = array(); @@ -512,23 +534,6 @@ switch ($mode) $profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array(); } - // We need to check if the modules 'zebra', 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links - $zebra_enabled = $user_notes_enabled = $warn_user_enabled = false; - - if (!class_exists('p_master')) - { - include($phpbb_root_path . 'includes/functions_module.' . $phpEx); - } - $module = new p_master(); - - $module->list_modules('ucp'); - $module->list_modules('mcp'); - $user_notes_enabled = ($module->loaded('notes', 'user_notes')) ? true : false; - $warn_user_enabled = ($module->loaded('warn', 'warn_user')) ? true : false; - $zebra_enabled = ($module->loaded('zebra')) ? true : false; - - unset($module); - // If the user has m_approve permission or a_user permission, then list then display unapproved posts if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user')) { @@ -1538,7 +1543,7 @@ page_footer(); /** * Prepare profile data */ -function show_profile($data) +function show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false) { global $config, $auth, $template, $user, $phpEx, $phpbb_root_path; @@ -1624,9 +1629,11 @@ function show_profile($data) 'ICQ_STATUS_IMG' => (!empty($data['user_icq'])) ? '' : '', 'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false, + 'S_WARNINGS' => ($auth->acl_getf_global('m_') || $auth->acl_get('m_warn')) ? true : false, + 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$user_id&sr=posts") : '', - 'U_NOTES' => $auth->acl_getf_global('m_') ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', - 'U_WARN' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', + 'U_NOTES' => ($user_notes_enabled && $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', + 'U_WARN' => ($warn_user_enabled && $auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $user_id) : '', 'U_EMAIL' => $email, 'U_WWW' => (!empty($data['user_website'])) ? $data['user_website'] : '', diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index 8352583d2a..b9e6f5006d 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -78,9 +78,9 @@
      {L_JOINED}:
      {JOINED}
      {L_VISITED}:
      {VISITED}
      - +
      {L_WARNINGS}:
      -
      {WARNINGS} [ {L_VIEW_NOTES} | {L_WARN_USER} ]
      +
      {WARNINGS} [ {L_VIEW_NOTES} | {L_WARN_USER} ]
      {L_TOTAL_POSTS}:
      {POSTS} | {L_SEARCH_USER_POSTS} diff --git a/phpBB/styles/subsilver2/template/memberlist_view.html b/phpBB/styles/subsilver2/template/memberlist_view.html index 8cfe4d9276..33f229d860 100644 --- a/phpBB/styles/subsilver2/template/memberlist_view.html +++ b/phpBB/styles/subsilver2/template/memberlist_view.html @@ -66,10 +66,10 @@
      - + - + From de81a5499ea941613401bd7e846db224d6d23054 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 18 Jun 2009 13:08:02 +0000 Subject: [PATCH 090/607] 'I think the phrase rhymes with Clucking Bell!' Fix spaces in r9618 stupid [code] block :@ git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9620 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_install.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 42b9b4e318..7fa299548d 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -23,10 +23,10 @@ function can_load_dll($dll) { // SQLite2 is a tricky thing, from 5.0.0 it requires PDO; if PDO is not loaded we must state that SQLite is unavailable // as the installer doesn't understand that the extension has a prerequisite. - if ($dll == 'sqlite' && version_compare(PHP_VERSION, '5.0.0', '>=') && !extension_loaded('pdo')) - { - return false; - } + if ($dll == 'sqlite' && version_compare(PHP_VERSION, '5.0.0', '>=') && !extension_loaded('pdo')) + { + return false; + } return ((@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'on') && (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') && function_exists('dl') && @dl($dll . '.' . PHP_SHLIB_SUFFIX)) ? true : false; } From d5559836848448986e322ef2602145db52bc7b2c Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 18 Jun 2009 15:57:55 +0000 Subject: [PATCH 091/607] Typo in r9613 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9621 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 2c8fc97731..8ff4eb8e14 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -118,7 +118,7 @@
    55. [Fix] Display and highlight already used rank images while assigning new rank (Bug #22665 - Patch by nickvergessen)
    56. [Fix] Do not display "View user notes" and "Warn user" links in user profile if corresponding MCP modules are disabled. (Bug #10519 - Patch by rxu)
    57. [Fix] Empty error message in UCP folder management when creating folder without name (Bug #39875 - Patch by nickvergessen)
    58. -
    59. [Fix] Wrong description in UCP group managment implicates missing feature (Bug #19945 - Patch by nickvergessen)
    60. +
    61. [Fix] Wrong description in UCP group management implicates missing feature (Bug #19945 - Patch by nickvergessen)
    62. [Fix] Do not throw an error when PDO is a shared module and not loaded preventing SQLite from being loaded.
    63. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    64. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    65. From 7d3c89e25ab8aa87f09d3971a569d31f63dbef40 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Jun 2009 18:01:42 +0000 Subject: [PATCH 092/607] Fix bug #33745 - Correctly orientate quoted text image on RTL languages Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9622 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/theme/bidi.css | 3 ++- phpBB/styles/prosilver/theme/colours.css | 4 ++++ phpBB/styles/prosilver/theme/images/quote_rtl.gif | Bin 0 -> 154 bytes 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 phpBB/styles/prosilver/theme/images/quote_rtl.gif diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8ff4eb8e14..0ff9d63ec9 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -116,6 +116,7 @@
    66. [Fix] Do not display birthdays of banned users (Bug #20625 - Patch by nickvergessen)
    67. [Fix] Fix function to recalculate Nested Sets (Bug #41555 - Patch by EXreaction)
    68. [Fix] Display and highlight already used rank images while assigning new rank (Bug #22665 - Patch by nickvergessen)
    69. +
    70. [Fix] Correctly orientate quoted text image on RTL languages (Bug #33745 - Patch by nickvergessen)
    71. [Fix] Do not display "View user notes" and "Warn user" links in user profile if corresponding MCP modules are disabled. (Bug #10519 - Patch by rxu)
    72. [Fix] Empty error message in UCP folder management when creating folder without name (Bug #39875 - Patch by nickvergessen)
    73. [Fix] Wrong description in UCP group management implicates missing feature (Bug #19945 - Patch by nickvergessen)
    74. diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index 18cb5fe558..0af79a49a3 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -367,11 +367,12 @@ /* Quote block */ .rtl blockquote { margin: 0.5em 25px 0 1px; + background-position: 99% 5px; } .rtl blockquote blockquote { /* Nested quotes */ - margin: 0.5em 15px 0 1px; + margin: 0.5em 15px 0 1px; } .rtl blockquote cite { diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index d7ee0b21b7..638f148ef9 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -461,6 +461,10 @@ blockquote { border-color:#DBDBCE; } +.rtl blockquote { + background-image: url("{T_THEME_PATH}/images/quote_rtl.gif"); +} + blockquote blockquote { /* Nested quotes */ background-color:#EFEED9; diff --git a/phpBB/styles/prosilver/theme/images/quote_rtl.gif b/phpBB/styles/prosilver/theme/images/quote_rtl.gif new file mode 100644 index 0000000000000000000000000000000000000000..ac719cf280fba68810d89e25246a5eda18411f7c GIT binary patch literal 154 zcmV;L0A>G2Nk%w1VGjTd0J8u9aByxvKR>OksiB~qh=_*X-Pl-HR(yPVOG`_|#ld7` zV!61r($UP7l#w$tGwSK&A^8LW000jFEC2ui01p5R000C>@X1N*ONvou7A=SqB$MJe z0<{F9_AsGCPRprG%!yQ|JjH`aqt}oKdH_kScX;(2x5uzYcnqG==_$256(s=ggm6k) I&XWiLJOAfD!vFvP literal 0 HcmV?d00001 From eb5498dd55fa3d3c5005656b70c9f4cb0630f34c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Jun 2009 18:12:28 +0000 Subject: [PATCH 093/607] Fix bug #31405 - Ability to define column split in FAQ/BBCode help (Bug #31405) Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9623 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/faq.php | 27 ++++++++++++++----- phpBB/language/en/help_bbcode.php | 5 ++++ phpBB/language/en/help_faq.php | 5 ++++ phpBB/styles/prosilver/template/faq_body.html | 2 +- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 0ff9d63ec9..7ea4eb26c2 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -127,6 +127,7 @@
    75. [Change] Quote BBCode no longer requires the f_reply permission. (Bug #16079)
    76. [Change] Banning/unbanning users now generates an entry in their user notes (Bug #21825 - Patch by nickvergessen)
    77. [Change] Smilies no longer require the f_bbcode permission. (Bug #26545)
    78. +
    79. [Change] Ability to define column split in FAQ/BBCode help (Bug #31405)
    80. [Feature] Backported 3.2 captcha plugins.
    81. [Feature] Introduced new ACM plugins:
        diff --git a/phpBB/faq.php b/phpBB/faq.php index da064e4452..04353de50f 100644 --- a/phpBB/faq.php +++ b/phpBB/faq.php @@ -38,15 +38,28 @@ switch ($mode) } // Pull the array data from the lang pack +$switch_column = $found_switch = false; $help_blocks = array(); foreach ($user->help as $help_ary) { if ($help_ary[0] == '--') { - $template->assign_block_vars('faq_block', array( - 'BLOCK_TITLE' => $help_ary[1]) - ); + if ($help_ary[1] == '--') + { + $switch_column = true; + $found_switch = true; + continue; + } + $template->assign_block_vars('faq_block', array( + 'BLOCK_TITLE' => $help_ary[1], + 'SWITCH_COLUMN' => $switch_column, + )); + + if ($switch_column) + { + $switch_column = false; + } continue; } @@ -58,9 +71,11 @@ foreach ($user->help as $help_ary) // Lets build a page ... $template->assign_vars(array( - 'L_FAQ_TITLE' => $l_title, - 'L_BACK_TO_TOP' => $user->lang['BACK_TO_TOP']) -); + 'L_FAQ_TITLE' => $l_title, + 'L_BACK_TO_TOP' => $user->lang['BACK_TO_TOP'], + + 'SWITCH_COLUMN_MANUALLY' => (!$found_switch) ? true : false, +)); page_header($l_title); diff --git a/phpBB/language/en/help_bbcode.php b/phpBB/language/en/help_bbcode.php index ed6fea96d3..df5f950e3e 100644 --- a/phpBB/language/en/help_bbcode.php +++ b/phpBB/language/en/help_bbcode.php @@ -78,6 +78,11 @@ $help = array( 0 => 'Creating an Ordered list', 1 => 'The second type of list, an ordered list, gives you control over what is output before each item. To create an ordered list you use [list=1][/list] to create a numbered list or alternatively [list=a][/list] for an alphabetical list. As with the unordered list, items are specified using [*]. For example:

        [list=1]
        [*]Go to the shops
        [*]Buy a new computer
        [*]Swear at computer when it crashes
        [/list]

        will generate the following:
        1. Go to the shops
        2. Buy a new computer
        3. Swear at computer when it crashes
        Whereas for an alphabetical list you would use:

        [list=a]
        [*]The first possible answer
        [*]The second possible answer
        [*]The third possible answer
        [/list]

        giving
        1. The first possible answer
        2. The second possible answer
        3. The third possible answer
        ' ), + // This block will switch the FAQ-Questions to the second template column + array( + 0 => '--', + 1 => '--' + ), array( 0 => '--', 1 => 'Creating Links' diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php index 89ac845021..88b2cc273d 100644 --- a/phpBB/language/en/help_faq.php +++ b/phpBB/language/en/help_faq.php @@ -202,6 +202,11 @@ $help = array( 0 => 'What are topic icons?', 1 => 'Topic icons are author chosen images associated with posts to indicate their content. The ability to use topic icons depends on the permissions set by the board administrator.' ), + // This block will switch the FAQ-Questions to the second template column + array( + 0 => '--', + 1 => '--' + ), array( 0 => '--', 1 => 'User Levels and Groups' diff --git a/phpBB/styles/prosilver/template/faq_body.html b/phpBB/styles/prosilver/template/faq_body.html index 78c2fc11b7..36d677a505 100644 --- a/phpBB/styles/prosilver/template/faq_body.html +++ b/phpBB/styles/prosilver/template/faq_body.html @@ -7,7 +7,7 @@
        - +
        From ac1fd3c740bf396e27e882877b94ae246caedac6 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Thu, 18 Jun 2009 23:21:19 +0000 Subject: [PATCH 094/607] Fix bug #16555 - Word censoring doesn't support unicode strings Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9624 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/cache.php | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7ea4eb26c2..cc00509fb5 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -121,6 +121,7 @@
      • [Fix] Empty error message in UCP folder management when creating folder without name (Bug #39875 - Patch by nickvergessen)
      • [Fix] Wrong description in UCP group management implicates missing feature (Bug #19945 - Patch by nickvergessen)
      • [Fix] Do not throw an error when PDO is a shared module and not loaded preventing SQLite from being loaded.
      • +
      • [Fix] Fix unicode words wrong censoring. (Bug #16555 - Patch by rxu)
      • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
      • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
      • [Change] Template engine now permits to a limited extent variable includes.
      • diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php index fc9a01ae4e..392f1377da 100644 --- a/phpBB/includes/cache.php +++ b/phpBB/includes/cache.php @@ -84,7 +84,15 @@ class cache extends acm $censors = array(); while ($row = $db->sql_fetchrow($result)) { - $censors['match'][] = '#(?=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) && @preg_match('/\p{L}/u', 'a') !== false) + { + $censors['match'][] = '#(?sql_freeresult($result); From d7d96223e7bae7cd60b13c6e7896d95838c3633c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 19 Jun 2009 09:51:50 +0000 Subject: [PATCH 095/607] - Display coloured usernames in ACP groups management screens - Changed behaviour of group_create() function to support specifying additional group columns - New groups option to excempt group leaders from group permissions git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9625 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_groups.html | 36 +- phpBB/develop/create_schema_files.php | 1 + phpBB/docs/CHANGELOG.html | 3 + phpBB/includes/acp/acp_groups.php | 38 +- phpBB/includes/acp/acp_permissions.php | 1 + phpBB/includes/auth.php | 12 +- phpBB/includes/functions_admin.php | 7 +- phpBB/includes/functions_user.php | 78 ++-- phpBB/includes/ucp/ucp_groups.php | 19 +- phpBB/install/database_update.php | 15 +- phpBB/install/schemas/firebird_schema.sql | 1 + phpBB/install/schemas/mssql_schema.sql | 431 +++++++++++----------- phpBB/install/schemas/mysql_40_schema.sql | 1 + phpBB/install/schemas/mysql_41_schema.sql | 1 + phpBB/install/schemas/oracle_schema.sql | 5 +- phpBB/install/schemas/postgres_schema.sql | 1 + phpBB/install/schemas/sqlite_schema.sql | 1 + phpBB/language/en/acp/groups.php | 5 +- 18 files changed, 370 insertions(+), 286 deletions(-) diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index 5df8a16a39..a513e69a8a 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -55,21 +55,29 @@
        - {L_GROUP_SETTINGS_SAVE} + {L_GROUP_OPTIONS_SAVE}

        {L_GROUP_FOUNDER_MANAGE_EXPLAIN}
        -
        +
        +
        +

        {L_GROUP_SKIP_AUTH_EXPLAIN}
        +
        +
        -
        +

        {L_GROUP_RECEIVE_PM_EXPLAIN}
        -
        +
        +
        + +
        + {L_GROUP_SETTINGS_SAVE}

        {L_GROUP_MESSAGE_LIMIT_EXPLAIN}
        @@ -80,7 +88,7 @@

        {L_GROUP_COLOR_EXPLAIN}
        -
          [ {L_COLOUR_SWATCH} ]
        +
              [ {L_COLOUR_SWATCH} ]
        @@ -97,7 +105,7 @@
        -
        +
        @@ -115,7 +123,7 @@
        px X px
        -
        +
        @@ -132,7 +140,7 @@
    82. {L_WARNINGS}: {WARNINGS}
      [ {L_VIEW_NOTES} | {L_WARN_USER} ]
      {WARNINGS}
      [ {L_VIEW_NOTES} | {L_WARN_USER} ]
      {L_VISITED}: {VISITED}
      {L_WARNINGS}: {WARNINGS}
      [ {L_VIEW_NOTES} | {L_WARN_USER} ]
      {WARNINGS}
      [ {L_VIEW_NOTES} | {L_WARN_USER} ]
      - + @@ -146,11 +154,11 @@
      {avatar_row.avatar_column.AVATAR_NAME}
      - +
      - + @@ -192,7 +200,7 @@ - {leader.USERNAME} + {leader.USERNAME}{leader.USERNAME} {L_YES}{L_NO} {leader.JOINED} {leader.USER_POSTS} @@ -213,7 +221,7 @@ - {member.USERNAME} + {member.USERNAME}{member.USERNAME} {L_YES}{L_NO} {member.JOINED} {member.USER_POSTS} @@ -231,12 +239,12 @@ - +
      -

      {L_MARK_ALL}{L_UNMARK_ALL}

      +

      {L_MARK_ALL}{L_UNMARK_ALL}

      {L_ADD_USERS}

      diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index d7173f6f1f..05f1b217a4 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1125,6 +1125,7 @@ function get_schema_struct() 'group_id' => array('UINT', NULL, 'auto_increment'), 'group_type' => array('TINT:4', 1), 'group_founder_manage' => array('BOOL', 0), + 'group_skip_auth' => array('BOOL', 0), 'group_name' => array('VCHAR_CI', ''), 'group_desc' => array('TEXT_UNI', ''), 'group_desc_bitfield' => array('VCHAR:255', ''), diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index cc00509fb5..04d0f91300 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -122,6 +122,7 @@
    83. [Fix] Wrong description in UCP group management implicates missing feature (Bug #19945 - Patch by nickvergessen)
    84. [Fix] Do not throw an error when PDO is a shared module and not loaded preventing SQLite from being loaded.
    85. [Fix] Fix unicode words wrong censoring. (Bug #16555 - Patch by rxu)
    86. +
    87. [Fix] Display coloured usernames in ACP groups management screens
    88. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    89. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    90. [Change] Template engine now permits to a limited extent variable includes.
    91. @@ -129,6 +130,7 @@
    92. [Change] Banning/unbanning users now generates an entry in their user notes (Bug #21825 - Patch by nickvergessen)
    93. [Change] Smilies no longer require the f_bbcode permission. (Bug #26545)
    94. [Change] Ability to define column split in FAQ/BBCode help (Bug #31405)
    95. +
    96. [Change] Changed behaviour of group_create() function to support specifying additional group columns
    97. [Feature] Backported 3.2 captcha plugins.
    98. [Feature] Introduced new ACM plugins:
        @@ -140,6 +142,7 @@
    99. [Feature] ATOM Feeds (Idea and diversed from RSS Feed 2.0 MOD (Version 1.0.8/9) by leviatan21)
    100. +
    101. [Feature] New groups option to excempt group leaders from group permissions
    102. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 2ee5ded01d..3df61ff4e2 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -309,6 +309,7 @@ class acp_groups 'message_limit' => request_var('group_message_limit', 0), 'max_recipients' => request_var('group_max_recipients', 0), 'founder_manage' => 0, + 'skip_auth' => request_var('group_skip_auth', 0), ); if ($user->data['user_type'] == USER_FOUNDER) @@ -400,11 +401,26 @@ class acp_groups // were made. $group_attributes = array(); - $test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'max_recipients', 'founder_manage'); - foreach ($test_variables as $test) + $test_variables = array( + 'rank' => 'int', + 'colour' => 'string', + 'avatar' => 'string', + 'avatar_type' => 'int', + 'avatar_width' => 'int', + 'avatar_height' => 'int', + 'receive_pm' => 'int', + 'legend' => 'int', + 'message_limit' => 'int', + 'max_recipients'=> 'int', + 'founder_manage'=> 'int', + 'skip_auth' => 'int', + ); + + foreach ($test_variables as $test => $type) { if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test])) { + settype($submit_ary[$test], $type); $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test]; } } @@ -562,7 +578,7 @@ class acp_groups 'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0, 'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0, 'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '', - + 'GROUP_SKIP_AUTH' => (!empty($group_row['group_skip_auth'])) ? ' checked="checked"' : '', 'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'], 'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'], @@ -591,8 +607,7 @@ class acp_groups 'U_SWATCH' => append_sid("{$phpbb_admin_path}swatch.$phpEx", 'form=settings&name=group_colour'), 'U_ACTION' => "{$this->u_action}&action=$action&g=$group_id", 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)), - ) - ); + )); return; break; @@ -607,7 +622,7 @@ class acp_groups $this->page_title = 'GROUP_MEMBERS'; // Grab the leaders - always, on every page... - $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending + $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_colour, u.user_posts, u.group_id, ug.group_leader, ug.user_pending FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND u.user_id = ug.user_id @@ -621,11 +636,12 @@ class acp_groups 'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"), 'USERNAME' => $row['username'], + 'USERNAME_COLOUR' => $row['user_colour'], 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', 'USER_POSTS' => $row['user_posts'], - 'USER_ID' => $row['user_id']) - ); + 'USER_ID' => $row['user_id'], + )); } $db->sql_freeresult($result); @@ -662,7 +678,7 @@ class acp_groups )); // Grab the members - $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending + $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND u.user_id = ug.user_id @@ -687,6 +703,7 @@ class acp_groups 'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"), 'USERNAME' => $row['username'], + 'USERNAME_COLOUR' => $row['user_colour'], 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', 'USER_POSTS' => $row['user_posts'], @@ -763,8 +780,7 @@ class acp_groups 'GROUP_NAME' => $group_name, 'TOTAL_MEMBERS' => $row['total_members'], - ) - ); + )); } } } diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 164970b5d5..1dab6febdd 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -963,6 +963,7 @@ class acp_permissions LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.group_id = g.group_id) WHERE ug.user_id = ' . $user_id . ' AND ug.user_pending = 0 + AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) ORDER BY g.group_type DESC, g.group_id DESC'; $result = $db->sql_query($sql); diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php index 1196a9a0f0..2a269c3c80 100644 --- a/phpBB/includes/auth.php +++ b/phpBB/includes/auth.php @@ -608,22 +608,26 @@ class auth // Now grab group settings - non-role specific... $sql_ary[] = 'SELECT ug.user_id, a.forum_id, a.auth_setting, a.auth_option_id' . $sql_opts_select . ' - FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug' . $sql_opts_from . ' + FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug, ' . GROUPS_TABLE . ' g' . $sql_opts_from . ' WHERE a.auth_role_id = 0 ' . (($sql_opts_from) ? 'AND a.auth_option_id = ao.auth_option_id ' : '') . ' AND a.group_id = ug.group_id + AND g.group_id = ug.group_id AND ug.user_pending = 0 + AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) ' . (($sql_user) ? 'AND ug.' . $sql_user : '') . " $sql_forum $sql_opts"; // Now grab group settings - role specific... $sql_ary[] = 'SELECT ug.user_id, a.forum_id, r.auth_setting, r.auth_option_id' . $sql_opts_select . ' - FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug, ' . ACL_ROLES_DATA_TABLE . ' r' . $sql_opts_from . ' + FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug, ' . GROUPS_TABLE . ' g, ' . ACL_ROLES_DATA_TABLE . ' r' . $sql_opts_from . ' WHERE a.auth_role_id = r.role_id ' . (($sql_opts_from) ? 'AND r.auth_option_id = ao.auth_option_id ' : '') . ' AND a.group_id = ug.group_id + AND g.group_id = ug.group_id AND ug.user_pending = 0 + AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) ' . (($sql_user) ? 'AND ug.' . $sql_user : '') . " $sql_forum $sql_opts"; @@ -825,9 +829,11 @@ class auth // Now grab group-specific permission settings $sql = 'SELECT a.forum_id, a.auth_option_id, a.auth_role_id, a.auth_setting - FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug + FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug, ' . GROUPS_TABLE . ' g WHERE a.group_id = ug.group_id + AND g.group_id = ug.group_id AND ug.user_pending = 0 + AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) AND ug.user_id = ' . $user_id; $result = $db->sql_query($sql); diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 52a7017e09..f9a072d1a8 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2137,12 +2137,13 @@ function cache_moderators() // Remove users who have group memberships with DENY moderator permissions $sql = $db->sql_build_query('SELECT', array( - 'SELECT' => 'a.forum_id, ug.user_id', + 'SELECT' => 'a.forum_id, ug.user_id, g.group_id', 'FROM' => array( ACL_OPTIONS_TABLE => 'o', USER_GROUP_TABLE => 'ug', - ACL_GROUPS_TABLE => 'a' + ACL_GROUPS_TABLE => 'a', + GROUPS_TABLE => 'g', ), 'LEFT_JOIN' => array( @@ -2156,6 +2157,8 @@ function cache_moderators() AND ((a.auth_setting = ' . ACL_NEVER . ' AND r.auth_setting IS NULL) OR r.auth_setting = ' . ACL_NEVER . ') AND a.group_id = ug.group_id + AND g.ground_id = ug.group_id + AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . " AND ug.user_pending = 0 AND o.auth_option " . $db->sql_like_expression('m_' . $db->any_char), diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index f8827154c9..5e8108eb64 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2396,24 +2396,9 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow global $phpbb_root_path, $config, $db, $user, $file_upload; $error = array(); - $attribute_ary = array( - 'group_colour' => 'string', - 'group_rank' => 'int', - 'group_avatar' => 'string', - 'group_avatar_type' => 'int', - 'group_avatar_width' => 'int', - 'group_avatar_height' => 'int', - 'group_receive_pm' => 'int', - 'group_legend' => 'int', - 'group_message_limit' => 'int', - 'group_max_recipients' => 'int', - - 'group_founder_manage' => 'int', - ); - - // Those are group-only attributes - $group_only_ary = array('group_receive_pm', 'group_legend', 'group_message_limit', 'group_max_recipients', 'group_founder_manage'); + // Attributes which also affect the users table + $user_attribute_ary = array('group_colour', 'group_rank', 'group_avatar', 'group_avatar_type', 'group_avatar_width', 'group_avatar_height'); // Check data. Limit group name length. if (!utf8_strlen($name) || utf8_strlen($name) > 60) @@ -2451,14 +2436,8 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow if (sizeof($group_attributes)) { - foreach ($attribute_ary as $attribute => $_type) - { - if (isset($group_attributes[$attribute])) - { - settype($group_attributes[$attribute], $_type); - $sql_ary[$attribute] = $group_attributes[$attribute]; - } - } + // Merge them with $sql_ary to properly update the group + $sql_ary = array_merge($sql_ary, $group_attributes); } // Setting the log message before we set the group id (if group gets added) @@ -2483,6 +2462,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow { remove_default_avatar($group_id, $user_ary); } + if (isset($sql_ary['group_rank']) && !$sql_ary['group_rank']) { remove_default_rank($group_id, $user_ary); @@ -2498,6 +2478,32 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow SET group_name = '" . $db->sql_escape($sql_ary['group_name']) . "' WHERE group_id = $group_id"; $db->sql_query($sql); + + // One special case is the group skip auth setting. If this was changed we need to purge permissions for this group + if (isset($group_attributes['group_skip_auth'])) + { + // Get users within this group... + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . ' + WHERE group_id = ' . $group_id . ' + AND user_pending = 0'; + $result = $db->sql_query($sql); + + $user_id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_id_ary[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (!empty($user_id_ary)) + { + global $auth; + + // Clear permissions cache of relevant users + $auth->acl_clear_prefetch($user_id_ary); + } + } } else { @@ -2508,6 +2514,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow if (!$group_id) { $group_id = $db->sql_nextid(); + if (isset($sql_ary['group_avatar_type']) && $sql_ary['group_avatar_type'] == AVATAR_UPLOAD) { group_correct_avatar($group_id, $sql_ary['group_avatar']); @@ -2518,18 +2525,21 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow $sql_ary = array(); if (sizeof($group_attributes)) { - foreach ($attribute_ary as $attribute => $_type) + // Go through the user attributes array, check if a group attribute matches it and then set it. ;) + foreach ($user_attribute_ary as $attribute) { - if (isset($group_attributes[$attribute]) && !in_array($attribute, $group_only_ary)) + if (!isset($group_attributes[$attribute])) { - // If we are about to set an avatar, we will not overwrite user avatars if no group avatar is set... - if (strpos($attribute, 'group_avatar') === 0 && !$group_attributes[$attribute]) - { - continue; - } - - $sql_ary[$attribute] = $group_attributes[$attribute]; + continue; } + + // If we are about to set an avatar, we will not overwrite user avatars if no group avatar is set... + if (strpos($attribute, 'group_avatar') === 0 && !$group_attributes[$attribute]) + { + continue; + } + + $sql_ary[$attribute] = $group_attributes[$attribute]; } } diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 49ebc48684..3f27f093ec 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -606,11 +606,24 @@ class ucp_groups // were made. $group_attributes = array(); - $test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'max_recipients'); - foreach ($test_variables as $test) + $test_variables = array( + 'rank' => 'int', + 'colour' => 'string', + 'avatar' => 'string', + 'avatar_type' => 'int', + 'avatar_width' => 'int', + 'avatar_height' => 'int', + 'receive_pm' => 'int', + 'legend' => 'int', + 'message_limit' => 'int', + 'max_recipients'=> 'int', + ); + + foreach ($test_variables as $test => $type) { - if ($action == 'add' || (isset($submit_ary[$test]) && $group_row['group_' . $test] != $submit_ary[$test])) + if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test])) { + settype($submit_ary[$test], $type); $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test]; } } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 7f1edf2e28..6f7216f82b 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -13,6 +13,9 @@ $updates_to_version = '3.0.6-dev'; // Enter any version to update from to test updates. The version within the db will not be updated. $debug_from_version = false; +// Which oldest version does this updater supports? +$oldest_from_version = '3.0.0'; + // Return if we "just include it" to find out for which version the database update is responsible for if (defined('IN_PHPBB') && defined('IN_INSTALL')) { @@ -685,6 +688,11 @@ function database_update_info() 'log_time' => array('log_time'), ), ), + 'add_columns' => array( + GROUPS_TABLE => array( + 'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'), + ), + ), ), ); } @@ -1991,23 +1999,28 @@ class updater_db_tools switch ($this->sql_layer) { case 'firebird': + // Does not support AFTER statement, only POSITION (and there you need the column position) $statements[] = 'ALTER TABLE ' . $table_name . ' ADD "' . strtoupper($column_name) . '" ' . $column_data['column_type_sql']; break; case 'mssql': + // Does not support AFTER, only through temporary table $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; break; case 'mysql_40': case 'mysql_41': - $statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql']; + $after = (!empty($column_data['after'])) ? ' AFTER ' . $column_data['after'] : ''; + $statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql'] . $after; break; case 'oracle': + // Does not support AFTER, only through temporary table $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql']; break; case 'postgres': + // Does not support AFTER, only through temporary table $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; break; diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index e6041e6c32..c37a038b3a 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -425,6 +425,7 @@ CREATE TABLE phpbb_groups ( group_id INTEGER NOT NULL, group_type INTEGER DEFAULT 1 NOT NULL, group_founder_manage INTEGER DEFAULT 0 NOT NULL, + group_skip_auth INTEGER DEFAULT 0 NOT NULL, group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, group_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, group_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 43c4c06d2d..953dc3d67c 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -25,15 +25,15 @@ CREATE TABLE [phpbb_attachments] ( [mimetype] [varchar] (100) DEFAULT ('') NOT NULL , [filesize] [int] DEFAULT (0) NOT NULL , [filetime] [int] DEFAULT (0) NOT NULL , - [thumbnail] [int] DEFAULT (0) NOT NULL + [thumbnail] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_attachments] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_attachments] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_attachments] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_attachments] PRIMARY KEY CLUSTERED ( [attach_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [filetime] ON [phpbb_attachments]([filetime]) ON [PRIMARY] @@ -60,7 +60,7 @@ CREATE TABLE [phpbb_acl_groups] ( [forum_id] [int] DEFAULT (0) NOT NULL , [auth_option_id] [int] DEFAULT (0) NOT NULL , [auth_role_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL + [auth_setting] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -82,15 +82,15 @@ CREATE TABLE [phpbb_acl_options] ( [auth_option] [varchar] (50) DEFAULT ('') NOT NULL , [is_global] [int] DEFAULT (0) NOT NULL , [is_local] [int] DEFAULT (0) NOT NULL , - [founder_only] [int] DEFAULT (0) NOT NULL + [founder_only] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_acl_options] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_options] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_acl_options] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_options] PRIMARY KEY CLUSTERED ( [auth_option_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE UNIQUE INDEX [auth_option] ON [phpbb_acl_options]([auth_option]) ON [PRIMARY] @@ -105,15 +105,15 @@ CREATE TABLE [phpbb_acl_roles] ( [role_name] [varchar] (255) DEFAULT ('') NOT NULL , [role_description] [varchar] (4000) DEFAULT ('') NOT NULL , [role_type] [varchar] (10) DEFAULT ('') NOT NULL , - [role_order] [int] DEFAULT (0) NOT NULL + [role_order] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_acl_roles] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_roles] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_acl_roles] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_roles] PRIMARY KEY CLUSTERED ( [role_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [role_type] ON [phpbb_acl_roles]([role_type]) ON [PRIMARY] @@ -129,16 +129,16 @@ GO CREATE TABLE [phpbb_acl_roles_data] ( [role_id] [int] DEFAULT (0) NOT NULL , [auth_option_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL + [auth_setting] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_acl_roles_data] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_roles_data] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_acl_roles_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_roles_data] PRIMARY KEY CLUSTERED ( [role_id], [auth_option_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [ath_op_id] ON [phpbb_acl_roles_data]([auth_option_id]) ON [PRIMARY] @@ -153,7 +153,7 @@ CREATE TABLE [phpbb_acl_users] ( [forum_id] [int] DEFAULT (0) NOT NULL , [auth_option_id] [int] DEFAULT (0) NOT NULL , [auth_role_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL + [auth_setting] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -179,15 +179,15 @@ CREATE TABLE [phpbb_banlist] ( [ban_end] [int] DEFAULT (0) NOT NULL , [ban_exclude] [int] DEFAULT (0) NOT NULL , [ban_reason] [varchar] (255) DEFAULT ('') NOT NULL , - [ban_give_reason] [varchar] (255) DEFAULT ('') NOT NULL + [ban_give_reason] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_banlist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_banlist] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_banlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_banlist] PRIMARY KEY CLUSTERED ( [ban_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [ban_end] ON [phpbb_banlist]([ban_end]) ON [PRIMARY] @@ -216,15 +216,15 @@ CREATE TABLE [phpbb_bbcodes] ( [first_pass_match] [text] DEFAULT ('') NOT NULL , [first_pass_replace] [text] DEFAULT ('') NOT NULL , [second_pass_match] [text] DEFAULT ('') NOT NULL , - [second_pass_replace] [text] DEFAULT ('') NOT NULL + [second_pass_replace] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_bbcodes] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bbcodes] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_bbcodes] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bbcodes] PRIMARY KEY CLUSTERED ( [bbcode_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [display_on_post] ON [phpbb_bbcodes]([display_on_posting]) ON [PRIMARY] @@ -236,16 +236,16 @@ GO */ CREATE TABLE [phpbb_bookmarks] ( [topic_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL + [user_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_bookmarks] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bookmarks] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_bookmarks] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bookmarks] PRIMARY KEY CLUSTERED ( [topic_id], [user_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -258,15 +258,15 @@ CREATE TABLE [phpbb_bots] ( [bot_name] [varchar] (255) DEFAULT ('') NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , [bot_agent] [varchar] (255) DEFAULT ('') NOT NULL , - [bot_ip] [varchar] (255) DEFAULT ('') NOT NULL + [bot_ip] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_bots] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bots] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_bots] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bots] PRIMARY KEY CLUSTERED ( [bot_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [bot_active] ON [phpbb_bots]([bot_active]) ON [PRIMARY] @@ -279,15 +279,15 @@ GO CREATE TABLE [phpbb_config] ( [config_name] [varchar] (255) DEFAULT ('') NOT NULL , [config_value] [varchar] (255) DEFAULT ('') NOT NULL , - [is_dynamic] [int] DEFAULT (0) NOT NULL + [is_dynamic] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_config] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_config] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_config] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_config] PRIMARY KEY CLUSTERED ( [config_name] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [is_dynamic] ON [phpbb_config]([is_dynamic]) ON [PRIMARY] @@ -302,16 +302,16 @@ CREATE TABLE [phpbb_confirm] ( [session_id] [char] (32) DEFAULT ('') NOT NULL , [confirm_type] [int] DEFAULT (0) NOT NULL , [code] [varchar] (8) DEFAULT ('') NOT NULL , - [seed] [int] DEFAULT (0) NOT NULL + [seed] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY CLUSTERED ( [session_id], [confirm_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [confirm_type] ON [phpbb_confirm]([confirm_type]) ON [PRIMARY] @@ -323,15 +323,15 @@ GO */ CREATE TABLE [phpbb_disallow] ( [disallow_id] [int] IDENTITY (1, 1) NOT NULL , - [disallow_username] [varchar] (255) DEFAULT ('') NOT NULL + [disallow_username] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY CLUSTERED ( [disallow_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -345,15 +345,15 @@ CREATE TABLE [phpbb_drafts] ( [forum_id] [int] DEFAULT (0) NOT NULL , [save_time] [int] DEFAULT (0) NOT NULL , [draft_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [draft_message] [text] DEFAULT ('') NOT NULL + [draft_message] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_drafts] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_drafts] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_drafts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_drafts] PRIMARY KEY CLUSTERED ( [draft_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [save_time] ON [phpbb_drafts]([save_time]) ON [PRIMARY] @@ -366,15 +366,15 @@ GO CREATE TABLE [phpbb_extensions] ( [extension_id] [int] IDENTITY (1, 1) NOT NULL , [group_id] [int] DEFAULT (0) NOT NULL , - [extension] [varchar] (100) DEFAULT ('') NOT NULL + [extension] [varchar] (100) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_extensions] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_extensions] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_extensions] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_extensions] PRIMARY KEY CLUSTERED ( [extension_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -390,15 +390,15 @@ CREATE TABLE [phpbb_extension_groups] ( [upload_icon] [varchar] (255) DEFAULT ('') NOT NULL , [max_filesize] [int] DEFAULT (0) NOT NULL , [allowed_forums] [varchar] (8000) DEFAULT ('') NOT NULL , - [allow_in_pm] [int] DEFAULT (0) NOT NULL + [allow_in_pm] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_extension_groups] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_extension_groups] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_extension_groups] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_extension_groups] PRIMARY KEY CLUSTERED ( [group_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -446,15 +446,15 @@ CREATE TABLE [phpbb_forums] ( [prune_next] [int] DEFAULT (0) NOT NULL , [prune_days] [int] DEFAULT (0) NOT NULL , [prune_viewed] [int] DEFAULT (0) NOT NULL , - [prune_freq] [int] DEFAULT (0) NOT NULL + [prune_freq] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_forums] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_forums] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums] PRIMARY KEY CLUSTERED ( [forum_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [left_right_id] ON [phpbb_forums]([left_id], [right_id]) ON [PRIMARY] @@ -470,17 +470,17 @@ GO CREATE TABLE [phpbb_forums_access] ( [forum_id] [int] DEFAULT (0) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , - [session_id] [char] (32) DEFAULT ('') NOT NULL + [session_id] [char] (32) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_forums_access] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums_access] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_forums_access] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums_access] PRIMARY KEY CLUSTERED ( [forum_id], [user_id], [session_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -490,16 +490,16 @@ GO CREATE TABLE [phpbb_forums_track] ( [user_id] [int] DEFAULT (0) NOT NULL , [forum_id] [int] DEFAULT (0) NOT NULL , - [mark_time] [int] DEFAULT (0) NOT NULL + [mark_time] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_forums_track] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums_track] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_forums_track] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums_track] PRIMARY KEY CLUSTERED ( [user_id], [forum_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -509,7 +509,7 @@ GO CREATE TABLE [phpbb_forums_watch] ( [forum_id] [int] DEFAULT (0) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , - [notify_status] [int] DEFAULT (0) NOT NULL + [notify_status] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -530,6 +530,7 @@ CREATE TABLE [phpbb_groups] ( [group_id] [int] IDENTITY (1, 1) NOT NULL , [group_type] [int] DEFAULT (1) NOT NULL , [group_founder_manage] [int] DEFAULT (0) NOT NULL , + [group_skip_auth] [int] DEFAULT (0) NOT NULL , [group_name] [varchar] (255) DEFAULT ('') NOT NULL , [group_desc] [varchar] (4000) DEFAULT ('') NOT NULL , [group_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , @@ -546,15 +547,15 @@ CREATE TABLE [phpbb_groups] ( [group_receive_pm] [int] DEFAULT (0) NOT NULL , [group_message_limit] [int] DEFAULT (0) NOT NULL , [group_max_recipients] [int] DEFAULT (0) NOT NULL , - [group_legend] [int] DEFAULT (1) NOT NULL + [group_legend] [int] DEFAULT (1) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_groups] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_groups] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_groups] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_groups] PRIMARY KEY CLUSTERED ( [group_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [group_legend_name] ON [phpbb_groups]([group_legend], [group_name]) ON [PRIMARY] @@ -570,15 +571,15 @@ CREATE TABLE [phpbb_icons] ( [icons_width] [int] DEFAULT (0) NOT NULL , [icons_height] [int] DEFAULT (0) NOT NULL , [icons_order] [int] DEFAULT (0) NOT NULL , - [display_on_posting] [int] DEFAULT (1) NOT NULL + [display_on_posting] [int] DEFAULT (1) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_icons] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_icons] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_icons] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_icons] PRIMARY KEY CLUSTERED ( [icons_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [display_on_posting] ON [phpbb_icons]([display_on_posting]) ON [PRIMARY] @@ -594,15 +595,15 @@ CREATE TABLE [phpbb_lang] ( [lang_dir] [varchar] (30) DEFAULT ('') NOT NULL , [lang_english_name] [varchar] (100) DEFAULT ('') NOT NULL , [lang_local_name] [varchar] (255) DEFAULT ('') NOT NULL , - [lang_author] [varchar] (255) DEFAULT ('') NOT NULL + [lang_author] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_lang] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_lang] PRIMARY KEY CLUSTERED ( [lang_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [lang_iso] ON [phpbb_lang]([lang_iso]) ON [PRIMARY] @@ -622,15 +623,15 @@ CREATE TABLE [phpbb_log] ( [log_ip] [varchar] (40) DEFAULT ('') NOT NULL , [log_time] [int] DEFAULT (0) NOT NULL , [log_operation] [varchar] (4000) DEFAULT ('') NOT NULL , - [log_data] [text] DEFAULT ('') NOT NULL + [log_data] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_log] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_log] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_log] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_log] PRIMARY KEY CLUSTERED ( [log_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [log_type] ON [phpbb_log]([log_type]) ON [PRIMARY] @@ -661,7 +662,7 @@ CREATE TABLE [phpbb_moderator_cache] ( [username] [varchar] (255) DEFAULT ('') NOT NULL , [group_id] [int] DEFAULT (0) NOT NULL , [group_name] [varchar] (255) DEFAULT ('') NOT NULL , - [display_on_index] [int] DEFAULT (1) NOT NULL + [display_on_index] [int] DEFAULT (1) NOT NULL ) ON [PRIMARY] GO @@ -686,15 +687,15 @@ CREATE TABLE [phpbb_modules] ( [right_id] [int] DEFAULT (0) NOT NULL , [module_langname] [varchar] (255) DEFAULT ('') NOT NULL , [module_mode] [varchar] (255) DEFAULT ('') NOT NULL , - [module_auth] [varchar] (255) DEFAULT ('') NOT NULL + [module_auth] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_modules] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_modules] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_modules] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_modules] PRIMARY KEY CLUSTERED ( [module_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [left_right_id] ON [phpbb_modules]([left_id], [right_id]) ON [PRIMARY] @@ -714,7 +715,7 @@ CREATE TABLE [phpbb_poll_options] ( [poll_option_id] [int] DEFAULT (0) NOT NULL , [topic_id] [int] DEFAULT (0) NOT NULL , [poll_option_text] [varchar] (4000) DEFAULT ('') NOT NULL , - [poll_option_total] [int] DEFAULT (0) NOT NULL + [poll_option_total] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -732,7 +733,7 @@ CREATE TABLE [phpbb_poll_votes] ( [topic_id] [int] DEFAULT (0) NOT NULL , [poll_option_id] [int] DEFAULT (0) NOT NULL , [vote_user_id] [int] DEFAULT (0) NOT NULL , - [vote_user_ip] [varchar] (40) DEFAULT ('') NOT NULL + [vote_user_ip] [varchar] (40) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO @@ -775,15 +776,15 @@ CREATE TABLE [phpbb_posts] ( [post_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , [post_edit_user] [int] DEFAULT (0) NOT NULL , [post_edit_count] [int] DEFAULT (0) NOT NULL , - [post_edit_locked] [int] DEFAULT (0) NOT NULL + [post_edit_locked] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_posts] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_posts] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_posts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_posts] PRIMARY KEY CLUSTERED ( [post_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [forum_id] ON [phpbb_posts]([forum_id]) ON [PRIMARY] @@ -829,15 +830,15 @@ CREATE TABLE [phpbb_privmsgs] ( [message_edit_time] [int] DEFAULT (0) NOT NULL , [message_edit_count] [int] DEFAULT (0) NOT NULL , [to_address] [varchar] (4000) DEFAULT ('') NOT NULL , - [bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL + [bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_privmsgs] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_privmsgs] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs] PRIMARY KEY CLUSTERED ( [msg_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [author_ip] ON [phpbb_privmsgs]([author_ip]) ON [PRIMARY] @@ -860,15 +861,15 @@ CREATE TABLE [phpbb_privmsgs_folder] ( [folder_id] [int] IDENTITY (1, 1) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , [folder_name] [varchar] (255) DEFAULT ('') NOT NULL , - [pm_count] [int] DEFAULT (0) NOT NULL + [pm_count] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_privmsgs_folder] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs_folder] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_privmsgs_folder] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs_folder] PRIMARY KEY CLUSTERED ( [folder_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [user_id] ON [phpbb_privmsgs_folder]([user_id]) ON [PRIMARY] @@ -887,15 +888,15 @@ CREATE TABLE [phpbb_privmsgs_rules] ( [rule_user_id] [int] DEFAULT (0) NOT NULL , [rule_group_id] [int] DEFAULT (0) NOT NULL , [rule_action] [int] DEFAULT (0) NOT NULL , - [rule_folder_id] [int] DEFAULT (0) NOT NULL + [rule_folder_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_privmsgs_rules] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs_rules] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_privmsgs_rules] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs_rules] PRIMARY KEY CLUSTERED ( [rule_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [user_id] ON [phpbb_privmsgs_rules]([user_id]) ON [PRIMARY] @@ -915,7 +916,7 @@ CREATE TABLE [phpbb_privmsgs_to] ( [pm_replied] [int] DEFAULT (0) NOT NULL , [pm_marked] [int] DEFAULT (0) NOT NULL , [pm_forwarded] [int] DEFAULT (0) NOT NULL , - [folder_id] [int] DEFAULT (0) NOT NULL + [folder_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -949,15 +950,15 @@ CREATE TABLE [phpbb_profile_fields] ( [field_hide] [int] DEFAULT (0) NOT NULL , [field_no_view] [int] DEFAULT (0) NOT NULL , [field_active] [int] DEFAULT (0) NOT NULL , - [field_order] [int] DEFAULT (0) NOT NULL + [field_order] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_profile_fields] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_profile_fields] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields] PRIMARY KEY CLUSTERED ( [field_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [fld_type] ON [phpbb_profile_fields]([field_type]) ON [PRIMARY] @@ -971,15 +972,15 @@ GO Table: 'phpbb_profile_fields_data' */ CREATE TABLE [phpbb_profile_fields_data] ( - [user_id] [int] DEFAULT (0) NOT NULL + [user_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_profile_fields_data] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields_data] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_profile_fields_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields_data] PRIMARY KEY CLUSTERED ( [user_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -991,17 +992,17 @@ CREATE TABLE [phpbb_profile_fields_lang] ( [lang_id] [int] DEFAULT (0) NOT NULL , [option_id] [int] DEFAULT (0) NOT NULL , [field_type] [int] DEFAULT (0) NOT NULL , - [lang_value] [varchar] (255) DEFAULT ('') NOT NULL + [lang_value] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_profile_fields_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields_lang] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_profile_fields_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields_lang] PRIMARY KEY CLUSTERED ( [field_id], [lang_id], [option_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1013,16 +1014,16 @@ CREATE TABLE [phpbb_profile_lang] ( [lang_id] [int] DEFAULT (0) NOT NULL , [lang_name] [varchar] (255) DEFAULT ('') NOT NULL , [lang_explain] [varchar] (4000) DEFAULT ('') NOT NULL , - [lang_default_value] [varchar] (255) DEFAULT ('') NOT NULL + [lang_default_value] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_profile_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_lang] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_profile_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_lang] PRIMARY KEY CLUSTERED ( [field_id], [lang_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1034,15 +1035,15 @@ CREATE TABLE [phpbb_ranks] ( [rank_title] [varchar] (255) DEFAULT ('') NOT NULL , [rank_min] [int] DEFAULT (0) NOT NULL , [rank_special] [int] DEFAULT (0) NOT NULL , - [rank_image] [varchar] (255) DEFAULT ('') NOT NULL + [rank_image] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_ranks] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_ranks] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_ranks] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_ranks] PRIMARY KEY CLUSTERED ( [rank_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1057,15 +1058,15 @@ CREATE TABLE [phpbb_reports] ( [user_notify] [int] DEFAULT (0) NOT NULL , [report_closed] [int] DEFAULT (0) NOT NULL , [report_time] [int] DEFAULT (0) NOT NULL , - [report_text] [text] DEFAULT ('') NOT NULL + [report_text] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_reports] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_reports] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_reports] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_reports] PRIMARY KEY CLUSTERED ( [report_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1076,15 +1077,15 @@ CREATE TABLE [phpbb_reports_reasons] ( [reason_id] [int] IDENTITY (1, 1) NOT NULL , [reason_title] [varchar] (255) DEFAULT ('') NOT NULL , [reason_description] [text] DEFAULT ('') NOT NULL , - [reason_order] [int] DEFAULT (0) NOT NULL + [reason_order] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_reports_reasons] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_reports_reasons] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_reports_reasons] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_reports_reasons] PRIMARY KEY CLUSTERED ( [reason_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1095,15 +1096,15 @@ CREATE TABLE [phpbb_search_results] ( [search_key] [varchar] (32) DEFAULT ('') NOT NULL , [search_time] [int] DEFAULT (0) NOT NULL , [search_keywords] [text] DEFAULT ('') NOT NULL , - [search_authors] [text] DEFAULT ('') NOT NULL + [search_authors] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_search_results] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_search_results] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_search_results] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_results] PRIMARY KEY CLUSTERED ( [search_key] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1114,15 +1115,15 @@ CREATE TABLE [phpbb_search_wordlist] ( [word_id] [int] IDENTITY (1, 1) NOT NULL , [word_text] [varchar] (255) DEFAULT ('') NOT NULL , [word_common] [int] DEFAULT (0) NOT NULL , - [word_count] [int] DEFAULT (0) NOT NULL + [word_count] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_search_wordlist] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_wordlist] PRIMARY KEY CLUSTERED ( [word_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE UNIQUE INDEX [wrd_txt] ON [phpbb_search_wordlist]([word_text]) ON [PRIMARY] @@ -1138,7 +1139,7 @@ GO CREATE TABLE [phpbb_search_wordmatch] ( [post_id] [int] DEFAULT (0) NOT NULL , [word_id] [int] DEFAULT (0) NOT NULL , - [title_match] [int] DEFAULT (0) NOT NULL + [title_match] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -1168,15 +1169,15 @@ CREATE TABLE [phpbb_sessions] ( [session_page] [varchar] (255) DEFAULT ('') NOT NULL , [session_viewonline] [int] DEFAULT (1) NOT NULL , [session_autologin] [int] DEFAULT (0) NOT NULL , - [session_admin] [int] DEFAULT (0) NOT NULL + [session_admin] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_sessions] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sessions] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_sessions] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sessions] PRIMARY KEY CLUSTERED ( [session_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [session_time] ON [phpbb_sessions]([session_time]) ON [PRIMARY] @@ -1196,16 +1197,16 @@ CREATE TABLE [phpbb_sessions_keys] ( [key_id] [char] (32) DEFAULT ('') NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , [last_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [last_login] [int] DEFAULT (0) NOT NULL + [last_login] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_sessions_keys] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sessions_keys] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_sessions_keys] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sessions_keys] PRIMARY KEY CLUSTERED ( [key_id], [user_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [last_login] ON [phpbb_sessions_keys]([last_login]) ON [PRIMARY] @@ -1219,15 +1220,15 @@ CREATE TABLE [phpbb_sitelist] ( [site_id] [int] IDENTITY (1, 1) NOT NULL , [site_ip] [varchar] (40) DEFAULT ('') NOT NULL , [site_hostname] [varchar] (255) DEFAULT ('') NOT NULL , - [ip_exclude] [int] DEFAULT (0) NOT NULL + [ip_exclude] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_sitelist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sitelist] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_sitelist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sitelist] PRIMARY KEY CLUSTERED ( [site_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1242,15 +1243,15 @@ CREATE TABLE [phpbb_smilies] ( [smiley_width] [int] DEFAULT (0) NOT NULL , [smiley_height] [int] DEFAULT (0) NOT NULL , [smiley_order] [int] DEFAULT (0) NOT NULL , - [display_on_posting] [int] DEFAULT (1) NOT NULL + [display_on_posting] [int] DEFAULT (1) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_smilies] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_smilies] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_smilies] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_smilies] PRIMARY KEY CLUSTERED ( [smiley_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [display_on_post] ON [phpbb_smilies]([display_on_posting]) ON [PRIMARY] @@ -1267,15 +1268,15 @@ CREATE TABLE [phpbb_styles] ( [style_active] [int] DEFAULT (1) NOT NULL , [template_id] [int] DEFAULT (0) NOT NULL , [theme_id] [int] DEFAULT (0) NOT NULL , - [imageset_id] [int] DEFAULT (0) NOT NULL + [imageset_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_styles] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_styles] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles] PRIMARY KEY CLUSTERED ( [style_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE UNIQUE INDEX [style_name] ON [phpbb_styles]([style_name]) ON [PRIMARY] @@ -1302,15 +1303,15 @@ CREATE TABLE [phpbb_styles_template] ( [bbcode_bitfield] [varchar] (255) DEFAULT ('kNg=') NOT NULL , [template_storedb] [int] DEFAULT (0) NOT NULL , [template_inherits_id] [int] DEFAULT (0) NOT NULL , - [template_inherit_path] [varchar] (255) DEFAULT ('') NOT NULL + [template_inherit_path] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_styles_template] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles_template] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_styles_template] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_template] PRIMARY KEY CLUSTERED ( [template_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE UNIQUE INDEX [tmplte_nm] ON [phpbb_styles_template]([template_name]) ON [PRIMARY] @@ -1325,7 +1326,7 @@ CREATE TABLE [phpbb_styles_template_data] ( [template_filename] [varchar] (100) DEFAULT ('') NOT NULL , [template_included] [varchar] (8000) DEFAULT ('') NOT NULL , [template_mtime] [int] DEFAULT (0) NOT NULL , - [template_data] [text] DEFAULT ('') NOT NULL + [template_data] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO @@ -1346,15 +1347,15 @@ CREATE TABLE [phpbb_styles_theme] ( [theme_path] [varchar] (100) DEFAULT ('') NOT NULL , [theme_storedb] [int] DEFAULT (0) NOT NULL , [theme_mtime] [int] DEFAULT (0) NOT NULL , - [theme_data] [text] DEFAULT ('') NOT NULL + [theme_data] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_styles_theme] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles_theme] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_styles_theme] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_theme] PRIMARY KEY CLUSTERED ( [theme_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE UNIQUE INDEX [theme_name] ON [phpbb_styles_theme]([theme_name]) ON [PRIMARY] @@ -1368,15 +1369,15 @@ CREATE TABLE [phpbb_styles_imageset] ( [imageset_id] [int] IDENTITY (1, 1) NOT NULL , [imageset_name] [varchar] (255) DEFAULT ('') NOT NULL , [imageset_copyright] [varchar] (255) DEFAULT ('') NOT NULL , - [imageset_path] [varchar] (100) DEFAULT ('') NOT NULL + [imageset_path] [varchar] (100) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_styles_imageset] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles_imageset] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_styles_imageset] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_imageset] PRIMARY KEY CLUSTERED ( [imageset_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE UNIQUE INDEX [imgset_nm] ON [phpbb_styles_imageset]([imageset_name]) ON [PRIMARY] @@ -1393,15 +1394,15 @@ CREATE TABLE [phpbb_styles_imageset_data] ( [image_lang] [varchar] (30) DEFAULT ('') NOT NULL , [image_height] [int] DEFAULT (0) NOT NULL , [image_width] [int] DEFAULT (0) NOT NULL , - [imageset_id] [int] DEFAULT (0) NOT NULL + [imageset_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_styles_imageset_data] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles_imageset_data] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_styles_imageset_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_imageset_data] PRIMARY KEY CLUSTERED ( [image_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [i_d] ON [phpbb_styles_imageset_data]([imageset_id]) ON [PRIMARY] @@ -1445,15 +1446,15 @@ CREATE TABLE [phpbb_topics] ( [poll_length] [int] DEFAULT (0) NOT NULL , [poll_max_options] [int] DEFAULT (1) NOT NULL , [poll_last_vote] [int] DEFAULT (0) NOT NULL , - [poll_vote_change] [int] DEFAULT (0) NOT NULL + [poll_vote_change] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_topics] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_topics] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics] PRIMARY KEY CLUSTERED ( [topic_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [forum_id] ON [phpbb_topics]([forum_id]) ON [PRIMARY] @@ -1482,16 +1483,16 @@ CREATE TABLE [phpbb_topics_track] ( [user_id] [int] DEFAULT (0) NOT NULL , [topic_id] [int] DEFAULT (0) NOT NULL , [forum_id] [int] DEFAULT (0) NOT NULL , - [mark_time] [int] DEFAULT (0) NOT NULL + [mark_time] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_topics_track] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics_track] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_topics_track] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics_track] PRIMARY KEY CLUSTERED ( [user_id], [topic_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [forum_id] ON [phpbb_topics_track]([forum_id]) ON [PRIMARY] @@ -1504,16 +1505,16 @@ GO CREATE TABLE [phpbb_topics_posted] ( [user_id] [int] DEFAULT (0) NOT NULL , [topic_id] [int] DEFAULT (0) NOT NULL , - [topic_posted] [int] DEFAULT (0) NOT NULL + [topic_posted] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_topics_posted] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics_posted] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_topics_posted] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics_posted] PRIMARY KEY CLUSTERED ( [user_id], [topic_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1523,7 +1524,7 @@ GO CREATE TABLE [phpbb_topics_watch] ( [topic_id] [int] DEFAULT (0) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , - [notify_status] [int] DEFAULT (0) NOT NULL + [notify_status] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -1544,7 +1545,7 @@ CREATE TABLE [phpbb_user_group] ( [group_id] [int] DEFAULT (0) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , [group_leader] [int] DEFAULT (0) NOT NULL , - [user_pending] [int] DEFAULT (1) NOT NULL + [user_pending] [int] DEFAULT (1) NOT NULL ) ON [PRIMARY] GO @@ -1634,15 +1635,15 @@ CREATE TABLE [phpbb_users] ( [user_interests] [varchar] (4000) DEFAULT ('') NOT NULL , [user_actkey] [varchar] (32) DEFAULT ('') NOT NULL , [user_newpasswd] [varchar] (40) DEFAULT ('') NOT NULL , - [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL + [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_users] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_users] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_users] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_users] PRIMARY KEY CLUSTERED ( [user_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [user_birthday] ON [phpbb_users]([user_birthday]) ON [PRIMARY] @@ -1666,15 +1667,15 @@ CREATE TABLE [phpbb_warnings] ( [user_id] [int] DEFAULT (0) NOT NULL , [post_id] [int] DEFAULT (0) NOT NULL , [log_id] [int] DEFAULT (0) NOT NULL , - [warning_time] [int] DEFAULT (0) NOT NULL + [warning_time] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_warnings] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_warnings] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_warnings] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_warnings] PRIMARY KEY CLUSTERED ( [warning_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1684,15 +1685,15 @@ GO CREATE TABLE [phpbb_words] ( [word_id] [int] IDENTITY (1, 1) NOT NULL , [word] [varchar] (255) DEFAULT ('') NOT NULL , - [replacement] [varchar] (255) DEFAULT ('') NOT NULL + [replacement] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_words] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_words] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_words] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_words] PRIMARY KEY CLUSTERED ( [word_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1703,16 +1704,16 @@ CREATE TABLE [phpbb_zebra] ( [user_id] [int] DEFAULT (0) NOT NULL , [zebra_id] [int] DEFAULT (0) NOT NULL , [friend] [int] DEFAULT (0) NOT NULL , - [foe] [int] DEFAULT (0) NOT NULL + [foe] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_zebra] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_zebra] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_zebra] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_zebra] PRIMARY KEY CLUSTERED ( [user_id], [zebra_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 5d3e4db7de..5b78dde036 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -297,6 +297,7 @@ CREATE TABLE phpbb_groups ( group_id mediumint(8) UNSIGNED NOT NULL auto_increment, group_type tinyint(4) DEFAULT '1' NOT NULL, group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, group_name blob NOT NULL, group_desc blob NOT NULL, group_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index f4e6fdefdc..0e8bb96652 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -297,6 +297,7 @@ CREATE TABLE phpbb_groups ( group_id mediumint(8) UNSIGNED NOT NULL auto_increment, group_type tinyint(4) DEFAULT '1' NOT NULL, group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, group_name varchar(255) DEFAULT '' NOT NULL, group_desc text NOT NULL, group_desc_bitfield varchar(255) DEFAULT '' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 64e1f8b8c0..dbe92650ac 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -586,6 +586,7 @@ CREATE TABLE phpbb_groups ( group_id number(8) NOT NULL, group_type number(4) DEFAULT '1' NOT NULL, group_founder_manage number(1) DEFAULT '0' NOT NULL, + group_skip_auth number(1) DEFAULT '0' NOT NULL, group_name varchar2(255) DEFAULT '' , group_desc clob DEFAULT '' , group_desc_bitfield varchar2(255) DEFAULT '' , @@ -822,7 +823,7 @@ CREATE TABLE phpbb_poll_votes ( topic_id number(8) DEFAULT '0' NOT NULL, poll_option_id number(4) DEFAULT '0' NOT NULL, vote_user_id number(8) DEFAULT '0' NOT NULL, - vote_user_ip varchar2(40) DEFAULT '' + vote_user_ip varchar2(40) DEFAULT '' ) / @@ -1466,7 +1467,7 @@ CREATE TABLE phpbb_styles_template_data ( template_filename varchar2(100) DEFAULT '' , template_included clob DEFAULT '' , template_mtime number(11) DEFAULT '0' NOT NULL, - template_data clob DEFAULT '' + template_data clob DEFAULT '' ) / diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 7eccad2585..6eb2aa4ffb 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -440,6 +440,7 @@ CREATE TABLE phpbb_groups ( group_id INT4 DEFAULT nextval('phpbb_groups_seq'), group_type INT2 DEFAULT '1' NOT NULL, group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0), + group_skip_auth INT2 DEFAULT '0' NOT NULL CHECK (group_skip_auth >= 0), group_name varchar_ci DEFAULT '' NOT NULL, group_desc varchar(4000) DEFAULT '' NOT NULL, group_desc_bitfield varchar(255) DEFAULT '' NOT NULL, diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 43f83fc989..1741eae5f2 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -289,6 +289,7 @@ CREATE TABLE phpbb_groups ( group_id INTEGER PRIMARY KEY NOT NULL , group_type tinyint(4) NOT NULL DEFAULT '1', group_founder_manage INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_skip_auth INTEGER UNSIGNED NOT NULL DEFAULT '0', group_name varchar(255) NOT NULL DEFAULT '', group_desc text(65535) NOT NULL DEFAULT '', group_desc_bitfield varchar(255) NOT NULL DEFAULT '', diff --git a/phpBB/language/en/acp/groups.php b/phpBB/language/en/acp/groups.php index db6f334540..a8b17e4d5d 100644 --- a/phpBB/language/en/acp/groups.php +++ b/phpBB/language/en/acp/groups.php @@ -88,16 +88,19 @@ $lang = array_merge($lang, array( 'GROUP_PENDING' => 'Pending members', 'GROUP_MAX_RECIPIENTS' => 'Maximum number of allowed recipients per private message', 'GROUP_MAX_RECIPIENTS_EXPLAIN' => 'The maximum number of allowed recipients in a private message. If 0 is entered, the board-wide setting is used.', + 'GROUP_OPTIONS_SAVE' => 'Group wide options', 'GROUP_PROMOTE' => 'Promote to group leader', 'GROUP_RANK' => 'Group rank', 'GROUP_RECEIVE_PM' => 'Group able to receive private messages', 'GROUP_RECEIVE_PM_EXPLAIN' => 'Please note that hidden groups are not able to be messaged, regardless of this setting.', 'GROUP_REQUEST' => 'Request', 'GROUP_SETTINGS_SAVE' => 'Group wide settings', + 'GROUP_SKIP_AUTH' => 'Excempt group leader from permissions', + 'GROUP_SKIP_AUTH_EXPLAIN' => 'If enabled group leader no longer inherit permissions from the group.', 'GROUP_TYPE' => 'Group type', 'GROUP_TYPE_EXPLAIN' => 'This determines which users can join or view this group.', 'GROUP_UPDATED' => 'Group preferences updated successfully.', - + 'GROUP_USERS_ADDED' => 'New users added to group successfully.', 'GROUP_USERS_EXIST' => 'The selected users are already members.', 'GROUP_USERS_REMOVE' => 'Users removed from group and new defaults set successfully.', From 5d9cf2aa41c61dd35114223006c5e16c104c5a2b Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 19 Jun 2009 12:31:28 +0000 Subject: [PATCH 096/607] Make captchas stricter by oly having one entry per session; fix a bug in ucp_register that caused three captcha instances to be generated. Non-MySQL databases and garbage collecting needs extensive testing. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9626 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 1 + .../captcha/plugins/captcha_abstract.php | 53 ++++++++++--------- phpBB/includes/ucp/ucp_register.php | 14 ++--- phpBB/install/database_update.php | 5 ++ 4 files changed, 42 insertions(+), 31 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 05f1b217a4..e605d60a88 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -983,6 +983,7 @@ function get_schema_struct() 'confirm_type' => array('TINT:3', 0), 'code' => array('VCHAR:8', ''), 'seed' => array('UINT:10', 0), + 'attempts' => array('UINT', 0), ), 'PRIMARY_KEY' => array('session_id', 'confirm_id'), 'KEYS' => array( diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index 1682293c02..6962100945 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -28,6 +28,7 @@ class phpbb_default_captcha var $confirm_code; var $code; var $seed; + var $attempts = 0; var $type; var $solved = false; var $captcha_vars = false; @@ -43,7 +44,7 @@ class phpbb_default_captcha $this->type = (int) $type; - if (!strlen($this->confirm_id)) + if (!strlen($this->confirm_id) || !$this->load_code()) { // we have no confirm ID, better get ready to display something $this->generate_code(); @@ -183,7 +184,6 @@ class phpbb_default_captcha global $config, $db, $user; $error = ''; - $this->confirm_code = request_var('confirm_code', ''); if (!$this->confirm_id) { $error = $user->lang['CONFIRM_CODE_WRONG']; @@ -204,7 +204,7 @@ class phpbb_default_captcha if (strlen($error)) { // okay, incorrect answer. Let's ask a new question. - $this->generate_code(); + $this->new_attempt(); return $error; } else @@ -259,6 +259,29 @@ class phpbb_default_captcha $db->sql_query($sql); } + /** + * New Question, if desired. + */ + function new_attempt() + { + global $db, $user; + + $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->seed = hexdec(substr(unique_id(), 4, 10)); + $this->solved = false; + // compute $seed % 0x7fffffff + $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); + + $sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + 'code' => (string) $this->code, + 'seed' => (int) $this->seed)) . ' + , attempts = attempts + 1 + WHERE + confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' AND + session_id = \'' . $db->sql_escape($user->session_id) . '\''; + $db->sql_query($sql); + } + /** * Look up everything we need for painting&checking. */ @@ -266,7 +289,7 @@ class phpbb_default_captcha { global $db, $user; - $sql = 'SELECT code, seed + $sql = 'SELECT code, seed, attempts FROM ' . CONFIRM_TABLE . " WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' AND session_id = '" . $db->sql_escape($user->session_id) . "' @@ -279,6 +302,7 @@ class phpbb_default_captcha { $this->code = $row['code']; $this->seed = $row['seed']; + $this->attempts = $row['attempts']; return true; } @@ -287,15 +311,6 @@ class phpbb_default_captcha function check_code() { - global $db; - - if (empty($this->code)) - { - if (!$this->load_code()) - { - return false; - } - } return (strcasecmp($this->code, $this->confirm_code) === 0); } @@ -312,17 +327,7 @@ class phpbb_default_captcha function get_attempt_count() { - global $db, $user; - - $sql = 'SELECT COUNT(session_id) AS attempts - FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . $this->type; - $result = $db->sql_query($sql); - $attempts = (int) $db->sql_fetchfield('attempts'); - $db->sql_freeresult($result); - - return $attempts; + return $this->attempts; } function reset() diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 4815329643..e1a924ae58 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -52,13 +52,6 @@ class ucp_register add_form_key('ucp_register_terms'); } - $captcha_solved = false; - if ($config['enable_confirm']) - { - include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']); - $captcha->init(CONFIRM_REG); - } if ($change_lang || $user_lang != $config['default_lang']) { @@ -150,6 +143,13 @@ class ucp_register return; } + $captcha_solved = false; + if ($config['enable_confirm']) + { + include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); + $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_REG); + } // Try to manually determine the timezone and adjust the dst if the server date/time complies with the default setting +/- 1 $timezone = date('Z') / 3600; diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 6f7216f82b..150ef20ca1 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -683,6 +683,11 @@ function database_update_info() // Changes from 3.0.5 '3.0.5' => array( + 'add_columns' => array( + CONFIRM_TABLE => array( + 'attempts' => array('UINT', 0), + ), + ), 'add_index' => array( LOG_TABLE => array( 'log_time' => array('log_time'), From be81ae9e46a5f79742b8f1bbf04ee86927eeff77 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 19 Jun 2009 12:38:08 +0000 Subject: [PATCH 097/607] should fix garbage collection git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9627 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 8c6606d680..b04a73be41 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -955,7 +955,7 @@ class session { include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx); } - captcha_factory::garbage_collect($config['captcha_plugin']); + phpbb_captcha_factory::garbage_collect($config['captcha_plugin']); } return; From 566bd3b791c0cd84940cd8d18cb92acff1b7fc0a Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 19 Jun 2009 12:44:49 +0000 Subject: [PATCH 098/607] props git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9628 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/recaptcha.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/recaptcha.php b/phpBB/language/en/recaptcha.php index 140e300b7b..1ecb23756a 100644 --- a/phpBB/language/en/recaptcha.php +++ b/phpBB/language/en/recaptcha.php @@ -4,7 +4,7 @@ * recaptcha [English] * * @package language -* @version $Id: groups.php 8477 2008-03-29 00:08:34Z naderman $ +* @version $Id$ * @copyright (c) 2008 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * From 7cebffe72fcdbbbad70ccc926192d63a92e426ce Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Fri, 19 Jun 2009 14:58:21 +0000 Subject: [PATCH 099/607] Fixed bug #14304 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9629 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_styles.php | 41 ++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 04d0f91300..f286152d89 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -131,6 +131,7 @@
    103. [Change] Smilies no longer require the f_bbcode permission. (Bug #26545)
    104. [Change] Ability to define column split in FAQ/BBCode help (Bug #31405)
    105. [Change] Changed behaviour of group_create() function to support specifying additional group columns
    106. ++
    107. [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
    108. [Feature] Backported 3.2 captcha plugins.
    109. [Feature] Introduced new ACM plugins:
        diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 4c33aa1edb..16b1852cd6 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -210,23 +210,36 @@ parse_css_file = {PARSE_CSS_FILE} trigger_error($user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); } - $sql = 'UPDATE ' . STYLES_TABLE . ' - SET style_active = ' . (($action == 'activate') ? 1 : 0) . ' - WHERE style_id = ' . $style_id; - $db->sql_query($sql); - - // Set style to default for any member using deactivated style - if ($action == 'deactivate') + if (($action == 'deactivate' && confirm_box(true)) || $action == 'activate') { - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = ' . $config['default_style'] . " - WHERE user_style = $style_id"; + $sql = 'UPDATE ' . STYLES_TABLE . ' + SET style_active = ' . (($action == 'activate') ? 1 : 0) . ' + WHERE style_id = ' . $style_id; $db->sql_query($sql); - $sql = 'UPDATE ' . FORUMS_TABLE . ' - SET forum_style = 0 - WHERE forum_style = ' . $style_id; - $db->sql_query($sql); + // Set style to default for any member using deactivated style + if ($action == 'deactivate') + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . $config['default_style'] . " + WHERE user_style = $style_id"; + $db->sql_query($sql); + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_style = 0 + WHERE forum_style = ' . $style_id; + $db->sql_query($sql); + } + } + elseif ( $action == 'deactivate' ) + { + $s_hidden_fields = array( + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'style_id' => $style_id, + ); + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); } break; } From bdcdf4fc93de034ece3581de3c9f79e7afccc8e1 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 19 Jun 2009 15:07:54 +0000 Subject: [PATCH 100/607] the + is one too much. ;) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9630 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f286152d89..0d6890212e 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -131,7 +131,7 @@
      • [Change] Smilies no longer require the f_bbcode permission. (Bug #26545)
      • [Change] Ability to define column split in FAQ/BBCode help (Bug #31405)
      • [Change] Changed behaviour of group_create() function to support specifying additional group columns
      • -+
      • [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
      • +
      • [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
      • [Feature] Backported 3.2 captcha plugins.
      • [Feature] Introduced new ACM plugins:
          From 6e884de00060c3632e1e7fa25c84c4e602fd46e8 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 19 Jun 2009 15:30:38 +0000 Subject: [PATCH 101/607] Follow coding guidelines for language strings (Related to r9575, Bug #46875 - Patch for acp/board by Raimon). Authorised by: naderman git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9631 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/board.php | 4 ++-- phpBB/language/en/common.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index e1739f229a..50f7ff612e 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -239,14 +239,14 @@ $lang = array_merge($lang, array( 'ACP_FEED_ENABLE' => 'Enable Feeds', 'ACP_FEED_ENABLE_EXPLAIN' => 'Turns on or off ATOM Feeds for the entire board.
          Disabling this switches off all Feeds, no matter how the options below are set.', 'ACP_FEED_LIMIT' => 'Number of items', - 'ACP_FEED_LIMIT_EXPLAI' => 'The maximum number of feed items to display.', + 'ACP_FEED_LIMIT_EXPLAIN' => 'The maximum number of feed items to display.', 'ACP_FEED_OVERALL_FORUMS' => 'Enable overall forums feed', 'ACP_FEED_OVERALL_FORUMS_EXPLAIN' => 'This feed displays the latest posts from all forums topics.', 'ACP_FEED_OVERALL_FORUMS_LIMIT' => 'Number of items per page to display in the forums feed', 'ACP_FEED_OVERALL_TOPIC' => 'Enable overall topics feed', - 'ACP_FEED_OVERALL_TOPIC_EXPLAIN' => 'Enables the "All Topics" feed', + 'ACP_FEED_OVERALL_TOPIC_EXPLAIN' => 'Enables the “All Topics” feed', 'ACP_FEED_OVERALL_TOPIC_LIMIT' => 'Number of items per page to display in the topics feed', 'ACP_FEED_FORUM' => 'Enable Per-Forum Feeds', 'ACP_FEED_FORUM_EXPLAIN' => 'Single forum new posts.', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 9e5de4d61b..8b0e60b75c 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -383,8 +383,8 @@ $lang = array_merge($lang, array( 'NO_ONLINE_USERS' => 'No registered users', 'NO_POSTS' => 'No posts', 'NO_POSTS_TIME_FRAME' => 'No posts exist inside this topic for the selected time frame.', - 'NO_FEED_ENABLED' => 'Feeds are not enabled.', - 'NO_FEED' => 'Couldn\'t find Feed.', + 'NO_FEED_ENABLED' => 'Feeds are not available on this board.', + 'NO_FEED' => 'The requested feed is not available.', 'NO_SUBJECT' => 'No subject specified', // Used for posts having no subject defined but displayed within management pages. 'NO_SUCH_SEARCH_MODULE' => 'The specified search backend doesn’t exist.', 'NO_SUPPORTED_AUTH_METHODS' => 'No supported authentication methods.', From d85a5ad036b2088fe742de29d9464678d2e19e23 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 19 Jun 2009 22:03:19 +0000 Subject: [PATCH 102/607] Fix bug #46785 - Hide avatars if type disabled and give global option to turn on/off Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9632 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 ++ phpBB/includes/acp/acp_board.php | 1 + phpBB/includes/acp/acp_users.php | 13 ++++++++++++- phpBB/includes/functions_display.php | 20 ++++++++++++++++++-- phpBB/includes/ucp/ucp_profile.php | 17 ++++++++++++++--- phpBB/install/database_update.php | 9 +++++++++ phpBB/install/schemas/schema_data.sql | 1 + phpBB/language/en/acp/board.php | 2 ++ phpBB/language/en/acp/users.php | 2 ++ phpBB/language/en/ucp.php | 2 ++ 10 files changed, 63 insertions(+), 6 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 0d6890212e..09062c43b0 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -131,6 +131,7 @@
        • [Change] Smilies no longer require the f_bbcode permission. (Bug #26545)
        • [Change] Ability to define column split in FAQ/BBCode help (Bug #31405)
        • [Change] Changed behaviour of group_create() function to support specifying additional group columns
        • +
        • [Change] Hide avatar when avatar-type is not allowed (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)
        • [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
        • [Feature] Backported 3.2 captcha plugins.
        • [Feature] Introduced new ACM plugins: @@ -144,6 +145,7 @@
        • [Feature] ATOM Feeds (Idea and diversed from RSS Feed 2.0 MOD (Version 1.0.8/9) by leviatan21)
        • [Feature] New groups option to excempt group leaders from group permissions
        • +
        • [Feature] Add new option to disable avatars board-wide (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)

        1.ii. Changes since 3.0.4

        diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 1b812a9c8f..9349dab5f6 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -112,6 +112,7 @@ class acp_board 'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), 'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), + 'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 11bfe12354..cb3ffe5720 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1429,8 +1429,19 @@ class acp_users $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } + if (!$config['allow_avatar'] && $user_row['user_avatar_type']) + { + $error[] = $user->lang['USER_AVATAR_NOT_ALLOWED']; + } + else if ((($user_row['user_avatar_type'] == AVATAR_UPLOAD) && !$config['allow_avatar_upload']) || + (($user_row['user_avatar_type'] == AVATAR_REMOTE) && !$config['allow_avatar_remote']) || + (($user_row['user_avatar_type'] == AVATAR_GALLERY) && !$config['allow_avatar_local'])) + { + $error[] = $user->lang['USER_AVATAR_TYPE_NOT_ALLOWED']; + } + // Generate users avatar - $avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : ''; + $avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height'], 'USER_AVATAR', true) : ''; $display_gallery = (isset($_POST['display_gallery'])) ? true : false; $avatar_select = basename(request_var('avatar_select', '')); diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index fdcc118269..8fa9a5677f 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1200,14 +1200,15 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank * @param string $avatar_width Width of users avatar * @param string $avatar_height Height of users avatar * @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP * * @return string Avatar image */ -function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR') +function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false) { global $user, $config, $phpbb_root_path, $phpEx; - if (empty($avatar) || !$avatar_type) + if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config)) { return ''; } @@ -1217,12 +1218,27 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ switch ($avatar_type) { case AVATAR_UPLOAD: + if (!$config['allow_avatar_upload'] && !$ignore_config) + { + return ''; + } $avatar_img = $phpbb_root_path . "download/file.$phpEx?avatar="; break; case AVATAR_GALLERY: + if (!$config['allow_avatar_local'] && !$ignore_config) + { + return ''; + } $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/'; break; + + case AVATAR_REMOTE: + if (!$config['allow_avatar_remote'] && !$ignore_config) + { + return ''; + } + break; } $avatar_img .= $avatar; diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 572235696e..e2a9699acc 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -578,9 +578,20 @@ class ucp_profile $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } + if (!$config['allow_avatar'] && $user->data['user_avatar_type']) + { + $error[] = $user->lang['AVATAR_NOT_ALLOWED']; + } + else if ((($user->data['user_avatar_type'] == AVATAR_UPLOAD) && !$config['allow_avatar_upload']) || + (($user->data['user_avatar_type'] == AVATAR_REMOTE) && !$config['allow_avatar_remote']) || + (($user->data['user_avatar_type'] == AVATAR_GALLERY) && !$config['allow_avatar_local'])) + { + $error[] = $user->lang['AVATAR_TYPE_NOT_ALLOWED']; + } + $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('
        ', $error) : '', - 'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']), + 'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height'], 'USER_AVATAR', true), 'AVATAR_SIZE' => $config['avatar_filesize'], 'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&mode=avatar&display_gallery=1'), @@ -590,11 +601,11 @@ class ucp_profile 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), )); - if ($display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) + if ($config['allow_avatar'] && $display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) { avatar_gallery($category, $avatar_select, 4); } - else + else if ($config['allow_avatar']) { $avatars_enabled = ($can_upload || ($auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false; diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 150ef20ca1..3848657809 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1115,6 +1115,15 @@ function change_database_data(&$no_updates, $version) $_module->remove_cache_file(); + if ($config['allow_avatar_upload'] || $config['allow_avatar_local'] || $config['allow_avatar_remote']) + { + set_config('allow_avatar', '1'); + } + else + { + set_config('allow_avatar', '0'); + } + $no_updates = false; break; } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index debf1e2289..20025455f6 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -8,6 +8,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('active_sessions', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_attachments', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_autologin', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload', '0'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 50f7ff612e..9ad6015a1f 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -87,6 +87,8 @@ $lang = array_merge($lang, array( $lang = array_merge($lang, array( 'ACP_AVATAR_SETTINGS_EXPLAIN' => 'Avatars are generally small, unique images a user can associate with themselves. Depending on the style they are usually displayed below the username when viewing topics. Here you can determine how users can define their avatars. Please note that in order to upload avatars you need to have created the directory you name below and ensure it can be written to by the web server. Please also note that file size limits are only imposed on uploaded avatars, they do not apply to remotely linked images.', + 'ALLOW_AVATARS' => 'Enable avatars', + 'ALLOW_AVATARS_EXPLAIN' => 'Allow general usage of avatars', 'ALLOW_LOCAL' => 'Enable gallery avatars', 'ALLOW_REMOTE' => 'Enable remote avatars', 'ALLOW_REMOTE_EXPLAIN' => 'Avatars linked to from another website.', diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index dc28032483..01cbbfd81e 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -109,7 +109,9 @@ $lang = array_merge($lang, array( 'USER_ADMIN_MOVE_POSTS' => 'Move all posts', 'USER_ADMIN_SIG_REMOVED' => 'Successfully removed signature from user account.', 'USER_ATTACHMENTS_REMOVED' => 'Successfully removed all attachments made by this user.', + 'USER_AVATAR_NOT_ALLOWED' => 'The avatar cannot be displayed because avatars have been disallowed.', 'USER_AVATAR_UPDATED' => 'Successfully updated user avatars details.', + 'USER_AVATAR_TYPE_NOT_ALLOWED' => 'The current avatar cannot be displayed because its type has been disallowed.', 'USER_CUSTOM_PROFILE_FIELDS' => 'Custom profile fields', 'USER_DELETED' => 'User deleted successfully.', 'USER_GROUP_ADD' => 'Add user to group', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index d6148a737b..a214cc163e 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -93,7 +93,9 @@ $lang = array_merge($lang, array( 'AVATAR_FEATURES_DISABLED' => 'The avatar functionality is currently disabled.', 'AVATAR_GALLERY' => 'Local gallery', 'AVATAR_GENERAL_UPLOAD_ERROR' => 'Could not upload avatar to %s.', + 'AVATAR_NOT_ALLOWED' => 'Your avatar cannot be displayed because avatars have been disallowed.', 'AVATAR_PAGE' => 'Page', + 'AVATAR_TYPE_NOT_ALLOWED' => 'Your current avatar cannot be displayed because its type has been disallowed.', 'BACK_TO_DRAFTS' => 'Back to saved drafts', 'BACK_TO_LOGIN' => 'Back to login screen', From 7d605da65bda85c26d13c810bbfc051b3495b76d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 19 Jun 2009 22:07:27 +0000 Subject: [PATCH 103/607] Fix bug #45805 - INCLUDEPHP not depending on phpbb_root_path Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9633 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_template.php | 2 +- phpBB/includes/template.php | 47 +++++++++++++++++++-------- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 09062c43b0..60be634427 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -132,6 +132,7 @@
      • [Change] Ability to define column split in FAQ/BBCode help (Bug #31405)
      • [Change] Changed behaviour of group_create() function to support specifying additional group columns
      • [Change] Hide avatar when avatar-type is not allowed (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)
      • +
      • [Change] INCLUDEPHP not depending on phpbb_root_path (Bug #45805 - Patch by nickvergessen)
      • [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
      • [Feature] Backported 3.2 captcha plugins.
      • [Feature] Introduced new ACM plugins: diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index d9d9abfe46..a951579db5 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -640,7 +640,7 @@ class template_compile */ function compile_tag_include_php($tag_args) { - return "include('" . $tag_args . "');"; + return "\$this->_php_include('$tag_args');"; } /** diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index 0098c484bd..0263783849 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -55,7 +55,7 @@ class template { $this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'; $this->cachepath = $phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_'; - + if ($user->theme['template_inherits_id']) { $this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template'; @@ -105,13 +105,13 @@ class template $this->filename[$handle] = $filename; $this->files[$handle] = $this->root . '/' . $filename; - + if ($this->inherit_root) { $this->files_inherit[$handle] = $this->inherit_root . '/' . $filename; } } - + return true; } @@ -209,7 +209,7 @@ class template return true; } - + /** * Load a compiled template if possible, if not, recompile it * @access private @@ -220,7 +220,7 @@ class template $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . $phpEx; $this->files_template[$handle] = $user->theme['template_id']; - + $recompile = false; if (!file_exists($filename) || @filesize($filename) === 0) { @@ -236,7 +236,7 @@ class template } $recompile = (@filemtime($filename) < filemtime($this->files[$handle])) ? true : false; } - + // Recompile page if the original template is newer, otherwise load the compiled version if (!$recompile) { @@ -249,14 +249,14 @@ class template { include($phpbb_root_path . 'includes/functions_template.' . $phpEx); } - + // Inheritance - we point to another template file for this one. Equality is also used for store_db if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'] && !file_exists($this->files[$handle])) { $this->files[$handle] = $this->files_inherit[$handle]; $this->files_template[$handle] = $user->theme['template_inherits_id']; } - + $compile = new template_compile($this); // If we don't have a file assigned to this handle, die. @@ -282,7 +282,7 @@ class template $ids[] = $user->theme['template_inherits_id']; } $ids[] = $user->theme['template_id']; - + foreach ($ids as $id) { $sql = 'SELECT * @@ -290,7 +290,7 @@ class template WHERE template_id = ' . $id . " AND (template_filename = '" . $db->sql_escape($this->filename[$handle]) . "' OR template_included " . $db->sql_like_expression($db->any_char . $this->filename[$handle] . ':' . $db->any_char) . ')'; - + $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { @@ -298,7 +298,7 @@ class template } $db->sql_freeresult($result); } - + if (sizeof($rows)) { foreach ($rows as $row) @@ -326,7 +326,7 @@ class template { $this->files_template[$row['template_filename']] = $user->theme['template_id']; } - + if ($force_reload || $row['template_mtime'] < filemtime($file)) { if ($row['template_filename'] == $this->filename[$handle]) @@ -468,7 +468,7 @@ class template { unset($this->_tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']); } - + // Add a new iteration to this block with the variable assignments we were given. $this->_tpldata[$blockname][] = $vararray; } @@ -511,7 +511,7 @@ class template // Nested blocks are not supported return false; } - + // Change key to zero (change first position) if false and to last position if true if ($key === false || $key === true) { @@ -614,6 +614,25 @@ class template eval(' ?>' . $this->compiled_code[$handle] . '_php_include(): File ' . htmlspecialchars($file) . ' does not exist or is empty'; + return; + } + include($file); + } } ?> \ No newline at end of file From ab5194ced44e4718ef7db1edf2cc516ce22e0838 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Sat, 20 Jun 2009 16:08:14 +0000 Subject: [PATCH 104/607] Fix bug #43005 - Imageset Export/Import Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9634 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/subsilver2/imageset/imageset.cfg | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 60be634427..1189ae8b5d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -123,6 +123,7 @@
      • [Fix] Do not throw an error when PDO is a shared module and not loaded preventing SQLite from being loaded.
      • [Fix] Fix unicode words wrong censoring. (Bug #16555 - Patch by rxu)
      • [Fix] Display coloured usernames in ACP groups management screens
      • +
      • [Fix] Correct the width value for poll_center.gif omitted in imageset.cfg for subsilver2. (Bug #43005 - Patch by rxu)
      • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
      • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
      • [Change] Template engine now permits to a limited extent variable includes.
      • diff --git a/phpBB/styles/subsilver2/imageset/imageset.cfg b/phpBB/styles/subsilver2/imageset/imageset.cfg index 3462d3ae66..d4189770f5 100644 --- a/phpBB/styles/subsilver2/imageset/imageset.cfg +++ b/phpBB/styles/subsilver2/imageset/imageset.cfg @@ -25,7 +25,7 @@ version = 3.0.5 img_site_logo = site_logo.gif*94*170 img_upload_bar = upload_bar.gif*16*280 img_poll_left = poll_left.gif*12*4 -img_poll_center = poll_center.gif*12* +img_poll_center = poll_center.gif*12*1 img_poll_right = poll_right.gif*12*4 img_icon_friend = img_icon_foe = From 0d626d77bfaebb7e7e281e963b486911470f0992 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 20 Jun 2009 16:51:01 +0000 Subject: [PATCH 105/607] Fix bug #46865 - Add unapproved topic icon for moderators on forum list Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9635 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_display.php | 9 +++++++-- phpBB/language/en/common.php | 1 + phpBB/styles/prosilver/template/forumlist_body.html | 1 + phpBB/styles/subsilver2/template/forumlist_body.html | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 1189ae8b5d..3455022da9 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -148,6 +148,7 @@
      • [Feature] ATOM Feeds (Idea and diversed from RSS Feed 2.0 MOD (Version 1.0.8/9) by leviatan21)
      • [Feature] New groups option to excempt group leaders from group permissions
      • [Feature] Add new option to disable avatars board-wide (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)
      • +
      • [Feature] Add unapproved topic icon for moderators on forum list (Bug #46865 - Patch by nickvergessen)

      1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 8fa9a5677f..d3244e7111 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -154,6 +154,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_tracking_info[$forum_id] = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; } + // Count the difference of real to public topics, so we can display an information to moderators + $row['forum_topics_unapproved'] = ($auth->acl_get('m_approve', $forum_id)) ? $row['forum_topics_real'] - $row['forum_topics'] : 0; $row['forum_topics'] = ($auth->acl_get('m_approve', $forum_id)) ? $row['forum_topics_real'] : $row['forum_topics']; // Display active topics from this forum? @@ -212,6 +214,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $subforums[$parent_id][$row['parent_id']]['children'][] = $forum_id; } + $forum_rows[$parent_id]['forum_topics_unapproved'] += $row['forum_topics_unapproved']; $forum_rows[$parent_id]['forum_topics'] += $row['forum_topics']; // Do not list redirects in LINK Forums as Posts. @@ -451,6 +454,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'L_FORUM_FOLDER_ALT' => $folder_alt, 'L_MODERATOR_STR' => $l_moderator, + 'U_UNAPPROVED_TOPICS' => ($row['forum_topics_unapproved'] > 0) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_topics&f=' . $row['forum_id']) : '', 'U_VIEWFORUM' => $u_viewforum, 'U_LAST_POSTER' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'U_LAST_POST' => $last_post_url) @@ -473,8 +477,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . '&f=' . $root_data['forum_id'] . '&mark=forums') : '', 'S_HAS_SUBFORUM' => ($visible_forums) ? true : false, 'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'], - 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST')) - ); + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPICS_UNAPPROVED'), + )); if ($return_moderators) { diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 8b0e60b75c..e708fd6339 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -602,6 +602,7 @@ $lang = array_merge($lang, array( 'TOPIC' => 'Topic', 'TOPICS' => 'Topics', + 'TOPICS_UNAPPROVED' => 'At least one topic in this forum has not been approved.', 'TOPIC_ICON' => 'Topic icon', 'TOPIC_LOCKED' => 'This topic is locked, you cannot edit posts or make further replies.', 'TOPIC_LOCKED_SHORT'=> 'Topic locked', diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html index f19f3c3075..c6cbe29cf4 100644 --- a/phpBB/styles/prosilver/template/forumlist_body.html +++ b/phpBB/styles/prosilver/template/forumlist_body.html @@ -41,6 +41,7 @@
      {forumrow.TOPICS} {L_TOPICS}
      {forumrow.POSTS} {L_POSTS}
      + {UNAPPROVED_IMG} {L_LAST_POST} {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL} {LAST_POST_IMG}
      {forumrow.LAST_POST_TIME}{L_NO_POSTS}
       
      diff --git a/phpBB/styles/subsilver2/template/forumlist_body.html b/phpBB/styles/subsilver2/template/forumlist_body.html index 368610ebe1..e42c5b09c3 100644 --- a/phpBB/styles/subsilver2/template/forumlist_body.html +++ b/phpBB/styles/subsilver2/template/forumlist_body.html @@ -58,7 +58,7 @@

      {forumrow.POSTS}

      -

      {forumrow.LAST_POST_TIME}

      +

      {UNAPPROVED_IMG} {forumrow.LAST_POST_TIME}

      {forumrow.LAST_POSTER_FULL} {LAST_POST_IMG}

      From 433de350c0fa2e1e09c23e6f5f29f118222d2df8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 20 Jun 2009 18:45:16 +0000 Subject: [PATCH 106/607] - [Feature] New "Newly Registered Users" group for assigning permissions to newly registered users. They will be removed from this group once they reach a defineable amount of posts. - [Feature] Ability to define if the "Newly Registered Users" group will be assigned as the default group to newly registered users. As a coincidence also Bug #46535 got fixed. Additionally the error message displayed with trigger_error() if accessing the private message tab in the ucp is now displayed inline in addition to a slightly different message for newly registered users to let them know that access permissions may be lifted over time. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9636 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 2 +- phpBB/docs/CHANGELOG.html | 2 + phpBB/includes/acp/acp_board.php | 4 +- phpBB/includes/auth/auth_apache.php | 1 + phpBB/includes/auth/auth_ldap.php | 1 + phpBB/includes/functions.php | 1 + phpBB/includes/functions_convert.php | 3 +- phpBB/includes/functions_posting.php | 4 +- phpBB/includes/functions_user.php | 36 ++++- phpBB/includes/session.php | 61 ++++++++ phpBB/includes/ucp/ucp_pm.php | 8 +- phpBB/includes/ucp/ucp_pm_viewfolder.php | 3 +- phpBB/includes/ucp/ucp_register.php | 5 + phpBB/install/database_update.php | 141 +++++++++++++++++- phpBB/install/schemas/schema_data.sql | 23 ++- phpBB/language/en/acp/board.php | 14 +- phpBB/language/en/acp/permissions.php | 5 + phpBB/language/en/common.php | 3 + phpBB/language/en/ucp.php | 2 +- phpBB/posting.php | 4 +- .../prosilver/template/ucp_pm_viewfolder.html | 2 + .../template/ucp_pm_viewfolder.html | 6 +- 22 files changed, 300 insertions(+), 31 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index e605d60a88..efe442f006 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1853,7 +1853,7 @@ function get_schema_struct() 'user_actkey' => array('VCHAR:32', ''), 'user_newpasswd' => array('VCHAR_UNI:40', ''), 'user_form_salt' => array('VCHAR_UNI:32', ''), - + 'user_new' => array('BOOL', 1), ), 'PRIMARY_KEY' => 'user_id', 'KEYS' => array( diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3455022da9..007964e6d5 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -147,6 +147,8 @@
    110. [Feature] ATOM Feeds (Idea and diversed from RSS Feed 2.0 MOD (Version 1.0.8/9) by leviatan21)
    111. [Feature] New groups option to excempt group leaders from group permissions
    112. +
    113. [Feature] New "Newly Registered Users" group for assigning permissions to newly registered users. They will be removed from this group once they reach a defineable amount of posts.
    114. +
    115. [Feature] Ability to define if the "Newly Registered Users" group will be assigned as the default group to newly registered users.
    116. [Feature] Add new option to disable avatars board-wide (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)
    117. [Feature] Add unapproved topic icon for moderators on forum list (Bug #46865 - Patch by nickvergessen)
    118. diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 9349dab5f6..7866b1b81f 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -171,8 +171,6 @@ class acp_board 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'POSTING', - 'enable_queue_trigger' => array('lang' => 'ENABLE_QUEUE_TRIGGER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'queue_trigger_posts' => array('lang' => 'QUEUE_TRIGGER_POSTS', 'validate' => 'int:0:250', 'type' => 'text:4:4', 'explain' => true), 'bump_type' => false, 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), @@ -229,6 +227,8 @@ class acp_board 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,), 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_acc_activation', 'explain' => true), + 'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']), + 'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true), 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true), diff --git a/phpBB/includes/auth/auth_apache.php b/phpBB/includes/auth/auth_apache.php index 930f5a0632..391e7abb0e 100644 --- a/phpBB/includes/auth/auth_apache.php +++ b/phpBB/includes/auth/auth_apache.php @@ -217,6 +217,7 @@ function user_row_apache($username, $password) 'group_id' => (int) $row['group_id'], 'user_type' => USER_NORMAL, 'user_ip' => $user->ip, + 'user_new' => ($config['new_member_post_limit']) ? 1 : 0, ); } diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index d49662fb2d..11c62ad0bc 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -227,6 +227,7 @@ function login_ldap(&$username, &$password) 'group_id' => (int) $row['group_id'], 'user_type' => USER_NORMAL, 'user_ip' => $user->ip, + 'user_new' => ($config['new_member_post_limit']) ? 1 : 0, ); unset($ldap_result); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e55a76fbb0..7b4f991965 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3795,6 +3795,7 @@ function page_header($page_title = '', $display_online_list = true) 'S_USER_NEW_PRIVMSG' => $user->data['user_new_privmsg'], 'S_USER_UNREAD_PRIVMSG' => $user->data['user_unread_privmsg'], + 'S_USER_NEW' => $user->data['user_new'], 'SID' => $SID, '_SID' => $_SID, diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 2213df7d0f..f6710ded30 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1698,7 +1698,8 @@ function add_default_groups() 'REGISTERED_COPPA' => array('', 0, 0), 'GLOBAL_MODERATORS' => array('00AA00', 1, 0), 'ADMINISTRATORS' => array('AA0000', 1, 1), - 'BOTS' => array('9E8DA7', 0, 0) + 'BOTS' => array('9E8DA7', 0, 0), + 'NEWLY_REGISTERED' => array('', 0, 0), ); $sql = 'SELECT * diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 07c8944992..e0dc128583 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1620,8 +1620,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // This variable indicates if the user is able to post or put into the queue - it is used later for all code decisions regarding approval $post_approval = 1; - // Check the permissions for post approval, as well as the queue trigger where users are put on approval with a post count lower than specified. Moderators are not affected. - if ((($config['enable_queue_trigger'] && $user->data['user_posts'] < $config['queue_trigger_posts']) || !$auth->acl_get('f_noapprove', $data['forum_id'])) && !$auth->acl_get('m_approve', $data['forum_id'])) + // Check the permissions for post approval. Moderators are not affected. + if (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id'])) { $post_approval = 0; } diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 5e8108eb64..17534376de 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -188,6 +188,8 @@ function user_add($user_row, $cp_data = false) 'user_regdate' => time(), 'user_passchg' => time(), 'user_options' => 895, + // We do not set the new flag here - registration scripts need to specify it + 'user_new' => 0, 'user_inactive_reason' => 0, 'user_inactive_time' => 0, @@ -275,6 +277,31 @@ function user_add($user_row, $cp_data = false) // Now make it the users default group... group_set_user_default($user_row['group_id'], array($user_id), false); + // Add to newly registered users group if user_new is 1 + if ($config['new_member_post_limit'] && $sql_ary['user_new']) + { + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'NEWLY_REGISTERED' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $add_group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if ($add_group_id) + { + // Add user to "newly registered users" group and set to default group if admin specified so. + if ($config['new_member_group_default']) + { + group_user_add($add_group_id, $user_id, false, false, true); + } + else + { + group_user_add($add_group_id, $user_id); + } + } + } + // set the newest user and adjust the user count if the user is a normal user and no activation mail is sent if ($user_row['user_type'] == USER_NORMAL) { @@ -2867,7 +2894,7 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, { if (isset($sql_where_ary[$gid]) && sizeof($sql_where_ary[$gid])) { - remove_default_rank($gid, $sql_where_ary[$gid]); + remove_default_rank($group_id, $sql_where_ary[$gid]); remove_default_avatar($group_id, $sql_where_ary[$gid]); group_set_user_default($gid, $sql_where_ary[$gid], $default_data_ary); } @@ -2889,7 +2916,10 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $log = 'LOG_GROUP_REMOVE'; - add_log('admin', $log, $group_name, implode(', ', $username_ary)); + if ($group_name) + { + add_log('admin', $log, $group_name, implode(', ', $username_ary)); + } group_update_listings($group_id); @@ -3283,7 +3313,7 @@ function get_group_name($group_id) $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - if (!$row) + if (!$row || ($row['group_type'] == GROUP_SPECIAL && empty($user->lang))) { return ''; } diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index b04a73be41..6b87bcc866 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -396,6 +396,11 @@ class session WHERE session_id = '" . $db->sql_escape($this->session_id) . "'"; $db->sql_query($sql); } + + if ($this->data['user_id'] != ANONYMOUS && !empty($config['new_member_post_limit']) && $this->data['user_new'] && $config['new_member_post_limit'] <= $this->data['user_posts']) + { + $this->leave_newly_registered(); + } } $this->data['is_registered'] = ($this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false; @@ -2234,6 +2239,62 @@ class user extends session return $var; } } + + /** + * Funtion to make the user leave the NEWLY_REGISTERED system group. + * @access public + */ + function leave_newly_registered() + { + global $db; + + if (!function_exists('group_user_del')) + { + global $phpbb_root_path, $phpEx; + + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'NEWLY_REGISTERED' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if (!$group_id) + { + return false; + } + + // We need to call group_user_del here, because this function makes sure everything is correctly changed. + // A downside for a call within the session handler is that the language is not set up yet - so no log entry + group_user_del($group_id, $this->data['user_id']); + + // Set user_new to 0 to let this not be triggered again + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new = 0 + WHERE user_id = ' . $this->data['user_id']; + $db->sql_query($sql); + + $this->data['user_permissions'] = ''; + $this->data['user_new'] = 0; + + // The new users group was the users default group? + if ($this->data['group_id'] == $group_id) + { + // Which group is now the users default one? + $sql = 'SELECT group_id + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $this->data['user_id']; + $result = $db->sql_query($sql); + $this->data['group_id'] = $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + } + + return true; + } } ?> \ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php index b4ac0c11da..6ac02c7d0a 100644 --- a/phpBB/includes/ucp/ucp_pm.php +++ b/phpBB/includes/ucp/ucp_pm.php @@ -119,7 +119,13 @@ class ucp_pm if (!$auth->acl_get('u_sendpm')) { - trigger_error('NO_AUTH_SEND_MESSAGE'); + // trigger_error('NO_AUTH_SEND_MESSAGE'); + $template->assign_vars(array( + 'S_NO_AUTH_SEND_MESSAGE' => true, + )); + + $tpl_file = 'ucp_pm_viewfolder'; + break; } include($phpbb_root_path . 'includes/ucp/ucp_pm_compose.' . $phpEx); diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index cb96b77754..b2ceb30f9e 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -504,8 +504,9 @@ function get_pm_from($folder_id, $folder, $user_id) 'TOTAL_MESSAGES' => (($pm_count == 1) ? $user->lang['VIEW_PM_MESSAGE'] : sprintf($user->lang['VIEW_PM_MESSAGES'], $pm_count)), 'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'), + 'L_NO_MESSAGES' => (!$auth->acl_get('u_sendpm')) ? $user->lang['NO_AUTH_SEND_MESSAGE'] : $user->lang['NO_MESSAGES'], - 'L_NO_MESSAGES' => (!$auth->acl_get('u_sendpm')) ? $user->lang['POST_PM_LOCKED'] : $user->lang['NO_MESSAGES'], + 'S_NO_AUTH_SEND_MESSAGE' => !$auth->acl_get('u_sendpm'), 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index e1a924ae58..e0dc0222f5 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -310,6 +310,11 @@ class ucp_register 'user_inactive_time' => $user_inactive_time, ); + if ($config['new_member_post_limit']) + { + $user_row['user_new'] = 1; + } + // Register user... $user_id = user_add($user_row, $cp_data); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 3848657809..44bcf2a112 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -687,17 +687,18 @@ function database_update_info() CONFIRM_TABLE => array( 'attempts' => array('UINT', 0), ), + USERS_TABLE => array( + 'user_new' => array('BOOL', 1), + ), + GROUPS_TABLE => array( + 'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'), + ), ), 'add_index' => array( LOG_TABLE => array( 'log_time' => array('log_time'), ), ), - 'add_columns' => array( - GROUPS_TABLE => array( - 'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'), - ), - ), ), ); } @@ -1115,6 +1116,136 @@ function change_database_data(&$no_updates, $version) $_module->remove_cache_file(); + // Add newly_registered group... but check if it already exists (we always supported running the updater on any schema) + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'NEWLY_REGISTERED'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if (!$group_id) + { + $sql = 'INSERT INTO ' . GROUPS_TABLE . " (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5)"; + _sql($sql, $errored, $error_ary); + + $group_id = $db->sql_nextid(); + } + + // Insert new user role... at the end of the chain + $sql = 'SELECT role_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_name = 'ROLE_USER_NEW_MEMBER' + AND role_type = 'u_'"; + $result = $db->sql_query($sql); + $u_role = (int) $db->sql_fetchfield('role_id'); + $db->sql_freeresult($result); + + if (!$u_role) + { + $sql = 'SELECT MAX(role_order) as max_order_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_type = 'u_'"; + $result = $db->sql_query($sql); + $next_order_id = (int) $db->sql_fetchfield('max_order_id'); + $db->sql_freeresult($result); + + $next_order_id++; + + $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', $next_order_id)"; + _sql($sql, $errored, $error_ary); + $u_role = $db->sql_nextid(); + + if (!$errored) + { + // Now add the correct data to the roles... + // The standard role says that new users are not able to send a PM, Mass PM, are not able to PM groups + $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')"; + _sql($sql, $errored, $error_ary); + + // Add user role to group + $sql = 'INSERT INTO ' . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES ($group_id, 0, 0, $u_role, 0)"; + _sql($sql, $errored, $error_ary); + } + } + + // Insert new forum role + $sql = 'SELECT role_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_name = 'ROLE_FORUM_NEW_MEMBER' + AND role_type = 'f_'"; + $result = $db->sql_query($sql); + $f_role = (int) $db->sql_fetchfield('role_id'); + $db->sql_freeresult($result); + + if (!$f_role) + { + $sql = 'SELECT MAX(role_order) as max_order_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_type = 'f_'"; + $result = $db->sql_query($sql); + $next_order_id = (int) $db->sql_fetchfield('max_order_id'); + $db->sql_freeresult($result); + + $next_order_id++; + + $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', $next_order_id)"; + _sql($sql, $errored, $error_ary); + $f_role = $db->sql_nextid(); + + if (!$errored) + { + $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $f_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove')"; + _sql($sql, $errored, $error_ary); + } + } + + // Set every members user_new column to 0 (old users) + $sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0'; + _sql($sql, $errored, $error_ary); + + // Newly registered users limit + if (!isset($config['new_member_post_limit'])) + { + set_config('new_member_post_limit', (!empty($config['enable_queue_trigger'])) ? $config['queue_trigger_posts'] : 0); + } + + if (!isset($config['new_member_group_default'])) + { + set_config('new_member_group_default', 0); + } + + // To mimick the old "feature" we will assign the forum role to every forum, regardless of the setting (this makes sure there are no "this does not work!!!! YUO!!!" posts... + // Check if the role is already assigned... + $sql = 'SELECT forum_id + FROM ' . ACL_GROUPS_TABLE . ' + WHERE group_id = ' . $group_id . ' + AND auth_role_id = ' . $f_role; + $result = $db->sql_query($sql); + $is_options = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + // Not assigned at all... :/ + if (!$is_options) + { + // Get postable forums + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type != ' . FORUM_LINK; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + _sql('INSERT INTO ' . ACL_GROUPS_TABLE . ' (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (' . $group_id . ', ' . (int) $row['forum_id'] . ', 0, ' . $f_role . ', 0)', $errored, $error_ary); + } + $db->sql_freeresult($result); + } + + // Clear permissions... + include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + $auth_admin = new auth_admin(); + $auth_admin->acl_clear_prefetch(); + if ($config['allow_avatar_upload'] || $config['allow_avatar_local'] || $config['allow_avatar_remote']) { set_config('allow_avatar', '1'); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 20025455f6..100809ec24 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -94,7 +94,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_pm_icons', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_post_confirm', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_queue_trigger', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_enable', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_limit', '10'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_forums', '1'); @@ -194,6 +193,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_name_chars', ' INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_pass_chars', '6'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_author_chars', '3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('new_member_post_limit', '3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('new_member_group_default', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('pass_complex', 'PASS_TYPE_ANY'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_edit_time', '0'); @@ -203,7 +204,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_recipients' INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page', '10'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('print_pm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '600'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_trigger_posts', '3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ranks_path', 'images/ranks'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('referer_validation', '1'); @@ -412,6 +412,11 @@ INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_POLLS', 'ROLE_DESCRIPTION_FORUM_POLLS', 'f_', 6); INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_LIMITED_POLLS', 'ROLE_DESCRIPTION_FORUM_LIMITED_POLLS', 'f_', 4); +# 23 +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', 6); + +# 24 +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', 10); # -- phpbb_styles INSERT INTO phpbb_styles (style_name, style_copyright, style_active, template_id, theme_id, imageset_id) VALUES ('prosilver', '© phpBB Group', 1, 1, 1, 1); @@ -513,6 +518,7 @@ INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_co INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GLOBAL_MODERATORS', 3, 0, '00AA00', 1, '', '', '', 0); INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('ADMINISTRATORS', 3, 1, 'AA0000', 1, '', '', '', 0); INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('BOTS', 3, 0, '9E8DA7', 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5); # -- User -> Group INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (1, 1, 0, 0); @@ -594,6 +600,13 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT # Limited Access + Polls (f_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg'); +# New Member (u_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 23, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group'); + +# New Member (f_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 24, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove'); + + # Permissions # GUESTS - u_download and u_search ability @@ -644,6 +657,12 @@ INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, # Bots having bot access INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (6, 2, 0, 19, 0); +# NEW MEMBERS aren't allowed to PM +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (7, 0, 0, 23, 0); + +# NEW MEMBERS on the queue +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (7, 2, 0, 24, 0); + # -- Demo Topic INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_subject, topic_last_post_time, topic_last_view_time, poll_title) VALUES ('{L_TOPICS_TOPIC_TITLE}', 2, 972086460, 0, 0, 0, 2, 0, 0, 1, 'Admin', 'AA0000', 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, 972086460, ''); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 9ad6015a1f..4c3d5326ab 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -142,11 +142,6 @@ $lang = array_merge($lang, array( 'ALLOW_POST_FLASH' => 'Allow use of [FLASH] BBCode tag in posts', 'ALLOW_POST_FLASH_EXPLAIN' => 'If disallowed the [FLASH] BBCode tag is disabled in posts. Otherwise the permission system controls which users can use the [FLASH] BBCode tag.', - 'ENABLE_QUEUE_TRIGGER' => 'Enable queued posts', - 'ENABLE_QUEUE_TRIGGER_EXPLAIN' => 'Ability to put registered users posts to post approval if their post count is lower than the specified value below. This setting has no effect on the permission setting for post/topic approval.', - 'QUEUE_TRIGGER_POSTS' => 'Maximum post count for queued posts', - 'QUEUE_TRIGGER_POSTS_EXPLAIN' => 'If queued posts is enabled, this is the post count the user need to reach in order to post without post approval. If the users post count is below this number, the post is stored in the queue automatically.', - 'BUMP_INTERVAL' => 'Bump interval', 'BUMP_INTERVAL_EXPLAIN' => 'Number of minutes, hours or days between the last post to a topic and the ability to bump this topic.', 'CHAR_LIMIT' => 'Maximum characters per post', @@ -199,8 +194,13 @@ $lang = array_merge($lang, array( $lang = array_merge($lang, array( 'ACP_REGISTER_SETTINGS_EXPLAIN' => 'Here you are able to define registration and profile related settings.', - 'ACC_ACTIVATION' => 'Account activation', - 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations.', + 'ACC_ACTIVATION' => 'Account activation', + 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations.', + 'NEW_MEMBER_POST_LIMIT' => 'New member post limit', + 'NEW_MEMBER_POST_LIMIT_EXPLAIN' => 'New members are within the Newly Registered Users group until they reach this number of posts. You can use this group to keep them from using the PM system or to review their posts. A value of 0 disables this feature.', + 'NEW_MEMBER_GROUP_DEFAULT' => 'Set Newly Registered Users group to default', + 'NEW_MEMBER_GROUP_DEFAULT_EXPLAIN' => 'If set to yes and a new member post limit is specified newly registered users will be not only put into the Newly Registered Users group, but this group also being their default one. This may come in handy if you want to assign a group default rank and/or avatar the user then inherits.', + 'ACC_ADMIN' => 'By Admin', 'ACC_DISABLE' => 'Disable', 'ACC_NONE' => 'None', diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php index 920643d927..4ca11cf9db 100644 --- a/phpBB/language/en/acp/permissions.php +++ b/phpBB/language/en/acp/permissions.php @@ -164,6 +164,7 @@ $lang = array_merge($lang, array( 'ROLE_FORUM_POLLS' => 'Standard Access + Polls', 'ROLE_FORUM_READONLY' => 'Read Only Access', 'ROLE_FORUM_STANDARD' => 'Standard Access', + 'ROLE_FORUM_NEW_MEMBER' => 'Newly registered User', 'ROLE_MOD_FULL' => 'Full Moderator', 'ROLE_MOD_QUEUE' => 'Queue Moderator', 'ROLE_MOD_SIMPLE' => 'Simple Moderator', @@ -173,6 +174,8 @@ $lang = array_merge($lang, array( 'ROLE_USER_NOAVATAR' => 'No Avatar', 'ROLE_USER_NOPM' => 'No Private Messages', 'ROLE_USER_STANDARD' => 'Standard Features', + 'ROLE_USER_NEW_MEMBER' => 'Newly registered User', + 'ROLE_DESCRIPTION_ADMIN_FORUM' => 'Can access the forum management and forum permission settings.', 'ROLE_DESCRIPTION_ADMIN_FULL' => 'Has access to all administrative functions of this board.
      Not recommended.', @@ -187,6 +190,7 @@ $lang = array_merge($lang, array( 'ROLE_DESCRIPTION_FORUM_POLLS' => 'Like Standard Access but can also create polls.', 'ROLE_DESCRIPTION_FORUM_READONLY' => 'Can read the forum, but cannot create new topics or reply to posts.', 'ROLE_DESCRIPTION_FORUM_STANDARD' => 'Can use most forum features including attachments and deleting own topics, but cannot lock own topics, and cannot create polls.', + 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains never permissions to lock features for new users.', 'ROLE_DESCRIPTION_MOD_FULL' => 'Can use all moderating features, including banning.', 'ROLE_DESCRIPTION_MOD_QUEUE' => 'Can use the Moderation Queue to validate and edit posts, but nothing else.', 'ROLE_DESCRIPTION_MOD_SIMPLE' => 'Can only use basic topic actions. Cannot send warnings or use moderation queue.', @@ -196,6 +200,7 @@ $lang = array_merge($lang, array( 'ROLE_DESCRIPTION_USER_NOAVATAR' => 'Has a limited feature set and is not allowed to use the Avatar feature.', 'ROLE_DESCRIPTION_USER_NOPM' => 'Has a limited feature set, and is not allowed to use Private Messages.', 'ROLE_DESCRIPTION_USER_STANDARD' => 'Can access most but not all user features. Cannot change user name or ignore the flood limit, for instance.', + 'ROLE_DESCRIPTION_USER_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains never permissions to lock features for new users.', 'ROLE_DESCRIPTION_EXPLAIN' => 'You are able to enter a short explanation of what the role is doing or for what it is meant for. The text you enter here will be displayed within the permissions screens too.', 'ROLE_DESCRIPTION_LONG' => 'The role description is too long, please limit it to 4000 characters.', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index e708fd6339..6f3433892a 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -250,6 +250,7 @@ $lang = array_merge($lang, array( 'G_REGISTERED' => 'Registered users', 'G_REGISTERED_COPPA' => 'Registered COPPA users', 'G_GLOBAL_MODERATORS' => 'Global moderators', + 'G_NEWLY_REGISTERED' => 'Newly registered users', 'HIDDEN_USERS_ONLINE' => '%d hidden users online', 'HIDDEN_USERS_TOTAL' => '%d hidden', @@ -649,6 +650,8 @@ $lang = array_merge($lang, array( 'USERS' => 'Users', 'USE_PERMISSIONS' => 'Test out user’s permissions', + 'USER_NEW_PERMISSION_DISALLOWED' => 'We are sorry, but you are not authorised to use this feature. You may have just registered here and may need to participate more to be able to use this feature.', + 'VARIANT_DATE_SEPARATOR' => ' / ', // Used in date format dropdown, eg: "Today, 13:37 / 01 Jan 2007, 13:37" ... to join a relative date with calendar date 'VIEWED' => 'Viewed', 'VIEWING_FAQ' => 'Viewing FAQ', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index a214cc163e..4b1b4f4913 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -352,7 +352,7 @@ $lang = array_merge($lang, array( 'POST_EDIT_PM' => 'Edit message', 'POST_FORWARD_PM' => 'Forward message', 'POST_NEW_PM' => 'Compose message', - 'POST_PM_LOCKED' => 'Private messaging is locked', + 'POST_PM_LOCKED' => 'Private messaging is locked.', 'POST_PM_POST' => 'Quote post', 'POST_QUOTE_PM' => 'Quote message', 'POST_REPLY_PM' => 'Reply to message', diff --git a/phpBB/posting.php b/phpBB/posting.php index 4b715a66a2..90d5755003 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1026,8 +1026,8 @@ if ($submit || $preview || $refresh) $captcha->reset(); } - // Check the permissions for post approval, as well as the queue trigger where users are put on approval with a post count lower than specified. Moderators are not affected. - if ((($config['enable_queue_trigger'] && $user->data['user_posts'] < $config['queue_trigger_posts']) || !$auth->acl_get('f_noapprove', $data['forum_id'])) && !$auth->acl_get('m_approve', $data['forum_id'])) + // Check the permissions for post approval. Moderators are not affected. + if (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id'])) { meta_refresh(10, $redirect_url); $message = ($mode == 'edit') ? $user->lang['POST_EDITED_MOD'] : $user->lang['POST_STORED_MOD']; diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index a8750a03f0..1b7e52480a 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -82,6 +82,8 @@ + +

      {L_USER_NEW_PERMISSION_DISALLOWED}{L_NO_AUTH_SEND_MESSAGE}

      {L_NO_MESSAGES}

      diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html b/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html index 36998f18c1..c86211bc7e 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html @@ -37,7 +37,7 @@ - + @@ -74,7 +74,7 @@ - {messagerow.ATTACH_ICON_IMG} + {messagerow.ATTACH_ICON_IMG} {L_MESSAGE_REMOVED_FROM_OUTBOX}
      {L_DELETE_MESSAGE} @@ -92,7 +92,7 @@
      - +
      {L_NO_MESSAGES}{L_USER_NEW_PERMISSION_DISALLOWED}{L_NO_MESSAGES}
      From c3da86afc6be7183cdf320fe6ff0f6f5ffe46c28 Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Sat, 20 Jun 2009 19:23:02 +0000 Subject: [PATCH 107/607] Fixed bug #45735 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9637 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_language.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 007964e6d5..7054f58022 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -124,6 +124,7 @@
    119. [Fix] Fix unicode words wrong censoring. (Bug #16555 - Patch by rxu)
    120. [Fix] Display coloured usernames in ACP groups management screens
    121. [Fix] Correct the width value for poll_center.gif omitted in imageset.cfg for subsilver2. (Bug #43005 - Patch by rxu)
    122. +
    123. [Fix] Correctly load complex language variable using acp_language (Bug #45735 - Patch by leviatan21)
    124. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    125. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    126. [Change] Template engine now permits to a limited extent variable includes.
    127. diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 71970b4b50..3eee702b1d 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -1254,7 +1254,7 @@ $lang = array_merge($lang, array( $keys = func_get_args(); $non_static = array_shift($keys); - $value = array_shift($keys); + $value = utf8_normalize_nfc(array_shift($keys)); if (!$non_static) { From 5ea9f6e3fc82ba39bbfde03b61a868d3c7b94f45 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 20 Jun 2009 22:38:39 +0000 Subject: [PATCH 108/607] Fix bug #31975 - Enhance obtain_users_online_string to be able to return user-lists for other session-items Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9638 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 59 +++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7054f58022..f3278dcfc1 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -151,6 +151,7 @@
    128. [Feature] New "Newly Registered Users" group for assigning permissions to newly registered users. They will be removed from this group once they reach a defineable amount of posts.
    129. [Feature] Ability to define if the "Newly Registered Users" group will be assigned as the default group to newly registered users.
    130. [Feature] Add new option to disable avatars board-wide (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)
    131. +
    132. [Feature] Enhance obtain_users_online_string to be able to return user-lists for other session-items (Bug #31975 - Patch by nickvergessen)
    133. [Feature] Add unapproved topic icon for moderators on forum list (Bug #46865 - Patch by nickvergessen)
    134. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 7b4f991965..c5216f7f6f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3439,16 +3439,17 @@ function msg_handler($errno, $msg_text, $errfile, $errline) /** * Queries the session table to get information about online guests -* @param int $forum_id Limits the search to the forum with this id +* @param int $item_id Limits the search to the item with this id +* @param string $item The name of the item which is stored in the session table as session_{$item}_id * @return int The number of active distinct guest sessions */ -function obtain_guest_count($forum_id = 0) +function obtain_guest_count($item_id = 0, $item = 'forum') { global $db, $config; - if ($forum_id) + if ($item_id) { - $reading_sql = ' AND s.session_forum_id = ' . (int) $forum_id; + $reading_sql = ' AND s.session_' . $item . '_id = ' . (int) $item_id; } else { @@ -3486,17 +3487,18 @@ function obtain_guest_count($forum_id = 0) /** * Queries the session table to get information about online users -* @param int $forum_id Limits the search to the forum with this id +* @param int $item_id Limits the search to the item with this id +* @param string $item The name of the item which is stored in the session table as session_{$item}_id * @return array An array containing the ids of online, hidden and visible users, as well as statistical info */ -function obtain_users_online($forum_id = 0) +function obtain_users_online($item_id = 0, $item = 'forum') { global $db, $config, $user; $reading_sql = ''; - if ($forum_id !== 0) + if ($item !== 0) { - $reading_sql = ' AND s.session_forum_id = ' . (int) $forum_id; + $reading_sql = ' AND s.session_' . $item . '_id = ' . (int) $item_id; } $online_users = array( @@ -3510,7 +3512,7 @@ function obtain_users_online($forum_id = 0) if ($config['load_online_guests']) { - $online_users['guests_online'] = obtain_guest_count($forum_id); + $online_users['guests_online'] = obtain_guest_count($item_id, $item); } // a little discrete magic to cache this for 30 seconds @@ -3549,14 +3551,17 @@ function obtain_users_online($forum_id = 0) /** * Uses the result of obtain_users_online to generate a localized, readable representation. * @param mixed $online_users result of obtain_users_online - array with user_id lists for total, hidden and visible users, and statistics -* @param int $forum_id Indicate that the data is limited to one forum and not global. +* @param int $item_id Indicate that the data is limited to one item and not global +* @param string $item The name of the item which is stored in the session table as session_{$item}_id * @return array An array containing the string for output to the template */ -function obtain_users_online_string($online_users, $forum_id = 0) +function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum') { global $config, $db, $user, $auth; $user_online_link = $online_userlist = ''; + // Need caps version of $item for language-strings + $item_caps = strtoupper($item); if (sizeof($online_users['online_users'])) { @@ -3591,18 +3596,18 @@ function obtain_users_online_string($online_users, $forum_id = 0) $online_userlist = $user->lang['NO_ONLINE_USERS']; } - if ($forum_id === 0) + if ($item_id === 0) { $online_userlist = $user->lang['REGISTERED_USERS'] . ' ' . $online_userlist; } else if ($config['load_online_guests']) { - $l_online = ($online_users['guests_online'] === 1) ? $user->lang['BROWSING_FORUM_GUEST'] : $user->lang['BROWSING_FORUM_GUESTS']; + $l_online = ($online_users['guests_online'] === 1) ? $user->lang['BROWSING_' . $item_caps . '_GUEST'] : $user->lang['BROWSING_' . $item_caps . '_GUESTS']; $online_userlist = sprintf($l_online, $online_userlist, $online_users['guests_online']); } else { - $online_userlist = sprintf($user->lang['BROWSING_FORUM'], $online_userlist); + $online_userlist = sprintf($user->lang['BROWSING_' . $item_caps], $online_userlist); } // Build online listing $vars_online = array( @@ -3700,10 +3705,28 @@ function page_header($page_title = '', $display_online_list = true) if ($config['load_online'] && $config['load_online_time'] && $display_online_list) { - $f = request_var('f', 0); - $f = max($f, 0); - $online_users = obtain_users_online($f); - $user_online_strings = obtain_users_online_string($online_users, $f); + /** + * Load online data: + * For obtaining another session column use the following code, whereby the column is session_{$item}_id. + * Put the code directly after $item = 'forum'; + * + * + * $my_item_id = request_var('my_item_id', 0); + * + * if ($my_item_id > 0) + * { + * // would revolve to the column session_myitem_id in the SESSIONS_TABLE + * $item = 'myitem'; + * $item_id = $my_item_id; + * } + * + */ + + $item_id = max(request_var('f', 0), 0); + $item = 'forum'; + + $online_users = obtain_users_online($item_id, $item); + $user_online_strings = obtain_users_online_string($online_users, $item_id, $item); $l_online_users = $user_online_strings['l_online_users']; $online_userlist = $user_online_strings['online_userlist']; From 9d56fa5e7087fc6cdfe4448bd17d5f02929aff7c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 20 Jun 2009 22:41:46 +0000 Subject: [PATCH 109/607] Fix bug #37015 - PMs - message history opacity Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9639 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/ucp_pm_history.html | 4 ++-- phpBB/styles/prosilver/theme/colours.css | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/styles/prosilver/template/ucp_pm_history.html b/phpBB/styles/prosilver/template/ucp_pm_history.html index d4ef61c4a9..88efcf95be 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_history.html +++ b/phpBB/styles/prosilver/template/ucp_pm_history.html @@ -17,9 +17,9 @@

      class="current">{history_row.SUBJECT}

      -

      {history_row.MINI_POST_IMG} {L_SENT_AT}: {history_row.SENT_DATE}
      +

      {history_row.MINI_POST_IMG} {L_SENT_AT}: {history_row.SENT_DATE}
      {L_MESSAGE_BY_AUTHOR} {history_row.MESSAGE_AUTHOR_FULL}

      -
      {history_row.MESSAGE}
      +
      {history_row.MESSAGE}
      diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 638f148ef9..28749dc0c4 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -865,7 +865,7 @@ dl.mini dt { ----------------------------------------*/ /* PM Message history */ .current { - color: #999999 !important; + color: #000000 !important; } /* PM marking colours */ From 050567483f8646a58b91e4abeb2bf61f735b0526 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 21 Jun 2009 09:36:13 +0000 Subject: [PATCH 110/607] Ability to fetch moderators with get_moderators() even if load_moderators setting is off. (Bug #35955) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9640 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_display.php | 34 ++++++++++++---------------- phpBB/posting.php | 5 +++- phpBB/viewforum.php | 5 +++- phpBB/viewtopic.php | 5 +++- 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f3278dcfc1..55eff22d74 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -135,6 +135,7 @@
    135. [Change] Changed behaviour of group_create() function to support specifying additional group columns
    136. [Change] Hide avatar when avatar-type is not allowed (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)
    137. [Change] INCLUDEPHP not depending on phpbb_root_path (Bug #45805 - Patch by nickvergessen)
    138. +
    139. [Change] Ability to fetch moderators with get_moderators() even if load_moderators setting is off. (Bug #35955)
    140. [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
    141. [Feature] Backported 3.2 captcha plugins.
    142. [Feature] Introduced new ACM plugins: diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index d3244e7111..57f416bee4 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -663,14 +663,7 @@ function get_moderators(&$forum_moderators, $forum_id = false) { global $config, $template, $db, $phpbb_root_path, $phpEx, $user, $auth; - // Have we disabled the display of moderators? If so, then return - // from whence we came ... - if (!$config['load_moderators']) - { - return; - } - - $forum_sql = ''; + $forum_id_ary = array(); if ($forum_id !== false) { @@ -679,13 +672,8 @@ function get_moderators(&$forum_moderators, $forum_id = false) $forum_id = array($forum_id); } - // If we don't have a forum then we can't have a moderator - if (!sizeof($forum_id)) - { - return; - } - - $forum_sql = 'AND m.' . $db->sql_in_set('forum_id', $forum_id); + // Exchange key/value pair to be able to faster check for the forum id existence + $forum_id_ary = array_flip($forum_id); } $sql_array = array( @@ -706,17 +694,25 @@ function get_moderators(&$forum_moderators, $forum_id = false) ), ), - 'WHERE' => "m.display_on_index = 1 $forum_sql", + 'WHERE' => 'm.display_on_index = 1', ); + // We query every forum here because for caching we should not have any parameter. $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query($sql, 3600); while ($row = $db->sql_fetchrow($result)) { + $f_id = (int) $row['forum_id']; + + if (!isset($forum_id_ary[$f_id])) + { + continue; + } + if (!empty($row['user_id'])) { - $forum_moderators[$row['forum_id']][] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); + $forum_moderators[$f_id][] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); } else { @@ -724,11 +720,11 @@ function get_moderators(&$forum_moderators, $forum_id = false) if ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) { - $forum_moderators[$row['forum_id']][] = '' . $group_name . ''; + $forum_moderators[$f_id][] = '' . $group_name . ''; } else { - $forum_moderators[$row['forum_id']][] = '' . $group_name . ''; + $forum_moderators[$f_id][] = '' . $group_name . ''; } } } diff --git a/phpBB/posting.php b/phpBB/posting.php index 90d5755003..9f63e43345 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1183,7 +1183,10 @@ if (sizeof($post_data['poll_options']) && $post_data['poll_title']) // Forum moderators? $moderators = array(); -get_moderators($moderators, $forum_id); +if ($config['load_moderators']) +{ + get_moderators($moderators, $forum_id); +} // Generate smiley listing generate_smilies('inline', $forum_id); diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 507ea18d24..1a2333ac8b 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -135,7 +135,10 @@ if ($forum_data['left_id'] != $forum_data['right_id'] - 1) else { $template->assign_var('S_HAS_SUBFORUM', false); - get_moderators($moderators, $forum_id); + if ($config['load_moderators']) + { + get_moderators($moderators, $forum_id); + } } // Dump out the page header and load viewforum template diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index aedf464248..0387ae3a05 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -550,7 +550,10 @@ generate_forum_rules($topic_data); // Moderators $forum_moderators = array(); -get_moderators($forum_moderators, $forum_id); +if ($config['load_moderators']) +{ + get_moderators($forum_moderators, $forum_id); +} // This is only used for print view so ... $server_path = (!$view) ? $phpbb_root_path : generate_board_url() . '/'; From f056e205add6b956b2e63a28a1d0b4062671c490 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 21 Jun 2009 10:40:52 +0000 Subject: [PATCH 111/607] rename user_id in confirm_box to confirm_uid. We are able to do this because confirm_box is completely transparent to the outside. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9641 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c5216f7f6f..dd82f9e53d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2496,7 +2496,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo if ($check && $confirm) { - $user_id = request_var('user_id', 0); + $user_id = request_var('confirm_uid', 0); $session_id = request_var('sess', ''); $confirm_key = request_var('confirm_key', ''); @@ -2518,10 +2518,10 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo } $s_hidden_fields = build_hidden_fields(array( - 'user_id' => $user->data['user_id'], - 'sess' => $user->session_id, - 'sid' => $user->session_id) - ); + 'confirm_uid' => $user->data['user_id'], + 'sess' => $user->session_id, + 'sid' => $user->session_id, + )); // generate activation key $confirm_key = gen_rand_string(10); From 37a054897fe42179f65e1fa87db4720760a2d6fc Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 21 Jun 2009 10:46:28 +0000 Subject: [PATCH 112/607] Fix bug #37235 - Correctly describe founder permissions on trace-information Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9642 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/language/en/acp/permissions.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 55eff22d74..47171ef4cb 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -123,6 +123,7 @@
    143. [Fix] Do not throw an error when PDO is a shared module and not loaded preventing SQLite from being loaded.
    144. [Fix] Fix unicode words wrong censoring. (Bug #16555 - Patch by rxu)
    145. [Fix] Display coloured usernames in ACP groups management screens
    146. +
    147. [Fix] Correctly describe founder permissions on trace-information (Bug #37235 - Patch by nickvergessen)
    148. [Fix] Correct the width value for poll_center.gif omitted in imageset.cfg for subsilver2. (Bug #43005 - Patch by rxu)
    149. [Fix] Correctly load complex language variable using acp_language (Bug #45735 - Patch by leviatan21)
    150. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    151. diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php index 4ca11cf9db..929caf7d38 100644 --- a/phpBB/language/en/acp/permissions.php +++ b/phpBB/language/en/acp/permissions.php @@ -246,7 +246,7 @@ $lang = array_merge($lang, array( 'TRACE_USER_GLOBAL_YES_TOTAL_NEVER' => 'The forum independent user permission evaluates to YES which overwrites the current local result NEVER. %sTrace global permission%s', 'TRACE_USER_GLOBAL_NEVER_TOTAL_KEPT' => 'The forum independent user permission evaluates to NEVER which doesn’t influence the local permission. %sTrace global permission%s', - 'TRACE_USER_FOUNDER' => 'The user has the founder type set, therefore admin permissions are set to YES by default.', + 'TRACE_USER_FOUNDER' => 'The user is a founder, therefore admin permissions are always set to YES.', 'TRACE_USER_KEPT' => 'The user’s permission is NO so the old total value is kept.', 'TRACE_USER_KEPT_LOCAL' => 'The user’s permission for this forum is NO so the old total value is kept.', 'TRACE_USER_NEVER_TOTAL_NEVER' => 'The user’s permission is set to NEVER and the total value is set to NEVER, so nothing is changed.', From 8e59781b73e492ef01c6ab3bf75341f355fbbb94 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 21 Jun 2009 10:48:14 +0000 Subject: [PATCH 113/607] Fix bug #44225 - Bad language-string on "Stick topic for X days" Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9643 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index b3acb7f290..8733fc5b10 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -184,7 +184,7 @@ $lang = array_merge($lang, array( 'SMILIES_ARE_ON' => 'Smilies are ON', 'STICKY_ANNOUNCE_TIME_LIMIT'=> 'Sticky/Announcement time limit', 'STICK_TOPIC_FOR' => 'Stick topic for', - 'STICK_TOPIC_FOR_EXPLAIN' => 'Enter 0 or leave blank for a never ending Sticky/Announcement.', + 'STICK_TOPIC_FOR_EXPLAIN' => 'Enter 0 or leave blank for a never ending Sticky/Announcement. Please note that this number is relative to the date of the post.', 'STYLES_TIP' => 'Tip: Styles can be applied quickly to selected text.', 'TOO_FEW_CHARS' => 'Your message contains too few characters.', From afc0ef93c51f659247f4942a3691405d95947383 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 21 Jun 2009 11:13:20 +0000 Subject: [PATCH 114/607] add check to newly registered function to not execute this more than once git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9644 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/session.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 6b87bcc866..4dc6933236 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -2248,6 +2248,11 @@ class user extends session { global $db; + if (empty($this->data['user_new'])) + { + return false; + } + if (!function_exists('group_user_del')) { global $phpbb_root_path, $phpEx; From c2c79d8297369fa461976061e0b7b95dd8c8a721 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Sun, 21 Jun 2009 13:31:26 +0000 Subject: [PATCH 115/607] fix the captcha ACP, restore xhtml compliance for recaptcha (#46195) - note, that this will not work in IE git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9645 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/captcha_gd_acp.html | 3 ++- phpBB/adm/style/captcha_recaptcha.html | 16 +++++++++++----- phpBB/adm/style/captcha_recaptcha_acp.html | 2 +- .../captcha/plugins/phpbb_recaptcha_plugin.php | 2 +- .../prosilver/template/captcha_recaptcha.html | 14 +++++++++----- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/phpBB/adm/style/captcha_gd_acp.html b/phpBB/adm/style/captcha_gd_acp.html index ea7a851be3..f4755a37da 100755 --- a/phpBB/adm/style/captcha_gd_acp.html +++ b/phpBB/adm/style/captcha_gd_acp.html @@ -54,8 +54,9 @@

      {L_WARNING}

      {L_CAPTCHA_PREVIEW_MSG}

      + -{CAPTCHA_PREVIEW} +
      diff --git a/phpBB/adm/style/captcha_recaptcha.html b/phpBB/adm/style/captcha_recaptcha.html index f325c3727d..0cb43cf01f 100644 --- a/phpBB/adm/style/captcha_recaptcha.html +++ b/phpBB/adm/style/captcha_recaptcha.html @@ -1,5 +1,6 @@ -
      +
      +
      - -
      {L_RECAPTCHA_NOT_AVAILABLE} diff --git a/phpBB/adm/style/captcha_recaptcha_acp.html b/phpBB/adm/style/captcha_recaptcha_acp.html index 07751d1d03..78f035a01d 100644 --- a/phpBB/adm/style/captcha_recaptcha_acp.html +++ b/phpBB/adm/style/captcha_recaptcha_acp.html @@ -31,7 +31,7 @@

      {L_CAPTCHA_PREVIEW_MSG}

      -{CAPTCHA_PREVIEW} +
      diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index bd8fbce0fa..50a456179b 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -107,7 +107,7 @@ class phpbb_recaptcha extends phpbb_default_captcha } $template->assign_vars(array( - 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), + 'CAPTCHA_PREVIEW' => $this->get_demo_template(), 'CAPTCHA_NAME' => $this->get_class_name(), )); diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index 5272fa50ef..0cb43cf01f 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -1,5 +1,6 @@ -
      +
      +
      -
      -
      + +
      {L_RECAPTCHA_NOT_AVAILABLE} From 794e122cfa01539e912786455da59e25d459a56f Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Sun, 21 Jun 2009 14:31:00 +0000 Subject: [PATCH 116/607] add quicktool to remove users from the newly registered special group. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9646 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_users.php | 30 +++++++++++++ phpBB/includes/functions_user.php | 73 +++++++++++++++++++++++++++++++ phpBB/includes/session.php | 41 +++-------------- phpBB/language/en/acp/common.php | 2 + phpBB/language/en/acp/users.php | 2 + 5 files changed, 112 insertions(+), 36 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index cb3ffe5720..fd64025565 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -650,6 +650,28 @@ class acp_users trigger_error($user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); break; + + case 'leave_nr': + + if (confirm_box(true)) + { + remove_newly_registered($user_id, $user_row); + + add_log('admin', 'LOG_USER_REMOVED_NR', $user_row['username']); + trigger_error($user->lang['USER_LIFTED_NR'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + + break; } // Handle registration info updates @@ -821,6 +843,10 @@ class acp_users if ($user_id == $user->data['user_id']) { $quick_tool_ary = array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH'); + if ($user_row['user_new']) + { + $quick_tool_ary['leave_nr'] = 'LEAVE_NR'; + } } else { @@ -842,6 +868,10 @@ class acp_users { $quick_tool_ary['reactivate'] = 'FORCE'; } + if ($user_row['user_new']) + { + $quick_tool_ary['leave_nr'] = 'LEAVE_NR'; + } } $s_action_options = ''; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 17534376de..bb54a14262 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -3456,4 +3456,77 @@ function group_update_listings($group_id) } } + + +/** +* Funtion to make a user leave the NEWLY_REGISTERED system group. +* @access public +* @param $user_id The id of the user to remove from the group +*/ +function remove_newly_registered($user_id, $user_data = false) +{ + global $db; + + if ($user_data === false) + { + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + return false; + } + else + { + $user_data = $user_row; + } + } + + if (empty($user_data['user_new'])) + { + return false; + } + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'NEWLY_REGISTERED' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if (!$group_id) + { + return false; + } + + // We need to call group_user_del here, because this function makes sure everything is correctly changed. + // A downside for a call within the session handler is that the language is not set up yet - so no log entry + group_user_del($group_id, $user_id); + + // Set user_new to 0 to let this not be triggered again + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new = 0 + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + + // The new users group was the users default group? + if ($user_data['group_id'] == $group_id) + { + // Which group is now the users default one? + $sql = 'SELECT group_id + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $user_data['group_id'] = $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + } + + return $user_data['group_id']; +} + ?> \ No newline at end of file diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 4dc6933236..f74a7c5acc 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -2253,51 +2253,20 @@ class user extends session return false; } - if (!function_exists('group_user_del')) + if (!function_exists('remove_newly_registered')) { global $phpbb_root_path, $phpEx; include($phpbb_root_path . 'includes/functions_user.' . $phpEx); } - - $sql = 'SELECT group_id - FROM ' . GROUPS_TABLE . " - WHERE group_name = 'NEWLY_REGISTERED' - AND group_type = " . GROUP_SPECIAL; - $result = $db->sql_query($sql); - $group_id = (int) $db->sql_fetchfield('group_id'); - $db->sql_freeresult($result); - - if (!$group_id) + if ($group = remove_newly_registered($this->data['user_id'], $this->data)) { - return false; + $this->data['group_id'] = $group; + } - - // We need to call group_user_del here, because this function makes sure everything is correctly changed. - // A downside for a call within the session handler is that the language is not set up yet - so no log entry - group_user_del($group_id, $this->data['user_id']); - - // Set user_new to 0 to let this not be triggered again - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_new = 0 - WHERE user_id = ' . $this->data['user_id']; - $db->sql_query($sql); - $this->data['user_permissions'] = ''; $this->data['user_new'] = 0; - - // The new users group was the users default group? - if ($this->data['group_id'] == $group_id) - { - // Which group is now the users default one? - $sql = 'SELECT group_id - FROM ' . USERS_TABLE . ' - WHERE user_id = ' . $this->data['user_id']; - $result = $db->sql_query($sql); - $this->data['group_id'] = $db->sql_fetchfield('group_id'); - $db->sql_freeresult($result); - } - + return true; } } diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index bc569cd8ed..65475d7627 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -666,6 +666,8 @@ $lang = array_merge($lang, array( 'LOG_USER_MOVE_POSTS' => 'Moved user posts
      » posts by “%1$s” to forum “%2$s”', 'LOG_USER_NEW_PASSWORD' => 'Changed user password
      » %s', 'LOG_USER_REACTIVATE' => 'Forced user account reactivation
      » %s', + 'LOG_USER_REMOVED_NR' => 'Removed newly registered flag from user
      » %s', + 'LOG_USER_UPDATE_EMAIL' => 'User “%1$s” changed e-mail
      » from “%2$s” to “%3$s”', 'LOG_USER_UPDATE_NAME' => 'Changed username
      » from “%1$s” to “%2$s”', 'LOG_USER_USER_UPDATE' => 'Updated user details
      » %s', diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index 01cbbfd81e..d2e09f43e7 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -106,6 +106,7 @@ $lang = array_merge($lang, array( 'USER_ADMIN_DEL_SIG' => 'Delete signature', 'USER_ADMIN_EXPLAIN' => 'Here you can change your users information and certain specific options.', 'USER_ADMIN_FORCE' => 'Force reactivation', + 'USER_ADMIN_LEAVE_NR' => 'Remove from Newly Registered', 'USER_ADMIN_MOVE_POSTS' => 'Move all posts', 'USER_ADMIN_SIG_REMOVED' => 'Successfully removed signature from user account.', 'USER_ATTACHMENTS_REMOVED' => 'Successfully removed all attachments made by this user.', @@ -118,6 +119,7 @@ $lang = array_merge($lang, array( 'USER_GROUP_NORMAL' => 'User defined groups user is a member of', 'USER_GROUP_PENDING' => 'Groups user is in pending mode', 'USER_GROUP_SPECIAL' => 'Pre-defined groups user is a member of', + 'USER_LIFTED_NR' => 'Successfully removed the user’s newly registered status.', 'USER_NO_ATTACHMENTS' => 'There are no attached files to display.', 'USER_OVERVIEW_UPDATED' => 'User details updated.', 'USER_POSTS_DELETED' => 'Successfully removed all posts made by this user.', From b16626e947328379ea986c10fe1c4840e502aacb Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Sun, 21 Jun 2009 14:42:20 +0000 Subject: [PATCH 117/607] Fixed bug #45975 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9647 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/index.php | 2 +- phpBB/adm/style/admin.css | 1 + phpBB/docs/CHANGELOG.html | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 2c3f9deb6c..778070e2e1 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -246,7 +246,7 @@ function h_radio($name, &$input_ary, $input_default = false, $id = false, $key = foreach ($input_ary as $value => $title) { $selected = ($input_default !== false && $value == $input_default) ? ' checked="checked"' : ''; - $html .= ''; + $html .= ' '; $id_assigned = true; } diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 344b5cacf0..173af4f7ab 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -184,6 +184,7 @@ a:active { width: 76%; margin: 0 0 0 3%; min-height: 350px; + overflow-y: auto; } .rtl #main { diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 47171ef4cb..1c489b338f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -94,6 +94,7 @@
    152. [Fix] Show report button in prosilver for guests who are allowed to report posts. (Bug #45695 - Patch by bantu)
    153. [Fix] Correctly show private message history (Bug #46065 - Patch by bantu)
    154. [Fix] Various XHTML mistakes in prosilver, subsilver2 and the ACP. (Bugs #25545 - Patch by bantu, #26315, #38555, #45505 - Patch by Raimon, #45785, #45865)
    155. +
    156. [Fix] Fix some ACP style issues (Bug #45975 - Patch by leviatan21)
    157. [Fix] Move post bump information markup to the template. (Bug #34295 - Patch by bantu)
    158. [Fix] Show error in the ACP when template folder is not readable. (Bug #45705 - Patch by bantu)
    159. [Fix] Adjust viewonline filename regular expression to be less strict. (Bug #46215 - Patch by bantu)
    160. From eb72e526b804844839555314914049eec75f1398 Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Sun, 21 Jun 2009 16:00:42 +0000 Subject: [PATCH 118/607] Fixed bug #43125 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9648 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 15 +++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 1c489b338f..794dc4fc44 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -127,6 +127,7 @@
    161. [Fix] Correctly describe founder permissions on trace-information (Bug #37235 - Patch by nickvergessen)
    162. [Fix] Correct the width value for poll_center.gif omitted in imageset.cfg for subsilver2. (Bug #43005 - Patch by rxu)
    163. [Fix] Correctly load complex language variable using acp_language (Bug #45735 - Patch by leviatan21)
    164. +
    165. [Fix] Fixed reapply_sid() to correctly strip session id in certain circumstances (Bug #43125 - Patch by leviatan21)
    166. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    167. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    168. [Change] Template engine now permits to a limited extent variable includes.
    169. diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index dd82f9e53d..14e1dde92f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2261,17 +2261,12 @@ function reapply_sid($url) } // Remove previously added sid - if (strpos($url, '?sid=') !== false) + if (strpos($url, 'sid=') !== false) { - $url = preg_replace('/(\?)sid=[a-z0-9]+(&|&)?/', '\1', $url); - } - else if (strpos($url, '&sid=') !== false) - { - $url = preg_replace('/&sid=[a-z0-9]+(&)?/', '\1', $url); - } - else if (strpos($url, '&sid=') !== false) - { - $url = preg_replace('/&sid=[a-z0-9]+(&)?/', '\1', $url); + // All kind of links + $url = preg_replace('/(\?)?(&|&)?sid=[a-z0-9]+/', '', $url); + // if the sid was the first param, make the old second as first ones + $url = preg_replace("/$phpEx(&|&)+?/", "$phpEx?", $url); } return append_sid($url); From f393b748c514906f036b84a25981a05cf7677614 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 21 Jun 2009 19:17:20 +0000 Subject: [PATCH 119/607] Fix bug #37565 - Correctly state why one language pack is marked with an asterisk in the ACP. Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9649 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/language/en/acp/language.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 794dc4fc44..37364e09d1 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -128,6 +128,7 @@
    170. [Fix] Correct the width value for poll_center.gif omitted in imageset.cfg for subsilver2. (Bug #43005 - Patch by rxu)
    171. [Fix] Correctly load complex language variable using acp_language (Bug #45735 - Patch by leviatan21)
    172. [Fix] Fixed reapply_sid() to correctly strip session id in certain circumstances (Bug #43125 - Patch by leviatan21)
    173. +
    174. [Fix] Correctly state why one language pack is marked with an asterisk in the ACP. (Bug #37565 - Patch by bantu)
    175. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    176. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    177. [Change] Template engine now permits to a limited extent variable includes.
    178. diff --git a/phpBB/language/en/acp/language.php b/phpBB/language/en/acp/language.php index a10148942b..4d11309ebb 100644 --- a/phpBB/language/en/acp/language.php +++ b/phpBB/language/en/acp/language.php @@ -37,7 +37,7 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'ACP_FILES' => 'Admin language files', - 'ACP_LANGUAGE_PACKS_EXPLAIN' => 'Here you are able to install/remove language packs.', + 'ACP_LANGUAGE_PACKS_EXPLAIN' => 'Here you are able to install/remove language packs. The default language pack is marked with an asterisk (*).', 'EMAIL_FILES' => 'E-mail templates', From 660ef4e43a82dc59b867a80d3d2fe71965199e20 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 22 Jun 2009 09:13:42 +0000 Subject: [PATCH 120/607] the permission setting is meant, not the word never. :) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9650 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/permissions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php index 929caf7d38..151b903b3e 100644 --- a/phpBB/language/en/acp/permissions.php +++ b/phpBB/language/en/acp/permissions.php @@ -190,7 +190,7 @@ $lang = array_merge($lang, array( 'ROLE_DESCRIPTION_FORUM_POLLS' => 'Like Standard Access but can also create polls.', 'ROLE_DESCRIPTION_FORUM_READONLY' => 'Can read the forum, but cannot create new topics or reply to posts.', 'ROLE_DESCRIPTION_FORUM_STANDARD' => 'Can use most forum features including attachments and deleting own topics, but cannot lock own topics, and cannot create polls.', - 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains never permissions to lock features for new users.', + 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains NEVER permissions to lock features for new users.', 'ROLE_DESCRIPTION_MOD_FULL' => 'Can use all moderating features, including banning.', 'ROLE_DESCRIPTION_MOD_QUEUE' => 'Can use the Moderation Queue to validate and edit posts, but nothing else.', 'ROLE_DESCRIPTION_MOD_SIMPLE' => 'Can only use basic topic actions. Cannot send warnings or use moderation queue.', @@ -200,7 +200,7 @@ $lang = array_merge($lang, array( 'ROLE_DESCRIPTION_USER_NOAVATAR' => 'Has a limited feature set and is not allowed to use the Avatar feature.', 'ROLE_DESCRIPTION_USER_NOPM' => 'Has a limited feature set, and is not allowed to use Private Messages.', 'ROLE_DESCRIPTION_USER_STANDARD' => 'Can access most but not all user features. Cannot change user name or ignore the flood limit, for instance.', - 'ROLE_DESCRIPTION_USER_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains never permissions to lock features for new users.', + 'ROLE_DESCRIPTION_USER_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains NEVER permissions to lock features for new users.', 'ROLE_DESCRIPTION_EXPLAIN' => 'You are able to enter a short explanation of what the role is doing or for what it is meant for. The text you enter here will be displayed within the permissions screens too.', 'ROLE_DESCRIPTION_LONG' => 'The role description is too long, please limit it to 4000 characters.', From ffa5a33702d8ec5adec6bfc1c71bcf6e5708c4ff Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 22 Jun 2009 09:29:22 +0000 Subject: [PATCH 121/607] erm, yes... ground should be group git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9651 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index f9a072d1a8..b634410afc 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2157,7 +2157,7 @@ function cache_moderators() AND ((a.auth_setting = ' . ACL_NEVER . ' AND r.auth_setting IS NULL) OR r.auth_setting = ' . ACL_NEVER . ') AND a.group_id = ug.group_id - AND g.ground_id = ug.group_id + AND g.group_id = ug.group_id AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . " AND ug.user_pending = 0 From 588dd7337fd87719b21cf2ec85671713e925acb9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 22 Jun 2009 09:43:01 +0000 Subject: [PATCH 122/607] Fix bug #13673 - Add confirm-box when deleting permissions Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9652 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_permissions.php | 66 ++++++++++++++++---------- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 37364e09d1..f9d3fd73eb 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -158,6 +158,7 @@
    179. [Feature] Add new option to disable avatars board-wide (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)
    180. [Feature] Enhance obtain_users_online_string to be able to return user-lists for other session-items (Bug #31975 - Patch by nickvergessen)
    181. [Feature] Add unapproved topic icon for moderators on forum list (Bug #46865 - Patch by nickvergessen)
    182. +
    183. [Feature] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)
    184. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 1dab6febdd..077a3d7c83 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -217,43 +217,61 @@ class acp_permissions trigger_error($user->lang['WRONG_PERMISSION_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } - // Handle actions if (strpos($mode, 'setting_') === 0 && $action) { switch ($action) { case 'delete': - - if (!check_form_key($form_name)) + if (confirm_box(true)) { - trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); - } - // All users/groups selected? - $all_users = (isset($_POST['all_users'])) ? true : false; - $all_groups = (isset($_POST['all_groups'])) ? true : false; + // All users/groups selected? + $all_users = (isset($_POST['all_users'])) ? true : false; + $all_groups = (isset($_POST['all_groups'])) ? true : false; - if ($all_users || $all_groups) - { - $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); - - if ($all_users && sizeof($items['user_ids'])) + if ($all_users || $all_groups) { - $user_id = $items['user_ids']; - } - else if ($all_groups && sizeof($items['group_ids'])) - { - $group_id = $items['group_ids']; - } - } + $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); - if (sizeof($user_id) || sizeof($group_id)) - { - $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id); + if ($all_users && sizeof($items['user_ids'])) + { + $user_id = $items['user_ids']; + } + else if ($all_groups && sizeof($items['group_ids'])) + { + $group_id = $items['group_ids']; + } + } + + if (sizeof($user_id) || sizeof($group_id)) + { + $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id); + } + else + { + trigger_error($user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + } } else { - trigger_error($user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + $s_hidden_fields = array( + 'i' => $id, + 'mode' => $mode, + 'action' => array($action => 1), + 'user_id' => $user_id, + 'group_id' => $group_id, + 'forum_id' => $forum_id, + 'type' => $permission_type, + ); + if (isset($_POST['all_users'])) + { + $s_hidden_fields['all_users'] = 1; + } + if (isset($_POST['all_groups'])) + { + $s_hidden_fields['all_groups'] = 1; + } + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); } break; From bfcf6a1de5181a0b26b247f8cb9e181b8c83ff90 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Mon, 22 Jun 2009 14:36:04 +0000 Subject: [PATCH 123/607] Fix bug #46765 - View unread posts Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9653 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 1 + phpBB/language/en/common.php | 1 + phpBB/search.php | 5 +++++ phpBB/styles/prosilver/template/index_body.html | 2 +- phpBB/styles/subsilver2/template/overall_header.html | 2 +- 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f9d3fd73eb..27fcf1d530 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -159,6 +159,7 @@
    185. [Feature] Enhance obtain_users_online_string to be able to return user-lists for other session-items (Bug #31975 - Patch by nickvergessen)
    186. [Feature] Add unapproved topic icon for moderators on forum list (Bug #46865 - Patch by nickvergessen)
    187. [Feature] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)
    188. +
    189. [Feature] Add unread posts quick search option (Bug #46765 - Patch by rxu)
    190. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 14e1dde92f..12b9363ec4 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3840,6 +3840,7 @@ function page_header($page_title = '', $display_online_list = true) 'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'), 'U_SEARCH_NEW' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'), 'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'), + 'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'), 'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'), 'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'), 'U_TEAM' => ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=leaders'), diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 6f3433892a..a2b8eafd52 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -522,6 +522,7 @@ $lang = array_merge($lang, array( 'SEARCH_SELF' => 'View your posts', 'SEARCH_TOPIC' => 'Search this topic…', 'SEARCH_UNANSWERED' => 'View unanswered posts', + 'SEARCH_UNREAD' => 'View unread posts', 'SECONDS' => 'Seconds', 'SELECT' => 'Select', 'SELECT_ALL_CODE' => 'Select all', diff --git a/phpBB/search.php b/phpBB/search.php index 5e2a7c2836..e5fd852e0d 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -348,6 +348,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) break; case 'newposts': + case 'unreadposts': $l_search_title = $user->lang['SEARCH_NEW']; // force sorting $show_results = (request_var('sr', 'topics') == 'posts') ? 'posts' : 'topics'; @@ -803,6 +804,10 @@ if ($keywords || $author || $author_id || $search_id || $submit) topic_status($row, $replies, (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false, $folder_img, $folder_alt, $topic_type); $unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false; + if ($search_id == 'unreadposts' && !$unread_topic) + { + continue; + } $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index 43d8ad0309..9cb4d2067d 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -6,7 +6,7 @@ diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index 6099a12338..c605871f0b 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -201,7 +201,7 @@ function marklist(id, name, state) From b1584a8d5c709c4c909826e23286ca6aa438cf41 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Mon, 22 Jun 2009 16:16:04 +0000 Subject: [PATCH 124/607] Fix bug #46965 - File named install in php directory Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9654 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_main.php | 2 +- phpBB/includes/session.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 27fcf1d530..7e806ae25c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -129,6 +129,7 @@
    191. [Fix] Correctly load complex language variable using acp_language (Bug #45735 - Patch by leviatan21)
    192. [Fix] Fixed reapply_sid() to correctly strip session id in certain circumstances (Bug #43125 - Patch by leviatan21)
    193. [Fix] Correctly state why one language pack is marked with an asterisk in the ACP. (Bug #37565 - Patch by bantu)
    194. +
    195. [Fix] Correctly check if install directory is still present. (Bug #46965 - Patch by rxu)
    196. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    197. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    198. [Change] Template engine now permits to a limited extent variable includes.
    199. diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 365290e909..5d6bd40681 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -499,7 +499,7 @@ class acp_main } // Warn if install is still present - if (file_exists($phpbb_root_path . 'install')) + if (file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install')) { $template->assign_var('S_REMOVE_INSTALL', true); } diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index f74a7c5acc..509e11e524 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1756,7 +1756,7 @@ class user extends session // Disable board if the install/ directory is still present // For the brave development army we do not care about this, else we need to comment out this everytime we develop locally - if (!defined('DEBUG_EXTRA') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists($phpbb_root_path . 'install')) + if (!defined('DEBUG_EXTRA') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install')) { // Adjust the message slightly according to the permissions if ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) From 926640fc750ad2d90d4c86b234350dbdd0cc938c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 23 Jun 2009 08:09:54 +0000 Subject: [PATCH 125/607] add missing user_new field to schema (just forgot to create it) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9655 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/schemas/firebird_schema.sql | 6 ++++-- phpBB/install/schemas/mssql_schema.sql | 6 ++++-- phpBB/install/schemas/mysql_40_schema.sql | 2 ++ phpBB/install/schemas/mysql_41_schema.sql | 2 ++ phpBB/install/schemas/oracle_schema.sql | 2 ++ phpBB/install/schemas/postgres_schema.sql | 2 ++ phpBB/install/schemas/sqlite_schema.sql | 4 +++- 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index c37a038b3a..a472aac421 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -227,7 +227,8 @@ CREATE TABLE phpbb_confirm ( session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, confirm_type INTEGER DEFAULT 0 NOT NULL, code VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - seed INTEGER DEFAULT 0 NOT NULL + seed INTEGER DEFAULT 0 NOT NULL, + attempts INTEGER DEFAULT 0 NOT NULL );; ALTER TABLE phpbb_confirm ADD PRIMARY KEY (session_id, confirm_id);; @@ -1364,7 +1365,8 @@ CREATE TABLE phpbb_users ( user_interests BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, user_actkey VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, user_newpasswd VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_form_salt VARCHAR(32) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE + user_form_salt VARCHAR(32) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_new INTEGER DEFAULT 1 NOT NULL );; ALTER TABLE phpbb_users ADD PRIMARY KEY (user_id);; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 953dc3d67c..1b3323072e 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -302,7 +302,8 @@ CREATE TABLE [phpbb_confirm] ( [session_id] [char] (32) DEFAULT ('') NOT NULL , [confirm_type] [int] DEFAULT (0) NOT NULL , [code] [varchar] (8) DEFAULT ('') NOT NULL , - [seed] [int] DEFAULT (0) NOT NULL + [seed] [int] DEFAULT (0) NOT NULL , + [attempts] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -1635,7 +1636,8 @@ CREATE TABLE [phpbb_users] ( [user_interests] [varchar] (4000) DEFAULT ('') NOT NULL , [user_actkey] [varchar] (32) DEFAULT ('') NOT NULL , [user_newpasswd] [varchar] (40) DEFAULT ('') NOT NULL , - [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL + [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL , + [user_new] [int] DEFAULT (1) NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 5b78dde036..a4ae03f5cd 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -163,6 +163,7 @@ CREATE TABLE phpbb_confirm ( confirm_type tinyint(3) DEFAULT '0' NOT NULL, code varbinary(8) DEFAULT '' NOT NULL, seed int(10) UNSIGNED DEFAULT '0' NOT NULL, + attempts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (session_id, confirm_id), KEY confirm_type (confirm_type) ); @@ -965,6 +966,7 @@ CREATE TABLE phpbb_users ( user_actkey varbinary(32) DEFAULT '' NOT NULL, user_newpasswd varbinary(120) DEFAULT '' NOT NULL, user_form_salt varbinary(96) DEFAULT '' NOT NULL, + user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, PRIMARY KEY (user_id), KEY user_birthday (user_birthday), KEY user_email_hash (user_email_hash), diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 0e8bb96652..ae7f5cd493 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -163,6 +163,7 @@ CREATE TABLE phpbb_confirm ( confirm_type tinyint(3) DEFAULT '0' NOT NULL, code varchar(8) DEFAULT '' NOT NULL, seed int(10) UNSIGNED DEFAULT '0' NOT NULL, + attempts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (session_id, confirm_id), KEY confirm_type (confirm_type) ) CHARACTER SET `utf8` COLLATE `utf8_bin`; @@ -965,6 +966,7 @@ CREATE TABLE phpbb_users ( user_actkey varchar(32) DEFAULT '' NOT NULL, user_newpasswd varchar(40) DEFAULT '' NOT NULL, user_form_salt varchar(32) DEFAULT '' NOT NULL, + user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, PRIMARY KEY (user_id), KEY user_birthday (user_birthday), KEY user_email_hash (user_email_hash), diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index dbe92650ac..1b8d0a3bb8 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -338,6 +338,7 @@ CREATE TABLE phpbb_confirm ( confirm_type number(3) DEFAULT '0' NOT NULL, code varchar2(8) DEFAULT '' , seed number(10) DEFAULT '0' NOT NULL, + attempts number(8) DEFAULT '0' NOT NULL, CONSTRAINT pk_phpbb_confirm PRIMARY KEY (session_id, confirm_id) ) / @@ -1783,6 +1784,7 @@ CREATE TABLE phpbb_users ( user_actkey varchar2(32) DEFAULT '' , user_newpasswd varchar2(120) DEFAULT '' , user_form_salt varchar2(96) DEFAULT '' , + user_new number(1) DEFAULT '1' NOT NULL, CONSTRAINT pk_phpbb_users PRIMARY KEY (user_id), CONSTRAINT u_phpbb_username_clean UNIQUE (username_clean) ) diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 6eb2aa4ffb..e92ee29141 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -276,6 +276,7 @@ CREATE TABLE phpbb_confirm ( confirm_type INT2 DEFAULT '0' NOT NULL, code varchar(8) DEFAULT '' NOT NULL, seed INT4 DEFAULT '0' NOT NULL CHECK (seed >= 0), + attempts INT4 DEFAULT '0' NOT NULL CHECK (attempts >= 0), PRIMARY KEY (session_id, confirm_id) ); @@ -1228,6 +1229,7 @@ CREATE TABLE phpbb_users ( user_actkey varchar(32) DEFAULT '' NOT NULL, user_newpasswd varchar(40) DEFAULT '' NOT NULL, user_form_salt varchar(32) DEFAULT '' NOT NULL, + user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0), PRIMARY KEY (user_id) ); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 1741eae5f2..2f57b63a8d 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -160,6 +160,7 @@ CREATE TABLE phpbb_confirm ( confirm_type tinyint(3) NOT NULL DEFAULT '0', code varchar(8) NOT NULL DEFAULT '', seed INTEGER UNSIGNED NOT NULL DEFAULT '0', + attempts INTEGER UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (session_id, confirm_id) ); @@ -934,7 +935,8 @@ CREATE TABLE phpbb_users ( user_interests text(65535) NOT NULL DEFAULT '', user_actkey varchar(32) NOT NULL DEFAULT '', user_newpasswd varchar(40) NOT NULL DEFAULT '', - user_form_salt varchar(32) NOT NULL DEFAULT '' + user_form_salt varchar(32) NOT NULL DEFAULT '', + user_new INTEGER UNSIGNED NOT NULL DEFAULT '1' ); CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); From c32f49679f635175d43de7264ee09782c56c628e Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 23 Jun 2009 10:48:53 +0000 Subject: [PATCH 126/607] - add options for quick reply (forum-based and board-wide) - add option for minimum post chars (which is a required setting for quick reply, therefore we introduce it here) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9656 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_forums.html | 5 +++ phpBB/docs/CHANGELOG.html | 2 ++ phpBB/includes/acp/acp_board.php | 3 ++ phpBB/includes/acp/acp_forums.php | 5 +++ phpBB/includes/constants.php | 1 + phpBB/includes/message_parser.php | 20 +++++++---- phpBB/install/convertors/convert_phpbb20.php | 2 ++ phpBB/install/database_update.php | 38 ++++++++++++++++---- phpBB/install/install_convert.php | 4 +-- phpBB/install/schemas/schema_data.sql | 2 ++ phpBB/language/en/acp/board.php | 8 +++-- phpBB/language/en/acp/forums.php | 2 ++ phpBB/language/en/posting.php | 1 + 13 files changed, 76 insertions(+), 17 deletions(-) diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index 547ac66e3c..937a288cb2 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -217,6 +217,11 @@
      +
      +

      {L_ENABLE_QUICK_REPLY_EXPLAIN}
      +
      +
      +

      {L_ENABLE_INDEXING_EXPLAIN}
      diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7e806ae25c..f34349fb51 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -161,7 +161,9 @@
    200. [Feature] Add unapproved topic icon for moderators on forum list (Bug #46865 - Patch by nickvergessen)
    201. [Feature] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)
    202. [Feature] Add unread posts quick search option (Bug #46765 - Patch by rxu)
    203. +
    204. [Feature] Ability to define minimum number of characters for posts/pms
    205. +

      1.ii. Changes since 3.0.4

        diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 7866b1b81f..41849b909a 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -87,6 +87,7 @@ class acp_board 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'ACP_LOAD_SETTINGS', 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), @@ -169,6 +170,7 @@ class acp_board 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'POSTING', 'bump_type' => false, @@ -181,6 +183,7 @@ class acp_board 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0', 'type' => 'text:3:4', 'explain' => true), 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'text:4:4', 'explain' => false), 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true), + 'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true), 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), 'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'), diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index bf5242ace6..810caa62d5 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -139,6 +139,7 @@ class acp_forums 'enable_icons' => request_var('enable_icons', false), 'enable_prune' => request_var('enable_prune', false), 'enable_post_review' => request_var('enable_post_review', true), + 'enable_quick_reply' => request_var('enable_quick_reply', false), 'prune_days' => request_var('prune_days', 7), 'prune_viewed' => request_var('prune_viewed', 7), 'prune_freq' => request_var('prune_freq', 1), @@ -423,6 +424,7 @@ class acp_forums $forum_data['forum_flags'] += (request_var('prune_sticky', false)) ? FORUM_FLAG_PRUNE_STICKY : 0; $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; $forum_data['forum_flags'] += (request_var('enable_post_review', true)) ? FORUM_FLAG_POST_REVIEW : 0; + $forum_data['forum_flags'] += (request_var('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0; } // Show form to create/modify a forum @@ -682,6 +684,7 @@ class acp_forums 'S_PRUNE_STICKY' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_STICKY) ? true : false, 'S_DISPLAY_ACTIVE_TOPICS' => ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) ? true : false, 'S_ENABLE_POST_REVIEW' => ($forum_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) ? true : false, + 'S_ENABLE_QUICK_REPLY' => ($forum_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) ? true : false, 'S_CAN_COPY_PERMISSIONS' => ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) ? true : false, )); @@ -941,6 +944,7 @@ class acp_forums $forum_data['forum_flags'] += ($forum_data['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0; $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; $forum_data['forum_flags'] += ($forum_data['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0; + $forum_data['forum_flags'] += ($forum_data['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0; // Unset data that are not database fields $forum_data_sql = $forum_data; @@ -951,6 +955,7 @@ class acp_forums unset($forum_data_sql['prune_sticky']); unset($forum_data_sql['show_active']); unset($forum_data_sql['enable_post_review']); + unset($forum_data_sql['enable_quick_reply']); unset($forum_data_sql['forum_password_confirm']); // What are we going to do tonight Brain? The same thing we do everynight, diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 4cb21bc637..2e2c239d89 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -91,6 +91,7 @@ define('FORUM_FLAG_PRUNE_ANNOUNCE', 4); define('FORUM_FLAG_PRUNE_STICKY', 8); define('FORUM_FLAG_ACTIVE_TOPICS', 16); define('FORUM_FLAG_POST_REVIEW', 32); +define('FORUM_FLAG_QUICK_REPLY', 64); // Optional text flags define('OPTION_FLAG_BBCODE', 1); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index ab6fc3f4f3..4cdc8b933e 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1089,14 +1089,22 @@ class parse_message extends bbcode_firstpass $replace = array("\\1:"); $this->message = preg_replace($match, $replace, trim($this->message)); - // Message length check. 0 disables this check completely. - if ($config['max_' . $mode . '_chars'] > 0) - { - $msg_len = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message)); + // Store message length... + $message_length = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message)); - if ((!$msg_len && $mode !== 'sig') || $config['max_' . $mode . '_chars'] && $msg_len > $config['max_' . $mode . '_chars']) + // Maximum message length check. 0 disables this check completely. + if ((int) $config['max_' . $mode . '_chars'] > 0 && $message_length > (int) $config['max_' . $mode . '_chars']) + { + $this->warn_msg[] = sprintf($user->lang['TOO_MANY_CHARS_' . strtoupper($mode)], $message_length, (int) $config['max_' . $mode . '_chars']); + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + + // Minimum message length check for post only + if ($mode !== 'sig') + { + if (!$message_length || $message_length < (int) $config['min_post_chars']) { - $this->warn_msg[] = (!$msg_len) ? $user->lang['TOO_FEW_CHARS'] : sprintf($user->lang['TOO_MANY_CHARS_' . strtoupper($mode)], $msg_len, $config['max_' . $mode . '_chars']); + $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : sprintf($user->lang['TOO_FEW_CHARS_LIMIT'], $message_length, (int) $config['min_post_chars']); return (!$update_this_message) ? $return_message : $this->warn_msg; } } diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 805c67b92d..f4fc466ac7 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -611,6 +611,7 @@ if (!$get_info) 'query_first' => array('target', $convert->truncate_statement . POSTS_TABLE), 'execute_first' => ' $config["max_post_chars"] = 0; + $config["min_post_chars"] = 0; $config["max_quote_depth"] = 0; ', @@ -660,6 +661,7 @@ if (!$get_info) 'execute_first' => ' $config["max_post_chars"] = 0; + $config["min_post_chars"] = 0; $config["max_quote_depth"] = 0; ', diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 44bcf2a112..c3f8b40de6 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1200,9 +1200,19 @@ function change_database_data(&$no_updates, $version) } } - // Set every members user_new column to 0 (old users) - $sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0'; - _sql($sql, $errored, $error_ary); + // Set every members user_new column to 0 (old users) only if there is no one yet (this makes sure we do not execute this more than once) + $sql = 'SELECT 1 + FROM ' . USERS_TABLE . ' + WHERE user_new = 0'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0'; + _sql($sql, $errored, $error_ary); + } // Newly registered users limit if (!isset($config['new_member_post_limit'])) @@ -1246,13 +1256,27 @@ function change_database_data(&$no_updates, $version) $auth_admin = new auth_admin(); $auth_admin->acl_clear_prefetch(); - if ($config['allow_avatar_upload'] || $config['allow_avatar_local'] || $config['allow_avatar_remote']) + if (!isset($config['allow_avatar'])) { - set_config('allow_avatar', '1'); + if ($config['allow_avatar_upload'] || $config['allow_avatar_local'] || $config['allow_avatar_remote']) + { + set_config('allow_avatar', '1'); + } + else + { + set_config('allow_avatar', '0'); + } } - else + + // Minimum number of characters + if (!isset($config['min_post_chars'])) { - set_config('allow_avatar', '0'); + set_config('min_post_chars', '1'); + } + + if (!isset($config['allow_quick_reply'])) + { + set_config('allow_quick_reply', '1'); } $no_updates = false; diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 7a4155e09d..38bfe96fcd 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -611,7 +611,7 @@ class install_convert extends module $config['max_quote_depth'] = 0; // @todo Need to confirm that max post length in source is <= max post length in destination or there may be interesting formatting issues - $config['max_post_chars'] = 0; + $config['max_post_chars'] = $config['min_post_chars'] = 0; // Set up a user as well. We _should_ have enough of a database here at this point to do this // and it helps for any core code we call @@ -989,7 +989,7 @@ class install_convert extends module $config['max_quote_depth'] = 0; // @todo Need to confirm that max post length in source is <= max post length in destination or there may be interesting formatting issues - $config['max_post_chars'] = 0; + $config['max_post_chars'] = $config['min_post_chars'] = 0; } $template->assign_block_vars('checks', array( diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 100809ec24..86432a3084 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -25,6 +25,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_attach', INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_flash', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_links', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_privmsg', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_quick_reply', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_bbcode', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_flash', '0'); @@ -191,6 +192,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_smilies', INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_urls', '5'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_name_chars', '3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_pass_chars', '6'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_post_chars', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_author_chars', '3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('new_member_post_limit', '3'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 4c3d5326ab..9247a87e52 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -70,6 +70,8 @@ $lang = array_merge($lang, array( 'ALLOW_NO_CENSORS' => 'Allow disabling of word censoring', 'ALLOW_NO_CENSORS_EXPLAIN' => 'Users can choose to disable the automatic word censoring of posts and private messages.', 'ALLOW_PM_ATTACHMENTS' => 'Allow attachments in private messages', + 'ALLOW_QUICK_REPLY' => 'Allow quick reply', + 'ALLOW_QUICK_REPLY_EXPLAIN' => 'This setting defines if quick reply is enabled or not. If this setting is enabled, forums need to have their quick reply option enabled too.', 'ALLOW_SIG' => 'Allow signatures', 'ALLOW_SIG_BBCODE' => 'Allow BBCode in user signatures', 'ALLOW_SIG_FLASH' => 'Allow use of [FLASH] BBCode tag in user signatures', @@ -144,8 +146,8 @@ $lang = array_merge($lang, array( 'BUMP_INTERVAL' => 'Bump interval', 'BUMP_INTERVAL_EXPLAIN' => 'Number of minutes, hours or days between the last post to a topic and the ability to bump this topic.', - 'CHAR_LIMIT' => 'Maximum characters per post', - 'CHAR_LIMIT_EXPLAIN' => 'The number of characters allowed within a post. Set to 0 for unlimited characters.', + 'CHAR_LIMIT' => 'Maximum characters per post/message', + 'CHAR_LIMIT_EXPLAIN' => 'The number of characters allowed within a post/private message. Set to 0 for unlimited characters.', 'DISPLAY_LAST_EDITED' => 'Display last edited time information', 'DISPLAY_LAST_EDITED_EXPLAIN' => 'Choose if the last edited by information to be displayed on posts.', 'EDIT_TIME' => 'Limit editing time', @@ -163,6 +165,8 @@ $lang = array_merge($lang, array( 'MAX_POST_IMG_WIDTH_EXPLAIN' => 'Maximum width of an image/flash file in postings. Set to 0 for unlimited size.', 'MAX_POST_URLS' => 'Maximum links per post', 'MAX_POST_URLS_EXPLAIN' => 'Maximum number of URLs in a post. Set to 0 for unlimited links.', + 'MIN_CHAR_LIMIT' => 'Minimum characters per post/message', + 'MIN_CHAR_LIMIT_EXPLAIN' => 'The minimum number of characters the user need to enter within a post/private message.', 'POSTING' => 'Posting', 'POSTS_PER_PAGE' => 'Posts per page', 'QUOTE_DEPTH_LIMIT' => 'Maximum nested quotes per post', diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php index 52919f4f40..7f3b1b997d 100644 --- a/phpBB/language/en/acp/forums.php +++ b/phpBB/language/en/acp/forums.php @@ -62,6 +62,8 @@ $lang = array_merge($lang, array( 'ENABLE_INDEXING_EXPLAIN' => 'If set to yes posts made to this forum will be indexed for searching.', 'ENABLE_POST_REVIEW' => 'Enable post review', 'ENABLE_POST_REVIEW_EXPLAIN' => 'If set to yes users are able to review their post if new posts were made to the topic while users wrote theirs. This should be disabled for chat forums.', + 'ENABLE_QUICK_REPLY' => 'Enable quick reply', + 'ENABLE_QUICK_REPLY_EXPLAIN' => 'If set to yes users get a quick reply box for this forum. If the global option for quick reply is disabled or the forum not postable to the quick reply box will not be displayed, even if set to yes here.', 'ENABLE_RECENT' => 'Display active topics', 'ENABLE_RECENT_EXPLAIN' => 'If set to yes topics made to this forum will be shown in the active topics list.', 'ENABLE_TOPIC_ICONS' => 'Enable topic icons', diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index 8733fc5b10..e665f540eb 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -188,6 +188,7 @@ $lang = array_merge($lang, array( 'STYLES_TIP' => 'Tip: Styles can be applied quickly to selected text.', 'TOO_FEW_CHARS' => 'Your message contains too few characters.', + 'TOO_FEW_CHARS_LIMIT' => 'Your message contains %1$d characters. The minimum number of characters you need to enter is %2$d.', 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', 'TOO_MANY_ATTACHMENTS' => 'Cannot add another attachment, %d is the maximum.', 'TOO_MANY_CHARS' => 'Your message contains too many characters.', From 762f87b8ad3e59d260d2d4e9fb1bf450ee92f58e Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 23 Jun 2009 10:58:44 +0000 Subject: [PATCH 127/607] update mysql upgrader to 3.0.6-dev git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9657 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/mysql_upgrader.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 22406d1286..2fc02fde8a 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -455,6 +455,7 @@ function get_schema_struct() 'confirm_type' => array('TINT:3', 0), 'code' => array('VCHAR:8', ''), 'seed' => array('UINT:10', 0), + 'attempts' => array('UINT', 0), ), 'PRIMARY_KEY' => array('session_id', 'confirm_id'), 'KEYS' => array( @@ -597,6 +598,7 @@ function get_schema_struct() 'group_id' => array('UINT', NULL, 'auto_increment'), 'group_type' => array('TINT:4', 1), 'group_founder_manage' => array('BOOL', 0), + 'group_skip_auth' => array('BOOL', 0), 'group_name' => array('VCHAR_CI', ''), 'group_desc' => array('TEXT_UNI', ''), 'group_desc_bitfield' => array('VCHAR:255', ''), @@ -1323,7 +1325,7 @@ function get_schema_struct() 'user_actkey' => array('VCHAR:32', ''), 'user_newpasswd' => array('VCHAR_UNI:40', ''), 'user_form_salt' => array('VCHAR_UNI:32', ''), - + 'user_new' => array('BOOL', 1), ), 'PRIMARY_KEY' => 'user_id', 'KEYS' => array( From 6dec355d1cb0e139fc0cff6af67588d7e5735823 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 23 Jun 2009 11:20:33 +0000 Subject: [PATCH 128/607] Add WAI-ARIA landmarks for easier accessibility to the prosilver template (Bug #45715 - Patch by MarcoZ) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9658 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + .../prosilver/template/overall_footer.html | 4 ++-- .../prosilver/template/overall_header.html | 18 +++++++++--------- .../prosilver/template/search_results.html | 2 +- .../prosilver/template/simple_footer.html | 2 +- .../prosilver/template/simple_header.html | 2 +- .../prosilver/template/viewforum_body.html | 2 +- .../prosilver/template/viewtopic_body.html | 2 +- 8 files changed, 17 insertions(+), 16 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f34349fb51..acc96098c7 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -141,6 +141,7 @@
      • [Change] Hide avatar when avatar-type is not allowed (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)
      • [Change] INCLUDEPHP not depending on phpbb_root_path (Bug #45805 - Patch by nickvergessen)
      • [Change] Ability to fetch moderators with get_moderators() even if load_moderators setting is off. (Bug #35955)
      • +
      • [Change] Add WAI-ARIA landmarks for easier accessibility to the prosilver template (Bug #45715 - Patch by MarcoZ)
      • [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
      • [Feature] Backported 3.2 captcha plugins.
      • [Feature] Introduced new ACM plugins: diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index fd8af31db6..c48ddeb55b 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -1,6 +1,6 @@ -
      diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index 50a456179b..bd8fbce0fa 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -107,7 +107,7 @@ class phpbb_recaptcha extends phpbb_default_captcha } $template->assign_vars(array( - 'CAPTCHA_PREVIEW' => $this->get_demo_template(), + 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), 'CAPTCHA_NAME' => $this->get_class_name(), )); From 4279658e1ffeab6cf4c5989ba5a88685a6927c4b Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 23 Jun 2009 13:22:05 +0000 Subject: [PATCH 130/607] meh git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9660 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_captcha.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 74e0521e12..2fc8fe7486 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -121,8 +121,8 @@ class acp_captcha } $template->assign_vars(array( - 'CAPTCHA_PREVIEW' => $demo_captcha->get_demo_template($id), - 'CAPTCHA_SELECT' => $captcha_select, + 'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id), + 'CAPTCHA_SELECT' => $captcha_select, )); } } From 9b3ffb02c2fe867c46b91f785222c99a83e58f31 Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Tue, 23 Jun 2009 14:01:09 +0000 Subject: [PATCH 131/607] Fixed Bug #24155 - mark buttons in acp with logs Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9661 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_logs.html | 45 +++++++++++++++++++---------------- phpBB/docs/CHANGELOG.html | 3 ++- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/phpBB/adm/style/acp_logs.html b/phpBB/adm/style/acp_logs.html index 11ab5faa9c..155917e84f 100644 --- a/phpBB/adm/style/acp_logs.html +++ b/phpBB/adm/style/acp_logs.html @@ -22,13 +22,14 @@ {L_IP} {L_TIME} {L_ACTION} - {L_MARK} + + {L_MARK} + - {log.USERNAME} @@ -38,32 +39,27 @@ {log.IP} {log.DATE} {log.ACTION}
      {log.DATA} - + + + - +
      + {L_DISPLAY_LOG}:  {S_LIMIT_DAYS} {L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR} + + {S_FORM_TOKEN} +
      +
      -
      -

      {L_NO_ENTRIES}

      -
      - - - - -
      - {L_DISPLAY_LOG}:  {S_LIMIT_DAYS} {L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR} - - {S_FORM_TOKEN} -
      -
      - + +
      {L_SELECT_FORUM}: @@ -79,7 +75,14 @@
      + + +
      +

      {L_NO_ENTRIES}

      +
      + + - \ No newline at end of file + diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index acc96098c7..e6b0421bec 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -130,6 +130,7 @@
    206. [Fix] Fixed reapply_sid() to correctly strip session id in certain circumstances (Bug #43125 - Patch by leviatan21)
    207. [Fix] Correctly state why one language pack is marked with an asterisk in the ACP. (Bug #37565 - Patch by bantu)
    208. [Fix] Correctly check if install directory is still present. (Bug #46965 - Patch by rxu)
    209. +
    210. [Fix] Correctly display ACP logs options, without permission to clear logs. (Bug #24155 - Patch by leviatan21)
    211. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    212. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    213. [Change] Template engine now permits to a limited extent variable includes.
    214. @@ -983,4 +984,4 @@ - \ No newline at end of file + From bd9ab51165172584c5401d5d98c3c6d3e4278ca7 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 23 Jun 2009 14:06:30 +0000 Subject: [PATCH 132/607] svn... git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9662 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/captcha_default_acp_demo.html | 0 phpBB/adm/style/captcha_gd_acp.html | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 phpBB/adm/style/captcha_default_acp_demo.html mode change 100755 => 100644 phpBB/adm/style/captcha_gd_acp.html diff --git a/phpBB/adm/style/captcha_default_acp_demo.html b/phpBB/adm/style/captcha_default_acp_demo.html old mode 100755 new mode 100644 diff --git a/phpBB/adm/style/captcha_gd_acp.html b/phpBB/adm/style/captcha_gd_acp.html old mode 100755 new mode 100644 From c0b4cf2f6e6e0953071fbdea189d58bf60c4f862 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 23 Jun 2009 17:15:53 +0000 Subject: [PATCH 133/607] fix feed generation git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9663 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/feed.php | 66 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index 1d4e26aaab..9d9bf145b1 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -158,38 +158,40 @@ else exit_handler(); } +$namespace = 'phpbb'; + echo '' . "\n"; -echo '' . "\n"; -echo '' . "\n\n"; +echo '<' . $namespace . ':feed xmlns:' . $namespace . '="http://www.w3.org/2005/Atom" xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $global_vars['FEED_LANG'] . '">' . "\n"; +echo '<' . $namespace . ':link rel="self" type="application/atom+xml" href="' . $global_vars['SELF_LINK'] . '" />' . "\n\n"; -echo (!empty($global_vars['FEED_TITLE'])) ? '' . $global_vars['FEED_TITLE'] . '' . "\n" : ''; -echo (!empty($global_vars['FEED_SUBTITLE'])) ? '' . $global_vars['FEED_SUBTITLE'] . '' . "\n" : ''; -echo (!empty($global_vars['FEED_LINK'])) ? '' . "\n" : ''; -echo '' . $global_vars['FEED_UPDATED'] . '' . "\n\n"; +echo (!empty($global_vars['FEED_TITLE'])) ? '<' . $namespace . ':title>' . $global_vars['FEED_TITLE'] . '' . "\n" : ''; +echo (!empty($global_vars['FEED_SUBTITLE'])) ? '<' . $namespace . ':subtitle>' . $global_vars['FEED_SUBTITLE'] . '' . "\n" : ''; +echo (!empty($global_vars['FEED_LINK'])) ? '<' . $namespace . ':link href="' . $global_vars['FEED_LINK'] .'" />' . "\n" : ''; +echo '<' . $namespace . ':updated>' . $global_vars['FEED_UPDATED'] . '' . "\n\n"; -echo '' . $global_vars['FEED_AUTHOR'] . '' . "\n"; -echo '' . $global_vars['SELF_LINK'] . '' . "\n"; +echo '<' . $namespace . ':author><' . $namespace . ':name>' . $global_vars['FEED_AUTHOR'] . '' . "\n"; +echo '<' . $namespace . ':id>' . $global_vars['SELF_LINK'] . '' . "\n"; foreach ($item_vars as $row) { - echo '' . "\n"; + echo '<' . $namespace . ':entry>' . "\n"; if (!empty($row['author'])) { - echo '' . $row['author'] . '' . "\n"; + echo '<' . $namespace . ':author><' . $namespace . ':name>' . $row['author'] . '' . "\n"; } - echo '' . $row['pubdate'] . '' . "\n"; - echo '' . $row['link'] . '' . "\n"; - echo '' . "\n"; - echo '' . $row['title'] . '' . "\n\n"; + echo '<' . $namespace . ':updated>' . $row['pubdate'] . '' . "\n"; + echo '<' . $namespace . ':id>' . $row['link'] . '' . "\n"; + echo '<' . $namespace . ':link href="' . $row['link'] . '"/>' . "\n"; + echo '<' . $namespace . ':title type="xhtml">
      ' . $row['title'] . '
      ' . "\n\n"; if (!empty($row['category'])) { - echo '' . "\n"; + echo '<' . $namespace . ':category term="' . $row['category_name'] . '" scheme="' . $row['category'] . '" label="' . $row['category_name'] . '"/>' . "\n"; } - echo '' . "\n"; + echo '<' . $namespace . ':content type="xhtml" xml:base="' . $row['link'] . '">' . "\n"; echo '
      ' . "\n"; echo $row['description']; @@ -198,11 +200,11 @@ foreach ($item_vars as $row) echo '

      ' . $user->lang['STATISTICS'] . ': ' . $row['statistics'] . '

      '; } - echo '
      ' . "\n" . '
      ' . "\n"; - echo '
      ' . "\n"; + echo '
      ' . "\n" . '' . "\n"; + echo '' . "\n"; } -echo '
      '; +echo ''; garbage_collection(); exit_handler(); @@ -217,7 +219,15 @@ function feed_append_sid($url, $params) $link = append_sid($board_url . $url, $params); // Remove added sid - not as easy as it sounds. ;) - return (strpos($link, 'sid=') !== false) ? trim(preg_replace('/(&|&|\?)sid=[a-z0-9]+(&|&)?/', '\1', $link), '?& ') : $link; + $link = (strpos($link, 'sid=') !== false) ? trim(preg_replace('/(&|&|\?)sid=[a-z0-9]+(&|&)?/', '\1', $link), '?& ') : $link; + + // Now the only thing remaining could be an empty & + if (substr($link, -5) === '&') + { + $link = substr($link, 0, -5); + } + + return $link; } /** @@ -237,6 +247,9 @@ function feed_generate_content($content, $uid, $bitfield, $options) $content = generate_text_for_display($content, $uid, $bitfield, $options); + // Add newlines + $content = str_replace('
      ', '
      ' . "\n", $content); + // Relative Path to Absolute path, Windows style $content = str_replace('./', $board_url . '/', $content); @@ -409,6 +422,11 @@ class phpbb_feed */ var $cache_time = 300; + /** + * Separator for title elements to separate items (for example forum / topic) + */ + var $separator = '•'; + /** * Constructor. Set standard keys. */ @@ -672,7 +690,7 @@ class phpbb_feed 'SELECT' => 'f.forum_id, f.forum_name, f.forum_desc_options, ' . 't.topic_last_post_time, t.topic_id, t.topic_title, t.topic_time, t.topic_replies, t.topic_views, ' . 'p.post_id, p.post_time, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . - 'u.username, u.user_id, u.user_email', + 'u.username, u.user_id, u.user_email, u.user_colour', 'FROM' => array( POSTS_TABLE => 'p', TOPICS_TABLE => 't', @@ -748,7 +766,7 @@ class phpbb_feed { global $phpEx, $config; - $item_row['title'] = (!$this->topic_id) ? $row['forum_name'] . ' | ' . $item_row['title'] : $item_row['title']; + $item_row['title'] = (!$this->topic_id) ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title']; $item_row['link'] = feed_append_sid('/viewtopic.' . $phpEx, "t={$row['topic_id']}&p={$row['post_id']}#p{$row['post_id']}"); if ($config['feed_item_statistics']) @@ -865,7 +883,7 @@ class phpbb_feed_news extends phpbb_feed 'SELECT' => 'f.forum_id, f.forum_password, f.forum_name, f.forum_topics, f.forum_posts, f.parent_id, f.left_id, f.right_id, t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_views, t.topic_time, p.post_id, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, - u.username, u.user_id, u.user_email', + u.username, u.user_id, u.user_email, u.user_colour', 'FROM' => array( TOPICS_TABLE => 't', FORUMS_TABLE => 'f', @@ -963,7 +981,7 @@ class phpbb_feed_topics extends phpbb_feed 'SELECT' => 'f.forum_id, f.forum_password, f.forum_name, f.forum_topics, f.forum_posts, f.parent_id, f.left_id, f.right_id, t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_views, t.topic_time, p.post_id, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, - u.username, u.user_id, u.user_email', + u.username, u.user_id, u.user_email, u.user_colour', 'FROM' => array( TOPICS_TABLE => 't', FORUMS_TABLE => 'f', From 723d4c562811b928528d6ff5b52069df36659b8f Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Wed, 24 Jun 2009 02:51:19 +0000 Subject: [PATCH 134/607] Fixed Bug #39845 - [Change] "Post details" links with image in MCP. Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9664 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/mcp_topic.html | 2 +- .../styles/subsilver2/template/mcp_topic.html | 18 +++++------------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e6b0421bec..f60622b75b 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -143,6 +143,7 @@
    215. [Change] INCLUDEPHP not depending on phpbb_root_path (Bug #45805 - Patch by nickvergessen)
    216. [Change] Ability to fetch moderators with get_moderators() even if load_moderators setting is off. (Bug #35955)
    217. [Change] Add WAI-ARIA landmarks for easier accessibility to the prosilver template (Bug #45715 - Patch by MarcoZ)
    218. +
    219. [Change] "Post details" links with image in MCP. (Bug #39845 - Patch by leviatan21)
    220. [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
    221. [Feature] Backported 3.2 captcha plugins.
    222. [Feature] Introduced new ACM plugins: diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index 7453c01ec1..996d8cf1a2 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -106,7 +106,7 @@ onload_functions.push('subPanels()');
      -
      {L_POST_DETAILS} | {L_SELECT}: checked="checked" />
      +

      {postrow.POST_SUBJECT}

      {postrow.MINI_POST_IMG} {L_POSTED} {postrow.POST_DATE} {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} [ {L_POST_DETAILS} ]

      diff --git a/phpBB/styles/subsilver2/template/mcp_topic.html b/phpBB/styles/subsilver2/template/mcp_topic.html index 2b66c8702a..4accce54d8 100644 --- a/phpBB/styles/subsilver2/template/mcp_topic.html +++ b/phpBB/styles/subsilver2/template/mcp_topic.html @@ -61,9 +61,7 @@ {L_DISPLAY_POSTS}: {S_SELECT_SORT_DAYS} {L_SORT_BY} {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}  - {L_AUTHOR} - {L_MESSAGE} - {L_SELECT} + {L_TOPIC_REVIEW}: {TOPIC_TITLE} {RETURN_TOPIC} @@ -81,19 +79,12 @@ - checked="checked" /> + {INFO_IMG} - - - - - -
      [ {L_POST_DETAILS} ]
      - - +
      @@ -131,6 +122,7 @@
      + checked="checked" /> @@ -156,4 +148,4 @@ - \ No newline at end of file + From 19e2dcd5db7f2a910409b82ce315265608ae8266 Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Wed, 24 Jun 2009 02:56:05 +0000 Subject: [PATCH 135/607] Fixed Bug #47145 - [Fix] Correctly check banned users when force password change Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9665 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/session.php | 2 +- phpBB/style.php | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f60622b75b..2ca61084bf 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -130,6 +130,7 @@
    223. [Fix] Fixed reapply_sid() to correctly strip session id in certain circumstances (Bug #43125 - Patch by leviatan21)
    224. [Fix] Correctly state why one language pack is marked with an asterisk in the ACP. (Bug #37565 - Patch by bantu)
    225. [Fix] Correctly check if install directory is still present. (Bug #46965 - Patch by rxu)
    226. +
    227. [Fix] Correct banned user behaviour when "force password change" is enabled (Bug #47145 - Patch by nickvergessen and leviatan21 )
    228. [Fix] Correctly display ACP logs options, without permission to clear logs. (Bug #24155 - Patch by leviatan21)
    229. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    230. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    231. diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 509e11e524..c1bc4b3f31 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1833,7 +1833,7 @@ class user extends session // Does the user need to change their password? If so, redirect to the // ucp profile reg_details page ... of course do not redirect if we're already in the ucp - if (!defined('IN_ADMIN') && !defined('ADMIN_START') && $config['chg_passforce'] && $this->data['is_registered'] && $auth->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) + if (!defined('IN_ADMIN') && !defined('ADMIN_START') && $config['chg_passforce'] && !empty($this->data['is_registered']) && $auth->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) { if (strpos($this->page['query_string'], 'mode=reg_details') === false && $this->page['page_name'] != "ucp.$phpEx") { diff --git a/phpBB/style.php b/phpBB/style.php index 78fd2a91b4..a5c50e7fec 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -91,7 +91,7 @@ if ($id) $recompile = $config['load_tplcompile']; if (!$user) { - $id = $config['default_style']; + $id = ($id) ? $id : $config['default_style']; $recompile = false; $user = array('user_id' => ANONYMOUS); } @@ -289,4 +289,4 @@ if ($id) exit; -?> \ No newline at end of file +?> From 8d106c79c54a4b870c65112fc50dbb2dd755936a Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Wed, 24 Jun 2009 03:11:20 +0000 Subject: [PATCH 136/607] Fixed Bug #15085 - [Feature] Add language selection on the registration terms page Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9666 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/ucp/ucp_register.php | 49 ++++++++++--------- .../prosilver/template/overall_header.html | 6 +-- .../prosilver/template/ucp_agreement.html | 27 +++++++++- .../subsilver2/template/overall_header.html | 4 +- .../subsilver2/template/ucp_agreement.html | 29 +++++++++-- 6 files changed, 84 insertions(+), 32 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 2ca61084bf..f1d60b2b8f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -146,6 +146,7 @@
    232. [Change] Add WAI-ARIA landmarks for easier accessibility to the prosilver template (Bug #45715 - Patch by MarcoZ)
    233. [Change] "Post details" links with image in MCP. (Bug #39845 - Patch by leviatan21)
    234. [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
    235. +
    236. [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
    237. [Feature] Backported 3.2 captcha plugins.
    238. [Feature] Introduced new ACM plugins:
        diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index e0dc0222f5..b2bcc794f7 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -52,7 +52,6 @@ class ucp_register add_form_key('ucp_register_terms'); } - if ($change_lang || $user_lang != $config['default_lang']) { $use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang); @@ -67,7 +66,7 @@ class ucp_register $agreed = (empty($_GET['change_lang'])) ? 0 : $agreed; } - $user->lang_name = $lang = $use_lang; + $user->lang_name = $user_lang = $use_lang; $user->lang = array(); $user->add_lang(array('common', 'ucp')); } @@ -78,17 +77,26 @@ class ucp_register } } + $captcha_solved = false; + if ($config['enable_confirm']) + { + include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); + $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_REG); + } + $cp = new custom_profile(); $error = $cp_data = $cp_error = array(); - if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable'])) { $add_lang = ($change_lang) ? '&change_lang=' . urlencode($change_lang) : ''; $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : ''; - $s_hidden_fields = array(); + $s_hidden_fields = array( + 'change_lang' => $change_lang, + ); // If we change the language, we want to pass on some more possible parameter. if ($change_lang) @@ -108,6 +116,17 @@ class ucp_register } } + // Checking amount of available languages + $lang_row = array(); + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $lang_row[] = $row; + } + $db->sql_freeresult($result); + if ($coppa === false && $config['coppa_enable']) { $now = getdate(); @@ -115,6 +134,7 @@ class ucp_register unset($now); $template->assign_vars(array( + 'S_LANG_OPTIONS' => (sizeof($lang_row) > 1) ? language_select($user_lang) : '', 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), @@ -129,6 +149,7 @@ class ucp_register else { $template->assign_vars(array( + 'S_LANG_OPTIONS' => (sizeof($lang_row) > 1) ? language_select($user_lang) : '', 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()), 'S_SHOW_COPPA' => false, @@ -138,19 +159,12 @@ class ucp_register ) ); } + unset($lang_row); $this->tpl_name = 'ucp_agreement'; return; } - $captcha_solved = false; - if ($config['enable_confirm']) - { - include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']); - $captcha->init(CONFIRM_REG); - } - // Try to manually determine the timezone and adjust the dst if the server date/time complies with the default setting +/- 1 $timezone = date('Z') / 3600; $is_dst = date('I'); @@ -430,7 +444,6 @@ class ucp_register $s_hidden_fields['coppa'] = $coppa; } - if ($config['enable_confirm']) { $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields()); @@ -441,15 +454,6 @@ class ucp_register // Visual Confirmation - Show images if ($config['enable_confirm'] && !$captcha_solved) { - if ($change_lang) - { - $str = '&change_lang=' . $change_lang; - } - else - { - $str = ''; - } - $template->assign_vars(array( 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''), 'CAPTCHA_TEMPLATE' => $captcha->get_template(), @@ -484,6 +488,7 @@ class ucp_register 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_TZ_OPTIONS' => tz_select($data['tz']), 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false, + 'S_REGISTRATION' => true, 'S_COPPA' => $coppa, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 52eeffbdb2..383bf74bb2 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -161,8 +161,8 @@
      • {L_FAQ}
      • {L_MEMBERLIST}
      • -
      • {L_REGISTER}
      • -
      • {L_LOGIN_LOGOUT}
      • +
      • {L_REGISTER}
      • +
      • {L_LOGIN_LOGOUT}
      @@ -179,4 +179,4 @@ {L_INFORMATION}: {L_BOARD_DISABLED} - \ No newline at end of file + diff --git a/phpBB/styles/prosilver/template/ucp_agreement.html b/phpBB/styles/prosilver/template/ucp_agreement.html index 67dcb35e7b..d64e2aebbe 100644 --- a/phpBB/styles/prosilver/template/ucp_agreement.html +++ b/phpBB/styles/prosilver/template/ucp_agreement.html @@ -1,8 +1,31 @@ - + + + +
      +

      + +

      +
      + {S_HIDDEN_FIELDS} +
      + +
      @@ -45,4 +68,4 @@ - \ No newline at end of file + diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index c605871f0b..a45e51b467 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -162,13 +162,13 @@ function marklist(id, name, state) diff --git a/phpBB/styles/subsilver2/template/ucp_agreement.html b/phpBB/styles/subsilver2/template/ucp_agreement.html index f1ea9df73a..d5420f66a6 100644 --- a/phpBB/styles/subsilver2/template/ucp_agreement.html +++ b/phpBB/styles/subsilver2/template/ucp_agreement.html @@ -1,9 +1,32 @@ - - + + + + +
      - * {L_LOGIN_LOGOUT}  + * {L_LOGIN_LOGOUT}   * {L_RESTORE_PERMISSIONS}  {L_BOARD_DISABLED}  * {PRIVATE_MESSAGE_INFO}, {PRIVATE_MESSAGE_INFO_UNREAD} -  * {L_REGISTER} +  * {L_REGISTER}
      + + + +
      {L_LANGUAGE}:
      + {S_HIDDEN_FIELDS} + + +
      @@ -58,4 +81,4 @@ - \ No newline at end of file + From e8638ff0ef36c3305e8f9136552439c858fae4b5 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 24 Jun 2009 09:24:09 +0000 Subject: [PATCH 137/607] tiny tiny thing... and such a huge change... Display topic icons in MCP forum view again (only prosilver) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9667 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/style.php | 2 +- phpBB/styles/prosilver/template/mcp_forum.html | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f1d60b2b8f..c198ae6a73 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -132,6 +132,7 @@
    239. [Fix] Correctly check if install directory is still present. (Bug #46965 - Patch by rxu)
    240. [Fix] Correct banned user behaviour when "force password change" is enabled (Bug #47145 - Patch by nickvergessen and leviatan21 )
    241. [Fix] Correctly display ACP logs options, without permission to clear logs. (Bug #24155 - Patch by leviatan21)
    242. +
    243. [Fix] Display topic icons in MCP forum view again (only prosilver).
    244. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    245. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    246. [Change] Template engine now permits to a limited extent variable includes.
    247. diff --git a/phpBB/style.php b/phpBB/style.php index a5c50e7fec..40d34c598c 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -289,4 +289,4 @@ if ($id) exit; -?> +?> \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index 05e4e2c8a2..2c98f7c9fa 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -35,7 +35,7 @@
    248. -
      style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"> +
      style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"> [ {L_SELECT_MERGE} ]   {topicrow.TOPIC_TITLE} {topicrow.UNAPPROVED_IMG} From f9bbf10a80c7a22a1ff59e30eef1cf9873e46516 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 24 Jun 2009 10:08:18 +0000 Subject: [PATCH 138/607] - Fix XHTML for r9666 - Utilize $captcha->solved property - Only validate captcha once to retain captcha mode over switching from/to agreement page git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9668 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 4 ++- phpBB/includes/ucp/ucp_register.php | 27 ++++++++++--------- .../prosilver/template/ucp_agreement.html | 6 +++-- phpBB/ucp.php | 4 +-- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 12b9363ec4..30bdc9abce 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2265,7 +2265,7 @@ function reapply_sid($url) { // All kind of links $url = preg_replace('/(\?)?(&|&)?sid=[a-z0-9]+/', '', $url); - // if the sid was the first param, make the old second as first ones + // if the sid was the first param, make the old second as first ones $url = preg_replace("/$phpEx(&|&)+?/", "$phpEx?", $url); } @@ -3844,6 +3844,8 @@ function page_header($page_title = '', $display_online_list = true) 'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'), 'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'), 'U_TEAM' => ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=leaders'), + 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), + 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), 'U_RESTORE_PERMISSIONS' => ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm') : '', 'U_FEED' => generate_board_url() . "/feed.$phpEx", diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index b2bcc794f7..aa3e00685e 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -51,7 +51,7 @@ class ucp_register { add_form_key('ucp_register_terms'); } - + if ($change_lang || $user_lang != $config['default_lang']) { $use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang); @@ -77,12 +77,18 @@ class ucp_register } } - $captcha_solved = false; + $vc_response = false; if ($config['enable_confirm']) { include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_REG); + + // If confirm id is submitted we check the status of the captcha here + if (request_var('confirm_code', '')) + { + $vc_response = $captcha->validate(); + } } $cp = new custom_profile(); @@ -117,10 +123,11 @@ class ucp_register } // Checking amount of available languages - $lang_row = array(); - $sql = 'SELECT lang_id + $sql = 'SELECT lang_id FROM ' . LANG_TABLE; $result = $db->sql_query($sql); + + $lang_row = array(); while ($row = $db->sql_fetchrow($result)) { $lang_row[] = $row; @@ -223,16 +230,10 @@ class ucp_register if ($config['enable_confirm']) { - $vc_response = $captcha->validate(); - if ($vc_response) + if (!$captcha->solved) { $error[] = $vc_response; } - else - { - $captcha_solved = true; - // $captcha->reset(); - } if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts']) { @@ -443,7 +444,7 @@ class ucp_register { $s_hidden_fields['coppa'] = $coppa; } - + if ($config['enable_confirm']) { $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields()); @@ -452,7 +453,7 @@ class ucp_register $confirm_image = ''; // Visual Confirmation - Show images - if ($config['enable_confirm'] && !$captcha_solved) + if ($config['enable_confirm'] && !$captcha->solved) { $template->assign_vars(array( 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''), diff --git a/phpBB/styles/prosilver/template/ucp_agreement.html b/phpBB/styles/prosilver/template/ucp_agreement.html index d64e2aebbe..3825abc08f 100644 --- a/phpBB/styles/prosilver/template/ucp_agreement.html +++ b/phpBB/styles/prosilver/template/ucp_agreement.html @@ -20,10 +20,12 @@

      + {S_HIDDEN_FIELDS}

      -
      - {S_HIDDEN_FIELDS} + +
      +
      diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 908d4fb89a..02b96f4bfb 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -127,8 +127,8 @@ switch ($mode) 'AGREEMENT_TITLE' => $user->lang[$title], 'AGREEMENT_TEXT' => sprintf($user->lang[$message], $config['sitename'], generate_board_url()), 'U_BACK' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), - 'L_BACK' => $user->lang['BACK_TO_LOGIN']) - ); + 'L_BACK' => $user->lang['BACK_TO_LOGIN'], + )); page_footer(); From 08a88fcf33693d4349d3fb478ce4704d70ba3111 Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Wed, 24 Jun 2009 13:31:04 +0000 Subject: [PATCH 139/607] [Feature] Add confirmation for deactivating language packs Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9669 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_language.php | 43 +++++++++++++++++++---------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index c198ae6a73..dec096bf48 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -148,6 +148,7 @@
    249. [Change] "Post details" links with image in MCP. (Bug #39845 - Patch by leviatan21)
    250. [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
    251. [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
    252. +
    253. [Feature] Add confirmation for deactivating language packs (Patch by leviatan21)
    254. [Feature] Backported 3.2 captcha plugins.
    255. [Feature] Introduced new ACM plugins:
        diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 3eee702b1d..8ca45a27f6 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -766,28 +766,41 @@ class acp_language trigger_error($user->lang['NO_REMOVE_DEFAULT_LANG'] . adm_back_link($this->u_action), E_USER_WARNING); } - $db->sql_query('DELETE FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id); + if (confirm_box(true)) + { + $db->sql_query('DELETE FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id); - $sql = 'UPDATE ' . USERS_TABLE . " - SET user_lang = '" . $db->sql_escape($config['default_lang']) . "' - WHERE user_lang = '" . $db->sql_escape($row['lang_iso']) . "'"; - $db->sql_query($sql); + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lang = '" . $db->sql_escape($config['default_lang']) . "' + WHERE user_lang = '" . $db->sql_escape($row['lang_iso']) . "'"; + $db->sql_query($sql); - // We also need to remove the translated entries for custom profile fields - we want clean tables, don't we? - $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . ' WHERE lang_id = ' . $lang_id; - $db->sql_query($sql); + // We also need to remove the translated entries for custom profile fields - we want clean tables, don't we? + $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . ' WHERE lang_id = ' . $lang_id; + $db->sql_query($sql); - $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' WHERE lang_id = ' . $lang_id; - $db->sql_query($sql); + $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' WHERE lang_id = ' . $lang_id; + $db->sql_query($sql); - $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE image_lang = '" . $db->sql_escape($row['lang_iso']) . "'"; - $result = $db->sql_query($sql); + $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE image_lang = '" . $db->sql_escape($row['lang_iso']) . "'"; + $result = $db->sql_query($sql); - $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE); + $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE); - add_log('admin', 'LOG_LANGUAGE_PACK_DELETED', $row['lang_english_name']); + add_log('admin', 'LOG_LANGUAGE_PACK_DELETED', $row['lang_english_name']); - trigger_error(sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name']) . adm_back_link($this->u_action)); + trigger_error(sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name']) . adm_back_link($this->u_action)); + } + else + { + $s_hidden_fields = array( + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'id' => $lang_id, + ); + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); + } break; case 'install': From 2a8cd76f59a24256ae1cd66c8469c57896f8dd24 Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Wed, 24 Jun 2009 13:39:34 +0000 Subject: [PATCH 140/607] Fixed Bug #44455 - Properly display post status messages in topic when post is reported and unapproved Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9670 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/mcp_topic.html | 2 +- phpBB/styles/prosilver/template/viewtopic_body.html | 2 +- phpBB/styles/prosilver/theme/common.css | 1 + phpBB/styles/subsilver2/template/mcp_topic.html | 4 ++-- phpBB/styles/subsilver2/template/viewtopic_body.html | 2 +- phpBB/styles/subsilver2/theme/stylesheet.css | 1 + 7 files changed, 8 insertions(+), 5 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index dec096bf48..acef0e5de0 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -133,6 +133,7 @@
      • [Fix] Correct banned user behaviour when "force password change" is enabled (Bug #47145 - Patch by nickvergessen and leviatan21 )
      • [Fix] Correctly display ACP logs options, without permission to clear logs. (Bug #24155 - Patch by leviatan21)
      • [Fix] Display topic icons in MCP forum view again (only prosilver).
      • +
      • [Fix] Properly display post status messages in topic when post is reported and unapproved (Bug #44455 - Patch by leviatan21)
      • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
      • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
      • [Change] Template engine now permits to a limited extent variable includes.
      • diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index 996d8cf1a2..db36ebf5ac 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -113,7 +113,7 @@ onload_functions.push('subPanels()');

        - {UNAPPROVED_IMG} {L_POST_UNAPPROVED} + {UNAPPROVED_IMG} {L_POST_UNAPPROVED}
        {REPORTED_IMG} {L_POST_REPORTED}

        diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index c1d232eee2..065eb5a1ae 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -140,7 +140,7 @@

        - {UNAPPROVED_IMG} {L_POST_UNAPPROVED} + {UNAPPROVED_IMG} {L_POST_UNAPPROVED}
        {REPORTED_IMG} {L_POST_REPORTED}

        diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 7178fa6e42..956c1b278f 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -611,6 +611,7 @@ p.rules { p.rules img { vertical-align: middle; + padding-top: 5px; } p.rules a { diff --git a/phpBB/styles/subsilver2/template/mcp_topic.html b/phpBB/styles/subsilver2/template/mcp_topic.html index 4accce54d8..12c0f73b97 100644 --- a/phpBB/styles/subsilver2/template/mcp_topic.html +++ b/phpBB/styles/subsilver2/template/mcp_topic.html @@ -111,8 +111,8 @@
    256. diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 43611daf76..794129b22f 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -210,7 +210,7 @@
      - {UNAPPROVED_IMG} {L_POST_UNAPPROVED} - {REPORTED_IMG}{L_POST_REPORTED} + {UNAPPROVED_IMG} {L_POST_UNAPPROVED}
      + {REPORTED_IMG} {L_POST_REPORTED}
      {postrow.MINI_POST_IMG} {L_POSTED}: {postrow.POST_DATE}
      - +
      {UNAPPROVED_IMG} {L_POST_UNAPPROVED} {REPORTED_IMG} {L_POST_REPORTED}{UNAPPROVED_IMG} {L_POST_UNAPPROVED}
      {REPORTED_IMG} {L_POST_REPORTED}
      diff --git a/phpBB/styles/subsilver2/theme/stylesheet.css b/phpBB/styles/subsilver2/theme/stylesheet.css index 62baa33566..cd6770e6c2 100644 --- a/phpBB/styles/subsilver2/theme/stylesheet.css +++ b/phpBB/styles/subsilver2/theme/stylesheet.css @@ -227,6 +227,7 @@ p.topicdetails { .postapprove img, .postreported img { vertical-align: bottom; + padding-top: 5px; } .postauthor { From 9c795870f9c8d5569365d9df9cc7207988dcb609 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 24 Jun 2009 21:13:53 +0000 Subject: [PATCH 141/607] Fix bug #37285 - [Change] Add quote-button for own pm's in pm-history Authorised by: ToonArmy git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9671 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_privmsgs.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index acef0e5de0..3d407d3c77 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -147,6 +147,7 @@
    257. [Change] Ability to fetch moderators with get_moderators() even if load_moderators setting is off. (Bug #35955)
    258. [Change] Add WAI-ARIA landmarks for easier accessibility to the prosilver template (Bug #45715 - Patch by MarcoZ)
    259. [Change] "Post details" links with image in MCP. (Bug #39845 - Patch by leviatan21)
    260. +
    261. [Change] Add quote-button for own pm's in pm-history (Bug #37285 - Patch by nickvergessen)
    262. [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
    263. [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
    264. [Feature] Add confirmation for deactivating language packs (Patch by leviatan21)
    265. diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 96400ad70d..271cce9f42 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1781,7 +1781,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $decoded_message = false; - if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) + if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) { $decoded_message = $message; decode_message($decoded_message, $row['bbcode_uid']); @@ -1824,7 +1824,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode 'MSG_ID' => $row['msg_id'], 'U_VIEW_MESSAGE' => "$url&f=$folder_id&p=" . $row['msg_id'], - 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', + 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') ); unset($rowset[$i]); From b4c17b3732659991e979b989327fe375a9218df0 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 25 Jun 2009 08:26:51 +0000 Subject: [PATCH 142/607] We have to use the documented API git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9672 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../captcha/plugins/captcha_abstract.php | 18 ++++++++++++++---- phpBB/includes/ucp/ucp_register.php | 4 ++-- phpBB/posting.php | 9 ++------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index 6962100945..e23cfd0de0 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -30,7 +30,7 @@ class phpbb_default_captcha var $seed; var $attempts = 0; var $type; - var $solved = false; + var $solved = 0; var $captcha_vars = false; function init($type) @@ -223,7 +223,7 @@ class phpbb_default_captcha $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->confirm_id = md5(unique_id($user->ip)); $this->seed = hexdec(substr(unique_id(), 4, 10)); - $this->solved = false; + $this->solved = 0; // compute $seed % 0x7fffffff $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); @@ -246,7 +246,7 @@ class phpbb_default_captcha $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->seed = hexdec(substr(unique_id(), 4, 10)); - $this->solved = false; + $this->solved = 0; // compute $seed % 0x7fffffff $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); @@ -268,7 +268,7 @@ class phpbb_default_captcha $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->seed = hexdec(substr(unique_id(), 4, 10)); - $this->solved = false; + $this->solved = 0; // compute $seed % 0x7fffffff $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); @@ -342,6 +342,16 @@ class phpbb_default_captcha // we leave the class usable by generating a new question $this->generate_code(); } + + function is_solved() + { + if ($this->solved === 0) + { + $this->validate(); + } + return (bool) $this->solved; + } + } ?> \ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index aa3e00685e..8192f5489b 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -230,7 +230,7 @@ class ucp_register if ($config['enable_confirm']) { - if (!$captcha->solved) + if (!$captcha->is_solved()) { $error[] = $vc_response; } @@ -453,7 +453,7 @@ class ucp_register $confirm_image = ''; // Visual Confirmation - Show images - if ($config['enable_confirm'] && !$captcha->solved) + if ($config['enable_confirm'] && !$captcha->is_solved()) { $template->assign_vars(array( 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''), diff --git a/phpBB/posting.php b/phpBB/posting.php index 9f63e43345..66daf7128f 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -592,7 +592,6 @@ if ($load && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_ load_drafts($topic_id, $forum_id); } -$solved_captcha = false; if ($submit || $preview || $refresh) { @@ -778,10 +777,6 @@ if ($submit || $preview || $refresh) { $error[] = $vc_response; } - else - { - $solved_captcha = true; - } } // check form @@ -1247,7 +1242,7 @@ generate_forum_nav($post_data); // Build Forum Rules generate_forum_rules($post_data); -if ($config['enable_post_confirm'] && !$user->data['is_registered'] && $solved_captcha === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) +if ($config['enable_post_confirm'] && !$user->data['is_registered'] && $captcha->is_solved() === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) { $captcha->reset(); @@ -1262,7 +1257,7 @@ $s_hidden_fields .= '' : ''; // Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview -if ($solved_captcha !== false) +if ($captcha->is_solved() !== false) { $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields()); } From 7ca31ace1a023c910470208abec219b1c03923ac Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 25 Jun 2009 10:39:36 +0000 Subject: [PATCH 143/607] fix r9652 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9673 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_permissions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 077a3d7c83..8e03a7fa52 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -254,6 +254,16 @@ class acp_permissions } else { + if (isset($_POST['cancel'])) + { + $u_redirect = $this->u_action . '&type=' . $permission_type; + foreach ($forum_id as $fid) + { + $u_redirect .= '&forum_id[]=' . $fid; + } + redirect($u_redirect); + } + $s_hidden_fields = array( 'i' => $id, 'mode' => $mode, From 1c0df0dc91dcfb603cfb653e7daaf03257ac5495 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 25 Jun 2009 17:57:57 +0000 Subject: [PATCH 144/607] revert r9653 because it does not work as advertised (a load of bugs and not really what we wanted... back to the drawing board ;)) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9674 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 - phpBB/includes/functions.php | 1 - phpBB/language/en/common.php | 1 - phpBB/search.php | 5 ----- phpBB/styles/prosilver/template/index_body.html | 2 +- phpBB/styles/subsilver2/template/overall_header.html | 2 +- 6 files changed, 2 insertions(+), 10 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3d407d3c77..fccd426867 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -169,7 +169,6 @@
    266. [Feature] Enhance obtain_users_online_string to be able to return user-lists for other session-items (Bug #31975 - Patch by nickvergessen)
    267. [Feature] Add unapproved topic icon for moderators on forum list (Bug #46865 - Patch by nickvergessen)
    268. [Feature] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)
    269. -
    270. [Feature] Add unread posts quick search option (Bug #46765 - Patch by rxu)
    271. [Feature] Ability to define minimum number of characters for posts/pms
    272. diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 30bdc9abce..25bef4557a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3840,7 +3840,6 @@ function page_header($page_title = '', $display_online_list = true) 'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'), 'U_SEARCH_NEW' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'), 'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'), - 'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'), 'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'), 'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'), 'U_TEAM' => ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=leaders'), diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index a2b8eafd52..6f3433892a 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -522,7 +522,6 @@ $lang = array_merge($lang, array( 'SEARCH_SELF' => 'View your posts', 'SEARCH_TOPIC' => 'Search this topic…', 'SEARCH_UNANSWERED' => 'View unanswered posts', - 'SEARCH_UNREAD' => 'View unread posts', 'SECONDS' => 'Seconds', 'SELECT' => 'Select', 'SELECT_ALL_CODE' => 'Select all', diff --git a/phpBB/search.php b/phpBB/search.php index e5fd852e0d..5e2a7c2836 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -348,7 +348,6 @@ if ($keywords || $author || $author_id || $search_id || $submit) break; case 'newposts': - case 'unreadposts': $l_search_title = $user->lang['SEARCH_NEW']; // force sorting $show_results = (request_var('sr', 'topics') == 'posts') ? 'posts' : 'topics'; @@ -804,10 +803,6 @@ if ($keywords || $author || $author_id || $search_id || $submit) topic_status($row, $replies, (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false, $folder_img, $folder_alt, $topic_type); $unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false; - if ($search_id == 'unreadposts' && !$unread_topic) - { - continue; - } $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index 9cb4d2067d..43d8ad0309 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -6,7 +6,7 @@ diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index a45e51b467..3dd8740832 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -201,7 +201,7 @@ function marklist(id, name, state) From 519492f71739539a0339ccd8a9c73d7c2ba48cd6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Jun 2009 09:56:09 +0000 Subject: [PATCH 145/607] Fix bug #46975 - "Report details" link broken in MCP Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9675 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/mcp.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index fccd426867..0fd40d26db 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -134,6 +134,7 @@
    273. [Fix] Correctly display ACP logs options, without permission to clear logs. (Bug #24155 - Patch by leviatan21)
    274. [Fix] Display topic icons in MCP forum view again (only prosilver).
    275. [Fix] Properly display post status messages in topic when post is reported and unapproved (Bug #44455 - Patch by leviatan21)
    276. +
    277. [Fix] "Report details" link broken in MCP (Bug #46975 - Patch by nickvergessen)
    278. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    279. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    280. [Change] Template engine now permits to a limited extent variable includes.
    281. diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 5f7aa3bd1f..17e2f7f115 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -77,6 +77,7 @@ if ($mode == 'topic_logs') $post_id = request_var('p', 0); $topic_id = request_var('t', 0); $forum_id = request_var('f', 0); +$report_id = request_var('r', 0); $user_id = request_var('u', 0); $username = utf8_normalize_nfc(request_var('username', '', true)); @@ -323,13 +324,14 @@ function _module_reports_url($mode, &$module_row) function extra_url() { - global $forum_id, $topic_id, $post_id, $user_id; + global $forum_id, $topic_id, $post_id, $report_id, $user_id; $url_extra = ''; $url_extra .= ($forum_id) ? "&f=$forum_id" : ''; $url_extra .= ($topic_id) ? "&t=$topic_id" : ''; $url_extra .= ($post_id) ? "&p=$post_id" : ''; $url_extra .= ($user_id) ? "&u=$user_id" : ''; + $url_extra .= ($report_id) ? "&r=$report_id" : ''; return $url_extra; } From f4fb682bbb329145686a88bdb3031b8b74f698f2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Jun 2009 10:04:21 +0000 Subject: [PATCH 146/607] Fix bug #47015 - Prune users does not prune founders Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9676 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/prune.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/prune.php b/phpBB/language/en/acp/prune.php index 5217bd4416..2f4a9b4984 100644 --- a/phpBB/language/en/acp/prune.php +++ b/phpBB/language/en/acp/prune.php @@ -53,7 +53,7 @@ $lang = array_merge($lang, array( 'PRUNE_USERS_LIST_DELETE' => 'With the selected critera for pruning users the following accounts will be removed.', 'PRUNE_USERS_LIST_DEACTIVATE' => 'With the selected critera for pruning users the following accounts will be deactivated.', - 'SELECT_USERS_EXPLAIN' => 'Enter specific usernames here, they will be used in preference to the criteria above.', + 'SELECT_USERS_EXPLAIN' => 'Enter specific usernames here, they will be used in preference to the criteria above. Founders cannot be pruned.', 'USER_DEACTIVATE_SUCCESS' => 'The selected users have been deactivated successfully.', 'USER_DELETE_SUCCESS' => 'The selected users have been deleted successfully.', From d39d8481cfd6a9cd1e418aaff14833a149770e71 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Jun 2009 10:07:59 +0000 Subject: [PATCH 147/607] Change bug #39505 - Pm history only shows pms of the receipts you currently reply to Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9677 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_privmsgs.php | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 0fd40d26db..0d09c5dc00 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -148,6 +148,7 @@
    282. [Change] Ability to fetch moderators with get_moderators() even if load_moderators setting is off. (Bug #35955)
    283. [Change] Add WAI-ARIA landmarks for easier accessibility to the prosilver template (Bug #45715 - Patch by MarcoZ)
    284. [Change] "Post details" links with image in MCP. (Bug #39845 - Patch by leviatan21)
    285. +
    286. [Change] Pm history only shows pms of the receipts you currently reply to (Bug #39505 - Patch by nickvergessen)
    287. [Change] Add quote-button for own pm's in pm-history (Bug #37285 - Patch by nickvergessen)
    288. [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
    289. [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
    290. diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 271cce9f42..8851b53680 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1691,12 +1691,29 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode { global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth, $bbcode; + // Select all receipts and the author from the pm we currently view, to only display their pm-history + $sql = 'SELECT author_id, user_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE msg_id = $msg_id + AND folder_id <> " . PRIVMSGS_HOLD_BOX; + $result = $db->sql_query($sql); + + $recipients = array(); + while ($row = $db->sql_fetchrow($result)) + { + $recipients[] = $row['user_id']; + $recipients[] = $row['author_id']; + } + $db->sql_freeresult($result); + $recipients = array_unique($recipients); + // Get History Messages (could be newer) $sql = 'SELECT t.*, p.*, u.* FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u WHERE t.msg_id = p.msg_id AND p.author_id = u.user_id - AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ") + AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') + AND ' . $db->sql_in_set('t.author_id', $recipients) . " AND t.user_id = $user_id"; if (!$message_row['root_level']) From d92bdc8a76c8e1ab2f3398c84fc74750f71b4ea4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Jun 2009 10:15:42 +0000 Subject: [PATCH 148/607] Fix bug #46225 - Add poster-name to moderator-log when deleting post/topic Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9678 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/language/en/acp/common.php | 4 ++-- phpBB/posting.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 0d09c5dc00..10085f69da 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -134,6 +134,7 @@
    291. [Fix] Correctly display ACP logs options, without permission to clear logs. (Bug #24155 - Patch by leviatan21)
    292. [Fix] Display topic icons in MCP forum view again (only prosilver).
    293. [Fix] Properly display post status messages in topic when post is reported and unapproved (Bug #44455 - Patch by leviatan21)
    294. +
    295. [Fix] Add poster-name to moderator-log when deleting post/topic (Bug #46225 - Patch by nickvergessen)
    296. [Fix] "Report details" link broken in MCP (Bug #46975 - Patch by nickvergessen)
    297. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    298. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    299. diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 65475d7627..7e92594b85 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -479,9 +479,9 @@ $lang = array_merge($lang, array( 'LOG_APPROVE_TOPIC' => 'Approved topic
      » %s', 'LOG_BUMP_TOPIC' => 'User bumped topic
      » %s', - 'LOG_DELETE_POST' => 'Deleted post
      » %s', + 'LOG_DELETE_POST' => 'Deleted post “%1$s” written by
      » %2$s', 'LOG_DELETE_SHADOW_TOPIC' => 'Deleted shadow topic
      » %s', - 'LOG_DELETE_TOPIC' => 'Deleted topic
      » %s', + 'LOG_DELETE_TOPIC' => 'Deleted topic “%1$s” written by
      » %2$s', 'LOG_FORK' => 'Copied topic
      » from %s', 'LOG_LOCK' => 'Locked topic
      » %s', 'LOG_LOCK_POST' => 'Locked post
      » %s', diff --git a/phpBB/posting.php b/phpBB/posting.php index 66daf7128f..4f099d97ac 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1440,14 +1440,14 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) if ($next_post_id === false) { - add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_TOPIC', $post_data['topic_title']); + add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_TOPIC', $post_data['topic_title'], $post_data['username']); $meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"); $message = $user->lang['POST_DELETED']; } else { - add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_POST', $post_data['post_subject']); + add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_POST', $post_data['post_subject'], $post_data['username']); $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id"; $message = $user->lang['POST_DELETED'] . '

      ' . sprintf($user->lang['RETURN_TOPIC'], '', ''); From 3adaf7534ebb5ab505985723f9a519796467b080 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 10:24:41 +0000 Subject: [PATCH 149/607] Thanks NV git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9679 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 4f099d97ac..a82854c3a4 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1242,7 +1242,7 @@ generate_forum_nav($post_data); // Build Forum Rules generate_forum_rules($post_data); -if ($config['enable_post_confirm'] && !$user->data['is_registered'] && $captcha->is_solved() === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) +if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === false) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) { $captcha->reset(); From fa9021c4420d92c73609e11eab8317e637c84639 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 10:26:01 +0000 Subject: [PATCH 150/607] Thanks NV git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9680 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index a82854c3a4..9d06ac3e2c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1257,7 +1257,7 @@ $s_hidden_fields .= '' : ''; // Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview -if ($captcha->is_solved() !== false) +if (isset($captcha) && $captcha->is_solved() !== false) { $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields()); } From fe916f427b54d11ff9c87256f7ea05ccbe3e74c6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 26 Jun 2009 10:43:01 +0000 Subject: [PATCH 151/607] Fix Bug #44685 - Resolve accesskey conflicts Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9681 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/overall_header.html | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 10085f69da..ba2c94e851 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -136,6 +136,7 @@
    300. [Fix] Properly display post status messages in topic when post is reported and unapproved (Bug #44455 - Patch by leviatan21)
    301. [Fix] Add poster-name to moderator-log when deleting post/topic (Bug #46225 - Patch by nickvergessen)
    302. [Fix] "Report details" link broken in MCP (Bug #46975 - Patch by nickvergessen)
    303. +
    304. [Fix] Resolve accesskey conflicts in prosilver. (Bug #44685 - Patch by bantu)
    305. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    306. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    307. [Change] Template engine now permits to a limited extent variable includes.
    308. diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 383bf74bb2..972c9a5c80 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -147,7 +147,7 @@ From 5d6dca16a7b7e9c043570139c90b97c83a01bb5e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 26 Jun 2009 10:47:19 +0000 Subject: [PATCH 152/607] Fix bug #47345 - Check if template file is empty before trying to read from it. Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9682 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_styles.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ba2c94e851..2567ba288e 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -137,6 +137,7 @@
    309. [Fix] Add poster-name to moderator-log when deleting post/topic (Bug #46225 - Patch by nickvergessen)
    310. [Fix] "Report details" link broken in MCP (Bug #46975 - Patch by nickvergessen)
    311. [Fix] Resolve accesskey conflicts in prosilver. (Bug #44685 - Patch by bantu)
    312. +
    313. [Fix] Check if template file is empty before trying to read from it. (Bug #47345 - Patch by bantu)
    314. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    315. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    316. [Change] Template engine now permits to a limited extent variable includes.
    317. diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 16b1852cd6..ab9ddc0b6f 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -2556,9 +2556,22 @@ parse_css_file = {PARSE_CSS_FILE} { trigger_error("Could not open {$phpbb_root_path}styles/$template_path$pathfile$file", E_USER_ERROR); } - $template_data = fread($fp, filesize("{$phpbb_root_path}styles/$template_path$pathfile$file")); + + $filesize = filesize("{$phpbb_root_path}styles/$template_path$pathfile$file"); + + if ($filesize) + { + $template_data = fread($fp, $filesize); + } + fclose($fp); + if (!$filesize) + { + // File is empty + continue; + } + if (preg_match_all('##is', $template_data, $matches)) { foreach ($matches[1] as $match) From e77f7e2a81bb870b853146dbd10424ff7fa283ce Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 26 Jun 2009 10:50:29 +0000 Subject: [PATCH 153/607] Fix bug #47085 - XHTML issue in the installer. Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9683 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/language/en/install.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 2567ba288e..06669709a5 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -93,7 +93,7 @@
    318. [Fix] Correctly determine writable status of files on Windows operating system. (Bug #39035)
    319. [Fix] Show report button in prosilver for guests who are allowed to report posts. (Bug #45695 - Patch by bantu)
    320. [Fix] Correctly show private message history (Bug #46065 - Patch by bantu)
    321. -
    322. [Fix] Various XHTML mistakes in prosilver, subsilver2 and the ACP. (Bugs #25545 - Patch by bantu, #26315, #38555, #45505 - Patch by Raimon, #45785, #45865)
    323. +
    324. [Fix] Various XHTML mistakes in prosilver, subsilver2 and the ACP. (Bugs #25545 - Patch by bantu, #26315, #38555, #45505 - Patch by Raimon, #45785, #45865, #47085 - Patch by Raimon)
    325. [Fix] Fix some ACP style issues (Bug #45975 - Patch by leviatan21)
    326. [Fix] Move post bump information markup to the template. (Bug #34295 - Patch by bantu)
    327. [Fix] Show error in the ACP when template folder is not readable. (Bug #45705 - Patch by bantu)
    328. diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index d3fd8d5e26..8e48dfbb36 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -184,11 +184,11 @@ $lang = array_merge($lang, array( 'INITIAL_CONFIG_EXPLAIN' => 'Now that install has determined your server can run phpBB you need to supply some specific information. If you do not know how to connect to your database please contact your hosting provider (in the first instance) or use the phpBB support forums. When entering data please ensure you check it thoroughly before continuing.', 'INSTALL_CONGRATS' => 'Congratulations!', 'INSTALL_CONGRATS_EXPLAIN' => ' -

      You have now successfully installed phpBB %1$s. From here, you have two options as to what to do with your newly installed phpBB3:

      + You have now successfully installed phpBB %1$s. From here, you have two options as to what to do with your newly installed phpBB3:

      Convert an existing board to phpBB3

      The phpBB Unified Convertor Framework supports the conversion of phpBB 2.0.x and other board systems to phpBB3. If you have an existing board that you wish to convert, please proceed on to the convertor.

      Go live with your phpBB3!

      -

      Clicking the button below will take you to your Administration Control Panel (ACP). Take some time to examine the options available to you. Remember that help is available online via the Documentation and the support forums, see the README for further information.

      Please now delete, move or rename the install directory before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible.

      ', +

      Clicking the button below will take you to your Administration Control Panel (ACP). Take some time to examine the options available to you. Remember that help is available online via the Documentation and the support forums, see the README for further information.

      Please now delete, move or rename the install directory before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible.', 'INSTALL_INTRO' => 'Welcome to Installation', 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

      In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

      From 8f60b757b85579407bd1ef07a59b85b1a791e43c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Jun 2009 11:34:27 +0000 Subject: [PATCH 154/607] Change bug #47425 - IP data lost on pagination Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9684 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/memberlist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 08451ac6b2..ccd215c590 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1247,7 +1247,7 @@ switch ($mode) 'joined' => array('joined', ''), 'active' => array('active', ''), 'count' => (request_var('count', '') !== '') ? array('count', 0) : array('count', ''), - 'ipdomain' => array('ip', ''), + 'ip' => array('ip', ''), 'first_char' => array('first_char', ''), ); From 89ddc4543f987f4edda07e7a09552a2e93dc238a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Jun 2009 11:38:29 +0000 Subject: [PATCH 155/607] Fix bug #38395 - Loading draft removes recipients when replying to PM Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9685 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_posting.php | 4 ++-- phpBB/includes/ucp/ucp_pm_compose.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 06669709a5..2704013dbf 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -134,6 +134,7 @@
    329. [Fix] Correctly display ACP logs options, without permission to clear logs. (Bug #24155 - Patch by leviatan21)
    330. [Fix] Display topic icons in MCP forum view again (only prosilver).
    331. [Fix] Properly display post status messages in topic when post is reported and unapproved (Bug #44455 - Patch by leviatan21)
    332. +
    333. [Fix] Loading draft removes recipients when replying to PM (Bug #38395 - Patch by nickvergessen)
    334. [Fix] Add poster-name to moderator-log when deleting post/topic (Bug #46225 - Patch by nickvergessen)
    335. [Fix] "Report details" link broken in MCP (Bug #46975 - Patch by nickvergessen)
    336. [Fix] Resolve accesskey conflicts in prosilver. (Bug #44685 - Patch by bantu)
    337. diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index e0dc128583..18bb432769 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -818,7 +818,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a /** * Load Drafts */ -function load_drafts($topic_id = 0, $forum_id = 0, $id = 0) +function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $msg_id = 0) { global $user, $db, $template, $auth; global $phpbb_root_path, $phpEx; @@ -911,7 +911,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0) { // Either display as PM draft if forum_id and topic_id are empty or if access to the forums has been denied afterwards... $link_pm = true; - $insert_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=compose&d={$draft['draft_id']}"); + $insert_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=compose&d={$draft['draft_id']}" . (($pm_action) ? "&action=$pm_action" : '') . (($msg_id) ? "&p=$msg_id" : '')); } $template->assign_block_vars('draftrow', array( diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 008d8d6c88..85e43dfc8c 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -631,7 +631,7 @@ function compose_pm($id, $mode, $action) // Load Drafts if ($load && $drafts) { - load_drafts(0, 0, $id); + load_drafts(0, 0, $id, $action, $msg_id); } if ($submit || $preview || $refresh) From 7cc969283153c5df0c5eaf4c198f635e2f2fe7c5 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Fri, 26 Jun 2009 11:52:54 +0000 Subject: [PATCH 156/607] Fix bug #36065 - Setting descriptor needs be more specific Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9686 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/language/en/acp/permissions_phpbb.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 2704013dbf..c57345c396 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -139,6 +139,7 @@
    338. [Fix] "Report details" link broken in MCP (Bug #46975 - Patch by nickvergessen)
    339. [Fix] Resolve accesskey conflicts in prosilver. (Bug #44685 - Patch by bantu)
    340. [Fix] Check if template file is empty before trying to read from it. (Bug #47345 - Patch by bantu)
    341. +
    342. [Fix] Correct descriptions of the permissions to use BBCode, smilies, images and flash to be more relevant. (Bug #36065 - Patch by rxu)
    343. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    344. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    345. [Change] Template engine now permits to a limited extent variable includes.
    346. diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index c8ccc0e56a..945a675861 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -121,10 +121,10 @@ $lang = array_merge($lang, array( 'acl_u_pm_printpm' => array('lang' => 'Can print private messages', 'cat' => 'pm'), 'acl_u_pm_attach' => array('lang' => 'Can attach files in private messages', 'cat' => 'pm'), 'acl_u_pm_download' => array('lang' => 'Can download files in private messages', 'cat' => 'pm'), - 'acl_u_pm_bbcode' => array('lang' => 'Can post BBCode in private messages', 'cat' => 'pm'), - 'acl_u_pm_smilies' => array('lang' => 'Can post smilies in private messages', 'cat' => 'pm'), - 'acl_u_pm_img' => array('lang' => 'Can post images in private messages', 'cat' => 'pm'), - 'acl_u_pm_flash' => array('lang' => 'Can post Flash in private messages', 'cat' => 'pm'), + 'acl_u_pm_bbcode' => array('lang' => 'Can use BBCode in private messages', 'cat' => 'pm'), + 'acl_u_pm_smilies' => array('lang' => 'Can use smilies in private messages', 'cat' => 'pm'), + 'acl_u_pm_img' => array('lang' => 'Can use [img] BBCode tag in private messages', 'cat' => 'pm'), + 'acl_u_pm_flash' => array('lang' => 'Can use [flash] BBCode tag in private messages', 'cat' => 'pm'), 'acl_u_sendemail' => array('lang' => 'Can send e-mails', 'cat' => 'misc'), 'acl_u_sendim' => array('lang' => 'Can send instant messages', 'cat' => 'misc'), @@ -151,10 +151,10 @@ $lang = array_merge($lang, array( 'acl_f_attach' => array('lang' => 'Can attach files', 'cat' => 'content'), 'acl_f_download' => array('lang' => 'Can download files', 'cat' => 'content'), 'acl_f_sigs' => array('lang' => 'Can use signatures', 'cat' => 'content'), - 'acl_f_bbcode' => array('lang' => 'Can post BBCode', 'cat' => 'content'), - 'acl_f_smilies' => array('lang' => 'Can post smilies', 'cat' => 'content'), - 'acl_f_img' => array('lang' => 'Can post images', 'cat' => 'content'), - 'acl_f_flash' => array('lang' => 'Can post Flash', 'cat' => 'content'), + 'acl_f_bbcode' => array('lang' => 'Can use BBCode', 'cat' => 'content'), + 'acl_f_smilies' => array('lang' => 'Can use smilies', 'cat' => 'content'), + 'acl_f_img' => array('lang' => 'Can use [img] BBCode tag', 'cat' => 'content'), + 'acl_f_flash' => array('lang' => 'Can use [flash] BBCode tag', 'cat' => 'content'), 'acl_f_edit' => array('lang' => 'Can edit own posts', 'cat' => 'actions'), 'acl_f_delete' => array('lang' => 'Can delete own posts', 'cat' => 'actions'), From 366a15d605bbecb3b55ebba91a8db2ac37807f4c Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Fri, 26 Jun 2009 14:15:45 +0000 Subject: [PATCH 157/607] Fixed Bug #26375 - Fix style issues in print mode. (Bug #26375 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9687 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/theme/print.css | 13 +++++++++++-- .../styles/subsilver2/template/viewtopic_print.html | 12 ++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index c57345c396..c43954cd86 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -140,6 +140,7 @@
    347. [Fix] Resolve accesskey conflicts in prosilver. (Bug #44685 - Patch by bantu)
    348. [Fix] Check if template file is empty before trying to read from it. (Bug #47345 - Patch by bantu)
    349. [Fix] Correct descriptions of the permissions to use BBCode, smilies, images and flash to be more relevant. (Bug #36065 - Patch by rxu)
    350. +
    351. [Fix] Fix style issues in print mode. (Bug #26375 - Patch by leviatan21)
    352. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    353. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    354. [Change] Template engine now permits to a limited extent variable includes.
    355. diff --git a/phpBB/styles/prosilver/theme/print.css b/phpBB/styles/prosilver/theme/print.css index 3143b3cf9b..09afaa9112 100644 --- a/phpBB/styles/prosilver/theme/print.css +++ b/phpBB/styles/prosilver/theme/print.css @@ -108,7 +108,7 @@ html>body .postbody h1 a:link:after, html>body .postbody h2 a:link:after { .grip-show { display:none; } /* Quote */ -.postquote { +.postquote, blockquote { font-size: 85%; margin: 1em 18% 1em 4%; padding: 0.5em; @@ -120,7 +120,16 @@ html>body .postbody h1 a:link:after, html>body .postbody h2 a:link:after { .postquote img { display: none; } .postquote span { display: block; } .postquote span .postquote { font-size: 100%; } -.quote-by { font-weight: bold; } +.quote-by, blockquote cite { + color: black; + display : block; + font-weight: bold; +} + +/* List */ +ol, ul { + margin-left: 15pt +} /* Misc page elements */ div.spacer { clear: both; } diff --git a/phpBB/styles/subsilver2/template/viewtopic_print.html b/phpBB/styles/subsilver2/template/viewtopic_print.html index 33d33f9c74..e1521c00a7 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_print.html +++ b/phpBB/styles/subsilver2/template/viewtopic_print.html @@ -24,12 +24,20 @@ td { line-height: 150%; } -.code, -.quote { +.code, .codecontent, +.quote, .quotecontent { + margin: 0 5px 0 5px; + padding: 5px; font-size: smaller; border: black solid 1px; } +.quotetitle { + color: black; + display : block; + font-weight: bold; +} + .forum { font-family: Arial,Helvetica,sans-serif; font-weight: bold; From a130dd31ed6cf2c630f3e5a4457c5bb47e475bca Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 14:36:40 +0000 Subject: [PATCH 158/607] this is very much work in progress; please feel free to improve markup, usability and to introduce possible further settings (per forum, per user) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9688 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/viewtopic.php | 2 + .../prosilver/template/quickreply_editor.html | 58 +++++++++++++++++++ .../template/quickreply_editor.html | 23 ++++++++ phpBB/viewtopic.php | 45 +++++++++++++- 4 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 phpBB/styles/prosilver/template/quickreply_editor.html create mode 100644 phpBB/styles/subsilver2/template/quickreply_editor.html diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index 4252fa7542..5c28b94d4e 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -86,11 +86,13 @@ $lang = array_merge($lang, array( 'PRINT_TOPIC' => 'Print view', 'QUICK_MOD' => 'Quick-mod tools', + 'QUICKREPLY' => 'Quick Reply', 'QUOTE' => 'Quote', 'REPLY_TO_TOPIC' => 'Reply to topic', 'RETURN_POST' => '%sReturn to the post%s', + 'SHOW_QR' => 'Show Editor', 'SUBMIT_VOTE' => 'Submit vote', 'TOTAL_VOTES' => 'Total votes', diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html new file mode 100644 index 0000000000..fbbcba9aba --- /dev/null +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -0,0 +1,58 @@ + + + +
      +
      +
      +

      {L_QUICKREPLY}

      + +
      +
      +
      +
      +
      +
      + +
      + +
      + +
      + {S_FORM_TOKEN} + {S_HIDDEN_FIELDS} +   +
      +
      +
      +
      + + + + + +
      \ No newline at end of file diff --git a/phpBB/styles/subsilver2/template/quickreply_editor.html b/phpBB/styles/subsilver2/template/quickreply_editor.html new file mode 100644 index 0000000000..286376633a --- /dev/null +++ b/phpBB/styles/subsilver2/template/quickreply_editor.html @@ -0,0 +1,23 @@ +
      + + + + + + + + + + + + + + +
      {L_QUICKREPLY}
      {L_SUBJECT}:
      + + {S_FORM_TOKEN} + {S_HIDDEN_FIELDS} +
      + +
      +
      \ No newline at end of file diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0387ae3a05..94f866a35c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -41,6 +41,7 @@ $sort_dir = request_var('sd', $default_sort_dir); $update = request_var('update', false); +$s_can_vote = false; /** * @todo normalize? */ @@ -695,7 +696,7 @@ if (!empty($topic_data['poll_start'])) if ($update && $s_can_vote) { - if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id)) + if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) { $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"); @@ -708,10 +709,14 @@ if (!empty($topic_data['poll_start'])) { $message = 'TOO_MANY_VOTE_OPTIONS'; } - else + else if (in_array(VOTE_CONVERTED, $cur_voted_id)) { $message = 'VOTE_CONVERTED'; } + else + { + $message = 'FORM_INVALID'; + } $message = $user->lang[$message] . '

      ' . sprintf($user->lang['RETURN_TOPIC'], '', ''); trigger_error($message); @@ -1422,6 +1427,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) { $s_first_unread = $first_unread = true; } + // $postrow = array( @@ -1598,6 +1604,41 @@ else if (!$all_marked_read) } } +// let's set up quick_reply +// TODO: introduce a per-forum and a per-user setting +if ($s_can_vote || $config['allow_quick_reply']) +{ + add_form_key('posting'); + if ($user->data['is_registered'] && $config['allow_quick_reply']) + { + + $s_attach_sig = $config['allow_sig'] && strlen($user->data['user_sig']) && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); + $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); + $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); + $s_notify = $config['allow_topic_notify'] && $user->data['user_notify']; + $qr_hidden_fields = array( + 'topic_cur_post_id' => $topic_data['topic_last_post_id'], + 'lastclick' => time(), + 'topic_id' => $topic_data['topic_id'], + 'forum_id' => $forum_id, + 'disable_bbcode' => !$s_bbcode, + 'disable_smilies' => !$s_smilies, + 'disable_magic_url' => !$config['allow_post_links'], + 'attach_sig' => $s_attach_sig, + 'notify' => $s_notify, + ); + + $template->assign_vars(array( + 'S_QUICK_REPLY' => true, + 'U_QR_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id"), + 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), + 'SUBJECT' => 'Re: ' . censor_text($topic_data['topic_title']), + + )); + } +} + + // We overwrite $_REQUEST['f'] if there is no forum specified // to be able to display the correct online list. // One downside is that the user currently viewing this topic/post is not taken into account. From 8184875932d9f2bb05b92f14260ed9b4182038a7 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 14:38:00 +0000 Subject: [PATCH 159/607] this is very much work in progress; please feel free to improve markup, usability and to introduce possible further settings (per forum, per user) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9689 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/viewtopic_body.html | 4 +++- phpBB/styles/subsilver2/template/viewtopic_body.html | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 065eb5a1ae..f8f54993f9 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -253,7 +253,9 @@
      - + + + diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 794129b22f..cfce658b47 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -324,6 +324,9 @@
      + + + From e2f01e86d08b91ceab02267ad135ddd33df7106c Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 15:00:17 +0000 Subject: [PATCH 160/607] meh git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9690 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subsilver2/template/quickreply_editor.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/subsilver2/template/quickreply_editor.html b/phpBB/styles/subsilver2/template/quickreply_editor.html index 286376633a..843812bb20 100644 --- a/phpBB/styles/subsilver2/template/quickreply_editor.html +++ b/phpBB/styles/subsilver2/template/quickreply_editor.html @@ -9,7 +9,8 @@ - + {L_MESSAGE}: + From 18c5c8e8eca03e4d0e142f106168eecfde3b2450 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 15:25:56 +0000 Subject: [PATCH 161/607] oh, it is already in here git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9691 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 94f866a35c..70dc8b77bb 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1606,10 +1606,11 @@ else if (!$all_marked_read) // let's set up quick_reply // TODO: introduce a per-forum and a per-user setting -if ($s_can_vote || $config['allow_quick_reply']) +$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY); +if ($s_can_vote || $s_quick_reply ) { add_form_key('posting'); - if ($user->data['is_registered'] && $config['allow_quick_reply']) + if ($s_quick_reply) { $s_attach_sig = $config['allow_sig'] && strlen($user->data['user_sig']) && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); From 957d1d43dc003adf0df735bea001f438b61ca39a Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 15:30:04 +0000 Subject: [PATCH 162/607] And check for permissions... git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9692 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 70dc8b77bb..94fdf821c3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1606,7 +1606,7 @@ else if (!$all_marked_read) // let's set up quick_reply // TODO: introduce a per-forum and a per-user setting -$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY); +$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id) ; if ($s_can_vote || $s_quick_reply ) { add_form_key('posting'); From 31968a5070a60d22aae1ed7bf503c92259b562e0 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 15:33:55 +0000 Subject: [PATCH 163/607] gah git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9693 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 94fdf821c3..90e033dab7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1606,7 +1606,7 @@ else if (!$all_marked_read) // let's set up quick_reply // TODO: introduce a per-forum and a per-user setting -$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id) ; +$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id) ; if ($s_can_vote || $s_quick_reply ) { add_form_key('posting'); @@ -1638,6 +1638,7 @@ if ($s_can_vote || $s_quick_reply ) )); } } +// now I have the urge to wash my hands :( // We overwrite $_REQUEST['f'] if there is no forum specified From d61574a61e4b46f8c7ad0e75f0e2261ab8405670 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 20:18:05 +0000 Subject: [PATCH 164/607] Okay it should work again. Thanks Raimon. In the future, please test if your changes are really a good idea. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9694 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/ucp/ucp_register.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 8192f5489b..ef6b076ebc 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -77,19 +77,6 @@ class ucp_register } } - $vc_response = false; - if ($config['enable_confirm']) - { - include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']); - $captcha->init(CONFIRM_REG); - - // If confirm id is submitted we check the status of the captcha here - if (request_var('confirm_code', '')) - { - $vc_response = $captcha->validate(); - } - } $cp = new custom_profile(); @@ -171,6 +158,15 @@ class ucp_register $this->tpl_name = 'ucp_agreement'; return; } + + + // The CAPTCHA kicks in here. We can't help that the information gets lost on language change. + if ($config['enable_confirm']) + { + include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); + $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_REG); + } // Try to manually determine the timezone and adjust the dst if the server date/time complies with the default setting +/- 1 $timezone = date('Z') / 3600; @@ -230,7 +226,8 @@ class ucp_register if ($config['enable_confirm']) { - if (!$captcha->is_solved()) + $vc_response = $captcha->validate(); + if (!$captcha->is_solved() && $vc_response) { $error[] = $vc_response; } From 076067f85649e53c77aceddf68b469ef59a294ca Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 20:58:36 +0000 Subject: [PATCH 165/607] Okay, okay, I see the issue. I'll revisit this tomorrow. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9695 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/captcha_abstract.php | 11 +++++------ phpBB/includes/ucp/ucp_register.php | 4 ---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index e23cfd0de0..c6de2ff887 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -38,13 +38,12 @@ class phpbb_default_captcha global $config, $db, $user; // read input - $this->confirm_id = request_var('confirm_id', ''); $this->confirm_code = request_var('confirm_code', ''); $refresh = request_var('refresh_vc', false) && $config['confirm_refresh']; $this->type = (int) $type; - if (!strlen($this->confirm_id) || !$this->load_code()) + if (!$this->load_code()) { // we have no confirm ID, better get ready to display something $this->generate_code(); @@ -205,6 +204,7 @@ class phpbb_default_captcha { // okay, incorrect answer. Let's ask a new question. $this->new_attempt(); + $this->solved = false; return $error; } else @@ -277,7 +277,6 @@ class phpbb_default_captcha 'seed' => (int) $this->seed)) . ' , attempts = attempts + 1 WHERE - confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' AND session_id = \'' . $db->sql_escape($user->session_id) . '\''; $db->sql_query($sql); } @@ -289,10 +288,9 @@ class phpbb_default_captcha { global $db, $user; - $sql = 'SELECT code, seed, attempts + $sql = 'SELECT code, confirm_id, seed, attempts FROM ' . CONFIRM_TABLE . " - WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' + WHERE session_id = '" . $db->sql_escape($user->session_id) . "' AND confirm_type = " . $this->type; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); @@ -300,6 +298,7 @@ class phpbb_default_captcha if ($row) { + $this->confirm_id = $row['confirm_id']; $this->code = $row['code']; $this->seed = $row['seed']; $this->attempts = $row['attempts']; diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index ef6b076ebc..a802a35b87 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -103,10 +103,6 @@ class ucp_register 'tz' => request_var('tz', (float) $config['board_timezone']), )); - if ($config['enable_confirm']) - { - $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields()); - } } // Checking amount of available languages From adaeec1ec9f7cd55522a5c4d0bf0538dbc0c6f99 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Sat, 27 Jun 2009 08:36:40 +0000 Subject: [PATCH 166/607] Fixed Bug #45115 - Signature parsing flags are not stored in DB Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9696 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_users.php | 15 ++++++++++++--- phpBB/includes/functions_user.php | 2 +- phpBB/includes/session.php | 4 ++-- phpBB/includes/ucp/ucp_profile.php | 15 ++++++++++++--- phpBB/install/database_update.php | 21 +++++++++++++++++++++ phpBB/install/schemas/firebird_schema.sql | 2 +- phpBB/install/schemas/mssql_schema.sql | 2 +- phpBB/install/schemas/mysql_40_schema.sql | 2 +- phpBB/install/schemas/mysql_41_schema.sql | 2 +- phpBB/install/schemas/oracle_schema.sql | 2 +- phpBB/install/schemas/postgres_schema.sql | 2 +- phpBB/install/schemas/sqlite_schema.sql | 2 +- 13 files changed, 56 insertions(+), 16 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index c43954cd86..2cadd3d001 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -178,6 +178,7 @@
    356. [Feature] Add unapproved topic icon for moderators on forum list (Bug #46865 - Patch by nickvergessen)
    357. [Feature] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)
    358. [Feature] Ability to define minimum number of characters for posts/pms
    359. +
    360. [Feature] Store signature configuration options in database (Bug #45115 - Patch by rxu)
    361. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index fd64025565..c663103e17 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1545,9 +1545,9 @@ class acp_users include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); - $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false; - $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false; - $enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; + $enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $this->optionget($user_row, 'sig_bbcode') : false; + $enable_smilies = ($config['allow_sig_smilies']) ? (bool) $this->optionget($user_row, 'sig_smilies') : false; + $enable_urls = ($config['allow_sig_links']) ? (bool) $this->optionget($user_row, 'sig_links') : false; $signature = utf8_normalize_nfc(request_var('signature', (string) $user_row['user_sig'], true)); $preview = (isset($_POST['preview'])) ? true : false; @@ -1556,6 +1556,10 @@ class acp_users { include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); + $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false; + $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false; + $enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; + $message_parser = new parse_message($signature); // Allowing Quote BBCode @@ -1573,8 +1577,13 @@ class acp_users if (!sizeof($error) && $submit) { + $this->optionset($user_row, 'sig_bbcode', $enable_bbcode); + $this->optionset($user_row, 'sig_smilies', $enable_smilies); + $this->optionset($user_row, 'sig_links', $enable_urls); + $sql_ary = array( 'user_sig' => (string) $message_parser->message, + 'user_options' => $user_row['user_options'], 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 'user_sig_bbcode_bitfield' => (string) $message_parser->bbcode_bitfield ); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index bb54a14262..4ea094e451 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -187,7 +187,7 @@ function user_add($user_row, $cp_data = false) 'user_ip' => '', 'user_regdate' => time(), 'user_passchg' => time(), - 'user_options' => 895, + 'user_options' => 230271, // We do not set the new flag here - registration scripts need to specify it 'user_new' => 0, diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index c1bc4b3f31..9ae5a7c793 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1431,8 +1431,8 @@ class user extends session var $img_lang; var $img_array = array(); - // Able to add new option (id 7) - var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10); + // Able to add new options (up to id 31) + var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17); var $keyvalues = array(); /** diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index e2a9699acc..d93567c543 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -456,9 +456,9 @@ class ucp_profile include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false; - $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false; - $enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; + $enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $user->optionget('sig_bbcode') : false; + $enable_smilies = ($config['allow_sig_smilies']) ? (bool) $user->optionget('sig_smilies') : false; + $enable_urls = ($config['allow_sig_links']) ? (bool) $user->optionget('sig_links') : false; $signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true)); @@ -468,6 +468,10 @@ class ucp_profile { include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false; + $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false; + $enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; + if (!sizeof($error)) { $message_parser = new parse_message($signature); @@ -487,8 +491,13 @@ class ucp_profile if (!sizeof($error) && $submit) { + $user->optionset('sig_bbcode', $enable_bbcode); + $user->optionset('sig_smilies', $enable_smilies); + $user->optionset('sig_links', $enable_urls); + $sql_ary = array( 'user_sig' => (string) $message_parser->message, + 'user_options' => $user->data['user_options'], 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield ); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index c3f8b40de6..98f0596835 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -676,6 +676,10 @@ function database_update_info() 'forum_style' => array('UINT', 0), ), ), + 'change_columns' => array( + USERS_TABLE => array( + 'user_options' => array('UINT:11', 230271), + ), ), // No changes from 3.0.5-RC1 to 3.0.5 @@ -1279,6 +1283,23 @@ function change_database_data(&$no_updates, $version) set_config('allow_quick_reply', '1'); } + // Set every members user_options column to enable + // bbcode, smilies and URLs for signatures by default + $sql = 'SELECT user_options + FROM ' . USERS_TABLE . ' + WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + $result = $db->sql_query_limit($sql, 1); + $user_option = (int) $db->sql_fetchfield('user_options'); + $db->sql_freeresult($result); + + // Check if we already updated the database by checking bit 15 which we used to store the sig_bbcode option + if (!($user_option & 1 << 15)) + { + // 229376 is the added value to enable all three signature options + $sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = user_options + 229376'; + _sql($sql, $errored, $error_ary); + } + $no_updates = false; break; } diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index a472aac421..4bbc147df7 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -1346,7 +1346,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline INTEGER DEFAULT 1 NOT NULL, user_allow_viewemail INTEGER DEFAULT 1 NOT NULL, user_allow_massemail INTEGER DEFAULT 1 NOT NULL, - user_options INTEGER DEFAULT 895 NOT NULL, + user_options INTEGER DEFAULT 230271 NOT NULL, user_avatar VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, user_avatar_type INTEGER DEFAULT 0 NOT NULL, user_avatar_width INTEGER DEFAULT 0 NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 1b3323072e..e2cc49e4d7 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1617,7 +1617,7 @@ CREATE TABLE [phpbb_users] ( [user_allow_viewonline] [int] DEFAULT (1) NOT NULL , [user_allow_viewemail] [int] DEFAULT (1) NOT NULL , [user_allow_massemail] [int] DEFAULT (1) NOT NULL , - [user_options] [int] DEFAULT (895) NOT NULL , + [user_options] [int] DEFAULT (230271) NOT NULL , [user_avatar] [varchar] (255) DEFAULT ('') NOT NULL , [user_avatar_type] [int] DEFAULT (0) NOT NULL , [user_avatar_width] [int] DEFAULT (0) NOT NULL , diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index a4ae03f5cd..86c3e18e40 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -946,7 +946,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_options int(11) UNSIGNED DEFAULT '895' NOT NULL, + user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL, user_avatar varbinary(255) DEFAULT '' NOT NULL, user_avatar_type tinyint(2) DEFAULT '0' NOT NULL, user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index ae7f5cd493..81ebb21f7d 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -946,7 +946,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_options int(11) UNSIGNED DEFAULT '895' NOT NULL, + user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL, user_avatar varchar(255) DEFAULT '' NOT NULL, user_avatar_type tinyint(2) DEFAULT '0' NOT NULL, user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 1b8d0a3bb8..10452ca18c 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1764,7 +1764,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline number(1) DEFAULT '1' NOT NULL, user_allow_viewemail number(1) DEFAULT '1' NOT NULL, user_allow_massemail number(1) DEFAULT '1' NOT NULL, - user_options number(11) DEFAULT '895' NOT NULL, + user_options number(11) DEFAULT '230271' NOT NULL, user_avatar varchar2(255) DEFAULT '' , user_avatar_type number(2) DEFAULT '0' NOT NULL, user_avatar_width number(4) DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index e92ee29141..3382cf4efc 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -1209,7 +1209,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0), user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0), user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0), - user_options INT4 DEFAULT '895' NOT NULL CHECK (user_options >= 0), + user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0), user_avatar varchar(255) DEFAULT '' NOT NULL, user_avatar_type INT2 DEFAULT '0' NOT NULL, user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0), diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 2f57b63a8d..486c0a75a1 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -916,7 +916,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline INTEGER UNSIGNED NOT NULL DEFAULT '1', user_allow_viewemail INTEGER UNSIGNED NOT NULL DEFAULT '1', user_allow_massemail INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_options INTEGER UNSIGNED NOT NULL DEFAULT '895', + user_options INTEGER UNSIGNED NOT NULL DEFAULT '230271', user_avatar varchar(255) NOT NULL DEFAULT '', user_avatar_type tinyint(2) NOT NULL DEFAULT '0', user_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0', From 4bef644a94f6865a948951c0e946a93b93d55b21 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Sat, 27 Jun 2009 09:34:55 +0000 Subject: [PATCH 167/607] Addition to r9696 - update develop/ scripts Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9697 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 2 +- phpBB/develop/mysql_upgrader.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index efe442f006..42f6251f67 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1833,7 +1833,7 @@ function get_schema_struct() 'user_allow_viewonline' => array('BOOL', 1), 'user_allow_viewemail' => array('BOOL', 1), 'user_allow_massemail' => array('BOOL', 1), - 'user_options' => array('UINT:11', 895), + 'user_options' => array('UINT:11', 230271), 'user_avatar' => array('VCHAR', ''), 'user_avatar_type' => array('TINT:2', 0), 'user_avatar_width' => array('USINT', 0), diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 2fc02fde8a..88934bde42 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -1305,7 +1305,7 @@ function get_schema_struct() 'user_allow_viewonline' => array('BOOL', 1), 'user_allow_viewemail' => array('BOOL', 1), 'user_allow_massemail' => array('BOOL', 1), - 'user_options' => array('UINT:11', 895), + 'user_options' => array('UINT:11', 230271), 'user_avatar' => array('VCHAR', ''), 'user_avatar_type' => array('TINT:2', 0), 'user_avatar_width' => array('USINT', 0), From 6273718dc5a7812b980ca45b20d123e5e0908026 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 27 Jun 2009 20:56:49 +0000 Subject: [PATCH 168/607] acp module for submitting statistical information to phpBB git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9698 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_send_statistics.html | 63 ++++++++ phpBB/includes/acp/acp_ranks.php | 2 +- phpBB/includes/acp/acp_send_statistics.php | 93 +++++++++++ .../includes/acp/info/acp_send_statistics.php | 37 +++++ .../includes/questionnaire/questionnaire.php | 152 ++++++++++++++++++ .../questionnaire/questionnaire_phpbb.php | 122 ++++++++++++++ phpBB/language/en/acp/common.php | 8 + 7 files changed, 476 insertions(+), 1 deletion(-) create mode 100644 phpBB/adm/style/acp_send_statistics.html create mode 100644 phpBB/includes/acp/acp_send_statistics.php create mode 100644 phpBB/includes/acp/info/acp_send_statistics.php create mode 100644 phpBB/includes/questionnaire/questionnaire.php create mode 100644 phpBB/includes/questionnaire/questionnaire_phpbb.php diff --git a/phpBB/adm/style/acp_send_statistics.html b/phpBB/adm/style/acp_send_statistics.html new file mode 100644 index 0000000000..573eee6fad --- /dev/null +++ b/phpBB/adm/style/acp_send_statistics.html @@ -0,0 +1,63 @@ + + + + +

      {L_SEND_STATISTICS}

      + +

      {L_EXPLAIN_SEND_STATISTICS}

      + + + + +
      + +

      + +
      + +

      + +

      + +
      + {providers.NAME} + +
      +
      {providers.values.KEY}
      +
      {providers.values.VALUE}
      +
      + +
      + +
      +

      + + +

      +
      +
      +

      {L_THANKS_SEND_STATISTICS}

      +
      + + + \ No newline at end of file diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index a1a10545ef..fcfef2a61e 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -39,7 +39,7 @@ class acp_ranks $this->tpl_name = 'acp_ranks'; $this->page_title = 'ACP_MANAGE_RANKS'; - $form_name = 'acp_prune'; + $form_name = 'acp_ranks'; add_form_key($form_name); switch ($action) diff --git a/phpBB/includes/acp/acp_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php new file mode 100644 index 0000000000..4bfacfdb50 --- /dev/null +++ b/phpBB/includes/acp/acp_send_statistics.php @@ -0,0 +1,93 @@ +tpl_name = 'acp_send_statistics'; + $this->page_title = 'ACP_SEND_STATISTICS'; + + $c = new Questionnaire_Data_Collector(); + $c->addDataProvider(new Questionnaire_PHP_Data_Provider()); + $c->addDataProvider(new Questionnaire_System_Data_Provider()); + $c->addDataProvider(new questionnaire_phpbb_data_provider($config)); + + $template->assign_vars(array( + 'U_COLLECT_STATS' => $collect_url, + 'RAW_DATA' => $c->getDataForForm(), + )); + + $raw = $c->getDataRaw(); + + foreach ($raw as $provider => $data) + { + $template->assign_block_vars('providers', array( + 'NAME' => htmlentities($provider), + )); + + foreach ($data as $key => $value) + { + if (is_array($value)) + { + $value = utf8_wordwrap(serialize($value), 75, "\n", true); + } + + $template->assign_block_vars('providers.values', array( + 'KEY' => htmlentities($key), + 'VALUE' => htmlentities($value), + )); + } + } + } + + /** + * Output the data as an HTML Definition List. + * + * @param mixed + * @param string + * @param string + * @return void + */ + function data_printer($value, $key) + { + echo '
      ', htmlentities($key), '
      ', $ident, "\t", '
      '; + if (is_array($value)) + { + $value = htmlentities(serialize($value)); + echo '
      '; + echo '
      '; + } else { + echo htmlentities($value); + } + echo '
      '; + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/acp/info/acp_send_statistics.php b/phpBB/includes/acp/info/acp_send_statistics.php new file mode 100644 index 0000000000..33e66ecd26 --- /dev/null +++ b/phpBB/includes/acp/info/acp_send_statistics.php @@ -0,0 +1,37 @@ + 'acp_send_statistics', + 'title' => 'ACP_SEND_STATISTICS', + 'version' => '1.0.0', + 'modes' => array( + 'questionnaire' => array('title' => 'ACP_SEND_STATISTICS', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')), + ), + ); + } + + function install() + { + } + + function uninstall() + { + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php new file mode 100644 index 0000000000..7eeb4e4113 --- /dev/null +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -0,0 +1,152 @@ + PHP_VERSION, + 'sapi' => PHP_SAPI, + 'int_size' => defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '', + 'safe_mode' => (int)ini_get('safe_mode'), + 'open_basedir' => (int)ini_get('open_basedir'), + 'memory_limit' => ini_get('memory_limit'), + 'allow_url_fopen' => (int)ini_get('allow_url_fopen'), + 'allow_url_include' => (int)ini_get('allow_url_include'), + 'file_uploads' => (int)ini_get('file_uploads'), + 'upload_max_filesize' => ini_get('upload_max_filesize'), + 'post_max_size' => ini_get('post_max_size'), + 'disable_functions' => ini_get('disable_functions'), + 'disable_classes' => ini_get('disable_classes'), + 'enable_dl' => (int)ini_get('enable_dl'), + 'magic_quotes_gpc' => (int)ini_get('magic_quotes_gpc'), + 'register_globals' => (int)ini_get('register_globals'), + 'filter.default' => ini_get('filter.default'), + 'zend.ze1_compatibility_mode' => (int)ini_get('zend.ze1_compatibility_mode'), + 'unicode.semantics' => (int)ini_get('unicode.semantics'), + 'zend_thread_safty' => (int)function_exists('zend_thread_id'), + 'extensions' => get_loaded_extensions() + ); + } +} + + +class Questionnaire_System_Data_Provider +{ + function getIdentifier() + { + return 'System'; + } + + /** + * Get data about the general system information, like OS or IP (shortened). + * + * @return array + */ + function getData() + { + // Start discovering the IPV4 server address, if available + $serverAddress = '0.0.0.0'; + if (isset($_SERVER['SERVER_ADDR'])) { + $serverAddress = $_SERVER['SERVER_ADDR']; + } + // Running on IIS? + if (isset($_SERVER['LOCAL_ADDR'])) { + $serverAddress = $_SERVER['LOCAL_ADDR']; + } + $aIPAddress = explode('.', $serverAddress); + + return array( + 'os' => PHP_OS, + 'httpd' => $_SERVER['SERVER_SOFTWARE'], + // we don't want the real IP address (for privacy policy reasons) but only + // a network address to see whether your installation is running on a private or public network. + // IANA reserved addresses for private networks (RFC 1918) are: + // - 10.0.0.0/8 + // - 172.16.0.0/12 + // - 192.168.0.0/16 + 'ip' => $aIPAddress[0].'.'.$aIPAddress[1].'.XXX.YYY' + ); + } +} + +/** + * This class collects data which is used to create some usage statistics. + * + * The collected data is - after authorization of the administrator - submitted + * to a central server. For privacy reasons we try to collect only data which aren't private + * or don't give any information which might help to identify the user. + * + * @author Johannes Schlueter + * @copyright (c) 2007-2008 Johannes Schlueter + */ + +class Questionnaire_Data_Collector +{ + var $providers; + var $data = null; + + /** + * Constructor. + * + * @param array + * @param string + */ + function __construct() + { + $this->providers = array(); + } + + function addDataProvider(&$provider) + { + $this->providers[] = &$provider; + } + + /** + * Get data as an array. + * + * @return array All Data + */ + function getDataRaw() + { + if (!$this->data) { + $this->collect(); + } + + return $this->data; + } + + function getDataForForm() + { + return base64_encode(serialize($this->getDataRaw())); + } + + /** + * Collect info into the data property. + * + * @return void + */ + function collect() + { + foreach (array_keys($this->providers) as $key) { + $provider = &$this->providers[$key]; + $this->data[$provider->getIdentifier()] = $provider->getData(); + } + } +} diff --git a/phpBB/includes/questionnaire/questionnaire_phpbb.php b/phpBB/includes/questionnaire/questionnaire_phpbb.php new file mode 100644 index 0000000000..7c2ce4c292 --- /dev/null +++ b/phpBB/includes/questionnaire/questionnaire_phpbb.php @@ -0,0 +1,122 @@ +unique_id = unique_id(); + set_config('questionnaire_unique_id', $this->unique_id); + } + else + { + $this->unique_id = $config['questionnaire_unique_id']; + } + + $this->config = $config; + } + + /** + * Returns a string identifier for this data provider + * + * @return string "phpBB" + */ + function getIdentifier() + { + return 'phpBB'; + } + + + /** + * Get data about this phpBB installation. + * + * @return array Relevant anonymous config options + */ + function getData() + { + + // Exclude certain config vars + $exclude_config_vars = array( + 'avatar_gallery_path' => true, + 'avatar_path' => true, + 'avatar_salt' => true, + 'board_contact' => true, + 'board_disable_msg' => true, + 'board_email' => true, + 'board_email_sig' => true, + 'cookie_name' => true, + 'icons_path' => true, + 'icons_path' => true, + 'jab_host' => true, + 'jab_password' => true, + 'jab_port' => true, + 'jab_username' => true, + 'ldap_base_dn' => true, + 'ldap_email' => true, + 'ldap_password' => true, + 'ldap_port' => true, + 'ldap_server' => true, + 'ldap_uid' => true, + 'ldap_user' => true, + 'ldap_user_filter' => true, + 'ranks_path' => true, + 'script_path' => true, + 'server_name' => true, + 'server_port' => true, + 'server_protocol' => true, + 'site_desc' => true, + 'sitename' => true, + 'smilies_path' => true, + 'smtp_host' => true, + 'smtp_password' => true, + 'smtp_port' => true, + 'smtp_username' => true, + 'upload_icons_path' => true, + 'upload_path' => true, + 'newest_user_colour' => true, + 'newest_user_id' => true, + 'newest_username' => true, + 'rand_seed' => true, + ); + + $result = array(); + foreach ($this->config as $name => $value) + { + if (!isset($exclude_config_vars[$name])) + { + $result['config.' . $name] = $value; + } + } + + return $result; + } +} \ No newline at end of file diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 7e92594b85..55c3ed0cac 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -393,6 +393,14 @@ $lang = array_merge($lang, array( 'USER_IS_INACTIVE' => 'User is inactive', )); +// Send statistics page +$lang = array_merge($lang, array( + 'EXPLAIN_SEND_STATISTICS' => 'Please send some statistical information about your server and forum configuration to phpBB. All information that could identify you has been removed - the data is entirely anonymous. We will base decisions about future phpBB versions on this information. Below you can display all variables that will be transmitted.', + 'HIDE_STATISTICS' => 'Hide details', + 'SEND_STATISTICS' => 'Send statistical information', + 'SHOW_STATISTICS' => 'Show details', +)); + // Log Entries $lang = array_merge($lang, array( 'LOG_ACL_ADD_USER_GLOBAL_U_' => 'Added or edited users’ user permissions
      » %s', From b07b30f55d872b8e7450fe954964ebf534ac2092 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 27 Jun 2009 21:08:42 +0000 Subject: [PATCH 169/607] did not have auto props on this machine - removed an unused function from the new acp file git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9699 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_send_statistics.php | 24 +--------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/phpBB/includes/acp/acp_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php index 4bfacfdb50..1549157041 100644 --- a/phpBB/includes/acp/acp_send_statistics.php +++ b/phpBB/includes/acp/acp_send_statistics.php @@ -2,7 +2,7 @@ /** * * @package acp -* @version $Id: acp_ranks.php 8479 2008-03-29 00:22:48Z naderman $ +* @version $Id$ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -66,28 +66,6 @@ class acp_send_statistics } } } - - /** - * Output the data as an HTML Definition List. - * - * @param mixed - * @param string - * @param string - * @return void - */ - function data_printer($value, $key) - { - echo '
      ', htmlentities($key), '
      ', $ident, "\t", '
      '; - if (is_array($value)) - { - $value = htmlentities(serialize($value)); - echo '
      '; - echo '
      '; - } else { - echo htmlentities($value); - } - echo '
      '; - } } ?> \ No newline at end of file From 494054838963df6cab6f25302f12d78156202698 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 27 Jun 2009 21:10:14 +0000 Subject: [PATCH 170/607] - forgot to remove __construct methods when making this PHP4 compatible git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9700 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/questionnaire/questionnaire.php | 2 +- phpBB/includes/questionnaire/questionnaire_phpbb.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 7eeb4e4113..811b26cf20 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -108,7 +108,7 @@ class Questionnaire_Data_Collector * @param array * @param string */ - function __construct() + function Questionnaire_Data_Collector() { $this->providers = array(); } diff --git a/phpBB/includes/questionnaire/questionnaire_phpbb.php b/phpBB/includes/questionnaire/questionnaire_phpbb.php index 7c2ce4c292..47bd931e68 100644 --- a/phpBB/includes/questionnaire/questionnaire_phpbb.php +++ b/phpBB/includes/questionnaire/questionnaire_phpbb.php @@ -27,9 +27,8 @@ class questionnaire_phpbb_data_provider * Constructor. * * @param array $config - * @param string $oldversion */ - function __construct($config) + function questionnaire_phpbb_data_provider($config) { // generate a unique id if necessary if (!isset($config['questionnaire_unique_id'])) From a8d678cc4cb18f6561c8bbf53c0f32aa931ffaca Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 28 Jun 2009 12:13:11 +0000 Subject: [PATCH 171/607] Fix small typo in r9625 - Thanks Tumba25 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9701 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/groups.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/groups.php b/phpBB/language/en/acp/groups.php index a8b17e4d5d..e8c1a3c494 100644 --- a/phpBB/language/en/acp/groups.php +++ b/phpBB/language/en/acp/groups.php @@ -95,7 +95,7 @@ $lang = array_merge($lang, array( 'GROUP_RECEIVE_PM_EXPLAIN' => 'Please note that hidden groups are not able to be messaged, regardless of this setting.', 'GROUP_REQUEST' => 'Request', 'GROUP_SETTINGS_SAVE' => 'Group wide settings', - 'GROUP_SKIP_AUTH' => 'Excempt group leader from permissions', + 'GROUP_SKIP_AUTH' => 'Exempt group leader from permissions', 'GROUP_SKIP_AUTH_EXPLAIN' => 'If enabled group leader no longer inherit permissions from the group.', 'GROUP_TYPE' => 'Group type', 'GROUP_TYPE_EXPLAIN' => 'This determines which users can join or view this group.', From e146efbd165c71b00003f6ae3ea3f4de2da3d64b Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 29 Jun 2009 12:52:45 +0000 Subject: [PATCH 172/607] Add some data for akismet et al git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9702 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/captcha_abstract.php | 4 ++-- phpBB/includes/ucp/ucp_register.php | 4 ++-- phpBB/posting.php | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index c6de2ff887..86ecdaf97e 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -178,7 +178,7 @@ class phpbb_default_captcha return; } - function validate() + function validate($data = false) { global $config, $db, $user; @@ -344,7 +344,7 @@ class phpbb_default_captcha function is_solved() { - if ($this->solved === 0) + if (request_var('confirm_code', false) && $this->solved === 0) { $this->validate(); } diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index a802a35b87..da62061a72 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -222,8 +222,8 @@ class ucp_register if ($config['enable_confirm']) { - $vc_response = $captcha->validate(); - if (!$captcha->is_solved() && $vc_response) + $vc_response = $captcha->validate($data); + if ($vc_response) { $error[] = $vc_response; } diff --git a/phpBB/posting.php b/phpBB/posting.php index 9d06ac3e2c..598f500bc4 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -772,7 +772,12 @@ if ($submit || $preview || $refresh) if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) { - $vc_response = $captcha->validate(); + $captcha_data = array( + 'message' => utf8_normalize_nfc(request_var('message', '', true)), + 'subject' => utf8_normalize_nfc(request_var('subject', '', true)), + 'username' => utf8_normalize_nfc(request_var('username', '', true)), + ); + $vc_response = $captcha->validate($captcha_data); if ($vc_response) { $error[] = $vc_response; From 7d13399665551b0200423205ba9350b8d9318ce7 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 29 Jun 2009 12:58:05 +0000 Subject: [PATCH 173/607] hmm git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9703 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/posting_editor.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 8cd5fc60d5..adde3411e6 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -88,9 +88,9 @@ -
      +
      -
      +
      From 1c5e724e5ecbf3a9e36d3e34dd50f4cd3134f696 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 29 Jun 2009 14:36:05 +0000 Subject: [PATCH 174/607] undoing change from #9575, as it broke the board disabled message git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9704 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 41849b909a..008594a319 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -437,7 +437,7 @@ class acp_board // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... foreach ($display_vars['vars'] as $config_name => $null) { - if ($null === false || strpos($config_name, 'legend') !== false) + if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) { continue; } From 9249ee2e7209b1f6b5da9ecee75408cb545c1647 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 30 Jun 2009 08:11:32 +0000 Subject: [PATCH 175/607] #47615 - move the panel for the conifrm box to the captcha template git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9705 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../prosilver/template/captcha_default.html | 16 +++++++++++++++- .../prosilver/template/captcha_recaptcha.html | 16 +++++++++++++++- .../prosilver/template/ucp_register.html | 18 +++++------------- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/phpBB/styles/prosilver/template/captcha_default.html b/phpBB/styles/prosilver/template/captcha_default.html index 00d901825a..7b36718225 100644 --- a/phpBB/styles/prosilver/template/captcha_default.html +++ b/phpBB/styles/prosilver/template/captcha_default.html @@ -1,4 +1,13 @@ + +
      +
      +

      {L_CONFIRMATION}

      +

      {L_CONFIRM_EXPLAIN}

      + +
      + +
      {L_CONFIRM_CODE}
      @@ -6,4 +15,9 @@
      {L_CONFIRM_CODE_EXPLAIN}
      -
      \ No newline at end of file +
      + +
      + + + \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index 0cb43cf01f..486124c844 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -1,3 +1,13 @@ + +
      +
      + +

      {L_CONFIRMATION}

      +

      {L_CONFIRM_EXPLAIN}

      + +
      + +
      @@ -22,4 +32,8 @@
      {L_RECAPTCHA_NOT_AVAILABLE} - \ No newline at end of file + + + + + diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index f35b5c9810..578808e6bb 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -71,17 +71,9 @@
      -
      - -
      -
      - -

      {L_CONFIRMATION}

      -

      {L_CONFIRM_EXPLAIN}

      - -
      + @@ -89,8 +81,7 @@ -
      -
      +
      @@ -98,10 +89,11 @@

      {L_COPPA_COMPLIANCE}

      {L_COPPA_EXPLAIN}

      - -
      + + +
      From c6a84179e3f24c18628c213b0a090e089a70bf71 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 30 Jun 2009 13:57:39 +0000 Subject: [PATCH 176/607] and remove that orphaned closing tag git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9706 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/captcha_recaptcha.html | 4 +++- phpBB/styles/prosilver/template/ucp_register.html | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index 486124c844..c0d4fdce98 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -34,6 +34,8 @@ {L_RECAPTCHA_NOT_AVAILABLE} - + +
      +
      diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index 578808e6bb..822293973d 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -77,8 +77,6 @@ - - From 5f89b6a6d085701a0f999feb15879a62148f6fac Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 30 Jun 2009 14:00:27 +0000 Subject: [PATCH 177/607] *blinks* there were supposed to be more files, where are they? Ah, here git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9707 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../includes/captcha/plugins/captcha_abstract.php | 14 ++++++++------ .../prosilver/template/captcha_recaptcha.html | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index 86ecdaf97e..2a93b3f895 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -38,12 +38,13 @@ class phpbb_default_captcha global $config, $db, $user; // read input + $this->confirm_id = request_var('confirm_id', ''); $this->confirm_code = request_var('confirm_code', ''); $refresh = request_var('refresh_vc', false) && $config['confirm_refresh']; $this->type = (int) $type; - if (!$this->load_code()) + if (!strlen($this->confirm_id) || !$this->load_code()) { // we have no confirm ID, better get ready to display something $this->generate_code(); @@ -95,6 +96,7 @@ class phpbb_default_captcha 'CONFIRM_IMG' => '', 'CONFIRM_ID' => $this->confirm_id, 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh'] && $this->type == CONFIRM_REG) ? true : false, 'L_CONFIRM_EXPLAIN' => $explain, )); @@ -178,7 +180,7 @@ class phpbb_default_captcha return; } - function validate($data = false) + function validate() { global $config, $db, $user; @@ -204,7 +206,6 @@ class phpbb_default_captcha { // okay, incorrect answer. Let's ask a new question. $this->new_attempt(); - $this->solved = false; return $error; } else @@ -277,6 +278,7 @@ class phpbb_default_captcha 'seed' => (int) $this->seed)) . ' , attempts = attempts + 1 WHERE + confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' AND session_id = \'' . $db->sql_escape($user->session_id) . '\''; $db->sql_query($sql); } @@ -288,9 +290,10 @@ class phpbb_default_captcha { global $db, $user; - $sql = 'SELECT code, confirm_id, seed, attempts + $sql = 'SELECT code, seed, attempts FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "' AND confirm_type = " . $this->type; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); @@ -298,7 +301,6 @@ class phpbb_default_captcha if ($row) { - $this->confirm_id = $row['confirm_id']; $this->code = $row['code']; $this->seed = $row['seed']; $this->attempts = $row['attempts']; diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index c0d4fdce98..fabbb0f277 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -1,4 +1,4 @@ - +
      @@ -33,7 +33,7 @@ {L_RECAPTCHA_NOT_AVAILABLE} - +
      From 814e3c661ac7f9c750230bceba0a4f1414c361d6 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 30 Jun 2009 14:08:42 +0000 Subject: [PATCH 178/607] a bit of text git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9708 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/recaptcha.php | 2 ++ phpBB/styles/prosilver/template/captcha_default.html | 4 ++-- phpBB/styles/prosilver/template/captcha_recaptcha.html | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/phpBB/language/en/recaptcha.php b/phpBB/language/en/recaptcha.php index 1ecb23756a..82766109a2 100644 --- a/phpBB/language/en/recaptcha.php +++ b/phpBB/language/en/recaptcha.php @@ -46,6 +46,8 @@ $lang = array_merge($lang, array( 'RECAPTCHA_PRIVATE' => 'Private reCaptcha key', 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. You can obtain keys from reCaptcha.net.', + 'RECAPTCHA_EXPLAIN' => 'To avoid spam postings, please enter the two words shown in the picture into the text field undeneath.', + )); ?> \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/captcha_default.html b/phpBB/styles/prosilver/template/captcha_default.html index 7b36718225..87a3ba1575 100644 --- a/phpBB/styles/prosilver/template/captcha_default.html +++ b/phpBB/styles/prosilver/template/captcha_default.html @@ -1,4 +1,4 @@ - +
      @@ -16,7 +16,7 @@
      {L_CONFIRM_CODE_EXPLAIN}
      - +
      diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index fabbb0f277..431124a210 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -9,8 +9,10 @@ -
      +
      +
      :
      {L_RECAPTCHA_EXPLAIN}
      + - -
      + -

      + -
      - +

      + +
      +

      + -
      +
      {providers.NAME}
      @@ -44,20 +46,22 @@ function iframeUpdated()
      -
      -

      +

      +

      -
      -

      {L_THANKS_SEND_STATISTICS}

      + +
      +

      {L_THANKS_SEND_STATISTICS}

      + \ No newline at end of file diff --git a/phpBB/includes/acp/acp_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php index 1549157041..6c29b9fbb5 100644 --- a/phpBB/includes/acp/acp_send_statistics.php +++ b/phpBB/includes/acp/acp_send_statistics.php @@ -15,8 +15,8 @@ if (!defined('IN_PHPBB')) { exit; } -include($phpbb_root_path . 'includes/questionnaire/questionnaire_phpbb.' . $phpEx); +include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx); /** * @package acp @@ -34,22 +34,24 @@ class acp_send_statistics $this->tpl_name = 'acp_send_statistics'; $this->page_title = 'ACP_SEND_STATISTICS'; - $c = new Questionnaire_Data_Collector(); - $c->addDataProvider(new Questionnaire_PHP_Data_Provider()); - $c->addDataProvider(new Questionnaire_System_Data_Provider()); - $c->addDataProvider(new questionnaire_phpbb_data_provider($config)); + $collector = new phpbb_questionnaire_data_collector(); + + // Add data provider + $collector->add_data_provider(new phpbb_questionnaire_php_data_provider()); + $collector->add_data_provider(new phpbb_questionnaire_system_data_provider()); + $collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config)); $template->assign_vars(array( 'U_COLLECT_STATS' => $collect_url, - 'RAW_DATA' => $c->getDataForForm(), + 'RAW_DATA' => $collector->get_data_for_form(), )); - $raw = $c->getDataRaw(); + $raw = $collector->get_data_raw(); foreach ($raw as $provider => $data) { $template->assign_block_vars('providers', array( - 'NAME' => htmlentities($provider), + 'NAME' => htmlspecialchars($provider), )); foreach ($data as $key => $value) @@ -60,8 +62,8 @@ class acp_send_statistics } $template->assign_block_vars('providers.values', array( - 'KEY' => htmlentities($key), - 'VALUE' => htmlentities($value), + 'KEY' => utf8_htmlspecialchars($key), + 'VALUE' => utf8_htmlspecialchars($value), )); } } diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 811b26cf20..42ac44d38a 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -1,152 +1,292 @@ PHP_VERSION, - 'sapi' => PHP_SAPI, - 'int_size' => defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '', - 'safe_mode' => (int)ini_get('safe_mode'), - 'open_basedir' => (int)ini_get('open_basedir'), - 'memory_limit' => ini_get('memory_limit'), - 'allow_url_fopen' => (int)ini_get('allow_url_fopen'), - 'allow_url_include' => (int)ini_get('allow_url_include'), - 'file_uploads' => (int)ini_get('file_uploads'), - 'upload_max_filesize' => ini_get('upload_max_filesize'), - 'post_max_size' => ini_get('post_max_size'), - 'disable_functions' => ini_get('disable_functions'), - 'disable_classes' => ini_get('disable_classes'), - 'enable_dl' => (int)ini_get('enable_dl'), - 'magic_quotes_gpc' => (int)ini_get('magic_quotes_gpc'), - 'register_globals' => (int)ini_get('register_globals'), - 'filter.default' => ini_get('filter.default'), - 'zend.ze1_compatibility_mode' => (int)ini_get('zend.ze1_compatibility_mode'), - 'unicode.semantics' => (int)ini_get('unicode.semantics'), - 'zend_thread_safty' => (int)function_exists('zend_thread_id'), - 'extensions' => get_loaded_extensions() - ); - } -} - - -class Questionnaire_System_Data_Provider -{ - function getIdentifier() - { - return 'System'; - } - - /** - * Get data about the general system information, like OS or IP (shortened). - * - * @return array - */ - function getData() - { - // Start discovering the IPV4 server address, if available - $serverAddress = '0.0.0.0'; - if (isset($_SERVER['SERVER_ADDR'])) { - $serverAddress = $_SERVER['SERVER_ADDR']; - } - // Running on IIS? - if (isset($_SERVER['LOCAL_ADDR'])) { - $serverAddress = $_SERVER['LOCAL_ADDR']; - } - $aIPAddress = explode('.', $serverAddress); - - return array( - 'os' => PHP_OS, - 'httpd' => $_SERVER['SERVER_SOFTWARE'], - // we don't want the real IP address (for privacy policy reasons) but only - // a network address to see whether your installation is running on a private or public network. - // IANA reserved addresses for private networks (RFC 1918) are: - // - 10.0.0.0/8 - // - 172.16.0.0/12 - // - 192.168.0.0/16 - 'ip' => $aIPAddress[0].'.'.$aIPAddress[1].'.XXX.YYY' - ); - } + exit; } /** - * This class collects data which is used to create some usage statistics. - * - * The collected data is - after authorization of the administrator - submitted - * to a central server. For privacy reasons we try to collect only data which aren't private - * or don't give any information which might help to identify the user. - * - * @author Johannes Schlueter - * @copyright (c) 2007-2008 Johannes Schlueter - */ - -class Questionnaire_Data_Collector +* This class collects data which is used to create some usage statistics. +* +* The collected data is - after authorization of the administrator - submitted +* to a central server. For privacy reasons we try to collect only data which aren't private +* or don't give any information which might help to identify the user. +* +* @author Johannes Schlueter +* @copyright (c) 2007-2008 Johannes Schlueter +*/ +class phpbb_questionnaire_data_collector { - var $providers; - var $data = null; + var $providers; + var $data = null; - /** - * Constructor. - * - * @param array - * @param string - */ - function Questionnaire_Data_Collector() - { - $this->providers = array(); - } + /** + * Constructor. + * + * @param array + * @param string + */ + function phpbb_questionnaire_data_collector() + { + $this->providers = array(); + } - function addDataProvider(&$provider) - { - $this->providers[] = &$provider; - } + function add_data_provider(&$provider) + { + $this->providers[] = &$provider; + } - /** - * Get data as an array. - * - * @return array All Data - */ - function getDataRaw() - { - if (!$this->data) { - $this->collect(); - } + /** + * Get data as an array. + * + * @return array All Data + */ + function get_data_raw() + { + if (!$this->data) + { + $this->collect(); + } - return $this->data; - } + return $this->data; + } - function getDataForForm() - { - return base64_encode(serialize($this->getDataRaw())); - } + function get_data_for_form() + { + return base64_encode(serialize($this->get_data_raw())); + } - /** - * Collect info into the data property. - * - * @return void - */ - function collect() - { - foreach (array_keys($this->providers) as $key) { + /** + * Collect info into the data property. + * + * @return void + */ + function collect() + { + foreach (array_keys($this->providers) as $key) + { $provider = &$this->providers[$key]; - $this->data[$provider->getIdentifier()] = $provider->getData(); - } - } + $this->data[$provider->get_identifier()] = $provider->get_data(); + } + } } + +/** interface: get_indentifier(), get_data() */ + +/** +* Questionnaire PHP data provider +* @package phpBB3 +*/ +class phpbb_questionnaire_php_data_provider +{ + function get_identifier() + { + return 'PHP'; + } + + /** + * Get data about the PHP runtime setup. + * + * @return array + */ + function get_data() + { + return array( + 'version' => PHP_VERSION, + 'sapi' => PHP_SAPI, + 'int_size' => defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '', + 'safe_mode' => (int) @ini_get('safe_mode'), + 'open_basedir' => (int) @ini_get('open_basedir'), + 'memory_limit' => @ini_get('memory_limit'), + 'allow_url_fopen' => (int) @ini_get('allow_url_fopen'), + 'allow_url_include' => (int) @ini_get('allow_url_include'), + 'file_uploads' => (int) @ini_get('file_uploads'), + 'upload_max_filesize' => @ini_get('upload_max_filesize'), + 'post_max_size' => @ini_get('post_max_size'), + 'disable_functions' => @ini_get('disable_functions'), + 'disable_classes' => @ini_get('disable_classes'), + 'enable_dl' => (int) @ini_get('enable_dl'), + 'magic_quotes_gpc' => (int) @ini_get('magic_quotes_gpc'), + 'register_globals' => (int) @ini_get('register_globals'), + 'filter.default' => @ini_get('filter.default'), + 'zend.ze1_compatibility_mode' => (int) @ini_get('zend.ze1_compatibility_mode'), + 'unicode.semantics' => (int) @ini_get('unicode.semantics'), + 'zend_thread_safty' => (int) function_exists('zend_thread_id'), + 'extensions' => get_loaded_extensions(), + ); + } +} + +/** +* Questionnaire System data provider +* @package phpBB3 +*/ +class phpbb_questionnaire_system_data_provider +{ + function get_identifier() + { + return 'System'; + } + + /** + * Get data about the general system information, like OS or IP (shortened). + * + * @return array + */ + function get_data() + { + // Start discovering the IPV4 server address, if available + $server_address = '0.0.0.0'; + + if (!empty($_SERVER['SERVER_ADDR'])) + { + $server_address = $_SERVER['SERVER_ADDR']; + } + + // Running on IIS? + if (!empty($_SERVER['LOCAL_ADDR'])) + { + $server_address = $_SERVER['LOCAL_ADDR']; + } + + $ip_address_ary = explode('.', $server_address); + + // build ip + if (!isset($ip_address_ary[0]) || !isset($ip_address_ary[1])) + { + $ip_address_ary = explode('.', '0.0.0.0'); + } + + return array( + 'os' => PHP_OS, + 'httpd' => $_SERVER['SERVER_SOFTWARE'], + // we don't want the real IP address (for privacy policy reasons) but only + // a network address to see whether your installation is running on a private or public network. + // IANA reserved addresses for private networks (RFC 1918) are: + // - 10.0.0.0/8 + // - 172.16.0.0/12 + // - 192.168.0.0/16 + 'ip' => $ip_address_ary[0] . '.' . $ip_address_ary[1] . '.XXX.YYY', + ); + } +} + +/** +* Questionnaire phpBB data provider +* @package phpBB3 +*/ +class phpbb_questionnaire_phpbb_data_provider +{ + var $config; + var $unique_id; + + /** + * Constructor. + * + * @param array $config + */ + function phpbb_questionnaire_phpbb_data_provider($config) + { + // generate a unique id if necessary + if (empty($config['questionnaire_unique_id'])) + { + $this->unique_id = unique_id(); + set_config('questionnaire_unique_id', $this->unique_id); + } + else + { + $this->unique_id = $config['questionnaire_unique_id']; + } + + $this->config = $config; + } + + /** + * Returns a string identifier for this data provider + * + * @return string "phpBB" + */ + function get_identifier() + { + return 'phpBB'; + } + + /** + * Get data about this phpBB installation. + * + * @return array Relevant anonymous config options + */ + function get_data() + { + // Exclude certain config vars + $exclude_config_vars = array( + 'avatar_gallery_path' => true, + 'avatar_path' => true, + 'avatar_salt' => true, + 'board_contact' => true, + 'board_disable_msg' => true, + 'board_email' => true, + 'board_email_sig' => true, + 'cookie_name' => true, + 'icons_path' => true, + 'icons_path' => true, + 'jab_host' => true, + 'jab_password' => true, + 'jab_port' => true, + 'jab_username' => true, + 'ldap_base_dn' => true, + 'ldap_email' => true, + 'ldap_password' => true, + 'ldap_port' => true, + 'ldap_server' => true, + 'ldap_uid' => true, + 'ldap_user' => true, + 'ldap_user_filter' => true, + 'ranks_path' => true, + 'script_path' => true, + 'server_name' => true, + 'server_port' => true, + 'server_protocol' => true, + 'site_desc' => true, + 'sitename' => true, + 'smilies_path' => true, + 'smtp_host' => true, + 'smtp_password' => true, + 'smtp_port' => true, + 'smtp_username' => true, + 'upload_icons_path' => true, + 'upload_path' => true, + 'newest_user_colour' => true, + 'newest_user_id' => true, + 'newest_username' => true, + 'rand_seed' => true, + ); + + $result = array(); + foreach ($this->config as $name => $value) + { + // Mods may add columns for storing passwords - we do not want to grab them + if (isset($exclude_config_vars[$name]) || strpos($name, 'password') !== false) + { + continue; + } + + $result['config.' . $name] = $value; + } + + return $result; + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/questionnaire/questionnaire_phpbb.php b/phpBB/includes/questionnaire/questionnaire_phpbb.php deleted file mode 100644 index 47bd931e68..0000000000 --- a/phpBB/includes/questionnaire/questionnaire_phpbb.php +++ /dev/null @@ -1,121 +0,0 @@ -unique_id = unique_id(); - set_config('questionnaire_unique_id', $this->unique_id); - } - else - { - $this->unique_id = $config['questionnaire_unique_id']; - } - - $this->config = $config; - } - - /** - * Returns a string identifier for this data provider - * - * @return string "phpBB" - */ - function getIdentifier() - { - return 'phpBB'; - } - - - /** - * Get data about this phpBB installation. - * - * @return array Relevant anonymous config options - */ - function getData() - { - - // Exclude certain config vars - $exclude_config_vars = array( - 'avatar_gallery_path' => true, - 'avatar_path' => true, - 'avatar_salt' => true, - 'board_contact' => true, - 'board_disable_msg' => true, - 'board_email' => true, - 'board_email_sig' => true, - 'cookie_name' => true, - 'icons_path' => true, - 'icons_path' => true, - 'jab_host' => true, - 'jab_password' => true, - 'jab_port' => true, - 'jab_username' => true, - 'ldap_base_dn' => true, - 'ldap_email' => true, - 'ldap_password' => true, - 'ldap_port' => true, - 'ldap_server' => true, - 'ldap_uid' => true, - 'ldap_user' => true, - 'ldap_user_filter' => true, - 'ranks_path' => true, - 'script_path' => true, - 'server_name' => true, - 'server_port' => true, - 'server_protocol' => true, - 'site_desc' => true, - 'sitename' => true, - 'smilies_path' => true, - 'smtp_host' => true, - 'smtp_password' => true, - 'smtp_port' => true, - 'smtp_username' => true, - 'upload_icons_path' => true, - 'upload_path' => true, - 'newest_user_colour' => true, - 'newest_user_id' => true, - 'newest_username' => true, - 'rand_seed' => true, - ); - - $result = array(); - foreach ($this->config as $name => $value) - { - if (!isset($exclude_config_vars[$name])) - { - $result['config.' . $name] = $value; - } - } - - return $result; - } -} \ No newline at end of file From 2e8d14004f9fc7083fcd7b377b86ea5cef7d55db Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 7 Jul 2009 10:52:59 +0000 Subject: [PATCH 190/607] Coding guidelines in r9629 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9720 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_styles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index ab9ddc0b6f..166ad11d3e 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -231,7 +231,7 @@ parse_css_file = {PARSE_CSS_FILE} $db->sql_query($sql); } } - elseif ( $action == 'deactivate' ) + else if ($action == 'deactivate') { $s_hidden_fields = array( 'i' => $id, From 585d533f4dc4cefc7e3e5c06cc7d9f171a81772b Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 7 Jul 2009 11:05:50 +0000 Subject: [PATCH 191/607] commit changes suggested by Crise git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9721 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/feed.php | 54 ++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index 9d9bf145b1..33549bcc56 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -158,41 +158,38 @@ else exit_handler(); } -$namespace = 'phpbb'; - echo '' . "\n"; -echo '<' . $namespace . ':feed xmlns:' . $namespace . '="http://www.w3.org/2005/Atom" xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $global_vars['FEED_LANG'] . '">' . "\n"; -echo '<' . $namespace . ':link rel="self" type="application/atom+xml" href="' . $global_vars['SELF_LINK'] . '" />' . "\n\n"; +echo '' . "\n"; +echo '' . "\n\n"; -echo (!empty($global_vars['FEED_TITLE'])) ? '<' . $namespace . ':title>' . $global_vars['FEED_TITLE'] . '' . "\n" : ''; -echo (!empty($global_vars['FEED_SUBTITLE'])) ? '<' . $namespace . ':subtitle>' . $global_vars['FEED_SUBTITLE'] . '' . "\n" : ''; -echo (!empty($global_vars['FEED_LINK'])) ? '<' . $namespace . ':link href="' . $global_vars['FEED_LINK'] .'" />' . "\n" : ''; -echo '<' . $namespace . ':updated>' . $global_vars['FEED_UPDATED'] . '' . "\n\n"; +echo (!empty($global_vars['FEED_TITLE'])) ? '' . $global_vars['FEED_TITLE'] . '' . "\n" : ''; +echo (!empty($global_vars['FEED_SUBTITLE'])) ? '' . $global_vars['FEED_SUBTITLE'] . '' . "\n" : ''; +echo (!empty($global_vars['FEED_LINK'])) ? '' . "\n" : ''; +echo '' . $global_vars['FEED_UPDATED'] . '' . "\n\n"; -echo '<' . $namespace . ':author><' . $namespace . ':name>' . $global_vars['FEED_AUTHOR'] . '' . "\n"; -echo '<' . $namespace . ':id>' . $global_vars['SELF_LINK'] . '' . "\n"; +echo '' . "\n"; +echo '' . $global_vars['SELF_LINK'] . '' . "\n"; foreach ($item_vars as $row) { - echo '<' . $namespace . ':entry>' . "\n"; + echo '' . "\n"; if (!empty($row['author'])) { - echo '<' . $namespace . ':author><' . $namespace . ':name>' . $row['author'] . '' . "\n"; + echo '' . "\n"; } - echo '<' . $namespace . ':updated>' . $row['pubdate'] . '' . "\n"; - echo '<' . $namespace . ':id>' . $row['link'] . '' . "\n"; - echo '<' . $namespace . ':link href="' . $row['link'] . '"/>' . "\n"; - echo '<' . $namespace . ':title type="xhtml">
      ' . $row['title'] . '
      ' . "\n\n"; + echo '' . $row['pubdate'] . '' . "\n"; + echo '' . $row['link'] . '' . "\n"; + echo '' . "\n"; + echo '<![CDATA[' . $row['title'] . ']]>' . "\n\n"; if (!empty($row['category'])) { - echo '<' . $namespace . ':category term="' . $row['category_name'] . '" scheme="' . $row['category'] . '" label="' . $row['category_name'] . '"/>' . "\n"; + echo '' . "\n"; } - echo '<' . $namespace . ':content type="xhtml" xml:base="' . $row['link'] . '">' . "\n"; - echo '
      ' . "\n"; + echo '' . $user->lang['STATISTICS'] . ': ' . $row['statistics'] . '

      '; } - echo '
      ' . "\n" . '' . "\n"; - echo '' . "\n"; + echo '
      ' . "\n" . ']]>' . "\n"; + echo '' . "\n"; } -echo ''; +echo ''; garbage_collection(); exit_handler(); @@ -257,17 +254,19 @@ function feed_generate_content($content, $uid, $bitfield, $options) $content = str_replace('' .$user->lang['SELECT_ALL_CODE'] . '', '', $content); $content = preg_replace('#(onkeypress|onclick)="(.*?)"#si', '', $content); + // Firefox does not support CSS for feeds, though + // Remove font sizes - $content = preg_replace('#([^>]+)#iU', '\1', $content); +// $content = preg_replace('#([^>]+)#iU', '\1', $content); // Make text strong :P - $content = preg_replace('#([^<]+)#iU', '\1', $content); +// $content = preg_replace('#(.*?)#iU', '\1', $content); // Italic - $content = preg_replace('#([^<]+)#iU', '\1', $content); +// $content = preg_replace('#([^<]+)#iU', '\1', $content); // Underline - $content = preg_replace('#([^<]+)#iU', '\1', $content); +// $content = preg_replace('#([^<]+)#iU', '\1', $content); // Remove embed Windows Media Streams $content = preg_replace( '#<\!--\[if \!IE\]>-->([^[]+)<\!--#si', '', $content); @@ -293,6 +292,9 @@ function feed_generate_content($content, $uid, $bitfield, $options) $content = str_replace(array_keys($entities), array_values($entities), $content); + // Remove CDATA blocks. ;) + $content = preg_replace('#\<\!\[CDATA\[(.*?)\]\]\>#s', '', $content); + // Other control characters // $content = preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $content); From bd516916b8c627917e9be17cc81e37d56421eb66 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 7 Jul 2009 11:41:07 +0000 Subject: [PATCH 192/607] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by leviatan21) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9722 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/bbcode.php | 2 +- phpBB/includes/message_parser.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f65689ae2e..38d189ff34 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -141,6 +141,7 @@
    362. [Fix] Check if template file is empty before trying to read from it. (Bug #47345 - Patch by bantu)
    363. [Fix] Correct descriptions of the permissions to use BBCode, smilies, images and flash to be more relevant. (Bug #36065 - Patch by rxu)
    364. [Fix] Fix style issues in print mode. (Bug #26375 - Patch by leviatan21)
    365. +
    366. [Fix] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by leviatan21)
    367. [Fix] Search by authorname does not display posts of guests and deleted users (Bug #36565 - Patch by nickvergessen)
    368. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    369. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    370. diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 562488db70..693523dcbb 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -265,7 +265,7 @@ class bbcode case 6: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( - '!\[color=(#[0-9a-f]{6}|[a-z\-]+):$uid\](.*?)\[/color:$uid\]!is' => $this->bbcode_tpl('color', $bbcode_id), + '!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+):$uid\](.*?)\[/color:$uid\]!is' => $this->bbcode_tpl('color', $bbcode_id), ) ); break; diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 4cdc8b933e..7370c2057c 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -118,7 +118,7 @@ class bbcode_firstpass extends bbcode 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")), 'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](.*)\[/img\]#iUe' => "\$this->bbcode_img('\$1')")), 'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#ise' => "\$this->bbcode_size('\$1', '\$2')")), - 'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!ise' => "\$this->bbcode_color('\$1', '\$2')")), + 'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!ise' => "\$this->bbcode_color('\$1', '\$2')")), 'u' => array('bbcode_id' => 7, 'regexp' => array('#\[u\](.*?)\[/u\]#ise' => "\$this->bbcode_underline('\$1')")), 'list' => array('bbcode_id' => 9, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#ise' => "\$this->bbcode_parse_list('\$0')")), 'email' => array('bbcode_id' => 10, 'regexp' => array('#\[email=?(.*?)?\](.*?)\[/email\]#ise' => "\$this->validate_email('\$1', '\$2')")), From d3721c2fe2f1a943dd73fe11a0057a7605158d0d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 7 Jul 2009 11:44:07 +0000 Subject: [PATCH 193/607] reading the bug report... the patch was actually provided by m0rpha git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9723 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 38d189ff34..3420d4f31d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -141,7 +141,7 @@
    371. [Fix] Check if template file is empty before trying to read from it. (Bug #47345 - Patch by bantu)
    372. [Fix] Correct descriptions of the permissions to use BBCode, smilies, images and flash to be more relevant. (Bug #36065 - Patch by rxu)
    373. [Fix] Fix style issues in print mode. (Bug #26375 - Patch by leviatan21)
    374. -
    375. [Fix] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by leviatan21)
    376. +
    377. [Fix] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by m0rpha)
    378. [Fix] Search by authorname does not display posts of guests and deleted users (Bug #36565 - Patch by nickvergessen)
    379. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    380. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    381. From 2b2119375243231f5ed735ecb6f664ea96a0b5d5 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 7 Jul 2009 12:01:37 +0000 Subject: [PATCH 194/607] put purge sessions above purge cache (admins are used to click the purge cache button and it may irretate them to have it not in a position where they expect it). :) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9724 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_main.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 3318215623..6b16f5ad69 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -139,14 +139,14 @@
      -

      {L_PURGE_CACHE_EXPLAIN}
      -
      +

      {L_PURGE_SESSIONS_EXPLAIN}
      +
      -

      {L_PURGE_SESSIONS_EXPLAIN}
      -
      +

      {L_PURGE_CACHE_EXPLAIN}
      +
      From 4991cae3a1f5d3bcb435ae65bd63d4a705aa0653 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Tue, 7 Jul 2009 12:55:34 +0000 Subject: [PATCH 195/607] Fixed Bug #39625 - QUOTE-string not included when replying to pm's Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9725 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/ucp/ucp_pm_compose.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3420d4f31d..630f35bc3c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -141,6 +141,7 @@
    382. [Fix] Check if template file is empty before trying to read from it. (Bug #47345 - Patch by bantu)
    383. [Fix] Correct descriptions of the permissions to use BBCode, smilies, images and flash to be more relevant. (Bug #36065 - Patch by rxu)
    384. [Fix] Fix style issues in print mode. (Bug #26375 - Patch by leviatan21)
    385. +
    386. [Fix] Fix minor issue with L_QUOTE language string missing in several PM composing modes. (Bug #39625 - Patch by rxu)
    387. [Fix] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by m0rpha)
    388. [Fix] Search by authorname does not display posts of guests and deleted users (Bug #36565 - Patch by nickvergessen)
    389. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    390. diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 85e43dfc8c..edee64bd18 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -84,6 +84,10 @@ function compose_pm($id, $mode, $action) } redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm')); } + + // Since viewtopic.php language entries are used in several modes, + // we include the language file here + $user->add_lang('viewtopic'); // Output PM_TO box if message composing if ($action != 'edit') @@ -746,7 +750,6 @@ function compose_pm($id, $mode, $action) // Preview if (!sizeof($error) && $preview) { - $user->add_lang('viewtopic'); $preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false); $preview_signature = $user->data['user_sig']; From eb4eee77ac5b870966a00b4e23ff14f204e18c68 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Tue, 7 Jul 2009 12:59:30 +0000 Subject: [PATCH 196/607] Further word censor fix to work with UTF8 correctly Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9726 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/cache.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 630f35bc3c..13dd42cf8f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -144,6 +144,7 @@
    391. [Fix] Fix minor issue with L_QUOTE language string missing in several PM composing modes. (Bug #39625 - Patch by rxu)
    392. [Fix] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by m0rpha)
    393. [Fix] Search by authorname does not display posts of guests and deleted users (Bug #36565 - Patch by nickvergessen)
    394. +
    395. [Fix] Further word censor fix to work with UTF8 correctly. (Patch by rxu)
    396. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    397. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    398. [Change] Template engine now permits to a limited extent variable includes.
    399. diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php index 392f1377da..1effada666 100644 --- a/phpBB/includes/cache.php +++ b/phpBB/includes/cache.php @@ -86,7 +86,7 @@ class cache extends acm { if ((version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) && @preg_match('/\p{L}/u', 'a') !== false) { - $censors['match'][] = '#(? Date: Tue, 7 Jul 2009 13:33:53 +0000 Subject: [PATCH 197/607] Fix bug #47815 - View end of ban in MCP and ACP when user is banned by duration - Patch by Pyramide Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9727 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_ban.php | 17 ++++++++++++++++- phpBB/language/en/acp/ban.php | 6 +++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 13dd42cf8f..a2d730e6a6 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -145,6 +145,7 @@
    400. [Fix] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by m0rpha)
    401. [Fix] Search by authorname does not display posts of guests and deleted users (Bug #36565 - Patch by nickvergessen)
    402. [Fix] Further word censor fix to work with UTF8 correctly. (Patch by rxu)
    403. +
    404. [Fix] View end of ban in MCP and ACP when user is banned by duration (Bug #47815 - Patch by Pyramide)
    405. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    406. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    407. [Change] Template engine now permits to a limited extent variable includes.
    408. diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php index 77fb44dda9..542ed47f3b 100644 --- a/phpBB/includes/acp/acp_ban.php +++ b/phpBB/includes/acp/acp_ban.php @@ -181,7 +181,22 @@ class acp_ban $banned_options .= '' . $row[$field] . ''; $time_length = ($row['ban_end']) ? ($row['ban_end'] - $row['ban_start']) / 60 : 0; - $ban_length[$row['ban_id']] = (isset($ban_end_text[$time_length])) ? $ban_end_text[$time_length] : $user->lang['UNTIL'] . ' -> ' . $user->format_date($row['ban_end']); + + if ($time_length == 0) + { + // Banned permanently + $ban_length[$row['ban_id']] = $user->lang['PERMANENT']; + } + else if (isset($ban_end_text[$time_length])) + { + // Banned for a given duration + $ban_length[$row['ban_id']] = sprintf($user->lang['BANNED_UNTIL_DURATION'], $ban_end_text[$time_length], $user->format_date($row['ban_end'], false, true)); + } + else + { + // Banned until given date + $ban_length[$row['ban_id']] = sprintf($user->lang['BANNED_UNTIL_DATE'], $user->format_date($row['ban_end'], false, true)); + } $ban_reasons[$row['ban_id']] = $row['ban_reason']; $ban_give_reasons[$row['ban_id']] = $row['ban_give_reason']; diff --git a/phpBB/language/en/acp/ban.php b/phpBB/language/en/acp/ban.php index 5fcbb1fa69..099834d1e4 100644 --- a/phpBB/language/en/acp/ban.php +++ b/phpBB/language/en/acp/ban.php @@ -48,6 +48,8 @@ $lang = array_merge($lang, array( 'BAN_REASON' => 'Reason for ban', 'BAN_GIVE_REASON' => 'Reason shown to the banned', 'BAN_UPDATE_SUCCESSFUL' => 'The banlist has been updated successfully.', + 'BANNED_UNTIL_DATE' => 'until %s', // Example: "until Mon 13.Jul.2009, 14:44" + 'BANNED_UNTIL_DURATION' => '%1$s (until %2$s)', // Example: "7 days (until Tue 14.Jul.2009, 14:44)" 'EMAIL_BAN' => 'Ban one or more e-mail addresses', 'EMAIL_BAN_EXCLUDE_EXPLAIN' => 'Enable this to exclude the entered e-mail address from all current bans.', @@ -67,7 +69,7 @@ $lang = array_merge($lang, array( 'LENGTH_BAN_INVALID' => 'The date has to be formatted YYYY-MM-DD.', 'PERMANENT' => 'Permanent', - + 'UNTIL' => 'Until', 'USER_BAN' => 'Ban one or more usernames', 'USER_BAN_EXCLUDE_EXPLAIN' => 'Enable this to exclude the entered users from all current bans.', @@ -75,8 +77,6 @@ $lang = array_merge($lang, array( 'USER_NO_BANNED' => 'No banned usernames', 'USER_UNBAN' => 'Un-ban or un-exclude usernames', 'USER_UNBAN_EXPLAIN' => 'You can unban (or un-exclude) multiple users in one go using the appropriate combination of mouse and keyboard for your computer and browser. Excluded users are emphasised.', - - )); ?> \ No newline at end of file From a6f088992b4d75df91df75f8d183a12f9fa12777 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 7 Jul 2009 15:18:11 +0000 Subject: [PATCH 198/607] Fix bug #47785 - Fetch requested cookie variables directly from cookie super global. This should fix a problem with phpBB installations on PHP 5.3 Authorised by: naderman git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9728 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a2d730e6a6..ac8775b0a0 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -161,6 +161,7 @@
    409. [Change] "Post details" links with image in MCP. (Bug #39845 - Patch by leviatan21)
    410. [Change] Pm history only shows pms of the receipts you currently reply to (Bug #39505 - Patch by nickvergessen)
    411. [Change] Add quote-button for own pm's in pm-history (Bug #37285 - Patch by nickvergessen)
    412. +
    413. [Change] Fetch requested cookie variables directly from cookie super global. (Bug #47785)
    414. [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
    415. [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
    416. [Feature] Add confirmation for deactivating language packs (Patch by leviatan21)
    417. diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 25bef4557a..29f4186a5d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -71,12 +71,13 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false) $_REQUEST[$var_name] = isset($_POST[$var_name]) ? $_POST[$var_name] : $_GET[$var_name]; } - if (!isset($_REQUEST[$var_name]) || (is_array($_REQUEST[$var_name]) && !is_array($default)) || (is_array($default) && !is_array($_REQUEST[$var_name]))) + $super_global = ($cookie) ? '_COOKIE' : '_REQUEST'; + if (!isset($$super_global[$var_name]) || is_array($$super_global[$var_name]) != is_array($default)) { return (is_array($default)) ? array() : $default; } - $var = $_REQUEST[$var_name]; + $var = $$super_global[$var_name]; if (!is_array($default)) { $type = gettype($default); From 48e3b6deaab11bd4f04132aed514430aef8696f7 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 7 Jul 2009 15:36:24 +0000 Subject: [PATCH 199/607] Fix r9728 - It does actually not work that way. ;-) Authorised by: naderman git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9729 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 29f4186a5d..c6f6084918 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -72,12 +72,12 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false) } $super_global = ($cookie) ? '_COOKIE' : '_REQUEST'; - if (!isset($$super_global[$var_name]) || is_array($$super_global[$var_name]) != is_array($default)) + if (!isset($GLOBALS[$super_global][$var_name]) || is_array($GLOBALS[$super_global][$var_name]) != is_array($default)) { return (is_array($default)) ? array() : $default; } - $var = $$super_global[$var_name]; + $var = $GLOBALS[$super_global][$var_name]; if (!is_array($default)) { $type = gettype($default); From 8750fdf3f57bad9bbf64eb98a8fb85a3dc3f1b0a Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 7 Jul 2009 19:41:22 +0000 Subject: [PATCH 200/607] #47885 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9730 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_main.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 6b16f5ad69..4718869d73 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -137,9 +137,9 @@ -
      +
      -

      {L_PURGE_SESSIONS_EXPLAIN}
      +

      {L_PURGE_SESSIONS_EXPLAIN}
      From f368e0ec09b38c885465478ff965400ffdc5c65e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 8 Jul 2009 10:22:36 +0000 Subject: [PATCH 201/607] Another feature: Detect when a post has been altered by someone else while editing. Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9731 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/includes/functions_posting.php | 7 +++++ phpBB/language/en/posting.php | 1 + phpBB/posting.php | 40 ++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ac8775b0a0..0b1fc95746 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -186,7 +186,7 @@
    418. [Feature] Ability to define minimum number of characters for posts/pms
    419. [Feature] Store signature configuration options in database (Bug #45115 - Patch by rxu)
    420. [Feature] Add bare-bones quick-reply editor to viewtopic.
    421. - +
    422. [Feature] Detect when a post has been altered by someone else while editing. (Patch by bantu)
    423. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 18bb432769..22fbfe3495 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -944,6 +944,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id WHERE p.topic_id = $topic_id " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . ' ' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . ' + ' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . ' ORDER BY p.post_time '; $sql .= ($mode == 'post_review') ? 'ASC' : 'DESC'; $result = $db->sql_query_limit($sql, $config['posts_per_page']); @@ -962,6 +963,12 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id return false; } + // Handle 'post_review_edit' like 'post_review' from now on + if ($mode == 'post_review_edit') + { + $mode = 'post_review'; + } + $sql = $db->sql_build_query('SELECT', array( 'SELECT' => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe', diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index e665f540eb..fae9f6124c 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -167,6 +167,7 @@ $lang = array_merge($lang, array( 'POST_ICON' => 'Post icon', 'POST_NORMAL' => 'Normal', 'POST_REVIEW' => 'Post review', + 'POST_REVIEW_EDIT_EXPLAIN' => 'This post has been altered by another user while you were editing it. You may wish to review the current version of this post and adjust your edits.', 'POST_REVIEW_EXPLAIN' => 'At least one new post has been made to this topic. You may wish to review your post in light of this.', 'POST_STORED' => 'This message has been posted successfully.', 'POST_STORED_MOD' => 'This message has been submitted successfully, but it will need to be approved by a moderator before it is publicly viewable.', diff --git a/phpBB/posting.php b/phpBB/posting.php index 598f500bc4..de5cdb9c6a 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -370,6 +370,7 @@ else } $post_data['post_edit_locked'] = (isset($post_data['post_edit_locked'])) ? (int) $post_data['post_edit_locked'] : 0; +$post_data['post_subject_md5'] = (isset($post_data['post_subject']) && $mode == 'edit') ? md5($post_data['post_subject']) : ''; $post_data['post_subject'] = (in_array($mode, array('quote', 'edit'))) ? $post_data['post_subject'] : ((isset($post_data['topic_title'])) ? $post_data['topic_title'] : ''); $post_data['topic_time_limit'] = (isset($post_data['topic_time_limit'])) ? (($post_data['topic_time_limit']) ? (int) $post_data['topic_time_limit'] / 86400 : (int) $post_data['topic_time_limit']) : 0; $post_data['poll_length'] = (!empty($post_data['poll_length'])) ? (int) $post_data['poll_length'] / 86400 : 0; @@ -704,6 +705,37 @@ if ($submit || $preview || $refresh) // Grab md5 'checksum' of new message $message_md5 = md5($message_parser->message); + // If editing and checksum has changed we know the post was edited while we're editing + // Notify and show user the changed post + if ($mode == 'edit' && $post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) + { + $edit_post_message_checksum = request_var('edit_post_message_checksum', ''); + $edit_post_subject_checksum = request_var('edit_post_subject_checksum', ''); + + // $post_data['post_checksum'] is the checksum of the post submitted in the meantime + // $message_md5 is the checksum of the post we're about to submit + // $edit_post_message_checksum is the checksum of the post we're editing + // ... + + // We make sure nobody else made exactly the same change + // we're about to submit by also checking $message_md5 != $post_data['post_checksum'] + if (($edit_post_message_checksum !== '' && $edit_post_message_checksum != $post_data['post_checksum'] && $message_md5 != $post_data['post_checksum']) + || ($edit_post_subject_checksum !== '' && $edit_post_subject_checksum != $post_data['post_subject_md5'] && md5($post_data['post_subject']) != $post_data['post_subject_md5'])) + { + if (topic_review($topic_id, $forum_id, 'post_review_edit', $post_id)) + { + $template->assign_vars(array( + 'S_POST_REVIEW' => true, + + 'L_POST_REVIEW_EXPLAIN' => $user->lang['POST_REVIEW_EDIT_EXPLAIN'], + )); + } + + $submit = false; + $refresh = true; + } + } + // Check checksum ... don't re-parse message if the same $update_message = ($mode != 'edit' || $message_md5 != $post_data['post_checksum'] || $status_switch || strlen($post_data['bbcode_uid']) < BBCODE_UID_LEN) ? true : false; @@ -1261,6 +1293,14 @@ $s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? ''; $s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '' : ''; +if ($mode == 'edit') +{ + $s_hidden_fields .= build_hidden_fields(array( + 'edit_post_message_checksum' => $post_data['post_checksum'], + 'edit_post_subject_checksum' => $post_data['post_subject_md5'], + )); +} + // Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview if (isset($captcha) && $captcha->is_solved() !== false) { From acf0fad19ab1323e9df96b094a2d38f338ce6da0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Jul 2009 12:48:07 +0000 Subject: [PATCH 202/607] Fix bug #47765 - Search by authorname does not display posts of deactivated users Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9732 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/search.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 0b1fc95746..e0e314122a 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -143,7 +143,7 @@
    424. [Fix] Fix style issues in print mode. (Bug #26375 - Patch by leviatan21)
    425. [Fix] Fix minor issue with L_QUOTE language string missing in several PM composing modes. (Bug #39625 - Patch by rxu)
    426. [Fix] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by m0rpha)
    427. -
    428. [Fix] Search by authorname does not display posts of guests and deleted users (Bug #36565 - Patch by nickvergessen)
    429. +
    430. [Fix] Search by authorname does not display posts of guests and deleted or deactivated users (Bug #36565, #47765 - Patch by nickvergessen)
    431. [Fix] Further word censor fix to work with UTF8 correctly. (Patch by rxu)
    432. [Fix] View end of ban in MCP and ACP when user is banned by duration (Bug #47815 - Patch by Pyramide)
    433. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    434. diff --git a/phpBB/search.php b/phpBB/search.php index c7c1d47257..48c0290d87 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -114,7 +114,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $sql = 'SELECT user_id FROM ' . USERS_TABLE . " WHERE $sql_where - AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + AND user_type <> " . USER_IGNORE; $result = $db->sql_query_limit($sql, 100); while ($row = $db->sql_fetchrow($result)) From 1c6e99848f9663792051c6bd84b6159b5ad57a4e Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Wed, 8 Jul 2009 12:50:45 +0000 Subject: [PATCH 203/607] Fixed Bug #40155 - Postcount of 0 not showing up in PMs Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9733 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/ucp/ucp_pm_viewmessage.php | 2 +- phpBB/styles/prosilver/template/ucp_pm_viewmessage.html | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e0e314122a..f693776f57 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -146,6 +146,7 @@
    435. [Fix] Search by authorname does not display posts of guests and deleted or deactivated users (Bug #36565, #47765 - Patch by nickvergessen)
    436. [Fix] Further word censor fix to work with UTF8 correctly. (Patch by rxu)
    437. [Fix] View end of ban in MCP and ACP when user is banned by duration (Bug #47815 - Patch by Pyramide)
    438. +
    439. [Fix] Display user's posts count in private message when it is equal to 0 (prosilver). (Bug #40155 - Patch by rxu)
    440. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    441. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    442. [Change] Template engine now permits to a limited extent variable includes.
    443. diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 5fef30056f..185a7f523c 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -178,7 +178,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'RANK_IMG' => $user_info['rank_image'], 'AUTHOR_AVATAR' => (isset($user_info['avatar'])) ? $user_info['avatar'] : '', 'AUTHOR_JOINED' => $user->format_date($user_info['user_regdate']), - 'AUTHOR_POSTS' => (!empty($user_info['user_posts'])) ? $user_info['user_posts'] : '', + 'AUTHOR_POSTS' => (int) $user_info['user_posts'], 'AUTHOR_FROM' => (!empty($user_info['user_from'])) ? $user_info['user_from'] : '', 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : ((isset($user_info['online']) && $user_info['online']) ? $user->img('icon_user_online', $user->lang['ONLINE']) : $user->img('icon_user_offline', $user->lang['OFFLINE'])), diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index ef9807f88a..56066cdf37 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -67,7 +67,7 @@
      {RANK_TITLE}
      {RANK_IMG}
       
      -
      {L_POSTS}: {AUTHOR_POSTS}
      +
      {L_POSTS}: {AUTHOR_POSTS}
      {L_JOINED}: {AUTHOR_JOINED}
      {L_LOCATION}: {AUTHOR_FROM}
      From 51885a2734bea8f77e9be0f536942fb6bf305163 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Jul 2009 13:03:43 +0000 Subject: [PATCH 204/607] Fix bug #47575 - Disable word-censor option in UCP lacks the config-setting - Patch by 00mohgta7 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9734 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/ucp/ucp_prefs.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f693776f57..3438944736 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -147,6 +147,7 @@
    444. [Fix] Further word censor fix to work with UTF8 correctly. (Patch by rxu)
    445. [Fix] View end of ban in MCP and ACP when user is banned by duration (Bug #47815 - Patch by Pyramide)
    446. [Fix] Display user's posts count in private message when it is equal to 0 (prosilver). (Bug #40155 - Patch by rxu)
    447. +
    448. [Fix] Disable word-censor option in UCP lacks the config-setting (Bug #47575 - Patch by 00mohgta7)
    449. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    450. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    451. [Change] Template engine now permits to a limited extent variable includes.
    452. diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 9b705fba6c..cc8565e69d 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -282,7 +282,7 @@ class ucp_prefs 'S_AVATARS' => $data['avatars'], 'S_DISABLE_CENSORS' => $data['wordcensor'], - 'S_CHANGE_CENSORS' => ($auth->acl_get('u_chgcensors')) ? true : false, + 'S_CHANGE_CENSORS' => ($auth->acl_get('u_chgcensors') && $config['allow_nocensors']) ? true : false, 'S_TOPIC_SORT_DAYS' => $s_limit_topic_days, 'S_TOPIC_SORT_KEY' => $s_sort_topic_key, From 55e15b4c8eea94f226a0169284bb51d7d9bcbcd4 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 8 Jul 2009 13:52:18 +0000 Subject: [PATCH 205/607] Fix database updater and db tools to support multiple column changes/additions/removals with SQLite git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9735 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/db/db_tools.php | 246 +++++++++++++++++++++++++++--- phpBB/install/database_update.php | 238 ++++++++++++++++++++++++++--- 3 files changed, 450 insertions(+), 35 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3438944736..36da6e67e8 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -148,6 +148,7 @@
    453. [Fix] View end of ban in MCP and ACP when user is banned by duration (Bug #47815 - Patch by Pyramide)
    454. [Fix] Display user's posts count in private message when it is equal to 0 (prosilver). (Bug #40155 - Patch by rxu)
    455. [Fix] Disable word-censor option in UCP lacks the config-setting (Bug #47575 - Patch by 00mohgta7)
    456. +
    457. [Fix] Fix database updater and db tools to support multiple column changes/additions/removals with SQLite
    458. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    459. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    460. [Change] Template engine now permits to a limited extent variable includes.
    461. diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index 7ea70f341d..ddc633c6d1 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -347,6 +347,11 @@ class phpbb_db_tools // holds the DDL for a column $columns = $statements = array(); + if ($this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + // Begin transaction $statements[] = 'begin'; @@ -580,6 +585,14 @@ class phpbb_db_tools } $statements = array(); + $sqlite = false; + + // For SQLite we need to perform the schema changes in a much more different way + if ($this->db->sql_layer == 'sqlite' && $this->return_statements) + { + $sqlite_data = array(); + $sqlite = true; + } // Change columns? if (!empty($schema_changes['change_columns'])) @@ -589,16 +602,27 @@ class phpbb_db_tools foreach ($columns as $column_name => $column_data) { // If the column exists we change it, else we add it ;) - if ($this->sql_column_exists($table, $column_name)) + if ($column_exists = $this->sql_column_exists($table, $column_name)) { - $result = $this->sql_column_change($table, $column_name, $column_data); + $result = $this->sql_column_change($table, $column_name, $column_data, true); } else { - $result = $this->sql_column_add($table, $column_name, $column_data); + $result = $this->sql_column_add($table, $column_name, $column_data, true); } - if ($this->return_statements) + if ($sqlite) + { + if ($column_exists) + { + $sqlite_data[$table]['change_columns'][] = $result; + } + else + { + $sqlite_data[$table]['add_columns'][] = $result; + } + } + else if ($this->return_statements) { $statements = array_merge($statements, $result); } @@ -614,16 +638,27 @@ class phpbb_db_tools foreach ($columns as $column_name => $column_data) { // Only add the column if it does not exist yet, else change it (to be consistent) - if ($this->sql_column_exists($table, $column_name)) + if ($column_exists = $this->sql_column_exists($table, $column_name)) { - $result = $this->sql_column_change($table, $column_name, $column_data); + $result = $this->sql_column_change($table, $column_name, $column_data, true); } else { - $result = $this->sql_column_add($table, $column_name, $column_data); + $result = $this->sql_column_add($table, $column_name, $column_data, true); } - if ($this->return_statements) + if ($sqlite) + { + if ($column_exists) + { + $sqlite_data[$table]['change_columns'][] = $result; + } + else + { + $sqlite_data[$table]['add_columns'][] = $result; + } + } + else if ($this->return_statements) { $statements = array_merge($statements, $result); } @@ -658,9 +693,13 @@ class phpbb_db_tools // Only remove the column if it exists... if ($this->sql_column_exists($table, $column)) { - $result = $this->sql_column_remove($table, $column); + $result = $this->sql_column_remove($table, $column, true); - if ($this->return_statements) + if ($sqlite) + { + $sqlite_data[$table]['drop_columns'][] = $result; + } + else if ($this->return_statements) { $statements = array_merge($statements, $result); } @@ -674,9 +713,13 @@ class phpbb_db_tools { foreach ($schema_changes['add_primary_keys'] as $table => $columns) { - $result = $this->sql_create_primary_key($table, $columns); + $result = $this->sql_create_primary_key($table, $columns, true); - if ($this->return_statements) + if ($sqlite) + { + $sqlite_data[$table]['primary_key'] = $result; + } + else if ($this->return_statements) { $statements = array_merge($statements, $result); } @@ -717,6 +760,147 @@ class phpbb_db_tools } } + if ($sqlite) + { + foreach ($sqlite_data as $table_name => $sql_schema_changes) + { + // Create temporary table with original data + $statements[] = 'begin'; + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}' + ORDER BY type DESC, name;"; + $result = $this->db->sql_query($sql); + + if (!$result) + { + continue; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + // Get the columns... + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $plain_table_cols = trim($matches[1]); + $new_table_cols = preg_split('/,(?![\s\w]+\))/m', $plain_table_cols); + $column_list = array(); + + foreach ($new_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + $column_list[] = $entities[0]; + } + + // note down the primary key notation because sqlite only supports adding it to the end for the new table + $primary_key = false; + $_new_cols = array(); + + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + $primary_key = $declaration; + continue; + } + $_new_cols[] = $declaration; + } + + $new_table_cols = $_new_cols; + + // First of all... change columns + if (!empty($sql_schema_changes['change_columns'])) + { + foreach ($sql_schema_changes['change_columns'] as $column_sql) + { + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if (strpos($column_sql, $entities[0] . ' ') === 0) + { + $new_table_cols[$key] = $column_sql; + } + } + } + } + + if (!empty($sql_schema_changes['add_columns'])) + { + foreach ($sql_schema_changes['add_columns'] as $column_sql) + { + $new_table_cols[] = $column_sql; + } + } + + // Now drop them... + if (!empty($sql_schema_changes['drop_columns'])) + { + foreach ($sql_schema_changes['drop_columns'] as $column_name) + { + // Remove from column list... + $new_column_list = array(); + foreach ($column_list as $key => $value) + { + if ($value === $column_name) + { + continue; + } + + $new_column_list[] = $value; + } + + $column_list = $new_column_list; + + // Remove from table... + $_new_cols = array(); + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if (strpos($column_name . ' ', $entities[0] . ' ') === 0) + { + continue; + } + $_new_cols[] = $declaration; + } + $new_table_cols = $_new_cols; + } + } + + // Primary key... + if (!empty($sql_schema_changes['primary_key'])) + { + $new_table_cols[] = 'PRIMARY KEY (' . implode(', ', $sql_schema_changes['primary_key']) . ')'; + } + // Add a new one or the old primary key + else if ($primary_key !== false) + { + $new_table_cols[] = $primary_key; + } + + $columns = implode(',', $column_list); + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $new_table_cols) . ');'; + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + } + } + if ($this->return_statements) { return $statements; @@ -1131,7 +1315,7 @@ class phpbb_db_tools /** * Add new column */ - function sql_column_add($table_name, $column_name, $column_data) + function sql_column_add($table_name, $column_name, $column_data, $inline = false) { $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); $statements = array(); @@ -1160,6 +1344,12 @@ class phpbb_db_tools break; case 'sqlite': + + if ($inline && $this->return_statements) + { + return $column_name . ' ' . $column_data['column_type_sql']; + } + if (version_compare(sqlite_libversion(), '3.0') == -1) { $sql = "SELECT sql @@ -1224,7 +1414,7 @@ class phpbb_db_tools /** * Drop column */ - function sql_column_remove($table_name, $column_name) + function sql_column_remove($table_name, $column_name, $inline = false) { $statements = array(); @@ -1252,6 +1442,12 @@ class phpbb_db_tools break; case 'sqlite': + + if ($inline && $this->return_statements) + { + return $column_name; + } + if (version_compare(sqlite_libversion(), '3.0') == -1) { $sql = "SELECT sql @@ -1294,7 +1490,7 @@ class phpbb_db_tools $columns = implode(',', $column_list); - $new_table_cols = $new_table_cols = preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols); + $new_table_cols = preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols); // create a new table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; @@ -1349,6 +1545,11 @@ class phpbb_db_tools { $statements = array(); + if (!$this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + // the most basic operation, get rid of the table $statements[] = 'DROP TABLE ' . $table_name; @@ -1407,7 +1608,7 @@ class phpbb_db_tools /** * Add primary key */ - function sql_create_primary_key($table_name, $column) + function sql_create_primary_key($table_name, $column, $inline = false) { $statements = array(); @@ -1434,6 +1635,12 @@ class phpbb_db_tools break; case 'sqlite': + + if ($inline && $this->return_statements) + { + return $column; + } + $sql = "SELECT sql FROM sqlite_master WHERE type = 'table' @@ -1641,7 +1848,7 @@ class phpbb_db_tools /** * Change column type (not name!) */ - function sql_column_change($table_name, $column_name, $column_data) + function sql_column_change($table_name, $column_name, $column_data, $inline = false) { $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); $statements = array(); @@ -1739,6 +1946,11 @@ class phpbb_db_tools case 'sqlite': + if ($inline && $this->return_statements) + { + return $column_name . ' ' . $column_data['column_type_sql']; + } + $sql = "SELECT sql FROM sqlite_master WHERE type = 'table' diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 85b9623ffe..d7398ea953 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -11,7 +11,7 @@ $updates_to_version = '3.0.6-dev'; // Enter any version to update from to test updates. The version within the db will not be updated. -$debug_from_version = false; +$debug_from_version = '3.0.5'; // Which oldest version does this updater supports? $oldest_from_version = '3.0.0'; @@ -1292,7 +1292,7 @@ function change_database_data(&$no_updates, $version) $result = $db->sql_query_limit($sql, 1); $user_option = (int) $db->sql_fetchfield('user_options'); $db->sql_freeresult($result); - + // Check if we already updated the database by checking bit 15 which we used to store the sig_bbcode option if (!($user_option & 1 << 15)) { @@ -1631,6 +1631,14 @@ class updater_db_tools } $statements = array(); + $sqlite = false; + + // For SQLite we need to perform the schema changes in a much more different way + if ($this->db->sql_layer == 'sqlite' && $this->return_statements) + { + $sqlite_data = array(); + $sqlite = true; + } // Change columns? if (!empty($schema_changes['change_columns'])) @@ -1640,16 +1648,27 @@ class updater_db_tools foreach ($columns as $column_name => $column_data) { // If the column exists we change it, else we add it ;) - if ($this->sql_column_exists($table, $column_name)) + if ($column_exists = $this->sql_column_exists($table, $column_name)) { - $result = $this->sql_column_change($table, $column_name, $column_data); + $result = $this->sql_column_change($table, $column_name, $column_data, true); } else { - $result = $this->sql_column_add($table, $column_name, $column_data); + $result = $this->sql_column_add($table, $column_name, $column_data, true); } - if ($this->return_statements) + if ($sqlite) + { + if ($column_exists) + { + $sqlite_data[$table]['change_columns'][] = $result; + } + else + { + $sqlite_data[$table]['add_columns'][] = $result; + } + } + else if ($this->return_statements) { $statements = array_merge($statements, $result); } @@ -1665,16 +1684,27 @@ class updater_db_tools foreach ($columns as $column_name => $column_data) { // Only add the column if it does not exist yet, else change it (to be consistent) - if ($this->sql_column_exists($table, $column_name)) + if ($column_exists = $this->sql_column_exists($table, $column_name)) { - $result = $this->sql_column_change($table, $column_name, $column_data); + $result = $this->sql_column_change($table, $column_name, $column_data, true); } else { - $result = $this->sql_column_add($table, $column_name, $column_data); + $result = $this->sql_column_add($table, $column_name, $column_data, true); } - if ($this->return_statements) + if ($sqlite) + { + if ($column_exists) + { + $sqlite_data[$table]['change_columns'][] = $result; + } + else + { + $sqlite_data[$table]['add_columns'][] = $result; + } + } + else if ($this->return_statements) { $statements = array_merge($statements, $result); } @@ -1709,9 +1739,13 @@ class updater_db_tools // Only remove the column if it exists... if ($this->sql_column_exists($table, $column)) { - $result = $this->sql_column_remove($table, $column); + $result = $this->sql_column_remove($table, $column, true); - if ($this->return_statements) + if ($sqlite) + { + $sqlite_data[$table]['drop_columns'][] = $result; + } + else if ($this->return_statements) { $statements = array_merge($statements, $result); } @@ -1725,9 +1759,13 @@ class updater_db_tools { foreach ($schema_changes['add_primary_keys'] as $table => $columns) { - $result = $this->sql_create_primary_key($table, $columns); + $result = $this->sql_create_primary_key($table, $columns, true); - if ($this->return_statements) + if ($sqlite) + { + $sqlite_data[$table]['primary_key'] = $result; + } + else if ($this->return_statements) { $statements = array_merge($statements, $result); } @@ -1768,6 +1806,147 @@ class updater_db_tools } } + if ($sqlite) + { + foreach ($sqlite_data as $table_name => $sql_schema_changes) + { + // Create temporary table with original data + $statements[] = 'begin'; + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}' + ORDER BY type DESC, name;"; + $result = $this->db->sql_query($sql); + + if (!$result) + { + continue; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + // Get the columns... + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $plain_table_cols = trim($matches[1]); + $new_table_cols = preg_split('/,(?![\s\w]+\))/m', $plain_table_cols); + $column_list = array(); + + foreach ($new_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + $column_list[] = $entities[0]; + } + + // note down the primary key notation because sqlite only supports adding it to the end for the new table + $primary_key = false; + $_new_cols = array(); + + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + $primary_key = $declaration; + continue; + } + $_new_cols[] = $declaration; + } + + $new_table_cols = $_new_cols; + + // First of all... change columns + if (!empty($sql_schema_changes['change_columns'])) + { + foreach ($sql_schema_changes['change_columns'] as $column_sql) + { + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if (strpos($column_sql, $entities[0] . ' ') === 0) + { + $new_table_cols[$key] = $column_sql; + } + } + } + } + + if (!empty($sql_schema_changes['add_columns'])) + { + foreach ($sql_schema_changes['add_columns'] as $column_sql) + { + $new_table_cols[] = $column_sql; + } + } + + // Now drop them... + if (!empty($sql_schema_changes['drop_columns'])) + { + foreach ($sql_schema_changes['drop_columns'] as $column_name) + { + // Remove from column list... + $new_column_list = array(); + foreach ($column_list as $key => $value) + { + if ($value === $column_name) + { + continue; + } + + $new_column_list[] = $value; + } + + $column_list = $new_column_list; + + // Remove from table... + $_new_cols = array(); + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if (strpos($column_name . ' ', $entities[0] . ' ') === 0) + { + continue; + } + $_new_cols[] = $declaration; + } + $new_table_cols = $_new_cols; + } + } + + // Primary key... + if (!empty($sql_schema_changes['primary_key'])) + { + $new_table_cols[] = 'PRIMARY KEY (' . implode(', ', $sql_schema_changes['primary_key']) . ')'; + } + // Add a new one or the old primary key + else if ($primary_key !== false) + { + $new_table_cols[] = $primary_key; + } + + $columns = implode(',', $column_list); + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $new_table_cols) . ');'; + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + } + } + if ($this->return_statements) { return $statements; @@ -2182,7 +2361,7 @@ class updater_db_tools /** * Add new column */ - function sql_column_add($table_name, $column_name, $column_data) + function sql_column_add($table_name, $column_name, $column_data, $inline = false) { $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); $statements = array(); @@ -2216,6 +2395,12 @@ class updater_db_tools break; case 'sqlite': + + if ($inline && $this->return_statements) + { + return $column_name . ' ' . $column_data['column_type_sql']; + } + if (version_compare(sqlite_libversion(), '3.0') == -1) { $sql = "SELECT sql @@ -2280,7 +2465,7 @@ class updater_db_tools /** * Drop column */ - function sql_column_remove($table_name, $column_name) + function sql_column_remove($table_name, $column_name, $inline = false) { $statements = array(); @@ -2308,6 +2493,12 @@ class updater_db_tools break; case 'sqlite': + + if ($inline && $this->return_statements) + { + return $column_name; + } + if (version_compare(sqlite_libversion(), '3.0') == -1) { $sql = "SELECT sql @@ -2401,7 +2592,7 @@ class updater_db_tools /** * Add primary key */ - function sql_create_primary_key($table_name, $column) + function sql_create_primary_key($table_name, $column, $inline = false) { $statements = array(); @@ -2428,6 +2619,12 @@ class updater_db_tools break; case 'sqlite': + + if ($inline && $this->return_statements) + { + return $column; + } + $sql = "SELECT sql FROM sqlite_master WHERE type = 'table' @@ -2541,7 +2738,7 @@ class updater_db_tools /** * Change column type (not name!) */ - function sql_column_change($table_name, $column_name, $column_data) + function sql_column_change($table_name, $column_name, $column_data, $inline = false) { $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); $statements = array(); @@ -2639,6 +2836,11 @@ class updater_db_tools case 'sqlite': + if ($inline && $this->return_statements) + { + return $column_name . ' ' . $column_data['column_type_sql']; + } + $sql = "SELECT sql FROM sqlite_master WHERE type = 'table' From cc1b91bb92612fcc84bb48e3d690ab4362d3c149 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 8 Jul 2009 14:04:55 +0000 Subject: [PATCH 206/607] Fix cosmetic ACP bug showing on hover elements in IE7 (Bug #16109 - Patch by prototech) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9736 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/install_footer.html | 1 + phpBB/adm/style/overall_footer.html | 1 + phpBB/docs/CHANGELOG.html | 1 + 3 files changed, 3 insertions(+) diff --git a/phpBB/adm/style/install_footer.html b/phpBB/adm/style/install_footer.html index 2ec3581ef4..4df43eaaa0 100644 --- a/phpBB/adm/style/install_footer.html +++ b/phpBB/adm/style/install_footer.html @@ -2,6 +2,7 @@ +
      diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html index d5316aae08..8af299ad57 100644 --- a/phpBB/adm/style/overall_footer.html +++ b/phpBB/adm/style/overall_footer.html @@ -2,6 +2,7 @@ +
      diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 36da6e67e8..92e00b0a56 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -149,6 +149,7 @@
    462. [Fix] Display user's posts count in private message when it is equal to 0 (prosilver). (Bug #40155 - Patch by rxu)
    463. [Fix] Disable word-censor option in UCP lacks the config-setting (Bug #47575 - Patch by 00mohgta7)
    464. [Fix] Fix database updater and db tools to support multiple column changes/additions/removals with SQLite
    465. +
    466. [Fix] Fix cosmetic ACP bug showing on hover elements in IE7 (Bug #16109 - Patch by prototech)
    467. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    468. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    469. [Change] Template engine now permits to a limited extent variable includes.
    470. From 61453bb2aba7c1acfedab0ea600c9d13ee751976 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Wed, 8 Jul 2009 14:30:01 +0000 Subject: [PATCH 207/607] Fixed Bug #24075 - GZIP status is not showed up correctly in debug mode Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9737 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_main.php | 2 +- phpBB/includes/functions.php | 2 +- phpBB/language/en/acp/board.php | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 92e00b0a56..34e1964227 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -150,6 +150,7 @@
    471. [Fix] Disable word-censor option in UCP lacks the config-setting (Bug #47575 - Patch by 00mohgta7)
    472. [Fix] Fix database updater and db tools to support multiple column changes/additions/removals with SQLite
    473. [Fix] Fix cosmetic ACP bug showing on hover elements in IE7 (Bug #16109 - Patch by prototech)
    474. +
    475. [Fix] Correctly detect GZIP status in debug mode. (Bug #24075 - Patch by rxu)
    476. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    477. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    478. [Change] Template engine now permits to a limited extent variable includes.
    479. diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index e0d6a3f01c..f9d611f8db 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -485,7 +485,7 @@ class acp_main 'UPLOAD_DIR_SIZE' => $upload_dir_size, 'TOTAL_ORPHAN' => $total_orphan, 'S_TOTAL_ORPHAN' => ($total_orphan === false) ? false : true, - 'GZIP_COMPRESSION' => ($config['gzip_compress']) ? $user->lang['ON'] : $user->lang['OFF'], + 'GZIP_COMPRESSION' => ($config['gzip_compress'] && @extension_loaded('zlib')) ? $user->lang['ON'] : $user->lang['OFF'], 'DATABASE_INFO' => $db->sql_server_info(), 'BOARD_VERSION' => $config['version'], diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c6f6084918..60fe6a454f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3927,7 +3927,7 @@ function page_footer($run_cron = true) $db->sql_report('display'); } - $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress']) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); + $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress'] && @extension_loaded('zlib')) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); if ($auth->acl_get('a_') && defined('DEBUG_EXTRA')) { diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 9247a87e52..0ac7d1fb6b 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -394,7 +394,7 @@ $lang = array_merge($lang, array( 'ACP_SERVER_SETTINGS_EXPLAIN' => 'Here you define server and domain dependant settings. Please ensure the data you enter is accurate, errors will result in e-mails containing incorrect information. When entering the domain name remember it does include http:// or other protocol term. Only alter the port number if you know your server uses a different value, port 80 is correct in most cases.', 'ENABLE_GZIP' => 'Enable GZip compression', - 'ENABLE_GZIP_EXPLAIN' => 'Generated content will be compressed prior to sending it to the user. This can reduce network traffic but will also increase CPU usage on both server and client side.', + 'ENABLE_GZIP_EXPLAIN' => 'Generated content will be compressed prior to sending it to the user. This can reduce network traffic but will also increase CPU usage on both server and client side. Requires zlib PHP extension to be loaded.', 'FORCE_SERVER_VARS' => 'Force server URL settings', 'FORCE_SERVER_VARS_EXPLAIN' => 'If set to yes the server settings defined here will be used in favour of the automatically determined values.', 'ICONS_PATH' => 'Post icons storage path', From c875e2924969bc5d7a923ac7af3feb998136f5e4 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 8 Jul 2009 14:58:06 +0000 Subject: [PATCH 208/607] some changelog changes and a small SQL correction git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9738 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 6 ++---- phpBB/includes/mcp/mcp_warn.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 34e1964227..90bd9d7d34 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -94,7 +94,7 @@
    480. [Fix] Show report button in prosilver for guests who are allowed to report posts. (Bug #45695 - Patch by bantu)
    481. [Fix] Correctly show private message history (Bug #46065 - Patch by bantu)
    482. [Fix] Various XHTML mistakes in prosilver, subsilver2 and the ACP. (Bugs #25545 - Patch by bantu, #26315, #38555, #45505 - Patch by Raimon, #45785, #45865, #47085 - Patch by Raimon)
    483. -
    484. [Fix] Fix some ACP style issues (Bug #45975 - Patch by leviatan21)
    485. +
    486. [Fix] Fix some ACP style issues (Bug #45975 - Patch by leviatan21, Bug #16109 - Patch by prototech)
    487. [Fix] Move post bump information markup to the template. (Bug #34295 - Patch by bantu)
    488. [Fix] Show error in the ACP when template folder is not readable. (Bug #45705 - Patch by bantu)
    489. [Fix] Adjust viewonline filename regular expression to be less strict. (Bug #46215 - Patch by bantu)
    490. @@ -122,7 +122,7 @@
    491. [Fix] Empty error message in UCP folder management when creating folder without name (Bug #39875 - Patch by nickvergessen)
    492. [Fix] Wrong description in UCP group management implicates missing feature (Bug #19945 - Patch by nickvergessen)
    493. [Fix] Do not throw an error when PDO is a shared module and not loaded preventing SQLite from being loaded.
    494. -
    495. [Fix] Fix unicode words wrong censoring. (Bug #16555 - Patch by rxu)
    496. +
    497. [Fix] Fix unicode words censoring. (Bug #16555 - Patches by rxu)
    498. [Fix] Display coloured usernames in ACP groups management screens
    499. [Fix] Correctly describe founder permissions on trace-information (Bug #37235 - Patch by nickvergessen)
    500. [Fix] Correct the width value for poll_center.gif omitted in imageset.cfg for subsilver2. (Bug #43005 - Patch by rxu)
    501. @@ -144,12 +144,10 @@
    502. [Fix] Fix minor issue with L_QUOTE language string missing in several PM composing modes. (Bug #39625 - Patch by rxu)
    503. [Fix] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by m0rpha)
    504. [Fix] Search by authorname does not display posts of guests and deleted or deactivated users (Bug #36565, #47765 - Patch by nickvergessen)
    505. -
    506. [Fix] Further word censor fix to work with UTF8 correctly. (Patch by rxu)
    507. [Fix] View end of ban in MCP and ACP when user is banned by duration (Bug #47815 - Patch by Pyramide)
    508. [Fix] Display user's posts count in private message when it is equal to 0 (prosilver). (Bug #40155 - Patch by rxu)
    509. [Fix] Disable word-censor option in UCP lacks the config-setting (Bug #47575 - Patch by 00mohgta7)
    510. [Fix] Fix database updater and db tools to support multiple column changes/additions/removals with SQLite
    511. -
    512. [Fix] Fix cosmetic ACP bug showing on hover elements in IE7 (Bug #16109 - Patch by prototech)
    513. [Fix] Correctly detect GZIP status in debug mode. (Bug #24075 - Patch by rxu)
    514. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    515. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    516. diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 4ce67e5f9b..63e5b19155 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -204,7 +204,7 @@ class mcp_warn $sql = 'SELECT u.*, p.* FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u - WHERE post_id = $post_id + WHERE p.post_id = $post_id AND u.user_id = p.poster_id"; $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); From 144f2e8d73bf6b0650c9b9e9e7c242bfab604d64 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Jul 2009 20:36:57 +0000 Subject: [PATCH 209/607] Fix bug #47685 - Wrong count of posts awaiting approval in MCP Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9739 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/mcp.php | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 90bd9d7d34..f56b7e28c8 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -145,6 +145,7 @@
    517. [Fix] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by m0rpha)
    518. [Fix] Search by authorname does not display posts of guests and deleted or deactivated users (Bug #36565, #47765 - Patch by nickvergessen)
    519. [Fix] View end of ban in MCP and ACP when user is banned by duration (Bug #47815 - Patch by Pyramide)
    520. +
    521. [Fix] Wrong count of posts awaiting approval in MCP. (Bug #47685 - Patch by nickvergessen)
    522. [Fix] Display user's posts count in private message when it is equal to 0 (prosilver). (Bug #40155 - Patch by rxu)
    523. [Fix] Disable word-censor option in UCP lacks the config-setting (Bug #47575 - Patch by 00mohgta7)
    524. [Fix] Fix database updater and db tools to support multiple column changes/additions/removals with SQLite
    525. diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 17e2f7f115..f5be1f1e9c 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -569,6 +569,9 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false) * sorting in mcp * * @param string $where_sql should either be WHERE (default if ommited) or end with AND or OR +* +* $mode reports and reports_closed: the $where parameters uses aliases p for posts table and r for report table +* $mode unapproved_posts: the $where parameters uses aliases p for posts table and t for topic table */ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE') { @@ -616,12 +619,14 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, $type = 'posts'; $default_key = 't'; $default_dir = 'd'; - $where_sql .= ($topic_id) ? ' topic_id = ' . $topic_id . ' AND' : ''; + $where_sql .= ($topic_id) ? ' p.topic_id = ' . $topic_id . ' AND' : ''; - $sql = 'SELECT COUNT(post_id) AS total - FROM ' . POSTS_TABLE . " - $where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . ' - AND post_approved = 0'; + $sql = 'SELECT COUNT(p.post_id) AS total + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t + $where_sql " . $db->sql_in_set('p.forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . ' + AND p.post_approved = 0 + AND t.topic_id = p.topic_id + AND t.topic_first_post_id <> p.post_id'; if ($min_time) { From 18d6fe0e3a523415338dee8932b247d9299cf19d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 9 Jul 2009 08:08:08 +0000 Subject: [PATCH 210/607] Posting smilies in view more smilies now work again in IE (Bug #46025 - Patch by leviatan21) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9740 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/posting_smilies.html | 2 +- phpBB/styles/subsilver2/template/posting_smilies.html | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f56b7e28c8..58f67a87fa 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -150,6 +150,7 @@
    526. [Fix] Disable word-censor option in UCP lacks the config-setting (Bug #47575 - Patch by 00mohgta7)
    527. [Fix] Fix database updater and db tools to support multiple column changes/additions/removals with SQLite
    528. [Fix] Correctly detect GZIP status in debug mode. (Bug #24075 - Patch by rxu)
    529. +
    530. [Fix] Posting smilies in view more smilies now work again in IE (Bug #46025 - Patch by leviatan21)
    531. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    532. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    533. [Change] Template engine now permits to a limited extent variable includes.
    534. diff --git a/phpBB/styles/prosilver/template/posting_smilies.html b/phpBB/styles/prosilver/template/posting_smilies.html index dd0963baf5..1c44fd5f11 100644 --- a/phpBB/styles/prosilver/template/posting_smilies.html +++ b/phpBB/styles/prosilver/template/posting_smilies.html @@ -12,7 +12,7 @@
      - {smiley.SMILEY_CODE} + {smiley.SMILEY_CODE}
      diff --git a/phpBB/styles/subsilver2/template/posting_smilies.html b/phpBB/styles/subsilver2/template/posting_smilies.html index a6f35bf2b7..3c57cb132f 100644 --- a/phpBB/styles/subsilver2/template/posting_smilies.html +++ b/phpBB/styles/subsilver2/template/posting_smilies.html @@ -16,7 +16,7 @@ {L_SMILIES} - {smiley.SMILEY_CODE}
      {L_CLOSE_WINDOW} + {smiley.SMILEY_CODE}
      {L_CLOSE_WINDOW} From 8278eb29a22cde49098da250a2df3fa22b450fd5 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 9 Jul 2009 10:04:18 +0000 Subject: [PATCH 211/607] changelog git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9741 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 58f67a87fa..6be303d534 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -167,9 +167,10 @@
    535. [Change] Pm history only shows pms of the receipts you currently reply to (Bug #39505 - Patch by nickvergessen)
    536. [Change] Add quote-button for own pm's in pm-history (Bug #37285 - Patch by nickvergessen)
    537. [Change] Fetch requested cookie variables directly from cookie super global. (Bug #47785)
    538. -
    539. [Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
    540. +
    541. [Change] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
    542. +
    543. [Change] Add confirmation for deactivating language packs (Patch by leviatan21)
    544. +
    545. [Change] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)
    546. [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
    547. -
    548. [Feature] Add confirmation for deactivating language packs (Patch by leviatan21)
    549. [Feature] Backported 3.2 captcha plugins.
    550. [Feature] Introduced new ACM plugins:
        @@ -187,7 +188,6 @@
      • [Feature] Add new option to disable avatars board-wide (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)
      • [Feature] Enhance obtain_users_online_string to be able to return user-lists for other session-items (Bug #31975 - Patch by nickvergessen)
      • [Feature] Add unapproved topic icon for moderators on forum list (Bug #46865 - Patch by nickvergessen)
      • -
      • [Feature] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)
      • [Feature] Ability to define minimum number of characters for posts/pms
      • [Feature] Store signature configuration options in database (Bug #45115 - Patch by rxu)
      • [Feature] Add bare-bones quick-reply editor to viewtopic.
      • From 65ec5e1bb5aac292235f242fd0b1932a3ba69572 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 9 Jul 2009 10:34:40 +0000 Subject: [PATCH 212/607] Addition to r9731: Add seperate language entry for more flexibility in other languages. Authorised by: naderman git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9742 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/posting.php | 1 + phpBB/posting.php | 1 + 2 files changed, 2 insertions(+) diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index fae9f6124c..8016a233fd 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -167,6 +167,7 @@ $lang = array_merge($lang, array( 'POST_ICON' => 'Post icon', 'POST_NORMAL' => 'Normal', 'POST_REVIEW' => 'Post review', + 'POST_REVIEW_EDIT' => 'Post review', 'POST_REVIEW_EDIT_EXPLAIN' => 'This post has been altered by another user while you were editing it. You may wish to review the current version of this post and adjust your edits.', 'POST_REVIEW_EXPLAIN' => 'At least one new post has been made to this topic. You may wish to review your post in light of this.', 'POST_STORED' => 'This message has been posted successfully.', diff --git a/phpBB/posting.php b/phpBB/posting.php index de5cdb9c6a..53746437ba 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -727,6 +727,7 @@ if ($submit || $preview || $refresh) $template->assign_vars(array( 'S_POST_REVIEW' => true, + 'L_POST_REVIEW' => $user->lang['POST_REVIEW_EDIT'], 'L_POST_REVIEW_EXPLAIN' => $user->lang['POST_REVIEW_EDIT_EXPLAIN'], )); } From 26bb3bbb6824166d05362f5516009fdf3477195f Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 9 Jul 2009 13:28:25 +0000 Subject: [PATCH 213/607] print out error if users try to update phpBB versions no longer supported with the used database update script git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9743 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 53 ++++++++++++++++--------------- phpBB/language/en/install.php | 1 + 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index d7398ea953..249b0a8f69 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -11,7 +11,7 @@ $updates_to_version = '3.0.6-dev'; // Enter any version to update from to test updates. The version within the db will not be updated. -$debug_from_version = '3.0.5'; +$debug_from_version = false; // Which oldest version does this updater supports? $oldest_from_version = '3.0.0'; @@ -249,28 +249,25 @@ if ($db->sql_layer == 'mysql' || $db->sql_layer == 'mysql4' || $db->sql_layer == echo '

        ' . $lang['ERROR'] . '


        '; echo '

        ' . sprintf($lang['MYSQL_SCHEMA_UPDATE_REQUIRED'], $config['dbms_version'], $db->sql_server_info(true)) . '

        '; -?> -
    551. - - - - - - - - - - -

      ' . $lang['ERROR'] . '


      '; + echo '

      ' . sprintf($lang['DB_UPDATE_NOT_SUPPORTED'], $oldest_from_version, $current_version) . '

      '; + + _print_footer(); + exit_handler(); + exit; +} + // If the latest version and the current version are 'unequal', we will update the version_update_from, else we do not update anything. if ($inline_update) { @@ -455,8 +452,21 @@ add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $updates_to_version); // Now we purge the session table as well as all cache files $cache->purge(); -?> +_print_footer(); +garbage_collection(); + +if (function_exists('exit_handler')) +{ + exit_handler(); +} + +/** +* Print out footer +*/ +function _print_footer() +{ + echo << @@ -471,14 +481,7 @@ $cache->purge(); - - 'Database password', 'DB_PORT' => 'Database server port', 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', + 'DB_UPDATE_NOT_SUPPORTED' => 'Sorry, but you are not able to update your phpBB database with this script. This update script updates the phpBB database from at least version “%1$s”, but your version is “%2$s”. Please try to update to an older version of phpBB first or post within our support forums to get more help.', 'DB_USERNAME' => 'Database username', 'DB_TEST' => 'Test connection', 'DEFAULT_LANG' => 'Default board language', From 019c43fa18026b44fe337ace8ee847b532661acf Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 10 Jul 2009 14:28:49 +0000 Subject: [PATCH 214/607] move QR editor git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9746 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/viewtopic.php | 2 +- phpBB/styles/prosilver/template/quickreply_editor.html | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index 5c28b94d4e..272597c54d 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -92,7 +92,7 @@ $lang = array_merge($lang, array( 'REPLY_TO_TOPIC' => 'Reply to topic', 'RETURN_POST' => '%sReturn to the post%s', - 'SHOW_QR' => 'Show Editor', + 'SHOW_QR' => 'Quick Reply', 'SUBMIT_VOTE' => 'Submit vote', 'TOTAL_VOTES' => 'Total votes', diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index fbbcba9aba..f3927e0227 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -42,9 +42,8 @@
      -

      {L_QUICKREPLY}

      - +
      From dfdb78a027ac63ffc337c88453fca364c85f4190 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 10 Jul 2009 15:16:09 +0000 Subject: [PATCH 215/607] remove spaces git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9747 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/quickreply_editor.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index f3927e0227..a79cf4f9f8 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -23,11 +23,11 @@
      -
      +
      - +
      @@ -38,12 +38,12 @@ -
      {S_FORM_TOKEN} {S_HIDDEN_FIELDS} @@ -41,15 +38,9 @@
      - +
      - - - - - -
      \ No newline at end of file From 86096d012940358e0f4bdcf8d78d06018b99a713 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 13 Jul 2009 09:17:38 +0000 Subject: [PATCH 219/607] looks better that way git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9752 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/viewtopic_body.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index f8f54993f9..b330079a0b 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -222,7 +222,9 @@
      - + + +
      @@ -253,9 +255,7 @@ - - - + From ecfe24528c46b264baa164ba5811fcc5cfab231e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 13 Jul 2009 19:20:17 +0000 Subject: [PATCH 220/607] Fix bug #47265 - Smilies and images not viewed in topic-print view Fix - Force full date for PMs print-view Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9753 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 ++ phpBB/includes/ucp/ucp_pm_viewmessage.php | 3 ++- phpBB/styles/prosilver/theme/print.css | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8aed44a6d8..a1b649f2be 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -152,6 +152,8 @@
    552. [Fix] Correctly detect GZIP status in debug mode. (Bug #24075 - Patch by rxu)
    553. [Fix] Posting smilies in view more smilies now work again in IE (Bug #46025 - Patch by leviatan21)
    554. [Fix] Properly convert and show filesize information (Bug #47775 - Patch by bantu)
    555. +
    556. [Fix] Smilies and images not viewed in topic-print view (Bug #47265 - Patch by nickvergessen)
    557. +
    558. [Fix] Force full date for PMs print-view (Patch by nickvergessen)
    559. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    560. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    561. [Change] Template engine now permits to a limited extent variable includes.
    562. diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 185a7f523c..82aa5afd8f 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -29,6 +29,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $msg_id = (int) $msg_id; $folder_id = (int) $folder_id; $author_id = (int) $message_row['author_id']; + $view = request_var('view', ''); // Not able to view message, it was deleted by the sender if ($message_row['pm_deleted']) @@ -192,7 +193,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['POST_EDIT_PM']), 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), - 'SENT_DATE' => $user->format_date($message_row['message_time']), + 'SENT_DATE' => ($view == 'print') ? $user->format_date($message_row['message_time'], false, true) : $user->format_date($message_row['message_time']), 'SUBJECT' => $message_row['message_subject'], 'MESSAGE' => $message, 'SIGNATURE' => ($message_row['enable_sig']) ? $signature : '', diff --git a/phpBB/styles/prosilver/theme/print.css b/phpBB/styles/prosilver/theme/print.css index 09afaa9112..6dfb5c4726 100644 --- a/phpBB/styles/prosilver/theme/print.css +++ b/phpBB/styles/prosilver/theme/print.css @@ -25,6 +25,10 @@ a:visited { color: #000000; text-decoration: none; } a:active { color: #000000; text-decoration: none; } img, .noprint, #sub-header, #sub-footer, .navbar, .box1, .divider, .signature { display: none; } +/* Display smilies (Bug #47265) */ +.content img { + display: inline; +} /* Container for the main body */ #wrap { From 5cbf5d4b16a41ea2599cb7f56836d5b963ab4000 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Tue, 14 Jul 2009 12:02:11 +0000 Subject: [PATCH 221/607] Fix bug #44295 - Cannot prune users who never logged in Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9754 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_prune.php | 7 ++++++- phpBB/language/en/acp/prune.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a1b649f2be..8334214de2 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -152,6 +152,7 @@
    563. [Fix] Correctly detect GZIP status in debug mode. (Bug #24075 - Patch by rxu)
    564. [Fix] Posting smilies in view more smilies now work again in IE (Bug #46025 - Patch by leviatan21)
    565. [Fix] Properly convert and show filesize information (Bug #47775 - Patch by bantu)
    566. +
    567. [Fix] Add ability to prune users who never logged in. (Bug #44295 - Patch by rxu)
    568. [Fix] Smilies and images not viewed in topic-print view (Bug #47265 - Patch by nickvergessen)
    569. [Fix] Force full date for PMs print-view (Patch by nickvergessen)
    570. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    571. diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index a82a438db7..7eeb37133f 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -406,7 +406,12 @@ class acp_prune $where_sql .= (sizeof($joined)) ? " AND user_regdate " . $key_match[$joined_select] . ' ' . gmmktime(0, 0, 0, (int) $joined[1], (int) $joined[2], (int) $joined[0]) : ''; $where_sql .= ($count !== '') ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : ''; - if (sizeof($active) && $active_select != 'lt') + // First handle pruning of users who never logged in, last active date is 0000-00-00 + if (sizeof($active) && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0) + { + $where_sql .= ' AND user_lastvisit = 0'; + } + else if (sizeof($active) && $active_select != 'lt') { $where_sql .= ' AND user_lastvisit ' . $key_match[$active_select] . ' ' . gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]); } diff --git a/phpBB/language/en/acp/prune.php b/phpBB/language/en/acp/prune.php index 2f4a9b4984..5e313d20e2 100644 --- a/phpBB/language/en/acp/prune.php +++ b/phpBB/language/en/acp/prune.php @@ -47,7 +47,7 @@ $lang = array_merge($lang, array( 'JOINED_EXPLAIN' => 'Enter a date in YYYY-MM-DD format.', - 'LAST_ACTIVE_EXPLAIN' => 'Enter a date in YYYY-MM-DD format.', + 'LAST_ACTIVE_EXPLAIN' => 'Enter a date in YYYY-MM-DD format. Enter 0000-00-00 to prune users who never logged in, Before and After conditions will be ignored.', 'PRUNE_USERS_LIST' => 'Users to be pruned', 'PRUNE_USERS_LIST_DELETE' => 'With the selected critera for pruning users the following accounts will be removed.', From 51748b00ed8e6b709f1a7df59570e8ecee6783d5 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Tue, 14 Jul 2009 14:46:38 +0000 Subject: [PATCH 222/607] Fix bug #46765 - View unread posts Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9755 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 91 +++++++++++++++++++ phpBB/language/en/common.php | 1 + phpBB/search.php | 33 +++++++ .../styles/prosilver/template/index_body.html | 2 +- .../subsilver2/template/overall_header.html | 2 +- 6 files changed, 128 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8334214de2..30d624c08f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -196,6 +196,7 @@
    572. [Feature] Store signature configuration options in database (Bug #45115 - Patch by rxu)
    573. [Feature] Add bare-bones quick-reply editor to viewtopic.
    574. [Feature] Detect when a post has been altered by someone else while editing. (Patch by bantu)
    575. +
    576. [Feature] Add unread posts quick search option (Bug #46765 - Patch by rxu)
    577. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 84bbb964de..74f7e31bee 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3896,6 +3896,7 @@ function page_header($page_title = '', $display_online_list = true) 'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'), 'U_SEARCH_NEW' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'), 'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'), + 'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'), 'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'), 'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'), 'U_TEAM' => ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=leaders'), @@ -4119,4 +4120,94 @@ function phpbb_user_session_handler() return; } +/* +* Get list of unread topics +* only for registered users and non-cookie tracking this function is used +*/ +function get_unread_topics_list($user_id = false, $sql_extra = '') +{ + global $config, $db, $user; + + if($user_id === false) + { + $user_id = $user->data['user_id']; + } + + $tracked_topics_list = $unread_topics_list = $read_topics_list = array(); + $tracked_forums_list = array(); + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + // List of the tracked forums (not ideal, hope the better way will be found) + // This list is to fetch later the forums user never read (fully) before + $sql = 'SELECT forum_id FROM ' . FORUMS_TRACK_TABLE . " + WHERE user_id = {$user_id}"; + $result = $db->sql_query($sql); + while($row = $db->sql_fetchrow($result)) + { + $tracked_forums_list[] = $row['forum_id']; + } + $db->sql_freeresult($result); + + // Get list of the unread topics - on topics tracking as the first step + $sql = 'SELECT t.topic_id, t.topic_last_post_time, tt.mark_time FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TRACK_TABLE . " tt + WHERE t.topic_id = tt.topic_id + AND t.topic_last_post_time >= tt.mark_time + AND tt.user_id = {$user_id} + $sql_extra"; + $result = $db->sql_query($sql); + while($row = $db->sql_fetchrow($result)) + { + if($row['topic_last_post_time'] == $row['mark_time']) + { + // Check if there're read topics for the forums having unread ones + $read_topics_list[$row['topic_id']] = $row['mark_time']; + } + else + { + $unread_topics_list[$row['topic_id']] = $row['mark_time']; + } + } + $db->sql_freeresult($result); + + // Get the full list of the tracked topics + $tracked_topics_list = array_merge(array_keys($unread_topics_list), array_keys($read_topics_list)); + + // Get list of the unread topics - on forums tracking as the second step + // We don't take in account topics tracked before + $sql = 'SELECT t.topic_id, ft.mark_time FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TRACK_TABLE . ' ft + WHERE t.forum_id = ft.forum_id + AND t.topic_last_post_time > ft.mark_time + AND ' . $db->sql_in_set('t.topic_id', $tracked_topics_list, true, true) . " + AND ft.user_id = {$user_id} + $sql_extra"; + $result = $db->sql_query($sql); + while($row = $db->sql_fetchrow($result)) + { + $unread_topics_list[$row['topic_id']] = $row['mark_time']; + } + $db->sql_freeresult($result); + + // And the last step - find unread topics were not found before (that can mean a user has never read some forums) + $sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . " + WHERE topic_last_post_time > {$user->data['user_lastmark']} + AND " . $db->sql_in_set('topic_id', array_keys($unread_topics_list), true, true) . ' + AND ' . $db->sql_in_set('forum_id', $tracked_forums_list, true, true) . " + $sql_extra"; + $result = $db->sql_query_limit($sql, 1000); + while($row = $db->sql_fetchrow($result)) + { + $unread_topics_list[$row['topic_id']] = $user->data['user_lastmark']; + } + $db->sql_freeresult($result); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + // We do not implement unread topics list for cookie based tracking + // because it would require expensive database queries + } + + return $unread_topics_list; +} + ?> \ No newline at end of file diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 6f3433892a..a2b8eafd52 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -522,6 +522,7 @@ $lang = array_merge($lang, array( 'SEARCH_SELF' => 'View your posts', 'SEARCH_TOPIC' => 'Search this topic…', 'SEARCH_UNANSWERED' => 'View unanswered posts', + 'SEARCH_UNREAD' => 'View unread posts', 'SECONDS' => 'Seconds', 'SELECT' => 'Select', 'SELECT_ALL_CODE' => 'Select all', diff --git a/phpBB/search.php b/phpBB/search.php index 48c0290d87..61aa16a6fb 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -364,6 +364,39 @@ if ($keywords || $author || $author_id || $search_id || $submit) } break; + case 'unreadposts': + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $l_search_title = $user->lang['SEARCH_UNREAD']; + // force sorting + $show_results = 'topics'; + $sort_key = 't'; + $sort_dir = 'd'; + $sort_by_sql['t'] = 't.topic_last_post_time'; + $sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; + + $unread_list = array(); + $unread_list = get_unread_topics_list(); + + if(!empty($unread_list)) + { + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE ' . $db->sql_in_set('t.topic_id', array_keys($unread_list)) . ' + AND t.topic_moved_id = 0 + ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . ' + ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; + $field = 'topic_id'; + } + break; + } + // Do nothing if it's cookie based read tracking + // Just do not break and let user to see newposts + case 'newposts': $l_search_title = $user->lang['SEARCH_NEW']; // force sorting diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index 43d8ad0309..9cb4d2067d 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -6,7 +6,7 @@ diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index 3dd8740832..a45e51b467 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -201,7 +201,7 @@ function marklist(id, name, state) From 753b8bb0bb6f6c8398189be451cc5095759c1e3e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 14 Jul 2009 20:21:51 +0000 Subject: [PATCH 223/607] Fix bug #47865 - Fix "Always show a scrollbar for short pages" for IE8 and Firefox 3.5 - Patch by stokerpiller Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9756 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/theme/common.css | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 30d624c08f..cc43d4b9cb 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -155,6 +155,7 @@
    578. [Fix] Add ability to prune users who never logged in. (Bug #44295 - Patch by rxu)
    579. [Fix] Smilies and images not viewed in topic-print view (Bug #47265 - Patch by nickvergessen)
    580. [Fix] Force full date for PMs print-view (Patch by nickvergessen)
    581. +
    582. [Fix] Fix "Always show a scrollbar for short pages" for IE8 and Firefox 3.5 (Bug #47865 - Patch by stokerpiller)
    583. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    584. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    585. [Change] Template engine now permits to a limited extent variable includes.
    586. diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 956c1b278f..a86f723f81 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -10,8 +10,7 @@ html { font-size: 100%; /* Always show a scrollbar for short pages - stops the jump when the scrollbar appears. non-IE browsers */ - height: 100%; - margin-bottom: 1px; + height: 101%; } body { From 0b2979c6bab97297f839937606635fd4cc6b1eae Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 14 Jul 2009 20:25:41 +0000 Subject: [PATCH 224/607] Feature Bug #45375 - Add option to disable remote upload avatars Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9757 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_users_avatar.html | 4 +++- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_board.php | 1 + phpBB/includes/acp/acp_users.php | 9 +++++---- phpBB/includes/ucp/ucp_groups.php | 14 +++++++++----- phpBB/includes/ucp/ucp_profile.php | 10 +++++----- phpBB/install/database_update.php | 12 ++++++++++++ phpBB/install/schemas/schema_data.sql | 1 + phpBB/language/en/acp/board.php | 2 ++ .../prosilver/template/ucp_avatar_options.html | 12 ++++++------ .../subsilver2/template/ucp_groups_manage.html | 6 +++++- 11 files changed, 50 insertions(+), 22 deletions(-) diff --git a/phpBB/adm/style/acp_users_avatar.html b/phpBB/adm/style/acp_users_avatar.html index 20b5b60050..deed41e16e 100644 --- a/phpBB/adm/style/acp_users_avatar.html +++ b/phpBB/adm/style/acp_users_avatar.html @@ -8,11 +8,13 @@
      - +
      + +

      {L_UPLOAD_AVATAR_URL_EXPLAIN}
      diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index cc43d4b9cb..7fdbc5ac00 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -198,6 +198,7 @@
    587. [Feature] Add bare-bones quick-reply editor to viewtopic.
    588. [Feature] Detect when a post has been altered by someone else while editing. (Patch by bantu)
    589. [Feature] Add unread posts quick search option (Bug #46765 - Patch by rxu)
    590. +
    591. [Feature] Add option to disable remote upload avatars (Bug #45375 - Patch by nickvergessen)
    592. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 008594a319..a4a2572c0f 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -117,6 +117,7 @@ class acp_board 'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_avatar_remote_upload'=> array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c663103e17..1cd7a405d5 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1484,10 +1484,11 @@ class acp_users $template->assign_vars(array( 'S_AVATAR' => true, - 'S_CAN_UPLOAD' => ($can_upload && $config['allow_avatar_upload']) ? true : false, - 'S_ALLOW_REMOTE' => ($config['allow_avatar_remote']) ? true : false, - 'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false, - 'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false, + 'S_UPLOAD_FILE' => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_upload']) ? true : false, + 'S_REMOTE_UPLOAD' => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_remote_upload']) ? true : false, + 'S_ALLOW_REMOTE' => ($config['allow_avatar'] && $config['allow_avatar_remote']) ? true : false, + 'S_DISPLAY_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && !$display_gallery) ? true : false, + 'S_IN_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && $display_gallery) ? true : false, 'AVATAR_IMAGE' => $avatar_img, 'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'], diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 3f27f093ec..8aba34c733 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -688,24 +688,28 @@ class ucp_groups $display_gallery = (isset($_POST['display_gallery'])) ? true : false; - if ($config['allow_avatar_local'] && $display_gallery) + if ($config['allow_avatar'] && $config['allow_avatar_local'] && $display_gallery) { avatar_gallery($category, $avatar_select, 4); } - $avatars_enabled = ($can_upload || ($config['allow_avatar_local'] || $config['allow_avatar_remote'])) ? true : false; + $avatars_enabled = ($config['allow_avatar'] && (($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) || ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false; $template->assign_vars(array( 'S_EDIT' => true, 'S_INCLUDE_SWATCH' => true, - 'S_CAN_UPLOAD' => $can_upload, - 'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '', + 'S_FORM_ENCTYPE' => ($config['allow_avatar'] && $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) ? ' enctype="multipart/form-data"' : '', 'S_ERROR' => (sizeof($error)) ? true : false, 'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false, 'S_AVATARS_ENABLED' => $avatars_enabled, - 'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false, + 'S_DISPLAY_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && !$display_gallery) ? true : false, 'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false, + 'S_UPLOAD_AVATAR_FILE' => ($config['allow_avatar'] && $config['allow_avatar_upload'] && $can_upload) ? true : false, + 'S_UPLOAD_AVATAR_URL' => ($config['allow_avatar'] && $config['allow_avatar_remote_upload'] && $can_upload) ? true : false, + 'S_LINK_AVATAR' => ($config['allow_avatar'] && $config['allow_avatar_remote']) ? true : false, + 'S_DISPLAY_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local']) ? true : false, + 'ERROR_MSG' => (sizeof($error)) ? implode('
      ', $error) : '', 'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '', 'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0, diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index d93567c543..a7785e7163 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -564,7 +564,7 @@ class ucp_profile $avatar_select = basename(request_var('avatar_select', '')); $category = basename(request_var('category', '')); - $can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; + $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; add_form_key('ucp_avatar'); @@ -605,7 +605,7 @@ class ucp_profile 'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&mode=avatar&display_gallery=1'), - 'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '', + 'S_FORM_ENCTYPE' => ($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) ? ' enctype="multipart/form-data"' : '', 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), )); @@ -616,15 +616,15 @@ class ucp_profile } else if ($config['allow_avatar']) { - $avatars_enabled = ($can_upload || ($auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false; + $avatars_enabled = (($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) || ($auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false; $template->assign_vars(array( 'AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']), 'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']), 'S_AVATARS_ENABLED' => $avatars_enabled, - 'S_UPLOAD_AVATAR_FILE' => $can_upload, - 'S_UPLOAD_AVATAR_URL' => $can_upload, + 'S_UPLOAD_AVATAR_FILE' => ($can_upload && $config['allow_avatar_upload']) ? true : false, + 'S_UPLOAD_AVATAR_URL' => ($can_upload && $config['allow_avatar_remote_upload']) ? true : false, 'S_LINK_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) ? true : false, 'S_DISPLAY_GALLERY' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) ? true : false) ); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 249b0a8f69..31d7976033 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1276,6 +1276,18 @@ function change_database_data(&$no_updates, $version) } } + if (!isset($config['allow_avatar_remote_upload'])) + { + if ($config['allow_avatar_remote'] && $config['allow_avatar_upload']) + { + set_config('allow_avatar_remote_upload', '1'); + } + else + { + set_config('allow_avatar_remote_upload', '0'); + } + } + // Minimum number of characters if (!isset($config['min_post_chars'])) { diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 86432a3084..0c5b527c9d 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -12,6 +12,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar', '0' INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote_upload', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_birthdays', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bookmarks', '1'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 0ac7d1fb6b..f09548661f 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -94,6 +94,8 @@ $lang = array_merge($lang, array( 'ALLOW_LOCAL' => 'Enable gallery avatars', 'ALLOW_REMOTE' => 'Enable remote avatars', 'ALLOW_REMOTE_EXPLAIN' => 'Avatars linked to from another website.', + 'ALLOW_REMOTE_UPLOAD' => 'Enable remote avatar uploading', + 'ALLOW_REMOTE_UPLOAD_EXPLAIN' => 'Allow uploading of avatars from another website.', 'ALLOW_UPLOAD' => 'Enable avatar uploading', 'AVATAR_GALLERY_PATH' => 'Avatar gallery path', 'AVATAR_GALLERY_PATH_EXPLAIN' => 'Path under your phpBB root directory for pre-loaded images, e.g. images/avatars/gallery.', diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options.html b/phpBB/styles/prosilver/template/ucp_avatar_options.html index d43e76e584..57aa82ca7b 100644 --- a/phpBB/styles/prosilver/template/ucp_avatar_options.html +++ b/phpBB/styles/prosilver/template/ucp_avatar_options.html @@ -13,21 +13,21 @@
      - +
      - +

      {L_UPLOAD_AVATAR_URL_EXPLAIN}
      - +

      {L_LINK_REMOTE_AVATAR_EXPLAIN}
      @@ -41,7 +41,7 @@
      - + @@ -50,7 +50,7 @@

      {L_AVATAR_GALLERY}

      - +
      @@ -63,7 +63,7 @@
      - + diff --git a/phpBB/styles/subsilver2/template/ucp_groups_manage.html b/phpBB/styles/subsilver2/template/ucp_groups_manage.html index 4aa2748f71..51e60c8b69 100644 --- a/phpBB/styles/subsilver2/template/ucp_groups_manage.html +++ b/phpBB/styles/subsilver2/template/ucp_groups_manage.html @@ -63,16 +63,19 @@ {AVATAR_IMAGE}

       {L_DELETE_AVATAR} - + + +
      {L_UPLOAD_AVATAR_URL_EXPLAIN} +
      {L_LINK_REMOTE_AVATAR_EXPLAIN} @@ -81,6 +84,7 @@
      {L_LINK_REMOTE_SIZE_EXPLAIN} px X px + From e3866c939d78b925844cd61d6ad567988f24e42d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 14 Jul 2009 20:35:53 +0000 Subject: [PATCH 225/607] Feature Bug #43375 - Ability to delete warnings and keep warnings permanently Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9758 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_users.html | 4 + phpBB/adm/style/acp_users_warnings.html | 39 +++++++ phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_users.php | 142 ++++++++++++++++++++++++ phpBB/includes/acp/info/acp_users.php | 1 + phpBB/includes/functions.php | 2 +- phpBB/install/database_update.php | 43 +++++++ phpBB/language/en/acp/common.php | 2 + phpBB/language/en/acp/users.php | 2 + 9 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 phpBB/adm/style/acp_users_warnings.html diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html index 34e4147356..da7d2a495b 100644 --- a/phpBB/adm/style/acp_users.html +++ b/phpBB/adm/style/acp_users.html @@ -83,6 +83,10 @@ + + + + diff --git a/phpBB/adm/style/acp_users_warnings.html b/phpBB/adm/style/acp_users_warnings.html new file mode 100644 index 0000000000..be9ef06825 --- /dev/null +++ b/phpBB/adm/style/acp_users_warnings.html @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + +
      {L_REPORT_BY}{L_TIME}{L_FEEDBACK}{L_MARK}
      {warn.USERNAME}{warn.DATE}{warn.ACTION}
      + +
      +

      {L_NO_WARNINGS}

      +
      + + + +
      +   + +

      {L_MARK_ALL}{L_UNMARK_ALL}

      +
      + + {S_FORM_TOKEN} + diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7fdbc5ac00..5f79341a14 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -199,6 +199,7 @@
    593. [Feature] Detect when a post has been altered by someone else while editing. (Patch by bantu)
    594. [Feature] Add unread posts quick search option (Bug #46765 - Patch by rxu)
    595. [Feature] Add option to disable remote upload avatars (Bug #45375 - Patch by nickvergessen)
    596. +
    597. [Feature] Ability to delete warnings and keep warnings permanently (Bug #43375 - Patch by nickvergessen)
    598. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 1cd7a405d5..d8fef3f547 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1065,6 +1065,148 @@ class acp_users break; + case 'warnings': + $user->add_lang('mcp'); + + // Set up general vars + $start = request_var('start', 0); + $deletemark = (isset($_POST['delmarked'])) ? true : false; + $deleteall = (isset($_POST['delall'])) ? true : false; + $confirm = (isset($_POST['confirm'])) ? true : false; + $marked = request_var('mark', array(0)); + $message = utf8_normalize_nfc(request_var('message', '', true)); + + // Sort keys + $sort_days = request_var('st', 0); + $sort_key = request_var('sk', 't'); + $sort_dir = request_var('sd', 'd'); + + // Delete entries if requested and able + if ($deletemark || $deleteall || $confirm) + { + if (confirm_box(true)) + { + $where_sql = ''; + $deletemark = request_var('delmarked', 0); + $deleteall = request_var('delall', 0); + if ($deletemark && $marked) + { + $sql_in = array(); + foreach ($marked as $mark) + { + $sql_in[] = $mark; + } + $where_sql = ' AND ' . $db->sql_in_set('warning_id', $sql_in); + unset($sql_in); + } + + if ($where_sql || $deleteall) + { + $sql = 'DELETE FROM ' . WARNINGS_TABLE . " + WHERE user_id = $user_id + $where_sql"; + $db->sql_query($sql); + + if ($deleteall) + { + $deleted_warnings = '0'; + } + else + { + $deleted_warnings = ' user_warnings - ' . $db->sql_affectedrows(); + } + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_warnings = $deleted_warnings + WHERE user_id = $user_id"; + $db->sql_query($sql); + + add_log('admin', 'LOG_WARNING_DELETED', $user_row['username']); + } + } + else + { + $s_hidden_fields = array( + 'i' => $id, + 'mode' => $mode, + 'u' => $user_id, + 'mark' => $marked, + ); + if (isset($_POST['delmarked'])) + { + $s_hidden_fields['delmarked'] = 1; + } + if (isset($_POST['delall'])) + { + $s_hidden_fields['delall'] = 1; + } + if (isset($_POST['delall']) || (isset($_POST['delmarked']) && sizeof($marked))) + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); + } + } + } + + $sql = 'SELECT w.warning_id, w.warning_time, w.post_id, l.log_operation, l.log_data, l.user_id AS mod_user_id, m.username AS mod_username, m.user_colour AS mod_user_colour + FROM ' . WARNINGS_TABLE . ' w + LEFT JOIN ' . LOG_TABLE . ' l + ON (w.log_id = l.log_id) + LEFT JOIN ' . USERS_TABLE . ' m + ON (l.user_id = m.user_id) + WHERE w.user_id = ' . $user_id . ' + ORDER BY w.warning_time DESC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!$row['log_operation']) + { + // We do not have a log-entry anymore, so there is no data available + $row['action'] = $user->lang['USER_WARNING_LOG_DELETED']; + } + else + { + $row['action'] = (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}'; + if (!empty($row['log_data'])) + { + $log_data_ary = @unserialize($row['log_data']); + $log_data_ary = ($log_data_ary === false) ? array() : $log_data_ary; + + if (isset($user->lang[$row['log_operation']])) + { + // Check if there are more occurrences of % than arguments, if there are we fill out the arguments array + // It doesn't matter if we add more arguments than placeholders + if ((substr_count($row['action'], '%') - sizeof($log_data_ary)) > 0) + { + $log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($row['action'], '%') - sizeof($log_data_ary), '')); + } + $row['action'] = vsprintf($row['action'], $log_data_ary); + $row['action'] = bbcode_nl2br(censor_text($row['action'])); + } + else if (!empty($log_data_ary)) + { + $row['action'] .= '
      ' . implode('', $log_data_ary); + } + } + } + + + $template->assign_block_vars('warn', array( + 'ID' => $row['warning_id'], + 'USERNAME' => ($row['log_operation']) ? get_username_string('full', $row['mod_user_id'], $row['mod_username'], $row['mod_user_colour']) : '-', + 'ACTION' => make_clickable($row['action']), + 'DATE' => $user->format_date($row['warning_time']), + )); + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_WARNINGS' => true, + 'S_CLEARLOGS' => $auth->acl_get('a_clearlogs'), + )); + + break; + case 'profile': include($phpbb_root_path . 'includes/functions_user.' . $phpEx); diff --git a/phpBB/includes/acp/info/acp_users.php b/phpBB/includes/acp/info/acp_users.php index 0cd5f7ae97..10081ac870 100644 --- a/phpBB/includes/acp/info/acp_users.php +++ b/phpBB/includes/acp/info/acp_users.php @@ -22,6 +22,7 @@ class acp_users_info 'modes' => array( 'overview' => array('title' => 'ACP_MANAGE_USERS', 'auth' => 'acl_a_user', 'cat' => array('ACP_CAT_USERS')), 'feedback' => array('title' => 'ACP_USER_FEEDBACK', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')), + 'warnings' => array('title' => 'ACP_USER_WARNINGS', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')), 'profile' => array('title' => 'ACP_USER_PROFILE', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')), 'prefs' => array('title' => 'ACP_USER_PREFS', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')), 'avatar' => array('title' => 'ACP_USER_AVATAR', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')), diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 74f7e31bee..eaaa8aaf6a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4025,7 +4025,7 @@ function page_footer($run_cron = true) // Tidy the cache $cron_type = 'tidy_cache'; } - else if (time() - $config['warnings_gc'] > $config['warnings_last_gc']) + else if ($config['warnings_last_gc'] && (time() - $config['warnings_gc'] > $config['warnings_last_gc'])) { $cron_type = 'tidy_warnings'; } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 31d7976033..e13bc1d546 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1122,6 +1122,49 @@ function change_database_data(&$no_updates, $version) } } + // Also install the "User Warning" module + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'acp' + AND module_langname = 'ACP_USER_MANAGEMENT' + AND module_mode = '' + AND module_basename = ''"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $category_id = (int) $row['module_id']; + + // Check if we actually need to add the module or if it is already added. ;) + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_class = 'acp' + AND module_langname = 'ACP_USER_WARNINGS' + AND module_mode = 'warnings' + AND module_auth = 'acl_a_user' + AND parent_id = {$category_id}"; + $result2 = $db->sql_query($sql); + $row2 = $db->sql_fetchrow($result2); + $db->sql_freeresult($result2); + + if (!$row2) + { + $module_data = array( + 'module_basename' => 'users', + 'module_enabled' => 1, + 'module_display' => 0, + 'parent_id' => $category_id, + 'module_class' => 'acp', + 'module_langname' => 'ACP_USER_WARNINGS', + 'module_mode' => 'warnings', + 'module_auth' => 'acl_a_user', + ); + + $_module->update_module_data($module_data, true); + } + } + $db->sql_freeresult($result); + $_module->remove_cache_file(); // Add newly_registered group... but check if it already exists (we always supported running the updater on any schema) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 720aba6002..9f69fe3790 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -186,6 +186,7 @@ $lang = array_merge($lang, array( 'ACP_USER_ROLES' => 'User roles', 'ACP_USER_SECURITY' => 'User security', 'ACP_USER_SIG' => 'Signature', + 'ACP_USER_WARNINGS' => 'Warnings', 'ACP_VC_SETTINGS' => 'Visual confirmation settings', 'ACP_VC_CAPTCHA_DISPLAY' => 'CAPTCHA image preview', @@ -697,6 +698,7 @@ $lang = array_merge($lang, array( 'LOG_USER_REACTIVATE_USER' => 'Forced user account reactivation', 'LOG_USER_UNLOCK' => 'User unlocked own topic
      » %s', 'LOG_USER_WARNING' => 'Added user warning
      » %s', + 'LOG_WARNING_DELETED' => 'Deleted user warning
      » %s', 'LOG_USER_WARNING_BODY' => 'The following warning was issued to this user
      » %s', 'LOG_USER_GROUP_CHANGE' => 'User changed default group
      » %s', diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index d2e09f43e7..a2d1b3911c 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -77,6 +77,7 @@ $lang = array_merge($lang, array( 'MOVE_POSTS_EXPLAIN' => 'Please select the forum to which you wish to move all the posts this user has made.', 'NO_SPECIAL_RANK' => 'No special rank assigned', + 'NO_WARNINGS' => 'No warnings.', 'NOT_MANAGE_FOUNDER' => 'You tried to manage a user with founder status. Only founders are allowed to manage other founders.', 'QUICK_TOOLS' => 'Quick tools', @@ -130,6 +131,7 @@ $lang = array_merge($lang, array( 'USER_RANK' => 'User rank', 'USER_RANK_UPDATED' => 'User rank updated.', 'USER_SIG_UPDATED' => 'User signature successfully updated.', + 'USER_WARNING_LOG_DELETED' => 'No information available. Possibly the log entry has been deleted.', 'USER_TOOLS' => 'Basic tools', )); From 33033ad12555377a9b50cfbeb72b683ddd56b893 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 14 Jul 2009 20:40:45 +0000 Subject: [PATCH 226/607] Fix Bug #45675 - Do not allow setting group as default group for pending user Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9759 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_users.html | 4 ++-- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_users.php | 25 +++++++++++++++++++++++++ phpBB/includes/functions_user.php | 26 +++++++++++++++++++++++++- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html index da7d2a495b..e266654649 100644 --- a/phpBB/adm/style/acp_users.html +++ b/phpBB/adm/style/acp_users.html @@ -135,8 +135,8 @@ {group.GROUP_NAME} - {L_GROUP_DEFAULT}{L_GROUP_DEFAULT} - {group.L_DEMOTE_PROMOTE}  + {L_GROUP_DEFAULT}{L_GROUP_DEFAULT}{L_GROUP_APPROVE}  + {group.L_DEMOTE_PROMOTE}  {L_GROUP_DELETE} diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 5f79341a14..7676d73607 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -156,6 +156,7 @@
    599. [Fix] Smilies and images not viewed in topic-print view (Bug #47265 - Patch by nickvergessen)
    600. [Fix] Force full date for PMs print-view (Patch by nickvergessen)
    601. [Fix] Fix "Always show a scrollbar for short pages" for IE8 and Firefox 3.5 (Bug #47865 - Patch by stokerpiller)
    602. +
    603. [Fix] Do not allow setting group as default group for pending user (Bug #45675 - Patch by nickvergessen)
    604. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    605. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    606. [Change] Template engine now permits to a limited extent variable includes.
    607. diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index d8fef3f547..c27c259b46 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2017,6 +2017,29 @@ class acp_users } break; + + case 'approve': + + if (confirm_box(true)) + { + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + group_user_attributes($action, $group_id, $user_id); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'g' => $group_id)) + ); + } + + break; } // Add user to group? @@ -2109,10 +2132,12 @@ class acp_users 'U_DEFAULT' => $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'], 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'], 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], + 'U_APPROVE' => ($group_type == 'pending') ? $this->u_action . "&action=approve&u=$user_id&g=" . $data['group_id'] : '', 'GROUP_NAME' => ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name'], 'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'], + 'S_IS_MEMBER' => ($group_type != 'pending') ? true : false, 'S_NO_DEFAULT' => ($user_row['group_id'] != $data['group_id']) ? true : false, 'S_SPECIAL_GROUP' => ($group_type == 'special') ? true : false, ) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 4ea094e451..c69c27c9d7 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -3109,6 +3109,27 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna break; case 'default': + // We only set default group for approved members of the group + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + AND user_pending = 0 + AND " . $db->sql_in_set('user_id', $user_id_ary); + $result = $db->sql_query($sql); + + $user_id_ary = $username_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_id_ary[] = $row['user_id']; + } + $db->sql_freeresult($result); + + $result = user_get_id_name($user_id_ary, $username_ary); + if (!sizeof($user_id_ary) || $result !== false) + { + return 'NO_USERS'; + } + $sql = 'SELECT user_id, group_id FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $user_id_ary, false, true); $result = $db->sql_query($sql); @@ -3197,7 +3218,7 @@ function group_validate_groupname($group_id, $group_name) */ function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false) { - global $db; + global $cache, $db; if (empty($user_id_ary)) { @@ -3297,6 +3318,9 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal { group_update_listings($group_id); } + + // Because some tables/caches use usercolour-specific data we need to purge this here. + $cache->destroy('sql', MODERATOR_CACHE_TABLE); } /** From 75d75627fe6e37e3e5127c99535ec1b058222f58 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 15 Jul 2009 09:43:20 +0000 Subject: [PATCH 227/607] fix r9615 Authorised by: naderman git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9760 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/posting_editor.html | 2 +- phpBB/styles/subsilver2/template/posting_body.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index adde3411e6..dea3277ba2 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -124,8 +124,8 @@ {IMG_STATUS}
      {FLASH_STATUS}
      {URL_STATUS}
      - {SMILIES_STATUS} + {SMILIES_STATUS}
      diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html index 356972f707..f8996b1517 100644 --- a/phpBB/styles/subsilver2/template/posting_body.html +++ b/phpBB/styles/subsilver2/template/posting_body.html @@ -249,10 +249,10 @@ {URL_STATUS} + {SMILIES_STATUS} - From 69fb835a29363b38d89b419c5b8cd9a5cb9941d9 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 15 Jul 2009 22:28:26 +0000 Subject: [PATCH 228/607] fixing hidden fields, pointed out by leviathan21 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9761 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/quickreply_editor.html | 2 +- phpBB/styles/subsilver2/template/quickreply_editor.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index a73c3c0439..22d90cdd90 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -27,7 +27,7 @@
      {S_FORM_TOKEN} - {S_HIDDEN_FIELDS} + {QR_HIDDEN_FIELDS}  
      diff --git a/phpBB/styles/subsilver2/template/quickreply_editor.html b/phpBB/styles/subsilver2/template/quickreply_editor.html index 843812bb20..6fdb40c7aa 100644 --- a/phpBB/styles/subsilver2/template/quickreply_editor.html +++ b/phpBB/styles/subsilver2/template/quickreply_editor.html @@ -15,7 +15,7 @@ {S_FORM_TOKEN} - {S_HIDDEN_FIELDS} + {QR_HIDDEN_FIELDS} From 7a5db8b55d163ae4b0b0bd433362dbbe8cbbfdf4 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 16 Jul 2009 10:17:20 +0000 Subject: [PATCH 229/607] assign vars git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9762 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index bd8fbce0fa..41ce242e91 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -133,6 +133,8 @@ class phpbb_recaptcha extends phpbb_default_captcha 'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '', 'RECAPTCHA_ERRORGET' => '', 'S_RECAPTCHA_AVAILABLE' => $this->is_available(), + 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, )); return 'captcha_recaptcha.html'; From a7776919945450eb2c0a37af30b35695f93fae51 Mon Sep 17 00:00:00 2001 From: "Marek A. R" Date: Thu, 16 Jul 2009 17:57:05 +0000 Subject: [PATCH 230/607] - Add pagination for icons and smilies in the ACP and smilies in the smiley popup git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9763 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_icons.html | 6 ++-- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_board.php | 1 + phpBB/includes/acp/acp_icons.php | 20 ++++++++--- phpBB/includes/functions_posting.php | 36 +++++++++++++++---- phpBB/install/schemas/schema_data.sql | 1 + phpBB/language/en/acp/board.php | 1 + .../prosilver/template/posting_smilies.html | 1 + .../subsilver2/template/posting_smilies.html | 3 +- 9 files changed, 54 insertions(+), 16 deletions(-) diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index 86500ae047..10166fec35 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -243,8 +243,8 @@ {items.EMOTION} - {ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}  - {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN} + {ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}  + {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN}  {ICON_EDIT} {ICON_DELETE} @@ -255,7 +255,7 @@ - +
      {PAGINATION}

         

      diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7676d73607..6ee8b91959 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -176,6 +176,7 @@
    608. [Change] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
    609. [Change] Add confirmation for deactivating language packs (Patch by leviatan21)
    610. [Change] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)
    611. +
    612. [Change] Add pagination for icons and smilies in the ACP and smilies in the smiley popup
    613. [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
    614. [Feature] Backported 3.2 captcha plugins.
    615. [Feature] Introduced new ACM plugins: diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index a4a2572c0f..5966d5a4b2 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -181,6 +181,7 @@ class acp_board 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), + 'smilies_per_page' => array('lang' => 'SMILIES_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0', 'type' => 'text:3:4', 'explain' => true), 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'text:4:4', 'explain' => false), 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true), diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index a88090cb25..cd26d46044 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -173,7 +173,7 @@ class acp_icons FROM $table ORDER BY {$fields}_order " . (($icon_id || $action == 'add') ? 'DESC' : 'ASC'); $result = $db->sql_query($sql); - + $data = array(); $after = false; $display = 0; @@ -835,12 +835,20 @@ class acp_icons ); $spacer = false; + + $sql = "SELECT COUNT(*) AS count + FROM $table"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $item_count = $row['count']; $sql = "SELECT * FROM $table ORDER BY {$fields}_order ASC"; - $result = $db->sql_query($sql); + $result = $db->sql_query_limit($sql, $config['smilies_per_page'], request_var('start', 0)); + $pagination_start = request_var('start', 0); while ($row = $db->sql_fetchrow($result)) { $alt_text = ($mode == 'smilies') ? $row['code'] : ''; @@ -855,9 +863,9 @@ class acp_icons 'EMOTION' => (isset($row['emotion'])) ? $row['emotion'] : '', 'U_EDIT' => $this->u_action . '&action=edit&id=' . $row[$fields . '_id'], 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row[$fields . '_id'], - 'U_MOVE_UP' => $this->u_action . '&action=move_up&id=' . $row[$fields . '_id'], - 'U_MOVE_DOWN' => $this->u_action . '&action=move_down&id=' . $row[$fields . '_id']) - ); + 'U_MOVE_UP' => $this->u_action . '&action=move_up&id=' . $row[$fields . '_id'] . '&start=' . $pagination_start, + 'U_MOVE_DOWN' => $this->u_action . '&action=move_down&id=' . $row[$fields . '_id'] . '&start=' . $pagination_start, + )); if (!$spacer && !$row['display_on_posting']) { @@ -865,6 +873,8 @@ class acp_icons } } $db->sql_freeresult($result); + $template->assign_var('PAGINATION', generate_pagination( + $this->u_action, $item_count, $config['smilies_per_page'], $pagination_start, true)); } } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 22fbfe3495..0c5aeb98d6 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -43,10 +43,25 @@ function generate_smilies($mode, $forum_id) } page_header($user->lang['SMILIES']); + + $sql = 'SELECT COUNT(smiley_id) AS count + FROM ' . SMILIES_TABLE . ' + GROUP BY smiley_url'; + $result = $db->sql_query($sql, 3600); + + $smiley_count = 0; + while ($row = $db->sql_fetchrow($result)) + { + ++$smiley_count; + } + $db->sql_freeresult($result); $template->set_filenames(array( 'body' => 'posting_smilies.html') ); + $template->assign_var('PAGINATION', + generate_pagination(append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=smilies&f=' . $forum_id), + $smiley_count, $config['smilies_per_page'], request_var('start', 0), true)); } $display_link = false; @@ -64,13 +79,22 @@ function generate_smilies($mode, $forum_id) $db->sql_freeresult($result); } - $last_url = ''; + if ($mode == 'window') + { + $sql = 'SELECT smiley_url, MIN(emotion) as emotion, MIN(code) AS code, smiley_width, smiley_height + FROM ' . SMILIES_TABLE . ' + GROUP BY smiley_url, smiley_width, smiley_height ORDER BY smiley_order'; + $result = $db->sql_query_limit($sql, $config['smilies_per_page'], request_var('start', 0), 3600); + } + else + { + $sql = 'SELECT * + FROM ' . SMILIES_TABLE . ' + WHERE display_on_posting = 1 + ORDER BY smiley_order'; - $sql = 'SELECT * - FROM ' . SMILIES_TABLE . - (($mode == 'inline') ? ' WHERE display_on_posting = 1 ' : '') . ' - ORDER BY smiley_order'; - $result = $db->sql_query($sql, 3600); + $result = $db->sql_query($sql, 3600); + } $smilies = array(); while ($row = $db->sql_fetchrow($result)) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 0c5b527c9d..5799abcff7 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -228,6 +228,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_length', ' INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_desc', '{L_CONFIG_SITE_DESC}'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('sitename', '{L_CONFIG_SITENAME}'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_path', 'images/smilies'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_per_page', '50'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_auth_method', 'PLAIN'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host', ''); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index f09548661f..b51db0ba57 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -175,6 +175,7 @@ $lang = array_merge($lang, array( 'QUOTE_DEPTH_LIMIT_EXPLAIN' => 'Maximum number of nested quotes in a post. Set to 0 for unlimited depth.', 'SMILIES_LIMIT' => 'Maximum smilies per post', 'SMILIES_LIMIT_EXPLAIN' => 'Maximum number of smilies in a post. Set to 0 for unlimited smilies.', + 'SMILIES_PER_PAGE' => 'Smilies per page', 'TOPICS_PER_PAGE' => 'Topics per page', )); diff --git a/phpBB/styles/prosilver/template/posting_smilies.html b/phpBB/styles/prosilver/template/posting_smilies.html index 1c44fd5f11..fdd0d7ada1 100644 --- a/phpBB/styles/prosilver/template/posting_smilies.html +++ b/phpBB/styles/prosilver/template/posting_smilies.html @@ -17,6 +17,7 @@ +
      {PAGINATION}
      {L_CLOSE_WINDOW} \ No newline at end of file diff --git a/phpBB/styles/subsilver2/template/posting_smilies.html b/phpBB/styles/subsilver2/template/posting_smilies.html index 3c57cb132f..2586530e55 100644 --- a/phpBB/styles/subsilver2/template/posting_smilies.html +++ b/phpBB/styles/subsilver2/template/posting_smilies.html @@ -16,11 +16,10 @@ {L_SMILIES} - {smiley.SMILEY_CODE}
      {L_CLOSE_WINDOW} + {smiley.SMILEY_CODE}
      {PAGINATION}
      {L_CLOSE_WINDOW} - \ No newline at end of file From dce2a9b039184a8c5dddf4825cf0b6b3081bc3fd Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 17 Jul 2009 09:05:09 +0000 Subject: [PATCH 231/607] A small correction to #r9763 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9764 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_icons.php | 38 ++++++++++++++-------------- phpBB/includes/functions_posting.php | 16 +++++++----- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index cd26d46044..e261a6cbf0 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -168,7 +168,7 @@ class acp_icons } } } - + $sql = "SELECT * FROM $table ORDER BY {$fields}_order " . (($icon_id || $action == 'add') ? 'DESC' : 'ASC'); @@ -180,7 +180,7 @@ class acp_icons $order_lists = array('', ''); $add_order_lists = array('', ''); $display_count = 0; - + while ($row = $db->sql_fetchrow($result)) { if ($action == 'add') @@ -234,12 +234,12 @@ class acp_icons $colspan = (($mode == 'smilies') ? '7' : '5'); $colspan += ($icon_id) ? 1 : 0; $colspan += ($action == 'add') ? 2 : 0; - + $template->assign_vars(array( 'S_EDIT' => true, 'S_SMILIES' => ($mode == 'smilies') ? true : false, 'S_ADD' => ($action == 'add') ? true : false, - + 'S_ORDER_LIST_DISPLAY' => $order_list . $order_lists[1], 'S_ORDER_LIST_UNDISPLAY' => $order_list . $order_lists[0], 'S_ORDER_LIST_DISPLAY_COUNT' => $display_count + 1, @@ -286,10 +286,10 @@ class acp_icons 'S_ADD_CODE' => true, 'S_IMG_OPTIONS' => $smiley_options, - + 'S_ADD_ORDER_LIST_DISPLAY' => $add_order_list . $add_order_lists[1], 'S_ADD_ORDER_LIST_UNDISPLAY' => $add_order_list . $add_order_lists[0], - + 'IMG_SRC' => $phpbb_root_path . $img_path . '/' . $default_row['smiley_url'], 'IMG_PATH' => $img_path, 'PHPBB_ROOT_PATH' => $phpbb_root_path, @@ -303,7 +303,7 @@ class acp_icons } return; - + break; case 'create': @@ -311,7 +311,7 @@ class acp_icons // Get items to create/modify $images = (isset($_POST['image'])) ? array_keys(request_var('image', array('' => 0))) : array(); - + // Now really get the items $image_id = (isset($_POST['id'])) ? request_var('id', array('' => 0)) : array(); $image_order = (isset($_POST['order'])) ? request_var('order', array('' => 0)) : array(); @@ -426,13 +426,13 @@ class acp_icons $db->sql_query($sql); $icons_updated++; } - + } } - + $cache->destroy('_icons'); $cache->destroy('sql', $table); - + $level = E_USER_NOTICE; switch ($icons_updated) { @@ -440,11 +440,11 @@ class acp_icons $suc_lang = "{$lang}_NONE"; $level = E_USER_WARNING; break; - + case 1: $suc_lang = "{$lang}_ONE"; break; - + default: $suc_lang = $lang; } @@ -835,20 +835,19 @@ class acp_icons ); $spacer = false; - + $pagination_start = request_var('start', 0); + $sql = "SELECT COUNT(*) AS count FROM $table"; $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); + $item_count = (int) $db->sql_fetchfield('count'); $db->sql_freeresult($result); - $item_count = $row['count']; $sql = "SELECT * FROM $table ORDER BY {$fields}_order ASC"; - $result = $db->sql_query_limit($sql, $config['smilies_per_page'], request_var('start', 0)); + $result = $db->sql_query_limit($sql, $config['smilies_per_page'], $pagination_start); - $pagination_start = request_var('start', 0); while ($row = $db->sql_fetchrow($result)) { $alt_text = ($mode == 'smilies') ? $row['code'] : ''; @@ -874,7 +873,8 @@ class acp_icons } $db->sql_freeresult($result); $template->assign_var('PAGINATION', generate_pagination( - $this->u_action, $item_count, $config['smilies_per_page'], $pagination_start, true)); + + $this->u_action, $item_count, $config['smilies_per_page'], $pagination_start, true)); } } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 0c5aeb98d6..7db2875cda 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -24,6 +24,8 @@ function generate_smilies($mode, $forum_id) global $auth, $db, $user, $config, $template; global $phpEx, $phpbb_root_path; + $start = request_var('start', 0); + if ($mode == 'window') { if ($forum_id) @@ -43,12 +45,12 @@ function generate_smilies($mode, $forum_id) } page_header($user->lang['SMILIES']); - + $sql = 'SELECT COUNT(smiley_id) AS count FROM ' . SMILIES_TABLE . ' GROUP BY smiley_url'; $result = $db->sql_query($sql, 3600); - + $smiley_count = 0; while ($row = $db->sql_fetchrow($result)) { @@ -59,9 +61,11 @@ function generate_smilies($mode, $forum_id) $template->set_filenames(array( 'body' => 'posting_smilies.html') ); + $template->assign_var('PAGINATION', generate_pagination(append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=smilies&f=' . $forum_id), - $smiley_count, $config['smilies_per_page'], request_var('start', 0), true)); + $smiley_count, $config['smilies_per_page'], $start, true) + ); } $display_link = false; @@ -83,8 +87,9 @@ function generate_smilies($mode, $forum_id) { $sql = 'SELECT smiley_url, MIN(emotion) as emotion, MIN(code) AS code, smiley_width, smiley_height FROM ' . SMILIES_TABLE . ' - GROUP BY smiley_url, smiley_width, smiley_height ORDER BY smiley_order'; - $result = $db->sql_query_limit($sql, $config['smilies_per_page'], request_var('start', 0), 3600); + GROUP BY smiley_url, smiley_width, smiley_height + ORDER BY smiley_order'; + $result = $db->sql_query_limit($sql, $config['smilies_per_page'], $start, 3600); } else { @@ -92,7 +97,6 @@ function generate_smilies($mode, $forum_id) FROM ' . SMILIES_TABLE . ' WHERE display_on_posting = 1 ORDER BY smiley_order'; - $result = $db->sql_query($sql, 3600); } From 955939ee1b8f95948c37628ee996a6ac07c305a2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 17 Jul 2009 10:11:10 +0000 Subject: [PATCH 232/607] Fix bug #47495 - Move hardcoded language string to language file. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9765 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_database.php | 4 +++- phpBB/language/en/acp/database.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 1182e224cf..575137ea2d 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -548,7 +548,9 @@ class base_extractor if (!$this->fp) { - trigger_error('Unable to write temporary file to storage folder', E_USER_ERROR); + global $user; + + trigger_error($user->lang['FILE_WRITE_FAIL'], E_USER_ERROR); } } } diff --git a/phpBB/language/en/acp/database.php b/phpBB/language/en/acp/database.php index 7100fcb1e3..ae8f76d6b7 100644 --- a/phpBB/language/en/acp/database.php +++ b/phpBB/language/en/acp/database.php @@ -54,6 +54,7 @@ $lang = array_merge($lang, array( 'DOWNLOAD_BACKUP' => 'Download backup', 'FILE_TYPE' => 'File type', + 'FILE_WRITE_FAIL' => 'Unable to write file to storage folder.', 'FULL_BACKUP' => 'Full', 'RESTORE_FAILURE' => 'The backup file may be corrupt.', From 2f9f52b151338903ed9721475f6cb3d753d100b9 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 17 Jul 2009 10:11:48 +0000 Subject: [PATCH 233/607] ok, i misread this one. :) related to r9763 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9766 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_icons.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index e261a6cbf0..291f846999 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -872,9 +872,10 @@ class acp_icons } } $db->sql_freeresult($result); - $template->assign_var('PAGINATION', generate_pagination( - $this->u_action, $item_count, $config['smilies_per_page'], $pagination_start, true)); + $template->assign_var('PAGINATION', + generate_pagination($this->u_action, $item_count, $config['smilies_per_page'], $pagination_start, true) + ); } } From 6cacfce937c64cae1f90dedef130f3a39fa2c317 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 17 Jul 2009 11:27:50 +0000 Subject: [PATCH 234/607] Ability to empty a user's outbox from the user ACP quick tools. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9767 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_users.php | 55 ++++++++++++++++++++++++++++++-- phpBB/language/en/acp/common.php | 1 + phpBB/language/en/acp/users.php | 3 ++ 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6ee8b91959..266ea2a80a 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -202,6 +202,7 @@
    616. [Feature] Add unread posts quick search option (Bug #46765 - Patch by rxu)
    617. [Feature] Add option to disable remote upload avatars (Bug #45375 - Patch by nickvergessen)
    618. [Feature] Ability to delete warnings and keep warnings permanently (Bug #43375 - Patch by nickvergessen)
    619. +
    620. [Feature] Ability to empty a user's outbox from the user ACP quick tools.
    621. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c27c259b46..cb342ac300 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -495,6 +495,56 @@ class acp_users break; + case 'deloutbox': + + if (confirm_box(true)) + { + $msg_ids = array(); + $lang = 'EMPTY'; + + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE author_id = $user_id + AND folder_id = " . PRIVMSGS_OUTBOX; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + if (!function_exists('delete_pm')) + { + include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + } + + do + { + $msg_ids[] = (int) $row['msg_id']; + } + while ($row = $db->sql_fetchrow($result)); + + $db->sql_freeresult($result); + + delete_pm($user_id, $msg_ids, PRIVMSGS_OUTBOX); + + add_log('admin', 'LOG_USER_DEL_OUTBOX', $user_row['username']); + + $lang = 'EMPTIED'; + } + $db->sql_freeresult($result); + + trigger_error($user->lang['USER_OUTBOX_' . $lang] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + break; + case 'moveposts': if (!check_form_key($form_name)) @@ -842,7 +892,7 @@ class acp_users if ($user_id == $user->data['user_id']) { - $quick_tool_ary = array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH'); + $quick_tool_ary = array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH', 'deloutbox' => 'DEL_OUTBOX'); if ($user_row['user_new']) { $quick_tool_ary['leave_nr'] = 'LEAVE_NR'; @@ -862,12 +912,13 @@ class acp_users $quick_tool_ary += array('active' => (($user_row['user_type'] == USER_INACTIVE) ? 'ACTIVATE' : 'DEACTIVATE')); } - $quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH'); + $quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH', 'deloutbox' => 'DEL_OUTBOX'); if ($config['email_enable'] && ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_INACTIVE)) { $quick_tool_ary['reactivate'] = 'FORCE'; } + if ($user_row['user_new']) { $quick_tool_ary['leave_nr'] = 'LEAVE_NR'; diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 9f69fe3790..4a334a44d3 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -675,6 +675,7 @@ $lang = array_merge($lang, array( 'LOG_USER_DELETED' => 'Deleted user
      » %s', 'LOG_USER_DEL_ATTACH' => 'Removed all attachments made by the user
      » %s', 'LOG_USER_DEL_AVATAR' => 'Removed user avatar
      » %s', + 'LOG_USER_DEL_OUTBOX' => 'Emptied user outbox
      » %s', 'LOG_USER_DEL_POSTS' => 'Removed all posts made by the user
      » %s', 'LOG_USER_DEL_SIG' => 'Removed user signature
      » %s', 'LOG_USER_INACTIVE' => 'User deactivated
      » %s', diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index a2d1b3911c..8d9bf0d486 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -103,6 +103,7 @@ $lang = array_merge($lang, array( 'USER_ADMIN_DEACTIVED' => 'User deactivated successfully.', 'USER_ADMIN_DEL_ATTACH' => 'Delete all attachments', 'USER_ADMIN_DEL_AVATAR' => 'Delete avatar', + 'USER_ADMIN_DEL_OUTBOX' => 'Empty PM outbox', 'USER_ADMIN_DEL_POSTS' => 'Delete all posts', 'USER_ADMIN_DEL_SIG' => 'Delete signature', 'USER_ADMIN_EXPLAIN' => 'Here you can change your users information and certain specific options.', @@ -122,6 +123,8 @@ $lang = array_merge($lang, array( 'USER_GROUP_SPECIAL' => 'Pre-defined groups user is a member of', 'USER_LIFTED_NR' => 'Successfully removed the user’s newly registered status.', 'USER_NO_ATTACHMENTS' => 'There are no attached files to display.', + 'USER_OUTBOX_EMPTIED' => 'Successfully emptied user’s private message outbox.', + 'USER_OUTBOX_EMPTY' => 'The user’s private message outbox was already empty.', 'USER_OVERVIEW_UPDATED' => 'User details updated.', 'USER_POSTS_DELETED' => 'Successfully removed all posts made by this user.', 'USER_POSTS_MOVED' => 'Successfully moved users posts to target forum.', From ab9715a9fe5577921180a6f77b5a89b990665b6e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 17 Jul 2009 11:32:27 +0000 Subject: [PATCH 235/607] Fix bugs #46615 & #46945 - Fail gracefully if store folder is not writable during update. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9768 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_compress.php | 7 ++++++- phpBB/install/install_update.php | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 266ea2a80a..15ec8cb4fc 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -157,6 +157,7 @@
    622. [Fix] Force full date for PMs print-view (Patch by nickvergessen)
    623. [Fix] Fix "Always show a scrollbar for short pages" for IE8 and Firefox 3.5 (Bug #47865 - Patch by stokerpiller)
    624. [Fix] Do not allow setting group as default group for pending user (Bug #45675 - Patch by nickvergessen)
    625. +
    626. [Fix] Fail gracefully if store folder is not writable during update. (Bugs #46615, #46945)
    627. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    628. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    629. [Change] Template engine now permits to a limited extent variable includes.
    630. diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index 881e1ba5cc..590daabf1d 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -155,7 +155,12 @@ class compress_zip extends compress */ function compress_zip($mode, $file) { - return $this->fp = @fopen($file, $mode . 'b'); + $this->fp = @fopen($file, $mode . 'b'); + + if (!$this->fp) + { + trigger_error('Unable to open file ' . $file . ' [' . $mode . 'b]'); + } } /** diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 388e217133..ccbad07e5b 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -915,6 +915,11 @@ class install_update extends module // Now init the connection if ($update_mode == 'download') { + if (function_exists('phpbb_is_writable') && !phpbb_is_writable($phpbb_root_path . 'store/')) + { + trigger_error(sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $phpbb_root_path . 'store/'), E_USER_ERROR); + } + if ($use_method == '.zip') { $compress = new compress_zip('w', $phpbb_root_path . 'store/' . $archive_filename . $use_method); From 5f6db9584c4b2594c437a07c0ecd60390ff39d5e Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 17 Jul 2009 13:21:03 +0000 Subject: [PATCH 236/607] Correct escaping/unescaping in the LDAP authentication plugin. #48175 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9769 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/config.php | 17 +++++++++++++++++ phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/auth/auth_ldap.php | 18 +++++++++++------- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/phpBB/config.php b/phpBB/config.php index e69de29bb2..fcfbc98bc2 100644 --- a/phpBB/config.php +++ b/phpBB/config.php @@ -0,0 +1,17 @@ + diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 15ec8cb4fc..9fc30afeed 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -158,6 +158,7 @@
    631. [Fix] Fix "Always show a scrollbar for short pages" for IE8 and Firefox 3.5 (Bug #47865 - Patch by stokerpiller)
    632. [Fix] Do not allow setting group as default group for pending user (Bug #45675 - Patch by nickvergessen)
    633. [Fix] Fail gracefully if store folder is not writable during update. (Bugs #46615, #46945)
    634. +
    635. [Fix] Correct escaping/unescaping in the LDAP authentication plugin. (Bug #48175)
    636. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    637. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    638. [Change] Template engine now permits to a limited extent variable includes.
    639. diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index 11c62ad0bc..b70e644b14 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -63,9 +63,11 @@ function init_ldap() // ldap_connect only checks whether the specified server is valid, so the connection might still fail $search = @ldap_search( $ldap, - $config['ldap_base_dn'], + htmlspecialchars_decode($config['ldap_base_dn']), ldap_user_filter($user->data['username']), - (empty($config['ldap_email'])) ? array($config['ldap_uid']) : array($config['ldap_uid'], $config['ldap_email']), + (empty($config['ldap_email'])) ? + array(htmlspecialchars_decode($config['ldap_uid'])) : + array(htmlspecialchars_decode($config['ldap_uid']), htmlspecialchars_decode($config['ldap_email'])), 0, 1 ); @@ -85,7 +87,7 @@ function init_ldap() return sprintf($user->lang['LDAP_NO_IDENTITY'], $user->data['username']); } - if (!empty($config['ldap_email']) && !isset($result[0][$config['ldap_email']])) + if (!empty($config['ldap_email']) && !isset($result[0][htmlspecialchars_decode($config['ldap_email'])])) { return $user->lang['LDAP_NO_EMAIL']; } @@ -152,7 +154,7 @@ function login_ldap(&$username, &$password) if ($config['ldap_user'] || $config['ldap_password']) { - if (!@ldap_bind($ldap, $config['ldap_user'], htmlspecialchars_decode($config['ldap_password']))) + if (!@ldap_bind($ldap, htmlspecialchars_decode($config['ldap_user']), htmlspecialchars_decode($config['ldap_password']))) { return $user->lang['LDAP_NO_SERVER_CONNECTION']; } @@ -160,9 +162,11 @@ function login_ldap(&$username, &$password) $search = @ldap_search( $ldap, - $config['ldap_base_dn'], + htmlspecialchars_decode($config['ldap_base_dn']), ldap_user_filter($username), - (empty($config['ldap_email'])) ? array($config['ldap_uid']) : array($config['ldap_uid'], $config['ldap_email']), + (empty($config['ldap_email'])) ? + array(htmlspecialchars_decode($config['ldap_uid'])) : + array(htmlspecialchars_decode($config['ldap_uid']), htmlspecialchars_decode($config['ldap_email'])), 0, 1 ); @@ -223,7 +227,7 @@ function login_ldap(&$username, &$password) $ldap_user_row = array( 'username' => $username, 'user_password' => phpbb_hash($password), - 'user_email' => (!empty($config['ldap_email'])) ? $ldap_result[0][$config['ldap_email']][0] : '', + 'user_email' => (!empty($config['ldap_email'])) ? utf8_htmlspecialchars($ldap_result[0][htmlspecialchars_decode($config['ldap_email'])][0]) : '', 'group_id' => (int) $row['group_id'], 'user_type' => USER_NORMAL, 'user_ip' => $user->ip, From 7284985ce231cef06e9c0026b593b2ab0e113686 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 17 Jul 2009 13:23:09 +0000 Subject: [PATCH 237/607] fail <3 r9769 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9770 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/config.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/phpBB/config.php b/phpBB/config.php index fcfbc98bc2..e69de29bb2 100644 --- a/phpBB/config.php +++ b/phpBB/config.php @@ -1,17 +0,0 @@ - From e4afce607529f7834776b588ca22ebb93647948e Mon Sep 17 00:00:00 2001 From: "Marek A. R" Date: Fri, 17 Jul 2009 13:40:26 +0000 Subject: [PATCH 238/607] - Add hard limit for smilies git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9771 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/constants.php | 3 +++ phpBB/language/en/acp/posting.php | 2 ++ 3 files changed, 6 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 9fc30afeed..f570573ea8 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -159,6 +159,7 @@
    640. [Fix] Do not allow setting group as default group for pending user (Bug #45675 - Patch by nickvergessen)
    641. [Fix] Fail gracefully if store folder is not writable during update. (Bugs #46615, #46945)
    642. [Fix] Correct escaping/unescaping in the LDAP authentication plugin. (Bug #48175)
    643. +
    644. [Fix] Add hard limit for smilies.
    645. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    646. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    647. [Change] Template engine now permits to a limited extent variable includes.
    648. diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 2e2c239d89..2173f2ee68 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -161,6 +161,9 @@ define('BBCODE_UID_LEN', 8); // Number of core BBCodes define('NUM_CORE_BBCODES', 12); +// Smiley hard limit +define('SMILEY_LIMIT', 1000); + // Magic url types define('MAGIC_URL_EMAIL', 1); define('MAGIC_URL_FULL', 2); diff --git a/phpBB/language/en/acp/posting.php b/phpBB/language/en/acp/posting.php index cfb626d186..1a2be20018 100644 --- a/phpBB/language/en/acp/posting.php +++ b/phpBB/language/en/acp/posting.php @@ -180,6 +180,8 @@ $lang = array_merge($lang, array( 'SMILIES_URL' => 'Smiley image file', 'SMILIES_WIDTH' => 'Smiley width', + 'TOO_MANY_SMILIES' => 'Limit of %d smilies reached.', + 'WRONG_PAK_TYPE' => 'The specified package does not contain the appropriate data.', )); From 9b9298cfaa0612372926ba83feef39a2c6c215fe Mon Sep 17 00:00:00 2001 From: "Marek A. R" Date: Fri, 17 Jul 2009 13:56:24 +0000 Subject: [PATCH 239/607] - Add hard limit for smilies git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9772 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_icons.php | 55 ++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 291f846999..fa1e324cc6 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -231,7 +231,7 @@ class acp_icons $data = $_images; } - $colspan = (($mode == 'smilies') ? '7' : '5'); + $colspan = (($mode == 'smilies') ? 7 : 5); $colspan += ($icon_id) ? 1 : 0; $colspan += ($action == 'add') ? 2 : 0; @@ -348,6 +348,25 @@ class acp_icons } } + if ($mode == 'smilies' && $action == 'create') + { + $smiley_count = $this->item_count($table); + + $addable_smileys_count = sizeof($images); + foreach ($images as $image) + { + if (!isset($image_add[$image])) + { + --$addable_smileys_count; + } + } + + if ($smiley_count + $addable_smileys_count > SMILEY_LIMIT) + { + trigger_error(sprintf($user->lang['TOO_MANY_SMILIES'], SMILEY_LIMIT) . adm_back_link($this->u_action), E_USER_WARNING); + } + } + $icons_updated = 0; $errors = array(); foreach ($images as $image) @@ -495,7 +514,6 @@ class acp_icons } } - // The user has already selected a smilies_pak file if ($current == 'delete') { @@ -541,6 +559,15 @@ class acp_icons $db->sql_freeresult($result); } + if ($mode == 'smilies') + { + $smiley_count = $this->item_count($table); + if ($smiley_count + sizeof($pak_ary) > SMILEY_LIMIT) + { + trigger_error(sprintf($user->lang['TOO_MANY_SMILIES'], SMILEY_LIMIT) . adm_back_link($this->u_action), E_USER_WARNING); + } + } + foreach ($pak_ary as $pak_entry) { $data = array(); @@ -837,11 +864,7 @@ class acp_icons $spacer = false; $pagination_start = request_var('start', 0); - $sql = "SELECT COUNT(*) AS count - FROM $table"; - $result = $db->sql_query($sql); - $item_count = (int) $db->sql_fetchfield('count'); - $db->sql_freeresult($result); + $item_count = $this->item_count($table); $sql = "SELECT * FROM $table @@ -877,6 +900,24 @@ class acp_icons generate_pagination($this->u_action, $item_count, $config['smilies_per_page'], $pagination_start, true) ); } + + /** + * Returns the count of smilies or icons in the database + * + * @param string $table The table of items to count. + * @return int number of items + */ + /* private */ function item_count($table) + { + global $db; + + $sql = "SELECT COUNT(*) AS count + FROM $table"; + $result = $db->sql_query($sql); + $item_count = (int) $db->sql_fetchfield('count'); + $db->sql_freeresult($result); + return $item_count; + } } ?> \ No newline at end of file From 50e5bdf08cac2c98c233876a5439aefa1d77e436 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 17 Jul 2009 16:39:16 +0000 Subject: [PATCH 240/607] Small change to r9765, Bug #47495 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9773 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_database.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 575137ea2d..bf02a58dce 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -548,9 +548,7 @@ class base_extractor if (!$this->fp) { - global $user; - - trigger_error($user->lang['FILE_WRITE_FAIL'], E_USER_ERROR); + trigger_error('FILE_WRITE_FAIL', E_USER_ERROR); } } } From 7a5ba35cc73b31e78b844db80b8e5b52666ca51b Mon Sep 17 00:00:00 2001 From: "Marek A. R" Date: Fri, 17 Jul 2009 17:21:07 +0000 Subject: [PATCH 241/607] - Add smilies per page config setting to the database updater git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9774 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index e13bc1d546..362a379ec1 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1073,6 +1073,9 @@ function change_database_data(&$no_updates, $version) set_config('feed_item_statistics', '1'); set_config('feed_exclude_id', ''); + // Entries for smiley pagination + set_config('smilies_per_page', '50'); + include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); $_module = new acp_modules(); From f7b5c060ae67a7ad568b3317043a743f84052f79 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 18 Jul 2009 09:42:28 +0000 Subject: [PATCH 242/607] Fix bug #37635 - Hide profile-icon from viewtopic-page if user has no permissions (subsilver2 only) - Patch by leviatan21 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9775 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/subsilver2/template/viewtopic_body.html | 2 +- phpBB/viewtopic.php | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f570573ea8..7ced5a74d6 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -158,6 +158,7 @@
    649. [Fix] Fix "Always show a scrollbar for short pages" for IE8 and Firefox 3.5 (Bug #47865 - Patch by stokerpiller)
    650. [Fix] Do not allow setting group as default group for pending user (Bug #45675 - Patch by nickvergessen)
    651. [Fix] Fail gracefully if store folder is not writable during update. (Bugs #46615, #46945)
    652. +
    653. [Fix] Hide profile-icon from viewtopic-page if user has no permissions (subsilver2 only) (Bug #37635 - Patch by leviatan21)
    654. [Fix] Correct escaping/unescaping in the LDAP authentication plugin. (Bug #48175)
    655. [Fix] Add hard limit for smilies.
    656. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    657. diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index cfce658b47..11f8c0354d 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -285,7 +285,7 @@ {L_BACK_TO_TOP} - + diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0ddf8603fc..5fdf3fd825 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1470,7 +1470,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, $user->session_id) : '', 'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), - 'U_PROFILE' => $user_cache[$poster_id]['profile'], 'U_SEARCH' => $user_cache[$poster_id]['search'], 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']) : '', 'U_EMAIL' => $user_cache[$poster_id]['email'], From ba08191a7027969eabaa03c4369f8d9bae4fd7a6 Mon Sep 17 00:00:00 2001 From: "Marek A. R" Date: Sat, 18 Jul 2009 09:44:03 +0000 Subject: [PATCH 243/607] - PHP4 compatibility git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9776 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index eaaa8aaf6a..5b0a2340b5 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3306,6 +3306,11 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $msg_text = $msg_long_text; } + if (!defined('E_DEPRECATED')) + { + define('E_DEPRECATED', 8192); + } + switch ($errno) { case E_NOTICE: @@ -3481,6 +3486,11 @@ function msg_handler($errno, $msg_text, $errfile, $errline) exit_handler(); break; + + // PHP4 comptibility + case E_DEPRECATED: + return true; + break; } // If we notice an error not handled here we pass this back to PHP by returning false From 0fe2b41cfca76b51eb14cc687f2a978b0f4a4da0 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 18 Jul 2009 10:02:06 +0000 Subject: [PATCH 244/607] #42925 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9777 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5b0a2340b5..d1a560f96d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1164,7 +1164,7 @@ function tz_select($default = '', $truncate = false) if (is_numeric($offset)) { $selected = ($offset == $default) ? ' selected="selected"' : ''; - $tz_select .= ''; + $tz_select .= ''; } } From ca627c277869d8b7c81a847eb88e5dff95fdda89 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 18 Jul 2009 10:12:17 +0000 Subject: [PATCH 245/607] Remove redundant SQL query from ucp.php. #40305 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9778 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/ucp.php | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7ced5a74d6..c9a0d2657d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -161,6 +161,7 @@
    658. [Fix] Hide profile-icon from viewtopic-page if user has no permissions (subsilver2 only) (Bug #37635 - Patch by leviatan21)
    659. [Fix] Correct escaping/unescaping in the LDAP authentication plugin. (Bug #48175)
    660. [Fix] Add hard limit for smilies.
    661. +
    662. [Fix] Remove redundant SQL query from ucp.php. (Bug #40305)
    663. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    664. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    665. [Change] Template engine now permits to a limited extent variable includes.
    666. diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 02b96f4bfb..b808049187 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -215,11 +215,6 @@ switch ($mode) $auth->acl_cache($user->data); - $sql = 'UPDATE ' . USERS_TABLE . " - SET user_perm_from = 0 - WHERE user_id = " . $user->data['user_id']; - $db->sql_query($sql); - $sql = 'SELECT username FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user->data['user_perm_from']; From f4e7d9265eed57be6bc5d06ac6d94cbbb876b2a3 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 18 Jul 2009 10:27:07 +0000 Subject: [PATCH 246/607] Reorder frame order of animated subsilver2 topic icons to be useful when animation is disabled. #29385 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9779 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + .../subsilver2/imageset/topic_read_hot.gif | Bin 1178 -> 1902 bytes .../imageset/topic_read_hot_mine.gif | Bin 1186 -> 1903 bytes .../subsilver2/imageset/topic_unread_hot.gif | Bin 1159 -> 1888 bytes .../imageset/topic_unread_hot_mine.gif | Bin 1167 -> 1895 bytes 5 files changed, 1 insertion(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index c9a0d2657d..09e5fa9dbf 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -162,6 +162,7 @@
    667. [Fix] Correct escaping/unescaping in the LDAP authentication plugin. (Bug #48175)
    668. [Fix] Add hard limit for smilies.
    669. [Fix] Remove redundant SQL query from ucp.php. (Bug #40305)
    670. +
    671. [Fix] Reorder frame order of animated subsilver2 topic icons to be useful when animation is disabled. (Bug #29385 - Patch by prototech)
    672. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    673. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    674. [Change] Template engine now permits to a limited extent variable includes.
    675. diff --git a/phpBB/styles/subsilver2/imageset/topic_read_hot.gif b/phpBB/styles/subsilver2/imageset/topic_read_hot.gif index a7e8831e2c4840112ef2ad801e98b4a2344bea5c..a7a7e8fc7825f69de277a29143b2079b2bc865ef 100644 GIT binary patch literal 1902 zcmeH`ZA=qq0LPzuYp?B5+FG!K0$0SWacBw(sY=GvQm8UrO2iEI!Q821EOA*!m}v~i zU0Z1}3|$;<3yV2koG#O(sPQFn?22_@Bw5XLI=8q3M|=s9HWjn>htwU z{x84h|F}2T*w?emfC0=`f@{|&uKxb_iLu*FO-(OeytsGo-sZ0F=jZ2pdwchu6h9gK z@zJA4XU?AeMS3tbHPzYKS-iJzWMt&--MgVP*J82Q&0DvU$>ihYv!S7(>FMdl-m|T( ztz~6p+qZ9D{?U>Br?0x*?sz;tGcz+gI~(phJ~uZv`S?j>;tym;ck{7J-+uQ)#s^=p z-Tn8cAK3ZhiD%E(whuN0`_wyoio8dUoET2dJw15(r{zVh?p;v#r`UK98q1T2f1cdP5SRXIG>rE6>$B1>7GRrdMNPA=*AX16acBUxWbYC$uS~xLp2qK9PCnKrf`FYy{bWSYP(H( z7T&% z7tgQm-*Ye9UWh2{?!Ox%K_g+X*#`|CxUwgPVi1~bfd+A4Xh{tSK2-Ynl!H(Ux*n#TT0kY-j6LMdnlNYWv>eoC$% zB?FY*yif=5kPb^vO>!?y&1YiaW*fp!*Qffe@p@d(_h3RpH67l!GTTyG^=WDYYh zJtG%PNCK{=@;xr;@Gc%TtZL1(vdqgM>X+}2$?va`i7+yeb1))^1%#%@-fW2}C{WX_ zOYSOEXwA^3bJV$bZC3UkQ-q0T>X#EWbYp3iQjM1E89&TMG5P9kC`oPwo(mZ>*UyQl zw#X$WIRA}+a%Jjp&dbp)nG%2iN}!TW*Mrrh*%1+fNG=FBgeAm}Xk0;H;hiBuQ%?Cf zwyKjbn&>-R)S*yX>#{dB3dgU1MWE;s%U9H#pd&>NBN*TdZC(lZqleJERmFE~Qpkzo nh17VQM{B6ueD6t{U&L^-oNKUyD!#x_$oQZ`*s3zfvK#*aqCm*{ delta 981 zcmaFIH;a?o-P6s&GEta8h~er)?n9G#nZ@h580;Bz7=QpI%E0#I!2E!UnGOLSH=da0 zaM`bRdF;Te5+=XgAk{$DYubjTDMlJ|xXy;3*>>m5Vc{igdC_jl-q~UTQhue070pVm zW>WUzatX~s%+d_4t=yv8`b<))6|Efn9L(Gc7m8Zi2y=-|QdAHUkzFJyDavMLt68tK zNSc{nLVBYlA0LCEg*w|JZV?_1X^DdeSw#dG^|f{RHlDx0dPkH;gT-FcjP=%?=d414 zI-E|tatuN*o(rwjGE#GPvlIRF^{c4TiVp?{PqOoyC^2vdGC8oYS#QYr*?5?hMNGx$ z*o=?qj|8;!5_Wi8IPNLHp!k!873}kRRt8oEb_PzM*NqR{*WYrGp+$+OojK_b*W6P{ z#y>PUTTUokUYKAwn|-;Fl8rzIZ-(Uok-AA7&m0ABsZLS=8zce>LKX&Q1}+9}pgDmD zoKGH-P>^Vtm}>FLMSz*l$@7T}2djX(i4d<6i_=P@gdU~l4N@#0jIOi@)-M-&IOV}Y zzlC?g#AO3yWtjQ>`C0k+ghY7w136fQSSL>r5*2a;Tf+*mh6!j5573$bU`*{0;B6IU zdDPy)a;;Pz|ckQVfv>(mal)Cd%M zP)nh9W=Kl4*7qK~c!K zN7+wx^Mq+Vin6Ts+?fp7_AH*x9L%5?6Xf7`2Sr#2hhGdUtB~kiXCY^ZPr*qHkurP_ z%)j8I!&QIu(TfbuT!V&-9$#!{Ct1h{IJ=07T1`Egwjtt=OL$^S%()T`r!#7kBW*0E iK4pIRBUM0JA%asIIK%duGO`i&duboxR1@!;U#)YR10-ZL#N zEfp0NTefUjx$|KA$%`J3CmxSaPfyRx%!K=n&CbqFJa`xxyA6HVwd2Up*WZ4h`_Tbk zSO4VHJtu!G_4vt}Jp+xwK21}1F?;CX@l)y9NBd9yJpFJ+h+bdYcI2z!tDhbehOYhD zeRk~p$S?Er^WepMLEwK7u+Haf-q7$)4ei}f{;C6kWGU+tRFMzX1N(yP!Z!ifJlLxf zL@E|i>%3&JY~o^1=dxGWFGrz}U#TirZj2<6m<1s>S9_!Wx}1_tMlYzp>sI1Qf&ol0 zRIu9OXNQCu6t(KdKQ1d0dvvxcCc$zP|Bclhj`UA>p!`CL(3KG|1ecWJhI^3#;$GYaKz| z!F6BE9ilF{&=uyF+p=j1`3wWDpatl7sk{5OCCNg(V&7a@v(b6r*<|fX#|OoZpWYxA znJE^Sp#TONfXmF9z+No>92KK@qmIb%M3hEN&g#E_UlJk1Dy@;2@PxEh)QnxV254=G zvN==FKz^0#y=RSaeuP#NAPDLcVh@s2%7r;7_^U-SA&786 zJ3B5?L0Vm)%SO0<%HfQ?YWT$7U^6JFAvtAAJide=YW3}S zf@6X-ZqjB+;I9euHl>?L4Y)%P?#@PZK2XP_6lf%D#YmvY*)SR*n$!X7>-m{epak@; z$BIp1hEiz}vztmK1XP2YH@Oq+HXhC^Z7C#u%u*1|()@@#e~wIKVF$afpP_j;*I?pV zI-F|+T}EqCwE;IdIfgiTGz=G(+Q%J?Z)Ce(4Gjw)xi)!mL>C}jIa`1C7b1z>mYH1_PwXjoBK}e)^xn#Yh zD4Uh7rqT*&W_}6j?UHR2VAR*v<=cMcD(gd09t{?IO*7W} z58to~3F>hA^U5&@y?rCJS<6T*z{5`K&gJFnomfQW)M|cyJjmS3!Qj-wAkcWQPmg>4 zg964z*3N#zGzp7|A5V*k8^ow^Y%$uDPd@jDKiywwzG7yfDFVHv4iTB^!Yb-VDnFB6X8Eo;eEMQk|s0pa?Wa1Qe7k z49pB%4BS9-0uRieVCZ1LpuBK{up^HJhiY4~f{4SM3;re@0vtTPU2w?dzPT^Gt^4)q2iU35|&F7pM^&#$Q}QhfAOJ= zs)7SYh{Yd1Zczn6iF$=H`@ldRMTy?te2GNoSf^O5miPfJ$=Jx#%5&_&aRwRjxg1Fc z9C-|75*d$h{&i{Y*bpLV(8GKvfS19zPdTwA*s9HnwfMKYf`)9ctP_6_KPw;DA0Zs9 z?h~9){87)$zy$OLFVG|L2j&;-kdSIsJ;1DJ$;CZeKK-zOq^k6h^Gz=k+7_}u|DfDr zG55@Rg9kkwcXrVte5(C*~k(FDk*z-xw{!?<^_Gp&-E`BFo^;Dkv=@!@=s; z#33!{JJ+cl8hA#az(caL9%yNXq*QAUV-uqVm-WQ^4b2jghI0prH(3hvKR(aC(c-sZ&~G5M-8a sC8C%%`J|5A9Inre1%He9LK-+)Vn^=9_`kZ*_G?)2I7L{VR#_WYd5wEGK$Vn6}2@yEJ|W)fD{Ac zZo78foa`VIM_fn?+7k=|sK7YXb z;r01^DqpFf7q~S*4aO~CXlUq*!(TtYY46>;chwtqpZ)2^;d4K(cy;-O3l};+tFbp7 zy>{)|*002m4xAYuAK$ZQ&+Xf{zl+~ozkdDj@bJ~ER|6*oJ5QcWCX@Gj8v6VD?~Fcp z^YfDH?9M4J za_ML2-R7Eor`^rr>mxUZBegVluylJk`QV|G|8hm(z}}wN&TlULnf|-GZy+RI86ErM z^w6)p7h@9>6X4lABk(^67$@XaORHZmvpSZ}nPo|uWVGeu`sVhp}`9Kr_0f@`yh!wj+7MnLN z_5uiv%>AUg#*;Y8qaUtjLs1R^&%Na7O69}-O&XoLg^svH6rH~%;z&NY7tC#(Z4%-> zYal$2h_)q}x|Ny&-)?6Fuzu}=+AcDtllT={yFGQ9wFUEZJIbkeJ^b7CGte)}%Y|o| z`h~6IhnNC}P@ywvUPqxY03=@!Ve8mnvt`R5nS}j+<-^VUr`D_*P)tz-7b=KH#IP(e z6u>|R6d7XgWr-2)D8uC#7Nth1ekNDNu&G#r#p;UGF0ze*{Zn(4+jOY}z&Q;*0KC6j z8|r5(0qcVME4XQMDRS%Fiu0sF+0i;92E!`*t|inc676lVXtzDxb6wWcmk^mcttlO0 zU2!ZISEtR;Fk~aAqXPhnp99iql6_{kHPl!?T{*9n^2TLkj*WHhTICwVN-B?$K_kaY zRi^fI%xJ~c^5SSn=!K*`^d{r!HKA&X3EqNuMkq9T1oQA(sZvh~ATe6mfNN?!J}SX3)fluy zyP2~EaMK)Ou}=_Hhab~_WQYL_;6R!&q``}Xo@OXaT0|Z*3g6X48kCrEb_D9<$nQ#LdawQ delta 933 zcmaFB*Uri9?&)S>nJCO4#Bg;Y_o2zW%;NQ24E78<3_t)9WnjB^V1B@gl^jtgB3sRJ zxFlKJjyUQ%Nct`Go>;UZWO{ek^dOTty}jmV()iCfPitV$yPeq76mW3WZT5x+C24yp zmO60}Aytk>W&s8k6EsR2dBqzhu*)l}&6Sa1Ff+H%>z|{_E?Y0F zYOqFFn8VCkhif&57{99Ao;}=>l_o3(!nY13x>bgfcsan=rRxvI0N1yHl5{qR1?_Iwy#YMyNK%0&T1S+9-DN zaFd2qDA->X6Bk^5FT%{&#(eTb#wMP+<_Yzj$uLLbst73<;Z#9u%-sKy*u1onftUjQGPWMwgOo zde>fCrcCO>5I3?EP;uEq%1ky*9JyXA)`w&;_TXHiw8~TxTp63xrH);73BT;O{p$A* zct5;8@9(-7>nfges(=#ATfoG`#F3#dp5AkGW@bkD#{1`fzBzRMr-u3s7cX8Mey`Pb z;L~f@uC;$6>>B)Lety2Er{~U{JKs*;YH4XnCX-jMUiE(&A3k*|l}i0N5{SiO)3f)s zd~j-NYU*IyD+9+*{BXiuUS2*jGUER{GTPVX_xtzm-TS(I!#v-?9X*zqzB@NJH~keG zzWfW++}Zl^8E0qzjj3D7@V*N6c=4s{U!ik0Q+yo z9ZtqCgSVRcHnF2!0mUk&7ayqg;zXI+K{HTHuQWC8300r-$)9l_YZ?Os@psiFHn#(c zT!2dSBPf)hJwy?`wnA#9Sv{!vFa?s_goXmS8ftsAOR|E{y3MqJ4>dLvaDV}M$f}j~ zc}^I)qQXd;S~IxLm$TDgv!&jW;4*Cm2)7}DgAiHG*xO+5jeJa9-^=i$gj)9N-DSf< zsUKAqt%^Ikb0CdMXTx_6L^mqsY7ibPJg-<%XpDyFU`-s8n>cr3b{z^=nqtj5E%*(r z*i6@)jJCUES0FA$hlKNbEy5XT5rv0TH<9G*g9Nb@ZVvUnW@TXYjOESlQfrQP@VW$j z2u_j(hXNSLK&}X`8SKXka3@c*I^EjzEES7j6rH*4;ypZ~R659B8usbs#M_#50${8X z8wG8@R|UMK1YjI+td4zZHAS|suDd|$h-00aaTr$E4p&mM2p{R9EII#a*^;$%Cj^=m z@u!_oqzcEB88eh*X_b!dBQ*%h=n-S5#w~EZgV;u`%T$%*pP)<}7~Vd}AC_-DWH*pj zSSn&O8^Tr(VN};MRR*s_siZS@S8!S((IN591& zr0{Pl4bTomZ6xfj$>;%8Nzom*A&w3f8eBnha)*@AQb8c@F@UM|x!hEOsa5IJc%PZA z_G88}`~`PVPz*uPqM-yx00yL@;q#z@KTW3u;3+V6)8p zs?m~mcasoBiQ?ju+rqoqOGnI0&_^qJn14~u0`_M>lYqdiMaO_PUg(lwm7m!tCxem2 mjZHTxCz_KhT^|I7d}{zx7`66R!Ar}Q>Vk15wcN*mHU9txbjv&d delta 945 zcmaFP*U!oA?&)S>nJCO4#Bg;Y_o2zW%;NQ24E78<3_t)9Wng=GAYLz7GDE9rT2a`- zzw^#>XK-biD)r?wIwm;O3%$CsFep|}E6(d;L)Y?YoB!A(*xy$;QNt%JQpb>_W>C!B z)}|zF&#lYO&YvzKq{`9GEWp5G!lo}ijbD~iNMOkl24h=M-g(m**yWYgmdeO5nAMwG z=uKau$}TIbYOqCEn8VCkhify37{99Akt5uabtWtZ!iQxpa^K}<5Yx4^*HhxYbMKyr zqJEscAd8*I%U2?jjJlcu9##yWMHn<0I36}SwCdaMVBu&4dWc0)XMutO)5FQKMl5?A z4sL8?VAav7yQ!4i#=}-Gz{bd+_>+Zo@^Lo4dN#uY_xS@pDYWco=P23mN38w4mZD^Z z!*b!N%94o&okE-{M@!`RPbOx5;?SJQuGw4@+yvGv0t!1824)5>25w;3`5%~nL8&rA z;LsDri-wJIp8PLddK($`H>S8Oou#vX0_SC0SpfmhM=CaJ9i|9m9Q~K**4|pR<A%D+F-1ZTUU`tpbmM{S=;Q?CWePDh7ha^wyyyK6*bI8go zTv%VcfrEb%i`$F|0d?Jn(|=eNv|LK$DXA;z+sMq2#FX3mn8&H6f2y+_duCvu7>8U( z2fvCvgL`~JJk0!hurFX11OY9m*vZo>*8L>iQAV--$a$734qv$oo)XNAb<8I-DvTo6 z9lv}~b0S~3f)~e@TU^Jxzh$T%QBe`*7gBSQ<&;(77KZpj!JgZFioFQj9-uYM3`{^@ z@B;l2bzpu0hon@iILpg=M@gCb?o0e3n=IO=1U+x}oMGeaz?mX5(;|Q~Bh>7mK-4#Z z%ZX8ZG0AV(A5{Cu$~$Q*s5r|o@UwGDD6@0833DqZEAVss*YK+4h{1@Wx#64FeezvoSv*YAIHep{j&ja&6IH_>; zAAKaqrco)-{G$H{LnEKq%Y?!oYlMV2R9-Q19!%nJH?o>;A;ZD> Date: Sat, 18 Jul 2009 13:03:45 +0000 Subject: [PATCH 247/607] fix r9775 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9780 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 5fdf3fd825..0ddf8603fc 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1470,6 +1470,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, $user->session_id) : '', 'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), + 'U_PROFILE' => $user_cache[$poster_id]['profile'], 'U_SEARCH' => $user_cache[$poster_id]['search'], 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']) : '', 'U_EMAIL' => $user_cache[$poster_id]['email'], From b6a1271c3aedab008be367565db9c9713e22e638 Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Sat, 18 Jul 2009 19:19:38 +0000 Subject: [PATCH 248/607] - added ability to filter logs by log_operation git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9781 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_logs.html | 8 +++- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_logs.php | 62 +++++++++++++++++++++++++++++- phpBB/includes/functions_admin.php | 5 ++- phpBB/language/en/acp/common.php | 3 ++ 5 files changed, 75 insertions(+), 4 deletions(-) diff --git a/phpBB/adm/style/acp_logs.html b/phpBB/adm/style/acp_logs.html index 155917e84f..843aa21c63 100644 --- a/phpBB/adm/style/acp_logs.html +++ b/phpBB/adm/style/acp_logs.html @@ -8,12 +8,18 @@
      +
      + {L_SELECT_LANG_KEY}:   +
      + -
      diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html index fc3e4c119f..ebcdf2d76b 100644 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ b/phpBB/styles/subsilver2/template/ucp_register.html @@ -32,11 +32,6 @@ {L_REG_COND} - - - {L_ITEMS_REQUIRED} - - {L_USERNAME}:
      {L_USERNAME_EXPLAIN} @@ -66,6 +61,10 @@ {L_TIMEZONE}: + + + {L_ITEMS_REQUIRED} + @@ -77,6 +76,7 @@ + From 21094ac790ff2206cf8e07b89b7d5130db63e03c Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 19 Jul 2009 11:34:01 +0000 Subject: [PATCH 264/607] Copy poll options properly when copying topic. #39065 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9797 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/mcp/mcp_main.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 02050416b8..a81c6d919c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -167,6 +167,7 @@
    676. [Fix] Permit null values for non-required integer custom profile fields and ensure zero complies with the range limits. (Bug #40925)
    677. [Fix] Allow changing forum from select box under certain circumstances. (Bug #37525)
    678. [Fix] Display required fields notice on registration above the custom profile fields. (Bug #39665)
    679. +
    680. [Fix] Copy poll options properly when copying topic. (Bug #39065)
    681. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    682. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    683. [Change] Template engine now permits to a limited extent variable includes.
    684. diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 0dfe3b0086..3c265d56da 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1064,7 +1064,9 @@ function mcp_fork_topic($topic_ids) 'topic_bumper' => (int) $topic_row['topic_bumper'], 'poll_title' => (string) $topic_row['poll_title'], 'poll_start' => (int) $topic_row['poll_start'], - 'poll_length' => (int) $topic_row['poll_length'] + 'poll_length' => (int) $topic_row['poll_length'], + 'poll_max_options' => (int) $topic_row['poll_max_options'], + 'poll_vote_change' => (int) $topic_row['poll_vote_change'], ); $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); From 76508b59d71f5c9943256045a4677888aca2464c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 19 Jul 2009 11:41:57 +0000 Subject: [PATCH 265/607] QR changes to let the options actually work (we use checkboxes and isset()) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9798 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 47 ++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index f3f6923381..69267f08dc 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1435,7 +1435,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) { $s_first_unread = $first_unread = true; } - + // $postrow = array( @@ -1614,41 +1614,44 @@ else if (!$all_marked_read) // let's set up quick_reply // TODO: introduce a per-forum and a per-user setting -$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id) ; -if ($s_can_vote || $s_quick_reply ) +$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id); + +if ($s_can_vote || $s_quick_reply) { add_form_key('posting'); + if ($s_quick_reply) { - - $s_attach_sig = $config['allow_sig'] && strlen($user->data['user_sig']) && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); - $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); - $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); - $s_notify = $config['allow_topic_notify'] && $user->data['user_notify']; + $s_attach_sig = $config['allow_sig'] && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); + $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); + $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); + $s_notify = $config['allow_topic_notify'] && $user->data['user_notify']; + $qr_hidden_fields = array( - 'topic_cur_post_id' => $topic_data['topic_last_post_id'], - 'lastclick' => time(), - 'topic_id' => $topic_data['topic_id'], - 'forum_id' => $forum_id, - 'disable_bbcode' => !$s_bbcode, - 'disable_smilies' => !$s_smilies, - 'disable_magic_url' => !$config['allow_post_links'], - 'attach_sig' => $s_attach_sig, - 'notify' => $s_notify, + 'topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], + 'lastclick' => (int) time(), + 'topic_id' => (int) $topic_data['topic_id'], + 'forum_id' => (int) $forum_id, ); - + + // Originally we use checkboxes and check with isset(), so we only provide them if they would be checked + (!$s_bbcode) ? $qr_hidden_fields['disable_bbcode'] = 1 : true; + (!$s_smilies) ? $qr_hidden_fields['disable_smilies'] = 1 : true; + (!$config['allow_post_links']) ? $qr_hidden_fields['disable_magic_url'] = 1 : true; + ($s_attach_sig) ? $qr_hidden_fields['attach_sig'] = 1 : true; + ($s_notify) ? $qr_hidden_fields['notify'] = 1 : true; + $template->assign_vars(array( - 'S_QUICK_REPLY' => true, + 'S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'SUBJECT' => 'Re: ' . censor_text($topic_data['topic_title']), - )); } } // now I have the urge to wash my hands :( - - + + // We overwrite $_REQUEST['f'] if there is no forum specified // to be able to display the correct online list. // One downside is that the user currently viewing this topic/post is not taken into account. From e7a17a34295106391cb1803070dccb9e7a419d86 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 19 Jul 2009 22:21:50 +0000 Subject: [PATCH 266/607] Set some svn properties. Cleanup. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9799 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/captcha_default_acp_demo.html | 3 +-- phpBB/adm/style/captcha_qa_acp_demo.html | 4 +-- phpBB/adm/style/captcha_recaptcha.html | 22 ++++++++-------- phpBB/language/en/captcha_qa.php | 6 ++--- phpBB/language/en/recaptcha.php | 3 +-- .../styles/prosilver/template/captcha_qa.html | 4 +-- .../prosilver/template/captcha_recaptcha.html | 25 +++++++++---------- .../prosilver/template/quickreply_editor.html | 1 - 8 files changed, 30 insertions(+), 38 deletions(-) diff --git a/phpBB/adm/style/captcha_default_acp_demo.html b/phpBB/adm/style/captcha_default_acp_demo.html index a714386e51..0b1434f7e0 100644 --- a/phpBB/adm/style/captcha_default_acp_demo.html +++ b/phpBB/adm/style/captcha_default_acp_demo.html @@ -1,5 +1,4 @@ -

      {L_CAPTCHA_PREVIEW_EXPLAIN}
      {L_PREVIEW}
      -
      \ No newline at end of file + diff --git a/phpBB/adm/style/captcha_qa_acp_demo.html b/phpBB/adm/style/captcha_qa_acp_demo.html index 919d4d48d5..474dfc58ea 100644 --- a/phpBB/adm/style/captcha_qa_acp_demo.html +++ b/phpBB/adm/style/captcha_qa_acp_demo.html @@ -1,7 +1,7 @@

      {L_CONFIRM_QUESTION_EXPLAIN}
      - +
      - +
      diff --git a/phpBB/adm/style/captcha_recaptcha.html b/phpBB/adm/style/captcha_recaptcha.html index 0cb43cf01f..93fc6e7499 100644 --- a/phpBB/adm/style/captcha_recaptcha.html +++ b/phpBB/adm/style/captcha_recaptcha.html @@ -1,5 +1,5 @@ -
      +
      - - -
      {L_RECAPTCHA_NOT_AVAILABLE} - \ No newline at end of file + diff --git a/phpBB/language/en/captcha_qa.php b/phpBB/language/en/captcha_qa.php index 1eee68fb96..ac1aa4ab1c 100644 --- a/phpBB/language/en/captcha_qa.php +++ b/phpBB/language/en/captcha_qa.php @@ -4,8 +4,8 @@ * recaptcha [English] * * @package language -* @version $Id: recaptcha.php 9709 2009-06-30 14:23:16Z Kellanved $ -* @copyright (c) 2008 phpBB Group +* @version $Id$ +* @copyright (c) 2009 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ @@ -57,8 +57,6 @@ $lang = array_merge($lang, array( 'QUESTION_TEXT_EXPLAIN' => 'The question that will be asked on registration.', 'QA_ERROR_MSG' => 'Please fill out all fields and enter at least one answer.', - - )); ?> \ No newline at end of file diff --git a/phpBB/language/en/recaptcha.php b/phpBB/language/en/recaptcha.php index e0c3db98b7..25802d3a9f 100644 --- a/phpBB/language/en/recaptcha.php +++ b/phpBB/language/en/recaptcha.php @@ -5,7 +5,7 @@ * * @package language * @version $Id$ -* @copyright (c) 2008 phpBB Group +* @copyright (c) 2009 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ @@ -47,7 +47,6 @@ $lang = array_merge($lang, array( 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. You can obtain keys from reCaptcha.net.', 'RECAPTCHA_EXPLAIN' => 'To avoid spam postings, please enter the two words shown in the picture into the text field underneath.', - )); ?> \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/captcha_qa.html b/phpBB/styles/prosilver/template/captcha_qa.html index 52df6fac4a..e363ee008d 100644 --- a/phpBB/styles/prosilver/template/captcha_qa.html +++ b/phpBB/styles/prosilver/template/captcha_qa.html @@ -4,11 +4,10 @@

      {L_CONFIRMATION}

      -
      -
      :
      {L_CONFIRM_QUESTION_EXPLAIN}
      +
      :
      {L_CONFIRM_QUESTION_EXPLAIN}
      @@ -20,4 +19,3 @@ - diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index 431124a210..510a1d3124 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -6,13 +6,13 @@

      {L_CONFIRM_EXPLAIN}

      - +
      -
      :
      {L_RECAPTCHA_EXPLAIN}
      +
      :
      {L_RECAPTCHA_EXPLAIN}
      - + - - -
      {L_RECAPTCHA_NOT_AVAILABLE} +
      - diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index 22d90cdd90..4fca4b0dfd 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -11,7 +11,6 @@ // ]]>
      -
      From b3767cd1436bf2b579ad2e0c1c17f55881d4dc4e Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Mon, 20 Jul 2009 00:57:18 +0000 Subject: [PATCH 267/607] - added filtration ability to MCP - added missing lang variable - fixed a pagination bug in filtration routines git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9800 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/includes/acp/acp_logs.php | 6 +++- phpBB/includes/functions_admin.php | 3 +- phpBB/includes/mcp/mcp_logs.php | 36 ++++++++++++++++++- phpBB/includes/mcp/mcp_notes.php | 22 +++++++++++- phpBB/language/en/acp/common.php | 2 ++ phpBB/styles/prosilver/template/mcp_logs.html | 3 ++ .../prosilver/template/mcp_notes_user.html | 3 ++ .../styles/subsilver2/template/mcp_logs.html | 3 ++ .../subsilver2/template/mcp_notes_user.html | 3 ++ 10 files changed, 78 insertions(+), 5 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a81c6d919c..2e81cb13ce 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -215,7 +215,7 @@
    685. [Feature] Add option to disable remote upload avatars (Bug #45375 - Patch by nickvergessen)
    686. [Feature] Ability to delete warnings and keep warnings permanently (Bug #43375 - Patch by nickvergessen)
    687. [Feature] Ability to empty a user's outbox from the user ACP quick tools.
    688. -
    689. [Feature] Ability to filter ACP logs
    690. +
    691. [Feature] Ability to filter ACP / MCP logs
    692. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index c44592a23c..f13979ec0f 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -158,8 +158,12 @@ class acp_logs $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { + if (empty($row['log_operation'])) + { + continue; + } $selected = ($log_operation == $row['log_operation']) ? ' selected="selected"' : ''; - $s_lang_keys .= ''; + $s_lang_keys .= ''; } $db->sql_freeresult($result); diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index dd6378a2b5..ff7f687945 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2499,7 +2499,8 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id $sql = 'SELECT COUNT(l.log_id) AS total_entries FROM ' . LOG_TABLE . " l WHERE l.log_type = $log_type - AND l.log_time >= $limit_days + AND l.log_time >= $limit_days " . + (!empty($log_operation) ? "AND l.log_operation = '" . $db->sql_escape($log_operation) . "'" : '') . " $sql_forum"; $result = $db->sql_query($sql); $log_count = (int) $db->sql_fetchfield('total_entries'); diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index a6b1935c88..b83e364811 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -164,10 +164,43 @@ class mcp_logs $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + $log_operation = request_var('log_operation', ''); + $s_lang_keys = ''; + + if ($topic_id) + { + $sql_forum = 'AND topic_id = ' . intval($topic_id); + } + else if (is_array($forum_id)) + { + $sql_forum = 'AND ' . $db->sql_in_set('forum_id', array_map('intval', $forum_id)); + } + else + { + $sql_forum = ($forum_id) ? 'AND forum_id = ' . intval($forum_id) : ''; + } + + $sql = "SELECT DISTINCT log_operation + FROM " . LOG_TABLE . ' + WHERE log_type = ' . LOG_MOD . ' + ' . (($limit_days) ? "AND log_time >= $sql_where " : ' ') . + $sql_forum; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + if (empty($row['log_operation'])) + { + continue; + } + $selected = ($log_operation == $row['log_operation']) ? ' selected="selected"' : ''; + $s_lang_keys .= ''; + } + $db->sql_freeresult($result); + // Grab log data $log_data = array(); $log_count = 0; - view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort); + view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $log_operation); $template->assign_vars(array( 'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start), @@ -181,6 +214,7 @@ class mcp_logs 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_LANG_KEYS' => $s_lang_keys, 'S_LOGS' => ($log_count > 0), ) ); diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index 7480b24a46..d07874524a 100644 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -193,9 +193,28 @@ class mcp_notes $sql_where = ($st) ? (time() - ($st * 86400)) : 0; $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC'); + $log_operation = request_var('log_operation', ''); + $s_lang_keys = ''; + + $sql = "SELECT DISTINCT log_operation + FROM " . LOG_TABLE . ' + WHERE log_type = ' . LOG_USERS . + (($limit_days) ? " AND log_time >= $sql_where" : ''); + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + if (empty($row['log_operation'])) + { + continue; + } + $selected = ($log_operation == $row['log_operation']) ? ' selected="selected"' : ''; + $s_lang_keys .= ''; + } + $db->sql_freeresult($result); + $log_data = array(); $log_count = 0; - view_log('user', $log_data, $log_count, $config['posts_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); + view_log('user', $log_data, $log_count, $config['posts_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort, $log_operation); if ($log_count) { @@ -219,6 +238,7 @@ class mcp_notes 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_LANG_KEYS' => $s_lang_keys, 'L_TITLE' => $user->lang['MCP_NOTES_USER'], diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index b1d722a006..55eadc8341 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -281,6 +281,8 @@ $lang = array_merge($lang, array( 'SETTING_TOO_LONG' => 'The entered value for the setting “%1$s” is too long. The maximal allowed length is %2$d.', 'SETTING_TOO_SHORT' => 'The entered value for the setting “%1$s” is not long enough. The minimal allowed length is %2$d.', + 'SHOW_ALL_OPERATIONS' => 'Show all operations', + 'UCP' => 'User Control Panel', 'USERNAMES_EXPLAIN' => 'Place each username on a separate line.', 'USER_CONTROL_PANEL' => 'User Control Panel', diff --git a/phpBB/styles/prosilver/template/mcp_logs.html b/phpBB/styles/prosilver/template/mcp_logs.html index bf1e867be3..ef2b4f4ab6 100644 --- a/phpBB/styles/prosilver/template/mcp_logs.html +++ b/phpBB/styles/prosilver/template/mcp_logs.html @@ -8,6 +8,9 @@

      {L_ANSWERS_EXPLAIN}
      -
      +
      From 354cab397f72f4485101b4e1ca541d229d2b2455 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 20 Jul 2009 12:46:24 +0000 Subject: [PATCH 273/607] cleaning git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9806 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/captcha_qa_acp.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/captcha_qa_acp.html b/phpBB/adm/style/captcha_qa_acp.html index 7cb563dae6..6913915892 100644 --- a/phpBB/adm/style/captcha_qa_acp.html +++ b/phpBB/adm/style/captcha_qa_acp.html @@ -52,7 +52,7 @@

      {L_WARNING}

      -

      {QA_ERROR_MSG}

      +

      {L_QA_ERROR_MSG}

      From 2dbf5fd1a2ac3db106abfb768fe629f66cb328d9 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 20 Jul 2009 12:47:45 +0000 Subject: [PATCH 274/607] cleaning git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9807 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/captcha_qa_acp.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/captcha_qa_acp.html b/phpBB/adm/style/captcha_qa_acp.html index 6913915892..d069233ccd 100644 --- a/phpBB/adm/style/captcha_qa_acp.html +++ b/phpBB/adm/style/captcha_qa_acp.html @@ -70,7 +70,7 @@

      {L_QUESTION_TEXT_EXPLAIN}
      -
      +

      {L_ANSWERS_EXPLAIN}
      From 783da3064a2a4e7163230b75cacb6ef7073493dc Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 20 Jul 2009 18:27:26 +0000 Subject: [PATCH 275/607] rename variables to avoid name clashes in aggregating plugins git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9808 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../plugins/phpbb_captcha_qa_plugin.php | 18 ++++++++++-------- .../styles/prosilver/template/captcha_qa.html | 6 +++--- .../styles/subsilver2/template/captcha_qa.html | 6 +++--- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index fdbbf1d218..cd5ee8c91d 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -50,10 +50,11 @@ class phpbb_captcha_qa { global $config, $db, $user; + // load our language file $user->add_lang('captcha_qa'); // read input - $this->confirm_id = request_var('confirm_id', ''); - $this->answer = request_var('answer', ''); + $this->confirm_id = request_var('qa_confirm_id', ''); + $this->answer = request_var('qa_answer', ''); $this->type = (int) $type; $this->question_lang = $user->data['user_lang']; @@ -118,6 +119,7 @@ class phpbb_captcha_qa { global $config, $db, $phpbb_root_path, $phpEx, $user; + // load language file for pretty display in the ACP dropdown $user->add_lang('captcha_qa'); if (!self::is_installed()) @@ -170,8 +172,8 @@ class phpbb_captcha_qa global $template; $template->assign_vars(array( - 'CONFIRM_QUESTION' => $this->question_text, - 'CONFIRM_ID' => $this->confirm_id, + 'QA_CONFIRM_QUESTION' => $this->question_text, + 'QA_CONFIRM_ID' => $this->confirm_id, 'S_CONFIRM_CODE' => true, 'S_TYPE' => $this->type, )); @@ -197,9 +199,9 @@ class phpbb_captcha_qa // this is required - otherwise we would forget about the captcha being already solved if ($this->solved) { - $hidden_fields['answer'] = $this->answer; + $hidden_fields['qa_answer'] = $this->answer; } - $hidden_fields['confirm_id'] = $this->confirm_id; + $hidden_fields['qa_confirm_id'] = $this->confirm_id; return $hidden_fields; } @@ -447,7 +449,7 @@ class phpbb_captcha_qa { global $db; - $answer = ($this->question_strict) ? request_var('answer', '') : utf8_clean_string(request_var('answer', '')); + $answer = ($this->question_strict) ? request_var('qa_answer', '') : utf8_clean_string(request_var('qa_answer', '')); $sql = 'SELECT answer_text FROM ' . ANSWERS_TABLE . ' @@ -509,7 +511,7 @@ class phpbb_captcha_qa */ function is_solved() { - if (request_var('answer', false) && $this->solved === 0) + if (request_var('qa_answer', false) && $this->solved === 0) { $this->validate(); } diff --git a/phpBB/styles/prosilver/template/captcha_qa.html b/phpBB/styles/prosilver/template/captcha_qa.html index e363ee008d..375ae401a4 100644 --- a/phpBB/styles/prosilver/template/captcha_qa.html +++ b/phpBB/styles/prosilver/template/captcha_qa.html @@ -7,10 +7,10 @@
      -
      :
      {L_CONFIRM_QUESTION_EXPLAIN}
      +
      :
      {L_CONFIRM_QUESTION_EXPLAIN}
      - - + +
      diff --git a/phpBB/styles/subsilver2/template/captcha_qa.html b/phpBB/styles/subsilver2/template/captcha_qa.html index 08b267b8fb..1711bdb90d 100644 --- a/phpBB/styles/subsilver2/template/captcha_qa.html +++ b/phpBB/styles/subsilver2/template/captcha_qa.html @@ -1,5 +1,5 @@ - {CONFIRM_QUESTION}:
      - - + {QA_CONFIRM_QUESTION}:
      + + \ No newline at end of file From 3a3872766177c30c580353c2946b0d308685a2c5 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 21 Jul 2009 10:26:18 +0000 Subject: [PATCH 276/607] copy regiustration attempt setting to acp_captcha - although the setting is pointless git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9809 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_captcha.html | 4 ++++ phpBB/includes/acp/acp_captcha.php | 16 ++++++++-------- phpBB/language/en/acp/board.php | 2 +- phpBB/language/en/acp/common.php | 4 ++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/phpBB/adm/style/acp_captcha.html b/phpBB/adm/style/acp_captcha.html index 290aaa254c..3d87aa89ec 100644 --- a/phpBB/adm/style/acp_captcha.html +++ b/phpBB/adm/style/acp_captcha.html @@ -17,6 +17,10 @@
      +
      +

      {L_REG_LIMIT_EXPLAIN}
      +
      +

      {L_VISUAL_CONFIRM_POST_EXPLAIN}
      diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 2fc8fe7486..c3588ceb9e 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -52,9 +52,10 @@ class acp_captcha $captchas = phpbb_captcha_factory::get_captcha_types(); $config_vars = array( - 'enable_confirm' => 'REG_ENABLE', - 'enable_post_confirm' => 'POST_ENABLE', - 'confirm_refresh' => 'CONFIRM_REFRESH', + 'enable_confirm' => array('tpl' => 'REG_ENABLE', 'default' => false), + 'enable_post_confirm' => array('tpl' => 'POST_ENABLE', 'default' => false), + 'confirm_refresh' => array('tpl' => 'CONFIRM_REFRESH', 'default' => false), + 'max_reg_attempts' => array('tpl' => 'REG_LIMIT', 'default' => 0), ); $this->tpl_name = 'acp_captcha'; @@ -67,10 +68,9 @@ class acp_captcha if ($submit && check_form_key($form_key)) { $config_vars = array_keys($config_vars); - - foreach ($config_vars as $config_var) + foreach ($config_vars as $config_var => $options) { - set_config($config_var, request_var($config_var, false)); + set_config($config_var, request_var($config_var, $options['default'])); } if ($selected !== $config['captcha_plugin']) @@ -115,9 +115,9 @@ class acp_captcha $demo_captcha =& phpbb_captcha_factory::get_instance($selected); - foreach ($config_vars as $config_var => $template_var) + foreach ($config_vars as $config_var => $options) { - $template->assign_var($template_var, (isset($_REQUEST[$config_var])) ? request_var($config_var, '') : $config[$config_var]) ; + $template->assign_var($options['tpl'], (isset($_POST[$config_var])) ? request_var($config_var, $options['default']) : $config[$config_var]) ; } $template->assign_vars(array( diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index c240aeee55..bebc9e3435 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -274,7 +274,7 @@ $lang = array_merge($lang, array( // Visual Confirmation Settings $lang = array_merge($lang, array( - 'ACP_VC_SETTINGS_EXPLAIN' => 'Here you are able to define visual confirmation defaults and CAPTCHA settings.', + 'ACP_VC_SETTINGS_EXPLAIN' => 'Here you can select and configure CAPTCHA plugins, which implement various ways to reject registration attempts from so-called spambots.', 'AVAILABLE_CAPTCHAS' => 'Available plugins', 'CAPTCHA_UNAVAILABLE' => 'The CAPTCHA cannot be selected as its requirements are not met.', 'CAPTCHA_GD' => 'GD CAPTCHA', diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 55eadc8341..9a7fda5951 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -188,7 +188,7 @@ $lang = array_merge($lang, array( 'ACP_USER_SIG' => 'Signature', 'ACP_USER_WARNINGS' => 'Warnings', - 'ACP_VC_SETTINGS' => 'Visual confirmation settings', + 'ACP_VC_SETTINGS' => 'CAPTCHA module settings', 'ACP_VC_CAPTCHA_DISPLAY' => 'CAPTCHA image preview', 'ACP_VERSION_CHECK' => 'Check for updates', 'ACP_VIEW_ADMIN_PERMISSIONS' => 'View administrative permissions', @@ -493,7 +493,7 @@ $lang = array_merge($lang, array( 'LOG_CONFIG_SERVER' => 'Altered server settings', 'LOG_CONFIG_SETTINGS' => 'Altered board settings', 'LOG_CONFIG_SIGNATURE' => 'Altered signature settings', - 'LOG_CONFIG_VISUAL' => 'Altered visual confirmation settings', + 'LOG_CONFIG_VISUAL' => 'Altered antibot settings', 'LOG_APPROVE_TOPIC' => 'Approved topic
      » %s', 'LOG_BUMP_TOPIC' => 'User bumped topic
      » %s', From 269c2c294457d0f31348f6bcd805f6800fd3087d Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 21 Jul 2009 10:52:38 +0000 Subject: [PATCH 277/607] fix back link git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9810 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/captcha_qa_acp.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/captcha_qa_acp.html b/phpBB/adm/style/captcha_qa_acp.html index d069233ccd..064d6969d1 100644 --- a/phpBB/adm/style/captcha_qa_acp.html +++ b/phpBB/adm/style/captcha_qa_acp.html @@ -3,7 +3,7 @@ - « {L_BACK} + « {L_BACK}

      {L_QUESTIONS}

      @@ -57,7 +57,7 @@
      - {L_QUESTIONS} + {L_EDIT_QUESTION}

      {L_QUESTION_STRICT_EXPLAIN}
      From b613781d3af6d7c5e5d9d0fa1592e78b54647c0f Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 21 Jul 2009 10:58:31 +0000 Subject: [PATCH 278/607] Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9811 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_template.php | 11 +++++++++-- phpBB/includes/template.php | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 2e81cb13ce..a0cc54f308 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -168,6 +168,7 @@
    693. [Fix] Allow changing forum from select box under certain circumstances. (Bug #37525)
    694. [Fix] Display required fields notice on registration above the custom profile fields. (Bug #39665)
    695. [Fix] Copy poll options properly when copying topic. (Bug #39065)
    696. +
    697. [Fix] Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags)
    698. [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    699. [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    700. [Change] Template engine now permits to a limited extent variable includes.
    701. diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index a951579db5..1d3a4d74f8 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -251,15 +251,22 @@ class template_compile $template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : ''); } + // Remove unused opening/closing tags + $template_php = str_replace(' ?>([\r\n])#', '?>\1\1', $template_php); + // There will be a number of occasions where we switch into and out of // PHP mode instantaneously. Rather than "burden" the parser with this // we'll strip out such occurences, minimising such switching if ($no_echo) { - return "\$$echo_var .= '" . str_replace(' ?>root = $template_path; $this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_'; + $this->_rootref = &$this->_tpldata['.'][0]; + return true; } From 0ee8d7ab15caae94cdd381e9f449713c8838b611 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 21 Jul 2009 20:30:50 +0000 Subject: [PATCH 280/607] increase default maximum pass chars to 100 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9813 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/schemas/schema_data.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 5799abcff7..8a83225b1b 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -175,7 +175,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_filesize_pm', INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_login_attempts', '3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_name_chars', '20'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_num_search_keywords', '10'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_pass_chars', '30'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_pass_chars', '100'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_poll_options', '10'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_chars', '60000'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_font_size', '200'); From 6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 21 Jul 2009 20:59:11 +0000 Subject: [PATCH 281/607] Users can report PMs to moderators which are then visible in a new MCP module git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9814 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 6 + phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_board.php | 1 + phpBB/includes/functions_privmsgs.php | 92 ++++- phpBB/includes/mcp/info/mcp_pm_reports.php | 39 +++ phpBB/includes/mcp/mcp_front.php | 92 +++++ phpBB/includes/mcp/mcp_pm_reports.php | 323 ++++++++++++++++++ phpBB/includes/mcp/mcp_reports.php | 172 +++++++--- phpBB/includes/ucp/ucp_pm_viewfolder.php | 73 +--- phpBB/includes/ucp/ucp_pm_viewmessage.php | 2 + phpBB/install/database_update.php | 65 ++++ phpBB/install/schemas/firebird_schema.sql | 6 +- phpBB/install/schemas/mssql_schema.sql | 10 +- phpBB/install/schemas/mysql_40_schema.sql | 6 +- phpBB/install/schemas/mysql_41_schema.sql | 6 +- phpBB/install/schemas/oracle_schema.sql | 6 + phpBB/install/schemas/postgres_schema.sql | 4 + phpBB/install/schemas/schema_data.sql | 1 + phpBB/install/schemas/sqlite_schema.sql | 6 +- phpBB/language/en/acp/board.php | 2 + phpBB/language/en/acp/common.php | 3 + phpBB/language/en/email/pm_report_closed.txt | 8 + phpBB/language/en/email/pm_report_deleted.txt | 8 + phpBB/language/en/mcp.php | 36 +- phpBB/mcp.php | 83 ++++- phpBB/report.php | 171 +++++++--- .../styles/prosilver/template/mcp_front.html | 41 +++ phpBB/styles/prosilver/template/mcp_post.html | 15 +- .../prosilver/template/mcp_reports.html | 15 +- .../template/ucp_pm_viewmessage.html | 3 +- .../styles/subsilver2/template/mcp_front.html | 37 ++ .../styles/subsilver2/template/mcp_post.html | 33 +- .../subsilver2/template/mcp_reports.html | 14 +- .../subsilver2/template/report_body.html | 4 +- .../template/ucp_pm_viewmessage.html | 2 +- 35 files changed, 1173 insertions(+), 213 deletions(-) create mode 100644 phpBB/includes/mcp/info/mcp_pm_reports.php create mode 100644 phpBB/includes/mcp/mcp_pm_reports.php create mode 100644 phpBB/language/en/email/pm_report_closed.txt create mode 100644 phpBB/language/en/email/pm_report_deleted.txt diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 42f6251f67..ab021a15ec 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1332,6 +1332,7 @@ function get_schema_struct() 'message_edit_count' => array('USINT', 0), 'to_address' => array('TEXT_UNI', ''), 'bcc_address' => array('TEXT_UNI', ''), + 'message_reported' => array('BOOL', 0), ), 'PRIMARY_KEY' => 'msg_id', 'KEYS' => array( @@ -1465,6 +1466,7 @@ function get_schema_struct() 'report_id' => array('UINT', NULL, 'auto_increment'), 'reason_id' => array('USINT', 0), 'post_id' => array('UINT', 0), + 'pm_id' => array('UINT', 0), 'user_id' => array('UINT', 0), 'user_notify' => array('BOOL', 0), 'report_closed' => array('BOOL', 0), @@ -1472,6 +1474,10 @@ function get_schema_struct() 'report_text' => array('MTEXT_UNI', ''), ), 'PRIMARY_KEY' => 'report_id', + 'KEYS' => array( + 'post_id' => array('INDEX', 'post_id'), + 'pm_id' => array('INDEX', 'pm_id'), + ), ); $schema_data['phpbb_reports_reasons'] = array( diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a0cc54f308..8b5da10c72 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -217,6 +217,7 @@
    702. [Feature] Ability to delete warnings and keep warnings permanently (Bug #43375 - Patch by nickvergessen)
    703. [Feature] Ability to empty a user's outbox from the user ACP quick tools.
    704. [Feature] Ability to filter ACP / MCP logs
    705. +
    706. [Feature] Users can report PMs to moderators which are then visible in a new MCP module
    707. 1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 5966d5a4b2..3a2ad6f89a 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -81,6 +81,7 @@ class acp_board 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 8851b53680..883d8ff13f 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1405,7 +1405,8 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) 'bbcode_bitfield' => $data['bbcode_bitfield'], 'bbcode_uid' => $data['bbcode_uid'], 'to_address' => implode(':', $to), - 'bcc_address' => implode(':', $bcc) + 'bcc_address' => implode(':', $bcc), + 'message_reported' => 0, ); break; @@ -1880,4 +1881,93 @@ function set_user_message_limit() $user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit; } +/** +* Generates an array of coloured recipient names from a list of PMs - (groups & users) +* +* @param array $pm_by_id An array of rows from PRIVMSGS_TABLE, keys are the msg_ids. +* +* @return array 2D Array: array(msg_id => array('username or group string', ...), ...) +* Usernames are generated with {@link get_username_string get_username_string} +* Groups are coloured and have a link to the membership page +*/ +function get_recipient_strings($pm_by_id) +{ + global $user, $db; + + $address_list = $recipient_list = $address = array(); + + $_types = array('u', 'g'); + + foreach ($pm_by_id as $message_id => $row) + { + $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); + + foreach ($_types as $ug_type) + { + if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) + { + foreach ($address[$message_id][$ug_type] as $ug_id => $in_to) + { + $recipient_list[$ug_type][$ug_id] = array('name' => $user->lang['NA'], 'colour' => ''); + } + } + } + } + + foreach ($_types as $ug_type) + { + if (!empty($recipient_list[$ug_type])) + { + if ($ug_type == 'u') + { + $sql = 'SELECT user_id as id, username as name, user_colour as colour + FROM ' . USERS_TABLE . ' + WHERE '; + } + else + { + $sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type + FROM ' . GROUPS_TABLE . ' + WHERE '; + } + $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type]))); + + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($ug_type == 'g') + { + $row['name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['name']] : $row['name']; + } + + $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); + } + $db->sql_freeresult($result); + } + } + + foreach ($address as $message_id => $adr_ary) + { + foreach ($adr_ary as $type => $id_ary) + { + foreach ($id_ary as $ug_id => $_id) + { + if ($type == 'u') + { + $address_list[$message_id][] = get_username_string('full', $ug_id, $recipient_list[$type][$ug_id]['name'], $recipient_list[$type][$ug_id]['colour']); + } + else + { + $user_colour = ($recipient_list[$type][$ug_id]['colour']) ? ' style="font-weight: bold; color:#' . $recipient_list[$type][$ug_id]['colour'] . '"' : ''; + $link = ''; + $address_list[$message_id][] = $link . $recipient_list[$type][$ug_id]['name'] . (($link) ? '' : ''); + } + } + } + } + + return $address_list; +} + ?> \ No newline at end of file diff --git a/phpBB/includes/mcp/info/mcp_pm_reports.php b/phpBB/includes/mcp/info/mcp_pm_reports.php new file mode 100644 index 0000000000..103f560597 --- /dev/null +++ b/phpBB/includes/mcp/info/mcp_pm_reports.php @@ -0,0 +1,39 @@ + 'mcp_pm_reports', + 'title' => 'MCP_PM_REPORTS', + 'version' => '1.0.0', + 'modes' => array( + 'pm_reports' => array('title' => 'MCP_PM_REPORTS_OPEN', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')), + 'pm_reports_closed' => array('title' => 'MCP_PM_REPORTS_CLOSED', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')), + 'pm_report_details' => array('title' => 'MCP_PM_REPORT_DETAILS', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')), + ), + ); + } + + function install() + { + } + + function uninstall() + { + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 05c1b796ac..ee75c1daff 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -152,6 +152,7 @@ function mcp_front_view($id, $mode, $action) $sql = 'SELECT COUNT(r.report_id) AS total FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p WHERE r.post_id = p.post_id + AND r.pm_id = 0 AND r.report_closed = 0 AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')'; $result = $db->sql_query($sql); @@ -181,6 +182,7 @@ function mcp_front_view($id, $mode, $action) ), 'WHERE' => 'r.post_id = p.post_id + AND r.pm_id = 0 AND r.report_closed = 0 AND r.reason_id = rr.reason_id AND p.topic_id = t.topic_id @@ -243,6 +245,96 @@ function mcp_front_view($id, $mode, $action) } } + // Latest 5 reported PMs + if ($module->loaded('pm_reports') && $auth->acl_getf_global('m_report')) + { + $template->assign_var('S_SHOW_PM_REPORTS', true); + + $sql = 'SELECT COUNT(r.report_id) AS total + FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . ' p + WHERE r.post_id = 0 + AND r.pm_id = p.msg_id + AND r.report_closed = 0'; + $result = $db->sql_query($sql); + $total = (int) $db->sql_fetchfield('total'); + $db->sql_freeresult($result); + + if ($total) + { + include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + $user->add_lang(array('ucp')); + + $sql = $db->sql_build_query('SELECT', array( + 'SELECT' => 'r.report_id, r.report_time, p.msg_id, p.message_subject, p.message_time, p.to_address, p.bcc_address, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id', + + 'FROM' => array( + REPORTS_TABLE => 'r', + REPORTS_REASONS_TABLE => 'rr', + USERS_TABLE => array('u', 'u2'), + PRIVMSGS_TABLE => 'p' + ), + + 'WHERE' => 'r.pm_id = p.msg_id + AND r.post_id = 0 + AND r.report_closed = 0 + AND r.reason_id = rr.reason_id + AND r.user_id = u.user_id + AND p.author_id = u2.user_id', + + 'ORDER_BY' => 'p.message_time DESC' + )); + $result = $db->sql_query_limit($sql, 5); + + $pm_by_id = $pm_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $pm_by_id[(int) $row['msg_id']] = $row; + $pm_list[] = (int) $row['msg_id']; + } + + $address_list = get_recipient_strings($pm_by_id); + + foreach ($pm_list as $message_id) + { + $row = $pm_by_id[$message_id]; + + $template->assign_block_vars('pm_report', array( + 'U_PM_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'r=' . $row['report_id'] . "&i=pm_reports&mode=pm_report_details"), + + 'REPORTER_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'REPORTER' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), + 'REPORTER_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), + 'U_REPORTER' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']), + + 'PM_AUTHOR_FULL' => get_username_string('full', $row['author_id'], $row['author_name'], $row['author_colour']), + 'PM_AUTHOR' => get_username_string('username', $row['author_id'], $row['author_name'], $row['author_colour']), + 'PM_AUTHOR_COLOUR' => get_username_string('colour', $row['author_id'], $row['author_name'], $row['author_colour']), + 'U_PM_AUTHOR' => get_username_string('profile', $row['author_id'], $row['author_name'], $row['author_colour']), + + 'PM_SUBJECT' => $row['message_subject'], + 'REPORT_TIME' => $user->format_date($row['report_time']), + 'PM_TIME' => $user->format_date($row['message_time']), + 'RECIPIENTS' => implode(', ', $address_list[$row['msg_id']]), + )); + } + } + + if ($total == 0) + { + $template->assign_vars(array( + 'L_REPORTS_TOTAL' => $user->lang['REPORTS_ZERO_TOTAL'], + 'S_HAS_PM_REPORTS' => false) + ); + } + else + { + $template->assign_vars(array( + 'L_REPORTS_TOTAL' => ($total == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total), + 'S_HAS_REPORTS' => true) + ); + } + } + // Latest 5 logs if ($module->loaded('logs')) { diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php new file mode 100644 index 0000000000..0e94d7e017 --- /dev/null +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -0,0 +1,323 @@ +p_master = &$p_master; + } + + function main($id, $mode) + { + global $auth, $db, $user, $template, $cache; + global $config, $phpbb_root_path, $phpEx, $action; + + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + + $start = request_var('start', 0); + + $this->page_title = 'MCP_PM_REPORTS'; + + switch ($action) + { + case 'close': + case 'delete': + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $report_id_list = request_var('report_id_list', array(0)); + + if (!sizeof($report_id_list)) + { + trigger_error('NO_REPORT_SELECTED'); + } + + if (!function_exists('close_report')) + { + include($phpbb_root_path . 'includes/mcp/mcp_reports.' . $phpEx); + } + + close_report($report_id_list, $mode, $action, true); + + break; + } + + switch ($mode) + { + case 'pm_report_details': + + $user->add_lang(array('posting', 'viewforum', 'viewtopic', 'ucp')); + + $report_id = request_var('r', 0); + + $sql = 'SELECT r.pm_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour + FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u + WHERE r.report_id = ' . $report_id . ' + AND rr.reason_id = r.reason_id + AND r.user_id = u.user_id + AND r.post_id = 0 + ORDER BY report_closed ASC'; + $result = $db->sql_query_limit($sql, 1); + $report = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$report_id || !$report) + { + trigger_error('NO_REPORT'); + } + + $pm_id = $report['pm_id']; + $report_id = $report['report_id']; + + $pm_info = get_pm_data(array($pm_id)); + + if (!sizeof($pm_info)) + { + trigger_error('NO_REPORT_SELECTED'); + } + + $pm_info = $pm_info[$pm_id]; + + write_pm_addresses(array('to' => $pm_info['to_address'], 'bcc' => $pm_info['bcc_address']), (int) $pm_info['author_id']); + + $reason = array('title' => $report['reason_title'], 'description' => $report['reason_description']); + if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])])) + { + $reason['description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])]; + $reason['title'] = $user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]; + } + + // Process message, leave it uncensored + $message = $pm_info['message_text']; + + if ($pm_info['bbcode_bitfield']) + { + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + $bbcode = new bbcode($pm_info['bbcode_bitfield']); + $bbcode->bbcode_second_pass($message, $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield']); + } + + $message = bbcode_nl2br($message); + $message = smiley_text($message); + + if ($pm_info['message_attachment'] && $auth->acl_get('u_pm_download')) + { + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE post_msg_id = ' . $pm_id . ' + AND in_message = 1 + ORDER BY filetime DESC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $attachments[] = $row; + } + $db->sql_freeresult($result); + + if (sizeof($attachments)) + { + $update_count = array(); + parse_attachments(0, $message, $attachments, $update_count); + } + + // Display not already displayed Attachments for this post, we already parsed them. ;) + if (!empty($attachments)) + { + $template->assign_var('S_HAS_ATTACHMENTS', true); + + foreach ($attachments as $attachment) + { + $template->assign_block_vars('attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + } + } + + $template->assign_vars(array( + 'S_MCP_REPORT' => true, + 'S_PM' => true, + 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports&mode=pm_report_details&r=' . $report_id), + 'S_CAN_VIEWIP' => $auth->acl_getf_global('m_info'), + 'S_POST_REPORTED' => $pm_info['message_reported'], + 'S_USER_NOTES' => true, + + 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports&mode=pm_report_details&r=' . $report_id), + 'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $report['user_id']), + 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $pm_info['author_id']), + 'U_MCP_WARN_REPORTER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $report['user_id']) : '', + 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $pm_info['author_id']) : '', + + 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), + 'MINI_POST_IMG' => $user->img('icon_post_target', 'POST'), + + 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '', ''), + 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), + 'REPORT_DATE' => $user->format_date($report['report_time']), + 'REPORT_ID' => $report_id, + 'REPORT_REASON_TITLE' => $reason['title'], + 'REPORT_REASON_DESCRIPTION' => $reason['description'], + 'REPORT_TEXT' => $report['report_text'], + + 'POST_AUTHOR_FULL' => get_username_string('full', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']), + 'POST_AUTHOR' => get_username_string('username', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']), + 'U_POST_AUTHOR' => get_username_string('profile', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']), + + 'REPORTER_FULL' => get_username_string('full', $report['user_id'], $report['username'], $report['user_colour']), + 'REPORTER_COLOUR' => get_username_string('colour', $report['user_id'], $report['username'], $report['user_colour']), + 'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']), + 'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']), + + 'POST_PREVIEW' => $message, + 'POST_SUBJECT' => ($pm_info['message_subject']) ? $pm_info['message_subject'] : $user->lang['NO_SUBJECT'], + 'POST_DATE' => $user->format_date($pm_info['message_time']), + 'POST_IP' => $pm_info['author_ip'], + 'POST_IPADDR' => ($auth->acl_getf_global('m_info') && request_var('lookup', '')) ? @gethostbyaddr($pm_info['author_ip']) : '', + 'POST_ID' => $pm_info['msg_id'], + + 'U_LOOKUP_IP' => ($auth->acl_getf_global('m_info')) ? $this->u_action . '&r=' . $report_id . '&pm=' . $pm_id . '&lookup=' . $pm_info['author_ip'] . '#ip' : '', + )); + + $this->tpl_name = 'mcp_post'; + + break; + + case 'pm_reports': + case 'pm_reports_closed': + $user->add_lang(array('ucp')); + + $sort_days = $total = 0; + $sort_key = $sort_dir = ''; + $sort_by_sql = $sort_order_sql = array(); + mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total); + + $limit_time_sql = ($sort_days) ? 'AND r.report_time >= ' . (time() - ($sort_days * 86400)) : ''; + + if ($mode == 'pm_reports') + { + $report_state = 'pm.message_reported = 1 AND r.report_closed = 0'; + } + else + { + $report_state = 'r.report_closed = 1'; + } + + $sql = 'SELECT r.report_id + FROM ' . PRIVMSGS_TABLE . ' pm, ' . REPORTS_TABLE . ' r ' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . (($sort_order_sql[0] == 'r') ? ', ' . USERS_TABLE . ' ru' : '') . " + WHERE $report_state + AND r.pm_id = pm.msg_id + " . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = pm.author_id' : '') . ' + ' . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = r.user_id' : '') . " + AND r.post_id = 0 + $limit_time_sql + ORDER BY $sort_order_sql"; + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + + $i = 0; + $report_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $report_ids[] = $row['report_id']; + $row_num[$row['report_id']] = $i++; + } + $db->sql_freeresult($result); + + if (sizeof($report_ids)) + { + $sql = 'SELECT p.*, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id + FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru + WHERE ' . $db->sql_in_set('r.report_id', $report_ids) . " + AND r.pm_id = p.msg_id + AND p.author_id = u.user_id + AND ru.user_id = r.user_id + ORDER BY $sort_order_sql"; + $result = $db->sql_query($sql); + + $pm_list = $pm_by_id = array(); + while ($row = $db->sql_fetchrow($result)) + { + $pm_by_id[(int) $row['msg_id']] = $row; + $pm_list[] = (int) $row['msg_id']; + } + $db->sql_freeresult($result); + + if (sizeof($pm_list)) + { + $address_list = get_recipient_strings($pm_by_id); + + foreach ($pm_list as $message_id) + { + $row = $pm_by_id[$message_id]; + $template->assign_block_vars('postrow', array( + 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=pm_reports&mode=pm_report_details&r={$row['report_id']}"), + + 'PM_AUTHOR_FULL' => get_username_string('full', $row['author_id'], $row['username'], $row['user_colour']), + 'PM_AUTHOR_COLOUR' => get_username_string('colour', $row['author_id'], $row['username'], $row['user_colour']), + 'PM_AUTHOR' => get_username_string('username', $row['author_id'], $row['username'], $row['user_colour']), + 'U_PM_AUTHOR' => get_username_string('profile', $row['author_id'], $row['username'], $row['user_colour']), + + 'REPORTER_FULL' => get_username_string('full', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), + 'REPORTER_COLOUR' => get_username_string('colour', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), + 'REPORTER' => get_username_string('username', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), + 'U_REPORTER' => get_username_string('profile', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), + + 'PM_SUBJECT' => ($row['message_subject']) ? $row['message_subject'] : $user->lang['NO_SUBJECT'], + 'PM_TIME' => $user->format_date($row['message_time']), + 'REPORT_ID' => $row['report_id'], + 'REPORT_TIME' => $user->format_date($row['report_time']), + + 'RECIPIENTS' => implode(', ', $address_list[$row['msg_id']]), + )); + } + } + } + + // Now display the page + $template->assign_vars(array( + 'L_EXPLAIN' => ($mode == 'pm_reports') ? $user->lang['MCP_PM_REPORTS_OPEN_EXPLAIN'] : $user->lang['MCP_PM_REPORTS_CLOSED_EXPLAIN'], + 'L_TITLE' => ($mode == 'pm_reports') ? $user->lang['MCP_PM_REPORTS_OPEN'] : $user->lang['MCP_PM_REPORTS_CLOSED'], + + 'S_PM' => true, + 'S_MCP_ACTION' => $this->u_action, + 'S_CLOSED' => ($mode == 'pm_reports_closed') ? true : false, + + 'PAGINATION' => generate_pagination($this->u_action . "&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start), + 'TOTAL' => $total, + 'TOTAL_REPORTS' => ($total == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $total), + ) + ); + + $this->tpl_name = 'mcp_reports'; + break; + } + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index cc701a0540..270b0055d9 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -77,6 +77,7 @@ class mcp_reports WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . ' AND rr.reason_id = r.reason_id AND r.user_id = u.user_id + AND r.pm_id = 0 ORDER BY report_closed ASC'; $result = $db->sql_query_limit($sql, 1); $report = $db->sql_fetchrow($result); @@ -149,13 +150,11 @@ class mcp_reports if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { - $extensions = $cache->obtain_attach_extensions($post_info['forum_id']); - $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' WHERE post_msg_id = ' . $post_id . ' AND in_message = 0 - ORDER BY filetime DESC, post_msg_id ASC'; + ORDER BY filetime DESC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -332,7 +331,7 @@ class mcp_reports mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); $forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total; - $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $limit_time_sql = ($sort_days) ? 'AND r.report_time >= ' . (time() - ($sort_days * 86400)) : ''; if ($mode == 'reports') { @@ -349,9 +348,10 @@ class mcp_reports $report_state AND r.post_id = p.post_id " . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . ' - ' . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = p.poster_id' : '') . ' + ' . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = r.user_id' : '') . ' ' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . " AND t.topic_id = p.topic_id + AND r.pm_id = 0 $limit_time_sql ORDER BY $sort_order_sql"; $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); @@ -374,6 +374,7 @@ class mcp_reports AND r.post_id = p.post_id AND u.user_id = p.poster_id AND ru.user_id = r.user_id + AND r.pm_id = 0 ORDER BY ' . $sort_order_sql; $result = $db->sql_query($sql); @@ -441,35 +442,54 @@ class mcp_reports /** * Closes a report */ -function close_report($report_id_list, $mode, $action) +function close_report($report_id_list, $mode, $action, $pm = false) { - global $db, $template, $user, $config; + global $db, $template, $user, $config, $auth; global $phpEx, $phpbb_root_path; - $sql = 'SELECT r.post_id - FROM ' . REPORTS_TABLE . ' r - WHERE ' . $db->sql_in_set('r.report_id', $report_id_list); + $pm_where = ($pm) ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 '; + $id_column = ($pm) ? 'pm_id' : 'post_id'; + $module = ($pm) ? 'pm_reports' : 'reports'; + $pm_prefix = ($pm) ? 'PM_' : ''; + + $sql = "SELECT r.$id_column + FROM " . REPORTS_TABLE . ' r + WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . $pm_where; $result = $db->sql_query($sql); $post_id_list = array(); while ($row = $db->sql_fetchrow($result)) { - $post_id_list[] = $row['post_id']; + $post_id_list[] = $row[$id_column]; } $post_id_list = array_unique($post_id_list); - if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report'))) + if ($pm) { - trigger_error('NOT_AUTHORISED'); + if (!$auth->acl_getf_global('m_report')) + { + trigger_error('NOT_AUTHORISED'); + } + } + else + { + if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report'))) + { + trigger_error('NOT_AUTHORISED'); + } } if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false) { $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=reports'); } + elseif ($action == 'delete' && strpos($user->data['session_page'], 'mode=pm_report_details') !== false) + { + $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=pm_reports'); + } else if ($action == 'close' && !request_var('r', 0)) { - $redirect = request_var('redirect', build_url(array('mode', 'p', 'quickmod')) . '&mode=reports'); + $redirect = request_var('redirect', build_url(array('mode', 'p', 'quickmod')) . '&mode=' . $module); } else { @@ -480,7 +500,7 @@ function close_report($report_id_list, $mode, $action) $topic_ids = array(); $s_hidden_fields = build_hidden_fields(array( - 'i' => 'reports', + 'i' => $module, 'mode' => $mode, 'report_id_list' => $report_id_list, 'action' => $action, @@ -489,13 +509,13 @@ function close_report($report_id_list, $mode, $action) if (confirm_box(true)) { - $post_info = get_post_data($post_id_list, 'm_report'); + $post_info = ($pm) ? get_pm_data($post_id_list) : get_post_data($post_id_list, 'm_report'); - $sql = 'SELECT r.report_id, r.post_id, r.report_closed, r.user_id, r.user_notify, u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type - FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u + $sql = "SELECT r.report_id, r.$id_column, r.report_closed, r.user_id, r.user_notify, u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type + FROM " . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . ' ' . (($action == 'close') ? 'AND r.report_closed = 0' : '') . ' - AND r.user_id = u.user_id'; + AND r.user_id = u.user_id' . $pm_where; $result = $db->sql_query($sql); $reports = $close_report_posts = $close_report_topics = $notify_reporters = $report_id_list = array(); @@ -506,8 +526,12 @@ function close_report($report_id_list, $mode, $action) if (!$report['report_closed']) { - $close_report_posts[] = $report['post_id']; - $close_report_topics[] = $post_info[$report['post_id']]['topic_id']; + $close_report_posts[] = $report[$id_column]; + + if (!$pm) + { + $close_report_topics[] = $post_info[$report['post_id']]['topic_id']; + } } if ($report['user_notify'] && !$report['report_closed']) @@ -522,7 +546,7 @@ function close_report($report_id_list, $mode, $action) $close_report_posts = array_unique($close_report_posts); $close_report_topics = array_unique($close_report_topics); - if (sizeof($close_report_posts)) + if (!$pm && sizeof($close_report_posts)) { // Get a list of topics that still contain reported posts $sql = 'SELECT DISTINCT topic_id @@ -561,18 +585,33 @@ function close_report($report_id_list, $mode, $action) if (sizeof($close_report_posts)) { - $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_reported = 0 - WHERE ' . $db->sql_in_set('post_id', $close_report_posts); - $db->sql_query($sql); - - if (sizeof($close_report_topics)) + if ($pm) { - $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_reported = 0 - WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . ' - OR ' . $db->sql_in_set('topic_moved_id', $close_report_topics); + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_reported = 0 + WHERE ' . $db->sql_in_set('msg_id', $close_report_posts); $db->sql_query($sql); + + if ($action == 'delete') + {echo "aha"; + delete_pm(ANONYMOUS, $close_report_posts, PRIVMSGS_INBOX); + } + } + else + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_reported = 0 + WHERE ' . $db->sql_in_set('post_id', $close_report_posts); + $db->sql_query($sql); + + if (sizeof($close_report_topics)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_reported = 0 + WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . ' + OR ' . $db->sql_in_set('topic_moved_id', $close_report_topics); + $db->sql_query($sql); + } } } @@ -582,7 +621,14 @@ function close_report($report_id_list, $mode, $action) foreach ($reports as $report) { - add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' . strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']); + if ($pm) + { + add_log('mod', 0, 0, 'LOG_PM_REPORT_' . strtoupper($action) . 'D', $post_info[$report['pm_id']]['message_subject']); + } + else + { + add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' . strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']); + } } $messenger = new messenger(); @@ -597,39 +643,53 @@ function close_report($report_id_list, $mode, $action) continue; } - $post_id = $reporter['post_id']; + $post_id = $reporter[$id_column]; - $messenger->template('report_' . $action . 'd', $reporter['user_lang']); + $messenger->template((($pm) ? 'pm_report_' : 'report_') . $action . 'd', $reporter['user_lang']); $messenger->to($reporter['user_email'], $reporter['username']); $messenger->im($reporter['user_jabber'], $reporter['username']); - $messenger->assign_vars(array( - 'USERNAME' => htmlspecialchars_decode($reporter['username']), - 'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']), - 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['post_subject'])), - 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_info[$post_id]['topic_title']))) - ); + if ($pm) + { + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($reporter['username']), + 'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']), + 'PM_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['message_subject'])), + )); + } + else + { + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($reporter['username']), + 'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']), + 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['post_subject'])), + 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_info[$post_id]['topic_title']))) + ); + } $messenger->send($reporter['user_notify_type']); } } - foreach ($post_info as $post) + if (!$pm) { - $forum_ids[$post['forum_id']] = $post['forum_id']; - $topic_ids[$post['topic_id']] = $post['topic_id']; + foreach ($post_info as $post) + { + $forum_ids[$post['forum_id']] = $post['forum_id']; + $topic_ids[$post['topic_id']] = $post['topic_id']; + } } - + unset($notify_reporters, $post_info, $reports); $messenger->save_queue(); - $success_msg = (sizeof($report_id_list) == 1) ? 'REPORT_' . strtoupper($action) . 'D_SUCCESS' : 'REPORTS_' . strtoupper($action) . 'D_SUCCESS'; + $success_msg = (sizeof($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS'; } else { - confirm_box(false, $user->lang[strtoupper($action) . '_REPORT' . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields); + confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields); } $redirect = request_var('redirect', "index.$phpEx"); @@ -642,15 +702,21 @@ function close_report($report_id_list, $mode, $action) else { meta_refresh(3, $redirect); + $return_forum = ''; - if (sizeof($forum_ids == 1)) - { - $return_forum = sprintf($user->lang['RETURN_FORUM'], '', '') . '

      '; - } $return_topic = ''; - if (sizeof($topic_ids == 1)) + + if (!$pm) { - $return_topic = sprintf($user->lang['RETURN_TOPIC'], '', '') . '

      '; + if (sizeof($forum_ids) === 1) + { + $return_forum = sprintf($user->lang['RETURN_FORUM'], '', '') . '

      '; + } + + if (sizeof($topic_ids) === 1) + { + $return_topic = sprintf($user->lang['RETURN_TOPIC'], '', '') . '

      '; + } } trigger_error($user->lang[$success_msg] . '

      ' . $return_forum . $return_topic . sprintf($user->lang['RETURN_PAGE'], "", '')); diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index b2ceb30f9e..f947518ba8 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -115,78 +115,7 @@ function view_folder($id, $mode, $folder_id, $folder) // Build Recipient List if in outbox/sentbox - max two additional queries if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) { - $recipient_list = $address = array(); - - foreach ($folder_info['rowset'] as $message_id => $row) - { - $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); - $_save = array('u', 'g'); - foreach ($_save as $save) - { - if (isset($address[$message_id][$save]) && sizeof($address[$message_id][$save])) - { - foreach (array_keys($address[$message_id][$save]) as $ug_id) - { - $recipient_list[$save][$ug_id] = array('name' => $user->lang['NA'], 'colour' => ''); - } - } - } - } - - $_types = array('u', 'g'); - foreach ($_types as $ug_type) - { - if (!empty($recipient_list[$ug_type])) - { - if ($ug_type == 'u') - { - $sql = 'SELECT user_id as id, username as name, user_colour as colour - FROM ' . USERS_TABLE . ' - WHERE '; - } - else - { - $sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type - FROM ' . GROUPS_TABLE . ' - WHERE '; - } - $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type]))); - - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - if ($ug_type == 'g') - { - $row['name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['name']] : $row['name']; - } - - $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); - } - $db->sql_freeresult($result); - } - } - - foreach ($address as $message_id => $adr_ary) - { - foreach ($adr_ary as $type => $id_ary) - { - foreach ($id_ary as $ug_id => $_id) - { - if ($type == 'u') - { - $address_list[$message_id][] = get_username_string('full', $ug_id, $recipient_list[$type][$ug_id]['name'], $recipient_list[$type][$ug_id]['colour']); - } - else - { - $user_colour = ($recipient_list[$type][$ug_id]['colour']) ? ' style="font-weight: bold; color:#' . $recipient_list[$type][$ug_id]['colour'] . '"' : ''; - $link = ''; - $address_list[$message_id][] = $link . $recipient_list[$type][$ug_id]['name'] . (($link) ? '' : ''); - } - } - } - } - unset($recipient_list, $address); + $address_list = get_recipient_strings($folder_info['rowset']); } $data = array(); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 82aa5afd8f..dd15f5ff37 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -190,6 +190,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['SEND_EMAIL']), 'QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['POST_QUOTE_PM']), 'REPLY_IMG' => $user->img('button_pm_reply', $user->lang['POST_REPLY_PM']), + 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_POST'), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['POST_EDIT_PM']), 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), @@ -210,6 +211,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&mode=compose&action=delete&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_EMAIL' => $user_info['email'], + 'U_REPORT' => ($config['allow_pm_report']) ? append_sid("{$phpbb_root_path}report.$phpEx", "pm=" . $message_row['msg_id']) : '', 'U_QUOTE' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_EDIT' => (($message_row['message_time'] > time() - ($config['pm_edit_time'] * 60) || !$config['pm_edit_time']) && $folder_id == PRIVMSGS_OUTBOX && $auth->acl_get('u_pm_edit')) ? "$url&mode=compose&action=edit&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_POST_REPLY_PM' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $message_row['msg_id'] : '', diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 362a379ec1..3b6c614deb 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -701,11 +701,21 @@ function database_update_info() GROUPS_TABLE => array( 'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'), ), + PRIVMSGS_TABLE => array( + 'message_reported' => array('BOOL', 0), + ), + REPORTS_TABLE => array( + 'pm_id' => array('UINT', 0), + ), ), 'add_index' => array( LOG_TABLE => array( 'log_time' => array('log_time'), ), + REPORTS_TABLE => array( + 'post_id' => array('post_id'), + 'pm_id' => array('pm_id'), + ), ), ), ); @@ -1076,6 +1086,9 @@ function change_database_data(&$no_updates, $version) // Entries for smiley pagination set_config('smilies_per_page', '50'); + // Entry for reporting PMs + set_config('allow_pm_report', '1'); + include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); $_module = new acp_modules(); @@ -1168,6 +1181,58 @@ function change_database_data(&$no_updates, $version) } $db->sql_freeresult($result); + + // Also install the "PM Reports" module + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'mcp' + AND module_langname = 'MCP_REPORTS' + AND module_mode = '' + AND module_basename = ''"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $category_id = (int) $row['module_id']; + + $modes = array( + 'pm_reports' => array('title' => 'MCP_PM_REPORTS_OPEN', 'auth' => 'aclf_m_report'), + 'pm_reports_closed' => array('title' => 'MCP_PM_REPORTS_CLOSED', 'auth' => 'aclf_m_report'), + 'pm_report_details' => array('title' => 'MCP_PM_REPORT_DETAILS', 'auth' => 'aclf_m_report'), + ); + + foreach ($modes as $mode => $data) + { + // Check if we actually need to add the module or if it is already added. ;) + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_class = 'mcp' + AND module_langname = '{$data['title']}' + AND module_mode = '$mode' + AND parent_id = {$category_id}"; + $result2 = $db->sql_query($sql); + $row2 = $db->sql_fetchrow($result2); + $db->sql_freeresult($result2); + + if (!$row2) + { + $module_data = array( + 'module_basename' => 'users', + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => $category_id, + 'module_class' => 'mcp', + 'module_langname' => $data['title'], + 'module_mode' => $mode, + 'module_auth' => $data['auth'], + ); + + $_module->update_module_data($module_data, true); + } + } + } + $db->sql_freeresult($result); + $_module->remove_cache_file(); // Add newly_registered group... but check if it already exists (we always supported running the updater on any schema) diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 4bbc147df7..de1472f6fd 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -685,7 +685,8 @@ CREATE TABLE phpbb_privmsgs ( message_edit_time INTEGER DEFAULT 0 NOT NULL, message_edit_count INTEGER DEFAULT 0 NOT NULL, to_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - bcc_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL + bcc_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + message_reported INTEGER DEFAULT 0 NOT NULL );; ALTER TABLE phpbb_privmsgs ADD PRIMARY KEY (msg_id);; @@ -872,6 +873,7 @@ CREATE TABLE phpbb_reports ( report_id INTEGER NOT NULL, reason_id INTEGER DEFAULT 0 NOT NULL, post_id INTEGER DEFAULT 0 NOT NULL, + pm_id INTEGER DEFAULT 0 NOT NULL, user_id INTEGER DEFAULT 0 NOT NULL, user_notify INTEGER DEFAULT 0 NOT NULL, report_closed INTEGER DEFAULT 0 NOT NULL, @@ -881,6 +883,8 @@ CREATE TABLE phpbb_reports ( ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);; +CREATE INDEX phpbb_reports_post_id ON phpbb_reports(post_id);; +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports(pm_id);; CREATE GENERATOR phpbb_reports_gen;; SET GENERATOR phpbb_reports_gen TO 0;; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index e2cc49e4d7..612b2b8d76 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -831,7 +831,8 @@ CREATE TABLE [phpbb_privmsgs] ( [message_edit_time] [int] DEFAULT (0) NOT NULL , [message_edit_count] [int] DEFAULT (0) NOT NULL , [to_address] [varchar] (4000) DEFAULT ('') NOT NULL , - [bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL + [bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL , + [message_reported] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO @@ -1055,6 +1056,7 @@ CREATE TABLE [phpbb_reports] ( [report_id] [int] IDENTITY (1, 1) NOT NULL , [reason_id] [int] DEFAULT (0) NOT NULL , [post_id] [int] DEFAULT (0) NOT NULL , + [pm_id] [int] DEFAULT (0) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , [user_notify] [int] DEFAULT (0) NOT NULL , [report_closed] [int] DEFAULT (0) NOT NULL , @@ -1070,6 +1072,12 @@ ALTER TABLE [phpbb_reports] WITH NOCHECK ADD ) ON [PRIMARY] GO +CREATE INDEX [post_id] ON [phpbb_reports]([post_id]) ON [PRIMARY] +GO + +CREATE INDEX [pm_id] ON [phpbb_reports]([pm_id]) ON [PRIMARY] +GO + /* Table: 'phpbb_reports_reasons' diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 86c3e18e40..5934d2d173 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -486,6 +486,7 @@ CREATE TABLE phpbb_privmsgs ( message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, to_address blob NOT NULL, bcc_address blob NOT NULL, + message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (msg_id), KEY author_ip (author_ip), KEY message_time (message_time), @@ -609,12 +610,15 @@ CREATE TABLE phpbb_reports ( report_id mediumint(8) UNSIGNED NOT NULL auto_increment, reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_text mediumblob NOT NULL, - PRIMARY KEY (report_id) + PRIMARY KEY (report_id), + KEY post_id (post_id), + KEY pm_id (pm_id) ); diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 81ebb21f7d..2623202d4a 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -486,6 +486,7 @@ CREATE TABLE phpbb_privmsgs ( message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, to_address text NOT NULL, bcc_address text NOT NULL, + message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (msg_id), KEY author_ip (author_ip), KEY message_time (message_time), @@ -609,12 +610,15 @@ CREATE TABLE phpbb_reports ( report_id mediumint(8) UNSIGNED NOT NULL auto_increment, reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_text mediumtext NOT NULL, - PRIMARY KEY (report_id) + PRIMARY KEY (report_id), + KEY post_id (post_id), + KEY pm_id (pm_id) ) CHARACTER SET `utf8` COLLATE `utf8_bin`; diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 10452ca18c..05d25db87c 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -923,6 +923,7 @@ CREATE TABLE phpbb_privmsgs ( message_edit_count number(4) DEFAULT '0' NOT NULL, to_address clob DEFAULT '' , bcc_address clob DEFAULT '' , + message_reported number(1) DEFAULT '0' NOT NULL, CONSTRAINT pk_phpbb_privmsgs PRIMARY KEY (msg_id) ) / @@ -1164,6 +1165,7 @@ CREATE TABLE phpbb_reports ( report_id number(8) NOT NULL, reason_id number(4) DEFAULT '0' NOT NULL, post_id number(8) DEFAULT '0' NOT NULL, + pm_id number(8) DEFAULT '0' NOT NULL, user_id number(8) DEFAULT '0' NOT NULL, user_notify number(1) DEFAULT '0' NOT NULL, report_closed number(1) DEFAULT '0' NOT NULL, @@ -1173,6 +1175,10 @@ CREATE TABLE phpbb_reports ( ) / +CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id) +/ +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id) +/ CREATE SEQUENCE phpbb_reports_seq / diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 3382cf4efc..bb4d839272 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -659,6 +659,7 @@ CREATE TABLE phpbb_privmsgs ( message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0), to_address varchar(4000) DEFAULT '' NOT NULL, bcc_address varchar(4000) DEFAULT '' NOT NULL, + message_reported INT2 DEFAULT '0' NOT NULL CHECK (message_reported >= 0), PRIMARY KEY (msg_id) ); @@ -810,6 +811,7 @@ CREATE TABLE phpbb_reports ( report_id INT4 DEFAULT nextval('phpbb_reports_seq'), reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0), post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0), + pm_id INT4 DEFAULT '0' NOT NULL CHECK (pm_id >= 0), user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0), report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0), @@ -818,6 +820,8 @@ CREATE TABLE phpbb_reports ( PRIMARY KEY (report_id) ); +CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id); /* Table: 'phpbb_reports_reasons' diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 8a83225b1b..3545fa9bc2 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -23,6 +23,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars', INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_namechange', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_nocensors', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_attach', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_report', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_flash', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_links', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_privmsg', '1'); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 486c0a75a1..4ee981c667 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -471,7 +471,8 @@ CREATE TABLE phpbb_privmsgs ( message_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', message_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0', to_address text(65535) NOT NULL DEFAULT '', - bcc_address text(65535) NOT NULL DEFAULT '' + bcc_address text(65535) NOT NULL DEFAULT '', + message_reported INTEGER UNSIGNED NOT NULL DEFAULT '0' ); CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip); @@ -590,6 +591,7 @@ CREATE TABLE phpbb_reports ( report_id INTEGER PRIMARY KEY NOT NULL , reason_id INTEGER UNSIGNED NOT NULL DEFAULT '0', post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + pm_id INTEGER UNSIGNED NOT NULL DEFAULT '0', user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0', report_closed INTEGER UNSIGNED NOT NULL DEFAULT '0', @@ -597,6 +599,8 @@ CREATE TABLE phpbb_reports ( report_text mediumtext(16777215) NOT NULL DEFAULT '' ); +CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id); # Table: 'phpbb_reports_reasons' CREATE TABLE phpbb_reports_reasons ( diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index bebc9e3435..1005b2ef5b 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -70,6 +70,8 @@ $lang = array_merge($lang, array( 'ALLOW_NO_CENSORS' => 'Allow disabling of word censoring', 'ALLOW_NO_CENSORS_EXPLAIN' => 'Users can choose to disable the automatic word censoring of posts and private messages.', 'ALLOW_PM_ATTACHMENTS' => 'Allow attachments in private messages', + 'ALLOW_PM_REPORT' => 'Allow users to report private messages', + 'ALLOW_PM_REPORT_EXPLAIN' => 'If this setting is enabled, users have the option of reporting a private message they have received or sent to the board’s moderators. These private messages will then be visible in the Moderator Control Panel.', 'ALLOW_QUICK_REPLY' => 'Allow quick reply', 'ALLOW_QUICK_REPLY_EXPLAIN' => 'This setting defines if quick reply is enabled or not. If this setting is enabled, forums need to have their quick reply option enabled too.', 'ALLOW_SIG' => 'Allow signatures', diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 9a7fda5951..ac8a14a21c 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -409,6 +409,7 @@ $lang = array_merge($lang, array( 'HIDE_STATISTICS' => 'Hide details', 'SEND_STATISTICS' => 'Send statistical information', 'SHOW_STATISTICS' => 'Show details', + 'THANKS_SEND_STATISTICS' => 'Thank you for submitting your information.', )); // Log Entries @@ -505,6 +506,8 @@ $lang = array_merge($lang, array( 'LOG_LOCK_POST' => 'Locked post
      » %s', 'LOG_MERGE' => 'Merged posts into topic
      » %s', 'LOG_MOVE' => 'Moved topic
      » from %1$s to %2$s', + 'LOG_PM_REPORT_CLOSED' => 'Closed PM report
      » %s', + 'LOG_PM_REPORT_DELETED' => 'Deleted PM report
      » %s', 'LOG_POST_APPROVED' => 'Approved post
      » %s', 'LOG_POST_DISAPPROVED' => 'Disapproved post “%1$s” with the following reason
      » %2$s', 'LOG_POST_EDITED' => 'Edited post “%1$s” written by
      » %2$s', diff --git a/phpBB/language/en/email/pm_report_closed.txt b/phpBB/language/en/email/pm_report_closed.txt new file mode 100644 index 0000000000..752a640867 --- /dev/null +++ b/phpBB/language/en/email/pm_report_closed.txt @@ -0,0 +1,8 @@ +Subject: Report closed - "{PM_SUBJECT}" + +Hello {USERNAME}, + +You are receiving this notification because the report you filed on the private message "{PM_SUBJECT}" at "{SITENAME}" was handled by a moderator or by an administrator. The report was afterwards closed. If you have further questions contact {CLOSER_NAME} with a personal message. + + +{EMAIL_SIG} \ No newline at end of file diff --git a/phpBB/language/en/email/pm_report_deleted.txt b/phpBB/language/en/email/pm_report_deleted.txt new file mode 100644 index 0000000000..04e4bd1404 --- /dev/null +++ b/phpBB/language/en/email/pm_report_deleted.txt @@ -0,0 +1,8 @@ +Subject: Report deleted - "{PM_SUBJECT}" + +Hello {USERNAME}, + +You are receiving this notification because the report you filed on the post "{PM_SUBJECT}" at "{SITENAME}" was deleted by a moderator or by an administrator. + + +{EMAIL_SIG} \ No newline at end of file diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index 93b694be77..18195fd0f8 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -46,6 +46,7 @@ $lang = array_merge($lang, array( 'ALL_NOTES_DELETED' => 'Successfully removed all user notes.', 'ALL_REPORTS' => 'All reports', 'ALREADY_REPORTED' => 'This post has already been reported.', + 'ALREADY_REPORTED_PM' => 'This private message has already been reported.', 'ALREADY_WARNED' => 'A warning has already been issued for this post.', 'APPROVE' => 'Approve', 'APPROVE_POST' => 'Approve post', @@ -58,11 +59,19 @@ $lang = array_merge($lang, array( 'CANNOT_WARN_SELF' => 'You cannot warn yourself.', 'CAN_LEAVE_BLANK' => 'This can be left blank.', 'CHANGE_POSTER' => 'Change poster', + 'CLOSE_PM_REPORT' => 'Close PM report', + 'CLOSE_PM_REPORT_CONFIRM' => 'Are you sure you want to close the selected PM report?', + 'CLOSE_PM_REPORTS' => 'Close PM reports', + 'CLOSE_PM_REPORTS_CONFIRM' => 'Are you sure you want to close the selected PM reports?', 'CLOSE_REPORT' => 'Close report', 'CLOSE_REPORT_CONFIRM' => 'Are you sure you want to close the selected report?', 'CLOSE_REPORTS' => 'Close reports', 'CLOSE_REPORTS_CONFIRM' => 'Are you sure you want to close the selected reports?', + 'DELETE_PM_REPORT' => 'Delete PM report', + 'DELETE_PM_REPORT_CONFIRM' => 'Are you sure you want to delete the selected PM report?', + 'DELETE_PM_REPORTS' => 'Delete PM reports', + 'DELETE_PM_REPORTS_CONFIRM' => 'Are you sure you want to delete the selected PM reports?', 'DELETE_POSTS' => 'Delete posts', 'DELETE_POSTS_CONFIRM' => 'Are you sure you want to delete these posts?', 'DELETE_POST_CONFIRM' => 'Are you sure you want to delete this post?', @@ -106,6 +115,7 @@ $lang = array_merge($lang, array( 'LATEST_LOGS' => 'Latest 5 logged actions', 'LATEST_REPORTED' => 'Latest 5 reports', + 'LATEST_REPORTED_PMS' => 'Latest 5 PM reports', 'LATEST_UNAPPROVED' => 'Latest 5 posts awaiting approval', 'LATEST_WARNING_TIME' => 'Latest warning issued', 'LATEST_WARNINGS' => 'Latest 5 warnings', @@ -170,7 +180,14 @@ $lang = array_merge($lang, array( 'MCP_POST_REPORTS' => 'Reports issued on this post', - 'MCP_REPORTS' => 'Reported posts', + 'MCP_PM_REPORTS' => 'Reported PMs', + 'MCP_PM_REPORT_DETAILS' => 'PM Report details', + 'MCP_PM_REPORTS_CLOSED' => 'Closed PM reports', + 'MCP_PM_REPORTS_CLOSED_EXPLAIN' => 'This is a list of all reports about private messages which have previously been resolved.', + 'MCP_PM_REPORTS_OPEN' => 'Open PM reports', + 'MCP_PM_REPORTS_OPEN_EXPLAIN' => 'This is a list of all reported private messages which are still to be handled.', + + 'MCP_REPORTS' => 'Reported messages', 'MCP_REPORT_DETAILS' => 'Report details', 'MCP_REPORTS_CLOSED' => 'Closed reports', 'MCP_REPORTS_CLOSED_EXPLAIN' => 'This is a list of all reports about posts which have previously been resolved.', @@ -232,6 +249,11 @@ $lang = array_merge($lang, array( 'ONLY_TOPIC' => 'Only topic “%s”', 'OTHER_USERS' => 'Other users posting from this IP', + 'PM_REPORT_CLOSED_SUCCESS' => 'The selected PM report has been closed successfully.', + 'PM_REPORT_DELETED_SUCCESS' => 'The selected PM report has been deleted successfully.', + 'PM_REPORTED_SUCCESS' => 'This private message has been successfully reported.', + 'PM_REPORTS_TOTAL' => 'In total there are %d PM reports to review.', + 'PM_REPORTS_ZERO_TOTAL' => 'There are no PM reports to review.', 'POSTER' => 'Poster', 'POSTS_APPROVED_SUCCESS' => 'The selected posts have been approved.', 'POSTS_DELETED_SUCCESS' => 'The selected posts have been successfully removed from the database.', @@ -264,7 +286,7 @@ $lang = array_merge($lang, array( 'REPORT_DELETED_SUCCESS' => 'The selected report has been deleted successfully.', 'REPORT_DETAILS' => 'Report details', 'REPORT_MESSAGE' => 'Report this message', - 'REPORT_MESSAGE_EXPLAIN' => 'Use this form to report the selected message. Reporting should generally be used only if the message breaks forum rules.', + 'REPORT_MESSAGE_EXPLAIN' => 'Use this form to report the selected private message. Reporting should generally be used only if the message breaks forum rules. Reporting a private message will make its contents visible to all moderators', 'REPORT_NOTIFY' => 'Notify me', 'REPORT_NOTIFY_EXPLAIN' => 'Informs you when your report is dealt with.', 'REPORT_POST_EXPLAIN' => 'Use this form to report the selected post to the forum moderators and board administrators. Reporting should generally be used only if the post breaks forum rules.', @@ -275,6 +297,7 @@ $lang = array_merge($lang, array( 'RETURN_MESSAGE' => '%sReturn to the message%s', 'RETURN_NEW_FORUM' => '%sGo to the new forum%s', 'RETURN_NEW_TOPIC' => '%sGo to the new topic%s', + 'RETURN_PM' => '%sReturn to the private message%s', 'RETURN_POST' => '%sReturn to the post%s', 'RETURN_QUEUE' => '%sReturn to the queue%s', 'RETURN_REPORTS' => '%sReturn to the reports%s', @@ -346,6 +369,7 @@ $lang = array_merge($lang, array( 'USER_WARNING_ADDED' => 'User warned successfully.', 'VIEW_DETAILS' => 'View details', + 'VIEW_PM' => 'View private message', 'VIEW_POST' => 'View post', 'WARNED_USERS' => 'Warned users', @@ -365,10 +389,10 @@ $lang = array_merge($lang, array( 'OTHER' => 'Other', ), 'DESCRIPTION' => array( - 'WAREZ' => 'The post contains links to illegal or pirated software.', - 'SPAM' => 'The reported post has the only purpose to advertise for a website or another product.', - 'OFF_TOPIC' => 'The reported post is off topic.', - 'OTHER' => 'The reported post does not fit into any other category, please use the further information field.', + 'WAREZ' => 'The message contains links to illegal or pirated software.', + 'SPAM' => 'The reported message has the only purpose to advertise for a website or another product.', + 'OFF_TOPIC' => 'The reported message is off topic.', + 'OTHER' => 'The reported message does not fit into any other category, please use the further information field.', ) ), )); diff --git a/phpBB/mcp.php b/phpBB/mcp.php index f5be1f1e9c..e04bd7cab2 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -212,11 +212,16 @@ if ($mode == '' || $mode == 'unapproved_topics' || $mode == 'unapproved_posts') $module->set_display('queue', 'approve_details', false); } -if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed') +if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed' || $mode == 'pm_reports' || $mode == 'pm_reports_closed' || $mode == 'pm_report_details') { $module->set_display('reports', 'report_details', false); } +if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed' || $mode == 'pm_reports' || $mode == 'pm_reports_closed' || $mode == 'report_details') +{ + $module->set_display('pm_reports', 'pm_report_details', false); +} + if (!$topic_id) { $module->set_display('main', 'topic_view', false); @@ -565,6 +570,45 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false) return $rowset; } +/** +* Get simple pm data +*/ +function get_pm_data($pm_ids) +{ + global $db, $auth, $config, $user; + + $rowset = array(); + + if (!sizeof($pm_ids)) + { + return array(); + } + + $sql_array = array( + 'SELECT' => 'p.*, u.*', + + 'FROM' => array( + USERS_TABLE => 'u', + PRIVMSGS_TABLE => 'p', + ), + + 'WHERE' => $db->sql_in_set('p.msg_id', $pm_ids) . ' + AND u.user_id = p.author_id', + ); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + unset($sql_array); + + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['msg_id']] = $row; + } + $db->sql_freeresult($result); + + return $rowset; +} + /** * sorting in mcp * @@ -650,6 +694,8 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, } break; + case 'pm_reports': + case 'pm_reports_closed': case 'reports': case 'reports_closed': $type = 'reports'; @@ -657,33 +703,46 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, $default_dir = 'd'; $limit_time_sql = ($min_time) ? "AND r.report_time >= $min_time" : ''; + $pm = (strpos($mode, 'pm_') === 0) ? true : false; + if ($topic_id) { - $where_sql .= ' p.topic_id = ' . $topic_id; + $where_sql .= ' p.topic_id = ' . $topic_id . ' AND '; } else if ($forum_id) { - $where_sql .= ' p.forum_id = ' . $forum_id; + $where_sql .= ' p.forum_id = ' . $forum_id . ' AND '; } - else + else if ($pm) { - $where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list(array('!f_read', '!m_report')), true, true); + $where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list(array('!f_read', '!m_report')), true, true) . ' AND '; } if ($mode == 'reports') { - $where_sql .= ' AND r.report_closed = 0'; + $where_sql .= ' r.report_closed = 0 AND '; } else { - $where_sql .= ' AND r.report_closed = 1'; + $where_sql .= ' r.report_closed = 1 AND '; } - $sql = 'SELECT COUNT(r.report_id) AS total - FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p - $where_sql - AND p.post_id = r.post_id - $limit_time_sql"; + if ($pm) + { + $sql = 'SELECT COUNT(r.report_id) AS total + FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . " p + $where_sql r.post_id = 0 + AND p.msg_id = r.pm_id + $limit_time_sql"; + } + else + { + $sql = 'SELECT COUNT(r.report_id) AS total + FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p + $where_sql r.pm_id = 0 + AND p.post_id = r.post_id + $limit_time_sql"; + } break; case 'viewlogs': diff --git a/phpBB/report.php b/phpBB/report.php index 03df91135d..db9c957ea8 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -24,18 +24,29 @@ $user->setup('mcp'); $forum_id = request_var('f', 0); $post_id = request_var('p', 0); +$pm_id = request_var('pm', 0); $reason_id = request_var('reason_id', 0); $report_text = utf8_normalize_nfc(request_var('report_text', '', true)); $user_notify = ($user->data['is_registered']) ? request_var('notify', 0) : false; $submit = (isset($_POST['submit'])) ? true : false; -if (!$post_id) +if (!$post_id && (!$pm_id || !$config['allow_pm_report'])) { trigger_error('NO_POST_SELECTED'); } -$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=$post_id") . "#p$post_id"; +if ($post_id) +{ + $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=$post_id") . "#p$post_id"; + $pm_id = 0; +} +else +{ + $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&p=$pm_id"); + $post_id = 0; + $forum_id = 0; +} // Has the report been cancelled? if (isset($_POST['cancel'])) @@ -43,52 +54,79 @@ if (isset($_POST['cancel'])) redirect($redirect_url); } -// Grab all relevant data -$sql = 'SELECT t.*, p.* - FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t - WHERE p.post_id = $post_id - AND p.topic_id = t.topic_id"; -$result = $db->sql_query($sql); -$report_data = $db->sql_fetchrow($result); -$db->sql_freeresult($result); - -if (!$report_data) +if ($post_id) { - trigger_error('POST_NOT_EXIST'); -} + // Grab all relevant data + $sql = 'SELECT t.*, p.* + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t + WHERE p.post_id = $post_id + AND p.topic_id = t.topic_id"; + $result = $db->sql_query($sql); + $report_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); -$forum_id = (int) ($report_data['forum_id']) ? $report_data['forum_id'] : $forum_id; -$topic_id = (int) $report_data['topic_id']; - -$sql = 'SELECT * - FROM ' . FORUMS_TABLE . ' - WHERE forum_id = ' . $forum_id; -$result = $db->sql_query($sql); -$forum_data = $db->sql_fetchrow($result); -$db->sql_freeresult($result); - -if (!$forum_data) -{ - trigger_error('FORUM_NOT_EXIST'); -} - -// Check required permissions -$acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT'); - -foreach ($acl_check_ary as $acl => $error) -{ - if (!$auth->acl_get($acl, $forum_id)) + if (!$report_data) { - trigger_error($error); + trigger_error('POST_NOT_EXIST'); + } + + $forum_id = (int) ($report_data['forum_id']) ? $report_data['forum_id'] : $forum_id; + $topic_id = (int) $report_data['topic_id']; + + $sql = 'SELECT * + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $forum_id; + $result = $db->sql_query($sql); + $forum_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$forum_data) + { + trigger_error('FORUM_NOT_EXIST'); + } + + // Check required permissions + $acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT'); + + foreach ($acl_check_ary as $acl => $error) + { + if (!$auth->acl_get($acl, $forum_id)) + { + trigger_error($error); + } + } + unset($acl_check_ary); + + if ($report_data['post_reported']) + { + $message = $user->lang['ALREADY_REPORTED']; + $message .= '

      ' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + trigger_error($message); } } -unset($acl_check_ary); - -if ($report_data['post_reported']) +else { - $message = $user->lang['ALREADY_REPORTED']; - $message .= '

      ' . sprintf($user->lang['RETURN_TOPIC'], '', ''); - trigger_error($message); + // Grab all relevant data + $sql = 'SELECT p.*, pt.* + FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . " pt + WHERE p.msg_id = $pm_id + AND p.msg_id = pt.msg_id + AND (p.author_id = " . $user->data['user_id'] . " OR pt.user_id = " . $user->data['user_id'] . ")"; + $result = $db->sql_query($sql); + $report_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$report_data) + { + trigger_error('PM_NOT_EXIST'); + } + + if ($report_data['message_reported']) + { + $message = $user->lang['ALREADY_REPORTED_PM']; + $message .= '

      ' . sprintf($user->lang['RETURN_PM'], '', ''); + trigger_error($message); + } } // Submit report? @@ -109,6 +147,7 @@ if ($submit && $reason_id) $sql_ary = array( 'reason_id' => (int) $reason_id, 'post_id' => $post_id, + 'pm_id' => $pm_id, 'user_id' => (int) $user->data['user_id'], 'user_notify' => (int) $user_notify, 'report_closed' => 0, @@ -120,26 +159,55 @@ if ($submit && $reason_id) $db->sql_query($sql); $report_id = $db->sql_nextid(); - if (!$report_data['post_reported']) + if ($post_id) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_reported = 1 WHERE post_id = ' . $post_id; $db->sql_query($sql); - } - if (!$report_data['topic_reported']) + if (!$report_data['topic_reported']) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_reported = 1 + WHERE topic_id = ' . $report_data['topic_id'] . ' + OR topic_moved_id = ' . $report_data['topic_id']; + $db->sql_query($sql); + } + + $lang_return = $user->lang['RETURN_TOPIC']; + $lang_success = $user->lang['POST_REPORTED_SUCCESS']; + } + else { - $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_reported = 1 - WHERE topic_id = ' . $report_data['topic_id'] . ' - OR topic_moved_id = ' . $report_data['topic_id']; + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_reported = 1 + WHERE msg_id = ' . $pm_id; $db->sql_query($sql); + + $sql_ary = array( + 'msg_id' => $pm_id, + 'user_id' => ANONYMOUS, + 'author_id' => (int) $report_data['author_id'], + 'pm_deleted' => 0, + 'pm_new' => 0, + 'pm_unread' => 0, + 'pm_replied' => 0, + 'pm_marked' => 0, + 'pm_forwarded' => 0, + 'folder_id' => PRIVMSGS_INBOX, + ); + + $sql = 'INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + + $lang_return = $user->lang['RETURN_PM']; + $lang_success = $user->lang['PM_REPORTED_SUCCESS']; } meta_refresh(3, $redirect_url); - $message = $user->lang['POST_REPORTED_SUCCESS'] . '

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

      ' . sprintf($lang_return, '', ''); trigger_error($message); } @@ -147,8 +215,9 @@ if ($submit && $reason_id) display_reasons($reason_id); $template->assign_vars(array( + 'S_REPORT_POST' => ($pm_id) ? false : true, 'REPORT_TEXT' => $report_text, - 'S_REPORT_ACTION' => append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $post_id), + 'S_REPORT_ACTION' => append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $post_id . '&pm=' . $pm_id), 'S_NOTIFY' => $user_notify, 'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false) diff --git a/phpBB/styles/prosilver/template/mcp_front.html b/phpBB/styles/prosilver/template/mcp_front.html index e0152391b9..9e93d09f24 100644 --- a/phpBB/styles/prosilver/template/mcp_front.html +++ b/phpBB/styles/prosilver/template/mcp_front.html @@ -100,6 +100,47 @@ + +
      +
      + +

      {L_LATEST_REPORTED_PMS}

      +

      {L_PM_REPORTS_TOTAL}

      + + +
        +
      • +
        +
        {L_VIEW_DETAILS}
        +
        {L_REPORTER}
        +
        +
      • +
      +
        + + +
      • +
        +
        + {pm_report.PM_SUBJECT} {pm_report.ATTACH_ICON_IMG}
        + {L_MESSAGE_BY_AUTHOR} {pm_report.PM_AUTHOR_FULL} » {pm_report.PM_TIME}
        + {L_MESSAGE_TO} {pm_report.RECIPIENTS} +
        +
        + {L_REPORTED} {L_POST_BY_AUTHOR} {pm_report.REPORTER_FULL} {L_REPORTED_ON_DATE} {pm_report.REPORT_TIME} +
        +
        +
      • + +
      + +

      {L_PM_REPORTS_ZERO_TOTAL}

      + + +
      +
      + +
      diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html index 0e23148175..0ae4279a8e 100644 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -1,7 +1,11 @@ + +

      {L_PM_REPORT_DETAILS}

      +

      {L_REPORT_DETAILS}

      +
      @@ -51,7 +55,16 @@

      {POST_SUBJECT}

      + +

      + {L_SENT_AT}: {POST_DATE} +
      {L_PM_FROM}: {POST_AUTHOR_FULL} +
      {L_TO}: {to_recipient.NAME_FULL}{to_recipient.NAME}  +
      {L_BCC}: {bcc_recipient.NAME_FULL}{bcc_recipient.NAME}  +

      +

      {MINI_POST_IMG} {L_POSTED} {L_POST_BY_AUTHOR} {POST_AUTHOR_FULL} » {POST_DATE}

      + @@ -152,7 +165,7 @@
      -

      {RETURN_QUEUE} | {RETURN_TOPIC_SIMPLE} | {RETURN_POST}{RETURN_REPORTS} | {L_VIEW_POST} | {L_VIEW_TOPIC} | {L_VIEW_FORUM}{RETURN_TOPIC}

      +

      {RETURN_QUEUE} | {RETURN_TOPIC_SIMPLE} | {RETURN_POST}{RETURN_REPORTS} | {L_VIEW_POST} | {L_VIEW_TOPIC} | {L_VIEW_FORUM}{RETURN_TOPIC}

      diff --git a/phpBB/styles/prosilver/template/mcp_reports.html b/phpBB/styles/prosilver/template/mcp_reports.html index 4e9db078c2..13a60a1e0b 100644 --- a/phpBB/styles/prosilver/template/mcp_reports.html +++ b/phpBB/styles/prosilver/template/mcp_reports.html @@ -2,11 +2,13 @@ +
      {S_FORM_TOKEN}
      +

      {L_TITLE}

      @@ -26,7 +28,7 @@
    708. {L_VIEW_DETAILS}
      -
      {L_REPORTER} & {L_FORUM}
      +
      {L_REPORTER} & {L_FORUM}
      {L_MARK}
    709. @@ -36,6 +38,16 @@
    710. + +
      + {postrow.PM_SUBJECT} {postrow.ATTACH_ICON_IMG}
      + {L_MESSAGE_BY_AUTHOR} {postrow.PM_AUTHOR_FULL} » {postrow.PM_TIME}
      + {L_MESSAGE_TO} {postrow.RECIPIENTS} +
      +
      + {postrow.REPORTER_FULL} {L_REPORTED_ON_DATE} {postrow.REPORT_TIME} +
      +
      {postrow.POST_SUBJECT} {postrow.ATTACH_ICON_IMG}
      {L_POSTED} {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} » {postrow.POST_TIME} @@ -44,6 +56,7 @@ {postrow.REPORTER_FULL} {L_REPORTED_ON_DATE} {postrow.REPORT_TIME}
      {L_FORUM}: {postrow.FORUM_NAME}
    711. +
      diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index 56066cdf37..059ae4703a 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -18,10 +18,11 @@
      - + diff --git a/phpBB/styles/subsilver2/template/mcp_front.html b/phpBB/styles/subsilver2/template/mcp_front.html index 029ba3cb3c..aefc6ccd6c 100644 --- a/phpBB/styles/subsilver2/template/mcp_front.html +++ b/phpBB/styles/subsilver2/template/mcp_front.html @@ -85,6 +85,43 @@

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      {L_LATEST_REPORTED_PMS}
       {L_PM_SUBJECT}  {L_PM_FROM}  {L_TO} & {L_BCC}  {L_SENT_AT}  {L_REPORTER}  {L_REPORT_TIME} 
      {pm_report.PM_SUBJECT}
      [ {L_VIEW_DETAILS} ]
      {pm_report.PM_AUTHOR_FULL}{pm_report.RECIPIENTS}{pm_report.PM_TIME}{pm_report.REPORTER_FULL}{pm_report.REPORT_TIME}
      {L_PM_REPORTS_ZERO_TOTAL}
      {L_PM_REPORTS_TOTAL}
      + +

      + + diff --git a/phpBB/styles/subsilver2/template/mcp_post.html b/phpBB/styles/subsilver2/template/mcp_post.html index 6260c79d7d..d631ce262f 100644 --- a/phpBB/styles/subsilver2/template/mcp_post.html +++ b/phpBB/styles/subsilver2/template/mcp_post.html @@ -5,7 +5,7 @@
      - + @@ -43,17 +43,17 @@
      {L_REPORT_DETAILS}{L_PM_REPORT_DETAILS}{L_REPORT_DETAILS}
      {L_REPORT_REASON}:
      - + - + - + - + @@ -69,9 +69,30 @@ - + + + + + + + + + + + + + + diff --git a/phpBB/styles/subsilver2/template/mcp_reports.html b/phpBB/styles/subsilver2/template/mcp_reports.html index 72b26e8751..1b6a3b82b6 100644 --- a/phpBB/styles/subsilver2/template/mcp_reports.html +++ b/phpBB/styles/subsilver2/template/mcp_reports.html @@ -7,11 +7,16 @@ - + + + + + + @@ -19,10 +24,17 @@ + + + + + diff --git a/phpBB/styles/subsilver2/template/report_body.html b/phpBB/styles/subsilver2/template/report_body.html index 6861d28ce1..7cd7d1040f 100644 --- a/phpBB/styles/subsilver2/template/report_body.html +++ b/phpBB/styles/subsilver2/template/report_body.html @@ -4,10 +4,10 @@
      {L_POST_DETAILS}{L_PM}{L_POST_DETAILS}
      {RETURN_QUEUE} | {RETURN_TOPIC_SIMPLE} | {RETURN_POST}{RETURN_REPORTS} | {L_VIEW_POST} | {L_VIEW_TOPIC} | {L_VIEW_FORUM}{RETURN_TOPIC}{RETURN_QUEUE} | {RETURN_TOPIC_SIMPLE} | {RETURN_POST}{RETURN_REPORTS} | {L_VIEW_PM}{L_VIEW_POST} | {L_VIEW_TOPIC} | {L_VIEW_FORUM}{RETURN_TOPIC}
      {L_POST_SUBJECT}: {L_PM_SUBJECT}{L_POST_SUBJECT}: {POST_SUBJECT} {UNAPPROVED_IMG} {L_POST_UNAPPROVED} {REPORTED_IMG} {L_POST_REPORTED}
      {L_POSTER}: {L_PM_FROM}{L_POSTER}: style="font-weight: bold; color: {POST_AUTHOR_COLOUR}">{POST_AUTHOR}   [ {L_READ_PROFILE} | {L_VIEW_NOTES} | {L_WARN_USER} ]
      {L_POSTED}: {L_SENT_AT}{L_POSTED}: {POST_DATE}
      {L_TO}: + + {to_recipient.NAME}{to_recipient.NAME_FULL}  + +
      {L_BCC}: + + {bcc_recipient.NAME}{bcc_recipient.NAME_FULL}  + +
      {L_PREVIEW}
      {L_DISPLAY_OPTIONS}
      {L_DISPLAY_POSTS}: {S_SELECT_SORT_DAYS} {L_SORT_BY} {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} {L_FORUM}     {L_ONLY_TOPIC}   {L_DISPLAY_POSTS}: {S_SELECT_SORT_DAYS} {L_SORT_BY} {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} {L_FORUM}     {L_ONLY_TOPIC}  
       {L_PM}  {L_TO} & {L_BCC}   {L_POST}   {L_AUTHOR}   {L_REPORTER}   {L_REPORT_TIME}   {L_SELECT} 

      {postrow.PM_SUBJECT}

      + {L_PM_FROM}: {postrow.PM_AUTHOR_FULL}
      {postrow.RECIPIENTS}
      + {L_SENT_AT}: {postrow.PM_TIME}

      {postrow.POST_SUBJECT}

      {L_FORUM}: {postrow.FORUM_NAME}{postrow.FORUM_NAME}
      {postrow.POST_AUTHOR_FULL}
      {postrow.POST_TIME}
      {postrow.REPORTER_FULL} {postrow.REPORT_TIME}
      [ {L_VIEW_DETAILS} ]
      - + - + diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html index b3387681bc..4971506a6d 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html @@ -93,7 +93,7 @@
      {L_REPORT_POST}{L_REPORT_POST}{L_REPORT_MESSAGE}
      {L_REPORT_POST_EXPLAIN}{L_REPORT_POST_EXPLAIN}{L_REPORT_MESSAGE_EXPLAIN}
      {L_REASON}:
      - +
      {DELETE_IMG} {REPORT_IMG} {DELETE_IMG}
      From cbed011ee3ca1fb545c23b2feba84a329a0f65c5 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 21 Jul 2009 22:51:39 +0000 Subject: [PATCH 284/607] Adding info on the VCS to coding guidelines git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9817 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/coding-guidelines.html | 65 ++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index bfd134faac..32312054d9 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -86,6 +86,12 @@
    712. Writing Style
  2. +
  3. VCS Guidelines +
      +
    1. Repository structure
    2. +
    3. Commit messages
    4. +
    +
  4. Guidelines Changelog
  5. Copyright and disclaimer
@@ -2252,12 +2258,67 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
-

7. Guidelines Changelog

+

7. VCS Guidelines

+
+

The version control system for phpBB3 is subversion. The repository is available at http://code.phpbb.com/svn/phpbb. + +

7.i. Repository Structure

+ +
    +
  • trunk
    The latest unstable development version with new features etc. Contains the actual board in /trunk/phpBB
  • +
  • branches
    Development branches of stable phpBB releases. Copied from /trunk at the time of release. +
      +
    • phpBB3.0/branches/phpBB-3_0_0/phpBB
      Development branch of the stable 3.0 line. Bug fixes are applied here.
    • +
    • phpBB2/branches/phpBB-2_0_0/phpBB
      Old phpBB2 development branch.
    • +
    +
  • +
  • tags
    Released versions. Copies of trunk or the respective branch, made at the time of release. +
      +
    • /tags/release_3_0_BX
      Beta release X of the 3.0 line.
    • +
    • /tags/release_3_0_RCX
      Release candidate X of the 3.0 line.
    • +
    • /tags/release_3_0_X-RCY
      Release candidate Y of the stable 3.0.X release.
    • +
    • /tags/release_3_0_X
      Stable 3.0.X release.
    • +
    • /tags/release_2_0_X
      Old stable 2.0.X release.
    • +
    +
  • +
+ +

7.ii. Commit Messages

+ +

The commit message should contain a brief explanation of all changes made within the commit. Often identical to the changelog entry. A bug ticket can be referenced by specifying the ticket ID with a hash, e.g. #12345. A reference to another revision should simply be prefixed with r, e.g. r12345.

+ +

Junior Developers need to have their patches approved by a development team member first. The commit message must end in a line with the following format:

+ +
+Authorised by: developer1[, developer2[, ...]]
+	
+ +
+ + + +
+
+ +
+ +

8. Guidelines Changelog

+
+
+ +
+ + +

Revision 9817

+ +
    +
  • Added VCS section.
  • +

Revision 8732

@@ -2330,7 +2391,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
-

8. Copyright and disclaimer

+

9. Copyright and disclaimer

From 8e8c40bc75f1394dfcb9fd772858069388b86b06 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 22 Jul 2009 00:11:46 +0000 Subject: [PATCH 285/607] - Added install_id to data collector - config variable whitelist, so sensitive MOD info is not transmitted, currently mostly bool/int values - should we reduce the amount of data? git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9818 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_send_statistics.html | 8 +- phpBB/includes/acp/acp_send_statistics.php | 15 +- .../includes/questionnaire/questionnaire.php | 260 ++++++++++++++---- 3 files changed, 228 insertions(+), 55 deletions(-) diff --git a/phpBB/adm/style/acp_send_statistics.html b/phpBB/adm/style/acp_send_statistics.html index ce45705559..1097dbd438 100644 --- a/phpBB/adm/style/acp_send_statistics.html +++ b/phpBB/adm/style/acp_send_statistics.html @@ -17,8 +17,8 @@ function iframe_updated() return; } - //dE('questionnaire-form', -1); - //dE('questionnaire-thanks', 1); + dE('questionnaire-form', -1); + dE('questionnaire-thanks', 1); } //]]> @@ -59,8 +59,8 @@ function iframe_updated() diff --git a/phpBB/includes/acp/acp_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php index 6c29b9fbb5..c76b450605 100644 --- a/phpBB/includes/acp/acp_send_statistics.php +++ b/phpBB/includes/acp/acp_send_statistics.php @@ -29,12 +29,23 @@ class acp_send_statistics { global $config, $template; - $collect_url = "http://www.phpbb.com/stats/getstatdata.php"; + $collect_url = "http://www.phpbb.com/stats/receive_stats.php"; $this->tpl_name = 'acp_send_statistics'; $this->page_title = 'ACP_SEND_STATISTICS'; - $collector = new phpbb_questionnaire_data_collector(); + // generate a unique id if necessary + if (!isset($config['questionnaire_unique_id'])) + { + $install_id = unique_id(); + set_config('questionnaire_unique_id', $install_id); + } + else + { + $install_id = $config['questionnaire_unique_id']; + } + + $collector = new phpbb_questionnaire_data_collector($install_id); // Add data provider $collector->add_data_provider(new phpbb_questionnaire_php_data_provider()); diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 42ac44d38a..e9f9172754 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -30,15 +30,16 @@ class phpbb_questionnaire_data_collector { var $providers; var $data = null; + var $install_id = ''; /** * Constructor. * - * @param array * @param string */ - function phpbb_questionnaire_data_collector() + function phpbb_questionnaire_data_collector($install_id) { + $this->install_id = $install_id; $this->providers = array(); } @@ -79,6 +80,7 @@ class phpbb_questionnaire_data_collector $provider = &$this->providers[$key]; $this->data[$provider->get_identifier()] = $provider->get_data(); } + $this->data['install_id'] = $this->install_id; } } @@ -229,62 +231,222 @@ class phpbb_questionnaire_phpbb_data_provider */ function get_data() { - // Exclude certain config vars - $exclude_config_vars = array( - 'avatar_gallery_path' => true, - 'avatar_path' => true, - 'avatar_salt' => true, - 'board_contact' => true, - 'board_disable_msg' => true, - 'board_email' => true, - 'board_email_sig' => true, - 'cookie_name' => true, - 'icons_path' => true, - 'icons_path' => true, - 'jab_host' => true, - 'jab_password' => true, - 'jab_port' => true, - 'jab_username' => true, - 'ldap_base_dn' => true, - 'ldap_email' => true, - 'ldap_password' => true, - 'ldap_port' => true, - 'ldap_server' => true, - 'ldap_uid' => true, - 'ldap_user' => true, - 'ldap_user_filter' => true, - 'ranks_path' => true, - 'script_path' => true, - 'server_name' => true, - 'server_port' => true, - 'server_protocol' => true, - 'site_desc' => true, - 'sitename' => true, - 'smilies_path' => true, - 'smtp_host' => true, - 'smtp_password' => true, - 'smtp_port' => true, - 'smtp_username' => true, - 'upload_icons_path' => true, - 'upload_path' => true, - 'newest_user_colour' => true, - 'newest_user_id' => true, - 'newest_username' => true, - 'rand_seed' => true, + global $phpbb_root_path, $phpEx; + include("{$phpbb_root_path}config.$phpEx"); + + // Only send certain config vars + $config_vars = array( + 'active_sessions' => true, + 'allow_attachments' => true, + 'allow_autologin' => true, + 'allow_avatar' => true, + 'allow_avatar_local' => true, + 'allow_avatar_remote' => true, + 'allow_avatar_upload' => true, + 'allow_bbcode' => true, + 'allow_birthdays' => true, + 'allow_bookmarks' => true, + 'allow_emailreuse' => true, + 'allow_forum_notify' => true, + 'allow_mass_pm' => true, + 'allow_name_chars' => true, + 'allow_namechange' => true, + 'allow_nocensors' => true, + 'allow_pm_attach' => true, + 'allow_post_flash' => true, + 'allow_post_links' => true, + 'allow_privmsg' => true, + 'allow_quick_reply' => true, + 'allow_sig' => true, + 'allow_sig_bbcode' => true, + 'allow_sig_flash' => true, + 'allow_sig_img' => true, + 'allow_sig_links' => true, + 'allow_sig_pm' => true, + 'allow_sig_smilies' => true, + 'allow_smilies' => true, + 'allow_topic_notify' => true, + 'attachment_quota' => true, + 'auth_bbcode_pm' => true, + 'auth_flash_pm' => true, + 'auth_img_pm' => true, + 'auth_method' => true, + 'auth_smilies_pm' => true, + 'avatar_filesize' => true, + 'avatar_max_height' => true, + 'avatar_max_width' => true, + 'avatar_min_height' => true, + 'avatar_min_width' => true, + 'board_dst' => true, + 'board_email_form' => true, + 'board_hide_emails' => true, + 'board_timezone' => true, + 'browser_check' => true, + 'bump_interval' => true, + 'bump_type' => true, + 'cache_gc' => true, + 'captcha_plugin' => true, + 'captcha_gd' => true, + 'captcha_gd_foreground_noise' => true, + 'captcha_gd_x_grid' => true, + 'captcha_gd_y_grid' => true, + 'captcha_gd_wave' => true, + 'captcha_gd_3d_noise' => true, + 'captcha_gd_fonts' => true, + 'confirm_refresh' => true, + 'check_attachment_content' => true, + 'check_dnsbl' => true, + 'chg_passforce' => true, + 'cookie_secure' => true, + 'coppa_enable' => true, + 'database_gc' => true, + 'dbms_version' => true, + 'default_dateformat' => true, + 'display_last_edited' => true, + 'display_order' => true, + 'edit_time' => true, + 'email_check_mx' => true, + 'email_enable' => true, + 'email_function_name' => true, + 'email_package_size' => true, + 'enable_confirm' => true, + 'enable_pm_icons' => true, + 'enable_post_confirm' => true, + 'feed_enable' => true, + 'feed_limit' => true, + 'feed_overall_forums' => true, + 'feed_overall_forums_limit' => true, + 'feed_overall_topics' => true, + 'feed_overall_topics_limit' => true, + 'feed_forum' => true, + 'feed_topic' => true, + 'feed_item_statistics' => true, + 'flood_interval' => true, + 'force_server_vars' => true, + 'form_token_lifetime' => true, + 'form_token_mintime' => true, + 'form_token_sid_guests' => true, + 'forward_pm' => true, + 'forwarded_for_check' => true, + 'full_folder_action' => true, + 'fulltext_native_common_thres' => true, + 'fulltext_native_load_upd' => true, + 'fulltext_native_max_chars' => true, + 'fulltext_native_min_chars' => true, + 'gzip_compress' => true, + 'hot_threshold' => true, + 'img_create_thumbnail' => true, + 'img_display_inlined' => true, + 'img_imagick' => true, + 'img_link_height' => true, + 'img_link_width' => true, + 'img_max_height' => true, + 'img_max_thumb_width' => true, + 'img_max_width' => true, + 'img_min_thumb_filesize' => true, + 'ip_check' => true, + 'jab_enable' => true, + 'jab_package_size' => true, + 'jab_use_ssl' => true, + 'limit_load' => true, + 'limit_search_load' => true, + 'load_anon_lastread' => true, + 'load_birthdays' => true, + 'load_cpf_memberlist' => true, + 'load_cpf_viewprofile' => true, + 'load_cpf_viewtopic' => true, + 'load_db_lastread' => true, + 'load_db_track' => true, + 'load_jumpbox' => true, + 'load_moderators' => true, + 'load_online' => true, + 'load_online_guests' => true, + 'load_online_time' => true, + 'load_onlinetrack' => true, + 'load_search' => true, + 'load_tplcompile' => true, + 'load_user_activity' => true, + 'max_attachments' => true, + 'max_attachments_pm' => true, + 'max_autologin_time' => true, + 'max_filesize' => true, + 'max_filesize_pm' => true, + 'max_login_attempts' => true, + 'max_name_chars' => true, + 'max_num_search_keywords' => true, + 'max_pass_chars' => true, + 'max_poll_options' => true, + 'max_post_chars' => true, + 'max_post_font_size' => true, + 'max_post_img_height' => true, + 'max_post_img_width' => true, + 'max_post_smilies' => true, + 'max_post_urls' => true, + 'max_quote_depth' => true, + 'max_reg_attempts' => true, + 'max_sig_chars' => true, + 'max_sig_font_size' => true, + 'max_sig_img_height' => true, + 'max_sig_img_width' => true, + 'max_sig_smilies' => true, + 'max_sig_urls' => true, + 'min_name_chars' => true, + 'min_pass_chars' => true, + 'min_post_chars' => true, + 'min_search_author_chars' => true, + 'mime_triggers' => true, + 'new_member_post_limit' => true, + 'new_member_group_default' => true, + 'override_user_style' => true, + 'pass_complex' => true, + 'pm_edit_time' => true, + 'pm_max_boxes' => true, + 'pm_max_msgs' => true, + 'pm_max_recipients' => true, + 'posts_per_page' => true, + 'print_pm' => true, + 'queue_interval' => true, + 'require_activation' => true, + 'referer_validation' => true, + 'search_block_size' => true, + 'search_gc' => true, + 'search_interval' => true, + 'search_anonymous_interval' => true, + 'search_type' => true, + 'search_store_results' => true, + 'secure_allow_deny' => true, + 'secure_allow_empty_referer' => true, + 'secure_downloads' => true, + 'session_gc' => true, + 'session_length' => true, + 'smtp_auth_method' => true, + 'smtp_delivery' => true, + 'topics_per_page' => true, + 'tpl_allow_php' => true, + 'version' => true, + 'warnings_expire_days' => true, + 'warnings_gc' => true, + + 'num_files' => true, + 'num_posts' => true, + 'num_topics' => true, + 'num_users' => true, + 'record_online_users' => true, ); $result = array(); foreach ($this->config as $name => $value) { - // Mods may add columns for storing passwords - we do not want to grab them - if (isset($exclude_config_vars[$name]) || strpos($name, 'password') !== false) + if (!isset($exclude_config_vars[$name])) { - continue; + $result['config.' . $name] = $value; } - - $result['config.' . $name] = $value; } + $result['dbms'] = $dbms; + $result['acm_type'] = $acm_type; + $result['load_extensions'] = $load_extensions; + return $result; } } From 2bb2e4a43b30bd3a686106865c84786de42d50e8 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 22 Jul 2009 01:01:55 +0000 Subject: [PATCH 286/607] Do not try to enter passive mode before logging in. Return error if ftp_nlist() returned error. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9819 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_transfer.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index c345f81e1d..2146d5fa0b 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -316,15 +316,15 @@ class ftp extends transfer return 'ERR_CONNECTING_SERVER'; } - // attempt to turn pasv mode on - @ftp_pasv($this->connection, true); - // login to the server if (!@ftp_login($this->connection, $this->username, $this->password)) { return 'ERR_UNABLE_TO_LOGIN'; } + // attempt to turn pasv mode on + @ftp_pasv($this->connection, true); + // change to the root directory if (!$this->_chdir($this->root_path)) { @@ -462,6 +462,12 @@ class ftp extends transfer { $list = @ftp_nlist($this->connection, $dir); + // Return on error + if ($list === false) + { + return false; + } + // Remove path if prepended foreach ($list as $key => $item) { From 81e67fbef141ea47249b5f9d1a4e1cb34263b248 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 22 Jul 2009 01:26:09 +0000 Subject: [PATCH 287/607] Fix bug #46295 - Be less strict with FTP daemons when getting directory filelists. Authorised by: bantu ;-) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9820 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_transfer.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8b5da10c72..356987cd33 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -169,6 +169,7 @@
  • [Fix] Display required fields notice on registration above the custom profile fields. (Bug #39665)
  • [Fix] Copy poll options properly when copying topic. (Bug #39065)
  • [Fix] Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags)
  • +
  • [Fix] Be less strict with FTP daemons when getting directory filelists. (Bug #46295)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index 2146d5fa0b..c1211eda52 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -462,6 +462,14 @@ class ftp extends transfer { $list = @ftp_nlist($this->connection, $dir); + // See bug #46295 - Some FTP daemons don't like './' + if ($dir === './') + { + // Let's try some alternatives + $list = (empty($list)) ? @ftp_nlist($this->connection, '.') : $list; + $list = (empty($list)) ? @ftp_nlist($this->connection, '') : $list; + } + // Return on error if ($list === false) { From 2a84b76f3062a87c0069da1db2bdca83509882b1 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 22 Jul 2009 02:57:36 +0000 Subject: [PATCH 288/607] Fix two potential problems with the ftp_fsock class. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9821 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_transfer.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index c1211eda52..7c5cd329a4 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -737,7 +737,12 @@ class ftp_fsock extends transfer $list = array(); while (!@feof($this->data_connection)) { - $list[] = preg_replace('#[\r\n]#', '', @fgets($this->data_connection, 512)); + $filename = preg_replace('#[\r\n]#', '', @fgets($this->data_connection, 512)); + + if ($filename !== '') + { + $list[] = $filename; + } } $this->_close_data_connection(); @@ -840,7 +845,7 @@ class ftp_fsock extends transfer $result = @fgets($this->connection, 512); $response .= $result; } - while (substr($response, 3, 1) != ' '); + while (substr($result, 3, 1) !== ' '); if (!preg_match('#^[123]#', $response)) { From 16e393b61d53843dfec3b88257925a0848c027ed Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 22 Jul 2009 03:02:45 +0000 Subject: [PATCH 289/607] Also fix bug #46295 in ftp_fsock class. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9822 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_transfer.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index 7c5cd329a4..046abede8e 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -483,7 +483,7 @@ class ftp extends transfer $item = str_replace('\\', '/', $item); $dir = str_replace('\\', '/', $dir); - if (strpos($item, $dir) === 0) + if (!empty($dir) && strpos($item, $dir) === 0) { $item = substr($item, strlen($dir)); } @@ -749,6 +749,20 @@ class ftp_fsock extends transfer // Clear buffer $this->_check_command(); + // See bug #46295 - Some FTP daemons don't like './' + if ($dir === './' && empty($list)) + { + // Let's try some alternatives + $list = $this->_ls('.'); + + if (empty($list)) + { + $list = $this->_ls(''); + } + + return $list; + } + // Remove path if prepended foreach ($list as $key => $item) { @@ -756,7 +770,7 @@ class ftp_fsock extends transfer $item = str_replace('\\', '/', $item); $dir = str_replace('\\', '/', $dir); - if (strpos($item, $dir) === 0) + if (!empty($dir) && strpos($item, $dir) === 0) { $item = substr($item, strlen($dir)); } From cef8c2d87e2c1e55a7fd6d57e3f998e531fd0bf2 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 22 Jul 2009 09:07:24 +0000 Subject: [PATCH 290/607] Parse email text files with the template engine. Did not check if this influences styles template cache list/purge/etc. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9823 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_messenger.php | 75 ++++++++++++++++++-------- 2 files changed, 54 insertions(+), 22 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 356987cd33..6011933082 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -219,6 +219,7 @@
  • [Feature] Ability to empty a user's outbox from the user ACP quick tools.
  • [Feature] Ability to filter ACP / MCP logs
  • [Feature] Users can report PMs to moderators which are then visible in a new MCP module
  • +
  • [Feature] Parse email text files with the template engine.
  • 1.ii. Changes since 3.0.4

    diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 4916ee41d7..2255b3dcb5 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -27,6 +27,8 @@ class messenger var $mail_priority = MAIL_NORMAL_PRIORITY; var $use_queue = true; + + var $tpl_obj = NULL; var $tpl_msg = array(); var $eol = "\n"; @@ -177,7 +179,7 @@ class messenger if (!trim($template_file)) { - trigger_error('No template file set', E_USER_ERROR); + trigger_error('No template file for emailing set.', E_USER_ERROR); } if (!trim($template_lang)) @@ -185,25 +187,25 @@ class messenger $template_lang = basename($config['default_lang']); } - if (empty($this->tpl_msg[$template_lang . $template_file])) + // tpl_msg now holds a template object we can use to parse the template file + if (!isset($this->tpl_msg[$template_lang . $template_file])) { - $tpl_file = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; - $tpl_file .= $template_lang . "/email/$template_file.txt"; + $this->tpl_msg[$template_lang . $template_file] = new template(); + $tpl = &$this->tpl_msg[$template_lang . $template_file]; - if (!file_exists($tpl_file)) - { - trigger_error("Could not find email template file [ $tpl_file ]", E_USER_ERROR); - } + $template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; + $template_path .= $template_lang . '/email'; - if (($data = @file_get_contents($tpl_file)) === false) - { - trigger_error("Failed opening template file [ $tpl_file ]", E_USER_ERROR); - } + $tpl->set_custom_template($template_path, $template_lang . '_email'); - $this->tpl_msg[$template_lang . $template_file] = $data; + $tpl->set_filenames(array( + 'body' => $template_file . '.txt', + )); } - $this->msg = $this->tpl_msg[$template_lang . $template_file]; + $this->tpl_obj = &$this->tpl_msg[$template_lang . $template_file]; + $this->vars = &$this->tpl_obj->_rootref; + $this->tpl_msg = ''; return true; } @@ -213,7 +215,22 @@ class messenger */ function assign_vars($vars) { - $this->vars = (empty($this->vars)) ? $vars : $this->vars + $vars; + if (!is_object($this->tpl_obj)) + { + return; + } + + $this->tpl_obj->assign_vars($vars); + } + + function assign_block_vars($blockname, $vars) + { + if (!is_object($this->tpl_obj)) + { + return; + } + + $this->tpl_obj->assign_block_vars($blockname, $vars); } /** @@ -224,15 +241,29 @@ class messenger global $config, $user; // We add some standard variables we always use, no need to specify them always - $this->vars['U_BOARD'] = (!isset($this->vars['U_BOARD'])) ? generate_board_url() : $this->vars['U_BOARD']; - $this->vars['EMAIL_SIG'] = (!isset($this->vars['EMAIL_SIG'])) ? str_replace('
    ', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])) : $this->vars['EMAIL_SIG']; - $this->vars['SITENAME'] = (!isset($this->vars['SITENAME'])) ? htmlspecialchars_decode($config['sitename']) : $this->vars['SITENAME']; + if (!isset($this->vars['U_BOARD'])) + { + $this->assign_vars(array( + 'U_BOARD' => generate_board_url(), + )); + } - // Escape all quotes, else the eval will fail. - $this->msg = str_replace ("'", "\'", $this->msg); - $this->msg = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "' . ((isset(\$this->vars['\\1'])) ? \$this->vars['\\1'] : '') . '", $this->msg); + if (!isset($this->vars['EMAIL_SIG'])) + { + $this->assign_vars(array( + 'EMAIL_SIG' => str_replace('
    ', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), + )); + } - eval("\$this->msg = '$this->msg';"); + if (!isset($this->vars['SITENAME'])) + { + $this->assign_vars(array( + 'SITENAME' => htmlspecialchars_decode($config['sitename']), + )); + } + + // Parse message through template + $this->msg = trim($this->tpl_obj->assign_display('body')); // We now try and pull a subject from the email body ... if it exists, // do this here because the subject may contain a variable From 5d7dfaebe1099dbf375950026a5ab0916f174c5b Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 22 Jul 2009 10:08:14 +0000 Subject: [PATCH 291/607] layout git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9824 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/captcha_qa_acp.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/captcha_qa_acp.html b/phpBB/adm/style/captcha_qa_acp.html index 064d6969d1..c9a2a4c8ec 100644 --- a/phpBB/adm/style/captcha_qa_acp.html +++ b/phpBB/adm/style/captcha_qa_acp.html @@ -21,8 +21,8 @@ {L_QUESTION_TEXT} - {L_QUESTION_LANG} - {L_ACTION} + {L_QUESTION_LANG} + {L_ACTION} @@ -30,7 +30,7 @@ - {questions.QUESTION_TEXT} + {questions.QUESTION_TEXT} {questions.QUESTION_LANG} {ICON_EDIT}{ICON_DELETE} From 43d30134cb98bcfbbd29511c3a33d38b3b61f59e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 22 Jul 2009 10:09:25 +0000 Subject: [PATCH 292/607] removed spaces git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9825 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/questionnaire/questionnaire.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index e9f9172754..fe6e8a3bd7 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -23,8 +23,8 @@ if (!defined('IN_PHPBB')) * to a central server. For privacy reasons we try to collect only data which aren't private * or don't give any information which might help to identify the user. * -* @author Johannes Schlueter -* @copyright (c) 2007-2008 Johannes Schlueter +* @author Johannes Schlueter +* @copyright (c) 2007-2008 Johannes Schlueter */ class phpbb_questionnaire_data_collector { @@ -35,7 +35,7 @@ class phpbb_questionnaire_data_collector /** * Constructor. * - * @param string + * @param string */ function phpbb_questionnaire_data_collector($install_id) { @@ -51,7 +51,7 @@ class phpbb_questionnaire_data_collector /** * Get data as an array. * - * @return array All Data + * @return array All Data */ function get_data_raw() { @@ -71,7 +71,7 @@ class phpbb_questionnaire_data_collector /** * Collect info into the data property. * - * @return void + * @return void */ function collect() { @@ -80,7 +80,7 @@ class phpbb_questionnaire_data_collector $provider = &$this->providers[$key]; $this->data[$provider->get_identifier()] = $provider->get_data(); } - $this->data['install_id'] = $this->install_id; + $this->data['install_id'] = $this->install_id; } } @@ -100,7 +100,7 @@ class phpbb_questionnaire_php_data_provider /** * Get data about the PHP runtime setup. * - * @return array + * @return array */ function get_data() { @@ -144,7 +144,7 @@ class phpbb_questionnaire_system_data_provider /** * Get data about the general system information, like OS or IP (shortened). * - * @return array + * @return array */ function get_data() { From c04626fa4db74dd5effda4574616460d919bedb9 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 22 Jul 2009 10:42:01 +0000 Subject: [PATCH 293/607] index for GC git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9826 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index cd5ee8c91d..c8951cd167 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -294,7 +294,7 @@ class phpbb_captcha_qa 'confirm_type' => array('USINT', 0), ), 'KEYS' => array( - 'confirm_id' => array('INDEX', 'confirm_id'), + 'session_id' => array('INDEX', 'session_id'), 'lookup' => array('INDEX', array('confirm_id', 'session_id', 'lang_iso')), ), 'PRIMARY_KEY' => 'confirm_id', From 2dfd327828a5f6387ea051aa9e588f39249ed059 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 22 Jul 2009 10:57:56 +0000 Subject: [PATCH 294/607] index for GC git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9827 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index c8951cd167..7367816ae8 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -271,7 +271,6 @@ class phpbb_captcha_qa ), 'PRIMARY_KEY' => 'question_id', 'KEYS' => array( - 'question_id' => array('INDEX', array('question_id', 'lang_iso')), 'lang_iso' => array('INDEX', 'lang_iso'), ), ), From 818b252f208b92157b56b101aac555eb1efb8cee Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 22 Jul 2009 11:47:37 +0000 Subject: [PATCH 295/607] fix r9758 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9828 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_users.php | 19 ++++++++++++++++--- phpBB/includes/functions.php | 2 +- phpBB/language/en/acp/common.php | 5 ++++- .../prosilver/template/memberlist_view.html | 5 ++--- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index cb342ac300..7921b6df67 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1160,11 +1160,13 @@ class acp_users if ($deleteall) { - $deleted_warnings = '0'; + $log_warnings = $deleted_warnings = 0; } else { - $deleted_warnings = ' user_warnings - ' . $db->sql_affectedrows(); + $num_warnings = (int) $db->sql_affectedrows(); + $deleted_warnings = ' user_warnings - ' . $num_warnings; + $log_warnings = ($num_warnings > 2) ? 2 : $num_warnings; } $sql = 'UPDATE ' . USERS_TABLE . " @@ -1172,7 +1174,18 @@ class acp_users WHERE user_id = $user_id"; $db->sql_query($sql); - add_log('admin', 'LOG_WARNING_DELETED', $user_row['username']); + switch ($log_warnings) + { + case 2: + add_log('admin', 'LOG_WARNINGS_DELETED', $user_row['username'], $num_warnings); + break; + case 1: + add_log('admin', 'LOG_WARNING_DELETED', $user_row['username']); + break; + default: + add_log('admin', 'LOG_WARNINGS_DELETED_ALL', $user_row['username']); + break; + } } } else diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 2dd28b2ffe..1a791ebff9 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4035,7 +4035,7 @@ function page_footer($run_cron = true) // Tidy the cache $cron_type = 'tidy_cache'; } - else if ($config['warnings_last_gc'] && (time() - $config['warnings_gc'] > $config['warnings_last_gc'])) + else if ($config['warnings_expire_days'] && (time() - $config['warnings_gc'] > $config['warnings_last_gc'])) { $cron_type = 'tidy_warnings'; } diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index ac8a14a21c..85380b2fd2 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -707,7 +707,6 @@ $lang = array_merge($lang, array( 'LOG_USER_REACTIVATE_USER' => 'Forced user account reactivation', 'LOG_USER_UNLOCK' => 'User unlocked own topic
    » %s', 'LOG_USER_WARNING' => 'Added user warning
    » %s', - 'LOG_WARNING_DELETED' => 'Deleted user warning
    » %s', 'LOG_USER_WARNING_BODY' => 'The following warning was issued to this user
    » %s', 'LOG_USER_GROUP_CHANGE' => 'User changed default group
    » %s', @@ -716,6 +715,10 @@ $lang = array_merge($lang, array( 'LOG_USER_GROUP_JOIN_PENDING' => 'User joined group and needs to be approved
    » %s', 'LOG_USER_GROUP_RESIGN' => 'User resigned membership from group
    » %s', + 'LOG_WARNING_DELETED' => 'Deleted user warning
    » %s', + 'LOG_WARNINGS_DELETED' => 'Deleted %2$s user warnings
    » %1$s', // Example: 'Deleted 2 user warnings
    » username' + 'LOG_WARNINGS_DELETED_ALL' => 'Deleted all user warnings
    » %s', + 'LOG_WORD_ADD' => 'Added word censor
    » %s', 'LOG_WORD_DELETE' => 'Deleted word censor
    » %s', 'LOG_WORD_EDIT' => 'Edited word censor
    » %s', diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index b9e6f5006d..abeecf8bf9 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -59,8 +59,7 @@
    {L_EMAIL_ADDRESS}:
    {L_SEND_EMAIL_USER} {USERNAME}
    {L_WEBSITE}:
    {U_WWW}
    -
    {L_PM}:
    {L_SEND_PRIVATE_MESSAGE}
    - +
    {L_PM}:
    {L_SEND_PRIVATE_MESSAGE}
    {L_MSNM}:
    {L_SEND_MSNM_MESSAGE}{USER_MSN}
    {L_YIM}:
    {L_SEND_YIM_MESSAGE}{USER_YIM}
    {L_AIM}:
    {L_SEND_AIM_MESSAGE}{USER_AIM}
    @@ -78,7 +77,7 @@
    {L_JOINED}:
    {JOINED}
    {L_VISITED}:
    {VISITED}
    - +
    {L_WARNINGS}:
    {WARNINGS} [ {L_VIEW_NOTES} | {L_WARN_USER} ]
    From 54f78a50bc6162fd49e506892a455f7bb43e31fb Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 22 Jul 2009 13:09:22 +0000 Subject: [PATCH 296/607] insert pm_reports module with correct basename on update git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9829 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 3b6c614deb..c055449d5f 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1217,7 +1217,7 @@ function change_database_data(&$no_updates, $version) if (!$row2) { $module_data = array( - 'module_basename' => 'users', + 'module_basename' => 'pm_reports', 'module_enabled' => 1, 'module_display' => 1, 'parent_id' => $category_id, From 00e81e704d78c7f4f45d1536ad170ed8dd985e84 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 22 Jul 2009 13:33:54 +0000 Subject: [PATCH 297/607] fix mcp sorting for pm_reports, and some minor language changes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9830 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/mcp/mcp_pm_reports.php | 8 ++++---- phpBB/language/en/mcp.php | 2 +- phpBB/language/en/ucp.php | 1 + phpBB/mcp.php | 16 +++++++++++----- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 0e94d7e017..72f77fae7c 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -221,7 +221,7 @@ class mcp_pm_reports if ($mode == 'pm_reports') { - $report_state = 'pm.message_reported = 1 AND r.report_closed = 0'; + $report_state = 'p.message_reported = 1 AND r.report_closed = 0'; } else { @@ -229,10 +229,10 @@ class mcp_pm_reports } $sql = 'SELECT r.report_id - FROM ' . PRIVMSGS_TABLE . ' pm, ' . REPORTS_TABLE . ' r ' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . (($sort_order_sql[0] == 'r') ? ', ' . USERS_TABLE . ' ru' : '') . " + FROM ' . PRIVMSGS_TABLE . ' p, ' . REPORTS_TABLE . ' r ' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . (($sort_order_sql[0] == 'r') ? ', ' . USERS_TABLE . ' ru' : '') . " WHERE $report_state - AND r.pm_id = pm.msg_id - " . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = pm.author_id' : '') . ' + AND r.pm_id = p.msg_id + " . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.author_id' : '') . ' ' . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = r.user_id' : '') . " AND r.post_id = 0 $limit_time_sql diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index 18195fd0f8..58088032df 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -286,7 +286,7 @@ $lang = array_merge($lang, array( 'REPORT_DELETED_SUCCESS' => 'The selected report has been deleted successfully.', 'REPORT_DETAILS' => 'Report details', 'REPORT_MESSAGE' => 'Report this message', - 'REPORT_MESSAGE_EXPLAIN' => 'Use this form to report the selected private message. Reporting should generally be used only if the message breaks forum rules. Reporting a private message will make its contents visible to all moderators', + 'REPORT_MESSAGE_EXPLAIN' => 'Use this form to report the selected private message. Reporting should generally be used only if the message breaks forum rules. Reporting a private message will make its contents visible to all moderators.', 'REPORT_NOTIFY' => 'Notify me', 'REPORT_NOTIFY_EXPLAIN' => 'Informs you when your report is dealt with.', 'REPORT_POST_EXPLAIN' => 'Use this form to report the selected post to the forum moderators and board administrators. Reporting should generally be used only if the post breaks forum rules.', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index d0ae957340..4a80e568a2 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -374,6 +374,7 @@ $lang = array_merge($lang, array( 'RENAME' => 'Rename', 'RENAME_FOLDER' => 'Rename folder', 'REPLIED_MESSAGE' => 'Replied to message', + 'REPORT_PM' => 'Report private message', 'RESIGN_SELECTED' => 'Resign selected', 'RETURN_FOLDER' => '%1$sReturn to previous folder%2$s', 'RETURN_UCP' => '%sReturn to the User Control Panel%s', diff --git a/phpBB/mcp.php b/phpBB/mcp.php index e04bd7cab2..48cd68500f 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -698,13 +698,13 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, case 'pm_reports_closed': case 'reports': case 'reports_closed': - $type = 'reports'; + $pm = (strpos($mode, 'pm_') === 0) ? true : false; + + $type = ($pm) ? 'pm_reports' : 'reports'; $default_key = 't'; $default_dir = 'd'; $limit_time_sql = ($min_time) ? "AND r.report_time >= $min_time" : ''; - $pm = (strpos($mode, 'pm_') === 0) ? true : false; - if ($topic_id) { $where_sql .= ' p.topic_id = ' . $topic_id . ' AND '; @@ -713,12 +713,12 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, { $where_sql .= ' p.forum_id = ' . $forum_id . ' AND '; } - else if ($pm) + else if (!$pm) { $where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list(array('!f_read', '!m_report')), true, true) . ' AND '; } - if ($mode == 'reports') + if ($mode == 'reports' || $mode == 'pm_reports') { $where_sql .= ' r.report_closed = 0 AND '; } @@ -785,6 +785,12 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, $sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.post_time', 't' => 'r.report_time', 's' => 'p.post_subject'); break; + case 'pm_reports': + $limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']); + $sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.message_time', 't' => 'r.report_time', 's' => 'p.message_subject'); + break; + case 'logs': $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); From 87dc01de256d31836cf67032e344da8ed01d1d8e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 22 Jul 2009 15:44:43 +0000 Subject: [PATCH 298/607] incorrect loop var in template git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9831 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/mcp_front.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/mcp_front.html b/phpBB/styles/prosilver/template/mcp_front.html index 9e93d09f24..c0d5fc815c 100644 --- a/phpBB/styles/prosilver/template/mcp_front.html +++ b/phpBB/styles/prosilver/template/mcp_front.html @@ -107,7 +107,7 @@

    {L_LATEST_REPORTED_PMS}

    {L_PM_REPORTS_TOTAL}

    - +
    • From a2f70721963677a1b241a1cf6bbcbb0c6e90d5d4 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 22 Jul 2009 15:45:46 +0000 Subject: [PATCH 299/607] missing language variable git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9832 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/mcp.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index 58088032df..a1f276c9d9 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -254,6 +254,7 @@ $lang = array_merge($lang, array( 'PM_REPORTED_SUCCESS' => 'This private message has been successfully reported.', 'PM_REPORTS_TOTAL' => 'In total there are %d PM reports to review.', 'PM_REPORTS_ZERO_TOTAL' => 'There are no PM reports to review.', + 'PM_REPORT_DETAILS' => 'Private message report details', 'POSTER' => 'Poster', 'POSTS_APPROVED_SUCCESS' => 'The selected posts have been approved.', 'POSTS_DELETED_SUCCESS' => 'The selected posts have been successfully removed from the database.', From 03d7465d0874501b3784a56d2a4c998084789561 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 22 Jul 2009 15:47:00 +0000 Subject: [PATCH 300/607] use « instead of ON string git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9833 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/mcp_post.html | 6 +++--- phpBB/styles/prosilver/template/mcp_reports.html | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html index 0ae4279a8e..8a3c8e7309 100644 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -12,7 +12,7 @@

      {L_REPORT_REASON}: {REPORT_REASON_TITLE}

      -

      {L_REPORTED} {L_POST_BY_AUTHOR} {REPORTER_FULL} {L_REPORTED_ON_DATE} {REPORT_DATE}

      +

      {L_REPORTED} {L_POST_BY_AUTHOR} {REPORTER_FULL} « {REPORT_DATE}

      {L_REPORT_CLOSED}

      @@ -184,7 +184,7 @@

      {L_FEEDBACK}

      - {L_REPORTED_BY}: {usernotes.REPORT_BY} {L_REPORTED_ON_DATE} {usernotes.REPORT_AT} + {L_REPORTED_BY}: {usernotes.REPORT_BY} « {usernotes.REPORT_AT}
      {usernotes.ACTION}
      @@ -224,7 +224,7 @@

      {L_MCP_POST_REPORTS}

      - {L_REPORTED_BY}: {reports.REPORTER}{reports.REPORTER} {L_REPORTED_ON_DATE} {reports.REPORT_TIME} + {L_REPORTED_BY}: {reports.REPORTER}{reports.REPORTER} « {reports.REPORT_TIME}

      {reports.REASON_TITLE}: {reports.REASON_DESC}
      {reports.REPORT_TEXT}

      diff --git a/phpBB/styles/prosilver/template/mcp_reports.html b/phpBB/styles/prosilver/template/mcp_reports.html index 13a60a1e0b..649154deb4 100644 --- a/phpBB/styles/prosilver/template/mcp_reports.html +++ b/phpBB/styles/prosilver/template/mcp_reports.html @@ -45,7 +45,7 @@ {L_MESSAGE_TO} {postrow.RECIPIENTS}
      - {postrow.REPORTER_FULL} {L_REPORTED_ON_DATE} {postrow.REPORT_TIME} + {postrow.REPORTER_FULL} « {postrow.REPORT_TIME}
      @@ -53,7 +53,7 @@ {L_POSTED} {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} » {postrow.POST_TIME}
      - {postrow.REPORTER_FULL} {L_REPORTED_ON_DATE} {postrow.REPORT_TIME}
      + {postrow.REPORTER_FULL} « {postrow.REPORT_TIME}
      {L_FORUM}: {postrow.FORUM_NAME}
      From e90f25e9b4090be3e631fe951c558f226add0c9f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 22 Jul 2009 15:50:31 +0000 Subject: [PATCH 301/607] geez I'm blind - use the right template and lang vars git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9834 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/mcp/mcp_front.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index ee75c1daff..b844796955 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -322,15 +322,15 @@ function mcp_front_view($id, $mode, $action) if ($total == 0) { $template->assign_vars(array( - 'L_REPORTS_TOTAL' => $user->lang['REPORTS_ZERO_TOTAL'], + 'L_REPORTS_TOTAL' => $user->lang['PM_REPORTS_ZERO_TOTAL'], 'S_HAS_PM_REPORTS' => false) ); } else { $template->assign_vars(array( - 'L_REPORTS_TOTAL' => ($total == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total), - 'S_HAS_REPORTS' => true) + 'L_REPORTS_TOTAL' => ($total == 1) ? $user->lang['PM_REPORT_TOTAL'] : sprintf($user->lang['PM_REPORTS_TOTAL'], $total), + 'S_HAS_PM_REPORTS' => true) ); } } From be51bbe42b3ca03fe2dcc57205ab5853bf5955cd Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 22 Jul 2009 16:39:26 +0000 Subject: [PATCH 302/607] fall back to bbcode-less quotes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9835 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/posting.php | 10 +++- phpBB/styles/prosilver/template/editor.js | 51 ++++++++++++++++++- .../template/posting_topic_review.html | 5 ++ 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 53746437ba..9f7fefd81c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1187,7 +1187,15 @@ $message_parser->decode_message($post_data['bbcode_uid']); if ($mode == 'quote' && !$submit && !$preview && !$refresh) { - $message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n"; + if ($config['allow_bbcode']) + { + $message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n"; + } + else + { + $message = '> ' . utf8_wordwrap(censor_text(trim($message_parser->message)), 75, "\n> "); + $message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . " :\n" . $message . "\n"; + } } if (($mode == 'reply' || $mode == 'quote') && !$submit && !$preview && !$refresh) diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 9610cf91d1..639b87e3ee 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -7,6 +7,7 @@ var imageTag = false; var theSelection = false; +var bbcodeEnabled = true; // Check for Browser & Platform for PC & IE specific bits // More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html var clientPC = navigator.userAgent.toLowerCase(); // Get client info @@ -14,7 +15,6 @@ var clientVer = parseInt(navigator.appVersion); // Get browser version var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1)); var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1)); - var baseHeight; /** @@ -250,12 +250,59 @@ function addquote(post_id, username) if (theSelection) { - insert_text('[quote="' + username + '"]' + theSelection + '[/quote]'); + if (bbcodeEnabled) + { + insert_text('[quote="' + username + '"]' + theSelection + '[/quote]'); + } + else + { + var lines = split_lines(theSelection); + for (i = 0; i < lines.length; i++) + { + insert_text('> ' + lines[i] + '\n') + } + } } return; } +function split_lines(text) +{ + var lines = text.split('\n'); + var splitLines = new Array(); + var j = 0; + for(i = 0; i < lines.length; i++) + { + if (lines[i].length <= 80) + { + splitLines[j] = lines[i]; + j++; + } + else + { + var line = lines[i]; + do + { + var splitAt = line.indexOf(' ', 80); + + if (splitAt == -1) + { + splitLines[j] = line; + j++ + } + else + { + splitLines[j] = line.substring(0, splitAt); + line = line.substring(splitAt); + j++; + } + } + while(splitAt != -1) + } + } + return splitLines; +} /** * From http://www.massless.org/mozedit/ */ diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 428a830ef3..a408b54185 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -5,6 +5,11 @@
      + From 41fa3b71e6dfa89bd329d6eeb251f10771165766 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 22 Jul 2009 16:42:30 +0000 Subject: [PATCH 303/607] fall back to bbcode-less quotes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9836 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6011933082..3c7bec292f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -220,6 +220,7 @@
    • [Feature] Ability to filter ACP / MCP logs
    • [Feature] Users can report PMs to moderators which are then visible in a new MCP module
    • [Feature] Parse email text files with the template engine.
    • +
    • [Feature] Use email-style quoting when bbcodes are disabled.

    1.ii. Changes since 3.0.4

    From 24e9d1e53f9005059a3aa2ec7f74d441d7eb504e Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 22 Jul 2009 22:02:10 +0000 Subject: [PATCH 304/607] handle newlines git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9837 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/posting.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 9f7fefd81c..14ee550ac9 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1193,7 +1193,8 @@ if ($mode == 'quote' && !$submit && !$preview && !$refresh) } else { - $message = '> ' . utf8_wordwrap(censor_text(trim($message_parser->message)), 75, "\n> "); + $message = '> ' . utf8_wordwrap(censor_text(trim($message_parser->message)), 75, "\n"); + $message = str_replace("\n", "\n> ", $message); $message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . " :\n" . $message . "\n"; } } From 83ee6bb50504209ef2072773bdd958f9cbe24539 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 23 Jul 2009 10:19:38 +0000 Subject: [PATCH 305/607] primitive one-level nesting git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9838 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/posting.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 14ee550ac9..600bf1688c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1193,8 +1193,18 @@ if ($mode == 'quote' && !$submit && !$preview && !$refresh) } else { - $message = '> ' . utf8_wordwrap(censor_text(trim($message_parser->message)), 75, "\n"); - $message = str_replace("\n", "\n> ", $message); + $offset = 0; + $quote_string = "> "; + $message = censor_text(trim($message_parser->message)); + // see if we are nesting. It's easily tricked but should work for one level of nesting + if (strpos($message, ">") !== false) + { + $offset = 10; + } + $message = utf8_wordwrap($message, 75 + $offset, "\n"); + + $message = $quote_string . $message; + $message = str_replace("\n", "\n" . $quote_string, $message); $message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . " :\n" . $message . "\n"; } } From 89332c00b7198b5bd07fdb98b21d4734c300da15 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 24 Jul 2009 08:47:10 +0000 Subject: [PATCH 306/607] Fix Bug #40515 - Fix set_custom_template for database-stored styles Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9839 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/template.php | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3c7bec292f..22eda7e24b 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -170,6 +170,7 @@
  • [Fix] Copy poll options properly when copying topic. (Bug #39065)
  • [Fix] Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags)
  • [Fix] Be less strict with FTP daemons when getting directory filelists. (Bug #46295)
  • +
  • [Fix] Fix set_custom_template for database-stored styles (Bug #40515 - Patch by nickvergessen)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index 7cf865072f..fa7cf437fd 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -39,6 +39,8 @@ class template var $files_inherit = array(); var $files_template = array(); var $inherit_root = ''; + var $orig_tpl_storedb = 'undefined'; + var $orig_tpl_inherits_id = 'undefined'; // this will hash handle names to the compiled/uncompiled code for that handle. var $compiled_code = array(); @@ -55,6 +57,16 @@ class template { $this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'; $this->cachepath = $phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_'; + if ($this->orig_tpl_storedb == 'undefined') + { + $this->orig_tpl_storedb = $user->theme['template_storedb']; + } + if ($this->orig_tpl_inherits_id == 'undefined') + { + $this->orig_tpl_inherits_id = $user->theme['template_inherits_id']; + } + $user->theme['template_storedb'] = $this->orig_tpl_storedb; + $user->theme['template_inherits_id'] = $this->orig_tpl_inherits_id; if ($user->theme['template_inherits_id']) { @@ -77,10 +89,12 @@ class template */ function set_custom_template($template_path, $template_name) { - global $phpbb_root_path; + global $phpbb_root_path, $user; $this->root = $template_path; $this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_'; + $user->theme['template_storedb'] = false; + $user->theme['template_inherits_id'] = false; $this->_rootref = &$this->_tpldata['.'][0]; From 224aa404f6c8f0014a0dc48b9776ff431b8d4f48 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 24 Jul 2009 08:49:51 +0000 Subject: [PATCH 307/607] Fix bug #47825 - Banning an already banned user states to be successful, but has no effect - Patch by Pyramide Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9840 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_user.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 22eda7e24b..b8d233ca13 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -171,6 +171,7 @@
  • [Fix] Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags)
  • [Fix] Be less strict with FTP daemons when getting directory filelists. (Bug #46295)
  • [Fix] Fix set_custom_template for database-stored styles (Bug #40515 - Patch by nickvergessen)
  • +
  • [Fix] Banning an already banned user states to be successful, but has no effect (Bug #47825 - Patch by Pyramide)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index c69c27c9d7..e8584239ad 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1016,7 +1016,17 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas } while ($row = $db->sql_fetchrow($result)); - $banlist_ary = array_unique(array_diff($banlist_ary, $banlist_ary_tmp)); + $banlist_ary_tmp = array_intersect($banlist_ary, $banlist_ary_tmp); + + if (sizeof($banlist_ary_tmp)) + { + // One or more entities are already banned/excluded, delete the existing bans, so they can be re-inserted with the given new length + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set($type, $banlist_ary_tmp) . ' + AND ban_exclude = ' . (int) $ban_exclude; + $db->sql_query($sql); + } + unset($banlist_ary_tmp); } $db->sql_freeresult($result); From f84cbee47c06dd9df3b2cf7085a3b37ab9095d09 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 24 Jul 2009 08:52:56 +0000 Subject: [PATCH 308/607] Fix bug #18005 - Do not add style-parameter to URL again, after admin re-authentification - Patch by leviatan21 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9841 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/session.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index b8d233ca13..f235be1e9b 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -172,6 +172,7 @@
  • [Fix] Be less strict with FTP daemons when getting directory filelists. (Bug #46295)
  • [Fix] Fix set_custom_template for database-stored styles (Bug #40515 - Patch by nickvergessen)
  • [Fix] Banning an already banned user states to be successful, but has no effect (Bug #47825 - Patch by Pyramide)
  • +
  • [Fix] Do not add style-parameter to URL again, after admin re-authentification (Bug #18005 - Patch by leviatan21)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 9ae5a7c793..c8617057c4 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1534,7 +1534,7 @@ class user extends session $this->add_lang($lang_set); unset($lang_set); - if (!empty($_GET['style']) && $auth->acl_get('a_styles')) + if (!empty($_GET['style']) && $auth->acl_get('a_styles') && !defined('ADMIN_START')) { global $SID, $_EXTRA_URL; From 433f03107de1162744a1d0b8c9fa3c4ba1b3ed21 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 24 Jul 2009 08:56:06 +0000 Subject: [PATCH 309/607] Fix bug #31505 - Do not cut post-message in between HTML-Entities on search.php - Patch by leviatan21 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9842 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_content.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f235be1e9b..afba5d32f3 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -173,6 +173,7 @@
  • [Fix] Fix set_custom_template for database-stored styles (Bug #40515 - Patch by nickvergessen)
  • [Fix] Banning an already banned user states to be successful, but has no effect (Bug #47825 - Patch by Pyramide)
  • [Fix] Do not add style-parameter to URL again, after admin re-authentification (Bug #18005 - Patch by leviatan21)
  • +
  • [Fix] Do not cut post-message in between HTML-Entities on search.php (Bug #31505 - Patch by leviatan21)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 630f4105d0..de5df37299 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -250,6 +250,11 @@ function get_context($text, $words, $length = 400) // first replace all whitespaces with single spaces $text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", ' ')); + // we need to turn the entities back into their original form, to not cut the message in between them + $entities = array('<', '>', '[', ']', '.', ':', ':'); + $characters = array('<', '>', '[', ']', '.', ':', ':'); + $text = str_replace($entities, $characters, $text); + $word_indizes = array(); if (sizeof($words)) { @@ -345,13 +350,13 @@ function get_context($text, $words, $length = 400) } } } - return $final_text; + return str_replace($characters, $entities, $final_text); } } if (!sizeof($words) || !sizeof($word_indizes)) { - return (utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text; + return str_replace($characters, $entities, ((utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text)); } } From 780854818b22ccdf36fe50e4e4bf5e68027c9e2b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 24 Jul 2009 09:01:29 +0000 Subject: [PATCH 310/607] Fix bug #48265 - Correctly set attachment flag for topics, posts and pms after deleting attachments - Patch by WorldWar and nickvergessen Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9843 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_admin.php | 58 +++++++++++++++++++++++---- phpBB/includes/functions_posting.php | 15 +++++++ phpBB/includes/message_parser.php | 15 +++++-- phpBB/includes/ucp/ucp_pm_compose.php | 17 +++++++- phpBB/posting.php | 23 ++++++++++- 6 files changed, 116 insertions(+), 13 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index afba5d32f3..cf1e7a24cc 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -174,6 +174,7 @@
  • [Fix] Banning an already banned user states to be successful, but has no effect (Bug #47825 - Patch by Pyramide)
  • [Fix] Do not add style-parameter to URL again, after admin re-authentification (Bug #18005 - Patch by leviatan21)
  • [Fix] Do not cut post-message in between HTML-Entities on search.php (Bug #31505 - Patch by leviatan21)
  • +
  • [Fix] Correctly set attachment flag for topics, posts and pms after deleting attachments (Bug #48265 - Patch by WorldWar and nickvergessen)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index ff7f687945..457fac2458 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -892,19 +892,61 @@ function delete_attachments($mode, $ids, $resync = true) // Update post indicators for posts now no longer having attachments if (sizeof($post_ids)) { - $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_attachment = 0 - WHERE ' . $db->sql_in_set('post_id', $post_ids); - $db->sql_query($sql); + // Just check which posts are still having an assigned attachment not orphaned by querying the attachments table + $sql = 'SELECT post_msg_id + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $post_ids) . ' + AND in_message = 0 + AND is_orphan = 0'; + $result = $db->sql_query($sql); + + $remaining_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $remaining_ids[] = $row['post_msg_id']; + } + $db->sql_freeresult($result); + + // Now only unset those ids remaining + $post_ids = array_diff($post_ids, $remaining_ids); + + if (sizeof($post_ids)) + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_attachment = 0 + WHERE ' . $db->sql_in_set('post_id', $post_ids); + $db->sql_query($sql); + } } // Update message table if messages are affected if (sizeof($message_ids)) { - $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' - SET message_attachment = 0 - WHERE ' . $db->sql_in_set('msg_id', $message_ids); - $db->sql_query($sql); + // Just check which messages are still having an assigned attachment not orphaned by querying the attachments table + $sql = 'SELECT post_msg_id + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $message_ids) . ' + AND in_message = 1 + AND is_orphan = 0'; + $result = $db->sql_query($sql); + + $remaining_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $remaining_ids[] = $row['post_msg_id']; + } + $db->sql_freeresult($result); + + // Now only unset those ids remaining + $message_ids = array_diff($message_ids, $remaining_ids); + + if (sizeof($message_ids)) + { + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_attachment = 0 + WHERE ' . $db->sql_in_set('msg_id', $message_ids); + $db->sql_query($sql); + } } // Now update the topics. This is a bit trickier, because there could be posts still having attachments within the topic diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 7db2875cda..e348694cfe 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1549,6 +1549,21 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) break; } + if (($post_mode == 'delete') || ($post_mode == 'delete_last_post') || ($post_mode == 'delete_first_post')) + { + $sql = 'SELECT 1 AS has_attachments + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $result = $db->sql_query($sql); + $has_attachments = (int) $db->sql_fetchfield('has_attachments'); + $db->sql_freeresult($result); + + if (!$has_attachments) + { + $sql_data[TOPICS_TABLE] .= ', topic_attachment = 0'; + } + } + // $sql_data[USERS_TABLE] = ($data['post_postcount']) ? 'user_posts = user_posts - 1' : ''; $db->sql_transaction('begin'); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 7370c2057c..7a2d35dbc6 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1334,7 +1334,7 @@ class parse_message extends bbcode_firstpass /** * Parse Attachments */ - function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false) + function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false, $post_msg_id = 0, $topic_id = 0) { global $config, $auth, $user, $phpbb_root_path, $phpEx, $db; @@ -1487,16 +1487,25 @@ class parse_message extends bbcode_firstpass 'filesize' => $filedata['filesize'], 'filetime' => $filedata['filetime'], 'thumbnail' => $filedata['thumbnail'], - 'is_orphan' => 1, + 'is_orphan' => ($post_msg_id) ? 0 : 1, 'in_message' => ($is_message) ? 1 : 0, 'poster_id' => $user->data['user_id'], ); + if ($post_msg_id) + { + $sql_ary['post_msg_id'] = $post_msg_id; + if ($topic_id) + { + $sql_ary['topic_id'] = $topic_id; + } + } + $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); $new_entry = array( 'attach_id' => $db->sql_nextid(), - 'is_orphan' => 1, + 'is_orphan' => ($post_msg_id) ? 0 : 1, 'real_filename' => $filedata['real_filename'], 'attach_comment'=> $this->filename_data['filecomment'], ); diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index edee64bd18..cf82925e1d 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -665,7 +665,22 @@ function compose_pm($id, $mode, $action) } // Parse Attachments - before checksum is calculated - $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); + if ($action == 'edit') + { + $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true, $msg_id); + if (sizeof($message_parser->attachment_data)) + { + // Update attachment indicators for pms having attachments now, as a precaution if the pm does not get stored by submit + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_attachment = 1 + WHERE msg_id = ' . $msg_id; + $db->sql_query($sql); + } + } + else + { + $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); + } if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) { diff --git a/phpBB/posting.php b/phpBB/posting.php index 600bf1688c..d304168153 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -700,7 +700,28 @@ if ($submit || $preview || $refresh) } // Parse Attachments - before checksum is calculated - $message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh); + if ($mode == 'edit') + { + $message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh, false, $post_id, $topic_id); + if (sizeof($message_parser->attachment_data)) + { + // Update attachment indicators for post/topic having attachments now, as a precaution if the post does not get stored by submit + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_attachment = 1 + WHERE post_id = ' . $post_id; + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_attachment = 1 + WHERE topic_id = ' . $topic_id; + $db->sql_query($sql); + } + } + else + { + $message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh); + } + // Grab md5 'checksum' of new message $message_md5 = md5($message_parser->message); From c84d5074c1aef4a1705d4b17472689e8e4a15351 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 24 Jul 2009 09:05:48 +0000 Subject: [PATCH 311/607] Fix Bug #47475 - Remove redundant code in prosilver search_results.html Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9844 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/search_results.html | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index 90e14d2a18..8ecb4f192a 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -18,7 +18,6 @@ From 4739c7ba3957dfe585973dafe7465cb9fd8c6d1f Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 24 Jul 2009 11:13:32 +0000 Subject: [PATCH 312/607] [Feature] Added new functionality to inactive users module: - Ability to set users per page. - Ability to sort by posts/number of reminders/last reminded date. - Show number of posts and ability to search posts. - Show number of reminders sent to user. - Show date of last reminder sent to user. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9845 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_inactive.html | 51 ++++++++++--------- phpBB/develop/create_schema_files.php | 2 + phpBB/docs/CHANGELOG.html | 9 ++++ phpBB/includes/acp/acp_inactive.php | 73 ++++++++++++++++++++------- phpBB/includes/functions_admin.php | 4 +- phpBB/install/database_update.php | 8 +-- phpBB/language/en/acp/common.php | 2 + phpBB/language/en/common.php | 1 + phpBB/language/en/memberlist.php | 8 ++- 9 files changed, 110 insertions(+), 48 deletions(-) diff --git a/phpBB/adm/style/acp_inactive.html b/phpBB/adm/style/acp_inactive.html index 240cec1643..ca65416421 100644 --- a/phpBB/adm/style/acp_inactive.html +++ b/phpBB/adm/style/acp_inactive.html @@ -12,7 +12,7 @@ @@ -22,8 +22,8 @@ {L_USERNAME} {L_JOINED} {L_INACTIVE_DATE} - {L_INACTIVE_REASON} {L_LAST_VISIT} + {L_INACTIVE_REASON} {L_MARK} @@ -31,11 +31,16 @@ - {inactive.USERNAME} - {inactive.JOINED} - {inactive.INACTIVE_DATE} - {inactive.REASON} - {inactive.LAST_VISIT} + + {inactive.USERNAME_FULL} +
    {L_POSTS}: {inactive.POSTS} [{L_SEARCH_USER_POSTS}] + + {inactive.JOINED} + {inactive.INACTIVE_DATE} + {inactive.LAST_VISIT} + + {inactive.REASON} +
    {inactive.REMINDED_EXPLAIN}    @@ -46,25 +51,25 @@ -
    - {L_DISPLAY_LOG}:  {S_LIMIT_DAYS} {L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR} - -
    -
    - +
    + {L_DISPLAY_LOG}:  {S_LIMIT_DAYS} {L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR} Users per page: + +
    + +
    + + - - -
    - - -

    {L_MARK_ALL}{L_UNMARK_ALL}

    - {S_FORM_TOKEN} -
    - + +
    + + +

    {L_MARK_ALL}{L_UNMARK_ALL}

    + {S_FORM_TOKEN} +
    diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index ab021a15ec..09a42bc684 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1860,6 +1860,8 @@ function get_schema_struct() 'user_newpasswd' => array('VCHAR_UNI:40', ''), 'user_form_salt' => array('VCHAR_UNI:32', ''), 'user_new' => array('BOOL', 1), + 'user_reminded' => array('TINT:4', 0), + 'user_reminded_time' => array('TIMESTAMP', 0), ), 'PRIMARY_KEY' => 'user_id', 'KEYS' => array( diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index cf1e7a24cc..3e7ae6e4e6 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -226,6 +226,15 @@
  • [Feature] Users can report PMs to moderators which are then visible in a new MCP module
  • [Feature] Parse email text files with the template engine.
  • [Feature] Use email-style quoting when bbcodes are disabled.
  • +
  • [Feature] Added new functionality to inactive users module: +
      +
    • Ability to set users per page.
    • +
    • Ability to sort by posts/number of reminders/last reminded date.
    • +
    • Show number of posts and ability to search posts.
    • +
    • Show number of reminders sent to user.
    • +
    • Show date of last reminder sent to user.
    • +
    +
  • 1.ii. Changes since 3.0.4

    diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index a38b47a704..e41e8f661d 100644 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -51,6 +51,19 @@ class acp_inactive $form_key = 'acp_inactive'; add_form_key($form_key); + // We build the sort key and per page settings here, because they may be needed later + + // Number of entries to display + $per_page = request_var('users_per_page', (int) $config['topics_per_page']); + + // Sorting + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('i' => $user->lang['SORT_INACTIVE'], 'j' => $user->lang['SORT_REG_DATE'], 'l' => $user->lang['SORT_LAST_VISIT'], 'd' => $user->lang['SORT_LAST_REMINDER'], 'r' => $user->lang['SORT_REASON'], 'u' => $user->lang['SORT_USERNAME'], 'p' => $user->lang['SORT_POSTS'], 'e' => $user->lang['SORT_REMINDER']); + $sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'd' => 'user_reminded_time', 'r' => 'user_inactive_reason', 'u' => 'username_clean', 'p' => 'user_posts', 'e' => 'user_reminded'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + if ($submit && sizeof($mark)) { if ($action !== 'delete' && !check_form_key($form_key)) @@ -67,7 +80,7 @@ class acp_inactive FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $mark); $result = $db->sql_query($sql); - + $user_affected = array(); while ($row = $db->sql_fetchrow($result)) { @@ -122,6 +135,12 @@ class acp_inactive $messenger->save_queue(); } + + // For activate we really need to redirect, else a refresh can result in users being deactivated again + $u_action = $this->u_action . "&$u_sort_param&start=$start"; + $u_action .= ($per_page != $config['topics_per_page']) ? "&users_per_page=$per_page" : ''; + + redirect($u_action); } else if ($action == 'delete') { @@ -175,7 +194,7 @@ class acp_inactive include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); $messenger = new messenger(); - $usernames = array(); + $usernames = $user_ids = array(); do { @@ -198,28 +217,34 @@ class acp_inactive $messenger->send($row['user_notify_type']); $usernames[] = $row['username']; + $user_ids[] = (int) $row['user_id']; } while ($row = $db->sql_fetchrow($result)); $messenger->save_queue(); + // Add the remind state to the database + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_reminded = user_reminded + 1, + user_reminded_time = ' . time() . ' + WHERE ' . $db->sql_in_set('user_id', $user_ids); + $db->sql_query($sql); + add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames)); unset($usernames); } $db->sql_freeresult($result); - + + // For remind we really need to redirect, else a refresh can result in more than one reminder + $u_action = $this->u_action . "&$u_sort_param&start=$start"; + $u_action .= ($per_page != $config['topics_per_page']) ? "&users_per_page=$per_page" : ''; + + redirect($u_action); + break; } } - // Sorting - $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('i' => $user->lang['SORT_INACTIVE'], 'j' => $user->lang['SORT_REG_DATE'], 'l' => $user->lang['SORT_LAST_VISIT'], 'r' => $user->lang['SORT_REASON'], 'u' => $user->lang['SORT_USERNAME']); - $sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'r' => 'user_inactive_reason', 'u' => 'username_clean'); - - $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; - gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); - // Define where and sort sql for use in displaying logs $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); @@ -227,19 +252,30 @@ class acp_inactive $inactive = array(); $inactive_count = 0; - $start = view_inactive_users($inactive, $inactive_count, $config['topics_per_page'], $start, $sql_where, $sql_sort); + $start = view_inactive_users($inactive, $inactive_count, $per_page, $start, $sql_where, $sql_sort); foreach ($inactive as $row) { $template->assign_block_vars('inactive', array( 'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']), + 'REMINDED_DATE' => $user->format_date($row['user_reminded_time']), 'JOINED' => $user->format_date($row['user_regdate']), 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']), + 'REASON' => $row['inactive_reason'], 'USER_ID' => $row['user_id'], - 'USERNAME' => $row['username'], - 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}")) - ); + 'POSTS' => ($row['user_posts']) ? $row['user_posts'] : 0, + 'REMINDED' => $row['user_reminded'], + + 'REMINDED_EXPLAIN' => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])), + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview')), + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), + 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), + + 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}"), + 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&sr=posts") : '', + )); } $option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE'); @@ -255,9 +291,10 @@ class acp_inactive 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, - 'S_ON_PAGE' => on_page($inactive_count, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $inactive_count, $config['topics_per_page'], $start, true), - + 'S_ON_PAGE' => on_page($inactive_count, $per_page, $start), + 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param&users_per_page=$per_page", $inactive_count, $per_page, $start, true), + 'USERS_PER_PAGE' => $per_page, + 'U_ACTION' => $this->u_action . '&start=' . $start, )); diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 457fac2458..aeb378953d 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2375,7 +2375,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u WHERE l.log_type = $log_type AND u.user_id = l.user_id - " . (($limit_days) ? "AND l.log_time >= $limit_days" : '') . + " . (($limit_days) ? "AND l.log_time >= $limit_days" : '') . (!empty($log_operation) ? "AND l.log_operation = '" . $db->sql_escape($log_operation) . "'" : '') . " $sql_forum ORDER BY $sort_by"; @@ -2685,7 +2685,7 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li $offset = ($offset - $limit < 0) ? 0 : $offset - $limit; } - $sql = 'SELECT user_id, username, user_regdate, user_lastvisit, user_inactive_time, user_inactive_reason + $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_type = ' . USER_INACTIVE . (($limit_days) ? " AND user_inactive_time >= $limit_days" : '') . " diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index c055449d5f..6d596a8a00 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -11,7 +11,7 @@ $updates_to_version = '3.0.6-dev'; // Enter any version to update from to test updates. The version within the db will not be updated. -$debug_from_version = false; +$debug_from_version = '3.0.5'; // Which oldest version does this updater supports? $oldest_from_version = '3.0.0'; @@ -696,7 +696,9 @@ function database_update_info() 'attempts' => array('UINT', 0), ), USERS_TABLE => array( - 'user_new' => array('BOOL', 1), + 'user_new' => array('BOOL', 1), + 'user_reminded' => array('TINT:4', 0), + 'user_reminded_time'=> array('TIMESTAMP', 0), ), GROUPS_TABLE => array( 'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'), @@ -714,7 +716,7 @@ function database_update_info() ), REPORTS_TABLE => array( 'post_id' => array('post_id'), - 'pm_id' => array('pm_id'), + 'pm_id' => array('pm_id'), ), ), ), diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 85380b2fd2..ca31dc90f8 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -399,6 +399,8 @@ $lang = array_merge($lang, array( 'SORT_LAST_VISIT' => 'Last visit', 'SORT_REASON' => 'Reason', 'SORT_REG_DATE' => 'Registration date', + 'SORT_LAST_REMINDER'=> 'Last reminded', + 'SORT_REMINDER' => 'Reminder sent', 'USER_IS_INACTIVE' => 'User is inactive', )); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index a2b8eafd52..b97445f186 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -541,6 +541,7 @@ $lang = array_merge($lang, array( 'SORT_JOINED' => 'Joined date', 'SORT_LOCATION' => 'Location', 'SORT_RANK' => 'Rank', + 'SORT_POSTS' => 'Posts', 'SORT_TOPIC_TITLE' => 'Topic title', 'SORT_USERNAME' => 'Username', 'SPLIT_TOPIC' => 'Split topic', diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index b5b8434776..20f64044be 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -81,7 +81,7 @@ $lang = array_merge($lang, array( 'IM_MESSAGE' => 'Your message', 'IM_MSNM' => 'Please note that you need Windows Messenger installed to use this.', 'IM_MSNM_BROWSER' => 'Your browser does not support this.', - 'IM_MSNM_CONNECT' => 'MSNM is not connected.\nYou have to connect to MSNM to continue.', + 'IM_MSNM_CONNECT' => 'MSNM is not connected.\nYou have to connect to MSNM to continue.', 'IM_NAME' => 'Your Name', 'IM_NO_DATA' => 'There is no suitable contact information for this user.', 'IM_NO_JABBER' => 'Sorry, direct messaging of Jabber users is not supported on this board. You will need a Jabber client installed on your system to contact the recipient above.', @@ -90,7 +90,7 @@ $lang = array_merge($lang, array( 'IM_SEND_MESSAGE' => 'Send message', 'IM_SENT_JABBER' => 'Your message to %1$s has been sent successfully.', 'IM_USER' => 'Send an instant message', - + 'LAST_ACTIVE' => 'Last active', 'LESS_THAN' => 'Less than', 'LIST_USER' => '1 user', @@ -134,6 +134,10 @@ $lang = array_merge($lang, array( 'USER_ADMIN' => 'Administrate user', 'USER_BAN' => 'Banning', 'USER_FORUM' => 'User statistics', + 'USER_LAST_REMINDED' => array( + 0 => 'No reminder sent yet', + 1 => '%1$d reminder sent
    » %2$s', + ), 'USER_ONLINE' => 'Online', 'USER_PRESENCE' => 'Board presence', From 4fcd83fa7d44e0e875697eecef2386f732052b58 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Fri, 24 Jul 2009 12:05:17 +0000 Subject: [PATCH 313/607] Fix bug #38055 - Post reply button shown in locked forum Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9846 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/viewtopic.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3e7ae6e4e6..eb70dd1895 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -175,6 +175,7 @@
  • [Fix] Do not add style-parameter to URL again, after admin re-authentification (Bug #18005 - Patch by leviatan21)
  • [Fix] Do not cut post-message in between HTML-Entities on search.php (Bug #31505 - Patch by leviatan21)
  • [Fix] Correctly set attachment flag for topics, posts and pms after deleting attachments (Bug #48265 - Patch by WorldWar and nickvergessen)
  • +
  • [Fix] Display "Locked" button instead of "Reply" one for locked forum in viewtopic (prosilver). (Bug #38055 - Patch by Raimon)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 69267f08dc..aa2a6be10a 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -605,7 +605,7 @@ $template->assign_vars(array( 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), 'WARN_IMG' => $user->img('icon_user_warn', 'WARN_USER'), - 'S_IS_LOCKED' =>($topic_data['topic_status'] == ITEM_UNLOCKED) ? false : true, + 'S_IS_LOCKED' => ($topic_data['topic_status'] == ITEM_UNLOCKED && $topic_data['forum_status'] == ITEM_UNLOCKED) ? false : true, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, From b902fc20ae78438af7eb44e9b1f078cdcc213e16 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 25 Jul 2009 10:16:13 +0000 Subject: [PATCH 314/607] Small change to r9839 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9847 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/template.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index fa7cf437fd..fece30e4cd 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -39,8 +39,8 @@ class template var $files_inherit = array(); var $files_template = array(); var $inherit_root = ''; - var $orig_tpl_storedb = 'undefined'; - var $orig_tpl_inherits_id = 'undefined'; + var $orig_tpl_storedb; + var $orig_tpl_inherits_id; // this will hash handle names to the compiled/uncompiled code for that handle. var $compiled_code = array(); @@ -57,14 +57,17 @@ class template { $this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'; $this->cachepath = $phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_'; - if ($this->orig_tpl_storedb == 'undefined') + + if ($this->orig_tpl_storedb === null) { $this->orig_tpl_storedb = $user->theme['template_storedb']; } - if ($this->orig_tpl_inherits_id == 'undefined') + + if ($this->orig_tpl_inherits_id === null) { $this->orig_tpl_inherits_id = $user->theme['template_inherits_id']; } + $user->theme['template_storedb'] = $this->orig_tpl_storedb; $user->theme['template_inherits_id'] = $this->orig_tpl_inherits_id; From e4b60c6d8a672fc2f59dd599cd347f3d25962def Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 25 Jul 2009 10:23:05 +0000 Subject: [PATCH 315/607] Add some docs for dynamic includes adding in r9570 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9848 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/coding-guidelines.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 32312054d9..37bad06587 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1116,6 +1116,16 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;

    You will note in the 3.0 templates the major sources start with <!-- INCLUDE overall_header.html --> or <!-- INCLUDE simple_header.html -->, etc. In 2.0.x control of "which" header to use was defined entirely within the code. In 3.0.x the template designer can output what they like. Note that you can introduce new templates (i.e. other than those in the default set) using this system and include them as you wish ... perhaps useful for a common "menu" bar or some such. No need to modify loads of files as with 2.0.x.

    +

    Added in 3.0.6 is the ability to include a file using a template variable to specify the file, this functionality only works for root variables (i.e. not block variables).

    +
    +<!-- INCLUDE {FILE_VAR} -->
    +
    +

    Template defined variables can also be utilised. +

    +<!-- DEFINE $SOME_VAR = 'my_file.html' -->
    +<!-- INCLUDE {$SOME_VAR} -->	
    +
    +

    PHP

    A contentious decision has seen the ability to include PHP within the template introduced. This is achieved by enclosing the PHP within relevant tags:

    From bac1e57c188e0289edce102b21224bba3219fd52 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Sat, 25 Jul 2009 11:49:14 +0000 Subject: [PATCH 316/607] details git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9849 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index eb70dd1895..a4cfe2704e 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -199,6 +199,12 @@
  • [Change] Cache get_username_string() function calls on viewtopic.
  • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
  • [Feature] Backported 3.2 captcha plugins.
  • +
      +
    • Classic and GD CAPTCHA
    • +
    • reCaptcha (based on API from recaptcha.net by Mike Crawford and Ben Maurer)
    • +
    • Q&A CAPTCHA
    • +
    • 3D Wave (by Robert "e;Xore& Hetzler)/li> +
  • [Feature] Introduced new ACM plugins:
    • null
    • From 1dcd7d2da8175b2ec099f4b07168b1d6c0a055e3 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 25 Jul 2009 12:35:46 +0000 Subject: [PATCH 317/607] Correctly propagate umlauts over search result pages [Bug #33755] git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9850 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/search.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a4cfe2704e..6a7b7a0627 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -176,6 +176,7 @@
    • [Fix] Do not cut post-message in between HTML-Entities on search.php (Bug #31505 - Patch by leviatan21)
    • [Fix] Correctly set attachment flag for topics, posts and pms after deleting attachments (Bug #48265 - Patch by WorldWar and nickvergessen)
    • [Fix] Display "Locked" button instead of "Reply" one for locked forum in viewtopic (prosilver). (Bug #38055 - Patch by Raimon)
    • +
    • [Fix] Correctly propagate umlauts over search result pages (Bug #33755)
    • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    • [Change] Template engine now permits to a limited extent variable includes.
    • diff --git a/phpBB/search.php b/phpBB/search.php index 61aa16a6fb..65e56b5d31 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -545,7 +545,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results); $u_search .= ($search_id) ? '&search_id=' . $search_id : ''; - $u_search .= ($u_hilit) ? '&keywords=' . urlencode(htmlspecialchars_decode($search->search_query)) : ''; + $u_search .= ($u_hilit) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; $u_search .= ($search_terms != 'all') ? '&terms=' . $search_terms : ''; $u_search .= ($topic_id) ? '&t=' . $topic_id : ''; $u_search .= ($author) ? '&author=' . urlencode(htmlspecialchars_decode($author)) : ''; From aec3a9964fdd5ad07b6f4c98aca115e0c299c64c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 25 Jul 2009 14:32:27 +0000 Subject: [PATCH 318/607] Fix r9849. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9851 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6a7b7a0627..56975135f9 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -204,7 +204,7 @@
    • Classic and GD CAPTCHA
    • reCaptcha (based on API from recaptcha.net by Mike Crawford and Ben Maurer)
    • Q&A CAPTCHA
    • -
    • 3D Wave (by Robert "e;Xore& Hetzler)/li> +
    • 3D Wave (by Robert "Xore" Hetzler)/li>
  • [Feature] Introduced new ACM plugins:
      From 268fc1bc561a780fdea69b5e6c2747e0936bb279 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 25 Jul 2009 14:48:25 +0000 Subject: [PATCH 319/607] r9849, r9851 - Do it right ... hopefully git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9852 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 56975135f9..b0a2937dcf 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -199,13 +199,14 @@
    • [Change] Add pagination for icons and smilies in the ACP and smilies in the smiley popup
    • [Change] Cache get_username_string() function calls on viewtopic.
    • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
    • -
    • [Feature] Backported 3.2 captcha plugins.
    • +
    • [Feature] Backported 3.2 captcha plugins.
      • Classic and GD CAPTCHA
      • reCaptcha (based on API from recaptcha.net by Mike Crawford and Ben Maurer)
      • Q&A CAPTCHA
      • -
      • 3D Wave (by Robert "Xore" Hetzler)/li> +
      • 3D Wave (by Robert "Xore" Hetzler)
      +
    • [Feature] Introduced new ACM plugins:
      • null
      • From 5d0616af0f75e3da4723d592e5b381e917448d2e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 25 Jul 2009 18:01:15 +0000 Subject: [PATCH 320/607] missing lang var for PM reports git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9853 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/mcp.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index a1f276c9d9..d1ef4d58c0 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -252,6 +252,7 @@ $lang = array_merge($lang, array( 'PM_REPORT_CLOSED_SUCCESS' => 'The selected PM report has been closed successfully.', 'PM_REPORT_DELETED_SUCCESS' => 'The selected PM report has been deleted successfully.', 'PM_REPORTED_SUCCESS' => 'This private message has been successfully reported.', + 'REPORT_TOTAL' => 'In total there is 1 PM report to review.', 'PM_REPORTS_TOTAL' => 'In total there are %d PM reports to review.', 'PM_REPORTS_ZERO_TOTAL' => 'There are no PM reports to review.', 'PM_REPORT_DETAILS' => 'Private message report details', From 801ac58bcf0a2fccc2bbde4a0d51151edfbada92 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 25 Jul 2009 18:06:25 +0000 Subject: [PATCH 321/607] I manage to get a one line commit wrong ... git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9854 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/mcp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index d1ef4d58c0..ab03cdb0be 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -252,7 +252,7 @@ $lang = array_merge($lang, array( 'PM_REPORT_CLOSED_SUCCESS' => 'The selected PM report has been closed successfully.', 'PM_REPORT_DELETED_SUCCESS' => 'The selected PM report has been deleted successfully.', 'PM_REPORTED_SUCCESS' => 'This private message has been successfully reported.', - 'REPORT_TOTAL' => 'In total there is 1 PM report to review.', + 'PM_REPORT_TOTAL' => 'In total there is 1 PM report to review.', 'PM_REPORTS_TOTAL' => 'In total there are %d PM reports to review.', 'PM_REPORTS_ZERO_TOTAL' => 'There are no PM reports to review.', 'PM_REPORT_DETAILS' => 'Private message report details', From ba37fa4f49c17047da9aeeb8ada5efaf1030e795 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Sun, 26 Jul 2009 10:16:52 +0000 Subject: [PATCH 322/607] Fix r9755 for #46765 Authorised by: ToonArmy git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9855 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 43 ++++++++++++++++++++++-------------- phpBB/search.php | 2 +- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 1a791ebff9..2d86b233f7 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4138,7 +4138,7 @@ function get_unread_topics_list($user_id = false, $sql_extra = '') { global $config, $db, $user; - if($user_id === false) + if ($user_id === false) { $user_id = $user->data['user_id']; } @@ -4150,25 +4150,28 @@ function get_unread_topics_list($user_id = false, $sql_extra = '') { // List of the tracked forums (not ideal, hope the better way will be found) // This list is to fetch later the forums user never read (fully) before - $sql = 'SELECT forum_id FROM ' . FORUMS_TRACK_TABLE . " + $sql = 'SELECT forum_id + FROM ' . FORUMS_TRACK_TABLE . " WHERE user_id = {$user_id}"; $result = $db->sql_query($sql); - while($row = $db->sql_fetchrow($result)) + while ($row = $db->sql_fetchrow($result)) { $tracked_forums_list[] = $row['forum_id']; } $db->sql_freeresult($result); - + // Get list of the unread topics - on topics tracking as the first step - $sql = 'SELECT t.topic_id, t.topic_last_post_time, tt.mark_time FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TRACK_TABLE . " tt + $sql = 'SELECT t.topic_id, t.topic_last_post_time, tt.mark_time + FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TRACK_TABLE . " tt WHERE t.topic_id = tt.topic_id AND t.topic_last_post_time >= tt.mark_time AND tt.user_id = {$user_id} - $sql_extra"; + $sql_extra + ORDER BY t.topic_last_post_time DESC"; $result = $db->sql_query($sql); - while($row = $db->sql_fetchrow($result)) + while ($row = $db->sql_fetchrow($result)) { - if($row['topic_last_post_time'] == $row['mark_time']) + if ($row['topic_last_post_time'] == $row['mark_time']) { // Check if there're read topics for the forums having unread ones $read_topics_list[$row['topic_id']] = $row['mark_time']; @@ -4179,33 +4182,41 @@ function get_unread_topics_list($user_id = false, $sql_extra = '') } } $db->sql_freeresult($result); - + // Get the full list of the tracked topics $tracked_topics_list = array_merge(array_keys($unread_topics_list), array_keys($read_topics_list)); // Get list of the unread topics - on forums tracking as the second step // We don't take in account topics tracked before - $sql = 'SELECT t.topic_id, ft.mark_time FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TRACK_TABLE . ' ft + $sql = 'SELECT t.topic_id, ft.mark_time + FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TRACK_TABLE . ' ft WHERE t.forum_id = ft.forum_id AND t.topic_last_post_time > ft.mark_time AND ' . $db->sql_in_set('t.topic_id', $tracked_topics_list, true, true) . " AND ft.user_id = {$user_id} - $sql_extra"; + $sql_extra + ORDER BY t.topic_last_post_time DESC"; $result = $db->sql_query($sql); - while($row = $db->sql_fetchrow($result)) + while ($row = $db->sql_fetchrow($result)) { $unread_topics_list[$row['topic_id']] = $row['mark_time']; } $db->sql_freeresult($result); - + + // Refresh the full list of the tracked topics + unset($tracked_topics_list); + $tracked_topics_list = array_merge(array_keys($unread_topics_list), array_keys($read_topics_list)); + // And the last step - find unread topics were not found before (that can mean a user has never read some forums) - $sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . " + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . " WHERE topic_last_post_time > {$user->data['user_lastmark']} AND " . $db->sql_in_set('topic_id', array_keys($unread_topics_list), true, true) . ' AND ' . $db->sql_in_set('forum_id', $tracked_forums_list, true, true) . " - $sql_extra"; + $sql_extra + ORDER BY topic_last_post_time DESC"; $result = $db->sql_query_limit($sql, 1000); - while($row = $db->sql_fetchrow($result)) + while ($row = $db->sql_fetchrow($result)) { $unread_topics_list[$row['topic_id']] = $user->data['user_lastmark']; } diff --git a/phpBB/search.php b/phpBB/search.php index 65e56b5d31..d913ca7ec9 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -381,7 +381,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $unread_list = array(); $unread_list = get_unread_topics_list(); - if(!empty($unread_list)) + if (!empty($unread_list)) { $sql = 'SELECT t.topic_id FROM ' . TOPICS_TABLE . ' t From 4faf662623fdc9956604049c57499546149f3655 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 26 Jul 2009 11:33:48 +0000 Subject: [PATCH 323/607] made a mistake when turning stats into a whitelist git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9856 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/questionnaire/questionnaire.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index fe6e8a3bd7..88873efdc5 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -253,6 +253,7 @@ class phpbb_questionnaire_phpbb_data_provider 'allow_namechange' => true, 'allow_nocensors' => true, 'allow_pm_attach' => true, + 'allow_pm_report' => true, 'allow_post_flash' => true, 'allow_post_links' => true, 'allow_privmsg' => true, @@ -435,11 +436,11 @@ class phpbb_questionnaire_phpbb_data_provider ); $result = array(); - foreach ($this->config as $name => $value) + foreach ($config_vars as $name => $void) { - if (!isset($exclude_config_vars[$name])) + if (isset($this->config[$name])) { - $result['config.' . $name] = $value; + $result['config.' . $name] = $this->config[$name]; } } From 1a0bd316e41ba78b8519558c47665877e8661970 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 26 Jul 2009 11:34:11 +0000 Subject: [PATCH 324/607] correctly add the install_id to the data git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9857 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_send_statistics.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/includes/acp/acp_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php index c76b450605..6784d29262 100644 --- a/phpBB/includes/acp/acp_send_statistics.php +++ b/phpBB/includes/acp/acp_send_statistics.php @@ -61,6 +61,11 @@ class acp_send_statistics foreach ($raw as $provider => $data) { + if ($provider == 'install_id') + { + $data = array($provider => $data); + } + $template->assign_block_vars('providers', array( 'NAME' => htmlspecialchars($provider), )); From 68e2102f20fa583dd184cefec19511d61caa5602 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 26 Jul 2009 14:54:02 +0000 Subject: [PATCH 325/607] Make some adjustments to the log filter. r9781, r9800 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9858 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_logs.php | 20 +++++++++++++++++++- phpBB/includes/mcp/mcp_logs.php | 20 +++++++++++++++++++- phpBB/language/en/acp/common.php | 2 ++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index f13979ec0f..567606cfc7 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -156,14 +156,32 @@ class acp_logs " . (($limit_days) ? "AND log_time >= $sql_where " : ' ') . $sql_forum; $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { if (empty($row['log_operation'])) { continue; } + $selected = ($log_operation == $row['log_operation']) ? ' selected="selected"' : ''; - $s_lang_keys .= ''; + + if (isset($user->lang[$row['log_operation']])) + { + $text = htmlspecialchars(strip_tags(str_replace('
        ', ' ', $user->lang[$row['log_operation']])), ENT_COMPAT, 'UTF-8'); + + // Fill in sprintf placeholders with translated placeholder text + if (substr_count($text, '%')) + { + $text = vsprintf($text, array_fill(0, substr_count($text, '%'), $user->lang['LOGS_PLACEHOLDER'])); + } + } + else + { + $text = ucfirst(str_replace('_', ' ', strtolower($row['log_operation']))); + } + + $s_lang_keys .= ''; } $db->sql_freeresult($result); diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index b83e364811..db22259ec4 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -186,14 +186,32 @@ class mcp_logs ' . (($limit_days) ? "AND log_time >= $sql_where " : ' ') . $sql_forum; $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { if (empty($row['log_operation'])) { continue; } + $selected = ($log_operation == $row['log_operation']) ? ' selected="selected"' : ''; - $s_lang_keys .= ''; + + if (isset($user->lang[$row['log_operation']])) + { + $text = htmlspecialchars(strip_tags(str_replace('
        ', ' ', $user->lang[$row['log_operation']])), ENT_COMPAT, 'UTF-8'); + + // Fill in sprintf placeholders with translated placeholder text + if (substr_count($text, '%')) + { + $text = vsprintf($text, array_fill(0, substr_count($text, '%'), $user->lang['LOGS_PLACEHOLDER'])); + } + } + else + { + $text = ucfirst(str_replace('_', ' ', strtolower($row['log_operation']))); + } + + $s_lang_keys .= ''; } $db->sql_freeresult($result); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index ca31dc90f8..af0a61fd32 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -307,6 +307,8 @@ $lang = array_merge($lang, array( 'DISPLAY_LOG' => 'Display entries from previous', + 'LOGS_PLACEHOLDER' => '<value>', + 'NO_ENTRIES' => 'No log entries for this period.', 'SORT_IP' => 'IP address', From 63f5cff824ed9c210f0adb933c3dd8a8bcfc17be Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 26 Jul 2009 16:16:30 +0000 Subject: [PATCH 326/607] Preserve post options when refusing to save the post as a draft. #39115 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9859 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/posting.php | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index b0a2937dcf..d72e75b009 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -177,6 +177,7 @@
      • [Fix] Correctly set attachment flag for topics, posts and pms after deleting attachments (Bug #48265 - Patch by WorldWar and nickvergessen)
      • [Fix] Display "Locked" button instead of "Reply" one for locked forum in viewtopic (prosilver). (Bug #38055 - Patch by Raimon)
      • [Fix] Correctly propagate umlauts over search result pages (Bug #33755)
      • +
      • [Fix] Preserve post options when refusing to save the post as a draft. (Bug #39115)
      • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
      • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
      • [Change] Template engine now permits to a limited extent variable includes.
      • diff --git a/phpBB/posting.php b/phpBB/posting.php index d304168153..919d92b27c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -545,6 +545,47 @@ if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ( ) ); + $hidden_fields = array( + 'icon_id' => 0, + + 'disable_bbcode' => false, + 'disable_smilies' => false, + 'disable_magic_url' => false, + 'attach_sig' => true, + 'lock_topic' => false, + + 'topic_type' => POST_NORMAL, + 'topic_time_limit' => 0, + + 'poll_title' => '', + 'poll_option_text' => '', + 'poll_max_options' => 1, + 'poll_length' => 0, + 'poll_vote_change' => false, + ); + + foreach ($hidden_fields as $name => $default) + { + if (!isset($_POST[$name])) + { + // Don't include it, if its not available + unset($hidden_fields[$name]); + continue; + } + + if (is_bool($default)) + { + // Use the string representation + $hidden_fields[$name] = request_var($name, ''); + } + else + { + $hidden_fields[$name] = request_var($name, $default); + } + } + + $s_hidden_fields .= build_hidden_fields($hidden_fields); + confirm_box(false, 'SAVE_DRAFT', $s_hidden_fields); } } From 19bff35057d5e65505253a7372f8d87fcc622d91 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 26 Jul 2009 17:01:07 +0000 Subject: [PATCH 327/607] #36685 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9860 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 1005b2ef5b..b0eb5c9cb6 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -486,7 +486,7 @@ $lang = array_merge($lang, array( 'EMAIL_SIG' => 'E-mail signature', 'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all e-mails the board sends.', 'ENABLE_EMAIL' => 'Enable board-wide e-mails', - 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no e-mails will be sent by the board at all.', + 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no e-mails will be sent by the board at all. Note the user and admin account activiation settings require this setting to be enabled.', 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', 'SMTP_CRAM_MD5' => 'CRAM-MD5', From b6ebd2e4972f8cff7e16ed96788b1fa861f7568d Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 26 Jul 2009 17:58:10 +0000 Subject: [PATCH 328/607] XHTML mistakes in the updater. #46585 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9861 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/install_update_diff.html | 21 +++++++++++++++------ phpBB/docs/CHANGELOG.html | 2 +- phpBB/includes/diff/renderer.php | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/phpBB/adm/style/install_update_diff.html b/phpBB/adm/style/install_update_diff.html index efbe1d045c..d794c5c516 100644 --- a/phpBB/adm/style/install_update_diff.html +++ b/phpBB/adm/style/install_update_diff.html @@ -28,6 +28,9 @@ function resize_panel() //whatever IE needs to do this } } + +window.onresize = resize_panel; + // ]]> @@ -48,10 +51,7 @@ function resize_panel() div#codepanel { - overflow: auto; width: 100%; - height: 350px; - display: inline-block; } div#codepanel { @@ -59,12 +59,22 @@ div#codepanel { } + +div#diff_content pre { + overflow: auto; + height: 414px; + width: 100% !important; +} + + /** * Unified Diff */ .file { line-height: .7em; + overflow: auto; + height: 414px; } .diff { @@ -203,9 +213,8 @@ table.hrdiff caption span { - - + @@ -220,7 +229,7 @@ table.hrdiff caption span {

        {L_SKIP}

        -
        +
        diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index d72e75b009..2cc0b05e38 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -264,7 +264,7 @@
      • [Fix] Changed the success message when requesting a new password to be more accurate. (Bug #41405)
      • [Fix] Add missing anti-abuse email headers to acp_inactive.php and ucp_resend.php.
      • [Fix] Only remind users in the correct inactive states depending on the board account activation level.
      • -
      • [Fix] Various XHTML mistakes in prosilver, subsilver2 and the ACP. (Bugs #41745, #42265 - Patch by nickvergessen, #38465, #43015)
      • +
      • [Fix] Various XHTML mistakes in prosilver, subsilver2 and the ACP. (Bugs #41745, #42265 - Patch by nickvergessen, #38465, #43015, #46585 - Patch by Raimon)
      • [Fix] Log password changes via password reset function. (Bug #41365)
      • [Fix] Poll, negative durations generate error (Bug #41295 - Patch by TerraFrost)
      • [Fix] Visibility of custom field on registration is incorrectly controlled by setting "display" (Bug #41385 - Patch by Eelke and fade2gray)
      • diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php index 02fb6ccc37..5cb1b6ada9 100644 --- a/phpBB/includes/diff/renderer.php +++ b/phpBB/includes/diff/renderer.php @@ -536,7 +536,7 @@ class diff_renderer_raw extends diff_renderer */ function get_diff_content($diff) { - return ''; + return ''; } function _block_header($xbeg, $xlen, $ybeg, $ylen) From 1a863c9581f4606c4a86593de78db0caeebf33ce Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 26 Jul 2009 18:24:53 +0000 Subject: [PATCH 329/607] Alter r9860 #36685 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9862 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index b0eb5c9cb6..7b88c5764e 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -486,7 +486,7 @@ $lang = array_merge($lang, array( 'EMAIL_SIG' => 'E-mail signature', 'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all e-mails the board sends.', 'ENABLE_EMAIL' => 'Enable board-wide e-mails', - 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no e-mails will be sent by the board at all. Note the user and admin account activiation settings require this setting to be enabled.', + 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no e-mails will be sent by the board at all. Note the user and admin account activiation settings require this setting to be enabled. If currently using "user" or "admin" activation in the activation settings, disabling this setting will require no activiation of new accounts.', 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', 'SMTP_CRAM_MD5' => 'CRAM-MD5', From 18ce333e31ae5bd1df619b9d553a77050b693eb0 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 26 Jul 2009 18:31:31 +0000 Subject: [PATCH 330/607] Fix r9862 #36685 this is pre-pub as well O_O git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9863 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 7b88c5764e..8f86981f50 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -486,7 +486,7 @@ $lang = array_merge($lang, array( 'EMAIL_SIG' => 'E-mail signature', 'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all e-mails the board sends.', 'ENABLE_EMAIL' => 'Enable board-wide e-mails', - 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no e-mails will be sent by the board at all. Note the user and admin account activiation settings require this setting to be enabled. If currently using "user" or "admin" activation in the activation settings, disabling this setting will require no activiation of new accounts.', + 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no e-mails will be sent by the board at all. Note the user and admin account activation settings require this setting to be enabled. If currently using "user" or "admin" activation in the activation settings, disabling this setting will require no activation of new accounts.', 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', 'SMTP_CRAM_MD5' => 'CRAM-MD5', From e7b3a68259b37c497037a1a2a0c2c7e3f862623f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 26 Jul 2009 20:22:41 +0000 Subject: [PATCH 331/607] geez, maybe we should stop displaying text and this would become easier git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9864 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/mcp/mcp_front.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index b844796955..3f73bde7d8 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -322,14 +322,14 @@ function mcp_front_view($id, $mode, $action) if ($total == 0) { $template->assign_vars(array( - 'L_REPORTS_TOTAL' => $user->lang['PM_REPORTS_ZERO_TOTAL'], + 'L_PM_REPORTS_TOTAL' => $user->lang['PM_REPORTS_ZERO_TOTAL'], 'S_HAS_PM_REPORTS' => false) ); } else { $template->assign_vars(array( - 'L_REPORTS_TOTAL' => ($total == 1) ? $user->lang['PM_REPORT_TOTAL'] : sprintf($user->lang['PM_REPORTS_TOTAL'], $total), + 'L_PM_REPORTS_TOTAL' => ($total == 1) ? $user->lang['PM_REPORT_TOTAL'] : sprintf($user->lang['PM_REPORTS_TOTAL'], $total), 'S_HAS_PM_REPORTS' => true) ); } From 63dc25e5b4596d0f00e4f1dff7fb232141e5227c Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 27 Jul 2009 06:15:47 +0000 Subject: [PATCH 332/607] #48685 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9865 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../captcha/plugins/phpbb_captcha_qa_plugin.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index 7367816ae8..0a0a9f9211 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -54,7 +54,7 @@ class phpbb_captcha_qa $user->add_lang('captcha_qa'); // read input $this->confirm_id = request_var('qa_confirm_id', ''); - $this->answer = request_var('qa_answer', ''); + $this->answer = request_var('qa_answer', '', true); $this->type = (int) $type; $this->question_lang = $user->data['user_lang']; @@ -448,7 +448,7 @@ class phpbb_captcha_qa { global $db; - $answer = ($this->question_strict) ? request_var('qa_answer', '') : utf8_clean_string(request_var('qa_answer', '')); + $answer = ($this->question_strict) ? request_var('qa_answer', '', true) : utf8_clean_string(request_var('qa_answer', '', true)); $sql = 'SELECT answer_text FROM ' . ANSWERS_TABLE . ' @@ -578,9 +578,9 @@ class phpbb_captcha_qa { // okay, show the editor $error = false; - $input_question = request_var('question_text', ''); - $input_answers = request_var('answers', ''); - $input_lang = request_var('lang_iso', ''); + $input_question = request_var('question_text', '', true); + $input_answers = request_var('answers', '', true); + $input_lang = request_var('lang_iso', '', true); $input_strict = request_var('strict', false); $langs = $this->get_languages(); foreach ($langs as $lang => $entry) @@ -724,10 +724,10 @@ class phpbb_captcha_qa global $db; $question = array( - 'question_text' => request_var('question_text', ''), + 'question_text' => request_var('question_text', '', true), 'strict' => request_var('strict', false), 'lang_iso' => request_var('lang_iso', ''), - 'answers' => explode("\n", request_var('answers', '')), + 'answers' => explode("\n", request_var('answers', '', true)), ); return $question; From 0cb565dc0c49edb871393cf4ec15fa193ce7fccb Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 27 Jul 2009 09:56:31 +0000 Subject: [PATCH 333/607] do not cache results from registered users... git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9866 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/feed.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index 33549bcc56..ffce19746d 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -10,7 +10,6 @@ * MOD Author Profile: http://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=345763 * MOD Author Homepage: http://www.mssti.com/phpbb3/ * -* @note remove cache if Authentication gets added **/ /** @@ -221,7 +220,7 @@ function feed_append_sid($url, $params) // Now the only thing remaining could be an empty & if (substr($link, -5) === '&') { - $link = substr($link, 0, -5); + $link = substr($link, 0, -5); } return $link; @@ -417,7 +416,7 @@ class phpbb_feed /** * Default setting for last x days */ - var $sort_days = 100; + var $sort_days = 30; /** * Default cache time of entries in seconds @@ -585,7 +584,7 @@ class phpbb_feed $post_ids = array(); - // Search for topics in last 7 days + // Search for topics in last X days $last_post_time_sql = ($this->sort_days) ? ' AND t.topic_last_post_time > ' . (time() - ($this->sort_days * 24 * 3600)) : ''; // Fetch latest post, grouped by topic... @@ -713,6 +712,18 @@ class phpbb_feed { global $db, $cache; + // Disable cache if it is not a guest or a bot but a registered user + if ($this->cache_time) + { + global $user; + + // We check this here because we call get_item() quite often + if (!empty($user) && $user->data['is_registered']) + { + $this->cache_time = 0; + } + } + if (!$this->cache_time) { if (empty($this->result)) From 3d8d213e8f57a9387b090c858fb831036b264ade Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 27 Jul 2009 10:24:42 +0000 Subject: [PATCH 334/607] Cast some array values and properties to integer. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9867 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/feed.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index ffce19746d..5f19d0161b 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -604,7 +604,7 @@ class phpbb_feed while ($row = $db->sql_fetchrow($result)) { - $post_ids[] = $row['topic_last_post_id']; + $post_ids[] = (int) $row['topic_last_post_id']; } $db->sql_freeresult($result); } @@ -630,7 +630,7 @@ class phpbb_feed $forum_ids = array(); while ($row = $db->sql_fetchrow($result)) { - $forum_ids[] = $row['forum_id']; + $forum_ids[] = (int) $row['forum_id']; } $db->sql_freeresult($result); @@ -646,7 +646,7 @@ class phpbb_feed while ($row = $db->sql_fetchrow($result)) { - $post_ids[] = $row['topic_last_post_id']; + $post_ids[] = (int) $row['topic_last_post_id']; } $db->sql_freeresult($result); } @@ -676,7 +676,7 @@ class phpbb_feed while ($row = $db->sql_fetchrow($result)) { - $post_ids[] = $row['post_id']; + $post_ids[] = (int) $row['post_id']; } $db->sql_freeresult($result); } @@ -870,7 +870,7 @@ class phpbb_feed_news extends phpbb_feed $this->set('enable_smilies', 'enable_smilies'); $this->set('enable_magic_url', 'enable_magic_url'); - $this->num_items = $config['feed_overall_forums_limit']; + $this->num_items = (int) $config['feed_overall_forums_limit']; } function open() @@ -949,7 +949,7 @@ class phpbb_feed_topics extends phpbb_feed $this->set('enable_smilies', 'enable_smilies'); $this->set('enable_magic_url', 'enable_magic_url'); - $this->num_items = $config['feed_overall_topics_limit']; + $this->num_items = (int) $config['feed_overall_topics_limit']; } function open() @@ -981,7 +981,7 @@ class phpbb_feed_topics extends phpbb_feed while ($row = $db->sql_fetchrow($result)) { - $post_ids[] = $row['topic_first_post_id']; + $post_ids[] = (int) $row['topic_first_post_id']; } $db->sql_freeresult($result); From 4066849b726b279923d0518c4754f21b464186a4 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 27 Jul 2009 10:46:56 +0000 Subject: [PATCH 335/607] i hope this resolves the duplicate issues in feed readers git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9868 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/feed.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index 5f19d0161b..a84cc81940 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -218,10 +218,9 @@ function feed_append_sid($url, $params) $link = (strpos($link, 'sid=') !== false) ? trim(preg_replace('/(&|&|\?)sid=[a-z0-9]+(&|&)?/', '\1', $link), '?& ') : $link; // Now the only thing remaining could be an empty & - if (substr($link, -5) === '&') - { - $link = substr($link, 0, -5); - } + $link = (substr($link, -5) === '&') ? substr($link, 0, -5) : $link; + // And &#xxx + $link = str_replace('&#', '#', $link); return $link; } From a0acfb6a3fce9a547d19c28ac99654275152ac98 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 27 Jul 2009 11:39:28 +0000 Subject: [PATCH 336/607] Minor captcha API change - disable display of plugin by returning false in get_template. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9869 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../captcha/plugins/captcha_abstract.php | 35 +++++++++++-------- .../plugins/phpbb_captcha_qa_plugin.php | 21 +++++++---- .../plugins/phpbb_recaptcha_plugin.php | 25 ++++++++----- phpBB/includes/functions.php | 1 - phpBB/includes/ucp/ucp_register.php | 3 +- .../styles/prosilver/template/login_body.html | 2 +- .../prosilver/template/posting_editor.html | 2 +- .../subsilver2/template/login_body.html | 2 +- .../subsilver2/template/posting_body.html | 2 +- 9 files changed, 56 insertions(+), 37 deletions(-) diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index fb64063a90..d24e554188 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -87,21 +87,28 @@ class phpbb_default_captcha { global $config, $user, $template, $phpEx, $phpbb_root_path; - $link = append_sid($phpbb_root_path . 'ucp.' . $phpEx . '?mode=confirm&confirm_id=' . $this->confirm_id . '&type=' . $this->type); - $explain = ($this->type != CONFIRM_POST) ? sprintf($user->lang['CONFIRM_EXPLAIN'], '', '') : $user->lang['POST_CONFIRM_EXPLAIN']; - - $template->assign_vars(array( - 'CONFIRM_IMAGE_LINK' => $link, - 'CONFIRM_IMAGE' => '', - 'CONFIRM_IMG' => '', - 'CONFIRM_ID' => $this->confirm_id, - 'S_CONFIRM_CODE' => true, - 'S_TYPE' => $this->type, - 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh'] && $this->type == CONFIRM_REG) ? true : false, - 'L_CONFIRM_EXPLAIN' => $explain, - )); + if ($this->is_solved()) + { + return false; + } + else + { + $link = append_sid($phpbb_root_path . 'ucp.' . $phpEx . '?mode=confirm&confirm_id=' . $this->confirm_id . '&type=' . $this->type); + $explain = ($this->type != CONFIRM_POST) ? sprintf($user->lang['CONFIRM_EXPLAIN'], '', '') : $user->lang['POST_CONFIRM_EXPLAIN']; + + $template->assign_vars(array( + 'CONFIRM_IMAGE_LINK' => $link, + 'CONFIRM_IMAGE' => '', + 'CONFIRM_IMG' => '', + 'CONFIRM_ID' => $this->confirm_id, + 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, + 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh'] && $this->type == CONFIRM_REG) ? true : false, + 'L_CONFIRM_EXPLAIN' => $explain, + )); - return 'captcha_default.html'; + return 'captcha_default.html'; + } } function get_demo_template($id) diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index 0a0a9f9211..1b34f26bfa 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -171,14 +171,21 @@ class phpbb_captcha_qa { global $template; - $template->assign_vars(array( - 'QA_CONFIRM_QUESTION' => $this->question_text, - 'QA_CONFIRM_ID' => $this->confirm_id, - 'S_CONFIRM_CODE' => true, - 'S_TYPE' => $this->type, - )); + if ($this->is_solved()) + { + return false; + } + else + { + $template->assign_vars(array( + 'QA_CONFIRM_QUESTION' => $this->question_text, + 'QA_CONFIRM_ID' => $this->confirm_id, + 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, + )); - return 'captcha_qa.html'; + return 'captcha_qa.html'; + } } /** diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index f148b12656..9a2cc11ebd 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -128,16 +128,23 @@ class phpbb_recaptcha extends phpbb_default_captcha { global $config, $user, $template; - $template->assign_vars(array( - 'RECAPTCHA_SERVER' => $this->recaptcha_server, - 'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '', - 'RECAPTCHA_ERRORGET' => '', - 'S_RECAPTCHA_AVAILABLE' => $this->is_available(), - 'S_CONFIRM_CODE' => true, - 'S_TYPE' => $this->type, - )); + if ($this->is_solved()) + { + return false; + } + else + { + $template->assign_vars(array( + 'RECAPTCHA_SERVER' => $this->recaptcha_server, + 'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '', + 'RECAPTCHA_ERRORGET' => '', + 'S_RECAPTCHA_AVAILABLE' => $this->is_available(), + 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, + )); - return 'captcha_recaptcha.html'; + return 'captcha_recaptcha.html'; + } } function get_demo_template($id) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 2d86b233f7..4badd69e9f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2752,7 +2752,6 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $captcha->reset(); $template->assign_vars(array( - 'S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template(), )); diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index da62061a72..f428b4603c 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -446,10 +446,9 @@ class ucp_register $confirm_image = ''; // Visual Confirmation - Show images - if ($config['enable_confirm'] && !$captcha->is_solved()) + if ($config['enable_confirm']) { $template->assign_vars(array( - 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''), 'CAPTCHA_TEMPLATE' => $captcha->get_template(), )); } diff --git a/phpBB/styles/prosilver/template/login_body.html b/phpBB/styles/prosilver/template/login_body.html index a4cd990630..61f796004f 100644 --- a/phpBB/styles/prosilver/template/login_body.html +++ b/phpBB/styles/prosilver/template/login_body.html @@ -21,7 +21,7 @@
        {L_RESEND_ACTIVATION}
  • - + diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index dea3277ba2..a02ad3ed10 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -99,7 +99,7 @@
    - + diff --git a/phpBB/styles/subsilver2/template/login_body.html b/phpBB/styles/subsilver2/template/login_body.html index b8a789bfe7..810a7376f2 100644 --- a/phpBB/styles/subsilver2/template/login_body.html +++ b/phpBB/styles/subsilver2/template/login_body.html @@ -65,7 +65,7 @@ - + diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html index f8996b1517..963e6fe966 100644 --- a/phpBB/styles/subsilver2/template/posting_body.html +++ b/phpBB/styles/subsilver2/template/posting_body.html @@ -332,7 +332,7 @@ - + From a96986744dbe5819b42baacc929c23fc8e57c746 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 27 Jul 2009 12:18:09 +0000 Subject: [PATCH 337/607] Directly send UTF8 data instead of entities. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9870 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/feed.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index a84cc81940..f0e4435956 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -282,10 +282,10 @@ function feed_generate_content($content, $uid, $bitfield, $options) // Replace some entities with their unicode counterpart $entities = array( - ' ' => ' ', - '•' => '•', - '·' => '·', - '©' => '©', + ' ' => "\xC2\xA0", + '•' => "\xE2\x80\xA2", + '·' => "\xC2\xB7", + '©' => "\xC2\xA9", ); $content = str_replace(array_keys($entities), array_values($entities), $content); @@ -425,7 +425,7 @@ class phpbb_feed /** * Separator for title elements to separate items (for example forum / topic) */ - var $separator = '•'; + var $separator = "\xE2\x80\xA2"; // • /** * Constructor. Set standard keys. From d2aca86b4a1858200a032e7bf4fdd997bc339331 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 27 Jul 2009 12:43:57 +0000 Subject: [PATCH 338/607] Fix a bug in r9781 #48595 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9871 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_logs.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index 567606cfc7..d1e8b6d9c4 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -33,6 +33,7 @@ class acp_logs // Set up general vars $action = request_var('action', ''); $forum_id = request_var('f', 0); + $topic_id = request_var('t', 0); $start = request_var('start', 0); $deletemark = (!empty($_POST['delmarked'])) ? true : false; $deleteall = (!empty($_POST['delall'])) ? true : false; From 986576e2457522e4d8fc1f877210b3aff60eefea Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 27 Jul 2009 12:57:29 +0000 Subject: [PATCH 339/607] Fix an SQL error git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9872 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index aeb378953d..8fc895efdc 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2376,7 +2376,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id WHERE l.log_type = $log_type AND u.user_id = l.user_id " . (($limit_days) ? "AND l.log_time >= $limit_days" : '') . - (!empty($log_operation) ? "AND l.log_operation = '" . $db->sql_escape($log_operation) . "'" : '') . " + (!empty($log_operation) ? " AND l.log_operation = '" . $db->sql_escape($log_operation) . "'" : '') . " $sql_forum ORDER BY $sort_by"; $result = $db->sql_query_limit($sql, $limit, $offset); From 9795ceef149fe5772c1619f8940ecd26c950b9cc Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 27 Jul 2009 12:58:15 +0000 Subject: [PATCH 340/607] Display the filter settings in the ACP log viewer when no entries are found. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9873 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_logs.html | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/phpBB/adm/style/acp_logs.html b/phpBB/adm/style/acp_logs.html index 843aa21c63..1c5c8940d2 100644 --- a/phpBB/adm/style/acp_logs.html +++ b/phpBB/adm/style/acp_logs.html @@ -53,19 +53,25 @@
    -
    - {L_DISPLAY_LOG}:  {S_LIMIT_DAYS} {L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR} - - {S_FORM_TOKEN} -
    -
    - + +
    +

    {L_NO_ENTRIES}

    +
    + + +
    + {L_DISPLAY_LOG}:  {S_LIMIT_DAYS} {L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR} + + {S_FORM_TOKEN} +
    +
    +
    {L_SELECT_FORUM}: @@ -73,7 +79,7 @@
    - +
     
    @@ -81,14 +87,6 @@
    - - -
    -

    {L_NO_ENTRIES}

    -
    - - - From f0820bc4426983ec7ef64e4ae7684020464fe6dc Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 27 Jul 2009 13:19:06 +0000 Subject: [PATCH 341/607] typo git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9874 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index 9a2cc11ebd..3ad58851b4 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -156,7 +156,7 @@ class phpbb_recaptcha extends phpbb_default_captcha { $hidden_fields = array(); - // this is required for postig.php - otherwise we would forget about the captcha being already solved + // this is required for posting.php - otherwise we would forget about the captcha being already solved if ($this->solved) { $hidden_fields['confirm_code'] = $this->confirm_code; From 919d42d02dc46b11f011b8e5073720579aad6615 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 27 Jul 2009 13:40:43 +0000 Subject: [PATCH 342/607] add EDIT_QUESTION git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9875 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/captcha_qa.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/language/en/captcha_qa.php b/phpBB/language/en/captcha_qa.php index 0d3dae0fab..6942d6dc0b 100644 --- a/phpBB/language/en/captcha_qa.php +++ b/phpBB/language/en/captcha_qa.php @@ -45,6 +45,7 @@ $lang = array_merge($lang, array( 'CONFIRM_QUESTION' => 'Question', 'ANSWER' => 'Answer', + 'EDIT_QUESTION' => 'Edit Question', 'QUESTIONS' => 'Questions', 'QUESTIONS_EXPLAIN' => 'Here you can add and edit questions to be asked on registration. You have to provide at least one question in the default board language to use this plugin. Questions should be easy for your target audience, but beyond the ability of google. Also, remember to change the questions regularly. If your question relies on punctuation, spelling or capitalisation, use the strict setting.', 'QUESTION_DELETED' => 'Question deleted', From 78b1c4caaa17cc8760b685ad41c19f15f9d89b68 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 27 Jul 2009 15:05:59 +0000 Subject: [PATCH 343/607] Do not send private message back to sender if sender is in the same group the private message was sent to. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9876 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_privmsgs.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 2cc0b05e38..23db9c780c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -178,6 +178,7 @@
  • [Fix] Display "Locked" button instead of "Reply" one for locked forum in viewtopic (prosilver). (Bug #38055 - Patch by Raimon)
  • [Fix] Correctly propagate umlauts over search result pages (Bug #33755)
  • [Fix] Preserve post options when refusing to save the post as a draft. (Bug #39115)
  • +
  • [Fix] Do not send private message back to sender if sender is in the same group the private message was sent to.
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 883d8ff13f..b201329b20 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1356,6 +1356,12 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) while ($row = $db->sql_fetchrow($result)) { + // Additionally, do not include the sender if he is in the group he wants to send to. ;) + if ($row['user_id'] === $user->data['user_id']) + { + continue; + } + $field = ($data['address_list']['g'][$row['group_id']] == 'to') ? 'to' : 'bcc'; $recipients[$row['user_id']] = $field; } @@ -1901,7 +1907,7 @@ function get_recipient_strings($pm_by_id) foreach ($pm_by_id as $message_id => $row) { $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); - + foreach ($_types as $ug_type) { if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) From fc4aaa3f5a32d8d7295197f15b2b9355b851342a Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 28 Jul 2009 07:05:17 +0000 Subject: [PATCH 344/607] #48735 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9877 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index 1b34f26bfa..4836d7906f 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -32,7 +32,6 @@ define('QA_CONFIRM_TABLE', $table_prefix . 'qa_confirm'); class phpbb_captcha_qa { var $confirm_id; - var $confirm_code; var $answer; var $question_ids; var $question_text; @@ -509,7 +508,7 @@ class phpbb_captcha_qa $db->sql_query($sql); // we leave the class usable by generating a new question - $this->generate_code(); + $this->select_question(); } /** From fecc3383a24eafe9b84caea37720813a0f1f5cfe Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 28 Jul 2009 11:26:55 +0000 Subject: [PATCH 345/607] disable QR by default git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9878 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 6d596a8a00..c2b5b3d3d1 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1409,7 +1409,7 @@ function change_database_data(&$no_updates, $version) if (!isset($config['allow_quick_reply'])) { - set_config('allow_quick_reply', '1'); + set_config('allow_quick_reply', '0'); } // Set every members user_options column to enable diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 3545fa9bc2..23ba9db2b5 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -27,7 +27,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_report', INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_flash', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_links', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_privmsg', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_quick_reply', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_quick_reply', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_bbcode', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_flash', '0'); From 6510aef869e455ae6748e4719cb6cb187264f4bb Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Tue, 28 Jul 2009 11:47:32 +0000 Subject: [PATCH 346/607] Fix bug #48345 - Adding users to group - default rank does not changing correctly Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9879 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_user.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 23db9c780c..93cafef1bd 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -179,6 +179,7 @@
  • [Fix] Correctly propagate umlauts over search result pages (Bug #33755)
  • [Fix] Preserve post options when refusing to save the post as a draft. (Bug #39115)
  • [Fix] Do not send private message back to sender if sender is in the same group the private message was sent to.
  • +
  • [Fix] Correctly add user to a group making it a default one. (Bug #48345 - Patch by rxu)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index e8584239ad..324be2b1ed 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2780,7 +2780,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, if ($default) { - group_set_user_default($group_id, $user_id_ary, $group_attributes); + group_user_attributes('default', $group_id, $user_id_ary, false, $group_name, $group_attributes); } $db->sql_transaction('commit'); From da169625a6a4e7682f0b3a2623f2081e52ad4a49 Mon Sep 17 00:00:00 2001 From: "Marek A. R" Date: Tue, 28 Jul 2009 13:58:01 +0000 Subject: [PATCH 347/607] - Display version check on ACP main page. - Cache version check. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9880 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_main.html | 16 ++++++++++++ phpBB/adm/style/acp_update.html | 4 +-- phpBB/docs/CHANGELOG.html | 2 ++ phpBB/includes/acp/acp_main.php | 21 ++++++++++++++++ phpBB/includes/acp/acp_update.php | 8 ++---- phpBB/includes/functions_admin.php | 39 ++++++++++++++++++++++++++++++ phpBB/language/en/acp/common.php | 9 ++++--- 7 files changed, 88 insertions(+), 11 deletions(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 4718869d73..192d2e50f5 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -14,6 +14,22 @@

    {L_ADMIN_INTRO}

    + +
    +

    {L_VERSIONCHECK_FAIL} - {L_VERSIONCHECK_FORCE_UPDATE} - {L_MORE}

    +
    + + +
    +

    {L_VERSION_UP_TO_DATE_ACP} - {L_VERSIONCHECK_FORCE_UPDATE} - {L_MORE}

    +
    + +
    +

    {L_VERSION_NOT_UP_TO_DATE_ACP} - {L_VERSIONCHECK_FORCE_UPDATE} - {L_MORE}

    +
    + + +

    {L_WARNING}

    diff --git a/phpBB/adm/style/acp_update.html b/phpBB/adm/style/acp_update.html index e82aee0e87..34d4f6934e 100644 --- a/phpBB/adm/style/acp_update.html +++ b/phpBB/adm/style/acp_update.html @@ -10,11 +10,11 @@
    -

    {L_VERSION_UP_TO_DATE_ACP}

    +

    {L_VERSION_UP_TO_DATE_ACP} - {L_VERSIONCHECK_FORCE_UPDATE}

    -

    {L_VERSION_NOT_UP_TO_DATE_ACP}

    +

    {L_VERSION_NOT_UP_TO_DATE_ACP} - {L_VERSIONCHECK_FORCE_UPDATE}

    diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 93cafef1bd..a9f68729e2 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -201,6 +201,7 @@
  • [Change] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)
  • [Change] Add pagination for icons and smilies in the ACP and smilies in the smiley popup
  • [Change] Cache get_username_string() function calls on viewtopic.
  • +
  • [Change] Cache version check.
  • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
  • [Feature] Backported 3.2 captcha plugins.
      @@ -247,6 +248,7 @@
    • Show date of last reminder sent to user.
  • +
  • [Feature] Display version check on ACP main page.
  • 1.ii. Changes since 3.0.4

    diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index f9d611f8db..8a5918b558 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -395,6 +395,25 @@ class acp_main } } + // Version check + $user->add_lang('install'); + + $latest_version_info = false; + if (($latest_version_info = obtain_latest_version_info(request_var('versioncheck_force', false))) === false) + { + $template->assign_var('S_VERSIONCHECK_FAIL', true); + } + else + { + $latest_version_info = explode("\n", $latest_version_info); + $latest_version = trim($latest_version_info[0]); + $template->assign_var('S_VERSION_UP_TO_DATE', + version_compare( + str_replace('rc', 'RC', strtolower($config['version'])), + str_replace('rc', 'RC', strtolower($latest_version)), + '<') ? false : true); + } + // Get forum statistics $total_posts = $config['num_posts']; $total_topics = $config['num_topics']; @@ -492,6 +511,8 @@ class acp_main 'U_ACTION' => $this->u_action, 'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&mode=admin'), 'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&mode=list'), + 'U_VERSIONCHECK' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&mode=version_check'), + 'U_VERSIONCHECK_FORCE' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=1&versioncheck_force=1'), 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false, 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index dbb25bdbbd..121c72aeb3 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -37,12 +37,7 @@ class acp_update $errstr = ''; $errno = 0; - $info = get_remote_file('www.phpbb.com', '/updatecheck', ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); - - if ($info === false) - { - trigger_error($errstr, E_USER_WARNING); - } + $info = obtain_latest_version_info(request_var('versioncheck_force', false), true); $info = explode("\n", $info); $latest_version = trim($info[0]); @@ -68,6 +63,7 @@ class acp_update 'S_UP_TO_DATE_AUTO' => $up_to_date_automatic, 'S_VERSION_CHECK' => true, 'U_ACTION' => $this->u_action, + 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'), 'LATEST_VERSION' => $latest_version, 'CURRENT_VERSION' => $config['version'], diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 8fc895efdc..afd00f88bf 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3054,4 +3054,43 @@ function add_permission_language() return true; } +/** + * Obtains the latest version information + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $warn_fail Trigger a warning if obtaining the latest version information fails. Defaults to false. + * @param int $ttl Cache version information for $ttl seconds. Defaults to 86400 (24 hours). + * + * @return string | false Version info on success, false on failure. + */ +function obtain_latest_version_info($force_update = false, $warn_fail = false, $ttl = 86400) +{ + global $cache; + + $info = $cache->get('versioncheck'); + + if ($info === false || $force_update) + { + $errstr = ''; + $errno = 0; + + $info = get_remote_file('www.phpbb.com', '/updatecheck', + ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); + + if ($info === false) + { + $cache->destroy('versioncheck'); + if ($warn_fail) + { + trigger_error($errstr, E_USER_WARNING); + } + return false; + } + + $cache->put('versioncheck', $info, $ttl); + } + + return $info; +} + ?> \ No newline at end of file diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index af0a61fd32..47ce59183f 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -249,6 +249,7 @@ $lang = array_merge($lang, array( 'MANAGE' => 'Manage', 'MENU_TOGGLE' => 'Hide or display the side menu', + 'MORE' => 'More »', 'MOVE_DOWN' => 'Move down', 'MOVE_UP' => 'Move up', @@ -374,9 +375,11 @@ $lang = array_merge($lang, array( 'UPLOAD_DIR_SIZE' => 'Size of posted attachments', 'USERS_PER_DAY' => 'Users per day', - 'VALUE' => 'Value', - 'VIEW_ADMIN_LOG' => 'View administrator log', - 'VIEW_INACTIVE_USERS' => 'View inactive users', + 'VALUE' => 'Value', + 'VERSIONCHECK_FAIL' => 'Failed to obtain latest version', + 'VERSIONCHECK_FORCE_UPDATE' => 'Re-Check version', + 'VIEW_ADMIN_LOG' => 'View administrator log', + 'VIEW_INACTIVE_USERS' => 'View inactive users', 'WELCOME_PHPBB' => 'Welcome to phpBB', 'WRITABLE_CONFIG' => 'Your config file (config.php) is currently world-writable. We strongly encourage you to change the permissions to 640 or at least to 644 (for example: chmod 640 config.php).', From 2532b579ce17a7a3a4866b7e787d8676dcef4ad6 Mon Sep 17 00:00:00 2001 From: "Marek A. R" Date: Tue, 28 Jul 2009 14:12:34 +0000 Subject: [PATCH 348/607] - Use nonbreakable space. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9881 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 47ce59183f..dd9869bbdb 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -249,7 +249,7 @@ $lang = array_merge($lang, array( 'MANAGE' => 'Manage', 'MENU_TOGGLE' => 'Hide or display the side menu', - 'MORE' => 'More »', + 'MORE' => 'More »', 'MOVE_DOWN' => 'Move down', 'MOVE_UP' => 'Move up', From d2420fe5550454871e784be846849d3e57dde5e8 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Tue, 28 Jul 2009 14:34:12 +0000 Subject: [PATCH 349/607] Fix r9855 for #46765 Authorised by: bantu git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9882 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4badd69e9f..639e9aa899 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4210,7 +4210,7 @@ function get_unread_topics_list($user_id = false, $sql_extra = '') $sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . " WHERE topic_last_post_time > {$user->data['user_lastmark']} - AND " . $db->sql_in_set('topic_id', array_keys($unread_topics_list), true, true) . ' + AND " . $db->sql_in_set('topic_id', $tracked_topics_list, true, true) . ' AND ' . $db->sql_in_set('forum_id', $tracked_forums_list, true, true) . " $sql_extra ORDER BY topic_last_post_time DESC"; From e2d24413b6323ec1863b01413082ef7f7daa739b Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 28 Jul 2009 14:56:39 +0000 Subject: [PATCH 350/607] More small adjustments to get_unread_topics_list(). #46765 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9883 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 639e9aa899..289f7f084f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4139,7 +4139,7 @@ function get_unread_topics_list($user_id = false, $sql_extra = '') if ($user_id === false) { - $user_id = $user->data['user_id']; + $user_id = (int) $user->data['user_id']; } $tracked_topics_list = $unread_topics_list = $read_topics_list = array(); @@ -4151,11 +4151,12 @@ function get_unread_topics_list($user_id = false, $sql_extra = '') // This list is to fetch later the forums user never read (fully) before $sql = 'SELECT forum_id FROM ' . FORUMS_TRACK_TABLE . " - WHERE user_id = {$user_id}"; + WHERE user_id = $user_id"; $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { - $tracked_forums_list[] = $row['forum_id']; + $tracked_forums_list[] = (int) $row['forum_id']; } $db->sql_freeresult($result); @@ -4164,20 +4165,21 @@ function get_unread_topics_list($user_id = false, $sql_extra = '') FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TRACK_TABLE . " tt WHERE t.topic_id = tt.topic_id AND t.topic_last_post_time >= tt.mark_time - AND tt.user_id = {$user_id} + AND tt.user_id = $user_id $sql_extra ORDER BY t.topic_last_post_time DESC"; $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { if ($row['topic_last_post_time'] == $row['mark_time']) { // Check if there're read topics for the forums having unread ones - $read_topics_list[$row['topic_id']] = $row['mark_time']; + $read_topics_list[$row['topic_id']] = (int) $row['mark_time']; } else { - $unread_topics_list[$row['topic_id']] = $row['mark_time']; + $unread_topics_list[$row['topic_id']] = (int) $row['mark_time']; } } $db->sql_freeresult($result); @@ -4192,13 +4194,14 @@ function get_unread_topics_list($user_id = false, $sql_extra = '') WHERE t.forum_id = ft.forum_id AND t.topic_last_post_time > ft.mark_time AND ' . $db->sql_in_set('t.topic_id', $tracked_topics_list, true, true) . " - AND ft.user_id = {$user_id} + AND ft.user_id = $user_id $sql_extra ORDER BY t.topic_last_post_time DESC"; $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { - $unread_topics_list[$row['topic_id']] = $row['mark_time']; + $unread_topics_list[$row['topic_id']] = (int) $row['mark_time']; } $db->sql_freeresult($result); @@ -4208,16 +4211,17 @@ function get_unread_topics_list($user_id = false, $sql_extra = '') // And the last step - find unread topics were not found before (that can mean a user has never read some forums) $sql = 'SELECT topic_id - FROM ' . TOPICS_TABLE . " - WHERE topic_last_post_time > {$user->data['user_lastmark']} - AND " . $db->sql_in_set('topic_id', $tracked_topics_list, true, true) . ' + FROM ' . TOPICS_TABLE . ' + WHERE topic_last_post_time > ' . (int) $user->data['user_lastmark'] . ' + AND ' . $db->sql_in_set('topic_id', $tracked_topics_list, true, true) . ' AND ' . $db->sql_in_set('forum_id', $tracked_forums_list, true, true) . " $sql_extra ORDER BY topic_last_post_time DESC"; $result = $db->sql_query_limit($sql, 1000); + while ($row = $db->sql_fetchrow($result)) { - $unread_topics_list[$row['topic_id']] = $user->data['user_lastmark']; + $unread_topics_list[$row['topic_id']] = (int) $user->data['user_lastmark']; } $db->sql_freeresult($result); } From da0da0dd8990b11b4005c290ab448fb0dc175454 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 28 Jul 2009 15:30:47 +0000 Subject: [PATCH 351/607] Move get_unread_topics_list() up in functions.php, added some documentation. Related to #46765 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9884 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 216 ++++++++++++++++++----------------- 1 file changed, 111 insertions(+), 105 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 289f7f084f..3aaa6fbcab 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1644,6 +1644,117 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis return $last_read; } +/** +* Get list of unread topics +* only for registered users and non-cookie tracking +* +* @param int $user_id User ID (or false for currect user) +* @param string $sql_extra Extra WHERE SQL statement +* +* @return array[int][int] Topic ids as keys, mark_time of topic as value +* @author rxu +*/ +function get_unread_topics_list($user_id = false, $sql_extra = '') +{ + global $config, $db, $user; + + if ($user_id === false) + { + $user_id = (int) $user->data['user_id']; + } + + $tracked_topics_list = $unread_topics_list = $read_topics_list = array(); + $tracked_forums_list = array(); + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + // List of the tracked forums (not ideal, hope the better way will be found) + // This list is to fetch later the forums user never read (fully) before + $sql = 'SELECT forum_id + FROM ' . FORUMS_TRACK_TABLE . " + WHERE user_id = $user_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $tracked_forums_list[] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + + // Get list of the unread topics - on topics tracking as the first step + $sql = 'SELECT t.topic_id, t.topic_last_post_time, tt.mark_time + FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TRACK_TABLE . " tt + WHERE t.topic_id = tt.topic_id + AND t.topic_last_post_time >= tt.mark_time + AND tt.user_id = $user_id + $sql_extra + ORDER BY t.topic_last_post_time DESC"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['topic_last_post_time'] == $row['mark_time']) + { + // Check if there're read topics for the forums having unread ones + $read_topics_list[$row['topic_id']] = (int) $row['mark_time']; + } + else + { + $unread_topics_list[$row['topic_id']] = (int) $row['mark_time']; + } + } + $db->sql_freeresult($result); + + // Get the full list of the tracked topics + $tracked_topics_list = array_merge(array_keys($unread_topics_list), array_keys($read_topics_list)); + + // Get list of the unread topics - on forums tracking as the second step + // We don't take in account topics tracked before + $sql = 'SELECT t.topic_id, ft.mark_time + FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TRACK_TABLE . ' ft + WHERE t.forum_id = ft.forum_id + AND t.topic_last_post_time > ft.mark_time + AND ' . $db->sql_in_set('t.topic_id', $tracked_topics_list, true, true) . " + AND ft.user_id = $user_id + $sql_extra + ORDER BY t.topic_last_post_time DESC"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $unread_topics_list[$row['topic_id']] = (int) $row['mark_time']; + } + $db->sql_freeresult($result); + + // Refresh the full list of the tracked topics + unset($tracked_topics_list); + $tracked_topics_list = array_merge(array_keys($unread_topics_list), array_keys($read_topics_list)); + + // And the last step - find unread topics were not found before (that can mean a user has never read some forums) + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_last_post_time > ' . (int) $user->data['user_lastmark'] . ' + AND ' . $db->sql_in_set('topic_id', $tracked_topics_list, true, true) . ' + AND ' . $db->sql_in_set('forum_id', $tracked_forums_list, true, true) . " + $sql_extra + ORDER BY topic_last_post_time DESC"; + $result = $db->sql_query_limit($sql, 1000); + + while ($row = $db->sql_fetchrow($result)) + { + $unread_topics_list[$row['topic_id']] = (int) $user->data['user_lastmark']; + } + $db->sql_freeresult($result); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + // We do not implement unread topics list for cookie based tracking + // because it would require expensive database queries + } + + return $unread_topics_list; +} + /** * Check for read forums and update topic tracking info accordingly * @@ -4129,109 +4240,4 @@ function phpbb_user_session_handler() return; } -/* -* Get list of unread topics -* only for registered users and non-cookie tracking this function is used -*/ -function get_unread_topics_list($user_id = false, $sql_extra = '') -{ - global $config, $db, $user; - - if ($user_id === false) - { - $user_id = (int) $user->data['user_id']; - } - - $tracked_topics_list = $unread_topics_list = $read_topics_list = array(); - $tracked_forums_list = array(); - - if ($config['load_db_lastread'] && $user->data['is_registered']) - { - // List of the tracked forums (not ideal, hope the better way will be found) - // This list is to fetch later the forums user never read (fully) before - $sql = 'SELECT forum_id - FROM ' . FORUMS_TRACK_TABLE . " - WHERE user_id = $user_id"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $tracked_forums_list[] = (int) $row['forum_id']; - } - $db->sql_freeresult($result); - - // Get list of the unread topics - on topics tracking as the first step - $sql = 'SELECT t.topic_id, t.topic_last_post_time, tt.mark_time - FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TRACK_TABLE . " tt - WHERE t.topic_id = tt.topic_id - AND t.topic_last_post_time >= tt.mark_time - AND tt.user_id = $user_id - $sql_extra - ORDER BY t.topic_last_post_time DESC"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - if ($row['topic_last_post_time'] == $row['mark_time']) - { - // Check if there're read topics for the forums having unread ones - $read_topics_list[$row['topic_id']] = (int) $row['mark_time']; - } - else - { - $unread_topics_list[$row['topic_id']] = (int) $row['mark_time']; - } - } - $db->sql_freeresult($result); - - // Get the full list of the tracked topics - $tracked_topics_list = array_merge(array_keys($unread_topics_list), array_keys($read_topics_list)); - - // Get list of the unread topics - on forums tracking as the second step - // We don't take in account topics tracked before - $sql = 'SELECT t.topic_id, ft.mark_time - FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TRACK_TABLE . ' ft - WHERE t.forum_id = ft.forum_id - AND t.topic_last_post_time > ft.mark_time - AND ' . $db->sql_in_set('t.topic_id', $tracked_topics_list, true, true) . " - AND ft.user_id = $user_id - $sql_extra - ORDER BY t.topic_last_post_time DESC"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $unread_topics_list[$row['topic_id']] = (int) $row['mark_time']; - } - $db->sql_freeresult($result); - - // Refresh the full list of the tracked topics - unset($tracked_topics_list); - $tracked_topics_list = array_merge(array_keys($unread_topics_list), array_keys($read_topics_list)); - - // And the last step - find unread topics were not found before (that can mean a user has never read some forums) - $sql = 'SELECT topic_id - FROM ' . TOPICS_TABLE . ' - WHERE topic_last_post_time > ' . (int) $user->data['user_lastmark'] . ' - AND ' . $db->sql_in_set('topic_id', $tracked_topics_list, true, true) . ' - AND ' . $db->sql_in_set('forum_id', $tracked_forums_list, true, true) . " - $sql_extra - ORDER BY topic_last_post_time DESC"; - $result = $db->sql_query_limit($sql, 1000); - - while ($row = $db->sql_fetchrow($result)) - { - $unread_topics_list[$row['topic_id']] = (int) $user->data['user_lastmark']; - } - $db->sql_freeresult($result); - } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) - { - // We do not implement unread topics list for cookie based tracking - // because it would require expensive database queries - } - - return $unread_topics_list; -} - ?> \ No newline at end of file From 8880e86f7b93c8b03e4f788c6abc17b429b390e7 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 28 Jul 2009 20:29:34 +0000 Subject: [PATCH 352/607] Fix tiny typo in r9884, #46765. Thanks rxu. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9885 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3aaa6fbcab..241bed408f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1648,7 +1648,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis * Get list of unread topics * only for registered users and non-cookie tracking * -* @param int $user_id User ID (or false for currect user) +* @param int $user_id User ID (or false for current user) * @param string $sql_extra Extra WHERE SQL statement * * @return array[int][int] Topic ids as keys, mark_time of topic as value From b4f3a0eb2d20cd618a1ade5f2d38a90cb9c6d265 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 28 Jul 2009 21:33:31 +0000 Subject: [PATCH 353/607] Fix r9696, #45115. Move column change to the correct version. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9886 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index c2b5b3d3d1..a00d928a12 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -679,11 +679,6 @@ function database_update_info() 'forum_style' => array('UINT', 0), ), ), - 'change_columns' => array( - USERS_TABLE => array( - 'user_options' => array('UINT:11', 230271), - ), - ), ), // No changes from 3.0.5-RC1 to 3.0.5 @@ -710,6 +705,11 @@ function database_update_info() 'pm_id' => array('UINT', 0), ), ), + 'change_columns' => array( + USERS_TABLE => array( + 'user_options' => array('UINT:11', 230271), + ), + ), 'add_index' => array( LOG_TABLE => array( 'log_time' => array('log_time'), From 1b8a1f73d77d3df21b8404611a130bb4ee19b822 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 28 Jul 2009 22:09:46 +0000 Subject: [PATCH 354/607] [Feature] Ability to copy permissions from one forum to several other forums. [Fix] Add log entry when copying forum permissions. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9887 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/permission_forum_copy.html | 120 ++++++++++++++++ phpBB/docs/CHANGELOG.html | 2 + phpBB/includes/acp/acp_forums.php | 58 +------- phpBB/includes/acp/acp_permissions.php | 66 +++++++++ phpBB/includes/acp/info/acp_permissions.php | 1 + phpBB/includes/functions_admin.php | 143 ++++++++++++++++++++ phpBB/install/database_update.php | 43 ++++++ phpBB/language/en/acp/common.php | 2 + phpBB/language/en/acp/permissions.php | 7 + 9 files changed, 385 insertions(+), 57 deletions(-) create mode 100644 phpBB/adm/style/permission_forum_copy.html diff --git a/phpBB/adm/style/permission_forum_copy.html b/phpBB/adm/style/permission_forum_copy.html new file mode 100644 index 0000000000..5a7978438b --- /dev/null +++ b/phpBB/adm/style/permission_forum_copy.html @@ -0,0 +1,120 @@ + + + + +

    {L_ACP_FORUM_PERMISSIONS_COPY}

    + + {L_ACP_FORUM_PERMISSIONS_COPY_EXPLAIN} + +
    + +
    + {L_LOOK_UP_FORUM} + +
    +

    {L_COPY_PERMISSIONS_FORUM_FROM_EXPLAIN}
    +
    +
    +
    + +
    + {L_LOOK_UP_FORUM} +

    {L_LOOK_UP_FORUMS_EXPLAIN}

    + +
    +

    {L_COPY_PERMISSIONS_FORUM_TO_EXPLAIN}
    +
    +
    +
    + +
    + {L_SUBMIT} +   + + {S_HIDDEN_FIELDS} + {S_FORM_TOKEN} +
    + +
    + + + + + + +

    {L_ACP_FORUM_PERMISSIONS_COPY}

    + + {L_ACP_FORUM_PERMISSIONS_COPY_EXPLAIN} + +
    + +
    + {L_LOOK_UP_FORUM} + +
    +

    {L_COPY_PERMISSIONS_FORUM_FROM_EXPLAIN}
    +
    +
    +
    + +
    + {L_LOOK_UP_FORUM} +

    {L_LOOK_UP_FORUMS_EXPLAIN}

    + +
    +

    {L_COPY_PERMISSIONS_FORUM_TO_EXPLAIN}
    +
    +
    +
    + +
    + {L_SUBMIT} +   + + {S_HIDDEN_FIELDS} + {S_FORM_TOKEN} +
    + +
    + + + + + + +

    {L_ACP_FORUM_PERMISSIONS_COPY}

    + + {L_ACP_FORUM_PERMISSIONS_COPY_EXPLAIN} + +
    + +
    + {L_LOOK_UP_FORUM} + +
    +

    {L_COPY_PERMISSIONS_FORUM_FROM_EXPLAIN}
    +
    +
    +
    + +
    + {L_LOOK_UP_FORUM} +

    {L_LOOK_UP_FORUMS_EXPLAIN}

    + +
    +

    {L_COPY_PERMISSIONS_FORUM_TO_EXPLAIN}
    +
    +
    +
    + +
    + {L_SUBMIT} +   + + {S_HIDDEN_FIELDS} + {S_FORM_TOKEN} +
    + +
    + + diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a9f68729e2..831956092b 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -180,6 +180,7 @@
  • [Fix] Preserve post options when refusing to save the post as a draft. (Bug #39115)
  • [Fix] Do not send private message back to sender if sender is in the same group the private message was sent to.
  • [Fix] Correctly add user to a group making it a default one. (Bug #48345 - Patch by rxu)
  • +
  • [Fix] Add log entry when copying forum permissions.
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • @@ -249,6 +250,7 @@
  • [Feature] Display version check on ACP main page.
  • +
  • [Feature] Ability to copy permissions from one forum to several other forums.
  • 1.ii. Changes since 3.0.4

    diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 810caa62d5..b6a13acd01 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -187,63 +187,7 @@ class acp_forums if (!empty($forum_perm_from) && $forum_perm_from != $forum_data['forum_id'] && (($action != 'edit') || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')))) { - // if we edit a forum delete current permissions first - if ($action == 'edit') - { - $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' - WHERE forum_id = ' . (int) $forum_data['forum_id']; - $db->sql_query($sql); - - $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' - WHERE forum_id = ' . (int) $forum_data['forum_id']; - $db->sql_query($sql); - } - - // From the mysql documentation: - // Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14. - // Due to this we stay on the safe side if we do the insertion "the manual way" - - // Copy permisisons from/to the acl users table (only forum_id gets changed) - $sql = 'SELECT user_id, auth_option_id, auth_role_id, auth_setting - FROM ' . ACL_USERS_TABLE . ' - WHERE forum_id = ' . $forum_perm_from; - $result = $db->sql_query($sql); - - $users_sql_ary = array(); - while ($row = $db->sql_fetchrow($result)) - { - $users_sql_ary[] = array( - 'user_id' => (int) $row['user_id'], - 'forum_id' => (int) $forum_data['forum_id'], - 'auth_option_id' => (int) $row['auth_option_id'], - 'auth_role_id' => (int) $row['auth_role_id'], - 'auth_setting' => (int) $row['auth_setting'] - ); - } - $db->sql_freeresult($result); - - // Copy permisisons from/to the acl groups table (only forum_id gets changed) - $sql = 'SELECT group_id, auth_option_id, auth_role_id, auth_setting - FROM ' . ACL_GROUPS_TABLE . ' - WHERE forum_id = ' . $forum_perm_from; - $result = $db->sql_query($sql); - - $groups_sql_ary = array(); - while ($row = $db->sql_fetchrow($result)) - { - $groups_sql_ary[] = array( - 'group_id' => (int) $row['group_id'], - 'forum_id' => (int) $forum_data['forum_id'], - 'auth_option_id' => (int) $row['auth_option_id'], - 'auth_role_id' => (int) $row['auth_role_id'], - 'auth_setting' => (int) $row['auth_setting'] - ); - } - $db->sql_freeresult($result); - - // Now insert the data - $db->sql_multi_insert(ACL_USERS_TABLE, $users_sql_ary); - $db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary); + copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false); cache_moderators(); } diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 8e03a7fa52..6bbe550e4f 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -57,6 +57,21 @@ class acp_permissions trigger_error('NO_MODE', E_USER_ERROR); } + // Copy forum permissions + if ($mode == 'setting_forum_copy') + { + $this->tpl_name = 'permission_forum_copy'; + + if ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) + { + $this->page_title = 'ACP_FORUM_PERMISSIONS_COPY'; + $this->copy_forum_permissions(); + return; + } + + trigger_error('NO_MODE', E_USER_ERROR); + } + // Set some vars $action = request_var('action', array('' => 0)); $action = key($action); @@ -1152,6 +1167,57 @@ class acp_permissions )); } + /** + * Handles copying permissions from one forum to others + */ + function copy_forum_permissions() + { + global $auth, $cache, $template, $user; + + $user->add_lang('acp/forums'); + + $submit = isset($_POST['submit']) ? true : false; + + if ($submit) + { + $src = request_var('src_forum_id', 0); + $dest = request_var('dest_forum_ids', array(0)); + + if (confirm_box(true)) + { + if (copy_forum_permissions($src, $dest)) + { + cache_moderators(); + + $auth->acl_clear_prefetch(); + $cache->destroy('sql', FORUMS_TABLE); + + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + } + else + { + trigger_error($user->lang['SELECTED_FORUM_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + else + { + $s_hidden_fields = array( + 'submit' => $submit, + 'src_forum_id' => $src, + 'dest_forum_ids' => $dest, + ); + + $s_hidden_fields = build_hidden_fields($s_hidden_fields); + + confirm_box(false, $user->lang['CONFIRM_OPERATION'] . ' ' . $user->lang['COPY_PERMISSIONS_CONFIRM'], $s_hidden_fields); + } + } + + $template->assign_vars(array( + 'S_FORUM_OPTIONS' => make_forum_select(false, false, false, false, false), + )); + } + /** * Get already assigned users/groups */ diff --git a/phpBB/includes/acp/info/acp_permissions.php b/phpBB/includes/acp/info/acp_permissions.php index 22de666af3..6f341742f3 100644 --- a/phpBB/includes/acp/info/acp_permissions.php +++ b/phpBB/includes/acp/info/acp_permissions.php @@ -24,6 +24,7 @@ class acp_permissions_info 'trace' => array('title' => 'ACP_PERMISSION_TRACE', 'auth' => 'acl_a_viewauth', 'display' => false, 'cat' => array('ACP_PERMISSION_MASKS')), 'setting_forum_local' => array('title' => 'ACP_FORUM_PERMISSIONS', 'auth' => 'acl_a_fauth && (acl_a_authusers || acl_a_authgroups)', 'cat' => array('ACP_FORUM_BASED_PERMISSIONS')), + 'setting_forum_copy' => array('title' => 'ACP_FORUM_PERMISSIONS_COPY', 'auth' => 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth', 'cat' => array('ACP_FORUM_BASED_PERMISSIONS')), 'setting_mod_local' => array('title' => 'ACP_FORUM_MODERATORS', 'auth' => 'acl_a_mauth && (acl_a_authusers || acl_a_authgroups)', 'cat' => array('ACP_FORUM_BASED_PERMISSIONS')), 'setting_user_global' => array('title' => 'ACP_USERS_PERMISSIONS', 'auth' => 'acl_a_authusers && (acl_a_aauth || acl_a_mauth || acl_a_uauth)', 'cat' => array('ACP_GLOBAL_PERMISSIONS', 'ACP_CAT_USERS')), 'setting_user_local' => array('title' => 'ACP_USERS_FORUM_PERMISSIONS', 'auth' => 'acl_a_authusers && (acl_a_mauth || acl_a_fauth)', 'cat' => array('ACP_FORUM_BASED_PERMISSIONS', 'ACP_CAT_USERS')), diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index afd00f88bf..e9a95f1ec6 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -306,6 +306,149 @@ function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $incl return $rows; } +/** +* Copies permissions from one forum to others +* +* @param int $src_forum_id The source forum we want to copy permissions from +* @param array $dest_forum_ids The destination forum(s) we want to copy to +* @param bool $clear_dest_perms True if destination permissions should be deleted +* @param bool $add_log True if log entry should be added +* +* @return bool False on error +* +* @author bantu +*/ +function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perms = true, $add_log = true) +{ + global $db; + + // Only one forum id specified + if (!is_array($dest_forum_ids)) + { + $dest_forum_ids = array($dest_forum_ids); + } + + // Make sure forum ids are integers + $src_forum_id = (int) $src_forum_id; + $dest_forum_ids = array_map('intval', $dest_forum_ids); + + // No source forum or no destination forums specified + if (empty($src_forum_id) || empty($dest_forum_ids)) + { + return false; + } + + // Check if source forums exists + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $src_forum_id; + $result = $db->sql_query($sql); + $src_forum_name = $db->sql_fetchfield('forum_name'); + + // Source forum doesn't exist + if (empty($src_forum_name)) + { + return false; + } + + // Check if destination forums exists + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $dest_forum_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $dest_forum_ids[] = (int) $row['forum_id']; + $dest_forum_names[] = $row['forum_name']; + } + $db->sql_freeresult($result); + + // No destination forum exists + if (empty($dest_forum_ids)) + { + return false; + } + + // From the mysql documentation: + // Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear + // in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14. + // Due to this we stay on the safe side if we do the insertion "the manual way" + + // Rowsets we're going to insert + $users_sql_ary = $groups_sql_ary = array(); + + // Query acl users table for source forum data + $sql = 'SELECT user_id, auth_option_id, auth_role_id, auth_setting + FROM ' . ACL_USERS_TABLE . ' + WHERE forum_id = ' . $src_forum_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $row = array( + 'user_id' => (int) $row['user_id'], + 'auth_option_id' => (int) $row['auth_option_id'], + 'auth_role_id' => (int) $row['auth_role_id'], + 'auth_setting' => (int) $row['auth_setting'], + ); + + foreach ($dest_forum_ids as $dest_forum_id) + { + $users_sql_ary[] = $row + array('forum_id' => $dest_forum_id); + } + } + $db->sql_freeresult($result); + + // Query acl groups table for source forum data + $sql = 'SELECT group_id, auth_option_id, auth_role_id, auth_setting + FROM ' . ACL_GROUPS_TABLE . ' + WHERE forum_id = ' . $src_forum_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $row = array( + 'group_id' => (int) $row['group_id'], + 'auth_option_id' => (int) $row['auth_option_id'], + 'auth_role_id' => (int) $row['auth_role_id'], + 'auth_setting' => (int) $row['auth_setting'], + ); + + foreach ($dest_forum_ids as $dest_forum_id) + { + $groups_sql_ary[] = $row + array('forum_id' => $dest_forum_id); + } + } + $db->sql_freeresult($result); + + $db->sql_transaction('begin'); + + // Clear current permissions of destination forums + if ($clear_dest_perms) + { + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $dest_forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $dest_forum_ids); + $db->sql_query($sql); + } + + $db->sql_multi_insert(ACL_USERS_TABLE, $users_sql_ary); + $db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary); + + if ($add_log) + { + add_log('admin', 'LOG_FORUM_COPIED_PERMISSIONS', $src_forum_name, implode(', ', $dest_forum_names)); + } + + $db->sql_transaction('commit'); + + return true; +} + /** * Get physical file listing */ diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index a00d928a12..b2460009f7 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1235,6 +1235,49 @@ function change_database_data(&$no_updates, $version) } $db->sql_freeresult($result); + // Also install the "Copy forum permissions" module + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'acp' + AND module_langname = 'ACP_FORUM_BASED_PERMISSIONS' + AND module_mode = '' + AND module_basename = ''"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $category_id = (int) $row['module_id']; + + // Check if we actually need to add the feed module or if it is already added. ;) + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_class = 'acp' + AND module_langname = 'ACP_FORUM_PERMISSIONS_COPY' + AND module_mode = 'setting_forum_copy' + AND module_auth = 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth' + AND parent_id = {$category_id}"; + $result2 = $db->sql_query($sql); + $row2 = $db->sql_fetchrow($result2); + $db->sql_freeresult($result2); + + if (!$row2) + { + $module_data = array( + 'module_basename' => 'permissions', + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => $category_id, + 'module_class' => 'acp', + 'module_langname' => 'ACP_FORUM_PERMISSIONS_COPY', + 'module_mode' => 'setting_forum_copy', + 'module_auth' => 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth', + ); + + $_module->update_module_data($module_data, true); + } + } + $db->sql_freeresult($result); + $_module->remove_cache_file(); // Add newly_registered group... but check if it already exists (we always supported running the updater on any schema) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index dd9869bbdb..7dd5e5f0f9 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -88,6 +88,7 @@ $lang = array_merge($lang, array( 'ACP_FORUM_MANAGEMENT' => 'Forum management', 'ACP_FORUM_MODERATORS' => 'Forum moderators', 'ACP_FORUM_PERMISSIONS' => 'Forum permissions', + 'ACP_FORUM_PERMISSIONS_COPY' => 'Copy forum permissions', 'ACP_FORUM_ROLES' => 'Forum roles', 'ACP_GENERAL_CONFIGURATION' => 'General configuration', @@ -545,6 +546,7 @@ $lang = array_merge($lang, array( 'LOG_ERROR_EMAIL' => 'E-mail error
    » %s', 'LOG_FORUM_ADD' => 'Created new forum
    » %s', + 'LOG_FORUM_COPIED_PERMISSIONS' => 'Copied forum permissions from %1$s
    » %2$s', 'LOG_FORUM_DEL_FORUM' => 'Deleted forum
    » %s', 'LOG_FORUM_DEL_FORUMS' => 'Deleted forum and its subforums
    » %s', 'LOG_FORUM_DEL_MOVE_FORUMS' => 'Deleted forum and moved subforums to %1$s
    » %2$s', diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php index 151b903b3e..716f39a686 100644 --- a/phpBB/language/en/acp/permissions.php +++ b/phpBB/language/en/acp/permissions.php @@ -80,6 +80,7 @@ $lang = array_merge($lang, array( 'ACP_ADMINISTRATORS_EXPLAIN' => 'Here you can assign administrator permissions to users or groups. All users with administrator permissions can view the administration control panel.', 'ACP_FORUM_MODERATORS_EXPLAIN' => 'Here you can assign users and groups as forum moderators. To assign users access to forums, to define global moderative permissions or administrators please use the appropriate page.', 'ACP_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can alter which users and groups can access which forums. To assign moderators or define administrators please use the appropriate page.', + 'ACP_FORUM_PERMISSIONS_COPY_EXPLAIN' => 'Here you can copy forum permissions from one forum to one or more other forums.', 'ACP_GLOBAL_MODERATORS_EXPLAIN' => 'Here you can assign global moderator permissions to users or groups. These moderators are like ordinary moderators except they have access to every forum on your board.', 'ACP_GROUPS_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can assign forum permissions to groups.', 'ACP_GROUPS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to groups - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. Individual users permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group’s permissions.', @@ -109,6 +110,12 @@ $lang = array_merge($lang, array( 'APPLY_PERMISSIONS_EXPLAIN' => 'The permissions and role defined for this item will only be applied to this item and all checked items.', 'AUTH_UPDATED' => 'Permissions have been updated.', + 'COPY_PERMISSIONS_CONFIRM' => 'Please be aware that this will overwrite any existing permissions on the selected targets.', + 'COPY_PERMISSIONS_FORUM_FROM_EXPLAIN' => 'The source forum you want to copy permissions from.', + 'COPY_PERMISSIONS_FORUM_TO_EXPLAIN' => 'The destination forums you want the copied permissions applied to.', + 'COPY_PERMISSIONS_FROM' => 'Copy permissions from', + 'COPY_PERMISSIONS_TO' => 'Apply permissions to', + 'CREATE_ROLE' => 'Create role', 'CREATE_ROLE_FROM' => 'Use settings from…', 'CUSTOM' => 'Custom…', From a1807c8ddd87d604eaef8fc3f249e13b957d4730 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 28 Jul 2009 22:18:39 +0000 Subject: [PATCH 355/607] Fix r9887. Remove duplicate content. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9888 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/permission_forum_copy.html | 80 ---------------------- 1 file changed, 80 deletions(-) diff --git a/phpBB/adm/style/permission_forum_copy.html b/phpBB/adm/style/permission_forum_copy.html index 5a7978438b..c919310035 100644 --- a/phpBB/adm/style/permission_forum_copy.html +++ b/phpBB/adm/style/permission_forum_copy.html @@ -38,83 +38,3 @@ - - - - -

    {L_ACP_FORUM_PERMISSIONS_COPY}

    - - {L_ACP_FORUM_PERMISSIONS_COPY_EXPLAIN} - -
    - -
    - {L_LOOK_UP_FORUM} - -
    -

    {L_COPY_PERMISSIONS_FORUM_FROM_EXPLAIN}
    -
    -
    -
    - -
    - {L_LOOK_UP_FORUM} -

    {L_LOOK_UP_FORUMS_EXPLAIN}

    - -
    -

    {L_COPY_PERMISSIONS_FORUM_TO_EXPLAIN}
    -
    -
    -
    - -
    - {L_SUBMIT} -   - - {S_HIDDEN_FIELDS} - {S_FORM_TOKEN} -
    - -
    - - - - - - -

    {L_ACP_FORUM_PERMISSIONS_COPY}

    - - {L_ACP_FORUM_PERMISSIONS_COPY_EXPLAIN} - -
    - -
    - {L_LOOK_UP_FORUM} - -
    -

    {L_COPY_PERMISSIONS_FORUM_FROM_EXPLAIN}
    -
    -
    -
    - -
    - {L_LOOK_UP_FORUM} -

    {L_LOOK_UP_FORUMS_EXPLAIN}

    - -
    -

    {L_COPY_PERMISSIONS_FORUM_TO_EXPLAIN}
    -
    -
    -
    - -
    - {L_SUBMIT} -   - - {S_HIDDEN_FIELDS} - {S_FORM_TOKEN} -
    - -
    - - From 01fe852ad8eb19e0700e6dd87ec518493adae897 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 29 Jul 2009 09:26:50 +0000 Subject: [PATCH 356/607] Slightly adjust version check on index page to be a bit more descriptive git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9889 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_main.html | 13 +++++++------ phpBB/includes/acp/acp_main.php | 25 +++++++++++++------------ phpBB/language/en/acp/common.php | 5 +++-- phpBB/language/en/install.php | 1 + 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 192d2e50f5..bdb045e326 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -14,21 +14,22 @@

    {L_ADMIN_INTRO}

    + +
    -

    {L_VERSIONCHECK_FAIL} - {L_VERSIONCHECK_FORCE_UPDATE} - {L_MORE}

    -
    +

    {L_VERSIONCHECK_FAIL}

    -

    {L_VERSION_UP_TO_DATE_ACP} - {L_VERSIONCHECK_FORCE_UPDATE} - {L_MORE}

    -
    +

    {L_VERSION_UP_TO_DATE_ACP}

    -

    {L_VERSION_NOT_UP_TO_DATE_ACP} - {L_VERSIONCHECK_FORCE_UPDATE} - {L_MORE}

    -
    +

    {L_VERSION_NOT_UP_TO_DATE_TITLE}

    +

    {L_VERSIONCHECK_FORCE_UPDATE} · {L_MORE_INFORMATION}

    +
    diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 8a5918b558..815a55b5a9 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -345,15 +345,15 @@ class acp_main add_log('admin', 'LOG_PURGE_CACHE'); break; - + case 'purge_sessions': if ((int) $user->data['user_type'] !== USER_FOUNDER) { trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } - + $tables = array(CONFIRM_TABLE, SESSIONS_TABLE); - + foreach ($tables as $table) { switch ($db->sql_layer) @@ -368,7 +368,7 @@ class acp_main break; } } - + // let's restore the admin session $reinsert_ary = array( 'session_id' => (string) $user->session_id, @@ -385,10 +385,10 @@ class acp_main 'session_admin' => 1, 'session_viewonline' => (int) $user->data['session_viewonline'], ); - + $sql = 'INSERT INTO ' . SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $reinsert_ary); $db->sql_query($sql); - + add_log('admin', 'LOG_PURGE_SESSIONS'); break; } @@ -406,12 +406,13 @@ class acp_main else { $latest_version_info = explode("\n", $latest_version_info); - $latest_version = trim($latest_version_info[0]); - $template->assign_var('S_VERSION_UP_TO_DATE', - version_compare( - str_replace('rc', 'RC', strtolower($config['version'])), - str_replace('rc', 'RC', strtolower($latest_version)), - '<') ? false : true); + + $latest_version = str_replace('rc', 'RC', strtolower(trim($latest_version_info[0]))); + $current_version = str_replace('rc', 'RC', strtolower($config['version'])); + + $template->assign_vars(array( + 'S_VERSION_UP_TO_DATE' => version_compare($current_version, $latest_version, '<') ? false : true, + )); } // Get forum statistics diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 7dd5e5f0f9..0538880667 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -250,7 +250,8 @@ $lang = array_merge($lang, array( 'MANAGE' => 'Manage', 'MENU_TOGGLE' => 'Hide or display the side menu', - 'MORE' => 'More »', + 'MORE' => 'More', // Not used at the moment + 'MORE_INFORMATION' => 'More information »', 'MOVE_DOWN' => 'Move down', 'MOVE_UP' => 'Move up', @@ -377,7 +378,7 @@ $lang = array_merge($lang, array( 'USERS_PER_DAY' => 'Users per day', 'VALUE' => 'Value', - 'VERSIONCHECK_FAIL' => 'Failed to obtain latest version', + 'VERSIONCHECK_FAIL' => 'Failed to obtain latest version information.', 'VERSIONCHECK_FORCE_UPDATE' => 'Re-Check version', 'VIEW_ADMIN_LOG' => 'View administrator log', 'VIEW_INACTIVE_USERS' => 'View inactive users', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index bc2dfd6e16..ed8e4f3c20 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -564,6 +564,7 @@ $lang = array_merge($lang, array( 'VERSION_CHECK_EXPLAIN' => 'Checks to see if the version of phpBB you are currently running is up to date.', 'VERSION_NOT_UP_TO_DATE' => 'Your version of phpBB is not up to date. Please continue the update process.', 'VERSION_NOT_UP_TO_DATE_ACP'=> 'Your version of phpBB is not up to date.
    Below you will find a link to the release announcement for the latest version as well as instructions on how to perform the update.', + 'VERSION_NOT_UP_TO_DATE_TITLE' => 'Your version of phpBB is not up to date.', 'VERSION_UP_TO_DATE' => 'Your installation is up to date, no updates are available for your version of phpBB. You may want to continue anyway to perform a file validity check.', 'VERSION_UP_TO_DATE_ACP' => 'Your installation is up to date, no updates are available for your version of phpBB. You do not need to update your installation.', 'VIEWING_FILE_CONTENTS' => 'Viewing file contents', From 7ebf9fa986df01b1fadfe43c1fbe09d2c0b779d7 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 29 Jul 2009 09:37:21 +0000 Subject: [PATCH 357/607] git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9890 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_main.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index bdb045e326..5d97c012a5 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -14,8 +14,6 @@

    {L_ADMIN_INTRO}

    - -

    {L_VERSIONCHECK_FAIL}

    From 49625a2aec3f1fbc83952d9d7ba207995120a436 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 29 Jul 2009 22:59:51 +0000 Subject: [PATCH 358/607] Props. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9891 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index 4836d7906f..76e5a3163c 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -2,7 +2,7 @@ /** * * @package VC -* @version $Id: captcha_abstract.php 9709 2009-06-30 14:23:16Z Kellanved $ +* @version $Id$ * @copyright (c) 2006, 2008 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * From e1db7e08dc560faf176995972d2bc7dbd97627fe Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 30 Jul 2009 13:39:38 +0000 Subject: [PATCH 359/607] Fix Bug #47295 - Min/max characters per posts also affects polls option Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9892 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/message_parser.php | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 831956092b..a84265329a 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -181,6 +181,7 @@
  • [Fix] Do not send private message back to sender if sender is in the same group the private message was sent to.
  • [Fix] Correctly add user to a group making it a default one. (Bug #48345 - Patch by rxu)
  • [Fix] Add log entry when copying forum permissions.
  • +
  • [Fix] Min/max characters per posts also affects polls option (Bug #47295 - Patch by nickvergessen)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 7a2d35dbc6..2d7dfb6004 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1062,10 +1062,21 @@ class parse_message extends bbcode_firstpass { global $config, $db, $user; - $mode = ($mode != 'post') ? 'sig' : 'post'; - $this->mode = $mode; + if (!isset($config['max_' . $mode . '_chars'])) + { + $config['max_' . $mode . '_chars'] = 0; + } + if (!isset($config['max_' . $mode . '_smilies'])) + { + $config['max_' . $mode . '_smilies'] = 0; + } + if (!isset($config['max_' . $mode . '_urls'])) + { + $config['max_' . $mode . '_urls'] = 0; + } + $this->allow_img_bbcode = $allow_img_bbcode; $this->allow_flash_bbcode = $allow_flash_bbcode; $this->allow_quote_bbcode = $allow_quote_bbcode; @@ -1100,7 +1111,7 @@ class parse_message extends bbcode_firstpass } // Minimum message length check for post only - if ($mode !== 'sig') + if ($mode === 'post') { if (!$message_length || $message_length < (int) $config['min_post_chars']) { @@ -1153,7 +1164,7 @@ class parse_message extends bbcode_firstpass // Check for "empty" message. We do not check here for maximum length, because bbcode, smilies, etc. can add to the length. // The maximum length check happened before any parsings. - if ($mode !== 'sig' && utf8_clean_string($this->message) === '') + if ($mode === 'post' && utf8_clean_string($this->message) === '') { $this->warn_msg[] = $user->lang['TOO_FEW_CHARS']; return (!$update_this_message) ? $return_message : $this->warn_msg; @@ -1629,7 +1640,7 @@ class parse_message extends bbcode_firstpass $this->message = $poll['poll_option_text']; $bbcode_bitfield = $this->bbcode_bitfield; - $poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false); + $poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll'); $bbcode_bitfield = base64_encode(base64_decode($bbcode_bitfield) | base64_decode($this->bbcode_bitfield)); $this->message = $tmp_message; @@ -1652,7 +1663,7 @@ class parse_message extends bbcode_firstpass { $this->warn_msg[] = $user->lang['POLL_TITLE_TOO_LONG']; } - $poll['poll_title'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false); + $poll['poll_title'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll'); if (strlen($poll['poll_title']) > 255) { $this->warn_msg[] = $user->lang['POLL_TITLE_COMP_TOO_LONG']; From 4616cdb066304031adef41ab56a132870ebaea89 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 30 Jul 2009 13:47:27 +0000 Subject: [PATCH 360/607] Fix bug #48885, introduced in r9843 Authorised by: kellanved git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9893 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/includes/functions_posting.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a84265329a..2371b5e2df 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -174,7 +174,7 @@
  • [Fix] Banning an already banned user states to be successful, but has no effect (Bug #47825 - Patch by Pyramide)
  • [Fix] Do not add style-parameter to URL again, after admin re-authentification (Bug #18005 - Patch by leviatan21)
  • [Fix] Do not cut post-message in between HTML-Entities on search.php (Bug #31505 - Patch by leviatan21)
  • -
  • [Fix] Correctly set attachment flag for topics, posts and pms after deleting attachments (Bug #48265 - Patch by WorldWar and nickvergessen)
  • +
  • [Fix] Correctly set attachment flag for topics, posts and pms after deleting attachments (Bug #48265 - Patch by MarcoDM and nickvergessen)
  • [Fix] Display "Locked" button instead of "Reply" one for locked forum in viewtopic (prosilver). (Bug #38055 - Patch by Raimon)
  • [Fix] Correctly propagate umlauts over search result pages (Bug #33755)
  • [Fix] Preserve post options when refusing to save the post as a draft. (Bug #39115)
  • diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index e348694cfe..543472ad4e 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1553,8 +1553,8 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) { $sql = 'SELECT 1 AS has_attachments FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $result = $db->sql_query($sql); + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query_limit($sql, 1); $has_attachments = (int) $db->sql_fetchfield('has_attachments'); $db->sql_freeresult($result); From 686f84a8fc63b867b722573716722b47213cc1de Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 30 Jul 2009 14:35:29 +0000 Subject: [PATCH 361/607] Fix Bug #48875 - we compare the bitlength, therefore we indeed do not need to re-cache if we think acl options got changed (which we did) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9894 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/auth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php index 2a269c3c80..02819f9e78 100644 --- a/phpBB/includes/auth.php +++ b/phpBB/includes/auth.php @@ -64,9 +64,9 @@ class auth $db->sql_freeresult($result); $cache->put('_acl_options', $this->acl_options); - $this->acl_cache($userdata); } - else if (!trim($userdata['user_permissions'])) + + if (!trim($userdata['user_permissions'])) { $this->acl_cache($userdata); } From e6f133dc55095b337ad311c761e82d4f026c0ea1 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 31 Jul 2009 08:16:36 +0000 Subject: [PATCH 362/607] Revert r9878 - QR was already disabled by default, for admin convenience we enable the global setting but no local setting, which results in OFF by default git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9895 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index b2460009f7..709836ea88 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1452,7 +1452,7 @@ function change_database_data(&$no_updates, $version) if (!isset($config['allow_quick_reply'])) { - set_config('allow_quick_reply', '0'); + set_config('allow_quick_reply', '1'); } // Set every members user_options column to enable diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 23ba9db2b5..3545fa9bc2 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -27,7 +27,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_report', INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_flash', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_links', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_privmsg', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_quick_reply', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_quick_reply', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_bbcode', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_flash', '0'); From 312f2c87edbc81af7e332c14d7ce590df183cf60 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 31 Jul 2009 12:46:15 +0000 Subject: [PATCH 363/607] Add box if users decided not to select a forum to copy permissions from on forum creation git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9896 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_forums_copy_perm.html | 21 +++++++ phpBB/includes/acp/acp_forums.php | 67 +++++++++++++++++++++++ phpBB/language/en/acp/forums.php | 3 + 3 files changed, 91 insertions(+) create mode 100644 phpBB/adm/style/acp_forums_copy_perm.html diff --git a/phpBB/adm/style/acp_forums_copy_perm.html b/phpBB/adm/style/acp_forums_copy_perm.html new file mode 100644 index 0000000000..73d9e70918 --- /dev/null +++ b/phpBB/adm/style/acp_forums_copy_perm.html @@ -0,0 +1,21 @@ + + +
    + +
    +

    {L_COPY_PERMISSIONS}

    +

    {L_COPY_PERMISSIONS_EXPLAIN}

    +

    {L_ACL_LINK}

    +
    +

    {L_COPY_PERMISSIONS_EXPLAIN}
    +
    +
    +
    {S_FORM_TOKEN}{S_HIDDEN_FIELDS} +   +
    + +
    + +
    + + diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index b6a13acd01..7977654c0a 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -74,6 +74,13 @@ class acp_forums { trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } + + case 'copy_perm': + + if (!(($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')))) + { + trigger_error($user->lang['NO_PERMISSION_COPY'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } break; } @@ -190,6 +197,12 @@ class acp_forums copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false); cache_moderators(); } + else if (($action != 'edit') && $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) + { + $this->copy_permission_page($forum_data); + return; + } + $auth->acl_clear_prefetch(); $cache->destroy('sql', FORUMS_TABLE); @@ -687,6 +700,36 @@ class acp_forums return; break; + + case 'copy_perm': + $forum_perm_from = request_var('forum_perm_from', 0); + + // Copy permissions? + if (!empty($forum_perm_from) && $forum_perm_from != $forum_id) + { + copy_forum_permissions($forum_perm_from, $forum_id, true); + cache_moderators(); + $auth->acl_clear_prefetch(); + $cache->destroy('sql', FORUMS_TABLE); + + $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_id; + + $message = $user->lang['FORUM_UPDATED']; + + // Redirect to permissions + if ($auth->acl_get('a_fauth')) + { + $message .= '

    ' . sprintf($user->lang['REDIRECT_ACL'], '', ''); + } + + // redirect directly to permission settings screen if authed + if ($action == 'add' && !$forum_perm_from && $auth->acl_get('a_fauth')) + { + meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url)); + } + + trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + } } // Default management page @@ -1876,6 +1919,30 @@ class acp_forums adm_page_footer(); } + + function copy_permission_page($forum_data) + { + global $phpEx, $phpbb_admin_path, $template, $user; + + $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; + $action = append_sid($this->u_action . "&parent_id={$this->parent_id}&f={$forum_data['forum_id']}&action=copy_perm"); + + + $l_acl = sprintf($user->lang['COPY_TO_ACL'], '', ''); + + + + $this->tpl_name = 'acp_forums_copy_perm'; + + $template->assign_vars(array( + 'U_ACL' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url), + 'L_ACL_LINK' => $l_acl, + 'L_BACK_LINK' => adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), + 'S_COPY_ACTION' => $action, + 'S_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], false, false, false, false), + )); + } + } ?> \ No newline at end of file diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php index 7f3b1b997d..371a184fb7 100644 --- a/phpBB/language/en/acp/forums.php +++ b/phpBB/language/en/acp/forums.php @@ -44,9 +44,12 @@ $lang = array_merge($lang, array( 'AUTO_PRUNE_VIEWED' => 'Auto-prune post viewed age', 'AUTO_PRUNE_VIEWED_EXPLAIN' => 'Number of days since topic was viewed after which topic is removed.', + 'CONTINUE' => 'Continue', 'COPY_PERMISSIONS' => 'Copy permissions from', + 'COPY_PERMISSIONS_EXPLAIN' => 'To ease up the permission setup for your new forum, you can copy the permissions of an existing forum.', 'COPY_PERMISSIONS_ADD_EXPLAIN' => 'Once created, the forum will have the same permissions as the one you select here. If no forum is selected the newly created forum will not be visible until permissions had been set.', 'COPY_PERMISSIONS_EDIT_EXPLAIN' => 'If you select to copy permissions, the forum will have the same permissions as the one you select here. This will overwrite any permissions you have previously set for this forum with the permissions of the forum you select here. If no forum is selected the current permissions will be kept.', + 'COPY_TO_ACL' => 'Alternatively, you are also able to %sset up new permissions%s for this forum.', 'CREATE_FORUM' => 'Create new forum', 'DECIDE_MOVE_DELETE_CONTENT' => 'Delete content or move to forum', From edc82a6ce76e3e9948573f401a088c269cb9204b Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 31 Jul 2009 13:11:44 +0000 Subject: [PATCH 364/607] Well git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9897 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 2371b5e2df..5e90b63f24 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -204,6 +204,7 @@
  • [Change] Add pagination for icons and smilies in the ACP and smilies in the smiley popup
  • [Change] Cache get_username_string() function calls on viewtopic.
  • [Change] Cache version check.
  • +
  • [Change] When creating a new forum without copying permissions, ask again.
  • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
  • [Feature] Backported 3.2 captcha plugins.
      From a718e22a3112e85039e562172de9e7fc487f9017 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 31 Jul 2009 14:05:24 +0000 Subject: [PATCH 365/607] check changed to allow for undefined lang entries. Proposed by a_jelly_donut git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9898 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/ucp/ucp_register.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index f428b4603c..babedd4f12 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -223,7 +223,7 @@ class ucp_register if ($config['enable_confirm']) { $vc_response = $captcha->validate($data); - if ($vc_response) + if ($vc_response !== false) { $error[] = $vc_response; } From 154f143a8cc866b2d84c9b42257e4f59aa50a945 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 31 Jul 2009 15:49:14 +0000 Subject: [PATCH 366/607] Fix bug #48695 - Do not try to create thumbnails for images we cannot open properly. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9899 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_posting.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 5e90b63f24..84d6858db1 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -182,6 +182,7 @@
    • [Fix] Correctly add user to a group making it a default one. (Bug #48345 - Patch by rxu)
    • [Fix] Add log entry when copying forum permissions.
    • [Fix] Min/max characters per posts also affects polls option (Bug #47295 - Patch by nickvergessen)
    • +
    • [Fix] Do not try to create thumbnails for images we cannot open properly. (Bug #48695)
    • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    • [Change] Template engine now permits to a limited extent variable includes.
    • diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 543472ad4e..bf3eef02c4 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -696,6 +696,11 @@ function create_thumbnail($source, $destination, $mimetype) break; } + if (empty($image)) + { + return false; + } + if ($type['version'] == 1) { $new_image = imagecreate($new_width, $new_height); From 17c50b91a5d2c869faf9ea1da557b3c6e38b06f9 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 10:40:00 +0000 Subject: [PATCH 367/607] adjust authors file... add contributions and new dev git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9900 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/AUTHORS | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/phpBB/docs/AUTHORS b/phpBB/docs/AUTHORS index b471a3846c..38457efbbc 100644 --- a/phpBB/docs/AUTHORS +++ b/phpBB/docs/AUTHORS @@ -20,33 +20,39 @@ Please see: http://www.phpbb.com/about/team/ for a list of all the people currently involved in phpBB. -phpBB Lead Developer : Acyd Burn (Meik Sievertsen) +phpBB Lead Developer : Acyd Burn (Meik Sievertsen) -phpBB Developers : APTX (Marek A. R.) - DavidMJ (David M.) - dhn (Dominik Drscher) - kellanved (Henry Sudhof) - naderman (Nils Adermann) - Terrafrost (Jim Wigginton) - ToonArmy (Chris Smith) +phpBB Developers : APTX (Marek A. R.) + Bantu (Andreas Fischer) + DavidMJ (David M.) + dhn (Dominik Drscher) + kellanved (Henry Sudhof) + naderman (Nils Adermann) + Terrafrost (Jim Wigginton) + ToonArmy (Chris Smith) + +Contributions by : leviatan21 (Gabriel Vazquez) + nickvergessen (Joas Schilling) + Raimon (Raimon Meuldijk) + rxu (Ruslan Uzdenov) + Xore (Robert Hetzler) -- Previous Contributors -- -phpBB Project Manager : theFinn (James Atkinson) [Founder - 04/2007] - SHS` (Jonathan Stanley) +phpBB Project Manager : theFinn (James Atkinson) [Founder - 04/2007] + SHS` (Jonathan Stanley) -phpBB Lead Developer : psoTFX (Paul S. Owen) [2001 - 09/2005] - -phpBB Developers : Ashe (Ludovic Arnaud) [10/2002 - 11/2003, 06/2006 - 10/2006] - BartVB (Bart van Bragt) [11/2000 - 03/2006] - GrahamJE (Graham Eames) [09/2005 - 11/2006] - Vic D'Elfant (Vic D'Elfant) [04/2007 - 04/2009] +phpBB Lead Developer : psoTFX (Paul S. Owen) [2001 - 09/2005] +phpBB Developers : Ashe (Ludovic Arnaud) [10/2002 - 11/2003, 06/2006 - 10/2006] + BartVB (Bart van Bragt) [11/2000 - 03/2006] + GrahamJE (Graham Eames) [09/2005 - 11/2006] + Vic D'Elfant (Vic D'Elfant) [04/2007 - 04/2009] -- Copyrights -- -Visual Confirmation : Xore (Robert Hetzler) +Visual Confirmation : Xore (Robert Hetzler) Original subSilver by subBlue Design, Tom Beddard, (c) 2001 phpBB Group prosilver by subBlue Design, Tom Beddard, (c) 2004 phpBB Group From 3461eaf828848bd27d4777cfd796319dd55c53ce Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 11:01:18 +0000 Subject: [PATCH 368/607] Fallback options for missing language files. (Bug #38575 - Patch by EXreaction) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9901 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/session.php | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 84d6858db1..a91ecc3bcb 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -254,6 +254,7 @@
    • [Feature] Display version check on ACP main page.
    • [Feature] Ability to copy permissions from one forum to several other forums.
    • +
    • [Feature] Fallback options for missing language files. (Bug #38575 - Patch by EXreaction)

    1.ii. Changes since 3.0.4

    diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index c8617057c4..a49716a8db 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -2006,6 +2006,34 @@ class user extends session $language_filename = $this->lang_path . $this->lang_name . '/' . (($use_help) ? 'help_' : '') . $lang_file . '.' . $phpEx; } + if (!file_exists($language_filename)) + { + global $config; + + if ($this->lang_name == 'en') + { + // The user's selected language is missing the file, the board default's language is missing the file, and the file doesn't exist in /en. + $language_filename = str_replace($this->lang_path . 'en', $this->lang_path . $this->data['user_lang'], $language_filename); + trigger_error('Language file ' . $language_filename . ' couldn\'t be opened.', E_USER_ERROR); + } + else if ($this->lang_name == basename($config['default_lang'])) + { + // Fall back to the English Language + $this->lang_name = 'en'; + $this->set_lang($lang, $help, $lang_file, $use_db, $use_help); + } + else if ($this->lang_name == $this->data['user_lang']) + { + // Fall back to the board default language + $this->lang_name = basename($config['default_lang']); + $this->set_lang($lang, $help, $lang_file, $use_db, $use_help); + } + + // Reset the lang name + $this->lang_name = (file_exists($this->lang_path . $this->data['user_lang'] . "/common.$phpEx")) ? $this->data['user_lang'] : basename($config['default_lang']); + return; + } + // Do not suppress error if in DEBUG_EXTRA mode $include_result = (defined('DEBUG_EXTRA')) ? (include $language_filename) : (@include $language_filename); @@ -2262,11 +2290,11 @@ class user extends session if ($group = remove_newly_registered($this->data['user_id'], $this->data)) { $this->data['group_id'] = $group; - + } $this->data['user_permissions'] = ''; $this->data['user_new'] = 0; - + return true; } } From ac857b2e0ae6a3d95218f03736f1835ca8d09b74 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 11:07:48 +0000 Subject: [PATCH 369/607] some encoding fixes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9902 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/board.php | 2 +- phpBB/language/en/acp/common.php | 2 +- phpBB/language/en/acp/posting.php | 4 ++-- phpBB/language/en/captcha_qa.php | 2 +- phpBB/language/en/memberlist.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 8f86981f50..6385abb970 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -486,7 +486,7 @@ $lang = array_merge($lang, array( 'EMAIL_SIG' => 'E-mail signature', 'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all e-mails the board sends.', 'ENABLE_EMAIL' => 'Enable board-wide e-mails', - 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no e-mails will be sent by the board at all. Note the user and admin account activation settings require this setting to be enabled. If currently using "user" or "admin" activation in the activation settings, disabling this setting will require no activation of new accounts.', + 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no e-mails will be sent by the board at all. Note the user and admin account activation settings require this setting to be enabled. If currently using “user” or “admin” activation in the activation settings, disabling this setting will require no activation of new accounts.', 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', 'SMTP_CRAM_MD5' => 'CRAM-MD5', diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 0538880667..7225d3114f 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -251,7 +251,7 @@ $lang = array_merge($lang, array( 'MANAGE' => 'Manage', 'MENU_TOGGLE' => 'Hide or display the side menu', 'MORE' => 'More', // Not used at the moment - 'MORE_INFORMATION' => 'More information »', + 'MORE_INFORMATION' => 'More information »', 'MOVE_DOWN' => 'Move down', 'MOVE_UP' => 'Move up', diff --git a/phpBB/language/en/acp/posting.php b/phpBB/language/en/acp/posting.php index 1a2be20018..531e07f7ef 100644 --- a/phpBB/language/en/acp/posting.php +++ b/phpBB/language/en/acp/posting.php @@ -68,7 +68,7 @@ $lang = array_merge($lang, array( 'TOKEN' => 'Token', 'TOKENS' => 'Tokens', - 'TOKENS_EXPLAIN' => 'Tokens are placeholders for user input. The input will be validated only if it matches the corresponding definition. If needed, you can number them by adding a number as the last character between the braces, e.g. {TEXT1}, {TEXT2}.

    Within the HTML replacement you can also use any language string present in your language/ directory like this: {L_<STRINGNAME>} where <STRINGNAME> is the name of the translated string you want to add. For example, {L_WROTE} will be displayed as "wrote" or its translation according to user’s locale.

    Please note that only tokens listed below are able to be used within custom BBCodes.', + 'TOKENS_EXPLAIN' => 'Tokens are placeholders for user input. The input will be validated only if it matches the corresponding definition. If needed, you can number them by adding a number as the last character between the braces, e.g. {TEXT1}, {TEXT2}.

    Within the HTML replacement you can also use any language string present in your language/ directory like this: {L_<STRINGNAME>} where <STRINGNAME> is the name of the translated string you want to add. For example, {L_WROTE} will be displayed as “wrote” or its translation according to user’s locale.

    Please note that only tokens listed below are able to be used within custom BBCodes.', 'TOKEN_DEFINITION' => 'What can it be?', 'TOO_MANY_BBCODES' => 'You cannot create any more BBCodes. Please remove one or more BBCodes then try again.', @@ -78,7 +78,7 @@ $lang = array_merge($lang, array( 'IDENTIFIER' => 'Characters from the latin alphabet (A-Z), numbers, hyphen and underscore', 'NUMBER' => 'Any series of digits', 'EMAIL' => 'A valid e-mail address', - 'URL' => 'A valid URL using any protocol (http, ftp, etc… cannot be used for javascript exploits). If none is given, "http://" is prefixed to the string.', + 'URL' => 'A valid URL using any protocol (http, ftp, etc… cannot be used for javascript exploits). If none is given, “http://” is prefixed to the string.', 'LOCAL_URL' => 'A local URL. The URL must be relative to the topic page and cannot contain a server name or protocol.', 'COLOR' => 'A HTML colour, can be either in the numeric form #FF1234 or a CSS colour keyword such as fuchsia or InactiveBorder' ) diff --git a/phpBB/language/en/captcha_qa.php b/phpBB/language/en/captcha_qa.php index 6942d6dc0b..b07438f2bb 100644 --- a/phpBB/language/en/captcha_qa.php +++ b/phpBB/language/en/captcha_qa.php @@ -47,7 +47,7 @@ $lang = array_merge($lang, array( 'ANSWER' => 'Answer', 'EDIT_QUESTION' => 'Edit Question', 'QUESTIONS' => 'Questions', - 'QUESTIONS_EXPLAIN' => 'Here you can add and edit questions to be asked on registration. You have to provide at least one question in the default board language to use this plugin. Questions should be easy for your target audience, but beyond the ability of google. Also, remember to change the questions regularly. If your question relies on punctuation, spelling or capitalisation, use the strict setting.', + 'QUESTIONS_EXPLAIN' => 'Here you can add and edit questions to be asked on registration. You have to provide at least one question in the default board language to use this plugin. Questions should be easy for your target audience, but beyond the ability of Google™. Also, remember to change the questions regularly. If your question relies on punctuation, spelling or capitalisation, use the strict setting.', 'QUESTION_DELETED' => 'Question deleted', 'QUESTION_LANG' => 'Language', 'QUESTION_LANG_EXPLAIN' => 'The language this question and its answers is written in.', diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index 20f64044be..d6892eb31b 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -136,7 +136,7 @@ $lang = array_merge($lang, array( 'USER_FORUM' => 'User statistics', 'USER_LAST_REMINDED' => array( 0 => 'No reminder sent yet', - 1 => '%1$d reminder sent
    » %2$s', + 1 => '%1$d reminder sent
    » %2$s', ), 'USER_ONLINE' => 'Online', 'USER_PRESENCE' => 'Board presence', From 530f4963cbc12e0f47f20c13c70587a60d3ad37c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 1 Aug 2009 11:43:39 +0000 Subject: [PATCH 370/607] Fix Bug #37585 - Correctly log action when users request to join a group Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9903 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_user.php | 2 +- phpBB/language/en/acp/common.php | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a91ecc3bcb..25f4f04158 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -182,6 +182,7 @@
  • [Fix] Correctly add user to a group making it a default one. (Bug #48345 - Patch by rxu)
  • [Fix] Add log entry when copying forum permissions.
  • [Fix] Min/max characters per posts also affects polls option (Bug #47295 - Patch by nickvergessen)
  • +
  • [Fix] Correctly log action when users request to join a group (Bug #37585 - Patch by nickvergessen)
  • [Fix] Do not try to create thumbnails for images we cannot open properly. (Bug #48695)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 324be2b1ed..ca6aae2540 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2793,7 +2793,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $group_name = get_group_name($group_id); } - $log = ($leader) ? 'LOG_MODS_ADDED' : 'LOG_USERS_ADDED'; + $log = ($leader) ? 'LOG_MODS_ADDED' : (($pending) ? 'LOG_USERS_PENDING' : 'LOG_USERS_ADDED'); add_log('admin', $log, $group_name, implode(', ', $username_ary)); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 7225d3114f..9a9b89652a 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -570,8 +570,9 @@ $lang = array_merge($lang, array( 'LOG_GROUP_REMOVE' => 'Members removed from usergroup %1$s
    » %2$s', 'LOG_GROUP_UPDATED' => 'Usergroup details updated
    » %s', 'LOG_MODS_ADDED' => 'Added new leaders to usergroup %1$s
    » %2$s', - 'LOG_USERS_APPROVED' => 'Users approved in usergroup %1$s
    » %2$s', 'LOG_USERS_ADDED' => 'Added new members to usergroup %1$s
    » %2$s', + 'LOG_USERS_APPROVED' => 'Users approved in usergroup %1$s
    » %2$s', + 'LOG_USERS_PENDING' => 'Users requested to join group “%1$s” and need to be approved
    » %2$s', 'LOG_IMAGESET_ADD_DB' => 'Added new imageset to database
    » %s', 'LOG_IMAGESET_ADD_FS' => 'Add new imageset on filesystem
    » %s', From 6bc7e1516206862472091e53d8f3f357a755eac8 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Sat, 1 Aug 2009 12:13:16 +0000 Subject: [PATCH 371/607] Addition to r9899 for bug #48695 - trying to create thumbnail for broken jpeg image Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9904 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_posting.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index bf3eef02c4..ee0d3b7f5d 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -684,6 +684,7 @@ function create_thumbnail($source, $destination, $mimetype) break; case IMG_JPG: + @ini_set('gd.jpeg_ignore_warning', 1); $image = @imagecreatefromjpeg($source); break; From 2958890439f29b9cf45997c52c8cfa57e0f16bc8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 12:28:50 +0000 Subject: [PATCH 372/607] Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9905 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/download/file.php | 2 +- phpBB/includes/acp/acp_attachments.php | 4 +-- phpBB/includes/functions_admin.php | 4 +-- phpBB/includes/functions_content.php | 6 ++-- phpBB/includes/functions_convert.php | 10 +++---- phpBB/includes/functions_posting.php | 10 +++---- phpBB/includes/functions_privmsgs.php | 2 +- phpBB/includes/functions_upload.php | 8 +++--- phpBB/includes/mcp/mcp_main.php | 4 +-- phpBB/includes/utf/utf_tools.php | 38 ++++++++++++++++++++++---- phpBB/viewtopic.php | 1 - 12 files changed, 59 insertions(+), 31 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 25f4f04158..5c627ae16c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -184,6 +184,7 @@
  • [Fix] Min/max characters per posts also affects polls option (Bug #47295 - Patch by nickvergessen)
  • [Fix] Correctly log action when users request to join a group (Bug #37585 - Patch by nickvergessen)
  • [Fix] Do not try to create thumbnails for images we cannot open properly. (Bug #48695)
  • +
  • [Fix] Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 32b5f87950..c6106fc09f 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -249,7 +249,7 @@ if (!$attachment) trigger_error('ERROR_NO_ATTACHMENT'); } -$attachment['physical_filename'] = basename($attachment['physical_filename']); +$attachment['physical_filename'] = utf8_basename($attachment['physical_filename']); $display_cat = $extensions[$attachment['extension']]['display_cat']; if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !$user->optionget('viewimg')) diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 0fc0fe0848..849c076f0e 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -1027,8 +1027,8 @@ class acp_attachments $template->assign_block_vars('orphan', array( 'FILESIZE' => get_formatted_filesize($row['filesize']), 'FILETIME' => $user->format_date($row['filetime']), - 'REAL_FILENAME' => basename($row['real_filename']), - 'PHYSICAL_FILENAME' => basename($row['physical_filename']), + 'REAL_FILENAME' => utf8_basename($row['real_filename']), + 'PHYSICAL_FILENAME' => utf8_basename($row['physical_filename']), 'ATTACH_ID' => $row['attach_id'], 'POST_IDS' => (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '', 'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'mode=view&id=' . $row['attach_id'])) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index e9a95f1ec6..38388236eb 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1235,7 +1235,7 @@ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) // Because of copying topics or modifications a physical filename could be assigned more than once. If so, do not remove the file itself. $sql = 'SELECT COUNT(attach_id) AS num_entries FROM ' . ATTACHMENTS_TABLE . " - WHERE physical_filename = '" . $db->sql_escape(basename($filename)) . "'"; + WHERE physical_filename = '" . $db->sql_escape(utf8_basename($filename)) . "'"; $result = $db->sql_query($sql); $num_entries = (int) $db->sql_fetchfield('num_entries'); $db->sql_freeresult($result); @@ -1246,7 +1246,7 @@ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) return false; } - $filename = ($mode == 'thumbnail') ? 'thumb_' . basename($filename) : basename($filename); + $filename = ($mode == 'thumbnail') ? 'thumb_' . utf8_basename($filename) : utf8_basename($filename); return @unlink($phpbb_root_path . $config['upload_path'] . '/' . $filename); } diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index de5df37299..c4ac48e8e8 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -841,8 +841,8 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, // Some basics... $attachment['extension'] = strtolower(trim($attachment['extension'])); - $filename = $phpbb_root_path . $config['upload_path'] . '/' . basename($attachment['physical_filename']); - $thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/thumb_' . basename($attachment['physical_filename']); + $filename = $phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($attachment['physical_filename']); + $thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/thumb_' . utf8_basename($attachment['physical_filename']); $upload_icon = ''; @@ -866,7 +866,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, 'UPLOAD_ICON' => $upload_icon, 'FILESIZE' => $filesize['value'], 'SIZE_LANG' => $filesize['unit'], - 'DOWNLOAD_NAME' => basename($attachment['real_filename']), + 'DOWNLOAD_NAME' => utf8_basename($attachment['real_filename']), 'COMMENT' => $comment, ); diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index f6710ded30..82ec114c09 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -551,7 +551,7 @@ function _import_check($config_var, $source, $use_target) ); // copy file will prepend $phpBB_root_path - $target = $config[$config_var] . '/' . basename(($use_target === false) ? $source : $use_target); + $target = $config[$config_var] . '/' . utf8_basename(($use_target === false) ? $source : $use_target); if (!empty($convert->convertor[$config_var]) && strpos($source, $convert->convertor[$config_var]) !== 0) { @@ -567,11 +567,11 @@ function _import_check($config_var, $source, $use_target) if ($result['copied']) { - $result['target'] = basename($target); + $result['target'] = utf8_basename($target); } else { - $result['target'] = ($use_target !== false) ? $result['orig_source'] : basename($target); + $result['target'] = ($use_target !== false) ? $result['orig_source'] : utf8_basename($target); } return $result; @@ -600,7 +600,7 @@ function import_attachment($source, $use_target = false) { $thumb_dir = $convert->convertor['thumbnails'][0]; $thumb_prefix = $convert->convertor['thumbnails'][1]; - $thumb_source = $thumb_dir . $thumb_prefix . basename($result['source']); + $thumb_source = $thumb_dir . $thumb_prefix . utf8_basename($result['source']); if (strpos($thumb_source, $convert->convertor['upload_path']) !== 0) { @@ -2257,7 +2257,7 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour if (substr($trg, -1) == '/') { - $trg .= basename($src); + $trg .= utf8_basename($src); } $src_path = relative_base($src, $source_relative_path, __LINE__, __FILE__); $trg_path = $trg; diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index ee0d3b7f5d..40df716ac9 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -785,7 +785,7 @@ function posting_gen_inline_attachments(&$attachment_data) foreach ($attachment_data as $i => $attachment) { - $s_inline_attachment_options .= ''; + $s_inline_attachment_options .= ''; } $template->assign_var('S_INLINE_ATTACHMENT_OPTIONS', $s_inline_attachment_options); @@ -819,7 +819,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a foreach ($attachment_data as $count => $attach_row) { $hidden = ''; - $attach_row['real_filename'] = basename($attach_row['real_filename']); + $attach_row['real_filename'] = utf8_basename($attach_row['real_filename']); foreach ($attach_row as $key => $value) { @@ -829,8 +829,8 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? $user->session_id : false); $template->assign_block_vars('attach_row', array( - 'FILENAME' => basename($attach_row['real_filename']), - 'A_FILENAME' => addslashes(basename($attach_row['real_filename'])), + 'FILENAME' => utf8_basename($attach_row['real_filename']), + 'A_FILENAME' => addslashes(utf8_basename($attach_row['real_filename'])), 'FILE_COMMENT' => $attach_row['attach_comment'], 'ATTACH_ID' => $attach_row['attach_id'], 'S_IS_ORPHAN' => $attach_row['is_orphan'], @@ -2175,7 +2175,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u else { // insert attachment into db - if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) { continue; } diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index b201329b20..955b310335 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1552,7 +1552,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) else { // insert attachment into db - if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) { continue; } diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index c65d732984..40ff4de2d1 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -58,7 +58,7 @@ class filespec $this->filename = $upload_ary['tmp_name']; $this->filesize = $upload_ary['size']; - $name = trim(htmlspecialchars(basename($upload_ary['name']))); + $name = trim(utf8_htmlspecialchars(utf8_basename($upload_ary['name']))); $this->realname = $this->uploadname = (STRIP) ? stripslashes($name) : $name; $this->mimetype = $upload_ary['type']; @@ -290,7 +290,7 @@ class filespec $upload_mode = (@ini_get('open_basedir') || @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on') ? 'move' : 'copy'; $upload_mode = ($this->local) ? 'local' : $upload_mode; - $this->destination_file = $this->destination_path . '/' . basename($this->realname); + $this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname); // Check if the file already exist, else there is something wrong... if (file_exists($this->destination_file) && !$overwrite) @@ -634,7 +634,7 @@ class fileupload if ($filedata === false) { - $_FILES[$form_name]['name'] = basename($source_file); + $_FILES[$form_name]['name'] = utf8_basename($source_file); $_FILES[$form_name]['size'] = 0; $mimetype = ''; @@ -746,7 +746,7 @@ class fileupload $ext = array_pop($url['path']); $url['path'] = implode('', $url['path']); - $upload_ary['name'] = basename($url['path']) . (($ext) ? '.' . $ext : ''); + $upload_ary['name'] = utf8_basename($url['path']) . (($ext) ? '.' . $ext : ''); $filename = $url['path']; $filesize = 0; diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 3c265d56da..6c2ac0b521 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1168,8 +1168,8 @@ function mcp_fork_topic($topic_ids) 'in_message' => 0, 'is_orphan' => (int) $attach_row['is_orphan'], 'poster_id' => (int) $attach_row['poster_id'], - 'physical_filename' => (string) basename($attach_row['physical_filename']), - 'real_filename' => (string) basename($attach_row['real_filename']), + 'physical_filename' => (string) utf8_basename($attach_row['physical_filename']), + 'real_filename' => (string) utf8_basename($attach_row['real_filename']), 'download_count' => (int) $attach_row['download_count'], 'attach_comment' => (string) $attach_row['attach_comment'], 'extension' => (string) $attach_row['extension'], diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index 8098176837..9ee87a5425 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -70,7 +70,7 @@ if (!extension_loaded('xml')) $pos = 0; $len = strlen($str); $ret = ''; - + while ($pos < $len) { $ord = ord($str[$pos]) & 0xF0; @@ -252,7 +252,7 @@ else if (is_null($offset)) { $ar = explode($needle, $str); - + if (sizeof($ar) > 1) { // Pop off the end of the string where the last match was made @@ -527,7 +527,7 @@ else $op = '^(?:' . $op . '.{' . $oy . '})'; } else - { + { // offset == 0; just anchor the pattern $op = '^'; } @@ -560,7 +560,7 @@ else $lx = (int) ($length / 65535); $ly = $length % 65535; - + // negative length requires a captured group // of length characters if ($lx) @@ -632,7 +632,7 @@ function utf8_str_split($str, $split_len = 1) { return array($str); } - + preg_match_all('/.{' . $split_len . '}|[^\x00]{1,' . $split_len . '}$/us', $str, $ar); return $ar[0]; } @@ -1917,4 +1917,32 @@ function utf8_wordwrap($string, $width = 75, $break = "\n", $cut = false) return implode($break, $new_lines); } +/** +* UTF8-safe basename() function +* +* basename() has some limitations and is dependent on the locale setting +* according to the PHP manual. Therefore we provide our own locale independant +* basename function. +* +* @param string $filename The filename basename() should be applied to +* @return string The basenamed filename +*/ +function utf8_basename($filename) +{ + // We always check for forward slash AND backward slash + // because they could be mixed or "sneaked" in. ;) + // You know, never trust user input... + if (strpos($filename, '/') !== false) + { + $filename = utf8_substr($filename, utf8_strrpos($filename, '/') + 1); + } + + if (strpos($filename, '\\') !== false) + { + $filename = utf8_substr($filename, utf8_strrpos($filename, '\\') + 1); + } + + return $filename; +} + ?> \ No newline at end of file diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index aa2a6be10a..52bae414df 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1613,7 +1613,6 @@ else if (!$all_marked_read) } // let's set up quick_reply -// TODO: introduce a per-forum and a per-user setting $s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id); if ($s_can_vote || $s_quick_reply) From 79406749622b816f569212ba89af1e27d1a7a772 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 12:36:05 +0000 Subject: [PATCH 373/607] change preferred to recommended in install.html file git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9906 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/INSTALL.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 4eee4520dc..577bc99c6e 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -283,7 +283,7 @@

    The patch file package is for those wanting to update through the patch application, and being comfortable with it.

    -

    The patch file is one solution for those with many Modifications (MODs) or other changes who do not want to re-add them back to all the changed files if they use the method explained above. To use this you will need command line access to a standard UNIX type patch application. If you do not have access to such an application but still want to use this update approach, we strongly recommend the Automatic update package explained below. It is also the preferred update method.

    +

    The patch file is one solution for those with many Modifications (MODs) or other changes who do not want to re-add them back to all the changed files if they use the method explained above. To use this you will need command line access to a standard UNIX type patch application. If you do not have access to such an application but still want to use this update approach, we strongly recommend the Automatic update package explained below. It is also the recommended update method.

    A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.4 you need the phpBB-3.0.4_to_3.0.5.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

    @@ -293,7 +293,7 @@

    4.iv. Automatic update package

    -

    This update method is the preferred method for updating. This package allows detecting changed files automatically and merges changes if needed.

    +

    This update method is the recommended method for updating. This package allows detecting changed files automatically and merges changes if needed.

    The automatic update package contains - contrary to the others - only the information required to update the previous release version to the latest available version. These packages are meant for use with the automatic update tool.

    From 73a6f7263b02ed694d986967a162f2359f89f709 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 13:52:37 +0000 Subject: [PATCH 374/607] Adjust build_url() to not prepend $phpbb_root_path if path returned from redirect() is an URL. This fixes redirect issues with some installations and bridges. (Bug #47535) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9907 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 5c627ae16c..eee01525aa 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -185,6 +185,7 @@
  • [Fix] Correctly log action when users request to join a group (Bug #37585 - Patch by nickvergessen)
  • [Fix] Do not try to create thumbnails for images we cannot open properly. (Bug #48695)
  • [Fix] Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke)
  • +
  • [Fix] Adjust build_url() to not prepend $phpbb_root_path if path returned from redirect() is an URL. This fixes redirect issues with some installations and bridges. (Bug #47535)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 241bed408f..d147872c34 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2284,7 +2284,7 @@ function redirect($url, $return = false, $disable_cd_check = false) $url = str_replace('&', '&', $url); // Determine which type of redirect we need to handle... - $url_parts = parse_url($url); + $url_parts = @parse_url($url); if ($url_parts === false) { @@ -2497,6 +2497,18 @@ function build_url($strip_vars = false) $redirect .= ($query) ? '?' . $query : ''; } + // We need to be cautious here. + // On some situations, the redirect path is an absolute URL, sometimes a relative path + // For a relative path, let's prefix it with $phpbb_root_path to point to the correct location, + // else we use the URL directly. + $url_parts = @parse_url($redirect); + + // URL + if ($url_parts !== false && !empty($url_parts['scheme']) && !empty($url_parts['host'])) + { + return str_replace('&', '&', $redirect); + } + return $phpbb_root_path . str_replace('&', '&', $redirect); } @@ -3596,7 +3608,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) exit_handler(); break; - + // PHP4 comptibility case E_DEPRECATED: return true; From 44a15b86355e0d2a4d7f6623cd05a3c9e5e58bdd Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 1 Aug 2009 15:46:23 +0000 Subject: [PATCH 375/607] Tiny adjustments related to r9900 and r9897. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9908 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/AUTHORS | 2 +- phpBB/docs/CHANGELOG.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/AUTHORS b/phpBB/docs/AUTHORS index 38457efbbc..63540ea8a0 100644 --- a/phpBB/docs/AUTHORS +++ b/phpBB/docs/AUTHORS @@ -23,7 +23,7 @@ involved in phpBB. phpBB Lead Developer : Acyd Burn (Meik Sievertsen) phpBB Developers : APTX (Marek A. R.) - Bantu (Andreas Fischer) + bantu (Andreas Fischer) DavidMJ (David M.) dhn (Dominik Drscher) kellanved (Henry Sudhof) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index eee01525aa..ea841da88a 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -208,7 +208,7 @@
  • [Change] Add pagination for icons and smilies in the ACP and smilies in the smiley popup
  • [Change] Cache get_username_string() function calls on viewtopic.
  • [Change] Cache version check.
  • -
  • [Change] When creating a new forum without copying permissions, ask again.
  • +
  • [Change] When creating a new forum without copying permissions, ask again.
  • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
  • [Feature] Backported 3.2 captcha plugins.
      From b7a0ef7e7a5f758cfaf874c84f8fc32c098946ab Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 16:08:05 +0000 Subject: [PATCH 376/607] return errors if return_on_error is true for multi_insert (Patch by bantu) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9909 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/dbal.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index b530a572da..95cfc01b14 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -447,7 +447,7 @@ class dbal $ary[] = '(' . implode(', ', $values) . ')'; } - $this->sql_query('INSERT INTO ' . $table . ' ' . ' (' . implode(', ', array_keys($sql_ary[0])) . ') VALUES ' . implode(', ', $ary)); + return $this->sql_query('INSERT INTO ' . $table . ' ' . ' (' . implode(', ', array_keys($sql_ary[0])) . ') VALUES ' . implode(', ', $ary)); } else { @@ -458,7 +458,12 @@ class dbal return false; } - $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $ary)); + $result = $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $ary)); + + if (!$result) + { + return false; + } } } From d78703d73bd40a9d0d553cfb6d39bf5347f84927 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Sat, 1 Aug 2009 16:28:02 +0000 Subject: [PATCH 377/607] Fix bug #1309 - Multiline [url] not Converted Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9910 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/message_parser.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ea841da88a..1d83a27174 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -209,6 +209,7 @@
    • [Change] Cache get_username_string() function calls on viewtopic.
    • [Change] Cache version check.
    • [Change] When creating a new forum without copying permissions, ask again.
    • +
    • [Change] Parse multiline url title for [url] BBCode tag. (Bug #1309)
    • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
    • [Feature] Backported 3.2 captcha plugins.
        diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 2d7dfb6004..6e626eeee8 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -115,7 +115,7 @@ class bbcode_firstpass extends bbcode 'attachment' => array('bbcode_id' => 12, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#ise' => "\$this->bbcode_attachment('\$1', '\$2')")), 'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#ise' => "\$this->bbcode_strong('\$1')")), 'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#ise' => "\$this->bbcode_italic('\$1')")), - 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")), + 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\]((?s).*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")), 'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](.*)\[/img\]#iUe' => "\$this->bbcode_img('\$1')")), 'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#ise' => "\$this->bbcode_size('\$1', '\$2')")), 'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!ise' => "\$this->bbcode_color('\$1', '\$2')")), From 93536d87c98ff4dca1e7cdeb975168c446b5e738 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 17:09:43 +0000 Subject: [PATCH 378/607] forgot this in r9909 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9911 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/dbal.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index 95cfc01b14..0e1d6cba33 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -435,8 +435,7 @@ class dbal // If by accident the sql array is only one-dimensional we build a normal insert statement if (!is_array($_sql_ary)) { - $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $sql_ary)); - return true; + return $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $sql_ary)); } $values = array(); From 554c341c3f0f9ddf3f0ea0155208fe912b98152a Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Sat, 1 Aug 2009 21:14:33 +0000 Subject: [PATCH 379/607] Language changes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9912 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/captcha_recaptcha.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/language/en/captcha_recaptcha.php b/phpBB/language/en/captcha_recaptcha.php index 25802d3a9f..e2d20ac4eb 100644 --- a/phpBB/language/en/captcha_recaptcha.php +++ b/phpBB/language/en/captcha_recaptcha.php @@ -37,16 +37,16 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'RECAPTCHA_LANG' => 'en', - 'RECAPTCHA_NOT_AVAILABLE' => 'You have to register for reCaptcha at reCaptcha.net.', + 'RECAPTCHA_NOT_AVAILABLE' => 'In order to use reCaptcha, you must create an account on reCaptcha.net.', 'CAPTCHA_RECAPTCHA' => 'reCaptcha', - 'RECAPTCHA_INCORRECT' => 'The entered visual confirmation was incorrect', + 'RECAPTCHA_INCORRECT' => 'The visual confirmation code you submitted was incorrect', 'RECAPTCHA_PUBLIC' => 'Public reCaptcha key', - 'RECAPTCHA_PUBLIC_EXPLAIN' => 'Your public reCaptcha key. You can obtain keys from reCaptcha.net.', + 'RECAPTCHA_PUBLIC_EXPLAIN' => 'Your public reCaptcha key. Keys can be obtained on reCaptcha.net.', 'RECAPTCHA_PRIVATE' => 'Private reCaptcha key', - 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. You can obtain keys from reCaptcha.net.', + 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. Keys can be obtained on reCaptcha.net.', - 'RECAPTCHA_EXPLAIN' => 'To avoid spam postings, please enter the two words shown in the picture into the text field underneath.', + 'RECAPTCHA_EXPLAIN' => 'Please enter both of the words displayed below into the text field underneath. This is a measure taken to prevent spam.', )); ?> \ No newline at end of file From 66c81cdac4f202a5ad8092ce94cbc995c873eaa0 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Sun, 2 Aug 2009 11:35:42 +0000 Subject: [PATCH 380/607] switch to full editor git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9913 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/viewtopic.php | 3 ++- phpBB/styles/prosilver/template/quickreply_editor.html | 1 + phpBB/styles/subsilver2/template/quickreply_editor.html | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index 272597c54d..25593fd24a 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -59,7 +59,8 @@ $lang = array_merge($lang, array( 'FILE_NOT_FOUND_404' => 'The file %s does not exist.', 'FORK_TOPIC' => 'Copy topic', - + 'FULL_EDITOR' => 'Full Editor', + 'LINKAGE_FORBIDDEN' => 'You are not authorised to view, download or link from/to this site.', 'LOGIN_NOTIFY_TOPIC' => 'You have been notified about this topic, please login to view it.', 'LOGIN_VIEWTOPIC' => 'The board requires you to be registered and logged in to view this topic.', diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index 4fca4b0dfd..10fede984d 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -28,6 +28,7 @@ {S_FORM_TOKEN} {QR_HIDDEN_FIELDS}   +  
  • diff --git a/phpBB/styles/subsilver2/template/quickreply_editor.html b/phpBB/styles/subsilver2/template/quickreply_editor.html index 6fdb40c7aa..f53b03bd62 100644 --- a/phpBB/styles/subsilver2/template/quickreply_editor.html +++ b/phpBB/styles/subsilver2/template/quickreply_editor.html @@ -10,10 +10,13 @@ {L_MESSAGE}: - + + - +   + + {S_FORM_TOKEN} {QR_HIDDEN_FIELDS} From c748d865b2665147453844980b8db3c98244dbf6 Mon Sep 17 00:00:00 2001 From: "Marek A. R" Date: Sun, 2 Aug 2009 16:44:45 +0000 Subject: [PATCH 381/607] #48965 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9914 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/message_parser.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 6e626eeee8..72c101f7a3 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1317,7 +1317,7 @@ class parse_message extends bbcode_firstpass } // (assertion) - $match[] = '(?<=^|[\n .])' . preg_quote($row['code'], '#') . '(?![^<>]*>)'; + $match[] = preg_quote($row['code'], '#'); $replace[] = '' . $row['code'] . ''; } $db->sql_freeresult($result); @@ -1327,7 +1327,7 @@ class parse_message extends bbcode_firstpass { if ($max_smilies) { - $num_matches = preg_match_all('#' . implode('|', $match) . '#', $this->message, $matches); + $num_matches = preg_match_all('#(?<=^|[\n .])(?:' . implode('|', $match) . ')(?![^<>]*>)#', $this->message, $matches); unset($matches); if ($num_matches !== false && $num_matches > $max_smilies) @@ -1338,7 +1338,7 @@ class parse_message extends bbcode_firstpass } // Make sure the delimiter # is added in front and at the end of every element within $match - $this->message = trim(preg_replace(explode(chr(0), '#' . implode('#' . chr(0) . '#', $match) . '#'), $replace, $this->message)); + $this->message = trim(preg_replace(explode(chr(0), '#(?<=^|[\n .])' . implode('(?![^<>]*>)#' . chr(0) . '#(?<=^|[\n .])', $match) . '(?![^<>]*>)#'), $replace, $this->message)); } } From d376811e7faf1f947645c9bfedd235c6ae9e3227 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 3 Aug 2009 13:32:52 +0000 Subject: [PATCH 382/607] require link hash for switchperm git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9915 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/memberlist.php | 2 +- phpBB/ucp.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index ccd215c590..51301d6ffe 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -580,7 +580,7 @@ switch ($mode) 'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '', 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '', - 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}") : '', + 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}&hash=" . generate_link_hash('switchperm')) : '', 'S_USER_NOTES' => ($user_notes_enabled) ? true : false, 'S_WARN_USER' => ($warn_user_enabled) ? true : false, diff --git a/phpBB/ucp.php b/phpBB/ucp.php index b808049187..061933fb0c 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -186,7 +186,7 @@ switch ($mode) $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - if (!$auth->acl_get('a_switchperm') || !$user_row || $user_id == $user->data['user_id']) + if (!$auth->acl_get('a_switchperm') || !$user_row || $user_id == $user->data['user_id'] || !check_link_hash(request_var('hash', ''), 'switchperm')) { redirect(append_sid("{$phpbb_root_path}index.$phpEx")); } From 1f871950d8bbefe59e18c00ea3238591c0b73807 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 3 Aug 2009 15:46:56 +0000 Subject: [PATCH 383/607] #48985 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9916 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 1 + phpBB/docs/CHANGELOG.html | 2 +- phpBB/includes/acp/acp_profile.php | 6 +++++- phpBB/install/database_update.php | 3 +++ phpBB/install/schemas/firebird_schema.sql | 5 ++++- phpBB/install/schemas/mssql_schema.sql | 5 ++++- phpBB/install/schemas/mysql_40_schema.sql | 3 +++ phpBB/install/schemas/mysql_41_schema.sql | 3 +++ phpBB/install/schemas/oracle_schema.sql | 3 +++ phpBB/install/schemas/postgres_schema.sql | 3 +++ phpBB/install/schemas/sqlite_schema.sql | 5 ++++- phpBB/language/en/acp/profile.php | 2 ++ phpBB/viewtopic.php | 17 ++++++++++++++++- 13 files changed, 52 insertions(+), 6 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 09a42bc684..da84a6029e 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1408,6 +1408,7 @@ function get_schema_struct() 'field_validation' => array('VCHAR_UNI:20', ''), 'field_required' => array('BOOL', 0), 'field_show_on_reg' => array('BOOL', 0), + 'field_show_on_vt' => array('BOOL', 0), 'field_show_profile' => array('BOOL', 0), 'field_hide' => array('BOOL', 0), 'field_no_view' => array('BOOL', 0), diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 1d83a27174..875dbf1400 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -258,9 +258,9 @@
  • [Feature] Display version check on ACP main page.
  • [Feature] Ability to copy permissions from one forum to several other forums.
  • +
  • [Feature] Ability to control the display of custom profile fields on viewtopic (Bug #48985).
  • [Feature] Fallback options for missing language files. (Bug #38575 - Patch by EXreaction)
  • -

    1.ii. Changes since 3.0.4

      diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index bbe36af9be..1b0ec4b5d5 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -369,6 +369,7 @@ class acp_profile 'field_show_profile'=> 0, 'field_no_view' => 0, 'field_show_on_reg' => 0, + 'field_show_on_vt' => 0, 'lang_name' => utf8_normalize_nfc(request_var('field_ident', '', true)), 'lang_explain' => '', 'lang_default_value'=> '') @@ -379,7 +380,7 @@ class acp_profile // $exclude contains the data we gather in each step $exclude = array( - 1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_required', 'field_hide', 'field_show_profile', 'field_no_view'), + 1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_vt', 'field_required', 'field_hide', 'field_show_profile', 'field_no_view'), 2 => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'), 3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options') ); @@ -405,6 +406,7 @@ class acp_profile $visibility_ary = array( 'field_required', 'field_show_on_reg', + 'field_show_on_vt', 'field_show_profile', 'field_hide', ); @@ -721,6 +723,7 @@ class acp_profile 'S_STEP_ONE' => true, 'S_FIELD_REQUIRED' => ($cp->vars['field_required']) ? true : false, 'S_SHOW_ON_REG' => ($cp->vars['field_show_on_reg']) ? true : false, + 'S_SHOW_ON_VT' => ($cp->vars['field_show_on_vt']) ? true : false, 'S_FIELD_HIDE' => ($cp->vars['field_hide']) ? true : false, 'S_SHOW_PROFILE' => ($cp->vars['field_show_profile']) ? true : false, 'S_FIELD_NO_VIEW' => ($cp->vars['field_no_view']) ? true : false, @@ -1036,6 +1039,7 @@ class acp_profile 'field_validation' => $cp->vars['field_validation'], 'field_required' => $cp->vars['field_required'], 'field_show_on_reg' => $cp->vars['field_show_on_reg'], + 'field_show_on_vt' => $cp->vars['field_show_on_vt'], 'field_hide' => $cp->vars['field_hide'], 'field_show_profile' => $cp->vars['field_show_profile'], 'field_no_view' => $cp->vars['field_no_view'] diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 709836ea88..e692750659 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -704,6 +704,9 @@ function database_update_info() REPORTS_TABLE => array( 'pm_id' => array('UINT', 0), ), + PROFILE_FIELDS_TABLE => array( + 'field_show_on_vt' => array('BOOL', 0), + ), ), 'change_columns' => array( USERS_TABLE => array( diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index de1472f6fd..a059dd6e2b 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -790,6 +790,7 @@ CREATE TABLE phpbb_profile_fields ( field_validation VARCHAR(20) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, field_required INTEGER DEFAULT 0 NOT NULL, field_show_on_reg INTEGER DEFAULT 0 NOT NULL, + field_show_on_vt INTEGER DEFAULT 0 NOT NULL, field_show_profile INTEGER DEFAULT 0 NOT NULL, field_hide INTEGER DEFAULT 0 NOT NULL, field_no_view INTEGER DEFAULT 0 NOT NULL, @@ -1370,7 +1371,9 @@ CREATE TABLE phpbb_users ( user_actkey VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, user_newpasswd VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, user_form_salt VARCHAR(32) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_new INTEGER DEFAULT 1 NOT NULL + user_new INTEGER DEFAULT 1 NOT NULL, + user_reminded INTEGER DEFAULT 0 NOT NULL, + user_reminded_time INTEGER DEFAULT 0 NOT NULL );; ALTER TABLE phpbb_users ADD PRIMARY KEY (user_id);; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 612b2b8d76..b6f85c907e 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -948,6 +948,7 @@ CREATE TABLE [phpbb_profile_fields] ( [field_validation] [varchar] (20) DEFAULT ('') NOT NULL , [field_required] [int] DEFAULT (0) NOT NULL , [field_show_on_reg] [int] DEFAULT (0) NOT NULL , + [field_show_on_vt] [int] DEFAULT (0) NOT NULL , [field_show_profile] [int] DEFAULT (0) NOT NULL , [field_hide] [int] DEFAULT (0) NOT NULL , [field_no_view] [int] DEFAULT (0) NOT NULL , @@ -1645,7 +1646,9 @@ CREATE TABLE [phpbb_users] ( [user_actkey] [varchar] (32) DEFAULT ('') NOT NULL , [user_newpasswd] [varchar] (40) DEFAULT ('') NOT NULL , [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL , - [user_new] [int] DEFAULT (1) NOT NULL + [user_new] [int] DEFAULT (1) NOT NULL , + [user_reminded] [int] DEFAULT (0) NOT NULL , + [user_reminded_time] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 5934d2d173..7b506f5a75 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -554,6 +554,7 @@ CREATE TABLE phpbb_profile_fields ( field_validation varbinary(60) DEFAULT '' NOT NULL, field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, @@ -971,6 +972,8 @@ CREATE TABLE phpbb_users ( user_newpasswd varbinary(120) DEFAULT '' NOT NULL, user_form_salt varbinary(96) DEFAULT '' NOT NULL, user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_reminded tinyint(4) DEFAULT '0' NOT NULL, + user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (user_id), KEY user_birthday (user_birthday), KEY user_email_hash (user_email_hash), diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 2623202d4a..651a842f8f 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -554,6 +554,7 @@ CREATE TABLE phpbb_profile_fields ( field_validation varchar(20) DEFAULT '' NOT NULL, field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, @@ -971,6 +972,8 @@ CREATE TABLE phpbb_users ( user_newpasswd varchar(40) DEFAULT '' NOT NULL, user_form_salt varchar(32) DEFAULT '' NOT NULL, user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_reminded tinyint(4) DEFAULT '0' NOT NULL, + user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (user_id), KEY user_birthday (user_birthday), KEY user_email_hash (user_email_hash), diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 05d25db87c..df707db3c5 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1060,6 +1060,7 @@ CREATE TABLE phpbb_profile_fields ( field_validation varchar2(60) DEFAULT '' , field_required number(1) DEFAULT '0' NOT NULL, field_show_on_reg number(1) DEFAULT '0' NOT NULL, + field_show_on_vt number(1) DEFAULT '0' NOT NULL, field_show_profile number(1) DEFAULT '0' NOT NULL, field_hide number(1) DEFAULT '0' NOT NULL, field_no_view number(1) DEFAULT '0' NOT NULL, @@ -1791,6 +1792,8 @@ CREATE TABLE phpbb_users ( user_newpasswd varchar2(120) DEFAULT '' , user_form_salt varchar2(96) DEFAULT '' , user_new number(1) DEFAULT '1' NOT NULL, + user_reminded number(4) DEFAULT '0' NOT NULL, + user_reminded_time number(11) DEFAULT '0' NOT NULL, CONSTRAINT pk_phpbb_users PRIMARY KEY (user_id), CONSTRAINT u_phpbb_username_clean UNIQUE (username_clean) ) diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index bb4d839272..66bd206928 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -741,6 +741,7 @@ CREATE TABLE phpbb_profile_fields ( field_validation varchar(20) DEFAULT '' NOT NULL, field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0), field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0), + field_show_on_vt INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_vt >= 0), field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0), field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0), field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0), @@ -1234,6 +1235,8 @@ CREATE TABLE phpbb_users ( user_newpasswd varchar(40) DEFAULT '' NOT NULL, user_form_salt varchar(32) DEFAULT '' NOT NULL, user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0), + user_reminded INT2 DEFAULT '0' NOT NULL, + user_reminded_time INT4 DEFAULT '0' NOT NULL CHECK (user_reminded_time >= 0), PRIMARY KEY (user_id) ); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 4ee981c667..4741baf559 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -537,6 +537,7 @@ CREATE TABLE phpbb_profile_fields ( field_validation varchar(20) NOT NULL DEFAULT '', field_required INTEGER UNSIGNED NOT NULL DEFAULT '0', field_show_on_reg INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_show_on_vt INTEGER UNSIGNED NOT NULL DEFAULT '0', field_show_profile INTEGER UNSIGNED NOT NULL DEFAULT '0', field_hide INTEGER UNSIGNED NOT NULL DEFAULT '0', field_no_view INTEGER UNSIGNED NOT NULL DEFAULT '0', @@ -940,7 +941,9 @@ CREATE TABLE phpbb_users ( user_actkey varchar(32) NOT NULL DEFAULT '', user_newpasswd varchar(40) NOT NULL DEFAULT '', user_form_salt varchar(32) NOT NULL DEFAULT '', - user_new INTEGER UNSIGNED NOT NULL DEFAULT '1' + user_new INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_reminded tinyint(4) NOT NULL DEFAULT '0', + user_reminded_time INTEGER UNSIGNED NOT NULL DEFAULT '0' ); CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); diff --git a/phpBB/language/en/acp/profile.php b/phpBB/language/en/acp/profile.php index ef291585bc..a25dcd174b 100644 --- a/phpBB/language/en/acp/profile.php +++ b/phpBB/language/en/acp/profile.php @@ -66,6 +66,8 @@ $lang = array_merge($lang, array( 'DISPLAY_AT_PROFILE_EXPLAIN' => 'The user is able to change this profile field within the user control panel.', 'DISPLAY_AT_REGISTER' => 'Display on registration screen', 'DISPLAY_AT_REGISTER_EXPLAIN' => 'If this option is enabled, the field will be displayed on registration.', + 'DISPLAY_ON_VT' => 'Display on viewtopic screen', + 'DISPLAY_ON_VT_EXPLAIN' => 'If this option is enabled, the field will be displayed in the mini-profile on the topic screen.', 'DISPLAY_PROFILE_FIELD' => 'Publicly display profile field', 'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown in all locations allowed within the load settings. Setting this to “no” will hide the field from topic pages, profiles and the memberlist.', 'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line.', diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 52bae414df..fc96f0c901 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1179,7 +1179,22 @@ if ($config['load_cpf_viewtopic']) $cp = new custom_profile(); // Grab all profile fields from users in id cache for later use - similar to the poster cache - $profile_fields_cache = $cp->generate_profile_fields_template('grab', $id_cache); + $profile_fields_tmp = $cp->generate_profile_fields_template('grab', $id_cache); + + // filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs. + $profile_fields_cache = array(); + foreach ($profile_fields_tmp as $profile_user_id => $profile_fields) + { + $profile_fields_cache[$profile_user_id] = array(); + foreach ($profile_fields as $used_ident => $profile_field) + { + if ($profile_field['data']['field_show_on_vt']) + { + $profile_fields_cache[$profile_user_id][$used_ident] = $profile_field; + } + } + } + unset($profile_fields_tmp); } // Generate online information for user From c8daec7c8239fab1cc45eb94829a1a99fd646d46 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 4 Aug 2009 10:04:54 +0000 Subject: [PATCH 384/607] Fix Bug #49035 - Fix general error while registration, through undefined variable $config in validate_referer (Patch by wjvriend) Authorised by: bantu git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9917 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/session.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 875dbf1400..1ba713b1b9 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -186,6 +186,7 @@
    • [Fix] Do not try to create thumbnails for images we cannot open properly. (Bug #48695)
    • [Fix] Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke)
    • [Fix] Adjust build_url() to not prepend $phpbb_root_path if path returned from redirect() is an URL. This fixes redirect issues with some installations and bridges. (Bug #47535)
    • +
    • [Fix] Fix general error while registration, through undefined variable $config in validate_referer (Bug #49035 - Patch by wjvriend)
    • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
    • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
    • [Change] Template engine now permits to a limited extent variable includes.
    • diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index a49716a8db..b4d817daf9 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1364,6 +1364,8 @@ class session */ function validate_referer($check_script_path = false) { + global $config; + // no referer - nothing to validate, user's fault for turning it off (we only check on POST; so meta can't be the reason) if (empty($this->referer) || empty($this->host)) { @@ -1373,7 +1375,7 @@ class session $host = htmlspecialchars($this->host); $ref = substr($this->referer, strpos($this->referer, '://') + 3); - if (!(stripos($ref, $host) === 0) && (!$config['force_server'] || !(stripos($ref, $config['server_name']) === 0))) + if (!(stripos($ref, $host) === 0) && (!$config['force_server_vars'] || !(stripos($ref, $config['server_name']) === 0))) { return false; } From 0e98a3aee813b4f83b1021d8204b38ba7fd319f0 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 4 Aug 2009 13:08:26 +0000 Subject: [PATCH 385/607] Even if the recipient of a PM is now inactive (for whatever reason) still display the information in PM recipient lists and do not hide it git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9918 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_privmsgs.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 955b310335..f6dd29cd99 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1145,8 +1145,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) { $sql = 'SELECT user_id, username, user_colour FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $u) . ' - AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + WHERE ' . $db->sql_in_set('user_id', $u); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) From 6cd6a907c7d8503896a46f710bb75370f1abcf43 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 4 Aug 2009 14:15:13 +0000 Subject: [PATCH 386/607] Separate PM Reply and PM Reply to all in prosilver. Style changes by dhn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9919 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 +- phpBB/includes/ucp/ucp_pm_compose.php | 12 +++++--- phpBB/includes/ucp/ucp_pm_viewmessage.php | 7 +++++ phpBB/language/en/ucp.php | 1 + .../template/ucp_pm_message_header.html | 24 ++++++++++++---- .../prosilver/template/ucp_pm_viewfolder.html | 2 +- .../template/ucp_pm_viewmessage.html | 10 +++---- phpBB/styles/prosilver/theme/colours.css | 6 ++++ phpBB/styles/prosilver/theme/cp.css | 28 +++++++++++++++++++ 9 files changed, 75 insertions(+), 18 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 1ba713b1b9..1ba549272c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -141,7 +141,7 @@
    • [Fix] Check if template file is empty before trying to read from it. (Bug #47345 - Patch by bantu)
    • [Fix] Correct descriptions of the permissions to use BBCode, smilies, images and flash to be more relevant. (Bug #36065 - Patch by rxu)
    • [Fix] Fix style issues in print mode. (Bug #26375 - Patch by leviatan21)
    • -
    • [Fix] Fix minor issue with L_QUOTE language string missing in several PM composing modes. (Bug #39625 - Patch by rxu)
    • +
    • [Fix] Fix minor issue with L_QUOTE language string missing in several PM composing modes. (Bug #39625 - Patch by rxu)
    • [Fix] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by m0rpha)
    • [Fix] Search by authorname does not display posts of guests and deleted or deactivated users (Bug #36565, #47765 - Patch by nickvergessen)
    • [Fix] View end of ban in MCP and ACP when user is banned by duration (Bug #47815 - Patch by Pyramide)
    • @@ -261,6 +261,7 @@
    • [Feature] Ability to copy permissions from one forum to several other forums.
    • [Feature] Ability to control the display of custom profile fields on viewtopic (Bug #48985).
    • [Feature] Fallback options for missing language files. (Bug #38575 - Patch by EXreaction)
    • +
    • [Feature] Separate PM Reply and PM Reply to all in prosilver.

    1.ii. Changes since 3.0.4

    diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index cf82925e1d..2f7c289653 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -46,6 +46,9 @@ function compose_pm($id, $mode, $action) $draft_id = request_var('d', 0); $lastclick = request_var('lastclick', 0); + // Reply to all triggered (quote/reply) + $reply_to_all = request_var('reply_to_all', 0); + // Do NOT use request_var or specialchars here $address_list = isset($_REQUEST['address_list']) ? $_REQUEST['address_list'] : array(); @@ -84,7 +87,7 @@ function compose_pm($id, $mode, $action) } redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm')); } - + // Since viewtopic.php language entries are used in several modes, // we include the language file here $user->add_lang('viewtopic'); @@ -314,13 +317,14 @@ function compose_pm($id, $mode, $action) if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !sizeof($address_list) && !$refresh && !$submit && !$preview) { - if ($action == 'quotepost') + // Add the original author as the recipient if quoting a post or only replying and not having checked "reply to all" + if ($action == 'quotepost' || !$reply_to_all) { $address_list = array('u' => array($post['author_id'] => 'to')); } else { - // We try to include every previously listed member from the TO Header + // We try to include every previously listed member from the TO Header - Reply to all $address_list = rebuild_header(array('to' => $post['to_address'])); // Add the author (if he is already listed then this is no shame (it will be overwritten)) @@ -443,7 +447,7 @@ function compose_pm($id, $mode, $action) $max_recipients = (!$max_recipients) ? $config['pm_max_recipients'] : $max_recipients; // If this is a quote/reply "to all"... we may increase the max_recpients to the number of original recipients - if (($action == 'reply' || $action == 'quote') && $max_recipients) + if (($action == 'reply' || $action == 'quote') && $max_recipients && $reply_to_all) { // We try to include every previously listed member from the TO Header $list = rebuild_header(array('to' => $post['to_address'])); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index dd15f5ff37..0e51e268cf 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -169,6 +169,9 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); + // Number of "to" recipients + $num_recipients = (int) preg_match_all('/:?(u|g)_([0-9]+):?/', $message_row['to_address'], $match); + $template->assign_vars(array( 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']), 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']), @@ -215,13 +218,17 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'U_QUOTE' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_EDIT' => (($message_row['message_time'] > time() - ($config['pm_edit_time'] * 60) || !$config['pm_edit_time']) && $folder_id == PRIVMSGS_OUTBOX && $auth->acl_get('u_pm_edit')) ? "$url&mode=compose&action=edit&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_POST_REPLY_PM' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $message_row['msg_id'] : '', + 'U_POST_REPLY_ALL' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=reply&f=$folder_id&reply_to_all=1&p=" . $message_row['msg_id'] : '', 'U_PREVIOUS_PM' => "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=previous", 'U_NEXT_PM' => "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=next", + 'U_PM_ACTION' => $url . '&mode=compose&f=' . $folder_id . '&p=' . $message_row['msg_id'], + 'S_HAS_ATTACHMENTS' => (sizeof($attachments)) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $message_row['message_attachment'], 'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false, 'S_SPECIAL_FOLDER' => in_array($folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)), + 'S_PM_RECIPIENTS' => $num_recipients, 'U_PRINT_PM' => ($config['print_pm'] && $auth->acl_get('u_pm_printpm')) ? "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=print" : '', 'U_FORWARD_PM' => ($config['forward_pm'] && $auth->acl_get('u_sendpm') && $auth->acl_get('u_pm_forward')) ? "$url&mode=compose&action=forward&f=$folder_id&p=" . $message_row['msg_id'] : '') diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 4a80e568a2..4b79a4b6ca 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -374,6 +374,7 @@ $lang = array_merge($lang, array( 'RENAME' => 'Rename', 'RENAME_FOLDER' => 'Rename folder', 'REPLIED_MESSAGE' => 'Replied to message', + 'REPLY_TO_ALL' => 'Reply to sender and all recipients.', 'REPORT_PM' => 'Report private message', 'RESIGN_SELECTED' => 'Resign selected', 'RETURN_FOLDER' => '%1$sReturn to previous folder%2$s', diff --git a/phpBB/styles/prosilver/template/ucp_pm_message_header.html b/phpBB/styles/prosilver/template/ucp_pm_message_header.html index f9eb1cc102..ee56d61808 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_message_header.html +++ b/phpBB/styles/prosilver/template/ucp_pm_message_header.html @@ -1,22 +1,30 @@

    {L_TITLE}: {CUR_FOLDER_NAME}

    -
    - -
    + + +
    diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index 1b7e52480a..05d213f2ed 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -2,9 +2,9 @@ +
    -

    {L_EXPORT_AS_CSV}

    diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index 059ae4703a..df0cf25e82 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -1,20 +1,18 @@ - + -
    -
    -
    +
    {L_VIEW_PREVIOUS_HISTORY} {L_VIEW_NEXT_HISTORY}
    -
    -
    +
    +
    diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 28749dc0c4..7929bbefe4 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -868,6 +868,12 @@ dl.mini dt { color: #000000 !important; } +/* PM panel adjustments */ +.pm-panel-header, +#cp-main .pm-message-nav { + border-bottom-color: #A4B3BF; +} + /* PM marking colours */ .pmlist li.pm_message_reported_colour, .pm_message_reported_colour { border-left-color: #BC2A4D; diff --git a/phpBB/styles/prosilver/theme/cp.css b/phpBB/styles/prosilver/theme/cp.css index fa8899bae8..1e0edc616f 100644 --- a/phpBB/styles/prosilver/theme/cp.css +++ b/phpBB/styles/prosilver/theme/cp.css @@ -348,6 +348,34 @@ dl.mini dd { line-height: 2.5em; } +/* PM panel adjustments */ +.pm-panel-header { + margin: 0; + padding-bottom: 10px; + border-bottom: 1px dashed #A4B3BF; +} + +.reply-all { + display: block; + padding-top: 4px; + clear: both; + float: left; +} + +.pm-panel-message { + padding-top: 10px; +} + +.pm-return-to { + padding-top: 23px; +} + +#cp-main .pm-message-nav { + margin: 0; + padding: 2px 10px 5px 10px; + border-bottom: 1px dashed #A4B3BF; +} + /* PM Message history */ .current { color: #999999; From ccbbaba91d0314144932c2916229818b0ac71c4e Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 4 Aug 2009 15:34:04 +0000 Subject: [PATCH 387/607] add the option to place image debugging information to the log git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9920 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 7 ++++++- phpBB/language/en/acp/common.php | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index d147872c34..6549ba9b0d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3465,8 +3465,13 @@ function msg_handler($errno, $msg_text, $errfile, $errline) // remove complete path to installation, with the risk of changing backslashes meant to be there $errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile); $msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text); - echo '[phpBB Debug] PHP Notice: in file ' . $errfile . ' on line ' . $errline . ': ' . $msg_text . '
    ' . "\n"; + + // we are writing an image - the user won't see the debug, so let's place it in the log + if (defined('IMAGE_OUTPUT')) + { + add_log('critical', 'LOG_IMAGE_GENERATION_ERROR', $errfile, $errline, $msg_text); + } // echo '

    BACKTRACE
    ' . get_backtrace() . '
    ' . "\n"; } diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 9a9b89652a..f03298642a 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -574,6 +574,8 @@ $lang = array_merge($lang, array( 'LOG_USERS_APPROVED' => 'Users approved in usergroup %1$s
    » %2$s', 'LOG_USERS_PENDING' => 'Users requested to join group “%1$s” and need to be approved
    » %2$s', + 'LOG_IMAGE_GENERATION_ERROR' => 'Error while creating image
    » Error in %1$s on line %2$s: %3$s', + 'LOG_IMAGESET_ADD_DB' => 'Added new imageset to database
    » %s', 'LOG_IMAGESET_ADD_FS' => 'Add new imageset on filesystem
    » %s', 'LOG_IMAGESET_DELETE' => 'Deleted imageset
    » %s', From 81998a510462f87acf4dc1f93d99b85f1025580c Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 4 Aug 2009 15:34:45 +0000 Subject: [PATCH 388/607] use new flag to place captcha errors in the error log (if debug is set) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9921 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/captcha_abstract.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index d24e554188..ceb9c4f9fb 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -66,6 +66,7 @@ class phpbb_default_captcha $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); $captcha = new captcha(); + define('IMAGE_OUTPUT', 1); $captcha->execute($this->code, $this->seed); } @@ -80,6 +81,7 @@ class phpbb_default_captcha } } $captcha = new captcha(); + define('IMAGE_OUTPUT', 1); $captcha->execute($this->code, $this->seed); } From 769bc7174f355531e384c3237cdcb1c7b5a3824f Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 4 Aug 2009 15:36:39 +0000 Subject: [PATCH 389/607] use new flag to place captcha errors in the error log (if debug is set) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9922 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 1ba549272c..01205402d2 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -262,6 +262,8 @@
  • [Feature] Ability to control the display of custom profile fields on viewtopic (Bug #48985).
  • [Feature] Fallback options for missing language files. (Bug #38575 - Patch by EXreaction)
  • [Feature] Separate PM Reply and PM Reply to all in prosilver.
  • +
  • [Feature] Place debug notices during captcha rendering in the error log - useful for debugging output already started errors.
  • +

    1.ii. Changes since 3.0.4

    From b6690e51f9a125380cea86f23138ab95db7b51da Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 4 Aug 2009 15:57:38 +0000 Subject: [PATCH 390/607] and for pseudocron too (to conisder: log db errors to debug faulty cron jobs) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9923 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 6549ba9b0d..13864848a8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3468,7 +3468,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) echo '[phpBB Debug] PHP Notice: in file ' . $errfile . ' on line ' . $errline . ': ' . $msg_text . '
    ' . "\n"; // we are writing an image - the user won't see the debug, so let's place it in the log - if (defined('IMAGE_OUTPUT')) + if (defined('IMAGE_OUTPUT') || defined('IN_CRON')) { add_log('critical', 'LOG_IMAGE_GENERATION_ERROR', $errfile, $errline, $msg_text); } @@ -3614,7 +3614,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) exit_handler(); break; - // PHP4 comptibility + // PHP4 compatibility case E_DEPRECATED: return true; break; From 4e9ce7060edad3361db224996adb5a87bf083b69 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 5 Aug 2009 12:02:18 +0000 Subject: [PATCH 391/607] log general errors in cron, images and when debug is enabled git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9924 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 8 ++++++++ phpBB/language/en/acp/common.php | 2 ++ 2 files changed, 10 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 13864848a8..e797b279c9 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3505,6 +3505,14 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $l_notify = '

    Please notify the board administrator or webmaster: ' . $config['board_contact'] . '

    '; } } + + if (defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) + { + // let's avoid loops + $db->sql_return_on_error(true); + add_log('critical', 'LOG_GENERAL_ERROR', $msg_title, $msg_text); + $db->sql_return_on_error(false); + } garbage_collection(); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index f03298642a..83778d90bf 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -562,6 +562,8 @@ $lang = array_merge($lang, array( 'LOG_FORUM_MOVE_UP' => 'Moved forum %1$s above %2$s', 'LOG_FORUM_SYNC' => 'Re-synchronised forum
    » %s', + 'LOG_GENERAL_ERROR' => 'A general error occured: %1$s
    » %2$s', + 'LOG_GROUP_CREATED' => 'New usergroup created
    » %s', 'LOG_GROUP_DEFAULTS' => 'Group “%1$s” made default for members
    » %2$s', 'LOG_GROUP_DELETE' => 'Usergroup deleted
    » %s', From 58c0bd804fe40898b4c87444a07efb16e8e60750 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 5 Aug 2009 12:47:56 +0000 Subject: [PATCH 392/607] update mysql_upgrader git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9925 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/mysql_upgrader.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 88934bde42..9caf9a3a04 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -804,6 +804,7 @@ function get_schema_struct() 'message_edit_count' => array('USINT', 0), 'to_address' => array('TEXT_UNI', ''), 'bcc_address' => array('TEXT_UNI', ''), + 'message_reported' => array('BOOL', 0), ), 'PRIMARY_KEY' => 'msg_id', 'KEYS' => array( @@ -879,6 +880,7 @@ function get_schema_struct() 'field_validation' => array('VCHAR_UNI:20', ''), 'field_required' => array('BOOL', 0), 'field_show_on_reg' => array('BOOL', 0), + 'field_show_on_vt' => array('BOOL', 0), 'field_show_profile' => array('BOOL', 0), 'field_hide' => array('BOOL', 0), 'field_no_view' => array('BOOL', 0), @@ -937,6 +939,7 @@ function get_schema_struct() 'report_id' => array('UINT', NULL, 'auto_increment'), 'reason_id' => array('USINT', 0), 'post_id' => array('UINT', 0), + 'pm_id' => array('UINT', 0), 'user_id' => array('UINT', 0), 'user_notify' => array('BOOL', 0), 'report_closed' => array('BOOL', 0), @@ -944,6 +947,10 @@ function get_schema_struct() 'report_text' => array('MTEXT_UNI', ''), ), 'PRIMARY_KEY' => 'report_id', + 'KEYS' => array( + 'post_id' => array('INDEX', 'post_id'), + 'pm_id' => array('INDEX', 'pm_id'), + ), ); $schema_data['phpbb_reports_reasons'] = array( @@ -1326,6 +1333,8 @@ function get_schema_struct() 'user_newpasswd' => array('VCHAR_UNI:40', ''), 'user_form_salt' => array('VCHAR_UNI:32', ''), 'user_new' => array('BOOL', 1), + 'user_reminded' => array('TINT:4', 0), + 'user_reminded_time' => array('TIMESTAMP', 0), ), 'PRIMARY_KEY' => 'user_id', 'KEYS' => array( From 914687075da7769583e2752701121deee61ff525 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Wed, 5 Aug 2009 12:51:48 +0000 Subject: [PATCH 393/607] Fix bug #15729 - Global announcements marked as read if all new topics in forum are viewed Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9926 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 2 +- phpBB/includes/functions_display.php | 2 ++ phpBB/includes/functions_posting.php | 21 +++++++++++++++------ phpBB/viewforum.php | 3 ++- phpBB/viewtopic.php | 4 ++-- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 01205402d2..00fae0c47d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -186,6 +186,7 @@
  • [Fix] Do not try to create thumbnails for images we cannot open properly. (Bug #48695)
  • [Fix] Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke)
  • [Fix] Adjust build_url() to not prepend $phpbb_root_path if path returned from redirect() is an URL. This fixes redirect issues with some installations and bridges. (Bug #47535)
  • +
  • [Fix] Do not mark global announcements as read if all topics in a forum become read (Bug #15729).
  • [Fix] Fix general error while registration, through undefined variable $config in validate_referer (Bug #49035 - Patch by wjvriend)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e797b279c9..23ed190bcd 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1227,7 +1227,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } // Add 0 to forums array to mark global announcements correctly - $forum_id[] = 0; + // $forum_id[] = 0; if ($config['load_db_lastread'] && $user->data['is_registered']) { diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 57f416bee4..f9eb4ce4cd 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -251,6 +251,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else { + // Add 0 to forums array to mark global announcements correctly + $forum_ids[] = 0; markread('topics', $forum_ids); $message = sprintf($user->lang['RETURN_FORUM'], '', ''); } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 40df716ac9..61741ceb81 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2531,7 +2531,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Mark this topic as read // We do not use post_time here, this is intended (post_time can have a date in the past if editing a message) - markread('topic', $data['forum_id'], $data['topic_id'], time()); + markread('topic', (($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']), $data['topic_id'], time()); // if ($config['load_db_lastread'] && $user->data['is_registered']) @@ -2539,7 +2539,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql = 'SELECT mark_time FROM ' . FORUMS_TRACK_TABLE . ' WHERE user_id = ' . $user->data['user_id'] . ' - AND forum_id = ' . $data['forum_id']; + AND forum_id = ' . (($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']); $result = $db->sql_query($sql); $f_mark_time = (int) $db->sql_fetchfield('mark_time'); $db->sql_freeresult($result); @@ -2552,14 +2552,23 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered']) { // Update forum info - $sql = 'SELECT forum_last_post_time - FROM ' . FORUMS_TABLE . ' - WHERE forum_id = ' . $data['forum_id']; + if ($topic_type == POST_GLOBAL) + { + $sql = 'SELECT MAX(topic_last_post_time) as forum_last_post_time + FROM ' . TOPICS_TABLE . ' + WHERE forum_id = 0'; + } + else + { + $sql = 'SELECT forum_last_post_time + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $data['forum_id']; + } $result = $db->sql_query($sql); $forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time'); $db->sql_freeresult($result); - update_forum_tracking_info($data['forum_id'], $forum_last_post_time, $f_mark_time, false); + update_forum_tracking_info((($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']), $forum_last_post_time, $f_mark_time, false); } // Send Notifications diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 1a2333ac8b..2668919e1d 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -179,7 +179,8 @@ if ($mark_read == 'topics') $token = request_var('hash', ''); if (check_link_hash($token, 'global')) { - markread('topics', $forum_id); + // Add 0 to forums array to mark global announcements correctly + markread('topics', array($forum_id, 0)); } $redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); meta_refresh(3, $redirect_url); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index fc96f0c901..51a8682229 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1582,10 +1582,10 @@ if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($use // Only mark topic if it's currently unread. Also make sure we do not set topic tracking back if earlier pages are viewed. if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id] && $max_post_time > $topic_tracking_info[$topic_id]) { - markread('topic', $forum_id, $topic_id, $max_post_time); + markread('topic', (($topic_data['topic_type'] == POST_GLOBAL) ? 0 : $forum_id), $topic_id, $max_post_time); // Update forum info - $all_marked_read = update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false); + $all_marked_read = update_forum_tracking_info((($topic_data['topic_type'] == POST_GLOBAL) ? 0 : $forum_id), $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false); } else { From f3a2c096e7f502e877ada6924d1fedffde59d431 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 5 Aug 2009 13:01:03 +0000 Subject: [PATCH 394/607] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false). git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9927 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_posting.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 00fae0c47d..c373a5a8f7 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -188,6 +188,7 @@
  • [Fix] Adjust build_url() to not prepend $phpbb_root_path if path returned from redirect() is an URL. This fixes redirect issues with some installations and bridges. (Bug #47535)
  • [Fix] Do not mark global announcements as read if all topics in a forum become read (Bug #15729).
  • [Fix] Fix general error while registration, through undefined variable $config in validate_referer (Bug #49035 - Patch by wjvriend)
  • +
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 61741ceb81..0991035c32 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1674,14 +1674,22 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } // This variable indicates if the user is able to post or put into the queue - it is used later for all code decisions regarding approval + // The variable name should be $post_approved, because it indicates if the post is approved or not $post_approval = 1; // Check the permissions for post approval. Moderators are not affected. if (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id'])) { + // Post not approved, but in queue $post_approval = 0; } + // Mods are able to force approved/unapproved posts. True means the post is approved, false the post is unapproved + if ($data['force_approved_state']) + { + $post_approval = ($data['force_approved_state']) ? 1 : 0; + } + // Start the transaction here $db->sql_transaction('begin'); From 4e117116749ad47c1cfcc24cd2cb24c7271aad1c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 5 Aug 2009 13:05:55 +0000 Subject: [PATCH 395/607] Fix Bug #48955 - Correctly extract column default value when exporting PostgreSQL tables. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9928 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_database.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index c373a5a8f7..17d192d88b 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -188,6 +188,7 @@
  • [Fix] Adjust build_url() to not prepend $phpbb_root_path if path returned from redirect() is an URL. This fixes redirect issues with some installations and bridges. (Bug #47535)
  • [Fix] Do not mark global announcements as read if all topics in a forum become read (Bug #15729).
  • [Fix] Fix general error while registration, through undefined variable $config in validate_referer (Bug #49035 - Patch by wjvriend)
  • +
  • [Fix] Correctly extract column default value when exporting PostgreSQL tables. (Bug #48955)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index bf02a58dce..b25518e1c4 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -1157,16 +1157,17 @@ class postgres_extractor extends base_extractor AND (c.oid = d.adrelid) AND d.adnum = " . $row['attnum']; $def_res = $db->sql_query($sql_get_default); + $def_row = $db->sql_fetchrow($def_res); + $db->sql_freeresult($def_res); - if (!$def_res) + if (empty($def_row)) { unset($row['rowdefault']); } else { - $row['rowdefault'] = $db->sql_fetchfield('rowdefault', false, $def_res); + $row['rowdefault'] = $def_row['rowdefault']; } - $db->sql_freeresult($def_res); if ($row['type'] == 'bpchar') { From 2c6e4d7e803d1fa7f1b585dd535f8c2c5fb6357d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 5 Aug 2009 13:11:27 +0000 Subject: [PATCH 396/607] fix r9927 - of course isset() git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9929 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 0991035c32..1385934c0e 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1685,7 +1685,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } // Mods are able to force approved/unapproved posts. True means the post is approved, false the post is unapproved - if ($data['force_approved_state']) + if (isset($data['force_approved_state'])) { $post_approval = ($data['force_approved_state']) ? 1 : 0; } From d0e9e4189ce83390beeb58acefee05bff2e6b167 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 5 Aug 2009 14:50:39 +0000 Subject: [PATCH 397/607] Fix Bug #46285 (drop index patch by Paul) - i hope the re-addition of the FULLTEXT index works. :o If someone wants to try? :) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9930 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/mysql_upgrader.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 9caf9a3a04..1f8bccdd1f 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -40,13 +40,18 @@ $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); -$mysql_indexer = false; +$mysql_indexer = $drop_index = false; if (strtolower($row['Type']) === 'mediumtext') { $mysql_indexer = true; } +if (strtolower($row['Key']) === 'mul') +{ + $drop_index = true; +} + echo "USE $dbname;$newline$newline"; @@ -124,6 +129,13 @@ foreach ($schema_data as $table_name => $table_data) // Create Table statement $generator = $textimage = false; + // Do we need to DROP a fulltext index before we alter the table? + if ($table_name == ($prefix . 'posts') && $drop_index) + { + echo "ALTER TABLE {$table_name}{$newline}"; + echo "DROP INDEX post_text,{$newline}DROP INDEX post_subject,{$newline}DROP INDEX post_content;{$newline}{$newline}"; + } + $line = "ALTER TABLE {$table_name} $newline"; // Table specific so we don't get overlap @@ -236,6 +248,12 @@ foreach ($schema_data as $table_name => $table_data) $line .= "\tDEFAULT CHARSET=utf8 COLLATE=utf8_bin;$newline$newline"; echo $line . "$newline"; + + // Do we now need to re-add the fulltext index? ;) + if ($table_name == ($prefix . 'posts') && $drop_index) + { + echo "ALTER TABLE $table_name ADD FULLTEXT (post_subject), ADD FULLTEXT (post_text), ADD FULLTEXT post_content (post_subject, post_text){$newline}"; + } } /** From ee65d2147b7e672c6dfdcd695f0b6314c40e42d2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 5 Aug 2009 15:28:46 +0000 Subject: [PATCH 398/607] fix r9713 for #36565 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9931 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 1 + phpBB/includes/search/fulltext_mysql.php | 6 ++---- phpBB/includes/search/fulltext_native.php | 6 ++---- phpBB/install/database_update.php | 3 +++ phpBB/install/schemas/firebird_schema.sql | 1 + phpBB/install/schemas/mssql_schema.sql | 3 +++ phpBB/install/schemas/mysql_40_schema.sql | 1 + phpBB/install/schemas/mysql_41_schema.sql | 1 + phpBB/install/schemas/oracle_schema.sql | 2 ++ phpBB/install/schemas/postgres_schema.sql | 1 + phpBB/install/schemas/sqlite_schema.sql | 1 + 11 files changed, 18 insertions(+), 8 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index da84a6029e..d8c34d0d76 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1305,6 +1305,7 @@ function get_schema_struct() 'poster_ip' => array('INDEX', 'poster_ip'), 'poster_id' => array('INDEX', 'poster_id'), 'post_approved' => array('INDEX', 'post_approved'), + 'post_username' => array('INDEX', 'post_username'), 'tid_post_time' => array('INDEX', array('topic_id', 'post_time')), ), ); diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 456a11f24e..f9efa2bcb5 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -444,8 +444,7 @@ class fulltext_mysql extends search_backend if (sizeof($author_ary) && $author_name) { // first one matches post of registered users, second one guests and deleted users - $sql_author = ' AND (' . $db->sql_in_set('p.poster_id', $author_ary) . " AND p.post_username = ''"; - $sql_author .= ' OR p.poster_id = ' . ANONYMOUS . ' AND p.post_username ' . $author_name . ')'; + $sql_author = '(' . $db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; } else if (sizeof($author_ary)) { @@ -553,8 +552,7 @@ class fulltext_mysql extends search_backend if ($author_name) { // first one matches post of registered users, second one guests and deleted users - $sql_author = '(' . $db->sql_in_set('p.poster_id', $author_ary) . " AND p.post_username = ''"; - $sql_author .= ' OR p.poster_id = ' . ANONYMOUS . ' AND p.post_username ' . $author_name . ')'; + $sql_author = '(' . $db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; } else { diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 513a16bc58..5af3929ccd 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -628,8 +628,7 @@ class fulltext_native extends search_backend if ($author_name) { // first one matches post of registered users, second one guests and deleted users - $sql_author = '(' . $db->sql_in_set('p.poster_id', $author_ary) . " AND p.post_username = ''"; - $sql_author .= ' OR p.poster_id = ' . ANONYMOUS . ' AND p.post_username ' . $author_name . ')'; + $sql_author = '(' . $db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; } else { @@ -840,8 +839,7 @@ class fulltext_native extends search_backend if ($author_name) { // first one matches post of registered users, second one guests and deleted users - $sql_author = '(' . $db->sql_in_set('p.poster_id', $author_ary) . " AND p.post_username = ''"; - $sql_author .= ' OR p.poster_id = ' . ANONYMOUS . ' AND p.post_username ' . $author_name . ')'; + $sql_author = '(' . $db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; } else { diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index e692750659..4380f0cb8c 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -721,6 +721,9 @@ function database_update_info() 'post_id' => array('post_id'), 'pm_id' => array('pm_id'), ), + POSTS_TABLE => array( + 'post_username' => array('post_username'), + ), ), ), ); diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index a059dd6e2b..1e8b850645 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -650,6 +650,7 @@ CREATE INDEX phpbb_posts_topic_id ON phpbb_posts(topic_id);; CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts(poster_ip);; CREATE INDEX phpbb_posts_poster_id ON phpbb_posts(poster_id);; CREATE INDEX phpbb_posts_post_approved ON phpbb_posts(post_approved);; +CREATE INDEX phpbb_posts_post_username ON phpbb_posts(post_username);; CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts(topic_id, post_time);; CREATE GENERATOR phpbb_posts_gen;; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index b6f85c907e..3c96299571 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -803,6 +803,9 @@ GO CREATE INDEX [post_approved] ON [phpbb_posts]([post_approved]) ON [PRIMARY] GO +CREATE INDEX [post_username] ON [phpbb_posts]([post_username]) ON [PRIMARY] +GO + CREATE INDEX [tid_post_time] ON [phpbb_posts]([topic_id], [post_time]) ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 7b506f5a75..9a090f0936 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -459,6 +459,7 @@ CREATE TABLE phpbb_posts ( KEY poster_ip (poster_ip), KEY poster_id (poster_id), KEY post_approved (post_approved), + KEY post_username (post_username(255)), KEY tid_post_time (topic_id, post_time) ); diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 651a842f8f..1c0225b92c 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -459,6 +459,7 @@ CREATE TABLE phpbb_posts ( KEY poster_ip (poster_ip), KEY poster_id (poster_id), KEY post_approved (post_approved), + KEY post_username (post_username), KEY tid_post_time (topic_id, post_time) ) CHARACTER SET `utf8` COLLATE `utf8_bin`; diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index df707db3c5..c802bcedff 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -879,6 +879,8 @@ CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id) / CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved) / +CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username) +/ CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time) / diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 66bd206928..aeb3265b81 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -630,6 +630,7 @@ CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id); CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip); CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id); CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved); +CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username); CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time); /* diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 4741baf559..e201f8de64 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -447,6 +447,7 @@ CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id); CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip); CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id); CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved); +CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username); CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time); # Table: 'phpbb_privmsgs' From a7509b226a2561b77297b54a1c9391f9fd68d61c Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Thu, 6 Aug 2009 05:17:25 +0000 Subject: [PATCH 399/607] #36475 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9932 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/install.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index ed8e4f3c20..f55468363c 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -560,15 +560,15 @@ $lang = array_merge($lang, array( 'USER_ACTIVE' => 'Active user', 'USER_INACTIVE' => 'Inactive user', - 'VERSION_CHECK' => 'Version check', - 'VERSION_CHECK_EXPLAIN' => 'Checks to see if the version of phpBB you are currently running is up to date.', - 'VERSION_NOT_UP_TO_DATE' => 'Your version of phpBB is not up to date. Please continue the update process.', - 'VERSION_NOT_UP_TO_DATE_ACP'=> 'Your version of phpBB is not up to date.
    Below you will find a link to the release announcement for the latest version as well as instructions on how to perform the update.', - 'VERSION_NOT_UP_TO_DATE_TITLE' => 'Your version of phpBB is not up to date.', - 'VERSION_UP_TO_DATE' => 'Your installation is up to date, no updates are available for your version of phpBB. You may want to continue anyway to perform a file validity check.', - 'VERSION_UP_TO_DATE_ACP' => 'Your installation is up to date, no updates are available for your version of phpBB. You do not need to update your installation.', - 'VIEWING_FILE_CONTENTS' => 'Viewing file contents', - 'VIEWING_FILE_DIFF' => 'Viewing file differences', + 'VERSION_CHECK' => 'Version check', + 'VERSION_CHECK_EXPLAIN' => 'Checks to see if your phpBB installation is up to date.', + 'VERSION_NOT_UP_TO_DATE' => 'Your phpBB installation is not up to date. Please continue the update process.', + 'VERSION_NOT_UP_TO_DATE_ACP' => 'Your phpBB installation is not up to date.
    Below is a link to the release announcement, which contains more information as well as instructions on updating.', + 'VERSION_NOT_UP_TO_DATE_TITLE' => 'Your phpBB installation is not up to date.', + 'VERSION_UP_TO_DATE' => 'Your phpBB installation is up to date. Although there are no updates available at this time, you may continue in order to perform a file validity check.', + 'VERSION_UP_TO_DATE_ACP' => 'Your phpBB installation is up to date. There are no updates available at this time.', + 'VIEWING_FILE_CONTENTS' => 'Viewing file contents', + 'VIEWING_FILE_DIFF' => 'Viewing file differences', 'WRONG_INFO_FILE_FORMAT' => 'Wrong info file format', )); From 380b11fe2249f48352d63297119465b6081b1268 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Thu, 6 Aug 2009 09:12:21 +0000 Subject: [PATCH 400/607] More language changes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9933 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/prune.php | 4 ++-- phpBB/language/en/captcha_qa.php | 14 +++++++------- phpBB/language/en/captcha_recaptcha.php | 2 +- phpBB/language/en/email/admin_welcome_inactive.txt | 4 ++-- phpBB/language/en/email/coppa_resend_inactive.txt | 8 ++++---- phpBB/language/en/email/coppa_welcome_inactive.txt | 8 ++++---- phpBB/language/en/email/installed.txt | 6 +++--- phpBB/language/en/email/pm_report_closed.txt | 2 +- phpBB/language/en/email/pm_report_deleted.txt | 2 +- .../language/en/email/user_reactivate_account.txt | 2 +- phpBB/language/en/email/user_remind_inactive.txt | 2 +- phpBB/language/en/email/user_resend_inactive.txt | 4 ++-- phpBB/language/en/email/user_welcome.txt | 2 +- phpBB/language/en/email/user_welcome_inactive.txt | 4 ++-- phpBB/language/en/install.php | 8 ++++---- phpBB/language/en/memberlist.php | 2 +- 16 files changed, 37 insertions(+), 37 deletions(-) diff --git a/phpBB/language/en/acp/prune.php b/phpBB/language/en/acp/prune.php index 5e313d20e2..8a06225102 100644 --- a/phpBB/language/en/acp/prune.php +++ b/phpBB/language/en/acp/prune.php @@ -37,10 +37,10 @@ if (empty($lang) || !is_array($lang)) // User pruning $lang = array_merge($lang, array( - 'ACP_PRUNE_USERS_EXPLAIN' => 'Here you can delete (or deactivate) users from your board. This can be done in a variety of ways; by post count, last activity, etc. Each of these criteria can be combined, i.e. you can prune users last active before 2002-01-01 with fewer than 10 posts. Alternatively you can enter a list of users directly into the text box, each on a separate line - any criteria entered will be ignored. Take care with this facility! Once a user is deleted there is no way back.', + 'ACP_PRUNE_USERS_EXPLAIN' => 'This section allows you to delete or deactivate users on your board. Accounts can be filtered in a variety of ways; by post count, most recent activity, etc. Criteria may be combined to narrow down which accounts are affected. For example, you can prune users with fewer than 10 posts, who were also inactive after 2002-01-01. Alternatively, you may skip the criteria selection completely by entering a list of users (each on a separate line) into the text field. Take care with this facility! Once a user is deleted, there is no way to reverse the action.', 'DEACTIVATE_DELETE' => 'Deactivate or delete', - 'DEACTIVATE_DELETE_EXPLAIN' => 'Choose whether to deactivate users or delete them entirely, note there is no undo!', + 'DEACTIVATE_DELETE_EXPLAIN' => 'Choose whether to deactivate users or delete them entirely. Please note that deleted users cannot be restored!', 'DELETE_USERS' => 'Delete', 'DELETE_USER_POSTS' => 'Delete pruned user posts', 'DELETE_USER_POSTS_EXPLAIN' => 'Removes posts made by deleted users, has no effect if users are deactivated.', diff --git a/phpBB/language/en/captcha_qa.php b/phpBB/language/en/captcha_qa.php index b07438f2bb..ef09f65951 100644 --- a/phpBB/language/en/captcha_qa.php +++ b/phpBB/language/en/captcha_qa.php @@ -37,27 +37,27 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'CAPTCHA_QA' => 'Q&A CAPTCHA', - 'CONFIRM_QUESTION_EXPLAIN' => 'Please answer this question to avoid automated registrations.', - 'CONFIRM_QUESTION_WRONG' => 'The answer to the confirmation question was not recognized.', + 'CONFIRM_QUESTION_EXPLAIN' => 'The following question is a means of identifying and preventing automated submissions.', + 'CONFIRM_QUESTION_WRONG' => 'You have provided an invalid answer to the confirmation question.', 'QUESTION_ANSWERS' => 'Answers', - 'ANSWERS_EXPLAIN' => 'The Answers. Please write one answer per line.', + 'ANSWERS_EXPLAIN' => 'Please enter valid answers to the question, one per line.', 'CONFIRM_QUESTION' => 'Question', 'ANSWER' => 'Answer', 'EDIT_QUESTION' => 'Edit Question', 'QUESTIONS' => 'Questions', - 'QUESTIONS_EXPLAIN' => 'Here you can add and edit questions to be asked on registration. You have to provide at least one question in the default board language to use this plugin. Questions should be easy for your target audience, but beyond the ability of Google™. Also, remember to change the questions regularly. If your question relies on punctuation, spelling or capitalisation, use the strict setting.', + 'QUESTIONS_EXPLAIN' => 'During registration, users will be asked one of the questions specified here. To use this plugin, at least one question must be set in the default language. These questions should be easy for your target audience to answer, but beyond the ability of a bot capable of running a Google™ search. Using a large and regulary changed set of questions will yield the best results. Enable the strict setting if your question relies on punctuation or capitalisation.', 'QUESTION_DELETED' => 'Question deleted', 'QUESTION_LANG' => 'Language', - 'QUESTION_LANG_EXPLAIN' => 'The language this question and its answers is written in.', + 'QUESTION_LANG_EXPLAIN' => 'The language that this question and its answers are written in.', 'QUESTION_STRICT' => 'Strict check', - 'QUESTION_STRICT_EXPLAIN' => 'If enabled, the check also recognizes capitalization and whitespaces.', + 'QUESTION_STRICT_EXPLAIN' => 'If enabled, capitalisation and whitespace will also be enforced.', 'QUESTION_TEXT' => 'Question', 'QUESTION_TEXT_EXPLAIN' => 'The question that will be asked on registration.', - 'QA_ERROR_MSG' => 'Please fill out all fields and enter at least one answer.', + 'QA_ERROR_MSG' => 'Please fill in all fields and enter at least one answer.', )); ?> \ No newline at end of file diff --git a/phpBB/language/en/captcha_recaptcha.php b/phpBB/language/en/captcha_recaptcha.php index e2d20ac4eb..897e8a4979 100644 --- a/phpBB/language/en/captcha_recaptcha.php +++ b/phpBB/language/en/captcha_recaptcha.php @@ -46,7 +46,7 @@ $lang = array_merge($lang, array( 'RECAPTCHA_PRIVATE' => 'Private reCaptcha key', 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. Keys can be obtained on reCaptcha.net.', - 'RECAPTCHA_EXPLAIN' => 'Please enter both of the words displayed below into the text field underneath. This is a measure taken to prevent spam.', + 'RECAPTCHA_EXPLAIN' => 'In an effort to prevent automatic submissions, we require that you enter both of the words displayed below into the text field underneath.', )); ?> \ No newline at end of file diff --git a/phpBB/language/en/email/admin_welcome_inactive.txt b/phpBB/language/en/email/admin_welcome_inactive.txt index f962b8a99c..af3ac9ca87 100644 --- a/phpBB/language/en/email/admin_welcome_inactive.txt +++ b/phpBB/language/en/email/admin_welcome_inactive.txt @@ -10,9 +10,9 @@ Username: {USERNAME} Board URL: {U_BOARD} ---------------------------- -Your account is currently inactive, the administrator of the board will need to activate it before you can log in. You will receive another e-mail when this has occurred. +Your account is currently inactive and will need to be approved by an administrator before you can log in. Another email will be sent when this had occured. -Please do not forget your password as it has been encrypted in our database and we cannot retrieve it for you. However, should you forget your password you can request a new one which will be activated in the same way as this account. +Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account. Thank you for registering. diff --git a/phpBB/language/en/email/coppa_resend_inactive.txt b/phpBB/language/en/email/coppa_resend_inactive.txt index 9d43ca4f85..c3e4af576d 100644 --- a/phpBB/language/en/email/coppa_resend_inactive.txt +++ b/phpBB/language/en/email/coppa_resend_inactive.txt @@ -2,9 +2,9 @@ Subject: Welcome to "{SITENAME}" {WELCOME_MSG} -In compliance with the COPPA your account is currently inactive. +In compliance with the COPPA, your account is currently inactive. -Please print this message out and have your parent or guardian sign and date it. Then fax it to: +Please print this message and have your parent or guardian sign and date it. Then fax it to: {FAX_INFO} @@ -33,9 +33,9 @@ Date: _______________ ------------------------------ CUT HERE ------------------------------ -Once the administrator has received the above form via fax or regular mail your account will be activated. +Once the administrator has received the above form via fax or regular mail, your account will be activated. -Please do not forget your password as it has been encrypted in our database and we cannot retrieve it for you. However, should you forget your password you can request a new one which will be activated in the same way as this account. +Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account. Thank you for registering. diff --git a/phpBB/language/en/email/coppa_welcome_inactive.txt b/phpBB/language/en/email/coppa_welcome_inactive.txt index 9d43ca4f85..c3e4af576d 100644 --- a/phpBB/language/en/email/coppa_welcome_inactive.txt +++ b/phpBB/language/en/email/coppa_welcome_inactive.txt @@ -2,9 +2,9 @@ Subject: Welcome to "{SITENAME}" {WELCOME_MSG} -In compliance with the COPPA your account is currently inactive. +In compliance with the COPPA, your account is currently inactive. -Please print this message out and have your parent or guardian sign and date it. Then fax it to: +Please print this message and have your parent or guardian sign and date it. Then fax it to: {FAX_INFO} @@ -33,9 +33,9 @@ Date: _______________ ------------------------------ CUT HERE ------------------------------ -Once the administrator has received the above form via fax or regular mail your account will be activated. +Once the administrator has received the above form via fax or regular mail, your account will be activated. -Please do not forget your password as it has been encrypted in our database and we cannot retrieve it for you. However, should you forget your password you can request a new one which will be activated in the same way as this account. +Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account. Thank you for registering. diff --git a/phpBB/language/en/email/installed.txt b/phpBB/language/en/email/installed.txt index 72b3d8edeb..2aa03a7f33 100644 --- a/phpBB/language/en/email/installed.txt +++ b/phpBB/language/en/email/installed.txt @@ -4,7 +4,7 @@ Congratulations, You have successfully installed phpBB on your server. -This e-mail contains important information on your installation that you should keep safe. The password has been encrypted in the database and cannot be recovered, although you can request a new password should you lose this one. +This e-mail contains important information regarding your installation and should be kept for reference. Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account. ---------------------------- Username: {USERNAME} @@ -12,8 +12,8 @@ Username: {USERNAME} Board URL: {U_BOARD} ---------------------------- -Useful information on your phpBB installation can be found in the docs folder of your installation and on phpBB.com's support page - http://www.phpbb.com/support/ +Useful information regarding the phpBB software can be found in the docs folder of your installation and on phpBB.com's support page - http://www.phpbb.com/support/ -In order to keep the board safe and secure, it is highly recommended that you keep current with software releases which can be easily done by subscribing to phpBB.com's mailing list, located at the above URL. +In order to keep your board safe and secure, we highly recommended keeping current with software releases. For your convenience, a mailing list is available at the page referenced above. {EMAIL_SIG} \ No newline at end of file diff --git a/phpBB/language/en/email/pm_report_closed.txt b/phpBB/language/en/email/pm_report_closed.txt index 752a640867..1b9f4a6658 100644 --- a/phpBB/language/en/email/pm_report_closed.txt +++ b/phpBB/language/en/email/pm_report_closed.txt @@ -2,7 +2,7 @@ Subject: Report closed - "{PM_SUBJECT}" Hello {USERNAME}, -You are receiving this notification because the report you filed on the private message "{PM_SUBJECT}" at "{SITENAME}" was handled by a moderator or by an administrator. The report was afterwards closed. If you have further questions contact {CLOSER_NAME} with a personal message. +You are receiving this notification because the report you filed regarding the private message "{PM_SUBJECT}" at "{SITENAME}" has been tended to by a moderator or administrator. The report is now closed. If you have further questions, please contact {CLOSER_NAME} by private message. {EMAIL_SIG} \ No newline at end of file diff --git a/phpBB/language/en/email/pm_report_deleted.txt b/phpBB/language/en/email/pm_report_deleted.txt index 04e4bd1404..8cb7fdd6fa 100644 --- a/phpBB/language/en/email/pm_report_deleted.txt +++ b/phpBB/language/en/email/pm_report_deleted.txt @@ -2,7 +2,7 @@ Subject: Report deleted - "{PM_SUBJECT}" Hello {USERNAME}, -You are receiving this notification because the report you filed on the post "{PM_SUBJECT}" at "{SITENAME}" was deleted by a moderator or by an administrator. +You are receiving this notification because the report you filed regarding the post "{PM_SUBJECT}" at "{SITENAME}" was deleted by a moderator or administrator. {EMAIL_SIG} \ No newline at end of file diff --git a/phpBB/language/en/email/user_reactivate_account.txt b/phpBB/language/en/email/user_reactivate_account.txt index b5639d0b7a..4ef7dd899a 100644 --- a/phpBB/language/en/email/user_reactivate_account.txt +++ b/phpBB/language/en/email/user_reactivate_account.txt @@ -9,7 +9,7 @@ Please keep this e-mail for your records. Your account information is as follows Username: {USERNAME} ---------------------------- -Your password has been encrypted in our database. Should you forget your password you can request a new one which will be activated in the same way as this account. +Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account. Please visit the following link to reactivate your account: diff --git a/phpBB/language/en/email/user_remind_inactive.txt b/phpBB/language/en/email/user_remind_inactive.txt index 49dea02044..1ba28329f6 100644 --- a/phpBB/language/en/email/user_remind_inactive.txt +++ b/phpBB/language/en/email/user_remind_inactive.txt @@ -2,7 +2,7 @@ Subject: Inactive account reminder Hello {USERNAME}, -On {REGISTER_DATE} you registered a new account at "{SITENAME}". To date you have not activated this account which is a prerequisite for board login. For your convenience the activation link is repeated below. +This notification is a reminder that your account at "{SITENAME}", created on {REGISTER_DATE}, remains inactive. If you would like to activate this account, please visit the following link: {U_ACTIVATE} diff --git a/phpBB/language/en/email/user_resend_inactive.txt b/phpBB/language/en/email/user_resend_inactive.txt index 5635801b80..4638d6df63 100644 --- a/phpBB/language/en/email/user_resend_inactive.txt +++ b/phpBB/language/en/email/user_resend_inactive.txt @@ -8,9 +8,9 @@ Please keep this e-mail for your records. Your account information is as follows Username: {USERNAME} ---------------------------- -Your password has been encrypted in our database. Should you forget your password you can request a new one which will be activated in the same way as this account. +Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account. -Your account is currently inactive. You cannot use it until you visit the following link: +Please visit the following link in order to activate your account: {U_ACTIVATE} diff --git a/phpBB/language/en/email/user_welcome.txt b/phpBB/language/en/email/user_welcome.txt index ebe42d8f91..2648769dfd 100644 --- a/phpBB/language/en/email/user_welcome.txt +++ b/phpBB/language/en/email/user_welcome.txt @@ -10,7 +10,7 @@ Username: {USERNAME} Board URL: {U_BOARD} ---------------------------- -Please do not forget your password as it has been encrypted in our database and we cannot retrieve it for you. However, should you forget your password you can request a new one which will be activated in the same way as this account. +Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account. Thank you for registering. diff --git a/phpBB/language/en/email/user_welcome_inactive.txt b/phpBB/language/en/email/user_welcome_inactive.txt index 80ad1b8abd..1b72b1c5a8 100644 --- a/phpBB/language/en/email/user_welcome_inactive.txt +++ b/phpBB/language/en/email/user_welcome_inactive.txt @@ -10,11 +10,11 @@ Username: {USERNAME} Board URL: {U_BOARD} ---------------------------- -Your account is currently inactive. You cannot use it until you visit the following link: +Please visit the following link in order to activate your account: {U_ACTIVATE} -Please do not forget your password as it has been encrypted in our database and we cannot retrieve it for you. However, should you forget your password you can request a new one which will be activated in the same way as this account. +Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account. Thank you for registering. diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index f55468363c..536d0b5bc7 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -133,7 +133,7 @@ $lang = array_merge($lang, array( 'DB_PASSWORD' => 'Database password', 'DB_PORT' => 'Database server port', 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', - 'DB_UPDATE_NOT_SUPPORTED' => 'Sorry, but you are not able to update your phpBB database with this script. This update script updates the phpBB database from at least version “%1$s”, but your version is “%2$s”. Please try to update to an older version of phpBB first or post within our support forums to get more help.', + 'DB_UPDATE_NOT_SUPPORTED' => 'We are sorry, but this script does not support updating from versions of phpBB prior to “%1$s”. The version you currently have installed is “%2$s”. Please update to a previous version before running this script. Assistance with this is available in the Support Forum on phpBB.com.', 'DB_USERNAME' => 'Database username', 'DB_TEST' => 'Test connection', 'DEFAULT_LANG' => 'Default board language', @@ -185,11 +185,11 @@ $lang = array_merge($lang, array( 'INITIAL_CONFIG_EXPLAIN' => 'Now that install has determined your server can run phpBB you need to supply some specific information. If you do not know how to connect to your database please contact your hosting provider (in the first instance) or use the phpBB support forums. When entering data please ensure you check it thoroughly before continuing.', 'INSTALL_CONGRATS' => 'Congratulations!', 'INSTALL_CONGRATS_EXPLAIN' => ' - You have now successfully installed phpBB %1$s. From here, you have two options as to what to do with your newly installed phpBB3:

    + You have successfully installed phpBB %1$s. Please proceed by choosing one of the following opions:

    Convert an existing board to phpBB3

    -

    The phpBB Unified Convertor Framework supports the conversion of phpBB 2.0.x and other board systems to phpBB3. If you have an existing board that you wish to convert, please proceed on to the convertor.

    +

    The phpBB Unified Convertor Framework supports the conversion of phpBB 2.0.x and other board systems to phpBB3. If you have an existing board that you wish to convert, please proceed to the convertor.

    Go live with your phpBB3!

    -

    Clicking the button below will take you to your Administration Control Panel (ACP). Take some time to examine the options available to you. Remember that help is available online via the Documentation and the support forums, see the README for further information.

    Please now delete, move or rename the install directory before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible.', +

    Clicking the button below will take you to your Administration Control Panel (ACP). Take some time to examine the options available to you. Remember that help is available online via the Documentation, README and the Support Forums.

    Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.', 'INSTALL_INTRO' => 'Welcome to Installation', 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

    In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

    diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index d6892eb31b..e7a9c6b88d 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -135,7 +135,7 @@ $lang = array_merge($lang, array( 'USER_BAN' => 'Banning', 'USER_FORUM' => 'User statistics', 'USER_LAST_REMINDED' => array( - 0 => 'No reminder sent yet', + 0 => 'No reminder sent at this time', 1 => '%1$d reminder sent
    » %2$s', ), 'USER_ONLINE' => 'Online', From d79c81449abfade601757bdd2963e513977e9500 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 6 Aug 2009 13:32:14 +0000 Subject: [PATCH 401/607] pm class is not supposed to be in there, also results in white background git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9934 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../styles/prosilver/template/ucp_profile_signature.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/styles/prosilver/template/ucp_profile_signature.html b/phpBB/styles/prosilver/template/ucp_profile_signature.html index dbaeac3254..5d25d2d9f4 100644 --- a/phpBB/styles/prosilver/template/ucp_profile_signature.html +++ b/phpBB/styles/prosilver/template/ucp_profile_signature.html @@ -8,7 +8,7 @@

    {L_SIGNATURE_PREVIEW}

    -
    +
    {SIGNATURE_PREVIEW}
    @@ -33,7 +33,7 @@
    - +
    @@ -41,8 +41,8 @@
    {S_HIDDEN_FIELDS} -   -   +   +   {S_FORM_TOKEN}
    From 8dcad17d1b938b04546254968c7a76ff39b8332d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 7 Aug 2009 12:10:34 +0000 Subject: [PATCH 402/607] Fix bug #49215 - Use $phpEx variable instead of hardcoded '.php' git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9935 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/install_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index ccbad07e5b..f73f741fae 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -1556,7 +1556,7 @@ class install_update extends module if ($info === false) { $update_info = array(); - include($phpbb_root_path . 'install/update/index.php'); + include($phpbb_root_path . 'install/update/index.' . $phpEx); $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info; if ($info !== false) @@ -1570,7 +1570,7 @@ class install_update extends module global $phpbb_root_path, $phpEx; $update_info = array(); - include($phpbb_root_path . 'install/update/index.php'); + include($phpbb_root_path . 'install/update/index.' . $phpEx); $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info; $errstr = ($info === false) ? $user->lang['WRONG_INFO_FILE_FORMAT'] : ''; From 090ab9bf0567734c951879b264744d16f41eceb3 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 7 Aug 2009 12:50:25 +0000 Subject: [PATCH 403/607] Bug #49215 again. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9936 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/install_convert.php | 4 ++-- phpBB/install/install_update.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 38bfe96fcd..7f1b9de5b6 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -1558,7 +1558,7 @@ class install_convert extends module */ function finish_conversion() { - global $db, $phpbb_root_path, $convert, $config, $language, $user, $template; + global $db, $phpbb_root_path, $phpEx, $convert, $config, $language, $user, $template; $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'convert_progress' @@ -1567,7 +1567,7 @@ class install_convert extends module OR config_name = 'convert_db_user'"); $db->sql_query('DELETE FROM ' . SESSIONS_TABLE); - @unlink($phpbb_root_path . 'cache/data_global.php'); + @unlink($phpbb_root_path . 'cache/data_global.' . $phpEx); cache_moderators(); // And finally, add a note to the log diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index f73f741fae..a809afd4c7 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -206,7 +206,7 @@ class install_update extends module if (in_array('language/en/install.php', $this->update_info['files'])) { $lang = array(); - include($this->new_location . 'language/en/install.php'); + include($this->new_location . 'language/en/install.' . $phpEx); // only add new keys to user's language in english $new_keys = array_diff(array_keys($lang), array_keys($user->lang)); foreach ($new_keys as $i => $new_key) From d2c818ffb9ab1081ebbf74d9895156d1805c237a Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 7 Aug 2009 13:02:14 +0000 Subject: [PATCH 404/607] add transactions to sync(); not one big one to avoid nesting. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9937 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_admin.php | 52 ++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 38388236eb..44675b9cc0 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1330,6 +1330,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, switch ($mode) { case 'topic_moved': + $db->sql_transaction('begin'); switch ($db->sql_layer) { case 'mysql4': @@ -1363,12 +1364,16 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sql = 'DELETE FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_id_ary); $db->sql_query($sql); - + break; } - break; + + $db->sql_transaction('commit'); + break; case 'topic_approved': + + $db->sql_transaction('begin'); switch ($db->sql_layer) { case 'mysql4': @@ -1404,11 +1409,15 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_query($sql); break; } - break; + + $db->sql_transaction('commit'); + break; case 'post_reported': $post_ids = $post_reported = array(); - + + $db->sql_transaction('begin'); + $sql = 'SELECT p.post_id, p.post_reported FROM ' . POSTS_TABLE . " p $where_sql @@ -1459,7 +1468,9 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, WHERE ' . $db->sql_in_set('post_id', $post_ids); $db->sql_query($sql); } - break; + + $db->sql_transaction('commit'); + break; case 'topic_reported': if ($sync_extra) @@ -1469,6 +1480,8 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $topic_ids = $topic_reported = array(); + $db->sql_transaction('begin'); + $sql = 'SELECT DISTINCT(t.topic_id) FROM ' . POSTS_TABLE . " t $where_sql_and t.post_reported = 1"; @@ -1501,11 +1514,15 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, WHERE ' . $db->sql_in_set('topic_id', $topic_ids); $db->sql_query($sql); } - break; + + $db->sql_transaction('commit'); + break; case 'post_attachment': $post_ids = $post_attachment = array(); + $db->sql_transaction('begin'); + $sql = 'SELECT p.post_id, p.post_attachment FROM ' . POSTS_TABLE . " p $where_sql @@ -1556,7 +1573,9 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, WHERE ' . $db->sql_in_set('post_id', $post_ids); $db->sql_query($sql); } - break; + + $db->sql_transaction('commit'); + break; case 'topic_attachment': if ($sync_extra) @@ -1566,6 +1585,8 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $topic_ids = $topic_attachment = array(); + $db->sql_transaction('begin'); + $sql = 'SELECT DISTINCT(t.topic_id) FROM ' . POSTS_TABLE . " t $where_sql_and t.post_attachment = 1"; @@ -1598,10 +1619,15 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, WHERE ' . $db->sql_in_set('topic_id', $topic_ids); $db->sql_query($sql); } - break; + + $db->sql_transaction('commit'); + + break; case 'forum': + $db->sql_transaction('begin'); + // 1: Get the list of all forums $sql = 'SELECT f.* FROM ' . FORUMS_TABLE . " f @@ -1802,11 +1828,15 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_query($sql); } } - break; + + $db->sql_transaction('commit'); + break; case 'topic': $topic_data = $post_ids = $approved_unapproved_ids = $resync_forums = $delete_topics = $delete_posts = $moved_topics = array(); + $db->sql_transaction('begin'); + $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_approved, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_replies, t.topic_replies_real, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time FROM ' . TOPICS_TABLE . " t $where_sql"; @@ -2129,6 +2159,8 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } unset($topic_data); + $db->sql_transaction('commit'); + // if some topics have been resync'ed then resync parent forums // except when we're only syncing a range, we don't want to sync forums during // batch processing. @@ -2136,7 +2168,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, { sync('forum', 'forum_id', array_values($resync_forums), true, true); } - break; + break; } return; From af6704700855e732dd811de4e8d6730d43a7c392 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 7 Aug 2009 13:53:17 +0000 Subject: [PATCH 405/607] Remove some left over code introduced in r9575, reverted in r9704. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9938 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_board.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 3a2ad6f89a..7bc94d685e 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -450,13 +450,6 @@ class acp_board continue; } - // If not set, then this is a valid entry and needs to be emptied (select_multiple, checkbox) - if (!isset($cfg_array[$config_name])) - { - $cfg_array[$config_name] = ''; - } - - // Erm, we spotted an array if ($null['type'] == 'select_multiple' && $submit && isset($_REQUEST['config'][$config_name])) { From 04263dfa312f7daab82ab629477d785253af896a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 7 Aug 2009 14:31:24 +0000 Subject: [PATCH 406/607] Coding guidelines: Tiny whitespace change for an unreleased file. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9939 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/captcha_abstract.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index ceb9c4f9fb..72f343d6b8 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -100,8 +100,8 @@ class phpbb_default_captcha $template->assign_vars(array( 'CONFIRM_IMAGE_LINK' => $link, - 'CONFIRM_IMAGE' => '', - 'CONFIRM_IMG' => '', + 'CONFIRM_IMAGE' => '', + 'CONFIRM_IMG' => '', 'CONFIRM_ID' => $this->confirm_id, 'S_CONFIRM_CODE' => true, 'S_TYPE' => $this->type, From bc8e507c64a576eef209c5a72cf2965d56d6016a Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 7 Aug 2009 15:37:27 +0000 Subject: [PATCH 407/607] include vs include_once git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9940 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php | 2 +- phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php | 2 +- phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php index ce678b6d29..5021045785 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ if (!class_exists('captcha_abstract')) { - include_once($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); + include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); } /** diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php index 1fc859532a..ac30ed4297 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ if (!class_exists('phpbb_default_captcha')) { - include_once($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); + include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); } /** diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index 3ad58851b4..b7b3ab07d3 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) if (!class_exists('phpbb_default_captcha')) { // we need the classic captcha code for tracking solutions and attempts - include_once($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); + include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); } /** From d5c6d1d434555167f9d7adfdd3805e92e5bc266c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 10 Aug 2009 09:13:28 +0000 Subject: [PATCH 408/607] reverted all changes made to this code block, especially the one mentioned in r9704 with reference to wrong bug report "undoing change from #9575, as it broke the board disabled message". The board disabled message still works fine. If there are any problems with the code and settings within the ACP, please tell me and i will check them. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9941 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_board.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 7bc94d685e..ea0de2ef30 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -440,7 +440,7 @@ class acp_board // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... foreach ($display_vars['vars'] as $config_name => $null) { - if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) + if ($null === false || strpos($config_name, 'legend') !== false) { continue; } @@ -450,6 +450,12 @@ class acp_board continue; } + // If not set, then this is a valid entry and needs to be emptied (select_multiple, checkbox) + if (!isset($cfg_array[$config_name])) + { + $cfg_array[$config_name] = ''; + } + // Erm, we spotted an array if ($null['type'] == 'select_multiple' && $submit && isset($_REQUEST['config'][$config_name])) { From 2547955b619e009df9c9ee4b8be2cc7c6da14630 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 10 Aug 2009 09:46:38 +0000 Subject: [PATCH 409/607] class name git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9942 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php index 5021045785..2f55d15efd 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) /** * Placeholder for autoload */ -if (!class_exists('captcha_abstract')) +if (!class_exists('phpbb_default_captcha')) { include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); } From d327154a5a5e9360b8ef5407da56e46a6629b26f Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 10 Aug 2009 11:14:21 +0000 Subject: [PATCH 410/607] ok, r9704 was correct - i used a wrong code base within my tests. :/ git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9943 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_board.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index ea0de2ef30..7bc94d685e 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -440,7 +440,7 @@ class acp_board // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... foreach ($display_vars['vars'] as $config_name => $null) { - if ($null === false || strpos($config_name, 'legend') !== false) + if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) { continue; } @@ -450,12 +450,6 @@ class acp_board continue; } - // If not set, then this is a valid entry and needs to be emptied (select_multiple, checkbox) - if (!isset($cfg_array[$config_name])) - { - $cfg_array[$config_name] = ''; - } - // Erm, we spotted an array if ($null['type'] == 'select_multiple' && $submit && isset($_REQUEST['config'][$config_name])) { From dea4eb6a0bbe04cc6fdf354a0564e449547064ff Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 10 Aug 2009 11:17:24 +0000 Subject: [PATCH 411/607] check for not set values in acp_board to correctly grab those input elements not populated if empty (checkboxes and multiple select fields) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9944 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_board.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 7bc94d685e..bd97c29f02 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -440,7 +440,7 @@ class acp_board // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... foreach ($display_vars['vars'] as $config_name => $null) { - if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) + if (strpos($config_name, 'legend') !== false) { continue; } @@ -450,6 +450,12 @@ class acp_board continue; } + // It could happen that the cfg array is not set. This happens within feed settings if unselecting all forums in the multiple select fields for example (it is the same as checkbox handling) + if (!isset($cfg_array[$config_name])) + { + $cfg_array[$config_name] = ''; + } + // Erm, we spotted an array if ($null['type'] == 'select_multiple' && $submit && isset($_REQUEST['config'][$config_name])) { From 2a276bf7de0f2fa9baeeb20bd78bf5a2dc73c5da Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 10 Aug 2009 11:52:10 +0000 Subject: [PATCH 412/607] #49345 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9945 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/captcha_qa.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/captcha_qa.html b/phpBB/styles/prosilver/template/captcha_qa.html index 375ae401a4..9de9bb8dc7 100644 --- a/phpBB/styles/prosilver/template/captcha_qa.html +++ b/phpBB/styles/prosilver/template/captcha_qa.html @@ -10,7 +10,7 @@
    :
    {L_CONFIRM_QUESTION_EXPLAIN}
    - +
    From 3036fbc66fc57ce520c6c5db4f4195370f874e1f Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Mon, 10 Aug 2009 12:07:01 +0000 Subject: [PATCH 413/607] Fix bug #47705 - Out of range value for column 'topic_replies_real' Authorised by: Kellanved git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9946 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/mcp/mcp_queue.php | 123 +++++++++++-------------------- 2 files changed, 46 insertions(+), 78 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 17d192d88b..41639161be 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -168,6 +168,7 @@
  • [Fix] Allow changing forum from select box under certain circumstances. (Bug #37525)
  • [Fix] Display required fields notice on registration above the custom profile fields. (Bug #39665)
  • [Fix] Copy poll options properly when copying topic. (Bug #39065)
  • +
  • [Fix] Fix error with disapproval of topics having several queued posts only. (Bug #47705 - Patch by rxu)
  • [Fix] Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags)
  • [Fix] Be less strict with FTP daemons when getting directory filelists. (Bug #46295)
  • [Fix] Fix set_custom_template for database-stored styles (Bug #40515 - Patch by nickvergessen)
  • diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 6209a27bf7..9b318379f1 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -859,89 +859,63 @@ function disapprove_post($post_id_list, $id, $mode) if (confirm_box(true)) { + $disapprove_log = $disapprove_log_topics = $disapprove_log_posts = array(); + $topic_replies_real = $post_disapprove_list = array(); - // If Topic -> forum_topics_real -= 1 - // If Post -> topic_replies_real -= 1 - - $num_disapproved = 0; - $forum_topics_real = $topic_id_list = $forum_id_list = $topic_replies_real_sql = $post_disapprove_sql = $disapprove_log = array(); - + // Build a list of posts to be unapproved and get the related topics real replies count foreach ($post_info as $post_id => $post_data) { - $topic_id_list[$post_data['topic_id']] = 1; - - if ($post_data['forum_id']) + $post_disapprove_list[$post_id] = $post_data['topic_id']; + if (!isset($topic_replies_real[$post_data['topic_id']])) { - $forum_id_list[$post_data['forum_id']] = 1; + $topic_replies_real[$post_data['topic_id']] = $post_data['topic_replies_real']; } + } - // Topic or Post. ;) - /** - * @todo this probably is a different method than the one used by delete_posts, does this cause counter inconsistency? - */ - if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_last_post_id'] == $post_id) + // Now we build the log array + foreach ($post_disapprove_list as $post_id => $topic_id) + { + // If the count of disapproved posts for the topic is greater + // than topic's real replies count, the whole topic is disapproved/deleted + if (sizeof(array_keys($post_disapprove_list, $topic_id)) > $topic_replies_real[$topic_id]) { - if ($post_data['forum_id']) + // Don't write the log more than once for every topic + if (!isset($disapprove_log_topics[$topic_id])) { - if (!isset($forum_topics_real[$post_data['forum_id']])) - { - $forum_topics_real[$post_data['forum_id']] = 0; - } - $forum_topics_real[$post_data['forum_id']]++; - $num_disapproved++; + // Build disapproved topics log + $disapprove_log_topics[$topic_id] = array( + 'type' => 'topic', + 'post_subject' => $post_info[$post_id]['topic_title'], + 'forum_id' => $post_info[$post_id]['forum_id'], + 'topic_id' => 0, // useless to log a topic id, as it will be deleted + ); } - - $disapprove_log[] = array( - 'type' => 'topic', - 'post_subject' => $post_data['post_subject'], - 'forum_id' => $post_data['forum_id'], - 'topic_id' => 0, // useless to log a topic id, as it will be deleted - ); } else { - if (!isset($topic_replies_real_sql[$post_data['topic_id']])) - { - $topic_replies_real_sql[$post_data['topic_id']] = 0; - } - $topic_replies_real_sql[$post_data['topic_id']]++; - - $disapprove_log[] = array( + // Build disapproved posts log + $disapprove_log_posts[] = array( 'type' => 'post', - 'post_subject' => $post_data['post_subject'], - 'forum_id' => $post_data['forum_id'], - 'topic_id' => $post_data['topic_id'], - ); - } + 'post_subject' => $post_info[$post_id]['post_subject'], + 'forum_id' => $post_info[$post_id]['forum_id'], + 'topic_id' => $post_info[$post_id]['topic_id'], + ); - $post_disapprove_sql[] = $post_id; - } - - unset($post_data); - - if (sizeof($forum_topics_real)) - { - foreach ($forum_topics_real as $forum_id => $topics_real) - { - $sql = 'UPDATE ' . FORUMS_TABLE . " - SET forum_topics_real = forum_topics_real - $topics_real - WHERE forum_id = $forum_id"; - $db->sql_query($sql); } } - if (sizeof($topic_replies_real_sql)) - { - foreach ($topic_replies_real_sql as $topic_id => $num_replies) - { - $sql = 'UPDATE ' . TOPICS_TABLE . " - SET topic_replies_real = topic_replies_real - $num_replies - WHERE topic_id = $topic_id"; - $db->sql_query($sql); - } - } + // Get disapproved posts/topics counts separately + $num_disapproved_topics = sizeof($disapprove_log_topics); + $num_disapproved_posts = sizeof($disapprove_log_posts); - if (sizeof($post_disapprove_sql)) + // Build the whole log + $disapprove_log = array_merge($disapprove_log_topics, $disapprove_log_posts); + + // Unset unneeded arrays + unset($post_data, $disapprove_log_topics, $disapprove_log_posts); + + // Let's do the job - delete disapproved posts + if (sizeof($post_disapprove_list)) { if (!function_exists('delete_posts')) { @@ -949,22 +923,15 @@ function disapprove_post($post_id_list, $id, $mode) } // We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts - delete_posts('post_id', $post_disapprove_sql); + // Note: function delete_posts triggers related forums/topics sync, + // so we don't need to call update_post_information later and to adjust real topic replies or forum topics count manually + delete_posts('post_id', array_keys($post_disapprove_list)); foreach ($disapprove_log as $log_data) { add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED', $log_data['post_subject'], $disapprove_reason); } } - unset($post_disapprove_sql, $topic_replies_real_sql); - - update_post_information('topic', array_keys($topic_id_list)); - - if (sizeof($forum_id_list)) - { - update_post_information('forum', array_keys($forum_id_list)); - } - unset($topic_id_list, $forum_id_list); $messenger = new messenger(); @@ -1032,13 +999,13 @@ function disapprove_post($post_id_list, $id, $mode) $messenger->save_queue(); - if (sizeof($forum_topics_real)) + if ($num_disapproved_topics) { - $success_msg = ($num_disapproved == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS'; + $success_msg = ($num_disapproved_topics == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS'; } else { - $success_msg = (sizeof($post_id_list) == 1) ? 'POST_DISAPPROVED_SUCCESS' : 'POSTS_DISAPPROVED_SUCCESS'; + $success_msg = ($num_disapproved_posts == 1) ? 'POST_DISAPPROVED_SUCCESS' : 'POSTS_DISAPPROVED_SUCCESS'; } } else From 10cdf3506cbd7c8cfb9e7c5286c1bf18f9c94c3a Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Mon, 10 Aug 2009 12:09:18 +0000 Subject: [PATCH 414/607] Function approve_post adjustment (migrating to sync()) Authorised by: Kellanved git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9947 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/mcp/mcp_queue.php | 75 +++----------------------------- 1 file changed, 5 insertions(+), 70 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 9b318379f1..896ff6d39f 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -491,11 +491,9 @@ function approve_post($post_id_list, $id, $mode) // If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1 $total_topics = $total_posts = 0; - $forum_topics_posts = $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array(); + $topic_approve_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array(); $user_posts_sql = $post_approved_list = array(); - $update_forum_information = false; - foreach ($post_info as $post_id => $post_data) { if ($post_data['post_approved']) @@ -523,16 +521,7 @@ function approve_post($post_id_list, $id, $mode) { if ($post_data['forum_id']) { - if (!isset($forum_topics_posts[$post_data['forum_id']])) - { - $forum_topics_posts[$post_data['forum_id']] = array( - 'forum_posts' => 0, - 'forum_topics' => 0 - ); - } - $total_topics++; - $forum_topics_posts[$post_data['forum_id']]['forum_topics']++; } $topic_approve_sql[] = $post_data['topic_id']; @@ -553,44 +542,19 @@ function approve_post($post_id_list, $id, $mode) ); } - if ($post_data['topic_replies_real'] > 0) - { - if (!isset($topic_replies_sql[$post_data['topic_id']])) - { - $topic_replies_sql[$post_data['topic_id']] = 0; - } - $topic_replies_sql[$post_data['topic_id']]++; - } - if ($post_data['forum_id']) { - if (!isset($forum_topics_posts[$post_data['forum_id']])) - { - $forum_topics_posts[$post_data['forum_id']] = array( - 'forum_posts' => 0, - 'forum_topics' => 0 - ); - } - $total_posts++; - $forum_topics_posts[$post_data['forum_id']]['forum_posts']++; // Increment by topic_replies if we approve a topic... // This works because we do not adjust the topic_replies when re-approving a topic after an edit. if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies']) { $total_posts += $post_data['topic_replies']; - $forum_topics_posts[$post_data['forum_id']]['forum_posts'] += $post_data['topic_replies']; } } $post_approve_sql[] = $post_id; - - // If the post is newer than the last post information stored we need to update the forum information - if ($post_data['post_time'] >= $post_data['forum_last_post_time']) - { - $update_forum_information = true; - } } $post_id_list = array_values(array_diff($post_id_list, $post_approved_list)); for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++) @@ -614,37 +578,13 @@ function approve_post($post_id_list, $id, $mode) $db->sql_query($sql); } + unset($topic_approve_sql, $post_approve_sql); + foreach ($approve_log as $log_data) { add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_APPROVED' : 'LOG_POST_APPROVED', $log_data['post_subject']); } - if (sizeof($topic_replies_sql)) - { - foreach ($topic_replies_sql as $topic_id => $num_replies) - { - $sql = 'UPDATE ' . TOPICS_TABLE . " - SET topic_replies = topic_replies + $num_replies - WHERE topic_id = $topic_id"; - $db->sql_query($sql); - } - } - - if (sizeof($forum_topics_posts)) - { - foreach ($forum_topics_posts as $forum_id => $row) - { - $sql = 'UPDATE ' . FORUMS_TABLE . ' - SET '; - $sql .= ($row['forum_topics']) ? "forum_topics = forum_topics + {$row['forum_topics']}" : ''; - $sql .= ($row['forum_topics'] && $row['forum_posts']) ? ', ' : ''; - $sql .= ($row['forum_posts']) ? "forum_posts = forum_posts + {$row['forum_posts']}" : ''; - $sql .= " WHERE forum_id = $forum_id"; - - $db->sql_query($sql); - } - } - if (sizeof($user_posts_sql)) { // Try to minimize the query count by merging users with the same post count additions @@ -673,14 +613,9 @@ function approve_post($post_id_list, $id, $mode) { set_config_count('num_posts', $total_posts, true); } - unset($topic_approve_sql, $topic_replies_sql, $post_approve_sql); - update_post_information('topic', array_keys($topic_id_list)); - - if ($update_forum_information) - { - update_post_information('forum', array_keys($forum_id_list)); - } + sync('topic', 'topic_id', array_keys($topic_id_list), true); + sync('forum', 'forum_id', array_keys($forum_id_list), true, true); unset($topic_id_list, $forum_id_list); $messenger = new messenger(); From e5fadfd42bc956a149e04370631b054213866544 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 10 Aug 2009 12:12:45 +0000 Subject: [PATCH 415/607] Bugs #15809, #49215 - Allow updater to work correctly with PHP filename extensions other than .php. Related revisions: r9935, r9936 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9948 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/install/install_update.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 41639161be..3e5757aa70 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -190,6 +190,7 @@
  • [Fix] Do not mark global announcements as read if all topics in a forum become read (Bug #15729).
  • [Fix] Fix general error while registration, through undefined variable $config in validate_referer (Bug #49035 - Patch by wjvriend)
  • [Fix] Correctly extract column default value when exporting PostgreSQL tables. (Bug #48955)
  • +
  • [Fix] Allow updater to work correctly with PHP filename extensions other than ".php". (Bugs #15809, #49215)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index a809afd4c7..ad72652e97 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -203,7 +203,7 @@ class install_update extends module } // What about the language file? Got it updated? - if (in_array('language/en/install.php', $this->update_info['files'])) + if (in_array('language/en/install.' . $phpEx, $this->update_info['files'])) { $lang = array(); include($this->new_location . 'language/en/install.' . $phpEx); @@ -1577,6 +1577,12 @@ class install_update extends module if ($info !== false) { + // We assume that all file extensions have been renamed to .$phpEx, + // if someone is using a non .php file extension for php files. + // However, in $update_info['files'] we use hardcoded .php. + // We therefore replace .php with .$phpEx. + $info['files'] = preg_replace('/\.php$/i', ".$phpEx", $info['files']); + // Adjust the update info file to hold some specific style-related information $info['custom'] = array(); /* From 12f1fd2c2f053646e76603f5f41829095070c8b6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Aug 2009 15:32:37 +0000 Subject: [PATCH 416/607] Fix Bug #49385 introduced with r9666 for #15085 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9949 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/overall_header.html | 2 +- phpBB/styles/subsilver2/template/overall_header.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 972c9a5c80..23c3961aaa 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -162,7 +162,7 @@
  • {L_MEMBERLIST}
  • {L_REGISTER}
  • -
  • {L_LOGIN_LOGOUT}
  • +
  • {L_LOGIN_LOGOUT}
  • diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index a45e51b467..028de14513 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -162,7 +162,7 @@ function marklist(id, name, state) From 5e2e08b05dc11992c3c56c45cc93e6d12ff6ae7d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 30 Aug 2009 17:13:28 +0000 Subject: [PATCH 534/607] Simplified login_box() and redirection after login. S_LOGIN_ACTION can now be used on every page. (Bug #50285) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10067 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 23 +++++++---------------- phpBB/viewforum.php | 2 -- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index d971af70ee..ad1bbe86fc 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -230,6 +230,7 @@
  • [Change] Unapproved topics can no longer be replied to (Bug #44005)
  • [Change] Require user to be registered and logged in to search for unread posts if topic read tracking is disabled for guests (Bug #49525)
  • [Change] Allow three-digit hex notation in Color BBcode. (Bug #39965 - Patch by m0rpha)
  • +
  • [Change] Simplified login_box() and redirection after login. S_LOGIN_ACTION can now be used on every page. (Bug #50285)
  • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
  • [Feature] Backported 3.2 captcha plugins.
      diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index d6ca262ab8..c6a6d354ce 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2978,28 +2978,18 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa } } - if (!$redirect) - { - // We just use what the session code determined... - // If we are not within the admin directory we use the page dir... - $redirect = ''; - - if (!$admin) - { - $redirect .= ($user->page['page_dir']) ? $user->page['page_dir'] . '/' : ''; - } - - $redirect .= $user->page['page_name'] . (($user->page['query_string']) ? '?' . htmlspecialchars($user->page['query_string']) : ''); - } - // Assign credential for username/password pair $credential = ($admin) ? md5(unique_id()) : false; $s_hidden_fields = array( - 'redirect' => $redirect, 'sid' => $user->session_id, ); + if ($redirect) + { + $s_hidden_fields['redirect'] = $redirect; + } + if ($admin) { $s_hidden_fields['credential'] = $credential; @@ -3017,7 +3007,6 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), 'S_DISPLAY_FULL_LOGIN' => ($s_display) ? true : false, - 'S_LOGIN_ACTION' => (!$admin) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("index.$phpEx", false, true, $user->session_id), // Needs to stay index.$phpEx because we are within the admin directory 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_ADMIN_AUTH' => $admin, @@ -4195,6 +4184,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'S_FORUM_ID' => $forum_id, 'S_TOPIC_ID' => $topic_id, + 'S_LOGIN_ACTION' => (!defined('ADMIN_START')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') . '&redirect=' . urlencode(str_replace('&', '&', build_url())) : append_sid("index.$phpEx", false, true, $user->session_id) . '&redirect=' . urlencode(str_replace('&', '&', build_url())), + 'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false, 'S_ENABLE_FEEDS_FORUMS' => ($config['feed_overall_forums']) ? true : false, 'S_ENABLE_FEEDS_TOPICS' => ($config['feed_overall_topics']) ? true : false, diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index b60eaa34e1..95c142d865 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -166,8 +166,6 @@ if (!$auth->acl_get('f_read', $forum_id)) { $template->assign_vars(array( 'S_NO_READ_ACCESS' => true, - 'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false, - 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') . '&redirect=' . urlencode(str_replace('&', '&', build_url())), )); page_footer(); From 3f22f755a3a3da4f711454e25772f13c42014ecc Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 30 Aug 2009 17:22:21 +0000 Subject: [PATCH 535/607] correct mode is send_statistics, else installs will differ from updates. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10068 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../includes/acp/info/acp_send_statistics.php | 2 +- phpBB/install/database_update.php | 65 +++++++++---------- 2 files changed, 31 insertions(+), 36 deletions(-) diff --git a/phpBB/includes/acp/info/acp_send_statistics.php b/phpBB/includes/acp/info/acp_send_statistics.php index 33e66ecd26..de5dcdb8ad 100644 --- a/phpBB/includes/acp/info/acp_send_statistics.php +++ b/phpBB/includes/acp/info/acp_send_statistics.php @@ -20,7 +20,7 @@ class acp_send_statistics_info 'title' => 'ACP_SEND_STATISTICS', 'version' => '1.0.0', 'modes' => array( - 'questionnaire' => array('title' => 'ACP_SEND_STATISTICS', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')), + 'send_statistics' => array('title' => 'ACP_SEND_STATISTICS', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')), ), ); } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 72bad95227..b9ac325778 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1181,11 +1181,11 @@ function change_database_data(&$no_updates, $version) AND module_mode = '' AND module_basename = ''"; $result = $db->sql_query($sql); + $category_id = (int) $db->sql_fetchfield('module_id'); + $db->sql_freeresult($result); - while ($row = $db->sql_fetchrow($result)) + if ($category_id) { - $category_id = (int) $row['module_id']; - // Check if we actually need to add the module or if it is already added. ;) $sql = 'SELECT * FROM ' . MODULES_TABLE . " @@ -1194,11 +1194,11 @@ function change_database_data(&$no_updates, $version) AND module_mode = 'warnings' AND module_auth = 'acl_a_user' AND parent_id = {$category_id}"; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); - $db->sql_freeresult($result2); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - if (!$row2) + if (!$row) { $module_data = array( 'module_basename' => 'users', @@ -1214,8 +1214,6 @@ function change_database_data(&$no_updates, $version) $_module->update_module_data($module_data, true); } } - $db->sql_freeresult($result); - // Also install the "PM Reports" module $sql = 'SELECT module_id @@ -1225,15 +1223,15 @@ function change_database_data(&$no_updates, $version) AND module_mode = '' AND module_basename = ''"; $result = $db->sql_query($sql); + $category_id = (int) $db->sql_fetchfield('module_id'); + $db->sql_freeresult($result); - while ($row = $db->sql_fetchrow($result)) + if ($category_id) { - $category_id = (int) $row['module_id']; - $modes = array( 'pm_reports' => array('title' => 'MCP_PM_REPORTS_OPEN', 'auth' => 'aclf_m_report'), - 'pm_reports_closed' => array('title' => 'MCP_PM_REPORTS_CLOSED', 'auth' => 'aclf_m_report'), - 'pm_report_details' => array('title' => 'MCP_PM_REPORT_DETAILS', 'auth' => 'aclf_m_report'), + 'pm_reports_closed' => array('title' => 'MCP_PM_REPORTS_CLOSED', 'auth' => 'aclf_m_report'), + 'pm_report_details' => array('title' => 'MCP_PM_REPORT_DETAILS', 'auth' => 'aclf_m_report'), ); foreach ($modes as $mode => $data) @@ -1245,11 +1243,11 @@ function change_database_data(&$no_updates, $version) AND module_langname = '{$data['title']}' AND module_mode = '$mode' AND parent_id = {$category_id}"; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); - $db->sql_freeresult($result2); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - if (!$row2) + if (!$row) { $module_data = array( 'module_basename' => 'pm_reports', @@ -1266,7 +1264,6 @@ function change_database_data(&$no_updates, $version) } } } - $db->sql_freeresult($result); // Also install the "Copy forum permissions" module $sql = 'SELECT module_id @@ -1276,11 +1273,11 @@ function change_database_data(&$no_updates, $version) AND module_mode = '' AND module_basename = ''"; $result = $db->sql_query($sql); + $category_id = (int) $db->sql_fetchfield('module_id'); + $db->sql_freeresult($result); - while ($row = $db->sql_fetchrow($result)) + if ($category_id) { - $category_id = (int) $row['module_id']; - // Check if we actually need to add the feed module or if it is already added. ;) $sql = 'SELECT * FROM ' . MODULES_TABLE . " @@ -1289,11 +1286,11 @@ function change_database_data(&$no_updates, $version) AND module_mode = 'setting_forum_copy' AND module_auth = 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth' AND parent_id = {$category_id}"; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); - $db->sql_freeresult($result2); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - if (!$row2) + if (!$row) { $module_data = array( 'module_basename' => 'permissions', @@ -1309,7 +1306,6 @@ function change_database_data(&$no_updates, $version) $_module->update_module_data($module_data, true); } } - $db->sql_freeresult($result); // Also install the "Send statistics" module $sql = 'SELECT module_id @@ -1319,11 +1315,11 @@ function change_database_data(&$no_updates, $version) AND module_mode = '' AND module_basename = ''"; $result = $db->sql_query($sql); + $category_id = (int) $db->sql_fetchfield('module_id'); + $db->sql_freeresult($result); - while ($row = $db->sql_fetchrow($result)) + if ($category_id) { - $category_id = (int) $row['module_id']; - // Check if we need to add the module or if it is already there. ;) $sql = 'SELECT * FROM ' . MODULES_TABLE . " @@ -1332,11 +1328,11 @@ function change_database_data(&$no_updates, $version) AND module_mode = 'send_statistics' AND module_auth = 'acl_a_server' AND parent_id = {$category_id}"; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); - $db->sql_freeresult($result2); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - if (!$row2) + if (!$row) { $module_data = array( 'module_basename' => 'send_statistics', @@ -1352,7 +1348,6 @@ function change_database_data(&$no_updates, $version) $_module->update_module_data($module_data, true); } } - $db->sql_freeresult($result); $_module->remove_cache_file(); From bf1621c05dc8ea61dfeb3bfd6003640232ab0b3a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 30 Aug 2009 17:50:11 +0000 Subject: [PATCH 536/607] Style authors are now able to define the default submit button used for form submission on ENTER keypress on forms using more than one. Prosilver uses this for the posting page(s) and registration screen. (we further test this at phpbb.com) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10069 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 4 +- phpBB/includes/ucp/ucp_pm_compose.php | 8 +- phpBB/styles/prosilver/template/forum_fn.js | 133 ++++++++++++++++++ .../prosilver/template/posting_editor.html | 8 +- .../prosilver/template/ucp_register.html | 8 +- 5 files changed, 154 insertions(+), 7 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ad1bbe86fc..e071cd859a 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -284,8 +284,8 @@
    • [Feature] Separate PM Reply and PM Reply to all in prosilver.
    • [Feature] Place debug notices during captcha rendering in the error log - useful for debugging output already started errors.
    • [Feature] Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset...
    • -
    • [Feature] Added function to generate email-hash. (Bug #49195)
    • - +
    • [Feature] Added function to generate Email hash. (Bug #49195)
    • +
    • [Feature] Style authors are now able to define the default submit button used for form submission on ENTER keypress on forms using more than one. Prosilver uses this for the posting page(s) and registration screen.

    1.ii. Changes since 3.0.4

    diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 2f7c289653..1d428ce92e 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -1163,8 +1163,14 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove global $refresh, $submit, $preview; - $refresh = $preview = true; + $refresh = true; $submit = false; + + // Preview is only true if there was also a message entered + if (request_var('message', '')) + { + $preview = true; + } } // Add User/Group [TO] diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index c1b86bd064..11e4315e2a 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -268,3 +268,136 @@ function play_qt_file(obj) obj.SetControllerVisible(true); obj.Play(); } + +/** +* Check if the nodeName of elem is name +* @author jQuery +*/ +function is_node_name(elem, name) +{ + return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); +} + +/** +* Check if elem is in array, return position +* @author jQuery +*/ +function is_in_array(elem, array) +{ + for (var i = 0, length = array.length; i < length; i++) + // === is correct (IE) + if (array[i] === elem) + return i; + + return -1; +} + +/** +* Find Element, type and class in tree +* Not used, but may come in handy for those not using JQuery +* @author jQuery.find, Meik Sievertsen +*/ +function find_in_tree(node, tag, type, class_name) +{ + var result, element, i = 0, length = node.childNodes.length; + + for (element = node.childNodes[0]; i < length; element = node.childNodes[++i]) + { + if (!element || element.nodeType != 1) continue; + + if ((!tag || is_node_name(element, tag)) && (!type || element.type == type) && (!class_name || is_in_array(class_name, (element.className || element).toString().split(/\s+/)) > -1)) + { + return element; + } + + if (element.childNodes.length) + result = find_in_tree(element, tag, type, class_name); + + if (result) return result; + } +} + +/** +* Usually used for onkeypress event, to submit a form on enter +*/ +function submit_default_button(event, selector, class_name) +{ + // Add which for key events + if (!event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode)) + event.which = event.charCode || event.keyCode; + + // Keycode is not return, then return. ;) + if (event.which != 13) + return true; + + var current = selector['parentNode']; + + // Search parent form element + while (current && (!current.nodeName || current.nodeType != 1 || !is_node_name(current, 'form')) && current != document) + current = current['parentNode']; + + // Find the input submit button with the class name + //current = find_in_tree(current, 'input', 'submit', class_name); + var input_tags = current.getElementsByTagName('input'); + current = false; + + for (var i = 0, element = input_tags[0]; i < input_tags.length; element = input_tags[++i]) + { + if (element.type == 'submit' && is_in_array(class_name, (element.className || element).toString().split(/\s+/)) > -1) + current = element; + } + + if (!current) + return true; + + // Submit form + current.focus(); + current.click(); + return false; +} + +/** +* Apply onkeypress event for forcing default submit button on ENTER key press +* The jQuery snippet used is based on http://greatwebguy.com/programming/dom/default-html-button-submit-on-enter-with-jquery/ +* The non-jQuery code is a mimick of the jQuery code ;) +*/ +function apply_onkeypress_event() +{ + // jQuery code in case jQuery is used + if (jquery_present) + { + $('form input').live('keypress', function (e) + { + var default_button = $(this).parents('form').find('input[type=submit].default-submit-action'); + + if (!default_button || default_button.length <= 0) + return true; + + if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) + { + default_button.click(); + return false; + } + + return true; + }); + + return; + } + + var input_tags = document.getElementsByTagName('input'); + + for (var i = 0, element = input_tags[0]; i < input_tags.length ; element = input_tags[++i]) + { + if (element.type == 'hidden') + continue; + + // onkeydown is possible too + element.onkeypress = function (evt) { submit_default_button((evt || window.event), this, 'default-submit-action'); }; + } +} + +/** +* Detect JQuery existance. We currently do not deliver it, but some styles do, so why not benefit from it. ;) +*/ +var jquery_present = typeof jQuery == 'function'; diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 81adebd206..9476242d11 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -1,3 +1,9 @@ + +

    {ERROR}

    @@ -184,7 +190,7 @@     onclick="document.getElementById('postform').action += '#preview';" />  -   +  
    diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index 4ff1de1c03..be26c17ec1 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -11,6 +11,10 @@ document.forms['register'].submit.click(); } + + onload_functions.push('apply_onkeypress_event()'); + + // ]]> @@ -92,15 +96,13 @@ - -
    {S_HIDDEN_FIELDS}   - + {S_FORM_TOKEN}
    From bc63b8685c9f2982439d967fdf0a042c922ad79c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 31 Aug 2009 08:58:44 +0000 Subject: [PATCH 537/607] Addition to r9887: Correctly install 'Copy forum permissions' module. Addition to r10068: Correct mode is send_statistics. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10070 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/install_install.php | 3 ++- phpBB/language/en/install.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 0e6c2f36aa..1b8553fb7a 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1958,7 +1958,7 @@ class install_install extends module 'TITLE' => $lang['INSTALL_CONGRATS'], 'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=convert&language=' . $data['language']), '../docs/README.html'), 'L_SUBMIT' => $lang['INSTALL_LOGIN'], - 'U_ACTION' => append_sid($phpbb_root_path . 'adm/index.' . $phpEx, 'i=send_statistics&mode=questionnaire'), + 'U_ACTION' => append_sid($phpbb_root_path . 'adm/index.' . $phpEx, 'i=send_statistics&mode=send_statistics'), )); } @@ -2231,6 +2231,7 @@ class install_install extends module ), 'ACP_FORUM_BASED_PERMISSIONS' => array( 'ACP_FORUM_PERMISSIONS', + 'ACP_FORUM_PERMISSIONS_COPY', 'ACP_FORUM_MODERATORS', 'ACP_USERS_FORUM_PERMISSIONS', 'ACP_GROUPS_FORUM_PERMISSIONS', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 35e9e7f459..5d3a5e91cb 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -368,7 +368,7 @@ $lang = array_merge($lang, array( // Updater $lang = array_merge($lang, array( - 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the Send statistics module in your ACP.', + 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the Send statistics module in your ACP.', 'ARCHIVE_FILE' => 'Source file within archive', 'BACK' => 'Back', From c492016ace472b5a8e432fbf2bf8f391d690b642 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 31 Aug 2009 09:31:30 +0000 Subject: [PATCH 538/607] Addition to r10060: Add function documentation. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10071 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c6a6d354ce..6d67f87096 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -552,7 +552,11 @@ function _hash_crypt_private($password, $setting, &$itoa64) } /** -* Hash email +* Hashes an email address to a big integer +* +* @param string $email Email address +* +* @return string Big Integer */ function phpbb_email_hash($email) { From 0dc8f103c9ab170f173ca1be4c04851d1c4fa6f8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 31 Aug 2009 09:38:53 +0000 Subject: [PATCH 539/607] ok, now we just define the modules we want to install on update and where they should appear. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10072 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 401 +++++++++++++----------------- 1 file changed, 178 insertions(+), 223 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index b9ac325778..d489521a20 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -575,6 +575,127 @@ function _write_result($no_updates, $errored, $error_ary) } } +function _add_modules($modules_to_install) +{ + global $phpbb_root_path, $phpEx, $db; + + include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); + + $_module = new acp_modules(); + + foreach ($modules_to_install as $module_mode => $module_data) + { + $_module->module_class = $module_data['class']; + + // Determine parent id first + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = '" . $db->sql_escape($module_data['class']) . "' + AND module_langname = '" . $db->sql_escape($module_data['cat']) . "' + AND module_mode = '' + AND module_basename = ''"; + $result = $db->sql_query($sql); + + // There may be more than one categories with the same name + $categories = array(); + while ($row = $db->sql_fetchrow($result)) + { + $categories[] = (int) $row['module_id']; + } + $db->sql_freeresult($result); + + if (!sizeof($categories)) + { + continue; + } + + // Add the module to all categories found + foreach ($categories as $parent_id) + { + // Check if the module already exists + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = '" . $db->sql_escape($module_data['base']) . "' + AND module_class = '" . $db->sql_escape($module_data['class']) . "' + AND module_langname = '" . $db->sql_escape($module_data['title']) . "' + AND module_mode = '" . $db->sql_escape($module_mode) . "' + AND module_auth = '" . $db->sql_escape($module_data['auth']) . "' + AND parent_id = {$parent_id}"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // If it exists, we simply continue with the next category + if ($row) + { + continue; + } + + // Build the module sql row + $module_row = array( + 'module_basename' => $module_data['base'], + 'module_enabled' => (isset($module_data['enabled'])) ? (int) $module_data['enabled'] : 1, + 'module_display' => (isset($module_data['display'])) ? (int) $module_data['display'] : 1, + 'parent_id' => $parent_id, + 'module_class' => $module_data['class'], + 'module_langname' => $module_data['title'], + 'module_mode' => $module_mode, + 'module_auth' => $module_data['auth'], + ); + + $_module->update_module_data($module_row, true); + + // Ok, do we need to re-order the module, move it up or down? + if (!isset($module_data['after'])) + { + continue; + } + + $after_mode = $module_data['after'][0]; + $after_langname = $module_data['after'][1]; + + // First of all, get the module id for the module this one has to be placed after + $sql = 'SELECT left_id + FROM ' . MODULES_TABLE . " + WHERE module_class = '" . $db->sql_escape($module_data['class']) . "' + AND module_basename = '" . $db->sql_escape($module_data['base']) . "' + AND module_langname = '" . $db->sql_escape($after_langname) . "' + AND module_mode = '" . $db->sql_escape($after_mode) . "' + AND parent_id = '{$parent_id}'"; + $result = $db->sql_query($sql); + $first_left_id = (int) $db->sql_fetchfield('left_id'); + $db->sql_freeresult($result); + + if (!$first_left_id) + { + continue; + } + + // Ok, count the number of modules between $after_mode and the added module + $sql = 'SELECT COUNT(module_id) as num_modules + FROM ' . MODULES_TABLE . " + WHERE module_class = '" . $db->sql_escape($module_data['class']) . "' + AND parent_id = {$parent_id} + AND left_id BETWEEN {$first_left_id} AND {$module_row['left_id']} + ORDER BY left_id"; + $result = $db->sql_query($sql); + $steps = (int) $db->sql_fetchfield('num_modules'); + $db->sql_freeresult($result); + + // We need to substract 2 + $steps -= 2; + + if ($steps <= 0) + { + continue; + } + + // Ok, move module up $num_modules times. ;) + $_module->move_module_by($module_row, 'move_up', $steps); + } + } +} + /**************************************************************************** * ADD YOUR DATABASE SCHEMA CHANGES HERE * *****************************************************************************/ @@ -1124,230 +1245,64 @@ function change_database_data(&$no_updates, $version) // Entry for reporting PMs set_config('allow_pm_report', '1'); - include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); + // Install modules + $modules_to_install = array( + 'feed' => array( + 'base' => 'board', + 'class' => 'acp', + 'title' => 'ACP_FEED_SETTINGS', + 'auth' => 'acl_a_board', + 'cat' => 'ACP_BOARD_CONFIGURATION', + 'after' => array('signature', 'ACP_SIGNATURE_SETTINGS') + ), + 'warnings' => array( + 'base' => 'users', + 'class' => 'acp', + 'title' => 'ACP_USER_WARNINGS', + 'auth' => 'acl_a_user', + 'display' => 0, + 'cat' => 'ACP_CAT_USERS', + 'after' => array('feedback', 'ACP_USER_FEEDBACK') + ), + 'send_statistics' => array( + 'base' => 'send_statistics', + 'class' => 'acp', + 'title' => 'ACP_SEND_STATISTICS', + 'auth' => 'acl_a_server', + 'cat' => 'ACP_SERVER_CONFIGURATION' + ), + 'setting_forum_copy' => array( + 'base' => 'permissions', + 'class' => 'acp', + 'title' => 'ACP_FORUM_PERMISSIONS_COPY', + 'auth' => 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth', + 'cat' => 'ACP_FORUM_BASED_PERMISSIONS', + 'after' => array('setting_forum_local', 'ACP_FORUM_PERMISSIONS') + ), + 'pm_reports' => array( + 'base' => 'pm_reports', + 'class' => 'mcp', + 'title' => 'MCP_PM_REPORTS_OPEN', + 'auth' => 'aclf_m_report', + 'cat' => 'MCP_REPORTS' + ), + 'pm_reports_closed' => array( + 'base' => 'pm_reports', + 'class' => 'mcp', + 'title' => 'MCP_PM_REPORTS_CLOSED', + 'auth' => 'aclf_m_report', + 'cat' => 'MCP_REPORTS' + ), + 'pm_report_details' => array( + 'base' => 'pm_reports', + 'class' => 'mcp', + 'title' => 'MCP_PM_REPORT_DETAILS', + 'auth' => 'aclf_m_report', + 'cat' => 'MCP_REPORTS' + ), + ); - $_module = new acp_modules(); - - // Set the module class - $_module->module_class = 'acp'; - - $sql = 'SELECT module_id - FROM ' . MODULES_TABLE . " - WHERE module_class = 'acp' - AND module_langname = 'ACP_BOARD_CONFIGURATION' - AND module_mode = '' - AND module_basename = ''"; - $result = $db->sql_query($sql); - $category_id = (int) $db->sql_fetchfield('module_id'); - $db->sql_freeresult($result); - - if ($category_id) - { - // Check if we actually need to add the feed module or if it is already added. ;) - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'board' - AND module_class = 'acp' - AND module_langname = 'ACP_FEED_SETTINGS' - AND module_mode = 'feed' - AND module_auth = 'acl_a_board' - AND parent_id = {$category_id}"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row) - { - $module_data = array( - 'module_basename' => 'board', - 'module_enabled' => 1, - 'module_display' => 1, - 'parent_id' => $category_id, - 'module_class' => 'acp', - 'module_langname' => 'ACP_FEED_SETTINGS', - 'module_mode' => 'feed', - 'module_auth' => 'acl_a_board', - ); - - $_module->update_module_data($module_data, true); - } - } - - // Also install the "User Warning" module - $sql = 'SELECT module_id - FROM ' . MODULES_TABLE . " - WHERE module_class = 'acp' - AND module_langname = 'ACP_USER_MANAGEMENT' - AND module_mode = '' - AND module_basename = ''"; - $result = $db->sql_query($sql); - $category_id = (int) $db->sql_fetchfield('module_id'); - $db->sql_freeresult($result); - - if ($category_id) - { - // Check if we actually need to add the module or if it is already added. ;) - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_class = 'acp' - AND module_langname = 'ACP_USER_WARNINGS' - AND module_mode = 'warnings' - AND module_auth = 'acl_a_user' - AND parent_id = {$category_id}"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row) - { - $module_data = array( - 'module_basename' => 'users', - 'module_enabled' => 1, - 'module_display' => 0, - 'parent_id' => $category_id, - 'module_class' => 'acp', - 'module_langname' => 'ACP_USER_WARNINGS', - 'module_mode' => 'warnings', - 'module_auth' => 'acl_a_user', - ); - - $_module->update_module_data($module_data, true); - } - } - - // Also install the "PM Reports" module - $sql = 'SELECT module_id - FROM ' . MODULES_TABLE . " - WHERE module_class = 'mcp' - AND module_langname = 'MCP_REPORTS' - AND module_mode = '' - AND module_basename = ''"; - $result = $db->sql_query($sql); - $category_id = (int) $db->sql_fetchfield('module_id'); - $db->sql_freeresult($result); - - if ($category_id) - { - $modes = array( - 'pm_reports' => array('title' => 'MCP_PM_REPORTS_OPEN', 'auth' => 'aclf_m_report'), - 'pm_reports_closed' => array('title' => 'MCP_PM_REPORTS_CLOSED', 'auth' => 'aclf_m_report'), - 'pm_report_details' => array('title' => 'MCP_PM_REPORT_DETAILS', 'auth' => 'aclf_m_report'), - ); - - foreach ($modes as $mode => $data) - { - // Check if we actually need to add the module or if it is already added. ;) - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_class = 'mcp' - AND module_langname = '{$data['title']}' - AND module_mode = '$mode' - AND parent_id = {$category_id}"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row) - { - $module_data = array( - 'module_basename' => 'pm_reports', - 'module_enabled' => 1, - 'module_display' => 1, - 'parent_id' => $category_id, - 'module_class' => 'mcp', - 'module_langname' => $data['title'], - 'module_mode' => $mode, - 'module_auth' => $data['auth'], - ); - - $_module->update_module_data($module_data, true); - } - } - } - - // Also install the "Copy forum permissions" module - $sql = 'SELECT module_id - FROM ' . MODULES_TABLE . " - WHERE module_class = 'acp' - AND module_langname = 'ACP_FORUM_BASED_PERMISSIONS' - AND module_mode = '' - AND module_basename = ''"; - $result = $db->sql_query($sql); - $category_id = (int) $db->sql_fetchfield('module_id'); - $db->sql_freeresult($result); - - if ($category_id) - { - // Check if we actually need to add the feed module or if it is already added. ;) - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_class = 'acp' - AND module_langname = 'ACP_FORUM_PERMISSIONS_COPY' - AND module_mode = 'setting_forum_copy' - AND module_auth = 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth' - AND parent_id = {$category_id}"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row) - { - $module_data = array( - 'module_basename' => 'permissions', - 'module_enabled' => 1, - 'module_display' => 1, - 'parent_id' => $category_id, - 'module_class' => 'acp', - 'module_langname' => 'ACP_FORUM_PERMISSIONS_COPY', - 'module_mode' => 'setting_forum_copy', - 'module_auth' => 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth', - ); - - $_module->update_module_data($module_data, true); - } - } - - // Also install the "Send statistics" module - $sql = 'SELECT module_id - FROM ' . MODULES_TABLE . " - WHERE module_class = 'acp' - AND module_langname = 'ACP_SERVER_CONFIGURATION' - AND module_mode = '' - AND module_basename = ''"; - $result = $db->sql_query($sql); - $category_id = (int) $db->sql_fetchfield('module_id'); - $db->sql_freeresult($result); - - if ($category_id) - { - // Check if we need to add the module or if it is already there. ;) - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_class = 'acp' - AND module_langname = 'ACP_SEND_STATISTICS' - AND module_mode = 'send_statistics' - AND module_auth = 'acl_a_server' - AND parent_id = {$category_id}"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row) - { - $module_data = array( - 'module_basename' => 'send_statistics', - 'module_enabled' => 1, - 'module_display' => 1, - 'parent_id' => $category_id, - 'module_class' => 'acp', - 'module_langname' => 'ACP_SEND_STATISTICS', - 'module_mode' => 'send_statistics', - 'module_auth' => 'acl_a_server', - ); - - $_module->update_module_data($module_data, true); - } - } + _add_modules($modules_to_install); $_module->remove_cache_file(); From bef4eb231fdd5184e2895bb8fbfdb43c129c7768 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 31 Aug 2009 11:18:06 +0000 Subject: [PATCH 540/607] Redirect to group list if confirm box canceled - Bug #50105 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10073 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/ucp/ucp_groups.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 8aba34c733..ea57246527 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -966,6 +966,9 @@ class ucp_groups ); } + // redirect to last screen + redirect($this->u_action . '&action=list&g=' . $group_id); + break; case 'deleteusers': @@ -1012,6 +1015,9 @@ class ucp_groups ); } + // redirect to last screen + redirect($this->u_action . '&action=list&g=' . $group_id); + break; case 'addusers': From fe6cb1489c4517de0f9902dabdad9bb870a67521 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 31 Aug 2009 11:25:28 +0000 Subject: [PATCH 541/607] Fix wrong error message for non-writable template file in acp_styles.php - Bug #50045 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10074 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_styles.php | 3 ++- phpBB/language/en/acp/styles.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 166ad11d3e..fbf3eadcb2 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -747,7 +747,8 @@ parse_css_file = {PARSE_CSS_FILE} { if (!($fp = @fopen($file, 'wb'))) { - trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); + // File exists and is writeable, but still not able to be written to + trigger_error(sprintf($user->lang['TEMPLATE_FILE_NOT_WRITABLE'], htmlspecialchars($template_file)) . adm_back_link($this->u_action), E_USER_WARNING); } fwrite($fp, $template_data); fclose($fp); diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index eb742fd140..247d8a4140 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -392,6 +392,7 @@ $lang = array_merge($lang, array( 'TEMPLATE_LOCATION' => 'Store templates in', 'TEMPLATE_LOCATION_EXPLAIN' => 'Images are always stored on the filesystem.', 'TEMPLATE_NAME' => 'Template name', + 'TEMPLATE_FILE_NOT_WRITABLE'=> 'Unable to write to template file %s. Please check the permissions for the directory and the files.', 'TEMPLATE_REFRESHED' => 'Template refreshed successfully.', 'THEME_ADDED' => 'New theme added on filesystem.', From 58b8e85c3d6ce59c0b7dbac854d71dd6e993996e Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 31 Aug 2009 12:07:18 +0000 Subject: [PATCH 542/607] correct method comment git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10075 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/search/fulltext_mysql.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index f9efa2bcb5..d1c1ff00d1 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -508,10 +508,23 @@ class fulltext_mysql extends search_backend /** * Performs a search on an author's posts without caring about message contents. Depends on display specific params * - * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered - * @param int $start indicates the first index of the page - * @param int $per_page number of ids each page is supposed to contain - * @return total number of results + * @param string $type contains either posts or topics depending on what should be searched for + * @param boolean $firstpost_only if true, only topic starting posts will be considered + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @param int $per_page number of ids each page is supposed to contain + * @return boolean|int total number of results + * + * @access public */ function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page) { From 7ce940680a410f9c8086001d8fb0c316e5dcf646 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 31 Aug 2009 12:29:45 +0000 Subject: [PATCH 543/607] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10076 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/posting.php | 4 ++-- phpBB/viewtopic.php | 18 ++++++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e071cd859a..4bd9120671 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -201,6 +201,7 @@
  • [Fix] Sort private messages by message time and not message id. (Bug #50015)
  • [Fix] Make sure only logs for existing users are displayed and user-specific logs removed on user deletion. (Bug #49855)
  • [Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)
  • +
  • [Fix] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/posting.php b/phpBB/posting.php index 84753a5ef2..77a499db4b 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1433,7 +1433,7 @@ $template->assign_vars(array( 'S_EDIT_REASON' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, 'S_DISPLAY_USERNAME' => (!$user->data['is_registered'] || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS)) ? true : false, 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, - 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id))) ? true : false, + 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked']) || $auth->acl_get('m_delete', $forum_id))) ? true : false, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '', 'S_SMILIES_ALLOWED' => $smilies_status, @@ -1545,7 +1545,7 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) global $phpbb_root_path, $phpEx; // If moderator removing post or user itself removing post, present a confirmation screen - if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time']))) + if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'])) { $s_hidden_fields = build_hidden_fields(array( 'p' => $post_id, diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ed4b60cf2c..eaa17279a2 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1465,6 +1465,20 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $s_first_unread = $first_unread = true; } + $edit_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_edit', $forum_id) || ( + $user->data['user_id'] == $poster_id && + $auth->acl_get('f_edit', $forum_id) && + !$row['post_edit_locked'] && + ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time']) + ))); + + $delete_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_delete', $forum_id) || ( + $user->data['user_id'] == $poster_id && + $auth->acl_get('f_delete', $forum_id) && + $topic_data['topic_last_post_id'] == $row['post_id'] && + // we do not want to allowe removal of the last post if a moderator locked it! + !$row['post_edit_locked'] + ))); // $postrow = array( @@ -1499,10 +1513,10 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), - 'U_EDIT' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p={$row['post_id']}") : ''), + 'U_EDIT' => ($edit_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p={$row['post_id']}") : '', 'U_QUOTE' => ($auth->acl_get('f_reply', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f=$forum_id&p={$row['post_id']}") : '', 'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, $user->session_id) : '', - 'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), + 'U_DELETE' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : '', 'U_PROFILE' => $user_cache[$poster_id]['profile'], 'U_SEARCH' => $user_cache[$poster_id]['search'], From f035f266069d45cce56802224a184bfe66495233 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 31 Aug 2009 12:45:02 +0000 Subject: [PATCH 544/607] Correctly display list items in forum description in prosilver and administration. (Bug #48055 - Patch by leviatan21) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10077 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/admin.css | 11 +++++++++++ phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/theme/content.css | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 173af4f7ab..ad15036daa 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -121,6 +121,17 @@ a:active { font-weight: bold; } +/* List items */ +ul, ol { + list-style-position: inside; + margin-left: 1em; +} + +li { + display: list-item; + list-style-type: inherit; +} + /* Main blocks ---------------------------------------- */ #wrap { diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 4bd9120671..6370c2b4ad 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -202,6 +202,7 @@
  • [Fix] Make sure only logs for existing users are displayed and user-specific logs removed on user deletion. (Bug #49855)
  • [Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)
  • [Fix] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)
  • +
  • [Fix] Correctly display list items in forum description in prosilver and administration. (Bug #48055 - Patch by leviatan21)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 19f5dfdb3b..e68f09049c 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -132,6 +132,18 @@ dd.posts, dd.topics, dd.views { font-size: 1.2em; } +/* List in forum description */ +dl.icon dt ol, +dl.icon dt ul { + list-style-position: inside; + margin-left: 1em; +} + +dl.icon dt li { + display: list-item; + list-style-type: inherit; +} + dd.lastpost { width: 25%; font-size: 1.1em; From 5f95f723d7f7ca4f02266d4f76b05899b59a6669 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 31 Aug 2009 13:16:10 +0000 Subject: [PATCH 545/607] set to !important because lists with the applied display: list-item will result in forum descriptions shown even if hidden (at least in safari) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10078 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/viewforum_body.html | 2 +- phpBB/styles/prosilver/template/viewtopic_body.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 23c52a5ee0..a07f1f589e 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -5,7 +5,7 @@

    - {FORUM_DESC}
    +

    {FORUM_DESC}
    {L_MODERATOR}{L_MODERATORS}: {MODERATORS}

    diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index b517aa7858..24c57b9a7e 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -2,7 +2,7 @@

    {L_MCP} ]

    {TOPIC_TITLE}

    -{FORUM_DESC}
    +
    {FORUM_DESC}

    From d7925595dc46c1d913dd722b2121d4552c20cb47 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 31 Aug 2009 13:50:40 +0000 Subject: [PATCH 546/607] Fix Bug #50035 - Fix handling of bookmarks and subscriptions on "split topcis", "merge topics" and "merge posts" Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10079 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/mcp/mcp_forum.php | 3 ++ phpBB/includes/mcp/mcp_topic.php | 87 ++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6370c2b4ad..f1f5787cab 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -203,6 +203,7 @@

  • [Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)
  • [Fix] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)
  • [Fix] Correctly display list items in forum description in prosilver and administration. (Bug #48055 - Patch by leviatan21)
  • +
  • [Fix] Fix handling of bookmarks and subscriptions on "split topcis", "merge topics" and "merge posts". (Bug #50035)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index b70601b479..acb7aa4ac0 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -416,11 +416,14 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) // If the topic no longer exist, we will update the topic watch table. // To not let it error out on users watching both topics, we just return on an error... + // Same for Bookmarks $db->sql_return_on_error(true); $db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); + $db->sql_query('UPDATE ' . BOOKMARKS_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); $db->sql_return_on_error(false); $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); + $db->sql_query('DELETE FROM ' . BOOKMARKS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); // Link to the new topic $return_link .= (($return_link) ? '

    ' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '', ''); diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 576d20b466..cdb4cac7d6 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -503,6 +503,45 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) // Update forum statistics set_config_count('num_topics', 1, true); + // Add new topic to bookmarks + $bookmarks = array(); + $sql = 'SELECT user_id + FROM ' . BOOKMARKS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $bookmarks[] = array( + 'user_id' => (int) $row['user_id'], + 'topic_id' => $to_topic_id, + ); + } + $db->sql_freeresult($result); + if (sizeof($bookmarks)) + { + $db->sql_multi_insert(BOOKMARKS_TABLE, $bookmarks); + } + + // Add new topic to watch-list + $notifications = array(); + $sql = 'SELECT user_id, notify_status + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $notifications[] = array( + 'user_id' => (int) $row['user_id'], + 'topic_id' => $to_topic_id, + 'notify_status' => (int) $row['notify_status'], + ); + } + $db->sql_freeresult($result); + if (sizeof($notifications)) + { + $db->sql_multi_insert(TOPICS_WATCH_TABLE, $notifications); + } + // Link back to both topics $return_link = sprintf($user->lang['RETURN_TOPIC'], '', '') . '

    ' . sprintf($user->lang['RETURN_NEW_TOPIC'], '', ''); } @@ -596,17 +635,65 @@ function merge_posts($topic_id, $to_topic_id) if ($row) { + // Add new topic to bookmarks + $bookmarks = array(); + $sql = 'SELECT user_id + FROM ' . BOOKMARKS_TABLE . ' + WHERE topic_id = ' . (int) $topic_id; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $bookmarks[] = array( + 'user_id' => (int) $row['user_id'], + 'topic_id' => (int) $to_topic_id, + ); + } + $db->sql_freeresult($result); + if (sizeof($bookmarks)) + { + // To not let it error out on users, who already bookmarked the topic, we just return on an error... + $db->sql_return_on_error(true); + $db->sql_multi_insert(BOOKMARKS_TABLE, $bookmarks); + $db->sql_return_on_error(false); + } + + // Add new topic to notifications + $notifications = array(); + $sql = 'SELECT user_id, notify_status + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE topic_id = ' . (int) $topic_id; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $notifications[] = array( + 'user_id' => (int) $row['user_id'], + 'topic_id' => (int) $to_topic_id, + 'notify_status' => (int) $row['notify_status'], + ); + } + $db->sql_freeresult($result); + if (sizeof($notifications)) + { + // To not let it error out on users, who already watch the topic, we just return on an error... + $db->sql_return_on_error(true); + $db->sql_multi_insert(TOPICS_WATCH_TABLE, $notifications); + $db->sql_return_on_error(false); + } + $return_link .= sprintf($user->lang['RETURN_TOPIC'], '', ''); } else { // If the topic no longer exist, we will update the topic watch table. // To not let it error out on users watching both topics, we just return on an error... + // Same for bookmarks $db->sql_return_on_error(true); $db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id); + $db->sql_query('UPDATE ' . BOOKMARKS_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id); $db->sql_return_on_error(false); $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id); + $db->sql_query('DELETE FROM ' . BOOKMARKS_TABLE . ' WHERE topic_id = ' . (int) $topic_id); } // Link to the new topic From 139f1d35302fc675b5e972e55c62d36cbc42af5c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 31 Aug 2009 14:57:04 +0000 Subject: [PATCH 547/607] fix r10076 for #48615 - Ability to specify amount of time user is able to delete his last post in topic. Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10080 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 ++- phpBB/includes/acp/acp_board.php | 1 + phpBB/install/database_update.php | 5 +++++ phpBB/install/schemas/schema_data.sql | 1 + phpBB/language/en/acp/board.php | 2 ++ phpBB/posting.php | 4 ++-- phpBB/viewtopic.php | 3 ++- 7 files changed, 15 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f1f5787cab..bf34bea603 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -201,7 +201,6 @@
  • [Fix] Sort private messages by message time and not message id. (Bug #50015)
  • [Fix] Make sure only logs for existing users are displayed and user-specific logs removed on user deletion. (Bug #49855)
  • [Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)
  • -
  • [Fix] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)
  • [Fix] Correctly display list items in forum description in prosilver and administration. (Bug #48055 - Patch by leviatan21)
  • [Fix] Fix handling of bookmarks and subscriptions on "split topcis", "merge topics" and "merge posts". (Bug #50035)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • @@ -234,6 +233,7 @@
  • [Change] Require user to be registered and logged in to search for unread posts if topic read tracking is disabled for guests (Bug #49525)
  • [Change] Allow three-digit hex notation in Color BBcode. (Bug #39965 - Patch by m0rpha)
  • [Change] Simplified login_box() and redirection after login. S_LOGIN_ACTION can now be used on every page. (Bug #50285)
  • +
  • [Change] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)
  • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
  • [Feature] Backported 3.2 captcha plugins.
      @@ -289,6 +289,7 @@
    • [Feature] Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset...
    • [Feature] Added function to generate Email hash. (Bug #49195)
    • [Feature] Style authors are now able to define the default submit button used for form submission on ENTER keypress on forms using more than one. Prosilver uses this for the posting page(s) and registration screen.
    • +
    • [Feature] Ability to specify amount of time user is able to delete his last post in topic.

    1.ii. Changes since 3.0.4

    diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 78ba5092a0..9f0bcf210f 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -177,6 +177,7 @@ class acp_board 'legend2' => 'POSTING', 'bump_type' => false, 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index d489521a20..48dd55ac72 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1498,6 +1498,11 @@ function change_database_data(&$no_updates, $version) _sql($sql, $errored, $error_ary); } + if (!isset($config['delete_time'])) + { + set_config('delete_time', $config['edit_time']); + } + $no_updates = false; break; } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 30acb90618..b582b8a8bd 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -90,6 +90,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style', '1 INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_edited', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_order', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_function_name', 'mail'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 2673b4a1ed..8797a1210a 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -152,6 +152,8 @@ $lang = array_merge($lang, array( 'BUMP_INTERVAL_EXPLAIN' => 'Number of minutes, hours or days between the last post to a topic and the ability to bump this topic.', 'CHAR_LIMIT' => 'Maximum characters per post/message', 'CHAR_LIMIT_EXPLAIN' => 'The number of characters allowed within a post/private message. Set to 0 for unlimited characters.', + 'DELETE_TIME' => 'Limit deleting time', + 'DELETE_TIME_EXPLAIN' => 'Limits the time available to delete a new post. Setting the value to 0 disables this behaviour.', 'DISPLAY_LAST_EDITED' => 'Display last edited time information', 'DISPLAY_LAST_EDITED_EXPLAIN' => 'Choose if the last edited by information to be displayed on posts.', 'EDIT_TIME' => 'Limit editing time', diff --git a/phpBB/posting.php b/phpBB/posting.php index 77a499db4b..b241da2eab 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1433,7 +1433,7 @@ $template->assign_vars(array( 'S_EDIT_REASON' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, 'S_DISPLAY_USERNAME' => (!$user->data['is_registered'] || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS)) ? true : false, 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, - 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked']) || $auth->acl_get('m_delete', $forum_id))) ? true : false, + 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])) || $auth->acl_get('m_delete', $forum_id))) ? true : false, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '', 'S_SMILIES_ALLOWED' => $smilies_status, @@ -1545,7 +1545,7 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) global $phpbb_root_path, $phpEx; // If moderator removing post or user itself removing post, present a confirmation screen - if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'])) + if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']))) { $s_hidden_fields = build_hidden_fields(array( 'p' => $post_id, diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index eaa17279a2..e7522841e3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1476,7 +1476,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && - // we do not want to allowe removal of the last post if a moderator locked it! + ($row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) && + // we do not want to allow removal of the last post if a moderator locked it! !$row['post_edit_locked'] ))); From d65ccbde11efe8dba2b4cdf838903938399cd045 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 1 Sep 2009 11:21:42 +0000 Subject: [PATCH 548/607] adjust inactive users list on ACP index to act like the new inactive users list from r9845 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10081 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_main.html | 17 +++++++++++------ phpBB/includes/acp/acp_main.php | 19 ++++++++++++++++--- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 51cc1c8047..139dc825c1 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -214,19 +214,24 @@
  • - + - - - - - + + + + + diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 815a55b5a9..cd83c52e01 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -540,6 +540,8 @@ class acp_main if ($auth->acl_get('a_user')) { + $user->add_lang('memberlist'); + $inactive = array(); $inactive_count = 0; @@ -549,13 +551,24 @@ class acp_main { $template->assign_block_vars('inactive', array( 'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']), + 'REMINDED_DATE' => $user->format_date($row['user_reminded_time']), 'JOINED' => $user->format_date($row['user_regdate']), 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']), + 'REASON' => $row['inactive_reason'], 'USER_ID' => $row['user_id'], - 'USERNAME' => $row['username'], - 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}")) - ); + 'POSTS' => ($row['user_posts']) ? $row['user_posts'] : 0, + 'REMINDED' => $row['user_reminded'], + + 'REMINDED_EXPLAIN' => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])), + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview')), + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), + 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), + + 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}"), + 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&sr=posts") : '', + )); } $option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE'); From 714aa8b09a62994ad4777d30064b72c90e84b442 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 1 Sep 2009 11:39:59 +0000 Subject: [PATCH 549/607] Only embed cron.php if there is no cron lock present to reduce overhead. (Bug #45725 - Patch by TerryE) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10082 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index bf34bea603..75d181cfcc 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -203,6 +203,7 @@
  • [Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)
  • [Fix] Correctly display list items in forum description in prosilver and administration. (Bug #48055 - Patch by leviatan21)
  • [Fix] Fix handling of bookmarks and subscriptions on "split topcis", "merge topics" and "merge posts". (Bug #50035)
  • +
  • [Fix] Only embed cron.php if there is no cron lock present to reduce overhead. (Bug #45725 - Patch by TerryE)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 6d67f87096..f18514096f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4284,7 +4284,26 @@ function page_footer($run_cron = true) ); // Call cron-type script + $call_cron = false; if (!defined('IN_CRON') && $run_cron && !$config['board_disable']) + { + $call_cron = true; + + // Any old lock present? + if (!empty($config['cron_lock'])) + { + $cron_time = explode(' ', $config['cron_lock']); + + // If 1 hour lock is present we do not call cron.php + if ($cron_time[0] + 3600 >= time()) + { + $call_cron = false; + } + } + } + + // Call cron job? + if ($call_cron) { $cron_type = ''; From a6dce700cea4c48d1fe1054f86e7d5cb3cabb582 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 1 Sep 2009 12:32:16 +0000 Subject: [PATCH 550/607] Fix IE6 display for very large forum icons - Bug #44695 - Patch by Ishimaru Chiaki git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10083 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/theme/tweaks.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/styles/prosilver/theme/tweaks.css b/phpBB/styles/prosilver/theme/tweaks.css index b6038f3f05..782e682b9d 100644 --- a/phpBB/styles/prosilver/theme/tweaks.css +++ b/phpBB/styles/prosilver/theme/tweaks.css @@ -67,6 +67,11 @@ dl.icon { height: 35px; } +* html li.row dl.icon dt { + height: 35px; + overflow: visible; +} + * html #search-box { width: 25%; } From 254dee274c0e2753edb171fcb71c71c8ed47222e Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 1 Sep 2009 15:07:26 +0000 Subject: [PATCH 551/607] erm, wrong position git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10084 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 48dd55ac72..8ebe261d9e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -694,6 +694,8 @@ function _add_modules($modules_to_install) $_module->move_module_by($module_row, 'move_up', $steps); } } + + $_module->remove_cache_file(); } /**************************************************************************** @@ -1304,8 +1306,6 @@ function change_database_data(&$no_updates, $version) _add_modules($modules_to_install); - $_module->remove_cache_file(); - // Add newly_registered group... but check if it already exists (we always supported running the updater on any schema) $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " From 604696f9a8abd2c743336e3d20ab85746f094637 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 1 Sep 2009 15:08:04 +0000 Subject: [PATCH 552/607] Correctly assign board administrator email for L_CONFIRM_EXPLAIN in captcha plugins. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10085 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../captcha/plugins/captcha_abstract.php | 24 +++++++++---------- .../plugins/phpbb_recaptcha_plugin.php | 5 +++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index e5a4e299bd..db4b7649c7 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -88,7 +88,7 @@ class phpbb_default_captcha function get_template() { global $config, $user, $template, $phpEx, $phpbb_root_path; - + if ($this->is_solved()) { return false; @@ -96,8 +96,8 @@ class phpbb_default_captcha else { $link = append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=confirm&confirm_id=' . $this->confirm_id . '&type=' . $this->type); - $explain = ($this->type != CONFIRM_POST) ? sprintf($user->lang['CONFIRM_EXPLAIN'], '', '') : $user->lang['POST_CONFIRM_EXPLAIN']; - + $explain = $user->lang(($this->type != CONFIRM_POST) ? 'CONFIRM_EXPLAIN' : 'POST_CONFIRM_EXPLAIN', '', ''); + $template->assign_vars(array( 'CONFIRM_IMAGE_LINK' => $link, 'CONFIRM_IMAGE' => '', @@ -118,7 +118,7 @@ class phpbb_default_captcha global $config, $user, $template, $phpbb_admin_path, $phpEx; $variables = ''; - + if (is_array($this->captcha_vars)) { foreach ($this->captcha_vars as $captcha_var => $template_var) @@ -192,7 +192,7 @@ class phpbb_default_captcha function validate() { global $config, $db, $user; - + $error = ''; if (!$this->confirm_id) { @@ -264,7 +264,7 @@ class phpbb_default_captcha 'code' => (string) $this->code, 'seed' => (int) $this->seed)) . ' WHERE - confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' + confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' AND session_id = \'' . $db->sql_escape($user->session_id) . '\''; $db->sql_query($sql); } @@ -285,13 +285,13 @@ class phpbb_default_captcha $sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( 'code' => (string) $this->code, 'seed' => (int) $this->seed)) . ' - , attempts = attempts + 1 + , attempts = attempts + 1 WHERE - confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' + confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' AND session_id = \'' . $db->sql_escape($user->session_id) . '\''; $db->sql_query($sql); } - + /** * Look up everything we need for painting&checking. */ @@ -352,7 +352,7 @@ class phpbb_default_captcha // we leave the class usable by generating a new question $this->generate_code(); } - + function is_solved() { if (request_var('confirm_code', false) && $this->solved === 0) @@ -361,7 +361,7 @@ class phpbb_default_captcha } return (bool) $this->solved; } - + /** * API function */ @@ -369,7 +369,7 @@ class phpbb_default_captcha { return false; } - + } ?> \ No newline at end of file diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index 89d44826d8..2d37b13a4f 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -54,7 +54,7 @@ class phpbb_recaptcha extends phpbb_default_captcha $user->add_lang('captcha_recaptcha'); return (isset($config['recaptcha_pubkey']) && !empty($config['recaptcha_pubkey'])); } - + /** * API function */ @@ -143,6 +143,8 @@ class phpbb_recaptcha extends phpbb_default_captcha } else { + $explain = $user->lang(($this->type != CONFIRM_POST) ? 'CONFIRM_EXPLAIN' : 'POST_CONFIRM_EXPLAIN', '', ''); + $template->assign_vars(array( 'RECAPTCHA_SERVER' => $this->recaptcha_server, 'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '', @@ -150,6 +152,7 @@ class phpbb_recaptcha extends phpbb_default_captcha 'S_RECAPTCHA_AVAILABLE' => $this->is_available(), 'S_CONFIRM_CODE' => true, 'S_TYPE' => $this->type, + 'L_CONFIRM_EXPLAIN' => $explain, )); return 'captcha_recaptcha.html'; From 9d3a851ab56041aeb6e64cb8886ec30662cd0226 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 1 Sep 2009 18:27:49 +0000 Subject: [PATCH 553/607] Add header gradient back into subsilver2 but keep site logo easily replaceable with smaller and bigger ones. Bug #11142, related to r7567. Thanks to dark/Rain and Raimon. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10086 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + .../styles/subsilver2/imageset/site_logo.gif | Bin 6868 -> 7151 bytes .../subsilver2/theme/images/background.gif | Bin 510 -> 666 bytes phpBB/styles/subsilver2/theme/stylesheet.css | 14 +++++--------- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 75d181cfcc..e3592c7fd0 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -204,6 +204,7 @@
  • [Fix] Correctly display list items in forum description in prosilver and administration. (Bug #48055 - Patch by leviatan21)
  • [Fix] Fix handling of bookmarks and subscriptions on "split topcis", "merge topics" and "merge posts". (Bug #50035)
  • [Fix] Only embed cron.php if there is no cron lock present to reduce overhead. (Bug #45725 - Patch by TerryE)
  • +
  • [Fix] Add header gradient back into subsilver2 but keep site logo easily replaceable with smaller and bigger ones. (Bug #11142 - Patch by dark/Rain and Raimon)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/styles/subsilver2/imageset/site_logo.gif b/phpBB/styles/subsilver2/imageset/site_logo.gif index 48c3b553da641238f8feb6be9060ce92a0636a6b..abce3cd51d33335210257301228219d18e6dcf56 100644 GIT binary patch literal 7151 zcmWkwc|6mP8~<$V_^{29l&eM;MXgJeScfBubs|TT969<<<(R8EC!yuO$|TI$h}<>z zHOx7;IYPPCfkgJ}_q?7zpZEKZ_v?ATpGW_So`$APE?^C;1OG39KrqbvQrF&F+txEO zJ~hId9iI3yI5s^nGC4jqcbweP**DTV#M5~((%i-6aK}6QM?3mP*uBH;Jwt8XgWP|U zqf_J4^P`iqBfKx#&T);M1NH1atZP9>|7d&faBKHq3+EqjtZQJje{`yMnAbBj(LFfc z-aRlr^L6YWaB6O7VrFpsAI~JjsS4`W2zyY7H1JW17`d3j3#y!H>KbV5>~HAkt7rGt zwfFRoe`)La$2l-KHVGkj32Qs-CV$p>FVM~ZZp4^1dOLcDF>O;c*Eu-R)Yae285rVy z;f_!Dk52ZD@Op)?Yi=VrO>N$g)!7)hmoUmQ;(Yzm0 zhEA6&1y`yCdd1%f)$1muOXtWbH)zH8QmT!}vCio%Yie3lNn3n%Pr<-adB@O)hR)ux z>3Vi|&(PQiZyL0T6tM^bZ;?R*2QjBavt)hzwWB{d0RcQYTsS=Yqi^Ff^zYRjXKo)qxb#KK6&ZF-X!NWK8#BD zNX}1h9L%oms_f-`Xd7VljTBy+pQ5g=*S^j-ZY-ym-qH@Ix{YwF1Uxmtl-2gU zzn}{u=#vsO1A=x*L6^$UFYg82cQ|a;^w8(F#&SXVzP~-xb#Cg{?(FRrQtj&pUt1GC zyrl|KU_W9Ji?5K|uTfko>hBw=dLQwEM`E$oXhDX|eC)0__Tt-&{d38O{^p<9F4E%0 zpDZA&t`%O|E;ZQrNDx%soXj-(_2C9PL4Ui(Vldrgy~1K9-!$>@+5FIJ!|(q~@HY9~ z5}XoX*;bY;cm@646(@)SRR8aQ|9b&I3IGr(Z@{G21|fGGwrs&oQm8_*((;`2`b*Du zpL7~+DavRL5I-NfWl;RCHAeZI_0`tm%=QGieRZiRIc(KdlGB?_$S@3P%}XrGF>}ROd~~@xkaNW9#tZ3!BW((fy}4HH9}7mxNYibv zv~8mQ$#%T&>^y@sJy}^ki*mqf$p;jT!2%eD=2|PjKkb+0_NUmHxq0zloa7spd0< zW`gbW-)D5y*{6i1&9JAJYdyGuDD`<_5Ghe9U4^9OI2nSTrKbn2nFn=Iw+1t9FuRW? z)@yHiA>U#&dAO+;xTe9k$o&sawCyXRncaU5S#wO03li2eP|=otI2=|wM184!)wmZD zt>;1CAM;0}6@rm(VPuBNk7Da~>h4#X-FH3yq5T6*K(l4^bCm@Brz%tY06_ZdD}*@SS4A3MX!??;_5Jj@u~y;8qVTXtSZN(bv&wQ^C*CGGBj zMMraQ7@zWq{bRF82a+u>T080?+SER=Czn~5qwE_}T|Vn_xKZiX;*&0^^*@E3mv^~- zV_f#}Ep8EubvpI#py{+p<1JIy@42TRj1}+1HLLz)i)I8)_g+3?Q<9(~$S>ruq7`z6 zO!SW|m2wZOo$l?a{LAoL^%ba=R#Fg!%V;wPS1G$kbQp6o=*~G~vInPh){%az9vzy4M=EyQ&^_bWo(M zjvuKP;}pIxaDQ58DdWZo#RH0$kNN#NU!@rKo~3^6+uDfFn`-PkapuBWr-=cj|90A* zs+O%$+pf*EU<7(y{+4RspS=scPd53@$F9nhw_6Q_5ke08UU2(tkqFgS)Jo}o=^wlM z@{hnRCNw~7eO1hVoe$v%7#^Q}=#Qx9w-mR2T!%vjC?c?}I*5c93@aw#_q1$j zvDw14IqiG&VyP4J$Hn&kY1aAHg3!V33hY(+VH@#uX5UIW#^;@)=VdxnN|aHa=(iAV z#=bA@9Gda$wi-H^Vymp&eG$E_C|=(1Wv}{Rko6s`@T1`A{aA@Gl*ko>OnRaUpcqaF zhN7KtvuaOd!mQ3-1hreT)FsTt$X+-1BvtEc&0c@`cwk!Ld%2j7_WXxEGnW)rejn73 zQ!##=yyNxy6`^I)89}gO*opA)lfj9`&kb+O_PJ^JQsj`6Yy#zN;zLxh5*q+d%0s2- z;xH^!5ft%~O5{4vD(y+Gwzv~69y~a|w{soPJM~MPLgOU^MMwj>%{!R`m$5ArO&`|H zH^1<6=Xe*y=ye%;B7@DSZXxU(orhX{cf-VGq@nI!s71 zynOQ+f_hMxzq@rCNCTt?hPn72Hr3xG_9J$;1aav)W z=b)3r>rxi@uiAx*Gw?EccaF%G>|}^rsNxQR_*1ts!jS=%2|mv+sos$wk2&A#7awZr zDNPS{yd)>oZHfo(qx%bv%6>BpyK(i{hXQx1R_?o(P9$YJ|kI>#M7F>IL z6JzD#p7(ZZ&h^O=0#3NBEa&%H$|} zmP2ygmTJ~Dgo-N!A+-y%oG@r&-p2p#h-$XwjNS+?j7lh)d!Z@GX*(Wb~874nUtE4=tA4zO?sZ5gaVv z5Ok2FLsUD&&z~T1lcL};S>MbEzfNX^C z125dLl(By?B~!}|w|k0ZYOJfYr|8Sq5UGs&#;0LO7D9(oCl+sjPu>8+uPn-R+R;mq zDnQ_=tqWY&Pp4C5x)Bj?1Grd9NyJDuaQU1ZjB7@vEqtH9kYU@j3_xJ2MS$Ts{H~r^ zxAP~?TU^&m>b(U&Eq${)1lOSCeO|c~+qX#7Wt{DQ;8?o1k1qsWoZM0Hv6OiL`yBtP zR*ZZwV81p5sq@=rhtRX1C&c{iTk3Wz?AC8S{pRoD)BJtYyWe}9#rsEAN2ia(3f44Q zy4{2y>u9#!>~xJQ3JX`c8i1@pmE^)8Bpr%rHcNhVpJFP`WpmUil~e#NaFSNIfjb zUav*Pmu>ZJauBK!Sm-?+>bH^WYXdJ|@BK=sSgx-I|9k+L;sB7pNVmg+o9mcD=f!_TsT*O)$VU_Hy#_nna@-U6NoAGE9O zhgt9`H*xU$aOe)2jr1ULfQv{Hcl+;--{*LT1iIggIs5&1=#_QIe|P+29iRv4fpb)U zqvj_gXFOK)#ZDI!VV&Gi4WPLBV0@85(AmDci^M`vzbF1YR=pK&T`W0%!4iOoT4xrRM?vJbAd&#cK0fuOmkfvx)9@0T;iHqyFkL*q8D3c4bxbJ`8cle9QXJK5 z7U=*8&F&VOPmIDdqZZ4fZt(v#=|de&Oh4TV0M!IrB>D%Bxsngasp_Qyeo~F3SZX&lq5)%VkT&Azie{4l@jw zd=eL(peX!xx6o2c6yGc6yFlaR4`tX*tc%f{-?kS5CPTYIMG9BI5funL$J;4)8(Bs-eq zAYAFN#H6I;=Sh04;WQldE=kPtYupq?%!HK8*bwf-W8{a>6^fWYgunq>y!CT2FEf#o zJlG^Zx-dts4j1D=PVh>K`Kb&$B`#Vf4e>OKb;rg=na4?85ut8?5hTY10wRAt5vQEw zjq@0N4wqkd$r6wf^SwZ6zL3%e+UjfEG(`;LzgekBt^zSNDwq!dM4681Eq_zh{buJz z{7>^VD$iAS_HyVxFS2{esv@oHf*4f~&7))-|Asz!H=}CfZI=yN zodh#TerH(u&XfgL$H73umn#Nd>H1J9^FT3g1euv>2fWVY!Bi>{;dl>oRyr962Ac;K z8z3wWKXb0kBm>9kTuRzU8s@9Oyf{3(_;7piQPB^hJkb+8 zK%Ir^AffbpN(_8T8UU0FLC7oVy(uk=uwUb@>59yW{eGfcyYiX8&PhB#&Zd1#7gx!;iwhe(cHbW8#G zf!JE+KT;NOq}*>oG`<{A$DtbOs4FR`D?X?W7RnR{!;@kb=7A-|>)%&Oy>JLm4qS@> z_aq@mFA&8R2>PWkOkQOyE4NY<5>5H|zUt#AQBau<|IY{kJ5pu6>2i=IHo-&>F&We> zv2jj$UkZATk2*65fJ6v;p?Zoasw(h8_gd8Wr(l?*;ENP^6{(_?^J#hWQ!5?S$QM<| z3#Gq!e~Ktn)t;-&^A4d^=J^1}@L&YL@(B*{R2)eoLUWRmABuzaM0gzGE!E?KxC?w` zsH&-rd58kq^FJcDKsy3hh=671h)q#y9yo~pAz=F2(UBfdkd}Om2R)Qpht3z9) z#6rY{`y(IK$47M$JWfU=gFInNcB7kCa~JFFQ5qcY8;rq& zEMkNH)~9v>5miPKUM`P1jun0ZG#z3#{WL{>8iC7Vn`}p0-=NY~O`jFawboc5o&aFF z*0YtQw&9W1{M5EI`S#b<*=mILQcIBwwDt>>;7cQ@=lLyHErd?Xv^wLn3p|rG!djoQ zV6HrVqdt#*dhG){MM%I?qAn8IcG)%Pd^S5Dkmf^0YB;Ddj;L!V$KcsP zX2)nmdbWK03K+eM#S!=G+|j{VSmY=zK@o(WgML7{R@Vvor^U_oAMGf09>QHl2q(Y_ z+wt3eIzYR$>Q{2uPdIEfeD}rkeNukOadfx|{yO7%kO{7DObg-2Y|h?bXM<^shmebE z{XV{sL>4lR1fc-~5%@l-F({NY;HUs?$EVboIgz$-tu2X8lvAk~8mPTzq z5Q-nzMT7)K_FwW#-nlA#x0qgrJeL|J4#+ei0a{Da6Cvbof~7taXg1eqCr4XADIQSafM6# zfjhBa-r}M&Y@{U(5yuw}CYI8e@FW79f*n;2gIi+t5^2CL0e_I6GviIRC#(gC1i0Fhbb)E;0c*{UBC*_t&v2GS7}j__j& zEQL8IO@Tuetm5f_69C$7L)EmQ7e0Z(1du>OydlCPaL`A@QjxzigaVFHA&|lZ<7o&L z8Z;OHV@cCa0Fpq5M^IqlIM4)`Gp8fX2ylB6#CaPk{Rk34hi5(l)0RL-%G`KJsT~0G zrXgqmEEhZIlMIpNK#{Z+6*c5HXH*MqvW0-cbs$aJ$MTs;&12AHw@Cn~n@7zsjIgk}K^b{zON zhX3;gd=FMg@ey1kl5Z`eeXk1pHcfgQRa1^=5uhdbzOmPYhkpd&*^Q7z2P>X)bnBC3W6C$2#3InV_3 zpw#(IY1$g9Yly~zJ@OMNKQ<`R3A5*b!|1=^d}x>8-gO%P`!Uk&A;Mp8I!G032;V!n zsy3>|-x7@idi)_ygpD5SKX2%WILd|@9`ppnEtlyAt9og?#nae^i~u4tDeh; z>w6_LjjyTZ{1^(B>@hwX6P*{+6U6!ZyK+4<@|wuT~VX>DfJ3^xMaNP`&2@4U+c{q^rV33*jr69 zA0DRbQthRW+lbQ7-<~TWu^Jb+N_JKAQj#8mY-1Oj=8sGtPw9)n%Q)}r7Hj&0`DO|l z9Hnn=^Gco{GCSid7E-YH^v62K&aAvdpd6>NySB)`IP{0Z3JPaE2A5x&lqFeh>*vNs zS2J}4e^!4l2Q8O=%NHVjT#;NnR_*XBXSNoR@-R!*Zwp-7WiBnn$9+q_$-jij6LM>i zfN^-2(Zb@CvyvB1(KL73=D+*|bxw6FyO-t0lm&fK39_O|8<~y5f}oczT;THK*8MOX z@5;`&2R&ud5iU^`E7sM8O~O7lO=${#sZ8022Ai1)DpokjR++r&IMtth(e1)dgnKXSRaAWaH_!L8t?>olDS8F5tChwMrK@)=U3Zpt3Ye0t5S zNAhofn=$kU$^p_ zjw|ban6Y!Gu8`s1FS{OZE_qIzoa-+!58!6rBnI!eqcQGkvKVWj?DNX&ez=dhnXb?Y zjz*CExwXORNF8bNgJ>i5jR&zQV;T=)O=mUiVoXCTY?B;5ZrG>VdT4%m{bVf>MmMJn zeWBl5+i-kG#U#TLQq+ejnQ7W*g$wmS45@$C+6#?enFe`KZt0dsBji zYf+hXigU?yyw5UoC&9j~$QL+x^_irDbuZqa6<`+$+>Yj>1of}h8*bJ^cD?tj$t9-|KT zY}N;bcKJK=mZZ16W@1eJ$+Ib*Z#;*%<6~ZPam_^7&SI{0$QPRl>&^bWUC(@fw9i?< lcmbxHKEFB=_5>~VCOq^1vrs1R-}=dY_H28z8H)wZ{SS?bkw^dl literal 6868 zcmWkxc|6nq1AcFx-G_}t?l~$VO%&x?Zc^r`h%&lV%5=J$W6sG)xx%6xCCyQUYR*I$ zQ9>CyO+UFYHs$!_WNf^_g~Ks48QyRH7_g7<L8qV>}qR(usmpT zs9|ZYVzo2mhx?W`_N4k~)mA4}*-Uhi|`(Z7nV#<6!_k4+rUd)(1l@A^Wr zr+GE-;iN2sI^CdorC^=5v( zNr|gyxqPEk^WeqN@rjpN_PfhI+2xDgjgS5tNU*psLD`3eJ$U!|d8XF6+|?)E{|aR9 z#n`llllA?hoUT^M1{Yc;R7~9UT&*%2e>dpCu1HP@&T8rl%q+95STJRe%@5tOz5Y}( zc}OF+Ccov4P0FZObhf0&*C@5VF3A>ls&KWp43?(9Bu zW{-Ks$eVYQKb|KUgm&sil^svY+f&eStVlRCDneMC@F{3*s=b5tOPw37A5S5$pM09= zy3^46Ht|va&Z3!nktW|W(b=Up_m@qXhUV$;W@MdCrCv{_WWHM$`b?W$t)1K;5p5EVUvJ3#srwPHP%^G{5*|foviFwefz~VZTGuAFRJf! zXHk!I-E^!e>B%!WKQs2CrnIk+7K>8}>o4ptUb|Vte5OBTU6D?f(>BH68MoA#WlD6I z%$MQ^jAvWVOmEX0u97oeoOX@=?2&2zY#@7gR=nq3{FKGr-AiW&60I4{{(0^XylOR4 zyFQM}8(6i6EA&Nv7`~<295ebp?&b2_c-qaAp4A9s*Yt}_OC^GN!_SkA<(gp%kZ$Z5 z&)n0SN=*N33mj6poT9&H?B~%YEc=@N*)jd^@%~N>ex#}Ko-65D@^u#?w0=GAUY{tr z{LcKrn0PABJ>JAVPmv&=I3YZ;X65jJ3~D-y-eBhNk?tUDVIhvoJB@!T;H&3vuvj4GKK`ww|i>4$*q8(Vnqc)=`+g*^T!h!^OmlE5DIi{PBkOOta=5g_$~m zY^|_}1$SpIC0-s^*Ri$S(DsF8O-Fg|-puUM@wPG><60wlPi*&R)7)I!ZrPfNd=9(0 zW*$m$1R37k&?bfOItAcLUmE0Vl`2n2X^c8t}y7W*G zX5&khAbP-QZN(Vn$>#~bhK5Ej;dIC3Lt3xfH8;&!cp01;zC>U*%pO-i_qasL!(pRc z8v#X@z?J!h(k4e-pHJS|SQMi4{c~<2gg99SnjDnnLS7=X$AP&#`e&5Y`BMJ#^b+#9 z`-9*2oo(zh8*P0entjk&}mFLP*d$tpqDe$(ak%4!Z-Z z;zQ-HF1=qlb3!p#EsfhU^-|kDHz>Ayc6rLn;p|AuC51J+Moudk7?N*G@Wx|`f<06l zqP)t7S^l%b%i{rB^XOMDjjAhOn}UXoro4`<>UPM*Muy_Ne7eR0I%NIr)(P*aoHx6j zb@tDf;4MEsqevgoM*)lsR+m4dkv>e++RxdCG+gnGTK@Jdt-g=*AUHzK*>wKLNqMNz zPC3o`@M_qG+N>ST*!~n%)w?I2%=!hLy)~(7-6ji=$`cs(MBm>b2g)>P&i*#|3{*Ka zMT0_%{a{-7E!#R;a$Uq;#-|Yj`K*77eOH1*{IHbf8U+*$UMFtdCQ%NiAvVxeX*B=E zQ}O2Yk=AD~)HI3-4r=?Gob85k4MrufD)&WjGaBvR5;%!IYXn~S9EDIL;Zd92N< z&6)R=ebHY5XWzjE3{I4{D)Zv`@oWY$hO+^Go5pId60#%Anho!KafpzuO1w23z22Jj z!g+N!H0}J^_%*iqrg~dAj~@F8(*Ez?~A0 zZnS0NZk)URXADg#;no*aiLRU!`cbn%PfDd9nQ|yrTbqlWAKW6P5IJFI+7O=>?;)#~ z-EN%EN>E9Bm60>3)iY4ud$H2+;;5m+tQ-~ZsI95&NE2-FQotLT43$>}+`&MU-K;;i zKmbd-XfM_RiD9jsz$D-wf&LPUwM5tT9kLxqTsb8Z_mx!I6rT#>OggRPf*Eb{9}c?7 zCC5kyv31vca5~U9x$nWbe5ACBG|pDLrDW=*mWIVc_kuq^tH~dtdr@0GHaTc0Kkj62 zt8PTn(rLrZI6#B(qh#&oa>K&rFc&YdP9 z%i2^uyK#=ZX4wIOCVo|M*a%_$fa7UHy{p8r?eynwr|KZfl!h5?(UsN1XD>c69d_6m zO}NUQTmQmqFU9$_SGVY-OXQ|HOZImT6X?1jg`0wsVksZ_*7_~|xc$5dnBAzo9>VOP zd*B2b@SzRd5e7`w+On2wBh%8ATvpVKtkdq?s2%O`MlN>8t7CDb<7QK~dR9tCy}_vp z{UpDD6HQxtt5Sn2jwqgvm5yDuJ~Fj39Gp=TmY6+v^ka$dg~Pv;x`nDdhnica7)IL! zbDn^U=DLVu+6*zpceR`+w3Tfn&3=1gv;Y-s;zhT>$v~UzcGW3vpF&0mE!f}ZsM>8m z)t4+AY;wd=w6aX6O>Z#OnU*ZaVfAwykP6%9ho6sl+;n*qlo<@-^bUAI2YSB|ZP;r6 zv>7d$XW3f;kE_Np!Bz~%M3sRUY{DWM6N=Clj3sZ*+#m-JK)PLb1?+W4NRAFMTgRvY zuKZ%yaPM}lCOUV`ZS~Q&$K%p=8@@Xo+X$0dj%^q^1bN+TgmC~=I<@jeMQDt0?KRe@ zzB#^0GUy@`xCk6_<^qhp)zbtvx*0;;E=owK;Lia+TGnB# z1no+HV?SoDjBzE|>Dzl#IfjWHG8@rLX0Kh7F5WXmr7(8rY$y7LT?u>o$1W~%&wLP3 zL_y2^O%On|j`V9gb{I{AZJqtNbANfgPfF}`|8lucWUXiK54ZXpm&Wtmn`Vtz)@ld) zaq`&_$WI-Qwim>34JlJ&)qsQ-=_drPh;%Fy<9dE@lN)1ArOdw7_I*nYiu~dI%%v7- z25iaEyJ;d}UXb6`DqgD?k6_K+$7JaqAXL9kf|rT(4lz9pM<;BVq-_rjeuXTgfL`HtQw?&D0m#hmAH(~d!5afAdsKkLb%-YOF6rymJptn5L* zRDBu$;SqcfJ>tB0U3fof4+Uy}L+DIkwP#@GzdlL0FgVo~Z$NQmOUL6^RXx^IWSvvlPKHOw>sjb6YkHzO(hut@$D+hKGz z>rz`4`1b}K2>^PTwUq*m2w3MQ0F}=6nZ~YhU~d%yBn+Gp5QhZOEI!*u8^Tdy%s-!B z@342*Qi!QAMvjaVkz?-{tDO*D{M;^7E>R8f-fJAjz8c)?x5nw81Vy_5yhQs(~U7Bb&(sg zgO+a`d&Gb>h2W-{WS>XsXQ+vhVr*Gm0-ln1>`hpLHX9k*=3; zO~Waf2guEx2^2AEP@M4A#Dk`h*xQLW5^@MMVzL7{bvp5;nfH#4>>r24X=We85xh%(JtRHY>9w$jDPKc7_avw<54=Uo|F@8R%GHq)Fz zfy%XM&Tda~|F8u@B!zS&7E)j^T87a{C71pUahfnUJ|YlgDhLT_4B~F;wZU|l-0+6a z0-~uG>JP|{2}Q)wb6zlWvQL8C$2qy7pdb`TmebH=oHC2N|1mg3&2pu!?aTqGBt6 zhG1Ynoogc*DI8cXCQ#)sgYs>ZvIh#FR#c4CVfSORpL6d#XTWU?!Qq(_vHv-@;$z-fP(8xR*X>K%hb@ z{=84t_?Ku@gQF;`pyK<3M0r`so&(oU8t1P zw0i|R)eDzN1pu}TxiA9%F;lWKLOL#hp~Cr?Jiam+me0g(K3Gxk1xC##mwqXA z5~J366KGQwFA{N|aBxF15$cD%{e!aI6sJ+0r^TuYHz?Olse)73m5{}e0n{tWpVIY9 zsX;r5yM#3s;e;&!R=bHG$hy0Wmkli-2Y$oNW^2sxwN|FJtdq3|Sy(m=p-qJyY<%d` z_)wdMcn?sd@B&r3amnuj%j7C2K)_M7Xalfo)cc<{Auw-YgJD%0M-4WGR}D{8%coRX zF{NY|&1>nEpPb;^xa^WH?B3bhR&wn?XtwQWZ2^`1`{2FQ*_yO_4+gNXYoj&xB7`&x z9wEY&gg2ChH$+fjexpT&CqX?O*O^;UdA=}Lj51_Z{rREHc&D5U?EsHf zP?iAQw;TSIQg=?bX&Zyw9$rNv$6aei?xexxP03NSaHP1Y(YsmB`F;r#@9PKYfs&a< zj6Waa$!s+-BNp>pXBwZrTq5=G;afS#P7!iDr`5Qk)r`}cN=JPUKrIQ-eN+LKDmXxa zYYSki4Dh);=c=$kwlP6!PAZp&01U!e9>R&+@>STepR0{_Z8|pA+^#{U=(RY}TGT5L zN{^A+&hVzuj&*^A!xLa31?jLt`XS+=9L735DUh!fIo^!m$%4r(lTHXauX0+ce4^Q7 z+;yRp+f8uWr>o>9=o6r4gxGpP`-2qxaRHgwgg+YC0WAO~uOpX-)nfYVTp|wuObr<_ z0D-s#(Bk|uOs_@hH>r>eX}|2Yq7y6`dXOLS2VWDJj`_ibr79yf%SXH&BOs%Dwu*Z? zMWB(1P4gnXp<^6`P^np8d4<$3VOPQ9oO`rzznAK@J{_3fBsKsf06I)$F7u!Fn2|fU ze(R2}$ERa@MA#nk3pw?E*&fY)fSG%F?TQ#$L+Sew*k#T_e4^v>%X41vap8>hHBHZ9 z@7AVqh5IEuEZ$re$HeZ8#C{)sra>LhIwROiFVO9Y`q!l1NN!Ohzgn*@AME|gc(ZJs zpnvBf)DQzTLxJ~!!P}g6WforN6v%qqM_d@t;tw*@Rb0-z@>wA5I5f0K?kXk>mUH0w zG%1~2LL48r49-P_>VM68+QV6m$>hGj-$`As`M#XH8L{s zjL1NQQWK#hbl@!}d5ezgQz0i-Ss@)N6o_2KU>g+-P$4ydKDr-F%%ihZp6B-TW&qsk z>Gm#jSfL0L$9oee#1GMd#wgjxN%^%o`78yy4fFsCU^39&0^lk_83H6y07z755QWZQ zfp!rbh*1V~h(HCGC;&+nsR-3u4!yei4+kTPbSMZVh57L+L5VP|Y22{xRD;y>O-T-YtAsPW?693hK{Iygmfd&;8 z#Uoq~of@J;Q9V=ln^hbSy}Hr~;1r_A5X_K_gwdh;yb~BI@D{;C_X2ARWI z80AienDi4fdjLfLlq(wc(+^W&fgoU!@t?(&vv4Z%+Fs;UeIi|d)`Lzkpn_-%kika^ z9wMu+f`<9oz=9Jpb0~KK2ok~F1#?E^z#t;=76z%8zcsL{+^7Ij9Sk9}ccI~stWfWlX!1T91Lxdnq0-O@Jh(kiW0$%h1~6?z z+A*E$kC~PWnfqm7BUSFIqV<$@yCy2udLOK9V_zl8uGMn6Vb<18FmWx~{3%fS_=yxF z6oNv#&>RCZ;&C_dX)Q4WHoj@*=7L2D*hD~RM;op`?R;Z(f0i9FZyJosWQ>${MHbotbRtaNhdEQ%{=vFeW_23k(^fVp3kC3fHMcGQ&DGen;-DtF(I6r2tLai( z04hV)iCGm#gF8;d=wd|pu)@!C^@=SN{Tv^bdu$|9! zX|W>^j+>%w25PeEJt_>hw3$RJ$oX*=oUJ=Lt*MrujdVwC*gKkpRp(vJrwp0)cAD1*HMV>jj?1y!Lbah=;qNmNt=HsV@NnC` z?cw?@9`!~k1|8EshxQX~J^I~GKU{om;{NU^#@Tyu@l6+P-!8(z;BCJ=kNzIJi0R7x z=P_)YVteV}DaZRBLwjzh_AumA~U8tZJBdB~ddgx7CdMpNJmLy%+ zG8qg@rYtPM%kJ&mwsXIqopW||f>6yEj8^Nv=zI7*e?PvCu6CoTXA95^B!D7?LP63} zqM8(<30{fgtP;Q&KT7)$$_tYohzN$+Fe78Mgi<0x3NXP#IL9e*R*o@}PKz2Ps3adH zI7QY|l9m+Jgc3`85y}ITZirY3;V>yc1Ruh=ZxJ>aW&#);W+aRjNkJv}D9$MnR+eLF zNl%GdQcx3oG|nk8R@VI(?L#RqLV94r4dDnS(2~{x+VlB*Hk-|4GLj_y_5b(dzntpa z<`MvC0~(9=#U?=Mum0*s=Es9W;P8{DCX1zNj>GY#y+s zrhU5A`Tksm;p8PY=+rGEmG#31Zdh-3l{Z{=)Gp6XL58NDzE`IE{TE(0^{t9uY{LIwbM~A2D>+8+c+uh>m)7js| z&DFxo($w4G-QC^K*4*0Q<<;Ba)7s$1&eqP=+}7OU$p-s9-P%hSQi z(*OVeA^8LV00000EC2ui00jVq000L6z@2bNEb@-XWMa7lIGwU+R6wOluGgDZJL`67 zU~q0cUYO0cblSjXN8WFpT>hxn33z;Mzo+>96M=yRgoHhZhdzpnjE# Date: Tue, 1 Sep 2009 18:37:51 +0000 Subject: [PATCH 554/607] Save some calls here, since page_footer(true) gets called quite often. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10087 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index f18514096f..96ecf739ed 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4288,6 +4288,7 @@ function page_footer($run_cron = true) if (!defined('IN_CRON') && $run_cron && !$config['board_disable']) { $call_cron = true; + $time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time(); // Any old lock present? if (!empty($config['cron_lock'])) @@ -4295,7 +4296,7 @@ function page_footer($run_cron = true) $cron_time = explode(' ', $config['cron_lock']); // If 1 hour lock is present we do not call cron.php - if ($cron_time[0] + 3600 >= time()) + if ($cron_time[0] + 3600 >= $time_now) { $call_cron = false; } @@ -4307,31 +4308,31 @@ function page_footer($run_cron = true) { $cron_type = ''; - if (time() - $config['queue_interval'] > $config['last_queue_run'] && !defined('IN_ADMIN') && file_exists($phpbb_root_path . 'cache/queue.' . $phpEx)) + if ($time_now - $config['queue_interval'] > $config['last_queue_run'] && !defined('IN_ADMIN') && file_exists($phpbb_root_path . 'cache/queue.' . $phpEx)) { // Process email queue $cron_type = 'queue'; } - else if (method_exists($cache, 'tidy') && time() - $config['cache_gc'] > $config['cache_last_gc']) + else if (method_exists($cache, 'tidy') && $time_now - $config['cache_gc'] > $config['cache_last_gc']) { // Tidy the cache $cron_type = 'tidy_cache'; } - else if ($config['warnings_expire_days'] && (time() - $config['warnings_gc'] > $config['warnings_last_gc'])) + else if ($config['warnings_expire_days'] && ($time_now - $config['warnings_gc'] > $config['warnings_last_gc'])) { $cron_type = 'tidy_warnings'; } - else if (time() - $config['database_gc'] > $config['database_last_gc']) + else if ($time_now - $config['database_gc'] > $config['database_last_gc']) { // Tidy the database $cron_type = 'tidy_database'; } - else if (time() - $config['search_gc'] > $config['search_last_gc']) + else if ($time_now - $config['search_gc'] > $config['search_last_gc']) { // Tidy the search $cron_type = 'tidy_search'; } - else if (time() - $config['session_gc'] > $config['session_last_gc']) + else if ($time_now - $config['session_gc'] > $config['session_last_gc']) { $cron_type = 'tidy_sessions'; } From 73baf42558b70acf7b2e194a84172778374a1c6e Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Wed, 2 Sep 2009 05:12:23 +0000 Subject: [PATCH 555/607] Fixed bugs #43145, #44375, #44415 and #43045 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10088 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 7 +++++-- phpBB/includes/acp/acp_ban.php | 6 ++++-- phpBB/includes/acp/acp_icons.php | 23 +++++++++++++++++++++++ phpBB/includes/acp/acp_users.php | 25 +++++++++++++++++++++++++ phpBB/includes/functions.php | 2 +- 5 files changed, 58 insertions(+), 5 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e3592c7fd0..c460081a04 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -205,6 +205,8 @@
  • [Fix] Fix handling of bookmarks and subscriptions on "split topcis", "merge topics" and "merge posts". (Bug #50035)
  • [Fix] Only embed cron.php if there is no cron lock present to reduce overhead. (Bug #45725 - Patch by TerryE)
  • [Fix] Add header gradient back into subsilver2 but keep site logo easily replaceable with smaller and bigger ones. (Bug #11142 - Patch by dark/Rain and Raimon)
  • +
  • [Fix] Activation email not sent from user settings (Bug #43145)
  • +
  • [Fix] Resend activation e-mail link inappropriate if using Admin activation (Bug #44375 - Patch by bbrunnrman)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • @@ -231,11 +233,12 @@
  • [Change] Parse multiline url title for [url] BBCode tag. (Bug #1309)
  • [Change] Introduce new parameter to page_header() for forum specific who is online listings.
  • [Change] Lifted minimum requirement for Firebird DBMS from 2.0+ to 2.1+.
  • -
  • [Change] Unapproved topics can no longer be replied to (Bug #44005)
  • +
  • [Change] Unapproved topics can no longer be replied to (Bug #44005, #47675, #23605)
  • [Change] Require user to be registered and logged in to search for unread posts if topic read tracking is disabled for guests (Bug #49525)
  • [Change] Allow three-digit hex notation in Color BBcode. (Bug #39965 - Patch by m0rpha)
  • [Change] Simplified login_box() and redirection after login. S_LOGIN_ACTION can now be used on every page. (Bug #50285)
  • [Change] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)
  • +
  • [Change] Resize oversized Topic icons (Bug #44415)
  • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
  • [Feature] Backported 3.2 captcha plugins.
      @@ -269,7 +272,7 @@
    • [Feature] Add option to disable remote upload avatars (Bug #45375 - Patch by nickvergessen)
    • [Feature] Ability to delete warnings and keep warnings permanently (Bug #43375 - Patch by nickvergessen)
    • [Feature] Ability to empty a user's outbox from the user ACP quick tools.
    • -
    • [Feature] Ability to filter ACP / MCP logs
    • +
    • [Feature] Ability to search ACP / MCP logs
    • [Feature] Users can report PMs to moderators which are then visible in a new MCP module
    • [Feature] Parse email text files with the template engine.
    • [Feature] Use email-style quoting when bbcodes are disabled.
    • diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php index 542ed47f3b..3198376584 100644 --- a/phpBB/includes/acp/acp_ban.php +++ b/phpBB/includes/acp/acp_ban.php @@ -156,7 +156,8 @@ class acp_ban FROM ' . BANLIST_TABLE . ' WHERE (ban_end >= ' . time() . " OR ban_end = 0) - AND ban_ip <> ''"; + AND ban_ip <> '' + ORDER BY ban_ip"; break; case 'email': @@ -168,7 +169,8 @@ class acp_ban FROM ' . BANLIST_TABLE . ' WHERE (ban_end >= ' . time() . " OR ban_end = 0) - AND ban_email <> ''"; + AND ban_email <> '' + ORDER BY ban_email"; break; } $result = $db->sql_query($sql); diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index fa1e324cc6..8213c55ccb 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -89,6 +89,18 @@ class acp_icons continue; } + // adjust the width and height to be lower than 128px while perserving the aspect ratio + if ($img_size[0] > 127 && $img_size[0] > $img_size[1]) + { + $img_size[1] = (int) ($img_size[1] * (127 / $img_size[0])); + $img_size[0] = 127; + } + else if ($img_size[1] > 127) + { + $img_size[0] = (int) ($img_size[0] * (127 / $img_size[1])); + $img_size[1] = 127; + } + $_images[$path . $img]['file'] = $path . $img; $_images[$path . $img]['width'] = $img_size[0]; $_images[$path . $img]['height'] = $img_size[1]; @@ -388,6 +400,17 @@ class acp_icons $image_height[$image] = $img_size[1]; } + if ($image_width[$image] > 127 && $image_width[$image] > $image_height[$image]) + { + $image_height[$image] = (int) ($image_height[$image] * (127 / $image_width[$image])); + $image_width[$image] = 127; + } + else if ($image_height[$image] > 127) + { + $image_width[$image] = (int) ($image_width[$image] * (127 / $image_height[$image])); + $image_height[$image] = 127; + } + $img_sql = array( $fields . '_url' => $image, $fields . '_width' => $image_width[$image], diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 71720f45b4..98a0cfebd5 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -385,6 +385,31 @@ class acp_users user_active_flip('flip', $user_id); + if ($user_row['user_type'] == USER_INACTIVE) + { + if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + { + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $messenger = new messenger(false); + + $messenger->template('admin_welcome_activated', $user_row['user_lang']); + + $messenger->to($user_row['user_email'], $user_row['username']); + + $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($user_row['username'])) + ); + + $messenger->send(NOTIFY_EMAIL); + } + } + $message = ($user_row['user_type'] == USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED'; $log = ($user_row['user_type'] == USER_INACTIVE) ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE'; diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 96ecf739ed..8957633ec7 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3006,7 +3006,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa 'LOGIN_EXPLAIN' => $l_explain, 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '', - 'U_RESEND_ACTIVATION' => ($config['require_activation'] != USER_ACTIVATION_NONE && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '', + 'U_RESEND_ACTIVATION' => ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '', 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), From c8ce477f909b147b6c6eaccdc0c039840b74520c Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Wed, 2 Sep 2009 05:20:59 +0000 Subject: [PATCH 556/607] attributed the fix for bug 43045 to DavidIQ git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10089 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index c460081a04..4ad8bae7f7 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -239,6 +239,7 @@
    • [Change] Simplified login_box() and redirection after login. S_LOGIN_ACTION can now be used on every page. (Bug #50285)
    • [Change] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)
    • [Change] Resize oversized Topic icons (Bug #44415)
    • +
    • [Change] Banned IPs are now sorted (Bug #43045 - Patch by DavidIQ)
    • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
    • [Feature] Backported 3.2 captcha plugins.
        From 5b004f31b5ce5df459a7179f0f7d14d5be000927 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 3 Sep 2009 09:25:16 +0000 Subject: [PATCH 557/607] We only remove board cookies (this is what the feature is supposed to do). This also solves issues with headers having > 20 Set-Cookie calls (which in turn breaks varnish 2.0.4-rc1 too) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10090 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/ucp.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 061933fb0c..994fe064a1 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -143,6 +143,12 @@ switch ($mode) foreach ($_COOKIE as $cookie_name => $cookie_data) { + // Only delete board cookies, no other ones... + if (strpos($cookie_name, $config['cookie_name'] . '_') !== 0) + { + continue; + } + $cookie_name = str_replace($config['cookie_name'] . '_', '', $cookie_name); // Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_ From 46e66c04011288a79ffb6232e4ccecb20240f2ce Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 3 Sep 2009 12:45:46 +0000 Subject: [PATCH 558/607] Some cleanup. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10091 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../plugins/phpbb_captcha_qa_plugin.php | 173 ++++++++++-------- 1 file changed, 96 insertions(+), 77 deletions(-) diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index 511706bb93..d71a781ae7 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -17,12 +17,11 @@ if (!defined('IN_PHPBB')) } global $table_prefix; + define('CAPTCHA_QUESTIONS_TABLE', $table_prefix . 'captcha_questions'); define('CAPTCHA_ANSWERS_TABLE', $table_prefix . 'captcha_answers'); define('CAPTCHA_QA_CONFIRM_TABLE', $table_prefix . 'qa_confirm'); - - /** * And now to something completely different. Let's make a captcha without extending the abstract class. * QA CAPTCHA sample implementation @@ -51,27 +50,37 @@ class phpbb_captcha_qa // load our language file $user->add_lang('captcha_qa'); + // read input $this->confirm_id = request_var('qa_confirm_id', ''); $this->answer = request_var('qa_answer', '', true); $this->type = (int) $type; $this->question_lang = $user->data['user_lang']; + // we need all defined questions - shouldn't be too many, so we can just grab them // try the user's lang first - $sql = 'SELECT question_id FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($user->data['user_lang']) . '\''; + $sql = 'SELECT question_id + FROM ' . CAPTCHA_QUESTIONS_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($user->data['user_lang']) . "'"; $result = $db->sql_query($sql, 3600); + while ($row = $db->sql_fetchrow($result)) { $this->question_ids[$row['question_id']] = $row['question_id']; } $db->sql_freeresult($result); + // fallback to the board default lang if (!sizeof($this->question_ids)) { $this->question_lang = $config['default_lang']; - $sql = 'SELECT question_id FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($config['default_lang']) . '\''; + + $sql = 'SELECT question_id + FROM ' . CAPTCHA_QUESTIONS_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; $result = $db->sql_query($sql, 7200); + while ($row = $db->sql_fetchrow($result)) { $this->question_ids[$row['question_id']] = $row['question_id']; @@ -93,6 +102,7 @@ class phpbb_captcha_qa function &get_instance() { $instance =& new phpbb_captcha_qa(); + return $instance; } @@ -108,31 +118,35 @@ class phpbb_captcha_qa include("$phpbb_root_path/includes/db/db_tools.$phpEx"); } $db_tool = new phpbb_db_tools($db); + return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE); } - + /** * API function - for the captcha to be available, it must have installed itself and there has to be at least one question in the board's default lang */ function is_available() { global $config, $db, $phpbb_root_path, $phpEx, $user; - + // load language file for pretty display in the ACP dropdown $user->add_lang('captcha_qa'); - + if (!phpbb_captcha_qa::is_installed()) { return false; } - $sql = 'SELECT COUNT(question_id) as count FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($config['default_lang']) . '\''; + + $sql = 'SELECT COUNT(question_id) as count + FROM ' . CAPTCHA_QUESTIONS_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); + return ((bool) $row['count']); } - /** * API function */ @@ -141,7 +155,6 @@ class phpbb_captcha_qa return true; } - /** * API function */ @@ -158,7 +171,6 @@ class phpbb_captcha_qa return 'phpbb_captcha_qa'; } - /** * API function - not needed as we don't display an image */ @@ -179,7 +191,7 @@ class phpbb_captcha_qa function get_template() { global $template; - + if ($this->is_solved()) { return false; @@ -218,6 +230,7 @@ class phpbb_captcha_qa $hidden_fields['qa_answer'] = $this->answer; } $hidden_fields['qa_confirm_id'] = $this->confirm_id; + return $hidden_fields; } @@ -230,7 +243,8 @@ class phpbb_captcha_qa $sql = 'SELECT DISTINCT c.session_id FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' c - LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) + LEFT JOIN ' . SESSIONS_TABLE . ' s + ON (c.session_id = s.session_id) WHERE s.session_id IS NULL' . ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); $result = $db->sql_query($sql); @@ -238,6 +252,7 @@ class phpbb_captcha_qa if ($row = $db->sql_fetchrow($result)) { $sql_in = array(); + do { $sql_in[] = (string) $row['session_id']; @@ -274,8 +289,9 @@ class phpbb_captcha_qa include("$phpbb_root_path/includes/db/db_tools.$phpEx"); } $db_tool = new phpbb_db_tools($db); + $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE); - + $schemas = array( CAPTCHA_QUESTIONS_TABLE => array ( 'COLUMNS' => array( @@ -315,7 +331,7 @@ class phpbb_captcha_qa 'PRIMARY_KEY' => 'confirm_id', ), ); - + foreach($schemas as $table => $schema) { if (!$db_tool->sql_table_exists($table)) @@ -325,15 +341,15 @@ class phpbb_captcha_qa } } - /** * API function - see what has to be done to validate */ function validate() { global $config, $db, $user; - + $error = ''; + if (!$this->confirm_id) { $error = $user->lang['CONFIRM_QUESTION_WRONG']; @@ -356,6 +372,7 @@ class phpbb_captcha_qa // okay, incorrect answer. Let's ask a new question. $this->new_attempt(); $this->solved = false; + return $error; } else @@ -373,17 +390,17 @@ class phpbb_captcha_qa $this->confirm_id = md5(unique_id($user->ip)); $this->question = (int) array_rand($this->question_ids); - + $sql = 'INSERT INTO ' . CAPTCHA_QA_CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'confirm_id' => (string) $this->confirm_id, - 'session_id' => (string) $user->session_id, - 'lang_iso' => (string) $this->question_lang, - 'confirm_type' => (int) $this->type, - 'question_id' => (int) $this->question, + 'confirm_id' => (string) $this->confirm_id, + 'session_id' => (string) $user->session_id, + 'lang_iso' => (string) $this->question_lang, + 'confirm_type' => (int) $this->type, + 'question_id' => (int) $this->question, )); $db->sql_query($sql); - $this->load_answer(); + $this->load_answer(); } /** @@ -395,14 +412,13 @@ class phpbb_captcha_qa $this->question = (int) array_rand($this->question_ids); $this->solved = 0; - // compute $seed % 0x7fffffff - $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( - 'question' => (int) $this->question,)) . ' - WHERE - confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' - AND session_id = \'' . $db->sql_escape($user->session_id) . '\''; + $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' + SET question_id = ' . (int) $this->question . " + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "'"; $db->sql_query($sql); + $this->load_answer(); } @@ -416,15 +432,14 @@ class phpbb_captcha_qa // yah, I would prefer a stronger rand, but this should work $this->question = (int) array_rand($this->question_ids); $this->solved = 0; - // compute $seed % 0x7fffffff - $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( - 'question_id' => (int) $this->question)) . ', - attempts = attempts + 1 - WHERE - confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' - AND session_id = \'' . $db->sql_escape($user->session_id) . '\''; + $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' + SET question_id = ' . (int) $this->question . ", + attempts = attempts + 1 + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "'"; $db->sql_query($sql); + $this->load_answer(); } @@ -434,7 +449,7 @@ class phpbb_captcha_qa function load_answer() { global $db, $user; - + $sql = 'SELECT con.question_id, attempts, question_text, strict FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' con, ' . CAPTCHA_QUESTIONS_TABLE . " qes WHERE con.question_id = qes.question_id @@ -453,8 +468,10 @@ class phpbb_captcha_qa $this->attempts = $row['attempts']; $this->question_strict = $row['strict']; $this->question_text = $row['question_text']; + return true; } + return false; } @@ -464,23 +481,27 @@ class phpbb_captcha_qa function check_answer() { global $db; - + $answer = ($this->question_strict) ? request_var('qa_answer', '', true) : utf8_clean_string(request_var('qa_answer', '', true)); - + $sql = 'SELECT answer_text - FROM ' . CAPTCHA_ANSWERS_TABLE . ' - WHERE question_id = ' . (int) $this->question; + FROM ' . CAPTCHA_ANSWERS_TABLE . ' + WHERE question_id = ' . (int) $this->question; $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { - $solution = ($this->question_strict) ? $row['answer_text'] : utf8_clean_string($row['answer_text'] ); + $solution = ($this->question_strict) ? $row['answer_text'] : utf8_clean_string($row['answer_text']); + if ($solution === $answer) { $this->solved = true; + break; } } $db->sql_freeresult($result); + return $this->solved; } @@ -531,10 +552,10 @@ class phpbb_captcha_qa { $this->validate(); } + return (bool) $this->solved; } - - + /** * API function - The ACP backend, this marks the end of the easy methods */ @@ -550,6 +571,7 @@ class phpbb_captcha_qa { $this->install(); } + $module->tpl_name = 'captcha_qa_acp'; $module->page_title = 'ACP_VC_SETTINGS'; $form_key = 'acp_captcha'; @@ -558,14 +580,14 @@ class phpbb_captcha_qa $submit = request_var('submit', false); $question_id = request_var('question_id', 0); $action = request_var('action', ''); - + // we have two pages, so users might want to navigate from one to the other $list_url = $module->u_action . "&configure=1&select_captcha=" . $this->get_class_name(); - + $template->assign_vars(array( - 'U_ACTION' => $module->u_action, - 'QUESTION_ID' => $question_id , - 'CLASS' => $this->get_class_name(), + 'U_ACTION' => $module->u_action, + 'QUESTION_ID' => $question_id , + 'CLASS' => $this->get_class_name(), )); // show the list? @@ -578,6 +600,7 @@ class phpbb_captcha_qa if (confirm_box(true)) { $this->acp_delete_question($question_id); + trigger_error($user->lang['QUESTION_DELETED'] . adm_back_link($list_url)); } else @@ -600,6 +623,7 @@ class phpbb_captcha_qa $input_lang = request_var('lang_iso', '', true); $input_strict = request_var('strict', false); $langs = $this->get_languages(); + foreach ($langs as $lang => $entry) { $template->assign_block_vars('langs', array( @@ -607,15 +631,17 @@ class phpbb_captcha_qa 'NAME' => $entry['name'], )); } - + $template->assign_vars(array( - 'U_LIST' => $list_url, + 'U_LIST' => $list_url, )); + if ($question_id) { if ($question = $this->acp_get_question_data($question_id)) { $answers = (isset($input_answers[$lang])) ? $input_answers[$lang] : implode("\n", $question['answers']); + $template->assign_vars(array( 'QUESTION_TEXT' => ($input_question) ? $input_question : $question['question_text'], 'LANG_ISO' => ($input_lang) ? $input_lang : $question['lang_iso'], @@ -630,18 +656,18 @@ class phpbb_captcha_qa } else { - $template->assign_vars(array( - 'QUESTION_TEXT' => $input_question, - 'LANG_ISO' => $input_lang, - 'STRICT' => $input_strict, - 'ANSWERS' => $input_answers, + 'QUESTION_TEXT' => $input_question, + 'LANG_ISO' => $input_lang, + 'STRICT' => $input_strict, + 'ANSWERS' => $input_answers, )); } - + if ($submit && check_form_key($form_key)) { $data = $this->acp_get_question_input(); + if (!$this->validate_input($data)) { $template->assign_vars(array( @@ -658,7 +684,7 @@ class phpbb_captcha_qa { $this->acp_add_question($data); } - + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($list_url)); } } @@ -668,7 +694,6 @@ class phpbb_captcha_qa } } } - /** * This handles the list overview @@ -676,7 +701,7 @@ class phpbb_captcha_qa function acp_question_list(&$module) { global $db, $template; - + $sql = 'SELECT * FROM ' . CAPTCHA_QUESTIONS_TABLE; $result = $db->sql_query($sql); @@ -688,7 +713,7 @@ class phpbb_captcha_qa while ($row = $db->sql_fetchrow($result)) { $url = $module->u_action . "&question_id={$row['question_id']}&configure=1&select_captcha=" . $this->get_class_name() . '&'; - + $template->assign_block_vars('questions', array( 'QUESTION_TEXT' => $row['question_text'], 'QUESTION_ID' => $row['question_id'], @@ -737,8 +762,7 @@ class phpbb_captcha_qa return $question; } } - - + /** * Grab a question from input and bring it into a format the editor understands */ @@ -780,7 +804,7 @@ class phpbb_captcha_qa $cache->destroy('sql', CAPTCHA_QUESTIONS_TABLE); } - + /** * Insert a question. * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data @@ -795,7 +819,7 @@ class phpbb_captcha_qa $question_ary['lang_id'] = $langs[$data['lang_iso']]['id']; unset($question_ary['answers']); - $sql = 'INSERT INTO ' . CAPTCHA_QUESTIONS_TABLE . $db->sql_build_array('INSERT', $question_ary); + $sql = 'INSERT INTO ' . CAPTCHA_QUESTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $question_ary); $db->sql_query($sql); $question_id = $db->sql_nextid(); @@ -804,7 +828,7 @@ class phpbb_captcha_qa $cache->destroy('sql', CAPTCHA_QUESTIONS_TABLE); } - + /** * Insert the answers. * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data @@ -812,7 +836,7 @@ class phpbb_captcha_qa function acp_insert_answers($data, $question_id) { global $db, $cache; - + foreach ($data['answers'] as $answer) { $answer_ary = array( @@ -820,13 +844,12 @@ class phpbb_captcha_qa 'answer_text' => $answer, ); - $sql = 'INSERT INTO ' . CAPTCHA_ANSWERS_TABLE . $db->sql_build_array('INSERT', $answer_ary); + $sql = 'INSERT INTO ' . CAPTCHA_ANSWERS_TABLE . ' ' . $db->sql_build_array('INSERT', $answer_ary); $db->sql_query($sql); } $cache->destroy('sql', CAPTCHA_ANSWERS_TABLE); } - /** * Delete a question. @@ -846,8 +869,7 @@ class phpbb_captcha_qa $cache->destroy('sql', $tables); } - - + /** * Check if the entered data can be inserted/used * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data @@ -873,7 +895,7 @@ class phpbb_captcha_qa return true; } - + /** * List the installed language packs */ @@ -881,13 +903,11 @@ class phpbb_captcha_qa { global $db; - $langs = array(); - $sql = 'SELECT * FROM ' . LANG_TABLE; - $result = $db->sql_query($sql); + $langs = array(); while ($row = $db->sql_fetchrow($result)) { $langs[$row['lang_iso']] = array( @@ -899,7 +919,6 @@ class phpbb_captcha_qa return $langs; } - } ?> \ No newline at end of file From 57ed7fd0886f66b9cb465f7acd60be7ee1024fed Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 3 Sep 2009 13:44:16 +0000 Subject: [PATCH 559/607] Bug #39505, r9677 - Add integer casting and allow array to be empty. Unset array when no longer needed. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10092 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_privmsgs.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index f6dd29cd99..848218ca83 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1707,8 +1707,8 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $recipients = array(); while ($row = $db->sql_fetchrow($result)) { - $recipients[] = $row['user_id']; - $recipients[] = $row['author_id']; + $recipients[] = (int) $row['user_id']; + $recipients[] = (int) $row['author_id']; } $db->sql_freeresult($result); $recipients = array_unique($recipients); @@ -1719,9 +1719,12 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode WHERE t.msg_id = p.msg_id AND p.author_id = u.user_id AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') - AND ' . $db->sql_in_set('t.author_id', $recipients) . " + AND ' . $db->sql_in_set('t.author_id', $recipients, false, true) . " AND t.user_id = $user_id"; + // We no longer need those. + unset($recipients); + if (!$message_row['root_level']) { $sql .= " AND (p.root_level = $msg_id OR (p.root_level = 0 AND p.msg_id = $msg_id))"; From 19086ba57289be4101131095aeeb615de2bc5639 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 3 Sep 2009 13:56:03 +0000 Subject: [PATCH 560/607] Some rewording, some typo fixes, some whitespace changes. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10093 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 18 +++++++++--------- .../plugins/phpbb_captcha_qa_plugin.php | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 4ad8bae7f7..3fc6ceaa52 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -104,7 +104,7 @@
      • [Fix] Fix dynamic config update routine error if firebird is used (Bug #46315)
      • [Fix] Allow friends/foes to be added and removed at the same time. (Bug #46255 - Patch by bantu)
      • [Fix] Only change topic/post icon if icons are enabled and user is allowed to. (Bug #46355 - Patch by bantu)
      • -
      • [Fix] Fix saving custom profile fields in ACP if Oracle used (Bug #46015)
      • +
      • [Fix] Fix saving custom profile fields in ACP if Oracle is used. (Bug #46015)
      • [Fix] Make view_log() more resilient to corrupt serialized data. (Bug #46545)
      • [Fix] Show error if hostname lookup doesn't return a valid IP address when banning. (Bug #45585 - Patch by bantu)
      • [Fix] Fix incorrect layout when loading private message draft. (Bug #38435 - Patch by nickvergessen)
      • @@ -130,7 +130,7 @@
      • [Fix] Fix reapply_sid() to correctly strip session id in certain circumstances (Bug #43125 - Patch by leviatan21)
      • [Fix] Correctly state why one language pack is marked with an asterisk in the ACP. (Bug #37565 - Patch by bantu)
      • [Fix] Correctly check if install directory is still present. (Bug #46965 - Patch by rxu)
      • -
      • [Fix] Correct banned user behaviour when "force password change" is enabled (Bug #47145 - Patch by nickvergessen and leviatan21 )
      • +
      • [Fix] Correct banned user behaviour when "force password change" is enabled (Bug #47145 - Patch by nickvergessen and leviatan21)
      • [Fix] Correctly display ACP logs options, without permission to clear logs. (Bug #24155 - Patch by leviatan21)
      • [Fix] Display topic icons in MCP forum view again (only prosilver).
      • [Fix] Properly display post status messages in topic when post is reported and unapproved (Bug #44455 - Patch by leviatan21)
      • @@ -181,7 +181,7 @@
      • [Fix] Do not send private message back to sender if sender is in the same group the private message was sent to.
      • [Fix] Correctly add user to a group making it a default one. (Bug #48345 - Patch by rxu)
      • [Fix] Add log entry when copying forum permissions.
      • -
      • [Fix] Min/max characters per posts also affects polls option (Bug #47295 - Patch by nickvergessen)
      • +
      • [Fix] Min/max characters per posts no longer affects poll options (Bug #47295 - Patch by nickvergessen)
      • [Fix] Correctly log action when users request to join a group (Bug #37585 - Patch by nickvergessen)
      • [Fix] Do not try to create thumbnails for images we cannot open properly. (Bug #48695)
      • [Fix] Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke)
      • @@ -202,11 +202,11 @@
      • [Fix] Make sure only logs for existing users are displayed and user-specific logs removed on user deletion. (Bug #49855)
      • [Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)
      • [Fix] Correctly display list items in forum description in prosilver and administration. (Bug #48055 - Patch by leviatan21)
      • -
      • [Fix] Fix handling of bookmarks and subscriptions on "split topcis", "merge topics" and "merge posts". (Bug #50035)
      • +
      • [Fix] Fix handling of bookmarks and subscriptions on "split topics", "merge topics" and "merge posts". (Bug #50035)
      • [Fix] Only embed cron.php if there is no cron lock present to reduce overhead. (Bug #45725 - Patch by TerryE)
      • [Fix] Add header gradient back into subsilver2 but keep site logo easily replaceable with smaller and bigger ones. (Bug #11142 - Patch by dark/Rain and Raimon)
      • -
      • [Fix] Activation email not sent from user settings (Bug #43145)
      • -
      • [Fix] Resend activation e-mail link inappropriate if using Admin activation (Bug #44375 - Patch by bbrunnrman)
      • +
      • [Fix] Send activation email when activating user from user settings. (Bug #43145)
      • +
      • [Fix] Do not show resend activation email link when using admin activation. (Bug #44375 - Patch by bbrunnrman)
      • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
      • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
      • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
      • @@ -220,8 +220,8 @@
      • [Change] INCLUDEPHP not depending on phpbb_root_path (Bug #45805 - Patch by nickvergessen)
      • [Change] Ability to fetch moderators with get_moderators() even if load_moderators setting is off. (Bug #35955)
      • [Change] "Post details" links with image in MCP. (Bug #39845 - Patch by leviatan21)
      • -
      • [Change] Pm history only shows pms of the receipts you currently reply to (Bug #39505 - Patch by nickvergessen)
      • -
      • [Change] Add quote-button for own pm's in pm-history (Bug #37285 - Patch by nickvergessen)
      • +
      • [Change] PM history now only shows PMs of users you currently reply to. (Bug #39505 - Patch by nickvergessen)
      • +
      • [Change] Show quote button for own PMs in PM history. (Bug #37285 - Patch by nickvergessen)
      • [Change] Fetch requested cookie variables directly from cookie super global. (Bug #47785)
      • [Change] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
      • [Change] Add confirmation for deactivating language packs (Patch by leviatan21)
      • @@ -270,7 +270,7 @@
      • [Feature] Add bare-bones quick-reply editor to viewtopic.
      • [Feature] Detect when a post has been altered by someone else while editing. (Patch by bantu)
      • [Feature] Add unread posts quick search option (Bug #46765 - Patch by rxu)
      • -
      • [Feature] Add option to disable remote upload avatars (Bug #45375 - Patch by nickvergessen)
      • +
      • [Feature] Add option to disable avatar uploads from remote locations. (Bug #45375 - Patch by nickvergessen)
      • [Feature] Ability to delete warnings and keep warnings permanently (Bug #43375 - Patch by nickvergessen)
      • [Feature] Ability to empty a user's outbox from the user ACP quick tools.
      • [Feature] Ability to search ACP / MCP logs
      • diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index d71a781ae7..15ad18ba87 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -95,7 +95,7 @@ class phpbb_captcha_qa $this->select_question(); } } - + /** * API function */ @@ -442,7 +442,7 @@ class phpbb_captcha_qa $this->load_answer(); } - + /** * Look up everything we need and populate the instance variables. */ @@ -812,7 +812,7 @@ class phpbb_captcha_qa function acp_add_question($data) { global $db, $cache; - + $langs = $this->get_languages(); $question_ary = $data; From 4c6360f5b5766900c5d86e5522be1a622f15b345 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 3 Sep 2009 13:59:31 +0000 Subject: [PATCH 561/607] #50675 ; also don't reset the captcha on login git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10094 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 8957633ec7..69d764b7aa 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2082,7 +2082,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add } $on_page = floor($start_item / $per_page) + 1; - $url_delim = (strpos($base_url, '?') === false) ? '?' : '&'; + $url_delim = (strpos($base_url, '?') === false) ? '?' : ((strpos($base_url, '?') === strlen($base_url) - 1) ? '' : '&'); $page_string = ($on_page == 1) ? '1' : '1'; @@ -2949,7 +2949,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_LOGIN); - $captcha->reset(); + // $captcha->reset(); $template->assign_vars(array( 'CAPTCHA_TEMPLATE' => $captcha->get_template(), From 3cfde658f98debff71b29e2dbc2dd1da0c8851d2 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 3 Sep 2009 20:06:57 +0000 Subject: [PATCH 562/607] #50485 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10095 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/ucp/ucp_register.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index babedd4f12..8359c223e0 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -68,6 +68,7 @@ class ucp_register $user->lang_name = $user_lang = $use_lang; $user->lang = array(); + $user->data['user_lang'] = $user->lang_name; $user->add_lang(array('common', 'ucp')); } else From f2858bc1ca30303e53d68621e99119fd274645fb Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 4 Sep 2009 10:19:04 +0000 Subject: [PATCH 563/607] XHTML compatible viewforum_body.html again (thanks Raimon for pointing this out) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10096 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/viewforum_body.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index a07f1f589e..70fd5c8496 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -3,11 +3,11 @@

        {FORUM_NAME}

        -

        +

        {FORUM_DESC}
        {L_MODERATOR}{L_MODERATORS}: {MODERATORS} -

        +
        From f17e49d11b3d8e7f5dd96afcc54a1cc172087651 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 4 Sep 2009 10:20:47 +0000 Subject: [PATCH 564/607] only whitespace changes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10097 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_users.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 98a0cfebd5..1afec6183a 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -551,11 +551,11 @@ class acp_users delete_pm($user_id, $msg_ids, PRIVMSGS_OUTBOX); add_log('admin', 'LOG_USER_DEL_OUTBOX', $user_row['username']); - + $lang = 'EMPTIED'; } $db->sql_freeresult($result); - + trigger_error($user->lang['USER_OUTBOX_' . $lang] . adm_back_link($this->u_action . '&u=' . $user_id)); } else @@ -725,7 +725,7 @@ class acp_users trigger_error($user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); break; - + case 'leave_nr': if (confirm_box(true)) From 2b5f04cf1c6987ec943ea3937e1d2c63b7982427 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 4 Sep 2009 10:25:31 +0000 Subject: [PATCH 565/607] changes for a little internal update test run git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10098 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 6 +++--- phpBB/install/schemas/schema_data.sql | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 8ebe261d9e..b98ebfdd5f 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,10 +8,10 @@ * */ -$updates_to_version = '3.0.6-dev'; +$updates_to_version = '3.0.6-alpha'; // Enter any version to update from to test updates. The version within the db will not be updated. -$debug_from_version = '3.0.5'; +$debug_from_version = false; // Which oldest version does this updater support? $oldest_from_version = '3.0.0'; @@ -834,7 +834,7 @@ function database_update_info() // No changes from 3.0.5-RC1 to 3.0.5 '3.0.5-RC1' => array(), - // Changes from 3.0.5 + // Changes from 3.0.5 to 3.0.6-RC1 '3.0.5' => array( 'add_columns' => array( CONFIRM_TABLE => array( diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index b582b8a8bd..2527cec999 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -239,7 +239,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.5'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.6-alpha'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); From c35cdff24195ed38ae6df98a59c27324a5c72d1c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 4 Sep 2009 12:04:30 +0000 Subject: [PATCH 566/607] Also update newest user data if someone is creating a founder with user_add(). git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10099 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 11b134cd85..7255d138ab 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -308,7 +308,7 @@ function user_add($user_row, $cp_data = false) } // set the newest user and adjust the user count if the user is a normal user and no activation mail is sent - if ($user_row['user_type'] == USER_NORMAL) + if ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_FOUNDER) { set_config('newest_user_id', $user_id, true); set_config('newest_username', $user_row['username'], true); From 2c997e3ed9b3057cdaf9fd550c57b814af83b02a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 4 Sep 2009 14:48:35 +0000 Subject: [PATCH 567/607] Somehow i must've been blind while adding/changing the links. Consistency! git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10100 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/install_update.html | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index a5a0f8b5b6..0260fdf9cb 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -219,8 +219,7 @@
        {L_FILE_USED}: {new.CUSTOM_ORIGINAL}
        - [ {new.L_SHOW_DIFF} - {L_BINARY_FILE} + [{new.L_SHOW_DIFF}]{L_BINARY_FILE}
        @@ -243,7 +242,7 @@
        {not_modified.DIR_PART}
        {not_modified.FILE_PART}

        {L_FILE_USED}: {not_modified.CUSTOM_ORIGINAL}
        -
        [ {not_modified.L_SHOW_DIFF} ]{L_BINARY_FILE}
        +
        [{not_modified.L_SHOW_DIFF}]{L_BINARY_FILE}
        @@ -271,7 +270,7 @@
        -
        [ {modified.L_SHOW_DIFF} ]{L_BINARY_FILE}
        +
        [{modified.L_SHOW_DIFF}]{L_BINARY_FILE}
        @@ -298,8 +297,7 @@
        {L_FILE_USED}: {new_conflict.CUSTOM_ORIGINAL}
        - [ {new_conflict.L_SHOW_DIFF} - {L_BINARY_FILE} + [{new_conflict.L_SHOW_DIFF}]{L_BINARY_FILE}
        @@ -323,7 +321,7 @@
        {L_NUM_CONFLICTS}: {conflict.NUM_CONFLICTS}
        - [ {L_DOWNLOAD_CONFLICTS} ]
        {L_DOWNLOAD_CONFLICTS_EXPLAIN} + [{L_DOWNLOAD_CONFLICTS}]
        {L_DOWNLOAD_CONFLICTS_EXPLAIN} {L_BINARY_FILE}
        @@ -462,7 +460,7 @@
        - +
        {S_HIDDEN_FIELDS} From ba2fb956de1affbd924c07b020385413077bbe8a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 4 Sep 2009 14:49:41 +0000 Subject: [PATCH 568/607] spelling git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10101 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 5d3a5e91cb..b653d54318 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -470,7 +470,7 @@ $lang = array_merge($lang, array( 'NO_VISIBLE_CHANGES' => 'No visible changes', 'NOTICE' => 'Notice', 'NUM_CONFLICTS' => 'Number of conflicts', - 'NUMBER_OF_FILES_COLLECTED' => 'Currently differences of %1$d of %2$d files have been checked.
        Please wait until all files are checked.', + 'NUMBER_OF_FILES_COLLECTED' => 'Currently differences from %1$d of %2$d files have been checked.
        Please wait until all files are checked.', 'OLD_UPDATE_FILES' => 'Update files are out of date. The update files found are for updating from phpBB %1$s to phpBB %2$s but the latest version of phpBB is %3$s.', From 186abf0798463d2bb9e37117ec7d451efd37b7a1 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 4 Sep 2009 14:50:05 +0000 Subject: [PATCH 569/607] phpBB updater now skips sole whitespace changes. This reduces the chance of conflicts tremendously. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10102 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/diff/engine.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3fc6ceaa52..abd7719c0d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -240,6 +240,7 @@
      • [Change] Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615)
      • [Change] Resize oversized Topic icons (Bug #44415)
      • [Change] Banned IPs are now sorted (Bug #43045 - Patch by DavidIQ)
      • +
      • [Change] phpBB updater now skips sole whitespace changes. This reduces the chance of conflicts tremendously.
      • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
      • [Feature] Backported 3.2 captcha plugins.
          diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php index eb0dcce395..e9f0e41b75 100644 --- a/phpBB/includes/diff/engine.php +++ b/phpBB/includes/diff/engine.php @@ -49,6 +49,8 @@ if (!defined('IN_PHPBB')) */ class diff_engine { + var $skip_whitespace_changes = true; + function diff(&$from_lines, &$to_lines, $preserve_cr = true) { // Remove empty lines... @@ -176,6 +178,20 @@ class diff_engine $add[] = $to_lines[$yi++]; } + // Here we are a bit naughty. Naughty Boy... Naughty Boy... + // We check if delete and add is filled and only consist of one item + if ($this->skip_whitespace_changes && sizeof($delete) == 1 && sizeof($add) == 1) + { + // Now we simply trim the string and see if the lines are identical + // If they are identical we do not need to take them into account for the merge (less conflicts in phpBB) + if (trim($delete[0]) === trim($add[0])) + { + // This line ensures the line found here is correctly copied later (remember: we naughty boys like loops) + $xi--; $yi--; $this->xchanged[$xi] = $this->ychanged[$yi] = false; + $delete = $add = array(); + } + } + if ($delete && $add) { $edits[] = new diff_op_change($delete, $add); From 295fb5373ae0a37bfbc36a4461dc3ed2c3cbf9cb Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Fri, 4 Sep 2009 14:53:35 +0000 Subject: [PATCH 570/607] - fixed bug #44975 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10103 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/session.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 112cf4e2fd..dcfde14159 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1361,6 +1361,20 @@ class session WHERE user_id = ' . (int) $user_id; $db->sql_query($sql); + // Update last visit info first before deleting sessions + $sql = 'SELECT session_time, session_page + FROM ' . SESSIONS_TABLE . ' + WHERE session_user_id = ' . (int) $user_id . ' + ORDER BY session_time DESC'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_lastvisit = ' . (int) $row['session_time'] . ", user_lastpage = '" . $db->sql_escape($row['session_page']) . "' + WHERE user_id = " . (int) $user_id; + $db->sql_query($sql); + // Let's also clear any current sessions for the specified user_id // If it's the current user then we'll leave this session intact $sql_where = 'session_user_id = ' . (int) $user_id; From d90e775f0e1ba2744fed662744b5b3570db9b425 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 4 Sep 2009 14:58:44 +0000 Subject: [PATCH 571/607] Let the user notice that downloading the files is not the end of the update process. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10104 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/install_update.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index 0260fdf9cb..4b89537acb 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -394,7 +394,7 @@
          {S_HIDDEN_FIELDS} -     +    
          From 31856352be0f29fd7423cfe87bdfd791b03fb938 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 4 Sep 2009 15:19:26 +0000 Subject: [PATCH 572/607] Change version numbers to 3.0.6 and 3.0.6-RC1 for a final internal test run git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10105 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/INSTALL.html | 4 ++-- phpBB/includes/constants.php | 2 +- phpBB/install/database_update.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/styles/prosilver/imageset/imageset.cfg | 2 +- phpBB/styles/prosilver/style.cfg | 2 +- phpBB/styles/prosilver/template/template.cfg | 2 +- phpBB/styles/prosilver/theme/theme.cfg | 2 +- phpBB/styles/subsilver2/imageset/imageset.cfg | 2 +- phpBB/styles/subsilver2/style.cfg | 2 +- phpBB/styles/subsilver2/template/template.cfg | 2 +- phpBB/styles/subsilver2/theme/theme.cfg | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 56f68b1dcb..c297abe267 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -273,7 +273,7 @@

          This package is meant for those wanting to only replace changed files from a previous version to the latest version. This package normally contains the changed files from up to five previous versions.

          -

          This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 3.0.4 you should select the phpBB-3.0.4_to_3.0.5.zip/tar.gz file.

          +

          This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 3.0.5 you should select the phpBB-3.0.5_to_3.0.6.zip/tar.gz file.

          The directory structure has been preserved enabling you (if you wish) to simply upload the contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any MODs these files will overwrite the originals possibly destroying them in the process. You will need to re-add MODs to any affected file before uploading.

          @@ -285,7 +285,7 @@

          The patch file is one solution for those with many Modifications (MODs) or other changes who do not want to re-add them back to all the changed files if they use the method explained above. To use this you will need command line access to a standard UNIX type patch application. If you do not have access to such an application but still want to use this update approach, we strongly recommend the Automatic update package explained below. It is also the recommended update method.

          -

          A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.4 you need the phpBB-3.0.4_to_3.0.5.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

          +

          A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.5 you need the phpBB-3.0.5_to_3.0.6.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

          If you do get failures you should look at using the Changed files only package to replace the files which failed to patch, please note that you will need to manually re-add any Modifications (MODs) to these particular files. Alternatively if you know how you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source.

          diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 98abf18b6f..a526b9bf71 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.5'); +define('PHPBB_VERSION', '3.0.6-RC1'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index b98ebfdd5f..ab22c803ee 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.6-alpha'; +$updates_to_version = '3.0.6-RC1'; // Enter any version to update from to test updates. The version within the db will not be updated. $debug_from_version = false; diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 2527cec999..5c653afc41 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -239,7 +239,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.6-alpha'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.6-RC1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); diff --git a/phpBB/styles/prosilver/imageset/imageset.cfg b/phpBB/styles/prosilver/imageset/imageset.cfg index 64b7f632c9..c838dffd03 100644 --- a/phpBB/styles/prosilver/imageset/imageset.cfg +++ b/phpBB/styles/prosilver/imageset/imageset.cfg @@ -19,7 +19,7 @@ # General Information about this style name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.5 +version = 3.0.6 # Images img_site_logo = site_logo.gif*52*139 diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index 7be43fb4fa..219106e9b6 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -19,4 +19,4 @@ # General Information about this style name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.5 \ No newline at end of file +version = 3.0.6 \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/template.cfg b/phpBB/styles/prosilver/template/template.cfg index 0e5e8f0530..22328dd50b 100644 --- a/phpBB/styles/prosilver/template/template.cfg +++ b/phpBB/styles/prosilver/template/template.cfg @@ -19,7 +19,7 @@ # General Information about this template name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.5 +version = 3.0.6 # Defining a different template bitfield template_bitfield = lNg= diff --git a/phpBB/styles/prosilver/theme/theme.cfg b/phpBB/styles/prosilver/theme/theme.cfg index 3a1dc6989a..91a35bbcc8 100644 --- a/phpBB/styles/prosilver/theme/theme.cfg +++ b/phpBB/styles/prosilver/theme/theme.cfg @@ -21,7 +21,7 @@ # General Information about this theme name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.5 +version = 3.0.6 # Some configuration options diff --git a/phpBB/styles/subsilver2/imageset/imageset.cfg b/phpBB/styles/subsilver2/imageset/imageset.cfg index d4189770f5..97fd0d8949 100644 --- a/phpBB/styles/subsilver2/imageset/imageset.cfg +++ b/phpBB/styles/subsilver2/imageset/imageset.cfg @@ -19,7 +19,7 @@ # General Information about this style name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.5 +version = 3.0.6 # Images img_site_logo = site_logo.gif*94*170 diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg index da64a05e5a..5eaaac782d 100644 --- a/phpBB/styles/subsilver2/style.cfg +++ b/phpBB/styles/subsilver2/style.cfg @@ -19,4 +19,4 @@ # General Information about this style name = subsilver2 copyright = © 2005 phpBB Group -version = 3.0.5 +version = 3.0.6 diff --git a/phpBB/styles/subsilver2/template/template.cfg b/phpBB/styles/subsilver2/template/template.cfg index 45c97f99d8..106eae28e6 100644 --- a/phpBB/styles/subsilver2/template/template.cfg +++ b/phpBB/styles/subsilver2/template/template.cfg @@ -19,5 +19,5 @@ # General Information about this template name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.5 +version = 3.0.6 diff --git a/phpBB/styles/subsilver2/theme/theme.cfg b/phpBB/styles/subsilver2/theme/theme.cfg index 4fe2824a32..57b7fa8c63 100644 --- a/phpBB/styles/subsilver2/theme/theme.cfg +++ b/phpBB/styles/subsilver2/theme/theme.cfg @@ -21,7 +21,7 @@ # General Information about this theme name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.5 +version = 3.0.6 # Some configuration options From 0fe74ebceac75c559b8779f291ebb2df80309e92 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 4 Sep 2009 15:44:10 +0000 Subject: [PATCH 573/607] Add INDEX on user_regdate because this is the default ORDER BY in memberlist.php - thanks nickvergessen. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10106 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 1 + phpBB/docs/CHANGELOG.html | 1 + phpBB/install/database_update.php | 3 +++ phpBB/install/schemas/firebird_schema.sql | 1 + phpBB/install/schemas/mssql_schema.sql | 3 +++ phpBB/install/schemas/mysql_40_schema.sql | 1 + phpBB/install/schemas/mysql_41_schema.sql | 1 + phpBB/install/schemas/oracle_schema.sql | 2 ++ phpBB/install/schemas/postgres_schema.sql | 1 + phpBB/install/schemas/sqlite_schema.sql | 1 + 10 files changed, 15 insertions(+) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index b9017937c8..77c8f8217b 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1869,6 +1869,7 @@ function get_schema_struct() 'PRIMARY_KEY' => 'user_id', 'KEYS' => array( 'user_birthday' => array('INDEX', 'user_birthday'), + 'user_regdate' => array('INDEX', 'user_regdate'), 'user_email_hash' => array('INDEX', 'user_email_hash'), 'user_type' => array('INDEX', 'user_type'), 'username_clean' => array('UNIQUE', 'username_clean'), diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index abd7719c0d..940a80002c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -241,6 +241,7 @@
        • [Change] Resize oversized Topic icons (Bug #44415)
        • [Change] Banned IPs are now sorted (Bug #43045 - Patch by DavidIQ)
        • [Change] phpBB updater now skips sole whitespace changes. This reduces the chance of conflicts tremendously.
        • +
        • [Change] Add index on user_regdate to the users table.
        • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
        • [Feature] Backported 3.2 captcha plugins.
            diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index ab22c803ee..54586c5650 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -877,6 +877,9 @@ function database_update_info() POSTS_TABLE => array( 'post_username' => array('post_username'), ), + USERS_TABLE => array( + 'user_regdate' => array('user_regdate'), + ), ), ), ); diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index f3defe9a54..91bd7263ce 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -1381,6 +1381,7 @@ CREATE TABLE phpbb_users ( ALTER TABLE phpbb_users ADD PRIMARY KEY (user_id);; CREATE INDEX phpbb_users_user_birthday ON phpbb_users(user_birthday);; +CREATE INDEX phpbb_users_user_regdate ON phpbb_users(user_regdate);; CREATE INDEX phpbb_users_user_email_hash ON phpbb_users(user_email_hash);; CREATE INDEX phpbb_users_user_type ON phpbb_users(user_type);; CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users(username_clean);; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index ac7c0928cd..c2af273edd 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1666,6 +1666,9 @@ GO CREATE INDEX [user_birthday] ON [phpbb_users]([user_birthday]) ON [PRIMARY] GO +CREATE INDEX [user_regdate] ON [phpbb_users]([user_regdate]) ON [PRIMARY] +GO + CREATE INDEX [user_email_hash] ON [phpbb_users]([user_email_hash]) ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 4fcead787b..ff5653a812 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -978,6 +978,7 @@ CREATE TABLE phpbb_users ( user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (user_id), KEY user_birthday (user_birthday), + KEY user_regdate (user_regdate), KEY user_email_hash (user_email_hash), KEY user_type (user_type), UNIQUE username_clean (username_clean(255)) diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 34adf5674e..ceb13aa102 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -978,6 +978,7 @@ CREATE TABLE phpbb_users ( user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (user_id), KEY user_birthday (user_birthday), + KEY user_regdate (user_regdate), KEY user_email_hash (user_email_hash), KEY user_type (user_type), UNIQUE username_clean (username_clean) diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 15692ea984..6855e6472f 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1804,6 +1804,8 @@ CREATE TABLE phpbb_users ( CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday) / +CREATE INDEX phpbb_users_user_regdate ON phpbb_users (user_regdate) +/ CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash) / CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type) diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 46e77e64b4..1c0acc4bd4 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -1243,6 +1243,7 @@ CREATE TABLE phpbb_users ( ); CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); +CREATE INDEX phpbb_users_user_regdate ON phpbb_users (user_regdate); CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index d754219cdf..53fe3d978a 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -949,6 +949,7 @@ CREATE TABLE phpbb_users ( ); CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); +CREATE INDEX phpbb_users_user_regdate ON phpbb_users (user_regdate); CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); From fc5a21e16a6502a89fd7b541683f21e216c8cf2e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 4 Sep 2009 17:27:13 +0000 Subject: [PATCH 574/607] Revert r10106 - Index usage is very unlikely because of WHERE IN (). :-| git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10107 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 1 - phpBB/docs/CHANGELOG.html | 1 - phpBB/install/database_update.php | 3 --- phpBB/install/schemas/firebird_schema.sql | 1 - phpBB/install/schemas/mssql_schema.sql | 3 --- phpBB/install/schemas/mysql_40_schema.sql | 1 - phpBB/install/schemas/mysql_41_schema.sql | 1 - phpBB/install/schemas/oracle_schema.sql | 2 -- phpBB/install/schemas/postgres_schema.sql | 1 - phpBB/install/schemas/sqlite_schema.sql | 1 - 10 files changed, 15 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 77c8f8217b..b9017937c8 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1869,7 +1869,6 @@ function get_schema_struct() 'PRIMARY_KEY' => 'user_id', 'KEYS' => array( 'user_birthday' => array('INDEX', 'user_birthday'), - 'user_regdate' => array('INDEX', 'user_regdate'), 'user_email_hash' => array('INDEX', 'user_email_hash'), 'user_type' => array('INDEX', 'user_type'), 'username_clean' => array('UNIQUE', 'username_clean'), diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 940a80002c..abd7719c0d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -241,7 +241,6 @@
          • [Change] Resize oversized Topic icons (Bug #44415)
          • [Change] Banned IPs are now sorted (Bug #43045 - Patch by DavidIQ)
          • [Change] phpBB updater now skips sole whitespace changes. This reduces the chance of conflicts tremendously.
          • -
          • [Change] Add index on user_regdate to the users table.
          • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
          • [Feature] Backported 3.2 captcha plugins.
              diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 54586c5650..ab22c803ee 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -877,9 +877,6 @@ function database_update_info() POSTS_TABLE => array( 'post_username' => array('post_username'), ), - USERS_TABLE => array( - 'user_regdate' => array('user_regdate'), - ), ), ), ); diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 91bd7263ce..f3defe9a54 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -1381,7 +1381,6 @@ CREATE TABLE phpbb_users ( ALTER TABLE phpbb_users ADD PRIMARY KEY (user_id);; CREATE INDEX phpbb_users_user_birthday ON phpbb_users(user_birthday);; -CREATE INDEX phpbb_users_user_regdate ON phpbb_users(user_regdate);; CREATE INDEX phpbb_users_user_email_hash ON phpbb_users(user_email_hash);; CREATE INDEX phpbb_users_user_type ON phpbb_users(user_type);; CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users(username_clean);; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index c2af273edd..ac7c0928cd 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1666,9 +1666,6 @@ GO CREATE INDEX [user_birthday] ON [phpbb_users]([user_birthday]) ON [PRIMARY] GO -CREATE INDEX [user_regdate] ON [phpbb_users]([user_regdate]) ON [PRIMARY] -GO - CREATE INDEX [user_email_hash] ON [phpbb_users]([user_email_hash]) ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index ff5653a812..4fcead787b 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -978,7 +978,6 @@ CREATE TABLE phpbb_users ( user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (user_id), KEY user_birthday (user_birthday), - KEY user_regdate (user_regdate), KEY user_email_hash (user_email_hash), KEY user_type (user_type), UNIQUE username_clean (username_clean(255)) diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index ceb13aa102..34adf5674e 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -978,7 +978,6 @@ CREATE TABLE phpbb_users ( user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (user_id), KEY user_birthday (user_birthday), - KEY user_regdate (user_regdate), KEY user_email_hash (user_email_hash), KEY user_type (user_type), UNIQUE username_clean (username_clean) diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 6855e6472f..15692ea984 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1804,8 +1804,6 @@ CREATE TABLE phpbb_users ( CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday) / -CREATE INDEX phpbb_users_user_regdate ON phpbb_users (user_regdate) -/ CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash) / CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type) diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 1c0acc4bd4..46e77e64b4 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -1243,7 +1243,6 @@ CREATE TABLE phpbb_users ( ); CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); -CREATE INDEX phpbb_users_user_regdate ON phpbb_users (user_regdate); CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 53fe3d978a..d754219cdf 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -949,7 +949,6 @@ CREATE TABLE phpbb_users ( ); CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); -CREATE INDEX phpbb_users_user_regdate ON phpbb_users (user_regdate); CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); From e0bf8245014ae38841e6edc6e1f43f1ed4070502 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 5 Sep 2009 12:03:52 +0000 Subject: [PATCH 575/607] Do not display links to user/post search if search is disabled. (Bug #50685 - Patch by HardStyle) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10108 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/memberlist_view.html | 2 +- phpBB/styles/prosilver/template/overall_header.html | 4 +++- phpBB/styles/subsilver2/template/memberlist_view.html | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index abd7719c0d..ee79525643 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -207,6 +207,7 @@
            • [Fix] Add header gradient back into subsilver2 but keep site logo easily replaceable with smaller and bigger ones. (Bug #11142 - Patch by dark/Rain and Raimon)
            • [Fix] Send activation email when activating user from user settings. (Bug #43145)
            • [Fix] Do not show resend activation email link when using admin activation. (Bug #44375 - Patch by bbrunnrman)
            • +
            • [Fix] Do not display links to user/post search if search is disabled. (Bug #50685 - Patch by HardStyle)
            • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
            • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
            • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
            • diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index 734afa6963..031bfec6ff 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -84,7 +84,7 @@
              {WARNINGS} [ {L_VIEW_NOTES} | {L_WARN_USER} ]
              {L_TOTAL_POSTS}:
              -
              {POSTS} | {L_SEARCH_USER_POSTS} +
              {POSTS} | {L_SEARCH_USER_POSTS}
              ({POSTS_PCT} / {POSTS_DAY})
              ({L_POSTS_IN_QUEUE})
              ({L_POSTS_IN_QUEUE})
              diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index f9f9dcfdff..7c8903b474 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -148,8 +148,10 @@
  • +
    {L_SEARCH_USER_POSTS} From 239438a6c9e3404035ab983e806f235f12a937b0 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 5 Sep 2009 12:06:12 +0000 Subject: [PATCH 576/607] Fix r10041 - Bug #50765 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10109 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/mcp/mcp_logs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index 782fba7a50..429e19b668 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -175,7 +175,7 @@ class mcp_logs $template->assign_vars(array( 'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start), 'TOTAL' => ($log_count == 1) ? $user->lang['TOTAL_LOG'] : sprintf($user->lang['TOTAL_LOGS'], $log_count), - 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param$log_operation_param$keywords_param", $log_count, $config['topics_per_page'], $start, true), + 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start, true), 'L_TITLE' => $user->lang['MCP_LOGS'], @@ -192,7 +192,7 @@ class mcp_logs foreach ($log_data as $row) { $data = array(); - + $checks = array('viewtopic', 'viewforum'); foreach ($checks as $check) { From d30ecde61811744cf1a9da87090e1a624e7b060b Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 5 Sep 2009 12:12:23 +0000 Subject: [PATCH 577/607] add inputbox class to input in prosilver - Bug #50795 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10110 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/mcp_logs.html | 4 ++-- phpBB/styles/prosilver/template/mcp_notes_user.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/styles/prosilver/template/mcp_logs.html b/phpBB/styles/prosilver/template/mcp_logs.html index 073e216611..02ebd1b3be 100644 --- a/phpBB/styles/prosilver/template/mcp_logs.html +++ b/phpBB/styles/prosilver/template/mcp_logs.html @@ -9,7 +9,7 @@ - + - + - + @@ -58,21 +58,21 @@
    {L_EDIT_QUESTION} -
    +

    {L_QUESTION_STRICT_EXPLAIN}
    - -
    + +

    {L_QUESTION_LANG_EXPLAIN}
    -
    +

    {L_QUESTION_TEXT_EXPLAIN}
    -
    +

    {L_ANSWERS_EXPLAIN}
    diff --git a/phpBB/adm/style/captcha_qa_acp_demo.html b/phpBB/adm/style/captcha_qa_acp_demo.html index 474dfc58ea..57bed8af53 100644 --- a/phpBB/adm/style/captcha_qa_acp_demo.html +++ b/phpBB/adm/style/captcha_qa_acp_demo.html @@ -2,6 +2,6 @@

    {L_CONFIRM_QUESTION_EXPLAIN}
    - +
    diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index 15ad18ba87..6f53e8c5ad 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -48,7 +48,7 @@ class phpbb_captcha_qa { global $config, $db, $user; - // load our language file + // load our language file $user->add_lang('captcha_qa'); // read input @@ -62,7 +62,7 @@ class phpbb_captcha_qa // try the user's lang first $sql = 'SELECT question_id FROM ' . CAPTCHA_QUESTIONS_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($user->data['user_lang']) . "'"; + WHERE lang_iso = '" . $db->sql_escape($user->data['user_lang']) . "'"; $result = $db->sql_query($sql, 3600); while ($row = $db->sql_fetchrow($result)) @@ -78,7 +78,7 @@ class phpbb_captcha_qa $sql = 'SELECT question_id FROM ' . CAPTCHA_QUESTIONS_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; $result = $db->sql_query($sql, 7200); while ($row = $db->sql_fetchrow($result)) @@ -139,7 +139,7 @@ class phpbb_captcha_qa $sql = 'SELECT COUNT(question_id) as count FROM ' . CAPTCHA_QUESTIONS_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -283,7 +283,7 @@ class phpbb_captcha_qa function install() { global $db, $phpbb_root_path, $phpEx; - + if (!class_exists('phpbb_db_tools')) { include("$phpbb_root_path/includes/db/db_tools.$phpEx"); @@ -294,41 +294,41 @@ class phpbb_captcha_qa $schemas = array( CAPTCHA_QUESTIONS_TABLE => array ( - 'COLUMNS' => array( - 'question_id' => array('UINT', Null, 'auto_increment'), - 'strict' => array('BOOL', 0), - 'lang_id' => array('UINT', 0), - 'lang_iso' => array('VCHAR:30', ''), - 'question_text' => array('TEXT_UNI', ''), - ), - 'PRIMARY_KEY' => 'question_id', - 'KEYS' => array( - 'lang_iso' => array('INDEX', 'lang_iso'), - ), + 'COLUMNS' => array( + 'question_id' => array('UINT', Null, 'auto_increment'), + 'strict' => array('BOOL', 0), + 'lang_id' => array('UINT', 0), + 'lang_iso' => array('VCHAR:30', ''), + 'question_text' => array('TEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'question_id', + 'KEYS' => array( + 'lang_iso' => array('INDEX', 'lang_iso'), + ), ), CAPTCHA_ANSWERS_TABLE => array ( - 'COLUMNS' => array( - 'question_id' => array('UINT', 0), - 'answer_text' => array('STEXT_UNI', ''), - ), - 'KEYS' => array( - 'question_id' => array('INDEX', 'question_id'), - ), + 'COLUMNS' => array( + 'question_id' => array('UINT', 0), + 'answer_text' => array('STEXT_UNI', ''), + ), + 'KEYS' => array( + 'question_id' => array('INDEX', 'question_id'), + ), ), CAPTCHA_QA_CONFIRM_TABLE => array ( - 'COLUMNS' => array( - 'session_id' => array('CHAR:32', ''), - 'confirm_id' => array('CHAR:32', ''), - 'lang_iso' => array('VCHAR:30', ''), - 'question_id' => array('UINT', 0), - 'attempts' => array('UINT', 0), - 'confirm_type' => array('USINT', 0), - ), - 'KEYS' => array( - 'session_id' => array('INDEX', 'session_id'), - 'lookup' => array('INDEX', array('confirm_id', 'session_id', 'lang_iso')), - ), - 'PRIMARY_KEY' => 'confirm_id', + 'COLUMNS' => array( + 'session_id' => array('CHAR:32', ''), + 'confirm_id' => array('CHAR:32', ''), + 'lang_iso' => array('VCHAR:30', ''), + 'question_id' => array('UINT', 0), + 'attempts' => array('UINT', 0), + 'confirm_type' => array('USINT', 0), + ), + 'KEYS' => array( + 'session_id' => array('INDEX', 'session_id'), + 'lookup' => array('INDEX', array('confirm_id', 'session_id', 'lang_iso')), + ), + 'PRIMARY_KEY' => 'confirm_id', ), ); @@ -415,7 +415,7 @@ class phpbb_captcha_qa $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' SET question_id = ' . (int) $this->question . " - WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' AND session_id = '" . $db->sql_escape($user->session_id) . "'"; $db->sql_query($sql); @@ -436,7 +436,7 @@ class phpbb_captcha_qa $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' SET question_id = ' . (int) $this->question . ", attempts = attempts + 1 - WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' AND session_id = '" . $db->sql_escape($user->session_id) . "'"; $db->sql_query($sql); @@ -451,7 +451,7 @@ class phpbb_captcha_qa global $db, $user; $sql = 'SELECT con.question_id, attempts, question_text, strict - FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' con, ' . CAPTCHA_QUESTIONS_TABLE . " qes + FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' con, ' . CAPTCHA_QUESTIONS_TABLE . " qes WHERE con.question_id = qes.question_id AND confirm_id = '" . $db->sql_escape($this->confirm_id) . "' AND session_id = '" . $db->sql_escape($user->session_id) . "' @@ -520,7 +520,7 @@ class phpbb_captcha_qa } /** - * API function + * API function */ function get_attempt_count() { @@ -528,7 +528,7 @@ class phpbb_captcha_qa } /** - * API function + * API function */ function reset() { @@ -544,7 +544,7 @@ class phpbb_captcha_qa } /** - * API function + * API function */ function is_solved() { @@ -815,7 +815,7 @@ class phpbb_captcha_qa $langs = $this->get_languages(); $question_ary = $data; - + $question_ary['lang_id'] = $langs[$data['lang_iso']]['id']; unset($question_ary['answers']); @@ -862,7 +862,7 @@ class phpbb_captcha_qa foreach ($tables as $table) { - $sql = "DELETE FROM $table + $sql = "DELETE FROM $table WHERE question_id = $question_id"; $db->sql_query($sql); } diff --git a/phpBB/styles/prosilver/template/captcha_qa.html b/phpBB/styles/prosilver/template/captcha_qa.html index ba13f21f7f..0b18ada3bb 100644 --- a/phpBB/styles/prosilver/template/captcha_qa.html +++ b/phpBB/styles/prosilver/template/captcha_qa.html @@ -7,7 +7,7 @@
    -
    :
    {L_CONFIRM_QUESTION_EXPLAIN}
    +

    {L_CONFIRM_QUESTION_EXPLAIN}
    From fdf19b0d9590bb3de3078adb86ba080afe2acc34 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 7 Sep 2009 12:39:37 +0000 Subject: [PATCH 584/607] since we now have several search_ids, all with different default results modes we now always add the sr variable to the URL - Bug #50775 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10117 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/phpBB/search.php b/phpBB/search.php index 66323e5d1d..efe5c247cb 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -372,30 +372,31 @@ if ($keywords || $author || $author_id || $search_id || $submit) break; case 'unreadposts': - $l_search_title = $user->lang['SEARCH_UNREAD']; - // force sorting - $show_results = 'topics'; - $sort_key = 't'; - $sort_by_sql['t'] = 't.topic_last_post_time'; - $sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); - $sql_where = 'AND t.topic_moved_id = 0 - ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . ' - ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : ''); + $l_search_title = $user->lang['SEARCH_UNREAD']; + // force sorting + $show_results = 'topics'; + $sort_key = 't'; + $sort_by_sql['t'] = 't.topic_last_post_time'; + $sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); - gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); - $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; - - $unread_list = array(); - $unread_list = get_unread_topics_list($user->data['user_id'], $sql_where, $sql_sort); + $sql_where = 'AND t.topic_moved_id = 0 + ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . ' + ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : ''); - if (!empty($unread_list)) - { - $sql = 'SELECT t.topic_id - FROM ' . TOPICS_TABLE . ' t - WHERE ' . $db->sql_in_set('t.topic_id', array_keys($unread_list)) . " - $sql_sort"; - $field = 'topic_id'; - } + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; + + $unread_list = array(); + $unread_list = get_unread_topics_list($user->data['user_id'], $sql_where, $sql_sort); + + if (!empty($unread_list)) + { + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE ' . $db->sql_in_set('t.topic_id', array_keys($unread_list)) . " + $sql_sort"; + $field = 'topic_id'; + } break; case 'newposts': @@ -541,7 +542,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $hilit = (strspn($hilit, '*') === strlen($hilit)) ? '' : $hilit; $u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit))); - $u_show_results = ($show_results != 'posts') ? '&sr=' . $show_results : ''; + $u_show_results = '&sr=' . $show_results; $u_search_forum = implode('&fid%5B%5D=', $search_forum); $u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results); From bb8e42fa5f1c524ec17d20b4925d0f71494f202f Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 7 Sep 2009 15:48:15 +0000 Subject: [PATCH 585/607] Fix retrieval of unread topics list. The old queries were too heavy, using temporary and filesort and actually only based on topics being retrieved before. Instead now use one query which is also a lot faster and yields the same results. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10118 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 104 +++++++++-------------------------- 1 file changed, 25 insertions(+), 79 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index be1208fb2e..3a5a018a86 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1683,92 +1683,38 @@ function get_unread_topics_list($user_id = false, $sql_extra = '', $sql_sort = ' if ($config['load_db_lastread'] && $user->data['is_registered']) { - // Get list of the unread topics - on topics tracking as the first step - $sql = 'SELECT t.topic_id, t.topic_last_post_time, tt.mark_time - FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TRACK_TABLE . " tt - WHERE t.topic_id = tt.topic_id - AND tt.user_id = $user_id - $sql_extra - $sql_sort"; + // Get list of the unread topics + $sql_array = array( + 'SELECT' => 't.topic_id, t.topic_last_post_time, tt.mark_time as topic_mark_time, ft.mark_time as forum_mark_time', + + 'FROM' => array(TOPICS_TABLE => 't'), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), + 'ON' => 't.topic_id = tt.topic_id AND t.topic_last_post_time > tt.mark_time AND tt.user_id = ' . $user_id, + ), + array( + 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), + 'ON' => 't.forum_id = ft.forum_id AND t.topic_last_post_time > ft.mark_time AND ft.user_id = ' . $user_id, + ), + ), + + 'WHERE' => "((tt.topic_id OR ft.forum_id) + OR t.topic_last_post_time > {$user->data['user_lastmark']}) + $sql_extra + $sql_sort", + ); + + $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query_limit($sql, $sql_limit); while ($row = $db->sql_fetchrow($result)) { $topic_id = (int) $row['topic_id']; - - if ($row['topic_last_post_time'] <= $row['mark_time']) - { - // Check if there're read topics for the forums having unread ones - $read_topics_list[$topic_id] = (int) $row['mark_time']; - } - else - { - $unread_topics_list[$topic_id] = (int) $row['mark_time']; - } + $unread_topics_list[$topic_id] = ($row['forum_mark_time']) ? (int) $row['forum_mark_time'] : (int) $row['topic_mark_time']; } $db->sql_freeresult($result); - - // Get the full list of the tracked topics and unread topics count - $tracked_topics_list = array_merge(array_keys($unread_topics_list), array_keys($read_topics_list)); - $unread_list_count = sizeof($unread_topics_list); - - if ($unread_list_count < $sql_limit) - { - // Get list of the unread topics - on forums tracking as the second step - // We don't take in account topics tracked before - $sql = 'SELECT t.topic_id, ft.mark_time - FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TRACK_TABLE . ' ft - WHERE t.forum_id = ft.forum_id - AND t.topic_last_post_time > ft.mark_time - AND ' . $db->sql_in_set('t.topic_id', $tracked_topics_list, true, true) . " - AND ft.user_id = $user_id - $sql_extra - $sql_sort"; - $result = $db->sql_query_limit($sql, ($sql_limit - $unread_list_count)); - - while ($row = $db->sql_fetchrow($result)) - { - $unread_topics_list[(int) $row['topic_id']] = (int) $row['mark_time']; - } - $db->sql_freeresult($result); - - // Refresh the full list of the tracked topics and unread topics count - unset($tracked_topics_list); - $tracked_topics_list = array_merge(array_keys($unread_topics_list), array_keys($read_topics_list)); - $unread_list_count = sizeof($unread_topics_list); - - if ($unread_list_count < $sql_limit) - { - // List of the tracked forums (not ideal, hope the better way will be found) - // This list is to fetch later the forums user never read (fully) before - $sql = 'SELECT forum_id - FROM ' . FORUMS_TRACK_TABLE . " - WHERE user_id = $user_id"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $tracked_forums_list[] = (int) $row['forum_id']; - } - $db->sql_freeresult($result); - - // And the last step - find unread topics were not found before (that can mean a user has never read some forums) - $sql = 'SELECT t.topic_id - FROM ' . TOPICS_TABLE . ' t - WHERE t.topic_last_post_time > ' . (int) $user->data['user_lastmark'] . ' - AND ' . $db->sql_in_set('t.topic_id', $tracked_topics_list, true, true) . ' - AND ' . $db->sql_in_set('t.forum_id', $tracked_forums_list, true, true) . " - $sql_extra - $sql_sort"; - $result = $db->sql_query_limit($sql, ($sql_limit - $unread_list_count)); - - while ($row = $db->sql_fetchrow($result)) - { - $unread_topics_list[(int) $row['topic_id']] = (int) $user->data['user_lastmark']; - } - $db->sql_freeresult($result); - } - } } else if ($config['load_anon_lastread'] || $user->data['is_registered']) { From d92cbe7fd1223bd21ec6ebb28567ca3f37ec25f4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 8 Sep 2009 07:59:03 +0000 Subject: [PATCH 586/607] regarding r10108 - Hide some more search links for #50685 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10119 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/ucp_main_front.html | 2 +- phpBB/styles/subsilver2/template/ucp_main_front.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/ucp_main_front.html b/phpBB/styles/prosilver/template/ucp_main_front.html index a1b9fa440e..39c5d4f396 100644 --- a/phpBB/styles/prosilver/template/ucp_main_front.html +++ b/phpBB/styles/prosilver/template/ucp_main_front.html @@ -33,7 +33,7 @@
    {L_JOINED}:
    {JOINED}
    {L_VISITED}:
    {LAST_VISIT_YOU}
    -
    {L_TOTAL_POSTS}:
    {POSTS} | {L_SEARCH_YOUR_POSTS}
    ({POSTS_DAY} / {POSTS_PCT}){POSTS}
    +
    {L_TOTAL_POSTS}:
    {POSTS} | {L_SEARCH_YOUR_POSTS}
    ({POSTS_DAY} / {POSTS_PCT}){POSTS}
    {L_ACTIVE_IN_FORUM}:
    {ACTIVE_FORUM}
    ({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})
    {L_ACTIVE_IN_TOPIC}:
    {ACTIVE_TOPIC}
    ({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})
    {L_YOUR_WARNINGS}:
    {WARNING_IMG} [{WARNINGS}]
    diff --git a/phpBB/styles/subsilver2/template/ucp_main_front.html b/phpBB/styles/subsilver2/template/ucp_main_front.html index 4dbe2353ae..fdef0bd949 100644 --- a/phpBB/styles/subsilver2/template/ucp_main_front.html +++ b/phpBB/styles/subsilver2/template/ucp_main_front.html @@ -43,7 +43,7 @@
    - + From d85493ab16658387d603ca0d949e65bc3ea1533c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 8 Sep 2009 08:53:01 +0000 Subject: [PATCH 587/607] Rename get_unread_topics_list() to get_unread_topics(). Cleanup: Remove some stuff we no longer need. Related to report #46765 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10120 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 30 +++++++++++++++------------- phpBB/includes/functions_display.php | 6 +++--- phpBB/search.php | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3a5a018a86..21d4963aa7 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1665,22 +1665,21 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis * @param string $sql_limit Limits the size of unread topics list, 0 for unlimited query * * @return array[int][int] Topic ids as keys, mark_time of topic as value -* @author rxu */ -function get_unread_topics_list($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001) +function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001) { global $config, $db, $user; $user_id = ($user_id === false) ? (int) $user->data['user_id'] : (int) $user_id; + // Data array we're going to return + $unread_topics = array(); + if (empty($sql_sort)) { $sql_sort = 'ORDER BY t.topic_last_post_time DESC'; } - $tracked_topics_list = $unread_topics_list = $read_topics_list = array(); - $tracked_forums_list = $mark_time = array(); - if ($config['load_db_lastread'] && $user->data['is_registered']) { // Get list of the unread topics @@ -1712,7 +1711,8 @@ function get_unread_topics_list($user_id = false, $sql_extra = '', $sql_sort = ' while ($row = $db->sql_fetchrow($result)) { $topic_id = (int) $row['topic_id']; - $unread_topics_list[$topic_id] = ($row['forum_mark_time']) ? (int) $row['forum_mark_time'] : (int) $row['topic_mark_time']; + + $unread_topics[$topic_id] = ($row['forum_mark_time']) ? (int) $row['forum_mark_time'] : (int) $row['topic_mark_time']; } $db->sql_freeresult($result); } @@ -1750,29 +1750,31 @@ function get_unread_topics_list($user_id = false, $sql_extra = '', $sql_sort = ' if (isset($tracking_topics['t'][$topic_id36])) { - $last_read[$topic_id] = base_convert($tracking_topics['t'][$topic_id36], 36, 10) + $config['board_startdate']; - if ($row['topic_last_post_time'] > $last_read[$topic_id]) + $last_read = base_convert($tracking_topics['t'][$topic_id36], 36, 10) + $config['board_startdate']; + + if ($row['topic_last_post_time'] > $last_read) { - $unread_topics_list[$topic_id] = $last_read[$topic_id]; + $unread_topics[$topic_id] = $last_read; } } else if (isset($tracking_topics['f'][$forum_id])) { - $mark_time[$forum_id] = base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']; - if ($row['topic_last_post_time'] > $mark_time[$forum_id]) + $mark_time = base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']; + + if ($row['topic_last_post_time'] > $mark_time) { - $unread_topics_list[$topic_id] = $mark_time[$forum_id]; + $unread_topics[$topic_id] = $mark_time; } } else { - $unread_topics_list[$topic_id] = $user_lastmark; + $unread_topics[$topic_id] = $user_lastmark; } } $db->sql_freeresult($result); } - return $unread_topics_list; + return $unread_topics; } /** diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 328c4b1274..5caccc81d9 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -103,12 +103,12 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_tracking_info = array(); $branch_root_id = $root_data['forum_id']; - // Check for unread global announcements - // For index page only we do it + // Check for unread global announcements (index page only) $ga_unread = false; if ($root_data['forum_id'] == 0) { - $unread_ga_list = get_unread_topics_list($user->data['user_id'], 'AND t.forum_id = 0'); + $unread_ga_list = get_unread_topics($user->data['user_id'], 'AND t.forum_id = 0'); + if (sizeof($unread_ga_list)) { $ga_unread = true; diff --git a/phpBB/search.php b/phpBB/search.php index efe5c247cb..258297d088 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -387,7 +387,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; $unread_list = array(); - $unread_list = get_unread_topics_list($user->data['user_id'], $sql_where, $sql_sort); + $unread_list = get_unread_topics($user->data['user_id'], $sql_where, $sql_sort); if (!empty($unread_list)) { From 5537393f76cf56d21f39b863425f3ddb5c500808 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 8 Sep 2009 10:36:22 +0000 Subject: [PATCH 588/607] Further adjust unread tracking query, should work now for user last mark times less than forum/topic mark times. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10121 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 20 ++++++++++++++------ phpBB/includes/functions_display.php | 4 ++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 21d4963aa7..24dd58c116 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1683,6 +1683,8 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s if ($config['load_db_lastread'] && $user->data['is_registered']) { // Get list of the unread topics + $last_mark = $user->data['user_lastmark']; + $sql_array = array( 'SELECT' => 't.topic_id, t.topic_last_post_time, tt.mark_time as topic_mark_time, ft.mark_time as forum_mark_time', @@ -1691,16 +1693,23 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s 'LEFT_JOIN' => array( array( 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), - 'ON' => 't.topic_id = tt.topic_id AND t.topic_last_post_time > tt.mark_time AND tt.user_id = ' . $user_id, + 'ON' => "tt.user_id = $user_id AND t.topic_id = tt.topic_id AND tt.mark_time > $last_mark", ), array( 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), - 'ON' => 't.forum_id = ft.forum_id AND t.topic_last_post_time > ft.mark_time AND ft.user_id = ' . $user_id, + 'ON' => "ft.user_id = $user_id AND t.forum_id = ft.forum_id AND ft.mark_time > $last_mark", ), ), - 'WHERE' => "((tt.topic_id OR ft.forum_id) - OR t.topic_last_post_time > {$user->data['user_lastmark']}) + 'WHERE' => " + ( + (tt.mark_time AND t.topic_last_post_time > tt.mark_time) OR + (tt.mark_time IS NULL AND ft.mark_time AND t.topic_last_post_time > ft.mark_time) OR + ( + ((tt.mark_time IS NULL AND ft.mark_time IS NULL) OR (tt.mark_time < $last_mark AND ft.mark_time < $last_mark)) + AND t.topic_last_post_time > $last_mark + ) + ) $sql_extra $sql_sort", ); @@ -1711,8 +1720,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s while ($row = $db->sql_fetchrow($result)) { $topic_id = (int) $row['topic_id']; - - $unread_topics[$topic_id] = ($row['forum_mark_time']) ? (int) $row['forum_mark_time'] : (int) $row['topic_mark_time']; + $unread_topics[$topic_id] = ($row['topic_mark_time']) ? (int) $row['topic_mark_time'] : (($row['forum_mark_time']) ? (int) $row['forum_mark_time'] : $last_mark); } $db->sql_freeresult($result); } diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 5caccc81d9..cec1becb6e 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -107,9 +107,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $ga_unread = false; if ($root_data['forum_id'] == 0) { - $unread_ga_list = get_unread_topics($user->data['user_id'], 'AND t.forum_id = 0'); + $unread_ga_list = get_unread_topics($user->data['user_id'], 'AND t.forum_id = 0', '', 1); - if (sizeof($unread_ga_list)) + if (!empty($unread_ga_list)) { $ga_unread = true; } From a5e4ca259aa98bc3d5abc03dcf4504c2afe91e92 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 8 Sep 2009 14:02:40 +0000 Subject: [PATCH 589/607] Always remove temporary filename (Bug #50965) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10122 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_upload.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 40ff4de2d1..a7abb06674 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -313,12 +313,9 @@ class filespec if (!@move_uploaded_file($this->filename, $this->destination_file)) { $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); - return false; } } - @unlink($this->filename); - break; case 'move': @@ -328,12 +325,9 @@ class filespec if (!@copy($this->filename, $this->destination_file)) { $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); - return false; } } - @unlink($this->filename); - break; case 'local': @@ -341,14 +335,21 @@ class filespec if (!@copy($this->filename, $this->destination_file)) { $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); - return false; } - @unlink($this->filename); break; } + // Remove temporary filename + @unlink($this->filename); + + if (sizeof($this->error)) + { + return false; + } + phpbb_chmod($this->destination_file, $chmod); + return true; } // Try to get real filesize from destination folder From dc4619c889c3ac3449555f63445828168055b033 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 9 Sep 2009 08:07:01 +0000 Subject: [PATCH 590/607] define $data array at the correct location. ;) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10123 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/ucp/ucp_pm_viewfolder.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 43b12a59e6..6493b54e1f 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -118,8 +118,6 @@ function view_folder($id, $mode, $folder_id, $folder) $address_list = get_recipient_strings($folder_info['rowset']); } - $data = array(); - foreach ($folder_info['pm_list'] as $message_id) { $row = &$folder_info['rowset'][$message_id]; @@ -196,7 +194,8 @@ function view_folder($id, $mode, $folder_id, $folder) else { // Build Recipient List if in outbox/sentbox - $address = array(); + $address = $data = array(); + if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) { foreach ($folder_info['rowset'] as $message_id => $row) From 30d402c24b3fa0af4285926784c97fde099254b7 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 9 Sep 2009 09:08:24 +0000 Subject: [PATCH 591/607] Send emails for manual user activation if admin activation is enabled not through queue in ACP (Bug #50925) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10124 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_inactive.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index e41e8f661d..3d0c0a2780 100644 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -113,7 +113,7 @@ class acp_inactive { include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); - $messenger = new messenger(); + $messenger = new messenger(false); foreach ($inactive_users as $row) { From 4675bf817915071e0effc48bb2246cda1fa8b3dc Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 9 Sep 2009 10:46:51 +0000 Subject: [PATCH 592/607] regarding r10108 - Hide some more search links for #50685 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10125 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/memberlist_body.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html index ab2be261a8..197cbd4a0c 100644 --- a/phpBB/styles/prosilver/template/memberlist_body.html +++ b/phpBB/styles/prosilver/template/memberlist_body.html @@ -131,7 +131,7 @@ - + From 8c3d390c61d692ff9501e3ccdaa0f39716c5fab4 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 9 Sep 2009 21:41:51 +0000 Subject: [PATCH 593/607] Related to r9830: Change REPORT_POST to REPORT_PM. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10126 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/ucp/ucp_pm_viewmessage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 0e51e268cf..26968e1382 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -193,7 +193,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['SEND_EMAIL']), 'QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['POST_QUOTE_PM']), 'REPLY_IMG' => $user->img('button_pm_reply', $user->lang['POST_REPLY_PM']), - 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_POST'), + 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_PM'), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['POST_EDIT_PM']), 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), From edaa46a47ded10b31a7a7aa2bbede41139f956e9 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 9 Sep 2009 22:00:08 +0000 Subject: [PATCH 594/607] Fix bug #51035 introduced in r9814. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10127 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subsilver2/template/mcp_post.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/subsilver2/template/mcp_post.html b/phpBB/styles/subsilver2/template/mcp_post.html index d631ce262f..ecf4558b45 100644 --- a/phpBB/styles/subsilver2/template/mcp_post.html +++ b/phpBB/styles/subsilver2/template/mcp_post.html @@ -46,7 +46,7 @@ - + From d20a910b86873c8747715437f78a543f958c6bd3 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 9 Sep 2009 22:32:13 +0000 Subject: [PATCH 595/607] Fix bug #50445 - Fix icon alignment for forums with large descriptions in subsilver2. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10128 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/subsilver2/template/forumlist_body.html | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ee79525643..5682e1f770 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -208,6 +208,7 @@
  • [Fix] Send activation email when activating user from user settings. (Bug #43145)
  • [Fix] Do not show resend activation email link when using admin activation. (Bug #44375 - Patch by bbrunnrman)
  • [Fix] Do not display links to user/post search if search is disabled. (Bug #50685 - Patch by HardStyle)
  • +
  • [Fix] Fix icon alignment for forums with large descriptions in subsilver2. (Bug #50445)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/styles/subsilver2/template/forumlist_body.html b/phpBB/styles/subsilver2/template/forumlist_body.html index e42c5b09c3..a994e9e676 100644 --- a/phpBB/styles/subsilver2/template/forumlist_body.html +++ b/phpBB/styles/subsilver2/template/forumlist_body.html @@ -19,11 +19,10 @@
    @@ -42,7 +41,7 @@ From ab971c59be9eefe86bd53bad5858c6427ccc57eb Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 10 Sep 2009 08:44:34 +0000 Subject: [PATCH 596/607] Fix bug #51075 introduced in r10121. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10129 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 24dd58c116..092a5d5d86 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1703,8 +1703,8 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s 'WHERE' => " ( - (tt.mark_time AND t.topic_last_post_time > tt.mark_time) OR - (tt.mark_time IS NULL AND ft.mark_time AND t.topic_last_post_time > ft.mark_time) OR + (tt.mark_time IS NOT NULL AND t.topic_last_post_time > tt.mark_time) OR + (tt.mark_time IS NULL AND ft.mark_time IS NOT NULL AND t.topic_last_post_time > ft.mark_time) OR ( ((tt.mark_time IS NULL AND ft.mark_time IS NULL) OR (tt.mark_time < $last_mark AND ft.mark_time < $last_mark)) AND t.topic_last_post_time > $last_mark From a5ec35e185126f5366a5749ad4f57325202b10f5 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 10 Sep 2009 08:58:24 +0000 Subject: [PATCH 597/607] Fix database updater for PostgreSQL: Data needs to be GROUPed BY left_id, before we can ORDER BY left_id. Introduced in r10072. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10130 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index ab22c803ee..41983400fc 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -677,6 +677,7 @@ function _add_modules($modules_to_install) WHERE module_class = '" . $db->sql_escape($module_data['class']) . "' AND parent_id = {$parent_id} AND left_id BETWEEN {$first_left_id} AND {$module_row['left_id']} + GROUP BY left_id ORDER BY left_id"; $result = $db->sql_query($sql); $steps = (int) $db->sql_fetchfield('num_modules'); From 94373fd1f85f79dae1674313c27ebb1735991c9a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 10 Sep 2009 13:30:47 +0000 Subject: [PATCH 598/607] also collect admins user agent vendor and version (send_statistics) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10131 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_send_statistics.html | 2 +- .../includes/questionnaire/questionnaire.php | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_send_statistics.html b/phpBB/adm/style/acp_send_statistics.html index a3e27470e0..2a9b61f314 100644 --- a/phpBB/adm/style/acp_send_statistics.html +++ b/phpBB/adm/style/acp_send_statistics.html @@ -23,7 +23,7 @@ function iframe_updated() //]]> - + diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 16bd79742d..1d015576a7 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -179,7 +179,7 @@ class phpbb_questionnaire_system_data_provider // - 10.0.0.0/8 // - 172.16.0.0/12 // - 192.168.0.0/16 - 'ip' => $ip_address_ary[0] . '.' . $ip_address_ary[1] . '.XXX.YYY', + 'ip' => $ip_address_ary[0] . '.' . $ip_address_ary[1] . '.XXX.YYY', ); } } @@ -233,7 +233,7 @@ class phpbb_questionnaire_phpbb_data_provider { global $phpbb_root_path, $phpEx; include("{$phpbb_root_path}config.$phpEx"); - + // Only send certain config vars $config_vars = array( 'active_sessions' => true, @@ -447,6 +447,22 @@ class phpbb_questionnaire_phpbb_data_provider $result['dbms'] = $dbms; $result['acm_type'] = $acm_type; $result['load_extensions'] = $load_extensions; + $result['user_agent'] = 'Unknown'; + + // Try to get user agent vendor and version + $match = array(); + $user_agent = (!empty($_SERVER['HTTP_USER_AGENT'])) ? (string) $_SERVER['HTTP_USER_AGENT'] : ''; + $agents = array('firefox', 'msie', 'opera', 'chrome', 'safari', 'mozilla', 'seamonkey', 'konqueror', 'netscape', 'gecko', 'navigator', 'mosaic', 'lynx', 'amaya', 'omniweb', 'avant', 'camino', 'flock', 'aol'); + + // We check here 1 by 1 because some strings occur after others (for example Mozilla [...] Firefox/) + foreach ($agents as $agent) + { + if (preg_match('#(' . $agent . ')[/ ]?([0-9.]*)#i', $user_agent, $match)) + { + $result['user_agent'] = $match[1] . ' ' . $match[2]; + break; + } + } return $result; } From 735e3961520da4bfa3bd952670ed9a4f05961593 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 10 Sep 2009 13:56:11 +0000 Subject: [PATCH 599/607] Correctly display underlined links placed in last line in viewtopic. (Bug #14811 - Patch by primehalo) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10132 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/theme/content.css | 1 + 2 files changed, 2 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 5682e1f770..ca791ef155 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -209,6 +209,7 @@
  • [Fix] Do not show resend activation email link when using admin activation. (Bug #44375 - Patch by bbrunnrman)
  • [Fix] Do not display links to user/post search if search is disabled. (Bug #50685 - Patch by HardStyle)
  • [Fix] Fix icon alignment for forums with large descriptions in subsilver2. (Bug #50445)
  • +
  • [Fix] Correctly display underlined links placed in last line in viewtopic. (Bug #14811 - Patch by primehalo)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index e68f09049c..417537e660 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -307,6 +307,7 @@ div[class].topic-actions { font-family: "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif; font-size: 1em; color: #333333; + padding-bottom: 1px; } .content h2, .panel h2 { From 78fe1375d41acc6de5e61a94e101a01670ab2fb3 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Thu, 10 Sep 2009 15:27:10 +0000 Subject: [PATCH 600/607] Language changes #51065 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10133 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/common.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index cf748028fd..6aba0f6a98 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -277,10 +277,10 @@ $lang = array_merge($lang, array( 'SELECT_ANONYMOUS' => 'Select anonymous user', 'SELECT_OPTION' => 'Select option', - 'SETTING_TOO_LOW' => 'The entered value for the setting “%1$s” is too low. The minimal allowed value is %2$d.', - 'SETTING_TOO_BIG' => 'The entered value for the setting “%1$s” is too big. The maximal allowed value is %2$d.', - 'SETTING_TOO_LONG' => 'The entered value for the setting “%1$s” is too long. The maximal allowed length is %2$d.', - 'SETTING_TOO_SHORT' => 'The entered value for the setting “%1$s” is not long enough. The minimal allowed length is %2$d.', + 'SETTING_TOO_LOW' => 'The provided value for the setting “%1$s” is too low. The minimal acceptable value is %2$d.', + 'SETTING_TOO_BIG' => 'The provided value for the setting “%1$s” is too high. The maximum acceptable value is %2$d.', + 'SETTING_TOO_LONG' => 'The provided value for the setting “%1$s” is too long. The maximum acceptable length is %2$d.', + 'SETTING_TOO_SHORT' => 'The provided value for the setting “%1$s” is too short. The minimal acceptable length is %2$d.', 'SHOW_ALL_OPERATIONS' => 'Show all operations', From dd9a5b3da6c50e69312f15dd700b4673eb637f33 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Thu, 10 Sep 2009 15:32:16 +0000 Subject: [PATCH 601/607] Language changes #51065 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10134 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 6aba0f6a98..94188f4b1b 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -277,10 +277,10 @@ $lang = array_merge($lang, array( 'SELECT_ANONYMOUS' => 'Select anonymous user', 'SELECT_OPTION' => 'Select option', - 'SETTING_TOO_LOW' => 'The provided value for the setting “%1$s” is too low. The minimal acceptable value is %2$d.', + 'SETTING_TOO_LOW' => 'The provided value for the setting “%1$s” is too low. The minimum acceptable value is %2$d.', 'SETTING_TOO_BIG' => 'The provided value for the setting “%1$s” is too high. The maximum acceptable value is %2$d.', 'SETTING_TOO_LONG' => 'The provided value for the setting “%1$s” is too long. The maximum acceptable length is %2$d.', - 'SETTING_TOO_SHORT' => 'The provided value for the setting “%1$s” is too short. The minimal acceptable length is %2$d.', + 'SETTING_TOO_SHORT' => 'The provided value for the setting “%1$s” is too short. The minimum acceptable length is %2$d.', 'SHOW_ALL_OPERATIONS' => 'Show all operations', From 33e58d8e9038610fa708cdbaf951f1fb8e28f3c0 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 10 Sep 2009 19:49:19 +0000 Subject: [PATCH 602/607] Fix bug #51105. - Ignore (disable) newly generated forum in forums list. Related to r9896. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10135 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_forums.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 5a44af836f..045d8a2e8e 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1936,7 +1936,7 @@ class acp_forums 'L_ACL_LINK' => $l_acl, 'L_BACK_LINK' => adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), 'S_COPY_ACTION' => $action, - 'S_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], false, false, false, false), + 'S_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_data['forum_id'], false, false, false), )); } From e4e59b3b659cc71144c73f1f71e89f03f1cc56b5 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 11 Sep 2009 13:53:56 +0000 Subject: [PATCH 603/607] #50985 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10136 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/ucp/ucp_pm_viewfolder.php | 30 ++++++++++++++++++------ phpBB/language/en/ucp.php | 1 + 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ca791ef155..be0a1309b9 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -210,6 +210,7 @@
  • [Fix] Do not display links to user/post search if search is disabled. (Bug #50685 - Patch by HardStyle)
  • [Fix] Fix icon alignment for forums with large descriptions in subsilver2. (Bug #50445)
  • [Fix] Correctly display underlined links placed in last line in viewtopic. (Bug #14811 - Patch by primehalo)
  • +
  • [Fix] Handle export of orivate messages where all recipients were deleted. (Bug #50985)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 6493b54e1f..0ad602eb5c 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -194,13 +194,15 @@ function view_folder($id, $mode, $folder_id, $folder) else { // Build Recipient List if in outbox/sentbox - $address = $data = array(); + + $address_temp = $address = $data = array(); if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) { foreach ($folder_info['rowset'] as $message_id => $row) { - $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); + $address_temp[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); + $address[$message_id] = array(); } } @@ -224,8 +226,12 @@ function view_folder($id, $mode, $folder_id, $folder) $_types = array('u', 'g'); foreach ($_types as $ug_type) { - if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) + if (isset($address_temp[$message_id][$ug_type]) && sizeof($address_temp[$message_id][$ug_type])) { + if (!isset($address[$message_id][$ug_type])) + { + $address[$message_id][$ug_type] = array(); + } if ($ug_type == 'u') { $sql = 'SELECT user_id as id, username as name @@ -238,21 +244,31 @@ function view_folder($id, $mode, $folder_id, $folder) FROM ' . GROUPS_TABLE . ' WHERE '; } - $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($address[$message_id][$ug_type]))); + $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($address_temp[$message_id][$ug_type]))); $result = $db->sql_query($sql); while ($info_row = $db->sql_fetchrow($result)) { - $address[$message_id][$ug_type][$address[$message_id][$ug_type][$info_row['id']]][] = $info_row['name']; - unset($address[$message_id][$ug_type][$info_row['id']]); + $address[$message_id][$ug_type][$address_temp[$message_id][$ug_type][$info_row['id']]][] = $info_row['name']; + unset($address_temp[$message_id][$ug_type][$info_row['id']]); } $db->sql_freeresult($result); } } - decode_message($message_row['message_text'], $message_row['bbcode_uid']); + // There is the chance that all recipients of the message got deleted. To avoid creating + // exports without recipients, we add a bogus "undisclosed recipient". + if (!(isset($address[$message_id]['g']) && sizeof($address[$message_id]['g'])) && + !(isset($address[$message_id]['u']) && sizeof($address[$message_id]['u']))) + { + $address[$message_id]['u'] = array(); + $address[$message_id]['u']['to'] = array(); + $address[$message_id]['u']['to'][] = $user->lang['UNDISCLOSED_RECIPIENT']; + } + decode_message($message_row['message_text'], $message_row['bbcode_uid']); + $data[] = array( 'subject' => censor_text($row['message_subject']), 'sender' => $row['username'], diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 4b79a4b6ca..65c7d726a3 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -460,6 +460,7 @@ $lang = array_merge($lang, array( 'UCP_ZEBRA' => 'Friends & Foes', 'UCP_ZEBRA_FOES' => 'Manage foes', 'UCP_ZEBRA_FRIENDS' => 'Manage friends', + 'UNDISCLOSED_RECIPIENT' => 'Undiclosed Recipient', 'UNKNOWN_FOLDER' => 'Unknown folder', 'UNWATCH_MARKED' => 'Unwatch marked', 'UPLOAD_AVATAR_FILE' => 'Upload from your machine', From 96ac8a84e608815245760cc2a5f2cd6cc4e4ba5d Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 11 Sep 2009 13:56:26 +0000 Subject: [PATCH 604/607] #50985 - typo git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10137 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index be0a1309b9..4dede2b9ce 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -210,7 +210,7 @@
  • [Fix] Do not display links to user/post search if search is disabled. (Bug #50685 - Patch by HardStyle)
  • [Fix] Fix icon alignment for forums with large descriptions in subsilver2. (Bug #50445)
  • [Fix] Correctly display underlined links placed in last line in viewtopic. (Bug #14811 - Patch by primehalo)
  • -
  • [Fix] Handle export of orivate messages where all recipients were deleted. (Bug #50985)
  • +
  • [Fix] Handle export of private messages where all recipients were deleted. (Bug #50985)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • From bf63d6cf10eb2bfd007dc220245ccfdab55a4f34 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 11 Sep 2009 14:38:23 +0000 Subject: [PATCH 605/607] rollback; will be in 3.0.7 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10138 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 - phpBB/includes/ucp/ucp_pm_viewfolder.php | 30 ++++++------------------ phpBB/language/en/ucp.php | 1 - 3 files changed, 7 insertions(+), 25 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 4dede2b9ce..ca791ef155 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -210,7 +210,6 @@
  • [Fix] Do not display links to user/post search if search is disabled. (Bug #50685 - Patch by HardStyle)
  • [Fix] Fix icon alignment for forums with large descriptions in subsilver2. (Bug #50445)
  • [Fix] Correctly display underlined links placed in last line in viewtopic. (Bug #14811 - Patch by primehalo)
  • -
  • [Fix] Handle export of private messages where all recipients were deleted. (Bug #50985)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 0ad602eb5c..6493b54e1f 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -194,15 +194,13 @@ function view_folder($id, $mode, $folder_id, $folder) else { // Build Recipient List if in outbox/sentbox - - $address_temp = $address = $data = array(); + $address = $data = array(); if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) { foreach ($folder_info['rowset'] as $message_id => $row) { - $address_temp[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); - $address[$message_id] = array(); + $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); } } @@ -226,12 +224,8 @@ function view_folder($id, $mode, $folder_id, $folder) $_types = array('u', 'g'); foreach ($_types as $ug_type) { - if (isset($address_temp[$message_id][$ug_type]) && sizeof($address_temp[$message_id][$ug_type])) + if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) { - if (!isset($address[$message_id][$ug_type])) - { - $address[$message_id][$ug_type] = array(); - } if ($ug_type == 'u') { $sql = 'SELECT user_id as id, username as name @@ -244,31 +238,21 @@ function view_folder($id, $mode, $folder_id, $folder) FROM ' . GROUPS_TABLE . ' WHERE '; } - $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($address_temp[$message_id][$ug_type]))); + $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($address[$message_id][$ug_type]))); $result = $db->sql_query($sql); while ($info_row = $db->sql_fetchrow($result)) { - $address[$message_id][$ug_type][$address_temp[$message_id][$ug_type][$info_row['id']]][] = $info_row['name']; - unset($address_temp[$message_id][$ug_type][$info_row['id']]); + $address[$message_id][$ug_type][$address[$message_id][$ug_type][$info_row['id']]][] = $info_row['name']; + unset($address[$message_id][$ug_type][$info_row['id']]); } $db->sql_freeresult($result); } } - // There is the chance that all recipients of the message got deleted. To avoid creating - // exports without recipients, we add a bogus "undisclosed recipient". - if (!(isset($address[$message_id]['g']) && sizeof($address[$message_id]['g'])) && - !(isset($address[$message_id]['u']) && sizeof($address[$message_id]['u']))) - { - $address[$message_id]['u'] = array(); - $address[$message_id]['u']['to'] = array(); - $address[$message_id]['u']['to'][] = $user->lang['UNDISCLOSED_RECIPIENT']; - } - decode_message($message_row['message_text'], $message_row['bbcode_uid']); - + $data[] = array( 'subject' => censor_text($row['message_subject']), 'sender' => $row['username'], diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 65c7d726a3..4b79a4b6ca 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -460,7 +460,6 @@ $lang = array_merge($lang, array( 'UCP_ZEBRA' => 'Friends & Foes', 'UCP_ZEBRA_FOES' => 'Manage foes', 'UCP_ZEBRA_FRIENDS' => 'Manage friends', - 'UNDISCLOSED_RECIPIENT' => 'Undiclosed Recipient', 'UNKNOWN_FOLDER' => 'Unknown folder', 'UNWATCH_MARKED' => 'Unwatch marked', 'UPLOAD_AVATAR_FILE' => 'Upload from your machine', From c768cff554212c04c6da254418657faf4eab0b15 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 12 Sep 2009 13:17:58 +0000 Subject: [PATCH 606/607] fix #49625 r10002 - Do not drop forum_id on mcp_front (un)approval Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10139 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/mcp/mcp_front.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 0ee3eb2466..50e14b9336 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -120,7 +120,7 @@ function mcp_front_view($id, $mode, $action) } $s_hidden_fields = build_hidden_fields(array( - 'redirect' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main') + 'redirect' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main' . (($forum_id) ? '&f=' . $forum_id : '')) )); $template->assign_vars(array(
    - * {L_LOGIN_LOGOUT}  + * {L_LOGIN_LOGOUT}   * {L_RESTORE_PERMISSIONS}  {L_BOARD_DISABLED} From 5078b5e4ccaebcf6897e985cdf8c73a8172a2edf Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Mon, 10 Aug 2009 16:04:44 +0000 Subject: [PATCH 417/607] - filtered logs weren't correctly paginated git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9950 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_logs.php | 3 ++- phpBB/includes/mcp/mcp_logs.php | 3 ++- phpBB/includes/mcp/mcp_notes.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index d1e8b6d9c4..861df90777 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -106,6 +106,7 @@ class acp_logs $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); $log_operation = request_var('log_operation', ''); + $log_operation_param = !empty($log_operation) ? '&log_operation=' . urlencode(htmlspecialchars_decode($log_operation)) : ''; $s_lang_keys = ''; switch ($mode) @@ -213,7 +214,7 @@ class acp_logs 'U_ACTION' => $this->u_action, 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $log_count, $config['topics_per_page'], $start, true), + 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param$log_operation_param", $log_count, $config['topics_per_page'], $start, true), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index db22259ec4..a73227f158 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -165,6 +165,7 @@ class mcp_logs $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); $log_operation = request_var('log_operation', ''); + $log_operation_param = !empty($log_operation) ? '&log_operation=' . urlencode(htmlspecialchars_decode($log_operation)) : ''; $s_lang_keys = ''; if ($topic_id) @@ -223,7 +224,7 @@ class mcp_logs $template->assign_vars(array( 'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start), 'TOTAL' => ($log_count == 1) ? $user->lang['TOTAL_LOG'] : sprintf($user->lang['TOTAL_LOGS'], $log_count), - 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $log_count, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param$log_operation_param", $log_count, $config['topics_per_page'], $start), 'L_TITLE' => $user->lang['MCP_LOGS'], diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index d07874524a..bc4c1df42f 100644 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -194,6 +194,7 @@ class mcp_notes $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC'); $log_operation = request_var('log_operation', ''); + $log_operation_param = !empty($log_operation) ? '&log_operation=' . urlencode(htmlspecialchars_decode($log_operation)) : ''; $s_lang_keys = ''; $sql = "SELECT DISTINCT log_operation @@ -243,7 +244,7 @@ class mcp_notes 'L_TITLE' => $user->lang['MCP_NOTES_USER'], 'PAGE_NUMBER' => on_page($log_count, $config['posts_per_page'], $start), - 'PAGINATION' => generate_pagination($this->u_action . "&st=$st&sk=$sk&sd=$sd", $log_count, $config['posts_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&st=$st&sk=$sk&sd=$sd$log_operation_param", $log_count, $config['posts_per_page'], $start), 'TOTAL_REPORTS' => ($log_count == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $log_count), 'RANK_TITLE' => $rank_title, From d85e79719d9a6939feca14cfc22daba086936631 Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Mon, 10 Aug 2009 22:09:10 +0000 Subject: [PATCH 418/607] fixed bug 44805 - extra initInsertions() calls needed git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9951 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_users_signature.html | 2 +- phpBB/adm/style/editor.js | 1 - phpBB/styles/subsilver2/template/ucp_main_drafts.html | 2 +- phpBB/styles/subsilver2/template/ucp_profile_signature.html | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/phpBB/adm/style/acp_users_signature.html b/phpBB/adm/style/acp_users_signature.html index 239d35f119..0ea5328c3c 100644 --- a/phpBB/adm/style/acp_users_signature.html +++ b/phpBB/adm/style/acp_users_signature.html @@ -93,7 +93,7 @@ // ]]> -
    +
    diff --git a/phpBB/adm/style/editor.js b/phpBB/adm/style/editor.js index 93d0059609..8d6df9164a 100644 --- a/phpBB/adm/style/editor.js +++ b/phpBB/adm/style/editor.js @@ -16,7 +16,6 @@ var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == - var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1)); var baseHeight; -window.onload = initInsertions; /** * Shows the help messages in the helpline window diff --git a/phpBB/styles/subsilver2/template/ucp_main_drafts.html b/phpBB/styles/subsilver2/template/ucp_main_drafts.html index 14ae52be53..e61c253b04 100644 --- a/phpBB/styles/subsilver2/template/ucp_main_drafts.html +++ b/phpBB/styles/subsilver2/template/ucp_main_drafts.html @@ -69,7 +69,7 @@ - + - + - \ No newline at end of file + diff --git a/phpBB/styles/subsilver2/template/captcha_qa.html b/phpBB/styles/subsilver2/template/captcha_qa.html index c9f2ecbb4d..dc8d5505a1 100644 --- a/phpBB/styles/subsilver2/template/captcha_qa.html +++ b/phpBB/styles/subsilver2/template/captcha_qa.html @@ -2,7 +2,7 @@ - - + + - \ No newline at end of file + diff --git a/phpBB/styles/subsilver2/template/captcha_recaptcha.html b/phpBB/styles/subsilver2/template/captcha_recaptcha.html index f6e3c8a217..d8b06d2c51 100644 --- a/phpBB/styles/subsilver2/template/captcha_recaptcha.html +++ b/phpBB/styles/subsilver2/template/captcha_recaptcha.html @@ -2,25 +2,25 @@ - - + + + - - {L_RECAPTCHA_NOT_AVAILABLE} - - \ No newline at end of file From 19f86451184b8819831c258df76575fdf2b22726 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 23 Aug 2009 15:11:43 +0000 Subject: [PATCH 515/607] Missed one file. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10048 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subsilver2/template/captcha_default.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/styles/subsilver2/template/captcha_default.html b/phpBB/styles/subsilver2/template/captcha_default.html index 76d0edbec4..eaf7a30944 100644 --- a/phpBB/styles/subsilver2/template/captcha_default.html +++ b/phpBB/styles/subsilver2/template/captcha_default.html @@ -9,8 +9,7 @@ - + From 9382f6ba174e55ee0b43649e40282a6cb47800ff Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 24 Aug 2009 00:29:23 +0000 Subject: [PATCH 516/607] Fix bug #50245 - Check for correct module name when installing the "Send statistics" module. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10049 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 7656ea8952..72bad95227 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1324,12 +1324,12 @@ function change_database_data(&$no_updates, $version) { $category_id = (int) $row['module_id']; - // Check if we actually need to add the feed module or if it is already added. ;) + // Check if we need to add the module or if it is already there. ;) $sql = 'SELECT * FROM ' . MODULES_TABLE . " WHERE module_class = 'acp' AND module_langname = 'ACP_SEND_STATISTICS' - AND module_mode = 'questionnaire' + AND module_mode = 'send_statistics' AND module_auth = 'acl_a_server' AND parent_id = {$category_id}"; $result2 = $db->sql_query($sql); From d2f72e2b27ee56c0dc1ef64e1573fe6e3fe0e0c5 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 24 Aug 2009 14:22:30 +0000 Subject: [PATCH 517/607] new tabindex handling, #50185; subsilver doesn't use tabindexes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10050 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../prosilver/template/captcha_default.html | 2 +- phpBB/styles/prosilver/template/captcha_qa.html | 2 +- .../prosilver/template/captcha_recaptcha.html | 3 ++- phpBB/styles/prosilver/template/login_body.html | 10 +++++----- .../styles/prosilver/template/overall_header.html | 2 +- .../styles/prosilver/template/posting_editor.html | 14 +++++++------- phpBB/styles/prosilver/template/ucp_register.html | 15 ++++++++------- 7 files changed, 25 insertions(+), 23 deletions(-) diff --git a/phpBB/styles/prosilver/template/captcha_default.html b/phpBB/styles/prosilver/template/captcha_default.html index 35771fce4e..0894445c8d 100644 --- a/phpBB/styles/prosilver/template/captcha_default.html +++ b/phpBB/styles/prosilver/template/captcha_default.html @@ -11,7 +11,7 @@
    {L_CONFIRM_CODE}
    -
    +
    {L_CONFIRM_CODE_EXPLAIN}
    diff --git a/phpBB/styles/prosilver/template/captcha_qa.html b/phpBB/styles/prosilver/template/captcha_qa.html index fa64e76114..093b91cdd7 100644 --- a/phpBB/styles/prosilver/template/captcha_qa.html +++ b/phpBB/styles/prosilver/template/captcha_qa.html @@ -9,7 +9,7 @@
    :
    {L_CONFIRM_QUESTION_EXPLAIN}
    - +
    diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index 18113b7632..9ec1f7f5de 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -16,7 +16,8 @@ diff --git a/phpBB/styles/prosilver/template/login_body.html b/phpBB/styles/prosilver/template/login_body.html index 61f796004f..b81a673406 100644 --- a/phpBB/styles/prosilver/template/login_body.html +++ b/phpBB/styles/prosilver/template/login_body.html @@ -11,11 +11,11 @@
    {LOGIN_ERROR}
    -
    +
    -
    +
    {L_FORGOT_PASS}
    {L_RESEND_ACTIVATION}
    @@ -26,14 +26,14 @@
    -
    -
    +
    +
     
    -
    {S_HIDDEN_FIELDS}
    +
    {S_HIDDEN_FIELDS}
    diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index f9f9dcfdff..a9f89b7e54 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -97,7 +97,7 @@ - + diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index a02ad3ed10..11a8d2baa3 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -90,14 +90,14 @@
    -
    +
    -
    +
    @@ -135,7 +135,7 @@
    - +
    @@ -180,10 +180,10 @@
    {S_HIDDEN_ADDRESS_FIELD} {S_HIDDEN_FIELDS} -   -   - onclick="document.getElementById('postform').action += '#preview';" />  -   +   +   + onclick="document.getElementById('postform').action += '#preview';" />  +  
    diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index 7ec245bdcb..0962551aa4 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -26,37 +26,38 @@
    {L_REG_COND}
    +

    {L_USERNAME_EXPLAIN}
    -
    +
    -
    +
    -
    +

    {L_PASSWORD_EXPLAIN}
    -
    +
    -
    +

    -
    +
    -
    +
    From 03568fd176501c6a6c629590ab701eadef5841aa Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 24 Aug 2009 15:12:40 +0000 Subject: [PATCH 518/607] Add INC (working name) to template syntax git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10051 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 ++ phpBB/docs/coding-guidelines.html | 7 ++++++- phpBB/includes/functions_template.php | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index d6aaf9e38f..a8b68e587d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -281,6 +281,8 @@
  • [Feature] Separate PM Reply and PM Reply to all in prosilver.
  • [Feature] Place debug notices during captcha rendering in the error log - useful for debugging output already started errors.
  • [Feature] Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset...
  • +
  • [Feature] Added INC command to template syntax.
  • +

    1.ii. Changes since 3.0.4

    diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 37b9629362..03b2949eba 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1174,7 +1174,12 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp; <!-- DEFINE $SOME_VAR = 'my_file.html' --> <!-- INCLUDE {$SOME_VAR} --> - +

    Also added in 3.0.6 is the ability to increment an variable on use. This can be used for instances like tabindexes, where the amount of entries is not statically known. +The INC command will print the current state of a defined var and then increment it by one (postincrement).

    +
    +<!-- DEFINE $SOME_VAR = 1 -->
    +<!-- INC $SOME_VAR -->
    +

    PHP

    A contentious decision has seen the ability to include PHP within the template introduced. This is achieved by enclosing the PHP within relevant tags:

    diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 1d3a4d74f8..23b09a87f7 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -191,6 +191,10 @@ class template_compile $compile_blocks[] = 'compile_tag_define($block_val[2], false) . ' ?>'; break; + case 'INC': + $compile_blocks[] = 'compile_tag_counter($block_val[2], true) . ' ?>'; + break; + case 'INCLUDE': $temp = array_shift($include_blocks); @@ -626,6 +630,22 @@ class template_compile return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $match[4] . ';'; } + + /** + * Compile INC tags + * @access private + */ + function compile_tag_counter($tag_args) + { + preg_match('#^\$(?=[A-Z])([A-Z0-9_\-]*)$#', $tag_args, $match); + if (empty($match[1])) + { + return ''; + } + + return 'echo $this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[1] . '\']++'; + } + /** * Compile INCLUDE tag * @access private From 19bae65f4c79c7f50d71fd57bfff6ff1033ed84b Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 25 Aug 2009 09:04:38 +0000 Subject: [PATCH 519/607] Fix possible wrong encodings in email template files in messenger. Related to bug #46725 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10052 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_messenger.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 847b2e0c46..0fcf33f999 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -268,6 +268,9 @@ class messenger // Parse message through template $this->msg = trim($this->tpl_obj->assign_display('body')); + // Because we use \n for newlines in the body message we need to fix line encoding errors for those admins who uploaded email template files in the wrong encoding + $this->msg = str_replace("\r\n", "\n", $this->msg); + // We now try and pull a subject from the email body ... if it exists, // do this here because the subject may contain a variable $drop_header = ''; From 17f40511bf4df9dd46cd13cbd2c7802c49575783 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 25 Aug 2009 09:07:26 +0000 Subject: [PATCH 520/607] Make sure only logs for existing users are displayed and user-specific logs removed on user deletion. (Bug #49855) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10053 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_admin.php | 3 ++- phpBB/includes/functions_user.php | 11 +++++++++++ phpBB/includes/mcp/mcp_queue.php | 3 ++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a8b68e587d..0d9409b142 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -199,6 +199,7 @@
  • [Fix] Fix email problems on servers with PHP installations not accepting RFC-compliant subject string passed to the the mail()-function. (Bug #46725)
  • [Fix] Correctly orientate Control-Panel-Navigation background-image on RTL languages. (Bug #49945)
  • [Fix] Sort private messages by message time and not message id. (Bug #50015)
  • +
  • [Fix] Make sure only logs for existing users are displayed and user-specific logs removed on user deletion. (Bug #49855)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index a021717f57..205d7046c7 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2744,8 +2744,9 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id } $sql = 'SELECT COUNT(l.log_id) AS total_entries - FROM ' . LOG_TABLE . " l + FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u WHERE l.log_type = $log_type + AND l.user_id = u.user_id AND l.log_time >= $limit_days $sql_keywords $sql_forum"; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index c562ac666f..cb3306745e 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -538,6 +538,17 @@ function user_delete($mode, $user_id, $post_username = false) $cache->destroy('sql', MODERATOR_CACHE_TABLE); + // Delete user log entries about this user + $sql = 'DELETE FROM ' . LOG_TABLE . ' + WHERE reportee_id = ' . $user_id; + $db->sql_query($sql); + + // Change user_id to anonymous for this users triggered events + $sql = 'UPDATE ' . LOG_TABLE . ' + SET user_id = ' . ANONYMOUS . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + // Delete the user_id from the zebra table $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' WHERE user_id = ' . $user_id . ' diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index f72007acf5..3783aadab5 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -556,6 +556,7 @@ function approve_post($post_id_list, $id, $mode) $post_approve_sql[] = $post_id; } + $post_id_list = array_values(array_diff($post_id_list, $post_approved_list)); for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++) { @@ -834,7 +835,7 @@ function disapprove_post($post_id_list, $id, $mode) 'post_subject' => $post_info[$post_id]['post_subject'], 'forum_id' => $post_info[$post_id]['forum_id'], 'topic_id' => $post_info[$post_id]['topic_id'], - ); + ); } } From b47b35a07d47435ecb35aa386783c42721bb4764 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 25 Aug 2009 09:48:44 +0000 Subject: [PATCH 521/607] This is an enhancement for revision r10051 (INC template variable) Within the mentioned revision INC was only able to be applied to defined template variables. I extended it now to work on all supported variables (template vars, defines, loops, defines in loops) I also added a DEC template variable to logically complete this. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10054 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/docs/coding-guidelines.html | 12 ++++++++++-- phpBB/includes/functions_template.php | 28 ++++++++++++++++++--------- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 0d9409b142..0922372a78 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -282,7 +282,7 @@
  • [Feature] Separate PM Reply and PM Reply to all in prosilver.
  • [Feature] Place debug notices during captcha rendering in the error log - useful for debugging output already started errors.
  • [Feature] Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset...
  • -
  • [Feature] Added INC command to template syntax.
  • +
  • [Feature] Added INC/DEC command to template syntax, applicable to DEFINES and normal template variables, including loops.
  • 1.ii. Changes since 3.0.4

    diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 03b2949eba..29fce50b54 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1169,17 +1169,25 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;
     <!-- INCLUDE {FILE_VAR} -->
     
    +

    Template defined variables can also be utilised. +

     <!-- DEFINE $SOME_VAR = 'my_file.html' -->
     <!-- INCLUDE {$SOME_VAR} -->
     
    -

    Also added in 3.0.6 is the ability to increment an variable on use. This can be used for instances like tabindexes, where the amount of entries is not statically known. -The INC command will print the current state of a defined var and then increment it by one (postincrement).

    + +

    Also added in 3.0.6 is the ability to increment or decrement a variable on use. This can be used for instances like tabindexes, where the amount of entries is not statically known. +The INC (for incrementing) and DEC (for decrementing) commands will print the current state of a defined var and then increment/decrement it by one (postincrement/postdecrement).

    +
     <!-- DEFINE $SOME_VAR = 1 -->
     <!-- INC $SOME_VAR -->
    +Result: 1
    +{$SOME_VAR} +Result: 2
    +

    PHP

    A contentious decision has seen the ability to include PHP within the template introduced. This is achieved by enclosing the PHP within relevant tags:

    diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 23b09a87f7..f22a48bddb 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -192,9 +192,13 @@ class template_compile break; case 'INC': - $compile_blocks[] = 'compile_tag_counter($block_val[2], true) . ' ?>'; + $compile_blocks[] = 'compile_tag_counter($block_val[2], '++') . ' ?>'; break; - + + case 'DEC': + $compile_blocks[] = 'compile_tag_counter($block_val[2], '--') . ' ?>'; + break; + case 'INCLUDE': $temp = array_shift($include_blocks); @@ -632,20 +636,26 @@ class template_compile /** - * Compile INC tags + * Compile INC/DEC tags + * INC/DEC tags support defined template variables as well as normal template variables * @access private */ - function compile_tag_counter($tag_args) + function compile_tag_counter($tag_args, $operation = '++') { - preg_match('#^\$(?=[A-Z])([A-Z0-9_\-]*)$#', $tag_args, $match); - if (empty($match[1])) + preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $tag_args, $varrefs); + + if (empty($varrefs[0])) { return ''; } - - return 'echo $this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[1] . '\']++'; + + // Build token + $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']'); + + // Increase or decrease token ;) + return "echo {$token}{$operation};"; } - + /** * Compile INCLUDE tag * @access private From 48b54bb29e12ec0dc052a688ccc5c18856675d97 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 25 Aug 2009 10:02:24 +0000 Subject: [PATCH 522/607] Adjustement for r10050, related to Bug #50185 Use internal S_TAB_INDEX instead of DEFINE git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10055 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 ++ .../prosilver/template/captcha_default.html | 2 +- .../styles/prosilver/template/captcha_qa.html | 2 +- .../prosilver/template/captcha_recaptcha.html | 2 +- .../styles/prosilver/template/index_body.html | 2 +- .../styles/prosilver/template/login_body.html | 14 +++++++------- .../prosilver/template/overall_header.html | 2 +- .../prosilver/template/posting_editor.html | 14 +++++++------- .../prosilver/template/ucp_register.html | 18 ++++++++---------- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 820a03fe64..79ea8978ee 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4120,6 +4120,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'S_USER_UNREAD_PRIVMSG' => $user->data['user_unread_privmsg'], 'S_USER_NEW' => $user->data['user_new'], + 'S_TAB_INDEX' => 1, + 'SID' => $SID, '_SID' => $_SID, 'SESSION_ID' => $user->session_id, diff --git a/phpBB/styles/prosilver/template/captcha_default.html b/phpBB/styles/prosilver/template/captcha_default.html index 0894445c8d..885a3f42af 100644 --- a/phpBB/styles/prosilver/template/captcha_default.html +++ b/phpBB/styles/prosilver/template/captcha_default.html @@ -11,7 +11,7 @@
    {L_CONFIRM_CODE}
    -
    +
    {L_CONFIRM_CODE_EXPLAIN}
    diff --git a/phpBB/styles/prosilver/template/captcha_qa.html b/phpBB/styles/prosilver/template/captcha_qa.html index 093b91cdd7..2d5e69207a 100644 --- a/phpBB/styles/prosilver/template/captcha_qa.html +++ b/phpBB/styles/prosilver/template/captcha_qa.html @@ -9,7 +9,7 @@
    :
    {L_CONFIRM_QUESTION_EXPLAIN}
    - +
    diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index 9ec1f7f5de..a77d19cfc1 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -17,7 +17,7 @@ // + tabindex : }; // ]]> diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index 9cb4d2067d..3ed8724361 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -18,7 +18,7 @@

    {L_LOGIN_LOGOUT}  •  {L_REGISTER}

    @@ -180,10 +180,10 @@
    {S_HIDDEN_ADDRESS_FIELD} {S_HIDDEN_FIELDS} -   -   - onclick="document.getElementById('postform').action += '#preview';" />  -   +   +   + onclick="document.getElementById('postform').action += '#preview';" />  +  
    diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index 0962551aa4..f83d75da76 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -26,38 +26,36 @@
    {L_REG_COND}
    - -

    {L_USERNAME_EXPLAIN}
    -
    +
    -
    +
    -
    +

    {L_PASSWORD_EXPLAIN}
    -
    +
    -
    +

    -
    +
    -
    +
    @@ -79,7 +77,7 @@ - + From c9ecb5dee73cacf7a805189db3f34cdc14703f45 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 25 Aug 2009 12:19:57 +0000 Subject: [PATCH 523/607] Fix style recompilation now we do not force the SID to be passed anymore. This also fixes the problems users see after updates, where styles are not always instantly updated, as well as helping style authors a lot. ;) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10056 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/style.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/style.php b/phpBB/style.php index 40d34c598c..0b4c3d0d41 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -92,7 +92,8 @@ if ($id) if (!$user) { $id = ($id) ? $id : $config['default_style']; - $recompile = false; +// Commented out because calls do not always include the SID anymore +// $recompile = false; $user = array('user_id' => ANONYMOUS); } From fa754d1576466f7ca8a483e72b5b1e1d47a4b1ad Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Tue, 25 Aug 2009 13:52:35 +0000 Subject: [PATCH 524/607] One more unread posts search adjustment. Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10057 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 20 +++++++++++++------- phpBB/search.php | 11 +++++------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 79ea8978ee..f5e494ae4c 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1649,12 +1649,13 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis * * @param int $user_id User ID (or false for current user) * @param string $sql_extra Extra WHERE SQL statement -* @param string $sql_limit Limits the size of unread topics list +* @param string $sql_sort ORDER BY SQL sorting statement +* @param string $sql_limit Limits the size of unread topics list, 0 for unlimited query * * @return array[int][int] Topic ids as keys, mark_time of topic as value * @author rxu */ -function get_unread_topics_list($user_id = false, $sql_extra = '', $sql_limit = 1001) +function get_unread_topics_list($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001) { global $config, $db, $user; @@ -1663,6 +1664,11 @@ function get_unread_topics_list($user_id = false, $sql_extra = '', $sql_limit = $user_id = (int) $user->data['user_id']; } + if (empty($sql_sort)) + { + $sql_sort = 'ORDER BY t.topic_last_post_time DESC'; + } + $tracked_topics_list = $unread_topics_list = $read_topics_list = array(); $tracked_forums_list = $mark_time = array(); @@ -1674,7 +1680,7 @@ function get_unread_topics_list($user_id = false, $sql_extra = '', $sql_limit = WHERE t.topic_id = tt.topic_id AND tt.user_id = $user_id $sql_extra - ORDER BY t.topic_last_post_time DESC"; + $sql_sort"; $result = $db->sql_query_limit($sql, $sql_limit); while ($row = $db->sql_fetchrow($result)) @@ -1706,7 +1712,7 @@ function get_unread_topics_list($user_id = false, $sql_extra = '', $sql_limit = AND ' . $db->sql_in_set('t.topic_id', $tracked_topics_list, true, true) . " AND ft.user_id = $user_id $sql_extra - ORDER BY t.topic_last_post_time DESC"; + $sql_sort"; $result = $db->sql_query_limit($sql, ($sql_limit - $unread_list_count)); while ($row = $db->sql_fetchrow($result)) @@ -1742,7 +1748,7 @@ function get_unread_topics_list($user_id = false, $sql_extra = '', $sql_limit = AND ' . $db->sql_in_set('t.topic_id', $tracked_topics_list, true, true) . ' AND ' . $db->sql_in_set('t.forum_id', $tracked_forums_list, true, true) . " $sql_extra - ORDER BY t.topic_last_post_time DESC"; + $sql_sort"; $result = $db->sql_query_limit($sql, ($sql_limit - $unread_list_count)); while ($row = $db->sql_fetchrow($result)) @@ -1776,9 +1782,9 @@ function get_unread_topics_list($user_id = false, $sql_extra = '', $sql_limit = FROM ' . TOPICS_TABLE . ' t WHERE t.topic_last_post_time > ' . $user_lastmark . " $sql_extra - ORDER BY t.topic_last_post_time DESC"; + $sql_sort"; - $result = $db->sql_query_limit($sql, 1000); + $result = $db->sql_query_limit($sql, $sql_limit); while ($row = $db->sql_fetchrow($result)) { diff --git a/phpBB/search.php b/phpBB/search.php index f991e8e023..66323e5d1d 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -376,24 +376,23 @@ if ($keywords || $author || $author_id || $search_id || $submit) // force sorting $show_results = 'topics'; $sort_key = 't'; - $sort_dir = 'd'; $sort_by_sql['t'] = 't.topic_last_post_time'; $sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + $sql_where = 'AND t.topic_moved_id = 0 + ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . ' + ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : ''); gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; $unread_list = array(); - $unread_list = get_unread_topics_list(); + $unread_list = get_unread_topics_list($user->data['user_id'], $sql_where, $sql_sort); if (!empty($unread_list)) { $sql = 'SELECT t.topic_id FROM ' . TOPICS_TABLE . ' t - WHERE ' . $db->sql_in_set('t.topic_id', array_keys($unread_list)) . ' - AND t.topic_moved_id = 0 - ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . ' - ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " + WHERE ' . $db->sql_in_set('t.topic_id', array_keys($unread_list)) . " $sql_sort"; $field = 'topic_id'; } From f1bd295ce6c92e219d20ac684835cd7aa4ce803b Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 27 Aug 2009 09:10:28 +0000 Subject: [PATCH 525/607] Change of r10055, which itself was: Adjustement for r10050, related to Bug #50185 Instead of S_TAB_INDEX we now use a method suggested by nickvergessen - we simply DEFINE the tabindex for the captcha depending on where it is included. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10058 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 -- .../prosilver/template/captcha_default.html | 2 +- .../styles/prosilver/template/captcha_qa.html | 2 +- .../prosilver/template/captcha_recaptcha.html | 4 ++-- .../styles/prosilver/template/login_body.html | 13 ++++++------ .../prosilver/template/posting_editor.html | 19 +++++++++--------- .../prosilver/template/ucp_register.html | 20 +++++++++---------- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index f5e494ae4c..e23278a0f2 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4126,8 +4126,6 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'S_USER_UNREAD_PRIVMSG' => $user->data['user_unread_privmsg'], 'S_USER_NEW' => $user->data['user_new'], - 'S_TAB_INDEX' => 1, - 'SID' => $SID, '_SID' => $_SID, 'SESSION_ID' => $user->session_id, diff --git a/phpBB/styles/prosilver/template/captcha_default.html b/phpBB/styles/prosilver/template/captcha_default.html index 885a3f42af..bccf231251 100644 --- a/phpBB/styles/prosilver/template/captcha_default.html +++ b/phpBB/styles/prosilver/template/captcha_default.html @@ -11,7 +11,7 @@
    {L_CONFIRM_CODE}
    -
    +
    {L_CONFIRM_CODE_EXPLAIN}
    diff --git a/phpBB/styles/prosilver/template/captcha_qa.html b/phpBB/styles/prosilver/template/captcha_qa.html index 2d5e69207a..ba13f21f7f 100644 --- a/phpBB/styles/prosilver/template/captcha_qa.html +++ b/phpBB/styles/prosilver/template/captcha_qa.html @@ -9,7 +9,7 @@
    :
    {L_CONFIRM_QUESTION_EXPLAIN}
    - +
    diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index a77d19cfc1..5ce19b20ec 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -16,8 +16,8 @@ diff --git a/phpBB/styles/prosilver/template/login_body.html b/phpBB/styles/prosilver/template/login_body.html index fc52deba72..495e8661b9 100644 --- a/phpBB/styles/prosilver/template/login_body.html +++ b/phpBB/styles/prosilver/template/login_body.html @@ -11,29 +11,30 @@
    {LOGIN_ERROR}
    -
    +
    -
    +
    {L_FORGOT_PASS}
    {L_RESEND_ACTIVATION}
    - + +
    -
    -
    +
    +
     
    -
    {S_HIDDEN_FIELDS}
    +
    {S_HIDDEN_FIELDS}
    diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index c349003c38..81adebd206 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -90,18 +90,19 @@
    -
    +
    -
    +
    - + + - + @@ -135,7 +136,7 @@
    - +
    @@ -180,10 +181,10 @@
    {S_HIDDEN_ADDRESS_FIELD} {S_HIDDEN_FIELDS} -   -   - onclick="document.getElementById('postform').action += '#preview';" />  -   +   +   + onclick="document.getElementById('postform').action += '#preview';" />  +  
    diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index f83d75da76..4ff1de1c03 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -28,34 +28,34 @@

    {L_USERNAME_EXPLAIN}
    -
    +
    -
    +
    -
    +

    {L_PASSWORD_EXPLAIN}
    -
    +
    -
    +

    -
    +
    -
    +
    @@ -75,10 +75,10 @@ - - - + + + From 7cf867419f567e0cf0ab9b4a9fb191ade71df948 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 27 Aug 2009 20:48:09 +0000 Subject: [PATCH 526/607] forgot to ci this git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10059 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_profile.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html index 64b7606591..85d37568c2 100644 --- a/phpBB/adm/style/acp_profile.html +++ b/phpBB/adm/style/acp_profile.html @@ -55,6 +55,10 @@

    {L_DISPLAY_AT_REGISTER_EXPLAIN}
    checked="checked" />
    +
    +

    {L_DISPLAY_ON_VT_EXPLAIN}
    +
    checked="checked" />
    +

    {L_REQUIRED_FIELD_EXPLAIN}
    checked="checked" />
    From c52f05b3329c9c79ecbc3184bd65cdbe4644ebcd Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 Aug 2009 09:26:43 +0000 Subject: [PATCH 527/607] Fix Bug #49195 - Queries on un-indexed column user_email Added function to generate email-hash. Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10060 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_users.php | 2 +- phpBB/includes/functions.php | 8 ++++++++ phpBB/includes/functions_user.php | 4 ++-- phpBB/includes/ucp/ucp_profile.php | 2 +- phpBB/includes/ucp/ucp_remind.php | 2 +- phpBB/includes/ucp/ucp_resend.php | 2 +- phpBB/install/install_install.php | 2 +- 8 files changed, 16 insertions(+), 7 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 0922372a78..8610887904 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -283,6 +283,7 @@
  • [Feature] Place debug notices during captcha rendering in the error log - useful for debugging output already started errors.
  • [Feature] Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset...
  • [Feature] Added INC/DEC command to template syntax, applicable to DEFINES and normal template variables, including loops.
  • +
  • [Feature] Added function to generate email-hash. (Bug #49195)
  • 1.ii. Changes since 3.0.4

    diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 7921b6df67..71720f45b4 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -847,7 +847,7 @@ class acp_users { $sql_ary += array( 'user_email' => $update_email, - 'user_email_hash' => crc32($update_email) . strlen($update_email) + 'user_email_hash' => phpbb_email_hash($update_email), ); add_log('user', $user_id, 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e23278a0f2..17fb351630 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -551,6 +551,14 @@ function _hash_crypt_private($password, $setting, &$itoa64) return $output; } +/** +* Hash email +*/ +function phpbb_email_hash($email) +{ + return crc32(strtolower($email)) . strlen($email); +} + /** * Global function for chmodding directories and files for internal use * diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index cb3306745e..11b134cd85 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -171,7 +171,7 @@ function user_add($user_row, $cp_data = false) 'user_password' => (isset($user_row['user_password'])) ? $user_row['user_password'] : '', 'user_pass_convert' => 0, 'user_email' => strtolower($user_row['user_email']), - 'user_email_hash' => crc32(strtolower($user_row['user_email'])) . strlen($user_row['user_email']), + 'user_email_hash' => phpbb_email_hash($user_row['user_email']), 'group_id' => $user_row['group_id'], 'user_type' => $user_row['user_type'], ); @@ -1727,7 +1727,7 @@ function validate_email($email, $allowed_email = false) { $sql = 'SELECT user_email_hash FROM ' . USERS_TABLE . " - WHERE user_email_hash = " . (crc32($email) . strlen($email)); + WHERE user_email_hash = " . $db->sql_escape(phpbb_email_hash($email)); $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index a7785e7163..e24acd89fc 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -110,7 +110,7 @@ class ucp_profile 'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'], 'username_clean' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'], 'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'], - 'user_email_hash' => ($auth->acl_get('u_chgemail')) ? crc32($data['email']) . strlen($data['email']) : $user->data['user_email_hash'], + 'user_email_hash' => ($auth->acl_get('u_chgemail')) ? phpbb_email_hash($data['email']) : $user->data['user_email_hash'], 'user_password' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? phpbb_hash($data['new_password']) : $user->data['user_password'], 'user_passchg' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? time() : 0, ); diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 6325bf89b6..df6733d038 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -38,7 +38,7 @@ class ucp_remind { $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason FROM ' . USERS_TABLE . " - WHERE user_email = '" . $db->sql_escape($email) . "' + WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "' AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); diff --git a/phpBB/includes/ucp/ucp_resend.php b/phpBB/includes/ucp/ucp_resend.php index cad494541b..39e9be24a1 100644 --- a/phpBB/includes/ucp/ucp_resend.php +++ b/phpBB/includes/ucp/ucp_resend.php @@ -45,7 +45,7 @@ class ucp_resend $sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, user_inactive_reason FROM ' . USERS_TABLE . " - WHERE user_email = '" . $db->sql_escape($email) . "' + WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "' AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 6a7b6ca121..0e6c2f36aa 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1337,7 +1337,7 @@ class install_install extends module WHERE config_name = 'avatar_salt'", 'UPDATE ' . $data['table_prefix'] . "users - SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email1']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . (crc32($data['board_email1']) . strlen($data['board_email1'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "' + SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email1']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . $db->sql_escape(phpbb_email_hash($data['board_email1'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "' WHERE username = 'Admin'", 'UPDATE ' . $data['table_prefix'] . "moderator_cache From f26b9e42c0f56a75950283d47f3ab356399f6639 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 28 Aug 2009 11:39:45 +0000 Subject: [PATCH 528/607] Send service unavailable response code for E_USER_ERROR git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10061 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 17fb351630..d6ca262ab8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3595,6 +3595,9 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $db->sql_return_on_error(false); } + // Do not send 200 OK, but service unavailable on errors + header('HTTP/1.1 503 Service Unavailable'); + garbage_collection(); // Try to not call the adm page data... From 175d708b1de4000291fc1916ccd164993b602547 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 29 Aug 2009 11:13:38 +0000 Subject: [PATCH 529/607] Use correct language key for mcp user notes for sorting entries - Bug #50385 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10062 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/mcp_notes_user.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/styles/prosilver/template/mcp_notes_user.html b/phpBB/styles/prosilver/template/mcp_notes_user.html index b738af4020..c05009b580 100644 --- a/phpBB/styles/prosilver/template/mcp_notes_user.html +++ b/phpBB/styles/prosilver/template/mcp_notes_user.html @@ -42,13 +42,13 @@
    - {S_HIDDEN_FIELDS}  + {S_HIDDEN_FIELDS}  {S_FORM_TOKEN}
    -
    +
    -
    +
    @@ -117,7 +117,7 @@
    - +
    From 36b8b94ea647930eb14edaf2e4b4d27ab56a05c9 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 30 Aug 2009 11:10:12 +0000 Subject: [PATCH 530/607] script to update email hashes (they are not strings btw, but BINT) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10063 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/update_email_hash.php | 57 +++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 phpBB/develop/update_email_hash.php diff --git a/phpBB/develop/update_email_hash.php b/phpBB/develop/update_email_hash.php new file mode 100644 index 0000000000..80fd4bbc17 --- /dev/null +++ b/phpBB/develop/update_email_hash.php @@ -0,0 +1,57 @@ +session_begin(); +$auth->acl($user->data); +$user->setup(); + +$start = request_var('start', 0); +$num_items = 1000; + +echo '
    Updating user email hashes' . "\n"; + +$sql = 'SELECT user_id, user_email + FROM ' . USERS_TABLE . ' + ORDER BY user_id ASC'; +$result = $db->sql_query($sql); + +$echos = 0; +while ($row = $db->sql_fetchrow($result)) +{ + $echos++; + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_email_hash = '" . $db->sql_escape(phpbb_email_hash($row['user_email'])) . "' + WHERE user_id = " . (int) $row['user_id']; + $db->sql_query($sql); + + if ($echos == 200) + { + echo '
    '; + $echos = 0; + } + + echo '.'; + flush(); +} +$db->sql_freeresult($result); + +echo 'FINISHED'; + +// Done +$db->sql_close(); +?> \ No newline at end of file From fd24241044338f9210319398ae10bc6ad02983ea Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 30 Aug 2009 11:15:24 +0000 Subject: [PATCH 531/607] Revert INC/DEC feature. It is not consistent with the other template variables - bad idea. ;) We will get to it though... but not now. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10064 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 - phpBB/docs/coding-guidelines.html | 4 ++-- phpBB/includes/functions_template.php | 30 --------------------------- 3 files changed, 2 insertions(+), 33 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8610887904..e7df10eba0 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -282,7 +282,6 @@
  • [Feature] Separate PM Reply and PM Reply to all in prosilver.
  • [Feature] Place debug notices during captcha rendering in the error log - useful for debugging output already started errors.
  • [Feature] Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset...
  • -
  • [Feature] Added INC/DEC command to template syntax, applicable to DEFINES and normal template variables, including loops.
  • [Feature] Added function to generate email-hash. (Bug #49195)
  • diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 29fce50b54..8ac2e4e89d 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1176,7 +1176,7 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp; <!-- DEFINE $SOME_VAR = 'my_file.html' --> <!-- INCLUDE {$SOME_VAR} --> - +

    PHP

    A contentious decision has seen the ability to include PHP within the template introduced. This is achieved by enclosing the PHP within relevant tags:

    diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index f22a48bddb..1d3a4d74f8 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -191,14 +191,6 @@ class template_compile $compile_blocks[] = 'compile_tag_define($block_val[2], false) . ' ?>'; break; - case 'INC': - $compile_blocks[] = 'compile_tag_counter($block_val[2], '++') . ' ?>'; - break; - - case 'DEC': - $compile_blocks[] = 'compile_tag_counter($block_val[2], '--') . ' ?>'; - break; - case 'INCLUDE': $temp = array_shift($include_blocks); @@ -634,28 +626,6 @@ class template_compile return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $match[4] . ';'; } - - /** - * Compile INC/DEC tags - * INC/DEC tags support defined template variables as well as normal template variables - * @access private - */ - function compile_tag_counter($tag_args, $operation = '++') - { - preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $tag_args, $varrefs); - - if (empty($varrefs[0])) - { - return ''; - } - - // Build token - $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']'); - - // Increase or decrease token ;) - return "echo {$token}{$operation};"; - } - /** * Compile INCLUDE tag * @access private From 2ad1abe0eedb9348bcb624eed23aba15c4ca94fe Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 30 Aug 2009 11:56:15 +0000 Subject: [PATCH 532/607] Fix Bug #50475 - Only show "Add friend" and "Add foe" links if the specific module is enabled. Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10065 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/memberlist.php | 14 ++++++++------ .../prosilver/template/memberlist_view.html | 16 +++++++++------- .../subsilver2/template/memberlist_view.html | 10 +++++++++- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e7df10eba0..fd0c1364db 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -200,6 +200,7 @@
  • [Fix] Correctly orientate Control-Panel-Navigation background-image on RTL languages. (Bug #49945)
  • [Fix] Sort private messages by message time and not message id. (Bug #50015)
  • [Fix] Make sure only logs for existing users are displayed and user-specific logs removed on user deletion. (Bug #49855)
  • +
  • [Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 424ea27739..11ff9e7685 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -500,8 +500,8 @@ switch ($mode) $poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']); - // We need to check if the modules 'zebra', 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links - $zebra_enabled = $user_notes_enabled = $warn_user_enabled = false; + // We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links + $zebra_enabled = $friends_enabled = $foes_enabled = $user_notes_enabled = $warn_user_enabled = false; // Only check if the user is logged in if ($user->data['is_registered']) @@ -518,6 +518,8 @@ switch ($mode) $user_notes_enabled = ($module->loaded('notes', 'user_notes')) ? true : false; $warn_user_enabled = ($module->loaded('warn', 'warn_user')) ? true : false; $zebra_enabled = ($module->loaded('zebra')) ? true : false; + $friends_enabled = ($module->loaded('zebra', 'friends')) ? true : false; + $foes_enabled = ($module->loaded('zebra', 'foes')) ? true : false; unset($module); } @@ -585,10 +587,10 @@ switch ($mode) 'S_USER_NOTES' => ($user_notes_enabled) ? true : false, 'S_WARN_USER' => ($warn_user_enabled) ? true : false, 'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false, - 'U_ADD_FRIEND' => (!$friend) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', - 'U_ADD_FOE' => (!$foe) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', - 'U_REMOVE_FRIEND' => ($friend) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&usernames[]=' . $user_id) : '', - 'U_REMOVE_FOE' => ($foe) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id) : '', + 'U_ADD_FRIEND' => (!$friend && !$foe && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', + 'U_ADD_FOE' => (!$friend && !$foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', + 'U_REMOVE_FRIEND' => ($friend && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&usernames[]=' . $user_id) : '', + 'U_REMOVE_FOE' => ($foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id) : '', )); if (!empty($profile_fields['row'])) diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index abeecf8bf9..2458fddfb3 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -34,14 +34,16 @@
    {L_USERGROUPS}:
    {custom_fields.PROFILE_FIELD_NAME}:
    {custom_fields.PROFILE_FIELD_VALUE}
    - -
     
    {L_ADD_FRIEND}
    -
     
    {L_ADD_FOE}
    + +
     
    {L_REMOVE_FRIEND}
    + +
     
    {L_REMOVE_FOE}
    - -
     
    {L_REMOVE_FRIEND}
    - -
     
    {L_REMOVE_FOE}
    + +
     
    {L_ADD_FRIEND}
    + + +
     
    {L_ADD_FOE}
    diff --git a/phpBB/styles/subsilver2/template/memberlist_view.html b/phpBB/styles/subsilver2/template/memberlist_view.html index 33f229d860..a8f2962c24 100644 --- a/phpBB/styles/subsilver2/template/memberlist_view.html +++ b/phpBB/styles/subsilver2/template/memberlist_view.html @@ -51,7 +51,15 @@
    - +
    diff --git a/phpBB/styles/subsilver2/template/ucp_profile_signature.html b/phpBB/styles/subsilver2/template/ucp_profile_signature.html index 26b0804df1..2b396ea0df 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_signature.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_signature.html @@ -27,7 +27,7 @@ - + From cb74521e6484f7bccd9c587d61e10e90c8653b99 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 11 Aug 2009 12:49:38 +0000 Subject: [PATCH 419/607] less obstrusive version info git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9952 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_main.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 5d97c012a5..52c9dfd2c5 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -17,17 +17,15 @@

    {L_VERSIONCHECK_FAIL}

    - - -
    -

    {L_VERSION_UP_TO_DATE_ACP}

    - -
    -

    {L_VERSION_NOT_UP_TO_DATE_TITLE}

    - -

    {L_VERSIONCHECK_FORCE_UPDATE} · {L_MORE_INFORMATION}

    + +
    +

    {L_VERSION_NOT_UP_TO_DATE_TITLE}

    +

    {L_VERSIONCHECK_FORCE_UPDATE} · {L_MORE_INFORMATION}

    +
    + +
    @@ -100,7 +98,9 @@
    - + From 926b38c4d5267559ead2970a2bf4e64e29d9da99 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 11 Aug 2009 12:58:00 +0000 Subject: [PATCH 420/607] use [] style we use for links occurring after text in acp_main too. ;) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9953 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_main.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 52c9dfd2c5..fc8804e62f 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -19,7 +19,7 @@

    {L_VERSIONCHECK_FAIL}

    {L_VERSIONCHECK_FORCE_UPDATE} · {L_MORE_INFORMATION}

    - +

    {L_VERSION_NOT_UP_TO_DATE_TITLE}

    {L_VERSIONCHECK_FORCE_UPDATE} · {L_MORE_INFORMATION}

    @@ -98,8 +98,8 @@
    - From 9dc2095b52fbe27925ac995879a0b491ae3e5130 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 11 Aug 2009 13:07:40 +0000 Subject: [PATCH 421/607] let the link wrap for tiny resolutions git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9954 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_main.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index fc8804e62f..1f1e7b8740 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -99,7 +99,7 @@ From ff458a5b4e81c1f35a3341ad4646205e52c5b5da Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 11 Aug 2009 13:35:15 +0000 Subject: [PATCH 422/607] Update search index if only post subject changed. (Bug #49435) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9955 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/posting.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3e5757aa70..f87e0439f0 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -191,6 +191,7 @@
  • [Fix] Fix general error while registration, through undefined variable $config in validate_referer (Bug #49035 - Patch by wjvriend)
  • [Fix] Correctly extract column default value when exporting PostgreSQL tables. (Bug #48955)
  • [Fix] Allow updater to work correctly with PHP filename extensions other than ".php". (Bugs #15809, #49215)
  • +
  • [Fix] Update search index if only post subject changed. (Bug #49435)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/posting.php b/phpBB/posting.php index 919d92b27c..36c3df50d9 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -802,6 +802,9 @@ if ($submit || $preview || $refresh) // Check checksum ... don't re-parse message if the same $update_message = ($mode != 'edit' || $message_md5 != $post_data['post_checksum'] || $status_switch || strlen($post_data['bbcode_uid']) < BBCODE_UID_LEN) ? true : false; + // Also check if subject got updated... + $update_subject = $mode != 'edit' || ($post_data['post_subject_md5'] && $post_data['post_subject_md5'] != md5($post_data['post_subject'])); + // Parse message if ($update_message) { @@ -1114,7 +1117,8 @@ if ($submit || $preview || $refresh) $data['topic_replies'] = $post_data['topic_replies']; } - $redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message); + // $update_message indicates two things: 1) update post_text in table 2) update search index + $redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message || $update_subject); if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) { From 96a30afcca3ebd832c9b3083bb5c9a9f2a2dc54b Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 11 Aug 2009 14:49:58 +0000 Subject: [PATCH 423/607] do not change column if column already exists. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9956 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 4380f0cb8c..8252cd4968 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1860,10 +1860,12 @@ class updater_db_tools { foreach ($columns as $column_name => $column_data) { - // Only add the column if it does not exist yet, else change it (to be consistent) + // Only add the column if it does not exist yet if ($column_exists = $this->sql_column_exists($table, $column_name)) { - $result = $this->sql_column_change($table, $column_name, $column_data, true); + continue; + // This is commented out here because it can take tremendous time on updates +// $result = $this->sql_column_change($table, $column_name, $column_data, true); } else { From be963ed93892659005f892767548ee4597e73fcb Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 11 Aug 2009 16:24:18 +0000 Subject: [PATCH 424/607] allow custom template path for email files git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9957 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_messenger.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 2255b3dcb5..212ae720cb 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -173,7 +173,7 @@ class messenger /** * Set email template to use */ - function template($template_file, $template_lang = '') + function template($template_file, $template_lang = '', $template_path = '') { global $config, $phpbb_root_path, $user; @@ -193,8 +193,11 @@ class messenger $this->tpl_msg[$template_lang . $template_file] = new template(); $tpl = &$this->tpl_msg[$template_lang . $template_file]; - $template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; - $template_path .= $template_lang . '/email'; + if (!$template_path) + { + $template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; + $template_path .= $template_lang . '/email'; + } $tpl->set_custom_template($template_path, $template_lang . '_email'); From dedddfabedf357cda8606a6bc6c49ac48028bc07 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 12 Aug 2009 09:19:47 +0000 Subject: [PATCH 425/607] change item to item_id; related to #49485 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9958 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 23ed190bcd..6c651b2b86 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3692,7 +3692,7 @@ function obtain_users_online($item_id = 0, $item = 'forum') global $db, $config, $user; $reading_sql = ''; - if ($item !== 0) + if ($item_id !== 0) { $reading_sql = ' AND s.session_' . $item . '_id = ' . (int) $item_id; } From 5dd85e232355432f87156270236901df33232721 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 12 Aug 2009 09:22:04 +0000 Subject: [PATCH 426/607] Fix r9955 for Bug #49435 (Since $update_message was true in submit_post() the non-parsed text had been entered into the db [because $update_message was false before]) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9959 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_posting.php | 5 +++-- phpBB/posting.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 1385934c0e..4cf6b7010d 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1621,8 +1621,9 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) /** * Submit Post +* @todo Split up and create lightweight, simple API for this. */ -function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true) +function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true, $update_search_index = true) { global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path; @@ -2487,7 +2488,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } // Index message contents - if ($update_message && $data['enable_indexing']) + if ($update_search_index && $data['enable_indexing']) { // Select the search method and do some additional checks to ensure it can actually be utilised $search_type = basename($config['search_type']); diff --git a/phpBB/posting.php b/phpBB/posting.php index 36c3df50d9..05fabaca7c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1117,8 +1117,8 @@ if ($submit || $preview || $refresh) $data['topic_replies'] = $post_data['topic_replies']; } - // $update_message indicates two things: 1) update post_text in table 2) update search index - $redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message || $update_subject); + // The last parameter tells submit_post if search indexer has to be run + $redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message, ($update_message || $update_subject) ? true : false); if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) { From 91b91494e201ee33d06fa86bc608f6f9fc45bdaa Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 12 Aug 2009 09:25:57 +0000 Subject: [PATCH 427/607] #49465 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9960 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/posting.php | 3 ++- phpBB/styles/prosilver/template/quickreply_editor.html | 2 +- phpBB/styles/subsilver2/template/quickreply_editor.html | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 05fabaca7c..bea534c5dd 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -39,7 +39,7 @@ $load = (isset($_POST['load'])) ? true : false; $delete = (isset($_POST['delete'])) ? true : false; $cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false; -$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load) ? true : false; +$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['full_editor']) ||isset($_POST['cancel_unglobalise']) || $save || $load) ? true : false; $mode = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var('mode', ''); $error = $post_data = array(); @@ -1365,6 +1365,7 @@ generate_forum_nav($post_data); // Build Forum Rules generate_forum_rules($post_data); +// Posting uses is_solved for legacy reasons. Plugins have to use is_solved to force themselves to be displayed. if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === false) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) { $captcha->reset(); diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index 10fede984d..cc090957f9 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -28,7 +28,7 @@ {S_FORM_TOKEN} {QR_HIDDEN_FIELDS}   -   +   diff --git a/phpBB/styles/subsilver2/template/quickreply_editor.html b/phpBB/styles/subsilver2/template/quickreply_editor.html index f53b03bd62..704c6e1306 100644 --- a/phpBB/styles/subsilver2/template/quickreply_editor.html +++ b/phpBB/styles/subsilver2/template/quickreply_editor.html @@ -15,7 +15,7 @@
    diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html index a2dcc4ebbd..64b7606591 100644 --- a/phpBB/adm/style/acp_profile.html +++ b/phpBB/adm/style/acp_profile.html @@ -127,7 +127,7 @@
    - +
    {S_HIDDEN_FIELDS} {S_FORM_TOKEN} @@ -151,15 +151,15 @@
    - +
    {S_HIDDEN_FIELDS} {S_FORM_TOKEN}
    - + - + @@ -194,14 +194,14 @@ {ICON_MOVE_UP_DISABLED} {ICON_MOVE_DOWN} - {ICON_MOVE_UP} - {ICON_MOVE_DOWN} + {ICON_MOVE_UP} + {ICON_MOVE_DOWN} {ICON_MOVE_UP} - {ICON_MOVE_DOWN_DISABLED} + {ICON_MOVE_DOWN_DISABLED} - {ICON_EDIT} + {ICON_EDIT} {ICON_EDIT_DISABLED} @@ -209,12 +209,16 @@
    + + + +
    {L_BOARD_VERSION}: {BOARD_VERSION} + style="color: #228822"style="color: #BC2A4D" title="{L_MORE_INFORMATION}" href="{U_VERSIONCHECK}">{BOARD_VERSION} {L_VERSIONCHECK_FORCE_UPDATE}  + {L_NUMBER_ORPHAN}: {TOTAL_ORPHAN}
    {L_BOARD_VERSION}: - style="color: #228822"style="color: #BC2A4D" title="{L_MORE_INFORMATION}" href="{U_VERSIONCHECK}">{BOARD_VERSION} {L_VERSIONCHECK_FORCE_UPDATE}  + + style="color: #228822"style="color: #BC2A4D" title="{L_MORE_INFORMATION}" href="{U_VERSIONCHECK}">{BOARD_VERSION} [ {L_VERSIONCHECK_FORCE_UPDATE} ] {L_NUMBER_ORPHAN}:
    {L_BOARD_VERSION}: - style="color: #228822"style="color: #BC2A4D" title="{L_MORE_INFORMATION}" href="{U_VERSIONCHECK}">{BOARD_VERSION} [ {L_VERSIONCHECK_FORCE_UPDATE} ] + style="color: #228822"style="color: #BC2A4D" title="{L_MORE_INFORMATION}" href="{U_VERSIONCHECK}">{BOARD_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] {L_NUMBER_ORPHAN}:
      - + {S_FORM_TOKEN} {QR_HIDDEN_FIELDS} From 2d0d35db48b0c3aae9952e1cf805beebe222958c Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 12 Aug 2009 10:30:37 +0000 Subject: [PATCH 428/607] populate who is online only where required git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9961 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/faq.php | 2 +- phpBB/includes/functions.php | 16 ++++++++++++---- phpBB/memberlist.php | 2 +- phpBB/posting.php | 4 ++-- phpBB/viewforum.php | 2 +- phpBB/viewtopic.php | 2 +- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/phpBB/faq.php b/phpBB/faq.php index 04353de50f..0a04bad8eb 100644 --- a/phpBB/faq.php +++ b/phpBB/faq.php @@ -77,7 +77,7 @@ $template->assign_vars(array( 'SWITCH_COLUMN_MANUALLY' => (!$found_switch) ? true : false, )); -page_header($l_title); +page_header($l_title, false); $template->set_filenames(array( 'body' => 'faq_body.html') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 6c651b2b86..4f88ee9625 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3861,7 +3861,7 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum' /** * Generate page header */ -function page_header($page_title = '', $display_online_list = true) +function page_header($page_title = '', $display_online_list = true, $forum_id = 0) { global $db, $config, $template, $SID, $_SID, $user, $auth, $phpEx, $phpbb_root_path; @@ -3917,10 +3917,18 @@ function page_header($page_title = '', $display_online_list = true) * } * */ - - $item_id = max(request_var('f', 0), 0); + + if ($forum_id) + { + $item_id = max($forum_id, 0); + } + else + { + $item_id = 0; + } + + // workaround legacy code $item = 'forum'; - $online_users = obtain_users_online($item_id, $item); $user_online_strings = obtain_users_online_string($online_users, $item_id, $item); diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 51301d6ffe..424ea27739 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1531,7 +1531,7 @@ switch ($mode) } // Output the page -page_header($page_title); +page_header($page_title, false); $template->set_filenames(array( 'body' => $template_html) diff --git a/phpBB/posting.php b/phpBB/posting.php index bea534c5dd..a175ebba51 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1492,7 +1492,7 @@ $allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') posting_gen_attachment_entry($attachment_data, $filename_data, $allowed); // Output page ... -page_header($page_title); +page_header($page_title, false); $template->set_filenames(array( 'body' => 'posting_body.html') @@ -1520,7 +1520,7 @@ function upload_popup($forum_style = 0) ($forum_style) ? $user->setup('posting', $forum_style) : $user->setup('posting'); - page_header($user->lang['PROGRESS_BAR']); + page_header($user->lang['PROGRESS_BAR'], false); $template->set_filenames(array( 'popup' => 'posting_progress_bar.html') diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 2668919e1d..ad1bb64ff2 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -142,7 +142,7 @@ else } // Dump out the page header and load viewforum template -page_header($user->lang['VIEW_FORUM'] . ' - ' . $forum_data['forum_name']); +page_header($user->lang['VIEW_FORUM'] . ' - ' . $forum_data['forum_name'], true, $forum_id); $template->set_filenames(array( 'body' => 'viewforum_body.html') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 51a8682229..10f782089b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1675,7 +1675,7 @@ if (empty($_REQUEST['f'])) } // Output the page -page_header($user->lang['VIEW_TOPIC'] . ' - ' . $topic_data['topic_title']); +page_header($user->lang['VIEW_TOPIC'] . ' - ' . $topic_data['topic_title'], true, $forum_id); $template->set_filenames(array( 'body' => ($view == 'print') ? 'viewtopic_print.html' : 'viewtopic_body.html') From e8908364e5443b176d9c0e3938758204e045fbaf Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 12 Aug 2009 12:07:49 +0000 Subject: [PATCH 429/607] wording git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9962 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/captcha_qa.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/captcha_qa.php b/phpBB/language/en/captcha_qa.php index ef09f65951..2b2c9de0de 100644 --- a/phpBB/language/en/captcha_qa.php +++ b/phpBB/language/en/captcha_qa.php @@ -37,7 +37,7 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'CAPTCHA_QA' => 'Q&A CAPTCHA', - 'CONFIRM_QUESTION_EXPLAIN' => 'The following question is a means of identifying and preventing automated submissions.', + 'CONFIRM_QUESTION_EXPLAIN' => 'This question is a means of identifying and preventing automated submissions.', 'CONFIRM_QUESTION_WRONG' => 'You have provided an invalid answer to the confirmation question.', 'QUESTION_ANSWERS' => 'Answers', From 8014c49f68c2081abfe40f5f3dd270025fdbaf1e Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 12 Aug 2009 12:10:23 +0000 Subject: [PATCH 430/607] entries git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9963 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f87e0439f0..ea2459b653 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -192,6 +192,8 @@
  • [Fix] Correctly extract column default value when exporting PostgreSQL tables. (Bug #48955)
  • [Fix] Allow updater to work correctly with PHP filename extensions other than ".php". (Bugs #15809, #49215)
  • [Fix] Update search index if only post subject changed. (Bug #49435)
  • +
  • [Fix] Fix who is online displaying incorrect data. (Bug #49485, thanks Brainy)
  • +
  • [Change] Introduce new parametwer to page_header for forum specific who is online listings.
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • From 45964352e37217277527480fcd89222b33c22280 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 12 Aug 2009 12:34:12 +0000 Subject: [PATCH 431/607] Typo in r9963. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9964 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ea2459b653..20f3f849d5 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -193,7 +193,6 @@
  • [Fix] Allow updater to work correctly with PHP filename extensions other than ".php". (Bugs #15809, #49215)
  • [Fix] Update search index if only post subject changed. (Bug #49435)
  • [Fix] Fix who is online displaying incorrect data. (Bug #49485, thanks Brainy)
  • -
  • [Change] Introduce new parametwer to page_header for forum specific who is online listings.
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • @@ -219,6 +218,7 @@
  • [Change] Cache version check.
  • [Change] When creating a new forum without copying permissions, ask again.
  • [Change] Parse multiline url title for [url] BBCode tag. (Bug #1309)
  • +
  • [Change] Introduce new parameter to page_header() for forum specific who is online listings.
  • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
  • [Feature] Backported 3.2 captcha plugins.
      From 09ad10a734c0993f9465e6ac3463951251602fc6 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 12 Aug 2009 15:00:47 +0000 Subject: [PATCH 432/607] ok, i am very sorry, but this needs to be fixed. Generally, our config table is not really suited for holding large datasets. Because feed settings for the forums to enable news feeds and excluded forums rely on the forums itself we have decided to introduce a forum_options table where custom options can be stored. Additionally, for this to work across all DBMS we support, we added a new method to the DBAL for the bitwise AND operator. Also moved the forum/topic feed template variable to the location where they belong to (forum and topic view) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9965 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/index.php | 18 ++-- phpBB/develop/create_schema_files.php | 1 + phpBB/develop/mysql_upgrader.php | 1 + phpBB/feed.php | 41 +++++++++- phpBB/includes/acp/acp_board.php | 82 +++++++++++-------- phpBB/includes/constants.php | 4 + phpBB/includes/db/dbal.php | 18 ++++ phpBB/includes/db/firebird.php | 5 ++ phpBB/includes/db/oracle.php | 5 ++ phpBB/includes/functions.php | 57 +++++++++++-- phpBB/includes/functions_admin.php | 36 ++++---- phpBB/install/database_update.php | 6 +- phpBB/install/schemas/firebird_schema.sql | 1 + phpBB/install/schemas/mssql_schema.sql | 1 + phpBB/install/schemas/mysql_40_schema.sql | 1 + phpBB/install/schemas/mysql_41_schema.sql | 1 + phpBB/install/schemas/oracle_schema.sql | 1 + phpBB/install/schemas/postgres_schema.sql | 1 + phpBB/install/schemas/schema_data.sql | 2 - phpBB/install/schemas/sqlite_schema.sql | 1 + .../prosilver/template/overall_header.html | 4 +- phpBB/viewforum.php | 1 + phpBB/viewtopic.php | 3 +- 23 files changed, 211 insertions(+), 80 deletions(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 778070e2e1..b6b251d2fc 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -263,6 +263,12 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) $tpl = ''; $name = 'config[' . $config_key . ']'; + // Make sure there is no notice printed out for non-existent config options (we simply set them) + if (!isset($new[$config_key])) + { + $new[$config_key] = ''; + } + switch ($tpl_type[0]) { case 'text': @@ -301,7 +307,6 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) break; case 'select': - case 'select_multiple': case 'custom': $return = ''; @@ -340,21 +345,12 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) } else { - if ($tpl_type[0] == 'select_multiple') - { - $new[$config_key] = @unserialize(trim($new[$config_key])); - } - $args = array($new[$config_key], $key); } $return = call_user_func_array($call, $args); - if ($tpl_type[0] == 'select_multiple') - { - $tpl = ''; - } - else if ($tpl_type[0] == 'select') + if ($tpl_type[0] == 'select') { $tpl = ''; } diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index d8c34d0d76..b9017937c8 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1073,6 +1073,7 @@ function get_schema_struct() 'forum_last_poster_name'=> array('VCHAR_UNI', ''), 'forum_last_poster_colour'=> array('VCHAR:6', ''), 'forum_flags' => array('TINT:4', 32), + 'forum_options' => array('UINT:20', 0), 'display_subforum_list' => array('BOOL', 1), 'display_on_index' => array('BOOL', 1), 'enable_indexing' => array('BOOL', 1), diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 1f8bccdd1f..034c1c0c20 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -563,6 +563,7 @@ function get_schema_struct() 'forum_last_poster_name'=> array('VCHAR_UNI', ''), 'forum_last_poster_colour'=> array('VCHAR:6', ''), 'forum_flags' => array('TINT:4', 32), + 'forum_options' => array('UINT:20', 0), 'display_subforum_list' => array('BOOL', 1), 'display_on_index' => array('BOOL', 1), 'enable_indexing' => array('BOOL', 1), diff --git a/phpBB/feed.php b/phpBB/feed.php index f0e4435956..9603b27301 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -339,7 +339,17 @@ class phpbb_feed_factory break; case 'news': - if (empty($config['feed_news_id'])) + global $db; + + // Get at least one news forum + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0'); + $result = $db->sql_query_limit($sql, 1, 0, 600); + $s_feed_news = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + if (!$s_feed_news) { return false; } @@ -534,7 +544,18 @@ class phpbb_feed global $auth, $db, $config, $phpbb_root_path, $phpEx, $user; // Which forums should not be searched ? - $exclude_forums = (!empty($config['feed_exclude_id'])) ? unserialize(trim($config['feed_exclude_id'])) : array(); + $exclude_forums = array(); + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_EXCLUDE, '<> 0'); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $exclude_forums[] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); // Exclude forums the user is not able to read $this->excluded_forums_ary = array_keys($auth->acl_getf('!f_read', true)); @@ -883,7 +904,18 @@ class phpbb_feed_news extends phpbb_feed { global $db, $config; - $in_fid_ary = unserialize(trim($config['feed_news_id'])); + // Get news forums... + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0'); + $result = $db->sql_query($sql); + + $in_fid_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $in_fid_ary[] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); if (!sizeof($in_fid_ary)) { @@ -905,7 +937,8 @@ class phpbb_feed_news extends phpbb_feed 'WHERE' => $db->sql_in_set('t.forum_id', $in_fid_ary) . ' AND f.forum_id = t.forum_id AND p.post_id = t.topic_first_post_id - AND t.topic_poster = u.user_id', + AND t.topic_poster = u.user_id + AND t.topic_moved_id = 0', 'ORDER_BY' => 't.topic_time DESC', ); diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index bd97c29f02..78ba5092a0 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -272,8 +272,8 @@ class acp_board 'feed_overall_topics_limit' => array('lang' => 'ACP_FEED_OVERALL_TOPIC_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => false), 'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), 'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), - 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'select_multiple', 'method' => 'select_news_forums', 'explain' => true ), - 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'select_multiple', 'method' => 'select_exclude_forums', 'explain' => true), + 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true), + 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true), ) ); break; @@ -440,35 +440,16 @@ class acp_board // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... foreach ($display_vars['vars'] as $config_name => $null) { - if (strpos($config_name, 'legend') !== false) + if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) { continue; } - if ($config_name == 'auth_method') + if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') { continue; } - // It could happen that the cfg array is not set. This happens within feed settings if unselecting all forums in the multiple select fields for example (it is the same as checkbox handling) - if (!isset($cfg_array[$config_name])) - { - $cfg_array[$config_name] = ''; - } - - // Erm, we spotted an array - if ($null['type'] == 'select_multiple' && $submit && isset($_REQUEST['config'][$config_name])) - { - // Get config *array* - $cfg_ = utf8_normalize_nfc(request_var('config', array('' => array('')), true)); - - // Check if the variable is set and an array - if (isset($cfg_[$config_name]) && is_array($cfg_[$config_name])) - { - $cfg_array[$config_name] = trim(serialize($cfg_[$config_name])); - } - } - $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; if ($config_name == 'email_function_name') @@ -484,6 +465,13 @@ class acp_board } } + // Store news and exclude ids + if ($mode == 'feed' && $submit) + { + $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id'); + $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id'); + } + if ($mode == 'auth') { // Retrieve a list of auth plugins and check their config values @@ -902,17 +890,17 @@ class acp_board { global $user, $config; - // Determine ids to be selected - $select_ids = (sizeof($value)) ? $value : false; - - $forum_list = make_forum_select($select_ids, false, true, true, true, false, true); + $forum_list = make_forum_select(false, false, true, true, true, false, true); // Build forum options - $s_forum_options = ''; + $s_forum_options = ''; return $s_forum_options; } @@ -921,20 +909,48 @@ class acp_board { global $user, $config; - // Determine ids to be selected - $select_ids = (sizeof($value)) ? $value : false; - - $forum_list = make_forum_select($select_ids, false, true, false, false, false, true); + $forum_list = make_forum_select(false, false, true, false, false, false, true); // Build forum options - $s_forum_options = ''; + $s_forum_options = ''; return $s_forum_options; } + + function store_feed_forums($option, $key) + { + global $db, $cache; + + // Get key + $values = request_var($key, array(0 => 0)); + + // Empty option bit for all forums + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_options = forum_options - ' . (1 << $option) . ' + WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0'); + $db->sql_query($sql); + + // Already emptied for all... + if (sizeof($values)) + { + // Set for selected forums + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_options = forum_options + ' . (1 << $option) . ' + WHERE ' . $db->sql_in_set('forum_id', $values); + $db->sql_query($sql); + } + + // Empty sql cache for forums table because options changed + $cache->destroy('sql', FORUMS_TABLE); + } + } ?> \ No newline at end of file diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 2173f2ee68..98abf18b6f 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -93,6 +93,10 @@ define('FORUM_FLAG_ACTIVE_TOPICS', 16); define('FORUM_FLAG_POST_REVIEW', 32); define('FORUM_FLAG_QUICK_REPLY', 64); +// Forum Options... sequential order. Modifications should begin at number 10 (number 29 is maximum) +define('FORUM_OPTION_FEED_NEWS', 1); +define('FORUM_OPTION_FEED_EXCLUDE', 2); + // Optional text flags define('OPTION_FLAG_BBCODE', 1); define('OPTION_FLAG_SMILIES', 2); diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index 0e1d6cba33..5418ed394b 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -411,6 +411,24 @@ class dbal } } + /** + * Run binary AND operator on DB column. + * Results in sql statement: "{$column_name} & (1 << {$bit}) {$compare}" + * + * @param string $column_name The column name to use + * @param int $bit The value to use for the AND operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29 + * @param string $compare Any custom SQL code after the check (for example "= 0") + */ + function sql_bit_and($column_name, $bit, $compare = '') + { + if (method_exists($this, '_sql_bit_and')) + { + return $this->_sql_bit_and($column_name, $bit, $compare); + } + + return $column_name . ' & ' . (1 << $bit) . (($compare) ? ' ' . $compare : ''); + } + /** * Run more than one insert statement. * diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php index 3b31942a8b..f5e8595382 100644 --- a/phpBB/includes/db/firebird.php +++ b/phpBB/includes/db/firebird.php @@ -446,6 +446,11 @@ class dbal_firebird extends dbal return $data; } + function _sql_bit_and($column_name, $bit, $compare = '') + { + return 'BIN_AND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); + } + /** * return sql error array * @access private diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index a140c4b676..10f4a1a7a7 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -568,6 +568,11 @@ class dbal_oracle extends dbal return $data; } + function _sql_bit_and($column_name, $bit, $compare = '') + { + return 'BITAND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); + } + /** * return sql error array * @access private diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4f88ee9625..49e9f41704 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3505,7 +3505,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $l_notify = '

      Please notify the board administrator or webmaster: ' . $config['board_contact'] . '

      '; } } - + if (defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) { // let's avoid loops @@ -3857,6 +3857,40 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum' ); } +/** +* Get option bitfield from custom data +* +* @param int $bit The bit/value to get +* @param int $data Current bitfield to check +* @return bool Returns true if value of constant is set in bitfield, else false +*/ +function phpbb_optionget($bit, $data) +{ + return ($data & 1 << (int) $bit) ? true : false; +} + +/** +* Set option bitfield +* +* @param int $bit The bit/value to set/unset +* @param bool $set True if option should be set, false if option should be unset. +* @param int $data Current bitfield to change +* +* @return int The new bitfield +*/ +function phpbb_optionset($bit, $set, $data) +{ + if ($set && !($data & 1 << $bit)) + { + $data += 1 << $bit; + } + else if (!$set && ($data & 1 << $bit)) + { + $data -= 1 << $bit; + } + + return $data; +} /** * Generate page header @@ -3917,7 +3951,7 @@ function page_header($page_title = '', $display_online_list = true, $forum_id = * } * */ - + if ($forum_id) { $item_id = max($forum_id, 0); @@ -3926,7 +3960,7 @@ function page_header($page_title = '', $display_online_list = true, $forum_id = { $item_id = 0; } - + // workaround legacy code $item = 'forum'; $online_users = obtain_users_online($item_id, $item); @@ -4005,6 +4039,19 @@ function page_header($page_title = '', $display_online_list = true, $forum_id = $forum_id = request_var('f', 0); $topic_id = request_var('t', 0); + $s_feed_news = false; + + // Get option for news + if ($config['feed_enable']) + { + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0'); + $result = $db->sql_query_limit($sql, 1, 0, 600); + $s_feed_news = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + } + // The following assigns all _common_ variables that may be used at any point in a template. $template->assign_vars(array( 'SITENAME' => $config['sitename'], @@ -4082,11 +4129,9 @@ function page_header($page_title = '', $display_online_list = true, $forum_id = 'S_TOPIC_ID' => $topic_id, 'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false, - 'S_ENABLE_FEEDS_NEWS' => ($config['feed_news_id'] != '') ? true : false, 'S_ENABLE_FEEDS_FORUMS' => ($config['feed_overall_forums']) ? true : false, 'S_ENABLE_FEEDS_TOPICS' => ($config['feed_overall_topics']) ? true : false, - 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_id && strpos($user->page['page_name'], 'viewforum') !== false) ? true : false, - 'S_ENABLE_FEEDS_TOPIC' => ($config['feed_topic'] && $topic_id && strpos($user->page['page_name'], 'viewtopic') !== false) ? true : false, + 'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false, 'T_THEME_PATH' => "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme', 'T_TEMPLATE_PATH' => "{$phpbb_root_path}styles/" . $user->theme['template_path'] . '/template', diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 44675b9cc0..1931ae3dfa 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -69,7 +69,7 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = $acl = ($ignore_acl) ? '' : (($only_acl_post) ? 'f_post' : array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel')); // This query is identical to the jumpbox one - $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id + $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, forum_flags, forum_options, left_id, right_id FROM ' . FORUMS_TABLE . ' ORDER BY left_id ASC'; $result = $db->sql_query($sql, 600); @@ -1364,15 +1364,15 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sql = 'DELETE FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_id_ary); $db->sql_query($sql); - + break; } - + $db->sql_transaction('commit'); break; case 'topic_approved': - + $db->sql_transaction('begin'); switch ($db->sql_layer) { @@ -1409,15 +1409,15 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_query($sql); break; } - + $db->sql_transaction('commit'); break; case 'post_reported': $post_ids = $post_reported = array(); - + $db->sql_transaction('begin'); - + $sql = 'SELECT p.post_id, p.post_reported FROM ' . POSTS_TABLE . " p $where_sql @@ -1468,7 +1468,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, WHERE ' . $db->sql_in_set('post_id', $post_ids); $db->sql_query($sql); } - + $db->sql_transaction('commit'); break; @@ -1481,7 +1481,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $topic_ids = $topic_reported = array(); $db->sql_transaction('begin'); - + $sql = 'SELECT DISTINCT(t.topic_id) FROM ' . POSTS_TABLE . " t $where_sql_and t.post_reported = 1"; @@ -1514,7 +1514,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, WHERE ' . $db->sql_in_set('topic_id', $topic_ids); $db->sql_query($sql); } - + $db->sql_transaction('commit'); break; @@ -1522,7 +1522,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $post_ids = $post_attachment = array(); $db->sql_transaction('begin'); - + $sql = 'SELECT p.post_id, p.post_attachment FROM ' . POSTS_TABLE . " p $where_sql @@ -1573,7 +1573,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, WHERE ' . $db->sql_in_set('post_id', $post_ids); $db->sql_query($sql); } - + $db->sql_transaction('commit'); break; @@ -1619,15 +1619,15 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, WHERE ' . $db->sql_in_set('topic_id', $topic_ids); $db->sql_query($sql); } - + $db->sql_transaction('commit'); - + break; case 'forum': $db->sql_transaction('begin'); - + // 1: Get the list of all forums $sql = 'SELECT f.* FROM ' . FORUMS_TABLE . " f @@ -1828,7 +1828,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_query($sql); } } - + $db->sql_transaction('commit'); break; @@ -1836,7 +1836,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $topic_data = $post_ids = $approved_unapproved_ids = $resync_forums = $delete_topics = $delete_posts = $moved_topics = array(); $db->sql_transaction('begin'); - + $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_approved, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_replies, t.topic_replies_real, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time FROM ' . TOPICS_TABLE . " t $where_sql"; @@ -2160,7 +2160,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, unset($topic_data); $db->sql_transaction('commit'); - + // if some topics have been resync'ed then resync parent forums // except when we're only syncing a range, we don't want to sync forums during // batch processing. diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 8252cd4968..e77a170240 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -707,6 +707,9 @@ function database_update_info() PROFILE_FIELDS_TABLE => array( 'field_show_on_vt' => array('BOOL', 0), ), + FORUMS_TABLE => array( + 'forum_options' => array('UINT:20', 0), + ), ), 'change_columns' => array( USERS_TABLE => array( @@ -1086,10 +1089,7 @@ function change_database_data(&$no_updates, $version) set_config('feed_forum', '1'); set_config('feed_topic', '1'); - set_config('feed_news_id', ''); - set_config('feed_item_statistics', '1'); - set_config('feed_exclude_id', ''); // Entries for smiley pagination set_config('smilies_per_page', '50'); diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 1e8b850645..f3defe9a54 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -363,6 +363,7 @@ CREATE TABLE phpbb_forums ( forum_last_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, forum_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, forum_flags INTEGER DEFAULT 32 NOT NULL, + forum_options INTEGER DEFAULT 0 NOT NULL, display_subforum_list INTEGER DEFAULT 1 NOT NULL, display_on_index INTEGER DEFAULT 1 NOT NULL, enable_indexing INTEGER DEFAULT 1 NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 3c96299571..ac7c0928cd 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -439,6 +439,7 @@ CREATE TABLE [phpbb_forums] ( [forum_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , [forum_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , [forum_flags] [int] DEFAULT (32) NOT NULL , + [forum_options] [int] DEFAULT (0) NOT NULL , [display_subforum_list] [int] DEFAULT (1) NOT NULL , [display_on_index] [int] DEFAULT (1) NOT NULL , [enable_indexing] [int] DEFAULT (1) NOT NULL , diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 9a090f0936..4fcead787b 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -249,6 +249,7 @@ CREATE TABLE phpbb_forums ( forum_last_poster_name blob NOT NULL, forum_last_poster_colour varbinary(6) DEFAULT '' NOT NULL, forum_flags tinyint(4) DEFAULT '32' NOT NULL, + forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL, display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 1c0225b92c..34adf5674e 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -249,6 +249,7 @@ CREATE TABLE phpbb_forums ( forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, forum_flags tinyint(4) DEFAULT '32' NOT NULL, + forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL, display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index c802bcedff..15692ea984 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -505,6 +505,7 @@ CREATE TABLE phpbb_forums ( forum_last_poster_name varchar2(765) DEFAULT '' , forum_last_poster_colour varchar2(6) DEFAULT '' , forum_flags number(4) DEFAULT '32' NOT NULL, + forum_options number(20) DEFAULT '0' NOT NULL, display_subforum_list number(1) DEFAULT '1' NOT NULL, display_on_index number(1) DEFAULT '1' NOT NULL, enable_indexing number(1) DEFAULT '1' NOT NULL, diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index aeb3265b81..46e77e64b4 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -382,6 +382,7 @@ CREATE TABLE phpbb_forums ( forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, forum_flags INT2 DEFAULT '32' NOT NULL, + forum_options INT4 DEFAULT '0' NOT NULL CHECK (forum_options >= 0), display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0), display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0), enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0), diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 3545fa9bc2..30acb90618 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -105,9 +105,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_topic INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_topics_limit', '15'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_forum', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_topic', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_news_id', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_item_statistics', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_exclude_id', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval', '15'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('force_server_vars', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('form_token_lifetime', '7200'); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index e201f8de64..d754219cdf 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -242,6 +242,7 @@ CREATE TABLE phpbb_forums ( forum_last_poster_name varchar(255) NOT NULL DEFAULT '', forum_last_poster_colour varchar(6) NOT NULL DEFAULT '', forum_flags tinyint(4) NOT NULL DEFAULT '32', + forum_options INTEGER UNSIGNED NOT NULL DEFAULT '0', display_subforum_list INTEGER UNSIGNED NOT NULL DEFAULT '1', display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1', enable_indexing INTEGER UNSIGNED NOT NULL DEFAULT '1', diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 23c3961aaa..9d4162591a 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -20,8 +20,8 @@ - - + +

      {L_CAPTCHA_CONFIGURE_EXPLAIN}
      + diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index c3588ceb9e..6e86f412fb 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -67,7 +67,6 @@ class acp_captcha if ($submit && check_form_key($form_key)) { - $config_vars = array_keys($config_vars); foreach ($config_vars as $config_var => $options) { set_config($config_var, request_var($config_var, $options['default'])); @@ -122,6 +121,7 @@ class acp_captcha $template->assign_vars(array( 'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id), + 'S_CAPTCHA_HAS_CONFIG' => $demo_captcha->has_config(), 'CAPTCHA_SELECT' => $captcha_select, )); } diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index 72f343d6b8..08ca0a91e4 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -362,6 +362,14 @@ class phpbb_default_captcha return (bool) $this->solved; } + /** + * API function + */ + function has_config() + { + return false; + } + } ?> \ No newline at end of file diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php index ab71da10d7..863d31a45d 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php @@ -73,6 +73,14 @@ class phpbb_captcha_gd extends phpbb_default_captcha return can_load_dll('gd'); } + /** + * API function + */ + function has_config() + { + return true; + } + function get_name() { return 'CAPTCHA_GD'; diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index cdbb7ea864..84730a738c 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -17,9 +17,9 @@ if (!defined('IN_PHPBB')) } global $table_prefix; -define('QUESTIONS_TABLE', $table_prefix . 'captcha_questions'); -define('ANSWERS_TABLE', $table_prefix . 'captcha_answers'); -define('QA_CONFIRM_TABLE', $table_prefix . 'qa_confirm'); +define('CAPTCHA_QUESTIONS_TABLE', $table_prefix . 'captcha_questions'); +define('CAPTCHA_ANSWERS_TABLE', $table_prefix . 'captcha_answers'); +define('CAPTCHA_QA_CONFIRM_TABLE', $table_prefix . 'qa_confirm'); @@ -59,7 +59,7 @@ class phpbb_captcha_qa $this->question_lang = $user->data['user_lang']; // we need all defined questions - shouldn't be too many, so we can just grab them // try the user's lang first - $sql = 'SELECT question_id FROM ' . QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($user->data['user_lang']) . '\''; + $sql = 'SELECT question_id FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($user->data['user_lang']) . '\''; $result = $db->sql_query($sql, 3600); while ($row = $db->sql_fetchrow($result)) { @@ -70,7 +70,7 @@ class phpbb_captcha_qa if (!sizeof($this->question_ids)) { $this->question_lang = $config['default_lang']; - $sql = 'SELECT question_id FROM ' . QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($config['default_lang']) . '\''; + $sql = 'SELECT question_id FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($config['default_lang']) . '\''; $result = $db->sql_query($sql, 7200); while ($row = $db->sql_fetchrow($result)) { @@ -108,7 +108,7 @@ class phpbb_captcha_qa include("$phpbb_root_path/includes/db/db_tools.$phpEx"); } $db_tool = new phpbb_db_tools($db); - return $db_tool->sql_table_exists(QUESTIONS_TABLE); + return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE); } /** @@ -125,13 +125,23 @@ class phpbb_captcha_qa { return false; } - $sql = 'SELECT COUNT(question_id) as count FROM ' . QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($config['default_lang']) . '\''; + $sql = 'SELECT COUNT(question_id) as count FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($config['default_lang']) . '\''; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); return ((bool) $row['count']); } + + /** + * API function + */ + function has_config() + { + return true; + } + + /** * API function */ @@ -219,7 +229,7 @@ class phpbb_captcha_qa global $db, $config; $sql = 'SELECT DISTINCT c.session_id - FROM ' . QA_CONFIRM_TABLE . ' c + FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' c LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) WHERE s.session_id IS NULL' . ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); @@ -236,7 +246,7 @@ class phpbb_captcha_qa if (sizeof($sql_in)) { - $sql = 'DELETE FROM ' . QA_CONFIRM_TABLE . ' + $sql = 'DELETE FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' WHERE ' . $db->sql_in_set('session_id', $sql_in); $db->sql_query($sql); } @@ -264,10 +274,10 @@ class phpbb_captcha_qa include("$phpbb_root_path/includes/db/db_tools.$phpEx"); } $db_tool = new phpbb_db_tools($db); - $tables = array(QUESTIONS_TABLE, ANSWERS_TABLE, QA_CONFIRM_TABLE); + $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE); $schemas = array( - QUESTIONS_TABLE => array ( + CAPTCHA_QUESTIONS_TABLE => array ( 'COLUMNS' => array( 'question_id' => array('UINT', Null, 'auto_increment'), 'strict' => array('BOOL', 0), @@ -280,7 +290,7 @@ class phpbb_captcha_qa 'lang_iso' => array('INDEX', 'lang_iso'), ), ), - ANSWERS_TABLE => array ( + CAPTCHA_ANSWERS_TABLE => array ( 'COLUMNS' => array( 'question_id' => array('UINT', 0), 'answer_text' => array('STEXT_UNI', ''), @@ -289,7 +299,7 @@ class phpbb_captcha_qa 'question_id' => array('INDEX', 'question_id'), ), ), - QA_CONFIRM_TABLE => array ( + CAPTCHA_QA_CONFIRM_TABLE => array ( 'COLUMNS' => array( 'session_id' => array('CHAR:32', ''), 'confirm_id' => array('CHAR:32', ''), @@ -363,7 +373,7 @@ class phpbb_captcha_qa $this->confirm_id = md5(unique_id($user->ip)); $this->question = (int) array_rand($this->question_ids); - $sql = 'INSERT INTO ' . QA_CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( + $sql = 'INSERT INTO ' . CAPTCHA_QA_CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( 'confirm_id' => (string) $this->confirm_id, 'session_id' => (string) $user->session_id, 'lang_iso' => (string) $this->question_lang, @@ -386,7 +396,7 @@ class phpbb_captcha_qa $this->solved = 0; // compute $seed % 0x7fffffff - $sql = 'UPDATE ' . QA_CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( 'question' => (int) $this->question,)) . ' WHERE confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' @@ -407,7 +417,7 @@ class phpbb_captcha_qa $this->solved = 0; // compute $seed % 0x7fffffff - $sql = 'UPDATE ' . QA_CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( 'question_id' => (int) $this->question)) . ', attempts = attempts + 1 WHERE @@ -425,7 +435,7 @@ class phpbb_captcha_qa global $db, $user; $sql = 'SELECT con.question_id, attempts, question_text, strict - FROM ' . QA_CONFIRM_TABLE . ' con, ' . QUESTIONS_TABLE . " qes + FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' con, ' . CAPTCHA_QUESTIONS_TABLE . " qes WHERE con.question_id = qes.question_id AND confirm_id = '" . $db->sql_escape($this->confirm_id) . "' AND session_id = '" . $db->sql_escape($user->session_id) . "' @@ -457,7 +467,7 @@ class phpbb_captcha_qa $answer = ($this->question_strict) ? request_var('qa_answer', '', true) : utf8_clean_string(request_var('qa_answer', '', true)); $sql = 'SELECT answer_text - FROM ' . ANSWERS_TABLE . ' + FROM ' . CAPTCHA_ANSWERS_TABLE . ' WHERE question_id = ' . (int) $this->question; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -480,7 +490,7 @@ class phpbb_captcha_qa { global $db, $user; - $sql = 'DELETE FROM ' . QA_CONFIRM_TABLE . " + $sql = 'DELETE FROM ' . CAPTCHA_QA_CONFIRM_TABLE . " WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' AND session_id = '" . $db->sql_escape($user->session_id) . "' AND confirm_type = " . $this->type; @@ -502,7 +512,7 @@ class phpbb_captcha_qa { global $db, $user; - $sql = 'DELETE FROM ' . QA_CONFIRM_TABLE . " + $sql = 'DELETE FROM ' . CAPTCHA_QA_CONFIRM_TABLE . " WHERE session_id = '" . $db->sql_escape($user->session_id) . "' AND confirm_type = " . (int) $this->type; $db->sql_query($sql); @@ -666,7 +676,7 @@ class phpbb_captcha_qa { global $db, $template; - $sql = 'SELECT * FROM ' . QUESTIONS_TABLE . ' WHERE 1'; + $sql = 'SELECT * FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE 1'; $result = $db->sql_query($sql); $template->assign_vars(array( 'S_LIST' => true, @@ -697,7 +707,7 @@ class phpbb_captcha_qa if ($question_id) { - $sql = 'SELECT * FROM ' . QUESTIONS_TABLE . ' WHERE question_id = ' . $question_id; + $sql = 'SELECT * FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE question_id = ' . $question_id; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) { @@ -709,7 +719,7 @@ class phpbb_captcha_qa return false; } $question['answers'] = array(); - $sql = 'SELECT * FROM ' . ANSWERS_TABLE . ' WHERE question_id = ' . $question_id; + $sql = 'SELECT * FROM ' . CAPTCHA_ANSWERS_TABLE . ' WHERE question_id = ' . $question_id; $result = $db->sql_query($sql); while($row = $db->sql_fetchrow($result)) { @@ -748,13 +758,13 @@ class phpbb_captcha_qa global $db; // easier to delete all answers than to figure out which to update - $sql = "DELETE FROM " . ANSWERS_TABLE . " WHERE question_id = $question_id"; + $sql = "DELETE FROM " . CAPTCHA_ANSWERS_TABLE . " WHERE question_id = $question_id"; $db->sql_query($sql); $langs = $this->get_languages(); $question_ary = $data; $question_ary['lang_id'] = $langs[$question_ary['lang_iso']]['id']; unset($question_ary['answers']); - $sql = "UPDATE " . QUESTIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $question_ary) . " + $sql = "UPDATE " . CAPTCHA_QUESTIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $question_ary) . " WHERE question_id = $question_id"; $db->sql_query($sql); $this->acp_insert_answers($data, $question_id); @@ -773,7 +783,7 @@ class phpbb_captcha_qa $question_ary['lang_id'] = $langs[$data['lang_iso']]['id']; unset($question_ary['answers']); - $sql = "INSERT INTO " . QUESTIONS_TABLE . $db->sql_build_array('INSERT', $question_ary); + $sql = "INSERT INTO " . CAPTCHA_QUESTIONS_TABLE . $db->sql_build_array('INSERT', $question_ary); $db->sql_query($sql); $question_id = $db->sql_nextid(); $this->acp_insert_answers($data, $question_id); @@ -793,7 +803,7 @@ class phpbb_captcha_qa 'question_id' => $question_id, 'answer_text' => $answer, ); - $sql = "INSERT INTO " . ANSWERS_TABLE . $db->sql_build_array('INSERT', $answer_ary); + $sql = "INSERT INTO " . CAPTCHA_ANSWERS_TABLE . $db->sql_build_array('INSERT', $answer_ary); $db->sql_query($sql); } } @@ -806,7 +816,7 @@ class phpbb_captcha_qa { global $db; - $tables = array(QUESTIONS_TABLE, ANSWERS_TABLE); + $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE); foreach($tables as $table) { $sql = "DELETE FROM $table WHERE question_id = $question_id"; diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index b7b3ab07d3..3634869a06 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -54,6 +54,14 @@ class phpbb_recaptcha extends phpbb_default_captcha $user->add_lang('captcha_recaptcha'); return (isset($config['recaptcha_pubkey']) && !empty($config['recaptcha_pubkey'])); } + + /** + * API function + */ + function has_config() + { + return true; + } function get_name() { From 7c6229784bd2f451f3addcac211507289fa5b712 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 14 Aug 2009 10:11:34 +0000 Subject: [PATCH 443/607] add back links git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9976 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/captcha_gd_acp.html | 1 + phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php | 1 + phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php | 1 + 3 files changed, 3 insertions(+) diff --git a/phpBB/adm/style/captcha_gd_acp.html b/phpBB/adm/style/captcha_gd_acp.html index d1f50bc899..be715401db 100644 --- a/phpBB/adm/style/captcha_gd_acp.html +++ b/phpBB/adm/style/captcha_gd_acp.html @@ -1,6 +1,7 @@ + « {L_BACK}

      {L_ACP_VC_SETTINGS}

      diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php index 863d31a45d..a85566deff 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php @@ -140,6 +140,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha $template->assign_vars(array( 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), 'CAPTCHA_NAME' => $this->get_class_name(), + 'U_ACTION' => $module->u_action, )); } } diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index 3634869a06..bd965fb10e 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -117,6 +117,7 @@ class phpbb_recaptcha extends phpbb_default_captcha $template->assign_vars(array( 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), 'CAPTCHA_NAME' => $this->get_class_name(), + 'U_ACTION' => $module->u_action, )); } From 412bb22acbe3c5cbb0d86d941f98bb8cae909f56 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 14 Aug 2009 10:19:37 +0000 Subject: [PATCH 444/607] fix #49685 introduced in r9896 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9977 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_forums.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 7977654c0a..b2e04083fe 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -189,6 +189,7 @@ class acp_forums if (!sizeof($errors)) { $forum_perm_from = request_var('forum_perm_from', 0); + $cache->destroy('sql', FORUMS_TABLE); // Copy permissions? if (!empty($forum_perm_from) && $forum_perm_from != $forum_data['forum_id'] && @@ -205,7 +206,6 @@ class acp_forums $auth->acl_clear_prefetch(); - $cache->destroy('sql', FORUMS_TABLE); $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; From 1683559e19c42effff71d21e2210a5a876241c64 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 14 Aug 2009 10:43:31 +0000 Subject: [PATCH 445/607] More r9896 cleanup. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9978 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_forums.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index b2e04083fe..5f56bfb84d 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -74,9 +74,9 @@ class acp_forums { trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } - + case 'copy_perm': - + if (!(($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')))) { trigger_error($user->lang['NO_PERMISSION_COPY'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); @@ -204,7 +204,6 @@ class acp_forums return; } - $auth->acl_clear_prefetch(); $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; @@ -722,14 +721,10 @@ class acp_forums $message .= '

      ' . sprintf($user->lang['REDIRECT_ACL'], '', ''); } - // redirect directly to permission settings screen if authed - if ($action == 'add' && !$forum_perm_from && $auth->acl_get('a_fauth')) - { - meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url)); - } - trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); } + + break; } // Default management page @@ -1919,7 +1914,10 @@ class acp_forums adm_page_footer(); } - + + /** + * Display copy permission page + */ function copy_permission_page($forum_data) { global $phpEx, $phpbb_admin_path, $template, $user; @@ -1927,11 +1925,8 @@ class acp_forums $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; $action = append_sid($this->u_action . "&parent_id={$this->parent_id}&f={$forum_data['forum_id']}&action=copy_perm"); - $l_acl = sprintf($user->lang['COPY_TO_ACL'], '', ''); - - $this->tpl_name = 'acp_forums_copy_perm'; $template->assign_vars(array( From a6bf9b4e4aa71da9e0c01e892281d55d661db341 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 14 Aug 2009 11:15:44 +0000 Subject: [PATCH 446/607] Some things I missed in r9887. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9979 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_admin.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 1931ae3dfa..2f8670a147 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -338,12 +338,13 @@ function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perm return false; } - // Check if source forums exists + // Check if source forum exists $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . $src_forum_id; $result = $db->sql_query($sql); $src_forum_name = $db->sql_fetchfield('forum_name'); + $db->sql_freeresult($result); // Source forum doesn't exist if (empty($src_forum_name)) @@ -357,6 +358,7 @@ function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perm WHERE ' . $db->sql_in_set('forum_id', $dest_forum_ids); $result = $db->sql_query($sql); + $dest_forum_ids = $dest_forum_names = array(); while ($row = $db->sql_fetchrow($result)) { $dest_forum_ids[] = (int) $row['forum_id']; From f4557ed74c1ad5d268d450dd187d0b61a6952f60 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 14 Aug 2009 14:14:28 +0000 Subject: [PATCH 447/607] the form actually is no longer required - in tests we had a form to submit the reply/reply to all, but this only worked with JS, so i decided to use a link. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9980 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../styles/prosilver/template/ucp_pm_message_header.html | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/phpBB/styles/prosilver/template/ucp_pm_message_header.html b/phpBB/styles/prosilver/template/ucp_pm_message_header.html index ee56d61808..fcebab0868 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_message_header.html +++ b/phpBB/styles/prosilver/template/ucp_pm_message_header.html @@ -5,9 +5,7 @@

      {FOLDER_STATUS}

      - - - +
      @@ -18,10 +16,7 @@ - - - - +
  • {L_BOARD_VERSION}: - style="color: #228822"style="color: #BC2A4D" title="{L_MORE_INFORMATION}" href="{U_VERSIONCHECK}">{BOARD_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] + style="color: #228822;"style="color: #BC2A4D;" title="{L_MORE_INFORMATION}">{BOARD_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] {L_NUMBER_ORPHAN}:
    {L_ACP_NO_ITEMS}
    - +
    diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index a408b54185..0d68a02758 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -5,7 +5,7 @@
    - - + diff --git a/phpBB/styles/subsilver2/template/captcha_default.html b/phpBB/styles/subsilver2/template/captcha_default.html index 61fc4ad68c..76d0edbec4 100644 --- a/phpBB/styles/subsilver2/template/captcha_default.html +++ b/phpBB/styles/subsilver2/template/captcha_default.html @@ -9,7 +9,8 @@
    {L_CONFIRM_CODE}:
    {L_CONFIRM_CODE_EXPLAIN}
    {L_CONFIRM_CODE}:
    {L_CONFIRM_CODE_EXPLAIN} +
    {QA_CONFIRM_QUESTION}
    {QA_CONFIRM_QUESTION}:
    {QA_CONFIRM_QUESTION}:
    {L_CONFIRM_CODE}
    {L_CONFIRM_CODE}:
    {L_RECAPTCHA_EXPLAIN} -
    - +
    {L_CONFIRM_CODE}:
    {L_RECAPTCHA_EXPLAIN}
    + + + +
    {L_CONFIRM_CODE}:
    {L_CONFIRM_CODE_EXPLAIN} -
    {L_CONFIRM_CODE}:
    {L_CONFIRM_CODE_EXPLAIN}
    [ {L_ADD_FRIEND} | {L_ADD_FOE}{L_REMOVE_FRIEND}{L_REMOVE_FOE} ][ + + {L_REMOVE_FRIEND} + + {L_REMOVE_FOE} + + {L_ADD_FRIEND} | {L_ADD_FOE} + + ]
    From 52e9f4d13e5cae7cfac72e515d5a28a8ad0ec0c3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 30 Aug 2009 12:05:38 +0000 Subject: [PATCH 533/607] fix r10065 for #50475 Authorised by: bantu git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10066 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/styles/prosilver/template/memberlist_view.html | 4 ++-- phpBB/styles/subsilver2/template/memberlist_view.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index fd0c1364db..d971af70ee 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -200,7 +200,7 @@
  • [Fix] Correctly orientate Control-Panel-Navigation background-image on RTL languages. (Bug #49945)
  • [Fix] Sort private messages by message time and not message id. (Bug #50015)
  • [Fix] Make sure only logs for existing users are displayed and user-specific logs removed on user deletion. (Bug #49855)
  • -
  • [Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)
  • +
  • [Fix] Only show "Add friend" and "Add foe" links if the specific module is enabled. (Bug #50475)
  • [Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index 2458fddfb3..734afa6963 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -39,10 +39,10 @@
     
    {L_REMOVE_FOE}
    - +
     
    {L_ADD_FRIEND}
    - +
     
    {L_ADD_FOE}
    diff --git a/phpBB/styles/subsilver2/template/memberlist_view.html b/phpBB/styles/subsilver2/template/memberlist_view.html index a8f2962c24..6d9ebc1802 100644 --- a/phpBB/styles/subsilver2/template/memberlist_view.html +++ b/phpBB/styles/subsilver2/template/memberlist_view.html @@ -57,7 +57,7 @@ {L_REMOVE_FOE} - {L_ADD_FRIEND} | {L_ADD_FOE} + {L_ADD_FRIEND} | {L_ADD_FOE} ]
    {L_USERNAME} {L_JOINED} {L_INACTIVE_DATE}{L_INACTIVE_REASON} {L_LAST_VISIT}{L_INACTIVE_REASON}
    {inactive.USERNAME}{inactive.JOINED}{inactive.INACTIVE_DATE}{inactive.REASON}{inactive.LAST_VISIT} + {inactive.USERNAME_FULL} +
    {L_POSTS}: {inactive.POSTS} [{L_SEARCH_USER_POSTS}] +
    {inactive.JOINED}{inactive.INACTIVE_DATE}{inactive.LAST_VISIT} + {inactive.REASON} +
    {inactive.REMINDED_EXPLAIN}
    {L_TOTAL_POSTS}: {POSTS}
    [{POSTS_PCT} / {POSTS_DAY}]
    [{L_POSTS_IN_QUEUE}]
    [{L_POSTS_IN_QUEUE}] -
    {L_SEARCH_USER_POSTS}
    {questions.QUESTION_TEXT} {questions.QUESTION_LANG}{ICON_EDIT}{ICON_DELETE}{ICON_EDIT} {ICON_DELETE}
    {L_TOTAL_POSTS}: {POSTS}
    [{POSTS_PCT} / {POSTS_DAY}]
    {L_SEARCH_YOUR_POSTS}
    {POSTS}
    {POSTS}
    [{POSTS_PCT} / {POSTS_DAY}]
    {L_SEARCH_YOUR_POSTS}
    {POSTS}
    {memberrow.RANK_IMG}{memberrow.RANK_TITLE} {memberrow.USERNAME_FULL}
    {L_SELECT} ]
    {memberrow.POSTS}{memberrow.POSTS}{memberrow.POSTS}{memberrow.POSTS}
    {memberrow.LOCATION}
     
    {memberrow.JOINED} {memberrow.VISITED} {L_PM}{L_POST_DETAILS}
    {RETURN_QUEUE} | {RETURN_TOPIC_SIMPLE} | {RETURN_POST}{RETURN_REPORTS} | {L_VIEW_PM}{L_VIEW_POST} | {L_VIEW_TOPIC} | {L_VIEW_FORUM}{RETURN_TOPIC}{RETURN_QUEUE} | {RETURN_TOPIC_SIMPLE} | {RETURN_POST}{RETURN_REPORTS} | {L_VIEW_POST} | {L_VIEW_TOPIC} | {L_VIEW_FORUM}{RETURN_TOPIC}
    {L_PM_SUBJECT}{L_POST_SUBJECT}: {forumrow.FORUM_FOLDER_IMG} -
    {forumrow.FORUM_IMAGE}
    +
    {forumrow.FORUM_IMAGE}
    {forumrow.FORUM_NAME}

    {forumrow.FORUM_DESC}

    -
    {L_REDIRECTS}: {forumrow.CLICKS}{forumrow.FORUM_FOLDER_IMG} -
    {forumrow.FORUM_IMAGE}
    +
    {forumrow.FORUM_IMAGE}
    {forumrow.FORUM_NAME}

    {forumrow.FORUM_DESC}

    @@ -52,7 +51,6 @@

    {forumrow.L_SUBFORUM_STR} {forumrow.SUBFORUMS}

    -

    {forumrow.TOPICS}

    {forumrow.POSTS}