Browse Source

Merge pull request #1717 from jloguercio/1.11.x

Add location url function with a exit break by default
José Loguercio 8 years ago
parent
commit
41c0f23abb
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;
+    }
+}