Merge branch 'develop' of github.com:marc1706/phpbb3 into feature/avatars

This commit is contained in:
Marc Alexander 2012-12-24 14:34:10 +01:00
commit c9338b38b3
144 changed files with 4213 additions and 2301 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

@ -2,9 +2,9 @@
<project name="phpBB" description="The phpBB forum software" default="all" basedir="../"> <project name="phpBB" description="The phpBB forum software" default="all" basedir="../">
<!-- a few settings for the build --> <!-- a few settings for the build -->
<property name="newversion" value="3.0.11" /> <property name="newversion" value="3.1.0-dev" />
<property name="prevversion" value="3.0.10" /> <property name="prevversion" value="3.0.11" />
<property name="olderversions" value="3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.7-PL1, 3.0.8, 3.0.9, 3.0.11-RC1, 3.0.11-RC2" /> <property name="olderversions" value="3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.7-PL1, 3.0.8, 3.0.9, 3.0.10" />
<!-- no configuration should be needed beyond this point --> <!-- no configuration should be needed beyond this point -->
<property name="oldversions" value="${olderversions}, ${prevversion}" /> <property name="oldversions" value="${olderversions}, ${prevversion}" />

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>

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

@ -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')

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

@ -71,7 +71,6 @@ require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
require($phpbb_root_path . 'includes/functions_container.' . $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

View file

@ -195,6 +195,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

@ -72,6 +72,7 @@
<ol style="list-style-type: lower-roman;"> <ol style="list-style-type: lower-roman;">
<li><a href="#templates">General Templating</a></li> <li><a href="#templates">General Templating</a></li>
<li><a href="#stylestree">Styles Tree</a></li> <li><a href="#stylestree">Styles Tree</a></li>
<li><a href="#template-events">Template Events</a></li>
</ol></li> </ol></li>
<li><a href="#charsets">Character Sets and Encodings</a></li> <li><a href="#charsets">Character Sets and Encodings</a></li>
<li><a href="#translation">Translation (<abbr title="Internationalisation">i18n</abbr>/<abbr title="Localisation">L10n</abbr>) Guidelines</a> <li><a href="#translation">Translation (<abbr title="Internationalisation">i18n</abbr>/<abbr title="Localisation">L10n</abbr>) Guidelines</a>
@ -1678,6 +1679,57 @@ version = 3.1.0
parent = prosilver parent = prosilver
</pre></div> </pre></div>
<a name="template-events"></a><h3>4.iii. Template Events</h3>
<p>Template events must follow this format: <code>&lt;!-- EVENT event_name --&gt;</code></p>
<p>Using the above example, files named <code>event_name.html</code> located within extensions will be injected into the location of the event.</p>
<h4>Template event naming guidelines:</h4>
<ul>
<li>An event name must be all lowercase, with each word separated by an underscore.</li>
<li>An event name must briefly describe the location and purpose of the event.</li>
<li>An event name must end with one of the following suffixes:</li>
<ul>
<li><code>_prepend</code> - This event adds an item to the beginning of a block of related items, or adds to the beginning of individual items in a block.</li>
<li><code>_append</code> - This event adds an item to the end of a block of related items, or adds to the end of individual items in a block.</li>
<li><code>_before</code> - This event adds content directly before the specified block</li>
<li><code>_after</code> - This event adds content directly after the specified block</li>
</ul>
</ul>
<h4>Template event documentation</h4>
<p>Events must be documented in <code>phpBB/docs/events.md</code> in alphabetical order based on the event name. The format is as follows:</p>
<ul><li>An event found in only one template file:
<div class="codebox"><pre>event_name
===
* Location: styles/&lt;style_name&gt;/template/filename.html
* Purpose: A brief description of what this event should be used for.
This may span multiple lines.
</pre></div></li>
<li>An event found in multiple template files:
<div class="codebox"><pre>event_name
===
* Locations:
+ first/file/path.html
+ second/file/path.html
* Purpose: Same as above.
</pre></div>
<li>An event that is found multiple times in a file should have the number of instances in parenthesis next to the filename.
<div class="codebox"><pre>event_name
===
* Locations:
+ first/file/path.html (2)
+ second/file/path.html
* Purpose: Same as above.
</pre></div></li>
<li>An actual example event documentation:
<div class="codebox"><pre>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.</pre></div></ul><br />
</div> </div>
<div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div>

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

@ -10,21 +10,36 @@ source source_phpbb_{SPHINX_ID}_main
sql_query_pre = UPDATE phpbb_sphinx SET max_doc_id = MAX(post_id) WHERE counter_id = 1 sql_query_pre = UPDATE phpbb_sphinx SET max_doc_id = MAX(post_id) WHERE counter_id = 1
sql_query_range = SELECT MIN(post_id), MAX(post_id) FROM phpbb_posts sql_query_range = SELECT MIN(post_id), MAX(post_id) FROM phpbb_posts
sql_range_step = 5000 sql_range_step = 5000
sql_query = SELECT \ sql_query = SELECT
p.post_id AS id, \ \
p.forum_id, \ p.post_id AS id,
p.topic_id, \ \
p.poster_id, \ p.forum_id,
CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post, \ \
p.post_time, \ p.topic_id,
p.post_subject, \ \
p.post_subject as title, \ p.poster_id,
p.post_text as data, \ \
t.topic_last_post_time, \ CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post,
0 as deleted \ \
FROM phpbb_posts p, phpbb_topics t \ p.post_time,
WHERE \ \
p.topic_id = t.topic_id \ p.post_subject,
\
p.post_subject as title,
\
p.post_text as data,
\
t.topic_last_post_time,
\
0 as deleted
\
FROM phpbb_posts p, phpbb_topics t
\
WHERE
\
p.topic_id = t.topic_id
\
AND p.post_id >= $start AND p.post_id <= $end AND p.post_id >= $start AND p.post_id <= $end
sql_query_post = sql_query_post =
sql_query_post_index = UPDATE phpbb_sphinx SET max_doc_id = $maxid WHERE counter_id = 1 sql_query_post_index = UPDATE phpbb_sphinx SET max_doc_id = $maxid WHERE counter_id = 1
@ -42,21 +57,36 @@ source source_phpbb_{SPHINX_ID}_delta : source_phpbb_{SPHINX_ID}_main
{ {
sql_query_range = sql_query_range =
sql_range_step = sql_range_step =
sql_query = SELECT \ sql_query = SELECT
p.post_id AS id, \ \
p.forum_id, \ p.post_id AS id,
p.topic_id, \ \
p.poster_id, \ p.forum_id,
CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post, \ \
p.post_time, \ p.topic_id,
p.post_subject, \ \
p.post_subject as title, \ p.poster_id,
p.post_text as data, \ \
t.topic_last_post_time, \ CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post,
0 as deleted \ \
FROM phpbb_posts p, phpbb_topics t \ p.post_time,
WHERE \ \
p.topic_id = t.topic_id \ p.post_subject,
\
p.post_subject as title,
\
p.post_text as data,
\
t.topic_last_post_time,
\
0 as deleted
\
FROM phpbb_posts p, phpbb_topics t
\
WHERE
\
p.topic_id = t.topic_id
\
AND p.post_id >= ( SELECT max_doc_id FROM phpbb_sphinx WHERE counter_id=1 ) AND p.post_id >= ( SELECT max_doc_id FROM phpbb_sphinx WHERE counter_id=1 )
sql_query_pre = sql_query_pre =
} }

View file

@ -43,7 +43,6 @@ 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/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_container.' . $phpEx);

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

@ -367,12 +367,10 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
} }
/** /**
* Save sql query * {@inheritDoc}
*/ */
function sql_save($query, $query_result, $ttl) function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl)
{ {
global $db;
// Remove extra spaces and tabs // Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query); $query = preg_replace('/[\n\r\s\t]+/', ' ', $query);

View file

@ -85,6 +85,7 @@ interface phpbb_cache_driver_interface
* result to persistent storage. In other words, there is no need * result to persistent storage. In other words, there is no need
* to call save() afterwards. * to call save() afterwards.
* *
* @param phpbb_db_driver $db Database connection
* @param string $query SQL query, should be used for generating storage key * @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 * @param mixed $query_result The result from dbal::sql_query, to be passed to
* dbal::sql_fetchrow to get all rows and store them * dbal::sql_fetchrow to get all rows and store them
@ -95,7 +96,7 @@ interface phpbb_cache_driver_interface
* representing the query should be returned. Otherwise * representing the query should be returned. Otherwise
* the original $query_result should be returned. * the original $query_result should be returned.
*/ */
public function sql_save($query, $query_result, $ttl); public function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl);
/** /**
* Check if result for a given SQL query exists in cache. * Check if result for a given SQL query exists in cache.

View file

@ -283,12 +283,10 @@ abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
} }
/** /**
* Save sql query * {@inheritDoc}
*/ */
function sql_save($query, $query_result, $ttl) function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl)
{ {
global $db;
// Remove extra spaces and tabs // Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query); $query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$hash = md5($query); $hash = md5($query);

View file

@ -105,9 +105,9 @@ class phpbb_cache_driver_null extends phpbb_cache_driver_base
} }
/** /**
* Save sql query * {@inheritDoc}
*/ */
function sql_save($query, $query_result, $ttl) function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl)
{ {
return $query_result; return $query_result;
} }

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;

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;

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;

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;

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) . '%';
@ -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;
@ -272,7 +270,7 @@ class dbal_firebird extends dbal
if ($cache_ttl) if ($cache_ttl)
{ {
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl); $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
} }
else if (strpos($query, 'SELECT') === 0 && $this->query_result) else if (strpos($query, 'SELECT') === 0 && $this->query_result)
{ {

View file

@ -15,14 +15,12 @@ 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 = ''; var $connect_error = '';
@ -170,7 +168,7 @@ class dbal_mssql extends dbal
if ($cache_ttl) if ($cache_ttl)
{ {
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl); $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
} }
else if (strpos($query, 'SELECT') === 0 && $this->query_result) else if (strpos($query, 'SELECT') === 0 && $this->query_result)
{ {

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,7 +26,7 @@ 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 = ''; var $connect_error = '';
@ -199,7 +197,7 @@ class dbal_mssql_odbc extends dbal
if ($cache_ttl) if ($cache_ttl)
{ {
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl); $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
} }
else if (strpos($query, 'SELECT') === 0 && $this->query_result) else if (strpos($query, 'SELECT') === 0 && $this->query_result)
{ {

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,7 +191,7 @@ 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 = '';
@ -339,7 +337,7 @@ class dbal_mssqlnative extends dbal
if ($cache_ttl) if ($cache_ttl)
{ {
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl); $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
} }
else if (strpos($query, 'SELECT') === 0 && $this->query_result) else if (strpos($query, 'SELECT') === 0 && $this->query_result)
{ {

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,7 +24,7 @@ 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 = ''; var $connect_error = '';
@ -208,7 +206,7 @@ class dbal_mysql extends dbal
if ($cache_ttl) if ($cache_ttl)
{ {
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl); $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
} }
else if (strpos($query, 'SELECT') === 0 && $this->query_result) else if (strpos($query, 'SELECT') === 0 && $this->query_result)
{ {

View file

@ -15,15 +15,13 @@ 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 = ''; var $connect_error = '';
@ -203,7 +201,7 @@ class dbal_mysqli extends dbal
if ($cache_ttl) if ($cache_ttl)
{ {
$this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl); $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
} }
} }
else if (defined('DEBUG')) else if (defined('DEBUG'))

View file

@ -15,13 +15,11 @@ 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 = ''; var $connect_error = '';
@ -448,7 +446,7 @@ class dbal_oracle extends dbal
if ($cache_ttl) if ($cache_ttl)
{ {
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl); $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
} }
else if (strpos($query, 'SELECT') === 0 && $this->query_result) else if (strpos($query, 'SELECT') === 0 && $this->query_result)
{ {

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 = '';
@ -218,7 +211,7 @@ class dbal_postgres extends dbal
if ($cache_ttl) if ($cache_ttl)
{ {
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl); $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
} }
else if (strpos($query, 'SELECT') === 0 && $this->query_result) else if (strpos($query, 'SELECT') === 0 && $this->query_result)
{ {

View file

@ -15,14 +15,12 @@ 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 = ''; var $connect_error = '';
@ -154,7 +152,7 @@ class dbal_sqlite extends dbal
if ($cache_ttl) if ($cache_ttl)
{ {
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl); $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
} }
else if (strpos($query, 'SELECT') === 0 && $this->query_result) else if (strpos($query, 'SELECT') === 0 && $this->query_result)
{ {

View file

@ -43,8 +43,8 @@ class phpbb_di_extension_config extends Extension
require($this->config_file); require($this->config_file);
$container->setParameter('core.table_prefix', $table_prefix); $container->setParameter('core.table_prefix', $table_prefix);
$container->setParameter('cache.driver.class', $this->fix_acm_type($acm_type)); $container->setParameter('cache.driver.class', $this->convert_30_acm_type($acm_type));
$container->setParameter('dbal.driver.class', 'dbal_'.$dbms); $container->setParameter('dbal.driver.class', phpbb_convert_30_dbms_to_31($dbms));
$container->setParameter('dbal.dbhost', $dbhost); $container->setParameter('dbal.dbhost', $dbhost);
$container->setParameter('dbal.dbuser', $dbuser); $container->setParameter('dbal.dbuser', $dbuser);
$container->setParameter('dbal.dbpasswd', $dbpasswd); $container->setParameter('dbal.dbpasswd', $dbpasswd);
@ -66,12 +66,12 @@ class phpbb_di_extension_config extends Extension
} }
/** /**
* Convert old (3.0) values to 3.1 class names * Convert 3.0 ACM type to 3.1 cache driver class name
* *
* @param style $acm_type ACM type * @param string $acm_type ACM type
* @return ACM type class * @return cache driver class
*/ */
protected function fix_acm_type($acm_type) protected function convert_30_acm_type($acm_type)
{ {
if (preg_match('#^[a-z]+$#', $acm_type)) if (preg_match('#^[a-z]+$#', $acm_type))
{ {

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;

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

@ -5549,6 +5549,52 @@ 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 * Create a Symfony Request object from phpbb_request object
* *

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>')
@ -313,6 +327,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

View file

@ -596,7 +596,7 @@ function phpbb_parse_range_request($request_array, $filesize)
/** /**
* Increments the download count of all provided attachments * Increments the download count of all provided attachments
* *
* @param dbal $db The database object * @param phpbb_db_driver $db The database object
* @param array|int $ids The attach_id of each attachment * @param array|int $ids The attach_id of each attachment
* *
* @return null * @return null
@ -617,7 +617,7 @@ function phpbb_increment_downloads($db, $ids)
/** /**
* Handles authentication when downloading attachments from a post or topic * Handles authentication when downloading attachments from a post or topic
* *
* @param dbal $db The database object * @param phpbb_db_driver $db The database object
* @param phpbb_auth $auth The authentication object * @param phpbb_auth $auth The authentication object
* @param int $topic_id The id of the topic that we are downloading from * @param int $topic_id The id of the topic that we are downloading from
* *
@ -651,7 +651,7 @@ function phpbb_download_handle_forum_auth($db, $auth, $topic_id)
/** /**
* Handles authentication when downloading attachments from PMs * Handles authentication when downloading attachments from PMs
* *
* @param dbal $db The database object * @param phpbb_db_driver $db The database object
* @param phpbb_auth $auth The authentication object * @param phpbb_auth $auth The authentication object
* @param int $user_id The user id * @param int $user_id The user id
* @param int $msg_id The id of the PM that we are downloading from * @param int $msg_id The id of the PM that we are downloading from
@ -678,7 +678,7 @@ function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id)
/** /**
* Checks whether a user can download from a particular PM * Checks whether a user can download from a particular PM
* *
* @param dbal $db The database object * @param phpbb_db_driver $db The database object
* @param int $user_id The user id * @param int $user_id The user id
* @param int $msg_id The id of the PM that we are downloading from * @param int $msg_id The id of the PM that we are downloading from
* *

View file

@ -28,7 +28,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'firebird', 'SCHEMA' => 'firebird',
'MODULE' => 'interbase', 'MODULE' => 'interbase',
'DELIM' => ';;', 'DELIM' => ';;',
'DRIVER' => 'firebird', 'DRIVER' => 'phpbb_db_driver_firebird',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => false, '2.0.x' => false,
), ),
@ -37,7 +37,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mysql_41', 'SCHEMA' => 'mysql_41',
'MODULE' => 'mysqli', 'MODULE' => 'mysqli',
'DELIM' => ';', 'DELIM' => ';',
'DRIVER' => 'mysqli', 'DRIVER' => 'phpbb_db_driver_mysqli',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => true, '2.0.x' => true,
), ),
@ -46,7 +46,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mysql', 'SCHEMA' => 'mysql',
'MODULE' => 'mysql', 'MODULE' => 'mysql',
'DELIM' => ';', 'DELIM' => ';',
'DRIVER' => 'mysql', 'DRIVER' => 'phpbb_db_driver_mysql',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => true, '2.0.x' => true,
), ),
@ -55,7 +55,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql', 'SCHEMA' => 'mssql',
'MODULE' => 'mssql', 'MODULE' => 'mssql',
'DELIM' => 'GO', 'DELIM' => 'GO',
'DRIVER' => 'mssql', 'DRIVER' => 'phpbb_db_driver_mssql',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => true, '2.0.x' => true,
), ),
@ -64,7 +64,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql', 'SCHEMA' => 'mssql',
'MODULE' => 'odbc', 'MODULE' => 'odbc',
'DELIM' => 'GO', 'DELIM' => 'GO',
'DRIVER' => 'mssql_odbc', 'DRIVER' => 'phpbb_db_driver_mssql_odbc',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => true, '2.0.x' => true,
), ),
@ -73,7 +73,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql', 'SCHEMA' => 'mssql',
'MODULE' => 'sqlsrv', 'MODULE' => 'sqlsrv',
'DELIM' => 'GO', 'DELIM' => 'GO',
'DRIVER' => 'mssqlnative', 'DRIVER' => 'phpbb_db_driver_mssqlnative',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => false, '2.0.x' => false,
), ),
@ -82,7 +82,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'oracle', 'SCHEMA' => 'oracle',
'MODULE' => 'oci8', 'MODULE' => 'oci8',
'DELIM' => '/', 'DELIM' => '/',
'DRIVER' => 'oracle', 'DRIVER' => 'phpbb_db_driver_oracle',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => false, '2.0.x' => false,
), ),
@ -91,7 +91,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'postgres', 'SCHEMA' => 'postgres',
'MODULE' => 'pgsql', 'MODULE' => 'pgsql',
'DELIM' => ';', 'DELIM' => ';',
'DRIVER' => 'postgres', 'DRIVER' => 'phpbb_db_driver_postgres',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => true, '2.0.x' => true,
), ),
@ -100,7 +100,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'sqlite', 'SCHEMA' => 'sqlite',
'MODULE' => 'sqlite', 'MODULE' => 'sqlite',
'DELIM' => ';', 'DELIM' => ';',
'DRIVER' => 'sqlite', 'DRIVER' => 'phpbb_db_driver_sqlite',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => false, '2.0.x' => false,
), ),
@ -205,26 +205,19 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
$dbms = $dbms_details['DRIVER']; $dbms = $dbms_details['DRIVER'];
if ($load_dbal)
{
// Include the DB layer
include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
}
// Instantiate it and set return on error true // Instantiate it and set return on error true
$sql_db = 'dbal_' . $dbms; $db = new $dbms();
$db = new $sql_db();
$db->sql_return_on_error(true); $db->sql_return_on_error(true);
// Check that we actually have a database name before going any further..... // Check that we actually have a database name before going any further.....
if ($dbms_details['DRIVER'] != 'sqlite' && $dbms_details['DRIVER'] != 'oracle' && $dbname === '') if ($dbms_details['DRIVER'] != 'phpbb_db_driver_sqlite' && $dbms_details['DRIVER'] != 'phpbb_db_driver_oracle' && $dbname === '')
{ {
$error[] = $lang['INST_ERR_DB_NO_NAME']; $error[] = $lang['INST_ERR_DB_NO_NAME'];
return false; return false;
} }
// Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea
if ($dbms_details['DRIVER'] == 'sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0) if ($dbms_details['DRIVER'] == 'phpbb_db_driver_sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0)
{ {
$error[] = $lang['INST_ERR_DB_FORUM_PATH']; $error[] = $lang['INST_ERR_DB_FORUM_PATH'];
return false; return false;
@ -233,8 +226,8 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
// Check the prefix length to ensure that index names are not too long and does not contain invalid characters // Check the prefix length to ensure that index names are not too long and does not contain invalid characters
switch ($dbms_details['DRIVER']) switch ($dbms_details['DRIVER'])
{ {
case 'mysql': case 'phpbb_db_driver_mysql':
case 'mysqli': case 'phpbb_db_driver_mysqli':
if (strspn($table_prefix, '-./\\') !== 0) if (strspn($table_prefix, '-./\\') !== 0)
{ {
$error[] = $lang['INST_ERR_PREFIX_INVALID']; $error[] = $lang['INST_ERR_PREFIX_INVALID'];
@ -243,22 +236,22 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
// no break; // no break;
case 'postgres': case 'phpbb_db_driver_postgres':
$prefix_length = 36; $prefix_length = 36;
break; break;
case 'mssql': case 'phpbb_db_driver_mssql':
case 'mssql_odbc': case 'phpbb_db_driver_mssql_odbc':
case 'mssqlnative': case 'phpbb_db_driver_mssqlnative':
$prefix_length = 90; $prefix_length = 90;
break; break;
case 'sqlite': case 'phpbb_db_driver_sqlite':
$prefix_length = 200; $prefix_length = 200;
break; break;
case 'firebird': case 'phpbb_db_driver_firebird':
case 'oracle': case 'phpbb_db_driver_oracle':
$prefix_length = 6; $prefix_length = 6;
break; break;
} }
@ -296,21 +289,21 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
// Make sure that the user has selected a sensible DBAL for the DBMS actually installed // Make sure that the user has selected a sensible DBAL for the DBMS actually installed
switch ($dbms_details['DRIVER']) switch ($dbms_details['DRIVER'])
{ {
case 'mysqli': case 'phpbb_db_driver_mysqli':
if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<')) if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<'))
{ {
$error[] = $lang['INST_ERR_DB_NO_MYSQLI']; $error[] = $lang['INST_ERR_DB_NO_MYSQLI'];
} }
break; break;
case 'sqlite': case 'phpbb_db_driver_sqlite':
if (version_compare(sqlite_libversion(), '2.8.2', '<')) if (version_compare(sqlite_libversion(), '2.8.2', '<'))
{ {
$error[] = $lang['INST_ERR_DB_NO_SQLITE']; $error[] = $lang['INST_ERR_DB_NO_SQLITE'];
} }
break; break;
case 'firebird': case 'phpbb_db_driver_firebird':
// check the version of FB, use some hackery if we can't get access to the server info // check the version of FB, use some hackery if we can't get access to the server info
if ($db->service_handle !== false && function_exists('ibase_server_info')) if ($db->service_handle !== false && function_exists('ibase_server_info'))
{ {
@ -391,7 +384,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
} }
break; break;
case 'oracle': case 'phpbb_db_driver_oracle':
if ($unicode_check) if ($unicode_check)
{ {
$sql = "SELECT * $sql = "SELECT *
@ -413,7 +406,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
} }
break; break;
case 'postgres': case 'phpbb_db_driver_postgres':
if ($unicode_check) if ($unicode_check)
{ {
$sql = "SHOW server_encoding;"; $sql = "SHOW server_encoding;";

View file

@ -210,7 +210,7 @@ class messenger
{ {
$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());
$tpl = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context()); $tpl = 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, $tpl); $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $tpl);
$this->tpl_msg[$template_lang . $template_file] = $tpl; $this->tpl_msg[$template_lang . $template_file] = $tpl;
@ -231,7 +231,7 @@ class messenger
} }
} }
$style->set_custom_style($template_lang . '_email', array($template_path, $fallback_template_path), ''); $style->set_custom_style($template_lang . '_email', array($template_path, $fallback_template_path), array(), '');
$tpl->set_filenames(array( $tpl->set_filenames(array(
'body' => $template_file . '.txt', 'body' => $template_file . '.txt',

View file

@ -1695,8 +1695,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// The variable name should be $post_approved, because it indicates if the post is approved or not // The variable name should be $post_approved, because it indicates if the post is approved or not
$post_approval = 1; $post_approval = 1;
// Check the permissions for post approval. Moderators are not affected. // Check the permissions for post approval.
if (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id'])) // Moderators must go through post approval like ordinary users.
if (!$auth->acl_get('f_noapprove', $data['forum_id']))
{ {
// Post not approved, but in queue // Post not approved, but in queue
$post_approval = 0; $post_approval = 0;

View file

@ -70,7 +70,7 @@ class filespec
$this->mimetype = 'application/octetstream'; $this->mimetype = 'application/octetstream';
} }
$this->extension = strtolower($this->get_extension($this->realname)); $this->extension = strtolower(self::get_extension($this->realname));
// Try to get real filesize from temporary folder (not always working) ;) // Try to get real filesize from temporary folder (not always working) ;)
$this->filesize = (@filesize($this->filename)) ? @filesize($this->filename) : $this->filesize; $this->filesize = (@filesize($this->filename)) ? @filesize($this->filename) : $this->filesize;
@ -187,8 +187,11 @@ class filespec
/** /**
* Get file extension * Get file extension
*
* @param string Filename that needs to be checked
* @return string Extension of the supplied filename
*/ */
function get_extension($filename) static public function get_extension($filename)
{ {
if (strpos($filename, '.') === false) if (strpos($filename, '.') === false)
{ {
@ -369,7 +372,7 @@ class filespec
} }
// Check image type // Check image type
$types = $this->upload->image_types(); $types = fileupload::image_types();
if (!isset($types[$this->image_info[2]]) || !in_array($this->extension, $types[$this->image_info[2]])) if (!isset($types[$this->image_info[2]]) || !in_array($this->extension, $types[$this->image_info[2]]))
{ {
@ -1019,9 +1022,11 @@ class fileupload
} }
/** /**
* Return image type/extension mapping * Get image type/extension mapping
*
* @return array Array containing the image types and their extensions
*/ */
function image_types() static public function image_types()
{ {
return array( return array(
IMAGETYPE_GIF => array('gif'), IMAGETYPE_GIF => array('gif'),

View file

@ -48,7 +48,7 @@ class phpbb_lock_db
/** /**
* A database connection * A database connection
* @var dbal * @var phpbb_db_driver
*/ */
private $db; private $db;
@ -59,9 +59,9 @@ class phpbb_lock_db
* *
* @param string $config_name A config variable to be used for locking * @param string $config_name A config variable to be used for locking
* @param array $config The phpBB configuration * @param array $config The phpBB configuration
* @param dbal $db A database connection * @param phpbb_db_driver $db A database connection
*/ */
public function __construct($config_name, phpbb_config $config, dbal $db) public function __construct($config_name, phpbb_config $config, phpbb_db_driver $db)
{ {
$this->config_name = $config_name; $this->config_name = $config_name;
$this->config = $config; $this->config = $config;

View file

@ -430,13 +430,16 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
// Message and return links // Message and return links
$success_msg = 'POSTS_MERGED_SUCCESS'; $success_msg = 'POSTS_MERGED_SUCCESS';
// If the topic no longer exist, we will update the topic watch table. if (!function_exists('phpbb_update_rows_avoiding_duplicates_notify_status'))
// To not let it error out on users watching both topics, we just return on an error... {
$db->sql_return_on_error(true); include($phpbb_root_path . 'includes/functions_database_helper.' . $phpEx);
$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); }
$db->sql_return_on_error(false);
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); // Update the topic watch table.
phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', $topic_ids, $to_topic_id);
// Update the bookmarks table.
phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_ids, $to_topic_id);
// Link to the new topic // Link to the new topic
$return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>'); $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');

View file

@ -1080,6 +1080,7 @@ function mcp_fork_topic($topic_ids)
} }
} }
// Copy topic subscriptions to new topic
$sql = 'SELECT user_id, notify_status $sql = 'SELECT user_id, notify_status
FROM ' . TOPICS_WATCH_TABLE . ' FROM ' . TOPICS_WATCH_TABLE . '
WHERE topic_id = ' . $topic_id; WHERE topic_id = ' . $topic_id;
@ -1100,6 +1101,27 @@ function mcp_fork_topic($topic_ids)
{ {
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
} }
// Copy bookmarks to new topic
$sql = 'SELECT user_id
FROM ' . BOOKMARKS_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);
$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$sql_ary[] = array(
'topic_id' => (int) $new_topic_id,
'user_id' => (int) $row['user_id'],
);
}
$db->sql_freeresult($result);
if (sizeof($sql_ary))
{
$db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary);
}
} }
// Sync new topics, parent forums and board stats // Sync new topics, parent forums and board stats

View file

@ -521,6 +521,49 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
WHERE post_id = {$post_id_list[0]}"; WHERE post_id = {$post_id_list[0]}";
$db->sql_query($sql); $db->sql_query($sql);
// Copy topic subscriptions to new topic
$sql = 'SELECT user_id, notify_status
FROM ' . TOPICS_WATCH_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);
$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$sql_ary[] = array(
'topic_id' => (int) $to_topic_id,
'user_id' => (int) $row['user_id'],
'notify_status' => (int) $row['notify_status'],
);
}
$db->sql_freeresult($result);
if (sizeof($sql_ary))
{
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
}
// Copy bookmarks to new topic
$sql = 'SELECT user_id
FROM ' . BOOKMARKS_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);
$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$sql_ary[] = array(
'topic_id' => (int) $to_topic_id,
'user_id' => (int) $row['user_id'],
);
}
$db->sql_freeresult($result);
if (sizeof($sql_ary))
{
$db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary);
}
$success_msg = 'TOPIC_SPLIT_SUCCESS'; $success_msg = 'TOPIC_SPLIT_SUCCESS';
// Update forum statistics // Update forum statistics
@ -623,13 +666,16 @@ function merge_posts($topic_id, $to_topic_id)
} }
else else
{ {
// If the topic no longer exist, we will update the topic watch table. if (!function_exists('phpbb_update_rows_avoiding_duplicates_notify_status'))
// To not let it error out on users watching both topics, we just return on an error... {
$db->sql_return_on_error(true); include($phpbb_root_path . 'includes/functions_database_helper.' . $phpEx);
$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id); }
$db->sql_return_on_error(false);
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id); // If the topic no longer exist, we will update the topic watch table.
phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', $topic_ids, $to_topic_id);
// If the topic no longer exist, we will update the bookmarks table.
phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_id, $to_topic_id);
} }
// Link to the new topic // Link to the new topic

