Merge branch 'develop' into ticket/11215

This commit is contained in:
David King 2013-08-31 13:37:11 -07:00
commit af1eb7466f
448 changed files with 3685 additions and 2833 deletions

View file

@ -170,8 +170,8 @@
checkreturn="true" />
<!-- Install composer dependencies, if there are any. -->
<exec dir="."
command='php -r "\$j = json_decode(file_get_contents("composer.json")); echo isset(\$j->require);"'
<exec dir="${dir}"
command='php -r "\$j = json_decode(file_get_contents(\"composer.json\")); echo isset(\$j->require);"'
checkreturn="true"
outputProperty='composer-has-dependencies' />
<if>

View file

@ -121,6 +121,7 @@ if (sizeof($package->old_packages))
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $dest_filename_dir);
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $dest_filename_dir);
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $dest_filename_dir);
$package->run_command('mkdir ' . $dest_filename_dir . '/install/update');
$package->run_command('mkdir ' . $dest_filename_dir . '/install/update/old');
@ -256,6 +257,7 @@ $update_info = array(
// Copy the install files to their respective locations
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $package->get('patch_directory'));
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $package->get('patch_directory'));
$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $package->get('patch_directory'));
// Remove some files
chdir($package->get('patch_directory') . '/install');

View file

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

View file

@ -127,8 +127,10 @@ phpbb.addAjaxCallback('activate_deactivate', function(res) {
* The removes the parent row of the link or form that triggered the callback,
* and is good for stuff like the removal of forums.
*/
phpbb.addAjaxCallback('row_delete', function() {
phpbb.addAjaxCallback('row_delete', function(res) {
if (res.SUCCESS !== false) {
$(this).parents('tr').remove();
}
});

View file

@ -109,27 +109,14 @@
<!-- ENDIF -->
</fieldset>
<!-- IF not S_UP_TO_DATE -->
<form id="install_dbupdate" method="post" action="{U_DB_UPDATE_ACTION}">
<fieldset class="submit-buttons">
<p>{L_UPDATE_DATABASE_EXPLAIN}</p>
<input class="button1" type="submit" name="db_update" value="{L_UPDATE_DATABASE}" />
</fieldset>
</form>
<!-- ELSE -->
<form id="install_update" method="post" action="{U_ACTION}">
<fieldset class="submit-buttons">
<p>{L_CHECK_FILES_UP_TO_DATE}</p>
<p>{L_CHECK_FILES_EXPLAIN}</p>
<input class="button1" type="submit" name="submit" value="{L_CHECK_FILES}" />
</fieldset>
</form>
<!-- ENDIF -->
<!-- ELSEIF S_DB_UPDATE -->
@ -155,18 +142,10 @@
<!-- ELSE -->
<h1>{L_UPDATE_DB_SUCCESS}</h1>
<br /><br />
<form id="install_update" method="post" action="{U_ACTION}">
<fieldset class="submit-buttons">
<p>{L_CHECK_FILES_EXPLAIN}</p>
<input class="button1" type="submit" name="submit" value="{L_CHECK_FILES}" />
</fieldset>
</form>
<div class="successbox">
<h3>{L_UPDATE_SUCCESS}</h3>
<p>{L_EVERYTHING_UP_TO_DATE}</p>
</div>
<!-- ENDIF -->
@ -174,10 +153,18 @@
<!-- IF S_ALL_UP_TO_DATE -->
<div class="successbox">
<h3>{L_UPDATE_SUCCESS}</h3>
<h1>{L_UPDATE_FILE_SUCCESS}</h1>
<p>{L_ALL_FILES_UP_TO_DATE}</p>
</div>
<p>{L_UPDATE_DATABASE_EXPLAIN}</p>
<form id="install_dbupdate" method="post" action="{U_DB_UPDATE_ACTION}">
<fieldset class="submit-buttons">
<input class="button1" type="submit" name="db_update" value="{L_UPDATE_DATABASE}" />
</fieldset>
</form>
<!-- ELSE -->
<h1>{L_COLLECTED_INFORMATION}</h1>

View file

@ -22,7 +22,7 @@ $auth->acl($user->data);
$user->setup();
// Set custom template for admin area
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
$template->set_custom_style('admin', $phpbb_admin_path . 'style');
$template->set_filenames(array(
'body' => 'colour_swatch.html')

View file

@ -46,7 +46,7 @@ if (!defined('PHPBB_INSTALLED'))
$script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path);
// Eliminate . and .. from the path
require($phpbb_root_path . 'includes/filesystem.' . $phpEx);
require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
$phpbb_filesystem = new phpbb_filesystem();
$script_path = $phpbb_filesystem->clean_path($script_path);
@ -71,7 +71,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
// Include files
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
@ -85,7 +85,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// Setup class loader first
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
@ -124,7 +124,6 @@ $phpbb_extension_manager = $phpbb_container->get('ext.manager');
$phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader');
$template = $phpbb_container->get('template');
$phpbb_style = $phpbb_container->get('style');
// Add own hook handler
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);

View file

@ -8,6 +8,12 @@ imports:
- { resource: auth_providers.yml }
services:
acl.permissions:
class: phpbb_permissions
arguments:
- @dispatcher
- @user
auth:
class: phpbb_auth
@ -92,7 +98,7 @@ services:
arguments:
- @user
- @service_container
- @style
- @template
cron.task_collection:
class: phpbb_di_service_collection
@ -126,7 +132,6 @@ services:
- [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]]
dbal.tools:
file: %core.root_path%includes/db/db_tools.%core.php_ext%
class: phpbb_db_tools
arguments:
- @dbal.conn
@ -240,33 +245,12 @@ services:
- %tables.notifications%
- %tables.user_notifications%
php_ini:
class: phpbb_php_ini
request:
class: phpbb_request
style:
class: phpbb_style
arguments:
- %core.root_path%
- %core.php_ext%
- @config
- @user
- @style.resource_locator
- @style.path_provider_ext
- @template
style.resource_locator:
class: phpbb_style_resource_locator
style.path_provider_ext:
class: phpbb_style_extension_path_provider
arguments:
- @ext.manager
- @style.path_provider
- %core.root_path%
style.path_provider:
class: phpbb_style_path_provider
template:
class: phpbb_template_twig
arguments:

0
phpBB/develop/blank.gif Normal file
View file

0
phpBB/develop/blank.jpg Normal file
View file

View file

@ -149,7 +149,8 @@ foreach ($schema_data as $table_name => $table_data)
list($orig_column_type, $column_length) = explode(':', $column_data[0]);
$column_type = sprintf($dbms_type_map['mysql_41'][$orig_column_type . ':'], $column_length);
if (isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0]))
if (isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit']) &&
isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0]))
{
switch ($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0])
{
@ -698,6 +699,24 @@ function get_schema_struct()
),
);
$schema_data['phpbb_login_attempts'] = array(
'COLUMNS' => array(
'attempt_ip' => array('VCHAR:40', ''),
'attempt_browser' => array('VCHAR:150', ''),
'attempt_forwarded_for' => array('VCHAR:255', ''),
'attempt_time' => array('TIMESTAMP', 0),
'user_id' => array('UINT', 0),
'username' => array('VCHAR_UNI:255', 0),
'username_clean' => array('VCHAR_CI', 0),
),
'KEYS' => array(
'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')),
'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')),
'att_time' => array('INDEX', array('attempt_time')),
'user_id' => array('INDEX', 'user_id'),
),
);
$schema_data['phpbb_moderator_cache'] = array(
'COLUMNS' => array(
'forum_id' => array('UINT', 0),
@ -901,6 +920,7 @@ function get_schema_struct()
'field_default_value' => array('VCHAR_UNI', ''),
'field_validation' => array('VCHAR_UNI:20', ''),
'field_required' => array('BOOL', 0),
'field_show_novalue' => array('BOOL', 0),
'field_show_on_reg' => array('BOOL', 0),
'field_show_on_vt' => array('BOOL', 0),
'field_show_profile' => array('BOOL', 0),

View file

@ -183,6 +183,8 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11662">PHPBB3-11662</a>] - &quot;occured&quot; should be &quot;occurred&quot;</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11670">PHPBB3-11670</a>] - Replace trademark ™ with ® on &quot;Welcome to phpBB&quot; install page</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11674">PHPBB3-11674</a>] - Do not include vendor folder if there are no dependencies.</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11524">PHPBB3-11524</a>] - MySQL Upgrader throws warnings on PHP 5.4</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11720">PHPBB3-11720</a>] - Reporting posts leads to white page error</li>
</ul>
<h4>Improvement</h4>
<ul>
@ -206,6 +208,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11294">PHPBB3-11294</a>] - Update extension list in running tests doc</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11368">PHPBB3-11368</a>] - Latest pm reports row count</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11583">PHPBB3-11583</a>] - InnoDB supports FULLTEXT index since MySQL 5.6.4.</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11740">PHPBB3-11740</a>] - Update link in FAQ to Ideas Centre</li>
</ul>
<h4>Sub-task</h4>
<ul>
@ -231,6 +234,8 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11529">PHPBB3-11529</a>] - Rename RUNNING_TESTS file to .md file to render it on GitHub</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11576">PHPBB3-11576</a>] - Make phpBB Test Suite MySQL behave at least as strict as phpBB MySQL driver</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11671">PHPBB3-11671</a>] - Add phing/phing to composer.json</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11752">PHPBB3-11752</a>] - Update phpBB.com URLs to https in email templates</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11753">PHPBB3-11753</a>] - Upgrade mysql_upgrader.php schema data.</li>
</ul>
<a name="v3010"></a><h3>1.ii. Changes since 3.0.10</h3>

View file

@ -832,7 +832,7 @@ $sql = 'SELECT *
$sql_ary = array(
'somedata' =&gt; $my_string,
'otherdata' =&gt; $an_int,
'moredata' =&gt; $another_int
'moredata' =&gt; $another_int,
);
$db-&gt;sql_query('INSERT INTO ' . SOME_TABLE . ' ' . $db-&gt;sql_build_array('INSERT', $sql_ary));
@ -844,7 +844,7 @@ $db-&gt;sql_query('INSERT INTO ' . SOME_TABLE . ' ' . $db-&gt;sql_build_array('I
$sql_ary = array(
'somedata' =&gt; $my_string,
'otherdata' =&gt; $an_int,
'moredata' =&gt; $another_int
'moredata' =&gt; $another_int,
);
$sql = 'UPDATE ' . SOME_TABLE . '
@ -937,20 +937,20 @@ $sql_array = array(
'FROM' =&gt; array(
FORUMS_WATCH_TABLE =&gt; 'fw',
FORUMS_TABLE =&gt; 'f'
FORUMS_TABLE =&gt; 'f',
),
'LEFT_JOIN' =&gt; array(
array(
'FROM' =&gt; array(FORUMS_TRACK_TABLE =&gt; 'ft'),
'ON' =&gt; 'ft.user_id = ' . $user-&gt;data['user_id'] . ' AND ft.forum_id = f.forum_id'
)
'ON' =&gt; 'ft.user_id = ' . $user-&gt;data['user_id'] . ' AND ft.forum_id = f.forum_id',
),
),
'WHERE' =&gt; 'fw.user_id = ' . $user-&gt;data['user_id'] . '
AND f.forum_id = fw.forum_id',
'ORDER_BY' =&gt; 'left_id'
'ORDER_BY' =&gt; 'left_id',
);
$sql = $db-&gt;sql_build_query('SELECT', $sql_array);
@ -964,13 +964,13 @@ $sql_array = array(
'FROM' =&gt; array(
FORUMS_WATCH_TABLE =&gt; 'fw',
FORUMS_TABLE =&gt; 'f'
FORUMS_TABLE =&gt; 'f',
),
'WHERE' =&gt; 'fw.user_id = ' . $user-&gt;data['user_id'] . '
AND f.forum_id = fw.forum_id',
'ORDER_BY' =&gt; 'left_id'
'ORDER_BY' =&gt; 'left_id',
);
if ($config['load_db_lastread'])
@ -978,8 +978,8 @@ if ($config['load_db_lastread'])
$sql_array['LEFT_JOIN'] = array(
array(
'FROM' =&gt; array(FORUMS_TRACK_TABLE =&gt; 'ft'),
'ON' =&gt; 'ft.user_id = ' . $user-&gt;data['user_id'] . ' AND ft.forum_id = f.forum_id'
)
'ON' =&gt; 'ft.user_id = ' . $user-&gt;data['user_id'] . ' AND ft.forum_id = f.forum_id',
),
);
$sql_array['SELECT'] .= ', ft.mark_time ';

View file

