aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_board.php2
-rw-r--r--phpBB/includes/acp/acp_ranks.php46
-rw-r--r--phpBB/includes/functions.php2
-rw-r--r--phpBB/includes/functions_module.php24
-rw-r--r--phpBB/includes/functions_posting.php15
5 files changed, 58 insertions, 31 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 1811748c2f..f2707f15ca 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -925,7 +925,7 @@ class acp_board
{
$user->timezone = new DateTimeZone($config['board_timezone']);
}
- catch (Exception $e)
+ catch (\Exception $e)
{
// If the board timezone is invalid, we just use the users timezone.
}
diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php
index fdbd0e0a1d..5885de57ec 100644
--- a/phpBB/includes/acp/acp_ranks.php
+++ b/phpBB/includes/acp/acp_ranks.php
@@ -25,7 +25,7 @@ class acp_ranks
function main($id, $mode)
{
- global $db, $user, $auth, $template, $cache, $request;
+ global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('acp/posting');
@@ -73,6 +73,17 @@ class acp_ranks
'rank_image' => htmlspecialchars_decode($rank_image)
);
+ /**
+ * Modify the SQL array when saving a rank
+ *
+ * @event core.acp_ranks_save_modify_sql_ary
+ * @var int rank_id The ID of the rank (if available)
+ * @var array sql_ary Array with the rank's data
+ * @since 3.1.0-RC3
+ */
+ $vars = array('rank_id', 'sql_ary');
+ extract($phpbb_dispatcher->trigger_event('core.acp_ranks_save_modify_sql_ary', compact($vars)));
+
if ($rank_id)
{
$sql = 'UPDATE ' . RANKS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE rank_id = $rank_id";
@@ -202,7 +213,7 @@ class acp_ranks
$filename_list = '<option value=""' . (($edit_img == '') ? ' selected="selected"' : '') . '>----------</option>' . $filename_list;
unset($existing_imgs, $imglist);
- $template->assign_vars(array(
+ $tpl_ary = array(
'S_EDIT' => true,
'U_BACK' => $this->u_action,
'RANKS_PATH' => $phpbb_root_path . $config['ranks_path'],
@@ -212,9 +223,21 @@ class acp_ranks
'S_FILENAME_LIST' => $filename_list,
'RANK_IMAGE' => ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : htmlspecialchars($phpbb_admin_path) . 'images/spacer.gif',
'S_SPECIAL_RANK' => (isset($ranks['rank_special']) && $ranks['rank_special']) ? true : false,
- 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0)
+ 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0,
);
+ /**
+ * Modify the template output array for editing/adding ranks
+ *
+ * @event core.acp_ranks_edit_modify_tpl_ary
+ * @var array ranks Array with the rank's data
+ * @var array tpl_ary Array with the rank's template data
+ * @since 3.1.0-RC3
+ */
+ $vars = array('ranks', 'tpl_ary');
+ extract($phpbb_dispatcher->trigger_event('core.acp_ranks_edit_modify_tpl_ary', compact($vars)));
+
+ $template->assign_vars($tpl_ary);
return;
break;
@@ -231,7 +254,7 @@ class acp_ranks
while ($row = $db->sql_fetchrow($result))
{
- $template->assign_block_vars('ranks', array(
+ $rank_row = array(
'S_RANK_IMAGE' => ($row['rank_image']) ? true : false,
'S_SPECIAL_RANK' => ($row['rank_special']) ? true : false,
@@ -240,8 +263,21 @@ class acp_ranks
'MIN_POSTS' => $row['rank_min'],
'U_EDIT' => $this->u_action . '&amp;action=edit&amp;id=' . $row['rank_id'],
- 'U_DELETE' => $this->u_action . '&amp;action=delete&amp;id=' . $row['rank_id'])
+ 'U_DELETE' => $this->u_action . '&amp;action=delete&amp;id=' . $row['rank_id'],
);
+
+ /**
+ * Modify the template output array for each listed rank
+ *
+ * @event core.acp_ranks_list_modify_rank_row
+ * @var array row Array with the rank's data
+ * @var array rank_row Array with the rank's template data
+ * @since 3.1.0-RC3
+ */
+ $vars = array('row', 'rank_row');
+ extract($phpbb_dispatcher->trigger_event('core.acp_ranks_list_modify_rank_row', compact($vars)));
+
+ $template->assign_block_vars('ranks', $rank_row);
}
$db->sql_freeresult($result);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index d7b1b56532..4318b20b97 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1031,7 +1031,7 @@ function phpbb_get_timezone_identifiers($selected_timezone)
$validate_timezone = new DateTimeZone($selected_timezone);
$timezones[] = $selected_timezone;
}
- catch (Exception $e)
+ catch (\Exception $e)
{
}
}
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 397e6401ff..fe9bcdb9d1 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -489,6 +489,12 @@ class p_master
$id = request_var('icat', '');
}
+ // Restore the backslashes in class names
+ if (strpos($id, '-') !== false)
+ {
+ $id = str_replace('-', '\\', $id);
+ }
+
if ($id && !is_numeric($id) && !$this->is_full_class($id))
{
$id = $this->p_class . '_' . $id;
@@ -616,7 +622,7 @@ class p_master
}
// Not being able to overwrite ;)
- $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name, $this->p_id)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
+ $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
else
{
@@ -648,7 +654,7 @@ class p_master
$this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name'];
}
- $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name, $this->p_id)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
+ $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
// Add url_extra parameter to u_action url
@@ -901,7 +907,7 @@ class p_master
else
{
// if the category has a name, then use it.
- $u_title .= $this->get_module_identifier($item_ary['name'], $item_ary['id']);
+ $u_title .= $this->get_module_identifier($item_ary['name']);
}
// If the item is not a category append the mode
if (!$item_ary['cat'])
@@ -1106,26 +1112,24 @@ class p_master
}
/**
- * If the basename contains a \ we dont use that for the URL.
+ * If the basename contains a \ we don't use that for the URL.
*
* Firefox is currently unable to correctly copy a urlencoded \
* so users will be unable to post links to modules.
- * However we can still fallback to the id instead of the name,
- * so we do that in this case.
+ * However we can replace them with dashes and re-replace them later
*
* @param string $basename Basename of the module
- * @param int $id Id of the module
- * @return mixed Identifier that should be used for
+ * @return string Identifier that should be used for
* module link creation
*/
- protected function get_module_identifier($basename, $id)
+ protected function get_module_identifier($basename)
{
if (strpos($basename, '\\') === false)
{
return $basename;
}
- return $id;
+ return str_replace('\\', '-', $basename);
}
/**
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index f7e33725ec..fb09bc7057 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1431,20 +1431,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
{
if (!$is_soft)
{
- if ($data['post_visibility'] == ITEM_APPROVED)
- {
- $phpbb_content_visibility->remove_post_from_statistic($data, $sql_data);
- }
- else if ($data['post_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE)
- {
- $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_unapproved = forum_posts_unapproved - 1';
- $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_unapproved = topic_posts_unapproved - 1';
- }
- else if ($data['post_visibility'] == ITEM_DELETED)
- {
- $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_softdeleted = forum_posts_softdeleted - 1';
- $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_softdeleted = topic_posts_softdeleted - 1';
- }
+ $phpbb_content_visibility->remove_post_from_statistic($data, $sql_data);
}
$sql = 'SELECT 1 AS has_attachments