Merge branch 'master' into ticket/12629

This commit is contained in:
Marc Alexander 2018-10-26 10:16:04 +02:00 committed by GitHub
commit ecf343f577
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
114 changed files with 1902 additions and 967 deletions

281
LICENSE Normal file
View file

@ -0,0 +1,281 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

View file

@ -3,8 +3,8 @@
<project name="phpBB" description="The phpBB forum software" default="all" basedir="../">
<!-- a few settings for the build -->
<property name="newversion" value="3.3.0-a1-dev" />
<property name="prevversion" value="3.2.2" />
<property name="olderversions" value="3.0.14, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.7-pl1, 3.1.8, 3.1.9, 3.1.10, 3.1.11, 3.1.12, 3.2.0-a1, 3.2.0-a2, 3.2.0-b1, 3.2.0-b2, 3.2.0-RC1, 3.2.0-RC2, 3.2.0, 3.2.1" />
<property name="prevversion" value="3.2.3" />
<property name="olderversions" value="3.0.14, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.7-pl1, 3.1.8, 3.1.9, 3.1.10, 3.1.11, 3.1.12, 3.2.0-a1, 3.2.0-a2, 3.2.0-b1, 3.2.0-b2, 3.2.0-RC1, 3.2.0-RC2, 3.2.0, 3.2.1, 3.2.2" />
<!-- no configuration should be needed beyond this point -->
<property name="oldversions" value="${olderversions}, ${prevversion}" />

Binary file not shown.

View file

@ -238,7 +238,7 @@
<form id="profile_fields" method="post" action="{U_ACTION}">
<fieldset class="quick">
<input class="text small" type="text" name="field_ident" /> <select name="field_type">{S_TYPE_OPTIONS}</select>
<select name="field_type">{S_TYPE_OPTIONS}</select>
<input class="button1" type="submit" name="submit" value="{L_CREATE_NEW_FIELD}" />
<input type="hidden" name="create" value="1" />
{S_FORM_TOKEN}

View file

@ -931,9 +931,9 @@ phpbb.addAjaxCallback('alt_text', function() {
$anchor.each(function() {
var $this = $(this);
altText = $this.attr('data-alt-text');
$this.attr('data-alt-text', $this.text());
$this.attr('title', $.trim(altText));
$this.text(altText);
$this.attr('data-alt-text', $.trim($this.text()));
$this.attr('title', altText);
$this.children('span').text(altText);
});
});
@ -1639,7 +1639,7 @@ phpbb.lazyLoadAvatars = function loadAvatars() {
});
};
$(window).load(phpbb.lazyLoadAvatars);
$(window).on('load', phpbb.lazyLoadAvatars);
/**
* Apply code editor to all textarea elements with data-bbcode attribute

View file

@ -211,7 +211,7 @@ phpbb.plupload.updateHiddenData = function(row, attach, index) {
.attr('type', 'hidden')
.attr('name', 'attachment_data[' + index + '][' + key + ']')
.attr('value', attach[key]);
$('textarea', row).after(input);
$(row).append(input);
}
};

File diff suppressed because one or more lines are too long

582
phpBB/composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -3,11 +3,13 @@ imports:
core:
require_dev_dependencies: true
allow_install_dir: true
debug:
exceptions: true
load_time: true
sql_explain: true
memory: true
show_errors: true
twig:
@ -18,3 +20,6 @@ core:
extensions:
composer_debug: true
composer_verbose: true
session:
log_errors: true

View file

@ -3,3 +3,4 @@ imports:
core:
require_dev_dependencies: true
allow_install_dir: true

View file

@ -31,7 +31,7 @@ $get_params_array = $request->get_super_global(\phpbb\request\request_interface:
/** @var \phpbb\controller\helper $controller_helper */
$controller_helper = $phpbb_container->get('controller.helper');
$response = new RedirectResponse(
$controller_helper->route('phpbb_cron_run', $get_params_array),
$controller_helper->route('phpbb_cron_run', $get_params_array, false),
301
);
$response->send();

View file

@ -50,6 +50,7 @@
<ol>
<li><a href="#changelog">Changelog</a>
<ul>
<li><a href="#v323rc2">Changes since 3.2.3-RC2</a></li>
<li><a href="#v323rc1">Changes since 3.2.3-RC1</a></li>
<li><a href="#v322">Changes since 3.2.2</a></li>
<li><a href="#v321">Changes since 3.2.1</a></li>
@ -130,6 +131,16 @@
<div class="inner">
<div class="content">
<a name="v323rc2"></a><h3>Changes since 3.2.3-RC2</h3>
<h4>Bug</h4>
<ul>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15504">PHPBB3-15504</a>] - phpBB Debug warning in 3.2.2</li>
</ul>
<h4>Improvement</h4>
<ul>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15740">PHPBB3-15740</a>] - Terms &amp; Privavy hardcoded</li>
</ul>
<a name="v323rc1"></a><h3>Changes since 3.2.3-RC1</h3>
<h4>Bug</h4>
<ul>

View file

@ -652,6 +652,13 @@ attachment_file_prepend
* Since: 3.1.6-RC1
* Purpose: Add custom attachment types displaying to the top of attachment block.
confirm_delete_body_delete_reason_before
===
* Locations:
+ styles/prosilver/template/confirm_delete_body.html
* Since: 3.2.4-RC1
* Purpose: Add custom text to the confirmation of a post that is deleted.
forumlist_body_category_header_after
===
* Locations:
@ -974,6 +981,20 @@ mcp_post_additional_options
* Since: 3.1.5-RC1
* Purpose: Add content within the list of post moderation actions
mcp_post_report_buttons_top_after
===
* Locations:
+ styles/prosilver/template/mcp_post.html
* Since: 3.2.4-RC1
* Purpose: Add content after report buttons
mcp_post_report_buttons_top_before
===
* Locations:
+ styles/prosilver/template/mcp_post.html
* Since: 3.2.4-RC1
* Purpose: Add content before report buttons
mcp_topic_options_after
===
* Locations:
@ -1707,6 +1728,13 @@ posting_poll_body_options_after
* Since: 3.1.4-RC1
* Purpose: Add content after the poll options on creating a poll
posting_preview_content_after
===
* Locations:
+ styles/prosilver/template/posting_preview.html
* Since: 3.2.4-RC1
* Purpose: Add content after the message content preview
posting_preview_poll_after
===
* Locations:
@ -1714,6 +1742,13 @@ posting_preview_poll_after
* Since: 3.1.7-RC1
* Purpose: Add content after the poll preview block
posting_topic_review_row_content_after
===
* Locations:
+ styles/prosilver/template/posting_topic_review.html
* Since: 3.2.4-RC1
* Purpose: Add content after the message content in topic review
posting_topic_review_row_post_details_after
===
* Locations:
@ -1875,6 +1910,13 @@ search_body_search_query_prepend
* Since: 3.1.7-RC1
* Purpose: Put content at the top of the search query fields set
search_results_content_after
===
* Locations:
+ styles/prosilver/template/search_results.html
* Since: 3.2.4-RC1
* Purpose: Add content after the message content in search results
search_results_header_after
===
* Locations:
@ -1950,6 +1992,13 @@ simple_footer_after
* Locations:
+ styles/prosilver/template/simple_footer.html
* Since: 3.1.0-a1
* Purpose: Add content prior to the scripts of the simple footer
simple_footer_body_after
===
* Locations:
+ styles/prosilver/template/simple_footer.html
* Since: 3.2.4-RC1
* Purpose: Add content directly prior to the `</body>` tag of the simple footer
simple_header_body_before
@ -2653,6 +2702,13 @@ viewtopic_body_postrow_back2top_prepend
* Since: 3.1.8-RC1
* Purpose: Add content to the post's bottom directly before the back to top link
viewtopic_body_postrow_content_after
===
* Locations:
+ styles/prosilver/template/viewtopic_body.html
* Since: 3.2.4-RC1
* Purpose: Add content after the message content in topics views
viewtopic_body_postrow_custom_fields_after
===
* Locations:

View file

@ -29,7 +29,6 @@ source source_phpbb_{SPHINX_ID}_main
AND p.post_id >= $start AND p.post_id <= $end
sql_query_post =
sql_query_post_index = UPDATE phpbb_sphinx SET max_doc_id = $maxid WHERE counter_id = 1
sql_query_info = SELECT * FROM phpbb_posts WHERE post_id = $id
sql_attr_uint = forum_id
sql_attr_uint = topic_id
sql_attr_uint = poster_id
@ -72,7 +71,6 @@ index index_phpbb_{SPHINX_ID}_main
morphology = none
stopwords =
min_word_len = 2
charset_type = utf-8
charset_table = U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z, A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6, U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101, U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109, U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F, U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117, U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D, U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135, U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C, U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144, U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B, U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153, U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159, U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161, U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167, U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F, U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175, U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C, U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F, U+4E00..U+9FFF
min_prefix_len = 0
min_infix_len = 0
@ -88,13 +86,11 @@ indexer
}
searchd
{
compat_sphinxql_magics = 0
listen = localhost:9312
log = {DATA_PATH}/log/searchd.log
query_log = {DATA_PATH}/log/sphinx-query.log
read_timeout = 5
max_children = 30
pid_file = {DATA_PATH}/searchd.pid
max_matches = 20000
binlog_path = {DATA_PATH}
}

View file

@ -36,17 +36,17 @@ $mode = $request->variable('mode', '');
if ($forum_id !== 0)
{
$url = $controller_helper->route('phpbb_feed_forum', array('forum_id' => $forum_id));
$url = $controller_helper->route('phpbb_feed_forum', array('forum_id' => $forum_id), false);
}
else if ($topic_id !== 0)
{
$url = $controller_helper->route('phpbb_feed_topic', array('topic_id' => $topic_id));
$url = $controller_helper->route('phpbb_feed_topic', array('topic_id' => $topic_id), false);
}
else
{
try
{
$url = $controller_helper->route('phpbb_feed_overall', array('mode' => $mode));
$url = $controller_helper->route('phpbb_feed_overall', array('mode' => $mode), false);
}
catch (InvalidParameterException $e)
{

View file

@ -1260,7 +1260,7 @@ class acp_attachments
$row['extension'] = strtolower(trim((string) $row['extension']));
$comment = ($row['attach_comment'] && !$row['in_message']) ? str_replace(array("\n", "\r"), array('<br />', "\n"), $row['attach_comment']) : '';
$display_cat = $extensions[$row['extension']]['display_cat'];
$display_cat = isset($extensions[$row['extension']]['display_cat']) ? $extensions[$row['extension']]['display_cat'] : ATTACHMENT_CATEGORY_NONE;
$l_downloaded_viewed = ($display_cat == ATTACHMENT_CATEGORY_NONE) ? 'DOWNLOAD_COUNTS' : 'VIEWED_COUNTS';
$template->assign_block_vars('attachments', array(

View file

@ -295,6 +295,22 @@ class acp_bbcodes
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_action, false, array($data['bbcode_tag']));
/**
* Event after a BBCode has been added or updated
*
* @event core.acp_bbcodes_modify_create_after
* @var string action Type of the action: modify|create
* @var int bbcode_id The id of the added or updated bbcode
* @var array sql_ary Array with bbcode data (read only)
* @since 3.2.4-RC1
*/
$vars = array(
'action',
'bbcode_id',
'sql_ary',
);
extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create_after', compact($vars)));
trigger_error($user->lang[$lang] . adm_back_link($this->u_action));
}
else
@ -325,10 +341,28 @@ class acp_bbcodes
{
if (confirm_box(true))
{
$bbcode_tag = $row['bbcode_tag'];
$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
$cache->destroy('sql', BBCODES_TABLE);
$phpbb_container->get('text_formatter.cache')->invalidate();
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BBCODE_DELETE', false, array($row['bbcode_tag']));
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BBCODE_DELETE', false, array($bbcode_tag));
/**
* Event after a BBCode has been deleted
*
* @event core.acp_bbcodes_delete_after
* @var string action Type of the action: delete
* @var int bbcode_id The id of the deleted bbcode
* @var string bbcode_tag The tag of the deleted bbcode
* @since 3.2.4-RC1
*/
$vars = array(
'action',
'bbcode_id',
'bbcode_tag',
);
extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_delete_after', compact($vars)));
if ($request->is_ajax())
{
@ -417,144 +451,7 @@ class acp_bbcodes
function build_regexp(&$bbcode_match, &$bbcode_tpl)
{
$bbcode_match = trim($bbcode_match);
$bbcode_tpl = trim($bbcode_tpl);
// Allow unicode characters for URL|LOCAL_URL|RELATIVE_URL|INTTEXT tokens
$utf8 = preg_match('/(URL|LOCAL_URL|RELATIVE_URL|INTTEXT)/', $bbcode_match);
$fp_match = preg_quote($bbcode_match, '!');
$fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match);
$fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace);
$sp_match = preg_quote($bbcode_match, '!');
$sp_match = preg_replace('#^\\\\\[(.*?)\\\\\]#', '\[$1:$uid\]', $sp_match);
$sp_match = preg_replace('#\\\\\[/(.*?)\\\\\]$#', '\[/$1:$uid\]', $sp_match);
$sp_replace = $bbcode_tpl;
// @todo Make sure to change this too if something changed in message parsing
$tokens = array(
'URL' => array(
'!(?:(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))!ie' => "\$this->bbcode_specialchars(('\$1') ? '\$1' : 'http://\$2')"
),
'LOCAL_URL' => array(
'!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')"
),
'RELATIVE_URL' => array(
'!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')"
),
'EMAIL' => array(
'!(' . get_preg_expression('email') . ')!ie' => "\$this->bbcode_specialchars('$1')"
),
'TEXT' => array(
'!(.*?)!es' => "str_replace(array(\"\\r\\n\", '\\\"', '\\'', '(', ')'), array(\"\\n\", '\"', '&#39;', '&#40;', '&#41;'), trim('\$1'))"
),
'SIMPLETEXT' => array(
'!([a-zA-Z0-9-+.,_ ]+)!' => "$1"
),
'INTTEXT' => array(
'!([\p{L}\p{N}\-+,_. ]+)!u' => "$1"
),
'IDENTIFIER' => array(
'!([a-zA-Z0-9-_]+)!' => "$1"
),
'COLOR' => array(
'!([a-z]+|#[0-9abcdef]+)!i' => '$1'
),
'NUMBER' => array(
'!([0-9]+)!' => '$1'
)
);
$sp_tokens = array(
'URL' => '(?i)((?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))(?-i)',
'LOCAL_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)',
'RELATIVE_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)',
'EMAIL' => '(' . get_preg_expression('email') . ')',
'TEXT' => '(.*?)',
'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)',
'INTTEXT' => '([\p{L}\p{N}\-+,_. ]+)',
'IDENTIFIER' => '([a-zA-Z0-9-_]+)',
'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)',
'NUMBER' => '([0-9]+)',
);
$pad = 0;
$modifiers = 'i';
$modifiers .= ($utf8) ? 'u' : '';
if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m))
{
foreach ($m[0] as $n => $token)
{
$token_type = $m[1][$n];
reset($tokens[strtoupper($token_type)]);
list($match, $replace) = each($tokens[strtoupper($token_type)]);
// Pad backreference numbers from tokens
if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
{
$repad = $pad + count(array_unique($repad[0]));
$replace = preg_replace_callback('/(?<!\\\\)\$([0-9]+)/', function ($match) use ($pad) {
return '${' . ($match[1] + $pad) . '}';
}, $replace);
$pad = $repad;
}
// Obtain pattern modifiers to use and alter the regex accordingly
$regex = preg_replace('/!(.*)!([a-z]*)/', '$1', $match);
$regex_modifiers = preg_replace('/!(.*)!([a-z]*)/', '$2', $match);
for ($i = 0, $size = strlen($regex_modifiers); $i < $size; ++$i)
{
if (strpos($modifiers, $regex_modifiers[$i]) === false)
{
$modifiers .= $regex_modifiers[$i];
if ($regex_modifiers[$i] == 'e')
{
$fp_replace = "'" . str_replace("'", "\\'", $fp_replace) . "'";
}
}
if ($regex_modifiers[$i] == 'e')
{
$replace = "'.$replace.'";
}
}
$fp_match = str_replace(preg_quote($token, '!'), $regex, $fp_match);
$fp_replace = str_replace($token, $replace, $fp_replace);
$sp_match = str_replace(preg_quote($token, '!'), $sp_tokens[$token_type], $sp_match);
// Prepend the board url to local relative links
$replace_prepend = ($token_type === 'LOCAL_URL') ? generate_board_url() . '/' : '';
$sp_replace = str_replace($token, $replace_prepend . '${' . ($n + 1) . '}', $sp_replace);
}
$fp_match = '!' . $fp_match . '!' . $modifiers;
$sp_match = '!' . $sp_match . '!s' . (($utf8) ? 'u' : '');
if (strpos($fp_match, 'e') !== false)
{
$fp_replace = str_replace("'.'", '', $fp_replace);
$fp_replace = str_replace(".''.", '.', $fp_replace);
}
}
else
{
// No replacement is present, no need for a second-pass pattern replacement
// A simple str_replace will suffice
$fp_match = '!' . $fp_match . '!' . $modifiers;
$sp_match = $fp_replace;
$sp_replace = '';
}
// Lowercase tags
$bbcode_tag = preg_replace('/.*?\[([a-z0-9_-]+).*/i', '$1', $bbcode_match);
$bbcode_search = preg_replace('/.*?\[([a-z0-9_-]+).*/i', '$1', $bbcode_match);
if (!preg_match('/^[a-zA-Z0-9_-]+$/', $bbcode_tag))
{
@ -562,25 +459,13 @@ class acp_bbcodes
trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$fp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) {
return strtolower($match[0]);
}, $fp_match);
$fp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) {
return strtolower($match[0]);
}, $fp_replace);
$sp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) {
return strtolower($match[0]);
}, $sp_match);
$sp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) {
return strtolower($match[0]);
}, $sp_replace);
return array(
'bbcode_tag' => $bbcode_tag,
'first_pass_match' => $fp_match,
'first_pass_replace' => $fp_replace,
'second_pass_match' => $sp_match,
'second_pass_replace' => $sp_replace
'first_pass_match' => '/(?!)/',
'first_pass_replace' => '',
// Use a non-matching, valid regexp to effectively disable this BBCode
'second_pass_match' => '/(?!)/',
'second_pass_replace' => ''
);
}
}