@ -52,6 +52,36 @@ index_body_stat_blocks_before
+ styles/subsilver2/template/index_body.html
* Purpose: Add new statistic blocks above the Who Is Online and Board Statistics blocks
memberlist_body_username_append
===
* Locations:
+ styles/prosilver/template/memberlist_body.html
+ styles/subsilver2/template/memberlist_body.html
* Purpose: Add information after every username in the memberlist. Works in
all display modes (leader, group and normal memberlist).
memberlist_body_username_prepend
===
* Locations:
+ styles/prosilver/template/memberlist_body.html
+ styles/subsilver2/template/memberlist_body.html
* Purpose: Add information before every username in the memberlist. Works in
all display modes (leader, group and normal memberlist).
memberlist_view_user_statistics_after
===
* Locations:
+ styles/prosilver/template/memberlist_view.html
+ styles/subsilver2/template/memberlist_view.html
* Purpose: Add entries after the user statistics part of any user profile
memberlist_view_user_statistics_before
===
* Locations:
+ styles/prosilver/template/memberlist_view.html
+ styles/subsilver2/template/memberlist_view.html
* Purpose: Add entries before the user statistics part of any user profile
overall_footer_after
===
* Locations:
@ -114,6 +144,36 @@ simple_footer_after
* Location: styles/prosilver/template/simple_footer.html
* Purpose: Add content directly prior to the `</body>` tag of the simple footer
topiclist_row_prepend
===
* Locations:
+ styles/prosilver/template/search_results.html
+ styles/prosilver/template/viewforum_body.html
+ styles/subsilver2/template/search_results.html
+ styles/subsilver2/template/viewforum_body.html
* Purpose: Add content into topic rows (inside the elements containing topic titles)
topiclist_row_append
===
* Locations:
+ styles/prosilver/template/search_results.html
+ styles/prosilver/template/viewforum_body.html
+ styles/subsilver2/template/search_results.html
+ styles/subsilver2/template/viewforum_body.html
* Purpose: Add content into topic rows (inside the elements containing topic titles)
ucp_pm_viewmessage_custom_fields_after
===
* Location: styles/prosilver/template/ucp_pm_viewmessage.html
* Purpose: Add data after the custom fields on the user profile when viewing
a private message
ucp_pm_viewmessage_custom_fields_before
===
* Location: styles/prosilver/template/ucp_pm_viewmessage.html
* Purpose: Add data before the custom fields on the user profile when viewing
a private message
ucp_pm_viewmessage_print_head_append
===
* Location: styles/prosilver/template/ucp_pm_viewmessage_print.html
@ -133,6 +193,38 @@ viewtopic_body_footer_before
and quick reply, directly before the jumpbox in Prosilver, breadcrumbs in
Subsilver2.
viewtopic_body_post_buttons_after
===
* Locations:
+ styles/prosilver/template/viewtopic_body.html
+ styles/subsilver2/template/viewtopic_body.html
* Purpose: Add post button to posts (next to edit, quote etc), at the end of
the list.
viewtopic_body_post_buttons_before
===
* Locations:
+ styles/prosilver/template/viewtopic_body.html
+ styles/subsilver2/template/viewtopic_body.html
* Purpose: Add post button to posts (next to edit, quote etc), at the start of
the list.
viewtopic_body_postrow_custom_fields_after
===
* Locations:
+ styles/prosilver/template/viewtopic_body.html
+ styles/subsilver2/template/viewtopic_body.html
* Purpose: Add data after the custom fields on the user profile when viewing
a post
viewtopic_body_postrow_custom_fields_before
===
* Locations:
+ styles/prosilver/template/viewtopic_body.html
+ styles/subsilver2/template/viewtopic_body.html
* Purpose: Add data before the custom fields on the user profile when viewing
a post
viewtopic_topic_title_prepend
===
* Locations:

View file

@ -41,7 +41,7 @@ if (isset($_GET['avatar']))
exit;
}
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
@ -50,7 +50,7 @@ if (isset($_GET['avatar']))
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// Setup class loader first
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();

View file

@ -28,10 +28,6 @@ class acp_database
global $cache, $db, $user, $auth, $template, $table_prefix;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
if (!class_exists('phpbb_db_tools'))
{
require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx);
}
$this->db_tools = new phpbb_db_tools($db);
$user->add_lang('acp/database');

View file

@ -379,6 +379,7 @@ class acp_modules
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang('ERROR'),
'MESSAGE_TEXT' => implode('<br />', $errors),
'SUCCESS' => false,
));
}

View file

@ -25,7 +25,7 @@ class acp_permission_roles
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $db, $user, $auth, $template, $cache, $phpbb_container;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
@ -306,6 +306,8 @@ class acp_permission_roles
trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$phpbb_permissions = $phpbb_container->get('acl.permissions');
$template->assign_vars(array(
'S_EDIT' => true,
@ -314,9 +316,8 @@ class acp_permission_roles
'ROLE_NAME' => $role_row['role_name'],
'ROLE_DESCRIPTION' => $role_row['role_description'],
'L_ACL_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)],
)
);
'L_ACL_TYPE' => $phpbb_permissions->get_type_lang($permission_type),
));
// We need to fill the auth options array with ACL_NO options ;)
$sql = 'SELECT auth_option_id, auth_option
@ -456,7 +457,9 @@ class acp_permission_roles
*/
function display_auth_options($auth_options)
{
global $template, $user;
global $template, $user, $phpbb_container;
$phpbb_permissions = $phpbb_container->get('acl.permissions');
$content_array = $categories = array();
$key_sort_array = array(0);
@ -473,7 +476,7 @@ class acp_permission_roles
foreach ($content_array as $cat => $cat_array)
{
$template->assign_block_vars('auth', array(
'CAT_NAME' => $user->lang['permission_cat'][$cat],
'CAT_NAME' => $phpbb_permissions->get_category_lang($cat),
'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false,
'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false,
@ -488,8 +491,8 @@ class acp_permission_roles
'S_NO' => ($allowed == ACL_NO) ? true : false,
'FIELD_NAME' => $permission,
'PERMISSION' => $user->lang['acl_' . $permission]['lang'])
);
'PERMISSION' => $phpbb_permissions->get_permission_lang($permission),
));
}
}
}

View file

@ -22,15 +22,18 @@ class acp_permissions
{
var $u_action;
var $permission_dropdown;
protected $permissions;
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $db, $user, $auth, $template, $cache, $phpbb_container;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
$this->permissions = $phpbb_container->get('acl.permissions');
$auth_admin = new auth_admin();
$user->add_lang('acp/permissions');
@ -49,7 +52,7 @@ class acp_permissions
if ($user_id && isset($auth_admin->acl_options['id'][$permission]) && $auth->acl_get('a_viewauth'))
{
$this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $user->lang['acl_' . $permission]['lang']);
$this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $this->permissions->get_permission_lang($permission));
$this->permission_trace($user_id, $forum_id, $permission);
return;
}
@ -512,7 +515,7 @@ class acp_permissions
$template->assign_vars(array(
'S_PERMISSION_DROPDOWN' => (sizeof($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false,
'L_PERMISSION_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)],
'L_PERMISSION_TYPE' => $this->permissions->get_type_lang($permission_type),
'U_ACTION' => $this->u_action,
'S_HIDDEN_FIELDS' => $s_hidden_fields)
@ -587,7 +590,7 @@ class acp_permissions
*/
function build_permission_dropdown($options, $default_option, $permission_scope)
{
global $user, $auth;
global $auth;
$s_dropdown_options = '';
foreach ($options as $setting)
@ -598,7 +601,7 @@ class acp_permissions
}
$selected = ($setting == $default_option) ? ' selected="selected"' : '';
$l_setting = (isset($user->lang['permission_type'][$permission_scope][$setting])) ? $user->lang['permission_type'][$permission_scope][$setting] : $user->lang['permission_type'][$setting];
$l_setting = $this->permissions->get_type_lang($setting, $permission_scope);
$s_dropdown_options .= '<option value="' . $setting . '"' . $selected . '>' . $l_setting . '</option>';
}
@ -979,7 +982,7 @@ class acp_permissions
$back = request_var('back', 0);
$template->assign_vars(array(
'PERMISSION' => $user->lang['acl_' . $permission]['lang'],
'PERMISSION' => $this->permissions->get_permission_lang($permission),
'PERMISSION_USERNAME' => $userdata['username'],
'FORUM_NAME' => $forum_name,

View file

@ -560,7 +560,7 @@ class acp_search
return $finder
->extension_suffix('_backend')
->extension_directory('/search')
->core_path('includes/search/')
->core_path('phpbb/search/')
->get_classes();
}

View file

@ -261,7 +261,8 @@ class auth_admin extends phpbb_auth
*/
function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true)
{
global $template, $user, $db, $phpbb_root_path, $phpEx;
global $template, $user, $db, $phpbb_root_path, $phpEx, $phpbb_container;
$phpbb_permissions = $phpbb_container->get('acl.permissions');
// Define names for template loops, might be able to be set
$tpl_pmask = 'p_mask';
@ -269,7 +270,7 @@ class auth_admin extends phpbb_auth
$tpl_category = 'category';
$tpl_mask = 'mask';
$l_acl_type = (isset($user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)])) ? $user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)] : 'ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type);
$l_acl_type = $phpbb_permissions->get_type_lang($permission_type, (($local) ? 'local' : 'global'));
// Allow trace for viewing permissions and in user mode
$show_trace = ($mode == 'view' && $user_mode == 'user') ? true : false;
@ -1100,7 +1101,9 @@ class auth_admin extends phpbb_auth
*/
function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false, $s_view)
{
global $template, $user, $phpbb_admin_path, $phpEx;
global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container;
$phpbb_permissions = $phpbb_container->get('acl.permissions');
@reset($category_array);
while (list($cat, $cat_array) = each($category_array))
@ -1110,8 +1113,8 @@ class auth_admin extends phpbb_auth
'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false,
'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false,
'CAT_NAME' => $user->lang['permission_cat'][$cat])
);
'CAT_NAME' => $phpbb_permissions->get_category_lang($cat),
));
/* Sort permissions by name (more naturaly and user friendly than sorting by a primary key)
* Commented out due to it's memory consumption and time needed
@ -1145,8 +1148,8 @@ class auth_admin extends phpbb_auth
'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&amp;mode=trace&amp;u=$ug_id&amp;f=$forum_id&amp;auth=$permission") : '',
'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '',
'PERMISSION' => $user->lang['acl_' . $permission]['lang'])
);
'PERMISSION' => $phpbb_permissions->get_permission_lang($permission),
));
}
else
{
@ -1163,8 +1166,8 @@ class auth_admin extends phpbb_auth
'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&amp;mode=trace&amp;u=$ug_id&amp;f=$forum_id&amp;auth=$permission") : '',
'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '',
'PERMISSION' => $user->lang['acl_' . $permission]['lang'])
);
'PERMISSION' => $phpbb_permissions->get_permission_lang($permission),
));
}
}
}
@ -1176,7 +1179,9 @@ class auth_admin extends phpbb_auth
*/
function build_permission_array(&$permission_row, &$content_array, &$categories, $key_sort_array)
{
global $user;
global $user, $phpbb_container;
$phpbb_permissions = $phpbb_container->get('acl.permissions');
foreach ($key_sort_array as $forum_id)
{
@ -1191,20 +1196,12 @@ class auth_admin extends phpbb_auth
@reset($permissions);
while (list($permission, $auth_setting) = each($permissions))
{
if (!isset($user->lang['acl_' . $permission]))
{
$user->lang['acl_' . $permission] = array(
'cat' => 'misc',
'lang' => '{ acl_' . $permission . ' }'
);
}
$cat = $user->lang['acl_' . $permission]['cat'];
$cat = $phpbb_permissions->get_permission_category($permission);
// Build our categories array
if (!isset($categories[$cat]))
{
$categories[$cat] = $user->lang['permission_cat'][$cat];
$categories[$cat] = $phpbb_permissions->get_category_lang($cat);
}
// Build our content array

View file

@ -132,11 +132,8 @@ class bbcode
{
$this->template_bitfield = new bitfield($user->style['bbcode_bitfield']);
$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(), $phpbb_root_path);
$template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, 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->set_style();
$template->set_style();
$template->set_filenames(array('bbcode.html' => 'bbcode.html'));
$this->template_filename = $template->get_source_file_for_handle('bbcode.html');
}

View file

@ -50,7 +50,8 @@ class phpbb_captcha_factory
{
include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx);
}
call_user_func(array($name, 'garbage_collect'), 0);
$captcha = self::get_instance($name);
$captcha->garbage_collect(0);
}
/**

View file

@ -110,12 +110,8 @@ class phpbb_captcha_qa
*/
static public function is_installed()
{
global $db, $phpbb_root_path, $phpEx;
global $db;
if (!class_exists('phpbb_db_tools', false))
{
include("$phpbb_root_path/includes/db/db_tools.$phpEx");
}
$db_tool = new phpbb_db_tools($db);
return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE);
@ -297,12 +293,8 @@ class phpbb_captcha_qa
*/
function install()
{
global $db, $phpbb_root_path, $phpEx;
global $db;
if (!class_exists('phpbb_db_tools'))
{
include("$phpbb_root_path/includes/db/db_tools.$phpEx");
}
$db_tool = new phpbb_db_tools($db);
$tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE);

View file

@ -5401,8 +5401,6 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'T_UPLOAD' => $config['upload_path'],
'SITE_LOGO_IMG' => $user->img('site_logo'),
'A_COOKIE_SETTINGS' => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')),
));
// application/xhtml+xml not used because of IE

View file

@ -118,7 +118,10 @@ function phpbb_create_container(array $extensions, $phpbb_root_path, $php_ext)
*/
function phpbb_create_install_container($phpbb_root_path, $php_ext)
{
$core = new phpbb_di_extension_core($phpbb_root_path);
$other_config_path = $phpbb_root_path . 'install/update/new/config/';
$config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/';
$core = new phpbb_di_extension_core($config_path);
$container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext);
$container->setParameter('core.root_path', $phpbb_root_path);
@ -135,6 +138,32 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext)
return $container;
}
/**
* Create updater container
*
* @param string $phpbb_root_path Root path
* @param string $php_ext PHP Extension
* @param array $config_path Path to config directory
* @return ContainerBuilder object (compiled)
*/
function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path)
{
$config_file = $phpbb_root_path . 'config.' . $php_ext;
return phpbb_create_compiled_container(
$config_file,
array(
new phpbb_di_extension_config($config_file),
new phpbb_di_extension_core($config_path),
),
array(
new phpbb_di_pass_collection_pass(),
new phpbb_di_pass_kernel_pass(),
),
$phpbb_root_path,
$php_ext
);
}
/**
* Create a compiled ContainerBuilder object
*
@ -146,11 +175,6 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext)
*/
function phpbb_create_compiled_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext)
{
$installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path);
// Now pass the enabled extension paths into the ext compiler extension
$extensions[] = new phpbb_di_extension_ext($installed_exts);
// Create the final container to be compiled and cached
$container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext);
@ -231,11 +255,14 @@ function phpbb_create_dumped_container_unless_debug($config_file, array $extensi
function phpbb_create_default_container($phpbb_root_path, $php_ext)
{
$config_file = $phpbb_root_path . 'config.' . $php_ext;
$installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path);
return phpbb_create_dumped_container_unless_debug(
$config_file,
array(
new phpbb_di_extension_config($config_file),
new phpbb_di_extension_core($phpbb_root_path),
new phpbb_di_extension_core($phpbb_root_path . 'config'),
new phpbb_di_extension_ext($installed_exts),
),
array(
new phpbb_di_pass_collection_pass(),

View file

@ -413,7 +413,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text
static $bbcode;
global $phpbb_dispatcher;
if (!$text)
if ($text === '')
{
return '';
}
@ -505,7 +505,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
$uid = $bitfield = '';
$flags = (($allow_bbcode) ? OPTION_FLAG_BBCODE : 0) + (($allow_smilies) ? OPTION_FLAG_SMILIES : 0) + (($allow_urls) ? OPTION_FLAG_LINKS : 0);
if (!$text)
if ($text === '')
{
return;
}

View file

@ -184,12 +184,6 @@ function dbms_select($default = '', $only_20x_options = false)
*/
function get_tables(&$db)
{
if (!class_exists('phpbb_db_tools'))
{
global $phpbb_root_path, $phpEx;
require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx);
}
$db_tools = new phpbb_db_tools($db);
return $db_tools->sql_list_tables();

View file

@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
*/
class messenger
{
var $vars, $msg, $extra_headers, $replyto, $from, $subject;
var $msg, $extra_headers, $replyto, $from, $subject;
var $addresses = array();
var $mail_priority = MAIL_NORMAL_PRIORITY;
@ -53,7 +53,7 @@ class messenger
function reset()
{
$this->addresses = $this->extra_headers = array();
$this->vars = $this->msg = $this->replyto = $this->from = '';
$this->msg = $this->replyto = $this->from = '';
$this->mail_priority = MAIL_NORMAL_PRIORITY;
}
@ -258,8 +258,6 @@ class messenger
'body' => $template_file . '.txt',
));
$this->vars = $this->template->get_template_vars();
return true;
}
@ -288,26 +286,11 @@ class messenger
global $config, $user;
// We add some standard variables we always use, no need to specify them always
if (!isset($this->vars['U_BOARD']))
{
$this->assign_vars(array(
'U_BOARD' => generate_board_url(),
));
}
if (!isset($this->vars['EMAIL_SIG']))
{
$this->assign_vars(array(
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])),
));
}
if (!isset($this->vars['SITENAME']))
{
$this->assign_vars(array(
'SITENAME' => htmlspecialchars_decode($config['sitename']),
));
}
// Parse message through template
$this->msg = trim($this->template->assign_display('body'));
@ -660,7 +643,7 @@ class messenger
{
$this->setup_template();
$this->template->set_style_names(array($path_name), $paths);
$this->template->set_custom_style($path_name, $paths);
}
}

