File: /var/www/vhosts/creativefellows.nl/test.creativefellows.nl/nec-enterprise.com/includes/main.inc.php
<?php
session_start();
require_once 'config.ini.php';
require_once 'cassette.front.php';
# TURN MAGIC QUOTES OFF
if(get_magic_quotes_gpc()){
function stripslashes_deep($value){
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
# default functions
function e($escape){return mysql_real_escape_string($escape);}
function esc($escape){return mysql_real_escape_string($escape);}
function dp($post){return preg_replace("/-/"," ",$post);}
function vl($url){return preg_replace("/[-]+/","-",preg_replace("/[^0-9a-zA-Z-#\/]/",'-', trim($url)));}
function vl2($url){return urlencode(preg_replace("/ /","-",$url));}
function formatDate($string){return strftime('%d %b %Y',strtotime($string));}
function makeIntro($text,$length=null,$addParagraphtags=null,$sign=null){
$sign = ($sign == null) ? " [..]" : $sign;
$textlen = strlen(strip_tags($text));
if($textlen < $length && $length!=null) $return = strip_tags($text);
else{
$cropAfter = ($length != null) ? $length : 115;
$intro = substr(strip_tags($text), 0, $cropAfter);
$ls = strrpos($intro, " ");
$return = substr($intro, 0, $ls).$sign;
}
$return = ($addParagraphtags == null) ? $return : "<p>".$return."</p>";
return $return;
}
function css($str){
return preg_replace("/ /","",strtolower($str));
}
function testImage($w=400,$h=250){
return '<img src="http://placehold.it/400x250/'.random_color().'/000000/">';
}
function random_color_part() {
return str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
}
function random_color() {
return random_color_part() . random_color_part() . random_color_part();
}
function is_odd($number) {
return $number & 1; // 0 = even, 1 = odd
}
function d($str){
echo "<pre>";
print_r($str);
echo "</pre>";
}
function outputSafe($string){
return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
}
?>