diff --git a/admin/includes/panels.prototypes.php b/admin/includes/panels.prototypes.php index 011677a..8448b54 100644 --- a/admin/includes/panels.prototypes.php +++ b/admin/includes/panels.prototypes.php @@ -96,6 +96,7 @@ var $smarty = null; var $events = array(); var $commands = array(); + var $args = array(); var $langres = ''; @@ -109,6 +110,13 @@ function exec() { + foreach($this->args as $mandatory_argument) { + if (!isset($_GET[$mandatory_argument])) { + return PANEL_REDIRECT_DEFAULT; + } + } + + $this->setup(); $result = 0; // if !=0, defaultaction for this panel is called @@ -248,4 +256,4 @@ -?> \ No newline at end of file +?> diff --git a/admin/main.php b/admin/main.php index 795c612..6aeac92 100755 --- a/admin/main.php +++ b/admin/main.php @@ -89,7 +89,7 @@ $smarty->assign('success', sess_remove("success_{$panel}")); $retval = $fp_admin_action->exec(); - if ($retval > 0) { + if ($retval > 0) { // if has REDIRECT option // clear postdata by a redirect sess_add("success_{$panel}", $smarty->get_template_vars('success')); @@ -97,8 +97,17 @@ $to_action = $retval > 1 ? ('&action=' . $action) : ''; $with_mod = isset($_GET['mod'])? ('&mod=' . $_GET['mod']) : ''; - - utils_redirect("admin.php?p={$panel}{$to_action}{$with_mod}"); + $with_arguments = ''; + + if ($retval == PANEL_REDIRECT_CURRENT) { + foreach ($fp_admin_action->args as $mandatory_argument) { + $with_arguments .= '&' . $mandatory_argument . + '=' . $_GET[$mandatory_argument]; + } + } + + $url = "admin.php?p={$panel}{$to_action}{$with_mod}{$with_arguments}"; + utils_redirect($url); } diff --git a/admin/panels/entry/admin.entry.commentlist.php b/admin/panels/entry/admin.entry.commentlist.php index 220f51e..1776c8b 100755 --- a/admin/panels/entry/admin.entry.commentlist.php +++ b/admin/panels/entry/admin.entry.commentlist.php @@ -16,29 +16,23 @@ class admin_entry_commentlist extends AdminPanelAction { - var $commands = array('delete'); + var $commands = array('delete'); + var $args = array('entry'); function dodelete($commentid) { $this->smarty->assign('success', - comment_delete($_GET['entry'], $commentid)? 6 : -6 + comment_delete($_GET['entry'], $commentid)? 1 : -1 ); return PANEL_REDIRECT_CURRENT; } function main() { global $fpdb; - if (isset($_GET['entry'])) { - $fpdb->query("id:{$_GET['entry']},fullparse:true"); + $fpdb->query("id:{$_GET['entry']},fullparse:true"); - return 0; + return 0; - - } - - - return 1; - } } diff --git a/fp-interface/lang/en-us/lang.admin.entry.php b/fp-interface/lang/en-us/lang.admin.entry.php index cc365ea..abb92b9 100755 --- a/fp-interface/lang/en-us/lang.admin.entry.php +++ b/fp-interface/lang/en-us/lang.admin.entry.php @@ -63,9 +63,6 @@ 2 => 'Entry has been deleted successfully', -2 => 'An error occurred while trying to delete the entry', - 6 => 'Comment has been deleted successfully', - -6 => 'An error occurred while trying to delete - the comment', ); @@ -98,6 +95,14 @@ 'nocomments' => 'This entry have not been commented, yet.', + ); + + $lang['admin']['entry']['commentlist']['msgs'] = + array( + 1 => 'Comment has been deleted successfully', + -1 => 'An error occurred while trying to delete + the comment', + ); /* delete action */