View file

@ -455,7 +455,7 @@ class p_master
*/
function load_active($mode = false, $module_url = false, $execute_module = true)
{
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $phpbb_style;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $template;
$module_path = $this->include_path . $this->p_class;
$icat = request_var('icat', '');
@ -508,7 +508,7 @@ class p_master
if (is_dir($module_style_dir))
{
$phpbb_style->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style'), array(), '');
$template->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style'));
}
}
@ -537,7 +537,7 @@ class p_master
if (is_dir($phpbb_root_path . $module_style_dir))
{
$phpbb_style->set_style(array($module_style_dir, 'styles'));
$template->set_style(array($module_style_dir, 'styles'));
}
}

View file

@ -1095,25 +1095,20 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
$poster_id = $row['user_id'];
$post_subject = $row['post_subject'];
$message = censor_text($row['post_text']);
$decoded_message = false;
if ($show_quote_button && $auth->acl_get('f_reply', $forum_id))
{
$decoded_message = $message;
$decoded_message = censor_text($row['post_text']);
decode_message($decoded_message, $row['bbcode_uid']);
$decoded_message = bbcode_nl2br($decoded_message);
}
if ($row['bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message, !$row['enable_smilies']);
$parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0);
$parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0);
$message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true);
if (!empty($attachments[$row['post_id']]))
{
@ -1995,6 +1990,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
}
$first_post_has_topic_info = ($post_mode == 'edit_first_post' &&
(($post_visibility == ITEM_DELETED && $data['topic_posts_softdeleted'] == 1) ||
($post_visibility == ITEM_UNAPPROVED && $data['topic_posts_unapproved'] == 1) ||
($post_visibility == ITEM_APPROVED && $data['topic_posts_approved'] == 1)));
// Fix the post's and topic's visibility and first/last post information, when the post is edited
if (($post_mode != 'post' && $post_mode != 'reply') && $data['post_visibility'] != $post_visibility)
{
@ -2007,7 +2006,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$phpbb_content_visibility->set_post_visibility($post_visibility, $data['post_id'], $data['topic_id'], $data['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest);
}
else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $first_post_has_topic_info)
{
if ($post_visibility == ITEM_APPROVED || $data['topic_visibility'] == $post_visibility)
{

View file

@ -2019,13 +2019,10 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode
$decoded_message = bbcode_nl2br($decoded_message);
}
if ($row['bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
}
$parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0);
$parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0);
$message = bbcode_nl2br($message);
$message = smiley_text($message, !$row['enable_smilies']);
$message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false);
$subject = censor_text($subject);

View file

@ -115,17 +115,9 @@ class mcp_pm_reports
}
// Process message, leave it uncensored
$message = $pm_info['message_text'];
$parse_flags = ($pm_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$message = generate_text_for_display($pm_info['message_text'], $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield'], $parse_flags, false);
if ($pm_info['bbcode_bitfield'])
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode($pm_info['bbcode_bitfield']);
$bbcode->bbcode_second_pass($message, $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
$report['report_text'] = make_clickable(bbcode_nl2br($report['report_text']));
if ($pm_info['message_attachment'] && $auth->acl_get('u_pm_download'))

View file

@ -125,17 +125,8 @@ function mcp_post_details($id, $mode, $action)
$post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false;
// Process message, leave it uncensored
$message = $post_info['post_text'];
if ($post_info['bbcode_bitfield'])
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode($post_info['bbcode_bitfield']);
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
$parse_flags = ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], $parse_flags, false);
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{

View file

@ -206,17 +206,8 @@ class mcp_queue
$post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false;
// Process message, leave it uncensored
$message = $post_info['post_text'];
if ($post_info['bbcode_bitfield'])
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode($post_info['bbcode_bitfield']);
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
$parse_flags = ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], $parse_flags, false);
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{

View file

@ -187,7 +187,7 @@ class mcp_reports
'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
'S_POST_REPORTED' => $post_info['post_reported'],
'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == POST_UNAPPROVED),
'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED),
'S_POST_LOCKED' => $post_info['post_edit_locked'],
'S_USER_NOTES' => true,

View file

@ -207,13 +207,8 @@ function mcp_topic_view($id, $mode, $action)
$message = $row['post_text'];
$post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title'];
if ($row['bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
$parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false);
if (!empty($attachments[$row['post_id']]))
{
@ -674,10 +669,10 @@ function merge_posts($topic_id, $to_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);
phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', array($topic_id), $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);
phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', array($topic_id), $to_topic_id);
}
// Link to the new topic

View file

@ -289,19 +289,8 @@ class mcp_warn
// We want to make the message available here as a reminder
// Parse the message and subject
$message = censor_text($user_row['post_text']);
// Second parse bbcode here
if ($user_row['bbcode_bitfield'])
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode($user_row['bbcode_bitfield']);
$bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
$parse_flags = OPTION_FLAG_SMILIES | ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0);
$message = generate_text_for_display($user_row['post_text'], $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], $parse_flags, true);
// Generate the appropriate user information for the user we are looking at
if (!function_exists('phpbb_get_user_avatar'))

View file

@ -1,137 +0,0 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Provides a style resource locator with core style paths and extension style paths
*
* Finds installed style paths and makes them available to the resource locator.
*
* @package phpBB3
*/
class phpbb_style_extension_path_provider extends phpbb_extension_provider implements phpbb_style_path_provider_interface
{
/**
* Optional prefix for style paths searched within extensions.
*
* Empty by default. Relative to the extension directory. As an example, it
* could be adm/ for admin style.
*
* @var string
*/
protected $ext_dir_prefix = '';
/**
* A provider of paths to be searched for styles
* @var phpbb_style_path_provider
*/
protected $base_path_provider;
/** @var string */
protected $phpbb_root_path;
/**
* Constructor stores extension manager
*
* @param phpbb_extension_manager $extension_manager phpBB extension manager
* @param phpbb_style_path_provider $base_path_provider A simple path provider
* to provide paths to be located in extensions
* @param string $phpbb_root_path phpBB root path
*/
public function __construct(phpbb_extension_manager $extension_manager, phpbb_style_path_provider $base_path_provider, $phpbb_root_path)
{
parent::__construct($extension_manager);
$this->base_path_provider = $base_path_provider;
$this->phpbb_root_path = $phpbb_root_path;
}
/**
* Sets a prefix for style paths searched within extensions.
*
* The prefix is inserted between the extension's path e.g. ext/foo/ and
* the looked up style path, e.g. styles/bar/. So it should not have a
* leading slash, but should have a trailing slash.
*
* @param string $ext_dir_prefix The prefix including trailing slash
* @return null
*/
public function set_ext_dir_prefix($ext_dir_prefix)
{
$this->ext_dir_prefix = $ext_dir_prefix;
}
/**
* Finds style paths using the extension manager
*
* Locates a path (e.g. styles/prosilver/) in all active extensions.
* Then appends the core style paths based in the current working
* directory.
*
* @return array List of style paths
*/
public function find()
{
$directories = array();
$finder = $this->extension_manager->get_finder();
foreach ($this->base_path_provider as $key => $paths)
{
if ($key == 'style')
{
foreach ($paths as $path)
{
$directories['style'][] = $path;
if ($path && !phpbb_is_absolute($path))
{
// Remove phpBB root path from the style path,
// so the finder is able to find extension styles,
// when the root path is not ./
if (strpos($path, $this->phpbb_root_path) === 0)
{
$path = substr($path, strlen($this->phpbb_root_path));
}
$result = $finder->directory('/' . $this->ext_dir_prefix . $path)
->get_directories(true, false, true);
foreach ($result as $ext => $ext_path)
{
// Make sure $ext_path has no ending slash
if (substr($ext_path, -1) === '/')
{
$ext_path = substr($ext_path, 0, -1);
}
$directories[$ext][] = $ext_path;
}
}
}
}
}
return $directories;
}
/**
* Overwrites the current style paths
*
* @param array $styles An array of style paths. The first element is the main style.
* @return null
*/
public function set_styles(array $styles)
{
$this->base_path_provider->set_styles($styles);
$this->items = null;
}
}

View file

@ -1,62 +0,0 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Provides a style resource locator with paths
*
* Finds installed style paths and makes them available to the resource locator.
*
* @package phpBB3
*/
class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_provider_interface
{
protected $paths = array();
/**
* Ignores the extension dir prefix
*
* @param string $ext_dir_prefix The prefix including trailing slash
* @return null
*/
public function set_ext_dir_prefix($ext_dir_prefix)
{
}
/**
* Overwrites the current style paths
*
* The first element of the passed styles map, is considered the main
* style.
*
* @param array $styles An array of style paths. The first element is the main style.
* @return null
*/
public function set_styles(array $styles)
{
$this->paths = array('style' => $styles);
}
/**
* Retrieve an iterator over all style paths
*
* @return ArrayIterator An iterator for the array of style paths
*/
public function getIterator()
{
return new ArrayIterator($this->paths);
}
}

View file

@ -1,42 +0,0 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Provides a style resource locator with paths
*
* Finds installed style paths and makes them available to the resource locator.
*
* @package phpBB3
*/
interface phpbb_style_path_provider_interface extends Traversable
{
/**
* Defines a prefix to use for style paths in extensions
*
* @param string $ext_dir_prefix The prefix including trailing slash
* @return null
*/
public function set_ext_dir_prefix($ext_dir_prefix);
/**
* Overwrites the current style paths
*
* @param array $styles An array of style paths. The first element is the main style.
* @return null
*/
public function set_styles(array $styles);
}

View file

