diff options
Diffstat (limited to 'phpBB/phpbb')
79 files changed, 486 insertions, 203 deletions
diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php index 65249275d4..38755ccf99 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -208,9 +208,12 @@ class auth /** * Get forums with the specified permission setting - * if the option is prefixed with !, then the result becomes negated * - * @param bool $clean set to true if only values needs to be returned which are set/unset + * @param string $opt The permission name to lookup. If prefixed with !, the result is negated. + * @param bool $clean set to true if only values needs to be returned which are set/unset + * + * @return array Contains the forum ids with the specified permission set to true. + This is a nested array: array => forum_id => permission => true */ function acl_getf($opt, $clean = false) { diff --git a/phpBB/phpbb/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php index 4f44efe9af..9137a77210 100644 --- a/phpBB/phpbb/auth/provider/apache.php +++ b/phpBB/phpbb/auth/provider/apache.php @@ -28,13 +28,13 @@ class apache extends \phpbb\auth\provider\base /** * Apache Authentication Constructor * - * @param \phpbb\db\driver\driver_interface $db - * @param \phpbb\config\config $config - * @param \phpbb\passwords\manager $passwords_manager - * @param \phpbb\request\request $request - * @param \phpbb\user $user - * @param string $phpbb_root_path - * @param string $php_ext + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\config\config $config Config object + * @param \phpbb\passwords\manager $passwords_manager Passwords Manager object + * @param \phpbb\request\request $request Request object + * @param \phpbb\user $user User object + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension */ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext) { diff --git a/phpBB/phpbb/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php index e7764b754b..d32e7504eb 100644 --- a/phpBB/phpbb/auth/provider/ldap.php +++ b/phpBB/phpbb/auth/provider/ldap.php @@ -29,10 +29,10 @@ class ldap extends \phpbb\auth\provider\base /** * LDAP Authentication Constructor * - * @param \phpbb\db\driver\driver_interface $db - * @param \phpbb\config\config $config - * @param \phpbb\passwords\manager $passwords_manager - * @param \phpbb\user $user + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\config\config $config Config object + * @param \phpbb\passwords\manager $passwords_manager Passwords manager object + * @param \phpbb\user $user User object */ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\user $user) { diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index c43004f340..edc5941602 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -19,6 +19,32 @@ namespace phpbb\avatar\driver; class upload extends \phpbb\avatar\driver\driver { /** + * @var \phpbb\mimetype\guesser + */ + protected $mimetype_guesser; + + /** + * Construct a driver object + * + * @param \phpbb\config\config $config phpBB configuration + * @param \phpbb\request\request $request Request object + * @param string $phpbb_root_path Path to the phpBB root + * @param string $php_ext PHP file extension + * @param \phpbb_path_helper $path_helper phpBB path helper + * @param \phpbb\mimetype\guesser $mimetype_guesser Mimetype guesser + * @param \phpbb\cache\driver\driver_interface $cache Cache driver + */ + public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\mimetype\guesser $mimetype_guesser, \phpbb\cache\driver\driver_interface $cache = null) + { + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->path_helper = $path_helper; + $this->mimetype_guesser = $mimetype_guesser; + $this->cache = $cache; + } + + /** * {@inheritdoc} */ public function get_data($row, $ignore_config = false) @@ -70,7 +96,7 @@ class upload extends \phpbb\avatar\driver\driver if (!empty($upload_file['name'])) { - $file = $upload->form_upload('avatar_upload_file'); + $file = $upload->form_upload('avatar_upload_file', $this->mimetype_guesser); } else if (!empty($this->config['allow_avatar_remote_upload']) && !empty($url)) { @@ -100,7 +126,7 @@ class upload extends \phpbb\avatar\driver\driver return false; } - $file = $upload->remote_upload($url); + $file = $upload->remote_upload($url, $this->mimetype_guesser); } else { diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index d6bf150384..b890d90558 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -47,7 +47,7 @@ class service protected $phpbb_root_path; /** - * PHP extension. + * PHP file extension. * * @var string */ @@ -60,7 +60,7 @@ class service * @param \phpbb\config\config $config The config * @param \phpbb\db\driver\driver_interface $db Database connection * @param string $phpbb_root_path Root path - * @param string $php_ext PHP extension + * @param string $php_ext PHP file extension */ public function __construct(\phpbb\cache\driver\driver_interface $driver, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext) { diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index b1f0635913..bc4897af18 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -17,7 +17,6 @@ use Symfony\Component\Console\Shell; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\DependencyInjection\TaggedContainerInterface; class application extends \Symfony\Component\Console\Application { @@ -38,9 +37,26 @@ class application extends \Symfony\Component\Console\Application */ public function __construct($name, $version, \phpbb\user $user) { + $this->user = $user; + parent::__construct($name, $version); + } - $this->user = $user; + /** + * {@inheritdoc} + */ + protected function getDefaultInputDefinition() + { + $input_definition = parent::getDefaultInputDefinition(); + + $input_definition->addOption(new InputOption( + 'safe-mode', + null, + InputOption::VALUE_NONE, + $this->user->lang('CLI_DESCRIPTION_OPTION_SAFE_MODE') + )); + + return $input_definition; } /** @@ -73,14 +89,13 @@ class application extends \Symfony\Component\Console\Application /** * Register a set of commands from the container * - * @param TaggedContainerInterface $container The container - * @param string $tag The tag used to register the commands + * @param \phpbb\di\service_collection $command_collection The console service collection */ - public function register_container_commands(TaggedContainerInterface $container, $tag = 'console.command') + public function register_container_commands(\phpbb\di\service_collection $command_collection) { - foreach($container->findTaggedServiceIds($tag) as $id => $void) + foreach ($command_collection as $service_command) { - $this->add($container->get($id)); + $this->add($service_command); } } diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index 379d2aa1ca..ec8229200c 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); } /** @@ -63,7 +59,7 @@ class purge extends \phpbb\console\command\command { $this ->setName('cache:purge') - ->setDescription('Purge the cache.') + ->setDescription($this->user->lang('PURGE_CACHE')) ; } 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/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 1310bb18b4..efd276d7e3 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -25,11 +25,11 @@ class delete extends command { $this ->setName('config:delete') - ->setDescription('Deletes a configuration option') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DELETE_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ; } @@ -53,11 +53,11 @@ class delete extends command { $this->config->delete($key); - $output->writeln("<info>Successfully deleted config $key</info>"); + $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_DELETE_SUCCESS', $key) . '</info>'); } else { - $output->writeln("<error>Config $key does not exist</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>'); } } } diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index ee8c65110e..9c03b49a3d 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -26,17 +26,17 @@ class get extends command { $this ->setName('config:get') - ->setDescription("Gets a configuration option's value") + ->setDescription($this->user->lang('CLI_DESCRIPTION_GET_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addOption( 'no-newline', null, InputOption::VALUE_NONE, - 'Set this option if the value should be printed without a new line at the end.' + $this->user->lang('CLI_CONFIG_PRINT_WITHOUT_NEWLINE') ) ; } @@ -66,7 +66,7 @@ class get extends command } else { - $output->writeln("<error>Could not get config $key</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>'); } } } diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 21f0660e61..b4d7438b66 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -26,22 +26,22 @@ class increment extends command { $this ->setName('config:increment') - ->setDescription("Increments a configuration option's value") + ->setDescription($this->user->lang('CLI_DESCRIPTION_INCREMENT_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addArgument( 'increment', InputArgument::REQUIRED, - 'Amount to increment by' + $this->user->lang('CLI_CONFIG_INCREMENT_BY') ) ->addOption( 'dynamic', 'd', InputOption::VALUE_NONE, - 'Set this option if the configuration option changes too frequently to be efficiently cached.' + $this->user->lang('CLI_CONFIG_CANNOT_CACHED') ) ; } @@ -65,6 +65,6 @@ class increment extends command $this->config->increment($key, $increment, $use_cache); - $output->writeln("<info>Successfully incremented config $key</info>"); + $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_INCREMENT_SUCCESS', $key) . '</info>'); } } diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index 587b7fb0de..695de31013 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -26,22 +26,22 @@ class set extends command { $this ->setName('config:set') - ->setDescription("Sets a configuration option's value") + ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addArgument( 'value', InputArgument::REQUIRED, - 'New configuration value, use 0 and 1 to specify boolean values' + $this->user->lang('CLI_CONFIG_NEW') ) ->addOption( 'dynamic', 'd', InputOption::VALUE_NONE, - 'Set this option if the configuration option changes too frequently to be efficiently cached.' + $this->user->lang('CLI_CONFIG_CANNOT_CACHED') ) ; } @@ -65,6 +65,6 @@ class set extends command $this->config->set($key, $value, $use_cache); - $output->writeln("<info>Successfully set config $key</info>"); + $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>'); } } diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index a7a52155f9..e8c69a0885 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -26,27 +26,27 @@ class set_atomic extends command { $this ->setName('config:set-atomic') - ->setDescription("Sets a configuration option's value only if the old matches the current value.") + ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_ATOMIC_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addArgument( 'old', InputArgument::REQUIRED, - 'Current configuration value, use 0 and 1 to specify boolean values' + $this->user->lang('CLI_CONFIG_CURRENT') ) ->addArgument( 'new', InputArgument::REQUIRED, - 'New configuration value, use 0 and 1 to specify boolean values' + $this->user->lang('CLI_CONFIG_NEW') ) ->addOption( 'dynamic', 'd', InputOption::VALUE_NONE, - 'Set this option if the configuration option changes too frequently to be efficiently cached.' + $this->user->lang('CLI_CONFIG_CANNOT_CACHED') ) ; } @@ -72,12 +72,12 @@ class set_atomic extends command if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache)) { - $output->writeln("<info>Successfully set config $key</info>"); + $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>'); return 0; } else { - $output->writeln("<error>Could not set config $key</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_SET_FAILURE', $key) . '</error>'); return 1; } } 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..c3caae5f70 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -32,31 +32,29 @@ 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() { $this ->setName('db:migrate') - ->setDescription('Updates the database by applying migrations.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE')) ; } protected function execute(InputInterface $input, OutputInterface $output) { + $this->migrator->create_migrations_table(); + $this->load_migrations(); $orig_version = $this->config['version']; while (!$this->migrator->finished()) diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php index c2f61568ea..f9047bdac8 100644 --- a/phpBB/phpbb/console/command/dev/migration_tips.php +++ b/phpBB/phpbb/console/command/dev/migration_tips.php @@ -20,17 +20,17 @@ 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() { $this ->setName('dev:migration-tips') - ->setDescription('Finds migrations that are not depended on.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_FIND_MIGRATIONS')) ; } 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/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index c04848aa01..1eee16cbd9 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -22,11 +22,11 @@ class disable extends command { $this ->setName('extension:disable') - ->setDescription('Disables the specified extension.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DISABLE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, - 'Name of the extension' + $this->user->lang('CLI_EXTENSION_NAME') ) ; } @@ -39,13 +39,13 @@ class disable extends command if ($this->manager->is_enabled($name)) { - $output->writeln("<error>Could not disable extension $name</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_DISABLE_FAILURE', $name) . '</error>'); return 1; } else { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name)); - $output->writeln("<info>Successfully disabled extension $name</info>"); + $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_DISABLE_SUCCESS', $name) . '</info>'); return 0; } } diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 86a034cdf4..59ff11e9b7 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -22,11 +22,11 @@ class enable extends command { $this ->setName('extension:enable') - ->setDescription('Enables the specified extension.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_ENABLE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, - 'Name of the extension' + $this->user->lang('CLI_EXTENSION_NAME') ) ; } @@ -40,12 +40,12 @@ class enable extends command if ($this->manager->is_enabled($name)) { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name)); - $output->writeln("<info>Successfully enabled extension $name</info>"); + $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name) . '</info>'); return 0; } else { - $output->writeln("<error>Could not enable extension $name</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name) . '</error>'); return 1; } } diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index 841598b90a..517e9a74c9 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -22,11 +22,11 @@ class purge extends command { $this ->setName('extension:purge') - ->setDescription('Purges the specified extension.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_PURGE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, - 'Name of the extension' + $this->user->lang('CLI_EXTENSION_NAME') ) ; } @@ -39,13 +39,13 @@ class purge extends command if ($this->manager->is_enabled($name)) { - $output->writeln("<error>Could not purge extension $name</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_PURGE_FAILURE', $name) . '</error>'); return 1; } else { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name)); - $output->writeln("<info>Successfully purge extension $name</info>"); + $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_PURGE_SUCCESS', $name) . '</info>'); return 0; } } diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php index 2db1c59e24..6ce9607098 100644 --- a/phpBB/phpbb/console/command/extension/show.php +++ b/phpBB/phpbb/console/command/extension/show.php @@ -21,7 +21,7 @@ class show extends command { $this ->setName('extension:show') - ->setDescription('Lists all extensions in the database and on the filesystem.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_LIST_EXTENSIONS')) ; } @@ -32,7 +32,7 @@ class show extends command if (empty($all)) { - $output->writeln('<comment>No extensions were found.</comment>'); + $output->writeln('<comment>' . $this->user->lang('CLI_EXTENSION_NOT_FOUND') . '</comment>'); return 3; } diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php index ec04da4267..ec4e1b0ee7 100644 --- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -20,18 +20,18 @@ 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() { $this ->setName('fixup:recalculate-email-hash') - ->setDescription('Recalculates the user_email_hash column of the users table.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH')) ; } @@ -70,6 +70,6 @@ class recalculate_email_hash extends \phpbb\console\command\command } $this->db->sql_freeresult($result); - $output->writeln('<info>Successfully recalculated all email hashes.</info>'); + $output->writeln('<info>' . $this->user->lang('CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS') . '</info>'); } } diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index e330fb5b6d..dd89d0504a 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -50,7 +50,7 @@ class helper protected $phpbb_root_path; /** - * PHP extension + * PHP file extension * @var string */ protected $php_ext; @@ -65,7 +65,7 @@ class helper * @param \phpbb\extension\manager $manager Extension manager object * @param \phpbb\symfony_request $symfony_request Symfony Request object * @param string $phpbb_root_path phpBB root path - * @param string $php_ext PHP extension + * @param string $php_ext PHP file extension */ public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, \phpbb\symfony_request $symfony_request, $phpbb_root_path, $php_ext) { @@ -82,9 +82,11 @@ class helper /** * Automate setting up the page and creating the response object. * - * @param string $handle The template handle to render + * @param string $template_file The template handle to render * @param string $page_title The title of the page to output * @param int $status_code The status code to be sent to the page header + * @param bool $display_online_list Do we display online users list + * * @return Response object containing rendered page */ public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false) diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php index b0601e641a..5c8ac04b77 100644 --- a/phpBB/phpbb/cron/manager.php +++ b/phpBB/phpbb/cron/manager.php @@ -35,6 +35,8 @@ class manager * Constructor. Loads all available tasks. * * @param array|\Traversable $tasks Provides an iterable set of task names + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension */ public function __construct($tasks, $phpbb_root_path, $php_ext) { diff --git a/phpBB/phpbb/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php index 032ba1d2cc..b47939ccbe 100644 --- a/phpBB/phpbb/cron/task/core/prune_all_forums.php +++ b/phpBB/phpbb/cron/task/core/prune_all_forums.php @@ -31,7 +31,7 @@ class prune_all_forums extends \phpbb\cron\task\base * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext The PHP file extension * @param \phpbb\config\config $config The config * @param \phpbb\db\driver\driver_interface $db The db connection */ diff --git a/phpBB/phpbb/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php index 8da0048baa..ba68565197 100644 --- a/phpBB/phpbb/cron/task/core/prune_forum.php +++ b/phpBB/phpbb/cron/task/core/prune_forum.php @@ -41,7 +41,7 @@ class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\para * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext PHP file extension * @param \phpbb\config\config $config The config * @param \phpbb\db\driver\driver_interface $db The db connection */ diff --git a/phpBB/phpbb/cron/task/core/prune_shadow_topics.php b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php index 83a2460454..97a4b0ea86 100644 --- a/phpBB/phpbb/cron/task/core/prune_shadow_topics.php +++ b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php @@ -43,7 +43,7 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext PHP file extension * @param \phpbb\config\config $config The config * @param \phpbb\db\driver\driver_interface $db The db connection * @param \phpbb\log\log $log The phpBB log system diff --git a/phpBB/phpbb/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php index 553e424bd0..796a96d7f5 100644 --- a/phpBB/phpbb/cron/task/core/queue.php +++ b/phpBB/phpbb/cron/task/core/queue.php @@ -26,7 +26,7 @@ class queue extends \phpbb\cron\task\base * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext PHP file extension * @param \phpbb\config\config $config The config */ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) diff --git a/phpBB/phpbb/cron/task/core/tidy_database.php b/phpBB/phpbb/cron/task/core/tidy_database.php index ec058b4a50..949bba8012 100644 --- a/phpBB/phpbb/cron/task/core/tidy_database.php +++ b/phpBB/phpbb/cron/task/core/tidy_database.php @@ -26,7 +26,7 @@ class tidy_database extends \phpbb\cron\task\base * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext The PHP file extension * @param \phpbb\config\config $config The config */ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) diff --git a/phpBB/phpbb/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php index 2de744b7c1..ce16b3f988 100644 --- a/phpBB/phpbb/cron/task/core/tidy_search.php +++ b/phpBB/phpbb/cron/task/core/tidy_search.php @@ -31,7 +31,7 @@ class tidy_search extends \phpbb\cron\task\base * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext The PHP file extension * @param \phpbb\auth\auth $auth The auth * @param \phpbb\config\config $config The config * @param \phpbb\db\driver\driver_interface $db The db connection @@ -54,8 +54,7 @@ class tidy_search extends \phpbb\cron\task\base */ public function run() { - // Select the search method - $search_type = basename($this->config['search_type']); + $search_type = $this->config['search_type']; // We do some additional checks in the module to ensure it can actually be utilised $error = false; @@ -78,10 +77,7 @@ class tidy_search extends \phpbb\cron\task\base */ public function is_runnable() { - // Select the search method - $search_type = basename($this->config['search_type']); - - return class_exists($search_type); + return class_exists($this->config['search_type']); } /** diff --git a/phpBB/phpbb/cron/task/core/tidy_warnings.php b/phpBB/phpbb/cron/task/core/tidy_warnings.php index 058288222c..7b67eae6ef 100644 --- a/phpBB/phpbb/cron/task/core/tidy_warnings.php +++ b/phpBB/phpbb/cron/task/core/tidy_warnings.php @@ -28,7 +28,7 @@ class tidy_warnings extends \phpbb\cron\task\base * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext PHP file extension * @param \phpbb\config\config $config The config */ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) diff --git a/phpBB/phpbb/cron/task/wrapper.php b/phpBB/phpbb/cron/task/wrapper.php index 11399282d3..8a4a8b1f0c 100644 --- a/phpBB/phpbb/cron/task/wrapper.php +++ b/phpBB/phpbb/cron/task/wrapper.php @@ -29,6 +29,8 @@ class wrapper * Wraps a task $task, which must implement cron_task interface. * * @param \phpbb\cron\task\task $task The cron task to wrap. + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension */ public function __construct(\phpbb\cron\task\task $task, $phpbb_root_path, $php_ext) { diff --git a/phpBB/phpbb/datetime.php b/phpBB/phpbb/datetime.php index 9c9292a8e4..e674707883 100644 --- a/phpBB/phpbb/datetime.php +++ b/phpBB/phpbb/datetime.php @@ -38,9 +38,9 @@ class datetime extends \DateTime * Constructs a new instance of \phpbb\datetime, expanded to include an argument to inject * the user context and modify the timezone to the users selected timezone if one is not set. * + * @param user $user object for context. * @param string $time String in a format accepted by strtotime(). * @param \DateTimeZone $timezone Time zone of the time. - * @param user $user object for context. */ public function __construct($user, $time = 'now', \DateTimeZone $timezone = null) { diff --git a/phpBB/phpbb/db/migration/data/v310/rc2.php b/phpBB/phpbb/db/migration/data/v310/rc2.php new file mode 100644 index 0000000000..e1323659da --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/rc2.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\v310; + +class rc2 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-RC2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/search_type.php b/phpBB/phpbb/db/migration/data/v310/search_type.php new file mode 100644 index 0000000000..f89456ae19 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/search_type.php @@ -0,0 +1,34 @@ +<?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\v310; + +class search_type extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\dev', + ); + } + + public function update_data() + { + return array( + array('if', array( + (is_file($this->phpbb_root_path . 'phpbb/search/' . $this->config['search_type'] . $this->php_ext)), + array('config.update', array('search_type', '\\phpbb\\search\\' . $this->config['search_type'])), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php index e66e5fd080..9000949a7d 100644 --- a/phpBB/phpbb/db/migration/profilefield_base_migration.php +++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php @@ -107,8 +107,8 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration while ($lang_id = (int) $this->db->sql_fetchfield('lang_id')) { $insert_buffer->insert(array( - 'field_id' => $field_id, - 'lang_id' => $lang_id, + 'field_id' => (int) $field_id, + 'lang_id' => (int) $lang_id, 'lang_name' => $lang_name, 'lang_explain' => '', 'lang_default_value' => '', @@ -136,8 +136,8 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration foreach ($this->profilefield_language_data as $language_data) { $insert_buffer->insert(array_merge(array( - 'field_id' => $field_id, - 'lang_id' => $lang_id, + 'field_id' => (int) $field_id, + 'lang_id' => (int) $lang_id, ), $language_data)); } } @@ -154,15 +154,15 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration $field_id = $this->get_custom_profile_field_id(); $sql = 'DELETE FROM ' . PROFILE_FIELDS_TABLE . ' - WHERE field_id = ' . $field_id; + WHERE field_id = ' . (int) $field_id; $this->db->sql_query($sql); $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . ' - WHERE field_id = ' . $field_id; + WHERE field_id = ' . (int) $field_id; $this->db->sql_query($sql); $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' - WHERE field_id = ' . $field_id; + WHERE field_id = ' . (int) $field_id; $this->db->sql_query($sql); } diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index d2df27613a..5cfbc5ca00 100644 --- a/phpBB/phpbb/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php @@ -105,6 +105,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface * @param string $auth_option The name of the permission (auth) option * @param bool $global True for checking a global permission setting, * False for a local permission setting + * @param int|false $copy_from If set, contains the id of the permission from which to copy the new one. * @return null */ public function add($auth_option, $global = true, $copy_from = false) @@ -243,7 +244,9 @@ class permission implements \phpbb\db\migration\tool\tool_interface * Add a new permission role * * @param string $role_name The new role name - * @param sting $role_type The type (u_, m_, a_) + * @param string $role_type The type (u_, m_, a_) + * @param string $role_description Description of the new role + * * @return null */ public function role_add($role_name, $role_type, $role_description = '') diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index 8b089a060f..8bc63e564a 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -767,4 +767,28 @@ class migrator return $this->migrations; } + + /** + * Creates the migrations table if it does not exist. + * @return null + */ + public function create_migrations_table() + { + // Make sure migrations have been installed. + if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations')) + { + $this->db_tools->sql_create_table($this->table_prefix . 'migrations', array( + 'COLUMNS' => array( + 'migration_name' => array('VCHAR', ''), + 'migration_depends_on' => array('TEXT', ''), + 'migration_schema_done' => array('BOOL', 0), + 'migration_data_done' => array('BOOL', 0), + 'migration_data_state' => array('TEXT', ''), + 'migration_start_time' => array('TIMESTAMP', 0), + 'migration_end_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => 'migration_name', + )); + } + } } 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/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index ab10073013..553b723cc8 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -175,7 +175,7 @@ class container_builder $this->container->compile(); } - if ($this->dump_container && !defined('DEBUG')) + if ($this->dump_container && !defined('DEBUG_CONTAINER')) { $this->dump_container($container_filename); } diff --git a/phpBB/phpbb/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php index 323dabb84c..ee9f29a59d 100644 --- a/phpBB/phpbb/event/kernel_request_subscriber.php +++ b/phpBB/phpbb/event/kernel_request_subscriber.php @@ -28,7 +28,7 @@ class kernel_request_subscriber implements EventSubscriberInterface protected $manager; /** - * PHP extension + * PHP file extension * @var string */ protected $php_ext; @@ -44,7 +44,7 @@ class kernel_request_subscriber implements EventSubscriberInterface * * @param \phpbb\extension\manager $manager Extension manager object * @param string $root_path Root path - * @param string $php_ext PHP extension + * @param string $php_ext PHP file extension */ public function __construct(\phpbb\extension\manager $manager, $root_path, $php_ext) { diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 5afec9ba82..76f0e3558e 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -77,11 +77,12 @@ class manager { $this->extensions = array(); - // Do not try to load any extensions when installing or updating + // Do not try to load any extensions if the extension table + // does not exist or when installing or updating. // Note: database updater invokes this code, and in 3.0 // there is no extension table therefore the rest of this function // fails - if (defined('IN_INSTALL')) + if (defined('IN_INSTALL') || version_compare($this->config['version'], '3.1.0-dev', '<')) { return; } diff --git a/phpBB/phpbb/feed/helper.php b/phpBB/phpbb/feed/helper.php index 9741b752af..198134cdcf 100644 --- a/phpBB/phpbb/feed/helper.php +++ b/phpBB/phpbb/feed/helper.php @@ -36,7 +36,7 @@ class helper * @param \phpbb\config\config $config Config object * @param \phpbb\user $user User object * @param string $phpbb_root_path Root path - * @param string $phpEx PHP extension + * @param string $phpEx PHP file extension */ public function __construct(\phpbb\config\config $config, \phpbb\user $user, $phpbb_root_path, $phpEx) { diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index c522c3273f..2af8b50b54 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -245,9 +245,9 @@ class log implements \phpbb\log\log_interface break; case 'mod': - $forum_id = (int) $additional_data['forum_id']; + $forum_id = isset($additional_data['forum_id']) ? (int) $additional_data['forum_id'] : 0; unset($additional_data['forum_id']); - $topic_id = (int) $additional_data['topic_id']; + $topic_id = isset($additional_data['topic_id']) ? (int) $additional_data['topic_id'] : 0; unset($additional_data['topic_id']); $sql_ary += array( 'log_type' => LOG_MOD, diff --git a/phpBB/phpbb/mimetype/guesser.php b/phpBB/phpbb/mimetype/guesser.php index 87b164b561..773a1f822a 100644 --- a/phpBB/phpbb/mimetype/guesser.php +++ b/phpBB/phpbb/mimetype/guesser.php @@ -99,6 +99,7 @@ class guesser * Guess mimetype of supplied file * * @param string $file Path to file + * @param string $file_name The real file name * * @return string Guess for mimetype of file */ diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index 74ef980445..5e4bab1530 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -68,12 +68,14 @@ class manager * @param \phpbb\user_loader $user_loader * @param \phpbb\config\config $config * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\cache\service $cache * @param \phpbb\user $user * @param string $phpbb_root_path * @param string $php_ext * @param string $notification_types_table * @param string $notifications_table * @param string $user_notifications_table + * * @return \phpbb\notification\manager */ public function __construct($notification_types, $notification_methods, ContainerInterface $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) @@ -832,7 +834,7 @@ class manager * Delete all notifications older than a certain time * * @param int $timestamp Unix timestamp to delete all notifications that were created before - * @param bool $only_unread True (default) to only prune read notifications + * @param bool $only_read True (default) to only prune read notifications */ public function prune_notifications($timestamp, $only_read = true) { diff --git a/phpBB/phpbb/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php index a6735dc793..0aad19d6bf 100644 --- a/phpBB/phpbb/notification/type/approve_post.php +++ b/phpBB/phpbb/notification/type/approve_post.php @@ -67,7 +67,8 @@ class approve_post extends \phpbb\notification\type\post /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php index 459a0ec348..e649f3920e 100644 --- a/phpBB/phpbb/notification/type/approve_topic.php +++ b/phpBB/phpbb/notification/type/approve_topic.php @@ -67,7 +67,8 @@ class approve_topic extends \phpbb\notification\type\topic /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index 910f51b3a6..a11ad76db9 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -161,6 +161,8 @@ abstract class base implements \phpbb\notification\type\type_interface * Magic method to set data on this notification * * @param mixed $name + * @param mixed $value + * * @return null */ public function __set($name, $value) @@ -174,7 +176,6 @@ abstract class base implements \phpbb\notification\type\type_interface * * Primarily for testing * - * @param string $name * @return mixed */ public function __toString() diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php index f4870e8a52..c83288cfb8 100644 --- a/phpBB/phpbb/notification/type/bookmark.php +++ b/phpBB/phpbb/notification/type/bookmark.php @@ -59,7 +59,8 @@ class bookmark extends \phpbb\notification\type\post /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php index 4f54e93e06..8445ca4b22 100644 --- a/phpBB/phpbb/notification/type/pm.php +++ b/phpBB/phpbb/notification/type/pm.php @@ -72,7 +72,8 @@ class pm extends \phpbb\notification\type\base /** * Find the users who want to receive notifications * - * @param array $pm Data from + * @param array $pm Data from submit_pm + * @param array $options Options for finding users for notification * * @return array */ @@ -178,7 +179,7 @@ class pm extends \phpbb\notification\type\base * Function for preparing the data for insertion in an SQL query * (The service handles insertion) * - * @param array $post Data from submit_post + * @param array $pm Data from submit_post * @param array $pre_create_data Data from pre_create_insert_array() * * @return array Array of data ready to be inserted into the database diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index ee3a253e0f..357176ec35 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -86,7 +86,8 @@ class post extends \phpbb\notification\type\base /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ diff --git a/phpBB/phpbb/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php index b893ad0d15..3bb1028619 100644 --- a/phpBB/phpbb/notification/type/post_in_queue.php +++ b/phpBB/phpbb/notification/type/post_in_queue.php @@ -70,6 +70,7 @@ class post_in_queue extends \phpbb\notification\type\post * Find the users who want to receive notifications * * @param array $post Data from the post + * @param array $options Options for finding users for notification * * @return array */ diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index 7c61b76b58..6e672e6fbd 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -66,7 +66,8 @@ class quote extends \phpbb\notification\type\post /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ @@ -122,7 +123,7 @@ class quote extends \phpbb\notification\type\post /** * Update a notification * - * @param array $data Data specific for this type that will be updated + * @param array $post Data specific for this type that will be updated */ public function update_notifications($post) { diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index 2eb802eb4b..14a328e104 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -94,6 +94,7 @@ class report_pm extends \phpbb\notification\type\pm * (copied from post_in_queue) * * @param array $post Data from the post + * @param array $options Options for finding users for notification * * @return array */ diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php index ed40df67f3..de7bf74a97 100644 --- a/phpBB/phpbb/notification/type/report_pm_closed.php +++ b/phpBB/phpbb/notification/type/report_pm_closed.php @@ -52,7 +52,8 @@ class report_pm_closed extends \phpbb\notification\type\pm /** * Find the users who want to receive notifications * - * @param array $pm Data from + * @param array $pm Data from submit_pm + * @param array $options Options for finding users for notification * * @return array */ diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php index 024c8d9d42..bec59df9d5 100644 --- a/phpBB/phpbb/notification/type/report_post.php +++ b/phpBB/phpbb/notification/type/report_post.php @@ -76,6 +76,7 @@ class report_post extends \phpbb\notification\type\post_in_queue * Find the users who want to receive notifications * * @param array $post Data from the post + * @param array $options Options for finding users for notification * * @return array */ diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php index a979af1fb0..cd1400f8fa 100644 --- a/phpBB/phpbb/notification/type/report_post_closed.php +++ b/phpBB/phpbb/notification/type/report_post_closed.php @@ -59,7 +59,8 @@ class report_post_closed extends \phpbb\notification\type\post /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index a512a12f20..289e45bedb 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -87,6 +87,7 @@ class topic extends \phpbb\notification\type\base * Find the users who want to receive notifications * * @param array $topic Data from the topic + * @param array $options Options for finding users for notification * * @return array */ diff --git a/phpBB/phpbb/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php index 2d54a68648..aef1487d77 100644 --- a/phpBB/phpbb/notification/type/topic_in_queue.php +++ b/phpBB/phpbb/notification/type/topic_in_queue.php @@ -70,6 +70,7 @@ class topic_in_queue extends \phpbb\notification\type\topic * Find the users who want to receive notifications * * @param array $topic Data from the topic + * @param array $options Options for finding users for notification * * @return array */ diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index a8592eac6c..38dbbab51e 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -46,7 +46,7 @@ class path_helper * @param \phpbb\filesystem $filesystem * @param \phpbb\request\request_interface $request * @param string $phpbb_root_path Relative path to phpBB root - * @param string $php_ext PHP extension (php) + * @param string $php_ext PHP file extension * @param mixed $adm_relative_path Relative path admin path to adm/ root */ public function __construct(\phpbb\symfony_request $symfony_request, \phpbb\filesystem $filesystem, \phpbb\request\request_interface $request, $phpbb_root_path, $php_ext, $adm_relative_path = null) 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/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php index f3b1676799..98802d2209 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -397,7 +397,7 @@ class manager } $field_desc = $contact_url = ''; - if ($use_contact_fields) + if ($use_contact_fields && $ident_ary['data']['field_is_contact']) { $value = $profile_field->get_profile_contact_value($ident_ary['value'], $ident_ary['data']); $field_desc = $this->user->lang($ident_ary['data']['field_contact_desc']); diff --git a/phpBB/phpbb/profilefields/type/type_googleplus.php b/phpBB/phpbb/profilefields/type/type_googleplus.php index df1bcc7f4b..887baa3de1 100644 --- a/phpBB/phpbb/profilefields/type/type_googleplus.php +++ b/phpBB/phpbb/profilefields/type/type_googleplus.php @@ -18,6 +18,14 @@ class type_googleplus extends type_string /** * {@inheritDoc} */ + public function get_name() + { + return $this->user->lang('FIELD_GOOGLEPLUS'); + } + + /** + * {@inheritDoc} + */ public function get_service_name() { return 'profilefields.type.googleplus'; diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php index 2dd13fa480..ec770f9467 100644 --- a/phpBB/phpbb/profilefields/type/type_interface.php +++ b/phpBB/phpbb/profilefields/type/type_interface.php @@ -189,8 +189,8 @@ interface type_interface /** * Allows manipulating the intended variables if needed * - * @param string $key Name of the option * @param int $step Step on which the option is hidden + * @param string $key Name of the option * @param string $action Currently performed action (create|edit) * @param array $field_data Array with data for this field * @return mixed Final value of the option diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php index c2b951b6c9..0eaf7e527d 100644 --- a/phpBB/phpbb/profilefields/type/type_string_common.php +++ b/phpBB/phpbb/profilefields/type/type_string_common.php @@ -98,7 +98,7 @@ abstract class type_string_common extends type_base */ public function get_profile_value($field_value, $field_data) { - if (!$field_value && !$field_data['field_show_novalue']) + if (($field_value === null || $field_value === '') && !$field_data['field_show_novalue']) { return null; } @@ -114,7 +114,7 @@ abstract class type_string_common extends type_base */ public function get_profile_value_raw($field_value, $field_data) { - if (!$field_value && !$field_data['field_show_novalue']) + if (($field_value === null || $field_value === '') && !$field_data['field_show_novalue']) { return null; } @@ -127,12 +127,7 @@ abstract class type_string_common extends type_base */ public function get_profile_contact_value($field_value, $field_data) { - if (!$field_value && !$field_data['field_show_novalue']) - { - return null; - } - - return $field_value; + return $this->get_profile_value_raw($field_value, $field_data); } /** diff --git a/phpBB/phpbb/search/base.php b/phpBB/phpbb/search/base.php index 9395b6a273..30781975d8 100644 --- a/phpBB/phpbb/search/base.php +++ b/phpBB/phpbb/search/base.php @@ -85,8 +85,12 @@ class base /** * Retrieves cached search results * - * @param int &$result_count will contain the number of all results for the search (not only for the current page) - * @param array &$id_ary is filled with the ids belonging to the requested page that are stored in the cache + * @param string $search_key an md5 string generated from all the passed search options to identify the results + * @param int &$result_count will contain the number of all results for the search (not only for the current page) + * @param array &$id_ary is filled with the ids belonging to the requested page that are stored in the cache + * @param int &$start indicates the first index of the page + * @param int $per_page number of ids each page is supposed to contain + * @param string $sort_dir is either a or d representing ASC and DESC * * @return int SEARCH_RESULT_NOT_IN_CACHE or SEARCH_RESULT_IN_CACHE or SEARCH_RESULT_INCOMPLETE */ @@ -160,8 +164,16 @@ class base /** * Caches post/topic ids * - * @param array &$id_ary contains a list of post or topic ids that shall be cached, the first element + * @param string $search_key an md5 string generated from all the passed search options to identify the results + * @param string $keywords contains the keywords as entered by the user + * @param array $author_ary an array of author ids, if the author should be ignored during the search the array is empty + * @param int $result_count contains the number of all results for the search (not only for the current page) + * @param array &$id_ary contains a list of post or topic ids that shall be cached, the first element * must have the absolute index $start in the result set. + * @param int $start indicates the first index of the page + * @param string $sort_dir is either a or d representing ASC and DESC + * + * @return null */ function save_ids($search_key, $keywords, $author_ary, $result_count, &$id_ary, $start, $sort_dir) { diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index d4e7de31e5..1a0aba096f 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -73,6 +73,12 @@ class fulltext_mysql extends \phpbb\search\base * Creates a new \phpbb\search\fulltext_mysql, which is used as a search backend * * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface Database object + * @param \phpbb\user $user User object */ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user) { diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index b3e7f51f87..b6af371d13 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -86,6 +86,12 @@ class fulltext_postgres extends \phpbb\search\base * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend * * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface Database object + * @param \phpbb\user $user User object */ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user) { diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 78c11f1180..79d68d2ae1 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -119,6 +119,12 @@ class fulltext_sphinx * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend * * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface Database object + * @param \phpbb\user $user User object */ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user) { diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 59b7ec2029..5a0d7c0031 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1062,11 +1062,13 @@ class session * Check for banned user * * Checks whether the supplied user is banned by id, ip or email. If no parameters - * are passed to the method pre-existing session data is used. If $return is false - * this routine does not return on finding a banned user, it outputs a relevant - * message and stops execution. + * are passed to the method pre-existing session data is used. * - * @param string|array $user_ips Can contain a string with one IP or an array of multiple IPs + * @param int|false $user_id The user id + * @param mixed $user_ips Can contain a string with one IP or an array of multiple IPs + * @param string|false $user_email The user email + * @param bool $return If $return is false this routine does not return on finding a banned user, + * it outputs a relevant message and stops execution. */ function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false) { @@ -1254,12 +1256,14 @@ class session /** * Check if ip is blacklisted - * This should be called only where absolutly necessary + * This should be called only where absolutely necessary * * Only IPv4 (rbldns does not support AAAA records/IPv6 lookups) * * @author satmd (from the php manual) - * @param string $mode register/post - spamcop for example is ommitted for posting + * @param string $mode register/post - spamcop for example is ommitted for posting + * @param string|false $ip the IPv4 address to check + * * @return false if ip is not blacklisted, else an array([checked server], [lookup]) */ function check_dnsbl($mode, $ip = false) diff --git a/phpBB/phpbb/template/asset.php b/phpBB/phpbb/template/asset.php index 5a01ee3a93..67dbd7b357 100644 --- a/phpBB/phpbb/template/asset.php +++ b/phpBB/phpbb/template/asset.php @@ -24,6 +24,7 @@ class asset * Constructor * * @param string $url URL + * @param \phpbb\path_helper $path_helper Path helper object */ public function __construct($url, \phpbb\path_helper $path_helper) { 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/phpbb/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php index 39653f6d26..cb3c953692 100644 --- a/phpBB/phpbb/template/twig/definition.php +++ b/phpBB/phpbb/template/twig/definition.php @@ -25,6 +25,8 @@ class definition * Get a DEFINE'd variable * * @param string $name + * @param array $arguments + * * @return mixed Null if not found */ public function __call($name, $arguments) diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index 8d25153e14..476ffd935e 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -36,11 +36,10 @@ class environment extends \Twig_Environment /** * Constructor * - * @param \phpbb\config\config $phpbb_config - * @param \phpbb\path_helper - * @param \phpbb\extension\manager - * @param string $phpbb_root_path - * @param \Twig_LoaderInterface $loader + * @param \phpbb\config\config $phpbb_config The phpBB configuration + * @param \phpbb\path_helper $path_helper phpBB path helper + * @param \phpbb\extension\manager $extension_manager phpBB extension manager + * @param \Twig_LoaderInterface $loader Twig loader interface * @param array $options Array of options to pass to Twig */ public function __construct($phpbb_config, \phpbb\path_helper $path_helper, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array()) diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index 8f523684dd..3a983491b9 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -162,7 +162,6 @@ class extension extends \Twig_Extension * (e.g. in the ACP, L_TITLE) * If not, we return the result of $user->lang() * - * @param string $lang name * @return string */ function lang() diff --git a/phpBB/phpbb/tree/tree_interface.php b/phpBB/phpbb/tree/tree_interface.php index 8238a072ff..5df01a89cf 100644 --- a/phpBB/phpbb/tree/tree_interface.php +++ b/phpBB/phpbb/tree/tree_interface.php @@ -18,7 +18,7 @@ interface tree_interface /** * Inserts an item into the database table and into the tree. * - * @param array $item The item to be added + * @param array $additional_data The item to be added * @return array Array with item data as set in the database */ public function insert(array $additional_data); |