network_id, $_SESSION['user']['id']) && (!$page_access)) {
//redirect to join the network
$join_url = 'http://'.$network_info->address.'.'.$domain_suffix.BASE_URL_REL.'/network.php?do=join&return='.urlencode($_SERVER['REQUEST_URI']);
header("Location:$join_url");
exit;
}
}
}//____eof__do_redirect
ob_start();
$time = gmdate('D, d M Y H:i:s').'GMT';
header("Last-Modified: $time");
header("Expires: $time");
header("Pragma: no-cache");
return 1;
}
}
function register_session($login_name,$user_id,$role,$first_name,$last_name,$email){
session_start();
$_SESSION['user']['name'] = $login_name;
$_SESSION['user']['id'] = $user_id;
$_SESSION['user']['role'] = $role;
$_SESSION['user']['first_name'] = $first_name;
$_SESSION['user']['last_name'] = $last_name;
$_SESSION['user']['email'] = $email;
}
function has_html(& $s) {
return (preg_match('/<[^>]+>/',$s)) ? true : false;
}
function chop_string($string, $length=30, $link = "") {
global $base_url;
Logger::log("ENTER: chop_string ".__FILE__);
if (has_html(& $string)) {
$san = new InputSanitizer();
$san->passthrough = TRUE; // we want no HTML filtering here
$return = $san->process($string, $length);
} else {
$return = substr($string, 0, $length);
if(strlen($string) > $length) {
$return .= "..";
/*if($length >= DESCRIPTION_LENGTH && !empty($link)) {
$return .= "
read more..";
}*/
}
}
$return = nl2br($return);
return $return;
}
function filter_all_post($post_array, $strip_all_tags = FALSE) {
$post_array = get_input_filter($strip_all_tags)->process($post_array);
//return $post_array;
}
//Function will take the comma separated tags as argument and return the array of these comma seprated tags
function tags_string_to_array($tagstring) {
$tags = array();
if(strlen($tagstring) > 0) {
$tags_array = explode(",",$tagstring);
foreach($tags_array as $value) {
$tags[] = $value;
}
}
return $tags;
}
// Function will take an array as argument and return the delimiter separated string
function tags_array_to_string($tagarray, $delimiter = ',') {
$tagstring = "";
if(count($tagarray) > 0) {
for($counter = 0; $counter < count($tagarray); $counter++) {
$tagstring .= $tagarray[$counter]['name'].$delimiter;
}
$tagstring = substr($tagstring, 0, strlen($tagstring) - 1);
}
return $tagstring;
}
/* This function is used to displat the formatted ouput.Following things will be handled by it
- Will split the String to chunks.
- Will Strip slashes
*/
function display_sanitized($body,$length=CHUNK_LENGTH) {
$body = stripslashes($body);
$body = chunk_split($body, $length);
return $body;
}
//This function checks the mime type of file
//purpose e.g. if we change abc.pdf to abc.gif then it will cause GD crash
//So we can check it actually
if (!function_exists('mime_content_type'))
{
function mime_content_type($f)
{
//$output = system ( trim( 'file -bi ' . escapeshellarg ( $f ) ) ) ;
$output = exec(trim('file -bi ' . escapeshellarg ($f)));
return $output;
}
}
?>