View file

@ -192,8 +192,6 @@ class acp_database
fclose($fp);
}
$storage->track_file($file);
// Remove file from tmp
@unlink($temp_dir . '/' . $file);

View file

@ -1012,7 +1012,7 @@ class acp_forums
}
$range_test_ary = array(
array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'TINT:0'),
array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'USINT:0'),
);
if (!empty($forum_data_ary['forum_image']) && !file_exists($phpbb_root_path . $forum_data_ary['forum_image']))

View file

@ -639,7 +639,7 @@ class acp_main
}
// Warn if install is still present
if (file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install'))
if (!$phpbb_container->getParameter('allow_install_dir') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install'))
{
$template->assign_var('S_REMOVE_INSTALL', true);
}

View file

@ -61,8 +61,17 @@ function phpbb_load_extensions_autoloaders($phpbb_root_path)
*/
function gen_rand_string($num_chars = 8)
{
// [a, z] + [0, 9] = 36
return substr(strtoupper(base_convert(bin2hex(random_bytes($num_chars + 1)), 16, 36)), 0, $num_chars);
$range = array_merge(range('A', 'Z'), range(0, 9));
$size = count($range);
$output = '';
for ($i = 0; $i < $num_chars; $i++)
{
$rand = random_int(0, $size-1);
$output .= $range[$rand];
}
return $output;
}
/**
@ -76,13 +85,17 @@ function gen_rand_string($num_chars = 8)
*/
function gen_rand_string_friendly($num_chars = 8)
{
$rand_str = bin2hex(random_bytes($num_chars + 1));
$range = array_merge(range('A', 'N'), range('P', 'Z'), range(1, 9));
$size = count($range);
// Remove Z and Y from the base_convert(), replace 0 with Z and O with Y
// [a, z] + [0, 9] - {z, y} = [a, z] + [0, 9] - {0, o} = 34
$rand_str = str_replace(array('0', 'O'), array('Z', 'Y'), strtoupper(base_convert($rand_str, 16, 34)));
$output = '';
for ($i = 0; $i < $num_chars; $i++)
{
$rand = random_int(0, $size-1);
$output .= $range[$rand];
}
return substr($rand_str, 0, $num_chars);
return $output;
}
/**
@ -90,7 +103,7 @@ function gen_rand_string_friendly($num_chars = 8)
*/
function unique_id()
{
return bin2hex(random_bytes(8));
return gen_rand_string(32);
}
/**
@ -1719,14 +1732,14 @@ function redirect($url, $return = false, $disable_cd_check = false)
if ($url_parts === false)
{
// Malformed url
trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
trigger_error('INSECURE_REDIRECT', E_USER_WARNING);
}
else if (!empty($url_parts['scheme']) && !empty($url_parts['host']))
{
// Attention: only able to redirect within the same domain if $disable_cd_check is false (yourdomain.com -> www.yourdomain.com will not work)
if (!$disable_cd_check && $url_parts['host'] !== $user->host)
{
trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
trigger_error('INSECURE_REDIRECT', E_USER_WARNING);
}
}
else if ($url[0] == '/')
@ -1766,13 +1779,13 @@ function redirect($url, $return = false, $disable_cd_check = false)
if (!$disable_cd_check && strpos($url, generate_board_url(true) . '/') !== 0)
{
trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
trigger_error('INSECURE_REDIRECT', E_USER_WARNING);
}
// Make sure no linebreaks are there... to prevent http response splitting for PHP < 4.4.2
if (strpos(urldecode($url), "\n") !== false || strpos(urldecode($url), "\r") !== false || strpos($url, ';') !== false)
{
trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
trigger_error('INSECURE_REDIRECT', E_USER_WARNING);
}
// Now, also check the protocol and for a valid url the last time...
@ -1781,7 +1794,7 @@ function redirect($url, $return = false, $disable_cd_check = false)
if ($url_parts === false || empty($url_parts['scheme']) || !in_array($url_parts['scheme'], $allowed_protocols))
{
trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
trigger_error('INSECURE_REDIRECT', E_USER_WARNING);
}
/**
@ -2338,10 +2351,12 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
* @event core.login_box_redirect
* @var string redirect Redirect string
* @var bool admin Is admin?
* @var array result Result from auth provider
* @since 3.1.0-RC5
* @changed 3.1.9-RC1 Removed undefined return variable
* @changed 3.2.4-RC1 Added result
*/
$vars = array('redirect', 'admin');
$vars = array('redirect', 'admin', 'result');
extract($phpbb_dispatcher->trigger_event('core.login_box_redirect', compact($vars)));
// append/replace SID (may change during the session for AOL users)
@ -2514,7 +2529,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
*/
function login_forum_box($forum_data)
{
global $db, $phpbb_container, $request, $template, $user, $phpbb_dispatcher;
global $db, $phpbb_container, $request, $template, $user, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$password = $request->variable('password', '', true);
@ -2599,6 +2614,8 @@ function login_forum_box($forum_data)
'body' => 'login_forum.html')
);
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"), $forum_data['forum_id']);
page_footer();
}
@ -4211,7 +4228,8 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
}
else
{
$u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login');
$redirect = $request->variable('redirect', rawurlencode($user->page['page']));
$u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&amp;redirect=' . $redirect);
$l_login_logout = $user->lang['LOGIN'];
}
@ -4477,7 +4495,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
'S_COOKIE_NOTICE' => !empty($config['cookie_notice']),
'T_THEME_NAME' => rawurlencode($user->style['style_path']),
'T_THEME_LANG_NAME' => $user->data['user_lang'],
'T_THEME_LANG_NAME' => $user->lang_name,
'T_TEMPLATE_NAME' => $user->style['style_path'],
'T_SUPER_TEMPLATE_NAME' => rawurlencode((isset($user->style['style_parent_tree']) && $user->style['style_parent_tree']) ? $user->style['style_parent_tree'] : $user->style['style_path']),
'T_IMAGES' => 'images',
@ -4541,7 +4559,9 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
*/
function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $request, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db)
{
if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG'))
global $phpbb_container;
if ($phpbb_container->getParameter('debug.sql_explain') && $request->variable('explain', false) && $auth->acl_get('a_'))
{
$db->sql_report('display');
}
@ -4571,9 +4591,10 @@ function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \php
$totaltime = microtime(true) - $GLOBALS['starttime'];
$debug_info[] = sprintf('<span title="SQL time: %.3fs / PHP time: %.3fs">Time: %.3fs</span>', $db->get_sql_time(), ($totaltime - $db->get_sql_time()), $totaltime);
}
}
$debug_info[] = sprintf('<span title="Cached: %d">Queries: %d</span>', $db->sql_num_queries(true), $db->sql_num_queries());
if ($phpbb_container->getParameter('debug.memory'))
{
$memory_usage = memory_get_peak_usage();
if ($memory_usage)
{
@ -4581,18 +4602,20 @@ function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \php
$debug_info[] = 'Peak Memory Usage: ' . $memory_usage;
}
}
if (defined('DEBUG'))
{
$debug_info[] = 'GZIP: ' . (($config['gzip_compress'] && @extension_loaded('zlib')) ? 'On' : 'Off');
if ($user->load)
{
$debug_info[] = 'Load: ' . $user->load;
}
}
if ($auth->acl_get('a_') && $phpbb_container->getParameter('debug.sql_explain'))
if ($phpbb_container->getParameter('debug.sql_explain'))
{
$debug_info[] = sprintf('<span title="Cached: %d">Queries: %d</span>', $db->sql_num_queries(true), $db->sql_num_queries());
if ($auth->acl_get('a_'))
{
$debug_info[] = '<a href="' . build_url() . '&amp;explain=1">SQL Explain</a>';
}

View file

@ -1740,3 +1740,47 @@ class bitfield
$this->data = $this->data | $bitfield->get_blob();
}
}
/**
* Formats the quote according to the given BBCode status setting
*
* @param bool $bbcode_status The status of the BBCode setting
* @param array $quote_attributes The attributes of the quoted post
* @param phpbb\textformatter\utils $text_formatter_utils Text formatter utilities
* @param parse_message $message_parser Message parser class
* @param string $message_link Link of the original quoted post
*/
function phpbb_format_quote($bbcode_status, $quote_attributes, $text_formatter_utils, $message_parser, $message_link = '')
{
if ($bbcode_status)
{
$quote_text = $text_formatter_utils->generate_quote(
censor_text($message_parser->message),
$quote_attributes
);
$message_parser->message = $quote_text . "\n\n";
}
else
{
$offset = 0;
$quote_string = "&gt; ";
$message = censor_text(trim($message_parser->message));
// see if we are nesting. It's easily tricked but should work for one level of nesting
if (strpos($message, "&gt;") !== false)
{
$offset = 10;
}
$message = utf8_wordwrap($message, 75 + $offset, "\n");
$message = $quote_string . $message;
$message = str_replace("\n", "\n" . $quote_string, $message);
$message_parser->message = $quote_attributes['author'] . " " . $user->lang['WROTE'] . ":\n" . $message . "\n";
}
if ($message_link)
{
$message_parser->message = $message_link . $message_parser->message;
}
}

View file

