Confirm deletion.
[readifood.git] / lib / hub.php
index 51aec9a..7a18d47 100644 (file)
     return $hub->getId();
   }
 
+  function confirm_delete_hub($name, $id = null) {
+    if (! check_admin(1, "delete a hub")) return;
+
+    if (isset($id)) $hub = get_hub_by_id($id);
+    else $hub = get_hub_by_name($name);
+    if (! $hub) return false;
+
+    echo "<h3>Confirm deletion</h3>\n";
+    echo "<p>You must confirm deletion of hub " . $hub->getDisplayname() . ": " . $hub->getDeleteLink(true) . "</p>\n";
+  }
+
   function delete_hub($name, $id = null, &$city_id = null) {
     if (! check_admin(1, "delete a hub")) return;
 
   if (count($args)) {
     switch ($args[0]) {
       case "delete":
+        confirm_delete_hub($name, $id);
+      break;
+
+      case "confirmdelete":
         delete_hub($name, $id);
       break;
     }