school shit

This commit is contained in:
Pachira 2016-09-20 14:54:45 +02:00
parent c2d60e216c
commit 1435b8e007

View file

@ -3,6 +3,8 @@
* A set of utility helper functions
*/
use Phroute\Phroute\Exception\HttpMethodNotAllowedException;
use Phroute\Phroute\Exception\HttpRouteNotFoundException;
use Sakura\Config;
use Sakura\Exceptions\ConfigValueNotFoundException;
use Sakura\Net;
@ -52,6 +54,20 @@ function view($name, $vars = [])
return Template::render($name);
}
// Abort response
function abort($status = 200)
{
http_response_code($status);
switch ($status) {
case 403:
throw new HttpMethodNotAllowedException;
case 404:
throw new HttpRouteNotFoundException;
}
}
function clean_string($string, $lower = false, $noSpecial = false, $replaceSpecial = '')
{
// Run common sanitisation function over string