From c9968db2dddd42760e7adba2e9e5475925c4996c Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Fri, 19 Dec 2008 20:40:26 -0500 Subject: Fixed Admin's movePending output The movePending command is used to re-arrange the pending queue. However, it's output had two errors: 1. If the move completed sucessfully, the pending queue would be shown again. However, the URL would still be the movePending command, with it's parameters. Because of this, if the user refreshed, it would try to re-arrange the queue again, which could cause some strange things to happen as the post in question had already been moved. This problem has been fixed by redirecting to the managePending command after executing the movePending command instead of simply running the managePending command internally as used to be the problem. 2. As a collary of the preceding error, if the move failed, the error would simply back up the browser's history and refresh. If the previous page was the output of a sucessful movePending command, strange things would happen. This was fixed dually by the previous solution and the fact that now the error messages simply link to the managePending command. --- pages/admin.php | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'pages') diff --git a/pages/admin.php b/pages/admin.php index a171b6f..50e7abc 100755 --- a/pages/admin.php +++ b/pages/admin.php @@ -372,8 +372,9 @@ if (isLoggedIn()) { $otherPending = $get2pending3; } else { - $template = new FITemplate('msg'); - $template->add('BACK', 'the previous page'); + $template = new FITemplate('msg2'); + $template->add('BACK', 'Back to the pending queue'); + $template->add('LINK', 'managePending.php'); $template->add('MSG', 'I\'m sorry, that pending post is already the first.'); } } else if ($_GET['dir'] == 'down') @@ -386,8 +387,9 @@ if (isLoggedIn()) { $otherPending = $get2pending3; } else { - $template = new FITemplate('msg'); - $template->add('BACK', 'the previous page'); + $template = new FITemplate('msg2'); + $template->add('BACK', 'Back to the pending queue'); + $template->add('LINK', 'managePending.php'); $template->add('MSG', 'I\'m sorry, that pending post is already the last.'); } } @@ -410,22 +412,13 @@ if (isLoggedIn()) addTags($_GET['id'], $tags2, 'pending'); addTags($otherPending['id'], $tags1, 'pending'); - $template = new FITemplate('admin/managePending'); - - $getpending = "SELECT * FROM pending ORDER BY id ASC"; - $getpending2 = mysql_query($getpending); - $i=0; - while ($getpending3[$i] = mysql_fetch_array($getpending2)) - { - $template->adds_block('PENDING', array( 'TITLE' => $getpending3[$i]['title'], - 'AUTHOR' => $getpending3[$i]['author'], - 'ID' => $getpending3[$i]['id'])); - $i++; - } + header('Location: managePending.php'); + exit; } } else { - $template = new FITemplate('msg'); - $template->add('BACK', 'the previous page'); + $template = new FITemplate('msg2'); + $template->add('BACK', 'Back to the pending queue'); + $template->add('LINK', 'managePending.php'); $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); } } else if ($_GET['page'] == 'managePosts') -- cgit 1.4.1