Merge branch 'develop' of https://github.com/phpbb/phpbb3 into feature/softdelete-1-permission-rebase

* 'develop' of https://github.com/phpbb/phpbb3: (544 commits)
  [feature/events] Fix improperly named event in documentation
  [feature/events] Fix alphabetization of events
  [feature/events] Put events in alphabetical order
  [feature/events] Make EVENTS.md lowercase
  [ticket/11285] Use more granularity in dependency checks in compress test
  [ticket/10880] The m_approve permisson no longer implies f_noapprove.
  [ticket/10803] Show failure message until user dismisses it
  [ticket/10954] Add missing semi-colon
  [ticket/10954] Make sure to mark subforums unread and add small fixes
  [feature/events] Use ` to escape HTML tags in markdown
  [feature/events] Remove HTML tags from markdown so they don't get parsed
  [ticket/10954] Miscellaneous coding fixes
  [feature/events] Remove extraneous space
  [feature/events] Add markdown template event documentation file
  [feature/events] forumlist_body_last_post_title_after -> _prepend (subsilver2)
  [feature/events] Fix overall_footer_end -> overall_footer_after (subsilver2)
  [feature/events] Fix typo in event name
  [ticket/10763] Use self when calling get_extension() in filespec class
  [feature/events] Fix more subsilver2 events
  [feature/events] Fix some subsilver2 events
  ...

Conflicts:
	phpBB/install/database_update.php
	phpBB/posting.php
This commit is contained in:
Joas Schilling 2012-12-20 22:51:38 +01:00
commit e34b8ed094
297 changed files with 7665 additions and 1970 deletions

2
.gitignore vendored
View file

@ -2,7 +2,7 @@
/phpunit.xml /phpunit.xml
/phpBB/cache/*.html /phpBB/cache/*.html
/phpBB/cache/*.php /phpBB/cache/*.php
/phpBB/cache/queue.php.lock /phpBB/cache/*.lock
/phpBB/composer.phar /phpBB/composer.phar
/phpBB/config.php /phpBB/config.php
/phpBB/config_dev.php /phpBB/config_dev.php

View file

@ -35,7 +35,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
* @param int $stackPtr The position of the current token * @param int $stackPtr The position of the current token
* in the stack passed in $tokens. * in the stack passed in $tokens.
* *
* @return void * @return null
*/ */
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{ {
@ -120,7 +120,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
* @param integer The stack pointer for the first comment token. * @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags. * @param array(string=>array) $tags The found file doc comment tags.
* *
* @return void * @return null
*/ */
protected function processPackage(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags) protected function processPackage(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
{ {
@ -143,7 +143,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
* @param integer The stack pointer for the first comment token. * @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags. * @param array(string=>array) $tags The found file doc comment tags.
* *
* @return void * @return null
*/ */
protected function processVersion(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags) protected function processVersion(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
{ {
@ -166,7 +166,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
* @param integer The stack pointer for the first comment token. * @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags. * @param array(string=>array) $tags The found file doc comment tags.
* *
* @return void * @return null
*/ */
protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags) protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
{ {
@ -189,7 +189,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
* @param integer The stack pointer for the first comment token. * @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags. * @param array(string=>array) $tags The found file doc comment tags.
* *
* @return void * @return null
*/ */
protected function processLicense(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags) protected function processLicense(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
{ {

View file

@ -52,7 +52,7 @@ $mode = request_var('mode', '');
// Set custom style for admin area // Set custom style for admin area
$phpbb_style->set_ext_dir_prefix('adm/'); $phpbb_style->set_ext_dir_prefix('adm/');
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', ''); $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); $template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets');
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');

View file

@ -241,6 +241,7 @@
<dt><label for="topics_per_page">{L_FORUM_TOPICS_PAGE}{L_COLON}</label><br /><span>{L_FORUM_TOPICS_PAGE_EXPLAIN}</span></dt> <dt><label for="topics_per_page">{L_FORUM_TOPICS_PAGE}{L_COLON}</label><br /><span>{L_FORUM_TOPICS_PAGE_EXPLAIN}</span></dt>
<dd><input type="text" id="topics_per_page" name="topics_per_page" value="{TOPICS_PER_PAGE}" size="4" maxlength="4" /></dd> <dd><input type="text" id="topics_per_page" name="topics_per_page" value="{TOPICS_PER_PAGE}" size="4" maxlength="4" /></dd>
</dl> </dl>
<!-- EVENT acp_forums_normal_settings_append -->
</fieldset> </fieldset>
<fieldset> <fieldset>
@ -454,12 +455,12 @@
<td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;"> <td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
<!-- IF forums.S_FIRST_ROW && not forums.S_LAST_ROW --> <!-- IF forums.S_FIRST_ROW && not forums.S_LAST_ROW -->
<span class="up">{ICON_MOVE_UP_DISABLED}</span> <span class="up">{ICON_MOVE_UP_DISABLED}</span>
<span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="forum_down" data-overlay="false">{ICON_MOVE_DOWN}</a></span> <span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="row_down" data-overlay="false">{ICON_MOVE_DOWN}</a></span>
<!-- ELSEIF not forums.S_FIRST_ROW && not forums.S_LAST_ROW --> <!-- ELSEIF not forums.S_FIRST_ROW && not forums.S_LAST_ROW -->
<span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="forum_up" data-overlay="false">{ICON_MOVE_UP}</a></span> <span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="row_up" data-overlay="false">{ICON_MOVE_UP}</a></span>
<span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="forum_down" data-overlay="false">{ICON_MOVE_DOWN}</a></span> <span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="row_down" data-overlay="false">{ICON_MOVE_DOWN}</a></span>
<!-- ELSEIF forums.S_LAST_ROW && not forums.S_FIRST_ROW --> <!-- ELSEIF forums.S_LAST_ROW && not forums.S_FIRST_ROW -->
<span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="forum_up" data-overlay="false">{ICON_MOVE_UP}</a></span> <span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="row_up" data-overlay="false">{ICON_MOVE_UP}</a></span>
<span class="down">{ICON_MOVE_DOWN_DISABLED}</span> <span class="down">{ICON_MOVE_DOWN_DISABLED}</span>
<!-- ELSE --> <!-- ELSE -->
<span class="up">{ICON_MOVE_UP_DISABLED}</span> <span class="up">{ICON_MOVE_UP_DISABLED}</span>

View file

@ -76,6 +76,8 @@
</div> </div>
<!-- ENDIF --> <!-- ENDIF -->
<!-- EVENT acp_main_notice_after -->
<table cellspacing="1"> <table cellspacing="1">
<caption>{L_FORUM_STATS}</caption> <caption>{L_FORUM_STATS}</caption>
<col class="col1" /><col class="col2" /><col class="col1" /><col class="col2" /> <col class="col1" /><col class="col2" /><col class="col1" /><col class="col2" />
@ -202,6 +204,8 @@
<dd><input type="hidden" name="action" value="purge_cache" /><input class="button2" type="submit" id="action_purge_cache" name="action_purge_cache" value="{L_RUN}" /></dd> <dd><input type="hidden" name="action" value="purge_cache" /><input class="button2" type="submit" id="action_purge_cache" name="action_purge_cache" value="{L_RUN}" /></dd>
</dl> </dl>
</form> </form>
<!-- EVENT acp_main_actions_append -->
</fieldset> </fieldset>
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -53,6 +53,7 @@
<dt><label for="password_confirm">{L_CONFIRM_PASSWORD}{L_COLON}</label><br /><span>{L_CONFIRM_PASSWORD_EXPLAIN}</span></dt> <dt><label for="password_confirm">{L_CONFIRM_PASSWORD}{L_COLON}</label><br /><span>{L_CONFIRM_PASSWORD_EXPLAIN}</span></dt>
<dd><input type="password" id="password_confirm" name="password_confirm" value="" autocomplete="off" /></dd> <dd><input type="password" id="password_confirm" name="password_confirm" value="" autocomplete="off" /></dd>
</dl> </dl>
<!-- EVENT acp_users_overview_options_append -->
<p class="quick"> <p class="quick">
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" /> <input class="button1" type="submit" name="update" value="{L_SUBMIT}" />

View file

@ -10,76 +10,98 @@ var img_templates = {
}; };
/** /**
* The following callbacks are for reording forums in acp_forums. forum_down * The following callbacks are for reording items. row_down
* is triggered when a forum is moved down, and forum_up is triggered when * is triggered when an item is moved down, and row_up is triggered when
* a forum is moved up. It moves the row up or down, and deactivates / * an item is moved up. It moves the row up or down, and deactivates /
* activates any up / down icons that require it (the ones at the top or bottom). * activates any up / down icons that require it (the ones at the top or bottom).
*/ */
phpbb.add_ajax_callback('forum_down', function() { phpbb.add_ajax_callback('row_down', function() {
var el = $(this), var el = $(this),
tr = el.parents('tr'); tr = el.parents('tr'),
tr_swap = tr.next();
/*
* If the element was the first one, we have to:
* - Add the up-link to the row we moved
* - Remove the up-link on the next row
*/
if (tr.is(':first-child')) if (tr.is(':first-child'))
{ {
var up_img = img_templates.up.clone().attr('href', tr.attr('data-up')); var up_img = img_templates.up.clone().attr('href', tr.attr('data-up'));
el.parents('span').siblings('.up').html(up_img); tr.find('.up').html(up_img);
tr.next().find('.up').html(img_templates.up_disabled);
phpbb.ajaxify({ phpbb.ajaxify({
selector: el.parents('span').siblings('.up').children('a'), selector: tr.find('.up').children('a'),
callback: 'forum_up', callback: 'row_up',
overlay: false overlay: false
}); });
tr_swap.find('.up').html(img_templates.up_disabled.clone());
} }
tr.insertAfter(tr.next()); tr.insertAfter(tr_swap);
/*
* As well as:
* - Remove the down-link on the moved row, if it is now the last row
* - Add the down-link to the next row, if it was the last row
*/
if (tr.is(':last-child')) if (tr.is(':last-child'))
{ {
el.replaceWith(img_templates.down_disabled); tr.find('.down').html(img_templates.down_disabled.clone());
var down_img = img_templates.down.clone().attr('href', tr.attr('data-down')); var down_img = img_templates.down.clone().attr('href', tr_swap.attr('data-down'));
tr.prev().find('.down').html(down_img); tr_swap.find('.down').html(down_img);
phpbb.ajaxify({ phpbb.ajaxify({
selector: tr.prev().find('.down').children('a'), selector: tr_swap.find('.down').children('a'),
callback: 'forum_down', callback: 'row_down',
overlay: false overlay: false
}); });
} }
}); });
phpbb.add_ajax_callback('forum_up', function() { phpbb.add_ajax_callback('row_up', function() {
var el = $(this), var el = $(this),
tr = el.parents('tr'); tr = el.parents('tr'),
tr_swap = tr.prev();
/*
* If the element was the last one, we have to:
* - Add the down-link to the row we moved
* - Remove the down-link on the next row
*/
if (tr.is(':last-child')) if (tr.is(':last-child'))
{ {
var down_img = img_templates.down.clone().attr('href', tr.attr('data-down')); var down_img = img_templates.down.clone().attr('href', tr.attr('data-down'));
el.parents('span').siblings('.down').html(down_img); tr.find('.down').html(down_img);
tr.prev().find('.down').html(img_templates.down_disabled);
phpbb.ajaxify({ phpbb.ajaxify({
selector: el.parents('span').siblings('.down').children('a'), selector: tr.find('.down').children('a'),
callback: 'forum_down', callback: 'row_down',
overlay: false overlay: false
}); });
tr_swap.find('.down').html(img_templates.down_disabled.clone());
} }
tr.insertBefore(tr.prev()); tr.insertBefore(tr_swap);
/*
* As well as:
* - Remove the up-link on the moved row, if it is now the first row
* - Add the up-link to the previous row, if it was the first row
*/
if (tr.is(':first-child')) if (tr.is(':first-child'))
{ {
el.replaceWith(img_templates.up_disabled); tr.find('.up').html(img_templates.up_disabled.clone());
var up_img = img_templates.up.clone().attr('href', tr.attr('data-up')); var up_img = img_templates.up.clone().attr('href', tr_swap.attr('data-up'));
tr.next().find('.up').html(up_img); tr_swap.find('.up').html(up_img);
phpbb.ajaxify({ phpbb.ajaxify({
selector: tr.next().find('.up').children('a'), selector: tr_swap.find('.up').children('a'),
callback: 'forum_up', callback: 'row_up',
overlay: false overlay: false
}); });
} }

View file

@ -42,5 +42,7 @@
<!-- INCLUDEJS ajax.js --> <!-- INCLUDEJS ajax.js -->
{SCRIPTS} {SCRIPTS}
<!-- EVENT acp_overall_footer_after -->
</body> </body>
</html> </html>

View file

@ -155,6 +155,7 @@ function switch_menu()
// ]]> // ]]>
</script> </script>
<!-- EVENT acp_overall_header_head_append -->
</head> </head>
<body class="{S_CONTENT_DIRECTION}"> <body class="{S_CONTENT_DIRECTION}">

View file

@ -18,6 +18,7 @@
<script type="text/javascript" src="{T_JQUERY_LINK}"></script> <script type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF --> <!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
<!-- EVENT acp_simple_footer_after -->
</body> </body>
</html> </html>

View file

@ -101,6 +101,7 @@ function find_username(url)
// ]]> // ]]>
</script> </script>
<!-- EVENT acp_simple_header_head_append -->
</head> </head>
<body class="{S_CONTENT_DIRECTION}"> <body class="{S_CONTENT_DIRECTION}">

View file

@ -24,7 +24,7 @@ $user->setup();
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : './'; $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : './';
// Set custom template for admin area // Set custom template for admin area
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', ''); $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
$template->set_filenames(array( $template->set_filenames(array(
'body' => 'colour_swatch.html') 'body' => 'colour_swatch.html')

31
phpBB/app.php Normal file
View file

@ -0,0 +1,31 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_url_matcher.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('app');
$symfony_request = phpbb_create_symfony_request($request);
$http_kernel = $phpbb_container->get('http_kernel');
$response = $http_kernel->handle($symfony_request);
$response->send();
$http_kernel->terminate($symfony_request, $response);

View file

@ -342,12 +342,6 @@ phpbb.ajaxify = function(options) {
var alert; var alert;
alert = phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text')); alert = phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text'));
setTimeout(function () {
dark.fadeOut(phpbb.alert_time, function() {
alert.hide();
});
}, 5000);
} }
// If the element is a form, POST must be used and some extra data must // If the element is a form, POST must be used and some extra data must

View file

@ -8,10 +8,6 @@
* Minimum Requirement: PHP 5.3.3 * Minimum Requirement: PHP 5.3.3
*/ */
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
/** /**
*/ */
if (!defined('IN_PHPBB')) if (!defined('IN_PHPBB'))
@ -67,43 +63,41 @@ if (!defined('PHPBB_INSTALLED'))
exit; exit;
} }
// Load Extensions
// dl() is deprecated and disabled by default as of PHP 5.3.
if (!empty($load_extensions) && function_exists('dl'))
{
$load_extensions = explode(',', $load_extensions);
foreach ($load_extensions as $extension)
{
@dl(trim($extension));
}
}
// Include files // Include files
require($phpbb_root_path . 'includes/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/di/processor/interface.' . $phpEx);
require($phpbb_root_path . 'includes/di/processor/config.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx); require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . ltrim($dbms, 'dbal_') . '.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// Set PHP error handler to ours // Set PHP error handler to ours
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
$phpbb_container = new ContainerBuilder();
$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/config'));
$loader->load('services.yml');
$processor = new phpbb_di_processor_config($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx);
$processor->process($phpbb_container);
// Setup class loader first // Setup class loader first
$phpbb_class_loader = $phpbb_container->get('class_loader'); $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", ".$phpEx");
$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); $phpbb_class_loader->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", ".$phpEx");
$phpbb_class_loader_ext->register();
// Set up container
$phpbb_container = phpbb_create_dumped_container_unless_debug(
array(
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
new phpbb_di_extension_core($phpbb_root_path),
),
array(
new phpbb_di_pass_collection_pass(),
new phpbb_di_pass_kernel_pass(),
),
$phpbb_root_path,
$phpEx
);
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
// set up caching // set up caching
$cache = $phpbb_container->get('cache'); $cache = $phpbb_container->get('cache');
@ -130,13 +124,6 @@ $phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader');
$template = $phpbb_container->get('template'); $template = $phpbb_container->get('template');
$phpbb_style = $phpbb_container->get('style'); $phpbb_style = $phpbb_container->get('style');
$ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor'));
foreach ($ids as $id)
{
$processor = $phpbb_container->get($id);
$processor->process($phpbb_container);
}
// Add own hook handler // Add own hook handler
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('phpbb_template', 'display'))); $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('phpbb_template', 'display')));

View file

@ -4,9 +4,11 @@
"symfony/config": "2.1.*", "symfony/config": "2.1.*",
"symfony/dependency-injection": "2.1.*", "symfony/dependency-injection": "2.1.*",
"symfony/event-dispatcher": "2.1.*", "symfony/event-dispatcher": "2.1.*",
"symfony/http-kernel": "2.1.*",
"symfony/routing": "2.1.*",
"symfony/yaml": "2.1.*" "symfony/yaml": "2.1.*"
}, },
"require-dev": { "require-dev": {
"fabpot/goutte": "1.0.x-dev" "fabpot/goutte": "v0.1.0"
} }
} }

788
phpBB/composer.lock generated
View file

@ -1,74 +1,778 @@
{ {
"hash": "1632798bc1d5298a4f5bd3087c972a9f", "hash": "c1a76530df6b9daa16b8033d61b76503",
"packages": [ "packages": [
{ {
"package": "symfony/config", "name": "symfony/config",
"version": "v2.1.0-RC1" "version": "v2.1.3",
"target-dir": "Symfony/Component/Config",
"source": {
"type": "git",
"url": "https://github.com/symfony/Config",
"reference": "v2.1.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Config/zipball/v2.1.3",
"reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-10-20 00:10:30",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\Config": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Config Component",
"homepage": "http://symfony.com"
}, },
{ {
"package": "symfony/dependency-injection", "name": "symfony/dependency-injection",
"version": "v2.1.0-RC1" "version": "v2.1.3",
"target-dir": "Symfony/Component/DependencyInjection",
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection",
"reference": "v2.1.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/DependencyInjection/zipball/v2.1.3",
"reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/yaml": "2.1.*",
"symfony/config": "2.1.*"
},
"suggest": {
"symfony/yaml": "2.1.*",
"symfony/config": "2.1.*"
},
"time": "2012-10-22 07:37:12",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\DependencyInjection": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony DependencyInjection Component",
"homepage": "http://symfony.com"
}, },
{ {
"package": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
"version": "v2.1.0-RC1" "version": "v2.1.3",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher",
"reference": "v2.1.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/EventDispatcher/zipball/v2.1.3",
"reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/dependency-injection": "2.1.*"
},
"suggest": {
"symfony/dependency-injection": "2.1.*",
"symfony/http-kernel": "2.1.*"
},
"time": "2012-10-04 08:17:57",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\EventDispatcher": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony EventDispatcher Component",
"homepage": "http://symfony.com"
}, },
{ {
"package": "symfony/yaml", "name": "symfony/http-foundation",
"version": "v2.1.0-RC1" "version": "v2.1.3",
"target-dir": "Symfony/Component/HttpFoundation",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation",
"reference": "v2.1.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/HttpFoundation/zipball/v2.1.3",
"reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-10-20 00:10:30",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\HttpFoundation": "",
"SessionHandlerInterface": "Symfony/Component/HttpFoundation/Resources/stubs"
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony HttpFoundation Component",
"homepage": "http://symfony.com"
},
{
"name": "symfony/http-kernel",
"version": "v2.1.3",
"target-dir": "Symfony/Component/HttpKernel",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel",
"reference": "v2.1.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/HttpKernel/zipball/v2.1.3",
"reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/event-dispatcher": "2.1.*",
"symfony/http-foundation": "2.1.*"
},
"require-dev": {
"symfony/browser-kit": "2.1.*",
"symfony/class-loader": "2.1.*",
"symfony/config": "2.1.*",
"symfony/console": "2.1.*",
"symfony/dependency-injection": "2.1.*",
"symfony/finder": "2.1.*",
"symfony/process": "2.1.*",
"symfony/routing": "2.1.*"
},
"suggest": {
"symfony/browser-kit": "2.1.*",
"symfony/class-loader": "2.1.*",
"symfony/config": "2.1.*",
"symfony/console": "2.1.*",
"symfony/dependency-injection": "2.1.*",
"symfony/finder": "2.1.*"
},
"time": "2012-10-30 01:14:14",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\HttpKernel": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony HttpKernel Component",
"homepage": "http://symfony.com"
},
{
"name": "symfony/routing",
"version": "v2.1.3",
"target-dir": "Symfony/Component/Routing",
"source": {
"type": "git",
"url": "https://github.com/symfony/Routing",
"reference": "v2.1.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Routing/zipball/v2.1.3",
"reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/config": "2.1.*",
"symfony/yaml": "2.1.*",
"symfony/http-kernel": "2.1.*",
"doctrine/common": ">=2.2,<2.4-dev"
},
"suggest": {
"symfony/config": "2.1.*",
"symfony/yaml": "2.1.*",
"doctrine/common": ">=2.2,<2.4-dev"
},
"time": "2012-10-26 02:26:42",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\Routing": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Routing Component",
"homepage": "http://symfony.com"
},
{
"name": "symfony/yaml",
"version": "v2.1.3",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml",
"reference": "v2.1.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Yaml/zipball/v2.1.3",
"reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-10-29 04:15:41",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com"
} }
], ],
"packages-dev": [ "packages-dev": [
{ {
"package": "fabpot/goutte", "name": "fabpot/goutte",
"version": "dev-master", "version": "v0.1.0",
"alias-pretty-version": "1.0.x-dev", "source": {
"alias-version": "1.0.9999999.9999999-dev" "type": "git",
"url": "https://github.com/fabpot/Goutte",
"reference": "v0.1.0"
},
"dist": {
"type": "zip",
"url": "https://github.com/fabpot/Goutte/archive/v0.1.0.zip",
"reference": "v0.1.0",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"ext-curl": "*",
"symfony/browser-kit": "2.1.*",
"symfony/css-selector": "2.1.*",
"symfony/dom-crawler": "2.1.*",
"symfony/finder": "2.1.*",
"symfony/process": "2.1.*",
"guzzle/guzzle": "3.0.*"
},
"time": "2012-12-02 13:44:35",
"type": "application",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Goutte": "."
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "A simple PHP Web Scraper",
"homepage": "https://github.com/fabpot/Goutte",
"keywords": [
"scraper"
]
}, },
{ {
"package": "fabpot/goutte", "name": "guzzle/guzzle",
"version": "dev-master", "version": "v3.0.5",
"source-reference": "6d26279344736f6983a969e46afef082ebf30a67", "source": {
"commit-date": "1345141401" "type": "git",
"url": "https://github.com/guzzle/guzzle",
"reference": "v3.0.5"
},
"dist": {
"type": "zip",
"url": "https://github.com/guzzle/guzzle/archive/v3.0.5.zip",
"reference": "v3.0.5",
"shasum": ""
},
"require": {
"php": ">=5.3.2",
"ext-curl": "*",
"symfony/event-dispatcher": "2.1.*"
},
"replace": {
"guzzle/batch": "self.version",
"guzzle/cache": "self.version",
"guzzle/common": "self.version",
"guzzle/http": "self.version",
"guzzle/inflection": "self.version",
"guzzle/iterator": "self.version",
"guzzle/log": "self.version",
"guzzle/parser": "self.version",
"guzzle/plugin": "self.version",
"guzzle/plugin-async": "self.version",
"guzzle/plugin-backoff": "self.version",
"guzzle/plugin-cache": "self.version",
"guzzle/plugin-cookie": "self.version",
"guzzle/plugin-curlauth": "self.version",
"guzzle/plugin-history": "self.version",
"guzzle/plugin-log": "self.version",
"guzzle/plugin-md5": "self.version",
"guzzle/plugin-mock": "self.version",
"guzzle/plugin-oauth": "self.version",
"guzzle/service": "self.version",
"guzzle/stream": "self.version"
},
"require-dev": {
"doctrine/common": "*",
"symfony/class-loader": "*",
"monolog/monolog": "1.*",
"zendframework/zend-cache": "2.0.*",
"zendframework/zend-log": "2.0.*",
"zend/zend-log1": "1.12",
"zend/zend-cache1": "1.12",
"phpunit/phpunit": "3.7.*"
},
"time": "2012-11-19 00:15:33",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"Guzzle\\Tests": "tests/",
"Guzzle": "src/"
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Guzzle Community",
"homepage": "https://github.com/guzzle/guzzle/contributors"
}
],
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
"homepage": "http://guzzlephp.org/",
"keywords": [
"framework",
"curl",
"http",
"rest",
"http client",
"client",
"web service"
]
}, },
{ {
"package": "guzzle/common", "name": "symfony/browser-kit",
"version": "v2.8.4" "version": "v2.1.3",
"target-dir": "Symfony/Component/BrowserKit",
"source": {
"type": "git",
"url": "https://github.com/symfony/BrowserKit",
"reference": "v2.1.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/BrowserKit/zipball/v2.1.3",
"reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/dom-crawler": "2.1.*"
},
"require-dev": {
"symfony/process": "2.1.*",
"symfony/css-selector": "2.1.*"
},
"suggest": {
"symfony/process": "2.1.*"
},
"time": "2012-10-25 06:11:50",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\BrowserKit": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony BrowserKit Component",
"homepage": "http://symfony.com"
}, },
{ {
"package": "guzzle/http", "name": "symfony/css-selector",
"version": "v2.8.4" "version": "v2.1.3",
"target-dir": "Symfony/Component/CssSelector",
"source": {
"type": "git",
"url": "https://github.com/symfony/CssSelector",
"reference": "v2.1.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/CssSelector/zipball/v2.1.3",
"reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-10-04 08:17:57",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\CssSelector": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony CssSelector Component",
"homepage": "http://symfony.com"
}, },
{ {
"package": "guzzle/parser", "name": "symfony/dom-crawler",
"version": "v2.8.4" "version": "v2.1.3",
"target-dir": "Symfony/Component/DomCrawler",
"source": {
"type": "git",
"url": "https://github.com/symfony/DomCrawler",
"reference": "v2.1.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/DomCrawler/zipball/v2.1.3",
"reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/css-selector": "2.1.*"
},
"suggest": {
"symfony/css-selector": "2.1.*"
},
"time": "2012-10-18 14:16:01",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\DomCrawler": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony DomCrawler Component",
"homepage": "http://symfony.com"
}, },
{ {
"package": "symfony/browser-kit", "name": "symfony/finder",
"version": "v2.1.0-RC1" "version": "v2.1.3",
"target-dir": "Symfony/Component/Finder",
"source": {
"type": "git",
"url": "https://github.com/symfony/Finder",
"reference": "v2.1.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Finder/zipball/v2.1.3",
"reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-10-20 00:10:30",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\Finder": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Finder Component",
"homepage": "http://symfony.com"
}, },
{ {
"package": "symfony/css-selector", "name": "symfony/process",
"version": "v2.1.0-RC1" "version": "v2.1.3",
}, "target-dir": "Symfony/Component/Process",
{ "source": {
"package": "symfony/dom-crawler", "type": "git",
"version": "v2.1.0-RC1" "url": "https://github.com/symfony/Process",
}, "reference": "v2.1.3"
{ },
"package": "symfony/finder", "dist": {
"version": "v2.1.0-RC1" "type": "zip",
}, "url": "https://github.com/symfony/Process/zipball/v2.1.3",
{ "reference": "v2.1.3",
"package": "symfony/process", "shasum": ""
"version": "v2.1.0-RC1" },
"require": {
"php": ">=5.3.3"
},
"time": "2012-10-20 00:10:30",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\Process": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Process Component",
"homepage": "http://symfony.com"
} }
], ],
"aliases": [ "aliases": [
], ],
"minimum-stability": "beta", "minimum-stability": "beta",
"stability-flags": { "stability-flags": [
"fabpot/goutte": 20
} ]
} }

View file

@ -6,6 +6,8 @@ services:
- %core.php_ext% - %core.php_ext%
- @config - @config
- @dbal.conn - @dbal.conn
calls:
- [set_name, [cron.task.core.prune_all_forums]]
tags: tags:
- { name: cron.task } - { name: cron.task }
@ -16,6 +18,8 @@ services:
- %core.php_ext% - %core.php_ext%
- @config - @config
- @dbal.conn - @dbal.conn
calls:
- [set_name, [cron.task.core.prune_forum]]
tags: tags:
- { name: cron.task } - { name: cron.task }
@ -25,6 +29,8 @@ services:
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- @config - @config
calls:
- [set_name, [cron.task.core.queue]]
tags: tags:
- { name: cron.task } - { name: cron.task }
@ -33,6 +39,8 @@ services:
arguments: arguments:
- @config - @config
- @cache.driver - @cache.driver
calls:
- [set_name, [cron.task.core.tidy_cache]]
tags: tags:
- { name: cron.task } - { name: cron.task }
@ -42,6 +50,8 @@ services:
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- @config - @config
calls:
- [set_name, [cron.task.core.tidy_database]]
tags: tags:
- { name: cron.task } - { name: cron.task }
@ -54,6 +64,8 @@ services:
- @config - @config
- @dbal.conn - @dbal.conn
- @user - @user
calls:
- [set_name, [cron.task.core.tidy_search]]
tags: tags:
- { name: cron.task } - { name: cron.task }
@ -62,6 +74,8 @@ services:
arguments: arguments:
- @config - @config
- @user - @user
calls:
- [set_name, [cron.task.core.tidy_sessions]]
tags: tags:
- { name: cron.task } - { name: cron.task }
@ -71,5 +85,7 @@ services:
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- @config - @config
calls:
- [set_name, [cron.task.core.tidy_warnings]]
tags: tags:
- { name: cron.task } - { name: cron.task }

9
phpBB/config/routing.yml Normal file
View file

@ -0,0 +1,9 @@
# Structure:
#
# foo_controller:
# pattern: /foo
# defaults: { _controller: foo_sevice:method }
#
# The above will be accessed via app.php?controller=foo and it will
# instantiate the "foo_service" service and call the "method" method.
#

View file

@ -44,15 +44,32 @@ services:
- @cache.driver - @cache.driver
- %tables.config% - %tables.config%
cron.task_provider: controller.helper:
class: phpbb_cron_task_provider class: phpbb_controller_helper
arguments: arguments:
- @container - @template
- @user
- %core.root_path%
- .%core.php_ext%
controller.resolver:
class: phpbb_controller_resolver
arguments:
- @user
- @service_container
- @ext.finder
cron.task_collection:
class: phpbb_di_service_collection
arguments:
- @service_container
tags:
- { name: service_collection, tag: cron.task }
cron.manager: cron.manager:
class: phpbb_cron_manager class: phpbb_cron_manager
arguments: arguments:
- @cron.task_provider - @cron.task_collection
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
@ -65,6 +82,8 @@ services:
dispatcher: dispatcher:
class: phpbb_event_dispatcher class: phpbb_event_dispatcher
arguments:
- @service_container
dbal.conn: dbal.conn:
class: %dbal.driver.class% class: %dbal.driver.class%
@ -89,12 +108,42 @@ services:
- .%core.php_ext% - .%core.php_ext%
- @cache.driver - @cache.driver
processor.ext: ext.finder:
class: phpbb_di_processor_ext class: phpbb_extension_finder
arguments: arguments:
- @ext.manager - @ext.manager
- %core.root_path%
- @cache.driver
- .%core.php_ext%
- _ext_finder
http_kernel:
class: Symfony\Component\HttpKernel\HttpKernel
arguments:
- @dispatcher
- @controller.resolver
kernel_request_subscriber:
class: phpbb_event_kernel_request_subscriber
arguments:
- @ext.finder
- %core.root_path%
- .%core.php_ext%
tags: tags:
- { name: container.processor } - { name: kernel.event_subscriber }
kernel_exception_subscriber:
class: phpbb_event_kernel_exception_subscriber
arguments:
- @template
- @user
tags:
- { name: kernel.event_subscriber }
kernel_terminate_subscriber:
class: phpbb_event_kernel_terminate_subscriber
tags:
- { name: kernel.event_subscriber }
request: request:
class: phpbb_request class: phpbb_request
@ -131,6 +180,7 @@ services:
- @user - @user
- @style.resource_locator - @style.resource_locator
- @template_context - @template_context
- @ext.manager
template_context: template_context:
class: phpbb_template_context class: phpbb_template_context

View file

@ -39,7 +39,7 @@ function do_cron($cron_lock, $run_tasks)
foreach ($run_tasks as $task) foreach ($run_tasks as $task)
{ {
if (defined('DEBUG_EXTRA') && $config['use_system_cron']) if (defined('DEBUG') && $config['use_system_cron'])
{ {
echo "[phpBB cron] Running task '{$task->get_name()}'\n"; echo "[phpBB cron] Running task '{$task->get_name()}'\n";
} }
@ -57,7 +57,7 @@ function do_cron($cron_lock, $run_tasks)
// //
// Attempt to alleviate the problem by doing setup outside of the lock as much as possible. // Attempt to alleviate the problem by doing setup outside of the lock as much as possible.
// //
// If DEBUG_EXTRA is defined and cron lock cannot be obtained, a message will be printed. // If DEBUG is defined and cron lock cannot be obtained, a message will be printed.
if ($config['use_system_cron']) if ($config['use_system_cron'])
{ {
@ -100,7 +100,7 @@ if ($cron_lock->acquire())
} }
else else
{ {
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
echo "Could not obtain cron lock.\n"; echo "Could not obtain cron lock.\n";
} }

View file

@ -111,7 +111,7 @@ function my_var_export($var)
* Download a file to the develop/ dir * Download a file to the develop/ dir
* *
* @param string $url URL of the file to download * @param string $url URL of the file to download
* @return void * @return null
*/ */
function download($url) function download($url)
{ {

View file

@ -199,7 +199,7 @@ function my_var_export($var)
* Download a file to the develop/ dir * Download a file to the develop/ dir
* *
* @param string $url URL of the file to download * @param string $url URL of the file to download
* @return void * @return null
*/ */
function download($url) function download($url)
{ {

View file

@ -481,7 +481,7 @@ function my_var_export($var)
* Download a file to the develop/ dir * Download a file to the develop/ dir
* *
* @param string $url URL of the file to download * @param string $url URL of the file to download
* @return void * @return null
*/ */
function download($url) function download($url)
{ {

View file

@ -222,7 +222,7 @@ die("\n\nALL TESTS PASSED SUCCESSFULLY\n");
* Download a file to the develop/ dir * Download a file to the develop/ dir
* *
* @param string $url URL of the file to download * @param string $url URL of the file to download
* @return void * @return null
*/ */
function download($url) function download($url)
{ {

View file

@ -132,7 +132,7 @@
<li>A SQL database system, <strong>one of</strong>: <li>A SQL database system, <strong>one of</strong>:
<ul> <ul>
<li>MySQL 3.23 or above (MySQLi supported)</li> <li>MySQL 3.23 or above (MySQLi supported)</li>
<li>PostgreSQL 7.3+</li> <li>PostgreSQL 8.3+</li>
<li>SQLite 2.8.2+ (SQLite 3 is not supported)</li> <li>SQLite 2.8.2+ (SQLite 3 is not supported)</li>
<li>Firebird 2.1+</li> <li>Firebird 2.1+</li>
<li>MS SQL Server 2000 or above (directly or via ODBC or the native adapter)</li> <li>MS SQL Server 2000 or above (directly or via ODBC or the native adapter)</li>

View file

@ -324,11 +324,7 @@
<p>Please remember that running any application on a developmental version of PHP can lead to strange/unexpected results which may appear to be bugs in the application (which may not be true). Therefore we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a developmental version of PHP please check any bugs you find on a system running a stable release before submitting.</p> <p>Please remember that running any application on a developmental version of PHP can lead to strange/unexpected results which may appear to be bugs in the application (which may not be true). Therefore we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a developmental version of PHP please check any bugs you find on a system running a stable release before submitting.</p>
<<<<<<< HEAD <p>This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MSSQL Server 2000, PostgreSQL 8.x, Oracle 8, SQLite 2 and Firebird. Versions of PHP used range from 5.3.x to 5.4.x without problem.</p>
<p>This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MSSQL Server 2000, PostgreSQL 8.x, Oracle 8, SQLite and Firebird. Versions of PHP used range from 5.3.x to 5.4.x without problem.</p>
=======
<p>This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MSSQL Server 2000, PostgreSQL 7.x, Oracle 8, SQLite 2 and Firebird. Versions of PHP used range from 4.3.3 to 5.4.x without problem. </p>
>>>>>>> develop-olympus
<a name="phpsec"></a><h3>7.i. Notice on PHP security issues</h3> <a name="phpsec"></a><h3>7.i. Notice on PHP security issues</h3>

View file

@ -193,7 +193,7 @@ $user_id = 2;
$auth->acl_clear_prefetch($user_id); $auth->acl_clear_prefetch($user_id);
</pre></div> </pre></div>
<p>This method returns void.</p> <p>This method returns null.</p>
<a name="acl_get_list"></a><h3>2.viii. acl_get_list</h3> <a name="acl_get_list"></a><h3>2.viii. acl_get_list</h3>

View file

@ -740,7 +740,7 @@ static private function f()
<a name="sql"></a><h3>2.iii. SQL/SQL Layout</h3> <a name="sql"></a><h3>2.iii. SQL/SQL Layout</h3>
<h4>Common SQL Guidelines: </h4> <h4>Common SQL Guidelines: </h4>
<p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (7.0+), Firebird, SQLite, Oracle8, ODBC (generalised if possible)).</p> <p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), Firebird, SQLite, Oracle8, ODBC (generalised if possible)).</p>
<p>All SQL commands should utilise the DataBase Abstraction Layer (DBAL)</p> <p>All SQL commands should utilise the DataBase Abstraction Layer (DBAL)</p>
<h4>SQL code layout:</h4> <h4>SQL code layout:</h4>

132
phpBB/docs/events.md Normal file
View file

@ -0,0 +1,132 @@
acp_forums_normal_settings_append
===
* Location: adm/style/acp_forums.html
* Purpose: Add settings to forums
acp_main_actions_append
===
* Location: adm/style/acp_main.html
* Purpose: Add actions to the ACP main page below the cache purge action
acp_main_notice_after
===
* Location: adm/style/acp_main.html
* Purpose: Add notices or other blocks in the ACP below other configuration notices
acp_overall_footer_after
===
* Location: adm/style/overall_footer.html
* Purpose: Add content below the footer in the ACP
acp_overall_header_head_append
===
* Location: adm/style/overall_header.html
* Add assets within the `<head>` tags in the ACP
acp_simple_footer_after
===
* Location: adm/style/simple_footer.html
* Purpose: Add content below the simple footer in the ACP
acp_simple_header_head_append
===
* Location: adm/style/overall_header.html
* Add assets within the `<head>` tags in the simple header of the ACP
acp_users_overview_options_append
===
* Location: adm/style/acp_users.html
* Purpose: Add options and settings on user overview page
forumlist_body_last_post_title_prepend
====
* Locations:
+ styles/prosilver/template/forumlist_body.html
+ styles/subsilver2/template/forumlist_body.html
* Purpose: Add content before the post title of the latest post in a forum on the forum list.
index_body_stat_blocks_before
===
* Locations:
+ styles/prosilver/template/index_body.html
+ styles/subsilver2/template/index_body.html
* Purpose: Add new statistic blocks above the Who Is Online and Board Statistics blocks
overall_footer_after
===
* Locations:
+ styles/prosilver/template/overall_footer.html
+ styles/subsilver2/template/overall_footer.html
* Purpose: Add content at the end of the file, directly prior to the `</body>` tag
overall_footer_breadcrumb_append
===
* Location: styles/prosilver/template/overall_footer.html
* Purpose: Add links to the list of breadcrumbs in the footer
overall_footer_copyright_append
===
* Locations:
+ styles/prosilver/template/overall_footer.html
+ styles/subsilver2/template/overall_footer.html
* Purpose: Add content after the copyright line (no new line by default), before the ACP link
overall_footer_copyright_prepend
===
* Locations:
+ styles/prosilver/template/overall_footer.html
+ styles/subsilver2/template/overall_footer.html
* Purpose: Add content before the copyright line
overall_header_breadcrumb_append
===
* Locations:
+ styles/prosilver/template/overall_header.html
+ styles/subsilver2/template/breadcrumbs.html
* Purpose: Add links to the list of breadcrumbs in the header
overall_header_head_append
===
* Locations:
+ styles/prosilver/template/overall_header.html
+ styles/subsilver2/template/overall_header.html
* Purpose: Add asset calls directly before the `</head>` tag
overall_header_navigation_append
===
* Location: styles/prosilver/template/overall_header.html
* Purpose: Add links after the navigation links in the header
overall_header_navigation_prepend
===
* Location: styles/prosilver/template/overall_header.html
* Purpose: Add links before the navigation links in the header
posting_editor_options_prepend
===
* Locations:
+ styles/prosilver/template/posting_editor.html
+ styles/prosilver/template/posting_body.html
* Purpose: Add posting options on the posting screen
simple_footer_after
===
* Location: styles/prosilver/template/simple_footer.html
* Purpose: Add content directly prior to the `</body>` tag of the simple footer
ucp_pm_viewmessage_print_head_append
===
* Location: styles/prosilver/template/ucp_pm_viewmessage_print.html
* Purpose: Add asset calls directly before the `</head>` tag of the Print PM screen
viewtopic_print_head_append
===
* Location: styles/prosilver/template/viewtopic_print.html
* Purpose: Add asset calls directly before the `</head>` tag of the Print Topic screen
viewtopic_topic_title_prepend
===
* Locations:
+ styles/prosilver/template/viewtopic_body.html
+ styles/subsilver2/template/viewtopic_body.html
* Purpose: Add content directly before the topic title link on the View topic screen

View file

@ -42,24 +42,35 @@ if (isset($_GET['avatar']))
} }
require($phpbb_root_path . 'includes/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/di/processor/interface.' . $phpEx);
require($phpbb_root_path . 'includes/di/processor/config.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx); require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
$phpbb_container = new ContainerBuilder(); // Setup class loader first
$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config')); $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", ".$phpEx");
$loader->load('services.yml'); $phpbb_class_loader->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", ".$phpEx");
$phpbb_class_loader_ext->register();
$processor = new phpbb_di_processor_config($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx); // Set up container
$processor->process($phpbb_container); $phpbb_container = phpbb_create_dumped_container_unless_debug(
array(
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
new phpbb_di_extension_core($phpbb_root_path),
),
array(
new phpbb_di_pass_collection_pass(),
new phpbb_di_pass_kernel_pass(),
),
$phpbb_root_path,
$phpEx
);
$phpbb_class_loader = $phpbb_container->get('class_loader'); $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
// set up caching // set up caching
$cache = $phpbb_container->get('cache'); $cache = $phpbb_container->get('cache');
@ -85,13 +96,6 @@ if (isset($_GET['avatar']))
$phpbb_extension_manager = $phpbb_container->get('ext.manager'); $phpbb_extension_manager = $phpbb_container->get('ext.manager');
$phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader'); $phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader');
$ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor'));
foreach ($ids as $id)
{
$processor = $phpbb_container->get($id);
$processor->process($phpbb_container);
}
// worst-case default // worst-case default
$browser = strtolower($request->header('User-Agent', 'msie 6.0')); $browser = strtolower($request->header('User-Agent', 'msie 6.0'));

View file

@ -150,7 +150,7 @@ if ($config['gzip_compress'])
} }
// IF debug extra is enabled and admin want to "explain" the page we need to set other headers... // IF debug extra is enabled and admin want to "explain" the page we need to set other headers...
if (defined('DEBUG_EXTRA') && request_var('explain', 0) && $auth->acl_get('a_')) if (defined('DEBUG') && request_var('explain', 0) && $auth->acl_get('a_'))
{ {
header('Content-type: text/html; charset=UTF-8'); header('Content-type: text/html; charset=UTF-8');
header('Cache-Control: private, no-cache="set-cookie"'); header('Cache-Control: private, no-cache="set-cookie"');
@ -555,12 +555,6 @@ class phpbb_feed_base
$forum_ids = array_flip($this->get_moderator_approve_forums()); $forum_ids = array_flip($this->get_moderator_approve_forums());
} }
if (!$forum_id)
{
// Global announcement, your a moderator in any forum than it's okay.
return (!empty($forum_ids)) ? true : false;
}
return (isset($forum_ids[$forum_id])) ? true : false; return (isset($forum_ids[$forum_id])) ? true : false;
} }

View file

@ -26,6 +26,7 @@ class acp_groups
{ {
global $config, $db, $user, $auth, $template, $cache; global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
global $request;
$user->add_lang('acp/groups'); $user->add_lang('acp/groups');
$this->tpl_name = 'acp_groups'; $this->tpl_name = 'acp_groups';
@ -323,7 +324,8 @@ class acp_groups
$submit_ary['founder_manage'] = isset($_REQUEST['group_founder_manage']) ? 1 : 0; $submit_ary['founder_manage'] = isset($_REQUEST['group_founder_manage']) ? 1 : 0;
} }
if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink']) $uploadfile = $request->file('uploadfile');
if (!empty($uploadfile['tmp_name']) || $data['uploadurl'] || $data['remotelink'])
{ {
// Avatar stuff // Avatar stuff
$var_ary = array( $var_ary = array(
@ -337,7 +339,7 @@ class acp_groups
{ {
$data['user_id'] = "g$group_id"; $data['user_id'] = "g$group_id";
if ((!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl']) && $can_upload) if ((!empty($uploadfile['tmp_name']) || $data['uploadurl']) && $can_upload)
{ {
list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error); list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error);
} }

View file

@ -16,10 +16,10 @@ class acp_extensions_info
{ {
return array( return array(
'filename' => 'acp_extensions', 'filename' => 'acp_extensions',
'title' => 'ACP_EXTENSIONS', 'title' => 'ACP_EXTENSIONS_MANAGEMENT',
'version' => '1.0.0', 'version' => '1.0.0',
'modes' => array( 'modes' => array(
'main' => array('title' => 'ACP_EXTENSIONS', 'auth' => 'acl_a_extensions', 'cat' => array('ACP_GENERAL_TASKS')), 'main' => array('title' => 'ACP_EXTENSIONS', 'auth' => 'acl_a_extensions', 'cat' => array('ACP_EXTENSIONS_MANAGEMENT')),
), ),
); );
} }

View file

@ -19,7 +19,7 @@ class acp_language_info
'title' => 'ACP_LANGUAGE', 'title' => 'ACP_LANGUAGE',
'version' => '1.0.0', 'version' => '1.0.0',
'modes' => array( 'modes' => array(
'lang_packs' => array('title' => 'ACP_LANGUAGE_PACKS', 'auth' => 'acl_a_language', 'cat' => array('ACP_GENERAL_TASKS')), 'lang_packs' => array('title' => 'ACP_LANGUAGE_PACKS', 'auth' => 'acl_a_language', 'cat' => array('ACP_LANGUAGE')),
), ),
); );
} }

View file

@ -134,7 +134,7 @@ class bbcode
$style_resource_locator = new phpbb_style_resource_locator(); $style_resource_locator = new phpbb_style_resource_locator();
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider()); $style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context()); $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $phpbb_extension_manager);
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $template); $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $template);
$style->set_style(); $style->set_style();
$template->set_filenames(array('bbcode.html' => 'bbcode.html')); $template->set_filenames(array('bbcode.html' => 'bbcode.html'));

View file

@ -26,7 +26,7 @@ class phpbb_cache_driver_apc extends phpbb_cache_driver_memory
/** /**
* Purge cache data * Purge cache data
* *
* @return void * @return null
*/ */
function purge() function purge()
{ {

View file

@ -30,7 +30,7 @@ class phpbb_cache_driver_eaccelerator extends phpbb_cache_driver_memory
/** /**
* Purge cache data * Purge cache data
* *
* @return void * @return null
*/ */
function purge() function purge()
{ {
@ -47,7 +47,7 @@ class phpbb_cache_driver_eaccelerator extends phpbb_cache_driver_memory
/** /**
* Perform cache garbage collection * Perform cache garbage collection
* *
* @return void * @return null
*/ */
function tidy() function tidy()
{ {

View file

@ -214,7 +214,12 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
while (($entry = readdir($dir)) !== false) while (($entry = readdir($dir)) !== false)
{ {
if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0) if (strpos($entry, 'container_') !== 0 &&
strpos($entry, 'url_matcher') !== 0 &&
strpos($entry, 'sql_') !== 0 &&
strpos($entry, 'data_') !== 0 &&
strpos($entry, 'ctpl_') !== 0 &&
strpos($entry, 'tpl_') !== 0)
{ {
continue; continue;
} }
@ -383,10 +388,10 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
if ($this->_write('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl + time(), $query)) if ($this->_write('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl + time(), $query))
{ {
$query_result = $query_id; return $query_id;
} }
return $query_id; return $query_result;
} }
/** /**
@ -648,10 +653,11 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
$file = "{$this->cache_dir}$filename.$phpEx"; $file = "{$this->cache_dir}$filename.$phpEx";
$lock = new phpbb_lock_flock($file);
$lock->acquire();
if ($handle = @fopen($file, 'wb')) if ($handle = @fopen($file, 'wb'))
{ {
@flock($handle, LOCK_EX);
// File header // File header
fwrite($handle, '<' . '?php exit; ?' . '>'); fwrite($handle, '<' . '?php exit; ?' . '>');
@ -692,7 +698,6 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
fwrite($handle, $data); fwrite($handle, $data);
} }
@flock($handle, LOCK_UN);
fclose($handle); fclose($handle);
if (!function_exists('phpbb_chmod')) if (!function_exists('phpbb_chmod'))
@ -703,10 +708,16 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE); phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE);
return true; $return_value = true;
}
else
{
$return_value = false;
} }
return false; $lock->release();
return $return_value;
} }
/** /**

View file

@ -63,42 +63,81 @@ interface phpbb_cache_driver_interface
public function destroy($var_name, $table = ''); public function destroy($var_name, $table = '');
/** /**
* Check if a given cache entry exist * Check if a given cache entry exists
*/ */
public function _exists($var_name); public function _exists($var_name);
/** /**
* Load cached sql query * Load result of an SQL query from cache.
*
* @param string $query SQL query
*
* @return int|bool Query ID (integer) if cache contains a rowset
* for the specified query.
* False otherwise.
*/ */
public function sql_load($query); public function sql_load($query);
/** /**
* Save sql query * Save result of an SQL query in cache.
*
* In persistent cache stores, this function stores the query
* result to persistent storage. In other words, there is no need
* to call save() afterwards.
*
* @param string $query SQL query, should be used for generating storage key
* @param mixed $query_result The result from dbal::sql_query, to be passed to
* dbal::sql_fetchrow to get all rows and store them
* in cache.
* @param int $ttl Time to live, after this timeout the query should
* expire from the cache.
* @return int|mixed If storing in cache succeeded, an integer $query_id
* representing the query should be returned. Otherwise
* the original $query_result should be returned.
*/ */
public function sql_save($query, $query_result, $ttl); public function sql_save($query, $query_result, $ttl);
/** /**
* Ceck if a given sql query exist in cache * Check if result for a given SQL query exists in cache.
*
* @param int $query_id
* @return bool
*/ */
public function sql_exists($query_id); public function sql_exists($query_id);
/** /**
* Fetch row from cache (database) * Fetch row from cache (database)
*
* @param int $query_id
* @return array|bool The query result if found in the cache, otherwise
* false.
*/ */
public function sql_fetchrow($query_id); public function sql_fetchrow($query_id);
/** /**
* Fetch a field from the current row of a cached database result (database) * Fetch a field from the current row of a cached database result (database)
*
* @param int $query_id
* @param $field The name of the column.
* @return string|bool The field of the query result if found in the cache,
* otherwise false.
*/ */
public function sql_fetchfield($query_id, $field); public function sql_fetchfield($query_id, $field);
/** /**
* Seek a specific row in an a cached database result (database) * Seek a specific row in an a cached database result (database)
*
* @param int $rownum Row to seek to.
* @param int $query_id
* @return bool
*/ */
public function sql_rowseek($rownum, $query_id); public function sql_rowseek($rownum, $query_id);
/** /**
* Free memory used for a cached database result (database) * Free memory used for a cached database result (database)
*
* @param int $query_id
* @return bool
*/ */
public function sql_freeresult($query_id); public function sql_freeresult($query_id);
} }

View file

@ -64,7 +64,7 @@ class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory
/** /**
* Unload the cache resources * Unload the cache resources
* *
* @return void * @return null
*/ */
function unload() function unload()
{ {
@ -76,7 +76,7 @@ class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory
/** /**
* Purge cache data * Purge cache data
* *
* @return void * @return null
*/ */
function purge() function purge()
{ {

View file

@ -162,7 +162,12 @@ abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
while (($entry = readdir($dir)) !== false) while (($entry = readdir($dir)) !== false)
{ {
if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0) if (strpos($entry, 'container_') !== 0 &&
strpos($entry, 'url_matcher') !== 0 &&
strpos($entry, 'sql_') !== 0 &&
strpos($entry, 'data_') !== 0 &&
strpos($entry, 'ctpl_') !== 0 &&
strpos($entry, 'tpl_') !== 0)
{ {
continue; continue;
} }
@ -294,7 +299,7 @@ abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
if (!preg_match('/FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?/', $query, $regs)) if (!preg_match('/FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?/', $query, $regs))
{ {
// Bail out if the match fails. // Bail out if the match fails.
return; return $query_result;
} }
$tables = array_map('trim', explode(',', $regs[1])); $tables = array_map('trim', explode(',', $regs[1]));
@ -334,8 +339,6 @@ abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
$this->_write('sql_' . $hash, $this->sql_rowset[$query_id], $ttl); $this->_write('sql_' . $hash, $this->sql_rowset[$query_id], $ttl);
$query_result = $query_id;
return $query_id; return $query_id;
} }

View file

@ -109,6 +109,7 @@ class phpbb_cache_driver_null extends phpbb_cache_driver_base
*/ */
function sql_save($query, $query_result, $ttl) function sql_save($query, $query_result, $ttl)
{ {
return $query_result;
} }
/** /**

View file

@ -39,13 +39,39 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
var $redis; var $redis;
/**
* Creates a redis cache driver.
*
* The following global constants affect operation:
*
* PHPBB_ACM_REDIS_HOST
* PHPBB_ACM_REDIS_PORT
* PHPBB_ACM_REDIS_PASSWORD
* PHPBB_ACM_REDIS_DB
*
* There are no publicly documented constructor parameters.
*/
function __construct() function __construct()
{ {
// Call the parent constructor // Call the parent constructor
parent::__construct(); parent::__construct();
$this->redis = new Redis(); $this->redis = new Redis();
$this->redis->connect(PHPBB_ACM_REDIS_HOST, PHPBB_ACM_REDIS_PORT);
$args = func_get_args();
if (!empty($args))
{
$ok = call_user_func_array(array($this->redis, 'connect'), $args);
}
else
{
$ok = $this->redis->connect(PHPBB_ACM_REDIS_HOST, PHPBB_ACM_REDIS_PORT);
}
if (!$ok)
{
trigger_error('Could not connect to redis server');
}
if (defined('PHPBB_ACM_REDIS_PASSWORD')) if (defined('PHPBB_ACM_REDIS_PASSWORD'))
{ {
@ -74,7 +100,7 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
/** /**
* Unload the cache resources * Unload the cache resources
* *
* @return void * @return null
*/ */
function unload() function unload()
{ {
@ -86,7 +112,7 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
/** /**
* Purge cache data * Purge cache data
* *
* @return void * @return null
*/ */
function purge() function purge()
{ {

View file

@ -26,7 +26,7 @@ class phpbb_cache_driver_wincache extends phpbb_cache_driver_memory
/** /**
* Purge cache data * Purge cache data
* *
* @return void * @return null
*/ */
function purge() function purge()
{ {

View file

@ -41,7 +41,7 @@ class phpbb_cache_driver_xcache extends phpbb_cache_driver_memory
/** /**
* Purge cache data * Purge cache data
* *
* @return void * @return null
*/ */
function purge() function purge()
{ {

View file

@ -57,19 +57,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha
static public function is_available() static public function is_available()
{ {
global $phpbb_root_path, $phpEx; return @extension_loaded('gd');
if (@extension_loaded('gd'))
{
return true;
}
if (!function_exists('can_load_dll'))
{
include($phpbb_root_path . 'includes/functions_install.' . $phpEx);
}
return can_load_dll('gd');
} }
/** /**

View file

@ -46,19 +46,7 @@ class phpbb_captcha_gd_wave extends phpbb_default_captcha
static public function is_available() static public function is_available()
{ {
global $phpbb_root_path, $phpEx; return @extension_loaded('gd');
if (@extension_loaded('gd'))
{
return true;
}
if (!function_exists('can_load_dll'))
{
include($phpbb_root_path . 'includes/functions_install.' . $phpEx);
}
return can_load_dll('gd');
} }
static public function get_name() static public function get_name()

View file

@ -109,7 +109,7 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
* @param String $key The configuration option's name * @param String $key The configuration option's name
* @param bool $use_cache Whether this variable should be cached or if it * @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached * changes too frequently to be efficiently cached
* @return void * @return null
*/ */
public function delete($key, $use_cache = true) public function delete($key, $use_cache = true)
{ {

View file

@ -29,7 +29,7 @@ class phpbb_config_db extends phpbb_config
/** /**
* Database connection * Database connection
* @var dbal * @var phpbb_db_driver
*/ */
protected $db; protected $db;
@ -42,11 +42,11 @@ class phpbb_config_db extends phpbb_config
/** /**
* Creates a configuration container with a default set of values * Creates a configuration container with a default set of values
* *
* @param dbal $db Database connection * @param phpbb_db_driver $db Database connection
* @param phpbb_cache_driver_interface $cache Cache instance * @param phpbb_cache_driver_interface $cache Cache instance
* @param string $table Configuration table name * @param string $table Configuration table name
*/ */
public function __construct(dbal $db, phpbb_cache_driver_interface $cache, $table) public function __construct(phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $table)
{ {
$this->db = $db; $this->db = $db;
$this->cache = $cache; $this->cache = $cache;
@ -96,7 +96,7 @@ class phpbb_config_db extends phpbb_config
* @param String $key The configuration option's name * @param String $key The configuration option's name
* @param bool $use_cache Whether this variable should be cached or if it * @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached * changes too frequently to be efficiently cached
* @return void * @return null
*/ */
public function delete($key, $use_cache = true) public function delete($key, $use_cache = true)
{ {

View file

@ -0,0 +1,24 @@
<?php
/**
*
* @package controller
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Controller exception class
* @package phpBB3
*/
class phpbb_controller_exception extends RuntimeException
{
}

View file

@ -0,0 +1,117 @@
<?php
/**
*
* @package controller
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\HttpFoundation\Response;
/**
* Controller helper class, contains methods that do things for controllers
* @package phpBB3
*/
class phpbb_controller_helper
{
/**
* Template object
* @var phpbb_template
*/
protected $template;
/**
* User object
* @var phpbb_user
*/
protected $user;
/**
* phpBB root path
* @var string
*/
protected $phpbb_root_path;
/**
* PHP extension
* @var string
*/
protected $php_ext;
/**
* Constructor
*
* @param phpbb_template $template Template object
* @param phpbb_user $user User object
* @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP extension
*/
public function __construct(phpbb_template $template, phpbb_user $user, $phpbb_root_path, $php_ext)
{
$this->template = $template;
$this->user = $user;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
}
/**
* Automate setting up the page and creating the response object.
*
* @param string $handle 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
* @return Response object containing rendered page
*/
public function render($template_file, $page_title = '', $status_code = 200)
{
page_header($page_title);
$this->template->set_filenames(array(
'body' => $template_file,
));
page_footer(true, false, false);
return new Response($this->template->assign_display('body'), $status_code);
}
/**
* Easily generate a URL
*
* @param array $url_parts Each array element is a 'folder'
* i.e. array('my', 'ext') maps to ./app.php/my/ext
* @param mixed $query The Query string, passed directly into the second
* argument of append_sid()
* @return string A URL that has already been run through append_sid()
*/
public function url(array $url_parts, $query = '')
{
return append_sid($this->phpbb_root_path . implode('/', $url_parts), $query);
}
/**
* Output an error, effectively the same thing as trigger_error
*
* @param string $message The error message
* @param string $code The error code (e.g. 404, 500, 503, etc.)
* @return Response A Reponse instance
*/
public function error($message, $code = 500)
{
$this->template->assign_vars(array(
'MESSAGE_TEXT' => $message,
'MESSAGE_TITLE' => $this->user->lang('INFORMATION'),
));
return $this->render('message_body.html', $this->user->lang('INFORMATION'), $code);
}
}

View file

@ -0,0 +1,82 @@
<?php
/**
*
* @package controller
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
/**
* Controller interface
* @package phpBB3
*/
class phpbb_controller_provider
{
/**
* YAML file(s) containing route information
* @var array
*/
protected $routing_paths;
/**
* Construct method
*
* @param array() $routing_paths Array of strings containing paths
* to YAML files holding route information
*/
public function __construct($routing_paths = array())
{
$this->routing_paths = $routing_paths;
}
/**
* Locate paths containing routing files
* This sets an internal property but does not return the paths.
*
* @return The current instance of this object for method chaining
*/
public function import_paths_from_finder(phpbb_extension_finder $finder)
{
// We hardcode the path to the core config directory
// because the finder cannot find it
$this->routing_paths = array_merge(array('config'), array_map('dirname', array_keys($finder
->directory('config')
->prefix('routing')
->suffix('yml')
->find()
)));
return $this;
}
/**
* Get a list of controllers and return it
*
* @param string $base_path Base path to prepend to file paths
* @return array Array of controllers and their route information
*/
public function find($base_path = '')
{
$routes = new RouteCollection;
foreach ($this->routing_paths as $path)
{
$loader = new YamlFileLoader(new FileLocator($base_path . $path));
$routes->addCollection($loader->load('routing.yml'));
}
return $routes;
}
}

View file

@ -0,0 +1,128 @@
<?php
/**
*
* @package controller
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
/**
* Controller manager class
* @package phpBB3
*/
class phpbb_controller_resolver implements ControllerResolverInterface
{
/**
* User object
* @var phpbb_user
*/
protected $user;
/**
* ContainerInterface object
* @var ContainerInterface
*/
protected $container;
/**
* Construct method
*
* @param phpbb_user $user User Object
* @param ContainerInterface $container ContainerInterface object
*/
public function __construct(phpbb_user $user, ContainerInterface $container)
{
$this->user = $user;
$this->container = $container;
}
/**
* Load a controller callable
*
* @param Symfony\Component\HttpFoundation\Request $request Symfony Request object
* @return bool|Callable Callable or false
* @throws phpbb_controller_exception
*/
public function getController(Request $request)
{
$controller = $request->attributes->get('_controller');
if (!$controller)
{
throw new phpbb_controller_exception($this->user->lang['CONTROLLER_NOT_SPECIFIED']);
}
// Require a method name along with the service name
if (stripos($controller, ':') === false)
{
throw new phpbb_controller_exception($this->user->lang['CONTROLLER_METHOD_NOT_SPECIFIED']);
}
list($service, $method) = explode(':', $controller);
if (!$this->container->has($service))
{
throw new phpbb_controller_exception($this->user->lang('CONTROLLER_SERVICE_UNDEFINED', $service));
}
$controller_object = $this->container->get($service);
return array($controller_object, $method);
}
/**
* Dependencies should be specified in the service definition and can be
* then accessed in __construct(). Arguments are sent through the URL path
* and should match the parameters of the method you are using as your
* controller.
*
* @param Symfony\Component\HttpFoundation\Request $request Symfony Request object
* @param mixed $controller A callable (controller class, method)
* @return bool False
* @throws phpbb_controller_exception
*/
public function getArguments(Request $request, $controller)
{
// At this point, $controller contains the object and method name
list($object, $method) = $controller;
$mirror = new ReflectionMethod($object, $method);
$arguments = array();
$parameters = $mirror->getParameters();
$attributes = $request->attributes->all();
foreach ($parameters as $param)
{
if (array_key_exists($param->name, $attributes))
{
$arguments[] = $attributes[$param->name];
}
else if ($param->getClass() && $param->getClass()->isInstance($request))
{
$arguments[] = $request;
}
else if ($param->isDefaultValueAvailable())
{
$arguments[] = $param->getDefaultValue();
}
else
{
throw new phpbb_controller_exception($this->user->lang('CONTROLLER_ARGUMENT_VALUE_MISSING', $param->getPosition() + 1, get_class($object) . ':' . $method, $param->name));
}
}
return $arguments;
}
}

View file

@ -54,7 +54,7 @@ class phpbb_cron_manager
* *
* @param array|Traversable $tasks Array of instances of phpbb_cron_task * @param array|Traversable $tasks Array of instances of phpbb_cron_task
* *
* @return void * @return null
*/ */
public function load_tasks($tasks) public function load_tasks($tasks)
{ {

View file

@ -37,9 +37,9 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
* @param string $phpbb_root_path The root path * @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension * @param string $php_ext The PHP extension
* @param phpbb_config $config The config * @param phpbb_config $config The config
* @param dbal $db The db connection * @param phpbb_db_driver $db The db connection
*/ */
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, dbal $db) public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db)
{ {
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
@ -50,7 +50,7 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
/** /**
* Runs this cron task. * Runs this cron task.
* *
* @return void * @return null
*/ */
public function run() public function run()
{ {

View file

@ -47,9 +47,9 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
* @param string $phpbb_root_path The root path * @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension * @param string $php_ext The PHP extension
* @param phpbb_config $config The config * @param phpbb_config $config The config
* @param dbal $db The db connection * @param phpbb_db_driver $db The db connection
*/ */
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, dbal $db) public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db)
{ {
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
@ -70,7 +70,7 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
/** /**
* Runs this cron task. * Runs this cron task.
* *
* @return void * @return null
*/ */
public function run() public function run()
{ {
@ -138,7 +138,7 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
* *
* @param phpbb_request_interface $request Request object. * @param phpbb_request_interface $request Request object.
* *
* @return void * @return null
*/ */
public function parse_parameters(phpbb_request_interface $request) public function parse_parameters(phpbb_request_interface $request)
{ {

View file

@ -43,7 +43,7 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base
/** /**
* Runs this cron task. * Runs this cron task.
* *
* @return void * @return null
*/ */
public function run() public function run()
{ {

View file

@ -40,7 +40,7 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base
/** /**
* Runs this cron task. * Runs this cron task.
* *
* @return void * @return null
*/ */
public function run() public function run()
{ {

View file

@ -43,7 +43,7 @@ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base
/** /**
* Runs this cron task. * Runs this cron task.
* *
* @return void * @return null
*/ */
public function run() public function run()
{ {

View file

@ -38,10 +38,10 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
* @param string $php_ext The PHP extension * @param string $php_ext The PHP extension
* @param phpbb_auth $auth The auth * @param phpbb_auth $auth The auth
* @param phpbb_config $config The config * @param phpbb_config $config The config
* @param dbal $db The db connection * @param phpbb_db_driver $db The db connection
* @param phpbb_user $user The user * @param phpbb_user $user The user
*/ */
public function __construct($phpbb_root_path, $php_ext, phpbb_auth $auth, phpbb_config $config, dbal $db, phpbb_user $user) public function __construct($phpbb_root_path, $php_ext, phpbb_auth $auth, phpbb_config $config, phpbb_db_driver $db, phpbb_user $user)
{ {
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
@ -54,7 +54,7 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
/** /**
* Runs this cron task. * Runs this cron task.
* *
* @return void * @return null
*/ */
public function run() public function run()
{ {

View file

@ -40,7 +40,7 @@ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base
/** /**
* Runs this cron task. * Runs this cron task.
* *
* @return void * @return null
*/ */
public function run() public function run()
{ {

View file

@ -45,7 +45,7 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base
/** /**
* Runs this cron task. * Runs this cron task.
* *
* @return void * @return null
*/ */
public function run() public function run()
{ {

View file

@ -46,7 +46,7 @@ interface phpbb_cron_task_parametrized extends phpbb_cron_task
* *
* @param phpbb_request_interface $request Request object. * @param phpbb_request_interface $request Request object.
* *
* @return void * @return null
*/ */
public function parse_parameters(phpbb_request_interface $request); public function parse_parameters(phpbb_request_interface $request);
} }

View file

@ -1,59 +0,0 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\TaggedContainerInterface;
/**
* Provides cron manager with tasks
*
* Finds installed cron tasks and makes them available to the cron manager.
*
* @package phpBB3
*/
class phpbb_cron_task_provider implements IteratorAggregate
{
private $container;
public function __construct(TaggedContainerInterface $container)
{
$this->container = $container;
}
/**
* Retrieve an iterator over all items
*
* @return ArrayIterator An iterator for the array of cron tasks
*/
public function getIterator()
{
$definitions = $this->container->findTaggedServiceIds('cron.task');
$tasks = array();
foreach ($definitions as $name => $definition)
{
$task = $this->container->get($name);
if ($task instanceof phpbb_cron_task_base)
{
$task->set_name($name);
}
$tasks[] = $task;
}
return new ArrayIterator($tasks);
}
}

View file

@ -31,7 +31,7 @@ interface phpbb_cron_task
/** /**
* Runs this cron task. * Runs this cron task.
* *
* @return void * @return null
*/ */
public function run(); public function run();

View file

@ -300,7 +300,7 @@ class phpbb_db_tools
/** /**
* Constructor. Set DB Object and set {@link $return_statements return_statements}. * Constructor. Set DB Object and set {@link $return_statements return_statements}.
* *
* @param phpbb_dbal $db DBAL object * @param phpbb_db_driver $db Database connection
* @param bool $return_statements True if only statements should be returned and no SQL being executed * @param bool $return_statements True if only statements should be returned and no SQL being executed
*/ */
function phpbb_db_tools(&$db, $return_statements = false) function phpbb_db_tools(&$db, $return_statements = false)

View file

@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
* Database Abstraction Layer * Database Abstraction Layer
* @package dbal * @package dbal
*/ */
class dbal class phpbb_db_driver
{ {
var $db_connect_id; var $db_connect_id;
var $query_result; var $query_result;
@ -72,17 +72,17 @@ class dbal
/** /**
* Constructor * Constructor
*/ */
function dbal() function __construct()
{ {
$this->num_queries = array( $this->num_queries = array(
'cached' => 0, 'cached' => 0,
'normal' => 0, 'normal' => 0,
'total' => 0, 'total' => 0,
); );
// Fill default sql layer based on the class being called. // Fill default sql layer based on the class being called.
// This can be changed by the specified layer itself later if needed. // This can be changed by the specified layer itself later if needed.
$this->sql_layer = substr(get_class($this), 5); $this->sql_layer = substr(get_class($this), strlen('phpbb_db_driver_'));
// Do not change this please! This variable is used to easy the use of it - and is hardcoded. // Do not change this please! This variable is used to easy the use of it - and is hardcoded.
$this->any_char = chr(0) . '%'; $this->any_char = chr(0) . '%';
@ -766,8 +766,8 @@ class dbal
// Show complete SQL error and path to administrators only // Show complete SQL error and path to administrators only
// Additionally show complete error on installation or if extended debug mode is enabled // Additionally show complete error on installation or if extended debug mode is enabled
// The DEBUG_EXTRA constant is for development only! // The DEBUG constant is for development only!
if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || defined('DEBUG_EXTRA')) if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || defined('DEBUG'))
{ {
$message .= ($sql) ? '<br /><br />SQL<br /><br />' . htmlspecialchars($sql) : ''; $message .= ($sql) ? '<br /><br />SQL<br /><br />' . htmlspecialchars($sql) : '';
} }
@ -1042,8 +1042,3 @@ class dbal
return $rows_total; return $rows_total;
} }
} }
/**
* This variable holds the class name to use later
*/
$sql_db = (!empty($dbms)) ? 'dbal_' . basename($dbms) : 'dbal';

View file

@ -15,14 +15,12 @@ if (!defined('IN_PHPBB'))
exit; exit;
} }
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/** /**
* Firebird/Interbase Database Abstraction Layer * Firebird/Interbase Database Abstraction Layer
* Minimum Requirement is Firebird 2.1 * Minimum Requirement is Firebird 2.1
* @package dbal * @package dbal
*/ */
class dbal_firebird extends dbal class phpbb_db_driver_firebird extends phpbb_db_driver
{ {
var $last_query_text = ''; var $last_query_text = '';
var $service_handle = false; var $service_handle = false;
@ -150,7 +148,7 @@ class dbal_firebird extends dbal
global $cache; global $cache;
// EXPLAIN only in extra debug mode // EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('start', $query); $this->sql_report('start', $query);
} }
@ -251,7 +249,7 @@ class dbal_firebird extends dbal
$this->sql_error($query); $this->sql_error($query);
} }
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('stop', $query); $this->sql_report('stop', $query);
} }
@ -279,7 +277,7 @@ class dbal_firebird extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
} }
} }
else if (defined('DEBUG_EXTRA')) else if (defined('DEBUG'))
{ {
$this->sql_report('fromcache', $query); $this->sql_report('fromcache', $query);
} }

View file

@ -15,20 +15,26 @@ if (!defined('IN_PHPBB'))
exit; exit;
} }
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/** /**
* MSSQL Database Abstraction Layer * MSSQL Database Abstraction Layer
* Minimum Requirement is MSSQL 2000+ * Minimum Requirement is MSSQL 2000+
* @package dbal * @package dbal
*/ */
class dbal_mssql extends dbal class phpbb_db_driver_mssql extends phpbb_db_driver
{ {
var $connect_error = '';
/** /**
* Connect to server * Connect to server
*/ */
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{ {
if (!function_exists('mssql_connect'))
{
$this->connect_error = 'mssql_connect function does not exist, is mssql extension installed?';
return $this->sql_error('');
}
$this->persistency = $persistency; $this->persistency = $persistency;
$this->user = $sqluser; $this->user = $sqluser;
$this->dbname = $database; $this->dbname = $database;
@ -139,7 +145,7 @@ class dbal_mssql extends dbal
global $cache; global $cache;
// EXPLAIN only in extra debug mode // EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('start', $query); $this->sql_report('start', $query);
} }
@ -154,7 +160,7 @@ class dbal_mssql extends dbal
$this->sql_error($query); $this->sql_error($query);
} }
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('stop', $query); $this->sql_report('stop', $query);
} }
@ -169,7 +175,7 @@ class dbal_mssql extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
} }
} }
else if (defined('DEBUG_EXTRA')) else if (defined('DEBUG'))
{ {
$this->sql_report('fromcache', $query); $this->sql_report('fromcache', $query);
} }
@ -355,34 +361,44 @@ class dbal_mssql extends dbal
*/ */
function _sql_error() function _sql_error()
{ {
$error = array( if (function_exists('mssql_get_last_message'))
'message' => @mssql_get_last_message(),
'code' => ''
);
// Get error code number
$result_id = @mssql_query('SELECT @@ERROR as code', $this->db_connect_id);
if ($result_id)
{ {
$row = @mssql_fetch_assoc($result_id); $error = array(
$error['code'] = $row['code']; 'message' => @mssql_get_last_message(),
@mssql_free_result($result_id); 'code' => '',
} );
// Get full error message if possible // Get error code number
$sql = 'SELECT CAST(description as varchar(255)) as message $result_id = @mssql_query('SELECT @@ERROR as code', $this->db_connect_id);
FROM master.dbo.sysmessages if ($result_id)
WHERE error = ' . $error['code'];
$result_id = @mssql_query($sql);
if ($result_id)
{
$row = @mssql_fetch_assoc($result_id);
if (!empty($row['message']))
{ {
$error['message'] .= '<br />' . $row['message']; $row = @mssql_fetch_assoc($result_id);
$error['code'] = $row['code'];
@mssql_free_result($result_id);
} }
@mssql_free_result($result_id);
// Get full error message if possible
$sql = 'SELECT CAST(description as varchar(255)) as message
FROM master.dbo.sysmessages
WHERE error = ' . $error['code'];
$result_id = @mssql_query($sql);
if ($result_id)
{
$row = @mssql_fetch_assoc($result_id);
if (!empty($row['message']))
{
$error['message'] .= '<br />' . $row['message'];
}
@mssql_free_result($result_id);
}
}
else
{
$error = array(
'message' => $this->connect_error,
'code' => '',
);
} }
return $error; return $error;

View file

@ -15,8 +15,6 @@ if (!defined('IN_PHPBB'))
exit; exit;
} }
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/** /**
* Unified ODBC functions * Unified ODBC functions
* Unified ODBC functions support any database having ODBC driver, for example Adabas D, IBM DB2, iODBC, Solid, Sybase SQL Anywhere... * Unified ODBC functions support any database having ODBC driver, for example Adabas D, IBM DB2, iODBC, Solid, Sybase SQL Anywhere...
@ -28,9 +26,10 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
* *
* @package dbal * @package dbal
*/ */
class dbal_mssql_odbc extends dbal class phpbb_db_driver_mssql_odbc extends phpbb_db_driver
{ {
var $last_query_text = ''; var $last_query_text = '';
var $connect_error = '';
/** /**
* Connect to server * Connect to server
@ -67,7 +66,24 @@ class dbal_mssql_odbc extends dbal
@ini_set('odbc.defaultlrl', $max_size); @ini_set('odbc.defaultlrl', $max_size);
} }
$this->db_connect_id = ($this->persistency) ? @odbc_pconnect($this->server, $this->user, $sqlpassword) : @odbc_connect($this->server, $this->user, $sqlpassword); if ($this->persistency)
{
if (!function_exists('odbc_pconnect'))
{
$this->connect_error = 'odbc_pconnect function does not exist, is odbc extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @odbc_pconnect($this->server, $this->user, $sqlpassword);
}
else
{
if (!function_exists('odbc_connect'))
{
$this->connect_error = 'odbc_connect function does not exist, is odbc extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @odbc_connect($this->server, $this->user, $sqlpassword);
}
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
} }
@ -157,7 +173,7 @@ class dbal_mssql_odbc extends dbal
global $cache; global $cache;
// EXPLAIN only in extra debug mode // EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('start', $query); $this->sql_report('start', $query);
} }
@ -173,7 +189,7 @@ class dbal_mssql_odbc extends dbal
$this->sql_error($query); $this->sql_error($query);
} }
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('stop', $query); $this->sql_report('stop', $query);
} }
@ -188,7 +204,7 @@ class dbal_mssql_odbc extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
} }
} }
else if (defined('DEBUG_EXTRA')) else if (defined('DEBUG'))
{ {
$this->sql_report('fromcache', $query); $this->sql_report('fromcache', $query);
} }
@ -349,10 +365,22 @@ class dbal_mssql_odbc extends dbal
*/ */
function _sql_error() function _sql_error()
{ {
return array( if (function_exists('odbc_errormsg'))
'message' => @odbc_errormsg(), {
'code' => @odbc_error() $error = array(
); 'message' => @odbc_errormsg(),
'code' => @odbc_error(),
);
}
else
{
$error = array(
'message' => $this->connect_error,
'code' => '',
);
}
return $error;
} }
/** /**

View file

@ -19,8 +19,6 @@ if (!defined('IN_PHPBB'))
exit; exit;
} }
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/** /**
* Prior to version 1.1 the SQL Server Native PHP driver didn't support sqlsrv_num_rows, or cursor based seeking so we recall all rows into an array * Prior to version 1.1 the SQL Server Native PHP driver didn't support sqlsrv_num_rows, or cursor based seeking so we recall all rows into an array
* and maintain our own cursor index into that array. * and maintain our own cursor index into that array.
@ -193,21 +191,23 @@ class result_mssqlnative
/** /**
* @package dbal * @package dbal
*/ */
class dbal_mssqlnative extends dbal class phpbb_db_driver_mssqlnative extends phpbb_db_driver
{ {
var $m_insert_id = NULL; var $m_insert_id = NULL;
var $last_query_text = ''; var $last_query_text = '';
var $query_options = array(); var $query_options = array();
var $connect_error = '';
/** /**
* Connect to server * Connect to server
*/ */
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{ {
# Test for driver support, to avoid suppressed fatal error // Test for driver support, to avoid suppressed fatal error
if (!function_exists('sqlsrv_connect')) if (!function_exists('sqlsrv_connect'))
{ {
trigger_error('Native MS SQL Server driver for PHP is missing or needs to be updated. Version 1.1 or later is required to install phpBB3. You can download the driver from: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx\n', E_USER_ERROR); $this->connect_error = 'Native MS SQL Server driver for PHP is missing or needs to be updated. Version 1.1 or later is required to install phpBB3. You can download the driver from: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx';
return $this->sql_error('');
} }
//set up connection variables //set up connection variables
@ -311,7 +311,7 @@ class dbal_mssqlnative extends dbal
global $cache; global $cache;
// EXPLAIN only in extra debug mode // EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('start', $query); $this->sql_report('start', $query);
} }
@ -329,7 +329,7 @@ class dbal_mssqlnative extends dbal
// reset options for next query // reset options for next query
$this->query_options = array(); $this->query_options = array();
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('stop', $query); $this->sql_report('stop', $query);
} }
@ -344,7 +344,7 @@ class dbal_mssqlnative extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
} }
} }
else if (defined('DEBUG_EXTRA')) else if (defined('DEBUG'))
{ {
$this->sql_report('fromcache', $query); $this->sql_report('fromcache', $query);
} }
@ -521,31 +521,43 @@ class dbal_mssqlnative extends dbal
*/ */
function _sql_error() function _sql_error()
{ {
$errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS); if (function_exists('sqlsrv_errors'))
$error_message = '';
$code = 0;
if ($errors != null)
{ {
foreach ($errors as $error) $errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS);
$error_message = '';
$code = 0;
if ($errors != null)
{ {
$error_message .= "SQLSTATE: ".$error[ 'SQLSTATE']."\n"; foreach ($errors as $error)
$error_message .= "code: ".$error[ 'code']."\n"; {
$code = $error['code']; $error_message .= "SQLSTATE: " . $error[ 'SQLSTATE'] . "\n";
$error_message .= "message: ".$error[ 'message']."\n"; $error_message .= "code: " . $error[ 'code'] . "\n";
$code = $error['code'];
$error_message .= "message: " . $error[ 'message'] . "\n";
}
$this->last_error_result = $error_message;
$error = $this->last_error_result;
} }
$this->last_error_result = $error_message; else
$error = $this->last_error_result; {
$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
}
$error = array(
'message' => $error,
'code' => $code,
);
} }
else else
{ {
$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); $error = array(
'message' => $this->connect_error,
'code' => '',
);
} }
return array( return $error;
'message' => $error,
'code' => $code,
);
} }
/** /**

View file

@ -15,8 +15,6 @@ if (!defined('IN_PHPBB'))
exit; exit;
} }
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/** /**
* MySQL4 Database Abstraction Layer * MySQL4 Database Abstraction Layer
* Compatible with: * Compatible with:
@ -26,9 +24,10 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
* MySQL 5.0+ * MySQL 5.0+
* @package dbal * @package dbal
*/ */
class dbal_mysql extends dbal class phpbb_db_driver_mysql extends phpbb_db_driver
{ {
var $multi_insert = true; var $multi_insert = true;
var $connect_error = '';
/** /**
* Connect to server * Connect to server
@ -43,7 +42,24 @@ class dbal_mysql extends dbal
$this->sql_layer = 'mysql4'; $this->sql_layer = 'mysql4';
$this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link); if ($this->persistency)
{
if (!function_exists('mysql_pconnect'))
{
$this->connect_error = 'mysql_pconnect function does not exist, is mysql extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @mysql_pconnect($this->server, $this->user, $sqlpassword);
}
else
{
if (!function_exists('mysql_connect'))
{
$this->connect_error = 'mysql_connect function does not exist, is mysql extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
}
if ($this->db_connect_id && $this->dbname != '') if ($this->db_connect_id && $this->dbname != '')
{ {
@ -167,7 +183,7 @@ class dbal_mysql extends dbal
global $cache; global $cache;
// EXPLAIN only in extra debug mode // EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('start', $query); $this->sql_report('start', $query);
} }
@ -182,7 +198,7 @@ class dbal_mysql extends dbal
$this->sql_error($query); $this->sql_error($query);
} }
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('stop', $query); $this->sql_report('stop', $query);
} }
@ -197,7 +213,7 @@ class dbal_mysql extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
} }
} }
else if (defined('DEBUG_EXTRA')) else if (defined('DEBUG'))
{ {
$this->sql_report('fromcache', $query); $this->sql_report('fromcache', $query);
} }
@ -426,18 +442,29 @@ class dbal_mysql extends dbal
*/ */
function _sql_error() function _sql_error()
{ {
if (!$this->db_connect_id) if ($this->db_connect_id)
{ {
return array( $error = array(
'message' => @mysql_error($this->db_connect_id),
'code' => @mysql_errno($this->db_connect_id),
);
}
else if (function_exists('mysql_error'))
{
$error = array(
'message' => @mysql_error(), 'message' => @mysql_error(),
'code' => @mysql_errno() 'code' => @mysql_errno(),
);
}
else
{
$error = array(
'message' => $this->connect_error,
'code' => '',
); );
} }
return array( return $error;
'message' => @mysql_error($this->db_connect_id),
'code' => @mysql_errno($this->db_connect_id)
);
} }
/** /**

View file

@ -15,23 +15,28 @@ if (!defined('IN_PHPBB'))
exit; exit;
} }
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/** /**
* MySQLi Database Abstraction Layer * MySQLi Database Abstraction Layer
* mysqli-extension has to be compiled with: * mysqli-extension has to be compiled with:
* MySQL 4.1+ or MySQL 5.0+ * MySQL 4.1+ or MySQL 5.0+
* @package dbal * @package dbal
*/ */
class dbal_mysqli extends dbal class phpbb_db_driver_mysqli extends phpbb_db_driver
{ {
var $multi_insert = true; var $multi_insert = true;
var $connect_error = '';
/** /**
* Connect to server * Connect to server
*/ */
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false) function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
{ {
if (!function_exists('mysqli_connect'))
{
$this->connect_error = 'mysqli_connect function does not exist, is mysqli extension installed?';
return $this->sql_error('');
}
// Mysqli extension supports persistent connection since PHP 5.3.0 // Mysqli extension supports persistent connection since PHP 5.3.0
$this->persistency = (version_compare(PHP_VERSION, '5.3.0', '>=')) ? $persistency : false; $this->persistency = (version_compare(PHP_VERSION, '5.3.0', '>=')) ? $persistency : false;
$this->user = $sqluser; $this->user = $sqluser;
@ -174,7 +179,7 @@ class dbal_mysqli extends dbal
global $cache; global $cache;
// EXPLAIN only in extra debug mode // EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('start', $query); $this->sql_report('start', $query);
} }
@ -189,7 +194,7 @@ class dbal_mysqli extends dbal
$this->sql_error($query); $this->sql_error($query);
} }
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('stop', $query); $this->sql_report('stop', $query);
} }
@ -199,7 +204,7 @@ class dbal_mysqli extends dbal
$this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl); $this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl);
} }
} }
else if (defined('DEBUG_EXTRA')) else if (defined('DEBUG'))
{ {
$this->sql_report('fromcache', $query); $this->sql_report('fromcache', $query);
} }
@ -423,18 +428,29 @@ class dbal_mysqli extends dbal
*/ */
function _sql_error() function _sql_error()
{ {
if (!$this->db_connect_id) if ($this->db_connect_id)
{ {
return array( $error = array(
'message' => @mysqli_error($this->db_connect_id),
'code' => @mysqli_errno($this->db_connect_id)
);
}
else if (function_exists('mysqli_connect_error'))
{
$error = array(
'message' => @mysqli_connect_error(), 'message' => @mysqli_connect_error(),
'code' => @mysqli_connect_errno() 'code' => @mysqli_connect_errno(),
);
}
else
{
$error = array(
'message' => $this->connect_error,
'code' => '',
); );
} }
return array( return $error;
'message' => @mysqli_error($this->db_connect_id),
'code' => @mysqli_errno($this->db_connect_id)
);
} }
/** /**

View file

@ -15,15 +15,14 @@ if (!defined('IN_PHPBB'))
exit; exit;
} }
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/** /**
* Oracle Database Abstraction Layer * Oracle Database Abstraction Layer
* @package dbal * @package dbal
*/ */
class dbal_oracle extends dbal class phpbb_db_driver_oracle extends phpbb_db_driver
{ {
var $last_query_text = ''; var $last_query_text = '';
var $connect_error = '';
/** /**
* Connect to server * Connect to server
@ -47,7 +46,33 @@ class dbal_oracle extends dbal
$connect = $sqlserver . (($port) ? ':' . $port : '') . '/' . $database; $connect = $sqlserver . (($port) ? ':' . $port : '') . '/' . $database;
} }
$this->db_connect_id = ($new_link) ? @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8') : (($this->persistency) ? @ociplogon($this->user, $sqlpassword, $connect, 'UTF8') : @ocilogon($this->user, $sqlpassword, $connect, 'UTF8')); if ($new_link)
{
if (!function_exists('ocinlogon'))
{
$this->connect_error = 'ocinlogon function does not exist, is oci extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8');
}
else if ($this->persistency)
{
if (!function_exists('ociplogon'))
{
$this->connect_error = 'ociplogon function does not exist, is oci extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @ociplogon($this->user, $sqlpassword, $connect, 'UTF8');
}
else
{
if (!function_exists('ocilogon'))
{
$this->connect_error = 'ocilogon function does not exist, is oci extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @ocilogon($this->user, $sqlpassword, $connect, 'UTF8');
}
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
} }
@ -236,7 +261,7 @@ class dbal_oracle extends dbal
global $cache; global $cache;
// EXPLAIN only in extra debug mode // EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('start', $query); $this->sql_report('start', $query);
} }
@ -413,7 +438,7 @@ class dbal_oracle extends dbal
} }
} }
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('stop', $query); $this->sql_report('stop', $query);
} }
@ -428,7 +453,7 @@ class dbal_oracle extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
} }
} }
else if (defined('DEBUG_EXTRA')) else if (defined('DEBUG'))
{ {
$this->sql_report('fromcache', $query); $this->sql_report('fromcache', $query);
} }
@ -646,17 +671,27 @@ class dbal_oracle extends dbal
*/ */
function _sql_error() function _sql_error()
{ {
$error = @ocierror(); if (function_exists('ocierror'))
$error = (!$error) ? @ocierror($this->query_result) : $error;
$error = (!$error) ? @ocierror($this->db_connect_id) : $error;
if ($error)
{ {
$this->last_error_result = $error; $error = @ocierror();
$error = (!$error) ? @ocierror($this->query_result) : $error;
$error = (!$error) ? @ocierror($this->db_connect_id) : $error;
if ($error)
{
$this->last_error_result = $error;
}
else
{
$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
}
} }
else else
{ {
$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); $error = array(
'message' => $this->connect_error,
'code' => '',
);
} }
return $error; return $error;

View file

@ -15,19 +15,12 @@ if (!defined('IN_PHPBB'))
exit; exit;
} }
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
if (!class_exists('phpbb_error_collector'))
{
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
}
/** /**
* PostgreSQL Database Abstraction Layer * PostgreSQL Database Abstraction Layer
* Minimum Requirement is Version 7.3+ * Minimum Requirement is Version 7.3+
* @package dbal * @package dbal
*/ */
class dbal_postgres extends dbal class phpbb_db_driver_postgres extends phpbb_db_driver
{ {
var $last_query_text = ''; var $last_query_text = '';
var $connect_error = ''; var $connect_error = '';
@ -194,7 +187,7 @@ class dbal_postgres extends dbal
global $cache; global $cache;
// EXPLAIN only in extra debug mode // EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('start', $query); $this->sql_report('start', $query);
} }
@ -210,7 +203,7 @@ class dbal_postgres extends dbal
$this->sql_error($query); $this->sql_error($query);
} }
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('stop', $query); $this->sql_report('stop', $query);
} }
@ -225,7 +218,7 @@ class dbal_postgres extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
} }
} }
else if (defined('DEBUG_EXTRA')) else if (defined('DEBUG'))
{ {
$this->sql_report('fromcache', $query); $this->sql_report('fromcache', $query);
} }

View file

@ -15,15 +15,15 @@ if (!defined('IN_PHPBB'))
exit; exit;
} }
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/** /**
* Sqlite Database Abstraction Layer * Sqlite Database Abstraction Layer
* Minimum Requirement: 2.8.2+ * Minimum Requirement: 2.8.2+
* @package dbal * @package dbal
*/ */
class dbal_sqlite extends dbal class phpbb_db_driver_sqlite extends phpbb_db_driver
{ {
var $connect_error = '';
/** /**
* Connect to server * Connect to server
*/ */
@ -35,7 +35,24 @@ class dbal_sqlite extends dbal
$this->dbname = $database; $this->dbname = $database;
$error = ''; $error = '';
$this->db_connect_id = ($this->persistency) ? @sqlite_popen($this->server, 0666, $error) : @sqlite_open($this->server, 0666, $error); if ($this->persistency)
{
if (!function_exists('sqlite_popen'))
{
$this->connect_error = 'sqlite_popen function does not exist, is sqlite extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @sqlite_popen($this->server, 0666, $error);
}
else
{
if (!function_exists('sqlite_open'))
{
$this->connect_error = 'sqlite_open function does not exist, is sqlite extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @sqlite_open($this->server, 0666, $error);
}
if ($this->db_connect_id) if ($this->db_connect_id)
{ {
@ -112,7 +129,7 @@ class dbal_sqlite extends dbal
global $cache; global $cache;
// EXPLAIN only in extra debug mode // EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('start', $query); $this->sql_report('start', $query);
} }
@ -127,7 +144,7 @@ class dbal_sqlite extends dbal
$this->sql_error($query); $this->sql_error($query);
} }
if (defined('DEBUG_EXTRA')) if (defined('DEBUG'))
{ {
$this->sql_report('stop', $query); $this->sql_report('stop', $query);
} }
@ -142,7 +159,7 @@ class dbal_sqlite extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
} }
} }
else if (defined('DEBUG_EXTRA')) else if (defined('DEBUG'))
{ {
$this->sql_report('fromcache', $query); $this->sql_report('fromcache', $query);
} }
@ -280,10 +297,22 @@ class dbal_sqlite extends dbal
*/ */
function _sql_error() function _sql_error()
{ {
return array( if (function_exists('sqlite_error_string'))
'message' => @sqlite_error_string(@sqlite_last_error($this->db_connect_id)), {
'code' => @sqlite_last_error($this->db_connect_id) $error = array(
); 'message' => @sqlite_error_string(@sqlite_last_error($this->db_connect_id)),
'code' => @sqlite_last_error($this->db_connect_id),
);
}
else
{
$error = array(
'message' => $this->connect_error,
'code' => '',
);
}
return $error;
} }
/** /**

View file

@ -0,0 +1,83 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\Config\FileLocator;
/**
* Container config extension
*/
class phpbb_di_extension_config extends Extension
{
public function __construct($config_file)
{
$this->config_file = $config_file;
}
/**
* Loads a specific configuration.
*
* @param array $config An array of configuration values
* @param ContainerBuilder $container A ContainerBuilder instance
*
* @throws InvalidArgumentException When provided tag is not defined in this extension
*/
public function load(array $config, ContainerBuilder $container)
{
require($this->config_file);
$container->setParameter('core.table_prefix', $table_prefix);
$container->setParameter('cache.driver.class', $this->convert_30_acm_type($acm_type));
$container->setParameter('dbal.driver.class', phpbb_convert_30_dbms_to_31($dbms));
$container->setParameter('dbal.dbhost', $dbhost);
$container->setParameter('dbal.dbuser', $dbuser);
$container->setParameter('dbal.dbpasswd', $dbpasswd);
$container->setParameter('dbal.dbname', $dbname);
$container->setParameter('dbal.dbport', $dbport);
$container->setParameter('dbal.new_link', defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK);
}
/**
* Returns the recommended alias to use in XML.
*
* This alias is also the mandatory prefix to use when using YAML.
*
* @return string The alias
*/
public function getAlias()
{
return 'config';
}
/**
* Convert 3.0 ACM type to 3.1 cache driver class name
*
* @param string $acm_type ACM type
* @return cache driver class
*/
protected function convert_30_acm_type($acm_type)
{
if (preg_match('#^[a-z]+$#', $acm_type))
{
return 'phpbb_cache_driver_'.$acm_type;
}
return $acm_type;
}
}

View file

@ -0,0 +1,69 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
/**
* Container core extension
*/
class phpbb_di_extension_core extends Extension
{
/**
* phpBB Root path
* @var string
*/
protected $root_path;
/**
* Constructor
*
* @param string $root_path Root path
*/
public function __construct($root_path)
{
$this->root_path = $root_path;
}
/**
* Loads a specific configuration.
*
* @param array $config An array of configuration values
* @param ContainerBuilder $container A ContainerBuilder instance
*
* @throws InvalidArgumentException When provided tag is not defined in this extension
*/
public function load(array $config, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->root_path . 'config')));
$loader->load('services.yml');
}
/**
* Returns the recommended alias to use in XML.
*
* This alias is also the mandatory prefix to use when using YAML.
*
* @return string The alias
*/
public function getAlias()
{
return 'core';
}
}

View file

@ -0,0 +1,69 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
/**
* Container ext extension
*/
class phpbb_di_extension_ext extends Extension
{
protected $paths = array();
public function __construct($enabled_extensions)
{
foreach ($enabled_extensions as $ext => $path)
{
$this->paths[] = $path;
}
}
/**
* Loads a specific configuration.
*
* @param array $config An array of configuration values
* @param ContainerBuilder $container A ContainerBuilder instance
*
* @throws InvalidArgumentException When provided tag is not defined in this extension
*/
public function load(array $config, ContainerBuilder $container)
{
foreach ($this->paths as $path)
{
if (file_exists($path . '/config/services.yml'))
{
$loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($path . '/config')));
$loader->load('services.yml');
}
}
}
/**
* Returns the recommended alias to use in XML.
*
* This alias is also the mandatory prefix to use when using YAML.
*
* @return string The alias
*/
public function getAlias()
{
return 'ext';
}
}

View file

@ -0,0 +1,46 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Appends an add method call to the definition of each collection service for
* the services tagged with the appropriate name defined in the collection's
* service_collection tag.
*/
class phpbb_di_pass_collection_pass implements CompilerPassInterface
{
/**
* Modify the container before it is passed to the rest of the code
*
* @param ContainerBuilder $container ContainerBuilder object
* @return null
*/
public function process(ContainerBuilder $container)
{
foreach ($container->findTaggedServiceIds('service_collection') as $id => $data)
{
$definition = $container->getDefinition($id);
foreach ($container->findTaggedServiceIds($data[0]['tag']) as $service_id => $service_data)
{
$definition->addMethodCall('add', array($service_id));
}
}
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
class phpbb_di_pass_kernel_pass implements CompilerPassInterface
{
/**
* Modify the container before it is passed to the rest of the code
*
* @param ContainerBuilder $container ContainerBuilder object
* @return null
*/
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('dispatcher');
foreach ($container->findTaggedServiceIds('kernel.event_listener') as $id => $events)
{
foreach ($events as $event)
{
$priority = isset($event['priority']) ? $event['priority'] : 0;
if (!isset($event['event']))
{
throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "event" attribute on "kernel.event_listener" tags.', $id));
}
if (!isset($event['method']))
{
throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "method" attribute on "kernel.event_listener" tags.', $id));
}
$definition->addMethodCall('addListenerService', array($event['event'], array($id, $event['method']), $priority));
}
}
foreach ($container->findTaggedServiceIds('kernel.event_subscriber') as $id => $attributes)
{
// We must assume that the class value has been correctly filled, even if the service is created by a factory
$class = $container->getDefinition($id)->getClass();
$refClass = new ReflectionClass($class);
$interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
if (!$refClass->implementsInterface($interface))
{
throw new InvalidArgumentException(sprintf('Service "%1$s" must implement interface "%2$s".', $id, $interface));
}
$definition->addMethodCall('addSubscriberService', array($id, $class));
}
}
}

View file

@ -1,76 +0,0 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Configure the container for phpBB's services though
* user-defined parameters defined in the config.php file.
*/
class phpbb_di_processor_config implements phpbb_di_processor_interface
{
private $config_file;
private $phpbb_root_path;
private $php_ext;
/**
* Constructor.
*
* @param string $config_file The config file
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
*/
public function __construct($config_file, $phpbb_root_path, $php_ext)
{
$this->config_file = $config_file;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
}
/**
* @inheritdoc
*/
public function process(ContainerBuilder $container)
{
require $this->config_file;
$container->setParameter('core.root_path', $this->phpbb_root_path);
$container->setParameter('core.php_ext', $this->php_ext);
$container->setParameter('core.table_prefix', $table_prefix);
$container->setParameter('cache.driver.class', $this->fix_acm_type($acm_type));
$container->setParameter('dbal.driver.class', 'dbal_'.$dbms);
$container->setParameter('dbal.dbhost', $dbhost);
$container->setParameter('dbal.dbuser', $dbuser);
$container->setParameter('dbal.dbpasswd', $dbpasswd);
$container->setParameter('dbal.dbname', $dbname);
$container->setParameter('dbal.dbport', $dbport);
$container->setParameter('dbal.new_link', defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK);
$container->set('container', $container);
}
protected function fix_acm_type($acm_type)
{
if (preg_match('#^[a-z]+$#', $acm_type))
{
return 'phpbb_cache_driver_'.$acm_type;
}
return $acm_type;
}
}

View file

@ -1,54 +0,0 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
/**
* Load the service configurations from all extensions into the container.
*/
class phpbb_di_processor_ext implements phpbb_di_processor_interface
{
private $extension_manager;
/**
* Constructor.
*
* @param string $extension_manager The extension manager
*/
public function __construct($extension_manager)
{
$this->extension_manager = $extension_manager;
}
/**
* @inheritdoc
*/
public function process(ContainerBuilder $container)
{
$enabled_exts = $this->extension_manager->all_enabled();
foreach ($enabled_exts as $name => $path)
{
if (file_exists($path . '/config/services.yml'))
{
$loader = new YamlFileLoader($container, new FileLocator($path . '/config'));
$loader->load('services.yml');
}
}
}
}

View file

@ -1,28 +0,0 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder;
interface phpbb_di_processor_interface
{
/**
* Mutate the container.
*
* @param ContainerBuilder $container The container
*/
public function process(ContainerBuilder $container);
}

View file

@ -0,0 +1,49 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Collection of services to be configured at container compile time.
*
* @package phpBB3
*/
class phpbb_di_service_collection extends ArrayObject
{
/**
* Constructor
*
* @param ContainerInterface $container Container object
*/
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
/**
* Add a service to the collection
*
* @param string $name The service name
* @return null
*/
public function add($name)
{
$task = $this->container->get($name);
$this->offsetSet($name, $task);
}
}

View file

@ -15,7 +15,7 @@ if (!defined('IN_PHPBB'))
exit; exit;
} }
use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
/** /**
* Extension of the Symfony2 EventDispatcher * Extension of the Symfony2 EventDispatcher
@ -31,7 +31,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
* extract($phpbb_dispatcher->trigger_event('core.index', compact($vars))); * extract($phpbb_dispatcher->trigger_event('core.index', compact($vars)));
* *
*/ */
class phpbb_event_dispatcher extends EventDispatcher class phpbb_event_dispatcher extends ContainerAwareEventDispatcher
{ {
public function trigger_event($eventName, $data = array()) public function trigger_event($eventName, $data = array())
{ {

View file

@ -0,0 +1,85 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpFoundation\Response;
class phpbb_event_kernel_exception_subscriber implements EventSubscriberInterface
{
/**
* Template object
* @var phpbb_template
*/
protected $template;
/**
* User object
* @var phpbb_user
*/
protected $user;
/**
* Construct method
*
* @param phpbb_template $template Template object
* @param phpbb_user $user User object
*/
public function __construct(phpbb_template $template, phpbb_user $user)
{
$this->template = $template;
$this->user = $user;
}
/**
* This listener is run when the KernelEvents::EXCEPTION event is triggered
*
* @param GetResponseForExceptionEvent $event
* @return null
*/
public function on_kernel_exception(GetResponseForExceptionEvent $event)
{
page_header($this->user->lang('INFORMATION'));
$exception = $event->getException();
$this->template->assign_vars(array(
'MESSAGE_TITLE' => $this->user->lang('INFORMATION'),
'MESSAGE_TEXT' => $exception->getMessage(),
));
$this->template->set_filenames(array(
'body' => 'message_body.html',
));
page_footer(true, false, false);
$status_code = $exception instanceof HttpException ? $exception->getStatusCode() : 500;
$response = new Response($this->template->assign_display('body'), $status_code);
$event->setResponse($response);
}
public static function getSubscribedEvents()
{
return array(
KernelEvents::EXCEPTION => 'on_kernel_exception',
);
}
}

View file

@ -0,0 +1,83 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\EventListener\RouterListener;
use Symfony\Component\Routing\RequestContext;
class phpbb_event_kernel_request_subscriber implements EventSubscriberInterface
{
/**
* Extension finder object
* @var phpbb_extension_finder
*/
protected $finder;
/**
* PHP extension
* @var string
*/
protected $php_ext;
/**
* Root path
* @var string
*/
protected $root_path;
/**
* Construct method
*
* @param phpbb_extension_finder $finder Extension finder object
* @param string $root_path Root path
* @param string $php_ext PHP extension
*/
public function __construct(phpbb_extension_finder $finder, $root_path, $php_ext)
{
$this->finder = $finder;
$this->root_path = $root_path;
$this->php_ext = $php_ext;
}
/**
* This listener is run when the KernelEvents::REQUEST event is triggered
*
* This is responsible for setting up the routing information
*
* @param GetResponseEvent $event
* @return null
*/
public function on_kernel_request(GetResponseEvent $event)
{
$request = $event->getRequest();
$context = new RequestContext();
$context->fromRequest($request);
$matcher = phpbb_get_url_matcher($this->finder, $context, $this->root_path, $this->php_ext);
$router_listener = new RouterListener($matcher, $context);
$router_listener->onKernelRequest($event);
}
public static function getSubscribedEvents()
{
return array(
KernelEvents::REQUEST => 'on_kernel_request',
);
}
}

View file

@ -0,0 +1,43 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
class phpbb_event_kernel_terminate_subscriber implements EventSubscriberInterface
{
/**
* This listener is run when the KernelEvents::TERMINATE event is triggered
* This comes after a Response has been sent to the server; this is
* primarily cleanup stuff.
*
* @param PostResponseEvent $event
* @return null
*/
public function on_kernel_terminate(PostResponseEvent $event)
{
exit_handler();
}
public static function getSubscribedEvents()
{
return array(
KernelEvents::TERMINATE => 'on_kernel_terminate',
);
}
}

View file

@ -1,84 +0,0 @@
<?php
/**
*
* @package extension
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Abstract class extended by extension front controller classes
*
* @package extension
*/
abstract class phpbb_extension_controller implements phpbb_extension_controller_interface
{
/**
* Request class object
* @var phpbb_request
*/
protected $request;
/**
* DBAL class object
* @var dbal
*/
protected $db;
/**
* User class object
* @var phpbb_user
*/
protected $user;
/**
* Template class object
* @var phpbb_template
*/
protected $template;
/**
* Config object
* @var phpbb_config
*/
protected $config;
/**
* PHP Extension
* @var string
*/
protected $php_ext;
/**
* Relative path to board root
* @var string
*/
protected $phpbb_root_path;
/**
* Constructor method that provides the common phpBB objects as inherited class
* properties for automatic availability in extension controllers
*/
public function __construct()
{
global $request, $db, $user, $template, $config;
global $phpEx, $phpbb_root_path;
$this->request = $request;
$this->db = $db;
$this->user = $user;
$this->template = $template;
$this->config = $config;
$this->php_ext = $phpEx;
$this->phpbb_root_path = $phpbb_root_path;
}
}

View file

@ -1,31 +0,0 @@
<?php
/**
*
* @package extension
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* The interface that extension classes have to implement to run front pages
*
* @package extension
*/
interface phpbb_extension_controller_interface
{
/**
* Handle the request to display a page from an extension
*
* @return null
*/
public function handle();
}

View file

@ -34,7 +34,7 @@ class phpbb_extension_manager
/** /**
* Creates a manager and loads information from database * Creates a manager and loads information from database
* *
* @param dbal $db A database connection * @param phpbb_db_driver $db A database connection
* @param phpbb_config $config phpbb_config * @param phpbb_config $config phpbb_config
* @param string $extension_table The name of the table holding extensions * @param string $extension_table The name of the table holding extensions
* @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $phpbb_root_path Path to the phpbb includes directory.
@ -42,7 +42,7 @@ class phpbb_extension_manager
* @param phpbb_cache_driver_interface $cache A cache instance or null * @param phpbb_cache_driver_interface $cache A cache instance or null
* @param string $cache_name The name of the cache variable, defaults to _ext * @param string $cache_name The name of the cache variable, defaults to _ext
*/ */
public function __construct(dbal $db, phpbb_config $config, $extension_table, $phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext') public function __construct(phpbb_db_driver $db, phpbb_config $config, $extension_table, $phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
{ {
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->db = $db; $this->db = $db;
@ -195,7 +195,7 @@ class phpbb_extension_manager
if ($this->cache) if ($this->cache)
{ {
$this->cache->destroy($this->cache_name); $this->cache->purge();
} }
return !$active; return !$active;
@ -252,7 +252,7 @@ class phpbb_extension_manager
if ($this->cache) if ($this->cache)
{ {
$this->cache->destroy($this->cache_name); $this->cache->purge();
} }
return true; return true;
@ -272,7 +272,7 @@ class phpbb_extension_manager
if ($this->cache) if ($this->cache)
{ {
$this->cache->destroy($this->cache_name); $this->cache->purge();
} }
return false; return false;
@ -335,7 +335,7 @@ class phpbb_extension_manager
if ($this->cache) if ($this->cache)
{ {
$this->cache->destroy($this->cache_name); $this->cache->purge();
} }
return true; return true;
@ -349,7 +349,7 @@ class phpbb_extension_manager
if ($this->cache) if ($this->cache)
{ {
$this->cache->destroy($this->cache_name); $this->cache->purge();
} }
return false; return false;

View file

@ -34,12 +34,12 @@ class phpbb_extension_metadata_manager
/** /**
* Creates the metadata manager * Creates the metadata manager
* *
* @param dbal $db A database connection * @param phpbb_db_driver $db A database connection
* @param string $extension_manager An instance of the phpbb extension manager * @param string $extension_manager An instance of the phpbb extension manager
* @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $phpEx php file extension * @param string $phpEx php file extension
*/ */
public function __construct($ext_name, dbal $db, phpbb_extension_manager $extension_manager, $phpbb_root_path, $phpEx = '.php', phpbb_template $template, phpbb_config $config) public function __construct($ext_name, phpbb_db_driver $db, phpbb_extension_manager $extension_manager, $phpbb_root_path, $phpEx = '.php', phpbb_template $template, phpbb_config $config)
{ {
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->db = $db; $this->db = $db;

View file

@ -7,6 +7,8 @@
* *
*/ */
use Symfony\Component\HttpFoundation\Request;
/** /**
* @ignore * @ignore
*/ */
@ -229,7 +231,8 @@ function phpbb_gmgetdate($time = false)
/** /**
* Return formatted string for filesizes * Return formatted string for filesizes
* *
* @param int $value filesize in bytes * @param mixed $value filesize in bytes
* (non-negative number; int, float or string)
* @param bool $string_only true if language string should be returned * @param bool $string_only true if language string should be returned
* @param array $allowed_units only allow these units (data array indexes) * @param array $allowed_units only allow these units (data array indexes)
* *
@ -241,6 +244,12 @@ function get_formatted_filesize($value, $string_only = true, $allowed_units = fa
global $user; global $user;
$available_units = array( $available_units = array(
'tb' => array(
'min' => 1099511627776, // pow(2, 40)
'index' => 4,
'si_unit' => 'TB',
'iec_unit' => 'TIB',
),
'gb' => array( 'gb' => array(
'min' => 1073741824, // pow(2, 30) 'min' => 1073741824, // pow(2, 30)
'index' => 3, 'index' => 3,
@ -2848,12 +2857,10 @@ function meta_refresh($time, $url, $disable_cd_check = false)
* *
* @param int $code HTTP status code * @param int $code HTTP status code
* @param string $message Message for the status code * @param string $message Message for the status code
* @return void * @return null
*/ */
function send_status_line($code, $message) function send_status_line($code, $message)
{ {
global $request;
if (substr(strtolower(@php_sapi_name()), 0, 3) === 'cgi') if (substr(strtolower(@php_sapi_name()), 0, 3) === 'cgi')
{ {
// in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though
@ -2861,18 +2868,35 @@ function send_status_line($code, $message)
} }
else else
{ {
if ($request->server('SERVER_PROTOCOL')) $version = phpbb_request_http_version();
{
$version = $request->server('SERVER_PROTOCOL');
}
else
{
$version = 'HTTP/1.0';
}
header("$version $code $message", true, $code); header("$version $code $message", true, $code);
} }
} }
/**
* Returns the HTTP version used in the current request.
*
* Handles the case of being called before $request is present,
* in which case it falls back to the $_SERVER superglobal.
*
* @return string HTTP version
*/
function phpbb_request_http_version()
{
global $request;
if ($request && $request->server('SERVER_PROTOCOL'))
{
return $request->server('SERVER_PROTOCOL');
}
else if (isset($_SERVER['SERVER_PROTOCOL']))
{
return $_SERVER['SERVER_PROTOCOL'];
}
return 'HTTP/1.0';
}
//Form validation //Form validation
@ -4192,12 +4216,12 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
$log_text .= '<br /><br />BACKTRACE<br />' . $backtrace; $log_text .= '<br /><br />BACKTRACE<br />' . $backtrace;
} }
if (defined('IN_INSTALL') || defined('DEBUG_EXTRA') || isset($auth) && $auth->acl_get('a_')) if (defined('IN_INSTALL') || defined('DEBUG') || isset($auth) && $auth->acl_get('a_'))
{ {
$msg_text = $log_text; $msg_text = $log_text;
} }
if ((defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db)) if ((defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db))
{ {
// let's avoid loops // let's avoid loops
$db->sql_return_on_error(true); $db->sql_return_on_error(true);
@ -4772,7 +4796,7 @@ function phpbb_get_plural_form($rule, $number)
* *
* @param array $param Parameter array, see $param_defaults array. * @param array $param Parameter array, see $param_defaults array.
* *
* @return void * @return null
*/ */
function phpbb_http_login($param) function phpbb_http_login($param)
{ {
@ -4870,13 +4894,108 @@ function phpbb_http_login($param)
trigger_error('NOT_AUTHORISED'); trigger_error('NOT_AUTHORISED');
} }
/**
* Escapes and quotes a string for use as an HTML/XML attribute value.
*
* This is a port of Python xml.sax.saxutils quoteattr.
*
* The function will attempt to choose a quote character in such a way as to
* avoid escaping quotes in the string. If this is not possible the string will
* be wrapped in double quotes and double quotes will be escaped.
*
* @param string $data The string to be escaped
* @param array $entities Associative array of additional entities to be escaped
* @return string Escaped and quoted string
*/
function phpbb_quoteattr($data, $entities = null)
{
$data = str_replace('&', '&amp;', $data);
$data = str_replace('>', '&gt;', $data);
$data = str_replace('<', '&lt;', $data);
$data = str_replace("\n", '&#10;', $data);
$data = str_replace("\r", '&#13;', $data);
$data = str_replace("\t", '&#9;', $data);
if (!empty($entities))
{
$data = str_replace(array_keys($entities), array_values($entities), $data);
}
if (strpos($data, '"') !== false)
{
if (strpos($data, "'") !== false)
{
$data = '"' . str_replace('"', '&quot;', $data) . '"';
}
else
{
$data = "'" . $data . "'";
}
}
else
{
$data = '"' . $data . '"';
}
return $data;
}
/**
* Converts query string (GET) parameters in request into hidden fields.
*
* Useful for forwarding GET parameters when submitting forms with GET method.
*
* It is possible to omit some of the GET parameters, which is useful if
* they are specified in the form being submitted.
*
* sid is always omitted.
*
* @param phpbb_request $request Request object
* @param array $exclude A list of variable names that should not be forwarded
* @return string HTML with hidden fields
*/
function phpbb_build_hidden_fields_for_query_params($request, $exclude = null)
{
$names = $request->variable_names(phpbb_request_interface::GET);
$hidden = '';
foreach ($names as $name)
{
// Sessions are dealt with elsewhere, omit sid always
if ($name == 'sid')
{
continue;
}
// Omit any additional parameters requested
if (!empty($exclude) && in_array($name, $exclude))
{
continue;
}
$escaped_name = phpbb_quoteattr($name);
// Note: we might retrieve the variable from POST or cookies
// here. To avoid exposing cookies, skip variables that are
// overwritten somewhere other than GET entirely.
$value = $request->variable($name, '', true);
$get_value = $request->variable($name, '', true, phpbb_request_interface::GET);
if ($value === $get_value)
{
$escaped_value = phpbb_quoteattr($value);
$hidden .= "<input type='hidden' name=$escaped_name value=$escaped_value />";
}
}
return $hidden;
}
/** /**
* Generate page header * Generate page header
*/ */
function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum') function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum')
{ {
global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path; global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path;
global $phpbb_dispatcher; global $phpbb_dispatcher, $request;
if (defined('HEADER_INC')) if (defined('HEADER_INC'))
{ {
@ -5065,6 +5184,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
$timezone_name = $user->lang['timezones'][$timezone_name]; $timezone_name = $user->lang['timezones'][$timezone_name];
} }
$hidden_fields_for_jumpbox = phpbb_build_hidden_fields_for_query_params($request, array('f'));
// The following assigns all _common_ variables that may be used at any point in a template. // The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array( $template->assign_vars(array(
'SITENAME' => $config['sitename'], 'SITENAME' => $config['sitename'],
@ -5079,6 +5200,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'RECORD_USERS' => $l_online_record, 'RECORD_USERS' => $l_online_record,
'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text, 'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text,
'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread, 'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
'HIDDEN_FIELDS_FOR_JUMPBOX' => $hidden_fields_for_jumpbox,
'S_USER_NEW_PRIVMSG' => $user->data['user_new_privmsg'], 'S_USER_NEW_PRIVMSG' => $user->data['user_new_privmsg'],
'S_USER_UNREAD_PRIVMSG' => $user->data['user_unread_privmsg'], 'S_USER_UNREAD_PRIVMSG' => $user->data['user_unread_privmsg'],
@ -5210,8 +5332,12 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
/** /**
* Generate page footer * Generate page footer
*
* @param bool $run_cron Whether or not to run the cron
* @param bool $display_template Whether or not to display the template
* @param bool $exit_handler Whether or not to run the exit_handler()
*/ */
function page_footer($run_cron = true) function page_footer($run_cron = true, $display_template = true, $exit_handler = true)
{ {
global $db, $config, $template, $user, $auth, $cache, $starttime, $phpbb_root_path, $phpEx; global $db, $config, $template, $user, $auth, $cache, $starttime, $phpbb_root_path, $phpEx;
global $request, $phpbb_dispatcher; global $request, $phpbb_dispatcher;
@ -5242,14 +5368,14 @@ function page_footer($run_cron = true)
$mtime = explode(' ', microtime()); $mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime; $totaltime = $mtime[0] + $mtime[1] - $starttime;
if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report')) if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG') && method_exists($db, 'sql_report'))
{ {
$db->sql_report('display'); $db->sql_report('display');
} }
$debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress'] && @extension_loaded('zlib')) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress'] && @extension_loaded('zlib')) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime);
if ($auth->acl_get('a_') && defined('DEBUG_EXTRA')) if ($auth->acl_get('a_') && defined('DEBUG'))
{ {
if (function_exists('memory_get_peak_usage')) if (function_exists('memory_get_peak_usage'))
{ {
@ -5306,10 +5432,17 @@ function page_footer($run_cron = true)
} }
} }
$template->display('body'); if ($display_template)
{
$template->display('body');
}
garbage_collection(); garbage_collection();
exit_handler();
if ($exit_handler)
{
exit_handler();
}
} }
/** /**
@ -5327,7 +5460,10 @@ function garbage_collection()
* @event core.garbage_collection * @event core.garbage_collection
* @since 3.1-A1 * @since 3.1-A1
*/ */
$phpbb_dispatcher->dispatch('core.garbage_collection'); if (!empty($phpbb_dispatcher))
{
$phpbb_dispatcher->dispatch('core.garbage_collection');
}
// Unload cache, must be done before the DB connection if closed // Unload cache, must be done before the DB connection if closed
if (!empty($cache)) if (!empty($cache))
@ -5413,3 +5549,95 @@ function phpbb_to_numeric($input)
{ {
return ($input > PHP_INT_MAX) ? (float) $input : (int) $input; return ($input > PHP_INT_MAX) ? (float) $input : (int) $input;
} }
/**
* Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name.
*
* If $dbms is a valid 3.1 db driver class name, returns it unchanged.
* Otherwise prepends phpbb_db_driver_ to the dbms to convert a 3.0 dbms
* to 3.1 db driver class name.
*
* @param string $dbms dbms parameter
* @return db driver class
*/
function phpbb_convert_30_dbms_to_31($dbms)
{
// Note: this check is done first because mysqli extension
// supplies a mysqli class, and class_exists($dbms) would return
// true for mysqli class.
// However, per the docblock any valid 3.1 driver name should be
// recognized by this function, and have priority over 3.0 dbms.
if (class_exists('phpbb_db_driver_' . $dbms))
{
return 'phpbb_db_driver_' . $dbms;
}
if (class_exists($dbms))
{
// Additionally we could check that $dbms extends phpbb_db_driver.
// http://php.net/manual/en/class.reflectionclass.php
// Beware of possible performance issues:
// http://stackoverflow.com/questions/294582/php-5-reflection-api-performance
// We could check for interface implementation in all paths or
// only when we do not prepend phpbb_db_driver_.
/*
$reflection = new \ReflectionClass($dbms);
if ($reflection->isSubclassOf('phpbb_db_driver'))
{
return $dbms;
}
*/
return $dbms;
}
throw new \RuntimeException("You have specified an invalid dbms driver: $dbms");
}
/**
* Create a Symfony Request object from phpbb_request object
*
* @param phpbb_request $request Request object
* @return Request A Symfony Request object
*/
function phpbb_create_symfony_request(phpbb_request $request)
{
// This function is meant to sanitize the global input arrays
$sanitizer = function(&$value, $key) {
$type_cast_helper = new phpbb_request_type_cast_helper();
$type_cast_helper->set_var($value, $value, gettype($value), true);
};
// We need to re-enable the super globals so we can access them here
$request->enable_super_globals();
$get_parameters = $_GET;
$post_parameters = $_POST;
$server_parameters = $_SERVER;
$files_parameters = $_FILES;
$cookie_parameters = $_COOKIE;
// And now disable them again for security
$request->disable_super_globals();
array_walk_recursive($get_parameters, $sanitizer);
array_walk_recursive($post_parameters, $sanitizer);
// Until we fix the issue with relative paths, we have to fake path info
// to allow urls like app.php?controller=foo/bar
$controller = $request->variable('controller', '');
$path_info = '/' . $controller;
$request_uri = $server_parameters['REQUEST_URI'];
// Remove the query string from REQUEST_URI
if ($pos = strpos($request_uri, '?'))
{
$request_uri = substr($request_uri, 0, $pos);
}
// Add the path info (i.e. controller route) to the REQUEST_URI
$server_parameters['REQUEST_URI'] = $request_uri . $path_info;
$server_parameters['SCRIPT_NAME'] = '';
return new Request($get_parameters, $post_parameters, array(), $cookie_parameters, $files_parameters, $server_parameters);
}

View file

@ -145,14 +145,14 @@ function adm_page_footer($copyright_html = true)
$mtime = explode(' ', microtime()); $mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime; $totaltime = $mtime[0] + $mtime[1] - $starttime;
if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report')) if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG') && method_exists($db, 'sql_report'))
{ {
$db->sql_report('display'); $db->sql_report('display');
} }
$debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress']) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress']) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime);
if ($auth->acl_get('a_') && defined('DEBUG_EXTRA')) if ($auth->acl_get('a_') && defined('DEBUG'))
{ {
if (function_exists('memory_get_peak_usage')) if (function_exists('memory_get_peak_usage'))
{ {

View file

@ -3342,7 +3342,7 @@ function obtain_latest_version_info($force_update = false, $warn_fail = false, $
* @param int $flag The binary flag which is OR-ed with the current column value * @param int $flag The binary flag which is OR-ed with the current column value
* @param string $sql_more This string is attached to the sql query generated to update the table. * @param string $sql_more This string is attached to the sql query generated to update the table.
* *
* @return void * @return null
*/ */
function enable_bitfield_column_flag($table_name, $column_name, $flag, $sql_more = '') function enable_bitfield_column_flag($table_name, $column_name, $flag, $sql_more = '')
{ {

View file

@ -0,0 +1,142 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Create the ContainerBuilder object
*
* @param array $extensions Array of Container extension objects
* @param string $phpbb_root_path Root path
* @param string $php_ext PHP Extension
* @return ContainerBuilder object
*/
function phpbb_create_container(array $extensions, $phpbb_root_path, $php_ext)
{
$container = new ContainerBuilder();
foreach ($extensions as $extension)
{
$container->registerExtension($extension);
$container->loadFromExtension($extension->getAlias());
}
$container->setParameter('core.root_path', $phpbb_root_path);
$container->setParameter('core.php_ext', $php_ext);
return $container;
}
/**
* Create installer container
*
* @param string $phpbb_root_path Root path
* @param string $php_ext PHP Extension
* @return ContainerBuilder object
*/
function phpbb_create_install_container($phpbb_root_path, $php_ext)
{
$core = new phpbb_di_extension_core($phpbb_root_path);
$container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext);
$container->setParameter('core.root_path', $phpbb_root_path);
$container->setParameter('core.php_ext', $php_ext);
$container->setParameter('core.table_prefix', '');
$container->register('dbal.conn')->setSynthetic(true);
$container->setAlias('cache.driver', 'cache.driver.install');
$container->compile();
return $container;
}
/**
* Create a compiled ContainerBuilder object
*
* @param array $extensions Array of Container extension objects
* @param array $passes Array of Compiler Pass objects
* @param string $phpbb_root_path Root path
* @param string $php_ext PHP Extension
* @return ContainerBuilder object (compiled)
*/
function phpbb_create_compiled_container(array $extensions, array $passes, $phpbb_root_path, $php_ext)
{
// Create a temporary container for access to the ext.manager service
$tmp_container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext);
$tmp_container->compile();
// XXX stop writing to global $cache when
// http://tracker.phpbb.com/browse/PHPBB3-11203 is fixed
$GLOBALS['cache'] = $tmp_container->get('cache');
$installed_exts = $tmp_container->get('ext.manager')->all_enabled();
// Now pass the enabled extension paths into the ext compiler extension
$extensions[] = new phpbb_di_extension_ext($installed_exts);
// Create the final container to be compiled and cached
$container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext);
// Compile the container
foreach ($passes as $pass)
{
$container->addCompilerPass($pass);
}
$container->compile();
return $container;
}
function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_root_path, $php_ext)
{
// Check for our cached container; if it exists, use it
$container_filename = phpbb_container_filename($phpbb_root_path, $php_ext);
if (file_exists($container_filename))
{
require($container_filename);
return new phpbb_cache_container();
}
$container = phpbb_create_compiled_container($extensions, $passes, $phpbb_root_path, $php_ext);
// Lastly, we create our cached container class
$dumper = new PhpDumper($container);
$cached_container_dump = $dumper->dump(array(
'class' => 'phpbb_cache_container',
'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder',
));
file_put_contents($container_filename, $cached_container_dump);
return $container;
}
function phpbb_create_dumped_container_unless_debug(array $extensions, array $passes, $phpbb_root_path, $php_ext)
{
$container_factory = defined('DEBUG') ? 'phpbb_create_compiled_container' : 'phpbb_create_dumped_container';
return $container_factory($extensions, $passes, $phpbb_root_path, $php_ext);
}
function phpbb_container_filename($phpbb_root_path, $php_ext)
{
$filename = str_replace(array('/', '.'), array('slash', 'dot'), $phpbb_root_path);
return $phpbb_root_path . 'cache/container_' . $filename . '.' . $php_ext;
}

View file

@ -0,0 +1,206 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Updates rows in given table from a set of values to a new value.
* If this results in rows violating uniqueness constraints, the duplicate
* rows are eliminated.
*
* The only supported table is bookmarks.
*
* @param phpbb_db_driver $db Database object
* @param string $table Table on which to perform the update
* @param string $column Column whose values to change
* @param array $from_values An array of values that should be changed
* @param int $to_value The new value
* @return null
*/
function phpbb_update_rows_avoiding_duplicates(phpbb_db_driver $db, $table, $column, $from_values, $to_value)
{
$sql = "SELECT $column, user_id
FROM $table
WHERE " . $db->sql_in_set($column, $from_values);
$result = $db->sql_query($sql);
$old_user_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$old_user_ids[$row[$column]][] = (int) $row['user_id'];
}
$db->sql_freeresult($result);
$sql = "SELECT $column, user_id
FROM $table
WHERE $column = " . (int) $to_value;
$result = $db->sql_query($sql);
$new_user_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$new_user_ids[$row[$column]][] = (int) $row['user_id'];
}
$db->sql_freeresult($result);
$queries = array();
foreach ($from_values as $from_value)
{
if (!isset($old_user_ids[$from_value]))
{
continue;
}
if (empty($new_user_ids))
{
$sql = "UPDATE $table
SET $column = " . (int) $to_value . "
WHERE $column = '" . $db->sql_escape($from_value) . "'";
$queries[] = $sql;
}
else
{
$different_user_ids = array_diff($old_user_ids[$from_value], $new_user_ids[$to_value]);
if (!empty($different_user_ids))
{
$sql = "UPDATE $table
SET $column = " . (int) $to_value . "
WHERE $column = '" . $db->sql_escape($from_value) . "'
AND " . $db->sql_in_set('user_id', $different_user_ids);
$queries[] = $sql;
}
}
}
if (!empty($queries))
{
$db->sql_transaction('begin');
foreach ($queries as $sql)
{
$db->sql_query($sql);
}
$sql = "DELETE FROM $table
WHERE " . $db->sql_in_set($column, $from_values);
$db->sql_query($sql);
$db->sql_transaction('commit');
}
}
/**
* Updates rows in given table from a set of values to a new value.
* If this results in rows violating uniqueness constraints, the duplicate
* rows are merged respecting notify_status (0 takes precedence over 1).
*
* The only supported table is topics_watch.
*
* @param phpbb_db_driver $db Database object
* @param string $table Table on which to perform the update
* @param string $column Column whose values to change
* @param array $from_values An array of values that should be changed
* @param int $to_value The new value
* @return null
*/
function phpbb_update_rows_avoiding_duplicates_notify_status(phpbb_db_driver $db, $table, $column, $from_values, $to_value)
{
$sql = "SELECT $column, user_id, notify_status
FROM $table
WHERE " . $db->sql_in_set($column, $from_values);
$result = $db->sql_query($sql);
$old_user_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$old_user_ids[(int) $row['notify_status']][$row[$column]][] = (int) $row['user_id'];
}
$db->sql_freeresult($result);
$sql = "SELECT $column, user_id
FROM $table
WHERE $column = " . (int) $to_value;
$result = $db->sql_query($sql);
$new_user_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$new_user_ids[$row[$column]][] = (int) $row['user_id'];
}
$db->sql_freeresult($result);
$queries = array();
$extra_updates = array(
0 => 'notify_status = 0',
1 => '',
);
foreach ($from_values as $from_value)
{
foreach ($extra_updates as $notify_status => $extra_update)
{
if (!isset($old_user_ids[$notify_status][$from_value]))
{
continue;
}
if (empty($new_user_ids))
{
$sql = "UPDATE $table
SET $column = " . (int) $to_value . "
WHERE $column = '" . $db->sql_escape($from_value) . "'";
$queries[] = $sql;
}
else
{
$different_user_ids = array_diff($old_user_ids[$notify_status][$from_value], $new_user_ids[$to_value]);
if (!empty($different_user_ids))
{
$sql = "UPDATE $table
SET $column = " . (int) $to_value . "
WHERE $column = '" . $db->sql_escape($from_value) . "'
AND " . $db->sql_in_set('user_id', $different_user_ids);
$queries[] = $sql;
}
if ($extra_update)
{
$same_user_ids = array_diff($old_user_ids[$notify_status][$from_value], $different_user_ids);
if (!empty($same_user_ids))
{
$sql = "UPDATE $table
SET $extra_update
WHERE $column = '" . (int) $to_value . "'
AND " . $db->sql_in_set('user_id', $same_user_ids);
$queries[] = $sql;
}
}
}
}
}
if (!empty($queries))
{
$db->sql_transaction('begin');
foreach ($queries as $sql)
{
$db->sql_query($sql);
}
$sql = "DELETE FROM $table
WHERE " . $db->sql_in_set($column, $from_values);
$db->sql_query($sql);
$db->sql_transaction('commit');
}
}

View file

@ -61,6 +61,20 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
{ {
markread('all', false, false, request_var('mark_time', 0)); markread('all', false, false, request_var('mark_time', 0));
if ($request->is_ajax())
{
// Tell the ajax script what language vars and URL need to be replaced
$data = array(
'NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'],
'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'],
'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums&mark_time=' . time()) : '',
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED']
);
$json_response = new phpbb_json_response();
$json_response->send($data);
}
trigger_error( trigger_error(
$user->lang['FORUMS_MARKED'] . '<br /><br />' . $user->lang['FORUMS_MARKED'] . '<br /><br />' .
sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect . '">', '</a>') sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect . '">', '</a>')
@ -314,6 +328,20 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>'); $message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>');
meta_refresh(3, $redirect); meta_refresh(3, $redirect);
if ($request->is_ajax())
{
// Tell the ajax script what language vars and URL need to be replaced
$data = array(
'NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'],
'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'],
'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . '&f=' . $root_data['forum_id'] . '&mark=forums&mark_time=' . time()) : '',
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED']
);
$json_response = new phpbb_json_response();
$json_response->send($data);
}
trigger_error($user->lang['FORUMS_MARKED'] . '<br /><br />' . $message); trigger_error($user->lang['FORUMS_MARKED'] . '<br /><br />' . $message);
} }
else else

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