diff msitegen.inc.php @ 211:5bae42020034

Factorize some code into msitegen.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 17 Nov 2013 20:51:03 +0200
parents cafc05949a19
children cec8bd335163
line wrap: on
line diff
--- a/msitegen.inc.php	Sun Nov 17 20:35:52 2013 +0200
+++ b/msitegen.inc.php	Sun Nov 17 20:51:03 2013 +0200
@@ -48,6 +48,28 @@
 }
 
 
+function stDumpAJAXStatusErrors()
+{
+  global $errorSet, $errorMsgs, $statusSet, $statusMsg;
+
+  if ($errorSet && !$statusSet)
+    stSetStatus(902, "Error");
+
+  if ($statusSet)
+  {
+    http_response_code($statusSet);
+    header("Status: ".$statusSet." ".$statusMsg);
+  }
+    
+  if ($errorSet)
+  {
+    echo "Following errors occured:\n";
+    foreach ($errorMsgs as $msg)
+      echo " - ".$msg."\n";
+  }
+}
+
+
 function stCheckHTTPS()
 {
   return isset($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] != "" && $_SERVER["HTTPS"] != "off");