@ -1,348 +0,0 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Style resource locator.
* Maintains mapping from template handles to source template file paths.
* Locates style files: resources (such as .js and .css files) and templates.
*
* Style resource locator is aware of styles tree, and can return actual
* filesystem paths (i.e., the "child" style or the "parent" styles)
* depending on what files exist.
*
* Root paths stored in locator are paths to style directories. Templates are
* stored in subdirectory that $template_path points to.
*
* @package phpBB3
*/
class phpbb_style_resource_locator implements phpbb_template_locator
{
/**
* Paths to style directories.
* @var array
*/
private $roots = array();
/**
* Location of templates directory within style directories.
* Must have trailing slash. Empty if templates are stored in root
* style directory, such as admin control panel templates.
* @var string
*/
private $template_path;
/**
* Map from root index to handles to source template file paths.
* Normally it only contains paths for handles that are used
* (or are likely to be used) by the page being rendered and not
* all templates that exist on the filesystem.
* @var array
*/
private $files = array();
/**
* Map from handles to source template file names.
* Covers the same data as $files property but maps to basenames
* instead of paths.
* @var array
*/
private $filenames = array();
/**
* Constructor.
*
* Sets default template path to template/.
*/
public function __construct()
{
$this->set_default_template_path();
}
/**
* Sets the list of style paths
*
* These paths will be searched for style files in the provided order.
* Paths may be outside of phpBB, but templates loaded from these paths
* will still be cached.
*
* @param array $style_paths An array of paths to style directories
* @return null
*/
public function set_paths($style_paths)
{
$this->roots = array();
$this->files = array();
$this->filenames = array();
foreach ($style_paths as $key => $paths)
{
foreach ($paths as $path)
{
// Make sure $path has no ending slash
if (substr($path, -1) === '/')
{
$path = substr($path, 0, -1);
}
$this->roots[$key][] = $path;
}
}
}
/**
* Sets the location of templates directory within style directories.
*
* The location must be a relative path, with a trailing slash.
* Typically it is one directory level deep, e.g. "template/".
*
* @param string $template_path Relative path to templates directory within style directories
* @return null
*/
public function set_template_path($template_path)
{
$this->template_path = $template_path;
}
/**
* Sets the location of templates directory within style directories
* to the default, which is "template/".
*
* @return null
*/
public function set_default_template_path()
{
$this->template_path = 'template/';
}
/**
* {@inheritDoc}
*/
public function set_filenames(array $filename_array)
{
foreach ($filename_array as $handle => $filename)
{
if (empty($filename))
{
trigger_error("style resource locator: set_filenames: Empty filename specified for $handle", E_USER_ERROR);
}
$this->filename[$handle] = $filename;
foreach ($this->roots as $root_key => $root_paths)
{
foreach ($root_paths as $root_index => $root)
{
$this->files[$root_key][$root_index][$handle] = $root . '/' . $this->template_path . $filename;
}
}
}
}
/**
* {@inheritDoc}
*/
public function get_filename_for_handle($handle)
{
if (!isset($this->filename[$handle]))
{
trigger_error("style resource locator: get_filename_for_handle: No file specified for handle $handle", E_USER_ERROR);
}
return $this->filename[$handle];
}
/**
* {@inheritDoc}
*/
public function get_virtual_source_file_for_handle($handle)
{
// If we don't have a file assigned to this handle, die.
if (!isset($this->files['style'][0][$handle]))
{
trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR);
}
$source_file = $this->files['style'][0][$handle];
return $source_file;
}
/**
* {@inheritDoc}
*/
public function get_source_file_for_handle($handle, $find_all = false)
{
// If we don't have a file assigned to this handle, die.
if (!isset($this->files['style'][0][$handle]))
{
trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR);
}
// locate a source file that exists
$source_file = $this->files['style'][0][$handle];
$tried = $source_file;
$found = false;
$found_all = array();
foreach ($this->roots as $root_key => $root_paths)
{
foreach ($root_paths as $root_index => $root)
{
$source_file = $this->files[$root_key][$root_index][$handle];
$tried .= ', ' . $source_file;
if (file_exists($source_file))
{
$found = true;
break;
}
}
if ($found)
{
if ($find_all)
{
$found_all[] = $source_file;
$found = false;
}
else
{
break;
}
}
}
// search failed
if (!$found && !$find_all)
{
trigger_error("style resource locator: File for handle $handle does not exist. Could not find: $tried", E_USER_ERROR);
}
return ($find_all) ? $found_all : $source_file;
}
/**
* {@inheritDoc}
*/
public function get_first_file_location($files, $return_default = false, $return_full_path = true)
{
// set default value
$default_result = false;
// check all available paths
foreach ($this->roots as $root_paths)
{
foreach ($root_paths as $path)
{
// check all files
foreach ($files as $filename)
{
$source_file = $path . '/' . $filename;
if (file_exists($source_file))
{
return ($return_full_path) ? $source_file : $filename;
}
// assign first file as result if $return_default is true
if ($return_default && $default_result === false)
{
$default_result = $source_file;
}
}
}
}
// search failed
return $default_result;
}
/**
* Obtains filesystem path for a template file.
*
* The simplest use is specifying a single template file as a string
* in the first argument. This template file should be a basename
* of a template file in the selected style, or its parent styles
* if template inheritance is being utilized.
*
* Note: "selected style" is whatever style the style resource locator
* is configured for.
*
* The return value then will be a path, relative to the current
* directory or absolute, to the template file in the selected style
* or its closest parent.
*
* If the selected style does not have the template file being searched,
* (and if inheritance is involved, none of the parents have it either),
* false will be returned.
*
* Specifying true for $return_default will cause the function to
* return the first path which was checked for existence in the event
* that the template file was not found, instead of false.
* This is the path in the selected style itself, not any of its
* parents.
*
* $files can be given an array of templates instead of a single
* template. When given an array, the function will try to resolve
* each template in the array to a path, and will return the first
* path that exists, or false if none exist.
*
* If $files is an array and template inheritance is involved, first
* each of the files will be checked in the selected style, then each
* of the files will be checked in the immediate parent, and so on.
*
* If $return_full_path is false, then instead of returning a usable
* path (when the template is found) only the template's basename
* will be returned. This can be used to check which of the templates
* specified in $files exists. Naturally more than one template must
* be given in $files.
*
* This function works identically to get_first_file_location except
* it operates on a list of templates, not files. Practically speaking,
* the templates given in the first argument first are prepended with
* the template path (property in this class), then given to
* get_first_file_location for the rest of the processing.
*
* Templates given to this function can be relative paths for templates
* located in subdirectories of the template directories. The paths
* should be relative to the templates directory (template/ by default).
*
* @param string or array $files List of templates to locate. If there is only
* one template, $files can be a string to make code easier to read.
* @param bool $return_default Determines what to return if template does not
* exist. If true, function will return location where template is
* supposed to be. If false, function will return false.
* @param bool $return_full_path If true, function will return full path
* to template. If false, function will return template file name.
* This parameter can be used to check which one of set of template
* files is available.
* @return string or boolean Source template path if template exists or $return_default is
* true. False if template does not exist and $return_default is false
*/
public function get_first_template_location($templates, $return_default = false, $return_full_path = true)
{
// add template path prefix
$files = array();
if (is_string($templates))
{
$files[] = $this->template_path . $templates;
}
else
{
foreach ($templates as $template)
{
$files[] = $this->template_path . $template;
}
}
return $this->get_first_file_location($files, $return_default, $return_full_path);
}
}

View file

@ -1,241 +0,0 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Base Style class.
* @package phpBB3
*/
class phpbb_style
{
/**
* Template class.
* Handles everything related to templates.
* @var phpbb_template
*/
private $template;
/**
* phpBB root path
* @var string
*/
private $phpbb_root_path;
/**
* PHP file extension
* @var string
*/
private $php_ext;
/**
* phpBB config instance
* @var phpbb_config
*/
private $config;
/**
* Current user
* @var phpbb_user
*/
private $user;
/**
* Style resource locator
* @var phpbb_style_resource_locator
*/
private $locator;
/**
* Style path provider
* @var phpbb_style_path_provider
*/
private $provider;
/**
* Constructor.
*
* @param string $phpbb_root_path phpBB root path
* @param user $user current user
* @param phpbb_style_resource_locator $locator style resource locator
* @param phpbb_style_path_provider $provider style path provider
* @param phpbb_template $template template
*/
public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_style_resource_locator $locator, phpbb_style_path_provider_interface $provider, phpbb_template $template)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->config = $config;
$this->user = $user;
$this->locator = $locator;
$this->provider = $provider;
$this->template = $template;
}
/**
* Get the style tree of the style preferred by the current user
*
* @return array Style tree, most specific first
*/
public function get_user_style()
{
$style_list = array(
$this->user->style['style_path'],
);
if ($this->user->style['style_parent_id'])
{
$style_list = array_merge($style_list, array_reverse(explode('/', $this->user->style['style_parent_tree'])));
}
return $style_list;
}
/**
* Set style location based on (current) user's chosen style.
*
* @param array $style_directories The directories to add style paths for
* E.g. array('ext/foo/bar/styles', 'styles')
* Default: array('styles') (phpBB's style directory)
* @return bool true
*/
public function set_style($style_directories = array('styles'))
{
$this->names = $this->get_user_style();
$paths = array();
foreach ($style_directories as $directory)
{
foreach ($this->names as $name)
{
$path = $this->get_style_path($name, $directory);
if (is_dir($path))
{
$paths[] = $path;
}
}
}
$this->provider->set_styles($paths);
$this->locator->set_paths($this->provider);
$new_paths = array();
foreach ($paths as $path)
{
$new_paths[] = $path . '/template/';
}
$this->template->set_style_names($this->names, $new_paths, ($style_directories === array('styles')));
return true;
}
/**
* Set custom style location (able to use directory outside of phpBB).
*
* Note: Templates are still compiled to phpBB's cache directory.
*
* @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 $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/).
* @return bool true
*/
public function set_custom_style($name, $paths, $names = array(), $template_path = false)
{
if (is_string($paths))
{
$paths = array($paths);
}
if (empty($names))
{
$names = array($name);
}
$this->names = $names;
$this->provider->set_styles($paths);
$this->locator->set_paths($this->provider);
if ($template_path !== false)
{
$this->locator->set_template_path($template_path);
}
$new_paths = array();
foreach ($paths as $path)
{
$new_paths[] = $path . '/' . (($template_path !== false) ? $template_path : 'template/');
}
$this->template->set_style_names($names, $new_paths);
return true;
}
/**
* Get location of style directory for specific style_path
*
* @param string $path Style path, such as "prosilver"
* @param string $style_base_directory The base directory the style is in
* E.g. 'styles', 'ext/foo/bar/styles'
* Default: 'styles'
* @return string Path to style directory, relative to current path
*/
public function get_style_path($path, $style_base_directory = 'styles')
{
return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . $path;
}
/**
* Defines a prefix to use for style paths in extensions
*
* @param string $ext_dir_prefix The prefix including trailing slash
* @return null
*/
public function set_ext_dir_prefix($ext_dir_prefix)
{
$this->provider->set_ext_dir_prefix($ext_dir_prefix);
}
/**
* Locates source file path, accounting for styles tree and verifying that
* the path exists.
*
* @param string or array $files List of files to locate. If there is only
* one file, $files can be a string to make code easier to read.
* @param bool $return_default Determines what to return if file does not
* exist. If true, function will return location where file is
* supposed to be. If false, function will return false.
* @param bool $return_full_path If true, function will return full path
* to file. If false, function will return file name. This
* parameter can be used to check which one of set of files
* is available.
* @return string or boolean Source file path if file exists or $return_default is
* true. False if file does not exist and $return_default is false
*/
public function locate($files, $return_default = false, $return_full_path = true)
{
// convert string to array
if (is_string($files))
{
$files = array($files);
}
// use resource locator to find files
return $this->locator->get_first_file_location($files, $return_default, $return_full_path);
}
}

View file

@ -1,163 +0,0 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Resource locator interface.
*
* Objects implementing this interface maintain mapping from template handles
* to source template file paths and locate templates.
*
* Locates style files.
*
* Resource locator is aware of styles tree, and can return actual
* filesystem paths (i.e., the "child" style or the "parent" styles)
* depending on what files exist.
*
* Root paths stored in locator are paths to style directories. Templates are
* stored in subdirectory that $template_path points to.
*
* @package phpBB3
*/
interface phpbb_template_locator
{
/**
* Sets the template filenames for handles. $filename_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);
/**
* Determines the filename for a template handle.
*
* The filename comes from array used in a set_filenames call,
* which should have been performed prior to invoking this function.
* Return value is a file basename (without path).
*
* @param $handle string Template handle
* @return string Filename corresponding to the template handle
*/
public function get_filename_for_handle($handle);
/**
* Determines the source file path for a template handle without
* regard for styles tree.
*
* This function returns the path in "primary" style directory
* corresponding to the given template handle. That path may or
* may not actually exist on the filesystem. Because this function
* does not perform stat calls to determine whether the path it
* 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
* guaranteed to exist (which might come from the parent style
* directory if primary style has parent styles).
*
* This function will trigger an error if the handle was never
* associated with a template file via set_filenames.
*
* @param $handle string Template handle
* @return string Path to source file path in primary style directory
*/
public function get_virtual_source_file_for_handle($handle);
/**
* Determines the source file path for a template handle, accounting
* for styles tree and verifying that the path exists.
*
* This function returns the actual path that may be compiled for
* the specified template handle. It will trigger an error if
* the template handle was never associated with a template path
* via set_filenames or if the template file does not exist on the
* filesystem.
*
* Use get_virtual_source_file_for_handle to just resolve a template
* handle to a path without any filesystem or styles tree checks.
*
* @param string $handle Template handle (i.e. "friendly" template name)
* @param bool $find_all If true, each root path will be checked and function
* will return array of files instead of string and will not
* trigger a error if template does not exist
* @return string Source file path
*/
public function get_source_file_for_handle($handle, $find_all = false);
/**
* Obtains a complete filesystem path for a file in a style.
*
* This function traverses the style tree (selected style and
* its parents in order, if inheritance is being used) and finds
* the first file on the filesystem matching specified relative path,
* or the first of the specified paths if more than one path is given.
*
* This function can be used to determine filesystem path of any
* file under any style, with the consequence being that complete
* relative to the style directory path must be provided as an argument.
*
* In particular, this function can be used to locate templates
* and javascript files.
*
* For locating templates get_first_template_location should be used
* as it prepends the configured template path to the template basename.
*
* Note: "selected style" is whatever style the style resource locator
* is configured for.
*
* The return value then will be a path, relative to the current
* directory or absolute, to the first existing file in the selected
* style or its closest parent.
*
* If the selected style does not have the file being searched,
* (and if inheritance is involved, none of the parents have it either),
* false will be returned.
*
* Multiple files can be specified, in which case the first file in
* the list that can be found on the filesystem is returned.
*
* If multiple files are specified and inheritance is involved,
* first each of the specified files is checked in the selected style,
* then each of the specified files is checked in the immediate parent,
* etc.
*
* Specifying true for $return_default will cause the function to
* return the first path which was checked for existence in the event
* that the template file was not found, instead of false.
* This is always a path in the selected style itself, not any of its
* parents.
*
* If $return_full_path is false, then instead of returning a usable
* path (when the file is found) the file's path relative to the style
* directory will be returned. This is the same path as was given to
* the function as a parameter. This can be used to check which of the
* files specified in $files exists. Naturally this requires passing
* more than one file in $files.
*
* @param array $files List of files to locate.
* @param bool $return_default Determines what to return if file does not
* exist. If true, function will return location where file is
* supposed to be. If false, function will return false.
* @param bool $return_full_path If true, function will return full path
* to file. If false, function will return file name. This
* parameter can be used to check which one of set of files
* is available.
* @return string or boolean Source file path if file exists or $return_default is
* true. False if file does not exist and $return_default is false
*/
public function get_first_file_location($files, $return_default = false, $return_full_path = true);
}

View file