View file

@ -702,17 +702,6 @@ class bbcode_firstpass extends bbcode
{ {
global $config, $user; global $config, $user;
/**
* If you change this code, make sure the cases described within the following reports are still working:
* #3572 - [quote="[test]test"]test [ test[/quote] - (correct: parsed)
* #14667 - [quote]test[/quote] test ] and [ test [quote]test[/quote] (correct: parsed)
* #14770 - [quote="["]test[/quote] (correct: parsed)
* [quote="[i]test[/i]"]test[/quote] (correct: parsed)
* [quote="[quote]test[/quote]"]test[/quote] (correct: parsed - Username displayed as [quote]test[/quote])
* #20735 - [quote]test[/[/b]quote] test [/quote][/quote] test - (correct: quoted: "test[/[/b]quote] test" / non-quoted: "[/quote] test" - also failed if layout distorted)
* #40565 - [quote="a"]a[/quote][quote="a]a[/quote] (correct: first quote tag parsed, second quote tag unparsed)
*/
$in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in))); $in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in)));
if (!$in) if (!$in)

View file

@ -260,6 +260,8 @@ class phpbb_questionnaire_phpbb_data_provider
include("{$phpbb_root_path}config.$phpEx"); include("{$phpbb_root_path}config.$phpEx");
unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution
$dbms = phpbb_convert_30_dbms_to_31($dbms);
// Only send certain config vars // Only send certain config vars
$config_vars = array( $config_vars = array(
'active_sessions' => true, 'active_sessions' => true,

View file

@ -41,8 +41,8 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
protected $config; protected $config;
/** /**
* DBAL object * Database connection
* @var dbal * @var phpbb_db_driver
*/ */
protected $db; protected $db;

View file

@ -85,8 +85,8 @@ class phpbb_search_fulltext_native extends phpbb_search_base
protected $config; protected $config;
/** /**
* DBAL object * Database connection
* @var dbal * @var phpbb_db_driver
*/ */
protected $db; protected $db;

View file

@ -66,8 +66,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
protected $config; protected $config;
/** /**
* DBAL object * Database connection
* @var dbal * @var phpbb_db_driver
*/ */
protected $db; protected $db;

View file

@ -84,8 +84,8 @@ class phpbb_search_fulltext_sphinx
protected $config; protected $config;
/** /**
* DBAL object * Database connection
* @var dbal * @var phpbb_db_driver
*/ */
protected $db; protected $db;
@ -875,7 +875,7 @@ class phpbb_search_fulltext_sphinx
</dl> </dl>
<dl> <dl>
<dt><label for="fulltext_sphinx_indexer_mem_limit">' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN'] . '</span></dt> <dt><label for="fulltext_sphinx_indexer_mem_limit">' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN'] . '</span></dt>
<dd><input id="fulltext_sphinx_indexer_mem_limit" type="text" size="4" maxlength="10" name="config[fulltext_sphinx_indexer_mem_limit]" value="' . $this->config['fulltext_sphinx_indexer_mem_limit'] . '" />' . $this->user->lang['MIB'] . '</dd> <dd><input id="fulltext_sphinx_indexer_mem_limit" type="text" size="4" maxlength="10" name="config[fulltext_sphinx_indexer_mem_limit]" value="' . $this->config['fulltext_sphinx_indexer_mem_limit'] . '" /> ' . $this->user->lang['MIB'] . '</dd>
</dl> </dl>
<dl> <dl>
<dt><label for="fulltext_sphinx_config_file">' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '</dt> <dt><label for="fulltext_sphinx_config_file">' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '</dt>

File diff suppressed because it is too large Load diff

View file

@ -91,16 +91,22 @@ class phpbb_style
{ {
$style_path = $this->user->style['style_path']; $style_path = $this->user->style['style_path'];
$style_dirs = ($this->user->style['style_parent_id']) ? array_reverse(explode('/', $this->user->style['style_parent_tree'])) : array(); $style_dirs = ($this->user->style['style_parent_id']) ? array_reverse(explode('/', $this->user->style['style_parent_tree'])) : array();
$paths = array($this->get_style_path($style_path));
$names = array($style_path);
foreach ($style_dirs as $dir) foreach ($style_dirs as $dir)
{ {
$paths[] = $this->get_style_path($dir); $names[] = $dir;
}
// Add 'all' path, used as last fallback path by events and extensions
//$names[] = 'all';
$paths = array();
foreach ($names as $name)
{
$paths[] = $this->get_style_path($name);
} }
// Add 'all' path, used as last fallback path by hooks and extensions return $this->set_custom_style($style_path, $paths, $names);
$paths[] = $this->get_style_path('all');
return $this->set_custom_style($style_path, $paths);
} }
/** /**
@ -110,18 +116,27 @@ class phpbb_style
* *
* @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver" * @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver"
* @param array or string $paths Array of style paths, relative to current root directory * @param array or string $paths Array of style paths, relative to current root directory
* @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used.
* @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/).
*/ */
public function set_custom_style($name, $paths, $template_path = false) public function set_custom_style($name, $paths, $names = array(), $template_path = false)
{ {
if (is_string($paths)) if (is_string($paths))
{ {
$paths = array($paths); $paths = array($paths);
} }
if (empty($names))
{
$names = array($name);
}
$this->names = $names;
$this->provider->set_styles($paths); $this->provider->set_styles($paths);
$this->locator->set_paths($this->provider); $this->locator->set_paths($this->provider);
$this->template->set_style_names($names);
if ($template_path !== false) if ($template_path !== false)
{ {
$this->locator->set_template_path($template_path); $this->locator->set_template_path($template_path);

View file

@ -35,16 +35,23 @@ class phpbb_template_compile
/** /**
* Constructor. * Constructor.
* *
* @param bool @allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag) * @param bool $allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag)
* @param array $style_names Name of style to which the template being compiled belongs and parents in style tree order
* @param phpbb_style_resource_locator $locator Resource locator * @param phpbb_style_resource_locator $locator Resource locator
* @param string $phpbb_root_path Path to phpBB root directory * @param string $phpbb_root_path Path to phpBB root directory
* @param phpbb_extension_manager $extension_manager Extension manager to use for finding template fragments in extensions; if null, template events will not be invoked
* @param phpbb_user $user Current user
*/ */
public function __construct($allow_php, $locator, $phpbb_root_path) public function __construct($allow_php, $style_names, $locator, $phpbb_root_path, $extension_manager = null, $user = null)
{ {
$this->filter_params = array( $this->filter_params = array(
'allow_php' => $allow_php, 'allow_php' => $allow_php,
'style_names' => $style_names,
'locator' => $locator, 'locator' => $locator,
'phpbb_root_path' => $phpbb_root_path 'phpbb_root_path' => $phpbb_root_path,
'extension_manager' => $extension_manager,
'user' => $user,
'template_compile' => $this,
); );
} }

View file

@ -87,6 +87,37 @@ class phpbb_template_filter extends php_user_filter
*/ */
private $phpbb_root_path; private $phpbb_root_path;
/**
* Name of the style that the template being compiled and/or rendered
* belongs to, and its parents, in inheritance tree order.
*
* Used to invoke style-specific template events.
*
* @var array
*/
private $style_names;
/**
* Extension manager.
*
* @var phpbb_extension_manager
*/
private $extension_manager;
/**
* Current user
*
* @var phpbb_user
*/
private $user;
/**
* Template compiler.
*
* @var phpbb_template_compile
*/
private $template_compile;
/** /**
* Stream filter * Stream filter
* *
@ -138,8 +169,10 @@ class phpbb_template_filter extends php_user_filter
/** /**
* Initializer, called on creation. * Initializer, called on creation.
* *
* Get the allow_php option, root directory and locator from params, * Get the allow_php option, style_names, root directory and locator from params,
* which are passed to stream_filter_append. * which are passed to stream_filter_append.
*
* @return boolean Returns true
*/ */
public function onCreate() public function onCreate()
{ {
@ -148,6 +181,13 @@ class phpbb_template_filter extends php_user_filter
$this->allow_php = $this->params['allow_php']; $this->allow_php = $this->params['allow_php'];
$this->locator = $this->params['locator']; $this->locator = $this->params['locator'];
$this->phpbb_root_path = $this->params['phpbb_root_path']; $this->phpbb_root_path = $this->params['phpbb_root_path'];
$this->style_names = $this->params['style_names'];
$this->extension_manager = $this->params['extension_manager'];
if (isset($this->params['user']))
{
$this->user = $this->params['user'];
}
$this->template_compile = $this->params['template_compile'];
return true; return true;
} }
@ -229,7 +269,9 @@ class phpbb_template_filter extends php_user_filter
} }
/** /**
* Callback for replacing matched tokens with PHP code * Callback for replacing matched tokens with compiled template code.
*
* Compiled template code is an HTML stream with embedded PHP.
* *
* @param array $matches Regular expression matches * @param array $matches Regular expression matches
* @return string compiled template code * @return string compiled template code
@ -317,6 +359,10 @@ class phpbb_template_filter extends php_user_filter
return '<!-- ENDPHP -->'; return '<!-- ENDPHP -->';
break; break;
case 'EVENT':
return '<?php ' . $this->compile_tag_event($matches[2]) . '?>';
break;
default: default:
return $matches[0]; return $matches[0];
break; break;
@ -835,6 +881,97 @@ class phpbb_template_filter extends php_user_filter
return "\$_template->_php_include('$tag_args');"; return "\$_template->_php_include('$tag_args');";
} }
/**
* Compile EVENT tag.
*
* $tag_args should be a single string identifying the event.
* The event name can contain letters, numbers and underscores only.
* If an invalid event name is specified, an E_USER_ERROR will be
* triggered.
*
* Event tags are only functional when the template engine has
* an instance of the extension manager. Extension manager would
* be called upon to find all extensions listening for the specified
* event, and to obtain additional template fragments. All such
* template fragments will be compiled and included in the generated
* compiled template code for the current template being compiled.
*
* The above means that whenever an extension is enabled or disabled,
* template cache should be cleared in order to update the compiled
* template code for the active set of template event listeners.
*
* This also means that extensions cannot return different template
* fragments at different times. Once templates are compiled, changing
* such template fragments would have no effect.
*
* @param string $tag_args EVENT tag arguments, as a string - for EVENT this is the event name
* @return string compiled template code
*/
private function compile_tag_event($tag_args)
{
if (!preg_match('/^\w+$/', $tag_args))
{
// The event location is improperly formatted,
if ($this->user)
{
trigger_error($this->user->lang('ERR_TEMPLATE_EVENT_LOCATION', $tag_args), E_USER_ERROR);
}
else
{
trigger_error(sprintf('The specified template event location <em>[%s]</em> is improperly formatted.', $tag_args), E_USER_ERROR);
}
}
$location = $tag_args;
if ($this->extension_manager)
{
$finder = $this->extension_manager->get_finder();
$files = $finder
->extension_prefix($location)
->extension_suffix('.html')
->extension_directory("/styles/all/template")
->get_files();
foreach ($this->style_names as $style_name)
{
$more_files = $finder
->extension_prefix($location)
->extension_suffix('.html')
->extension_directory("/styles/" . $style_name . "/template")
->get_files();
if (!empty($more_files))
{
$files = array_merge($files, $more_files);
break;
}
}
$all_compiled = '';
foreach ($files as $file)
{
$compiled = $this->template_compile->compile_file($file);
if ($compiled === false)
{
if ($this->user)
{
trigger_error($this->user->lang('ERR_TEMPLATE_COMPILATION', phpbb_filter_root_path($file)), E_USER_ERROR);
}
else
{
trigger_error(sprintf('The file could not be compiled: %s', phpbb_filter_root_path($file)), E_USER_ERROR);
}
}
$all_compiled .= $compiled;
}
// Need spaces inside php tags as php cannot grok
// < ?php? > sans the spaces
return ' ?' . '>' . $all_compiled . '<?php ';
}
}
/** /**
* parse expression * parse expression
* This is from Smarty * This is from Smarty

View file

@ -39,7 +39,7 @@ interface phpbb_template_locator
* Sets the template filenames for handles. $filename_array * Sets the template filenames for handles. $filename_array
* should be a hash of handle => filename pairs. * should be a hash of handle => filename pairs.
* *
* @param array $filname_array Should be a hash of handle => filename pairs. * @param array $filename_array Should be a hash of handle => filename pairs.
*/ */
public function set_filenames(array $filename_array); public function set_filenames(array $filename_array);
@ -66,7 +66,7 @@ interface phpbb_template_locator
* returns actually exists, it is faster than get_source_file_for_handle. * returns actually exists, it is faster than get_source_file_for_handle.
* *
* Use get_source_file_for_handle to obtain the actual path that is * Use get_source_file_for_handle to obtain the actual path that is
* guaranteed to exist (which might come from the parent style * guaranteed to exist (which might come from the parent style
* directory if primary style has parent styles). * directory if primary style has parent styles).
* *
* This function will trigger an error if the handle was never * This function will trigger an error if the handle was never

View file

@ -74,6 +74,23 @@ class phpbb_template
*/ */
private $locator; private $locator;
/**
* Extension manager.
*
* @var phpbb_extension_manager
*/
private $extension_manager;
/**
* Name of the style that the template being compiled and/or rendered
* belongs to, and its parents, in inheritance tree order.
*
* Used to invoke style-specific template events.
*
* @var array
*/
private $style_names;
/** /**
* Constructor. * Constructor.
* *
@ -81,8 +98,9 @@ class phpbb_template
* @param user $user current user * @param user $user current user
* @param phpbb_template_locator $locator template locator * @param phpbb_template_locator $locator template locator
* @param phpbb_template_context $context template context * @param phpbb_template_context $context template context
* @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked
*/ */
public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_locator $locator, phpbb_template_context $context) public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_locator $locator, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null)
{ {
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
@ -90,12 +108,13 @@ class phpbb_template
$this->user = $user; $this->user = $user;
$this->locator = $locator; $this->locator = $locator;
$this->context = $context; $this->context = $context;
$this->extension_manager = $extension_manager;
} }
/** /**
* Sets the template filenames for handles. * Sets the template filenames for handles.
* *
* @param array $filname_array Should be a hash of handle => filename pairs. * @param array $filename_array Should be a hash of handle => filename pairs.
*/ */
public function set_filenames(array $filename_array) public function set_filenames(array $filename_array)
{ {
@ -104,6 +123,18 @@ class phpbb_template
return true; return true;
} }
/**
* Sets the style names corresponding to style hierarchy being compiled
* and/or rendered.
*
* @param array $style_names List of style names in inheritance tree order
* @return null
*/
public function set_style_names(array $style_names)
{
$this->style_names = $style_names;
}
/** /**
* Clears all variables and blocks assigned to this template. * Clears all variables and blocks assigned to this template.
*/ */
@ -282,7 +313,7 @@ class phpbb_template
return new phpbb_template_renderer_include($output_file, $this); return new phpbb_template_renderer_include($output_file, $this);
} }
$compile = new phpbb_template_compile($this->config['tpl_allow_php'], $this->locator, $this->phpbb_root_path); $compile = new phpbb_template_compile($this->config['tpl_allow_php'], $this->style_names, $this->locator, $this->phpbb_root_path, $this->extension_manager, $this->user);
if ($compile->compile_file_to_file($source_file, $output_file) !== false) if ($compile->compile_file_to_file($source_file, $output_file) !== false)
{ {

View file

@ -24,6 +24,8 @@ if (!defined('IN_PHPBB'))
include($phpbb_root_path . 'config.' . $phpEx); include($phpbb_root_path . 'config.' . $phpEx);
unset($dbpasswd); unset($dbpasswd);
$dbms = phpbb_convert_30_dbms_to_31($dbms);
/** /**
* $convertor_data provides some basic information about this convertor which is * $convertor_data provides some basic information about this convertor which is
* used on the initial list of convertors and to populate the default settings * used on the initial list of convertors and to populate the default settings

View file

@ -83,7 +83,6 @@ phpbb_require_updated('includes/functions_content.' . $phpEx, true);
require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
phpbb_require_updated('includes/db/db_tools.' . $phpEx); phpbb_require_updated('includes/db/db_tools.' . $phpEx);
@ -818,6 +817,70 @@ function _add_modules($modules_to_install)
$_module->remove_cache_file(); $_module->remove_cache_file();
} }
/**
* Add a new permission, optionally copy permission setting from another
*
* @param auth_admin $auth_admin auth_admin object
* @param phpbb_db_driver $db Database object
* @param string $permission_name Name of the permission to add
* @param bool $is_global True is global, false is local
* @param string $copy_from Optional permission name from which to copy
* @return bool true on success, false on failure
*/
function _add_permission(auth_admin $auth_admin, phpbb_db_driver $db, $permission_name, $is_global = true, $copy_from = '')
{
// Only add a permission that don't already exist
if (!empty($auth_admin->acl_options['id'][$permission_name]))
{
return true;
}
$permission_scope = $is_global ? 'global' : 'local';
$result = $auth_admin->acl_add_option(array(
$permission_scope => array($permission_name),
));
if (!$result)
{
return $result;
}
// The permission has been added, now we can copy it if needed
if ($copy_from && isset($auth_admin->acl_options['id'][$copy_from]))
{
$old_id = $auth_admin->acl_options['id'][$copy_from];
$new_id = $auth_admin->acl_options['id'][$permission_name];
$tables = array(ACL_GROUPS_TABLE, ACL_ROLES_DATA_TABLE, ACL_USERS_TABLE);
foreach ($tables as $table)
{
$sql = 'SELECT *
FROM ' . $table . '
WHERE auth_option_id = ' . $old_id;
$result = _sql($sql, $errored, $error_ary);
$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$row['auth_option_id'] = $new_id;
$sql_ary[] = $row;
}
$db->sql_freeresult($result);
if (sizeof($sql_ary))
{
$db->sql_multi_insert($table, $sql_ary);
}
}
$auth_admin->acl_clear_prefetch();
}
return true;
}
/**************************************************************************** /****************************************************************************
* ADD YOUR DATABASE SCHEMA CHANGES HERE * * ADD YOUR DATABASE SCHEMA CHANGES HERE *
*****************************************************************************/ *****************************************************************************/
@ -1149,7 +1212,7 @@ function database_update_info()
*****************************************************************************/ *****************************************************************************/
function change_database_data(&$no_updates, $version) function change_database_data(&$no_updates, $version)
{ {
global $db, $errored, $error_ary, $config, $phpbb_root_path, $phpEx, $db_tools; global $db, $db_tools, $errored, $error_ary, $config, $table_prefix, $phpbb_root_path, $phpEx;
$update_helpers = new phpbb_update_helpers(); $update_helpers = new phpbb_update_helpers();
@ -1466,8 +1529,6 @@ function change_database_data(&$no_updates, $version)
), ),
); );
global $db_tools;
$statements = $db_tools->perform_schema_changes($changes); $statements = $db_tools->perform_schema_changes($changes);
foreach ($statements as $sql) foreach ($statements as $sql)
@ -2109,26 +2170,41 @@ function change_database_data(&$no_updates, $version)
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
global $db_tools, $table_prefix; /*
* Due to a bug, vanilla phpbb could not create captcha tables
// Recover from potentially broken Q&A CAPTCHA table on firebird * in 3.0.8 on firebird. It was possible for board administrators
// Q&A CAPTCHA was uninstallable, so it's safe to remove these * to adjust the code to work. If code was manually adjusted by
// without data loss * board administrators, index names would not be the same as
* what 3.0.9 and newer expect. This code fragment drops captcha
* tables, destroying all entered Q&A captcha configuration, such
* that when Q&A is configured next the respective tables will be
* created with correct index names.
*
* If you wish to preserve your Q&A captcha configuration, you can
* manually rename indexes to the currently expected name:
* phpbb_captcha_questions_lang_iso => phpbb_captcha_questions_lang
* phpbb_captcha_answers_question_id => phpbb_captcha_answers_qid
*
* Again, this needs to be done only if a board was manually modified
* to fix broken captcha code.
*
if ($db_tools->sql_layer == 'firebird') if ($db_tools->sql_layer == 'firebird')
{ {
$tables = array( $changes = array(
$table_prefix . 'captcha_questions', 'drop_tables' => array(
$table_prefix . 'captcha_answers', $table_prefix . 'captcha_questions',
$table_prefix . 'qa_confirm', $table_prefix . 'captcha_answers',
$table_prefix . 'qa_confirm',
),
); );
foreach ($tables as $table) $statements = $db_tools->perform_schema_changes($changes);
foreach ($statements as $sql)
{ {
if ($db_tools->sql_table_exists($table)) _sql($sql, $errored, $error_ary);
{
$db_tools->sql_table_drop($table);
}
} }
} }
*/
$no_updates = false; $no_updates = false;
break; break;
@ -2461,6 +2537,12 @@ function change_database_data(&$no_updates, $version)
unset($next_legend); unset($next_legend);
} }
// Rename styles module to Customise
$sql = 'UPDATE ' . MODULES_TABLE . "
SET module_langname = 'ACP_CAT_CUSTOMISE'
WHERE module_langname = 'ACP_CAT_STYLES'";
_sql($sql, $errored, $error_ary);
// Install modules // Install modules
$modules_to_install = array( $modules_to_install = array(
'position' => array( 'position' => array(
@ -2498,10 +2580,67 @@ function change_database_data(&$no_updates, $version)
'auth' => '', 'auth' => '',
'cat' => 'UCP_PROFILE', 'cat' => 'UCP_PROFILE',
), ),
// To add a category, the mode and basename must be empty
// The mode is taken from the array key
'' => array(
'base' => '',
'class' => 'acp',
'title' => 'ACP_EXTENSION_MANAGEMENT',
'auth' => 'acl_a_extensions',
'cat' => 'ACP_CAT_CUSTOMISE',
),
'extensions' => array(
'base' => 'acp_extensions',
'class' => 'acp',
'title' => 'ACP_EXTENSIONS',
'auth' => 'acl_a_extensions',
'cat' => 'ACP_EXTENSION_MANAGEMENT',
),
); );
_add_modules($modules_to_install); _add_modules($modules_to_install);
// We need a separate array for the new language sub heading
// because it requires another empty key
$modules_to_install = array(
'' => array(
'base' => '',
'class' => 'acp',
'title' => 'ACP_LANGUAGE',
'auth' => 'acl_a_language',
'cat' => 'ACP_CAT_CUSTOMISE',
),
);
_add_modules($modules_to_install);
// Move language management to new location in the Customise tab
// First get language module id
$sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
WHERE module_basename = 'acp_language'";
$result = $db->sql_query($sql);
$language_module_id = $db->sql_fetchfield('module_id');
$db->sql_freeresult($result);
// Next get language management module id of the one just created
$sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
WHERE module_langname = 'ACP_LANGUAGE'";
$result = $db->sql_query($sql);
$language_management_module_id = $db->sql_fetchfield('module_id');
$db->sql_freeresult($result);
if (!class_exists('acp_modules'))
{
include($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx);
}
// acp_modules calls adm_back_link, which is undefined at this point
if (!function_exists('adm_back_link'))
{
include($phpbb_root_path . 'includes/functions_acp.' . $phpEx);
}
$module_manager = new acp_modules();
$module_manager->module_class = 'acp';
$module_manager->move_module($language_module_id, $language_management_module_id);
$sql = 'DELETE FROM ' . MODULES_TABLE . " $sql = 'DELETE FROM ' . MODULES_TABLE . "
WHERE (module_basename = 'styles' OR module_basename = 'acp_styles') AND (module_mode = 'imageset' OR module_mode = 'theme' OR module_mode = 'template')"; WHERE (module_basename = 'styles' OR module_basename = 'acp_styles') AND (module_mode = 'imageset' OR module_mode = 'theme' OR module_mode = 'template')";
_sql($sql, $errored, $error_ary); _sql($sql, $errored, $error_ary);
@ -2794,7 +2933,11 @@ function change_database_data(&$no_updates, $version)
set_config('board_timezone', $update_helpers->convert_phpbb30_timezone($config['board_timezone'], $config['board_dst'])); set_config('board_timezone', $update_helpers->convert_phpbb30_timezone($config['board_timezone'], $config['board_dst']));
// After we have calculated the timezones we can delete user_dst column from user table. // After we have calculated the timezones we can delete user_dst column from user table.
$db_tools->sql_column_remove(USERS_TABLE, 'user_dst'); $statements = $db_tools->sql_column_remove(USERS_TABLE, 'user_dst');
foreach ($statements as $sql)
{
_sql($sql, $errored, $error_ary);
}
} }
if (!isset($config['site_home_url'])) if (!isset($config['site_home_url']))
@ -2825,45 +2968,12 @@ function change_database_data(&$no_updates, $version)
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
// Add new permission u_chgprofileinfo and duplicate settings from u_sig // Add new permissions
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
$auth_admin = new auth_admin(); $auth_admin = new auth_admin();
// Only add the new permission if it does not already exist _add_permission($auth_admin, $db, 'u_chgprofileinfo', true, 'u_sig');
if (empty($auth_admin->acl_options['id']['u_chgprofileinfo'])) _add_permission($auth_admin, $db, 'a_extensions', true, 'a_styles');
{
$auth_admin->acl_add_option(array('global' => array('u_chgprofileinfo')));
// Now the tricky part, filling the permission
$old_id = $auth_admin->acl_options['id']['u_sig'];
$new_id = $auth_admin->acl_options['id']['u_chgprofileinfo'];
$tables = array(ACL_GROUPS_TABLE, ACL_ROLES_DATA_TABLE, ACL_USERS_TABLE);
foreach ($tables as $table)
{
$sql = 'SELECT *
FROM ' . $table . '
WHERE auth_option_id = ' . $old_id;
$result = _sql($sql, $errored, $error_ary);
$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$row['auth_option_id'] = $new_id;
$sql_ary[] = $row;
}
$db->sql_freeresult($result);
if (sizeof($sql_ary))
{
$db->sql_multi_insert($table, $sql_ary);
}
}
// Remove any old permission entries
$auth_admin->acl_clear_prefetch();
}
// Update the auth setting for the module // Update the auth setting for the module
$sql = 'UPDATE ' . MODULES_TABLE . " $sql = 'UPDATE ' . MODULES_TABLE . "

