aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/auth/provider/oauth/token_storage.php6
-rw-r--r--phpBB/phpbb/controller/helper.php32
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_14.php37
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_14_rc1.php37
-rw-r--r--phpBB/phpbb/db/migration/data/v310/style_update_p1.php6
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/v314.php32
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/v314rc1.php31
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/v314rc2.php32
-rw-r--r--phpBB/phpbb/event/md_exporter.php137
-rw-r--r--phpBB/phpbb/event/php_exporter.php120
-rw-r--r--phpBB/phpbb/log/log.php85
-rw-r--r--phpBB/phpbb/passwords/manager.php2
-rw-r--r--phpBB/phpbb/permissions.php3
-rw-r--r--phpBB/phpbb/plupload/plupload.php4
-rw-r--r--phpBB/phpbb/template/twig/loader.php3
-rw-r--r--phpBB/phpbb/template/twig/node/definenode.php3
-rw-r--r--phpBB/phpbb/template/twig/node/includephp.php6
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/defineparser.php7
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includephp.php3
19 files changed, 540 insertions, 46 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/token_storage.php b/phpBB/phpbb/auth/provider/oauth/token_storage.php
index 60b549f3a2..9b6afae255 100644
--- a/phpBB/phpbb/auth/provider/oauth/token_storage.php
+++ b/phpBB/phpbb/auth/provider/oauth/token_storage.php
@@ -116,7 +116,8 @@ class token_storage implements TokenStorageInterface
{
$service = $this->get_service_name_for_db($service);
- if ($this->cachedToken) {
+ if ($this->cachedToken)
+ {
return true;
}
@@ -231,7 +232,8 @@ class token_storage implements TokenStorageInterface
{
$service = $this->get_service_name_for_db($service);
- if ($this->cachedToken instanceof TokenInterface) {
+ if ($this->cachedToken instanceof TokenInterface)
+ {
return $this->cachedToken;
}
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php
index c6c470e91b..a07a396e73 100644
--- a/phpBB/phpbb/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
@@ -13,6 +13,7 @@
namespace phpbb\controller;
+use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@@ -142,6 +143,12 @@ class helper
$base_url = $context->getBaseUrl();
+ // Append page name if base URL does not contain it
+ if (!empty($page_name) && strpos($base_url, '/' . $page_name) === false)
+ {
+ $base_url .= '/' . $page_name;
+ }
+
// If enable_mod_rewrite is false we need to replace the current front-end by app.php, otherwise we need to remove it.
$base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url);
@@ -206,12 +213,31 @@ class helper
public function message($message, array $parameters = array(), $title = 'INFORMATION', $code = 200)
{
array_unshift($parameters, $message);
+ $message_text = call_user_func_array(array($this->user, 'lang'), $parameters);
+ $message_title = $this->user->lang($title);
+
+ if ($this->request->is_ajax())
+ {
+ global $refresh_data;
+
+ return new JsonResponse(
+ array(
+ 'MESSAGE_TITLE' => $message_title,
+ 'MESSAGE_TEXT' => $message_text,
+ 'S_USER_WARNING' => false,
+ 'S_USER_NOTICE' => false,
+ 'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null
+ ),
+ $code
+ );
+ }
+
$this->template->assign_vars(array(
- 'MESSAGE_TEXT' => call_user_func_array(array($this->user, 'lang'), $parameters),
- 'MESSAGE_TITLE' => $this->user->lang($title),
+ 'MESSAGE_TEXT' => $message_text,
+ 'MESSAGE_TITLE' => $message_title,
));
- return $this->render('message_body.html', $this->user->lang($title), $code);
+ return $this->render('message_body.html', $message_title, $code);
}
/**
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_14.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14.php
new file mode 100644
index 0000000000..51475f5a05
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14.php
@@ -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\v30x;
+
+class release_3_0_14 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return phpbb_version_compare($this->config['version'], '3.0.14', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
+ }
+
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v30x\release_3_0_14_rc1');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('if', array(
+ phpbb_version_compare($this->config['version'], '3.0.14', '<'),
+ array('config.update', array('version', '3.0.14')),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_14_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14_rc1.php
new file mode 100644
index 0000000000..421ef06dd3
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14_rc1.php
@@ -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\v30x;
+
+class release_3_0_14_rc1 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return phpbb_version_compare($this->config['version'], '3.0.14-RC1', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
+ }
+
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v30x\release_3_0_13');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('if', array(
+ phpbb_version_compare($this->config['version'], '3.0.14-RC1', '<'),
+ array('config.update', array('version', '3.0.14-RC1')),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
index e8d3a3af64..3b0d53d803 100644
--- a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
+++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
@@ -136,7 +136,7 @@ class style_update_p1 extends \phpbb\db\migration\migration
if (!sizeof($valid_styles))
{
// No valid styles: remove everything and add prosilver
- $this->sql_query('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary);
+ $this->sql_query('DELETE FROM ' . STYLES_TABLE);
$sql_ary = array(
'style_name' => 'prosilver',
@@ -157,13 +157,13 @@ class style_update_p1 extends \phpbb\db\migration\migration
$this->sql_query($sql);
$sql = 'SELECT style_id
- FROM ' . $table . "
+ FROM ' . STYLES_TABLE . "
WHERE style_name = 'prosilver'";
$result = $this->sql_query($sql);
$default_style = $this->db->sql_fetchfield($result);
$this->db->sql_freeresult($result);
- set_config('default_style', $default_style);
+ $this->config->set('default_style', $default_style);
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0';
$this->sql_query($sql);
diff --git a/phpBB/phpbb/db/migration/data/v31x/v314.php b/phpBB/phpbb/db/migration/data/v31x/v314.php
new file mode 100644
index 0000000000..b7793ca569
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/v314.php
@@ -0,0 +1,32 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v31x;
+
+class v314 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v30x\release_3_0_14',
+ '\phpbb\db\migration\data\v31x\v314rc2',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.4')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v31x/v314rc1.php b/phpBB/phpbb/db/migration/data/v31x/v314rc1.php
new file mode 100644
index 0000000000..10cdbe3f9c
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/v314rc1.php
@@ -0,0 +1,31 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v31x;
+
+class v314rc1 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\v313',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.4-RC1')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v31x/v314rc2.php b/phpBB/phpbb/db/migration/data/v31x/v314rc2.php
new file mode 100644
index 0000000000..b75b7a9be8
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/v314rc2.php
@@ -0,0 +1,32 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v31x;
+
+class v314rc2 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v30x\release_3_0_14_rc1',
+ '\phpbb\db\migration\data\v31x\v314rc1',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.4-RC2')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php
index f7021875f3..02c2a1b9d6 100644
--- a/phpBB/phpbb/event/md_exporter.php
+++ b/phpBB/phpbb/event/md_exporter.php
@@ -24,6 +24,12 @@ class md_exporter
/** @var string phpBB Root Path */
protected $root_path;
+ /** @var string The minimum version for the events to return */
+ protected $min_version;
+
+ /** @var string The maximum version for the events to return */
+ protected $max_version;
+
/** @var string */
protected $filter;
@@ -36,8 +42,10 @@ class md_exporter
/**
* @param string $phpbb_root_path
* @param mixed $extension String 'vendor/ext' to filter, null for phpBB core
+ * @param string $min_version
+ * @param string $max_version
*/
- public function __construct($phpbb_root_path, $extension = null)
+ public function __construct($phpbb_root_path, $extension = null, $min_version = null, $max_version = null)
{
$this->root_path = $phpbb_root_path;
$this->path = $this->root_path;
@@ -49,6 +57,8 @@ class md_exporter
$this->events = array();
$this->events_by_file = array();
$this->filter = $this->current_event = '';
+ $this->min_version = $min_version;
+ $this->max_version = $max_version;
}
/**
@@ -147,15 +157,64 @@ class md_exporter
}
list($file_details, $details) = explode("\n* Since: ", $details, 2);
- list($since, $description) = explode("\n* Purpose: ", $details, 2);
+
+ $changed_versions = array();
+ if (strpos($details, "\n* Changed: ") !== false)
+ {
+ list($since, $details) = explode("\n* Changed: ", $details, 2);
+ while (strpos($details, "\n* Changed: ") !== false)
+ {
+ list($changed, $details) = explode("\n* Changed: ", $details, 2);
+ $changed_versions[] = $changed;
+ }
+ list($changed, $description) = explode("\n* Purpose: ", $details, 2);
+ $changed_versions[] = $changed;
+ }
+ else
+ {
+ list($since, $description) = explode("\n* Purpose: ", $details, 2);
+ $changed_versions = array();
+ }
$files = $this->validate_file_list($file_details);
$since = $this->validate_since($since);
+ $changes = array();
+ foreach ($changed_versions as $changed)
+ {
+ list($changed_version, $changed_description) = $this->validate_changed($changed);
+
+ if (isset($changes[$changed_version]))
+ {
+ throw new \LogicException("Duplicate change information found for event '{$this->current_event}'");
+ }
+
+ $changes[$changed_version] = $changed_description;
+ }
+ $description = trim($description, "\n") . "\n";
+
+ if (!$this->version_is_filtered($since))
+ {
+ $is_filtered = false;
+ foreach ($changes as $version => $null)
+ {
+ if ($this->version_is_filtered($version))
+ {
+ $is_filtered = true;
+ break;
+ }
+ }
+
+ if (!$is_filtered)
+ {
+ continue;
+ }
+ }
$this->events[$event_name] = array(
'event' => $this->current_event,
'files' => $files,
'since' => $since,
+ 'changed' => $changes,
'description' => $description,
);
}
@@ -164,20 +223,48 @@ class md_exporter
}
/**
+ * The version to check
+ *
+ * @param string $version
+ * @return bool
+ */
+ protected function version_is_filtered($version)
+ {
+ return (!$this->min_version || phpbb_version_compare($this->min_version, $version, '<='))
+ && (!$this->max_version || phpbb_version_compare($this->max_version, $version, '>='));
+ }
+
+ /**
* Format the php events as a wiki table
+ *
+ * @param string $action
* @return string Number of events found
*/
- public function export_events_for_wiki()
+ public function export_events_for_wiki($action = '')
{
if ($this->filter === 'adm')
{
- $wiki_page = '= ACP Template Events =' . "\n";
+ if ($action === 'diff')
+ {
+ $wiki_page = '=== ACP Template Events ===' . "\n";
+ }
+ else
+ {
+ $wiki_page = '= ACP Template Events =' . "\n";
+ }
$wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n";
$wiki_page .= '! Identifier !! Placement !! Added in Release !! Explanation' . "\n";
}
else
{
- $wiki_page = '= Template Events =' . "\n";
+ if ($action === 'diff')
+ {
+ $wiki_page = '=== Template Events ===' . "\n";
+ }
+ else
+ {
+ $wiki_page = '= Template Events =' . "\n";
+ }
$wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n";
$wiki_page .= '! Identifier !! Prosilver Placement (If applicable) !! Subsilver Placement (If applicable) !! Added in Release !! Explanation' . "\n";
}
@@ -227,7 +314,7 @@ class md_exporter
*/
public function validate_since($since)
{
- if (!preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $since))
+ if (!$this->validate_version($since))
{
throw new \LogicException("Invalid since information found for event '{$this->current_event}'");
}
@@ -236,6 +323,44 @@ class md_exporter
}
/**
+ * Validate "Changed" Information
+ *
+ * @param string $changed
+ * @return string
+ * @throws \LogicException
+ */
+ public function validate_changed($changed)
+ {
+ if (strpos($changed, ' ') !== false)
+ {
+ list($version, $description) = explode(' ', $changed, 2);
+ }
+ else
+ {
+ $version = $changed;
+ $description = '';
+ }
+
+ if (!$this->validate_version($version))
+ {
+ throw new \LogicException("Invalid changed information found for event '{$this->current_event}'");
+ }
+
+ return array($version, $description);
+ }
+
+ /**
+ * Validate "version" Information
+ *
+ * @param string $version
+ * @return bool True if valid, false otherwise
+ */
+ public function validate_version($version)
+ {
+ return preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $version);
+ }
+
+ /**
* Validate the files list
*
* @param string $file_details
diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php
index 35144eeeec..d2ab0595c0 100644
--- a/phpBB/phpbb/event/php_exporter.php
+++ b/phpBB/phpbb/event/php_exporter.php
@@ -25,6 +25,12 @@ class php_exporter
/** @var string phpBB Root Path */
protected $root_path;
+ /** @var string The minimum version for the events to return */
+ protected $min_version;
+
+ /** @var string The maximum version for the events to return */
+ protected $max_version;
+
/** @var string */
protected $current_file;
@@ -43,14 +49,18 @@ class php_exporter
/**
* @param string $phpbb_root_path
* @param mixed $extension String 'vendor/ext' to filter, null for phpBB core
+ * @param string $min_version
+ * @param string $max_version
*/
- public function __construct($phpbb_root_path, $extension = null)
+ public function __construct($phpbb_root_path, $extension = null, $min_version = null, $max_version = null)
{
$this->root_path = $phpbb_root_path;
$this->path = $phpbb_root_path;
$this->events = $this->file_lines = array();
$this->current_file = $this->current_event = '';
$this->current_event_line = 0;
+ $this->min_version = $min_version;
+ $this->max_version = $max_version;
$this->path = $this->root_path;
if ($extension)
@@ -148,11 +158,20 @@ class php_exporter
/**
* Format the php events as a wiki table
+ *
+ * @param string $action
* @return string
*/
- public function export_events_for_wiki()
+ public function export_events_for_wiki($action = '')
{
- $wiki_page = '= PHP Events (Hook Locations) =' . "\n";
+ if ($action === 'diff')
+ {
+ $wiki_page = '=== PHP Events (Hook Locations) ===' . "\n";
+ }
+ else
+ {
+ $wiki_page = '= PHP Events (Hook Locations) =' . "\n";
+ }
$wiki_page .= '{| class="sortable zebra" cellspacing="0" cellpadding="5"' . "\n";
$wiki_page .= '! Identifier !! Placement !! Arguments !! Added in Release !! Explanation' . "\n";
foreach ($this->events as $event)
@@ -215,6 +234,34 @@ class php_exporter
$since_line_num = $this->find_since();
$since = $this->validate_since($this->file_lines[$since_line_num]);
+ $changed_line_nums = $this->find_changed('changed');
+ if (empty($changed_line_nums))
+ {
+ $changed_line_nums = $this->find_changed('change');
+ }
+ $changed_versions = array();
+ if (!empty($changed_line_nums))
+ {
+ foreach ($changed_line_nums as $changed_line_num)
+ {
+ $changed_versions[] = $this->validate_changed($this->file_lines[$changed_line_num]);
+ }
+ }
+
+ if (!$this->version_is_filtered($since))
+ {
+ $valid_version = false;
+ foreach ($changed_versions as $changed)
+ {
+ $valid_version = $valid_version || $this->version_is_filtered($changed);
+ }
+
+ if (!$valid_version)
+ {
+ continue;
+ }
+ }
+
// Find event description line
$description_line_num = $this->find_description();
$description = substr(trim($this->file_lines[$description_line_num]), strlen('* '));
@@ -243,6 +290,18 @@ class php_exporter
}
/**
+ * The version to check
+ *
+ * @param string $version
+ * @return bool
+ */
+ protected function version_is_filtered($version)
+ {
+ return (!$this->min_version || phpbb_version_compare($this->min_version, $version, '<='))
+ && (!$this->max_version || phpbb_version_compare($this->max_version, $version, '>='));
+ }
+
+ /**
* Find the name of the event inside the dispatch() line
*
* @param int $event_line
@@ -449,6 +508,33 @@ class php_exporter
}
/**
+ * Find the "@changed" Information lines
+ *
+ * @param string $tag_name Should be 'changed' or 'change'
+ * @return array Absolute line numbers
+ * @throws \LogicException
+ */
+ public function find_changed($tag_name)
+ {
+ $lines = array();
+ $last_line = 0;
+ try
+ {
+ while ($line = $this->find_tag($tag_name, array('since'), $last_line))
+ {
+ $lines[] = $line;
+ $last_line = $line;
+ }
+ }
+ catch (\LogicException $e)
+ {
+ // Not changed? No problem!
+ }
+
+ return $lines;
+ }
+
+ /**
* Find the "@event" Information line
*
* @return int Absolute line number
@@ -464,13 +550,14 @@ class php_exporter
* @param string $find_tag Name of the tag we are trying to find
* @param array $disallowed_tags List of tags that must not appear between
* the tag and the actual event
+ * @param int $skip_to_line Skip lines until this one
* @return int Absolute line number
* @throws \LogicException
*/
- public function find_tag($find_tag, $disallowed_tags)
+ public function find_tag($find_tag, $disallowed_tags, $skip_to_line = 0)
{
- $find_tag_line = 0;
- $found_comment_end = false;
+ $find_tag_line = $skip_to_line ? $this->current_event_line - $skip_to_line + 1 : 0;
+ $found_comment_end = ($skip_to_line) ? true : false;
while (strpos(ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t "), '* @' . $find_tag . ' ') !== 0)
{
if ($found_comment_end && ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t") === '/**')
@@ -561,6 +648,27 @@ class php_exporter
}
/**
+ * Validate "@changed" Information
+ *
+ * @param string $line
+ * @return string
+ * @throws \LogicException
+ */
+ public function validate_changed($line)
+ {
+ $match = array();
+ $line = str_replace("\t", ' ', ltrim($line, "\t "));
+ preg_match('#^\* @change(d)? (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match);
+ if (!isset($match[2]))
+ {
+ throw new \LogicException("Invalid '@changed' information for event "
+ . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'");
+ }
+
+ return $match[2];
+ }
+
+ /**
* Validate "@event" Information
*
* @param string $event_name
diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php
index 0c5205530b..f4ba76ff0c 100644
--- a/phpBB/phpbb/log/log.php
+++ b/phpBB/phpbb/log/log.php
@@ -521,15 +521,77 @@ class log implements \phpbb\log\log_interface
$sql_keywords = $this->generate_sql_keyword($keywords);
}
- if ($count_logs)
- {
- $sql = 'SELECT COUNT(l.log_id) AS total_entries
- FROM ' . $this->log_table . ' l, ' . USERS_TABLE . ' u
- WHERE l.log_type = ' . (int) $log_type . '
+ $get_logs_sql_ary = array(
+ 'SELECT' => 'l.*, u.username, u.username_clean, u.user_colour',
+ 'FROM' => array(
+ $this->log_table => 'l',
+ USERS_TABLE => 'u',
+ ),
+ 'WHERE' => 'l.log_type = ' . (int) $log_type . "
AND l.user_id = u.user_id
- AND l.log_time >= ' . (int) $log_time . "
$sql_keywords
- $sql_additional";
+ $sql_additional",
+
+ 'ORDER_BY' => $sort_by,
+ );
+
+ if($log_time)
+ {
+ $get_logs_sql_ary['WHERE'] = 'l.log_time >= ' . (int) $log_time . '
+ AND ' . $get_logs_sql_ary['WHERE'];
+ }
+
+ /**
+ * Modify the query to obtain the logs data
+ *
+ * @event core.get_logs_main_query_before
+ * @var array get_logs_sql_ary The array in the format of the query builder with the query
+ * to get the log count and the log list
+ * @var string mode Mode of the entries we display
+ * @var bool count_logs Do we count all matching entries?
+ * @var int limit Limit the number of entries
+ * @var int offset Offset when fetching the entries
+ * @var mixed forum_id Limit entries to the forum_id,
+ * can also be an array of forum_ids
+ * @var int topic_id Limit entries to the topic_id
+ * @var int user_id Limit entries to the user_id
+ * @var int log_time Limit maximum age of log entries
+ * @var string sort_by SQL order option
+ * @var string keywords Will only return entries that have the
+ * keywords in log_operation or log_data
+ * @var string profile_url URL to the users profile
+ * @var int log_type Limit logs to a certain type. If log_type
+ * is false, no entries will be returned.
+ * @var string sql_additional Additional conditions for the entries,
+ * e.g.: 'AND l.forum_id = 1'
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'get_logs_sql_ary',
+ 'mode',
+ 'count_logs',
+ 'limit',
+ 'offset',
+ 'forum_id',
+ 'topic_id',
+ 'user_id',
+ 'log_time',
+ 'sort_by',
+ 'keywords',
+ 'profile_url',
+ 'log_type',
+ 'sql_additional',
+ );
+ extract($this->dispatcher->trigger_event('core.get_logs_main_query_before', compact($vars)));
+
+ if ($count_logs)
+ {
+ $count_logs_sql_ary = $get_logs_sql_ary;
+
+ $count_logs_sql_ary['SELECT'] = 'COUNT(l.log_id) AS total_entries';
+ unset($count_logs_sql_ary['ORDER_BY']);
+
+ $sql = $this->db->sql_build_query('SELECT', $count_logs_sql_ary);
$result = $this->db->sql_query($sql);
$this->entry_count = (int) $this->db->sql_fetchfield('total_entries');
$this->db->sql_freeresult($result);
@@ -548,14 +610,7 @@ class log implements \phpbb\log\log_interface
}
}
- $sql = 'SELECT l.*, u.username, u.username_clean, u.user_colour
- FROM ' . $this->log_table . ' l, ' . USERS_TABLE . ' u
- WHERE l.log_type = ' . (int) $log_type . '
- AND u.user_id = l.user_id
- ' . (($log_time) ? 'AND l.log_time >= ' . (int) $log_time : '') . "
- $sql_keywords
- $sql_additional
- ORDER BY $sort_by";
+ $sql = $this->db->sql_build_query('SELECT', $get_logs_sql_ary);
$result = $this->db->sql_query_limit($sql, $limit, $this->last_page_offset);
$i = 0;
diff --git a/phpBB/phpbb/passwords/manager.php b/phpBB/phpbb/passwords/manager.php
index fbb49d86a0..aa9147ecf4 100644
--- a/phpBB/phpbb/passwords/manager.php
+++ b/phpBB/phpbb/passwords/manager.php
@@ -56,7 +56,7 @@ class manager
* @param array $hashing_algorithms Hashing driver
* service collection
* @param \phpbb\passwords\helper $helper Passwords helper object
- * @param string $defaults List of default driver types
+ * @param array $defaults List of default driver types
*/
public function __construct(\phpbb\config\config $config, $hashing_algorithms, helper $helper, $defaults)
{
diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php
index 9b3dcadf32..82f59b5c20 100644
--- a/phpBB/phpbb/permissions.php
+++ b/phpBB/phpbb/permissions.php
@@ -277,13 +277,14 @@ class permissions
'm_approve' => array('lang' => 'ACL_M_APPROVE', 'cat' => 'post_actions'),
'm_report' => array('lang' => 'ACL_M_REPORT', 'cat' => 'post_actions'),
'm_chgposter' => array('lang' => 'ACL_M_CHGPOSTER', 'cat' => 'post_actions'),
+ 'm_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'post_actions'),
+ 'm_softdelete' => array('lang' => 'ACL_M_SOFTDELETE', 'cat' => 'post_actions'),
'm_move' => array('lang' => 'ACL_M_MOVE', 'cat' => 'topic_actions'),
'm_lock' => array('lang' => 'ACL_M_LOCK', 'cat' => 'topic_actions'),
'm_split' => array('lang' => 'ACL_M_SPLIT', 'cat' => 'topic_actions'),
'm_merge' => array('lang' => 'ACL_M_MERGE', 'cat' => 'topic_actions'),
- 'm_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'misc'),
'm_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'),
'm_ban' => array('lang' => 'ACL_M_BAN', 'cat' => 'misc'),
diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php
index fcce5b3bd8..ca78167ec0 100644
--- a/phpBB/phpbb/plupload/plupload.php
+++ b/phpBB/phpbb/plupload/plupload.php
@@ -267,8 +267,8 @@ class plupload
{
$resize = sprintf(
'resize: {width: %d, height: %d, quality: 100},',
- (int) $this->config['img_max_height'],
- (int) $this->config['img_max_width']
+ (int) $this->config['img_max_width'],
+ (int) $this->config['img_max_height']
);
}
diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php
index 2f8ffaa776..139a413b70 100644
--- a/phpBB/phpbb/template/twig/loader.php
+++ b/phpBB/phpbb/template/twig/loader.php
@@ -97,7 +97,8 @@ class loader extends \Twig_Loader_Filesystem
// If this is in the cache we can skip the entire process below
// as it should have already been validated
- if (isset($this->cache[$name])) {
+ if (isset($this->cache[$name]))
+ {
return $this->cache[$name];
}
diff --git a/phpBB/phpbb/template/twig/node/definenode.php b/phpBB/phpbb/template/twig/node/definenode.php
index 84d0d8a645..ddbd151d20 100644
--- a/phpBB/phpbb/template/twig/node/definenode.php
+++ b/phpBB/phpbb/template/twig/node/definenode.php
@@ -30,7 +30,8 @@ class definenode extends \Twig_Node
{
$compiler->addDebugInfo($this);
- if ($this->getAttribute('capture')) {
+ if ($this->getAttribute('capture'))
+ {
$compiler
->write("ob_start();\n")
->subcompile($this->getNode('value'))
diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php
index 15fefd761a..76182c2f84 100644
--- a/phpBB/phpbb/template/twig/node/includephp.php
+++ b/phpBB/phpbb/template/twig/node/includephp.php
@@ -46,7 +46,8 @@ class includephp extends \Twig_Node
return;
}
- if ($this->getAttribute('ignore_missing')) {
+ if ($this->getAttribute('ignore_missing'))
+ {
$compiler
->write("try {\n")
->indent()
@@ -75,7 +76,8 @@ class includephp extends \Twig_Node
->write("}\n")
;
- if ($this->getAttribute('ignore_missing')) {
+ if ($this->getAttribute('ignore_missing'))
+ {
$compiler
->outdent()
->write("} catch (\Twig_Error_Loader \$e) {\n")
diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php
index b0a658ca04..b755836ccd 100644
--- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php
+++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php
@@ -32,7 +32,8 @@ class defineparser extends \Twig_TokenParser
$name = $this->parser->getExpressionParser()->parseExpression();
$capture = false;
- if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) {
+ if ($stream->test(\Twig_Token::OPERATOR_TYPE, '='))
+ {
$stream->next();
$value = $this->parser->getExpressionParser()->parseExpression();
@@ -44,7 +45,9 @@ class defineparser extends \Twig_TokenParser
}
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
- } else {
+ }
+ else
+ {
$capture = true;
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
diff --git a/phpBB/phpbb/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php
index f480a3858c..3992636f8c 100644
--- a/phpBB/phpbb/template/twig/tokenparser/includephp.php
+++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php
@@ -30,7 +30,8 @@ class includephp extends \Twig_TokenParser
$stream = $this->parser->getStream();
$ignoreMissing = false;
- if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) {
+ if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore'))
+ {
$stream->next();
$stream->expect(\Twig_Token::NAME_TYPE, 'missing');