diff options
32 files changed, 336 insertions, 130 deletions
diff --git a/phpBB/adm/style/acp_ranks.html b/phpBB/adm/style/acp_ranks.html index dd2d07a837..fa06513b98 100644 --- a/phpBB/adm/style/acp_ranks.html +++ b/phpBB/adm/style/acp_ranks.html @@ -24,6 +24,9 @@ <fieldset> <legend>{L_ACP_RANKS}</legend> + + <!-- EVENT acp_ranks_edit_before --> + <dl> <dt><label for="title">{L_RANK_TITLE}{L_COLON}</label></dt> <dd><input name="title" type="text" id="title" value="{RANK_TITLE}" maxlength="255" /></dd> @@ -38,13 +41,15 @@ <dd><label><input onclick="phpbb.toggleDisplay('posts', -1)" type="radio" class="radio" name="special_rank" value="1" id="special_rank"<!-- IF S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_YES}</label> <label><input onclick="phpbb.toggleDisplay('posts', 1)" type="radio" class="radio" name="special_rank" value="0"<!-- IF not S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd> </dl> - <!-- IF S_SPECIAL_RANK --><div id="posts" style="display: none;"><!-- ELSE --><div id="posts"><!-- ENDIF --> + <div id="posts"<!-- IF S_SPECIAL_RANK --> style="display: none;"<!-- ENDIF -->> <dl> <dt><label for="min_posts">{L_RANK_MINIMUM}{L_COLON}</label></dt> <dd><input name="min_posts" type="number" id="min_posts" maxlength="10" value="{MIN_POSTS}" /></dd> </dl> </div> + <!-- EVENT acp_ranks_edit_after --> + <p class="submit-buttons"> <input type="hidden" name="action" value="save" /> @@ -68,18 +73,22 @@ <table class="table1 zebra-table"> <thead> <tr> + <!-- EVENT acp_ranks_list_header_before --> <th>{L_RANK_IMAGE}</th> <th>{L_RANK_TITLE}</th> <th>{L_RANK_MINIMUM}</th> + <!-- EVENT acp_ranks_list_header_after --> <th>{L_ACTION}</th> </tr> </thead> <tbody> <!-- BEGIN ranks --> <tr> + <!-- EVENT acp_ranks_list_column_before --> <td style="text-align: center;"><!-- IF ranks.S_RANK_IMAGE --><img src="{ranks.RANK_IMAGE}" alt="{ranks.RANK_TITLE}" title="{ranks.RANK_TITLE}" /><!-- ELSE --> - <!-- ENDIF --></td> <td style="text-align: center;">{ranks.RANK_TITLE}</td> <td style="text-align: center;"><!-- IF ranks.S_SPECIAL_RANK --> - <!-- ELSE -->{ranks.MIN_POSTS}<!-- ENDIF --></td> + <!-- EVENT acp_ranks_list_column_after --> <td style="text-align: center;"><a href="{ranks.U_EDIT}">{ICON_EDIT}</a> <a href="{ranks.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a></td> </tr> <!-- END ranks --> diff --git a/phpBB/composer.json b/phpBB/composer.json index 9b473a3bb7..0ab30b0837 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -1,9 +1,31 @@ { - "_readme": [ - "You MUST update the clean-vendor-dir target in build/build.xml", - "accordingly when adding or upgrading dependencies." + "name": "phpbb/phpbb", + "description": "phpBB Forum Software application", + "type": "project", + "keywords": ["phpbb", "forum"], + "homepage": "https://www.phpbb.com", + "license": "GPL-2.0", + "authors": [ + { + "name": "phpBB Limited", + "email": "operations@phpbb.com", + "homepage": "https://www.phpbb.com/go/authors" + } ], + "support": { + "issues": "https://tracker.phpbb.com", + "forum": "https://www.phpbb.com/community/", + "wiki": "https://wiki.phpbb.com", + "irc": "irc://irc.freenode.org/phpbb" + }, + "scripts": { + "post-update-cmd": "echo 'You MUST manually modify the clean-vendor-dir target in build/build.xml when adding or upgrading dependencies.'" + }, + "replace": { + "phpbb/phpbb-core": "self.version" + }, "require": { + "php": ">=5.3.3", "lusitanian/oauth": "0.2.*", "symfony/config": "2.3.*", "symfony/console": "2.3.*", diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 751cd0695f..3860a98b31 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "dcd46c1373cfc4dacd2e1f8a79da0b91", + "hash": "6bc742a2b9feb426db9987d27085f915", "packages": [ { "name": "lusitanian/oauth", @@ -255,14 +255,12 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Debug Component", @@ -2430,17 +2428,11 @@ "time": "2014-05-17 21:49:26" } ], - "aliases": [ - - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": [ - - ], - "platform": [ - - ], - "platform-dev": [ - - ] + "stability-flags": [], + "platform": { + "php": ">=5.3.3" + }, + "platform-dev": [] } diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index b4e387bd73..a9f9f5ed19 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -79,6 +79,7 @@ services: class: phpbb\content_visibility arguments: - @auth + - @config - @dbal.conn - @user - %core.root_path% diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index a46cea47b1..e3e12a3176 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -61,6 +61,7 @@ <li><a href="#update_all">All package types</a></li> </ol> </li> + <li><a href="#update30">Updating from phpBB 3.0.x to phpBB 3.1.x</a></li> <li><a href="#convert">Conversion from phpBB 2.0.x to phpBB 3.1.x</a> <ol style="list-style-type: lower-roman;"> <li><a href="#prereq">Requirements before converting</a></li> @@ -324,7 +325,41 @@ <hr /> - <a name="convert"></a><h2>5. Conversion from phpBB 2.0.x to phpBB 3.1.x</h2> + <a name="update30"></a><h2>5. Updating from phpBB 3.0.x to phpBB 3.1.x</h2> + + <div class="paragraph"> + <div class="inner"><span class="corners-top"><span></span></span> + + <div class="content"> + + <p>Updating from phpBB 3.0.x to 3.1.x is just the same as <a href="#update">updating from stable releases of phpBB 3.1.x</a></p> + + <p>However you can also start with a new set of phpBB 3.1.x files.</p> + + <ol> + <li>Delete all files <strong>EXCEPT</strong> for the following: + + <ul> + <li>The <code>config.php</code> file</li> + <li>The <code>images/</code> directory</li> + <li>The <code>files/</code> directory</li> + <li>The <code>store/</code> directory</li> + </ul></li> + + <li>Upload the contents of the 3.1.x Full Package into your forum's directory.</li> + <li>Browse to install/database_update.php</li> + <li>Delete the <code>install/</code> directory</li> + </ol> + </div> + + <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> + + <span class="corners-bottom"><span></span></span></div> + </div> + + <hr /> + + <a name="convert"></a><h2>6. Conversion from phpBB 2.0.x to phpBB 3.1.x</h2> <div class="paragraph"> <div class="inner"><span class="corners-top"><span></span></span> @@ -387,7 +422,7 @@ <hr /> - <a name="postinstall"></a><h2>6. Important (security related) post-Install tasks for all installation methods</h2> + <a name="postinstall"></a><h2>7. Important (security related) post-Install tasks for all installation methods</h2> <div class="paragraph"> <div class="inner"><span class="corners-top"><span></span></span> @@ -425,7 +460,7 @@ <hr /> -<a name="anti_spam"></a><h2>7. Anti-Spam Measures</h2> +<a name="anti_spam"></a><h2>8. Anti-Spam Measures</h2> <div class="paragraph"> <div class="inner"><span class="corners-top"><span></span></span> @@ -441,7 +476,7 @@ <hr /> -<a name="disclaimer"></a><h2>8. Copyright and disclaimer</h2> +<a name="disclaimer"></a><h2>9. Copyright and disclaimer</h2> <div class="paragraph"> <div class="inner"><span class="corners-top"><span></span></span> diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index c537504d54..044596073c 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -85,6 +85,50 @@ acp_posting_buttons_before * Since: 3.1.0-b4 * Purpose: Add content before BBCode posting buttons in the ACP +acp_ranks_edit_after +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content after the rank details when editing a rank in the ACP + +acp_ranks_edit_before +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content before the rank details when editing a rank in the ACP + +acp_ranks_list_column_after +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content before the first column in the ranks list in the ACP + +acp_ranks_list_column_before +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content after the last column (but before the action column) +in the ranks list in the ACP + +acp_ranks_list_header_after +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content before the first header-column in the ranks list in the ACP + +acp_ranks_list_header_before +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content after the last header-column (but before the action column) +in the ranks list in the ACP + acp_simple_footer_after === * Location: adm/style/simple_footer.html diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 1811748c2f..f2707f15ca 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -925,7 +925,7 @@ class acp_board { $user->timezone = new DateTimeZone($config['board_timezone']); } - catch (Exception $e) + catch (\Exception $e) { // If the board timezone is invalid, we just use the users timezone. } diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index fdbd0e0a1d..5885de57ec 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -25,7 +25,7 @@ class acp_ranks function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $request; + global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; $user->add_lang('acp/posting'); @@ -73,6 +73,17 @@ class acp_ranks 'rank_image' => htmlspecialchars_decode($rank_image) ); + /** + * Modify the SQL array when saving a rank + * + * @event core.acp_ranks_save_modify_sql_ary + * @var int rank_id The ID of the rank (if available) + * @var array sql_ary Array with the rank's data + * @since 3.1.0-RC3 + */ + $vars = array('rank_id', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_ranks_save_modify_sql_ary', compact($vars))); + if ($rank_id) { $sql = 'UPDATE ' . RANKS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE rank_id = $rank_id"; @@ -202,7 +213,7 @@ class acp_ranks $filename_list = '<option value=""' . (($edit_img == '') ? ' selected="selected"' : '') . '>----------</option>' . $filename_list; unset($existing_imgs, $imglist); - $template->assign_vars(array( + $tpl_ary = array( 'S_EDIT' => true, 'U_BACK' => $this->u_action, 'RANKS_PATH' => $phpbb_root_path . $config['ranks_path'], @@ -212,9 +223,21 @@ class acp_ranks 'S_FILENAME_LIST' => $filename_list, 'RANK_IMAGE' => ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : htmlspecialchars($phpbb_admin_path) . 'images/spacer.gif', 'S_SPECIAL_RANK' => (isset($ranks['rank_special']) && $ranks['rank_special']) ? true : false, - 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0) + 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0, ); + /** + * Modify the template output array for editing/adding ranks + * + * @event core.acp_ranks_edit_modify_tpl_ary + * @var array ranks Array with the rank's data + * @var array tpl_ary Array with the rank's template data + * @since 3.1.0-RC3 + */ + $vars = array('ranks', 'tpl_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_ranks_edit_modify_tpl_ary', compact($vars))); + + $template->assign_vars($tpl_ary); return; break; @@ -231,7 +254,7 @@ class acp_ranks while ($row = $db->sql_fetchrow($result)) { - $template->assign_block_vars('ranks', array( + $rank_row = array( 'S_RANK_IMAGE' => ($row['rank_image']) ? true : false, 'S_SPECIAL_RANK' => ($row['rank_special']) ? true : false, @@ -240,8 +263,21 @@ class acp_ranks 'MIN_POSTS' => $row['rank_min'], 'U_EDIT' => $this->u_action . '&action=edit&id=' . $row['rank_id'], - 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row['rank_id']) + 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row['rank_id'], ); + + /** + * Modify the template output array for each listed rank + * + * @event core.acp_ranks_list_modify_rank_row + * @var array row Array with the rank's data + * @var array rank_row Array with the rank's template data + * @since 3.1.0-RC3 + */ + $vars = array('row', 'rank_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_ranks_list_modify_rank_row', compact($vars))); + + $template->assign_block_vars('ranks', $rank_row); } $db->sql_freeresult($result); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index d7b1b56532..4318b20b97 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1031,7 +1031,7 @@ function phpbb_get_timezone_identifiers($selected_timezone) $validate_timezone = new DateTimeZone($selected_timezone); $timezones[] = $selected_timezone; } - catch (Exception $e) + catch (\Exception $e) { } } diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 397e6401ff..fe9bcdb9d1 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -489,6 +489,12 @@ class p_master $id = request_var('icat', ''); } + // Restore the backslashes in class names + if (strpos($id, '-') !== false) + { + $id = str_replace('-', '\\', $id); + } + if ($id && !is_numeric($id) && !$this->is_full_class($id)) { $id = $this->p_class . '_' . $id; @@ -616,7 +622,7 @@ class p_master } // Not being able to overwrite ;) - $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name, $this->p_id)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; } else { @@ -648,7 +654,7 @@ class p_master $this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; } - $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name, $this->p_id)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; } // Add url_extra parameter to u_action url @@ -901,7 +907,7 @@ class p_master else { // if the category has a name, then use it. - $u_title .= $this->get_module_identifier($item_ary['name'], $item_ary['id']); + $u_title .= $this->get_module_identifier($item_ary['name']); } // If the item is not a category append the mode if (!$item_ary['cat']) @@ -1106,26 +1112,24 @@ class p_master } /** - * If the basename contains a \ we dont use that for the URL. + * If the basename contains a \ we don't use that for the URL. * * Firefox is currently unable to correctly copy a urlencoded \ * so users will be unable to post links to modules. - * However we can still fallback to the id instead of the name, - * so we do that in this case. + * However we can replace them with dashes and re-replace them later * * @param string $basename Basename of the module - * @param int $id Id of the module - * @return mixed Identifier that should be used for + * @return string Identifier that should be used for * module link creation */ - protected function get_module_identifier($basename, $id) + protected function get_module_identifier($basename) { if (strpos($basename, '\\') === false) { return $basename; } - return $id; + return str_replace('\\', '-', $basename); } /** diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index f7e33725ec..fb09bc7057 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1431,20 +1431,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ { if (!$is_soft) { - if ($data['post_visibility'] == ITEM_APPROVED) - { - $phpbb_content_visibility->remove_post_from_statistic($data, $sql_data); - } - else if ($data['post_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE) - { - $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_unapproved = forum_posts_unapproved - 1'; - $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_unapproved = topic_posts_unapproved - 1'; - } - else if ($data['post_visibility'] == ITEM_DELETED) - { - $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_softdeleted = forum_posts_softdeleted - 1'; - $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_softdeleted = topic_posts_softdeleted - 1'; - } + $phpbb_content_visibility->remove_post_from_statistic($data, $sql_data); } $sql = 'SELECT 1 AS has_attachments diff --git a/phpBB/install/schemas/schema.json b/phpBB/install/schemas/schema.json index a3ffd923a1..1a9b9b62b7 100644 --- a/phpBB/install/schemas/schema.json +++ b/phpBB/install/schemas/schema.json @@ -2397,14 +2397,6 @@ ] }, "KEYS": { - "unq_mtch": [ - "UNIQUE", - [ - "word_id", - "post_id", - "title_match" - ] - ], "word_id": [ "INDEX", "word_id" @@ -2412,6 +2404,14 @@ "post_id": [ "INDEX", "post_id" + ], + "un_mtch": [ + "UNIQUE", + [ + "word_id", + "post_id", + "title_match" + ] ] } }, diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index b32af32d25..2d538b739c 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -208,7 +208,7 @@ class file extends \phpbb\cache\driver\base { $iterator = new \DirectoryIterator($this->cache_dir); } - catch (Exception $e) + catch (\Exception $e) { return; } @@ -259,7 +259,7 @@ class file extends \phpbb\cache\driver\base { $iterator = new \DirectoryIterator($dir); } - catch (Exception $e) + catch (\Exception $e) { return; } diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index b890d90558..56727c2ad5 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -168,18 +168,12 @@ class service { if ($row['rank_special']) { - $ranks['special'][$row['rank_id']] = array( - 'rank_title' => $row['rank_title'], - 'rank_image' => $row['rank_image'] - ); + unset($row['rank_min']); + $ranks['special'][$row['rank_id']] = $row; } else { - $ranks['normal'][] = array( - 'rank_title' => $row['rank_title'], - 'rank_min' => $row['rank_min'], - 'rank_image' => $row['rank_image'] - ); + $ranks['normal'][$row['rank_id']] = $row; } } $this->db->sql_freeresult($result); diff --git a/phpBB/phpbb/composer.json b/phpBB/phpbb/composer.json new file mode 100644 index 0000000000..513d7e4559 --- /dev/null +++ b/phpBB/phpbb/composer.json @@ -0,0 +1,27 @@ +{ + "name": "phpbb/phpbb-core", + "description": "Collection of core phpBB libraries", + "type": "library", + "keywords": ["phpbb", "forum"], + "homepage": "https://www.phpbb.com", + "license": "GPL-2.0", + "authors": [ + { + "name": "phpBB Limited", + "email": "operations@phpbb.com", + "homepage": "https://www.phpbb.com/go/authors" + } + ], + "support": { + "issues": "https://tracker.phpbb.com", + "forum": "https://www.phpbb.com/community/", + "wiki": "https://wiki.phpbb.com", + "irc": "irc://irc.freenode.org/phpbb" + }, + "autoload": { + "classmap": [""] + }, + "require": { + "php": ">=5.3.3" + } +} diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index 1f50032f26..da4405d676 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -38,6 +38,12 @@ class content_visibility protected $auth; /** + * config object + * @var \phpbb\config\config + */ + protected $config; + + /** * phpBB root path * @var string */ @@ -53,6 +59,7 @@ class content_visibility * Constructor * * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object * @param \phpbb\db\driver\driver_interface $db Database object * @param \phpbb\user $user User object * @param string $phpbb_root_path Root path @@ -62,9 +69,10 @@ class content_visibility * @param string $topics_table Topics table name * @param string $users_table Users table name */ - public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table) + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table) { $this->auth = $auth; + $this->config = $config; $this->db = $db; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; @@ -576,7 +584,7 @@ class content_visibility $sql_data[$this->users_table] = (($sql_data[$this->users_table]) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts + 1'; } - set_config_count('num_posts', 1, true); + $this->config->increment('num_posts', 1, false); } /** @@ -588,15 +596,28 @@ class content_visibility */ public function remove_post_from_statistic($data, &$sql_data) { - $sql_data[$this->topics_table] = ((!empty($sql_data[$this->topics_table])) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved - 1'; - $sql_data[$this->forums_table] = ((!empty($sql_data[$this->forums_table])) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved - 1'; + if ($data['post_visibility'] == ITEM_APPROVED) + { + $sql_data[$this->topics_table] = ((!empty($sql_data[$this->topics_table])) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved - 1'; + $sql_data[$this->forums_table] = ((!empty($sql_data[$this->forums_table])) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved - 1'; - if ($data['post_postcount']) + if ($data['post_postcount']) + { + $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1'; + } + + $this->config->increment('num_posts', -1, false); + } + else if ($data['post_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE) { - $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1'; + $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_unapproved = forum_posts_unapproved - 1'; + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_unapproved = topic_posts_unapproved - 1'; + } + else if ($data['post_visibility'] == ITEM_DELETED) + { + $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_softdeleted = forum_posts_softdeleted - 1'; + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_softdeleted = topic_posts_softdeleted - 1'; } - - set_config_count('num_posts', -1, true); } /** @@ -627,8 +648,8 @@ class content_visibility $sql_data[$this->forums_table] .= ', forum_posts_unapproved = forum_posts_unapproved - ' . $topic_row['topic_posts_unapproved']; $sql_data[$this->forums_table] .= ', forum_posts_softdeleted = forum_posts_softdeleted - ' . $topic_row['topic_posts_softdeleted']; - set_config_count('num_topics', -1, true); - set_config_count('num_posts', $topic_row['topic_posts_approved'] * (-1), true); + $this->config->increment('num_topics', -1, false); + $this->config->increment('num_posts', $topic_row['topic_posts_approved'] * (-1), false); // Get user post count information $sql = 'SELECT poster_id, COUNT(post_id) AS num_posts diff --git a/phpBB/phpbb/db/migration/data/v310/rename_too_long_indexes.php b/phpBB/phpbb/db/migration/data/v310/rename_too_long_indexes.php new file mode 100644 index 0000000000..8d2a15d8ea --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/rename_too_long_indexes.php @@ -0,0 +1,38 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class rename_too_long_indexes extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_0'); + } + + public function update_schema() + { + return array( + 'drop_keys' => array( + $this->table_prefix . 'search_wordmatch' => array( + 'unq_mtch', + ), + ), + 'add_unique_index' => array( + $this->table_prefix . 'search_wordmatch' => array( + 'un_mtch' => array('word_id', 'post_id', 'title_match'), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index ae0c695aa2..5d93eb8246 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -2104,7 +2104,7 @@ class tools $statements = array(); $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config) - if (strlen($table_name . $index_name) - strlen($table_prefix) > 24) + if (strlen($table_name . '_' . $index_name) - strlen($table_prefix) > 24) { $max_length = strlen($table_prefix) + 24; trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR); diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index 1051021ea7..edca8ee1af 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -330,27 +330,6 @@ class metadata_manager } /** - * Version validation helper - * - * @param string $string The string for comparing to a version - * @param string $current_version The version to compare to - * @return bool True/False if meets version requirements - */ - private function _validate_version($string, $current_version) - { - // Allow them to specify their own comparison operator (ex: <3.1.2, >=3.1.0) - $comparison_matches = false; - preg_match('#[=<>]+#', $string, $comparison_matches); - - if (!empty($comparison_matches)) - { - return version_compare($current_version, str_replace(array($comparison_matches[0], ' '), '', $string), $comparison_matches[0]); - } - - return version_compare($current_version, $string, '>='); - } - - /** * Outputs the metadata into the template * * @return null diff --git a/phpBB/styles/prosilver/template/navbar_header.html b/phpBB/styles/prosilver/template/navbar_header.html index b40be089d2..68759c3c4c 100644 --- a/phpBB/styles/prosilver/template/navbar_header.html +++ b/phpBB/styles/prosilver/template/navbar_header.html @@ -23,6 +23,14 @@ <!-- ENDIF --> <li class="small-icon icon-search-unanswered"><a href="{U_SEARCH_UNANSWERED}" role="menuitem">{L_SEARCH_UNANSWERED}</a></li> <li class="small-icon icon-search-active"><a href="{U_SEARCH_ACTIVE_TOPICS}" role="menuitem">{L_SEARCH_ACTIVE_TOPICS}</a></li> + <li class="separator"></li> + <li class="small-icon icon-search"><a href="{U_SEARCH}" role="menuitem">{L_SEARCH}</a></li> + <!-- ENDIF --> + + <!-- IF not S_IS_BOT and (S_DISPLAY_MEMBERLIST or U_TEAM) --> + <li class="separator"></li> + <!-- IF S_DISPLAY_MEMBERLIST --><li class="small-icon icon-members"><a href="{U_MEMBERLIST}" role="menuitem">{L_MEMBERLIST}</a></li><!-- ENDIF --> + <!-- IF U_TEAM --><li class="small-icon icon-team"><a href="{U_TEAM}" role="menuitem">{L_THE_TEAM}</a></li><!-- ENDIF --> <!-- ENDIF --> <li class="separator"></li> diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index bc9e4b3965..d3594cc5bd 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -114,7 +114,7 @@ .rtl .dropdown li li { padding-left: 0; - padding-right: 10px; + padding-right: 18px; } .rtl .dropdown-extended .header { @@ -315,7 +315,7 @@ unicode-bidi: embed; } -ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { +li.breadcrumbs span:first-child > a { padding-left: 0; padding-right: 19px; } @@ -628,12 +628,11 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { ---------------------------------------- */ .rtl .small-icon { background-position: 100% 50%; - padding-left: 0; - padding-right: 19px; } -.rtl ul.linklist li.small-icon { - padding-right: 0; +.rtl .small-icon > a { + padding-left: 0; + padding-right: 19px; } /* Post control buttons diff --git a/phpBB/styles/prosilver/theme/buttons.css b/phpBB/styles/prosilver/theme/buttons.css index 18c71d251e..b45aae5672 100644 --- a/phpBB/styles/prosilver/theme/buttons.css +++ b/phpBB/styles/prosilver/theme/buttons.css @@ -105,17 +105,21 @@ background-position: 0 50%; background-repeat: no-repeat; background-image: none; - padding: 0 0 0 17px; } -ul.linklist li.small-icon { - padding-left: 0; +.small-icon > a { + display: inline-block; + padding: 0 0 0 18px; } ul.linklist.bulletin > li.small-icon:before { display: none; } +.dropdown .small-icon > a { + display: block; +} + /* Poster contact icons ----------------------------------------*/ .contact-icons.dropdown-contents { diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index fce66f7efb..82542c8d86 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -654,7 +654,6 @@ Colours and backgrounds for buttons.css .icon-pm { background-image: url("./images/icon_pm.gif"); } .icon-print { background-image: url("./images/icon_print.gif"); } .icon-profile { background-image: url("./images/icon_profile.gif"); } -.icon-quick-links { background-image: url("./images/icon_quick_links.gif"); } .icon-register { background-image: url("./images/icon_register.gif"); } .icon-search, .responsive-search a { background-image: url("./images/icon_search.gif"); } .icon-search-active { background-image: url("./images/subforum_read.gif"); } diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index e33bf99965..54d81406e8 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -625,7 +625,7 @@ ul.linklist.bulletin > li.no-bulletin:before { .dropdown li li { border-top: 1px dotted transparent; - padding-left: 10px; + padding-left: 18px; } .wrap .dropdown li, .dropdown.wrap li, .dropdown-extended li { diff --git a/phpBB/styles/prosilver/theme/links.css b/phpBB/styles/prosilver/theme/links.css index 890f854baa..9b5c00d9b6 100644 --- a/phpBB/styles/prosilver/theme/links.css +++ b/phpBB/styles/prosilver/theme/links.css @@ -27,7 +27,7 @@ a:hover { text-decoration: underline; } } /* Navigation bar links */ -ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { +li.breadcrumbs span:first-child > a { display: inline-block; padding-left: 17px; } diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php index 99068729df..aa705c52a5 100644 --- a/tests/content_visibility/delete_post_test.php +++ b/tests/content_visibility/delete_post_test.php @@ -271,7 +271,8 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case $config['search_type'] = 'phpbb_mock_search'; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - set_config_count(null, null, null, new \phpbb\config\config(array('num_posts' => 3, 'num_topics' => 1))); + $phpbb_config = new \phpbb\config\config(array('num_posts' => 3, 'num_topics' => 1)); + set_config_count(null, null, null, $phpbb_config); // Create auth mock $auth = $this->getMock('\phpbb\auth\auth'); @@ -287,7 +288,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager()); - $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); + $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $phpbb_config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason); diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php index 9fd84d7c04..7e4ce6577d 100644 --- a/tests/content_visibility/get_forums_visibility_sql_test.php +++ b/tests/content_visibility/get_forums_visibility_sql_test.php @@ -135,7 +135,8 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data ->with($this->stringContains('_'), $this->anything()) ->will($this->returnValueMap($permissions)); $user = $this->getMock('\phpbb\user'); - $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $config = new phpbb\config\config(array()); + $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $result = $db->sql_query('SELECT ' . $mode . '_id FROM ' . $table . ' diff --git a/tests/content_visibility/get_global_visibility_sql_test.php b/tests/content_visibility/get_global_visibility_sql_test.php index 6397cd6e45..082e0d76ab 100644 --- a/tests/content_visibility/get_global_visibility_sql_test.php +++ b/tests/content_visibility/get_global_visibility_sql_test.php @@ -135,7 +135,8 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data ->with($this->stringContains('_'), $this->anything()) ->will($this->returnValueMap($permissions)); $user = $this->getMock('\phpbb\user'); - $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $config = new phpbb\config\config(array()); + $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $result = $db->sql_query('SELECT ' . $mode . '_id FROM ' . $table . ' diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php index daad901b67..2d4f24f1c6 100644 --- a/tests/content_visibility/get_visibility_sql_test.php +++ b/tests/content_visibility/get_visibility_sql_test.php @@ -82,7 +82,8 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te ->with($this->stringContains('_'), $this->anything()) ->will($this->returnValueMap($permissions)); $user = $this->getMock('\phpbb\user'); - $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $config = new phpbb\config\config(array()); + $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $result = $db->sql_query('SELECT ' . $mode . '_id FROM ' . $table . ' diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php index abfefaddfa..a596b45714 100644 --- a/tests/content_visibility/set_post_visibility_test.php +++ b/tests/content_visibility/set_post_visibility_test.php @@ -125,7 +125,8 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t $db = $this->new_dbal(); $auth = $this->getMock('\phpbb\auth\auth'); $user = $this->getMock('\phpbb\user'); - $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $config = new phpbb\config\config(array()); + $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $content_visibility->set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest); @@ -174,7 +175,8 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t $db = $this->new_dbal(); $auth = $this->getMock('\phpbb\auth\auth'); $user = $this->getMock('\phpbb\user'); - $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $config = new phpbb\config\config(array()); + $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $content_visibility->set_post_visibility(ITEM_DELETED, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest); diff --git a/tests/content_visibility/set_topic_visibility_test.php b/tests/content_visibility/set_topic_visibility_test.php index 6437c61436..230474428c 100644 --- a/tests/content_visibility/set_topic_visibility_test.php +++ b/tests/content_visibility/set_topic_visibility_test.php @@ -89,7 +89,8 @@ class phpbb_content_visibility_set_topic_visibility_test extends phpbb_database_ $db = $this->new_dbal(); $auth = $this->getMock('\phpbb\auth\auth'); $user = $this->getMock('\phpbb\user'); - $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $config = new phpbb\config\config(array()); + $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $content_visibility->set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all); diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index c22c4c5ad2..bd926e2a98 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -100,7 +100,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c // Container $phpbb_container = new phpbb_mock_container_builder(); - $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); + $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); $user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); |