fixed redirect in comments (baaw!) incidentally I've added a new option for panels to define mandatory argument; why? BECAUSE I CAN! BAWAHAHAHA; really because I hadn't any other idea, and this sounded nice; I'll have to port the other panels for simmetry, but in the meantime they should still work ok.
This commit is contained in:
		
							parent
							
								
									ae4ed473f7
								
							
						
					
					
						commit
						69f4510433
					
				@ -96,6 +96,7 @@
 | 
				
			|||||||
		var $smarty = null;
 | 
							var $smarty = null;
 | 
				
			||||||
		var $events = array();
 | 
							var $events = array();
 | 
				
			||||||
		var $commands = array();
 | 
							var $commands = array();
 | 
				
			||||||
 | 
							var $args = array();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		var $langres = ''; 
 | 
							var $langres = ''; 
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
@ -109,6 +110,13 @@
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		function exec() {
 | 
							function exec() {
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
 | 
								foreach($this->args as $mandatory_argument) {
 | 
				
			||||||
 | 
									if (!isset($_GET[$mandatory_argument])) {
 | 
				
			||||||
 | 
										return PANEL_REDIRECT_DEFAULT;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								
 | 
				
			||||||
			$this->setup();
 | 
								$this->setup();
 | 
				
			||||||
			$result = 0; // if !=0, defaultaction for this panel is called
 | 
								$result = 0; // if !=0, defaultaction for this panel is called
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
@ -248,4 +256,4 @@
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 | 
				
			|||||||
@ -89,7 +89,7 @@
 | 
				
			|||||||
 		$smarty->assign('success', sess_remove("success_{$panel}"));
 | 
					 		$smarty->assign('success', sess_remove("success_{$panel}"));
 | 
				
			||||||
 		$retval = $fp_admin_action->exec();
 | 
					 		$retval = $fp_admin_action->exec();
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
		if ($retval > 0) {
 | 
							if ($retval > 0) { // if has REDIRECT option
 | 
				
			||||||
			// clear postdata by a redirect
 | 
								// clear postdata by a redirect
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			sess_add("success_{$panel}", $smarty->get_template_vars('success'));
 | 
								sess_add("success_{$panel}", $smarty->get_template_vars('success'));
 | 
				
			||||||
@ -97,8 +97,17 @@
 | 
				
			|||||||
			
 | 
								
 | 
				
			||||||
			$to_action = $retval > 1 ? ('&action=' . $action) : '';
 | 
								$to_action = $retval > 1 ? ('&action=' . $action) : '';
 | 
				
			||||||
			$with_mod = isset($_GET['mod'])? ('&mod=' . $_GET['mod']) : ''; 
 | 
								$with_mod = isset($_GET['mod'])? ('&mod=' . $_GET['mod']) : ''; 
 | 
				
			||||||
			
 | 
								$with_arguments = '';
 | 
				
			||||||
			utils_redirect("admin.php?p={$panel}{$to_action}{$with_mod}");
 | 
					
 | 
				
			||||||
 | 
								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);
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
				
			|||||||
@ -16,29 +16,23 @@
 | 
				
			|||||||
 
 | 
					 
 | 
				
			||||||
 	class admin_entry_commentlist extends AdminPanelAction {
 | 
					 	class admin_entry_commentlist extends AdminPanelAction {
 | 
				
			||||||
 		
 | 
					 		
 | 
				
			||||||
 		var $commands = array('delete');
 | 
							var $commands = array('delete');
 | 
				
			||||||
 | 
							var $args = array('entry');
 | 
				
			||||||
 		
 | 
					 		
 | 
				
			||||||
 		function dodelete($commentid) {
 | 
					 		function dodelete($commentid) {
 | 
				
			||||||
			$this->smarty->assign('success',
 | 
								$this->smarty->assign('success',
 | 
				
			||||||
				comment_delete($_GET['entry'], $commentid)? 6 : -6 
 | 
									comment_delete($_GET['entry'], $commentid)? 1 : -1
 | 
				
			||||||
			);
 | 
								);
 | 
				
			||||||
			return PANEL_REDIRECT_CURRENT;
 | 
								return PANEL_REDIRECT_CURRENT;
 | 
				
			||||||
 		}
 | 
					 		}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		function main() {
 | 
							function main() {
 | 
				
			||||||
			global $fpdb;
 | 
								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;
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}			
 | 
						}			
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -63,9 +63,6 @@
 | 
				
			|||||||
		2	=> 'Entry has been deleted successfully',
 | 
							2	=> 'Entry has been deleted successfully',
 | 
				
			||||||
		-2	=>	 'An error occurred while trying to delete 
 | 
							-2	=>	 'An error occurred while trying to delete 
 | 
				
			||||||
					the entry',
 | 
										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.',
 | 
							'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 */
 | 
						/* delete action */
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user