2017-11-08 17:39:50 +01:00
|
|
|
<?php if(count(get_included_files()) ==1) exit("Direct access not permitted.");
|
|
|
|
|
2017-11-09 17:43:34 +01:00
|
|
|
global $CONFIG;
|
2017-11-08 17:39:50 +01:00
|
|
|
$CONFIG = require 'config.php';
|
|
|
|
|
2017-11-09 17:43:34 +01:00
|
|
|
function startsWith($haystack, $needle)
|
2017-11-08 17:39:50 +01:00
|
|
|
{
|
2017-11-09 17:43:34 +01:00
|
|
|
$length = strlen($needle);
|
|
|
|
return (substr($haystack, 0, $length) === $needle);
|
|
|
|
}
|
2017-11-08 17:39:50 +01:00
|
|
|
|
2017-11-09 17:43:34 +01:00
|
|
|
function endsWith($haystack, $needle)
|
|
|
|
{
|
|
|
|
$length = strlen($needle);
|
|
|
|
return $length === 0 || (substr($haystack, -$length) === $needle);
|
|
|
|
}
|
2017-11-08 17:39:50 +01:00
|
|
|
|
2017-11-09 17:43:34 +01:00
|
|
|
function httpError($errorcode, $message)
|
|
|
|
{
|
|
|
|
die($message);//TODO errorcode
|
2017-12-30 23:46:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function destructiveUrlEncode($str) {
|
|
|
|
$str = str_replace(' ', '_', $str);
|
|
|
|
$str = str_replace('+', '_', $str);
|
|
|
|
$str = str_replace('.', '', $str);
|
|
|
|
return urlencode($str);
|
2017-11-08 17:39:50 +01:00
|
|
|
}
|