@ -223,9 +223,6 @@ function send_file_to_browser($attachment, $category)
}
}
// Close the db connection before sending the file etc.
file_gc(false);
if (!set_modified_headers($attachment['filetime'], $user->browser))
{
if ($size)
@ -238,6 +235,9 @@ function send_file_to_browser($attachment, $category)
$fp = $storage->read_stream($filename);
// Close the db connection before sending the file etc.
file_gc(false);
if ($fp !== false)
{
$output = fopen('php://output', 'w+b');

View file

@ -327,6 +327,7 @@ class messenger
$subject = $this->subject;
$message = $this->msg;
$template = $this->template;
/**
* Event to modify notification message text before parsing
*
@ -336,13 +337,16 @@ class messenger
* and the message without sending it
* @var string subject The message subject
* @var string message The message text
* @var \phpbb\template\template template Template object
* @since 3.1.11-RC1
* @changed 3.2.4-RC1 Added template
*/
$vars = array(
'method',
'break',
'subject',
'message',
'template',
);
extract($phpbb_dispatcher->trigger_event('core.modify_notification_message', compact($vars)));
$this->subject = $subject;
@ -517,7 +521,7 @@ class messenger
*/
function msg_email()
{
global $config;
global $config, $phpbb_dispatcher;
if (empty($config['email_enable']))
{
@ -545,6 +549,33 @@ class messenger
$contact_name = htmlspecialchars_decode($config['board_contact_name']);
$board_contact = (($contact_name !== '') ? '"' . mail_encode($contact_name) . '" ' : '') . '<' . $config['board_contact'] . '>';
$break = false;
$addresses = $this->addresses;
$subject = $this->subject;
$msg = $this->msg;
/**
* Event to send message via external transport
*
* @event core.notification_message_email
* @var bool break Flag indicating if the function return after hook
* @var array addresses The message recipients
* @var string subject The message subject
* @var string msg The message text
* @since 3.2.4-RC1
*/
$vars = array(
'break',
'addresses',
'subject',
'msg',
);
extract($phpbb_dispatcher->trigger_event('core.notification_message_email', compact($vars)));
if ($break)
{
return true;
}
if (empty($this->replyto))
{
$this->replyto = $board_contact;
@ -781,7 +812,7 @@ class queue
*/
function process()
{
global $config, $phpEx, $phpbb_root_path, $user;
global $config, $phpEx, $phpbb_root_path, $user, $phpbb_dispatcher;
$lock = new \phpbb\lock\flock($this->cache_file);
$lock->acquire();
@ -878,23 +909,45 @@ class queue
switch ($object)
{
case 'email':
$err_msg = '';
$to = (!$to) ? 'undisclosed-recipients:;' : $to;
$break = false;
/**
* Event to send message via external transport
*
* @event core.notification_message_process
* @var bool break Flag indicating if the function return after hook
* @var array addresses The message recipients
* @var string subject The message subject
* @var string msg The message text
* @since 3.2.4-RC1
*/
$vars = array(
'break',
'addresses',
'subject',
'msg',
);
extract($phpbb_dispatcher->trigger_event('core.notification_message_process', compact($vars)));
if ($config['smtp_delivery'])
if (!$break)
{
$result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers);
}
else
{
$result = phpbb_mail($to, $subject, $msg, $headers, PHP_EOL, $err_msg);
}
$err_msg = '';
$to = (!$to) ? 'undisclosed-recipients:;' : $to;
if (!$result)
{
$messenger = new messenger();
$messenger->error('EMAIL', $err_msg);
continue 2;
if ($config['smtp_delivery'])
{
$result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers);
}
else
{
$result = phpbb_mail($to, $subject, $msg, $headers, PHP_EOL, $err_msg);
}
if (!$result)
{
$messenger = new messenger();
$messenger->error('EMAIL', $err_msg);
continue 2;
}
}
break;

View file

@ -2250,6 +2250,19 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data
'post_subject' => $subject,
));
/**
* This event allows you to modify the notification data upon submission
*
* @event core.modify_submit_notification_data
* @var array notification_data The notification data to be inserted in to the database
* @var array data_ary The data array with a lot of the post submission data
* @var string mode The posting mode
* @var int poster_id The poster id
* @since 3.2.4-RC1
*/
$vars = array('notification_data', 'data_ary', 'mode', 'poster_id');
extract($phpbb_dispatcher->trigger_event('core.modify_submit_notification_data', compact($vars)));
/* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
@ -2277,8 +2290,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data
case 'edit_first_post':
case 'edit':
case 'edit_last_post':
if ($user->data['user_id'] == $poster_id)
{
$phpbb_notifications->update_notifications(array(
'notification.type.quote',
), $notification_data);
}
$phpbb_notifications->update_notifications(array(
'notification.type.quote',
'notification.type.bookmark',
'notification.type.topic',
'notification.type.post',

View file

@ -461,9 +461,11 @@ function user_delete($mode, $user_ids, $retain_username = true)
* @var array user_ids IDs of the deleted user
* @var mixed retain_username True if username should be retained
* or false if not
* @var array user_rows Array containing data of the deleted users
* @since 3.1.0-a1
* @changed 3.2.4-RC1 Added user_rows
*/
$vars = array('mode', 'user_ids', 'retain_username');
$vars = array('mode', 'user_ids', 'retain_username', 'user_rows');
extract($phpbb_dispatcher->trigger_event('core.delete_user_before', compact($vars)));
// Before we begin, we will remove the reports the user issued.
@ -664,7 +666,7 @@ function user_delete($mode, $user_ids, $retain_username = true)
delete_posts('poster_id', $user_ids);
}
$table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE, SESSIONS_KEYS_TABLE, PRIVMSGS_FOLDER_TABLE, PRIVMSGS_RULES_TABLE);
$table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE, SESSIONS_KEYS_TABLE, PRIVMSGS_FOLDER_TABLE, PRIVMSGS_RULES_TABLE, $phpbb_container->getParameter('tables.auth_provider_oauth_token_storage'), $phpbb_container->getParameter('tables.auth_provider_oauth_states'), $phpbb_container->getParameter('tables.auth_provider_oauth_account_assoc'));
// Delete the miscellaneous (non-post) data for the user
foreach ($table_ary as $table)
@ -1427,21 +1429,14 @@ function user_ipwhois($ip)
return '';
}
if (preg_match(get_preg_expression('ipv4'), $ip))
{
// IPv4 address
$whois_host = 'whois.arin.net.';
}
else if (preg_match(get_preg_expression('ipv6'), $ip))
{
// IPv6 address
$whois_host = 'whois.sixxs.net.';
}
else
if (!preg_match(get_preg_expression('ipv4'), $ip) && !preg_match(get_preg_expression('ipv6'), $ip))
{
return '';
}
// IPv4 & IPv6 addresses
$whois_host = 'whois.arin.net.';
$ipwhois = '';
if (($fsk = @fsockopen($whois_host, 43)))
@ -3616,11 +3611,6 @@ function remove_newly_registered($user_id, $user_data = false)
}
}
if (empty($user_data['user_new']))
{
return false;
}
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "
WHERE group_name = 'NEWLY_REGISTERED'

View file

@ -213,6 +213,10 @@ function mcp_post_details($id, $mode, $action)
$l_deleted_by = '';
}
// parse signature
$parse_flags = ($post_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$post_info['user_sig'] = generate_text_for_display($post_info['user_sig'], $post_info['user_sig_bbcode_uid'], $post_info['user_sig_bbcode_bitfield'], $parse_flags, true);
$mcp_post_template_data = array(
'U_MCP_ACTION' => "$url&amp;i=main&amp;quickmod=1&amp;mode=post_details", // Use this for mode paramaters
'U_POST_ACTION' => "$url&amp;i=$id&amp;mode=post_details", // Use this for action parameters
@ -262,6 +266,7 @@ function mcp_post_details($id, $mode, $action)
'POST_IP' => $post_info['poster_ip'],
'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
'POST_ID' => $post_info['post_id'],
'SIGNATURE' => $post_info['user_sig'],
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&amp;i=$id&amp;mode=$mode&amp;lookup={$post_info['poster_ip']}#ip" : '',
'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;mode=$mode&amp;action=whois&amp;p=$post_id&amp;ip={$post_info['poster_ip']}") : '',

View file

@ -242,6 +242,10 @@ class mcp_reports
}
}
// parse signature
$parse_flags = ($post_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$post_info['user_sig'] = generate_text_for_display($post_info['user_sig'], $post_info['user_sig_bbcode_uid'], $post_info['user_sig_bbcode_bitfield'], $parse_flags, true);
$template->assign_vars(array(
'S_MCP_REPORT' => true,
'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
@ -291,6 +295,7 @@ class mcp_reports
'POST_IP' => $post_info['poster_ip'],
'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
'POST_ID' => $post_info['post_id'],
'SIGNATURE' => $post_info['user_sig'],
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? $this->u_action . '&amp;r=' . $report_id . '&amp;p=' . $post_id . '&amp;f=' . $forum_id . '&amp;lookup=' . $post_info['poster_ip'] . '#ip' : '',
));

View file

@ -77,6 +77,22 @@ class ucp_main
// If the user can't see any forums, he can't read any posts because fid of 0 is invalid
if (!empty($forum_ary))
{
/**
* Modify sql variables before query is processed
*
* @event core.ucp_main_front_modify_sql
* @var string sql_select SQL select
* @var string sql_from SQL from
* @var array forum_ary Forum array
* @since 3.2.4-RC1
*/
$vars = array(
'sql_select',
'sql_from',
'forum_ary',
);
extract($phpbb_dispatcher->trigger_event('core.ucp_main_front_modify_sql', compact($vars)));
$sql = "SELECT t.* $sql_select
FROM $sql_from
WHERE t.topic_type = " . POST_GLOBAL . '
@ -144,7 +160,7 @@ class ucp_main
$folder_img .= '_mine';
}
$template->assign_block_vars('topicrow', array(
$topicrow = array(
'FORUM_ID' => $forum_id,
'TOPIC_ID' => $topic_id,
'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
@ -171,8 +187,30 @@ class ucp_main
'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=unread") . '#unread',
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id"))
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id"),
);
/**
* Add template variables to a front topics row.
*
* @event core.ucp_main_front_modify_template_vars
* @var array topicrow Array containing the template variables for the row
* @var array row Array containing the subscribed forum row data
* @var int forum_id Forum ID
* @var string folder_img Folder image
* @var string folder_alt Alt text for the folder image
* @since 3.2.4-RC1
*/
$vars = array(
'topicrow',
'row',
'forum_id',
'folder_img',
'folder_alt',
);
extract($phpbb_dispatcher->trigger_event('core.ucp_main_front_modify_template_vars', compact($vars)));
$template->assign_block_vars('topicrow', $topicrow);
}
if ($config['load_user_activity'])
@ -502,6 +540,9 @@ class ucp_main
$draft_subject = $draft_message = '';
add_form_key('ucp_draft');
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
$message_parser = new parse_message();
if ($delete)
{
if (check_form_key('ucp_draft'))
@ -535,9 +576,19 @@ class ucp_main
{
if ($draft_message && $draft_subject)
{
// $auth->acl_gets can't be used here because it will check for global forum permissions in this case
// In general we don't need too harsh checking here for permissions, as this will be handled later when submitting
$bbcode_status = $auth->acl_get('u_pm_bbcode') || $auth->acl_getf_global('f_bbcode');
$smilies_status = $auth->acl_get('u_pm_smilies') || $auth->acl_getf_global('f_smilies');
$img_status = $auth->acl_get('u_pm_img') || $auth->acl_getf_global('f_img');
$flash_status = $auth->acl_get('u_pm_flash') || $auth->acl_getf_global('f_flash');
$message_parser->message = $draft_message;
$message_parser->parse($bbcode_status, $config['allow_post_links'], $smilies_status, $img_status, $flash_status, true, $config['allow_post_links']);
$draft_row = array(
'draft_subject' => $draft_subject,
'draft_message' => $draft_message
'draft_message' => $message_parser->message,
);
$sql = 'UPDATE ' . DRAFTS_TABLE . '
@ -639,9 +690,16 @@ class ucp_main
$insert_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&amp;mode=compose&amp;d=" . $draft['draft_id']);
}
if (!$submit)
{
$message_parser->message = $draft['draft_message'];
$message_parser->decode_message();
$draft_message = $message_parser->message;
}
$template_row = array(
'DATE' => $user->format_date($draft['save_time']),
'DRAFT_MESSAGE' => ($submit) ? $draft_message : $draft['draft_message'],
'DRAFT_MESSAGE' => $draft_message,
'DRAFT_SUBJECT' => ($submit) ? $draft_subject : $draft['draft_subject'],
'TITLE' => $title,

View file

@ -48,7 +48,6 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$to_group_id = $request->variable('g', 0);
$msg_id = $request->variable('p', 0);
$draft_id = $request->variable('d', 0);
$lastclick = $request->variable('lastclick', 0);
// Reply to all triggered (quote/reply)
$reply_to_all = $request->variable('reply_to_all', 0);
@ -80,7 +79,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$group_helper = $phpbb_container->get('group_helper');
// Was cancel pressed? If so then redirect to the appropriate page
if ($cancel || ($current_time - $lastclick < 2 && $submit))
if ($cancel)
{
if ($msg_id)
{
@ -125,7 +124,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
// Add groups to PM box
if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group'))
{
$sql = 'SELECT g.group_id, g.group_name, g.group_type
$sql = 'SELECT g.group_id, g.group_name, g.group_type, g.group_colour
FROM ' . GROUPS_TABLE . ' g';
if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
@ -148,7 +147,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$group_options = '';
while ($row = $db->sql_fetchrow($result))
{
$group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . $group_helper->get_name($row['group_name']) . '</option>';
$group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '"' . ($row['group_colour'] ? ' style="color: #' . $row['group_colour'] . '"' : '') . '>' . $group_helper->get_name($row['group_name']) . '</option>';
}
$db->sql_freeresult($result);
}
@ -659,13 +658,16 @@ function compose_pm($id, $mode, $action, $user_folders = array())
{
if (confirm_box(true))
{
$message_parser->message = $message;
$message_parser->parse($bbcode_status, $url_status, $smilies_status, $img_status, $flash_status, true, $url_status);
$sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'user_id' => $user->data['user_id'],
'topic_id' => 0,
'forum_id' => 0,
'save_time' => $current_time,
'draft_subject' => $subject,
'draft_message' => $message
'draft_message' => $message_parser->message,
)
);
$db->sql_query($sql);
@ -954,7 +956,16 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$post_id = $request->variable('p', 0);
if ($config['allow_post_links'])
{
$message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}{$user->lang['COLON']} {$message_subject}[/url]\n\n";
$message_link = generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}";
$message_link_subject = "{$user->lang['SUBJECT']}{$user->lang['COLON']} {$message_subject}";
if ($bbcode_status)
{
$message_link = "[url=" . $message_link . "]" . $message_link_subject . "[/url]\n\n";
}
else
{
$message_link = $message_link . " - " . $message_link_subject . "\n\n";
}
}
else
{
@ -974,11 +985,8 @@ function compose_pm($id, $mode, $action, $user_folders = array())
{
$quote_attributes['post_id'] = $post['msg_id'];
}
$quote_text = $phpbb_container->get('text_formatter.utils')->generate_quote(
censor_text($message_parser->message),
$quote_attributes
);
$message_parser->message = $message_link . $quote_text . "\n\n";
phpbb_format_quote($bbcode_status, $quote_attributes, $phpbb_container->get('text_formatter.utils'), $message_parser, $message_link);
}
if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh)
@ -1174,8 +1182,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
break;
}
$s_hidden_fields = '<input type="hidden" name="lastclick" value="' . $current_time . '" />';
$s_hidden_fields .= (isset($check_value)) ? '<input type="hidden" name="status_switch" value="' . $check_value . '" />' : '';
$s_hidden_fields = (isset($check_value)) ? '<input type="hidden" name="status_switch" value="' . $check_value . '" />' : '';
$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . ((isset($_REQUEST['draft_loaded'])) ? $request->variable('draft_loaded', 0) : $draft_id) . '" />' : '';
$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"';
@ -1262,7 +1269,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove_g, $add_to, $add_bcc)
{
global $auth, $db, $user;
global $request;
global $request, $phpbb_dispatcher;
// Delete User [TO/BCC]
if ($remove_u && $request->variable('remove_u', array(0 => '')))
@ -1439,6 +1446,21 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
$error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION'];
}
}
/**
* Event for additional message list actions
*
* @event core.message_list_actions
* @var array address_list The assoc array with the recipient user/group ids
* @var array error The array containing error data
* @var bool remove_u The variable for removing a user
* @var bool remove_g The variable for removing a group
* @var bool add_to The variable for adding a user to the [TO] field
* @var bool add_bcc The variable for adding a user to the [BCC] field
* @since 3.2.4-RC1
*/
$vars = array('address_list', 'error', 'remove_u', 'remove_g', 'add_to', 'add_bcc');
extract($phpbb_dispatcher->trigger_event('core.message_list_actions', compact($vars)));
}
/**

View file

@ -552,6 +552,31 @@ class ucp_register
break;
}
/* @var $provider_collection \phpbb\auth\provider_collection */
$provider_collection = $phpbb_container->get('auth.provider_collection');
$auth_provider = $provider_collection->get_provider();
$auth_provider_data = $auth_provider->get_login_data();
if ($auth_provider_data)
{
if (isset($auth_provider_data['VARS']))
{
$template->assign_vars($auth_provider_data['VARS']);
}
if (isset($auth_provider_data['BLOCK_VAR_NAME']))
{
foreach ($auth_provider_data['BLOCK_VARS'] as $block_vars)
{
$template->assign_block_vars($auth_provider_data['BLOCK_VAR_NAME'], $block_vars);
}
}
$template->assign_vars(array(
'PROVIDER_TEMPLATE_FILE' => $auth_provider_data['TEMPLATE_FILE'],
));
}
// Assign template vars for timezone select
phpbb_timezone_select($template, $user, $data['tz'], true);

View file

@ -63,7 +63,7 @@ class convertor
{
global $user, $phpbb_root_path, $phpEx, $db, $lang, $config, $cache, $auth;
global $convert, $convert_row, $message_parser, $skip_rows, $language;
global $request, $phpbb_dispatcher;
global $request, $phpbb_dispatcher, $phpbb_container;
$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
extract($phpbb_config_php_file->get_all());
@ -687,7 +687,7 @@ class convertor
$this->template->assign_block_vars('checks', array(
'TITLE' => "skip_rows = $skip_rows",
'RESULT' => $rows . ((defined('DEBUG') && function_exists('memory_get_usage')) ? ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] : ''),
'RESULT' => $rows . (($phpbb_container->getParameter('debug.memory') && function_exists('memory_get_usage')) ? ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] : ''),
));
$mtime = explode(' ', microtime());
@ -920,6 +920,7 @@ class convertor
{
global $user, $db, $phpbb_root_path, $phpEx, $config, $cache;
global $convert;
global $phpbb_container;
include_once ($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
@ -959,7 +960,7 @@ class convertor
sync('topic', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, true);
$this->template->assign_block_vars('checks', array(
'TITLE' => sprintf($user->lang['SYNC_TOPIC_ID'], $sync_batch, ($sync_batch + $batch_size)) . ((defined('DEBUG') && function_exists('memory_get_usage')) ? ' [' . ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] . ']' : ''),
'TITLE' => sprintf($user->lang['SYNC_TOPIC_ID'], $sync_batch, ($sync_batch + $batch_size)) . (($phpbb_container->getParameter('debug.memory') && function_exists('memory_get_usage')) ? ' [' . ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] . ']' : ''),
'RESULT' => $user->lang['DONE'],
));

