aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/config/console.yml19
-rw-r--r--phpBB/docs/events.md33
-rw-r--r--phpBB/includes/functions.php14
-rw-r--r--phpBB/includes/functions_install.php1
-rw-r--r--phpBB/language/en/posting.php2
-rw-r--r--phpBB/phpbb/console/command/cache/purge.php10
-rw-r--r--phpBB/phpbb/console/command/command.php13
-rw-r--r--phpBB/phpbb/console/command/config/command.php4
-rw-r--r--phpBB/phpbb/console/command/cron/cron_list.php10
-rw-r--r--phpBB/phpbb/console/command/cron/run.php10
-rw-r--r--phpBB/phpbb/console/command/db/migrate.php8
-rw-r--r--phpBB/phpbb/console/command/dev/migration_tips.php4
-rw-r--r--phpBB/phpbb/console/command/extension/command.php4
-rw-r--r--phpBB/phpbb/console/command/fixup/recalculate_email_hash.php4
-rw-r--r--phpBB/phpbb/db/tools.php37
-rw-r--r--phpBB/phpbb/plupload/plupload.php31
-rw-r--r--phpBB/phpbb/template/context.php78
-rw-r--r--phpBB/styles/prosilver/template/navbar_footer.html1
-rw-r--r--phpBB/styles/prosilver/template/navbar_header.html3
-rw-r--r--phpBB/styles/subsilver2/template/breadcrumbs.html6
-rw-r--r--phpBB/styles/subsilver2/template/overall_header.html2
-rw-r--r--phpBB/viewforum.php4
-rw-r--r--phpBB/viewtopic.php40
-rw-r--r--tests/console/cron/cron_list_test.php2
-rw-r--r--tests/console/cron/run_test.php2
-rw-r--r--tests/dbal/db_tools_test.php3
26 files changed, 264 insertions, 81 deletions
diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml
index 06ea0e317f..540908164a 100644
--- a/phpBB/config/console.yml
+++ b/phpBB/config/console.yml
@@ -9,11 +9,11 @@ services:
console.command.cache.purge:
class: phpbb\console\command\cache\purge
arguments:
+ - @user
- @cache.driver
- @dbal.conn
- @auth
- @log
- - @user
- @config
tags:
- { name: console.command }
@@ -21,6 +21,7 @@ services:
console.command.config.delete:
class: phpbb\console\command\config\delete
arguments:
+ - @user
- @config
tags:
- { name: console.command }
@@ -28,6 +29,7 @@ services:
console.command.config.increment:
class: phpbb\console\command\config\increment
arguments:
+ - @user
- @config
tags:
- { name: console.command }
@@ -35,6 +37,7 @@ services:
console.command.config.get:
class: phpbb\console\command\config\get
arguments:
+ - @user
- @config
tags:
- { name: console.command }
@@ -42,6 +45,7 @@ services:
console.command.config.set:
class: phpbb\console\command\config\set
arguments:
+ - @user
- @config
tags:
- { name: console.command }
@@ -49,6 +53,7 @@ services:
console.command.config.set_atomic:
class: phpbb\console\command\config\set_atomic
arguments:
+ - @user
- @config
tags:
- { name: console.command }
@@ -56,35 +61,36 @@ services:
console.command.cron.list:
class: phpbb\console\command\cron\cron_list
arguments:
- - @cron.manager
- @user
+ - @cron.manager
tags:
- { name: console.command }
console.command.cron.run:
class: phpbb\console\command\cron\run
arguments:
+ - @user
- @cron.manager
- @cron.lock_db
- - @user
tags:
- { name: console.command }
console.command.db.migrate:
class: phpbb\console\command\db\migrate
arguments:
+ - @user
- @migrator
- @ext.manager
- @config
- @cache
- @log
- - @user
tags:
- { name: console.command }
console.command.dev.migration_tips:
class: phpbb\console\command\dev\migration_tips
arguments:
+ - @user
- @ext.manager
tags:
- { name: console.command }
@@ -92,6 +98,7 @@ services:
console.command.extension.disable:
class: phpbb\console\command\extension\disable
arguments:
+ - @user
- @ext.manager
- @log
tags:
@@ -100,6 +107,7 @@ services:
console.command.extension.enable:
class: phpbb\console\command\extension\enable
arguments:
+ - @user
- @ext.manager
- @log
tags:
@@ -108,6 +116,7 @@ services:
console.command.extension.purge:
class: phpbb\console\command\extension\purge
arguments:
+ - @user
- @ext.manager
- @log
tags:
@@ -116,6 +125,7 @@ services:
console.command.extension.show:
class: phpbb\console\command\extension\show
arguments:
+ - @user
- @ext.manager
- @log
tags:
@@ -124,6 +134,7 @@ services:
console.command.fixup.recalculate_email_hash:
class: phpbb\console\command\fixup\recalculate_email_hash
arguments:
+ - @user
- @dbal.conn
tags:
- { name: console.command }
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index b6d4bfe214..b80e5fd4cb 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -437,9 +437,18 @@ overall_footer_breadcrumb_append
===
* Locations:
+ styles/prosilver/template/navbar_footer.html
+ + styles/subsilver2/template/breadcrumbs.html
* Since: 3.1.0-a1
* Purpose: Add links to the list of breadcrumbs in the footer
+overall_footer_breadcrumb_prepend
+===
+* Locations:
+ + styles/prosilver/template/navbar_footer.html
+ + styles/subsilver2/template/breadcrumbs.html
+* Since: 3.1.0-RC3
+* Purpose: Add links to the list of breadcrumbs in the footer (after site-home, but before board-index)
+
overall_footer_content_after
===
* Locations:
@@ -520,6 +529,30 @@ overall_header_breadcrumb_append
* Since: 3.1.0-a1
* Purpose: Add links to the list of breadcrumbs in the header
+overall_header_breadcrumb_prepend
+===
+* Locations:
+ + styles/prosilver/template/navbar_header.html
+ + styles/subsilver2/template/breadcrumbs.html
+* Since: 3.1.0-RC3
+* Purpose: Add links to the list of breadcrumbs in the header (after site-home, but before board-index)
+
+overall_header_breadcrumbs_after
+===
+* Locations:
+ + styles/prosilver/template/navbar_header.html
+ + styles/subsilver2/template/breadcrumbs.html
+* Since: 3.1.0-RC3
+* Purpose: Add content after the breadcrumbs (outside of the breadcrumbs container)
+
+overall_header_breadcrumbs_before
+===
+* Locations:
+ + styles/prosilver/template/navbar_header.html
+ + styles/subsilver2/template/breadcrumbs.html
+* Since: 3.1.0-RC3
+* Purpose: Add content before the breadcrumbs (outside of the breadcrumbs container)
+
overall_header_content_before
===
* Locations:
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 8b9969aced..3402a618b0 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1067,7 +1067,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false)
$offset_string = phpbb_format_timezone_offset($offset);
$timezones['GMT' . $offset_string . ' - ' . $timezone] = array(
'tz' => $timezone,
- 'offest' => 'GMT' . $offset_string,
+ 'offset' => 'GMT' . $offset_string,
'current' => $current_time,
);
if ($timezone === $default)
@@ -1084,14 +1084,14 @@ function phpbb_timezone_select($user, $default = '', $truncate = false)
foreach ($timezones as $timezone)
{
- if ($opt_group != $timezone['offest'])
+ if ($opt_group != $timezone['offset'])
{
$tz_select .= ($opt_group) ? '</optgroup>' : '';
- $tz_select .= '<optgroup label="' . $timezone['offest'] . ' - ' . $timezone['current'] . '">';
- $opt_group = $timezone['offest'];
+ $tz_select .= '<optgroup label="' . $timezone['offset'] . ' - ' . $timezone['current'] . '">';
+ $opt_group = $timezone['offset'];
- $selected = ($default_offset == $timezone['offest']) ? ' selected="selected"' : '';
- $tz_dates .= '<option value="' . $timezone['offest'] . ' - ' . $timezone['current'] . '"' . $selected . '>' . $timezone['offest'] . ' - ' . $timezone['current'] . '</option>';
+ $selected = ($default_offset == $timezone['offset']) ? ' selected="selected"' : '';
+ $tz_dates .= '<option value="' . $timezone['offset'] . ' - ' . $timezone['current'] . '"' . $selected . '>' . $timezone['offset'] . ' - ' . $timezone['current'] . '</option>';
}
$label = $timezone['tz'];
@@ -1099,7 +1099,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false)
{
$label = $user->lang['timezones'][$label];
}
- $title = $timezone['offest'] . ' - ' . $label;
+ $title = $timezone['offset'] . ' - ' . $label;
if ($truncate)
{
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index 06f49e4b50..ab6ecb5519 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -449,6 +449,7 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_cont
}
$config_data .= "\n@define('PHPBB_INSTALLED', true);\n";
+ $config_data .= "// @define('PHPBB_DISPLAY_LOAD_TIME', true);\n";
if ($debug)
{
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index 31d49e8bdf..2cd6ec59cc 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -60,7 +60,7 @@ $lang = array_merge($lang, array(
'BBCODE_O_HELP' => 'Ordered list: e.g. [list=1][*]First point[/list] or [list=a][*]Point a[/list]',
'BBCODE_P_HELP' => 'Insert image: [img]http://image_url[/img]',
'BBCODE_Q_HELP' => 'Quote text: [quote]text[/quote]',
- 'BBCODE_S_HELP' => 'Font colour: [color=red]text[/color] Tip: you can also use color=#FF0000',
+ 'BBCODE_S_HELP' => 'Font colour: [color=red]text[/color] or [color=#FF0000]text[/color]',
'BBCODE_U_HELP' => 'Underline text: [u]text[/u]',
'BBCODE_W_HELP' => 'Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]',
'BBCODE_Y_HELP' => 'List: Add list element',
diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php
index 379d2aa1ca..8c51d1b5a8 100644
--- a/phpBB/phpbb/console/command/cache/purge.php
+++ b/phpBB/phpbb/console/command/cache/purge.php
@@ -29,31 +29,27 @@ class purge extends \phpbb\console\command\command
/** @var \phpbb\log\log */
protected $log;
- /** @var \phpbb\user */
- protected $user;
-
/** @var \phpbb\config\config */
protected $config;
/**
* Constructor
*
+ * @param \phpbb\user $user User instance
* @param \phpbb\cache\driver\driver_interface $cache Cache instance
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\auth\auth $auth Auth instance
* @param \phpbb\log\log $log Logger instance
- * @param \phpbb\user $user User instance
* @param \phpbb\config\config $config Config instance
*/
- public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user, \phpbb\config\config $config)
+ public function __construct(\phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\config\config $config)
{
$this->cache = $cache;
$this->db = $db;
$this->auth = $auth;
$this->log = $log;
- $this->user = $user;
$this->config = $config;
- parent::__construct();
+ parent::__construct($user);
}
/**
diff --git a/phpBB/phpbb/console/command/command.php b/phpBB/phpbb/console/command/command.php
index d3449c0c38..638c989da2 100644
--- a/phpBB/phpbb/console/command/command.php
+++ b/phpBB/phpbb/console/command/command.php
@@ -15,4 +15,17 @@ namespace phpbb\console\command;
abstract class command extends \Symfony\Component\Console\Command\Command
{
+ /** @var \phpbb\user */
+ protected $user;
+
+ /**
+ * Constructor
+ *
+ * @param \phpbb\user $user User instance (mostly for translation)
+ */
+ public function __construct(\phpbb\user $user)
+ {
+ $this->user = $user;
+ parent::__construct();
+ }
}
diff --git a/phpBB/phpbb/console/command/config/command.php b/phpBB/phpbb/console/command/config/command.php
index de3fbd7fa7..f0ad5d4d19 100644
--- a/phpBB/phpbb/console/command/config/command.php
+++ b/phpBB/phpbb/console/command/config/command.php
@@ -17,10 +17,10 @@ abstract class command extends \phpbb\console\command\command
/** @var \phpbb\config\config */
protected $config;
- function __construct(\phpbb\config\config $config)
+ function __construct(\phpbb\user $user, \phpbb\config\config $config)
{
$this->config = $config;
- parent::__construct();
+ parent::__construct($user);
}
}
diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php
index 4f4228d9b3..c515fd9e80 100644
--- a/phpBB/phpbb/console/command/cron/cron_list.php
+++ b/phpBB/phpbb/console/command/cron/cron_list.php
@@ -20,20 +20,16 @@ class cron_list extends \phpbb\console\command\command
/** @var \phpbb\cron\manager */
protected $cron_manager;
- /** @var \phpbb\user */
- protected $user;
-
/**
* Constructor
*
- * @param \phpbb\cron\manager $cron_manager Cron manager
* @param \phpbb\user $user User instance
+ * @param \phpbb\cron\manager $cron_manager Cron manager
*/
- public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\user $user)
+ public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager)
{
$this->cron_manager = $cron_manager;
- $this->user = $user;
- parent::__construct();
+ parent::__construct($user);
}
/**
diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php
index 0b365ece67..72ad1205ef 100644
--- a/phpBB/phpbb/console/command/cron/run.php
+++ b/phpBB/phpbb/console/command/cron/run.php
@@ -25,23 +25,19 @@ class run extends \phpbb\console\command\command
/** @var \phpbb\lock\db */
protected $lock_db;
- /** @var \phpbb\user */
- protected $user;
-
/**
* Construct method
*
+ * @param \phpbb\user $user The user object (used to get language information)
* @param \phpbb\cron\manager $cron_manager The cron manager containing
* the cron tasks to be executed.
* @param \phpbb\lock\db $lock_db The lock for accessing database.
- * @param \phpbb\user $user The user object (used to get language information)
*/
- public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db, \phpbb\user $user)
+ public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db)
{
$this->cron_manager = $cron_manager;
$this->lock_db = $lock_db;
- $this->user = $user;
- parent::__construct();
+ parent::__construct($user);
}
/**
diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php
index 2abeaf5268..758b125b13 100644
--- a/phpBB/phpbb/console/command/db/migrate.php
+++ b/phpBB/phpbb/console/command/db/migrate.php
@@ -32,19 +32,15 @@ class migrate extends \phpbb\console\command\command
/** @var \phpbb\log\log */
protected $log;
- /** @var \phpbb\user */
- protected $user;
-
- function __construct(\phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\user $user)
+ function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log)
{
$this->migrator = $migrator;
$this->extension_manager = $extension_manager;
$this->config = $config;
$this->cache = $cache;
$this->log = $log;
- $this->user = $user;
+ parent::__construct($user);
$this->user->add_lang(array('common', 'install', 'migrator'));
- parent::__construct();
}
protected function configure()
diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php
index c2f61568ea..e1387b34ae 100644
--- a/phpBB/phpbb/console/command/dev/migration_tips.php
+++ b/phpBB/phpbb/console/command/dev/migration_tips.php
@@ -20,10 +20,10 @@ class migration_tips extends \phpbb\console\command\command
/** @var \phpbb\extension\manager */
protected $extension_manager;
- function __construct(\phpbb\extension\manager $extension_manager)
+ function __construct(\phpbb\user $user, \phpbb\extension\manager $extension_manager)
{
$this->extension_manager = $extension_manager;
- parent::__construct();
+ parent::__construct($user);
}
protected function configure()
diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php
index 21bb640504..364d954082 100644
--- a/phpBB/phpbb/console/command/extension/command.php
+++ b/phpBB/phpbb/console/command/extension/command.php
@@ -20,11 +20,11 @@ abstract class command extends \phpbb\console\command\command
/** @var \phpbb\log\log */
protected $log;
- public function __construct(\phpbb\extension\manager $manager, \phpbb\log\log $log)
+ public function __construct(\phpbb\user $user, \phpbb\extension\manager $manager, \phpbb\log\log $log)
{
$this->manager = $manager;
$this->log = $log;
- parent::__construct();
+ parent::__construct($user);
}
}
diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php
index ec04da4267..cb821cfe20 100644
--- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php
+++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php
@@ -20,11 +20,11 @@ class recalculate_email_hash extends \phpbb\console\command\command
/** @var \phpbb\db\driver\driver_interface */
protected $db;
- function __construct(\phpbb\db\driver\driver_interface $db)
+ function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db)
{
$this->db = $db;
- parent::__construct();
+ parent::__construct($user);
}
protected function configure()
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
index 18defc4535..ae0c695aa2 100644
--- a/phpBB/phpbb/db/tools.php
+++ b/phpBB/phpbb/db/tools.php
@@ -1487,8 +1487,16 @@ class tools
$return_array['textimage'] = $column_type === '[text]';
- $sql .= 'NOT NULL';
- $sql_default .= 'NOT NULL';
+ if (!is_null($column_data[1]) || (isset($column_data[2]) && $column_data[2] == 'auto_increment'))
+ {
+ $sql .= 'NOT NULL';
+ $sql_default .= 'NOT NULL';
+ }
+ else
+ {
+ $sql .= 'NULL';
+ $sql_default .= 'NULL';
+ }
$return_array['column_type_sql_default'] = $sql_default;
@@ -1503,7 +1511,15 @@ class tools
{
$sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' ";
}
- $sql .= 'NOT NULL';
+
+ if (!is_null($column_data[1]))
+ {
+ $sql .= 'NOT NULL';
+ }
+ else
+ {
+ $sql .= 'NULL';
+ }
if (isset($column_data[2]))
{
@@ -1528,7 +1544,7 @@ class tools
// Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields)
if (!preg_match('/number/i', $column_type))
{
- $sql .= ($column_data[1] === '') ? '' : 'NOT NULL';
+ $sql .= ($column_data[1] === '' || $column_data[1] === null) ? '' : 'NOT NULL';
}
$return_array['auto_increment'] = false;
@@ -1556,6 +1572,12 @@ class tools
$return_array['null'] = 'NOT NULL';
$sql .= 'NOT NULL ';
}
+ else
+ {
+ $default_val = "'" . $column_data[1] . "'";
+ $return_array['null'] = 'NULL';
+ $sql .= 'NULL ';
+ }
$return_array['default'] = $default_val;
@@ -1588,8 +1610,11 @@ class tools
$sql .= ' ' . $column_type;
}
- $sql .= ' NOT NULL ';
- $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : '';
+ if (!is_null($column_data[1]))
+ {
+ $sql .= ' NOT NULL ';
+ $sql .= "DEFAULT '{$column_data[1]}'";
+ }
break;
}
diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php
index c610d49a63..3c686a552f 100644
--- a/phpBB/phpbb/plupload/plupload.php
+++ b/phpBB/phpbb/plupload/plupload.php
@@ -79,8 +79,7 @@ class plupload
$this->php_ini = $php_ini;
$this->mimetype_guesser = $mimetype_guesser;
- $this->upload_directory = $this->phpbb_root_path . $this->config['upload_path'];
- $this->temporary_directory = $this->upload_directory . '/plupload';
+ $this->set_default_directories();
}
/**
@@ -120,6 +119,9 @@ class plupload
{
rename("{$file_path}.part", $file_path);
+ // Reset upload directories to defaults once completed
+ $this->set_default_directories();
+
// Need to modify some of the $_FILES values to reflect the new file
return array(
'tmp_name' => $file_path,
@@ -372,4 +374,29 @@ class plupload
);
}
}
+
+ /**
+ * Sets the default directories for uploads
+ *
+ * @return null
+ */
+ protected function set_default_directories()
+ {
+ $this->upload_directory = $this->phpbb_root_path . $this->config['upload_path'];
+ $this->temporary_directory = $this->upload_directory . '/plupload';
+ }
+
+ /**
+ * Sets the upload directories to the specified paths
+ *
+ * @param string $upload_directory Upload directory
+ * @param string $temporary_directory Temporary directory
+ *
+ * @return null
+ */
+ public function set_upload_directories($upload_directory, $temporary_directory)
+ {
+ $this->upload_directory = $upload_directory;
+ $this->temporary_directory = $temporary_directory;
+ }
}
diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php
index 0a32879943..4ee48205c8 100644
--- a/phpBB/phpbb/template/context.php
+++ b/phpBB/phpbb/template/context.php
@@ -34,6 +34,11 @@ class context
*/
private $rootref;
+ /**
+ * @var bool
+ */
+ private $num_rows_is_set;
+
public function __construct()
{
$this->clear();
@@ -46,6 +51,7 @@ class context
{
$this->tpldata = array('.' => array(0 => array()));
$this->rootref = &$this->tpldata['.'][0];
+ $this->num_rows_is_set = false;
}
/**
@@ -95,10 +101,59 @@ class context
// returning a reference directly is not
// something php is capable of doing
$ref = &$this->tpldata;
+
+ if (!$this->num_rows_is_set)
+ {
+ /*
+ * We do not set S_NUM_ROWS while adding a row, to reduce the complexity
+ * If we would set it on adding, each subsequent adding would cause
+ * n modifications, resulting in a O(n!) complexity, rather then O(n)
+ */
+ foreach ($ref as $loop_name => &$loop_data)
+ {
+ if ($loop_name === '.')
+ {
+ continue;
+ }
+
+ $this->set_num_rows($loop_data);
+ }
+ $this->num_rows_is_set = true;
+ }
+
return $ref;
}
/**
+ * Set S_NUM_ROWS for each row in this template block
+ *
+ * @param array $loop_data
+ */
+ protected function set_num_rows(&$loop_data)
+ {
+ $s_num_rows = sizeof($loop_data);
+ foreach ($loop_data as &$mod_block)
+ {
+ foreach ($mod_block as $sub_block_name => &$sub_block)
+ {
+ // If the key name is lowercase and the data is an array,
+ // it could be a template loop. So we set the S_NUM_ROWS there
+ // aswell.
+ if ($sub_block_name === strtolower($sub_block_name) && is_array($sub_block))
+ {
+ $this->set_num_rows($sub_block);
+ }
+ }
+
+ // Check whether we are inside a block before setting the variable
+ if (isset($mod_block['S_BLOCK_NAME']))
+ {
+ $mod_block['S_NUM_ROWS'] = $s_num_rows;
+ }
+ }
+ }
+
+ /**
* Returns a reference to template root scope.
*
* This function is public so that template renderer may invoke it.
@@ -123,6 +178,7 @@ class context
*/
public function assign_block_vars($blockname, array $vararray)
{
+ $this->num_rows_is_set = false;
if (strpos($blockname, '.') !== false)
{
// Nested block.
@@ -160,13 +216,6 @@ class context
// We're adding a new iteration to this block with the given
// variable assignments.
$str[$blocks[$blockcount]][] = $vararray;
- $s_num_rows = sizeof($str[$blocks[$blockcount]]);
-
- // Set S_NUM_ROWS
- foreach ($str[$blocks[$blockcount]] as &$mod_block)
- {
- $mod_block['S_NUM_ROWS'] = $s_num_rows;
- }
}
else
{
@@ -192,13 +241,6 @@ class context
// Add a new iteration to this block with the variable assignments we were given.
$this->tpldata[$blockname][] = $vararray;
- $s_num_rows = sizeof($this->tpldata[$blockname]);
-
- // Set S_NUM_ROWS
- foreach ($this->tpldata[$blockname] as &$mod_block)
- {
- $mod_block['S_NUM_ROWS'] = $s_num_rows;
- }
}
return true;
@@ -250,6 +292,7 @@ class context
*/
public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
{
+ $this->num_rows_is_set = false;
if (strpos($blockname, '.') !== false)
{
// Nested block.
@@ -349,12 +392,6 @@ class context
$block[$key] = $vararray;
$block[$key]['S_ROW_COUNT'] = $block[$key]['S_ROW_NUM'] = $key;
- // Set S_NUM_ROWS
- foreach ($this->tpldata[$blockname] as &$mod_block)
- {
- $mod_block['S_NUM_ROWS'] = sizeof($this->tpldata[$blockname]);
- }
-
return true;
}
@@ -382,6 +419,7 @@ class context
*/
public function destroy_block_vars($blockname)
{
+ $this->num_rows_is_set = false;
if (strpos($blockname, '.') !== false)
{
// Nested block.
diff --git a/phpBB/styles/prosilver/template/navbar_footer.html b/phpBB/styles/prosilver/template/navbar_footer.html
index f8ca83163b..4a9275c898 100644
--- a/phpBB/styles/prosilver/template/navbar_footer.html
+++ b/phpBB/styles/prosilver/template/navbar_footer.html
@@ -4,6 +4,7 @@
<ul id="nav-footer" class="linklist bulletin" role="menubar">
<li class="small-icon icon-home breadcrumbs">
<!-- IF U_SITE_HOME --><span class="crumb"><a href="{U_SITE_HOME}" data-navbar-reference="home">{L_SITE_HOME}</a></span><!-- ENDIF -->
+ <!-- EVENT overall_footer_breadcrumb_prepend -->
<span class="crumb"><a href="{U_INDEX}" data-navbar-reference="index">{L_INDEX}</a></span>
<!-- EVENT overall_footer_breadcrumb_append -->
</li>
diff --git a/phpBB/styles/prosilver/template/navbar_header.html b/phpBB/styles/prosilver/template/navbar_header.html
index a83cd5b0a2..ed34089550 100644
--- a/phpBB/styles/prosilver/template/navbar_header.html
+++ b/phpBB/styles/prosilver/template/navbar_header.html
@@ -83,8 +83,10 @@
<ul id="nav-breadcrumbs" class="linklist navlinks" role="menubar">
<!-- DEFINE $MICRODATA = ' itemtype="http://data-vocabulary.org/Breadcrumb" itemscope=""' -->
+ <!-- EVENT overall_header_breadcrumbs_before -->
<li class="small-icon icon-home breadcrumbs">
<!-- IF U_SITE_HOME --><span class="crumb"><a href="{U_SITE_HOME}"{$MICRODATA} data-navbar-reference="home">{L_SITE_HOME}</a></span><!-- ENDIF -->
+ <!-- EVENT overall_header_breadcrumb_prepend -->
<span class="crumb"><a href="{U_INDEX}" accesskey="h"{$MICRODATA} data-navbar-reference="index">{L_INDEX}</a></span>
<!-- BEGIN navlinks -->
<!-- EVENT overall_header_navlink_prepend -->
@@ -93,6 +95,7 @@
<!-- END navlinks -->
<!-- EVENT overall_header_breadcrumb_append -->
</li>
+ <!-- EVENT overall_header_breadcrumbs_after -->
<!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH -->
<li class="rightside responsive-search" style="display: none;"><a href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}" role="menuitem">{L_SEARCH}</a></li>
diff --git a/phpBB/styles/subsilver2/template/breadcrumbs.html b/phpBB/styles/subsilver2/template/breadcrumbs.html
index 3aa05bc0eb..25387da832 100644
--- a/phpBB/styles/subsilver2/template/breadcrumbs.html
+++ b/phpBB/styles/subsilver2/template/breadcrumbs.html
@@ -2,8 +2,10 @@
<table class="tablebg" width="100%" cellspacing="1" cellpadding="0" style="margin-top: 5px;">
<tr>
<td class="row1">
- <p class="breadcrumbs"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}"{$MICRODATA} data-navbar-reference="home">{L_SITE_HOME}</a> <strong>&#187;</strong> <!-- ENDIF --><a href="{U_INDEX}"{$MICRODATA} data-navbar-reference="index">{L_INDEX}</a><!-- BEGIN navlinks --><!-- EVENT overall_header_navlink_prepend --> &#187; <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}<!-- IF navlinks.MICRODATA --> {navlinks.MICRODATA}<!-- ENDIF -->>{navlinks.FORUM_NAME}</a><!-- EVENT overall_header_navlink_append --><!-- END navlinks -->
- <!-- EVENT overall_header_breadcrumb_append --></p>
+ <!-- EVENT overall_header_breadcrumbs_before -->
+ <p class="breadcrumbs"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}"{$MICRODATA} data-navbar-reference="home">{L_SITE_HOME}</a> <strong>&#187;</strong> <!-- ENDIF --><!-- IF $OVERALL_HEADER_BREADCRUMBS --><!-- EVENT overall_header_breadcrumb_prepend --><!-- ELSE --><!-- EVENT overall_footer_breadcrumb_prepend --><!-- ENDIF --><a href="{U_INDEX}"{$MICRODATA} data-navbar-reference="index">{L_INDEX}</a><!-- BEGIN navlinks --><!-- EVENT overall_header_navlink_prepend --> &#187; <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}<!-- IF navlinks.MICRODATA --> {navlinks.MICRODATA}<!-- ENDIF -->>{navlinks.FORUM_NAME}</a><!-- EVENT overall_header_navlink_append --><!-- END navlinks -->
+ <!-- IF $OVERALL_HEADER_BREADCRUMBS --><!-- EVENT overall_header_breadcrumb_append --><!-- ELSE --><!-- EVENT overall_footer_breadcrumb_append --><!-- ENDIF --></p>
+ <!-- EVENT overall_header_breadcrumbs_after -->
<!-- EVENT overall_footer_timezone_before -->
<p class="datetime">{S_TIMEZONE}</p>
<!-- EVENT overall_footer_timezone_after -->
diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html
index 711ce66362..cb9a3a2a36 100644
--- a/phpBB/styles/subsilver2/template/overall_header.html
+++ b/phpBB/styles/subsilver2/template/overall_header.html
@@ -251,7 +251,9 @@ function marklist(id, name, state)
<br style="clear: both;" />
<!-- DEFINE $S_MICRODATA = 1 -->
+ <!-- DEFINE $OVERALL_HEADER_BREADCRUMBS = 1 -->
<!-- INCLUDE breadcrumbs.html -->
+ <!-- UNDEFINE $OVERALL_HEADER_BREADCRUMBS -->
<!-- DEFINE $S_MICRODATA = 0 -->
<br />
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index c9623293c6..9086feb390 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -469,11 +469,11 @@ if ($forum_data['forum_type'] == FORUM_POST)
$forum_tracking_info = array();
-if ($user->data['is_registered'])
+if ($user->data['is_registered'] && $config['load_db_lastread'])
{
$forum_tracking_info[$forum_id] = $forum_data['mark_time'];
- if (!empty($global_announce_forums) && $config['load_db_lastread'])
+ if (!empty($global_announce_forums))
{
$sql = 'SELECT forum_id, mark_time
FROM ' . FORUMS_TRACK_TABLE . '
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 905eecee76..1fdce5a6c3 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1423,6 +1423,46 @@ $template->assign_vars(array(
'S_NUM_POSTS' => sizeof($post_list))
);
+/**
+* Event to modify the post, poster and attachment data before assigning the posts
+*
+* @event core.viewtopic_modify_post_data
+* @var int forum_id Forum ID
+* @var int topic_id Topic ID
+* @var array topic_data Array with topic data
+* @var array post_list Array with post_ids we are going to display
+* @var array rowset Array with post_id => post data
+* @var array user_cache Array with prepared user data
+* @var int start Pagination information
+* @var int sort_days Display posts of previous x days
+* @var string sort_key Key the posts are sorted by
+* @var string sort_dir Direction the posts are sorted by
+* @var bool display_notice Shall we display a notice instead of attachments
+* @var bool has_approved_attachments Does the topic have approved attachments
+* @var array attachments List of attachments post_id => array of attachments
+* @var array permanently_banned_users List of permanently banned users
+* @var array can_receive_pm_list Array with posters that can receive pms
+* @since 3.1.0-RC3
+*/
+$vars = array(
+ 'forum_id',
+ 'topic_id',
+ 'topic_data',
+ 'post_list',
+ 'rowset',
+ 'user_cache',
+ 'sort_days',
+ 'sort_key',
+ 'sort_dir',
+ 'start',
+ 'permanently_banned_users',
+ 'can_receive_pm_list',
+ 'display_notice',
+ 'has_approved_attachments',
+ 'attachments',
+);
+extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_data', compact($vars)));
+
// Output the posts
$first_unread = $post_unread = false;
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php
index f04c14e847..1059a3f221 100644
--- a/tests/console/cron/cron_list_test.php
+++ b/tests/console/cron/cron_list_test.php
@@ -75,7 +75,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
public function get_command_tester()
{
$application = new Application();
- $application->add(new cron_list($this->cron_manager, $this->user));
+ $application->add(new cron_list($this->user, $this->cron_manager));
$command = $application->find('cron:list');
$this->command_name = $command->getName();
diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php
index ff251cff3c..60bd74e1f0 100644
--- a/tests/console/cron/run_test.php
+++ b/tests/console/cron/run_test.php
@@ -148,7 +148,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
public function get_command_tester()
{
$application = new Application();
- $application->add(new run($this->cron_manager, $this->lock, $this->user));
+ $application->add(new run($this->user, $this->cron_manager, $this->lock));
$command = $application->find('cron:run');
$this->command_name = $command->getName();
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php
index f3c6888c8d..6cc2f8ec0f 100644
--- a/tests/dbal/db_tools_test.php
+++ b/tests/dbal/db_tools_test.php
@@ -46,6 +46,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
'c_bool' => array('BOOL', 1),
'c_vchar' => array('VCHAR', 'foo'),
'c_vchar_size' => array('VCHAR:4', 'foo'),
+ 'c_vchar_null' => array('VCHAR', null),
'c_char_size' => array('CHAR:4', 'foo'),
'c_xstext' => array('XSTEXT', 'foo'),
'c_stext' => array('STEXT', 'foo'),
@@ -111,6 +112,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
'c_bool' => 0,
'c_vchar' => '',
'c_vchar_size' => '',
+ 'c_vchar_null' => null,
'c_char_size' => 'abcd',
'c_xstext' => '',
'c_stext' => '',
@@ -144,6 +146,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
array('c_bool', 0),
array('c_vchar', str_repeat('a', 255)),
array('c_vchar_size', str_repeat('a', 4)),
+ array('c_vchar_null', str_repeat('a', 4)),
array('c_char_size', str_repeat('a', 4)),
array('c_xstext', str_repeat('a', 1000)),
array('c_stext', str_repeat('a', 3000)),