From 76b478026f8e996ed8ca993fc71f647153ab2fd4 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sun, 22 Dec 2013 18:46:47 +0000 Subject: minimize number of url constructions on comments.php git-svn-id: http://piwigo.org/svn/trunk@26088 68402e56-0260-453c-a942-63ccdbb3a9ee --- comments.php | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'comments.php') 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(), -- cgit v1.2.3