Ver Fonte

List Views: Simplify action handling.

Nate há 5 anos atrás
pai
commit
7f5cd7e8b9
1 ficheiros alterados com 13 adições e 9 exclusões
  1. 13 9
      contacts.php

+ 13 - 9
contacts.php

@@ -50,16 +50,20 @@
 		$contacts = $_POST['contacts'];
 	}
 
-//delete the contacts
-	if (permission_exists('contact_delete')) {
-		if ($action == 'delete' && is_array($contacts) && @sizeof($contacts) != 0) {
-			//delete
-				$obj = new contacts;
-				$obj->delete($contacts);
-			//redirect
-				header('Location: contacts.php'.($search != '' ? '?search='.urlencode($search) : null));
-				exit;
+//process posted data by action
+	if ($action != '' && is_array($contacts) && @sizeof($contacts) != 0) {
+		$obj = new contacts;
+
+		switch ($action) {
+			case 'delete':
+				if (permission_exists('contact_delete')) {
+					$obj->delete($contacts);
+				}
+				break;
 		}
+
+		header('Location: contacts.php'.($search != '' ? '?search='.urlencode($search) : null));
+		exit;
 	}
 
 //retrieve current user's assigned groups (uuids)