1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-19 07:00:14 +01:00

Merge branch '3.1.x' into ticket/15011

This commit is contained in:
javiexin 2017-02-15 23:56:52 +01:00 committed by GitHub
commit 7f69580df3
80 changed files with 914 additions and 409 deletions

View File

@ -1,292 +0,0 @@
#!/usr/bin/env php
<?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.
*
*/
function show_usage()
{
$filename = basename(__FILE__);
echo "$filename adds repositories of a github network as remotes to a local git repository.\n";
echo "\n";
echo "Usage: [php] $filename -s collaborators|organisation|contributors|forks [OPTIONS]\n";
echo "\n";
echo "Scopes:\n";
echo " collaborators Repositories of people who have push access to the specified repository\n";
echo " contributors Repositories of people who have contributed to the specified repository\n";
echo " organisation Repositories of members of the organisation at github\n";
echo " forks All repositories of the whole github network\n";
echo "\n";
echo "Options:\n";
echo " -s scope See description above (mandatory)\n";
echo " -u github_username Overwrites the github username (optional)\n";
echo " -r repository_name Overwrites the repository name (optional)\n";
echo " -m your_github_username Sets up ssh:// instead of git:// for pushable repositories (optional)\n";
echo " -d Outputs the commands instead of running them (optional)\n";
echo " -h This help text\n";
exit(1);
}
// Handle arguments
$opts = getopt('s:u:r:m:dh');
if (empty($opts) || isset($opts['h']))
{
show_usage();
}
$scope = get_arg($opts, 's', '');
$username = get_arg($opts, 'u', 'phpbb');
$repository = get_arg($opts, 'r', 'phpbb3');
$developer = get_arg($opts, 'm', '');
$dry_run = !get_arg($opts, 'd', true);
run(null, $dry_run);
exit(work($scope, $username, $repository, $developer));
function work($scope, $username, $repository, $developer)
{
// Get some basic data
$forks = get_forks($username, $repository);
$collaborators = get_collaborators($username, $repository);
if ($forks === false || $collaborators === false)
{
echo "Error: failed to retrieve forks or collaborators\n";
return 1;
}
switch ($scope)
{
case 'collaborators':
$remotes = array_intersect_key($forks, $collaborators);
break;
case 'organisation':
$remotes = array_intersect_key($forks, get_organisation_members($username));
break;
case 'contributors':
$remotes = array_intersect_key($forks, get_contributors($username, $repository));
break;
case 'forks':
$remotes = $forks;
break;
default:
show_usage();
}
if (file_exists('.git'))
{
add_remote($username, $repository, isset($collaborators[$developer]));
}
else
{
clone_repository($username, $repository, isset($collaborators[$developer]));
}
// Add private security repository for developers
if ($username == 'phpbb' && $repository == 'phpbb3' && isset($collaborators[$developer]))
{
run("git remote add $username-security " . get_repository_url($username, "$repository-security", true));
}
// Skip blessed repository.
unset($remotes[$username]);
foreach ($remotes as $remote)
{
add_remote($remote['username'], $remote['repository'], $remote['username'] == $developer);
}
run('git remote update');
}
function clone_repository($username, $repository, $pushable = false)
{
$url = get_repository_url($username, $repository, false);
run("git clone $url ./ --origin $username");
if ($pushable)
{
$ssh_url = get_repository_url($username, $repository, true);
run("git remote set-url --push $username $ssh_url");
}
}
function add_remote($username, $repository, $pushable = false)
{
$url = get_repository_url($username, $repository, false);
run("git remote add $username $url");
if ($pushable)
{
$ssh_url = get_repository_url($username, $repository, true);
run("git remote set-url --push $username $ssh_url");
}
}
function get_repository_url($username, $repository, $ssh = false)
{
$url_base = ($ssh) ? 'git@github.com:' : 'git://github.com/';
return $url_base . $username . '/' . $repository . '.git';
}
function api_request($query)
{
return api_url_request("https://api.github.com/$query?per_page=100");
}
function api_url_request($url)
{
$contents = file_get_contents($url, false, stream_context_create(array(
'http' => array(
'header' => "User-Agent: phpBB/1.0\r\n",
),
)));
$sub_request_result = array();
// Check headers for pagination links
if (!empty($http_response_header))
{
foreach ($http_response_header as $header_element)
{
// Find Link Header which gives us a link to the next page
if (strpos($header_element, 'Link: ') === 0)
{
list($head, $header_content) = explode(': ', $header_element);
foreach (explode(', ', $header_content) as $links)
{
list($url, $rel) = explode('; ', $links);
if ($rel == 'rel="next"')
{
// Found a next link, follow it and merge the results
$sub_request_result = api_url_request(substr($url, 1, -1));
}
}
}
}
}
if ($contents === false)
{
return false;
}
$contents = json_decode($contents);
if (isset($contents->message) && strpos($contents->message, 'API Rate Limit') === 0)
{
throw new RuntimeException('Reached github API Rate Limit. Please try again later' . "\n", 4);
}
return ($sub_request_result) ? array_merge($sub_request_result, $contents) : $contents;
}
function get_contributors($username, $repository)
{
$request = api_request("repos/$username/$repository/stats/contributors");
if ($request === false)
{
return false;
}
$usernames = array();
foreach ($request as $contribution)
{
$usernames[$contribution->author->login] = $contribution->author->login;
}
return $usernames;
}
function get_organisation_members($username)
{
$request = api_request("orgs/$username/public_members");
if ($request === false)
{
return false;
}
$usernames = array();
foreach ($request as $member)
{
$usernames[$member->login] = $member->login;
}
return $usernames;
}
function get_collaborators($username, $repository)
{
$request = api_request("repos/$username/$repository/collaborators");
if ($request === false)
{
return false;
}
$usernames = array();
foreach ($request as $collaborator)
{
$usernames[$collaborator->login] = $collaborator->login;
}
return $usernames;
}
function get_forks($username, $repository)
{
$request = api_request("repos/$username/$repository/forks");
if ($request === false)
{
return false;
}
$usernames = array();
foreach ($request as $fork)
{
$usernames[$fork->owner->login] = array(
'username' => $fork->owner->login,
'repository' => $fork->name,
);
}
return $usernames;
}
function get_arg($array, $index, $default)
{
return isset($array[$index]) ? $array[$index] : $default;
}
function run($cmd, $dry = false)
{
static $dry_run;
if (is_null($cmd))
{
$dry_run = $dry;
}
else if (!empty($dry_run))
{
echo "$cmd\n";
}
else
{
passthru(escapeshellcmd($cmd));
}
}

View File

@ -136,4 +136,5 @@
<!-- END meta_authors -->
</fieldset>
<!-- EVENT acp_ext_details_end -->
<!-- INCLUDE overall_footer.html -->

View File

@ -30,6 +30,11 @@
<p><a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a> &middot; <a href="{U_VERSIONCHECK}">{L_MORE_INFORMATION}</a></p>
</div>
<!-- ENDIF -->
<!-- IF S_VERSION_UPGRADEABLE -->
<div class="errorbox notice">
<p>{UPGRADE_INSTRUCTIONS}</p>
</div>
<!-- ENDIF -->
<!-- IF S_SEARCH_INDEX_MISSING -->
<div class="errorbox">

View File

@ -127,6 +127,7 @@
<!-- ENDIF -->
</dl>
<!-- ENDIF -->
<!-- EVENT acp_profile_step_one_lang_after -->
</fieldset>
<fieldset class="quick">

View File

@ -20,6 +20,11 @@
<p>{L_VERSION_NOT_UP_TO_DATE_ACP} - <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p>
</div>
<!-- ENDIF -->
<!-- IF S_VERSION_UPGRADEABLE -->
<div class="errorbox notice">
<p>{UPGRADE_INSTRUCTIONS}</p>
</div>
<!-- ENDIF -->
<fieldset>
<legend></legend>

View File