@ -1,465 +0,0 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Twig Template class.
* @package phpBB3
*/
class phpbb_template_twig implements phpbb_template
{
/**
* Template context.
* Stores template data used during template rendering.
* @var phpbb_template_context
*/
protected $context;
/**
* Path of the cache directory for the template
*
* Cannot be changed during runtime.
*
* @var string
*/
private $cachepath = '';
/**
* phpBB root path
* @var string
*/
protected $phpbb_root_path;
/**
* adm relative path
* @var string
*/
protected $adm_relative_path;
/**
* PHP file extension
* @var string
*/
protected $php_ext;
/**
* phpBB config instance
* @var phpbb_config
*/
protected $config;
/**
* Current user
* @var phpbb_user
*/
protected $user;
/**
* Extension manager.
*
* @var phpbb_extension_manager
*/
protected $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
*/
protected $style_names;
/**
* Twig Environment
*
* @var Twig_Environment
*/
protected $twig;
/**
* Array of filenames assigned to set_filenames
*
* @var array
*/
protected $filenames = array();
/**
* Constructor.
*
* @param string $phpbb_root_path phpBB root path
* @param string $php_ext php extension (typically 'php')
* @param phpbb_config $config
* @param phpbb_user $user
* @param phpbb_template_context $context template context
* @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked
* @param string $adm_relative_path relative path to adm directory
*/
public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null, $adm_relative_path = null)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->adm_relative_path = $adm_relative_path;
$this->php_ext = $php_ext;
$this->config = $config;
$this->user = $user;
$this->context = $context;
$this->extension_manager = $extension_manager;
$this->cachepath = $phpbb_root_path . 'cache/twig/';
// Initiate the loader, __main__ namespace paths will be setup later in set_style_names()
$loader = new Twig_Loader_Filesystem('');
$this->twig = new phpbb_template_twig_environment(
$this->config,
($this->extension_manager) ? $this->extension_manager->all_enabled() : array(),
$this->phpbb_root_path,
$loader,
array(
'cache' => (defined('IN_INSTALL')) ? false : $this->cachepath,
'debug' => defined('DEBUG'),
'auto_reload' => (bool) $this->config['load_tplcompile'],
'autoescape' => false,
)
);
$this->twig->addExtension(
new phpbb_template_twig_extension(
$this->context,
$this->user
)
);
$lexer = new phpbb_template_twig_lexer($this->twig);
$this->twig->setLexer($lexer);
}
/**
* Clear the cache
*
* @return phpbb_template
*/
public function clear_cache()
{
if (is_dir($this->cachepath))
{
$this->twig->clearCacheFiles();
}
return $this;
}
/**
* Sets the template filenames for handles.
*
* @param array $filename_array Should be a hash of handle => filename pairs.
* @return phpbb_template $this
*/
public function set_filenames(array $filename_array)
{
$this->filenames = array_merge($this->filenames, $filename_array);
return $this;
}
/**
* Sets the style names/paths corresponding to style hierarchy being compiled
* and/or rendered.
*
* @param array $style_names List of style names in inheritance tree order
* @param array $style_paths List of style paths in inheritance tree order
* @param bool $is_core True if the style names are the "core" styles for this page load
* Core means the main phpBB template files
* @return phpbb_template $this
*/
public function set_style_names(array $style_names, array $style_paths, $is_core = false)
{
$this->style_names = $style_names;
// Set as __main__ namespace
$this->twig->getLoader()->setPaths($style_paths);
// Core style namespace from phpbb_style::set_style()
if ($is_core)
{
$this->twig->getLoader()->setPaths($style_paths, 'core');
}
// Add admin namespace
if (is_dir($this->phpbb_root_path . $this->adm_relative_path . 'style/'))
{
$this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->adm_relative_path . 'style/', 'admin');
}
// Add all namespaces for all extensions
if ($this->extension_manager instanceof phpbb_extension_manager)
{
$style_names[] = 'all';
foreach ($this->extension_manager->all_enabled() as $ext_namespace => $ext_path)
{
// namespaces cannot contain /
$namespace = str_replace('/', '_', $ext_namespace);
$paths = array();
foreach ($style_names as $style_name)
{
$ext_style_path = $ext_path . 'styles/' . $style_name . '/template';
if (is_dir($ext_style_path))
{
$paths[] = $ext_style_path;
}
}
$this->twig->getLoader()->setPaths($paths, $namespace);
}
}
return $this;
}
/**
* Clears all variables and blocks assigned to this template.
*
* @return phpbb_template $this
*/
public function destroy()
{
$this->context = array();
return $this;
}
/**
* Reset/empty complete block
*
* @param string $blockname Name of block to destroy
* @return phpbb_template $this
*/
public function destroy_block_vars($blockname)
{
$this->context->destroy_block_vars($blockname);
return $this;
}
/**
* Display a template for provided handle.
*
* The template will be loaded and compiled, if necessary, first.
*
* This function calls hooks.
*
* @param string $handle Handle to display
* @return phpbb_template $this
*/
public function display($handle)
{
$result = $this->call_hook($handle, __FUNCTION__);
if ($result !== false)
{
return $result[0];
}
$this->twig->display($this->get_filename_from_handle($handle), $this->get_template_vars());
return $this;
}
/**
* Calls hook if any is defined.
*
* @param string $handle Template handle being displayed.
* @param string $method Method name of the caller.
*/
protected function call_hook($handle, $method)
{
global $phpbb_hook;
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, $method), $handle, $this))
{
if ($phpbb_hook->hook_return(array(__CLASS__, $method)))
{
$result = $phpbb_hook->hook_return_result(array(__CLASS__, $method));
return array($result);
}
}
return false;
}
/**
* Display the handle and assign the output to a template variable
* or return the compiled result.
*
* @param string $handle Handle to operate on
* @param string $template_var Template variable to assign compiled handle to
* @param bool $return_content If true return compiled handle, otherwise assign to $template_var
* @return phpbb_template|string if $return_content is true return string of the compiled handle, otherwise return $this
*/
public function assign_display($handle, $template_var = '', $return_content = true)
{
if ($return_content)
{
return $this->twig->render($this->get_filename_from_handle($handle), $this->get_template_vars());
}
$this->assign_var($template_var, $this->twig->render($this->get_filename_from_handle($handle, $this->get_template_vars())));
return $this;
}
/**
* Assign key variable pairs from an array
*
* @param array $vararray A hash of variable name => value pairs
* @return phpbb_template $this
*/
public function assign_vars(array $vararray)
{
foreach ($vararray as $key => $val)
{
$this->assign_var($key, $val);
}
return $this;
}
/**
* Assign a single scalar value to a single key.
*
* Value can be a string, an integer or a boolean.
*
* @param string $varname Variable name
* @param string $varval Value to assign to variable
* @return phpbb_template $this
*/
public function assign_var($varname, $varval)
{
$this->context->assign_var($varname, $varval);
return $this;
}
/**
* Append text to the string value stored in a key.
*
* Text is appended using the string concatenation operator (.).
*
* @param string $varname Variable name
* @param string $varval Value to append to variable
* @return phpbb_template $this
*/
public function append_var($varname, $varval)
{
$this->context->append_var($varname, $varval);
return $this;
}
/**
* Assign key variable pairs from an array to a specified block
* @param string $blockname Name of block to assign $vararray to
* @param array $vararray A hash of variable name => value pairs
* @return phpbb_template $this
*/
public function assign_block_vars($blockname, array $vararray)
{
$this->context->assign_block_vars($blockname, $vararray);
return $this;
}
/**
* Change already assigned key variable pair (one-dimensional - single loop entry)
*
* An example of how to use this function:
* {@example alter_block_array.php}
*
* @param string $blockname the blockname, for example 'loop'
* @param array $vararray the var array to insert/add or merge
* @param mixed $key Key to search for
*
* array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
*
* int: Position [the position to change or insert at directly given]
*
* If key is false the position is set to 0
* If key is true the position is set to the last entry
*
* @param string $mode Mode to execute (valid modes are 'insert' and 'change')
*
* If insert, the vararray is inserted at the given position (position counting from zero).
* If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
*
* Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
* and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
*
* @return bool false on error, true on success
*/
public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
{
return $this->context->alter_block_array($blockname, $vararray, $key, $mode);
}
/**
* Get template vars in a format Twig will use (from the context)
*
* @return array
*/
public function get_template_vars()
{
$context_vars = $this->context->get_data_ref();
$vars = array_merge(
$context_vars['.'][0], // To get normal vars
$context_vars, // To get loops
array(
'definition' => new phpbb_template_twig_definition(),
'user' => $this->user,
)
);
// cleanup
unset($vars['.']);
return $vars;
}
/**
* Get a filename from the handle
*
* @param string $handle
* @return string
*/
protected function get_filename_from_handle($handle)
{
return (isset($this->filenames[$handle])) ? $this->filenames[$handle] : $handle;
}
/**
* Get path to template for handle (required for BBCode parser)
*
* @return string
*/
public function get_source_file_for_handle($handle)
{
return $this->twig->getLoader()->getCacheKey($this->get_filename_from_handle($handle));
}
}

View file

