aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_board.php3
-rw-r--r--phpBB/includes/acp/acp_database.php1
-rw-r--r--phpBB/includes/functions.php4
-rw-r--r--phpBB/includes/functions_display.php40
-rw-r--r--phpBB/includes/functions_module.php2
-rw-r--r--phpBB/includes/mcp/mcp_front.php37
-rw-r--r--phpBB/includes/mcp/mcp_reports.php1
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php2
8 files changed, 74 insertions, 16 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 63e2647f02..a41a53226f 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -514,7 +514,8 @@ class acp_board
if ($config_name == 'guest_style')
{
- if (isset($cfg_array[$config_name])) {
+ if (isset($cfg_array[$config_name]))
+ {
$this->guest_style_set($cfg_array[$config_name]);
}
continue;
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 0c52f82459..c5aebf011d 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -1173,6 +1173,7 @@ class postgres_extractor extends base_extractor
$this->flush($sql_data . ";\n");
}
}
+ $db->sql_freeresult($result);
$sql_data = '-- Table: ' . $table_name . "\n";
$sql_data .= "DROP TABLE $table_name;\n";
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index e2e9b509d7..d460497669 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2309,7 +2309,7 @@ function redirect($url, $return = false, $disable_cd_check = false)
// Attention: only able to redirect within the same domain if $disable_cd_check is false (yourdomain.com -> www.yourdomain.com will not work)
if (!$disable_cd_check && $url_parts['host'] !== $user->host)
{
- $url = generate_board_url();
+ trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
}
}
else if ($url[0] == '/')
@@ -2347,7 +2347,7 @@ function redirect($url, $return = false, $disable_cd_check = false)
// Clean URL and check if we go outside the forum directory
$url = $phpbb_path_helper->clean_url($url);
- if (!$disable_cd_check && strpos($url, generate_board_url(true)) === false)
+ if (!$disable_cd_check && strpos($url, generate_board_url(true) . '/') !== 0)
{
trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
}
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index b62b514293..5888a6160d 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -732,13 +732,15 @@ function generate_forum_rules(&$forum_data)
function generate_forum_nav(&$forum_data)
{
global $db, $user, $template, $auth, $config;
- global $phpEx, $phpbb_root_path;
+ global $phpEx, $phpbb_root_path, $phpbb_dispatcher;
if (!$auth->acl_get('f_list', $forum_data['forum_id']))
{
return;
}
+ $navlinks = $navlinks_parents = $forum_template_data = array();
+
// Get forum parents
$forum_parents = get_forum_parents($forum_data);
@@ -757,35 +759,59 @@ function generate_forum_nav(&$forum_data)
continue;
}
- $template->assign_block_vars('navlinks', array(
+ $navlinks_parents[] = array(
'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false,
'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false,
'FORUM_NAME' => $parent_name,
'FORUM_ID' => $parent_forum_id,
'MICRODATA' => $microdata_attr . '="' . $parent_forum_id . '"',
- 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id))
+ 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id),
);
}
}
- $template->assign_block_vars('navlinks', array(
+ $navlinks = array(
'S_IS_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_ID' => $forum_data['forum_id'],
'MICRODATA' => $microdata_attr . '="' . $forum_data['forum_id'] . '"',
- 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id']))
+ 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id']),
);
- $template->assign_vars(array(
+ $forum_template_data = array(
'FORUM_ID' => $forum_data['forum_id'],
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']),
'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false,
- ));
+ );
+
+ /**
+ * Event to modify the navlinks text
+ *
+ * @event core.generate_forum_nav
+ * @var array forum_data Array with the forum data
+ * @var array forum_template_data Array with generic forum template data
+ * @var string microdata_attr The microdata attribute
+ * @var array navlinks_parents Array with the forum parents navlinks data
+ * @var array navlinks Array with the forum navlinks data
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'forum_data',
+ 'forum_template_data',
+ 'microdata_attr',
+ 'navlinks_parents',
+ 'navlinks',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.generate_forum_nav', compact($vars)));
+
+ $template->assign_block_vars_array('navlinks', $navlinks_parents);
+ $template->assign_block_vars('navlinks', $navlinks);
+ $template->assign_vars($forum_template_data);
return;
}
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index fe9bcdb9d1..f9ceecff63 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -1086,7 +1086,7 @@ class p_master
->core_path('language/' . $user->lang_name . '/mods/')
->find();
- $lang_files = array_unique(array_merge($user_lang_files, $english_lang_files, $default_lang_files));
+ $lang_files = array_merge($english_lang_files, $default_lang_files, $user_lang_files);
foreach ($lang_files as $lang_file => $ext_name)
{
$user->add_lang_ext($ext_name, $lang_file);
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index 500db55456..629b6fd275 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -41,10 +41,27 @@ function mcp_front_view($id, $mode, $action)
if (!empty($forum_list))
{
- $sql = 'SELECT COUNT(post_id) AS total
- FROM ' . POSTS_TABLE . '
- WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
- AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE));
+ $sql_ary = array(
+ 'SELECT' => 'COUNT(post_id) AS total',
+ 'FROM' => array(
+ POSTS_TABLE => 'p',
+ ),
+ 'WHERE' => $db->sql_in_set('p.forum_id', $forum_list) . '
+ AND ' . $db->sql_in_set('p.post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE))
+ );
+
+ /**
+ * Allow altering the query to get the number of unapproved posts
+ *
+ * @event core.mcp_front_queue_unapproved_total_before
+ * @var int sql_ary Query to get the total number of unapproved posts
+ * @var array forum_list List of forums to look for unapproved posts
+ * @since 3.1.5-RC1
+ */
+ $vars = array('sql_ary', 'forum_list');
+ extract($phpbb_dispatcher->trigger_event('core.mcp_front_queue_unapproved_total_before', compact($vars)));
+
+ $sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query($sql);
$total = (int) $db->sql_fetchfield('total');
$db->sql_freeresult($result);
@@ -157,6 +174,18 @@ function mcp_front_view($id, $mode, $action)
AND r.pm_id = 0
AND r.report_closed = 0
AND ' . $db->sql_in_set('p.forum_id', $forum_list);
+
+ /**
+ * Alter sql query to count the number of reported posts
+ *
+ * @event core.mcp_front_reports_count_query_before
+ * @var int sql The query string used to get the number of reports that exist
+ * @var array forum_list List of forums that contain the posts
+ * @since 3.1.5-RC1
+ */
+ $vars = array('sql', 'forum_list');
+ extract($phpbb_dispatcher->trigger_event('core.mcp_front_reports_count_query_before', compact($vars)));
+
$result = $db->sql_query($sql);
$total = (int) $db->sql_fetchfield('total');
$db->sql_freeresult($result);
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index 804d48ea97..ccb54092b4 100644
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -489,6 +489,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)
{
$post_id_list[] = $row[$id_column];
}
+ $db->sql_freeresult($result);
$post_id_list = array_unique($post_id_list);
if ($pm)
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index 1d3fb19f67..3c274b53c7 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -69,7 +69,7 @@ class ucp_prefs
* @var array data Array with current ucp options data
* @var array error Array with list of errors
* @since 3.1.0-a1
- * @changed 3.1.4-rc1 Added error variable to the event
+ * @changed 3.1.4-RC1 Added error variable to the event
*/
$vars = array('submit', 'data', 'error');
extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars)));