@ -173,9 +173,11 @@ function submitPermissions() {
$.ajax({
url: $form.action,
type: 'POST',
data: formData + '&' + $submitAllButton.name + '=' + encodeURIComponent($submitAllButton.value) +
data: formData + '&' + $submitButton.name + '=' + encodeURIComponent($submitButton.value) +
'&creation_time=' + $form.find('input[type=hidden][name=creation_time]')[0].value +
'&form_token=' + $form.find('input[type=hidden][name=form_token]')[0].value,
'&form_token=' + $form.find('input[type=hidden][name=form_token]')[0].value +
'&' + $form.children('input[type=hidden]').serialize() +
'&' + $form.find('input[type=checkbox][name^=inherit]').serialize(),
success: handlePermissionReturn,
error: handlePermissionReturn
});

View File

@ -53,7 +53,7 @@ function marklist(id, name, state)
for (var r = 0; r < rb.length; r++)
{
if (rb[r].name.substr(0, name.length) == name)
if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true)
{
rb[r].checked = state;
}

View File

@ -66,7 +66,7 @@ function marklist(id, name, state)
for (var r = 0; r < rb.length; r++)
{
if (rb[r].name.substr(0, name.length) == name)
if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true)
{
rb[r].checked = state;
}

View File

@ -5,9 +5,7 @@ services:
- @service_container
dbal.conn.driver:
class: %dbal.driver.class%
calls:
- [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]]
synthetic: true
dbal.tools:
class: phpbb\db\tools

View File

@ -58,6 +58,12 @@ acp_email_options_after
* Since: 3.1.2-RC1
* Purpose: Add settings to mass email form
acp_ext_details_end
===
* Location: adm/style/acp_ext_details.html
* Since: 3.1.11-RC1
* Purpose: Add more detailed information on extension after the available information.
acp_ext_list_disabled_title_after
===
* Location: adm/style/acp_ext_list.html
@ -369,6 +375,13 @@ acp_profile_contact_before
* Since: 3.1.6-RC1
* Purpose: Add extra options to custom profile field configuration in the ACP
acp_profile_step_one_lang_after
===
* Locations:
+ adm/style/acp_profile.html
* Since: 3.1.11-RC1
* Purpose: Add extra lang specific options to custom profile field step one configuration in the ACP
acp_prune_forums_append
===
* Locations:
@ -814,6 +827,14 @@ mcp_forum_actions_after
* Since: 3.1.11-RC1
* Purpose: Add some information after actions fieldset
mcp_forum_actions_append
===
* Locations:
+ styles/prosilver/template/mcp_forum.html
+ styles/subsilver2/template/mcp_forum.html
* Since: 3.1.11-RC1
* Purpose: Add additional options to actions select
mcp_forum_actions_before
===
* Locations:
@ -1042,6 +1063,22 @@ memberlist_search_sorting_options_before
* Since: 3.1.2-RC1
* Purpose: Add information before the search sorting options field.
memberlist_team_username_append
===
* Locations:
+ styles/prosilver/template/memberlist_team.html
+ styles/subsilver2/template/memberlist_team.html
* Since: 3.1.11-RC1
* Purpose: Append information to username of team member
memberlist_team_username_prepend
===
* Locations:
+ styles/prosilver/template/memberlist_team.html
+ styles/subsilver2/template/memberlist_team.html
* Since: 3.1.11-RC1
* Purpose: Add information before team user username
memberlist_view_contact_after
===
* Locations:
@ -2009,6 +2046,14 @@ ucp_main_front_user_activity_after
* Since: 3.1.6-RC1
* Purpose: Add content right after the user activity info viewing UCP front page
ucp_main_front_user_activity_append
===
* Locations:
+ styles/prosilver/template/ucp_main_front.html
+ styles/subsilver2/template/ucp_main_front.html
* Since: 3.1.11-RC1
* Purpose: Add content after last user activity info viewing UCP front page
ucp_main_front_user_activity_before
===
* Locations:
@ -2017,6 +2062,14 @@ ucp_main_front_user_activity_before
* Since: 3.1.6-RC1
* Purpose: Add content right before the user activity info viewing UCP front page
ucp_main_front_user_activity_prepend
===
* Locations:
+ styles/prosilver/template/ucp_main_front.html
+ styles/subsilver2/template/ucp_main_front.html
* Since: 3.1.11-RC1
* Purpose: Add content before first user activity info viewing UCP front page
ucp_pm_history_post_buttons_after
===
* Locations:
@ -2113,6 +2166,13 @@ ucp_pm_viewmessage_custom_fields_before
* Purpose: Add data before the custom fields on the user profile when viewing
a private message
ucp_pm_viewmessage_options_before
===
* Locations:
+ styles/prosilver/template/ucp_pm_viewmessage.html
* Since: 3.1.11-RC1
* Purpose: Add content right before display options
ucp_pm_viewmessage_post_buttons_after
===
* Locations:
@ -2271,6 +2331,14 @@ ucp_profile_register_details_after
* Since: 3.1.4-RC1
* Purpose: Add options in profile page fieldset - after confirm password field.
ucp_register_buttons_before
===
* Locations:
+ styles/prosilver/template/ucp_register.html
+ styles/subsilver2/template/ucp_register.html
* Since: 3.1.11-RC1
* Purpose: Add content before buttons in registration form.
ucp_register_credentials_before
===
* Locations:

View File

@ -262,7 +262,7 @@ else
* @var string mode Download mode
* @var bool thumbnail Flag indicating if the file is a thumbnail
* @since 3.1.6-RC1
* @change 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions")
* @changed 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions")
*/
$vars = array(
'attach_id',

View File

@ -421,23 +421,33 @@ class acp_main
// Version check
$user->add_lang('install');
if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.3.3', '<'))
if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.4.0', '<'))
{
$template->assign_vars(array(
'S_PHP_VERSION_OLD' => true,
'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '<a href="https://www.phpbb.com/community/viewtopic.php?f=14&amp;t=2152375">', '</a>'),
'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], PHP_VERSION, '5.4.0', '<a href="https://www.phpbb.com/support/docs/en/3.2/ug/quickstart/requirements">', '</a>'),
));
}
if ($auth->acl_get('a_board'))
{
/** @var \phpbb\version_helper $version_helper */
$version_helper = $phpbb_container->get('version_helper');
try
{
$recheck = $request->variable('versioncheck_force', false);
$updates_available = $version_helper->get_suggested_updates($recheck);
$updates_available = $version_helper->get_update_on_branch($recheck);
$upgrades_available = $version_helper->get_suggested_updates();
if (!empty($upgrades_available))
{
$upgrades_available = array_pop($upgrades_available);
}
$template->assign_var('S_VERSION_UP_TO_DATE', empty($updates_available));
$template->assign_vars(array(
'S_VERSION_UP_TO_DATE' => empty($updates_available),
'S_VERSION_UPGRADEABLE' => !empty($upgrades_available),
'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false,
));
}
catch (\RuntimeException $e)
{

View File

@ -37,7 +37,12 @@ class acp_update
try
{
$recheck = $request->variable('versioncheck_force', false);
$updates_available = $version_helper->get_suggested_updates($recheck);
$updates_available = $version_helper->get_update_on_branch($recheck);
$upgrades_available = $version_helper->get_suggested_updates();
if (!empty($upgrades_available))
{
$upgrades_available = array_pop($upgrades_available);
}
}
catch (\RuntimeException $e)
{
@ -51,7 +56,7 @@ class acp_update
$template->assign_block_vars('updates_available', $version_data);
}
$update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update');
$update_link = append_sid($phpbb_root_path . 'install/');
$template->assign_vars(array(
'S_UP_TO_DATE' => empty($updates_available),
@ -61,6 +66,8 @@ class acp_update
'CURRENT_VERSION' => $config['version'],
'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $update_link),
'S_VERSION_UPGRADEABLE' => !empty($upgrades_available),
'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false,
));
// Incomplete update?

View File

@ -641,8 +641,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)
*
* @event core.move_posts_before
* @var array post_ids Array of post ids to move
* @var string topic_id The topic id the posts are moved to
* @var bool auto_sync Whether or not to perform auto sync
* @var int topic_id The topic id the posts are moved to
* @var bool auto_sync Whether or not to perform auto sync
* @var array forum_ids Array of the forum ids the posts are moved from
* @var array topic_ids Array of the topic ids the posts are moved from
* @var array forum_row Array with the forum id of the topic the posts are moved to
@ -673,8 +673,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)
*
* @event core.move_posts_after
* @var array post_ids Array of the moved post ids
* @var string topic_id The topic id the posts are moved to
* @var bool auto_sync Whether or not to perform auto sync
* @var int topic_id The topic id the posts are moved to
* @var bool auto_sync Whether or not to perform auto sync
* @var array forum_ids Array of the forum ids the posts are moved from
* @var array topic_ids Array of the topic ids the posts are moved from
* @var array forum_row Array with the forum id of the topic the posts are moved to
@ -698,6 +698,28 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)
sync('topic_attachment', 'topic_id', $topic_ids);
sync('topic', 'topic_id', $topic_ids, true);
sync('forum', 'forum_id', $forum_ids, true, true);
/**
* Perform additional actions after move post sync
*
* @event core.move_posts_sync_after
* @var array post_ids Array of the moved post ids
* @var int topic_id The topic id the posts are moved to
* @var bool auto_sync Whether or not to perform auto sync
* @var array forum_ids Array of the forum ids the posts are moved from
* @var array topic_ids Array of the topic ids the posts are moved from
* @var array forum_row Array with the forum id of the topic the posts are moved to
* @since 3.1.11-RC1
*/
$vars = array(
'post_ids',
'topic_id',
'auto_sync',
'forum_ids',
'topic_ids',
'forum_row',
);
extract($phpbb_dispatcher->trigger_event('core.move_posts_sync_after', compact($vars)));
}
// Update posted information

