mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-16 21:54:00 +02:00
Merge branch 'develop' of https://github.com/phpbb/phpbb into ticket/11997
Conflicts: tests/functional/fixtures/ext/foo/bar/config/services.yml
This commit is contained in:
@@ -178,14 +178,16 @@ class manager
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip out user_ and group_ prefixes from keys
|
||||
* Strip out user_, group_, or other prefixes from array keys
|
||||
*
|
||||
* @param array $row User data or group data
|
||||
* @param array $row User data or group data
|
||||
* @param string $prefix Prefix of data keys (e.g. user), should not include the trailing underscore
|
||||
*
|
||||
* @return array User data or group data with keys that have been
|
||||
* stripped from the preceding "user_" or "group_"
|
||||
* @return array User or group data with keys that have been
|
||||
* stripped from the preceding "user_" or "group_"
|
||||
* Also the group id is prefixed with g, when the prefix group is removed.
|
||||
*/
|
||||
static public function clean_row($row)
|
||||
static public function clean_row($row, $prefix = '')
|
||||
{
|
||||
// Upon creation of a user/group $row might be empty
|
||||
if (empty($row))
|
||||
@@ -193,23 +195,19 @@ class manager
|
||||
return self::$default_row;
|
||||
}
|
||||
|
||||
$keys = array_keys($row);
|
||||
$values = array_values($row);
|
||||
$output = array();
|
||||
foreach ($row as $key => $value)
|
||||
{
|
||||
$key = preg_replace("#^(?:{$prefix}_)#", '', $key);
|
||||
$output[$key] = $value;
|
||||
}
|
||||
|
||||
$keys = array_map(array('\phpbb\avatar\manager', 'strip_prefix'), $keys);
|
||||
if ($prefix === 'group' && isset($output['id']))
|
||||
{
|
||||
$output['id'] = 'g' . $output['id'];
|
||||
}
|
||||
|
||||
return array_combine($keys, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip prepending user_ or group_ prefix from key
|
||||
*
|
||||
* @param string Array key
|
||||
* @return string Key that has been stripped from its prefix
|
||||
*/
|
||||
static protected function strip_prefix($key)
|
||||
{
|
||||
return preg_replace('#^(?:user_|group_)#', '', $key);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
|
23
phpBB/phpbb/console/application.php
Normal file
23
phpBB/phpbb/console/application.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\console;
|
||||
|
||||
use Symfony\Component\DependencyInjection\TaggedContainerInterface;
|
||||
|
||||
class application extends \Symfony\Component\Console\Application
|
||||
{
|
||||
function register_container_commands(TaggedContainerInterface $container, $tag = 'console.command')
|
||||
{
|
||||
foreach($container->findTaggedServiceIds($tag) as $id => $void)
|
||||
{
|
||||
$this->add($container->get($id));
|
||||
}
|
||||
}
|
||||
}
|
14
phpBB/phpbb/console/command/command.php
Normal file
14
phpBB/phpbb/console/command/command.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\console\command;
|
||||
|
||||
abstract class command extends \Symfony\Component\Console\Command\Command
|
||||
{
|
||||
}
|
22
phpBB/phpbb/console/command/extension/command.php
Normal file
22
phpBB/phpbb/console/command/extension/command.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
namespace phpbb\console\command\extension;
|
||||
|
||||
abstract class command extends \phpbb\console\command\command
|
||||
{
|
||||
/** @var \phpbb\extension\manager */
|
||||
protected $manager;
|
||||
|
||||
function __construct(\phpbb\extension\manager $manager)
|
||||
{
|
||||
$this->manager = $manager;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
47
phpBB/phpbb/console/command/extension/disable.php
Normal file
47
phpBB/phpbb/console/command/extension/disable.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
namespace phpbb\console\command\extension;
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class disable extends command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('extension:disable')
|
||||
->setDescription('Disables the specified extension.')
|
||||
->addArgument(
|
||||
'extension-name',
|
||||
InputArgument::REQUIRED,
|
||||
'Name of the extension'
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$name = $input->getArgument('extension-name');
|
||||
$this->manager->disable($name);
|
||||
$this->manager->load_extensions();
|
||||
|
||||
if ($this->manager->enabled($name))
|
||||
{
|
||||
$output->writeln("<error>Could not disable extension $name</error>");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$output->writeln("<info>Successfully disabled extension $name</info>");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
47
phpBB/phpbb/console/command/extension/enable.php
Normal file
47
phpBB/phpbb/console/command/extension/enable.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
namespace phpbb\console\command\extension;
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class enable extends command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('extension:enable')
|
||||
->setDescription('Enables the specified extension.')
|
||||
->addArgument(
|
||||
'extension-name',
|
||||
InputArgument::REQUIRED,
|
||||
'Name of the extension'
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$name = $input->getArgument('extension-name');
|
||||
$this->manager->enable($name);
|
||||
$this->manager->load_extensions();
|
||||
|
||||
if ($this->manager->enabled($name))
|
||||
{
|
||||
$output->writeln("<info>Successfully enabled extension $name</info>");
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$output->writeln("<error>Could not enable extension $name</error>");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
47
phpBB/phpbb/console/command/extension/purge.php
Normal file
47
phpBB/phpbb/console/command/extension/purge.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
namespace phpbb\console\command\extension;
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class purge extends command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('extension:purge')
|
||||
->setDescription('Purges the specified extension.')
|
||||
->addArgument(
|
||||
'extension-name',
|
||||
InputArgument::REQUIRED,
|
||||
'Name of the extension'
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$name = $input->getArgument('extension-name');
|
||||
$this->manager->purge($name);
|
||||
$this->manager->load_extensions();
|
||||
|
||||
if ($this->manager->enabled($name))
|
||||
{
|
||||
$output->writeln("<error>Could not purge extension $name</error>");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$output->writeln("<info>Successfully purge extension $name</info>");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
58
phpBB/phpbb/console/command/extension/show.php
Normal file
58
phpBB/phpbb/console/command/extension/show.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
namespace phpbb\console\command\extension;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class show extends command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('extension:show')
|
||||
->setDescription('Lists all extensions in the database and on the filesystem.')
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->manager->load_extensions();
|
||||
$all = array_keys($this->manager->all_available());
|
||||
|
||||
if (empty($all))
|
||||
{
|
||||
$output->writeln('<comment>No extensions were found.</comment>');
|
||||
return 3;
|
||||
}
|
||||
|
||||
$enabled = array_keys($this->manager->all_enabled());
|
||||
$this->print_extension_list($output, 'Enabled', $enabled);
|
||||
|
||||
$output->writeln('');
|
||||
|
||||
$disabled = array_keys($this->manager->all_disabled());
|
||||
$this->print_extension_list($output, 'Disabled', $disabled);
|
||||
|
||||
$output->writeln('');
|
||||
|
||||
$purged = array_diff($all, $enabled, $disabled);
|
||||
$this->print_extension_list($output, 'Available', $purged);
|
||||
}
|
||||
|
||||
protected function print_extension_list(OutputInterface $output, $type, array $extensions)
|
||||
{
|
||||
$output->writeln("<info>$type:</info>");
|
||||
|
||||
foreach ($extensions as $extension)
|
||||
{
|
||||
$output->writeln(" - $extension");
|
||||
}
|
||||
}
|
||||
}
|
71
phpBB/phpbb/console/command/fixup/recalculate_email_hash.php
Normal file
71
phpBB/phpbb/console/command/fixup/recalculate_email_hash.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
namespace phpbb\console\command\fixup;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class recalculate_email_hash extends \phpbb\console\command\command
|
||||
{
|
||||
/** @var \phpbb\db\driver\driver */
|
||||
protected $db;
|
||||
|
||||
function __construct(\phpbb\db\driver\driver $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('fixup:recalculate-email-hash')
|
||||
->setDescription('Recalculates the user_email_hash column of the users table.')
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$sql = 'SELECT user_id, user_email, user_email_hash
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type <> ' . USER_IGNORE . "
|
||||
AND user_email <> ''";
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$user_email_hash = phpbb_email_hash($row['user_email']);
|
||||
if ($user_email_hash !== $row['user_email_hash'])
|
||||
{
|
||||
$sql_ary = array(
|
||||
'user_email_hash' => $user_email_hash,
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE user_id = ' . (int) $row['user_id'];
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG)
|
||||
{
|
||||
$output->writeln(sprintf(
|
||||
'user_id %d, email %s => %s',
|
||||
$row['user_id'],
|
||||
$row['user_email'],
|
||||
$user_email_hash
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$output->writeln('<info>Successfully recalculated all email hashes.</info>');
|
||||
}
|
||||
}
|
@@ -816,7 +816,7 @@ class driver
|
||||
*/
|
||||
function sql_report($mode, $query = '')
|
||||
{
|
||||
global $cache, $starttime, $phpbb_root_path, $phpbb_admin_path, $user;
|
||||
global $cache, $starttime, $phpbb_root_path, $phpbb_path_helper, $user;
|
||||
global $request;
|
||||
|
||||
if (is_object($request) && !$request->variable('explain', false))
|
||||
@@ -846,7 +846,7 @@ class driver
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>SQL Report</title>
|
||||
<link href="' . htmlspecialchars($phpbb_admin_path) . 'style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
||||
<link href="' . htmlspecialchars($phpbb_path_helper->update_web_root_path($phpbb_root_path) . $phpbb_path_helper->get_adm_relative_path()) . 'style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
||||
</head>
|
||||
<body id="errorpage">
|
||||
<div id="wrap">
|
||||
|
28
phpBB/phpbb/db/migration/data/v310/alpha2.php
Normal file
28
phpBB/phpbb/db/migration/data/v310/alpha2.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v310;
|
||||
|
||||
class alpha2 extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v310\alpha1',
|
||||
'\phpbb\db\migration\data\v310\notifications_cron_p2',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('version', '3.1.0-a2')),
|
||||
);
|
||||
}
|
||||
}
|
60
phpBB/phpbb/db/migration/data/v310/avatar_types.php
Normal file
60
phpBB/phpbb/db/migration/data/v310/avatar_types.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v310;
|
||||
|
||||
class avatar_types extends \phpbb\db\migration\migration
|
||||
{
|
||||
/**
|
||||
* @var avatar type map
|
||||
*/
|
||||
protected $avatar_type_map = array(
|
||||
AVATAR_UPLOAD => 'avatar.driver.upload',
|
||||
AVATAR_REMOTE => 'avatar.driver.remote',
|
||||
AVATAR_GALLERY => 'avatar.driver.local',
|
||||
);
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v310\dev',
|
||||
'\phpbb\db\migration\data\v310\avatars',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('custom', array(array($this, 'update_user_avatar_type'))),
|
||||
array('custom', array(array($this, 'update_group_avatar_type'))),
|
||||
);
|
||||
}
|
||||
|
||||
public function update_user_avatar_type()
|
||||
{
|
||||
foreach ($this->avatar_type_map as $old => $new)
|
||||
{
|
||||
$sql = 'UPDATE ' . $this->table_prefix . "users
|
||||
SET user_avatar_type = '$new'
|
||||
WHERE user_avatar_type = '$old'";
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
public function update_group_avatar_type()
|
||||
{
|
||||
foreach ($this->avatar_type_map as $old => $new)
|
||||
{
|
||||
$sql = 'UPDATE ' . $this->table_prefix . "groups
|
||||
SET group_avatar_type = '$new'
|
||||
WHERE group_avatar_type = '$old'";
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
27
phpBB/phpbb/db/migration/data/v310/notifications_cron_p2.php
Normal file
27
phpBB/phpbb/db/migration/data/v310/notifications_cron_p2.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v310;
|
||||
|
||||
class notifications_cron_p2 extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return array('\phpbb\db\migration\data\v310\notifications_cron');
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
// Make read_notification_last_gc dynamic.
|
||||
array('config.remove', array('read_notification_last_gc')),
|
||||
array('config.add', array('read_notification_last_gc', 0, 1)),
|
||||
);
|
||||
}
|
||||
}
|
@@ -34,7 +34,10 @@ class softdelete_p2 extends \phpbb\db\migration\migration
|
||||
),
|
||||
'drop_keys' => array(
|
||||
$this->table_prefix . 'posts' => array('post_approved'),
|
||||
$this->table_prefix . 'topics' => array('forum_appr_last'),
|
||||
$this->table_prefix . 'topics' => array(
|
||||
'forum_appr_last',
|
||||
'topic_approved',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -63,6 +66,7 @@ class softdelete_p2 extends \phpbb\db\migration\migration
|
||||
),
|
||||
$this->table_prefix . 'topics' => array(
|
||||
'forum_appr_last' => array('forum_id', 'topic_approved', 'topic_last_post_id'),
|
||||
'topic_approved' => array('topic_approved'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@@ -24,6 +24,14 @@ class style_update_p2 extends \phpbb\db\migration\migration
|
||||
public function update_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_keys' => array(
|
||||
$this->table_prefix . 'styles' => array(
|
||||
'imageset_id',
|
||||
'template_id',
|
||||
'theme_id',
|
||||
),
|
||||
),
|
||||
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'styles' => array(
|
||||
'imageset_id',
|
||||
@@ -53,6 +61,14 @@ class style_update_p2 extends \phpbb\db\migration\migration
|
||||
),
|
||||
),
|
||||
|
||||
'add_index' => array(
|
||||
$this->table_prefix . 'styles' => array(
|
||||
'imageset_id' => array('imageset_id'),
|
||||
'template_id' => array('template_id'),
|
||||
'theme_id' => array('theme_id'),
|
||||
),
|
||||
),
|
||||
|
||||
'add_tables' => array(
|
||||
$this->table_prefix . 'styles_imageset' => array(
|
||||
'COLUMNS' => array(
|
||||
|
42
phpBB/phpbb/db/migration/data/v310/ucp_popuppm_module.php
Normal file
42
phpBB/phpbb/db/migration/data/v310/ucp_popuppm_module.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v310;
|
||||
|
||||
class ucp_popuppm_module extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
$sql = 'SELECT module_id
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_class = 'ucp'
|
||||
AND module_langname = 'UCP_PM_POPUP_TITLE'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$module_id = $this->db->sql_fetchfield('module_id');
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $module_id == false;
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array('\phpbb\db\migration\data\v310\dev');
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('module.remove', array(
|
||||
'ucp',
|
||||
'UCP_PM',
|
||||
'UCP_PM_POPUP_TITLE',
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
@@ -375,7 +375,7 @@ class migrator
|
||||
|
||||
foreach ($steps as $step_identifier => $step)
|
||||
{
|
||||
$last_result = false;
|
||||
$last_result = 0;
|
||||
if ($state)
|
||||
{
|
||||
// Continue until we reach the step that matches the last step called
|
||||
@@ -436,7 +436,7 @@ class migrator
|
||||
* @param bool $reverse False to install, True to attempt uninstallation by reversing the call
|
||||
* @return null
|
||||
*/
|
||||
protected function run_step($step, $last_result = false, $reverse = false)
|
||||
protected function run_step($step, $last_result = 0, $reverse = false)
|
||||
{
|
||||
$callable_and_parameters = $this->get_callable_from_step($step, $last_result, $reverse);
|
||||
|
||||
@@ -459,7 +459,7 @@ class migrator
|
||||
* @param bool $reverse False to install, True to attempt uninstallation by reversing the call
|
||||
* @return array Array with parameters for call_user_func_array(), 0 is the callable, 1 is parameters
|
||||
*/
|
||||
protected function get_callable_from_step(array $step, $last_result = false, $reverse = false)
|
||||
protected function get_callable_from_step(array $step, $last_result = 0, $reverse = false)
|
||||
{
|
||||
$type = $step[0];
|
||||
$parameters = $step[1];
|
||||
|
@@ -70,7 +70,7 @@ class config extends Extension
|
||||
{
|
||||
if (preg_match('#^[a-z]+$#', $acm_type))
|
||||
{
|
||||
return '\\phpbb\cache\driver\\'.$acm_type;
|
||||
return 'phpbb\\cache\\driver\\' . $acm_type;
|
||||
}
|
||||
|
||||
return $acm_type;
|
||||
|
@@ -14,26 +14,22 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
class extension_subscriber_loader
|
||||
{
|
||||
private $dispatcher;
|
||||
private $extension_manager;
|
||||
private $listener_collection;
|
||||
|
||||
public function __construct(EventDispatcherInterface $dispatcher, \phpbb\extension\manager $extension_manager)
|
||||
public function __construct(EventDispatcherInterface $dispatcher, \phpbb\di\service_collection $listener_collection)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->extension_manager = $extension_manager;
|
||||
$this->listener_collection = $listener_collection;
|
||||
}
|
||||
|
||||
public function load()
|
||||
{
|
||||
$finder = $this->extension_manager->get_finder();
|
||||
$subscriber_classes = $finder
|
||||
->extension_directory('/event')
|
||||
->core_path('event/')
|
||||
->get_classes();
|
||||
|
||||
foreach ($subscriber_classes as $class)
|
||||
if (!empty($this->listener_collection))
|
||||
{
|
||||
$subscriber = new $class();
|
||||
$this->dispatcher->addSubscriber($subscriber);
|
||||
foreach ($this->listener_collection as $listener)
|
||||
{
|
||||
$this->dispatcher->addSubscriber($listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
33
phpBB/phpbb/mimetype/content_guesser.php
Normal file
33
phpBB/phpbb/mimetype/content_guesser.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\mimetype;
|
||||
|
||||
/**
|
||||
* @package mimetype
|
||||
*/
|
||||
|
||||
class content_guesser extends guesser_base
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function is_supported()
|
||||
{
|
||||
return function_exists('mime_content_type');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function guess($file, $file_name = '')
|
||||
{
|
||||
return mime_content_type($file);
|
||||
}
|
||||
}
|
509
phpBB/phpbb/mimetype/extension_guesser.php
Normal file
509
phpBB/phpbb/mimetype/extension_guesser.php
Normal file
@@ -0,0 +1,509 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\mimetype;
|
||||
|
||||
/**
|
||||
* @package mimetype
|
||||
*/
|
||||
|
||||
class extension_guesser extends guesser_base
|
||||
{
|
||||
/**
|
||||
* @var file extension map
|
||||
*/
|
||||
protected $extension_map = array(
|
||||
'3dm' => 'x-world/x-3dmf',
|
||||
'3dmf' => 'x-world/x-3dmf',
|
||||
'a' => 'application/octet-stream',
|
||||
'aab' => 'application/x-authorware-bin',
|
||||
'aam' => 'application/x-authorware-map',
|
||||
'aas' => 'application/x-authorware-seg',
|
||||
'abc' => 'text/vnd.abc',
|
||||
'acgi' => 'text/html',
|
||||
'afl' => 'video/animaflex',
|
||||
'ai' => 'application/postscript',
|
||||
'aif' => 'audio/aiff',
|
||||
'aifc' => 'audio/aiff',
|
||||
'aiff' => 'audio/aiff',
|
||||
'aim' => 'application/x-aim',
|
||||
'aip' => 'text/x-audiosoft-intra',
|
||||
'ani' => 'application/x-navi-animation',
|
||||
'aos' => 'application/x-nokia-9000-communicator-add-on-software',
|
||||
'aps' => 'application/mime',
|
||||
'arc' => 'application/octet-stream',
|
||||
'arj' => 'application/arj',
|
||||
'art' => 'image/x-jg',
|
||||
'asf' => 'video/x-ms-asf',
|
||||
'asm' => 'text/x-asm',
|
||||
'asp' => 'text/asp',
|
||||
'asx' => 'video/x-ms-asf',
|
||||
'au' => 'audio/x-au',
|
||||
'avi' => 'video/avi',
|
||||
'avs' => 'video/avs-video',
|
||||
'bcpio' => 'application/x-bcpio',
|
||||
'bin' => 'application/x-binary',
|
||||
'bm' => 'image/bmp',
|
||||
'bmp' => 'image/bmp',
|
||||
'boo' => 'application/book',
|
||||
'book' => 'application/book',
|
||||
'boz' => 'application/x-bzip2',
|
||||
'bsh' => 'application/x-bsh',
|
||||
'bz' => 'application/x-bzip',
|
||||
'bz2' => 'application/x-bzip2',
|
||||
'c' => 'text/x-c',
|
||||
'c++' => 'text/x-c',
|
||||
'cat' => 'application/vnd.ms-pki.seccat',
|
||||
'cc' => 'text/plain',
|
||||
'ccad' => 'application/clariscad',
|
||||
'cco' => 'application/x-cocoa',
|
||||
'cdf' => 'application/cdf',
|
||||
'cer' => 'application/x-x509-ca-cert',
|
||||
'cha' => 'application/x-chat',
|
||||
'chat' => 'application/x-chat',
|
||||
'class' => 'application/java',
|
||||
'com' => 'application/octet-stream',
|
||||
'conf' => 'text/plain',
|
||||
'cpio' => 'application/x-cpio',
|
||||
'cpp' => 'text/x-c',
|
||||
'cpt' => 'application/x-cpt',
|
||||
'crl' => 'application/pkix-crl',
|
||||
'crt' => 'application/x-x509-ca-cert',
|
||||
'csh' => 'application/x-csh',
|
||||
'css' => 'text/css',
|
||||
'cxx' => 'text/plain',
|
||||
'dcr' => 'application/x-director',
|
||||
'deepv' => 'application/x-deepv',
|
||||
'def' => 'text/plain',
|
||||
'der' => 'application/x-x509-ca-cert',
|
||||
'dif' => 'video/x-dv',
|
||||
'dir' => 'application/x-director',
|
||||
'dl' => 'video/dl',
|
||||
'doc' => 'application/msword',
|
||||
'dot' => 'application/msword',
|
||||
'dp' => 'application/commonground',
|
||||
'drw' => 'application/drafting',
|
||||
'dump' => 'application/octet-stream',
|
||||
'dv' => 'video/x-dv',
|
||||
'dvi' => 'application/x-dvi',
|
||||
'dwf' => 'model/vnd.dwf',
|
||||
'dwg' => 'image/x-dwg',
|
||||
'dxf' => 'image/x-dwg',
|
||||
'dxr' => 'application/x-director',
|
||||
'el' => 'text/x-script.elisp',
|
||||
'elc' => 'application/x-elc',
|
||||
'env' => 'application/x-envoy',
|
||||
'eps' => 'application/postscript',
|
||||
'es' => 'application/x-esrehber',
|
||||
'etx' => 'text/x-setext',
|
||||
'evy' => 'application/x-envoy',
|
||||
'exe' => 'application/octet-stream',
|
||||
'f' => 'text/x-fortran',
|
||||
'f77' => 'text/x-fortran',
|
||||
'f90' => 'text/x-fortran',
|
||||
'fdf' => 'application/vnd.fdf',
|
||||
'fif' => 'image/fif',
|
||||
'fli' => 'video/x-fli',
|
||||
'flo' => 'image/florian',
|
||||
'flx' => 'text/vnd.fmi.flexstor',
|
||||
'fmf' => 'video/x-atomic3d-feature',
|
||||
'for' => 'text/x-fortran',
|
||||
'fpx' => 'image/vnd.fpx',
|
||||
'frl' => 'application/freeloader',
|
||||
'funk' => 'audio/make',
|
||||
'g' => 'text/plain',
|
||||
'g3' => 'image/g3fax',
|
||||
'gif' => 'image/gif',
|
||||
'gl' => 'video/x-gl',
|
||||
'gsd' => 'audio/x-gsm',
|
||||
'gsm' => 'audio/x-gsm',
|
||||
'gsp' => 'application/x-gsp',
|
||||
'gss' => 'application/x-gss',
|
||||
'gtar' => 'application/x-gtar',
|
||||
'gz' => 'application/x-gzip',
|
||||
'gzip' => 'application/x-gzip',
|
||||
'h' => 'text/x-h',
|
||||
'hdf' => 'application/x-hdf',
|
||||
'help' => 'application/x-helpfile',
|
||||
'hgl' => 'application/vnd.hp-hpgl',
|
||||
'hh' => 'text/x-h',
|
||||
'hlb' => 'text/x-script',
|
||||
'hlp' => 'application/hlp',
|
||||
'hpg' => 'application/vnd.hp-hpgl',
|
||||
'hpgl' => 'application/vnd.hp-hpgl',
|
||||
'hqx' => 'application/x-binhex40',
|
||||
'hta' => 'application/hta',
|
||||
'htc' => 'text/x-component',
|
||||
'htm' => 'text/html',
|
||||
'html' => 'text/html',
|
||||
'htmls' => 'text/html',
|
||||
'htt' => 'text/webviewhtml',
|
||||
'htx' => 'text/html',
|
||||
'ice' => 'x-conference/x-cooltalk',
|
||||
'ico' => 'image/x-icon',
|
||||
'idc' => 'text/plain',
|
||||
'ief' => 'image/ief',
|
||||
'iefs' => 'image/ief',
|
||||
'iges' => 'application/iges',
|
||||
'igs' => 'application/iges',
|
||||
'ima' => 'application/x-ima',
|
||||
'imap' => 'application/x-httpd-imap',
|
||||
'inf' => 'application/inf',
|
||||
'ins' => 'application/x-internett-signup',
|
||||
'ip' => 'application/x-ip2',
|
||||
'isu' => 'video/x-isvideo',
|
||||
'it' => 'audio/it',
|
||||
'iv' => 'application/x-inventor',
|
||||
'ivr' => 'i-world/i-vrml',
|
||||
'ivy' => 'application/x-livescreen',
|
||||
'jam' => 'audio/x-jam',
|
||||
'jav' => 'text/plain',
|
||||
'jav' => 'text/x-java-source',
|
||||
'java' => 'text/x-java-source',
|
||||
'jcm' => 'application/x-java-commerce',
|
||||
'jfif' => 'image/jpeg',
|
||||
'jfif-tbnl' => 'image/jpeg',
|
||||
'jpe' => 'image/jpeg',
|
||||
'jpeg' => 'image/jpeg',
|
||||
'jpg' => 'image/jpeg',
|
||||
'jps' => 'image/x-jps',
|
||||
'js' => 'application/x-javascript',
|
||||
'jut' => 'image/jutvision',
|
||||
'kar' => 'audio/midi',
|
||||
'ksh' => 'text/x-script.ksh',
|
||||
'la' => 'audio/x-nspaudio',
|
||||
'lam' => 'audio/x-liveaudio',
|
||||
'latex' => 'application/x-latex',
|
||||
'lha' => 'application/x-lha',
|
||||
'lhx' => 'application/octet-stream',
|
||||
'list' => 'text/plain',
|
||||
'lma' => 'audio/x-nspaudio',
|
||||
'log' => 'text/plain',
|
||||
'lsp' => 'text/x-script.lisp',
|
||||
'lst' => 'text/plain',
|
||||
'lsx' => 'text/x-la-asf',
|
||||
'ltx' => 'application/x-latex',
|
||||
'lzh' => 'application/x-lzh',
|
||||
'lzx' => 'application/x-lzx',
|
||||
'm' => 'text/x-m',
|
||||
'm1v' => 'video/mpeg',
|
||||
'm2a' => 'audio/mpeg',
|
||||
'm2v' => 'video/mpeg',
|
||||
'm3u' => 'audio/x-mpequrl',
|
||||
'man' => 'application/x-troff-man',
|
||||
'map' => 'application/x-navimap',
|
||||
'mar' => 'text/plain',
|
||||
'mbd' => 'application/mbedlet',
|
||||
'mc$' => 'application/x-magic-cap-package-1.0',
|
||||
'mcd' => 'application/x-mathcad',
|
||||
'mcf' => 'text/mcf',
|
||||
'mcp' => 'application/netmc',
|
||||
'me' => 'application/x-troff-me',
|
||||
'mht' => 'message/rfc822',
|
||||
'mhtml' => 'message/rfc822',
|
||||
'mid' => 'audio/x-midi',
|
||||
'midi' => 'audio/x-midi',
|
||||
'mif' => 'application/x-mif',
|
||||
'mime' => 'www/mime',
|
||||
'mjf' => 'audio/x-vnd.audioexplosion.mjuicemediafile',
|
||||
'mjpg' => 'video/x-motion-jpeg',
|
||||
'mm' => 'application/x-meme',
|
||||
'mme' => 'application/base64',
|
||||
'mod' => 'audio/x-mod',
|
||||
'moov' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
'movie' => 'video/x-sgi-movie',
|
||||
'mp2' => 'audio/x-mpeg',
|
||||
'mp3' => 'audio/x-mpeg-3',
|
||||
'mpa' => 'audio/mpeg',
|
||||
'mpc' => 'application/x-project',
|
||||
'mpe' => 'video/mpeg',
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpga' => 'audio/mpeg',
|
||||
'mpp' => 'application/vnd.ms-project',
|
||||
'mpt' => 'application/x-project',
|
||||
'mpv' => 'application/x-project',
|
||||
'mpx' => 'application/x-project',
|
||||
'mrc' => 'application/marc',
|
||||
'ms' => 'application/x-troff-ms',
|
||||
'mv' => 'video/x-sgi-movie',
|
||||
'my' => 'audio/make',
|
||||
'mzz' => 'application/x-vnd.audioexplosion.mzz',
|
||||
'nap' => 'image/naplps',
|
||||
'naplps' => 'image/naplps',
|
||||
'nc' => 'application/x-netcdf',
|
||||
'ncm' => 'application/vnd.nokia.configuration-message',
|
||||
'nif' => 'image/x-niff',
|
||||
'niff' => 'image/x-niff',
|
||||
'nix' => 'application/x-mix-transfer',
|
||||
'nsc' => 'application/x-conference',
|
||||
'nvd' => 'application/x-navidoc',
|
||||
'o' => 'application/octet-stream',
|
||||
'oda' => 'application/oda',
|
||||
'omc' => 'application/x-omc',
|
||||
'omcd' => 'application/x-omcdatamaker',
|
||||
'omcr' => 'application/x-omcregerator',
|
||||
'p' => 'text/x-pascal',
|
||||
'p10' => 'application/x-pkcs10',
|
||||
'p12' => 'application/x-pkcs12',
|
||||
'p7a' => 'application/x-pkcs7-signature',
|
||||
'p7c' => 'application/x-pkcs7-mime',
|
||||
'p7m' => 'application/x-pkcs7-mime',
|
||||
'p7r' => 'application/x-pkcs7-certreqresp',
|
||||
'p7s' => 'application/pkcs7-signature',
|
||||
'part' => 'application/pro_eng',
|
||||
'pas' => 'text/pascal',
|
||||
'pbm' => 'image/x-portable-bitmap',
|
||||
'pcl' => 'application/x-pcl',
|
||||
'pct' => 'image/x-pict',
|
||||
'pcx' => 'image/x-pcx',
|
||||
'pdb' => 'chemical/x-pdb',
|
||||
'pdf' => 'application/pdf',
|
||||
'pfunk' => 'audio/make.my.funk',
|
||||
'pgm' => 'image/x-portable-greymap',
|
||||
'pic' => 'image/pict',
|
||||
'pict' => 'image/pict',
|
||||
'pkg' => 'application/x-newton-compatible-pkg',
|
||||
'pko' => 'application/vnd.ms-pki.pko',
|
||||
'pl' => 'text/x-script.perl',
|
||||
'plx' => 'application/x-pixclscript',
|
||||
'pm' => 'text/x-script.perl-module',
|
||||
'pm4' => 'application/x-pagemaker',
|
||||
'pm5' => 'application/x-pagemaker',
|
||||
'png' => 'image/png',
|
||||
'pnm' => 'image/x-portable-anymap',
|
||||
'pot' => 'application/mspowerpoint',
|
||||
'pov' => 'model/x-pov',
|
||||
'ppa' => 'application/vnd.ms-powerpoint',
|
||||
'ppm' => 'image/x-portable-pixmap',
|
||||
'pps' => 'application/mspowerpoint',
|
||||
'ppt' => 'application/mspowerpoint',
|
||||
'ppz' => 'application/mspowerpoint',
|
||||
'pre' => 'application/x-freelance',
|
||||
'prt' => 'application/pro_eng',
|
||||
'ps' => 'application/postscript',
|
||||
'psd' => 'application/octet-stream',
|
||||
'pvu' => 'paleovu/x-pv',
|
||||
'pwz' => 'application/vnd.ms-powerpoint',
|
||||
'py' => 'text/x-script.phyton',
|
||||
'pyc' => 'applicaiton/x-bytecode.python',
|
||||
'qcp' => 'audio/vnd.qcelp',
|
||||
'qd3' => 'x-world/x-3dmf',
|
||||
'qd3d' => 'x-world/x-3dmf',
|
||||
'qif' => 'image/x-quicktime',
|
||||
'qt' => 'video/quicktime',
|
||||
'qtc' => 'video/x-qtc',
|
||||
'qti' => 'image/x-quicktime',
|
||||
'qtif' => 'image/x-quicktime',
|
||||
'ra' => 'audio/x-realaudio',
|
||||
'ram' => 'audio/x-pn-realaudio',
|
||||
'ras' => 'image/x-cmu-raster',
|
||||
'rast' => 'image/cmu-raster',
|
||||
'rexx' => 'text/x-script.rexx',
|
||||
'rf' => 'image/vnd.rn-realflash',
|
||||
'rgb' => 'image/x-rgb',
|
||||
'rm' => 'audio/x-pn-realaudio',
|
||||
'rmi' => 'audio/mid',
|
||||
'rmm' => 'audio/x-pn-realaudio',
|
||||
'rmp' => 'audio/x-pn-realaudio',
|
||||
'rng' => 'application/vnd.nokia.ringing-tone',
|
||||
'rnx' => 'application/vnd.rn-realplayer',
|
||||
'roff' => 'application/x-troff',
|
||||
'rp' => 'image/vnd.rn-realpix',
|
||||
'rpm' => 'audio/x-pn-realaudio-plugin',
|
||||
'rt' => 'text/richtext',
|
||||
'rtf' => 'text/richtext',
|
||||
'rtx' => 'text/richtext',
|
||||
'rv' => 'video/vnd.rn-realvideo',
|
||||
's' => 'text/x-asm',
|
||||
's3m' => 'audio/s3m',
|
||||
'saveme' => 'application/octet-stream',
|
||||
'sbk' => 'application/x-tbook',
|
||||
'scm' => 'video/x-scm',
|
||||
'sdml' => 'text/plain',
|
||||
'sdp' => 'application/x-sdp',
|
||||
'sdr' => 'application/sounder',
|
||||
'sea' => 'application/x-sea',
|
||||
'set' => 'application/set',
|
||||
'sgm' => 'text/x-sgml',
|
||||
'sgml' => 'text/x-sgml',
|
||||
'sh' => 'text/x-script.sh',
|
||||
'shar' => 'application/x-shar',
|
||||
'shtml' => 'text/x-server-parsed-html',
|
||||
'sid' => 'audio/x-psid',
|
||||
'sit' => 'application/x-stuffit',
|
||||
'skd' => 'application/x-koan',
|
||||
'skm' => 'application/x-koan',
|
||||
'skp' => 'application/x-koan',
|
||||
'skt' => 'application/x-koan',
|
||||
'sl' => 'application/x-seelogo',
|
||||
'smi' => 'application/smil',
|
||||
'smil' => 'application/smil',
|
||||
'snd' => 'audio/x-adpcm',
|
||||
'sol' => 'application/solids',
|
||||
'spc' => 'text/x-speech',
|
||||
'spl' => 'application/futuresplash',
|
||||
'spr' => 'application/x-sprite',
|
||||
'sprite' => 'application/x-sprite',
|
||||
'src' => 'application/x-wais-source',
|
||||
'ssi' => 'text/x-server-parsed-html',
|
||||
'ssm' => 'application/streamingmedia',
|
||||
'sst' => 'application/vnd.ms-pki.certstore',
|
||||
'step' => 'application/step',
|
||||
'stl' => 'application/vnd.ms-pki.stl',
|
||||
'stp' => 'application/step',
|
||||
'sv4cpio' => 'application/x-sv4cpio',
|
||||
'sv4crc' => 'application/x-sv4crc',
|
||||
'svf' => 'image/x-dwg',
|
||||
'svr' => 'application/x-world',
|
||||
'swf' => 'application/x-shockwave-flash',
|
||||
't' => 'application/x-troff',
|
||||
'talk' => 'text/x-speech',
|
||||
'tar' => 'application/x-tar',
|
||||
'tbk' => 'application/x-tbook',
|
||||
'tcl' => 'text/x-script.tcl',
|
||||
'tcsh' => 'text/x-script.tcsh',
|
||||
'tex' => 'application/x-tex',
|
||||
'texi' => 'application/x-texinfo',
|
||||
'texinfo' => 'application/x-texinfo',
|
||||
'text' => 'text/plain',
|
||||
'tgz' => 'application/x-compressed',
|
||||
'tif' => 'image/tiff',
|
||||
'tiff' => 'image/tiff',
|
||||
'tr' => 'application/x-troff',
|
||||
'tsi' => 'audio/tsp-audio',
|
||||
'tsp' => 'audio/tsplayer',
|
||||
'tsv' => 'text/tab-separated-values',
|
||||
'turbot' => 'image/florian',
|
||||
'txt' => 'text/plain',
|
||||
'uil' => 'text/x-uil',
|
||||
'uni' => 'text/uri-list',
|
||||
'unis' => 'text/uri-list',
|
||||
'unv' => 'application/i-deas',
|
||||
'uri' => 'text/uri-list',
|
||||
'uris' => 'text/uri-list',
|
||||
'ustar' => 'multipart/x-ustar',
|
||||
'uu' => 'text/x-uuencode',
|
||||
'uue' => 'text/x-uuencode',
|
||||
'vcd' => 'application/x-cdlink',
|
||||
'vcs' => 'text/x-vcalendar',
|
||||
'vda' => 'application/vda',
|
||||
'vdo' => 'video/vdo',
|
||||
'vew' => 'application/groupwise',
|
||||
'viv' => 'video/vivo',
|
||||
'vivo' => 'video/vivo',
|
||||
'vmd' => 'application/vocaltec-media-desc',
|
||||
'vmf' => 'application/vocaltec-media-file',
|
||||
'voc' => 'audio/voc',
|
||||
'vos' => 'video/vosaic',
|
||||
'vox' => 'audio/voxware',
|
||||
'vqe' => 'audio/x-twinvq-plugin',
|
||||
'vqf' => 'audio/x-twinvq',
|
||||
'vql' => 'audio/x-twinvq-plugin',
|
||||
'vrml' => 'application/x-vrml',
|
||||
'vrt' => 'x-world/x-vrt',
|
||||
'vsd' => 'application/x-visio',
|
||||
'vst' => 'application/x-visio',
|
||||
'vsw' => 'application/x-visio',
|
||||
'w60' => 'application/wordperfect6.0',
|
||||
'w61' => 'application/wordperfect6.1',
|
||||
'w6w' => 'application/msword',
|
||||
'wav' => 'audio/wav',
|
||||
'wb1' => 'application/x-qpro',
|
||||
'wbmp' => 'image/vnd.wap.wbmp',
|
||||
'web' => 'application/vnd.xara',
|
||||
'wiz' => 'application/msword',
|
||||
'wk1' => 'application/x-123',
|
||||
'wmf' => 'windows/metafile',
|
||||
'wml' => 'text/vnd.wap.wml',
|
||||
'wmlc' => 'application/vnd.wap.wmlc',
|
||||
'wmls' => 'text/vnd.wap.wmlscript',
|
||||
'wmlsc' => 'application/vnd.wap.wmlscriptc',
|
||||
'word' => 'application/msword',
|
||||
'wp' => 'application/wordperfect',
|
||||
'wp5' => 'application/wordperfect',
|
||||
'wp6' => 'application/wordperfect',
|
||||
'wpd' => 'application/wordperfect',
|
||||
'wq1' => 'application/x-lotus',
|
||||
'wri' => 'application/mswrite',
|
||||
'wrl' => 'model/vrml',
|
||||
'wrz' => 'model/vrml',
|
||||
'wsc' => 'text/scriplet',
|
||||
'wsrc' => 'application/x-wais-source',
|
||||
'wtk' => 'application/x-wintalk',
|
||||
'xbm' => 'image/xbm',
|
||||
'xdr' => 'video/x-amt-demorun',
|
||||
'xgz' => 'xgl/drawing',
|
||||
'xif' => 'image/vnd.xiff',
|
||||
'xl' => 'application/excel',
|
||||
'xla' => 'application/excel',
|
||||
'xlb' => 'application/excel',
|
||||
'xlc' => 'application/excel',
|
||||
'xld' => 'application/excel',
|
||||
'xlk' => 'application/excel',
|
||||
'xll' => 'application/excel',
|
||||
'xlm' => 'application/excel',
|
||||
'xls' => 'application/excel',
|
||||
'xlt' => 'application/excel',
|
||||
'xlv' => 'application/excel',
|
||||
'xlw' => 'application/excel',
|
||||
'xm' => 'audio/xm',
|
||||
'xml' => 'text/xml',
|
||||
'xmz' => 'xgl/movie',
|
||||
'xpix' => 'application/x-vnd.ls-xpix',
|
||||
'xpm' => 'image/xpm',
|
||||
'x-png' => 'image/png',
|
||||
'xsr' => 'video/x-amt-showrun',
|
||||
'xwd' => 'image/x-xwindowdump',
|
||||
'xyz' => 'chemical/x-pdb',
|
||||
'z' => 'application/x-compressed',
|
||||
'zip' => 'application/x-zip-compressed',
|
||||
'zoo' => 'application/octet-stream',
|
||||
'zsh' => 'text/x-script.zsh',
|
||||
);
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function is_supported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function guess($file, $file_name = '')
|
||||
{
|
||||
$file_name = (empty($file_name)) ? $file : $file_name;
|
||||
return $this->map_extension_to_type($file_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map extension of supplied file_name to mime type
|
||||
*
|
||||
* @param string $file_name Path to file or filename
|
||||
*
|
||||
* @return string|null Mimetype if known or null if not
|
||||
*/
|
||||
protected function map_extension_to_type($file_name)
|
||||
{
|
||||
$extension = pathinfo($file_name, PATHINFO_EXTENSION);
|
||||
|
||||
if (isset($this->extension_map[$extension]))
|
||||
{
|
||||
return $this->extension_map[$extension];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
130
phpBB/phpbb/mimetype/guesser.php
Normal file
130
phpBB/phpbb/mimetype/guesser.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\mimetype;
|
||||
|
||||
/**
|
||||
* @package mimetype
|
||||
*/
|
||||
|
||||
class guesser
|
||||
{
|
||||
/**
|
||||
* @const Default priority for mimetype guessers
|
||||
*/
|
||||
const PRIORITY_DEFAULT = 0;
|
||||
|
||||
/**
|
||||
* @var mimetype guessers
|
||||
*/
|
||||
protected $guessers;
|
||||
|
||||
/**
|
||||
* Construct a mimetype guesser object
|
||||
*
|
||||
* @param array $mimetype_guessers Mimetype guesser service collection
|
||||
*/
|
||||
public function __construct($mimetype_guessers)
|
||||
{
|
||||
$this->register_guessers($mimetype_guessers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register MimeTypeGuessers and sort them by priority
|
||||
*
|
||||
* @param array $mimetype_guessers Mimetype guesser service collection
|
||||
*
|
||||
* @throws \LogicException If incorrect or not mimetype guessers have
|
||||
* been supplied to class
|
||||
*/
|
||||
protected function register_guessers($mimetype_guessers)
|
||||
{
|
||||
foreach ($mimetype_guessers as $guesser)
|
||||
{
|
||||
$is_supported = (method_exists($guesser, 'is_supported')) ? 'is_supported' : '';
|
||||
$is_supported = (method_exists($guesser, 'isSupported')) ? 'isSupported' : $is_supported;
|
||||
|
||||
if (empty($is_supported))
|
||||
{
|
||||
throw new \LogicException('Incorrect mimetype guesser supplied.');
|
||||
}
|
||||
|
||||
if ($guesser->$is_supported())
|
||||
{
|
||||
$this->guessers[] = $guesser;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->guessers))
|
||||
{
|
||||
throw new \LogicException('No mimetype guesser supplied.');
|
||||
}
|
||||
|
||||
// Sort guessers by priority
|
||||
usort($this->guessers, array($this, 'sort_priority'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the priority of supplied guessers
|
||||
* This is a compare function for usort. A guesser with higher priority
|
||||
* should be used first and vice versa. usort() orders the array values
|
||||
* from low to high depending on what the comparison function returns
|
||||
* to it. Return value should be smaller than 0 if value a is smaller
|
||||
* than value b. This has been reversed in the comparision function in
|
||||
* order to sort the guessers from high to low.
|
||||
* Method has been set to public in order to allow proper testing.
|
||||
*
|
||||
* @param object $guesser_a Mimetype guesser a
|
||||
* @param object $guesser_b Mimetype guesser b
|
||||
*
|
||||
* @return int If both guessers have the same priority 0, bigger
|
||||
* than 0 if first guesser has lower priority, and lower
|
||||
* than 0 if first guesser has higher priority
|
||||
*/
|
||||
public function sort_priority($guesser_a, $guesser_b)
|
||||
{
|
||||
$priority_a = (int) (method_exists($guesser_a, 'get_priority')) ? $guesser_a->get_priority() : self::PRIORITY_DEFAULT;
|
||||
$priority_b = (int) (method_exists($guesser_b, 'get_priority')) ? $guesser_b->get_priority() : self::PRIORITY_DEFAULT;
|
||||
|
||||
return $priority_b - $priority_a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Guess mimetype of supplied file
|
||||
*
|
||||
* @param string $file Path to file
|
||||
*
|
||||
* @return string Guess for mimetype of file
|
||||
*/
|
||||
public function guess($file, $file_name = '')
|
||||
{
|
||||
if (!is_file($file))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_readable($file))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->guessers as $guesser)
|
||||
{
|
||||
$mimetype = $guesser->guess($file, $file_name);
|
||||
|
||||
// Try to guess something that is not the fallback application/octet-stream
|
||||
if ($mimetype !== null && $mimetype !== 'application/octet-stream')
|
||||
{
|
||||
return $mimetype;
|
||||
}
|
||||
}
|
||||
// Return any mimetype if we got a result or the fallback value
|
||||
return (!empty($mimetype)) ? $mimetype : 'application/octet-stream';
|
||||
}
|
||||
}
|
38
phpBB/phpbb/mimetype/guesser_base.php
Normal file
38
phpBB/phpbb/mimetype/guesser_base.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\mimetype;
|
||||
|
||||
/**
|
||||
* @package mimetype
|
||||
*/
|
||||
|
||||
abstract class guesser_base implements guesser_interface
|
||||
{
|
||||
/**
|
||||
* @var int Guesser Priority
|
||||
*/
|
||||
protected $priority;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function get_priority()
|
||||
{
|
||||
return $this->priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function set_priority($priority)
|
||||
{
|
||||
$this->priority = $priority;
|
||||
}
|
||||
}
|
49
phpBB/phpbb/mimetype/guesser_interface.php
Normal file
49
phpBB/phpbb/mimetype/guesser_interface.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\mimetype;
|
||||
|
||||
/**
|
||||
* @package mimetype
|
||||
*/
|
||||
|
||||
interface guesser_interface
|
||||
{
|
||||
/**
|
||||
* Returns whether this guesser is supported on the current OS
|
||||
*
|
||||
* @return bool True if guesser is supported, false if not
|
||||
*/
|
||||
public function is_supported();
|
||||
|
||||
/**
|
||||
* Guess mimetype of supplied file
|
||||
*
|
||||
* @param string $file Path to file
|
||||
*
|
||||
* @return string Guess for mimetype of file
|
||||
*/
|
||||
public function guess($file, $file_name = '');
|
||||
|
||||
/**
|
||||
* Get the guesser priority
|
||||
*
|
||||
* @return int Guesser priority
|
||||
*/
|
||||
public function get_priority();
|
||||
|
||||
/**
|
||||
* Set the guesser priority
|
||||
*
|
||||
* @param int Guesser priority
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_priority($priority);
|
||||
}
|
@@ -27,6 +27,9 @@ class manager
|
||||
/** @var \phpbb\user_loader */
|
||||
protected $user_loader;
|
||||
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\db\driver\driver */
|
||||
protected $db;
|
||||
|
||||
@@ -58,6 +61,7 @@ class manager
|
||||
* @param array $notification_methods
|
||||
* @param ContainerBuilder $phpbb_container
|
||||
* @param \phpbb\user_loader $user_loader
|
||||
* @param \phpbb\config\config $config
|
||||
* @param \phpbb\db\driver\driver $db
|
||||
* @param \phpbb\user $user
|
||||
* @param string $phpbb_root_path
|
||||
@@ -67,13 +71,14 @@ class manager
|
||||
* @param string $user_notifications_table
|
||||
* @return \phpbb\notification\manager
|
||||
*/
|
||||
public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
|
||||
public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
|
||||
{
|
||||
$this->notification_types = $notification_types;
|
||||
$this->notification_methods = $notification_methods;
|
||||
$this->phpbb_container = $phpbb_container;
|
||||
|
||||
$this->user_loader = $user_loader;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->cache = $cache;
|
||||
$this->user = $user;
|
||||
@@ -797,6 +802,8 @@ class manager
|
||||
WHERE notification_time < ' . (int) $timestamp .
|
||||
(($only_read) ? ' AND notification_read = 1' : '');
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$this->config->set('read_notification_last_gc', time(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -183,6 +183,10 @@ class post extends \phpbb\notification\type\base
|
||||
'username' => $this->get_data('post_username'),
|
||||
)), $responders);
|
||||
|
||||
$responders_cnt = sizeof($responders);
|
||||
$responders = $this->trim_user_ary($responders);
|
||||
$trimmed_responders_cnt = $responders_cnt - sizeof($responders);
|
||||
|
||||
foreach ($responders as $responder)
|
||||
{
|
||||
if ($responder['username'])
|
||||
@@ -194,11 +198,18 @@ class post extends \phpbb\notification\type\base
|
||||
$usernames[] = $this->user_loader->get_username($responder['poster_id'], 'no_profile');
|
||||
}
|
||||
}
|
||||
$lang_key = $this->language_key;
|
||||
|
||||
if ($trimmed_responders_cnt)
|
||||
{
|
||||
$lang_key .= '_TRIMMED';
|
||||
}
|
||||
|
||||
return $this->user->lang(
|
||||
$this->language_key,
|
||||
implode(', ', $usernames),
|
||||
censor_text($this->get_data('topic_title'))
|
||||
$lang_key,
|
||||
implode($this->user->lang['COMMA_SEPARATOR'], $usernames),
|
||||
censor_text($this->get_data('topic_title')),
|
||||
$trimmed_responders_cnt
|
||||
);
|
||||
}
|
||||
|
||||
@@ -234,7 +245,7 @@ class post extends \phpbb\notification\type\base
|
||||
'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('topic_title'))),
|
||||
|
||||
'U_VIEW_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?p={$this->item_id}#p{$this->item_id}",
|
||||
'U_NEWEST_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}&view=unread#unread",
|
||||
'U_NEWEST_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}&e=1&view=unread#unread",
|
||||
'U_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}",
|
||||
'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}",
|
||||
'U_FORUM' => generate_board_url() . "/viewforum.{$this->php_ext}?f={$this->get_data('forum_id')}",
|
||||
@@ -272,6 +283,22 @@ class post extends \phpbb\notification\type\base
|
||||
}
|
||||
}
|
||||
|
||||
return $this->trim_user_ary($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim the user array passed down to 3 users if the array contains
|
||||
* more than 4 users.
|
||||
*
|
||||
* @param array $users Array of users
|
||||
* @return array Trimmed array of user_ids
|
||||
*/
|
||||
public function trim_user_ary($users)
|
||||
{
|
||||
if (sizeof($users) > 4)
|
||||
{
|
||||
array_splice($users, 3);
|
||||
}
|
||||
return $users;
|
||||
}
|
||||
|
||||
|
@@ -41,6 +41,11 @@ class plupload
|
||||
*/
|
||||
protected $php_ini;
|
||||
|
||||
/**
|
||||
* @var \phpbb\mimetype\guesser
|
||||
*/
|
||||
protected $mimetype_guesser;
|
||||
|
||||
/**
|
||||
* Final destination for uploaded files, i.e. the "files" directory.
|
||||
* @var string
|
||||
@@ -61,16 +66,18 @@ class plupload
|
||||
* @param \phpbb\request\request_interface $request
|
||||
* @param \phpbb\user $user
|
||||
* @param \phpbb\php\ini $php_ini
|
||||
* @param \phpbb\mimetype\guesser $mimetype_guesser
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \phpbb\php\ini $php_ini)
|
||||
public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \phpbb\php\ini $php_ini, \phpbb\mimetype\guesser $mimetype_guesser)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->user = $user;
|
||||
$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';
|
||||
@@ -113,14 +120,12 @@ class plupload
|
||||
{
|
||||
rename("{$file_path}.part", $file_path);
|
||||
|
||||
$file_info = new \Symfony\Component\HttpFoundation\File\File($file_path);
|
||||
|
||||
// Need to modify some of the $_FILES values to reflect the new file
|
||||
return array(
|
||||
'tmp_name' => $file_path,
|
||||
'name' => $this->request->variable('real_filename', ''),
|
||||
'size' => filesize($file_path),
|
||||
'type' => $file_info->getMimeType($file_path),
|
||||
'type' => $this->mimetype_guesser->guess($file_path, $file_name),
|
||||
);
|
||||
}
|
||||
else
|
||||
|
@@ -68,6 +68,12 @@ class lexer extends \Twig_Lexer
|
||||
);
|
||||
|
||||
// Fix tokens that may have inline variables (e.g. <!-- DEFINE $TEST = '{FOO}')
|
||||
$code = $this->strip_surrounding_quotes(array(
|
||||
'INCLUDE',
|
||||
'INCLUDEPHP',
|
||||
'INCLUDEJS',
|
||||
'INCLUDECSS',
|
||||
), $code);
|
||||
$code = $this->fix_inline_variable_tokens(array(
|
||||
'DEFINE \$[a-zA-Z0-9_]+ =',
|
||||
'INCLUDE',
|
||||
@@ -75,6 +81,12 @@ class lexer extends \Twig_Lexer
|
||||
'INCLUDEJS',
|
||||
'INCLUDECSS',
|
||||
), $code);
|
||||
$code = $this->add_surrounding_quotes(array(
|
||||
'INCLUDE',
|
||||
'INCLUDEPHP',
|
||||
'INCLUDEJS',
|
||||
'INCLUDECSS',
|
||||
), $code);
|
||||
|
||||
// Fix our BEGIN statements
|
||||
$code = $this->fix_begin_tokens($code);
|
||||
@@ -107,10 +119,30 @@ class lexer extends \Twig_Lexer
|
||||
return parent::tokenize($code, $filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip surrounding quotes
|
||||
*
|
||||
* First step to fix tokens that may have inline variables
|
||||
* E.g. <!-- INCLUDE '{TEST}.html' to <!-- INCLUDE {TEST}.html
|
||||
*
|
||||
* @param array $tokens array of tokens to search for (imploded to a regular expression)
|
||||
* @param string $code
|
||||
* @return string
|
||||
*/
|
||||
protected function strip_surrounding_quotes($tokens, $code)
|
||||
{
|
||||
// Remove matching quotes at the beginning/end if a statement;
|
||||
// E.g. 'asdf'"' -> asdf'"
|
||||
// E.g. "asdf'"" -> asdf'"
|
||||
// E.g. 'asdf'" -> 'asdf'"
|
||||
return preg_replace('#<!-- (' . implode('|', $tokens) . ') (([\'"])?(.*?)\1) -->#', '<!-- $1 $2 -->', $code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix tokens that may have inline variables
|
||||
*
|
||||
* E.g. <!-- INCLUDE {TEST}.html
|
||||
* Second step to fix tokens that may have inline variables
|
||||
* E.g. <!-- INCLUDE '{TEST}.html' to <!-- INCLUDE ' ~ {TEST} ~ '.html
|
||||
*
|
||||
* @param array $tokens array of tokens to search for (imploded to a regular expression)
|
||||
* @param string $code
|
||||
@@ -120,22 +152,30 @@ class lexer extends \Twig_Lexer
|
||||
{
|
||||
$callback = function($matches)
|
||||
{
|
||||
// Remove matching quotes at the beginning/end if a statement;
|
||||
// E.g. 'asdf'"' -> asdf'"
|
||||
// E.g. "asdf'"" -> asdf'"
|
||||
// E.g. 'asdf'" -> 'asdf'"
|
||||
$matches[2] = preg_replace('#^([\'"])?(.*?)\1$#', '$2', $matches[2]);
|
||||
|
||||
// Replace template variables with start/end to parse variables (' ~ TEST ~ '.html)
|
||||
$matches[2] = preg_replace('#{([a-zA-Z0-9_\.$]+)}#', "'~ \$1 ~'", $matches[2]);
|
||||
|
||||
// Surround the matches in single quotes ('' ~ TEST ~ '.html')
|
||||
return "<!-- {$matches[1]} '{$matches[2]}' -->";
|
||||
return "<!-- {$matches[1]} {$matches[2]} -->";
|
||||
};
|
||||
|
||||
return preg_replace_callback('#<!-- (' . implode('|', $tokens) . ') (.+?) -->#', $callback, $code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add surrounding quotes
|
||||
*
|
||||
* Last step to fix tokens that may have inline variables
|
||||
* E.g. <!-- INCLUDE '{TEST}.html' to <!-- INCLUDE '' ~ {TEST} ~ '.html'
|
||||
*
|
||||
* @param array $tokens array of tokens to search for (imploded to a regular expression)
|
||||
* @param string $code
|
||||
* @return string
|
||||
*/
|
||||
protected function add_surrounding_quotes($tokens, $code)
|
||||
{
|
||||
return preg_replace('#<!-- (' . implode('|', $tokens) . ') (.+?) -->#', '<!-- $1 \'$2\' -->', $code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix begin tokens (convert our BEGIN to Twig for)
|
||||
*
|
||||
|
@@ -30,6 +30,13 @@ class defineparser extends \Twig_TokenParser
|
||||
$stream->next();
|
||||
$value = $this->parser->getExpressionParser()->parseExpression();
|
||||
|
||||
if ($value instanceof \Twig_Node_Expression_Name)
|
||||
{
|
||||
// This would happen if someone improperly formed their DEFINE syntax
|
||||
// e.g. <!-- DEFINE $VAR = foo -->
|
||||
throw new \Twig_Error_Syntax('Invalid DEFINE', $token->getLine(), $this->parser->getFilename());
|
||||
}
|
||||
|
||||
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
|
||||
} else {
|
||||
$capture = true;
|
||||
|
@@ -36,7 +36,7 @@ class user extends \phpbb\session
|
||||
var $img_array = array();
|
||||
|
||||
// Able to add new options (up to id 31)
|
||||
var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17);
|
||||
var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17);
|
||||
|
||||
/**
|
||||
* Constructor to set the lang path
|
||||
|
Reference in New Issue
Block a user