From b6d6938b9fd99020dd4e5b92ef5fc8dc21a81a78 Mon Sep 17 00:00:00 2001 From: brunoais Date: Fri, 9 Aug 2013 17:01:09 +0100 Subject: [ticket/11663] Make generate_text_for_storage return the errors. generate_text_for_storage does not return anything, all returned values are outputted using the parameters so this uses the returned value with the same idea as many C language functions where the returned value is if all went well or not and if it didn't what went wrong. PHPBB3-11663 --- phpBB/includes/functions_content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 05d3c5fde2..c2cfabe983 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -542,7 +542,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb $vars = array('text', 'uid', 'bitfield', 'flags'); extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_after', compact($vars))); - return; + return $message_parser->warn_msg; } /** -- cgit v1.2.1 From 53888ec540a7f7b1aeabcb4ef2d1a6afce121c06 Mon Sep 17 00:00:00 2001 From: brunoais Date: Wed, 14 Aug 2013 10:44:45 +0100 Subject: [ticket/11663] Add the doc block about the return value. generate_text_for_storage does not return anything, all returned values are outputted using the parameters so this uses the returned value with the same idea as many C language functions where the returned value is if all went well or not and if it didn't what went wrong. PHPBB3-11663 --- phpBB/includes/functions_content.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index c2cfabe983..593d2eb045 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -481,6 +481,8 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text * For parsing custom parsed text to be stored within the database. * This function additionally returns the uid and bitfield that needs to be stored. * Expects $text to be the value directly from request_var() and in it's non-parsed form +* +* @return array An array of string with the errors that occurred while parsing */ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false) { -- cgit v1.2.1 From 7a02a8bcf20b79feb996c2508e647c21f3a0ac70 Mon Sep 17 00:00:00 2001 From: brunoais Date: Sat, 17 Aug 2013 20:06:43 +0100 Subject: [ticket/11663] Add the doc block about the parameters. PHPBB3-11663 --- phpBB/includes/functions_content.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 593d2eb045..7e501de9c8 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -481,6 +481,14 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text * For parsing custom parsed text to be stored within the database. * This function additionally returns the uid and bitfield that needs to be stored. * Expects $text to be the value directly from request_var() and in it's non-parsed form +* +* @param string $text The text to be replaced with the parsed one +* @param string $uid The BBCode uid for this parse +* @param string $bitfield The BBCode bitfield for this parse +* @param int $flags The allow_bbcode, allow_urls and allow_smilies compiled into a single integer. +* @param bool $allow_bbcode If BBCode is allowed (i.e. if BBCode is parsed) +* @param bool $allow_urls If urls is allowed +* @param bool $allow_smilies If smilies are allowed * * @return array An array of string with the errors that occurred while parsing */ -- cgit v1.2.1 From 5f788e40d8d2b122b92f2b02dbfdc40960a1e047 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 16 Oct 2013 00:37:54 +0200 Subject: [ticket/11924] Bring layout of events.md to one style PHPBB3-11924 --- phpBB/docs/events.md | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index bef4727149..17615d1405 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -21,7 +21,7 @@ acp_overall_footer_after acp_overall_header_head_append === * Location: adm/style/overall_header.html -* Add assets within the `` tags in the ACP +* Purpose: Add assets within the `` tags in the ACP acp_simple_footer_after === @@ -31,7 +31,7 @@ acp_simple_footer_after acp_simple_header_head_append === * Location: adm/style/overall_header.html -* Add assets within the `` tags in the simple header of the ACP +* Purpose: Add assets within the `` tags in the simple header of the ACP acp_users_overview_options_append === @@ -91,7 +91,8 @@ overall_footer_after overall_footer_breadcrumb_append === -* Location: styles/prosilver/template/overall_footer.html +* Locations: + + styles/prosilver/template/overall_footer.html * Purpose: Add links to the list of breadcrumbs in the footer overall_footer_copyright_append @@ -124,12 +125,14 @@ overall_header_head_append overall_header_navigation_append === -* Location: styles/prosilver/template/overall_header.html +* Locations: + + styles/prosilver/template/overall_header.html * Purpose: Add links after the navigation links in the header overall_header_navigation_prepend === -* Location: styles/prosilver/template/overall_header.html +* Locations: + + styles/prosilver/template/overall_header.html * Purpose: Add links before the navigation links in the header posting_editor_options_prepend @@ -141,7 +144,8 @@ posting_editor_options_prepend simple_footer_after === -* Location: styles/prosilver/template/simple_footer.html +* Locations: + + styles/prosilver/template/simple_footer.html * Purpose: Add content directly prior to the `` tag of the simple footer topiclist_row_prepend @@ -164,19 +168,22 @@ topiclist_row_append ucp_pm_viewmessage_custom_fields_after === -* Location: styles/prosilver/template/ucp_pm_viewmessage.html +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html * Purpose: Add data after the custom fields on the user profile when viewing a private message ucp_pm_viewmessage_custom_fields_before === -* Location: styles/prosilver/template/ucp_pm_viewmessage.html +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html * Purpose: Add data before the custom fields on the user profile when viewing a private message ucp_pm_viewmessage_print_head_append === -* Location: styles/prosilver/template/ucp_pm_viewmessage_print.html +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage_print.html * Purpose: Add asset calls directly before the `` tag of the Print PM screen ucp_prefs_personal_prepend @@ -241,7 +248,8 @@ Display Options screen viewtopic_print_head_append === -* Location: styles/prosilver/template/viewtopic_print.html +* Locations: + + styles/prosilver/template/viewtopic_print.html * Purpose: Add asset calls directly before the `` tag of the Print Topic screen viewtopic_body_footer_before -- cgit v1.2.1 From 9cf634e517a9e1ac4dda8b8b01cc21f8680f529c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 16 Oct 2013 00:39:52 +0200 Subject: [ticket/11924] Add script to export events.md with wiki markup PHPBB3-11924 --- phpBB/develop/export_events_for_wiki.php | 102 +++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 phpBB/develop/export_events_for_wiki.php diff --git a/phpBB/develop/export_events_for_wiki.php b/phpBB/develop/export_events_for_wiki.php new file mode 100644 index 0000000000..72e5607e00 --- /dev/null +++ b/phpBB/develop/export_events_for_wiki.php @@ -0,0 +1,102 @@ + Date: Wed, 16 Oct 2013 00:45:28 +0200 Subject: [ticket/11924] Add version info of template events to events.md PHPBB3-11924 --- phpBB/develop/export_events_for_wiki.php | 5 ++-- phpBB/docs/events.md | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/phpBB/develop/export_events_for_wiki.php b/phpBB/develop/export_events_for_wiki.php index 72e5607e00..c43d1fdfcd 100644 --- a/phpBB/develop/export_events_for_wiki.php +++ b/phpBB/develop/export_events_for_wiki.php @@ -41,7 +41,8 @@ function export_from_eventsmd($filter) if ($filter == 'acp' && strpos($event_name, 'acp_') !== 0) continue; if ($filter == 'styles' && strpos($event_name, 'acp_') === 0) continue; - list($file_details, $explanition) = explode("\n* Purpose: ", $details); + list($file_details, $details) = explode("\n* Since: ", $details); + list($version, $explanition) = explode("\n* Purpose: ", $details); echo "|- id=\"{$event_name}\"\n"; echo "| [[#{$event_name}|{$event_name}]] || "; @@ -68,7 +69,7 @@ function export_from_eventsmd($filter) { echo substr($file_details, strlen("* Location: adm/style/")); } - echo " || 3.1.0-a1 || " . str_replace("\n", ' ', $explanition) . "\n"; + echo " || {$version} || " . str_replace("\n", ' ', $explanition) . "\n"; } } diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 17615d1405..49804a57bc 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -1,41 +1,49 @@ acp_forums_normal_settings_append === * Location: adm/style/acp_forums.html +* Since: 3.1.0-a1 * Purpose: Add settings to forums acp_main_actions_append === * Location: adm/style/acp_main.html +* Since: 3.1.0-a1 * Purpose: Add actions to the ACP main page below the cache purge action acp_main_notice_after === * Location: adm/style/acp_main.html +* Since: 3.1.0-a1 * Purpose: Add notices or other blocks in the ACP below other configuration notices acp_overall_footer_after === * Location: adm/style/overall_footer.html +* Since: 3.1.0-a1 * Purpose: Add content below the footer in the ACP acp_overall_header_head_append === * Location: adm/style/overall_header.html +* Since: 3.1.0-a1 * Purpose: Add assets within the `` tags in the ACP acp_simple_footer_after === * Location: adm/style/simple_footer.html +* Since: 3.1.0-a1 * Purpose: Add content below the simple footer in the ACP acp_simple_header_head_append === * Location: adm/style/overall_header.html +* Since: 3.1.0-a1 * Purpose: Add assets within the `` tags in the simple header of the ACP acp_users_overview_options_append === * Location: adm/style/acp_users.html +* Since: 3.1.0-a1 * Purpose: Add options and settings on user overview page forumlist_body_last_post_title_prepend @@ -43,6 +51,7 @@ forumlist_body_last_post_title_prepend * Locations: + styles/prosilver/template/forumlist_body.html + styles/subsilver2/template/forumlist_body.html +* Since: 3.1.0-a1 * Purpose: Add content before the post title of the latest post in a forum on the forum list. index_body_stat_blocks_before @@ -50,6 +59,7 @@ index_body_stat_blocks_before * Locations: + styles/prosilver/template/index_body.html + styles/subsilver2/template/index_body.html +* Since: 3.1.0-a1 * Purpose: Add new statistic blocks above the Who Is Online and Board Statistics blocks memberlist_body_username_append @@ -57,6 +67,7 @@ memberlist_body_username_append * Locations: + styles/prosilver/template/memberlist_body.html + styles/subsilver2/template/memberlist_body.html +* Since: 3.1.0-a1 * Purpose: Add information after every username in the memberlist. Works in all display modes (leader, group and normal memberlist). @@ -65,6 +76,7 @@ memberlist_body_username_prepend * Locations: + styles/prosilver/template/memberlist_body.html + styles/subsilver2/template/memberlist_body.html +* Since: 3.1.0-a1 * Purpose: Add information before every username in the memberlist. Works in all display modes (leader, group and normal memberlist). @@ -73,6 +85,7 @@ memberlist_view_user_statistics_after * Locations: + styles/prosilver/template/memberlist_view.html + styles/subsilver2/template/memberlist_view.html +* Since: 3.1.0-a1 * Purpose: Add entries after the user statistics part of any user profile memberlist_view_user_statistics_before @@ -80,6 +93,7 @@ memberlist_view_user_statistics_before * Locations: + styles/prosilver/template/memberlist_view.html + styles/subsilver2/template/memberlist_view.html +* Since: 3.1.0-a1 * Purpose: Add entries before the user statistics part of any user profile overall_footer_after @@ -87,12 +101,14 @@ overall_footer_after * Locations: + styles/prosilver/template/overall_footer.html + styles/subsilver2/template/overall_footer.html +* Since: 3.1.0-a1 * Purpose: Add content at the end of the file, directly prior to the `` tag overall_footer_breadcrumb_append === * Locations: + styles/prosilver/template/overall_footer.html +* Since: 3.1.0-a1 * Purpose: Add links to the list of breadcrumbs in the footer overall_footer_copyright_append @@ -100,6 +116,7 @@ overall_footer_copyright_append * Locations: + styles/prosilver/template/overall_footer.html + styles/subsilver2/template/overall_footer.html +* Since: 3.1.0-a1 * Purpose: Add content after the copyright line (no new line by default), before the ACP link overall_footer_copyright_prepend @@ -107,6 +124,7 @@ overall_footer_copyright_prepend * Locations: + styles/prosilver/template/overall_footer.html + styles/subsilver2/template/overall_footer.html +* Since: 3.1.0-a1 * Purpose: Add content before the copyright line overall_header_breadcrumb_append @@ -114,6 +132,7 @@ overall_header_breadcrumb_append * Locations: + styles/prosilver/template/overall_header.html + styles/subsilver2/template/breadcrumbs.html +* Since: 3.1.0-a1 * Purpose: Add links to the list of breadcrumbs in the header overall_header_head_append @@ -121,18 +140,21 @@ overall_header_head_append * Locations: + styles/prosilver/template/overall_header.html + styles/subsilver2/template/overall_header.html +* Since: 3.1.0-a1 * Purpose: Add asset calls directly before the `` tag overall_header_navigation_append === * Locations: + styles/prosilver/template/overall_header.html +* Since: 3.1.0-a1 * Purpose: Add links after the navigation links in the header overall_header_navigation_prepend === * Locations: + styles/prosilver/template/overall_header.html +* Since: 3.1.0-a1 * Purpose: Add links before the navigation links in the header posting_editor_options_prepend @@ -140,12 +162,14 @@ posting_editor_options_prepend * Locations: + styles/prosilver/template/posting_editor.html + styles/prosilver/template/posting_body.html +* Since: 3.1.0-a1 * Purpose: Add posting options on the posting screen simple_footer_after === * Locations: + styles/prosilver/template/simple_footer.html +* Since: 3.1.0-a1 * Purpose: Add content directly prior to the `` tag of the simple footer topiclist_row_prepend @@ -155,6 +179,7 @@ topiclist_row_prepend + styles/prosilver/template/viewforum_body.html + styles/subsilver2/template/search_results.html + styles/subsilver2/template/viewforum_body.html +* Since: 3.1.0-a1 * Purpose: Add content into topic rows (inside the elements containing topic titles) topiclist_row_append @@ -164,12 +189,14 @@ topiclist_row_append + styles/prosilver/template/viewforum_body.html + styles/subsilver2/template/search_results.html + styles/subsilver2/template/viewforum_body.html +* Since: 3.1.0-a1 * Purpose: Add content into topic rows (inside the elements containing topic titles) ucp_pm_viewmessage_custom_fields_after === * Locations: + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.0-a1 * Purpose: Add data after the custom fields on the user profile when viewing a private message @@ -177,6 +204,7 @@ ucp_pm_viewmessage_custom_fields_before === * Locations: + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.0-a1 * Purpose: Add data before the custom fields on the user profile when viewing a private message @@ -184,6 +212,7 @@ ucp_pm_viewmessage_print_head_append === * Locations: + styles/prosilver/template/ucp_pm_viewmessage_print.html +* Since: 3.1.0-a1 * Purpose: Add asset calls directly before the `` tag of the Print PM screen ucp_prefs_personal_prepend @@ -191,6 +220,7 @@ ucp_prefs_personal_prepend * Locations: + styles/prosilver/template/ucp_prefs_personal.html + styles/subsilver2/template/ucp_prefs_personal.html +* Since: 3.1.0-a1 * Purpose: Add user options to the top of the Edit Global Settings block ucp_prefs_personal_append @@ -198,6 +228,7 @@ ucp_prefs_personal_append * Locations: + styles/prosilver/template/ucp_prefs_personal.html + styles/subsilver2/template/ucp_prefs_personal.html +* Since: 3.1.0-a1 * Purpose: Add user options to the bottom of the Edit Global Settings block ucp_prefs_post_prepend @@ -205,6 +236,7 @@ ucp_prefs_post_prepend * Locations: + styles/prosilver/template/ucp_prefs_post.html + styles/subsilver2/template/ucp_prefs_post.html +* Since: 3.1.0-a1 * Purpose: Add user options to the top of the Edit Posting Defaults block ucp_prefs_post_append @@ -212,6 +244,7 @@ ucp_prefs_post_append * Locations: + styles/prosilver/template/ucp_prefs_post.html + styles/subsilver2/template/ucp_prefs_post.html +* Since: 3.1.0-a1 * Purpose: Add user options to the bottom of the Edit Posting Defaults block ucp_prefs_view_radio_buttons_prepend @@ -219,6 +252,7 @@ ucp_prefs_view_radio_buttons_prepend * Locations: + styles/prosilver/template/ucp_prefs_view.html + styles/subsilver2/template/ucp_prefs_view.html +* Since: 3.1.0-a1 * Purpose: Add options to the top of the radio buttons block of the Edit Display Options screen @@ -227,6 +261,7 @@ ucp_prefs_view_radio_buttons_append * Locations: + styles/prosilver/template/ucp_prefs_view.html + styles/subsilver2/template/ucp_prefs_view.html +* Since: 3.1.0-a1 * Purpose: Add options to the bottom of the radio buttons block of the Edit Display Options screen @@ -235,6 +270,7 @@ ucp_prefs_view_select_menu_prepend * Locations: + styles/prosilver/template/ucp_prefs_view.html + styles/subsilver2/template/ucp_prefs_view.html +* Since: 3.1.0-a1 * Purpose: Add options to the top of the drop-down lists block of the Edit Display Options screen @@ -243,6 +279,7 @@ ucp_prefs_view_select_menu_append * Locations: + styles/prosilver/template/ucp_prefs_view.html + styles/subsilver2/template/ucp_prefs_view.html +* Since: 3.1.0-a1 * Purpose: Add options to the bottom of the drop-down lists block of the Edit Display Options screen @@ -250,6 +287,7 @@ viewtopic_print_head_append === * Locations: + styles/prosilver/template/viewtopic_print.html +* Since: 3.1.0-a1 * Purpose: Add asset calls directly before the `` tag of the Print Topic screen viewtopic_body_footer_before @@ -257,6 +295,7 @@ viewtopic_body_footer_before * Locations: + styles/prosilver/template/viewtopic_body.html + styles/subsilver2/template/viewtopic_body.html +* Since: 3.1.0-a1 * Purpose: Add content to the bottom of the View topic screen below the posts and quick reply, directly before the jumpbox in Prosilver, breadcrumbs in Subsilver2. @@ -266,6 +305,7 @@ viewtopic_body_post_buttons_after * Locations: + styles/prosilver/template/viewtopic_body.html + styles/subsilver2/template/viewtopic_body.html +* Since: 3.1.0-a1 * Purpose: Add post button to posts (next to edit, quote etc), at the end of the list. @@ -274,6 +314,7 @@ viewtopic_body_post_buttons_before * Locations: + styles/prosilver/template/viewtopic_body.html + styles/subsilver2/template/viewtopic_body.html +* Since: 3.1.0-a1 * Purpose: Add post button to posts (next to edit, quote etc), at the start of the list. @@ -282,6 +323,7 @@ viewtopic_body_postrow_custom_fields_after * Locations: + styles/prosilver/template/viewtopic_body.html + styles/subsilver2/template/viewtopic_body.html +* Since: 3.1.0-a1 * Purpose: Add data after the custom fields on the user profile when viewing a post @@ -290,6 +332,7 @@ viewtopic_body_postrow_custom_fields_before * Locations: + styles/prosilver/template/viewtopic_body.html + styles/subsilver2/template/viewtopic_body.html +* Since: 3.1.0-a1 * Purpose: Add data before the custom fields on the user profile when viewing a post @@ -298,4 +341,5 @@ viewtopic_topic_title_prepend * Locations: + styles/prosilver/template/viewtopic_body.html + styles/subsilver2/template/viewtopic_body.html +* Since: 3.1.0-a1 * Purpose: Add content directly before the topic title link on the View topic screen -- cgit v1.2.1 From a03965554e7a286057b18a86c561f874759f8f0a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 16 Oct 2013 00:48:51 +0200 Subject: [ticket/11924] Reduce unneccessary load PHPBB3-11924 --- phpBB/develop/export_events_for_wiki.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/phpBB/develop/export_events_for_wiki.php b/phpBB/develop/export_events_for_wiki.php index c43d1fdfcd..5acc698a7e 100644 --- a/phpBB/develop/export_events_for_wiki.php +++ b/phpBB/develop/export_events_for_wiki.php @@ -1,17 +1,13 @@ Date: Wed, 16 Oct 2013 16:32:00 +0200 Subject: [ticket/11924] Add option to export php event list PHPBB3-11924 --- phpBB/develop/export_events_for_wiki.php | 242 +++++++++++++++++++++++++++++++ 1 file changed, 242 insertions(+) diff --git a/phpBB/develop/export_events_for_wiki.php b/phpBB/develop/export_events_for_wiki.php index 5acc698a7e..48eb4224b0 100644 --- a/phpBB/develop/export_events_for_wiki.php +++ b/phpBB/develop/export_events_for_wiki.php @@ -18,6 +18,9 @@ function usage() echo "\n"; echo "styles:\n"; echo " Export all events for files in the prosilver and subsilver2 styles.\n"; + echo "\n"; + echo "php:\n"; + echo " Export all events for php-files.\n"; exit(2); } @@ -70,6 +73,241 @@ function export_from_eventsmd($filter) } } +function export_from_php() +{ + global $phpbb_root_path; + + $files = get_file_list($phpbb_root_path); + $events = array(); + foreach ($files as $file) + { + $file_events = check_for_events($file); + if (!empty($file_events)) + { + $events = array_merge($events, $file_events); + } + } + + ksort($events); + + foreach ($events as $event) + { + echo '|- id="' . $event['event'] . '"' . "\n"; + echo '| [[#' . $event['event'] . '|' . $event['event'] . ']] || ' . $event['file'] . ' || ' . implode(', ', $event['arguments']) . ' || ' . $event['since'] . ' || ' . $event['description'] . "\n"; + } +} + +function check_for_events($file) +{ + global $phpbb_root_path; + + $events = array(); + $content = file_get_contents($phpbb_root_path . $file); + + if (strpos($content, "phpbb_dispatcher->trigger_event('") || strpos($content, "phpbb_dispatcher->dispatch('")) + { + $lines = explode("\n", $content); + for ($i = 0, $num_lines = sizeof($lines); $i < $num_lines; $i++) + { + if ($found_trigger_event = strpos($lines[$i], "phpbb_dispatcher->trigger_event('")) + { + $event_line = $i; + $event_name = $lines[$event_line]; + $event_name = substr($event_name, $found_trigger_event + strlen("phpbb_dispatcher->trigger_event('")); + $event_name = substr($event_name, 0, strpos($event_name, "'")); + + // Validate @event name + $find_event_line = 1; + while (strpos($lines[$event_line - $find_event_line], '* @event ') === false) + { + $find_event_line++; + + if ($find_event_line > min(50, $event_line)) + { + throw new LogicException('Can not find @event tag for event "' . $event_name . '" in file "' . $file . '"'); + } + } + $event_name_tag = substr(trim($lines[$event_line - $find_event_line]), strlen('* @event ')); + if ($event_name_tag !== $event_name) + { + throw new LogicException('Event name does not match @event tag for event "' . $event_name . '" in file "' . $file . '"'); + } + + // Find $vars array lines + $find_varsarray_line = 1; + while (strpos($lines[$event_line - $find_varsarray_line], "vars = array('") === false) + { + $find_varsarray_line++; + + if ($find_varsarray_line > min(50, $event_line)) + { + throw new LogicException('Can not find "$vars = array()"-line for event "' . $event_name . '" in file "' . $file . '"'); + } + } + $varsarray = substr(trim($lines[$event_line - $find_varsarray_line]), strlen("\$vars = array('"), -3); + $arguments = explode("', '", $varsarray); + + // Validate $vars array with @var + $find_vars_line = 3; + $doc_vars = array(); + while (strpos(trim($lines[$event_line - $find_vars_line]), '*') === 0) + { + $var_line = trim($lines[$event_line - $find_vars_line]); + $var_line = preg_replace('!\s+!', ' ', $var_line); + if (strpos($var_line, '* @var ') === 0) + { + $doc_line = explode(' ', $var_line); + if (isset($doc_line[3])) + { + $doc_vars[] = $doc_line[3]; + } + } + $find_vars_line++; + } + if (sizeof($arguments) !== sizeof($doc_vars) && array_intersect($arguments, $doc_vars)) + { + throw new LogicException('$vars array does not match the list of @var tags for event "' . $event_name . '" in file "' . $file . '"'); + } + + // Find @since + $find_since_line = 1; + while (strpos($lines[$event_line - $find_since_line], '* @since ') === false) + { + $find_since_line++; + + if ($find_since_line > min(50, $event_line)) + { + throw new LogicException('Can not find @since tag for event "' . $event_name . '" in file "' . $file . '"'); + } + } + $since = substr(trim($lines[$event_line - $find_since_line]), strlen('* @since ')); + $since = ($since == '3.1-A1') ? '3.1.0-a1' : $since; + + // Find event description line + $find_description_line = 3; + while (strpos(trim($lines[$event_line - $find_description_line]), '*') === 0) + { + $find_description_line++; + + if ($find_description_line > min(50, $event_line)) + { + throw new LogicException('Can not find description-line for event "' . $event_name . '" in file "' . $file . '"'); + } + } + $description = substr(trim($lines[$event_line - $find_description_line + 1]), strlen('* ')); + + $events[$event_name] = array( + 'event' => $event_name, + 'file' => $file, + 'arguments' => $arguments, + 'since' => $since, + 'description' => $description, + ); + } + if ($found_trigger_event = strpos($lines[$i], "phpbb_dispatcher->dispatch('")) + { + $event_line = $i; + $event_name = $lines[$event_line]; + $event_name = substr($event_name, $found_trigger_event + strlen("phpbb_dispatcher->dispatch('")); + $event_name = substr($event_name, 0, strpos($event_name, "'")); + + // Validate @event name + $find_event_line = 1; + while (strpos($lines[$event_line - $find_event_line], '* @event ') === false) + { + $find_event_line++; + } + $event_name_tag = substr(trim($lines[$event_line - $find_event_line]), strlen('* @event ')); + if ($event_name_tag !== $event_name) + { + throw new LogicException('Event name does not match @event tag for event "' . $event_name . '" in file "' . $file . '"'); + } + + // Find @since + $find_since_line = 1; + while (strpos($lines[$event_line - $find_since_line], '* @since ') === false) + { + $find_since_line++; + } + $since = substr(trim($lines[$event_line - $find_since_line]), strlen('* @since ')); + $since = ($since == '3.1-A1') ? '3.1.0-a1' : $since; + + // Find event description line + $find_description_line = 3; + while (strpos(trim($lines[$event_line - $find_description_line]), '*') === 0) + { + $find_description_line++; + } + $description = substr(trim($lines[$event_line - $find_description_line + 1]), strlen('* ')); + + $events[$event_name] = array( + 'event' => $event_name, + 'file' => $file, + 'arguments' => array(), + 'since' => $since, + 'description' => $description, + ); + } + } + } + + return $events; +} + +/** +* Returns a list of files in that directory +* +* Works recursive with any depth +* +* @param string $dir Directory to go through +* @return array List of files (including directories from within $dir +*/ +function get_file_list($dir, $path = '') +{ + try + { + $iterator = new \DirectoryIterator($dir); + } + catch (Exception $e) + { + return array(); + } + + $files = array(); + foreach ($iterator as $file_info) + { + if ($file_info->isDot()) + { + continue; + } + + // Do not scan some directories + if ($file_info->isDir() && ( + ($path == '' && in_array($file_info->getFilename(), array('cache', 'develop', 'ext', 'files', 'language', 'store', 'vendor'))) + || ($path == '/includes' && in_array($file_info->getFilename(), array('utf'))) + || ($path == '/phpbb/db/migration' && in_array($file_info->getFilename(), array('data'))) + || ($path == '/phpbb' && in_array($file_info->getFilename(), array('event'))) + )) + { + continue; + } + else if ($file_info->isDir()) + { + $sub_dir = get_file_list($file_info->getPath() . '/' . $file_info->getFilename(), $path . '/' . $file_info->getFilename()); + foreach ($sub_dir as $file) + { + $files[] = $file_info->getFilename() . '/' . $file; + } + } + else if ($file_info->getExtension() == 'php') + { + $files[] = $file_info->getFilename(); + } + } + + return $files; +} + function validate_argument_count($count) { global $argv; @@ -94,6 +332,10 @@ switch ($action) export_from_eventsmd('styles'); break; + case 'php': + export_from_php(); + break; + default: usage(); } -- cgit v1.2.1 From 3c9a8a3788f4dda1ef16430f16d6392a9e6f8dad Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 16 Oct 2013 16:32:40 +0200 Subject: [ticket/11924] Fix some minor issues with the php event docs PHPBB3-11924 --- phpBB/includes/acp/acp_forums.php | 2 +- phpBB/includes/functions.php | 12 ++++++------ phpBB/includes/ucp/ucp_zebra.php | 2 +- phpBB/posting.php | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 258aabcc0d..029f4b23c9 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1470,7 +1470,7 @@ class acp_forums /** * Event when we move content from one forum to another * - * @event core.acp_manage_forums_move_children + * @event core.acp_manage_forums_move_content * @var int from_id If of the current parent forum * @var int to_id If of the new parent forum * @var bool sync Shall we sync the "to"-forum's data diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 947e29ea02..a077dd4078 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5609,14 +5609,14 @@ function garbage_collection() global $cache, $db; global $phpbb_dispatcher; - /** - * Unload some objects, to free some memory, before we finish our task - * - * @event core.garbage_collection - * @since 3.1-A1 - */ if (!empty($phpbb_dispatcher)) { + /** + * Unload some objects, to free some memory, before we finish our task + * + * @event core.garbage_collection + * @since 3.1-A1 + */ $phpbb_dispatcher->dispatch('core.garbage_collection'); } diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index 6bb3cdc145..090f9bf34c 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -64,7 +64,7 @@ class ucp_zebra * @var array user_ids User ids we remove * @since 3.1-A1 */ - $vars = array('user_ids'); + $vars = array('mode', 'user_ids'); extract($phpbb_dispatcher->trigger_event('core.ucp_remove_zebra', compact($vars))); $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' diff --git a/phpBB/posting.php b/phpBB/posting.php index 396b320eac..e29b74af65 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1525,7 +1525,7 @@ $template->assign_vars(array( * @event core.posting_modify_template_vars * @since 3.1-A1 */ -$phpbb_dispatcher->trigger_event('core.posting_modify_template_vars'); +$phpbb_dispatcher->dispatch('core.posting_modify_template_vars'); // Build custom bbcodes array display_custom_bbcodes(); -- cgit v1.2.1 From 91eeebfb07e416d21d9c4fe57e0387f3b075024d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 16 Oct 2013 16:38:22 +0200 Subject: [ticket/11924] Remove duplicated code PHPBB3-11924 --- phpBB/develop/export_events_for_wiki.php | 76 +++++++++----------------------- 1 file changed, 22 insertions(+), 54 deletions(-) diff --git a/phpBB/develop/export_events_for_wiki.php b/phpBB/develop/export_events_for_wiki.php index 48eb4224b0..cce5939f48 100644 --- a/phpBB/develop/export_events_for_wiki.php +++ b/phpBB/develop/export_events_for_wiki.php @@ -109,6 +109,7 @@ function check_for_events($file) $lines = explode("\n", $content); for ($i = 0, $num_lines = sizeof($lines); $i < $num_lines; $i++) { + $event_line = 0; if ($found_trigger_event = strpos($lines[$i], "phpbb_dispatcher->trigger_event('")) { $event_line = $i; @@ -116,23 +117,6 @@ function check_for_events($file) $event_name = substr($event_name, $found_trigger_event + strlen("phpbb_dispatcher->trigger_event('")); $event_name = substr($event_name, 0, strpos($event_name, "'")); - // Validate @event name - $find_event_line = 1; - while (strpos($lines[$event_line - $find_event_line], '* @event ') === false) - { - $find_event_line++; - - if ($find_event_line > min(50, $event_line)) - { - throw new LogicException('Can not find @event tag for event "' . $event_name . '" in file "' . $file . '"'); - } - } - $event_name_tag = substr(trim($lines[$event_line - $find_event_line]), strlen('* @event ')); - if ($event_name_tag !== $event_name) - { - throw new LogicException('Event name does not match @event tag for event "' . $event_name . '" in file "' . $file . '"'); - } - // Find $vars array lines $find_varsarray_line = 1; while (strpos($lines[$event_line - $find_varsarray_line], "vars = array('") === false) @@ -168,54 +152,28 @@ function check_for_events($file) { throw new LogicException('$vars array does not match the list of @var tags for event "' . $event_name . '" in file "' . $file . '"'); } - - // Find @since - $find_since_line = 1; - while (strpos($lines[$event_line - $find_since_line], '* @since ') === false) - { - $find_since_line++; - - if ($find_since_line > min(50, $event_line)) - { - throw new LogicException('Can not find @since tag for event "' . $event_name . '" in file "' . $file . '"'); - } - } - $since = substr(trim($lines[$event_line - $find_since_line]), strlen('* @since ')); - $since = ($since == '3.1-A1') ? '3.1.0-a1' : $since; - - // Find event description line - $find_description_line = 3; - while (strpos(trim($lines[$event_line - $find_description_line]), '*') === 0) - { - $find_description_line++; - - if ($find_description_line > min(50, $event_line)) - { - throw new LogicException('Can not find description-line for event "' . $event_name . '" in file "' . $file . '"'); - } - } - $description = substr(trim($lines[$event_line - $find_description_line + 1]), strlen('* ')); - - $events[$event_name] = array( - 'event' => $event_name, - 'file' => $file, - 'arguments' => $arguments, - 'since' => $since, - 'description' => $description, - ); } - if ($found_trigger_event = strpos($lines[$i], "phpbb_dispatcher->dispatch('")) + else if ($found_trigger_event = strpos($lines[$i], "phpbb_dispatcher->dispatch('")) { $event_line = $i; $event_name = $lines[$event_line]; $event_name = substr($event_name, $found_trigger_event + strlen("phpbb_dispatcher->dispatch('")); $event_name = substr($event_name, 0, strpos($event_name, "'")); + $arguments = array(); + } + if ($event_line) + { // Validate @event name $find_event_line = 1; while (strpos($lines[$event_line - $find_event_line], '* @event ') === false) { $find_event_line++; + + if ($find_event_line > min(50, $event_line)) + { + throw new LogicException('Can not find @event tag for event "' . $event_name . '" in file "' . $file . '"'); + } } $event_name_tag = substr(trim($lines[$event_line - $find_event_line]), strlen('* @event ')); if ($event_name_tag !== $event_name) @@ -228,6 +186,11 @@ function check_for_events($file) while (strpos($lines[$event_line - $find_since_line], '* @since ') === false) { $find_since_line++; + + if ($find_since_line > min(50, $event_line)) + { + throw new LogicException('Can not find @since tag for event "' . $event_name . '" in file "' . $file . '"'); + } } $since = substr(trim($lines[$event_line - $find_since_line]), strlen('* @since ')); $since = ($since == '3.1-A1') ? '3.1.0-a1' : $since; @@ -237,13 +200,18 @@ function check_for_events($file) while (strpos(trim($lines[$event_line - $find_description_line]), '*') === 0) { $find_description_line++; + + if ($find_description_line > min(50, $event_line)) + { + throw new LogicException('Can not find description-line for event "' . $event_name . '" in file "' . $file . '"'); + } } $description = substr(trim($lines[$event_line - $find_description_line + 1]), strlen('* ')); $events[$event_name] = array( 'event' => $event_name, 'file' => $file, - 'arguments' => array(), + 'arguments' => $arguments, 'since' => $since, 'description' => $description, ); -- cgit v1.2.1 From 403da5d38d7feb1fd65e40c9907dd922f4401c90 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Wed, 16 Oct 2013 23:50:23 -0700 Subject: [ticket/11280] Prevent duplicate entry in forums_track table. Enforcing a time limit prevents all rows from being selected, thus a new row is inserted resulting in a duplicate entry. PHPBB3-11280 --- phpBB/includes/functions.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ad5e3c05ce..c88e78c91f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1478,7 +1478,6 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ $sql = 'SELECT forum_id FROM ' . FORUMS_TRACK_TABLE . " WHERE user_id = {$user->data['user_id']} - AND mark_time < $post_time AND " . $db->sql_in_set('forum_id', $forum_id); $result = $db->sql_query($sql); -- cgit v1.2.1 From 42a4305f19d45dae8fda57d47809ab301f944f21 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Tue, 15 Oct 2013 21:42:08 -0700 Subject: [ticket/11899] Give indication of activity after voting in poll. PHPBB3-11899 --- phpBB/styles/prosilver/template/viewtopic_body.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index e678ea8f8c..d2862c2ba3 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -60,7 +60,7 @@
-
+
-- cgit v1.2.1 From 6fce4b44a8daaad76e9f819c69699d78d1d763b4 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 19 Oct 2013 08:47:12 -0700 Subject: [ticket/11935] Fix

tags not allowed inside tags PHPBB3-11935 --- phpBB/language/en/acp/extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index 0adaff10c8..369397ead2 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -39,7 +39,7 @@ $lang = array_merge($lang, array( 'EXTENSIONS' => 'Extensions', 'EXTENSIONS_ADMIN' => 'Extensions Manager', 'EXTENSIONS_EXPLAIN' => 'The Extensions Manager is a tool in your phpBB Board which allows you to manage all of your extensions statuses and view information about them.', - 'EXTENSION_INVALID_LIST' => 'The "%s" extension is not valid.

%s

', + 'EXTENSION_INVALID_LIST' => 'The "%s" extension is not valid.
%s

', 'EXTENSION_NOT_AVAILABLE' => 'The selected extension is not available for this board, please verify your phpBB and PHP versions are allowed (see the details page).', 'DETAILS' => 'Details', -- cgit v1.2.1 From 2b7120508b81300134557bfc2cba39a4bc160055 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 19 Oct 2013 08:48:41 -0700 Subject: [ticket/11935] Fix incorrect alt tags that should be title tags PHPBB3-11935 --- phpBB/adm/style/acp_ext_list.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 53de0b4d12..4e13b1974a 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -28,7 +28,7 @@ {L_DETAILS} - {enabled.actions.L_ACTION} + {enabled.actions.L_ACTION}  |  @@ -48,7 +48,7 @@ - {disabled.actions.L_ACTION} + {disabled.actions.L_ACTION}  |  -- cgit v1.2.1 From 8816664d8abbcf319e9bdfd5e3c1618131a419cf Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 19 Oct 2013 08:49:18 -0700 Subject: [ticket/11935] Fix stray tags PHPBB3-11935 --- phpBB/adm/style/acp_ext_list.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 4e13b1974a..bb50f922f7 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -24,7 +24,7 @@ - {enabled.META_DISPLAY_NAME} + {enabled.META_DISPLAY_NAME} {L_DETAILS} @@ -42,7 +42,7 @@ - {disabled.META_DISPLAY_NAME} + {disabled.META_DISPLAY_NAME} {L_DETAILS} -- cgit v1.2.1 From 5d49a8f06e7cb79c4ef3c5ad8ef5cac67e135b68 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 19 Oct 2013 08:51:08 -0700 Subject: [ticket/11935] Fix invalid HTML usage of