@ -76,17 +76,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
$user_info = get_user_information($author_id, $message_row);
// Parse the message and subject
$message = censor_text($message_row['message_text']);
// Second parse bbcode here
if ($message_row['bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($message, $message_row['bbcode_uid'], $message_row['bbcode_bitfield']);
}
// Always process smilies after parsing bbcodes
$message = bbcode_nl2br($message);
$message = smiley_text($message);
$parse_flags = ($message_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$message = generate_text_for_display($message_row['message_text'], $message_row['bbcode_uid'], $message_row['bbcode_bitfield'], $parse_flags, true);
// Replace naughty words such as farty pants
$message_row['message_subject'] = censor_text($message_row['message_subject']);
@ -160,21 +151,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
// End signature parsing, only if needed
if ($signature)
{
$signature = censor_text($signature);
if ($user_info['user_sig_bbcode_bitfield'])
{
if ($bbcode === false)
{
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode($user_info['user_sig_bbcode_bitfield']);
}
$bbcode->bbcode_second_pass($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield']);
}
$signature = bbcode_nl2br($signature);
$signature = smiley_text($signature);
$parse_flags = ($user_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$signature = generate_text_for_display($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield'], $parse_flags, true);
}
$url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm');

View file

@ -267,7 +267,7 @@ class ucp_prefs
$limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
$sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
$sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views');
// Post ordering options
$limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);

View file

@ -546,6 +546,9 @@ class ucp_profile
// Build custom bbcodes array
display_custom_bbcodes();
// Generate smiley listing
generate_smilies('inline', 0);
break;
case 'avatar':

View file

@ -38,7 +38,7 @@ class ucp_register
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
$coppa = $request->is_set('coppa') ? (int) $request->variable('coppa', false) : false;
$agreed = (int) $request->variable('agreed', false);
$agreed = $request->variable('agreed', false);
$submit = $request->is_set_post('submit');
$change_lang = request_var('change_lang', '');
$user_lang = request_var('lang', $user->lang_name);
@ -63,7 +63,7 @@ class ucp_register
$submit = false;
// Setting back agreed to let the user view the agreement in his/her language
$agreed = ($request->variable('change_lang', false)) ? 0 : $agreed;
$agreed = false;
}
$user->lang_name = $user_lang = $use_lang;
@ -89,7 +89,7 @@ class ucp_register
$add_coppa = ($coppa !== false) ? '&amp;coppa=' . $coppa : '';
$s_hidden_fields = array(
'change_lang' => $change_lang,
'change_lang' => '',
);
// If we change the language, we want to pass on some more possible parameter.

View file

@ -101,6 +101,8 @@ class ucp_remind
$messenger->set_addresses($user_row);
$messenger->anti_abuse_headers($config, $user);
$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($user_row['username']),
'PASSWORD' => htmlspecialchars_decode($user_password),

View file

@ -21,26 +21,6 @@ define('IN_INSTALL', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
if (!function_exists('phpbb_require_updated'))
{
function phpbb_require_updated($path, $optional = false)
{
global $phpbb_root_path;
$new_path = $phpbb_root_path . 'install/update/new/' . $path;
$old_path = $phpbb_root_path . $path;
if (file_exists($new_path))
{
require($new_path);
}
else if (!$optional || file_exists($old_path))
{
require($old_path);
}
}
}
function phpbb_end_update($cache, $config)
{
$cache->purge();
@ -69,7 +49,7 @@ function phpbb_end_update($cache, $config)
exit_handler();
}
phpbb_require_updated('includes/startup.' . $phpEx);
require($phpbb_root_path . 'includes/startup.' . $phpEx);
include($phpbb_root_path . 'config.' . $phpEx);
if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type))
@ -82,30 +62,31 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
// Include files
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
require($phpbb_root_path . 'config.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// Set PHP error handler to ours
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// Setup class loader first
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
// Set up container (must be done here because extensions table may not exist)
$container_extensions = array(
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
new phpbb_di_extension_core($phpbb_root_path),
new phpbb_di_extension_core($phpbb_root_path . 'config/'),
);
$container_passes = array(
new phpbb_di_pass_collection_pass(),
//new phpbb_di_pass_kernel_pass(),
);
$phpbb_container = phpbb_create_container($container_extensions, $phpbb_root_path, $phpEx);
@ -217,7 +198,7 @@ $phpbb_extension_manager = $phpbb_container->get('ext.manager');
$finder = $phpbb_extension_manager->get_finder();
$migrations = $finder
->core_path('includes/db/migration/data/')
->core_path('phpbb/db/migration/data/')
->get_classes();
$migrator->set_migrations($migrations);
@ -263,8 +244,8 @@ while (!$migrator->finished())
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
if ((time() - $update_start_time) >= $safe_time_limit)
{
echo $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '<br />';
echo '<a href="' . append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=' . $request->variable('type', 0) . '&amp;language=' . $user->lang['USER_LANG']) . '">' . $user->lang['DATABASE_UPDATE_CONTINUE'] . '</a>';
echo '<br />' . $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '<br /><br />';
echo '<a href="' . append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=' . $request->variable('type', 0) . '&amp;language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['DATABASE_UPDATE_CONTINUE'] . '</a>';
phpbb_end_update($cache, $config);
}
@ -280,7 +261,7 @@ echo $user->lang['DATABASE_UPDATE_COMPLETE'] . '<br />';
if ($request->variable('type', 0))
{
echo $user->lang['INLINE_UPDATE_SUCCESSFUL'] . '<br /><br />';
echo '<a href="' . append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update&amp;sub=file_check&amp;language=' . $user->lang['USER_LANG']) . '" class="button1">' . $user->lang['CONTINUE_UPDATE_NOW'] . '</a>';
echo '<a href="' . append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update&amp;sub=update_db&amp;language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['CONTINUE_UPDATE_NOW'] . '</a>';
}
else
{

View file

@ -28,7 +28,7 @@ if (version_compare(PHP_VERSION, '5.3.3') < 0)
function phpbb_require_updated($path, $optional = false)
{
global $phpbb_root_path;
global $phpbb_root_path, $table_prefix;
$new_path = $phpbb_root_path . 'install/update/new/' . $path;
$old_path = $phpbb_root_path . $path;
@ -43,6 +43,23 @@ function phpbb_require_updated($path, $optional = false)
}
}
function phpbb_include_updated($path, $optional = false)
{
global $phpbb_root_path;
$new_path = $phpbb_root_path . 'install/update/new/' . $path;
$old_path = $phpbb_root_path . $path;
if (file_exists($new_path))
{
include($new_path);
}
else if (!$optional || file_exists($old_path))
{
include($old_path);
}
}
phpbb_require_updated('includes/startup.' . $phpEx);
// Try to override some limits - maybe it helps some...
@ -78,19 +95,22 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
// Include essential scripts
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
phpbb_require_updated('phpbb/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
phpbb_require_updated('includes/functions.' . $phpEx);
phpbb_require_updated('includes/functions_container.' . $phpEx);
phpbb_require_updated('includes/functions_content.' . $phpEx, true);
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
phpbb_include_updated('includes/functions_admin.' . $phpEx);
phpbb_include_updated('includes/utf/utf_normalizer.' . $phpEx);
phpbb_include_updated('includes/utf/utf_tools.' . $phpEx);
phpbb_require_updated('includes/functions_install.' . $phpEx);
// Setup class loader first
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
$phpbb_class_loader_new = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}install/update/new/phpbb/", $phpEx);
$phpbb_class_loader_new->register();
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
@ -108,7 +128,7 @@ $request = $phpbb_container->get('request');
request_var('', 0, false, false, $request); // "dependency injection" for a function
// Try and load an appropriate language if required
$language = basename(request_var('language', ''));
$language = basename($request->variable('language', ''));
if ($request->header('Accept-Language') && !$language)
{
@ -167,11 +187,23 @@ if (!file_exists($phpbb_root_path . 'language/' . $language) || !is_dir($phpbb_r
}
// And finally, load the relevant language files
include($phpbb_root_path . 'language/' . $language . '/common.' . $phpEx);
include($phpbb_root_path . 'language/' . $language . '/acp/common.' . $phpEx);
include($phpbb_root_path . 'language/' . $language . '/acp/board.' . $phpEx);
include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx);
include($phpbb_root_path . 'language/' . $language . '/posting.' . $phpEx);
$load_lang_files = array('common', 'acp/common', 'acp/board', 'install', 'posting');
$new_path = $phpbb_root_path . 'install/update/new/language/' . $language . '/';
$old_path = $phpbb_root_path . 'language/' . $language . '/';
// NOTE: we can not use "phpbb_include_updated" as the files uses vars which would be required
// to be global while loading.
foreach ($load_lang_files as $lang_file)
{
if (file_exists($new_path . $lang_file . '.' . $phpEx))
{
include($new_path . $lang_file . '.' . $phpEx);
}
else
{
include($old_path . $lang_file . '.' . $phpEx);
}
}
// usually we would need every single constant here - and it would be consistent. For 3.0.x, use a dirty hack... :(
@ -181,8 +213,8 @@ define('CHMOD_READ', 4);
define('CHMOD_WRITE', 2);
define('CHMOD_EXECUTE', 1);
$mode = request_var('mode', 'overview');
$sub = request_var('sub', '');
$mode = $request->variable('mode', 'overview');
$sub = $request->variable('sub', '');
// Set PHP error handler to ours
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
@ -212,12 +244,11 @@ $config = new phpbb_config(array(
'load_tplcompile' => '1'
));
$phpbb_style_resource_locator = new phpbb_style_resource_locator();
$phpbb_style_path_provider = new phpbb_style_path_provider();
$template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, 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->set_ext_dir_prefix('adm/');
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style');
$paths = array_filter($paths, 'is_dir');
$template->set_custom_style('admin', $paths);
$template->assign_var('T_ASSETS_PATH', '../assets');
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');

View file

@ -1435,7 +1435,7 @@ class install_install extends module
$db->sql_return_on_error(true);
include_once($phpbb_root_path . 'includes/constants.' . $phpEx);
include_once($phpbb_root_path . 'includes/search/fulltext_native.' . $phpEx);
include_once($phpbb_root_path . 'phpbb/search/fulltext_native.' . $phpEx);
// We need to fill the config to let internal functions correctly work
$config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE);
@ -1888,7 +1888,7 @@ class install_install extends module
/**
* Populate migrations for the installation
*
* This "installs" all migrations from (root path)/includes/db/migrations/data.
* This "installs" all migrations from (root path)/phpbb/db/migrations/data.
* "installs" means it adds all migrations to the migrations table, but does not
* perform any of the actions in the migrations.
*
@ -1900,7 +1900,7 @@ class install_install extends module
$finder = $extension_manager->get_finder();
$migrations = $finder
->core_path('includes/db/migration/data/')
->core_path('phpbb/db/migration/data/')
->get_classes();
$migrator->populate_migrations($migrations);
}

View file

@ -39,7 +39,7 @@ if (!empty($setmodules))
'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1),
'module_order' => 30,
'module_subs' => '',
'module_stages' => array('INTRO', 'VERSION_CHECK', 'UPDATE_DB', 'FILE_CHECK', 'UPDATE_FILES'),
'module_stages' => array('INTRO', 'VERSION_CHECK', 'FILE_CHECK', 'UPDATE_FILES', 'UPDATE_DB'),
'module_reqs' => ''
);
}
@ -57,7 +57,6 @@ class install_update extends module
var $new_location;
var $latest_version;
var $current_version;
var $unequal_version;
var $update_to_version;
@ -71,18 +70,22 @@ class install_update extends module
function main($mode, $sub)
{
global $phpbb_style, $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language;
global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language;
global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container;
// We must enable super globals, otherwise creating a new instance of the request class,
// using the new container with a dbal connection will fail with the following PHP Notice:
// Object of class phpbb_request_deactivated_super_global could not be converted to int
$request->enable_super_globals();
// Create a normal container now
$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
$phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'install/update/new/config');
// Writes into global $cache
$cache = $phpbb_container->get('cache');
$this->tpl_name = 'install_update';
$this->page_title = 'UPDATE_INSTALLATION';
$this->unequal_version = false;
$this->old_location = $phpbb_root_path . 'install/update/old/';
$this->new_location = $phpbb_root_path . 'install/update/new/';
@ -125,7 +128,7 @@ class install_update extends module
$config['default_lang'] = $language;
$user->data['user_lang'] = $language;
$user->setup(array('common', 'acp/common', 'acp/board', 'install', 'posting'));
$user->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting'));
// Reset the default_lang
$config['default_lang'] = $config_default_lang;
@ -138,7 +141,9 @@ class install_update extends module
}
// Set custom template again. ;)
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style');
$paths = array_filter($paths, 'is_dir');
$template->set_custom_style('admin', $paths);
$template->assign_vars(array(
'S_USER_LANG' => $user->lang['USER_LANG'],
@ -192,8 +197,6 @@ class install_update extends module
// Check if the update files are actually meant to update from the current version
if ($this->current_version != $this->update_info['version']['from'])
{
$this->unequal_version = true;
$template->assign_vars(array(
'S_ERROR' => true,
'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $this->current_version, $this->update_info['version']['from'], $this->update_info['version']['to']),
@ -201,10 +204,8 @@ class install_update extends module
}
// Check if the update files stored are for the latest version...
if ($this->latest_version != $this->update_info['version']['to'])
if (version_compare(strtolower($this->latest_version), strtolower($this->update_info['version']['to']), '>'))
{
$this->unequal_version = true;
$template->assign_vars(array(
'S_WARNING' => true,
'WARNING_MSG' => sprintf($user->lang['OLD_UPDATE_FILES'], $this->update_info['version']['from'], $this->update_info['version']['to'], $this->latest_version))
@ -222,14 +223,15 @@ class install_update extends module
if ($this->test_update === false)
{
// Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present
if (in_array($phpbb_adm_relative_path . 'style/install_update.html', $this->update_info['files']))
{
$this->tpl_name = '../../install/update/new/adm/style/install_update';
}
// What about the language file? Got it updated?
if (in_array('language/en/install.' . $phpEx, $this->update_info['files']))
if (in_array('language/' . $language . '/install.' . $phpEx, $this->update_info['files']))
{
$lang = array();
include($this->new_location . 'language/' . $language . '/install.' . $phpEx);
// this is the user's language.. just merge it
$user->lang = array_merge($user->lang, $lang);
}
if ($language != 'en' && in_array('language/en/install.' . $phpEx, $this->update_info['files']))
{
$lang = array();
include($this->new_location . 'language/en/install.' . $phpEx);
@ -273,18 +275,17 @@ class install_update extends module
$this->page_title = 'STAGE_VERSION_CHECK';
$template->assign_vars(array(
'S_UP_TO_DATE' => $up_to_date,
'S_VERSION_CHECK' => true,
'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;sub=file_check"),
'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;sub=update_db"),
'S_UP_TO_DATE' => $up_to_date,
'LATEST_VERSION' => $this->latest_version,
'CURRENT_VERSION' => $this->current_version)
);
'CURRENT_VERSION' => $this->current_version,
));
// Print out version the update package updates to
if ($this->unequal_version)
if ($this->latest_version != $this->update_info['version']['to'])
{
$template->assign_var('PACKAGE_VERSION', $this->update_info['version']['to']);
}
@ -302,30 +303,6 @@ class install_update extends module
break;
case 'update_db':
// Make sure the database update is valid for the latest version
$valid = false;
$updates_to_version = '';
if (file_exists($phpbb_root_path . 'install/database_update.' . $phpEx))
{
include_once($phpbb_root_path . 'install/database_update.' . $phpEx);
if ($updates_to_version === $this->update_info['version']['to'])
{
$valid = true;
}
}
// Should not happen at all
if (!$valid)
{
trigger_error($user->lang['DATABASE_UPDATE_INFO_OLD'], E_USER_ERROR);
}
// Just a precaution
$cache->purge();
// Redirect the user to the database update script with some explanations...
$template->assign_vars(array(
'S_DB_UPDATE' => true,
@ -333,8 +310,14 @@ class install_update extends module
'U_DB_UPDATE' => append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=1&amp;language=' . $user->data['user_lang']),
'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;sub=update_db"),
'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;sub=file_check"),
'L_EVERYTHING_UP_TO_DATE' => $user->lang('EVERYTHING_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&amp;redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')),
));
// Do not display incompatible package note after successful update
if ($config['version'] == $this->update_info['version']['to'])
{
$template->assign_var('S_ERROR', false);
}
break;
case 'file_check':
@ -500,17 +483,30 @@ class install_update extends module
$template->assign_vars(array(
'S_FILE_CHECK' => true,
'S_ALL_UP_TO_DATE' => $all_up_to_date,
'L_ALL_FILES_UP_TO_DATE' => $user->lang('ALL_FILES_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&amp;redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')),
'S_VERSION_UP_TO_DATE' => $up_to_date,
'S_UP_TO_DATE' => $up_to_date,
'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;sub=file_check"),
'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;sub=update_files"),
'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;sub=update_db"),
));
// Since some people try to update to RC releases, but phpBB.com tells them the last version is the version they currently run
// we are faced with the updater thinking the database schema is up-to-date; which it is, but should be updated none-the-less
// We now try to cope with this by triggering the update process
if (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->update_info['version']['to'])), '<'))
{
$template->assign_vars(array(
'S_UP_TO_DATE' => false,
));
}
if ($all_up_to_date)
{
global $phpbb_container;
$phpbb_log = $phpbb_container->get('log');
// Add database update to log
add_log('admin', 'LOG_UPDATE_PHPBB', $this->current_version, $this->update_to_version);
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_UPDATE_PHPBB', time(), array($this->current_version, $this->update_to_version));
$db->sql_return_on_error(true);
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'");
@ -1089,12 +1085,6 @@ class install_update extends module
$this->tpl_name = 'install_update_diff';
// Got the diff template itself updated? If so, we are able to directly use it
if (in_array($phpbb_adm_relative_path . 'style/install_update_diff.html', $this->update_info['files']))
{
$this->tpl_name = '../../install/update/new/adm/style/install_update_diff';
}
$this->page_title = 'VIEWING_FILE_DIFF';
$status = request_var('status', '');

View file

@ -170,7 +170,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_search_load'
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_anon_lastread', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_birthdays', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_memberlist', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_profile', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_pm', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewprofile', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewtopic', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_lastread', '1');

View file

@ -33,209 +33,175 @@ if (empty($lang) || !is_array($lang))
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
/**
* MODDERS PLEASE NOTE
* EXTENSION-DEVELOPERS PLEASE NOTE
*
* You are able to put your permission sets into a separate file too by
* prefixing the new file with permissions_ and putting it into the acp
* language folder.
*
* An example of how the file could look like:
*
* <code>
*
* if (empty($lang) || !is_array($lang))
* {
* $lang = array();
* }
*
* // Adding new category
* $lang['permission_cat']['bugs'] = 'Bugs';
*
* // Adding new permission set
* $lang['permission_type']['bug_'] = 'Bug Permissions';
*
* // Adding the permissions
* $lang = array_merge($lang, array(
* 'acl_bug_view' => array('lang' => 'Can view bug reports', 'cat' => 'bugs'),
* 'acl_bug_post' => array('lang' => 'Can post bugs', 'cat' => 'post'), // Using a phpBB category here
* ));
*
* </code>
* You are able to put your permission sets into your extension.
* The permissions logic should be added via the 'core.permissions' event.
* You can easily add new permission categories, types and permissions, by
* simply merging them into the respective arrays.
* The respective language strings should be added into a language file, that
* start with 'permissions_', so they are automatically loaded within the ACP.
*/
// Define categories and permission types
$lang = array_merge($lang, array(
'permission_cat' => array(
'actions' => 'Actions',
'content' => 'Content',
'forums' => 'Forums',
'misc' => 'Misc',
'permissions' => 'Permissions',
'pm' => 'Private messages',
'polls' => 'Polls',
'post' => 'Post',
'post_actions' => 'Post actions',
'posting' => 'Posting',
'profile' => 'Profile',
'settings' => 'Settings',
'topic_actions' => 'Topic actions',
'user_group' => 'Users &amp; Groups',
),
// With defining 'global' here we are able to specify what is printed out if the permission is within the global scope.
'permission_type' => array(
'u_' => 'User permissions',
'a_' => 'Admin permissions',
'm_' => 'Moderator permissions',
'f_' => 'Forum permissions',
'global' => array(
'm_' => 'Global moderator permissions',
),
),
'ACL_CAT_ACTIONS' => 'Actions',
'ACL_CAT_CONTENT' => 'Content',
'ACL_CAT_FORUMS' => 'Forums',
'ACL_CAT_MISC' => 'Misc',
'ACL_CAT_PERMISSIONS' => 'Permissions',
'ACL_CAT_PM' => 'Private messages',
'ACL_CAT_POLLS' => 'Polls',
'ACL_CAT_POST' => 'Post',
'ACL_CAT_POST_ACTIONS' => 'Post actions',
'ACL_CAT_POSTING' => 'Posting',
'ACL_CAT_PROFILE' => 'Profile',
'ACL_CAT_SETTINGS' => 'Settings',
'ACL_CAT_TOPIC_ACTIONS' => 'Topic actions',
'ACL_CAT_USER_GROUP' => 'Users &amp; Groups',
));
// User Permissions
$lang = array_merge($lang, array(
'acl_u_viewprofile' => array('lang' => 'Can view profiles, memberlist and online list', 'cat' => 'profile'),
'acl_u_chgname' => array('lang' => 'Can change username', 'cat' => 'profile'),
'acl_u_chgpasswd' => array('lang' => 'Can change password', 'cat' => 'profile'),
'acl_u_chgemail' => array('lang' => 'Can change email address', 'cat' => 'profile'),
'acl_u_chgavatar' => array('lang' => 'Can change avatar', 'cat' => 'profile'),
'acl_u_chggrp' => array('lang' => 'Can change default usergroup', 'cat' => 'profile'),
'acl_u_chgprofileinfo' => array('lang' => 'Can change profile field information', 'cat' => 'profile'),
'ACL_U_VIEWPROFILE' => 'Can view profiles, memberlist and online list',
'ACL_U_CHGNAME' => 'Can change username',
'ACL_U_CHGPASSWD' => 'Can change password',
'ACL_U_CHGEMAIL' => 'Can change email address',
'ACL_U_CHGAVATAR' => 'Can change avatar',
'ACL_U_CHGGRP' => 'Can change default usergroup',
'ACL_U_CHGPROFILEINFO' => 'Can change profile field information',
'acl_u_attach' => array('lang' => 'Can attach files', 'cat' => 'post'),
'acl_u_download' => array('lang' => 'Can download files', 'cat' => 'post'),
'acl_u_savedrafts' => array('lang' => 'Can save drafts', 'cat' => 'post'),
'acl_u_chgcensors' => array('lang' => 'Can disable word censors', 'cat' => 'post'),
'acl_u_sig' => array('lang' => 'Can use signature', 'cat' => 'post'),
'ACL_U_ATTACH' => 'Can attach files',
'ACL_U_DOWNLOAD' => 'Can download files',
'ACL_U_SAVEDRAFTS' => 'Can save drafts',
'ACL_U_CHGCENSORS' => 'Can disable word censors',
'ACL_U_SIG' => 'Can use signature',
'acl_u_sendpm' => array('lang' => 'Can send private messages', 'cat' => 'pm'),
'acl_u_masspm' => array('lang' => 'Can send messages to multiple users', 'cat' => 'pm'),
'acl_u_masspm_group'=> array('lang' => 'Can send messages to groups', 'cat' => 'pm'),
'acl_u_readpm' => array('lang' => 'Can read private messages', 'cat' => 'pm'),
'acl_u_pm_edit' => array('lang' => 'Can edit own private messages', 'cat' => 'pm'),
'acl_u_pm_delete' => array('lang' => 'Can remove private messages from own folder', 'cat' => 'pm'),
'acl_u_pm_forward' => array('lang' => 'Can forward private messages', 'cat' => 'pm'),
'acl_u_pm_emailpm' => array('lang' => 'Can email private messages', 'cat' => 'pm'),
'acl_u_pm_printpm' => array('lang' => 'Can print private messages', 'cat' => 'pm'),
'acl_u_pm_attach' => array('lang' => 'Can attach files in private messages', 'cat' => 'pm'),
'acl_u_pm_download' => array('lang' => 'Can download files in private messages', 'cat' => 'pm'),
'acl_u_pm_bbcode' => array('lang' => 'Can use BBCode in private messages', 'cat' => 'pm'),
'acl_u_pm_smilies' => array('lang' => 'Can use smilies in private messages', 'cat' => 'pm'),
'acl_u_pm_img' => array('lang' => 'Can use [img] BBCode tag in private messages', 'cat' => 'pm'),
'acl_u_pm_flash' => array('lang' => 'Can use [flash] BBCode tag in private messages', 'cat' => 'pm'),
'ACL_U_SENDPM' => 'Can send private messages',
'ACL_U_MASSPM' => 'Can send messages to multiple users',
'ACL_U_MASSPM_GROUP'=> 'Can send messages to groups',
'ACL_U_READPM' => 'Can read private messages',
'ACL_U_PM_EDIT' => 'Can edit own private messages',
'ACL_U_PM_DELETE' => 'Can remove private messages from own folder',
'ACL_U_PM_FORWARD' => 'Can forward private messages',
'ACL_U_PM_EMAILPM' => 'Can email private messages',
'ACL_U_PM_PRINTPM' => 'Can print private messages',
'ACL_U_PM_ATTACH' => 'Can attach files in private messages',
'ACL_U_PM_DOWNLOAD' => 'Can download files in private messages',
'ACL_U_PM_BBCODE' => 'Can use BBCode in private messages',
'ACL_U_PM_SMILIES' => 'Can use smilies in private messages',
'ACL_U_PM_IMG' => 'Can use [img] BBCode tag in private messages',
'ACL_U_PM_FLASH' => 'Can use [flash] BBCode tag in private messages',
'acl_u_sendemail' => array('lang' => 'Can send emails', 'cat' => 'misc'),
'acl_u_sendim' => array('lang' => 'Can send instant messages', 'cat' => 'misc'),
'acl_u_ignoreflood' => array('lang' => 'Can ignore flood limit', 'cat' => 'misc'),
'acl_u_hideonline' => array('lang' => 'Can hide online status', 'cat' => 'misc'),
'acl_u_viewonline' => array('lang' => 'Can view hidden online users', 'cat' => 'misc'),
'acl_u_search' => array('lang' => 'Can search board', 'cat' => 'misc'),
'ACL_U_SENDEMAIL' => 'Can send emails',
'ACL_U_SENDIM' => 'Can send instant messages',
'ACL_U_IGNOREFLOOD' => 'Can ignore flood limit',
'ACL_U_HIDEONLINE' => 'Can hide online status',
'ACL_U_VIEWONLINE' => 'Can view hidden online users',
'ACL_U_SEARCH' => 'Can search board',
));
// Forum Permissions
$lang = array_merge($lang, array(
'acl_f_list' => array('lang' => 'Can see forum', 'cat' => 'actions'),
'acl_f_read' => array('lang' => 'Can read forum', 'cat' => 'actions'),
'acl_f_search' => array('lang' => 'Can search the forum', 'cat' => 'actions'),
'acl_f_subscribe' => array('lang' => 'Can subscribe forum', 'cat' => 'actions'),
'acl_f_print' => array('lang' => 'Can print topics', 'cat' => 'actions'),
'acl_f_email' => array('lang' => 'Can email topics', 'cat' => 'actions'),
'acl_f_bump' => array('lang' => 'Can bump topics', 'cat' => 'actions'),
'acl_f_user_lock' => array('lang' => 'Can lock own topics', 'cat' => 'actions'),
'acl_f_download' => array('lang' => 'Can download files', 'cat' => 'actions'),
'acl_f_report' => array('lang' => 'Can report posts', 'cat' => 'actions'),
'ACL_F_LIST' => 'Can see forum',
'ACL_F_READ' => 'Can read forum',
'ACL_F_SEARCH' => 'Can search the forum',
'ACL_F_SUBSCRIBE' => 'Can subscribe forum',
'ACL_F_PRINT' => 'Can print topics',
'ACL_F_EMAIL' => 'Can email topics',
'ACL_F_BUMP' => 'Can bump topics',
'ACL_F_USER_LOCK' => 'Can lock own topics',
'ACL_F_DOWNLOAD' => 'Can download files',
'ACL_F_REPORT' => 'Can report posts',
'acl_f_post' => array('lang' => 'Can start new topics', 'cat' => 'post'),
'acl_f_sticky' => array('lang' => 'Can post stickies', 'cat' => 'post'),
'acl_f_announce' => array('lang' => 'Can post announcements', 'cat' => 'post'),
'acl_f_reply' => array('lang' => 'Can reply to topics', 'cat' => 'post'),
'acl_f_edit' => array('lang' => 'Can edit own posts', 'cat' => 'post'),
'acl_f_delete' => array('lang' => 'Can permanently delete own posts', 'cat' => 'post'),
'acl_f_softdelete' => array('lang' => 'Can soft delete own posts<br /><em>Moderators, who have the approve posts permission, can restore soft deleted posts.</em>', 'cat' => 'post'),
'acl_f_ignoreflood' => array('lang' => 'Can ignore flood limit', 'cat' => 'post'),
'acl_f_postcount' => array('lang' => 'Increment post counter<br /><em>Please note that this setting only affects new posts.</em>', 'cat' => 'post'),
'acl_f_noapprove' => array('lang' => 'Can post without approval', 'cat' => 'post'),
'ACL_F_POST' => 'Can start new topics',
'ACL_F_STICKY' => 'Can post stickies',
'ACL_F_ANNOUNCE' => 'Can post announcements',
'ACL_F_REPLY' => 'Can reply to topics',
'ACL_F_EDIT' => 'Can edit own posts',
'ACL_F_DELETE' => 'Can permanently delete own posts',
'ACL_F_SOFTDELETE' => 'Can soft delete own posts<br /><em>Moderators, who have the approve posts permission, can restore soft deleted posts.</em>',
'ACL_F_IGNOREFLOOD' => 'Can ignore flood limit',
'ACL_F_POSTCOUNT' => 'Increment post counter<br /><em>Please note that this setting only affects new posts.</em>',
'ACL_F_NOAPPROVE' => 'Can post without approval',
'acl_f_attach' => array('lang' => 'Can attach files', 'cat' => 'content'),
'acl_f_icons' => array('lang' => 'Can use topic/post icons', 'cat' => 'content'),
'acl_f_bbcode' => array('lang' => 'Can use BBCode', 'cat' => 'content'),
'acl_f_flash' => array('lang' => 'Can use [flash] BBCode tag', 'cat' => 'content'),
'acl_f_img' => array('lang' => 'Can use [img] BBCode tag', 'cat' => 'content'),
'acl_f_sigs' => array('lang' => 'Can use signatures', 'cat' => 'content'),
'acl_f_smilies' => array('lang' => 'Can use smilies', 'cat' => 'content'),
'ACL_F_ATTACH' => 'Can attach files',
'ACL_F_ICONS' => 'Can use topic/post icons',
'ACL_F_BBCODE' => 'Can use BBCode',
'ACL_F_FLASH' => 'Can use [flash] BBCode tag',
'ACL_F_IMG' => 'Can use [img] BBCode tag',
'ACL_F_SIGS' => 'Can use signatures',
'ACL_F_SMILIES' => 'Can use smilies',
'acl_f_poll' => array('lang' => 'Can create polls', 'cat' => 'polls'),
'acl_f_vote' => array('lang' => 'Can vote in polls', 'cat' => 'polls'),
'acl_f_votechg' => array('lang' => 'Can change existing vote', 'cat' => 'polls'),
'ACL_F_POLL' => 'Can create polls',
'ACL_F_VOTE' => 'Can vote in polls',
'ACL_F_VOTECHG' => 'Can change existing vote',
));
// Moderator Permissions
$lang = array_merge($lang, array(
'acl_m_edit' => array('lang' => 'Can edit posts', 'cat' => 'post_actions'),
'acl_m_delete' => array('lang' => 'Can permanently delete posts', 'cat' => 'post_actions'),
'acl_m_softdelete' => array('lang' => 'Can soft delete posts<br /><em>Moderators, who have the approve posts permission, can restore soft deleted posts.</em>', 'cat' => 'post_actions'),
'acl_m_approve' => array('lang' => 'Can approve and restore posts', 'cat' => 'post_actions'),
'acl_m_report' => array('lang' => 'Can close and delete reports', 'cat' => 'post_actions'),
'acl_m_chgposter' => array('lang' => 'Can change post author', 'cat' => 'post_actions'),
'ACL_M_EDIT' => 'Can edit posts',
'ACL_M_DELETE' => 'Can permanently delete posts',
'ACL_M_SOFTDELETE' => 'Can soft delete posts<br /><em>Moderators, who have the approve posts permission, can restore soft deleted posts.</em>',
'ACL_M_APPROVE' => 'Can approve posts',
'ACL_M_REPORT' => 'Can close and delete reports',
'ACL_M_CHGPOSTER' => 'Can change post author',
'acl_m_move' => array('lang' => 'Can move topics', 'cat' => 'topic_actions'),
'acl_m_lock' => array('lang' => 'Can lock topics', 'cat' => 'topic_actions'),
'acl_m_split' => array('lang' => 'Can split topics', 'cat' => 'topic_actions'),
'acl_m_merge' => array('lang' => 'Can merge topics', 'cat' => 'topic_actions'),
'ACL_M_MOVE' => 'Can move topics',
'ACL_M_LOCK' => 'Can lock topics',
'ACL_M_SPLIT' => 'Can split topics',
'ACL_M_MERGE' => 'Can merge topics',
'acl_m_info' => array('lang' => 'Can view post details', 'cat' => 'misc'),
'acl_m_warn' => array('lang' => 'Can issue warnings<br /><em>This setting is only assigned globally. It is not forum based.</em>', 'cat' => 'misc'), // This moderator setting is only global (and not local)
'acl_m_ban' => array('lang' => 'Can manage bans<br /><em>This setting is only assigned globally. It is not forum based.</em>', 'cat' => 'misc'), // This moderator setting is only global (and not local)
'ACL_M_INFO' => 'Can view post details',
'ACL_M_WARN' => 'Can issue warnings<br /><em>This setting is only assigned globally. It is not forum based.</em>', // This moderator setting is only global (and not local)
'ACL_M_BAN' => 'Can manage bans<br /><em>This setting is only assigned globally. It is not forum based.</em>', // This moderator setting is only global (and not local)
));
// Admin Permissions
$lang = array_merge($lang, array(
'acl_a_board' => array('lang' => 'Can alter board settings/check for updates', 'cat' => 'settings'),
'acl_a_server' => array('lang' => 'Can alter server/communication settings', 'cat' => 'settings'),
'acl_a_jabber' => array('lang' => 'Can alter Jabber settings', 'cat' => 'settings'),
'acl_a_phpinfo' => array('lang' => 'Can view php settings', 'cat' => 'settings'),
'ACL_A_BOARD' => 'Can alter board settings/check for updates',
'ACL_A_SERVER' => 'Can alter server/communication settings',
'ACL_A_JABBER' => 'Can alter Jabber settings',
'ACL_A_PHPINFO' => 'Can view php settings',
'acl_a_forum' => array('lang' => 'Can manage forums', 'cat' => 'forums'),
'acl_a_forumadd' => array('lang' => 'Can add new forums', 'cat' => 'forums'),
'acl_a_forumdel' => array('lang' => 'Can delete forums', 'cat' => 'forums'),
'acl_a_prune' => array('lang' => 'Can prune forums', 'cat' => 'forums'),
'ACL_A_FORUM' => 'Can manage forums',
'ACL_A_FORUMADD' => 'Can add new forums',
'ACL_A_FORUMDEL' => 'Can delete forums',
'ACL_A_PRUNE' => 'Can prune forums',
'acl_a_icons' => array('lang' => 'Can alter topic/post icons and smilies', 'cat' => 'posting'),
'acl_a_words' => array('lang' => 'Can alter word censors', 'cat' => 'posting'),
'acl_a_bbcode' => array('lang' => 'Can define BBCode tags', 'cat' => 'posting'),
'acl_a_attach' => array('lang' => 'Can alter attachment related settings', 'cat' => 'posting'),
'ACL_A_ICONS' => 'Can alter topic/post icons and smilies',
'ACL_A_WORDS' => 'Can alter word censors',
'ACL_A_BBCODE' => 'Can define BBCode tags',
'ACL_A_ATTACH' => 'Can alter attachment related settings',
'acl_a_user' => array('lang' => 'Can manage users<br /><em>This also includes seeing the users browser agent within the viewonline list.</em>', 'cat' => 'user_group'),
'acl_a_userdel' => array('lang' => 'Can delete/prune users', 'cat' => 'user_group'),
'acl_a_group' => array('lang' => 'Can manage groups', 'cat' => 'user_group'),
'acl_a_groupadd' => array('lang' => 'Can add new groups', 'cat' => 'user_group'),
'acl_a_groupdel' => array('lang' => 'Can delete groups', 'cat' => 'user_group'),
'acl_a_ranks' => array('lang' => 'Can manage ranks', 'cat' => 'user_group'),
'acl_a_profile' => array('lang' => 'Can manage custom profile fields', 'cat' => 'user_group'),
'acl_a_names' => array('lang' => 'Can manage disallowed names', 'cat' => 'user_group'),
'acl_a_ban' => array('lang' => 'Can manage bans', 'cat' => 'user_group'),
'ACL_A_USER' => 'Can manage users<br /><em>This also includes seeing the users browser agent within the viewonline list.</em>',
'ACL_A_USERDEL' => 'Can delete/prune users',
'ACL_A_GROUP' => 'Can manage groups',
'ACL_A_GROUPADD' => 'Can add new groups',
'ACL_A_GROUPDEL' => 'Can delete groups',
'ACL_A_RANKS' => 'Can manage ranks',
'ACL_A_PROFILE' => 'Can manage custom profile fields',
'ACL_A_NAMES' => 'Can manage disallowed names',
'ACL_A_BAN' => 'Can manage bans',
'acl_a_viewauth' => array('lang' => 'Can view permission masks', 'cat' => 'permissions'),
'acl_a_authgroups' => array('lang' => 'Can alter permissions for individual groups', 'cat' => 'permissions'),
'acl_a_authusers' => array('lang' => 'Can alter permissions for individual users', 'cat' => 'permissions'),
'acl_a_fauth' => array('lang' => 'Can alter forum permission class', 'cat' => 'permissions'),
'acl_a_mauth' => array('lang' => 'Can alter moderator permission class', 'cat' => 'permissions'),
'acl_a_aauth' => array('lang' => 'Can alter admin permission class', 'cat' => 'permissions'),
'acl_a_uauth' => array('lang' => 'Can alter user permission class', 'cat' => 'permissions'),
'acl_a_roles' => array('lang' => 'Can manage roles', 'cat' => 'permissions'),
'acl_a_switchperm' => array('lang' => 'Can use others permissions', 'cat' => 'permissions'),
'ACL_A_VIEWAUTH' => 'Can view permission masks',
'ACL_A_AUTHGROUPS' => 'Can alter permissions for individual groups',
'ACL_A_AUTHUSERS' => 'Can alter permissions for individual users',
'ACL_A_FAUTH' => 'Can alter forum permission class',
'ACL_A_MAUTH' => 'Can alter moderator permission class',
'ACL_A_AAUTH' => 'Can alter admin permission class',
'ACL_A_UAUTH' => 'Can alter user permission class',
'ACL_A_ROLES' => 'Can manage roles',
'ACL_A_SWITCHPERM' => 'Can use others permissions',
'acl_a_styles' => array('lang' => 'Can manage styles', 'cat' => 'misc'),
'acl_a_extensions' => array('lang' => 'Can manage extensions', 'cat' => 'misc'),
'acl_a_viewlogs' => array('lang' => 'Can view logs', 'cat' => 'misc'),
'acl_a_clearlogs' => array('lang' => 'Can clear logs', 'cat' => 'misc'),
'acl_a_modules' => array('lang' => 'Can manage modules', 'cat' => 'misc'),
'acl_a_language' => array('lang' => 'Can manage language packs', 'cat' => 'misc'),
'acl_a_email' => array('lang' => 'Can send mass email', 'cat' => 'misc'),
'acl_a_bots' => array('lang' => 'Can manage bots', 'cat' => 'misc'),
'acl_a_reasons' => array('lang' => 'Can manage report/denial reasons', 'cat' => 'misc'),
'acl_a_backup' => array('lang' => 'Can backup/restore database', 'cat' => 'misc'),
'acl_a_search' => array('lang' => 'Can manage search backends and settings', 'cat' => 'misc'),
'ACL_A_STYLES' => 'Can manage styles',
'ACL_A_EXTENSIONS' => 'Can manage extensions',
'ACL_A_VIEWLOGS' => 'Can view logs',
'ACL_A_CLEARLOGS' => 'Can clear logs',
'ACL_A_MODULES' => 'Can manage modules',
'ACL_A_LANGUAGE' => 'Can manage language packs',
'ACL_A_EMAIL' => 'Can send mass email',
'ACL_A_BOTS' => 'Can manage bots',
'ACL_A_REASONS' => 'Can manage report/denial reasons',
'ACL_A_BACKUP' => 'Can backup/restore database',
'ACL_A_SEARCH' => 'Can manage search backends and settings',
));

View file

@ -12,7 +12,7 @@ Username: {USERNAME}
Board URL: {U_BOARD}
----------------------------
Useful information regarding the phpBB software can be found in the docs folder of your installation and on phpBB.com's support page - http://www.phpbb.com/support/
Useful information regarding the phpBB software can be found in the docs folder of your installation and on phpBB.com's support page - https://www.phpbb.com/support/
In order to keep your board safe and secure, we highly recommended keeping current with software releases. For your convenience, a mailing list is available at the page referenced above.

View file

@ -332,7 +332,7 @@ $help = array(
),
array(
0 => 'Why isnt X feature available?',
1 => 'This software was written by and licensed through phpBB Group. If you believe a feature needs to be added, or you want to report a bug, please visit the phpBB <a href="http://area51.phpbb.com/">Area51</a> website, where you will find resources to do so.'
1 => 'This software was written by and licensed through phpBB Group. If you believe a feature needs to be added please visit the <a href="https://www.phpbb.com/ideas/">phpBB Ideas Centre</a>, where you can upvote existing ideas or suggest new features.'
),
array(
0 => 'Who do I contact about abusive and/or legal matters related to this board?',

View file

@ -374,7 +374,7 @@ $lang = array_merge($lang, array(
// Updater
$lang = array_merge($lang, array(
'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now <a href="%1$s">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the <a href="%2$s">Send statistics</a> module in your ACP.',
'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version.',
'ARCHIVE_FILE' => 'Source file within archive',
'BACK' => 'Back',
@ -398,7 +398,7 @@ $lang = array_merge($lang, array(
'DATABASE_TYPE' => 'Database type',
'DATABASE_UPDATE_COMPLETE' => 'Database updater has completed!',
'DATABASE_UPDATE_CONTINUE' => 'Continue database update.',
'DATABASE_UPDATE_CONTINUE' => 'Continue database update',
'DATABASE_UPDATE_INFO_OLD' => 'The database update file within the install directory is outdated. Please make sure you uploaded the correct version of the file.',
'DATABASE_UPDATE_NOT_COMPLETED' => 'The database update has not yet completed.',
'DELETE_USER_REMOVE' => 'Delete user and remove posts',
@ -419,8 +419,9 @@ $lang = array_merge($lang, array(
'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive',
'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.',
'ERROR' => 'Error',
'EDIT_USERNAME' => 'Edit username',
'ERROR' => 'Error',
'EVERYTHING_UP_TO_DATE' => 'Everything is up to date with the latest phpBB version. You should now <a href="%1$s">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the <a href="%2$s">Send statistics</a> module in your ACP.',
'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.',
'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.',
@ -570,6 +571,7 @@ $lang = array_merge($lang, array(
'UPLOAD_METHOD' => 'Upload method',
'UPDATE_DB_SUCCESS' => 'Database update was successful.',
'UPDATE_FILE_SUCCESS' => 'File update was successful.',
'USER_ACTIVE' => 'Active user',
'USER_INACTIVE' => 'Inactive user',

View file

@ -561,17 +561,8 @@ switch ($mode)
if ($member['user_sig'])
{
$member['user_sig'] = censor_text($member['user_sig']);
if ($member['user_sig_bbcode_bitfield'])
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode();
$bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']);
}
$member['user_sig'] = bbcode_nl2br($member['user_sig']);
$member['user_sig'] = smiley_text($member['user_sig']);
$parse_flags = ($member['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield'], $parse_flags, true);
}
$poster_avatar = phpbb_get_user_avatar($member);

View file

@ -93,7 +93,7 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver
// Make sure getimagesize works...
if (function_exists('getimagesize'))
{
if (($width <= 0 || $height <= 0) && (($image_data = getimagesize($url)) === false))
if (($width <= 0 || $height <= 0) && (($image_data = @getimagesize($url)) === false))
{
$error[] = 'UNABLE_GET_IMAGE_SIZE';
return false;

View file

@ -205,28 +205,34 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
function purge()
{
// Purge all phpbb cache files
$dir = @opendir($this->cache_dir);
if (!$dir)
try
{
$iterator = new DirectoryIterator($this->cache_dir);
}
catch (Exception $e)
{
return;
}
while (($entry = readdir($dir)) !== false)
foreach ($iterator as $fileInfo)
{
if (strpos($entry, 'container_') !== 0 &&
strpos($entry, 'url_matcher') !== 0 &&
strpos($entry, 'sql_') !== 0 &&
strpos($entry, 'data_') !== 0 &&
strpos($entry, 'ctpl_') !== 0 &&
strpos($entry, 'tpl_') !== 0)
if ($fileInfo->isDot())
{
continue;
}
$this->remove_file($this->cache_dir . $entry);
$filename = $fileInfo->getFilename();
if ($fileInfo->isDir())
{
$this->remove_dir($fileInfo->getPathname());
}
elseif (strpos($filename, 'container_') === 0 ||
strpos($filename, 'url_matcher') === 0 ||
strpos($filename, 'sql_') === 0 ||
strpos($filename, 'data_') === 0)
{
$this->remove_file($fileInfo->getPathname());
}
}
closedir($dir);
unset($this->vars);
unset($this->var_expires);
@ -241,6 +247,44 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
$this->is_modified = false;
}
/**
* Remove directory
*
* @param string $dir Directory to remove
*
* @return null
*/
protected function remove_dir($dir)
{
try
{
$iterator = new DirectoryIterator($dir);
}
catch (Exception $e)
{
return;
}
foreach ($iterator as $fileInfo)
{
if ($fileInfo->isDot())
{
continue;
}
if ($fileInfo->isDir())
{
$this->remove_dir($fileInfo->getPathname());
}
else
{
$this->remove_file($fileInfo->getPathname());
}
}
@rmdir($dir);
}
/**
* Destroy cache data
*/

View file

@ -360,6 +360,11 @@ class phpbb_content_visibility
// Sync the first/last topic information if needed
if (!$is_starter && $is_latest)
{
if (!function_exists('update_post_information'))
{
include($this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext);
}
// update_post_information can only update the last post info ...
if ($topic_id)
{

View file

@ -38,23 +38,23 @@ class phpbb_controller_resolver implements ControllerResolverInterface
protected $container;
/**
* phpbb_style object
* @var phpbb_style
* phpbb_template object
* @var phpbb_template
*/
protected $style;
protected $template;
/**
* Construct method
*
* @param phpbb_user $user User Object
* @param ContainerInterface $container ContainerInterface object
* @param phpbb_style $style
* @param phpbb_template $template
*/
public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_style $style = null)
public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_template $template = null)
{
$this->user = $user;
$this->container = $container;
$this->style = $style;
$this->template = $template;
}
/**
@ -96,13 +96,13 @@ class phpbb_controller_resolver implements ControllerResolverInterface
$controller_dir = explode('_', get_class($controller_object));
// 0 phpbb, 1 ext, 2 vendor, 3 extension name, ...
if (!is_null($this->style) && isset($controller_dir[3]) && $controller_dir[1] === 'ext')
if (!is_null($this->template) && isset($controller_dir[3]) && $controller_dir[1] === 'ext')
{
$controller_style_dir = 'ext/' . $controller_dir[2] . '/' . $controller_dir[3] . '/styles';
if (is_dir($controller_style_dir))
{
$this->style->set_style(array($controller_style_dir, 'styles'));
$this->template->set_style(array($controller_style_dir, 'styles'));
}
}

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