View File

@ -646,7 +646,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
* @var array row The data of the forum
* @var array subforums_row Template data of subforums
* @since 3.1.0-a1
* @change 3.1.0-b5 Added var subforums_row
* @changed 3.1.0-b5 Added var subforums_row
*/
$vars = array('forum_row', 'row', 'subforums_row');
extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars)));
@ -1554,6 +1554,23 @@ function phpbb_get_user_rank($user_data, $user_posts)
}
}
/**
* Modify a user's rank before displaying
*
* @event core.get_user_rank_after
* @var array user_data Array with user's data
* @var int user_posts User_posts to change
* @var array user_rank_data User rank data
* @since 3.1.11-RC1
*/
$vars = array(
'user_data',
'user_posts',
'user_rank_data',
);
extract($phpbb_dispatcher->trigger_event('core.get_user_rank_after', compact($vars)));
return $user_rank_data;
}

View File

@ -124,7 +124,7 @@ function wrap_img_in_html($src, $title)
*/
function send_file_to_browser($attachment, $upload_dir, $category)
{
global $user, $db, $config, $phpbb_root_path;
global $user, $db, $config, $phpbb_dispatcher, $phpbb_root_path;
$filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_filename'];
@ -149,6 +149,26 @@ function send_file_to_browser($attachment, $upload_dir, $category)
// Now send the File Contents to the Browser
$size = @filesize($filename);
/**
* Event to alter attachment before it is sent to browser.
*
* @event core.send_file_to_browser_before
* @var array attachment Attachment data
* @var string upload_dir Relative path of upload directory
* @var int category Attachment category
* @var string filename Path to file, including filename
* @var int size File size
* @since 3.1.11-RC1
*/
$vars = array(
'attachment',
'upload_dir',
'category',
'filename',
'size',
);
extract($phpbb_dispatcher->trigger_event('core.send_file_to_browser_before', compact($vars)));
// To correctly display further errors we need to make sure we are using the correct headers for both (unsetting content-length may not work)
// Check if headers already sent or not able to get the file contents.

View File

@ -2514,7 +2514,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
* @var string url The "Return to topic" URL
*
* @since 3.1.0-a3
* @change 3.1.0-RC3 Added vars mode, subject, username, topic_type,
* @changed 3.1.0-RC3 Added vars mode, subject, username, topic_type,
* poll, update_message, update_search_index
*/
$vars = array(

View File

@ -276,7 +276,7 @@ function user_add($user_row, $cp_data = false, $notifications_data = null)
* @var array cp_data Array of Custom profile fields submited to user_add
* @var array sql_ary Array of data to be inserted when a user is added
* @since 3.1.0-a1
* @change 3.1.0-b5
* @changed 3.1.0-b5 Added user_row and cp_data
*/
$vars = array('user_row', 'cp_data', 'sql_ary');
extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars)));
@ -1291,7 +1291,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
*/
function user_unban($mode, $ban)
{
global $db, $user, $auth, $cache;
global $db, $user, $auth, $cache, $phpbb_dispatcher;
// Delete stale bans
$sql = 'DELETE FROM ' . BANLIST_TABLE . '
@ -1358,6 +1358,20 @@ function user_unban($mode, $ban)
add_log('user', $user_id, 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list);
}
}
/**
* Use this event to perform actions after the unban has been performed
*
* @event core.user_unban
* @var string mode One of the following: user, ip, email
* @var array user_ids_ary Array with user_ids
* @since 3.1.11-RC1
*/
$vars = array(
'mode',
'user_ids_ary',
);
extract($phpbb_dispatcher->trigger_event('core.user_unban', compact($vars)));
}
$cache->destroy('sql', BANLIST_TABLE);

View File

@ -458,7 +458,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
return;
}
$redirect = request_var('redirect', build_url(array('quickmod')));
$redirect = request_var('redirect', "{$phpbb_root_path}mcp.$phpEx?f=$forum_id&amp;i=main&amp;mode=forum_view");
$s_hidden_fields = build_hidden_fields(array(
'i' => 'main',

View File

@ -164,7 +164,7 @@ class mcp_main
* @var string action Topic quick moderation action name
* @var bool quickmod Flag indicating whether MCP is in quick moderation mode
* @since 3.1.0-a4
* @change 3.1.0-RC4 Added variables: action, quickmod
* @changed 3.1.0-RC4 Added variables: action, quickmod
*/
$vars = array('action', 'quickmod');
extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars)));
@ -463,7 +463,7 @@ function change_topic_type($action, $topic_ids)
*/
function mcp_move_topic($topic_ids)
{
global $auth, $user, $db, $template, $phpbb_log, $request;
global $auth, $user, $db, $template, $phpbb_log, $request, $phpbb_dispatcher;
global $phpEx, $phpbb_root_path;
// Here we limit the operation to one forum only
@ -625,6 +625,18 @@ function mcp_move_topic($topic_ids)
'poll_last_vote' => (int) $row['poll_last_vote']
);
/**
* Perform actions before shadow topic is created.
*
* @event core.mcp_main_modify_shadow_sql
* @var array shadow SQL array to be used by $db->sql_build_array
* @since 3.1.11-RC1
*/
$vars = array(
'shadow',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_shadow_sql', compact($vars)));
$db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow));
// Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts
@ -1281,6 +1293,18 @@ function mcp_fork_topic($topic_ids)
'poll_vote_change' => (int) $topic_row['poll_vote_change'],
);
/**
* Perform actions before forked topic is created.
*
* @event core.mcp_main_modify_fork_sql
* @var array sql_ary SQL array to be used by $db->sql_build_array
* @since 3.1.11-RC1
*/
$vars = array(
'sql_ary',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_fork_sql', compact($vars)));
$db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$new_topic_id = $db->sql_nextid();
$new_topic_id_list[$topic_id] = $new_topic_id;

View File

@ -1171,7 +1171,7 @@ class parse_message extends bbcode_firstpass
* @var bool return Do we return after the event is triggered if $warn_msg is not empty
* @var array warn_msg Array of the warning messages
* @since 3.1.2-RC1
* @change 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid
* @changed 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid
*/
$message = $this->message;
$warn_msg = $this->warn_msg;

View File

@ -397,7 +397,7 @@ function view_folder($id, $mode, $folder_id, $folder)
*/
function get_pm_from($folder_id, $folder, $user_id)
{
global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx;
global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx, $phpbb_dispatcher;
$start = request_var('start', 0);
@ -461,7 +461,7 @@ function get_pm_from($folder_id, $folder, $user_id)
$start = $pagination->validate_start($start, $config['topics_per_page'], $pm_count);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start);
$template->assign_vars(array(
$template_vars = array(
'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count),
'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'),
@ -475,7 +475,33 @@ function get_pm_from($folder_id, $folder, $user_id)
'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose') : '',
'S_PM_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&amp;mode=view&amp;action=view_folder&amp;f=$folder_id" . (($start !== 0) ? "&amp;start=$start" : '')),
));
);
/**
* Modify template variables before they are assigned
*
* @event core.ucp_pm_view_folder_get_pm_from_template
* @var int folder_id Folder ID
* @var array folder Folder data
* @var int user_id User ID
* @var string base_url Pagination base URL
* @var int start Pagination start
* @var int pm_count Count of PMs
* @var array template_vars Template variables to be assigned
* @since 3.1.11-RC1
*/
$vars = array(
'folder_id',
'folder',
'user_id',
'base_url',
'start',
'pm_count',
'template_vars',
);
extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_template', compact($vars)));
$template->assign_vars($template_vars);
// Grab all pm data
$rowset = $pm_list = array();
@ -509,15 +535,38 @@ function get_pm_from($folder_id, $folder, $user_id)
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction;
}
$sql = 'SELECT t.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported
FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u
WHERE t.user_id = $user_id
$sql_ary = array(
'SELECT' => 't.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported',
'FROM' => array(
PRIVMSGS_TO_TABLE => 't',
PRIVMSGS_TABLE => 'p',
USERS_TABLE => 'u',
),
'WHERE' => "t.user_id = $user_id
AND p.author_id = u.user_id
AND $folder_sql
AND t.msg_id = p.msg_id
$sql_limit_time
ORDER BY $sql_sort_order";
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
$sql_limit_time",
'ORDER_BY' => $sql_sort_order,
);
/**
* Modify SQL before it is executed
*
* @event core.ucp_pm_view_folder_get_pm_from_sql
* @var array sql_ary SQL array
* @var int sql_limit SQL limit
* @var int sql_start SQL start
* @since 3.1.11-RC1
*/
$vars = array(
'sql_ary',
'sql_limit',
'sql_start',
);
extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_sql', compact($vars)));
$result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), $sql_limit, $sql_start);
$pm_reported = array();
while ($row = $db->sql_fetchrow($result))

