Skip to content

Commit

Permalink
Add location url function with a exit break by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jloguercio committed Feb 27, 2017
1 parent ca77870 commit c0ba9f9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions main/inc/lib/api.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

1 comment on commit c0ba9f9

@ywarnier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little redundant with the Redirect class (see main/inc/lib/redirect.class.php) and should be removed as it isn't used yet.

Please sign in to comment.