aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2013-12-22 18:46:47 +0000
committermistic100 <mistic@piwigo.org>2013-12-22 18:46:47 +0000
commit76b478026f8e996ed8ca993fc71f647153ab2fd4 (patch)
treecd7b7dd88b96ab8fa0a7062e9d83117f73ffb485
parentbb20bfc9ea3c8d73d52c5091a8a5e730817b6e02 (diff)
minimize number of url constructions on comments.php
git-svn-id: http://piwigo.org/svn/trunk@26088 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--comments.php35
1 files changed, 9 insertions, 26 deletions
diff --git a/comments.php b/comments.php
index 906fca87a..e2a36ba39 100644
--- a/comments.php
+++ b/comments.php
@@ -38,6 +38,9 @@ if (!$conf['activate_comments'])
// +-----------------------------------------------------------------------+
check_status(ACCESS_GUEST);
+$url_self = PHPWG_ROOT_PATH.'comments.php'
+ .get_query_string_diff(array('delete','edit','validate','pwg_token'));
+
$sort_order = array(
'DESC' => l10n('descending'),
'ASC' => l10n('ascending')
@@ -284,12 +287,7 @@ if (isset($action))
if ($perform_redirect)
{
- $redirect_url =
- PHPWG_ROOT_PATH
- .'comments.php'
- .get_query_string_diff(array('delete','edit','validate','pwg_token'));
-
- redirect($redirect_url);
+ redirect($url_self);
}
}
}
@@ -386,9 +384,8 @@ SELECT COUNT(DISTINCT(com.id))
;';
list($counter) = pwg_db_fetch_row(pwg_query($query));
-$url = PHPWG_ROOT_PATH
- .'comments.php'
- .get_query_string_diff(array('start','delete','validate','pwg_token'));
+$url = PHPWG_ROOT_PATH.'comments.php'
+ .get_query_string_diff(array('start','edit','delete','validate','pwg_token'));
$navbar = create_navigation_bar($url,
$counter,
@@ -398,10 +395,6 @@ $navbar = create_navigation_bar($url,
$template->assign('navbar', $navbar);
-$url_self = PHPWG_ROOT_PATH
- .'comments.php'
- .get_query_string_diff(array('edit','delete','validate','pwg_token'));
-
// +-----------------------------------------------------------------------+
// | last comments display |
// +-----------------------------------------------------------------------+
@@ -536,13 +529,8 @@ SELECT c.id, name, permalink, uppercats, com.id as comment_id
if (can_manage_comment('delete', $comment['author_id']))
{
- $url =
- get_root_url()
- .'comments.php'
- .get_query_string_diff(array('delete','validate','edit', 'pwg_token'));
-
$tpl_comment['U_DELETE'] = add_url_params(
- $url,
+ $url_self,
array(
'delete' => $comment['comment_id'],
'pwg_token' => get_pwg_token(),
@@ -552,13 +540,8 @@ SELECT c.id, name, permalink, uppercats, com.id as comment_id
if (can_manage_comment('edit', $comment['author_id']))
{
- $url =
- get_root_url()
- .'comments.php'
- .get_query_string_diff(array('edit', 'delete','validate', 'pwg_token'));
-
$tpl_comment['U_EDIT'] = add_url_params(
- $url,
+ $url_self,
array(
'edit' => $comment['comment_id']
)
@@ -581,7 +564,7 @@ SELECT c.id, name, permalink, uppercats, com.id as comment_id
if ('true' != $comment['validated'])
{
$tpl_comment['U_VALIDATE'] = add_url_params(
- $url,
+ $url_self,
array(
'validate'=> $comment['comment_id'],
'pwg_token' => get_pwg_token(),