View File

@ -633,10 +633,19 @@ class ucp_profile
'user_avatar_height' => $result['avatar_height'],
);
/**
* Trigger events on successfull avatar change
*
* @event core.ucp_profile_avatar_sql
* @var array result Array with data to be stored in DB
* @since 3.1.11-RC1
*/
$vars = array('result');
extract($phpbb_dispatcher->trigger_event('core.ucp_profile_avatar_sql', compact($vars)));
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $result) . '
WHERE user_id = ' . (int) $user->data['user_id'];
$db->sql_query($sql);
meta_refresh(3, $this->u_action);

View File

@ -45,6 +45,28 @@ class ucp_register
$change_lang = request_var('change_lang', '');
$user_lang = request_var('lang', $user->lang_name);
/**
* Add UCP register data before they are assigned to the template or submitted
*
* To assign data to the template, use $template->assign_vars()
*
* @event core.ucp_register_requests_after
* @var bool coppa Is set coppa
* @var bool agreed Did user agree to coppa?
* @var bool submit Is set post submit?
* @var string change_lang Change language request
* @var string user_lang User language request
* @since 3.1.11-RC1
*/
$vars = array(
'coppa',
'agreed',
'submit',
'change_lang',
'user_lang',
);
extract($phpbb_dispatcher->trigger_event('core.ucp_register_requests_after', compact($vars)));
if ($agreed)
{
add_form_key('ucp_register');

View File

@ -30,7 +30,7 @@ class ucp_remind
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template, $phpbb_container;
global $db, $user, $auth, $template, $phpbb_container, $phpbb_dispatcher;
if (!$config['allow_password_reset'])
{
@ -43,10 +43,30 @@ class ucp_remind
if ($submit)
{
$sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
FROM ' . USERS_TABLE . "
WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
$sql_array = array(
'SELECT' => 'user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason',
'FROM' => array(USERS_TABLE => 'u'),
'WHERE' => "user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"
);
/**
* Change SQL query for fetching user data
*
* @event core.ucp_remind_modify_select_sql
* @var string email User's email from the form
* @var string username User's username from the form
* @var array sql_array Fully assembled SQL query with keys SELECT, FROM, WHERE
* @since 3.1.11-RC1
*/
$vars = array(
'email',
'username',
'sql_array',
);
extract($phpbb_dispatcher->trigger_event('core.ucp_remind_modify_select_sql', compact($vars)));
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

View File

@ -373,7 +373,7 @@ $lang = array_merge($lang, array(
'NUMBER_USERS' => 'Number of users',
'NUMBER_ORPHAN' => 'Orphan attachments',
'PHP_VERSION_OLD' => 'The version of PHP on this server will no longer be supported by future versions of phpBB. %sDetails%s',
'PHP_VERSION_OLD' => 'The version of PHP on this server (%1$s) will no longer be supported by future versions of phpBB. The minimum required version will be PHP %2$s. %3$sDetails%4$s',
'POSTS_PER_DAY' => 'Posts per day',

View File

@ -336,6 +336,7 @@ $lang = array_merge($lang, array(
'INTERESTS' => 'Interests',
'INVALID_DIGEST_CHALLENGE' => 'Invalid digest challenge.',
'INVALID_EMAIL_LOG' => '<strong>%s</strong> possibly an invalid email address?',
'INVALID_FEED_ATTACHMENTS' => 'The selected feed tried fetching attachments with invalid constraints.',
'INVALID_PLURAL_RULE' => 'The chosen plural rule is invalid. Valid values are integers between 0 and 15.',
'IP' => 'IP',
'IP_BLACKLISTED' => 'Your IP %1$s has been blocked because it is blacklisted. For details please see <a href="%2$s">%2$s</a>.',

View File

@ -574,6 +574,7 @@ $lang = array_merge($lang, array(
'UPDATING_DATA' => 'Updating data',
'UPDATING_TO_LATEST_STABLE' => 'Updating database to latest stable release',
'UPDATED_VERSION' => 'Updated version',
'UPGRADE_INSTRUCTIONS' => 'A new feature release <strong>%1$s</strong> is available. Please read <a href="%2$s" title="%2$s"><strong>the release announcement</strong></a> to learn about what it has to offer, and how to upgrade.',
'UPLOAD_METHOD' => 'Upload method',
'UPDATE_DB_SUCCESS' => 'Database update was successful.',

View File

@ -514,7 +514,7 @@ class auth
*/
function acl_clear_prefetch($user_id = false)
{
global $db, $cache;
global $db, $cache, $phpbb_dispatcher;
// Rebuild options cache
$cache->destroy('_role_cache');
@ -553,6 +553,16 @@ class auth
$where_sql";
$db->sql_query($sql);
/**
* Event is triggered after user(s) permission settings cache has been cleared
*
* @event core.acl_clear_prefetch_after
* @var mixed user_id User ID(s)
* @since 3.1.11-RC1
*/
$vars = array('user_id');
extract($phpbb_dispatcher->trigger_event('core.acl_clear_prefetch_after', compact($vars)));
return;
}

View File

@ -601,6 +601,6 @@ class file extends \phpbb\cache\driver\base
*/
protected function clean_varname($varname)
{
return str_replace('/', '-', $varname);
return str_replace(array('/', '\\'), '-', $varname);
}
}

View File

@ -52,6 +52,7 @@ class notification_options_reconvert extends \phpbb\db\migration\migration
{
$limit = 250;
$converted_users = 0;
$start = $start ?: 0;
$sql = 'SELECT user_id, user_notify_type, user_notify_pm
FROM ' . $this->table_prefix . 'users

View File

@ -0,0 +1,46 @@
<?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\v31x;
class increase_size_of_emotion extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v31x\v3110',
);
}
public function update_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'smilies' => array(
'emotion' => array('VCHAR_UNI', ''),
),
),
);
}
public function revert_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'smilies' => array(
'emotion' => array('VCHAR_UNI:50', ''),
),
),
);
}
}

View File

@ -191,6 +191,7 @@ abstract class profilefield_base_migration extends container_aware_migration
$insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->table_prefix . 'profile_fields_data');
$limit = 250;
$converted_users = 0;
$start = $start ?: 0;
$sql = 'SELECT user_id, ' . $this->user_column_name . '
FROM ' . $this->table_prefix . 'users

View File

