diff options
38 files changed, 457 insertions, 104 deletions
diff --git a/phpBB/adm/style/acp_avatar_options_local.html b/phpBB/adm/style/acp_avatar_options_local.html index 0cdb3644d7..8adafa1d99 100644 --- a/phpBB/adm/style/acp_avatar_options_local.html +++ b/phpBB/adm/style/acp_avatar_options_local.html @@ -1,7 +1,6 @@ <dl> <dt><label for="category">{L_AVATAR_CATEGORY}{L_COLON}</label></dt> <dd><select name="avatar_local_cat" id="category"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> <!-- BEGIN avatar_local_cats --> <option value="{avatar_local_cats.NAME}"<!-- IF avatar_local_cats.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_local_cats.NAME}</option> <!-- END avatar_local_cats --> diff --git a/phpBB/assets/javascript/plupload.js b/phpBB/assets/javascript/plupload.js index 8ffd452a09..5445e83e15 100644 --- a/phpBB/assets/javascript/plupload.js +++ b/phpBB/assets/javascript/plupload.js @@ -586,6 +586,11 @@ uploader.bind('FilesAdded', function(up, files) { return; } + // Switch the active tab if the style supports it + if (typeof activateSubPanel == 'function') { + activateSubPanel('attach-panel'); + } + // Show the file list if there aren't any files currently. if (!$('#file-list-container').is(':visible')) { $('#file-list-container').show(100); diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml index a102a8c609..9b0f0aa9a4 100644 --- a/phpBB/config/console.yml +++ b/phpBB/config/console.yml @@ -46,6 +46,14 @@ services: tags: - { name: console.command } + console.command.cron.list: + class: phpbb\console\command\cron\cron_list + arguments: + - @cron.manager + - @user + tags: + - { name: console.command } + console.command.cron.run: class: phpbb\console\command\cron\run arguments: diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index 6b7ed1d269..80dee1d620 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -58,13 +58,7 @@ class acp_logs if ($deletemark && sizeof($marked)) { - $sql_in = array(); - foreach ($marked as $mark) - { - $sql_in[] = $mark; - } - $conditions['log_id'] = $sql_in; - unset($sql_in); + $conditions['log_id'] = array('IN' => $marked); } if ($deleteall) @@ -78,8 +72,6 @@ class acp_logs $conditions['keywords'] = $keywords; } - $conditions['log_type'] = $this->log_type; - $phpbb_log = $phpbb_container->get('log'); $phpbb_log->delete($mode, $conditions); } diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index a0c1bc02ec..2945e1ec8a 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -115,9 +115,8 @@ class mcp_logs if ($deletemark && sizeof($marked)) { $conditions = array( - 'log_type' => LOG_MOD, 'forum_id' => $forum_list, - 'log_id' => $marked, + 'log_id' => array('IN' => $marked), ); $phpbb_log->delete('mod', $conditions); @@ -127,7 +126,6 @@ class mcp_logs $keywords = utf8_normalize_nfc(request_var('keywords', '', true)); $conditions = array( - 'log_type' => LOG_MOD, 'forum_id' => $forum_list, 'keywords' => $keywords, ); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 0b82b447ef..6ca1a985a5 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -223,6 +223,7 @@ $lang = array_merge($lang, array( 'BACK' => 'Back', + 'CLI_DESCRIPTION_CRON_LIST' => 'Prints a list of ready and unready cron jobs.', 'CLI_DESCRIPTION_CRON_RUN' => 'Runs all ready cron tasks.', 'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'Name of the task to be run', @@ -233,6 +234,7 @@ $lang = array_merge($lang, array( 'CRON_LOCK_ERROR' => 'Could not obtain cron lock.', 'CRON_NO_SUCH_TASK' => 'Could not find cron task ā%sā.', 'CRON_NO_TASK' => 'No cron tasks need to be run right now.', + 'CRON_NO_TASKS' => 'No cron tasks could be found.', 'DEACTIVATE' => 'Deactivate', 'DIRECTORY_DOES_NOT_EXIST' => 'The entered path ā%sā does not exist.', @@ -304,6 +306,8 @@ $lang = array_merge($lang, array( 'SHOW_ALL_OPERATIONS' => 'Show all operations', + 'TASKS_NOT_READY' => 'Not ready tasks:', + 'TASKS_READY' => 'Ready tasks:', 'TOTAL_SIZE' => 'Total size', 'UCP' => 'User Control Panel', diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index 00e519e3f2..f3acf7cb2c 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -36,7 +36,7 @@ class local extends \phpbb\avatar\driver\driver public function prepare_form($request, $template, $user, $row, &$error) { $avatar_list = $this->get_avatar_list($user); - $category = $request->variable('avatar_local_cat', ''); + $category = $request->variable('avatar_local_cat', key($avatar_list)); foreach ($avatar_list as $cat => $null) { @@ -131,7 +131,7 @@ class local extends \phpbb\avatar\driver\driver } return array( - 'avatar' => ($category != $user->lang['MAIN']) ? $category . '/' . $file : $file, + 'avatar' => ($category != $user->lang['NO_AVATAR_CATEGORY']) ? $category . '/' . $file : $file, 'avatar_width' => $avatar_list[$category][urldecode($file)]['width'], 'avatar_height' => $avatar_list[$category][urldecode($file)]['height'], ); @@ -179,9 +179,9 @@ class local extends \phpbb\avatar\driver\driver { $dims = array(0, 0); } - $cat = ($path == $file_path) ? $user->lang['MAIN'] : str_replace("$path/", '', $file_path); + $cat = ($path == $file_path) ? $user->lang['NO_AVATAR_CATEGORY'] : str_replace("$path/", '', $file_path); $avatar_list[$cat][$image] = array( - 'file' => ($cat != $user->lang['MAIN']) ? rawurlencode($cat) . '/' . rawurlencode($image) : rawurlencode($image), + 'file' => ($cat != $user->lang['NO_AVATAR_CATEGORY']) ? rawurlencode($cat) . '/' . rawurlencode($image) : rawurlencode($image), 'filename' => rawurlencode($image), 'name' => ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $image))), 'width' => $dims[0], diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php new file mode 100644 index 0000000000..9db6a23947 --- /dev/null +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -0,0 +1,90 @@ +<?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\console\command\cron; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class cron_list extends \phpbb\console\command\command +{ + /** @var \phpbb\cron\manager */ + protected $cron_manager; + + /** @var \phpbb\user */ + protected $user; + + public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\user $user) + { + $this->cron_manager = $cron_manager; + $this->user = $user; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('cron:list') + ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_LIST')) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $tasks = $this->cron_manager->get_tasks(); + + if (empty($tasks)) + { + $output->writeln($this->user->lang('CRON_NO_TASKS')); + return; + } + + $ready_tasks = array(); + $not_ready_tasks = array(); + foreach ($tasks as $task) + { + if ($task->is_ready()) + { + $ready_tasks[] = $task; + } + else + { + $not_ready_tasks[] = $task; + } + } + + if (!empty($ready_tasks)) + { + $output->writeln('<info>' . $this->user->lang('TASKS_READY') . '</info>'); + $this->print_tasks_names($ready_tasks, $output); + } + + if (!empty($ready_tasks) && !empty($not_ready_tasks)) + { + $output->writeln(''); + } + + if (!empty($not_ready_tasks)) + { + $output->writeln('<info>' . $this->user->lang('TASKS_NOT_READY') . '</info>'); + $this->print_tasks_names($not_ready_tasks, $output); + } + } + + protected function print_tasks_names(array $tasks, OutputInterface $output) + { + foreach ($tasks as $task) + { + $output->writeln($task->get_name()); + } + } +} diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php index 1eb8edf033..f04f063228 100644 --- a/phpBB/phpbb/cron/manager.php +++ b/phpBB/phpbb/cron/manager.php @@ -122,6 +122,16 @@ class manager } /** + * Find all tasks and return them. + * + * @return array List of all tasks. + */ + public function get_tasks() + { + return $this->tasks; + } + + /** * Wraps a task inside an instance of \phpbb\cron\task\wrapper. * * @param \phpbb\cron\task\task $task The task. diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 453cb740bb..10efe5fd1c 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -391,28 +391,29 @@ class log implements \phpbb\log\log_interface } $sql_where = 'WHERE log_type = ' . $log_type; + + if (isset($conditions['keywords'])) + { + $sql_where .= $this->generate_sql_keyword($conditions['keywords'], ''); + + unset($conditions['keywords']); + } + foreach ($conditions as $field => $field_value) { $sql_where .= ' AND '; - if ($field == 'keywords') + if (is_array($field_value) && sizeof($field_value) == 2 && !is_array($field_value[1])) + { + $sql_where .= $field . ' ' . $field_value[0] . ' ' . $field_value[1]; + } + else if (is_array($field_value) && isset($field_value['IN']) && is_array($field_value['IN'])) { - $sql_where .= $this->generate_sql_keyword($field_value, '', ''); + $sql_where .= $this->db->sql_in_set($field, $field_value['IN']); } else { - if (is_array($field_value) && sizeof($field_value) == 2 && !is_array($field_value[1])) - { - $sql_where .= $field . ' ' . $field_value[0] . ' ' . $field_value[1]; - } - else if (is_array($field_value) && isset($field_value['IN']) && is_array($field_value['IN'])) - { - $sql_where .= $this->db->sql_in_set($field, $field_value['IN']); - } - else - { - $sql_where .= $field . ' = ' . $field_value; - } + $sql_where .= $field . ' = ' . $field_value; } } @@ -781,7 +782,7 @@ class log implements \phpbb\log\log_interface } } - $sql_keywords = $statement_operator . ' ('; + $sql_keywords = ' ' . $statement_operator . ' ('; if (!empty($operations)) { $sql_keywords .= $this->db->sql_in_set($table_alias . 'log_operation', $operations) . ' OR '; diff --git a/phpBB/posting.php b/phpBB/posting.php index 2516067aae..60bb595da6 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1546,6 +1546,7 @@ $page_data = array( 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'], 'EDIT_REASON' => $request->variable('edit_reason', ''), + 'SHOW_PANEL' => $request->variable('show_panel', ''), 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"), 'U_VIEW_TOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") : '', 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup"), diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 52293a8f2a..fa838fde19 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -104,27 +104,38 @@ jQuery(document).ready(function() { show_panel = this.getAttribute('data-show-panel'); if (panels.length) { - subPanels(show_panel); + activateSubPanel(show_panel, panels); childNodes.click(function () { - subPanels(this.getAttribute('data-subpanel')); + activateSubPanel(this.getAttribute('data-subpanel'), panels); return false; }); } + }); +}); - function subPanels(p) { - var i; +/** +* Activate specific subPanel +*/ +function activateSubPanel(p, panels) { + var i; - if (typeof(p) === 'string') { - show_panel = p; - } + if (typeof(p) === 'string') { + show_panel = p; + } + $('input[name="show_panel"]').val(show_panel); - for (i = 0; i < panels.length; i++) { - jQuery('#' + panels[i]).css('display', panels[i] === show_panel ? 'block' : 'none'); - jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === show_panel); - } - } - }); -}); + if (typeof(panels) === 'undefined') { + panels = []; + jQuery('.sub-panels a[data-subpanel]').each(function() { + panels.push(this.getAttribute('data-subpanel')); + }); + } + + for (i = 0; i < panels.length; i++) { + jQuery('#' + panels[i]).css('display', panels[i] === show_panel ? 'block' : 'none'); + jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === show_panel); + } +} /** * Call print preview diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 28ed215662..e9c95aa799 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -33,7 +33,7 @@ </div> <div> - <a id="bottom" accesskey="z"></a> + <a id="bottom" class="anchor" accesskey="z"></a> <!-- IF not S_IS_BOT -->{RUN_CRON_TASK}<!-- ENDIF --> </div> diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index d18fff6bb0..e5371e792e 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -57,7 +57,7 @@ <!-- EVENT overall_header_body_before --> <div id="wrap"> - <a id="top" accesskey="t"></a> + <a id="top" class="anchor" accesskey="t"></a> <div id="page-header"> <div class="headerbar"> <div class="inner"> @@ -89,7 +89,7 @@ <!-- EVENT overall_header_page_body_before --> - <a id="start_here"></a> + <a id="start_here" class="anchor"></a> <div id="page-body"> <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN and (U_MCP or U_ACP) --> <div id="information" class="rules"> diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index e311b85cbe..081c267a94 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -99,7 +99,7 @@ <!-- ENDIF --> <!-- IF not S_PRIVMSGS and not S_SHOW_DRAFTS and not $SIG_EDIT eq 1 --> - <div id="tabs" class="sub-panels" data-show-panel="options-panel"> + <div id="tabs" class="sub-panels" data-show-panel="<!-- IF SHOW_PANEL -->{SHOW_PANEL}<!-- ELSE -->options-panel<!-- ENDIF -->"> <ul> <li id="options-panel-tab" class="activetab"><a href="#tabs" data-subpanel="options-panel"><span>{L_OPTIONS}</span></a></li> <!-- IF S_SHOW_ATTACH_BOX --> diff --git a/phpBB/styles/prosilver/template/posting_layout.html b/phpBB/styles/prosilver/template/posting_layout.html index 4ef0954200..630afdb832 100644 --- a/phpBB/styles/prosilver/template/posting_layout.html +++ b/phpBB/styles/prosilver/template/posting_layout.html @@ -68,6 +68,7 @@ <!-- DEFINE $EXTRA_POSTING_OPTIONS = 1 --> <!-- INCLUDE posting_editor.html --> + <input type="hidden" name="show_panel" value="options-panel" /> {S_FORM_TOKEN} </div> </div> diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index 48f6cc87da..d31dd32cf6 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -35,5 +35,5 @@ <!-- EVENT simple_header_body_before --> <div id="simple-wrap"> - <a id="top" accesskey="t"></a> + <a id="top" class="anchor" accesskey="t"></a> <div id="page-body"> diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options_local.html b/phpBB/styles/prosilver/template/ucp_avatar_options_local.html index 3946b9d269..2a0f403782 100644 --- a/phpBB/styles/prosilver/template/ucp_avatar_options_local.html +++ b/phpBB/styles/prosilver/template/ucp_avatar_options_local.html @@ -1,6 +1,5 @@ <!-- IF .avatar_local_cats --> <label for="category">{L_AVATAR_CATEGORY}{L_COLON} <select name="avatar_local_cat" id="category"> -<option value="">{L_NO_AVATAR_CATEGORY}</option> <!-- BEGIN avatar_local_cats --> <option value="{avatar_local_cats.NAME}"<!-- IF avatar_local_cats.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_local_cats.NAME}</option> <!-- END avatar_local_cats --> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html index 551e58f62f..ce0f4941a5 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -11,7 +11,7 @@ </head> <body id="phpbb"> <div id="wrap"> - <a id="top" accesskey="t"></a> + <a id="top" class="anchor" accesskey="t"></a> <div id="page-header"> <h1>{SITENAME}</h1> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index eb61bd3e72..fb0b9733e7 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -59,7 +59,7 @@ <!-- ENDIF --> </div> <!-- ENDIF --> - <div class="clear"></div> + </div> <!-- IF S_HAS_POLL --> @@ -117,7 +117,7 @@ <!-- BEGIN postrow --> <!-- EVENT viewtopic_body_postrow_post_before --> - <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --> + <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" class="anchor" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --> <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF --><!-- IF postrow.POSTER_WARNINGS --> warned<!-- ENDIF -->"> <div class="inner"> diff --git a/phpBB/styles/prosilver/template/viewtopic_print.html b/phpBB/styles/prosilver/template/viewtopic_print.html index 98308c4adc..5c44f58adb 100644 --- a/phpBB/styles/prosilver/template/viewtopic_print.html +++ b/phpBB/styles/prosilver/template/viewtopic_print.html @@ -11,7 +11,7 @@ </head> <body id="phpbb"> <div id="wrap"> - <a id="top" accesskey="t"></a> + <a id="top" class="anchor" accesskey="t"></a> <div id="page-header"> <h1>{SITENAME}</h1> diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index b66c841d7c..8c1c2c3926 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -37,7 +37,7 @@ ul.topiclist dt { } ul.topiclist.missing-column dt { - margin-right: -330px; + margin-right: -345px; } ul.topiclist.two-long-columns dt { @@ -55,7 +55,7 @@ ul.topiclist dt .list-inner { } ul.topiclist.missing-column dt .list-inner { - margin-right: 330px; + margin-right: 345px; } ul.topiclist.two-long-columns dt .list-inner { @@ -237,6 +237,12 @@ div[class].topic-actions { height: auto; } +.topic-actions:after { + content: ''; + clear: both; + display: block; +} + /* Post body styles ----------------------------------------*/ .postbody { diff --git a/phpBB/styles/prosilver/theme/links.css b/phpBB/styles/prosilver/theme/links.css index ff6df7c9a7..86cdf9c10e 100644 --- a/phpBB/styles/prosilver/theme/links.css +++ b/phpBB/styles/prosilver/theme/links.css @@ -228,3 +228,7 @@ a.feed-icon-forum { float: right; margin: 3px; } + +a.anchor { + display: block; +} diff --git a/phpBB/styles/subsilver2/template/faq_body.html b/phpBB/styles/subsilver2/template/faq_body.html index 22c4145a20..b3c41e932a 100644 --- a/phpBB/styles/subsilver2/template/faq_body.html +++ b/phpBB/styles/subsilver2/template/faq_body.html @@ -1,6 +1,6 @@ <!-- INCLUDE overall_header.html --> -<a name="faqtop"></a> +<a name="faqtop" class="anchor"></a> <div id="pagecontent"> @@ -38,7 +38,7 @@ <!-- ELSE --> <td class="row2" valign="top"> <!-- ENDIF --> - <div class="postbody"><a name="f{faq_block.S_ROW_COUNT}r{faq_block.faq_row.S_ROW_COUNT}"></a><b>» {faq_block.faq_row.FAQ_QUESTION}</b></div> + <div class="postbody"><a name="f{faq_block.S_ROW_COUNT}r{faq_block.faq_row.S_ROW_COUNT}" class="anchor"></a><b>» {faq_block.faq_row.FAQ_QUESTION}</b></div> <div class="postbody">{faq_block.faq_row.FAQ_ANSWER}</div> <p class="gensmall"><a href="#faqtop">{L_BACK_TO_TOP}</a></p> </td> diff --git a/phpBB/styles/subsilver2/template/mcp_post.html b/phpBB/styles/subsilver2/template/mcp_post.html index 0f000ca931..f5052ee2d0 100644 --- a/phpBB/styles/subsilver2/template/mcp_post.html +++ b/phpBB/styles/subsilver2/template/mcp_post.html @@ -144,7 +144,7 @@ <!-- IF S_TOPIC_REVIEW --><!-- INCLUDE posting_topic_review.html --><!-- ENDIF --> <!-- ELSE --> <!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER --> - <br /><a name="mod"></a> + <br /><a name="mod" class="anchor"></a> <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> <tr> @@ -166,7 +166,7 @@ <!-- ENDIF --> <!-- IF S_CAN_VIEWIP --> - <br /><a name="ip"></a> + <br /><a name="ip" class="anchor"></a> <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> <tr> diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index b4a2fa5b59..314e284155 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -140,7 +140,7 @@ function marklist(id, name, state) <!-- EVENT overall_header_body_before --> -<a name="top"></a> +<a name="top" class="anchor"></a> <div id="wrapheader"> diff --git a/phpBB/styles/subsilver2/template/posting_review.html b/phpBB/styles/subsilver2/template/posting_review.html index baf159aecd..c118499564 100644 --- a/phpBB/styles/subsilver2/template/posting_review.html +++ b/phpBB/styles/subsilver2/template/posting_review.html @@ -23,7 +23,7 @@ <td colspan="2">{post_review_row.L_IGNORE_POST}</td> <!-- ELSE --> - <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{post_review_row.POST_ID}"></a> + <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{post_review_row.POST_ID}" class="anchor"></a> <table width="150" cellspacing="0" cellpadding="4" border="0"> <tr> <td align="center"><b class="postauthor">{post_review_row.POST_AUTHOR_FULL}</b></td> diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index 23ea56a216..20976861fc 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -23,7 +23,7 @@ <!-- IF topic_review_row.S_IGNORE_POST --> <td colspan="2">{topic_review_row.L_IGNORE_POST}</td> <!-- ELSE --> - <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{topic_review_row.POST_ID}"></a> + <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{topic_review_row.POST_ID}" class="anchor"></a> <table width="150" cellspacing="0"> <tr> <td align="center"><b class="postauthor"<!-- IF topic_review_row.POST_AUTHOR_COLOUR --> style="color: {topic_review_row.POST_AUTHOR_COLOUR}"<!-- ENDIF -->>{topic_review_row.POST_AUTHOR}</b></td> diff --git a/phpBB/styles/subsilver2/template/search_results.html b/phpBB/styles/subsilver2/template/search_results.html index 3649bb9633..23d0b3a146 100644 --- a/phpBB/styles/subsilver2/template/search_results.html +++ b/phpBB/styles/subsilver2/template/search_results.html @@ -97,7 +97,7 @@ <!-- IF searchresults.S_IGNORE_POST --> <td class="gensmall" colspan="2" height="25" align="center">{searchresults.L_IGNORE_POST}</td> <!-- ELSE --> - <td colspan="2" height="25"><p class="topictitle"><a name="p{searchresults.POST_ID}" id="p{searchresults.POST_ID}"></a> {L_FORUM}{L_COLON} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> {L_TOPIC}{L_COLON} <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a> </p></td> + <td colspan="2" height="25"><p class="topictitle"><a name="p{searchresults.POST_ID}" id="p{searchresults.POST_ID}" class="anchor"></a> {L_FORUM}{L_COLON} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> {L_TOPIC}{L_COLON} <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a> </p></td> </tr> <tr class="row1"> <td width="150" align="center" valign="middle"><b class="postauthor">{searchresults.POST_AUTHOR_FULL}</b></td> diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html index 36ac149691..faeeaea3d5 100644 --- a/phpBB/styles/subsilver2/template/simple_header.html +++ b/phpBB/styles/subsilver2/template/simple_header.html @@ -18,5 +18,5 @@ <body class="{S_CONTENT_DIRECTION} {BODY_CLASS}"> <!-- EVENT simple_header_body_before --> -<a name="top"></a> +<a name="top" class="anchor"></a> <div id="wrapcentre"> diff --git a/phpBB/styles/subsilver2/template/ucp_avatar_options_local.html b/phpBB/styles/subsilver2/template/ucp_avatar_options_local.html index 87e5608fec..7beddfc109 100644 --- a/phpBB/styles/subsilver2/template/ucp_avatar_options_local.html +++ b/phpBB/styles/subsilver2/template/ucp_avatar_options_local.html @@ -2,7 +2,6 @@ <!-- IF .avatar_local_cats --> <tr> <td class="cat" colspan="2" align="center" valign="middle"><span class="genmed">{L_AVATAR_CATEGORY}{L_COLON} </span><select name="avatar_local_cat" id="category"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> <!-- BEGIN avatar_local_cats --> <option value="{avatar_local_cats.NAME}"<!-- IF avatar_local_cats.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_local_cats.NAME}</option> <!-- END avatar_local_cats --> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_history.html b/phpBB/styles/subsilver2/template/ucp_pm_history.html index ad06da2b7e..c07edb0f68 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_history.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_history.html @@ -18,7 +18,7 @@ </tr> <!-- BEGIN history_row --> <!-- IF history_row.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a name="{history_row.MSG_ID}"></a> + <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a name="{history_row.MSG_ID}" class="anchor"></a> <table width="150" cellspacing="0"> <tr> <td align="center" colspan="2"><span class="postauthor">{history_row.MESSAGE_AUTHOR_FULL}</span></td> diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 0c7900076b..8f83bfbea6 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -141,8 +141,8 @@ <!-- IF postrow.S_POST_HIDDEN --> <td class="gensmall" colspan="2" height="25" align="center"> - <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --> - <a name="p{postrow.POST_ID}"></a> + <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" class="anchor" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --> + <a name="p{postrow.POST_ID}" class="anchor"></a> <!-- IF postrow.S_POST_HIDDEN --> <!-- IF postrow.S_POST_DELETED --> {postrow.L_POST_DELETED_MESSAGE} @@ -155,7 +155,7 @@ <!-- ELSE --> <td align="center" valign="middle"> - <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --><a name="p{postrow.POST_ID}"></a> + <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" class="anchor" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --><a name="p{postrow.POST_ID}" class="anchor"></a> <b class="postauthor"<!-- IF postrow.POST_AUTHOR_COLOUR --> style="color: {postrow.POST_AUTHOR_COLOUR}"<!-- ENDIF -->>{postrow.POST_AUTHOR}</b> </td> <td width="100%" height="25"> diff --git a/phpBB/styles/subsilver2/theme/stylesheet.css b/phpBB/styles/subsilver2/theme/stylesheet.css index ea8e660e30..e69eec4f14 100644 --- a/phpBB/styles/subsilver2/theme/stylesheet.css +++ b/phpBB/styles/subsilver2/theme/stylesheet.css @@ -458,6 +458,10 @@ th a:hover { text-decoration: underline; } +a.anchor { + display: block; +} + /* Form Elements ------------ */ diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php new file mode 100644 index 0000000000..46705a585f --- /dev/null +++ b/tests/console/cron/cron_list_test.php @@ -0,0 +1,103 @@ +<?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. +* +*/ + +require_once dirname(__FILE__) . '/tasks/simple_ready.php'; +require_once dirname(__FILE__) . '/tasks/simple_not_ready.php'; + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Tester\CommandTester; +use phpbb\console\command\cron\cron_list; + +class phpbb_console_command_cron_list_test extends phpbb_test_case +{ + /** @var \phpbb\cron\manager */ + protected $cron_manager; + + /** @var \phpbb\user */ + protected $user; + + protected $command_name; + + protected $command_tester; + + protected function setUp() + { + $this->user = $this->getMock('\phpbb\user'); + $this->user->method('lang')->will($this->returnArgument(0)); + } + + public function test_no_task() + { + $this->initiate_test(0, 0); + $this->assertContains('CRON_NO_TASKS', $this->command_tester->getDisplay()); + } + + public function test_only_ready() + { + $this->initiate_test(2, 0); + $this->assertContains('TASKS_READY command1 command2', preg_replace('/\s+/', ' ', trim($this->command_tester->getDisplay()))); + } + + public function test_only_not_ready() + { + $this->initiate_test(0, 2); + $this->assertContains('TASKS_NOT_READY command1 command2', preg_replace('/\s+/', ' ', trim($this->command_tester->getDisplay()))); + } + + public function test_both_ready() + { + $this->initiate_test(2, 2); + $this->assertSame('TASKS_READY command1 command2 TASKS_NOT_READY command3 command4', preg_replace('/\s+/', ' ', trim($this->command_tester->getDisplay()))); + } + + public function get_cron_manager(array $tasks) + { + global $pathEx, $phpbb_root_path; + $i = 1; + foreach ($tasks as $task) + { + $task->set_name('command' . $i); + $i++; + } + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); + } + + public function get_command_tester() + { + $application = new Application(); + $application->add(new cron_list($this->cron_manager, $this->user)); + + $command = $application->find('cron:list'); + $this->command_name = $command->getName(); + return new CommandTester($command); + } + + public function initiate_test($number_ready, $number_not_ready) + { + $tasks = array(); + + for ($i = 0; $i < $number_ready; $i++) + { + $tasks[] = new phpbb_cron_task_simple_ready(); + } + + for ($i = 0; $i < $number_not_ready; $i++) + { + $tasks[] = new phpbb_cron_task_simple_not_ready(); + } + + $this->get_cron_manager($tasks); + $this->command_tester = $this->get_command_tester(); + $this->command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true)); + } +} diff --git a/tests/console/cron/tasks/simple_not_ready.php b/tests/console/cron/tasks/simple_not_ready.php new file mode 100644 index 0000000000..887768e5fe --- /dev/null +++ b/tests/console/cron/tasks/simple_not_ready.php @@ -0,0 +1,13 @@ +<?php + +class phpbb_cron_task_simple_not_ready extends \phpbb\cron\task\base +{ + public function run() + { + } + + public function should_run() + { + return false; + } +} diff --git a/tests/console/cron/tasks/simple_ready.php b/tests/console/cron/tasks/simple_ready.php new file mode 100644 index 0000000000..47970e104f --- /dev/null +++ b/tests/console/cron/tasks/simple_ready.php @@ -0,0 +1,8 @@ +<?php + +class phpbb_cron_task_simple_ready extends \phpbb\cron\task\base +{ + public function run() + { + } +} diff --git a/tests/log/delete_test.php b/tests/log/delete_test.php index f10e3e582b..b8be15efa5 100644 --- a/tests/log/delete_test.php +++ b/tests/log/delete_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* 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. * */ @@ -13,48 +17,141 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_log_delete_test extends phpbb_database_test_case { + protected $log; + public function getDataSet() { return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/delete_log.xml'); } - public function test_log_delete() + protected function setUp() { global $phpbb_root_path, $phpEx, $db, $phpbb_dispatcher, $auth; $db = $this->new_dbal(); - $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $user = $this->getMock('\phpbb\user'); $user->data['user_id'] = 1; $auth = $this->getMock('\phpbb\auth\auth'); - $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); - - // Delete all admin logs - $this->assertCount(2, $log->get_logs('admin')); - $log->delete('admin'); - // One entry is added to the admin log when the logs are purged - $this->assertCount(1, $log->get_logs('admin')); - - // Delete with keyword - $this->assertCount(1, $log->get_logs('mod', false, 0, 0, 0, 0, 0, 0, 'l.log_time DESC', 'guest')); - $log->delete('mod', array('keywords' => 'guest')); - $this->assertEmpty($log->get_logs('mod', false, 0, 0, 0, 0, 0, 0, 'l.log_time DESC', 'guest')); - - // Delete with simples conditions - $this->assertCount(3, $log->get_logs('mod', false, 0, 0, 12, 0, 1, 0, 'l.log_time DESC')); - $log->delete('mod', array('forum_id' => 12, 'user_id' => 1)); - $this->assertEmpty($log->get_logs('mod', false, 0, 0, 12, 0, 1, 0, 'l.log_time DESC')); - - // Delete with IN condition - $this->assertCount(2, $log->get_logs('mod', false, 0, 0, array(13, 14), 0, 0, 0, 'l.log_time DESC')); - $log->delete('mod', array('forum_id' => array('IN' => array(14, 13)))); - $this->assertEmpty($log->get_logs('mod', false, 0, 0, array(13, 14), 0, 0, 0, 'l.log_time DESC')); - - // Delete with a custom condition (ie: WHERE x >= 10) - $this->assertCount(3, $log->get_logs('critical', false, 0, 0, 0, 0, 0, 0, 'l.log_time DESC')); - $log->delete('critical', array('user_id' => array('>', 1))); - $this->assertCount(1, $log->get_logs('critical', false, 0, 0, 0, 0, 0, 0, 'l.log_time DESC')); + $this->log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + + parent::setUp(); + } + + public function log_delete_data() + { + return array( + array( + array(1, 2), + array(16), + array(), + 'admin', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + array( + array(11), + array(), + array('keywords' => 'guest'), + 'mod', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + 'guest', + ), + array( + array(4, 5, 7), + array(), + array('forum_id' => 12, 'user_id' => 1), + 'mod', + false, + 0, + 0, + 12, + 0, + 1, + 0, + 'l.log_id ASC', + '', + ), + array( + array(12, 13), + array(), + array('forum_id' => array('IN' => array(14, 13))), + 'mod', + false, + 0, + 0, + array(13, 14), + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + array( + array(3, 14, 15), + array(3), + array('user_id' => array('>', 1)), + 'critical', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + array( + array(3, 14, 15), + array(), + array('keywords' => ''), + 'critical', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + ); + } + + /** + * @dataProvider log_delete_data + */ + public function test_log_delete($expected_before, $expected_after, $delete_conditions, $mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $log_time, $sort_by, $keywords) + { + $this->assertSame($expected_before, $this->get_ids($this->log->get_logs($mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $log_time, $sort_by, $keywords)), 'before'); + $this->log->delete($mode, $delete_conditions); + $this->assertSame($expected_after, $this->get_ids($this->log->get_logs($mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $log_time, $sort_by, $keywords)), 'after'); + } + + public function get_ids($logs) + { + $ids = array(); + foreach ($logs as $log_entry) + { + $ids[] = (int) $log_entry['id']; + } + return $ids; } } |