View file

@ -215,7 +215,7 @@ $phpbb_style_path_provider = new phpbb_style_path_provider();
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, new phpbb_template_context()); $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, new phpbb_template_context());
$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template); $phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
$phpbb_style->set_ext_dir_prefix('adm/'); $phpbb_style->set_ext_dir_prefix('adm/');
$phpbb_style->set_custom_style('admin', '../adm/style', ''); $phpbb_style->set_custom_style('admin', '../adm/style', array(), '');
$template->assign_var('T_ASSETS_PATH', '../assets'); $template->assign_var('T_ASSETS_PATH', '../assets');
$template->assign_var('T_TEMPLATE_PATH', '../adm/style'); $template->assign_var('T_TEMPLATE_PATH', '../adm/style');

View file

@ -121,10 +121,11 @@ class install_convert extends module
require($phpbb_root_path . 'config.' . $phpEx); require($phpbb_root_path . 'config.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
$db = new $sql_db(); $dbms = phpbb_convert_30_dbms_to_31($dbms);
$db = new $dbms();
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
unset($dbpasswd); unset($dbpasswd);
@ -209,10 +210,11 @@ class install_convert extends module
require($phpbb_root_path . 'config.' . $phpEx); require($phpbb_root_path . 'config.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
$db = new $sql_db(); $dbms = phpbb_convert_30_dbms_to_31($dbms);
$db = new $dbms();
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
unset($dbpasswd); unset($dbpasswd);
@ -332,10 +334,11 @@ class install_convert extends module
require($phpbb_root_path . 'config.' . $phpEx); require($phpbb_root_path . 'config.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
$db = new $sql_db(); $dbms = phpbb_convert_30_dbms_to_31($dbms);
$db = new $dbms();
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
unset($dbpasswd); unset($dbpasswd);
@ -425,8 +428,7 @@ class install_convert extends module
if ($src_dbms != $dbms || $src_dbhost != $dbhost || $src_dbport != $dbport || $src_dbname != $dbname || $src_dbuser != $dbuser) if ($src_dbms != $dbms || $src_dbhost != $dbhost || $src_dbport != $dbport || $src_dbname != $dbname || $src_dbuser != $dbuser)
{ {
$sql_db = 'dbal_' . $src_dbms; $src_db = new $src_dbms();
$src_db = new $sql_db();
$src_db->sql_connect($src_dbhost, $src_dbuser, htmlspecialchars_decode($src_dbpasswd), $src_dbname, $src_dbport, false, true); $src_db->sql_connect($src_dbhost, $src_dbuser, htmlspecialchars_decode($src_dbpasswd), $src_dbname, $src_dbport, false, true);
$same_db = false; $same_db = false;
} }
@ -575,10 +577,11 @@ class install_convert extends module
require($phpbb_root_path . 'config.' . $phpEx); require($phpbb_root_path . 'config.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
$db = new $sql_db(); $dbms = phpbb_convert_30_dbms_to_31($dbms);
$db = new $dbms();
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
unset($dbpasswd); unset($dbpasswd);
@ -639,12 +642,8 @@ class install_convert extends module
$src_db = $same_db = null; $src_db = $same_db = null;
if ($convert->src_dbms != $dbms || $convert->src_dbhost != $dbhost || $convert->src_dbport != $dbport || $convert->src_dbname != $dbname || $convert->src_dbuser != $dbuser) if ($convert->src_dbms != $dbms || $convert->src_dbhost != $dbhost || $convert->src_dbport != $dbport || $convert->src_dbname != $dbname || $convert->src_dbuser != $dbuser)
{ {
if ($convert->src_dbms != $dbms) $dbms = $convert->src_dbms;
{ $src_db = new $dbms();
require($phpbb_root_path . 'includes/db/' . $convert->src_dbms . '.' . $phpEx);
}
$sql_db = 'dbal_' . $convert->src_dbms;
$src_db = new $sql_db();
$src_db->sql_connect($convert->src_dbhost, $convert->src_dbuser, htmlspecialchars_decode($convert->src_dbpasswd), $convert->src_dbname, $convert->src_dbport, false, true); $src_db->sql_connect($convert->src_dbhost, $convert->src_dbuser, htmlspecialchars_decode($convert->src_dbpasswd), $convert->src_dbname, $convert->src_dbport, false, true);
$same_db = false; $same_db = false;
} }

View file

@ -1118,11 +1118,8 @@ class install_install extends module
$dbms = $available_dbms[$data['dbms']]['DRIVER']; $dbms = $available_dbms[$data['dbms']]['DRIVER'];
// Load the appropriate database class if not already loaded
include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
// Instantiate the database // Instantiate the database
$db = new $sql_db(); $db = new $dbms();
$db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false); $db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false);
// NOTE: trigger_error does not work here. // NOTE: trigger_error does not work here.
@ -1418,11 +1415,8 @@ class install_install extends module
$dbms = $available_dbms[$data['dbms']]['DRIVER']; $dbms = $available_dbms[$data['dbms']]['DRIVER'];
// Load the appropriate database class if not already loaded
include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
// Instantiate the database // Instantiate the database
$db = new $sql_db(); $db = new $dbms();
$db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false); $db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false);
// NOTE: trigger_error does not work here. // NOTE: trigger_error does not work here.
@ -2095,9 +2089,10 @@ class install_install extends module
'ACP_PERMISSION_ROLES', 'ACP_PERMISSION_ROLES',
'ACP_PERMISSION_MASKS', 'ACP_PERMISSION_MASKS',
), ),
'ACP_CAT_STYLES' => array( 'ACP_CAT_CUSTOMISE' => array(
'ACP_STYLE_MANAGEMENT', 'ACP_STYLE_MANAGEMENT',
'ACP_STYLE_COMPONENTS', 'ACP_EXTENSIONS_MANAGEMENT',
'ACP_LANGUAGE',
), ),
'ACP_CAT_MAINTENANCE' => array( 'ACP_CAT_MAINTENANCE' => array(
'ACP_FORUM_LOGS', 'ACP_FORUM_LOGS',

View file

@ -83,7 +83,6 @@ class install_update extends module
// Init DB // Init DB
require($phpbb_root_path . 'config.' . $phpEx); require($phpbb_root_path . 'config.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx);
// Special options for conflicts/modified files // Special options for conflicts/modified files
@ -92,7 +91,9 @@ class install_update extends module
define('MERGE_NEW_FILE', 3); define('MERGE_NEW_FILE', 3);
define('MERGE_MOD_FILE', 4); define('MERGE_MOD_FILE', 4);
$db = new $sql_db(); $dbms = phpbb_convert_30_dbms_to_31($dbms);
$db = new $dbms();
// Connect to DB // Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);
@ -131,7 +132,7 @@ class install_update extends module
} }
// Set custom template again. ;) // Set custom template again. ;)
$phpbb_style->set_custom_style('admin', '../adm/style', ''); $phpbb_style->set_custom_style('admin', '../adm/style', array(), '');
$template->assign_vars(array( $template->assign_vars(array(
'S_USER_LANG' => $user->lang['USER_LANG'], 'S_USER_LANG' => $user->lang['USER_LANG'],

View file

@ -59,6 +59,7 @@ $lang = array_merge($lang, array(
'ACP_CAPTCHA' => 'CAPTCHA', 'ACP_CAPTCHA' => 'CAPTCHA',
'ACP_CAT_CUSTOMISE' => 'Customise',
'ACP_CAT_DATABASE' => 'Database', 'ACP_CAT_DATABASE' => 'Database',
'ACP_CAT_DOT_MODS' => '.MODs', 'ACP_CAT_DOT_MODS' => '.MODs',
'ACP_CAT_FORUMS' => 'Forums', 'ACP_CAT_FORUMS' => 'Forums',
@ -80,8 +81,10 @@ $lang = array_merge($lang, array(
'ACP_DISALLOW_USERNAMES' => 'Disallow usernames', 'ACP_DISALLOW_USERNAMES' => 'Disallow usernames',
'ACP_EMAIL_SETTINGS' => 'Email settings', 'ACP_EMAIL_SETTINGS' => 'Email settings',
'ACP_EXTENSION_GROUPS' => 'Manage extension groups', 'ACP_EXTENSION_GROUPS' => 'Manage attachment extension groups',
'ACP_EXTENSIONS' => 'Manage board extensions', 'ACP_EXTENSION_MANAGEMENT' => 'Extension management',
'ACP_EXTENSIONS' => 'Extensions',
'ACP_FORUM_BASED_PERMISSIONS' => 'Forum based permissions', 'ACP_FORUM_BASED_PERMISSIONS' => 'Forum based permissions',
'ACP_FORUM_LOGS' => 'Forum logs', 'ACP_FORUM_LOGS' => 'Forum logs',
@ -119,7 +122,7 @@ $lang = array_merge($lang, array(
'ACP_MANAGE_ATTACHMENTS' => 'Manage attachments', 'ACP_MANAGE_ATTACHMENTS' => 'Manage attachments',
'ACP_MANAGE_ATTACHMENTS_EXPLAIN' => 'Here you can list and delete files attached to posts and private messages.', 'ACP_MANAGE_ATTACHMENTS_EXPLAIN' => 'Here you can list and delete files attached to posts and private messages.',
'ACP_MANAGE_EXTENSIONS' => 'Manage extensions', 'ACP_MANAGE_EXTENSIONS' => 'Manage attachment extensions',
'ACP_MANAGE_FORUMS' => 'Manage forums', 'ACP_MANAGE_FORUMS' => 'Manage forums',
'ACP_MANAGE_RANKS' => 'Manage ranks', 'ACP_MANAGE_RANKS' => 'Manage ranks',
'ACP_MANAGE_REASONS' => 'Manage report/denial reasons', 'ACP_MANAGE_REASONS' => 'Manage report/denial reasons',
@ -166,7 +169,6 @@ $lang = array_merge($lang, array(
'ACP_SERVER_SETTINGS' => 'Server settings', 'ACP_SERVER_SETTINGS' => 'Server settings',
'ACP_SIGNATURE_SETTINGS' => 'Signature settings', 'ACP_SIGNATURE_SETTINGS' => 'Signature settings',
'ACP_SMILIES' => 'Smilies', 'ACP_SMILIES' => 'Smilies',
'ACP_STYLE_COMPONENTS' => 'Style components',
'ACP_STYLE_MANAGEMENT' => 'Style management', 'ACP_STYLE_MANAGEMENT' => 'Style management',
'ACP_STYLES' => 'Styles', 'ACP_STYLES' => 'Styles',
'ACP_STYLES_CACHE' => 'Purge Cache', 'ACP_STYLES_CACHE' => 'Purge Cache',

View file

@ -186,6 +186,8 @@ $lang = array_merge($lang, array(
'ERR_CONNECTING_SERVER' => 'Error connecting to the server.', 'ERR_CONNECTING_SERVER' => 'Error connecting to the server.',
'ERR_JAB_AUTH' => 'Could not authorise on Jabber server.', 'ERR_JAB_AUTH' => 'Could not authorise on Jabber server.',
'ERR_JAB_CONNECT' => 'Could not connect to Jabber server.', 'ERR_JAB_CONNECT' => 'Could not connect to Jabber server.',
'ERR_TEMPLATE_EVENT_LOCATION' => 'The specified template event location <em>[%s]</em> is improperly formatted.',
'ERR_TEMPLATE_COMPILATION' => 'The file could not be compiled: %s',
'ERR_UNABLE_TO_LOGIN' => 'The specified username or password is incorrect.', 'ERR_UNABLE_TO_LOGIN' => 'The specified username or password is incorrect.',
'ERR_UNWATCHING' => 'An error occured while trying to unsubscribe.', 'ERR_UNWATCHING' => 'An error occured while trying to unsubscribe.',
'ERR_WATCHING' => 'An error occured while trying to subscribe.', 'ERR_WATCHING' => 'An error occured while trying to subscribe.',

View file

@ -1116,8 +1116,9 @@ if ($submit || $preview || $refresh)
$captcha->reset(); $captcha->reset();
} }
// Check the permissions for post approval. Moderators are not affected. // Check the permissions for post approval.
if ((!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id']) && empty($data['force_approved_state'])) || (isset($data['force_approved_state']) && !$data['force_approved_state'])) // Moderators must go through post approval like ordinary users.
if ((!$auth->acl_get('f_noapprove', $data['forum_id']) && empty($data['force_approved_state'])) || (isset($data['force_approved_state']) && !$data['force_approved_state']))
{ {
meta_refresh(10, $redirect_url); meta_refresh(10, $redirect_url);
$message = ($mode == 'edit') ? $user->lang['POST_EDITED_MOD'] : $user->lang['POST_STORED_MOD']; $message = ($mode == 'edit') ? $user->lang['POST_EDITED_MOD'] : $user->lang['POST_STORED_MOD'];

View file

@ -2,6 +2,94 @@
"use strict"; "use strict";
/**
* Close popup alert after a specified delay
*
* @param int Delay in ms until darkenwrapper's click event is triggered
*/
phpbb.closeDarkenWrapper = function(delay) {
setTimeout(function() {
$('#darkenwrapper').trigger('click');
}, delay);
};
// This callback will mark all forum icons read
phpbb.add_ajax_callback('mark_forums_read', function(res) {
var readTitle = res.NO_UNREAD_POSTS;
var unreadTitle = res.UNREAD_POSTS;
var iconsArray = {
'forum_unread': 'forum_read',
'forum_unread_subforum': 'forum_read_subforum',
'forum_unread_locked': 'forum_read_locked',
};
$('li.row').find('dl[class*="forum_unread"]').each(function() {
var $this = $(this);
$.each(iconsArray, function(unreadClass, readClass) {
if ($this.hasClass(unreadClass)) {
$this.removeClass(unreadClass).addClass(readClass);
}
});
$this.children('dt[title="' + unreadTitle + '"]').attr('title', readTitle);
});
// Mark subforums read
$('a.subforum[class*="unread"]').removeClass('unread').addClass('read');
// Update mark forums read links
$('[data-ajax="mark_forums_read"]').attr('href', res.U_MARK_FORUMS);
phpbb.closeDarkenWrapper(3000);
});
// This callback will mark all topic icons read
phpbb.add_ajax_callback('mark_topics_read', function(res) {
var readTitle = res.NO_UNREAD_POSTS;
var unreadTitle = res.UNREAD_POSTS;
var iconsArray = {
'global_unread': 'global_read',
'announce_unread': 'announce_read',
'sticky_unread': 'sticky_read',
'topic_unread': 'topic_read'
};
var iconsState = ['', '_hot', '_hot_mine', '_locked', '_locked_mine', '_mine'];
var unreadClassSelectors = '';
var classMap = {};
var classNames = [];
$.each(iconsArray, function(unreadClass, readClass) {
$.each(iconsState, function(key, value) {
// Only topics can be hot
if ((value == '_hot' || value == '_hot_mine') && unreadClass != 'topic_unread') {
return true;
}
classMap[unreadClass + value] = readClass + value;
classNames.push(unreadClass + value);
});
});
unreadClassSelectors = '.' + classNames.join(',.');
$('li.row').find(unreadClassSelectors).each(function() {
var $this = $(this);
$.each(classMap, function(unreadClass, readClass) {
if ($this.hasClass(unreadClass)) {
$this.removeClass(unreadClass).addClass(readClass);
}
});
$this.children('dt[title="' + unreadTitle + '"]').attr('title', readTitle);
});
// Remove link to first unread post
$('a').has('span.icon_topic_newest').remove();
// Update mark topics read links
$('[data-ajax="mark_topics_read"]').attr('href', res.U_MARK_TOPICS);
phpbb.closeDarkenWrapper(3000);
});
// This callback finds the post from the delete link, and removes it. // This callback finds the post from the delete link, and removes it.
phpbb.add_ajax_callback('post_delete', function() { phpbb.add_ajax_callback('post_delete', function() {
var el = $(this), var el = $(this),

View file

@ -51,6 +51,7 @@
<!-- IF forumrow.U_UNAPPROVED_TOPICS --><a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a><!-- ENDIF --> <!-- IF forumrow.U_UNAPPROVED_TOPICS --><a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a><!-- ENDIF -->
<!-- IF forumrow.LAST_POST_TIME --><dfn>{L_LAST_POST}</dfn> <!-- IF forumrow.LAST_POST_TIME --><dfn>{L_LAST_POST}</dfn>
<!-- IF forumrow.S_DISPLAY_SUBJECT --> <!-- IF forumrow.S_DISPLAY_SUBJECT -->
<!-- EVENT forumlist_body_last_post_title_prepend -->
<a href="{forumrow.U_LAST_POST}" title="{forumrow.LAST_POST_SUBJECT}" class="lastsubject">{forumrow.LAST_POST_SUBJECT_TRUNCATED}</a> <br /> <a href="{forumrow.U_LAST_POST}" title="{forumrow.LAST_POST_SUBJECT}" class="lastsubject">{forumrow.LAST_POST_SUBJECT_TRUNCATED}</a> <br />
<!-- ENDIF --> <!-- ENDIF -->
{L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL} {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL}

View file

@ -8,7 +8,7 @@
<!-- IF S_DISPLAY_SEARCH --> <!-- IF S_DISPLAY_SEARCH -->
<li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a><!-- IF S_LOAD_UNREADS --> &bull; <a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- ENDIF --><!-- IF S_USER_LOGGED_IN --> &bull; <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a><!-- ENDIF --> &bull; <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li> <li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a><!-- IF S_LOAD_UNREADS --> &bull; <a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- ENDIF --><!-- IF S_USER_LOGGED_IN --> &bull; <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a><!-- ENDIF --> &bull; <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside"><a href="{U_MARK_FORUMS}" accesskey="m" data-ajax="true">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF --> <!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside"><a href="{U_MARK_FORUMS}" accesskey="m" data-ajax="mark_forums_read" data-overlay="false">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF -->
</ul> </ul>
<!-- ENDIF --> <!-- ENDIF -->
@ -29,6 +29,8 @@
</form> </form>
<!-- ENDIF --> <!-- ENDIF -->
<!-- EVENT index_body_stat_blocks_before -->
<!-- IF S_DISPLAY_ONLINE_LIST --> <!-- IF S_DISPLAY_ONLINE_LIST -->
<!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF --> <!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF -->
<p>{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST} <p>{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST}

View file

@ -6,7 +6,8 @@
<div class="inner"> <div class="inner">
<ul class="linklist"> <ul class="linklist">
<li class="icon-home"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}">{L_SITE_HOME}</a> <strong>&#8249;</strong> <!-- ENDIF --><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a></li> <li class="icon-home"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}">{L_SITE_HOME}</a> <strong>&#8249;</strong> <!-- ENDIF --><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a>
<!-- EVENT overall_footer_breadcrumb_append --></li>
<!-- IF not S_IS_BOT --> <!-- IF not S_IS_BOT -->
<!-- IF U_WATCH_FORUM_LINK --><li <!-- IF S_WATCHING_FORUM -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{U_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-ajax="toggle_link" data-toggle-class="icon-<!-- IF not S_WATCHING_FORUM -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_FORUM_TOGGLE}" data-toggle-url="{U_WATCH_FORUM_TOGGLE}">{S_WATCH_FORUM_TITLE}</a></li><!-- ENDIF --> <!-- IF U_WATCH_FORUM_LINK --><li <!-- IF S_WATCHING_FORUM -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{U_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-ajax="toggle_link" data-toggle-class="icon-<!-- IF not S_WATCHING_FORUM -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_FORUM_TOGGLE}" data-toggle-url="{U_WATCH_FORUM_TOGGLE}">{S_WATCH_FORUM_TITLE}</a></li><!-- ENDIF -->
<!-- IF U_WATCH_TOPIC --><li <!-- IF S_WATCHING_TOPIC -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{U_WATCH_TOPIC}" title="{S_WATCH_TOPIC_TITLE}" data-ajax="toggle_link" data-toggle-class="<!-- IF not S_WATCHING_TOPIC -->icon-unsubscribe<!-- ELSE -->icon-subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_TOPIC_TOGGLE}" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}">{S_WATCH_TOPIC_TITLE}</a></li><!-- ENDIF --> <!-- IF U_WATCH_TOPIC --><li <!-- IF S_WATCHING_TOPIC -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{U_WATCH_TOPIC}" title="{S_WATCH_TOPIC_TITLE}" data-ajax="toggle_link" data-toggle-class="<!-- IF not S_WATCHING_TOPIC -->icon-unsubscribe<!-- ELSE -->icon-subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_TOPIC_TOGGLE}" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}">{S_WATCH_TOPIC_TITLE}</a></li><!-- ENDIF -->
@ -19,8 +20,11 @@
</div> </div>
</div> </div>
<div class="copyright">{CREDIT_LINE} <div class="copyright">
<!-- EVENT overall_footer_copyright_prepend -->
{CREDIT_LINE}
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
<!-- EVENT overall_footer_copyright_append -->
<!-- IF DEBUG_OUTPUT --><br />{DEBUG_OUTPUT}<!-- ENDIF --> <!-- IF DEBUG_OUTPUT --><br />{DEBUG_OUTPUT}<!-- ENDIF -->
<!-- IF U_ACP --><br /><strong><a href="{U_ACP}">{L_ACP}</a></strong><!-- ENDIF --> <!-- IF U_ACP --><br /><strong><a href="{U_ACP}">{L_ACP}</a></strong><!-- ENDIF -->
</div> </div>
@ -55,5 +59,6 @@
<!-- INCLUDEJS template/ajax.js --> <!-- INCLUDEJS template/ajax.js -->
{SCRIPTS} {SCRIPTS}
<!-- EVENT overall_footer_after -->
</body> </body>
</html> </html>

View file

@ -84,8 +84,9 @@
<link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" /> <link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" />
<![endif]--> <![endif]-->
</head> <!-- EVENT overall_header_head_append -->
</head>
<body id="phpbb" class="section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}"> <body id="phpbb" class="section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}">
<div id="wrap"> <div id="wrap">
@ -121,7 +122,11 @@
<ul class="linklist navlinks"> <ul class="linklist navlinks">
<!-- DEFINE $MICRODATA = ' itemtype="http://data-vocabulary.org/Breadcrumb" itemscope=""' --> <!-- DEFINE $MICRODATA = ' itemtype="http://data-vocabulary.org/Breadcrumb" itemscope=""' -->
<li class="icon-home"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}"{$MICRODATA}>{L_SITE_HOME}</a> <strong>&#8249;</strong> <!-- ENDIF --><a href="{U_INDEX}" accesskey="h"{$MICRODATA}>{L_INDEX}</a> <!-- BEGIN navlinks --> <strong>&#8249;</strong> <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}>{navlinks.FORUM_NAME}</a><!-- END navlinks --></li> <li class="icon-home"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}"{$MICRODATA}>{L_SITE_HOME}</a> <strong>&#8249;</strong> <!-- ENDIF -->
<a href="{U_INDEX}" accesskey="h"{$MICRODATA}>{L_INDEX}</a>
<!-- BEGIN navlinks --> <strong>&#8249;</strong> <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}>{navlinks.FORUM_NAME}</a><!-- END navlinks -->
<!-- EVENT overall_header_breadcrumb_append -->
</li>
<!-- IF U_EMAIL_TOPIC --><li class="rightside"><a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}" class="sendemail">{L_EMAIL_TOPIC}</a></li><!-- ENDIF --> <!-- IF U_EMAIL_TOPIC --><li class="rightside"><a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}" class="sendemail">{L_EMAIL_TOPIC}</a></li><!-- ENDIF -->
<!-- IF U_EMAIL_PM --><li class="rightside"><a href="{U_EMAIL_PM}" title="{L_EMAIL_PM}" class="sendemail">{L_EMAIL_PM}</a></li><!-- ENDIF --> <!-- IF U_EMAIL_PM --><li class="rightside"><a href="{U_EMAIL_PM}" title="{L_EMAIL_PM}" class="sendemail">{L_EMAIL_PM}</a></li><!-- ENDIF -->
@ -145,12 +150,14 @@
<!-- ENDIF --> <!-- ENDIF -->
<ul class="linklist rightside"> <ul class="linklist rightside">
<!-- EVENT overall_header_navigation_prepend -->
<li class="icon-faq"><a href="{U_FAQ}" title="{L_FAQ_EXPLAIN}">{L_FAQ}</a></li> <li class="icon-faq"><a href="{U_FAQ}" title="{L_FAQ_EXPLAIN}">{L_FAQ}</a></li>
<!-- IF not S_IS_BOT --> <!-- IF not S_IS_BOT -->
<!-- IF S_DISPLAY_MEMBERLIST --><li class="icon-members"><a href="{U_MEMBERLIST}" title="{L_MEMBERLIST_EXPLAIN}">{L_MEMBERLIST}</a></li><!-- ENDIF --> <!-- IF S_DISPLAY_MEMBERLIST --><li class="icon-members"><a href="{U_MEMBERLIST}" title="{L_MEMBERLIST_EXPLAIN}">{L_MEMBERLIST}</a></li><!-- ENDIF -->
<!-- IF not S_USER_LOGGED_IN and S_REGISTER_ENABLED and not (S_SHOW_COPPA or S_REGISTRATION) --><li class="icon-register"><a href="{U_REGISTER}">{L_REGISTER}</a></li><!-- ENDIF --> <!-- IF not S_USER_LOGGED_IN and S_REGISTER_ENABLED and not (S_SHOW_COPPA or S_REGISTRATION) --><li class="icon-register"><a href="{U_REGISTER}">{L_REGISTER}</a></li><!-- ENDIF -->
<li class="icon-logout"><a href="{U_LOGIN_LOGOUT}" title="{L_LOGIN_LOGOUT}" accesskey="x">{L_LOGIN_LOGOUT}</a></li> <li class="icon-logout"><a href="{U_LOGIN_LOGOUT}" title="{L_LOGIN_LOGOUT}" accesskey="x">{L_LOGIN_LOGOUT}</a></li>
<!-- ENDIF --> <!-- ENDIF -->
<!-- EVENT overall_header_navigation_append -->
</ul> </ul>
</div> </div>

View file

@ -213,6 +213,7 @@
<div class="inner"> <div class="inner">
<fieldset class="fields1"> <fieldset class="fields1">
<!-- EVENT posting_editor_options_prepend -->
<!-- IF S_BBCODE_ALLOWED --> <!-- IF S_BBCODE_ALLOWED -->
<div><label for="disable_bbcode"><input type="checkbox" name="disable_bbcode" id="disable_bbcode"{S_BBCODE_CHECKED} /> {L_DISABLE_BBCODE}</label></div> <div><label for="disable_bbcode"><input type="checkbox" name="disable_bbcode" id="disable_bbcode"{S_BBCODE_CHECKED} /> {L_DISABLE_BBCODE}</label></div>
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -10,5 +10,6 @@
<!-- 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 -->
{SCRIPTS} {SCRIPTS}
<!-- EVENT simple_footer_after -->
</body> </body>
</html> </html>

View file

@ -9,8 +9,8 @@
<title>{SITENAME} &bull; {PAGE_TITLE}</title> <title>{SITENAME} &bull; {PAGE_TITLE}</title>
<link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" /> <link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" />
<!-- EVENT ucp_pm_viewmessage_print_head_append -->
</head> </head>
<body id="phpbb"> <body id="phpbb">
<div id="wrap"> <div id="wrap">
<a id="top" accesskey="t"></a> <a id="top" accesskey="t"></a>

View file

@ -28,7 +28,7 @@
<!-- IF S_HAS_SUBFORUM --> <!-- IF S_HAS_SUBFORUM -->
<!-- IF not S_IS_BOT and U_MARK_FORUMS --> <!-- IF not S_IS_BOT and U_MARK_FORUMS -->
<ul class="linklist"> <ul class="linklist">
<li class="rightside"><a href="{U_MARK_FORUMS}">{L_MARK_SUBFORUMS_READ}</a></li> <li class="rightside"><a href="{U_MARK_FORUMS}" data-ajax="mark_forums_read" data-overlay="false">{L_MARK_SUBFORUMS_READ}</a></li>
</ul> </ul>
<!-- ENDIF --> <!-- ENDIF -->
<!-- INCLUDE forumlist_body.html --> <!-- INCLUDE forumlist_body.html -->
@ -57,7 +57,7 @@
<!-- IF .pagination or TOTAL_POSTS or TOTAL_TOPICS --> <!-- IF .pagination or TOTAL_POSTS or TOTAL_TOPICS -->
<div class="pagination"> <div class="pagination">
<!-- IF not S_IS_BOT and U_MARK_TOPICS --><a href="{U_MARK_TOPICS}" accesskey="m" data-ajax="true">{L_MARK_TOPICS_READ}</a> &bull; <!-- ENDIF --> <!-- IF not S_IS_BOT and U_MARK_TOPICS --><a href="{U_MARK_TOPICS}" accesskey="m" data-ajax="mark_topics_read" data-overlay="false">{L_MARK_TOPICS_READ}</a> &bull; <!-- ENDIF -->
<!-- IF TOTAL_TOPICS -->{TOTAL_TOPICS} &bull; <!-- ENDIF --> <!-- IF TOTAL_TOPICS -->{TOTAL_TOPICS} &bull; <!-- ENDIF -->
<!-- IF .pagination --> <!-- IF .pagination -->
<!-- INCLUDE pagination.html --> <!-- INCLUDE pagination.html -->
@ -211,7 +211,7 @@
<!-- IF PAGE_NUMBER or TOTAL_POSTS or TOTAL_TOPICS --> <!-- IF PAGE_NUMBER or TOTAL_POSTS or TOTAL_TOPICS -->
<div class="pagination"> <div class="pagination">
<!-- IF TOTAL_TOPICS and not S_IS_BOT and U_MARK_TOPICS --><a href="{U_MARK_TOPICS}">{L_MARK_TOPICS_READ}</a> &bull; <!-- ENDIF --> <!-- IF TOTAL_TOPICS and not S_IS_BOT and U_MARK_TOPICS --><a href="{U_MARK_TOPICS}" data-ajax="mark_topics_read" data-overlay="false">{L_MARK_TOPICS_READ}</a> &bull; <!-- ENDIF -->
<!-- IF TOTAL_POSTS and not NEWEST_USER --> {TOTAL_POSTS}<!-- ELSEIF TOTAL_TOPICS and not NEWEST_USER --> {TOTAL_TOPICS} &bull; <!-- ENDIF --> <!-- IF TOTAL_POSTS and not NEWEST_USER --> {TOTAL_POSTS}<!-- ELSEIF TOTAL_TOPICS and not NEWEST_USER --> {TOTAL_TOPICS} &bull; <!-- ENDIF -->
<!-- IF TOTAL_USERS -->{TOTAL_USERS} &bull; <!-- ENDIF --> <!-- IF TOTAL_USERS -->{TOTAL_USERS} &bull; <!-- ENDIF -->
<!-- IF .pagination --> <!-- IF .pagination -->

View file

@ -1,6 +1,6 @@
<!-- INCLUDE overall_header.html --> <!-- INCLUDE overall_header.html -->
<!-- IF U_MCP --><p>[&nbsp;<a href="{U_MCP}">{L_MCP}</a>&nbsp;]</p><!-- ENDIF --> <!-- IF U_MCP --><p>[&nbsp;<a href="{U_MCP}">{L_MCP}</a>&nbsp;]</p><!-- ENDIF -->
<h2><a href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></h2> <h2><!-- EVENT viewtopic_topic_title_prepend --><a href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></h2>
<!-- NOTE: remove the style="display: none" when you want to have the forum description on the topic body --> <!-- NOTE: remove the style="display: none" when you want to have the forum description on the topic body -->
<!-- IF FORUM_DESC --><div style="display: none !important;">{FORUM_DESC}<br /></div><!-- ENDIF --> <!-- IF FORUM_DESC --><div style="display: none !important;">{FORUM_DESC}<br /></div><!-- ENDIF -->

View file

@ -9,8 +9,8 @@
<title>{SITENAME} &bull; {PAGE_TITLE}</title> <title>{SITENAME} &bull; {PAGE_TITLE}</title>
<link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" /> <link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" />
<!-- EVENT viewtopic_print_head_append -->
</head> </head>
<body id="phpbb"> <body id="phpbb">
<div id="wrap"> <div id="wrap">
<a id="top" accesskey="t"></a> <a id="top" accesskey="t"></a>

View file

@ -2,7 +2,8 @@
<table class="tablebg" width="100%" cellspacing="1" cellpadding="0" style="margin-top: 5px;"> <table class="tablebg" width="100%" cellspacing="1" cellpadding="0" style="margin-top: 5px;">
<tr> <tr>
<td class="row1"> <td class="row1">
<p class="breadcrumbs"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}"{$MICRODATA}>{L_SITE_HOME}</a> <strong>&#187;</strong> <!-- ENDIF --><a href="{U_INDEX}"{$MICRODATA}>{L_INDEX}</a><!-- BEGIN navlinks --> &#187; <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}>{navlinks.FORUM_NAME}</a><!-- END navlinks --></p> <p class="breadcrumbs"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}"{$MICRODATA}>{L_SITE_HOME}</a> <strong>&#187;</strong> <!-- ENDIF --><a href="{U_INDEX}"{$MICRODATA}>{L_INDEX}</a><!-- BEGIN navlinks --> &#187; <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}>{navlinks.FORUM_NAME}</a><!-- END navlinks -->
<!-- EVENT overall_header_breadcrumb_append --></p>
<p class="datetime">{S_TIMEZONE}</p> <p class="datetime">{S_TIMEZONE}</p>
</td> </td>
</tr> </tr>

View file

@ -61,6 +61,7 @@
<td class="row2" align="center" nowrap="nowrap"> <td class="row2" align="center" nowrap="nowrap">
<!-- IF forumrow.LAST_POST_TIME --> <!-- IF forumrow.LAST_POST_TIME -->
<!-- IF forumrow.S_DISPLAY_SUBJECT --> <!-- IF forumrow.S_DISPLAY_SUBJECT -->
<!-- EVENT forumlist_body_last_post_title_prepend -->
<p class="topicdetails"><a href="{forumrow.U_LAST_POST}" title="{forumrow.LAST_POST_SUBJECT}" class="lastsubject">{forumrow.LAST_POST_SUBJECT_TRUNCATED}</a></p> <p class="topicdetails"><a href="{forumrow.U_LAST_POST}" title="{forumrow.LAST_POST_SUBJECT}" class="lastsubject">{forumrow.LAST_POST_SUBJECT_TRUNCATED}</a></p>
<!-- ENDIF --> <!-- ENDIF -->
<p class="topicdetails"><!-- IF forumrow.U_UNAPPROVED_TOPICS --><a href="{forumrow.U_UNAPPROVED_TOPICS}" class="imageset">{UNAPPROVED_IMG}</a>&nbsp;<!-- ENDIF -->{forumrow.LAST_POST_TIME}</p> <p class="topicdetails"><!-- IF forumrow.U_UNAPPROVED_TOPICS --><a href="{forumrow.U_UNAPPROVED_TOPICS}" class="imageset">{UNAPPROVED_IMG}</a>&nbsp;<!-- ENDIF -->{forumrow.LAST_POST_TIME}</p>

View file

@ -18,6 +18,8 @@
<!-- INCLUDE breadcrumbs.html --> <!-- INCLUDE breadcrumbs.html -->
<!-- EVENT index_body_stat_blocks_before -->
<!-- IF S_DISPLAY_ONLINE_LIST --> <!-- IF S_DISPLAY_ONLINE_LIST -->
<br clear="all" /> <br clear="all" />

View file

@ -3,8 +3,11 @@
<div id="wrapfooter"> <div id="wrapfooter">
<!-- IF U_ACP --><span class="gensmall">[ <a href="{U_ACP}">{L_ACP}</a> ]</span><br /><br /><!-- ENDIF --> <!-- IF U_ACP --><span class="gensmall">[ <a href="{U_ACP}">{L_ACP}</a> ]</span><br /><br /><!-- ENDIF -->
<span class="copyright">{CREDIT_LINE} <span class="copyright">
<!-- EVENT overall_footer_copyright_prepend -->
{CREDIT_LINE}
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
<!-- EVENT overall_footer_copyright_append -->
<!-- IF DEBUG_OUTPUT --><br /><bdo dir="ltr">[ {DEBUG_OUTPUT} ]</bdo><!-- ENDIF --></span> <!-- IF DEBUG_OUTPUT --><br /><bdo dir="ltr">[ {DEBUG_OUTPUT} ]</bdo><!-- ENDIF --></span>
</div> </div>
@ -12,5 +15,6 @@
<!-- 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 -->
{SCRIPTS} {SCRIPTS}
<!-- EVENT overall_footer_after -->
</body> </body>
</html> </html>

View file

@ -129,6 +129,9 @@ function marklist(id, name, state)
// ]]> // ]]>
</script> </script>
<!-- EVENT overall_header_head_append -->
</head> </head>
<body class="{S_CONTENT_DIRECTION}"> <body class="{S_CONTENT_DIRECTION}">

View file

@ -257,6 +257,7 @@
</td> </td>
<td class="row2"> <td class="row2">
<table cellpadding="1"> <table cellpadding="1">
<!-- EVENT posting_editor_options_prepend -->
<!-- IF S_BBCODE_ALLOWED --> <!-- IF S_BBCODE_ALLOWED -->
<tr> <tr>
<td><input type="checkbox" class="radio" name="disable_bbcode"{S_BBCODE_CHECKED} /></td> <td><input type="checkbox" class="radio" name="disable_bbcode"{S_BBCODE_CHECKED} /></td>

View file

@ -9,5 +9,6 @@
<!-- 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 -->
{SCRIPTS} {SCRIPTS}
<!-- EVENT simple_footer_after -->
</body> </body>
</html> </html>

View file

@ -15,7 +15,7 @@
<!-- ENDIF --> <!-- ENDIF -->
<div id="pageheader"> <div id="pageheader">
<h2><a class="titles" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></h2> <h2><!-- EVENT viewtopic_topic_title_prepend --><a class="titles" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></h2>
<!-- IF MODERATORS --> <!-- IF MODERATORS -->
<p class="moderators"><!-- IF S_SINGLE_MODERATOR -->{L_MODERATOR}<!-- ELSE -->{L_MODERATORS}<!-- ENDIF -->{L_COLON} {MODERATORS}</p> <p class="moderators"><!-- IF S_SINGLE_MODERATOR -->{L_MODERATOR}<!-- ELSE -->{L_MODERATORS}<!-- ENDIF -->{L_COLON} {MODERATORS}</p>

View file

@ -181,6 +181,20 @@ if ($mark_read == 'topics')
$redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); $redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
meta_refresh(3, $redirect_url); meta_refresh(3, $redirect_url);
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_TOPICS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics&mark_time=" . time()) : '',
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $user->lang['TOPICS_MARKED']
);
$json_response = new phpbb_json_response();
$json_response->send($data);
}
trigger_error($user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>')); trigger_error($user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>'));
} }

View file

@ -1353,7 +1353,7 @@ if (sizeof($attach_list))
} }
$template->assign_vars(array( $template->assign_vars(array(
'S_HAS_ATTACHMENTS' => !empty($attachments), 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'],
)); ));
$methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); $methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx);

View file

@ -30,7 +30,7 @@ example for mysqli can be found below. More information on configuration
options can be found on the wiki (see below). options can be found on the wiki (see below).
<?php <?php
$dbms = 'mysqli'; $dbms = 'phpbb_db_driver_mysqli';
$dbhost = 'localhost'; $dbhost = 'localhost';
$dbport = ''; $dbport = '';
$dbname = 'database'; $dbname = 'database';

View file

@ -2,28 +2,264 @@
/** /**
* *
* @package testing * @package testing
* @version $Id$ * @copyright (c) 2012 phpBB Group
* @copyright (c) 2008 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
// require_once dirname(__FILE__) . '/../../phpBB/includes/bbcode/bbcode_parser_base.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
// require_once dirname(__FILE__) . '/../../phpBB/includes/bbcode/bbcode_parser.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/bbcode.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/message_parser.php';
class phpbb_bbcode_parser_test extends PHPUnit_Framework_TestCase class phpbb_bbcode_parser_test extends PHPUnit_Framework_TestCase
{ {
public function test_both_passes() public function bbcode_firstpass_data()
{ {
$this->markTestIncomplete('New bbcode parser has not been backported from feature/ascraeus-experiment yet.'); return array(
// Default bbcodes from in their simplest way
$parser = new phpbb_bbcode_parser(); array(
'Test default bbcodes: simple bold',
'[b]bold[/b]',
'[b:]bold[/b:]',
),
array(
'Test default bbcodes: simple underlined',
'[u]underlined[/u]',
'[u:]underlined[/u:]',
),
array(
'Test default bbcodes: simple italic',
'[i]italic[/i]',
'[i:]italic[/i:]',
),
array(
'Test default bbcodes: simple color rgb',
'[color=#FF0000]colored[/color]',
'[color=#FF0000:]colored[/color:]',
),
array(
'Test default bbcodes: simple color name',
'[color=red]colored[/color]',
'[color=red:]colored[/color:]',
),
array(
'Test default bbcodes: simple size',
'[size=75]smaller[/size]',
'[size=75:]smaller[/size:]',
),
array(
'Test default bbcodes: simple quote',
'[quote]quoted[/quote]',
'[quote:]quoted[/quote:]',
),
array(
'Test default bbcodes: simple quote with username',
'[quote=&quot;username&quot;]quoted[/quote]',
'[quote=&quot;username&quot;:]quoted[/quote:]',
),
array(
'Test default bbcodes: simple code',
'[code]unparsed code[/code]',
'[code:]unparsed code[/code:]',
),
array(
'Test default bbcodes: simple php code',
'[code=php]unparsed code[/code]',
'[code=php:]<span class="syntaxdefault">unparsed&nbsp;code</span>[/code:]',
),
array(
'Test default bbcodes: simple list',
'[list]no item[/list]',
'[list:]no item[/list:u:]',
),
array(
'Test default bbcodes: simple list-item only',
'[*]unparsed',
'[*]unparsed',
),
array(
'Test default bbcodes: simple list-item',
'[list][*]item[/list]',
'[list:][*:]item[/*:m:][/list:u:]',
),
array(
'Test default bbcodes: simple list-item closed',
'[list][*]item[/*][/list]',
'[list:][*:]item[/*:][/list:u:]',
),
array(
'Test default bbcodes: simple list-item numbered',
'[list=1][*]item[/list]',
'[list=1:][*:]item[/*:m:][/list:o:]',
),
array(
'Test default bbcodes: simple list-item alpha',
'[list=a][*]item[/list]',
'[list=a:][*:]item[/*:m:][/list:o:]',
),
array(
'Test default bbcodes: simple list-item roman',
'[list=i][*]item[/list]',
'[list=i:][*:]item[/*:m:][/list:o:]',
),
array(
'Test default bbcodes: simple list-item disc',
'[list=disc][*]item[/list]',
'[list=disc:][*:]item[/*:m:][/list:u:]',
),
array(
'Test default bbcodes: simple list-item circle',
'[list=circle][*]item[/list]',
'[list=circle:][*:]item[/*:m:][/list:u:]',
),
array(
'Test default bbcodes: simple list-item square',
'[list=square][*]item[/list]',
'[list=square:][*:]item[/*:m:][/list:u:]',
),
array(
'Test default bbcodes: simple img',
'[img]https://area51.phpbb.com/images/area51.png[/img]',
'[img:]https&#58;//area51&#46;phpbb&#46;com/images/area51&#46;png[/img:]',
),
array(
'Test default bbcodes: simple url',
'[url]https://area51.phpbb.com/[/url]',
'[url:]https&#58;//area51&#46;phpbb&#46;com/[/url:]',
),
array(
'Test default bbcodes: simple url with description',
'[url=https://area51.phpbb.com/]Area51[/url]',
'[url=https&#58;//area51&#46;phpbb&#46;com/:]Area51[/url:]',
),
array(
'Test default bbcodes: simple email',
'[email]bbcode-test@phpbb.com[/email]',
'[email:]bbcode-test@phpbb&#46;com[/email:]',
),
array(
'Test default bbcodes: simple email with description',
'[email=bbcode-test@phpbb.com]Email[/email]',
'[email=bbcode-test@phpbb&#46;com:]Email[/email:]',
),
array(
'Test default bbcodes: simple attachment',
'[attachment=0]filename[/attachment]',
'[attachment=0:]<!-- ia0 -->filename<!-- ia0 -->[/attachment:]',
),
$result = $parser->first_pass('[i]Italic [u]underlined text[/u][/i]'); // Special cases for quote which were reported as bugs before
$result = $parser->second_pass($result); array(
'PHPBB3-1401 - correct: parsed',
'[quote=&quot;&#91;test]test&quot;]test [ test[/quote]',
'[quote=&quot;&#91;test]test&quot;:]test [ test[/quote:]',
),
array(
'PHPBB3-6117 - correct: parsed',
'[quote]test[/quote] test ] and [ test [quote]test[/quote]',
'[quote:]test[/quote:] test ] and [ test [quote:]test[/quote:]',
),
array(
'PHPBB3-6200 - correct: parsed',
'[quote=&quot;[&quot;]test[/quote]',
'[quote=&quot;&#91;&quot;:]test[/quote:]',
),
array(
'PHPBB3-9364 - quoted: "test[/[/b]quote] test" / non-quoted: "[/quote] test" - also failed if layout distorted',
'[quote]test[/[/b]quote] test [/quote][/quote] test',
'[quote:]test[/[/b]quote] test [/quote:][/quote] test',
),
array(
'PHPBB3-8096 - first quote tag parsed, second quote tag unparsed',
'[quote=&quot;a&quot;]a[/quote][quote=&quot;a]a[/quote]',
'[quote=&quot;a&quot;:]a[/quote:][quote=&quot;a]a[/quote]',
),
$expected = '<span style="font-style: italic">Italic <span style="text-decoration: underline">underlined text</span></span>'; // Simple bbcodes nesting
array(
'Allow textual bbcodes in textual bbcodes',
'[b]bold [i]bold + italic[/i][/b]',
'[b:]bold [i:]bold + italic[/i:][/b:]',
),
array(
'Allow textual bbcodes in url with description',
'[url=https://area51.phpbb.com/]Area51 [i]italic[/i][/url]',
'[url=https&#58;//area51&#46;phpbb&#46;com/:]Area51 [i:]italic[/i:][/url:]',
),
array(
'Allow url with description in textual bbcodes',
'[i]italic [url=https://area51.phpbb.com/]Area51[/url][/i]',
'[i:]italic [url=https&#58;//area51&#46;phpbb&#46;com/:]Area51[/url:][/i:]',
),
$this->assertEquals($expected, $result, 'Simple nested BBCode first+second pass'); // Nesting bbcodes into quote usernames
array(
'Allow textual bbcodes in usernames',
'[quote=&quot;[i]test[/i]&quot;]test[/quote]',
'[quote=&quot;[i:]test[/i:]&quot;:]test[/quote:]',
),
array(
'Allow links bbcodes in usernames',
'[quote=&quot;[url=https://area51.phpbb.com/]test[/url]&quot;]test[/quote]',
'[quote=&quot;[url=https&#58;//area51&#46;phpbb&#46;com/:]test[/url:]&quot;:]test[/quote:]',
),
array(
'Allow img bbcodes in usernames - Username displayed the image',
'[quote=&quot;[img]https://area51.phpbb.com/images/area51.png[/img]&quot;]test[/quote]',
'[quote=&quot;[img:]https&#58;//area51&#46;phpbb&#46;com/images/area51&#46;png[/img:]&quot;:]test[/quote:]',
),
array(
'Disallow flash bbcodes in usernames - Username displayed as [flash]http://www.phpbb.com/[/flash]',
'[quote=&quot;[flash]http://www.phpbb.com/[/flash]&quot;]test[/quote]',
'[quote=&quot;&#91;flash]http://www.phpbb.com/&#91;/flash]&quot;:]test[/quote:]',
),
array(
'Disallow quote bbcodes in usernames - Username displayed as [quote]test[/quote]',
'[quote=&quot;[quote]test[/quote]&quot;]test[/quote]',
'[quote=&quot;&#91;quote]test&#91;/quote]&quot;:]test[/quote:]',
),
// Do not parse bbcodes in code boxes
array(
'Do not parse textual bbcodes in code',
'[code]unparsed code [b]bold [i]bold + italic[/i][/b][/code]',
'[code:]unparsed code &#91;b&#93;bold &#91;i&#93;bold + italic&#91;/i&#93;&#91;/b&#93;[/code:]',
),
array(
'Do not parse quote bbcodes in code',
'[code]unparsed code [quote=&quot;username&quot;]quoted[/quote][/code]',
'[code:]unparsed code &#91;quote=&quot;username&quot;&#93;quoted&#91;/quote&#93;[/code:]',
),
// New user friendly mixed nesting
array(
'Textual bbcode nesting into textual bbcode',
'[b]bold [i]bold + italic[/b] italic[/i]',
'[b:]bold [i:]bold + italic[/b:] italic[/i:]',
'Incomplete test case: secondpass parses as [b:]bold [i:]bold + italic[/i:] italic[/b:]',
),
);
}
/**
* @dataProvider bbcode_firstpass_data
*/
public function test_bbcode_firstpass($description, $message, $expected, $incomplete = false)
{
if ($incomplete)
{
$this->markTestIncomplete($incomplete);
}
global $user, $request;
$user = new phpbb_mock_user;
$request = new phpbb_mock_request;
$bbcode = new bbcode_firstpass();
$bbcode->message = $message;
$bbcode->bbcode_init(false);
$bbcode->parse_bbcode();
$this->assertEquals($expected, $bbcode->message);
} }
} }

View file

@ -38,10 +38,16 @@ class phpbb_compress_test extends phpbb_test_case
$phpbb_root_path = ''; $phpbb_root_path = '';
$this->path = dirname(__FILE__) . '/fixtures/'; $this->path = dirname(__FILE__) . '/fixtures/';
}
if (!@extension_loaded('zlib') || !@extension_loaded('bz2')) protected function check_extensions($extensions)
{
foreach ($extensions as $extension)
{ {
$this->markTestSkipped('PHP needs to be compiled with --with-zlib and --with-bz2 in order to run these tests'); if (!@extension_loaded($extension))
{
$this->markTestSkipped("$extension extension is not loaded");
}
} }
} }
@ -114,17 +120,18 @@ class phpbb_compress_test extends phpbb_test_case
public function tar_archive_list() public function tar_archive_list()
{ {
return array( return array(
array('archive.tar', '.tar'), array('archive.tar', '.tar', array()),
array('archive.tar.gz', '.tar.gz'), array('archive.tar.gz', '.tar.gz', array('zlib')),
array('archive.tar.bz2', '.tar.bz2'), array('archive.tar.bz2', '.tar.bz2', array('bz2')),
); );
} }
/** /**
* @dataProvider tar_archive_list * @dataProvider tar_archive_list
*/ */
public function test_extract_tar($filename, $type) public function test_extract_tar($filename, $type, $extensions)
{ {
$this->check_extensions($extensions);
$compress = new compress_tar('r', $this->path . $filename); $compress = new compress_tar('r', $this->path . $filename);
$compress->extract('tests/compress/' . self::EXTRACT_DIR); $compress->extract('tests/compress/' . self::EXTRACT_DIR);
$this->valid_extraction(); $this->valid_extraction();
@ -141,8 +148,10 @@ class phpbb_compress_test extends phpbb_test_case
* @depends test_extract_tar * @depends test_extract_tar
* @dataProvider tar_archive_list * @dataProvider tar_archive_list
*/ */
public function test_compress_tar($filename, $type) public function test_compress_tar($filename, $type, $extensions)
{ {
$this->check_extensions($extensions);
$tar = dirname(__FILE__) . self::ARCHIVE_DIR . $filename; $tar = dirname(__FILE__) . self::ARCHIVE_DIR . $filename;
$compress = new compress_tar('w', $tar); $compress = new compress_tar('w', $tar);
$this->archive_files($compress); $this->archive_files($compress);
@ -160,6 +169,8 @@ class phpbb_compress_test extends phpbb_test_case
*/ */
public function test_compress_zip() public function test_compress_zip()
{ {
$this->check_extensions(array('zlib'));
$zip = dirname(__FILE__) . self::ARCHIVE_DIR . 'archive.zip'; $zip = dirname(__FILE__) . self::ARCHIVE_DIR . 'archive.zip';
$compress = new compress_zip('w', $zip); $compress = new compress_zip('w', $zip);
$this->archive_files($compress); $this->archive_files($compress);

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