@ -185,6 +185,7 @@ class container_builder
}
$this->container->set('config.php', $this->config_php_file);
$this->inject_dbal_driver();
if ($this->compile_container)
{
@ -303,6 +304,18 @@ class container_builder
}
}
/**
* Inject the dbal connection driver into container
*/
protected function inject_dbal_driver()
{
$config_data = $this->config_php_file->get_all();
if (!empty($config_data))
{
$this->container->set('dbal.conn.driver', $this->get_dbal_connection());
}
}
/**
* Get DB connection.
*
@ -320,6 +333,7 @@ class container_builder
$this->config_php_file->get('dbpasswd'),
$this->config_php_file->get('dbname'),
$this->config_php_file->get('dbport'),
false,
defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK
);
}

View File

@ -43,12 +43,6 @@ class config extends Extension
'core.adm_relative_path' => $this->config_php->get('phpbb_adm_relative_path') ? $this->config_php->get('phpbb_adm_relative_path') : 'adm/',
'core.table_prefix' => $this->config_php->get('table_prefix'),
'cache.driver.class' => $this->convert_30_acm_type($this->config_php->get('acm_type')),
'dbal.driver.class' => $this->config_php->convert_30_dbms_to_31($this->config_php->get('dbms')),
'dbal.dbhost' => $this->config_php->get('dbhost'),
'dbal.dbuser' => $this->config_php->get('dbuser'),
'dbal.dbpasswd' => $this->config_php->get('dbpasswd'),
'dbal.dbname' => $this->config_php->get('dbname'),
'dbal.dbport' => $this->config_php->get('dbport'),
'dbal.new_link' => defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK,
);
$parameter_bag = $container->getParameterBag();

View File

@ -510,7 +510,7 @@ class php_exporter
/**
* Find the "@changed" Information lines
*
* @param string $tag_name Should be 'changed' or 'change'
* @param string $tag_name Should be 'change', not 'changed'
* @return array Absolute line numbers
* @throws \LogicException
*/
@ -658,7 +658,7 @@ class php_exporter
{
$match = array();
$line = str_replace("\t", ' ', ltrim($line, "\t "));
preg_match('#^\* @change(d)? (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match);
preg_match('#^\* @changed (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match);
if (!isset($match[2]))
{
throw new \LogicException("Invalid '@changed' information for event "

View File

@ -25,8 +25,11 @@ abstract class attachments_base extends \phpbb\feed\base
/**
* Retrieve the list of attachments that may be displayed
*
* @param array $post_ids Specify for which post IDs to fetch the attachments (optional)
* @param array $topic_ids Specify for which topic IDs to fetch the attachments (optional)
*/
protected function fetch_attachments()
protected function fetch_attachments($post_ids = array(), $topic_ids = array())
{
$sql_array = array(
'SELECT' => 'a.*',
@ -37,7 +40,20 @@ abstract class attachments_base extends \phpbb\feed\base
'ORDER_BY' => 'a.filetime DESC, a.post_msg_id ASC',
);
if (isset($this->topic_id))
if (!empty($post_ids))
{
$sql_array['WHERE'] .= 'AND ' . $this->db->sql_in_set('a.post_msg_id', $post_ids);
}
else if (!empty($topic_ids))
{
if (isset($this->topic_id))
{
$topic_ids[] = $this->topic_id;
}
$sql_array['WHERE'] .= 'AND ' . $this->db->sql_in_set('a.topic_id', $topic_ids);
}
else if (isset($this->topic_id))
{
$sql_array['WHERE'] .= 'AND a.topic_id = ' . (int) $this->topic_id;
}
@ -51,6 +67,11 @@ abstract class attachments_base extends \phpbb\feed\base
);
$sql_array['WHERE'] .= 'AND t.forum_id = ' . (int) $this->forum_id;
}
else
{
// Do not allow querying the full attachments table
throw new \RuntimeException($this->user->lang('INVALID_FEED_ATTACHMENTS'));
}
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql);
@ -63,15 +84,6 @@ abstract class attachments_base extends \phpbb\feed\base
$this->db->sql_freeresult($result);
}
/**
* {@inheritDoc}
*/
public function open()
{
parent::open();
$this->fetch_attachments();
}
/**
* Get attachments related to a given post
*

View File

@ -112,6 +112,8 @@ class forum extends \phpbb\feed\post_base
return false;
}
parent::fetch_attachments(array(), $topic_ids);
$this->sql = array(
'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' .
'u.username, u.user_id',

View File

@ -83,6 +83,8 @@ class news extends \phpbb\feed\topic_base
return false;
}
parent::fetch_attachments($post_ids);
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name,
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time,

View File

@ -52,6 +52,8 @@ class overall extends \phpbb\feed\post_base
return false;
}
parent::fetch_attachments(array(), $topic_ids);
// Get the actual data
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name, ' .

View File

@ -91,6 +91,8 @@ class topic extends \phpbb\feed\post_base
function get_sql()
{
parent::fetch_attachments();
$this->sql = array(
'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' .
'u.username, u.user_id',

View File

@ -55,6 +55,8 @@ class topics extends \phpbb\feed\topic_base
return false;
}
parent::fetch_attachments($post_ids);
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name,
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time,

View File

@ -71,6 +71,8 @@ class topics_active extends \phpbb\feed\topic_base
return false;
}
parent::fetch_attachments($post_ids);
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name,
t.topic_id, t.topic_title, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views,

View File

@ -141,6 +141,8 @@ class report_pm extends \phpbb\notification\type\pm
*/
public function get_email_template_variables()
{
$user_data = $this->user_loader->get_user($this->get_data('reporter_id'));
return array(
'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']),
'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))),

View File

@ -266,7 +266,7 @@ class plupload
if ($this->config['img_max_height'] > 0 && $this->config['img_max_width'] > 0)
{
$resize = sprintf(
'resize: {width: %d, height: %d, quality: 100},',
'resize: {width: %d, height: %d, quality: 85},',
(int) $this->config['img_max_width'],
(int) $this->config['img_max_height']
);

View File

@ -133,6 +133,14 @@ interface type_interface
*/
public function get_field_ident($field_data);
/**
* Get the localized name of the field
*
* @param string $field_name Unlocalized name of this field
* @return string Localized name of the field
*/
public function get_field_name($field_name);
/**
* Get the column type for the database
*

View File

@ -942,38 +942,45 @@ class fulltext_mysql extends \phpbb\search\base
$this->get_stats();
}
$alter = array();
$alter_list = array();
if (!isset($this->stats['post_subject']))
{
$alter_entry = array();
if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
{
$alter[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL';
$alter_entry[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL';
}
else
{
$alter[] = 'MODIFY post_subject text NOT NULL';
$alter_entry[] = 'MODIFY post_subject text NOT NULL';
}
$alter[] = 'ADD FULLTEXT (post_subject)';
$alter_entry[] = 'ADD FULLTEXT (post_subject)';
$alter_list[] = $alter_entry;
}
if (!isset($this->stats['post_content']))
{
$alter_entry = array();
if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
{
$alter[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL';
$alter_entry[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL';
}
else
{
$alter[] = 'MODIFY post_text mediumtext NOT NULL';
$alter_entry[] = 'MODIFY post_text mediumtext NOT NULL';
}
$alter[] = 'ADD FULLTEXT post_content (post_text, post_subject)';
$alter_entry[] = 'ADD FULLTEXT post_content (post_text, post_subject)';
$alter_list[] = $alter_entry;
}
if (sizeof($alter))
if (sizeof($alter_list))
{
$this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));
foreach ($alter_list as $alter)
{
$this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));
}
}
$this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);

View File

@ -365,15 +365,15 @@ class context
if ($mode == 'insert')
{
// Make sure we are not exceeding the last iteration
if ($key >= sizeof($this->tpldata[$blockname]))
if ($key >= sizeof($block))
{
$key = sizeof($this->tpldata[$blockname]);
unset($this->tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
$key = sizeof($block);
unset($block[($key - 1)]['S_LAST_ROW']);
$vararray['S_LAST_ROW'] = true;
}
else if ($key === 0)
{
unset($this->tpldata[$blockname][0]['S_FIRST_ROW']);
unset($block[0]['S_FIRST_ROW']);
$vararray['S_FIRST_ROW'] = true;
}

View File

@ -169,8 +169,7 @@ class extension extends \Twig_Extension
$args = func_get_args();
$key = $args[0];
$context = $this->context->get_data_ref();
$context_vars = $context['.'][0];
$context_vars = $this->context->get_root_ref();
if (isset($context_vars['L_' . $key]))
{

View File

@ -200,6 +200,49 @@ class version_helper
});
}
/**
* Gets the latest update for the current branch the user is on
* Will suggest versions from newer branches when EoL has been reached
* and/or version from newer branch is needed for having all known security
* issues fixed.
*
* @param bool $force_update Ignores cached data. Defaults to false.
* @param bool $force_cache Force the use of the cache. Override $force_update.
* @return array Version info or empty array if there are no updates
* @throws \RuntimeException
*/
public function get_update_on_branch($force_update = false, $force_cache = false)
{
$versions = $this->get_versions_matching_stability($force_update, $force_cache);
$self = $this;
$current_version = $this->current_version;
// Filter out any versions less than to the current version
$versions = array_filter($versions, function($data) use ($self, $current_version) {
return $self->compare($data['current'], $current_version, '>=');
});
// Get the lowest version from the previous list.
$update_info = array_reduce($versions, function($value, $data) use ($self, $current_version) {
if ($value === null && $self->compare($data['current'], $current_version, '>='))
{
if (!$data['eol'] && (!$data['security'] || $self->compare($data['security'], $data['current'], '<=')))
{
return ($self->compare($data['current'], $current_version, '>')) ? $data : array();
}
else
{
return null;
}
}
return $value;
});
return $update_info === null ? array() : $update_info;
}
/**
* Obtains the latest version information
*

View File

@ -84,7 +84,7 @@ $current_time = time();
* NOTE: Should be actual language strings, NOT
* language keys.
* @since 3.1.0-a1
* @change 3.1.2-RC1 Removed 'delete' var as it does not exist
* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist
*/
$vars = array(
'post_id',
@ -941,7 +941,9 @@ if ($submit || $preview || $refresh)
* is posting a new topic or editing a post)
* @var bool refresh Whether or not to retain previously submitted data
* @var object message_parser The message parser object
* @var array error Array of errors
* @since 3.1.2-RC1
* @changed 3.1.11-RC1 Added error
*/
$vars = array(
'post_data',
@ -956,6 +958,7 @@ if ($submit || $preview || $refresh)
'cancel',
'refresh',
'message_parser',
'error',
);
extract($phpbb_dispatcher->trigger_event('core.posting_modify_message_text', compact($vars)));
@ -1261,7 +1264,7 @@ if ($submit || $preview || $refresh)
* @var array error Any error strings; a non-empty array aborts form submission.
* NOTE: Should be actual language strings, NOT language keys.
* @since 3.1.0-RC5
* @change 3.1.5-RC1 Added poll array to the event
* @changed 3.1.5-RC1 Added poll array to the event
*/
$vars = array(
'post_data',
@ -1869,13 +1872,13 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_
* posting page via $template->assign_vars()
* @var object message_parser The message parser object
* @since 3.1.0-a1
* @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title,
* @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title,
* s_topic_icons, form_enctype, s_action, s_hidden_fields,
* post_id, topic_id, forum_id, submit, preview, save, load,
* delete, cancel, refresh, error, page_data, message_parser
* @change 3.1.2-RC1 Removed 'delete' var as it does not exist
* @change 3.1.5-RC1 Added poll variables to the page_data array
* @change 3.1.6-RC1 Added 'draft_id' var
* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist
* @changed 3.1.5-RC1 Added poll variables to the page_data array
* @changed 3.1.6-RC1 Added 'draft_id' var
*/
$vars = array(
'post_data',

View File

@ -132,9 +132,10 @@ phpbb.markNotifications = function($popup, unreadCount) {
// Update the unread count.
$('strong', '#notification_list_button').html(unreadCount);
// Remove the Mark all read link & notification count if there are no unread notifications.
// Remove the Mark all read link and hide notification count if there are no unread notifications.
if (!unreadCount) {
$('#mark_all_notifications, #notification_list_button > strong').remove();
$('#mark_all_notifications').remove();
$('#notification_list_button > strong').addClass('hidden');
}
// Update page title

View File

@ -57,7 +57,7 @@ function marklist(id, name, state) {
jQuery('#' + id + ' input[type=checkbox][name]').each(function() {
var $this = jQuery(this);
if ($this.attr('name').substr(0, name.length) === name) {
if ($this.attr('name').substr(0, name.length) === name && !$this.prop('disabled')) {
$this.prop('checked', state);
}
});

View File

@ -138,6 +138,7 @@
<option value="make_announce">{L_MAKE_ANNOUNCE}</option>
<option value="make_global">{L_MAKE_GLOBAL}</option>
<!-- ENDIF -->
<!-- EVENT mcp_forum_actions_append -->
</select>
<input class="button2" type="submit" value="{L_SUBMIT}" />
<div><a href="#" onclick="marklist('mcp', 'topic_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'topic_id_list', false); return false;">{L_UNMARK_ALL}</a></div>

View File

@ -19,7 +19,7 @@
<tbody>
<!-- BEGIN user -->
<tr class="<!-- IF group.user.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF group.user.S_INACTIVE --> inactive<!-- ENDIF -->">
<td><!-- IF group.user.RANK_IMG --><span class="rank-img">{group.user.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{group.user.RANK_TITLE}</span><!-- ENDIF -->{group.user.USERNAME_FULL}<!-- IF group.user.S_INACTIVE --> ({L_INACTIVE})<!-- ENDIF --></td>
<td><!-- IF group.user.RANK_IMG --><span class="rank-img">{group.user.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{group.user.RANK_TITLE}</span><!-- ENDIF --><!-- EVENT memberlist_team_username_prepend -->{group.user.USERNAME_FULL}<!-- IF group.user.S_INACTIVE --> ({L_INACTIVE})<!-- ENDIF --><!-- EVENT memberlist_team_username_append --></td>
<td class="info"><!-- IF group.user.U_GROUP -->
<a<!-- IF group.user.GROUP_COLOR --> style="font-weight: bold; color: #{group.user.GROUP_COLOR}"<!-- ENDIF --> href="{group.user.U_GROUP}">{group.user.GROUP_NAME}</a>
<!-- ELSE -->

View File

@ -72,12 +72,12 @@
</li>
<!-- IF S_DISPLAY_PM -->
<li class="small-icon icon-pm rightside" data-skip-responsive="true">
<a href="{U_PRIVATEMSGS}" role="menuitem"><span>{L_PRIVATE_MESSAGES} </span><!-- IF PRIVATE_MESSAGE_COUNT --><strong class="badge">{PRIVATE_MESSAGE_COUNT}</strong><!-- ENDIF --></a>
<a href="{U_PRIVATEMSGS}" role="menuitem"><span>{L_PRIVATE_MESSAGES} </span><strong class="badge<!-- IF not PRIVATE_MESSAGE_COUNT --> hidden<!-- ENDIF -->">{PRIVATE_MESSAGE_COUNT}</strong></a>
</li>
<!-- ENDIF -->
<!-- IF S_NOTIFICATIONS_DISPLAY -->
<li class="small-icon icon-notification dropdown-container dropdown-{S_CONTENT_FLOW_END} rightside" data-skip-responsive="true">
<a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger"><span>{L_NOTIFICATIONS} </span><!-- IF NOTIFICATIONS_COUNT --><strong class="badge">{NOTIFICATIONS_COUNT}</strong><!-- ENDIF --></a>
<a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger"><span>{L_NOTIFICATIONS} </span><strong class="badge<!-- IF not NOTIFICATIONS_COUNT --> hidden<!-- ENDIF -->">{NOTIFICATIONS_COUNT}</strong></a>
<!-- INCLUDE notification_dropdown.html -->
</li>
<!-- ENDIF -->

View File

@ -76,6 +76,7 @@
<!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --><a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a> <!-- ENDIF -->
<!-- IF searchresults.S_TOPIC_DELETED --><a href="{searchresults.U_MCP_QUEUE}">{DELETED_IMG}</a> <!-- ENDIF -->
<!-- IF searchresults.S_TOPIC_REPORTED --><a href="{searchresults.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br />
<!-- EVENT topiclist_row_topic_title_after -->
<!-- IF .searchresults.pagination -->
<div class="pagination">
<ul>
@ -91,7 +92,6 @@
</div>
<!-- ENDIF -->
<!-- IF searchresults.S_HAS_POLL -->{POLL_IMG} <!-- ENDIF -->
<!-- EVENT topiclist_row_topic_title_after -->
{L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} &raquo; {searchresults.FIRST_POST_TIME} &raquo; {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a>
<!-- EVENT topiclist_row_append -->

View File

@ -55,12 +55,14 @@
<!-- EVENT ucp_main_front_user_activity_before -->
<dl class="details">
<!-- EVENT ucp_main_front_user_activity_prepend -->
<dt>{L_JOINED}{L_COLON}</dt> <dd>{JOINED}</dd>
<dt>{L_LAST_ACTIVE}{L_COLON}</dt> <dd>{LAST_VISIT_YOU}</dd>
<dt>{L_TOTAL_POSTS}{L_COLON}</dt> <dd><!-- IF POSTS_PCT -->{POSTS}<!-- IF S_DISPLAY_SEARCH --> | <strong><a href="{U_SEARCH_USER}">{L_SEARCH_YOUR_POSTS}</a></strong><!-- ENDIF --><br />({POSTS_DAY} / {POSTS_PCT})<!-- ELSE -->{POSTS}<!-- ENDIF --></dd>
<!-- IF ACTIVE_FORUM != '' --><dt>{L_ACTIVE_IN_FORUM}{L_COLON}</dt> <dd><strong><a href="{U_ACTIVE_FORUM}">{ACTIVE_FORUM}</a></strong><br />({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})</dd><!-- ENDIF -->
<!-- IF ACTIVE_TOPIC != '' --><dt>{L_ACTIVE_IN_TOPIC}{L_COLON}</dt> <dd><strong><a href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></strong><br />({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})</dd><!-- ENDIF -->
<!-- IF WARNINGS --><dt>{L_YOUR_WARNINGS}{L_COLON}</dt> <dd class="error">{WARNING_IMG} [{WARNINGS}]</dd><!-- ENDIF -->
<!-- EVENT ucp_main_front_user_activity_append -->
</dl>
<!-- EVENT ucp_main_front_user_activity_after -->

View File

@ -146,6 +146,7 @@
</div>
</div>
<!-- EVENT ucp_pm_viewmessage_options_before -->
<!-- IF S_VIEW_MESSAGE -->
<fieldset class="display-options">
<!-- IF U_PREVIOUS_PM --><a href="{U_PREVIOUS_PM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_VIEW_PREVIOUS_PM}</a><!-- ENDIF -->

View File

@ -79,8 +79,6 @@
<!-- ENDIF -->
<!-- IF S_COPPA -->
<div class="panel">
<div class="inner">
@ -91,6 +89,8 @@
</div>
<!-- ENDIF -->
<!-- EVENT ucp_register_buttons_before -->
<div class="panel">
<div class="inner">

View File

@ -1269,6 +1269,10 @@ ul.linklist:after,
padding: 4px 6px;
}
.badge.hidden {
display: none;
}
/* Navbar specific list items
----------------------------------------*/

View File

@ -493,6 +493,8 @@ blockquote.uncited {
padding: 3px;
border: 1px solid transparent;
font-size: 1em;
overflow-x: scroll;
word-wrap: normal;
}
.codebox p {
@ -515,7 +517,7 @@ blockquote .codebox {
max-height: 200px;
white-space: normal;
padding-top: 5px;
font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono;
font: 0.9em Monaco, "Andale Mono","Courier New", Courier, monospace;
line-height: 1.3em;
margin: 2px 0;
}

View File

@ -77,6 +77,7 @@
<option value="make_announce">{L_MAKE_ANNOUNCE}</option>
<option value="make_global">{L_MAKE_GLOBAL}</option>
<!-- ENDIF -->
<!-- EVENT mcp_forum_actions_append -->
</select>
<input class="btnmain" type="submit" value="{L_SUBMIT}" />
</td>

View File

@ -54,7 +54,7 @@
for (var r = 0; r < rb.length; r++)
{
if (rb[r].name.substr(0, name.length) == name)
if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true)
{
rb[r].checked = state;
}

View File

@ -17,7 +17,7 @@
<!-- BEGIN user -->
<!-- IF group.user.S_ROW_COUNT is even --><tr class="row2"><!-- ELSE --><tr class="row1"><!-- ENDIF -->
<td class="gen" align="center"><strong>{group.user.USERNAME_FULL}</strong><!-- IF group.user.S_INACTIVE --> <em>({L_INACTIVE})</em><!-- ENDIF --></td>
<td class="gen" align="center"><!-- EVENT memberlist_team_username_prepend --><strong>{group.user.USERNAME_FULL}</strong><!-- IF group.user.S_INACTIVE --> <em>({L_INACTIVE})</em><!-- ENDIF --><!-- EVENT memberlist_team_username_append --></td>
<!-- IF S_DISPLAY_MODERATOR_FORUMS --><td class="gensmall" align="center"><!-- IF group.user.FORUM_OPTIONS --><select style="width: 100%;">{group.user.FORUMS}</select><!-- ELSEIF group.user.FORUMS -->{group.user.FORUMS}<!-- ELSE -->-<!-- ENDIF --></td><!-- ENDIF -->
<td class="gensmall" align="center" nowrap="nowrap">&nbsp;
<!-- IF group.user.U_GROUP -->

View File

@ -83,7 +83,7 @@ function marklist(id, name, state)
for (var r = 0; r < rb.length; r++)
{
if (rb[r].name.substr(0, name.length) == name)
if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true)
{
rb[r].checked = state;
}

View File

@ -38,6 +38,7 @@
<!-- EVENT ucp_main_front_user_activity_before -->
<td class="row1" colspan="3">
<table width="100%" cellspacing="1" cellpadding="4">
<!-- EVENT ucp_main_front_user_activity_prepend -->
<tr>
<td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="genmed">{L_JOINED}{L_COLON} </b></td>
<td width="100%"><b class="gen">{JOINED}</b></td>
@ -62,6 +63,7 @@
<td class="genmed">{WARNING_IMG} [ <b>{WARNINGS}</b> ]</td>
</tr>
<!-- ENDIF -->
<!-- EVENT ucp_main_front_user_activity_append -->
</table>
</td>
<!-- EVENT ucp_main_front_user_activity_after -->

View File

@ -91,6 +91,8 @@
</tr>
<!-- ENDIF -->
<!-- EVENT ucp_register_buttons_before -->
<tr>
<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" id="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td>
</tr>

View File

@ -431,9 +431,9 @@ $sql_array = array(
* Author, Post time, Replies, Subject, Views
* @var string sort_dir Either "a" for ascending or "d" for descending
* @since 3.1.0-a1
* @change 3.1.0-RC4 Added forum_data var
* @change 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars
* @change 3.1.9-RC1 Fix types of properties
* @changed 3.1.0-RC4 Added forum_data var
* @changed 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars
* @changed 3.1.9-RC1 Fix types of properties
*/
$vars = array(
'forum_data',
@ -782,9 +782,11 @@ $topic_tracking_info = $tracking_topics = array();
* @var array topic_list Array with current viewforum page topic ids
* @var array rowset Array with topics data (in topic_id => topic_data format)
* @var int total_topic_count Forum's total topic count
* @var int forum_id Forum identifier
* @since 3.1.0-b3
* @changed 3.1.11-RC1 Added forum_id
*/
$vars = array('topic_list', 'rowset', 'total_topic_count');
$vars = array('topic_list', 'rowset', 'total_topic_count', 'forum_id');
extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topics_data', compact($vars)));
// Okay, lets dump out the page ...

View File

@ -168,7 +168,7 @@ $sql_ary = array(
* @var int guest_counter Number of guests displayed
* @var array forum_data Array with forum data
* @since 3.1.0-a1
* @change 3.1.0-a2 Added vars guest_counter and forum_data
* @changed 3.1.0-a2 Added vars guest_counter and forum_data
*/
$vars = array('sql_ary', 'show_guests', 'guest_counter', 'forum_data');
extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_sql', compact($vars)));
@ -385,7 +385,7 @@ while ($row = $db->sql_fetchrow($result))
* @var string location_url Page url to displayed in the list
* @var array forum_data Array with forum data
* @since 3.1.0-a1
* @change 3.1.0-a2 Added var forum_data
* @changed 3.1.0-a2 Added var forum_data
*/
$vars = array('on_page', 'row', 'location', 'location_url', 'forum_data');
extract($phpbb_dispatcher->trigger_event('core.viewonline_overwrite_location', compact($vars)));

View File

@ -700,7 +700,7 @@ $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=
* @var int total_posts Topic total posts count
* @var string viewtopic_url URL to the topic page
* @since 3.1.0-RC4
* @change 3.1.2-RC1 Added viewtopic_url
* @changed 3.1.2-RC1 Added viewtopic_url
*/
$vars = array(
'base_url',
@ -1200,7 +1200,7 @@ $sql_ary = array(
* @var int start Pagination information
* @var array sql_ary The SQL array to get the data of posts and posters
* @since 3.1.0-a1
* @change 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start
* @changed 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start
*/
$vars = array(
'forum_id',
@ -1316,7 +1316,6 @@ while ($row = $db->sql_fetchrow($result))
'rank_title' => '',
'rank_image' => '',
'rank_image_src' => '',
'sig' => '',
'pm' => '',
'email' => '',
'jabber' => '',
@ -2008,9 +2007,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
* @var array post_row Template block array of the post
* @var array topic_data Array with topic data
* @since 3.1.0-a1
* @change 3.1.0-a3 Added vars start, current_row_number, end, attachments
* @change 3.1.0-b3 Added topic_data array, total_posts
* @change 3.1.0-RC3 Added poster_id
* @changed 3.1.0-a3 Added vars start, current_row_number, end, attachments
* @changed 3.1.0-b3 Added topic_data array, total_posts
* @changed 3.1.0-RC3 Added poster_id
*/
$vars = array(
'start',
@ -2108,7 +2107,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
* @var array post_row Template block array of the post
* @var array topic_data Array with topic data
* @since 3.1.0-a3
* @change 3.1.0-b3 Added topic_data array, total_posts
* @changed 3.1.0-b3 Added topic_data array, total_posts
*/
$vars = array(
'start',
@ -2271,7 +2270,7 @@ $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang
* @var int start Start offset used to calculate the page
* @var array post_list Array with post_ids we are going to display
* @since 3.1.0-a1
* @change 3.1.0-RC4 Added post_list var
* @changed 3.1.0-RC4 Added post_list var
*/
$vars = array('page_title', 'topic_data', 'forum_id', 'start', 'post_list');
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars)));

View File

@ -53,7 +53,7 @@ namespace
$this->assertTrue($container->isFrozen());
// Checks inject_config
$this->assertTrue($container->hasParameter('dbal.dbhost'));
$this->assertTrue($container->hasParameter('core.table_prefix'));
// Checks use_extensions
$this->assertTrue($container->hasParameter('enabled'));

View File

@ -10,5 +10,8 @@ services:
arguments:
- @service_container
dbal.conn.driver:
synthetic: true
dispatcher:
class: phpbb\db\driver\container_mock

View File

@ -10,5 +10,8 @@ services:
arguments:
- @service_container
dbal.conn.driver:
synthetic: true
dispatcher:
class: phpbb\db\driver\container_mock

View File

@ -34,7 +34,7 @@
* posting page via $template->assign_vars()
* @var object message_parser The message parser object
* @since 3.1.0-a1
* @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title,
* @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title,
* s_topic_icons, form_enctype, s_action, s_hidden_fields,
* post_id, topic_id, forum_id, submit, preview, save, load,
* delete, cancel, refresh, error, page_data, message_parser

View File

@ -0,0 +1,94 @@
<?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__) . '/attachments_mock_feed.php');
class phpbb_feed_attachments_base_test extends phpbb_database_test_case
{
protected $filesystem;
/** @var \phpbb_feed_attachments_mock_feed */
protected $attachments_mocks_feed;
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__) . '/../extension/fixtures/extensions.xml');
}
public function setUp()
{
global $phpbb_root_path, $phpEx;
$this->filesystem = new \phpbb\filesystem();
$config = new \phpbb\config\config(array());
$user = new \phpbb\user('\phpbb\datetime');
$feed_helper = new \phpbb\feed\helper($config, $user, $phpbb_root_path, $phpEx);
$db = $this->new_dbal();
$cache = new \phpbb_mock_cache();
$auth = new \phpbb\auth\auth();
$content_visibility = new \phpbb\content_visibility(
$auth,
$config,
new \phpbb_mock_event_dispatcher(),
$db,
$user,
$phpbb_root_path,
$phpEx,
FORUMS_TABLE,
POSTS_TABLE,
TOPICS_TABLE,
USERS_TABLE
);
$this->attachments_mocks_feed = new \phpbb_feed_attachments_mock_feed(
$feed_helper,
$config,
$db,
$cache,
$user,
$auth,
$content_visibility,
new \phpbb_mock_event_dispatcher(),
$phpEx
);
}
public function data_fetch_attachments()
{
return array(
array(array(0), array(0)),
array(array(), array(1)),
array(array(), array(), 'RuntimeException')
);
}
/**
* @dataProvider data_fetch_attachments
*/
public function test_fetch_attachments($post_ids, $topic_ids, $expected_exception = false)
{
$this->attachments_mocks_feed->post_ids = $post_ids;
$this->attachments_mocks_feed->topic_ids = $topic_ids;
if ($expected_exception !== false)
{
$this->setExpectedException($expected_exception);
$this->attachments_mocks_feed->get_sql();
}
else
{
$this->assertTrue($this->attachments_mocks_feed->get_sql());
}
}
}

View File

@ -0,0 +1,31 @@
<?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.
*
*/
/**
* Board wide feed (aka overall feed)
*
* This will give you the newest {$this->num_items} posts
* from the whole board.
*/
class phpbb_feed_attachments_mock_feed extends \phpbb\feed\attachments_base
{
public $topic_ids = array();
public $post_ids = array();
function get_sql()
{
parent::fetch_attachments($this->post_ids, $this->topic_ids);
return true;
}
}

View File

@ -82,6 +82,7 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case
// Get form token
$link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri();
$crawler = self::request('GET', substr($link, strpos($link, 'ucp.')));
$this->assertCount(0, $crawler->filter('#notification_list_button strong'));
$this->assertCount(1, $crawler->filter('#notification_list_button strong.badge.hidden'));
$this->assertEquals("0", $crawler->filter('#notification_list_button strong.badge.hidden')->text());
}
}

View File

@ -24,7 +24,7 @@ class phpbb_plupload_test extends phpbb_test_case
array(
130,
150,
'resize: {width: 130, height: 150, quality: 100},'
'resize: {width: 130, height: 150, quality: 85},'
),
);
}

View File

@ -332,4 +332,204 @@ class phpbb_version_helper_test extends phpbb_test_case
$this->assertSame($expected, $version_helper->get_latest_on_current_branch());
}
public function get_update_on_branch_data()
{
return array(
array(
'1.0.0',
array(
'1.0' => array(
'current' => '1.0.1',
),
'1.1' => array(
'current' => '1.1.1',
),
),
array(
'current' => '1.0.1',
),
),
array(
'1.0.1',
array(
'1.0' => array(
'current' => '1.0.1',
),
'1.1' => array(
'current' => '1.1.1',
),
),
array(),
),
array(
'1.0.1-a1',
array(
'1.0' => array(
'current' => '1.0.1-a2',
),
'1.1' => array(
'current' => '1.1.0',
),
),
array(
'current' => '1.0.1-a2',
),
),
array(
'1.1.0',
array(
'1.0' => array(
'current' => '1.0.1',
),
'1.1' => array(
'current' => '1.1.1',
),
),
array(
'current' => '1.1.1',
),
),
array(
'1.1.1',
array(
'1.0' => array(
'current' => '1.0.1',
),
'1.1' => array(
'current' => '1.1.1',
),
),
array(),
),
array(
'1.1.0-a1',
array(
'1.0' => array(
'current' => '1.0.1',
),
'1.1' => array(
'current' => '1.1.0-a2',
),
),
array(
'current' => '1.1.0-a2',
),
),
array(
'1.1.0',
array(),
array(),
),
// Latest safe release is 1.0.1
array(
'1.0.0',
array(
'1.0' => array(
'current' => '1.0.1',
'security' => '1.0.1',
),
'1.1' => array(
'current' => '1.1.1',
),
),
array(
'current' => '1.0.1',
'security' => '1.0.1',
),
),
// Latest safe release is 1.0.0
array(
'1.0.0',
array(
'1.0' => array(
'current' => '1.0.1',
'security' => '1.0.0',
),
'1.1' => array(
'current' => '1.1.1',
),
),
array(
'current' => '1.0.1',
'security' => '1.0.0',
),
),
// Latest safe release is 1.1.0
array(
'1.0.0',
array(
'1.0' => array(
'current' => '1.0.1',
'security' => '1.1.0',
),
'1.1' => array(
'current' => '1.1.1',
),
),
array(
'current' => '1.1.1',
),
),
// Latest 1.0 release is EOL
array(
'1.0.0',
array(
'1.0' => array(
'current' => '1.0.1',
'eol' => true,
),
'1.1' => array(
'current' => '1.1.1',
),
),
array(
'current' => '1.1.1',
),
),
// All are EOL -- somewhat undefined behavior
array(
'1.0.0',
array(
'1.0' => array(
'current' => '1.0.1',
'eol' => true,
),
'1.1' => array(
'current' => '1.1.1',
'eol' => true,
),
),
array(),
),
);
}
/**
* @dataProvider get_update_on_branch_data
*/
public function test_get_update_on_branch($current_version, $versions, $expected)
{
$version_helper = $this
->getMockBuilder('\phpbb\version_helper')
->setMethods(array(
'get_versions_matching_stability',
))
->setConstructorArgs(array(
$this->cache,
new \phpbb\config\config(array(
'version' => $current_version,
)),
new \phpbb\file_downloader(),
new \phpbb\user('\phpbb\datetime'),
))
->getMock()
;
$version_helper->expects($this->any())
->method('get_versions_matching_stability')
->will($this->returnValue($versions));
$this->assertSame($expected, $version_helper->get_update_on_branch());
}
}