View file

@ -289,13 +289,13 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('exts_composer_enab
INSERT INTO phpbb_config (config_name, config_value) VALUES ('exts_composer_purge_on_remove', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\attachment\provider', 'phpbb\storage\provider\local');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\attachment\config\path', 'files');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\attachment\config\depth', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\attachment\config\subfolders', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\avatar\provider', 'phpbb\storage\provider\local');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\avatar\config\path', 'images/avatars/upload');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\avatar\config\depth', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\avatar\config\subfolders', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\backup\provider', 'phpbb\storage\provider\local');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\backup\config\path', 'store');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\backup\config\depth', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\backup\config\subfolders', '0');
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cache_last_gc', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cron_lock', '0', 1);
@ -795,11 +795,11 @@ INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'ods');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'odt');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'rtf');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'mp3');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'mpeg');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'mpg');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'ogg');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'ogm');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'mp3');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'mpeg');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'mpg');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'ogg');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'ogm');
# Add default profile fields
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_location', 'profilefields.type.string', 'phpbb_location', '20', '2', '100', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, '', '');

View file

@ -371,7 +371,7 @@ $lang = array_merge($lang, array(
'ACP_CONTACT_SETTINGS_EXPLAIN' => 'Here you can enable and disable the contact page and also add a text that is displayed on the page.',
'CONTACT_US_ENABLE' => 'Enable contact page',
'CONTACT_US_ENABLE_EXPLAIN' => 'This page allows users to send emails to board administrators. Please note that board-wide emails option must be enabled as well. You can find this option in General > Client Communication > Email settings.',
'CONTACT_US_ENABLE_EXPLAIN' => 'This page allows users to send emails to board administrators. Please note that board-wide emails option must be enabled as well. You can find this option in General &gt; Client Communication &gt; Email settings.',
'CONTACT_US_INFO' => 'Contact information',
'CONTACT_US_INFO_EXPLAIN' => 'The message is displayed on the contact page',

View file

@ -234,16 +234,6 @@ $lang = array_merge($lang, array(
'BACK' => 'Back',
'CANNOT_CHANGE_FILE_GROUP' => 'Unable to change file group',
'CANNOT_CHANGE_FILE_PERMISSIONS' => 'Unable to change file permissions',
'CANNOT_COPY_FILES' => 'Unable to copy files',
'CANNOT_CREATE_SYMLINK' => 'Unable to create a symlink',
'CANNOT_DELETE_FILES' => 'Unable to delete files from the system',
'CANNOT_DUMP_FILE' => 'Unable to dump file',
'CANNOT_MIRROR_DIRECTORY' => 'Unable to mirror directory',
'CANNOT_RENAME_FILE' => 'Unable to rename a file from the system',
'CANNOT_TOUCH_FILES' => 'Unable to determine if the file exists',
'CONTAINER_EXCEPTION' => 'phpBB encountered an error building the container due to an installed extension. For this reason, all extensions have been temporarily disabled. Please try purging your forum cache. All extensions will automatically be re-enabled once the container error is resolved. If this error continues, please visit <a href="https://www.phpbb.com/support">phpBB.com</a> for support.',
'EXCEPTION' => 'Exception',

View file

@ -55,9 +55,10 @@ $lang = array_merge($lang, array(
'STORAGE_BACKUP_TITLE' => 'Backup storage',
// Local adapter
'STORAGE_ADAPTER_LOCAL_NAME' => 'Local',
'STORAGE_ADAPTER_LOCAL_OPTION_PATH' => 'Path',
'STORAGE_ADAPTER_LOCAL_OPTION_DEPTH' => 'Depth',
'STORAGE_ADAPTER_LOCAL_NAME' => 'Local',
'STORAGE_ADAPTER_LOCAL_OPTION_PATH' => 'Path',
'STORAGE_ADAPTER_LOCAL_OPTION_SUBFOLDERS' => 'Organize in subfolders',
'STORAGE_ADAPTER_LOCAL_OPTION_SUBFOLDERS_EXPLAIN' => 'Some web servers may have problems storing large number of files in a single directory. Enable this option to distribute files in different directories.',
// Form validation
'STORAGE_UPDATE_SUCCESSFUL' => 'All storage types were successfully updated.',

View file

@ -49,7 +49,7 @@ $lang = array_merge($lang, array(
'ANSWER' => 'Answer',
'EDIT_QUESTION' => 'Edit Question',
'QUESTIONS' => 'Questions',
'QUESTIONS_EXPLAIN' => 'For every form submission where you have enabled the Q&amp;A plugin, users will be asked one of the questions specified here. To use this plugin at least one question must be set in the default language. These questions should be easy for your target audience to answer but beyond the ability of a bot capable of running a Google™ search. Using a large and regularly changed set of questions will yield the best results. Enable the strict setting if your question relies on mixed case, punctuation or whitespace.',
'QUESTIONS_EXPLAIN' => 'For every form submission where you have enabled the Q&amp;A plugin, users will be asked one of the questions specified here. To use this plugin at least one question must be set in the default language. These questions should be easy for your target audience to answer but beyond the ability of a bot capable of running a Google™ search. Only a single proper question is necessary. If you start receiving spam registrations, the question should be changed. Enable the strict setting if your question relies on mixed case, punctuation or whitespace.',
'QUESTION_DELETED' => 'Question deleted',
'QUESTION_LANG' => 'Language',
'QUESTION_LANG_EXPLAIN' => 'The language this question and its answers are written in.',

View file

@ -157,7 +157,6 @@ $lang = array_merge($lang, array(
'BYTES_SHORT' => 'B',
'CANCEL' => 'Cancel',
'CANNOT_RENAME_FILE' => 'Cannot rename %s',
'CHANGE' => 'Change',
'CHANGE_FONT_SIZE' => 'Change font size',
'CHANGING_PREFERENCES' => 'Changing board preferences',
@ -268,6 +267,17 @@ $lang = array_merge($lang, array(
'FSOCK_DISABLED' => 'The operation could not be completed because the <var>fsockopen</var> function has been disabled or the server being queried could not be found.',
'FSOCK_TIMEOUT' => 'A timeout occurred while reading from the network stream.',
'FILESYSTEM_CANNOT_CHANGE_FILE_GROUP' => 'Unable to change file group',
'FILESYSTEM_CANNOT_CHANGE_FILE_PERMISSIONS' => 'Unable to change file permissions',
'FILESYSTEM_CANNOT_COPY_FILES' => 'Unable to copy files',
'FILESYSTEM_CANNOT_CREATE_SYMLINK' => 'Unable to create a symlink',
'FILESYSTEM_CANNOT_CREATE_DIRECTORY' => 'Unable to create directory',
'FILESYSTEM_CANNOT_DELETE_FILES' => 'Unable to delete files from the system',
'FILESYSTEM_CANNOT_DUMP_FILE' => 'Unable to dump file',
'FILESYSTEM_CANNOT_MIRROR_DIRECTORY' => 'Unable to mirror directory',
'FILESYSTEM_CANNOT_RENAME_FILE' => 'Unable to rename a file from the system',
'FILESYSTEM_CANNOT_TOUCH_FILES' => 'Unable to determine if the file exists',
'FTP_FSOCK_HOST' => 'FTP host',
'FTP_FSOCK_HOST_EXPLAIN' => 'FTP server used to connect your site.',
'FTP_FSOCK_PASSWORD' => 'FTP password',
@ -745,6 +755,7 @@ $lang = array_merge($lang, array(
'STORAGE_CANNOT_CREATE_DIR' => 'Can not create directory.',
'STORAGE_CANNOT_OPEN_FILE' => 'Can not open file.',
'STORAGE_CANNOT_CREATE_FILE' => 'Can not create file.',
'STORAGE_INVALID_RESOURCE' => 'Resource is invalid.',
'TB' => 'TB',
'TERMS_LINK' => 'Terms',

View file

@ -264,7 +264,6 @@ $lang = array_merge($lang, array(
'TOPIC_BUMPED' => 'Topic has been bumped successfully.',
'UNAUTHORISED_BBCODE' => 'You cannot use certain BBCodes: %s.',
'UNGLOBALISE_EXPLAIN' => 'To switch this topic back from being global to a normal topic, you need to select the forum you wish this topic to be displayed.',
'UNSUPPORTED_CHARACTERS_MESSAGE' => 'Your message contains the following unsupported characters:<br />%s',
'UNSUPPORTED_CHARACTERS_SUBJECT' => 'Your subject contains the following unsupported characters:<br />%s',
'UPDATE_COMMENT' => 'Update comment',

View file

@ -446,6 +446,7 @@ $lang = array_merge($lang, array(
'RECIPIENT' => 'Recipient',
'RECIPIENTS' => 'Recipients',
'REGISTRATION' => 'Registration',
'OAUTH_REGISTRATION' => 'Registration using external services',
'RELEASE_MESSAGES' => '%sRelease all on-hold messages%s… they will be re-sorted into the appropriate folder if enough space is made available.',
'REMOVE_ADDRESS' => 'Remove address',
'REMOVE_SELECTED_BOOKMARKS' => 'Remove selected bookmarks',

View file

@ -99,6 +99,8 @@ class delete
$this->set_sql_constraints($mode);
$sql_id = $this->sql_id;
/**
* Perform additional actions before collecting data for attachment(s) deletion
*
@ -117,11 +119,21 @@ class delete
);
extract($this->dispatcher->trigger_event('core.delete_attachments_collect_data_before', compact($vars)));
$this->sql_id = $sql_id;
unset($sql_id);
// Collect post and topic ids for later use if we need to touch remaining entries (if resync is enabled)
$this->collect_attachment_info($resync);
// Delete attachments from database
$this->delete_attachments_from_db();
$this->delete_attachments_from_db($mode, $ids, $resync);
$sql_id = $this->sql_id;
$post_ids = $this->post_ids;
$topic_ids = $this->topic_ids;
$message_ids = $this->message_ids;
$physical = $this->physical;
$num_deleted = $this->num_deleted;
/**
* Perform additional actions after attachment(s) deletion from the database
@ -151,13 +163,21 @@ class delete
);
extract($this->dispatcher->trigger_event('core.delete_attachments_from_database_after', compact($vars)));
$this->sql_id = $sql_id;
$this->post_ids = $post_ids;
$this->topic_ids = $topic_ids;
$this->message_ids = $message_ids;
$this->physical = $physical;
$this->num_deleted = $num_deleted;
unset($sql_id, $post_ids, $topic_ids, $message_ids, $physical, $num_deleted);
if (!$this->num_deleted)
{
return 0;
}
// Delete attachments from storage
$this->remove_from_storage();
$this->remove_from_storage($mode, $ids, $resync);
// If we do not resync, we do not need to adjust any message, post, topic or user entries
if (!$resync)
@ -283,8 +303,14 @@ class delete
/**
* Delete attachments from database table
*/
protected function delete_attachments_from_db()
protected function delete_attachments_from_db($mode, $ids, $resync)
{
$sql_id = $this->sql_id;
$post_ids = $this->post_ids;
$topic_ids = $this->topic_ids;
$message_ids = $this->message_ids;
$physical = $this->physical;
/**
* Perform additional actions before attachment(s) deletion
*
@ -311,6 +337,13 @@ class delete
);
extract($this->dispatcher->trigger_event('core.delete_attachments_before', compact($vars)));
$this->sql_id = $sql_id;
$this->post_ids = $post_ids;
$this->topic_ids = $topic_ids;
$this->message_ids = $message_ids;
$this->physical = $physical;
unset($sql_id, $post_ids, $topic_ids, $message_ids, $physical);
// Delete attachments
$sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $this->db->sql_in_set($this->sql_id, $this->ids);
@ -324,7 +357,7 @@ class delete
/**
* Delete attachments from storage
*/
protected function remove_from_storage()
protected function remove_from_storage($mode, $ids, $resync)
{
$space_removed = $files_removed = 0;
@ -343,6 +376,13 @@ class delete
}
}
$sql_id = $this->sql_id;
$post_ids = $this->post_ids;
$topic_ids = $this->topic_ids;
$message_ids = $this->message_ids;
$physical = $this->physical;
$num_deleted = $this->num_deleted;
/**
* Perform additional actions after attachment(s) deletion from the filesystem
*
@ -375,6 +415,14 @@ class delete
);
extract($this->dispatcher->trigger_event('core.delete_attachments_from_filesystem_after', compact($vars)));
$this->sql_id = $sql_id;
$this->post_ids = $post_ids;
$this->topic_ids = $topic_ids;
$this->message_ids = $message_ids;
$this->physical = $physical;
$this->num_deleted = $num_deleted;
unset($sql_id, $post_ids, $topic_ids, $message_ids, $physical, $num_deleted);
if ($space_removed || $files_removed)
{
$this->config->increment('upload_dir_size', $space_removed * (-1), false);

View file

@ -254,8 +254,6 @@ class upload
{
fclose($fp);
}
$this->storage->track_file($destination_name);
}
else
{

View file

@ -392,7 +392,7 @@ class oauth extends \phpbb\auth\provider\base
if ($credentials['key'] && $credentials['secret'])
{
$actual_name = str_replace('auth.provider.oauth.service.', '', $service_name);
$redirect_url = build_url(false) . '&login=external&oauth_service=' . $actual_name;
$redirect_url = generate_board_url() . '/ucp.' . $this->php_ext . '?mode=login&login=external&oauth_service=' . $actual_name;
$login_data['BLOCK_VARS'][$service_name] = array(
'REDIRECT_URL' => redirect($redirect_url, true),
'SERVICE_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)],

View file

@ -25,7 +25,11 @@ class apcu extends \phpbb\cache\driver\memory
*/
function purge()
{
apcu_clear_cache();
/*
* Use an iterator to selectively delete our cache entries without disturbing
* any other cache users (e.g. other phpBB boards hosted on this server)
*/
apcu_delete(new \APCUIterator('#^' . $this->key_prefix . '#'));
parent::purge();
}

View file

@ -51,10 +51,11 @@ abstract class memory extends \phpbb\cache\driver\base
function load()
{
// grab the global cache
$this->vars = $this->_read('global');
$data = $this->_read('global');
if ($this->vars !== false)
if ($data !== false)
{
$this->vars = $data;
return true;
}

View file

@ -471,13 +471,18 @@ class installer
$composer = Factory::create($io, null, false);
$core_packages = $this->get_core_packages($composer);
// The composer/installers package must be installed on his own and not provided by the existing autoloader
$core_replace = $core_packages;
unset($core_replace['composer/installers']);
$ext_json_data = [
'require' => array_merge(
['php' => $this->get_core_php_requirement($composer)],
$core_packages,
$this->get_extra_dependencies(),
$packages),
'replace' => $core_packages,
'replace' => $core_replace,
'repositories' => $this->get_composer_repositories(),
'config' => [
'vendor-dir'=> $this->packages_vendor_dir,

View file

@ -55,21 +55,26 @@ class prune_all_forums extends \phpbb\cron\task\base
include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext);
}
$sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, forum_flags, prune_freq
FROM ' . FORUMS_TABLE . "
WHERE enable_prune = 1
AND prune_next < " . time();
$sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, enable_shadow_prune, prune_shadow_days, prune_shadow_freq, prune_shadow_next, forum_flags, prune_freq
FROM ' . FORUMS_TABLE;
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
if ($row['prune_days'])
if ($row['enable_prune'] && $row['prune_next'] < time())
{
auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']);
}
if ($row['prune_days'])
{
auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']);
}
if ($row['prune_viewed'])
if ($row['prune_viewed'])
{
auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']);
}
}
if ($row['enable_shadow_prune'] && $row['prune_shadow_next'] < time() && $row['prune_shadow_days'])
{
auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']);
auto_prune($row['forum_id'], 'shadow', $row['forum_flags'], $row['prune_shadow_days'], $row['prune_shadow_freq']);
}
}
$this->db->sql_freeresult($result);

View file

@ -267,7 +267,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
unset($row['line2'], $row['line3']);
}
}
return (count($row)) ? $row : false;
return ($row !== null) ? $row : false;
}
/**

View file

@ -17,7 +17,7 @@ class auth_provider_oauth extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_table_exists($this->table_prefix . 'auth_provider_oauth');
return $this->db_tools->sql_table_exists($this->table_prefix . 'oauth_tokens');
}
static public function depends_on()

View file

@ -85,13 +85,11 @@ class remove_outdated_media extends \phpbb\db\migration\migration
WHERE ' . $this->db->sql_in_set('group_id', $group_ids);
}
$result = $this->db->sql_query($sql);
$this->db->sql_freeresult($result);
$this->db->sql_query($sql);
// delete the now empty, outdated media extension groups
$sql = 'DELETE FROM ' . EXTENSION_GROUPS_TABLE . '
WHERE ' . $this->db->sql_in_set('group_id', $group_ids);
$result = $this->db->sql_query($sql);
$this->db->sql_freeresult($result);
$this->db->sql_query($sql);
}
}

View file

@ -0,0 +1,37 @@
<?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\v32x;
class forum_topics_per_page_type extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v32x\v323',
);
}
public function update_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'forums' => array(
'forum_topics_per_page' => array('USINT', 0),
),
),
);
}
}

View file

@ -0,0 +1,37 @@
<?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\v32x;
class v323 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.2.3', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v32x\v323rc2',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.2.3')),
);
}
}

View file

@ -0,0 +1,33 @@
<?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\v330;
class extensions_composer_2 extends \phpbb\db\migration\migration
{
public function update_data()
{
$repositories = json_decode($this->config['exts_composer_repositories'], true);
$repositories[] = 'https://satis.phpbb.com';
$repositories = array_unique($repositories);
return array(
array('config.update', array('exts_composer_repositories', json_encode($repositories, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES))),
);
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v330\extensions_composer');
}
}

View file

@ -74,13 +74,11 @@ class remove_attachment_flash extends \phpbb\db\migration\migration
WHERE ' . $this->db->sql_in_set('group_id', $group_ids);
}
$result = $this->db->sql_query($sql);
$this->db->sql_freeresult($result);
$this->db->sql_query($sql);
// delete the now empty, outdated media extension groups
$sql = 'DELETE FROM ' . EXTENSION_GROUPS_TABLE . '
WHERE ' . $this->db->sql_in_set('group_id', $group_ids);
$result = $this->db->sql_query($sql);
$this->db->sql_freeresult($result);
$this->db->sql_query($sql);
}
}

View file

@ -13,7 +13,7 @@
namespace phpbb\db\migration\data\v330;
class storage_adapter_local_depth extends \phpbb\db\migration\migration
class storage_adapter_local_subfolders extends \phpbb\db\migration\migration
{
static public function depends_on()
{
@ -29,15 +29,15 @@ class storage_adapter_local_depth extends \phpbb\db\migration\migration
return array(
array('if', array(
($this->config['storage\\attachment\\provider'] == \phpbb\storage\provider\local::class),
array('config.add', array('storage\\attachment\\config\\depth', '0')),
array('config.add', array('storage\\attachment\\config\\subfolders', '0')),
)),
array('if', array(
($this->config['storage\\avatar\\provider'] == \phpbb\storage\provider\local::class),
array('config.add', array('storage\\avatar\\config\\depth', '0')),
array('config.add', array('storage\\avatar\\config\\subfolders', '0')),
)),
array('if', array(
($this->config['storage\\backup\\provider'] == \phpbb\storage\provider\local::class),
array('config.add', array('storage\\backup\\config\\depth', '0')),
array('config.add', array('storage\\backup\\config\\subfolders', '0')),
)),
);
}

View file

@ -86,7 +86,14 @@ class storage_track extends \phpbb\db\migration\container_aware_migration
$ext = substr(strrchr($filename, '.'), 1);
$filename = (int) $filename;
$storage->track_file($this->config['avatar_salt'] . '_' . ($avatar_group ? 'g' : '') . $filename . '.' . $ext);
try
{
$storage->track_file($this->config['avatar_salt'] . '_' . ($avatar_group ? 'g' : '') . $filename . '.' . $ext);
}
catch (\phpbb\storage\exception\exception $e)
{
// If file don't exist, don't track it
}
}
$this->db->sql_freeresult($result);
}
@ -103,11 +110,25 @@ class storage_track extends \phpbb\db\migration\container_aware_migration
while ($row = $this->db->sql_fetchrow($result))
{
$storage->track_file($row['physical_filename']);
try
{
$storage->track_file($row['physical_filename']);
}
catch (\phpbb\storage\exception\exception $e)
{
// If file don't exist, don't track it
}
if ($row['thumbnail'] == 1)
{
$storage->track_file('thumb_' . $row['physical_filename']);
try
{
$storage->track_file('thumb_' . $row['physical_filename']);
}
catch (\phpbb\storage\exception\exception $e)
{
// If file don't exist, don't track it
}
}
}
$this->db->sql_freeresult($result);
@ -125,8 +146,16 @@ class storage_track extends \phpbb\db\migration\container_aware_migration
while ($row = $this->db->sql_fetchrow($result))
{
$storage->track_file($row['filename']);
try
{
$storage->track_file($row['filename']);
}
catch (\phpbb\storage\exception\exception $e)
{
// If file don't exist, don't track it
}
}
$this->db->sql_freeresult($result);
}
}

View file

@ -341,7 +341,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
}
// Clear the Modules Cache
$this->cache->destroy("_modules_$class");
$this->module_manager->remove_cache_file($class);
}
/**
@ -425,7 +425,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
$this->module_manager->delete_module($module_id, $class);
}
$this->cache->destroy("_modules_$class");
$this->module_manager->remove_cache_file($class);
}
}

View file

@ -486,7 +486,7 @@ class container_builder
$cached_container_dump = $dumper->dump(array(
'class' => 'phpbb_cache_container',
'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder',
'base_class' => 'Symfony\\Component\\DependencyInjection\\Container',
));
$cache->write($cached_container_dump, $this->container->getResources());

View file

@ -31,12 +31,14 @@ class container_configuration implements ConfigurationInterface
$rootNode
->children()
->booleanNode('require_dev_dependencies')->defaultValue(false)->end()
->booleanNode('allow_install_dir')->defaultValue(false)->end()
->arrayNode('debug')
->addDefaultsIfNotSet()
->children()
->booleanNode('exceptions')->defaultValue(false)->end()
->booleanNode('load_time')->defaultValue(false)->end()
->booleanNode('sql_explain')->defaultValue(false)->end()
->booleanNode('memory')->defaultValue(false)->end()
->booleanNode('show_errors')->defaultValue(false)->end()
->end()
->end()
@ -55,6 +57,12 @@ class container_configuration implements ConfigurationInterface
->booleanNode('composer_verbose')->defaultValue(false)->end()
->end()
->end()
->arrayNode('session')
->addDefaultsIfNotSet()
->children()
->booleanNode('log_errors')->defaultValue(false)->end()
->end()
->end()
->end()
;
return $treeBuilder;

View file

@ -72,6 +72,8 @@ class core extends Extension
}
}
$container->setParameter('allow_install_dir', $config['allow_install_dir']);
// Set the Twig options if defined in the environment
$definition = $container->getDefinition('template.twig.environment');
$twig_environment_options = $definition->getArgument(static::TWIG_OPTIONS_POSITION);
@ -110,6 +112,12 @@ class core extends Extension
{
$container->setParameter('debug.' . $name, $value);
}
// Set the log options
foreach ($config['session'] as $name => $value)
{
$container->setParameter('session.' . $name, $value);
}
}
/**

View file

@ -439,16 +439,9 @@ class md_exporter
$event_list = array();
$file_content = file_get_contents($this->path . $file);
$events = explode('<!-- EVENT ', $file_content);
// Remove the code before the first event
array_shift($events);
foreach ($events as $event)
{
$event = explode(' -->', $event, 2);
$event_list[] = array_shift($event);
}
preg_match_all('/(?:{%|<!--) EVENT (.*) (?:%}|-->)/U', $file_content, $event_list);
return $event_list;
return $event_list[1];
}
/**

View file

@ -456,8 +456,6 @@ class filespec_storage
{
fclose($fp);
}
$storage->track_file($this->destination_file);
}
catch (\phpbb\storage\exception\exception $e)
{

View file

@ -68,7 +68,7 @@ class filesystem implements filesystem_interface
$error = trim($e->getMessage());
$file = substr($error, strrpos($error, ' '));
throw new filesystem_exception('CANNOT_CHANGE_FILE_GROUP', $file, array(), $e);
throw new filesystem_exception('FILESYSTEM_CANNOT_CHANGE_FILE_GROUP', $file, array(), $e);
}
}
@ -125,14 +125,14 @@ class filesystem implements filesystem_interface
{
if (true !== @chmod($file, $dir_perm))
{
throw new filesystem_exception('CANNOT_CHANGE_FILE_PERMISSIONS', $file, array());
throw new filesystem_exception('FILESYSTEM_CANNOT_CHANGE_FILE_PERMISSIONS', $file, array());
}
}
else if (is_file($file))
{
if (true !== @chmod($file, $file_perm))
{
throw new filesystem_exception('CANNOT_CHANGE_FILE_PERMISSIONS', $file, array());
throw new filesystem_exception('FILESYSTEM_CANNOT_CHANGE_FILE_PERMISSIONS', $file, array());
}
}
}
@ -154,7 +154,7 @@ class filesystem implements filesystem_interface
$error = trim($e->getMessage());
$file = substr($error, strrpos($error, ' '));
throw new filesystem_exception('CANNOT_CHANGE_FILE_GROUP', $file, array(), $e);
throw new filesystem_exception('FILESYSTEM_CANNOT_CHANGE_FILE_GROUP', $file, array(), $e);
}
}
@ -177,7 +177,7 @@ class filesystem implements filesystem_interface
}
catch (IOException $e)
{
throw new filesystem_exception('CANNOT_COPY_FILES', '', array(), $e);
throw new filesystem_exception('FILESYSTEM_CANNOT_COPY_FILES', '', array(), $e);
}
}
@ -192,7 +192,7 @@ class filesystem implements filesystem_interface
}
catch (IOException $e)
{
throw new filesystem_exception('CANNOT_DUMP_FILE', $filename, array(), $e);
throw new filesystem_exception('FILESYSTEM_CANNOT_DUMP_FILE', $filename, array(), $e);
}
}
@ -304,7 +304,7 @@ class filesystem implements filesystem_interface
$msg = $e->getMessage();
$filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"'));
throw new filesystem_exception('CANNOT_MIRROR_DIRECTORY', $filename, array(), $e);
throw new filesystem_exception('FILESYSTEM_CANNOT_MIRROR_DIRECTORY', $filename, array(), $e);
}
}
@ -322,7 +322,7 @@ class filesystem implements filesystem_interface
$msg = $e->getMessage();
$filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"'));
throw new filesystem_exception('CANNOT_CREATE_DIRECTORY', $filename, array(), $e);
throw new filesystem_exception('FILESYSTEM_CANNOT_CREATE_DIRECTORY', $filename, array(), $e);
}
}
@ -487,7 +487,7 @@ class filesystem implements filesystem_interface
$error = trim($e->getMessage());
$file = substr($error, strrpos($error, ' '));
throw new filesystem_exception('CANNOT_DELETE_FILES', $file, array(), $e);
throw new filesystem_exception('FILESYSTEM_CANNOT_DELETE_FILES', $file, array(), $e);
}
}
@ -505,7 +505,7 @@ class filesystem implements filesystem_interface
$msg = $e->getMessage();
$filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"'));
throw new filesystem_exception('CANNOT_RENAME_FILE', $filename, array(), $e);
throw new filesystem_exception('FILESYSTEM_CANNOT_RENAME_FILE', $filename, array(), $e);
}
}
@ -520,7 +520,7 @@ class filesystem implements filesystem_interface
}
catch (IOException $e)
{
throw new filesystem_exception('CANNOT_CREATE_SYMLINK', $origin_dir, array(), $e);
throw new filesystem_exception('FILESYSTEM_CANNOT_CREATE_SYMLINK', $origin_dir, array(), $e);
}
}
@ -540,7 +540,7 @@ class filesystem implements filesystem_interface
$error = trim($e->getMessage());
$file = substr($error, strrpos($error, ' '));
throw new filesystem_exception('CANNOT_TOUCH_FILES', $file, array(), $e);
throw new filesystem_exception('FILESYSTEM_CANNOT_TOUCH_FILES', $file, array(), $e);
}
}

View file

@ -122,8 +122,11 @@ class check_update extends task_base
// Check for a valid update directory
if (!$this->filesystem->exists($update_files) || !$this->filesystem->is_readable($update_files))
{
$this->iohandler->add_warning_message('UPDATE_FILES_NOT_FOUND');
$this->set_test_passed(false);
if ($this->iohandler->get_input('update_type', 'all') === 'all')
{
$this->iohandler->add_warning_message('UPDATE_FILES_NOT_FOUND');
$this->set_test_passed(false);
}
// If there are no update files, we can't check the version etc
// However, we can let the users run migrations if they really want to...

View file

@ -87,7 +87,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
$banned_users = phpbb_get_banned_user_ids($user_ids);
// Load all the users we need
$this->user_loader->load_users($user_ids);
$this->user_loader->load_users(array_diff($user_ids, $banned_users), array(USER_IGNORE));
// Load the messenger
if (!class_exists('messenger'))
@ -107,7 +107,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
$user = $this->user_loader->get_user($notification->user_id);
if ($user['user_type'] == USER_IGNORE || ($user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL) || in_array($notification->user_id, $banned_users))
if ($user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL)
{
continue;
}

View file

@ -150,8 +150,6 @@ class request implements \phpbb\request\request_interface
return;
}
$this->type_cast_helper->add_magic_quotes($value);
// setting to null means unsetting
if ($value === null)
{

View file

@ -18,69 +18,6 @@ namespace phpbb\request;
*/
class type_cast_helper implements \phpbb\request\type_cast_helper_interface
{
/**
* @var string Whether slashes need to be stripped from input
*/
protected $strip;
/**
* Initialises the type cast helper class.
* All it does is find out whether magic quotes are turned on.
*/
public function __construct()
{
if (version_compare(PHP_VERSION, '5.4.0-dev', '>='))
{
$this->strip = false;
}
else
{
$this->strip = (@get_magic_quotes_gpc()) ? true : false;
}
}
/**
* Recursively applies addslashes to a variable.
*
* @param mixed &$var Variable passed by reference to which slashes will be added.
*/
public function addslashes_recursively(&$var)
{
if (is_string($var))
{
$var = addslashes($var);
}
else if (is_array($var))
{
$var_copy = $var;
$var = array();
foreach ($var_copy as $key => $value)
{
if (is_string($key))
{
$key = addslashes($key);
}
$var[$key] = $value;
$this->addslashes_recursively($var[$key]);
}
}
}
/**
* Recursively applies addslashes to a variable if magic quotes are turned on.
*
* @param mixed &$var Variable passed by reference to which slashes will be added.
*/
public function add_magic_quotes(&$var)
{
if ($this->strip)
{
$this->addslashes_recursively($var);
}
}
/**
* Set variable $result to a particular type.
*
@ -129,8 +66,6 @@ class type_cast_helper implements \phpbb\request\type_cast_helper_interface
$result = preg_replace('/[\x80-\xFF]/', '?', $result);
}
}
$result = ($this->strip) ? stripslashes($result) : $result;
}
}

View file

@ -18,20 +18,6 @@ namespace phpbb\request;
*/
interface type_cast_helper_interface
{
/**
* Recursively applies addslashes to a variable.
*
* @param mixed &$var Variable passed by reference to which slashes will be added.
*/
public function addslashes_recursively(&$var);
/**
* Recursively applies addslashes to a variable if magic quotes are turned on.
*
* @param mixed &$var Variable passed by reference to which slashes will be added.
*/
public function add_magic_quotes(&$var);
/**
* Set variable $result to a particular type.
*

View file

@ -292,7 +292,6 @@ class fulltext_sphinx
AND p.post_id >= $start AND p.post_id <= $end'),
array('sql_query_post', ''),
array('sql_query_post_index', 'UPDATE ' . SPHINX_TABLE . ' SET max_doc_id = $maxid WHERE counter_id = 1'),
array('sql_query_info', 'SELECT * FROM ' . POSTS_TABLE . ' WHERE post_id = $id'),
array('sql_attr_uint', 'forum_id'),
array('sql_attr_uint', 'topic_id'),
array('sql_attr_uint', 'poster_id'),
@ -333,7 +332,6 @@ class fulltext_sphinx
array('morphology', 'none'),
array('stopwords', ''),
array('min_word_len', '2'),
array('charset_type', 'utf-8'),
array('charset_table', 'U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z, A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6, U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101, U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109, U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F, U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117, U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D, U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135, U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C, U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144, U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B, U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153, U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159, U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161, U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167, U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F, U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175, U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C, U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F, U+4E00..U+9FFF'),
array('min_prefix_len', '0'),
array('min_infix_len', '0'),
@ -346,14 +344,12 @@ class fulltext_sphinx
array('mem_limit', $this->config['fulltext_sphinx_indexer_mem_limit'] . 'M'),
),
'searchd' => array(
array('compat_sphinxql_magics' , '0'),
array('listen' , ($this->config['fulltext_sphinx_host'] ? $this->config['fulltext_sphinx_host'] : 'localhost') . ':' . ($this->config['fulltext_sphinx_port'] ? $this->config['fulltext_sphinx_port'] : '9312')),
array('log', $this->config['fulltext_sphinx_data_path'] . 'log/searchd.log'),
array('query_log', $this->config['fulltext_sphinx_data_path'] . 'log/sphinx-query.log'),
array('read_timeout', '5'),
array('max_children', '30'),
array('pid_file', $this->config['fulltext_sphinx_data_path'] . 'searchd.pid'),
array('max_matches', (string) SPHINX_MAX_MATCHES),
array('binlog_path', $this->config['fulltext_sphinx_data_path']),
),
);
@ -648,7 +644,7 @@ class fulltext_sphinx
$this->sphinx->SetFilter('deleted', array(0));
$this->sphinx->SetLimits($start, (int) $per_page, SPHINX_MAX_MATCHES);
$this->sphinx->SetLimits((int) $start, (int) $per_page, SPHINX_MAX_MATCHES);
$result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('&quot;', '"', $this->search_query)), $this->indexes);
// Could be connection to localhost:9312 failed (errno=111,

View file

@ -481,7 +481,7 @@ class session
else
{
// Added logging temporarily to help debug bugs...
if (defined('DEBUG') && $this->data['user_id'] != ANONYMOUS)
if ($phpbb_container->getParameter('session.log_errors') && $this->data['user_id'] != ANONYMOUS)
{
if ($referer_valid)
{

View file

@ -28,8 +28,7 @@ interface adapter_interface
* @param string path The file to be written to.
* @param string content The data to write into the file.
*
* @throws \phpbb\storage\exception\exception When the file already exists
* When the file cannot be written
* @throws \phpbb\storage\exception\exception When the file cannot be written
*/
public function put_contents($path, $content);
@ -38,8 +37,7 @@ interface adapter_interface
*
* @param string $path The file to read
*
* @throws \phpbb\storage\exception\exception When the file doesn't exist
* When cannot read file contents
* @throws \phpbb\storage\exception\exception When cannot read file contents
*
* @return string Returns file contents
*
@ -70,8 +68,7 @@ interface adapter_interface
* @param string $path_orig The original file/direcotry
* @param string $path_dest The target file/directory
*
* @throws \phpbb\storage\exception\exception When target exists
* When file/directory cannot be renamed
* @throws \phpbb\storage\exception\exception When file/directory cannot be renamed
*/
public function rename($path_orig, $path_dest);
@ -81,8 +78,7 @@ interface adapter_interface
* @param string $path_orig The original filename
* @param string $path_dest The target filename
*
* @throws \phpbb\storage\exception\exception When target exists
* When the file cannot be copied
* @throws \phpbb\storage\exception\exception When the file cannot be copied
*/
public function copy($path_orig, $path_dest);

View file

@ -73,10 +73,17 @@ class local implements adapter_interface, stream_interface
* This is for those who have problems storing a large number of files in
* a single directory.
* More info: https://tracker.phpbb.com/browse/PHPBB3-15371
*
*/
/*
* @var bool subfolders
*/
protected $subfolders;
/*
* @var int dir_depth
*/
protected $dir_depth;
protected $dir_depth = 2;
/**
* Constructor
@ -101,7 +108,7 @@ class local implements adapter_interface, stream_interface
$this->path = $options['path'];
$this->root_path = $this->phpbb_root_path . $options['path'];
$this->dir_depth = (int) $options['depth'];
$this->subfolders = (bool) $options['subfolders'];
}
/**
@ -111,11 +118,6 @@ class local implements adapter_interface, stream_interface
{
$this->ensure_directory_exists($path);
if ($this->exists($path))
{
throw new exception('STORAGE_FILE_EXISTS', $path);
}
try
{
$this->filesystem->dump_file($this->root_path . $this->get_path($path) . $this->get_filename($path), $content);
@ -131,11 +133,6 @@ class local implements adapter_interface, stream_interface
*/
public function get_contents($path)
{
if (!$this->exists($path))
{
throw new exception('STORAGE_FILE_NO_EXIST', $path);
}
$content = @file_get_contents($this->root_path . $this->get_path($path) . $this->get_filename($path));
if ($content === false)
@ -249,17 +246,20 @@ class local implements adapter_interface, stream_interface
*/
protected function remove_empty_dirs($path)
{
$dirpath = dirname($this->root_path . $path);
$filepath = dirname($this->root_path . $this->get_path($path) . $this->get_filename($path));
$path = filesystem_helper::make_path_relative($filepath, $dirpath);
do
if ($this->subfolders)
{
$parts = explode('/', $path);
$parts = array_slice($parts, 0, -1);
$path = implode('/', $parts);
$dirpath = dirname($this->root_path . $path);
$filepath = dirname($this->root_path . $this->get_path($path) . $this->get_filename($path));
$path = filesystem_helper::make_path_relative($filepath, $dirpath);
do
{
$parts = explode('/', $path);
$parts = array_slice($parts, 0, -1);
$path = implode('/', $parts);
}
while ($path && @rmdir($dirpath . '/' . $path));
}
while ($path && @rmdir($dirpath . '/' . $path));
}
/**
@ -271,21 +271,22 @@ class local implements adapter_interface, stream_interface
protected function get_path($path)
{
$dirname = dirname($path);
$dirname = ($dirname != '.') ? $dirname . DIRECTORY_SEPARATOR : '';
$hash = md5(basename($path));
$parts = str_split($hash, 2);
$parts = array_slice($parts, 0, $this->dir_depth);
// Create path
$path = $dirname . DIRECTORY_SEPARATOR;
if (!empty($parts))
if ($this->subfolders)
{
$path .= implode(DIRECTORY_SEPARATOR, $parts) . DIRECTORY_SEPARATOR;
$hash = md5(basename($path));
$parts = str_split($hash, 2);
$parts = array_slice($parts, 0, $this->dir_depth);
if (!empty($parts))
{
$dirname .= implode(DIRECTORY_SEPARATOR, $parts) . DIRECTORY_SEPARATOR;
}
}
return $path;
return $dirname;
}
/**
@ -320,11 +321,6 @@ class local implements adapter_interface, stream_interface
{
$this->ensure_directory_exists($path);
if ($this->exists($path))
{
throw new exception('STORAGE_FILE_EXISTS', $path);
}
$stream = @fopen($this->root_path . $this->get_path($path) . $this->get_filename($path), 'w+b');
if (!$stream)
@ -337,6 +333,8 @@ class local implements adapter_interface, stream_interface
fclose($stream);
throw new exception('STORAGE_CANNOT_COPY_RESOURCE');
}
fclose($stream);
}
/**
@ -350,7 +348,7 @@ class local implements adapter_interface, stream_interface
*/
public function file_size($path)
{
$size = filesize($this->root_path . $this->get_path($path) . $this->get_filename($path));
$size = @filesize($this->root_path . $this->get_path($path) . $this->get_filename($path));
if ($size === null)
{
@ -422,7 +420,7 @@ class local implements adapter_interface, stream_interface
*/
public function get_link($path)
{
return generate_board_url() . $this->path . $path;
return generate_board_url() . '/' . $this->path . $path;
}
/**

View file

@ -37,8 +37,14 @@ class local implements provider_interface
public function get_options()
{
return [
'path' => array('type' => 'text'),
'depth' => array('type' => 'text'),
'path' => ['type' => 'text'],
'subfolders' => [
'type' => 'radio',
'options' => [
'ENABLE' => '1',
'DISABLE' => '0',
],
],
];
}

View file

@ -15,6 +15,7 @@ namespace phpbb\storage;
use phpbb\cache\driver\driver_interface as cache;
use phpbb\db\driver\driver_interface as db;
use phpbb\storage\exception\exception;
/**
* @internal Experimental
@ -106,6 +107,11 @@ class storage
*/
public function put_contents($path, $content)
{
if ($this->exists($path))
{
throw new exception('STORAGE_FILE_EXISTS', $path);
}
$this->get_adapter()->put_contents($path, $content);
$this->track_file($path);
}
@ -123,19 +129,25 @@ class storage
*/
public function get_contents($path)
{
if (!$this->exists($path))
{
throw new exception('STORAGE_FILE_NO_EXIST', $path);
}
return $this->get_adapter()->get_contents($path);
}
/**
* Checks the existence of files or directories
*
* @param string $path file/directory to check
* @param string $path file/directory to check
* @param bool $full_check check in the filesystem too
*
* @return bool Returns true if the file/directory exist, false otherwise.
* @return bool Returns true if the file/directory exist, false otherwise
*/
public function exists($path)
public function exists($path, $full_check = false)
{
return $this->get_adapter()->exists($path);
return ($this->is_tracked($path) && (!$full_check || $this->get_adapter()->exists($path)));
}
/**
@ -143,10 +155,16 @@ class storage
*
* @param string $path file/directory to remove
*
* @throws \phpbb\storage\exception\exception When removal fails.
* @throws \phpbb\storage\exception\exception When removal fails
* When the file doesn't exist
*/
public function delete($path)
{
if (!$this->exists($path))
{
throw new exception('STORAGE_FILE_NO_EXIST', $path);
}
$this->get_adapter()->delete($path);
$this->untrack_file($path);
}
@ -157,11 +175,22 @@ class storage
* @param string $path_orig The original file/direcotry
* @param string $path_dest The target file/directory
*
* @throws \phpbb\storage\exception\exception When target exists
* @throws \phpbb\storage\exception\exception When the file doesn't exist
* When target exists
* When file/directory cannot be renamed
*/
public function rename($path_orig, $path_dest)
{
if (!$this->exists($path_orig))
{
throw new exception('STORAGE_FILE_NO_EXIST', $path_orig);
}
if ($this->exists($path_dest))
{
throw new exception('STORAGE_FILE_EXISTS', $path_dest);
}
$this->get_adapter()->rename($path_orig, $path_dest);
$this->track_rename($path_orig, $path_dest);
}
@ -172,11 +201,22 @@ class storage
* @param string $path_orig The original filename
* @param string $path_dest The target filename
*
* @throws \phpbb\storage\exception\exception When target exists
* @throws \phpbb\storage\exception\exception When the file doesn't exist
* When target exists
* When the file cannot be copied
*/
public function copy($path_orig, $path_dest)
{
if (!$this->exists($path_orig))
{
throw new exception('STORAGE_FILE_NO_EXIST', $path_orig);
}
if ($this->exists($path_dest))
{
throw new exception('STORAGE_FILE_EXISTS', $path_dest);
}
$this->get_adapter()->copy($path_orig, $path_dest);
$this->track_file($path_dest);
}
@ -186,12 +226,18 @@ class storage
*
* @param string $path File to read
*
* @throws \phpbb\storage\exception\exception When unable to open file
* @throws \phpbb\storage\exception\exception When the file doesn't exist
* When unable to open file
*
* @return resource Returns a file pointer
*/
public function read_stream($path)
{
if (!$this->exists($path))
{
throw new exception('STORAGE_FILE_NO_EXIST', $path);
}
$stream = null;
$adapter = $this->get_adapter();
@ -212,20 +258,31 @@ class storage
/**
* Writes a new file using a stream
* The file needs to be tracked after using this method
*
* @param string $path The target file
* @param resource $resource The resource
*
* @throws \phpbb\storage\exception\exception When target file cannot be created
* @throws \phpbb\storage\exception\exception When the file exist
* When target file cannot be created
*/
public function write_stream($path, $resource)
{
if ($this->exists($path))
{
throw new exception('STORAGE_FILE_EXISTS', $path);
}
if (!is_resource($resource))
{
throw new exception('STORAGE_INVALID_RESOURCE');
}
$adapter = $this->get_adapter();
if ($adapter instanceof stream_interface)
{
$adapter->write_stream($path, $resource);
$this->track_file($path);
}
else
{
@ -242,6 +299,11 @@ class storage
*/
public function track_file($path, $update = false)
{
if (!$this->get_adapter()->exists($path))
{
throw new exception('STORAGE_FILE_NO_EXIST', $path);
}
$sql_ary = array(
'file_path' => $path,
'storage' => $this->get_name(),
@ -256,7 +318,10 @@ class storage
if (!$row)
{
$file = $this->file_info($path);
// Don't call the file_info method, because it check's if the file is tracked
// and is not (for now). This method check if the file exists using the adapter
// at the beginning.
$file = new file_info($this->get_adapter(), $path);
$sql_ary['filesize'] = $file->size;
$sql = 'INSERT INTO ' . $this->storage_table . $this->db->sql_build_array('INSERT', $sql_ary);
@ -295,6 +360,29 @@ class storage
$this->cache->destroy('_storage_' . $this->get_name() . '_numfiles');
}
/**
* Check if a file is tracked
*
* @param string $path The file
*
* @return bool True if file is tracked
*/
public function is_tracked($path)
{
$sql_ary = array(
'file_path' => $path,
'storage' => $this->get_name(),
);
$sql = 'SELECT file_id FROM ' . $this->storage_table . '
WHERE ' . $this->db->sql_build_array('SELECT', $sql_ary);
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
return ($row) ? true : false;
}
/**
* Rename tracked file
*
@ -316,11 +404,17 @@ class storage
* @param string $path The file
*
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
* When the file doesn't exist
*
* @return \phpbb\storage\file_info Returns file_info object
*/
public function file_info($path)
{
if (!$this->exists($path))
{
throw new exception('STORAGE_FILE_NO_EXIST', $path);
}
return new file_info($this->get_adapter(), $path);
}

View file

@ -110,7 +110,7 @@ class user extends \phpbb\session
function setup($lang_set = false, $style_id = false)
{
global $db, $request, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache;
global $phpbb_dispatcher;
global $phpbb_dispatcher, $phpbb_container;
$this->language->set_default_language($config['default_lang']);
@ -189,6 +189,9 @@ class user extends \phpbb\session
/**
* Event to load language files and modify user data on every page
*
* Note: To load language file with this event, see description
* of lang_set_ext variable.
*
* @event core.user_setup
* @var array user_data Array with user's data row
* @var string user_lang_name Basename of the user's langauge
@ -325,7 +328,7 @@ class user extends \phpbb\session
// Disable board if the install/ directory is still present
// For the brave development army we do not care about this, else we need to comment out this every time we develop locally
if (!defined('DEBUG') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install'))
if (!$phpbb_container->getParameter('allow_install_dir') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install'))
{
// Adjust the message slightly according to the permissions
if ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))

View file

@ -64,8 +64,9 @@ class user_loader
* Load user helper
*
* @param array $user_ids
* @param array $ignore_types user types to ignore
*/
public function load_users(array $user_ids)
public function load_users(array $user_ids, array $ignore_types = array())
{
$user_ids[] = ANONYMOUS;
@ -79,7 +80,8 @@ class user_loader
{
$sql = 'SELECT *
FROM ' . $this->users_table . '
WHERE ' . $this->db->sql_in_set('user_id', $user_ids);
WHERE ' . $this->db->sql_in_set('user_id', $user_ids) . '
AND ' . $this->db->sql_in_set('user_type', $ignore_types, true, true);
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))

View file

@ -33,7 +33,6 @@ $post_id = $request->variable('p', 0);
$topic_id = $request->variable('t', 0);
$forum_id = $request->variable('f', 0);
$draft_id = $request->variable('d', 0);
$lastclick = $request->variable('lastclick', 0);
$preview = (isset($_POST['preview'])) ? true : false;
$save = (isset($_POST['save'])) ? true : false;
@ -41,7 +40,7 @@ $load = (isset($_POST['load'])) ? true : false;
$confirm = $request->is_set_post('confirm');
$cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false;
$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview);
$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || $save || $load || $preview);
$submit = $request->is_set_post('post') && !$refresh && !$preview;
$mode = $request->variable('mode', '');
@ -68,7 +67,6 @@ $current_time = time();
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum
* @var int draft_id ID of the draft
* @var int lastclick Timestamp of when the form was last loaded
* @var bool submit Whether or not the form has been submitted
* @var bool preview Whether or not the post is being previewed
* @var bool save Whether or not a draft is being saved
@ -85,13 +83,13 @@ $current_time = time();
* language keys.
* @since 3.1.0-a1
* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist
* @changed 3.2.4-RC1 Remove unused 'lastclick' var
*/
$vars = array(
'post_id',
'topic_id',
'forum_id',
'draft_id',
'lastclick',
'submit',
'preview',
'save',
@ -354,7 +352,6 @@ switch ($mode)
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum
* @var int draft_id ID of the draft
* @var int lastclick Timestamp of when the form was last loaded
* @var bool submit Whether or not the form has been submitted
* @var bool preview Whether or not the post is being previewed
* @var bool save Whether or not a draft is being saved
@ -370,13 +367,13 @@ switch ($mode)
* @var array post_data All post data from database
* @since 3.1.3-RC1
* @changed 3.1.10-RC1 Added post_data
* @changed 3.2.4-RC1 Remove unused 'lastclick' var
*/
$vars = array(
'post_id',
'topic_id',
'forum_id',
'draft_id',
'lastclick',
'submit',
'preview',
'save',
@ -1630,35 +1627,14 @@ if ($generate_quote)
// Remove attachment bbcode tags from the quoted message to avoid mixing with the new post attachments if any
$message_parser->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#uis', '\\2', $message_parser->message);
if ($config['allow_bbcode'])
{
$message_parser->message = $bbcode_utils->generate_quote(
censor_text($message_parser->message),
array(
'author' => $post_data['quote_username'],
'post_id' => $post_data['post_id'],
'time' => $post_data['post_time'],
'user_id' => $post_data['poster_id'],
)
);
$message_parser->message .= "\n\n";
}
else
{
$offset = 0;
$quote_string = "&gt; ";
$message = censor_text(trim($message_parser->message));
// see if we are nesting. It's easily tricked but should work for one level of nesting
if (strpos($message, "&gt;") !== false)
{
$offset = 10;
}
$message = utf8_wordwrap($message, 75 + $offset, "\n");
$quote_attributes = array(
'author' => $post_data['quote_username'],
'post_id' => $post_data['post_id'],
'time' => $post_data['post_time'],
'user_id' => $post_data['poster_id'],
);
$message = $quote_string . $message;
$message = str_replace("\n", "\n" . $quote_string, $message);
$message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . ":\n" . $message . "\n";
}
phpbb_format_quote($config['allow_bbcode'], $quote_attributes, $bbcode_utils, $message_parser);
}
if (($mode == 'reply' || $mode == 'quote') && !$submit && !$preview && !$refresh)
@ -1762,7 +1738,6 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($c
}
$s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? '<input type="hidden" name="topic_cur_post_id" value="' . $post_data['topic_last_post_id'] . '" />' : '';
$s_hidden_fields .= '<input type="hidden" name="lastclick" value="' . $current_time . '" />';
$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . $request->variable('draft_loaded', $draft_id) . '" />' : '';
if ($mode == 'edit')

View file

@ -35,7 +35,7 @@ $controller_helper = $phpbb_container->get('controller.helper');
$response = new RedirectResponse(
$controller_helper->route($redirect_route_name, array(
'id' => ($pm_id === 0) ? $post_id : $pm_id,
)),
), false),
301
);
$response->send();

View file

@ -199,7 +199,7 @@ phpbb.addAjaxCallback('zebra', function(res) {
*/
phpbb.addAjaxCallback('vote_poll', function(res) {
if (typeof res.success !== 'undefined') {
var poll = $('.topic_poll');
var poll = $(this).closest('.topic_poll');
var panel = poll.find('.panel');
var resultsVisible = poll.find('dl:first-child .resultbar').is(':visible');
var mostVotes = 0;

View file

@ -49,6 +49,8 @@
</dl>
<!-- ENDIF -->
{% EVENT confirm_delete_body_delete_reason_before %}
<dl>
<dt><label for="delete_reason">{L_DELETE_REASON}{L_COLON}</label><br /><span>{L_DELETE_REASON_EXPLAIN}</span></dt>
<dd><input type="text" name="delete_reason" id="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /></dd>

View file

@ -273,11 +273,9 @@ function insertUser(formId, value) {
function insert_marked_users(formId, users) {
'use strict';
for (var i = 0; i < users.length; i++) {
if (users[i].checked) {
insertUser(formId, users[i].value);
}
}
$(users).filter(':checked').each(function() {
insertUser(formId, this.value);
});
window.close();
}
@ -612,7 +610,7 @@ function parseDocument($container) {
// If there are any images in the links list, run the check again after they have loaded
$linksAll.find('img').each(function() {
$(this).load(function() {
$(this).on('load', function() {
check();
});
});

View file

@ -11,10 +11,10 @@
<!-- BEGIN bans -->
ban_length['{bans.BAN_ID}'] = '{bans.A_LENGTH}';
<!-- IF bans.A_REASON -->
ban_reason['{bans.BAN_ID}'] = '{bans.A_REASON}';
ban_reason['{bans.BAN_ID}'] = '{{ bans.A_REASON | e('js') }}';
<!-- ENDIF -->
<!-- IF bans.A_GIVE_REASON -->
ban_give_reason['{bans.BAN_ID}'] = '{bans.A_GIVE_REASON}';
ban_give_reason['{bans.BAN_ID}'] = '{{ bans.A_GIVE_REASON | e('js') }}';
<!-- ENDIF -->
<!-- END bans -->

View file

@ -31,10 +31,12 @@
<form method="post" id="mcp_report" action="{S_CLOSE_ACTION}">
<fieldset class="submit-buttons">
{% EVENT mcp_post_report_buttons_top_before %}
<!-- IF not S_REPORT_CLOSED -->
<input class="button1 button button-form" type="submit" value="{L_CLOSE_REPORT}" name="action[close]" /> &nbsp;
<!-- ENDIF -->
<input class="button1 button button-form-bold" type="submit" value="{L_DELETE_REPORT}" name="action[delete]" />
{% EVENT mcp_post_report_buttons_top_after %}
<input type="hidden" name="report_id_list[]" value="{REPORT_ID}" />
{S_FORM_TOKEN}
</fieldset>
@ -69,8 +71,8 @@
<p class="author">
<strong>{L_SENT_AT}{L_COLON}</strong> {POST_DATE}
<br /><strong>{L_PM_FROM}{L_COLON}</strong> {POST_AUTHOR_FULL}
<!-- IF S_TO_RECIPIENT --><br /><strong>{L_TO}{L_COLON}</strong> <!-- BEGIN to_recipient --><!-- IF to_recipient.NAME_FULL -->{to_recipient.NAME_FULL}<!-- ELSE --><a href="{to_recipient.U_VIEW}" style="color:<!-- IF to_recipient.COLOUR -->{to_recipient.COLOUR}<!-- ELSEIF to_recipient.IS_GROUP -->#0000FF<!-- ENDIF -->;">{to_recipient.NAME}</a><!-- ENDIF -->&nbsp;<!-- END to_recipient --><!-- ENDIF -->
<!-- IF S_BCC_RECIPIENT --><br /><strong>{L_BCC}{L_COLON}</strong> <!-- BEGIN bcc_recipient --><!-- IF bcc_recipient.NAME_FULL -->{bcc_recipient.NAME_FULL}<!-- ELSE --><a href="{bcc_recipient.U_VIEW}" style="color:<!-- IF bcc_recipient.COLOUR -->{bcc_recipient.COLOUR}<!-- ELSEIF bcc_recipient.IS_GROUP -->#0000FF<!-- ENDIF -->;">{bcc_recipient.NAME}</a><!-- ENDIF -->&nbsp;<!-- END bcc_recipient --><!-- ENDIF -->
<!-- IF S_TO_RECIPIENT --><br /><strong>{L_TO}{L_COLON}</strong> <!-- BEGIN to_recipient --><!-- IF to_recipient.NAME_FULL -->{to_recipient.NAME_FULL}<!-- ELSE --><a href="{to_recipient.U_VIEW}"<!-- IF to_recipient.COLOUR --> style="color:{to_recipient.COLOUR};"<!-- ENDIF -->><strong>{to_recipient.NAME}</strong></a><!-- ENDIF -->&nbsp;<!-- END to_recipient --><!-- ENDIF -->
<!-- IF S_BCC_RECIPIENT --><br /><strong>{L_BCC}{L_COLON}</strong> <!-- BEGIN bcc_recipient --><!-- IF bcc_recipient.NAME_FULL -->{bcc_recipient.NAME_FULL}<!-- ELSE --><a href="{bcc_recipient.U_VIEW}"<!-- IF bcc_recipient.COLOUR --> style="color:{bcc_recipient.COLOUR};"<!-- ENDIF -->><strong>{bcc_recipient.NAME}</strong></a><!-- ENDIF -->&nbsp;<!-- END bcc_recipient --><!-- ENDIF -->
</p>
<!-- ELSE -->
<p class="author"><span><i class="icon fa-file fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{MINI_POST_IMG}</span></span> {L_POSTED} {L_POST_BY_AUTHOR} {POST_AUTHOR_FULL} &raquo; {POST_DATE}</p>

View file

@ -178,9 +178,9 @@
</ul>
<ul id="nav-breadcrumbs" class="nav-breadcrumbs linklist navlinks" role="menubar">
<!-- DEFINE $MICRODATA = ' itemtype="http://data-vocabulary.org/Breadcrumb" itemscope=""' -->
<!-- DEFINE $MICRODATA = ' itemtype="http://schema.org/ListItem" itemprop="itemListElement" itemscope' -->
<!-- EVENT overall_header_breadcrumbs_before -->
<li class="breadcrumbs">
<li class="breadcrumbs" itemscope itemtype="http://schema.org/BreadcrumbList">
<!-- IF U_SITE_HOME -->
<span class="crumb" {$MICRODATA}><a href="{U_SITE_HOME}" itemprop="url" data-navbar-reference="home"><i class="icon fa-home fa-fw" aria-hidden="true"></i><span itemprop="title">{L_SITE_HOME}</span></a></span>
<!-- ENDIF -->

View file

@ -19,11 +19,11 @@
<!-- EVENT overall_footer_copyright_append -->
<p class="footer-row">
<a class="footer-link" href="{{ U_PRIVACY }}" title="{{ lang('PRIVACY_LINK') }}" role="menuitem">
<span class="footer-link-text">Privacy</span>
<span class="footer-link-text">{{ lang('PRIVACY_LINK') }}</span>
</a>
|
<a class="footer-link" href="{{ U_TERMS_USE }}" title="{{ lang('TERMS_LINK') }}" role="menuitem">
<span class="footer-link-text">Terms</span>
<span class="footer-link-text">{{ lang('TERMS_LINK') }}</span>
</a>
</p>
<!-- IF DEBUG_OUTPUT -->

View file

@ -38,27 +38,6 @@
<!-- IF S_POST_REVIEW --><!-- INCLUDE posting_review.html --><!-- ENDIF -->
<!-- IF S_UNGLOBALISE -->
<div class="panel bg3">
<div class="inner">
<fieldset class="fields1">
<h2>{L_SELECT_DESTINATION_FORUM}</h2>
<p>{L_UNGLOBALISE_EXPLAIN}</p>
<dl>
<dt><label for="to_forum_id">{L_MOVE}{L_COLON}</label></dt>
<dd><select id="to_forum_id" name="to_forum_id">{S_FORUM_SELECT}</select></dd>
</dl>
<dl>
<dt>&nbsp;</dt>
<dd><input class="button1 button button-form" type="submit" name="post" value="{L_CONFIRM}" /> <input class="button1 button button-form-bold" type="submit" name="cancel_unglobalise" value="{L_CANCEL}" /></dd>
</dl>
</fieldset>
</div>
</div>
<!-- ENDIF -->
<!-- IF S_DISPLAY_PREVIEW --><!-- INCLUDE posting_preview.html --><!-- ENDIF -->
<div class="panel" id="postingbox">

View file

@ -32,7 +32,7 @@
<!-- BEGIN to_recipient -->
<li>
<!-- IF not S_EDIT_POST --><input type="submit" name="remove_{to_recipient.TYPE}[{to_recipient.UG_ID}]" value="x" class="button1 button button-form-bold" /><!-- ENDIF -->
<!-- IF to_recipient.IS_GROUP --><a href="{to_recipient.U_VIEW}"><strong>{to_recipient.NAME}</strong></a><!-- ELSE -->{to_recipient.NAME_FULL}<!-- ENDIF -->
<!-- IF to_recipient.IS_GROUP --><a href="{to_recipient.U_VIEW}" style="color: {{ to_recipient.COLOUR }}"><strong>{to_recipient.NAME}</strong></a><!-- ELSE -->{to_recipient.NAME_FULL}<!-- ENDIF -->
</li>
<!-- END to_recipient -->
</ul>
@ -49,7 +49,7 @@
<!-- BEGIN bcc_recipient -->
<li>
<!-- IF not S_EDIT_POST --><input type="submit" name="remove_{bcc_recipient.TYPE}[{bcc_recipient.UG_ID}]" value="x" class="button1 button button-form-bold" /><!-- ENDIF -->
<!-- IF bcc_recipient.IS_GROUP --><a href="{bcc_recipient.U_VIEW}"><strong>{bcc_recipient.NAME}</strong></a><!-- ELSE -->{bcc_recipient.NAME_FULL}<!-- ENDIF -->
<!-- IF bcc_recipient.IS_GROUP --><a href="{bcc_recipient.U_VIEW}" style="color: {{ bcc_recipient.COLOUR }}"><strong>{bcc_recipient.NAME}</strong></a><!-- ELSE -->{bcc_recipient.NAME_FULL}<!-- ENDIF -->
</li>
<!-- END bcc_recipient -->
</ul>

View file

@ -31,6 +31,8 @@
<div class="content">{PREVIEW_MESSAGE}</div>
<!-- EVENT posting_preview_content_after -->
<!-- IF .attachment -->
<dl class="attachbox">
<dt>{L_ATTACHMENTS}</dt>

View file

@ -60,6 +60,8 @@
<div class="content">{topic_review_row.MESSAGE}</div>
<!-- EVENT posting_topic_review_row_content_after -->
<!-- IF topic_review_row.S_HAS_ATTACHMENTS -->
<dl class="attachbox">
<dt>{L_ATTACHMENTS}</dt>

View file

@ -194,6 +194,7 @@
<div class="postbody">
<h3><a href="{searchresults.U_VIEW_POST}">{searchresults.POST_SUBJECT}</a></h3>
<div class="content">{searchresults.MESSAGE}</div>
<!-- EVENT search_results_content_after -->
</div>
<!-- ENDIF -->

View file

@ -40,5 +40,7 @@
{$SCRIPTS}
{% EVENT simple_footer_body_after %}
</body>
</html>

View file

@ -124,8 +124,8 @@
<p class="author">
<strong>{L_SENT_AT}{L_COLON}</strong> {SENT_DATE}
<br /><strong>{L_PM_FROM}{L_COLON}</strong> {MESSAGE_AUTHOR_FULL}
<!-- IF S_TO_RECIPIENT --><br /><strong>{L_TO}{L_COLON}</strong> <!-- BEGIN to_recipient --><!-- IF to_recipient.NAME_FULL -->{to_recipient.NAME_FULL}<!-- ELSE --><a href="{to_recipient.U_VIEW}" style="color:<!-- IF to_recipient.COLOUR -->{to_recipient.COLOUR}<!-- ELSEIF to_recipient.IS_GROUP -->#0000FF<!-- ENDIF -->;">{to_recipient.NAME}</a><!-- ENDIF -->&nbsp;<!-- END to_recipient --><!-- ENDIF -->
<!-- IF S_BCC_RECIPIENT --><br /><strong>{L_BCC}{L_COLON}</strong> <!-- BEGIN bcc_recipient --><!-- IF bcc_recipient.NAME_FULL -->{bcc_recipient.NAME_FULL}<!-- ELSE --><a href="{bcc_recipient.U_VIEW}" style="color:<!-- IF bcc_recipient.COLOUR -->{bcc_recipient.COLOUR}<!-- ELSEIF bcc_recipient.IS_GROUP -->#0000FF<!-- ENDIF -->;">{bcc_recipient.NAME}</a><!-- ENDIF -->&nbsp;<!-- END bcc_recipient --><!-- ENDIF -->
<!-- IF S_TO_RECIPIENT --><br /><strong>{L_TO}{L_COLON}</strong> <!-- BEGIN to_recipient --><!-- IF to_recipient.NAME_FULL -->{to_recipient.NAME_FULL}<!-- ELSE --><a href="{to_recipient.U_VIEW}"<!-- IF to_recipient.COLOUR --> style="color:{to_recipient.COLOUR};"<!-- ENDIF -->><strong>{to_recipient.NAME}</strong></a><!-- ENDIF -->&nbsp;<!-- END to_recipient --><!-- ENDIF -->
<!-- IF S_BCC_RECIPIENT --><br /><strong>{L_BCC}{L_COLON}</strong> <!-- BEGIN bcc_recipient --><!-- IF bcc_recipient.NAME_FULL -->{bcc_recipient.NAME_FULL}<!-- ELSE --><a href="{bcc_recipient.U_VIEW}"<!-- IF bcc_recipient.COLOUR --> style="color:{bcc_recipient.COLOUR};"<!-- ENDIF -->><strong>{bcc_recipient.NAME}</strong></a><!-- ENDIF -->&nbsp;<!-- END bcc_recipient --><!-- ENDIF -->
</p>

View file

@ -12,6 +12,17 @@
}
</script>
<div class="panel">
<div class="inner">
<h2>{{ SITENAME }} - {{ lang('OAUTH_REGISTRATION') }}</h2>
{% if PROVIDER_TEMPLATE_FILE %}
{% include PROVIDER_TEMPLATE_FILE %}
{% endif %}
</div>
</div>
<form id="register" method="post" action="{S_UCP_ACTION}"{S_FORM_ENCTYPE}>
<div class="panel">

View file

@ -326,6 +326,8 @@
<div class="content">{postrow.MESSAGE}</div>
<!-- EVENT viewtopic_body_postrow_content_after -->
<!-- IF postrow.S_HAS_ATTACHMENTS -->
<dl class="attachbox">
<dt>

View file

@ -30,6 +30,12 @@ if (in_array($mode, array('login', 'login_link', 'logout', 'confirm', 'sendpassw
define('IN_LOGIN', true);
}
if ($mode === 'delete_cookies')
{
define('SKIP_CHECK_BAN', true);
define('SKIP_CHECK_DISABLED', true);
}
// Start session management
$user->session_begin();
$auth->acl($user->data);
@ -138,7 +144,7 @@ switch ($mode)
'AGREEMENT_TITLE' => $user->lang[$title],
'AGREEMENT_TEXT' => sprintf($user->lang[$message], $config['sitename'], generate_board_url()),
'U_BACK' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
'L_BACK' => $user->lang['BACK_TO_LOGIN'],
'L_BACK' => $user->lang['BACK_TO_PREV'],
));
page_footer();

View file

@ -780,7 +780,7 @@ $template->assign_vars(array(
'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&amp;t=$topic_id",
'U_FORUM' => $server_path,
'U_VIEW_TOPIC' => $viewtopic_url,
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id" . (($start == 0) ? '' : "&amp;start=$start") . (strlen($u_sort_param) ? "&amp;$u_sort_param" : '')),
'U_CANONICAL' => generate_board_url() . '/' . append_sid("viewtopic.$phpEx", "t=$topic_id" . (($start) ? "&amp;start=$start" : ''), true, ''),
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=previous"),
@ -998,6 +998,29 @@ if (!empty($topic_data['poll_start']))
'total_votes' => array_sum($vote_counts),
'can_vote' => !count($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']),
);
/**
* Event to manipulate the poll data sent by AJAX response
*
* @event core.viewtopic_modify_poll_ajax_data
* @var array data JSON response data
* @var array valid_user_votes Valid user votes
* @var array vote_counts Vote counts
* @var int forum_id Forum ID
* @var array topic_data Topic data
* @var array poll_info Array with the poll information
* @since 3.2.4-RC1
*/
$vars = array(
'data',
'valid_user_votes',
'vote_counts',
'forum_id',
'topic_data',
'poll_info',
);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_ajax_data', compact($vars)));
$json_response = new \phpbb\json_response();
$json_response->send($data);
}
@ -1148,6 +1171,29 @@ $sql = 'SELECT p.post_id
" . (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id': '') . "
$limit_posts_time
ORDER BY $sql_sort_order";
/**
* Event to modify the SQL query that gets post_list
*
* @event core.viewtopic_modify_post_list_sql
* @var string sql The SQL query to generate the post_list
* @var int sql_limit The number of posts the query fetches
* @var int sql_start The index the query starts to fetch from
* @var string sort_key Key the posts are sorted by
* @var string sort_days Display posts of previous x days
* @var int forum_id Forum ID
* @since 3.2.4-RC1
*/
$vars = array(
'sql',
'sql_limit',
'sql_start',
'sort_key',
'sort_days',
'forum_id',
);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_list_sql', compact($vars)));
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
$i = ($store_reverse) ? $sql_limit - 1 : 0;
@ -2069,7 +2115,7 @@ for ($i = 0, $end = count($post_list); $i < $end; ++$i)
array(
'ID' => 'pm',
'NAME' => $user->lang['SEND_PRIVATE_MESSAGE'],
'U_CONTACT' => $u_pm,
'U_CONTACT' => $post_row['U_PM'],
),
array(
'ID' => 'email',
@ -2249,7 +2295,6 @@ if ($s_can_vote || $s_quick_reply)
$qr_hidden_fields = array(
'topic_cur_post_id' => (int) $topic_data['topic_last_post_id'],
'lastclick' => (int) time(),
'topic_id' => (int) $topic_data['topic_id'],
'forum_id' => (int) $forum_id,
);

View file

@ -21,9 +21,6 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\filesystem\filesystem */
protected $filesystem;
/** @var \phpbb\attachment\resync */
protected $resync;
@ -47,22 +44,11 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case
$cache = $this->createMock('\phpbb\cache\driver\driver_interface');
$this->config = new \phpbb\config\config(array());
$this->db = $this->new_dbal();
$db_mock = $this->createMock('\phpbb\db\driver\driver_interface');
$this->resync = new \phpbb\attachment\resync($this->db);
$this->filesystem = $this->createMock('\phpbb\filesystem\filesystem', array('remove', 'exists'));
$this->filesystem->expects($this->any())
->method('remove')
->willReturn(false);
$this->filesystem->expects($this->any())
$this->storage = $this->createMock('\phpbb\storage\storage');
$this->storage->expects($this->any())
->method('exists')
->willReturn(true);
$adapter = new \phpbb\storage\adapter\local($this->filesystem, new \FastImageSize\FastImageSize(), new \phpbb\mimetype\guesser(array(new \phpbb\mimetype\extension_guesser)), $phpbb_root_path);
$adapter->configure(['path' => 'files']);
$adapter_factory_mock = $this->createMock('\phpbb\storage\adapter_factory');
$adapter_factory_mock->expects($this->any())
->method('get')
->willReturn($adapter);
$this->storage = new \phpbb\storage\storage($db_mock, $cache, $adapter_factory_mock, '', '');
$this->dispatcher = new \phpbb_mock_event_dispatcher();
$this->attachment_delete = new \phpbb\attachment\delete($this->config, $this->db, $this->dispatcher, $this->resync, $this->storage);
}

View file

@ -86,9 +86,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
));
$config = $this->config;
$this->db = $this->new_dbal();
$db_mock = $this->createMock('\phpbb\db\driver\driver_interface');
$this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), $this->config, $this->db, $phpbb_root_path, $phpEx);
$cache_mock = $this->createMock('\phpbb\cache\driver\driver_interface');
$this->request = $this->createMock('\phpbb\request\request');
$this->filesystem = new \phpbb\filesystem\filesystem();
@ -105,13 +103,10 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers);
$this->plupload = new \phpbb\plupload\plupload($phpbb_root_path, $this->config, $this->request, new \phpbb\user($this->language, '\phpbb\datetime'), $this->php_ini, $this->mimetype_guesser);
$adapter = new \phpbb\storage\adapter\local($this->filesystem, new \FastImageSize\FastImageSize(), new \phpbb\mimetype\guesser(array(new \phpbb\mimetype\extension_guesser)), $phpbb_root_path);
$adapter->configure(['path' => 'files']);
$adapter_factory_mock = $this->createMock('\phpbb\storage\adapter_factory');
$adapter_factory_mock->expects($this->any())
->method('get')
->willReturn($adapter);
$this->storage = new \phpbb\storage\storage($db_mock, $cache_mock, $adapter_factory_mock, '', '');
$this->storage = $this->createMock('\phpbb\storage\storage');
$this->storage->expects($this->any())
->method('free_space')
->willReturn(1024*1024); // 1gb
$factory_mock = $this->getMockBuilder('\phpbb\files\factory')
->disableOriginalConstructor()

View file

@ -30,25 +30,16 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
global $phpbb_root_path, $phpEx;
// Mock phpbb_container
$cache = $this->createMock('\phpbb\cache\driver\driver_interface');
$phpbb_container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface');
$phpbb_container->expects($this->any())
->method('get')
->will($this->returnArgument(0));
$filesystem = new \phpbb\filesystem\filesystem();
$adapter = new \phpbb\storage\adapter\local($filesystem, new \FastImageSize\FastImageSize(), new \phpbb\mimetype\guesser(array(new \phpbb\mimetype\extension_guesser)), $phpbb_root_path);
$adapter->configure(['path' => 'images/avatars/upload']);
$db = $this->createMock('\phpbb\db\driver\driver_interface');
$adapter_factory_mock = $this->createMock('\phpbb\storage\adapter_factory');
$adapter_factory_mock->expects($this->any())
->method('get')
->willReturn($adapter);
$storage = new \phpbb\storage\storage($db, $cache, $adapter_factory_mock, '', '');
$storage = $this->createMock('\phpbb\storage\storage');
// Prepare dependencies for avatar manager and driver
$this->config = new \phpbb\config\config(array());
$cache = $this->createMock('\phpbb\cache\driver\driver_interface');
$path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
new phpbb_mock_request()

View file

@ -49,10 +49,27 @@ class phpbb_cache_apcu_driver_test extends phpbb_cache_common_test_case
protected function setUp()
{
global $phpbb_container, $phpbb_root_path;
parent::setUp();
$phpbb_container = new phpbb_mock_container_builder();
$phpbb_container->setParameter('core.cache_dir', $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/');
$this->driver = new \phpbb\cache\driver\apcu;
$this->driver->purge();
}
public function test_purge()
{
/* add a cache entry which does not match our key */
$foreign_key = 'test_' . $this->driver->key_prefix . 'test';
$this->assertSame(true, apcu_store($foreign_key, 0, 600));
$this->assertSame(true, apcu_exists($foreign_key));
parent::test_purge();
$this->assertSame(true, apcu_exists($foreign_key));
}
}

Some files were not shown because too many files have changed in this diff Show more