Browse Source

Add location url function with a exit break by default

José Loguercio 8 years ago
parent
commit
c0ba9f94f6
1 changed files with 16 additions and 0 deletions
  1. 16 0
      main/inc/lib/api.lib.php

+ 16 - 0
main/inc/lib/api.lib.php

@@ -8095,3 +8095,19 @@ function api_number_format($number, $decimals = 0)
 
     return number_format($number, $decimals);
 }
+
+/**
+ * Set location url with a exit break by default
+ *
+ * @param $url
+ * @param bool $exit
+ * @return void
+ */
+function location($url, $exit = true)
+{
+    header('Location: ' . $url);
+
+    if ($exit) {
+        exit;
+    }
+}