stripEscape($params['form']['data']); } if (isset($_GET)) { if (ini_get('magic_quotes_gpc') == 1) { $params['url'] = array_map('stripslashes', $_GET); } else { $params['url'] = $_GET; } } foreach ($_FILES as $name => $data) { if ($name != 'data') { $params['form'][$name] = $data; } } if (isset($_FILES['data'])) { foreach ($_FILES['data'] as $key => $data) { foreach ($data as $model => $fields) { foreach ($fields as $field => $value) { $params['data'][$model][$field][$key] = $value; } } } } return $params; } function message($msg, $redirect="", $error=true) { if($error) $_SESSION['error_msg'] = $msg; else $_SESSION['msg'] = $msg; if($redirect) header("location: ".$redirect); } function check_url($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_NOBODY, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if(!ini_get("open_basedir")) { curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); //follow up to 10 redirections - avoids loops } $data = curl_exec($ch); curl_close($ch); if(!$data) return false; preg_match_all("/HTTP\/1\.[1|0]\s(\d{3})/",$data,$matches); $code = end($matches[1]); if($code=='404') return false; else return true; } function upload_file($file_id,$file_upload_path,$file_name = null ) { $file_prefix = md5(microtime()); $path_parts = pathinfo(basename($_FILES[$file_id]['name'])); if(empty($file_name)) { $file_name = basename($_FILES[$file_id]['name'],'.'.$path_parts['extension']); } $upload_filename = $file_upload_path.$file_prefix.'_'.$this->clean_up($file_name).'.'.$path_parts['extension']; if( strlen($upload_filename) >= 255) { $str_len = 255 - strlen($file_prefix.'-'.'.'.$path_parts['extension']); $upload_filename = $file_upload_path.$file_prefix.'_'.substr($this->clean_up($file_name),0,$str_len).'.'.$path_parts['extension']; } $path_parts = pathinfo($upload_filename); if(move_uploaded_file($_FILES[$file_id]['tmp_name'], $upload_filename)) { @chmod($upload_filename, 0666); return $path_parts['basename']; } else return false; } function clean_up($text) { $text = html_entity_decode($text); $text = str_replace(' ', '-', $text); $text = str_replace('_', '-', $text); $text = preg_replace('#[^a-zA-Z0-9_\-]+#', '', $text); $text = preg_replace('#[\-]+#', '-', $text); $text = strtolower($text); if( strlen($text) > 255 ) { $text = substr($text,0,254); } return $text; } function escape_html($html_text) { $html_text=nl2br($html_text); $replace = array("\n", "\r", "'", "\""); $html_text = str_replace($replace, "", $html_text); $html_text = str_replace('/', "\/", $html_text); return $html_text; } function sanitize_keywords($keywords_text) { $replace = array("\n", "\r","\t"); $keywords_text = str_replace($replace, "", $keywords_text); $keywords_text_array = explode(",",$keywords_text); if(count($keywords_text_array)>0 && is_array($keywords_text_array)) { foreach($keywords_text_array as $keywords_text_key => $keywords_text_value ) { $keywords_text_value = trim($keywords_text_value); $keywords_text_value = preg_replace('#[^a-zA-Z0-9_\-\s]+#', '', $keywords_text_value); if( $keywords_text_value!='') { $keywords_text_array[$keywords_text_key] = strtolower($keywords_text_value); } else { unset($keywords_text_array[$keywords_text_key]); } } $keywords_text_array = array_unique($keywords_text_array); $keywords_text = implode(",",$keywords_text_array); } else { $keywords_text = trim($keywords_text_value); } return $keywords_text; } function check_back_link($remote_url, $your_link) { $match_pattern = preg_quote(rtrim($your_link, "/"), "/"); $found = false; /* if ($handle = fsockopen ($remote_url, "80")) { while (!feof($handle)) { $part = fread($handle, 1024); */ $part = file_get_contents($remote_url); if (preg_match("/(.*)<\/a>/", $part)) { $found = true; } /* break; } } fclose($handle); } */ return $found; // example: //if (check_back_link("http://www.all4yourwebsite.com", "http://www.finalwebsites.com")) echo "link exists"; } function extract_keywords($keywords_text='no keyword',$keywords_separator=',',$no_of_keywords=15) { $chars = preg_split('/'.$keywords_separator.'/', $keywords_text , -1, PREG_SPLIT_OFFSET_CAPTURE); if(count($chars)>$no_of_keywords) { $keywords_text = substr($keywords_text, 0, $chars[$no_of_keywords][1]-1); } else { if($chars[count($chars)][1] != 0 ) $keywords_text = substr($keywords_text, 0, $chars[count($chars)][1]); } return $keywords_text; } function tagcloud($tagcloud_array=array()) { $tagcloud_temp = array(); foreach($tagcloud_array as $tagcloud_value ) { $array_tagcloud = explode(',',$tagcloud_value); foreach($array_tagcloud as $tagcloud_val ) { if(array_key_exists(strtolower(trim($tagcloud_val)),$tagcloud_temp)) { $tagcloud_temp[strtolower(trim($tagcloud_val))]++; } else { $tagcloud_temp[strtolower(trim($tagcloud_val))] = 1; } } } $i=0; ksort($tagcloud_temp); // change these font sizes if you will $max_size = 110; // max font size in % $min_size = 50; // min font size in % // get the largest and smallest array values $max_qty = max(array_values($tagcloud_temp)); $min_qty = min(array_values($tagcloud_temp)); // find the range of values $spread = $max_qty - $min_qty; if (0 == $spread) { // we don't want to divide by zero $spread = 1; } // determine the font-size increment // this is the increase per tag quantity (times used) $step = ($max_size - $min_size)/($spread); foreach($tagcloud_temp as $tag_key => $tag_value ) { $size = $min_size + (($tag_value - $min_qty) * $step); $size = ceil($size); $tagcloud[$tag_key]['tag_name'] = $tag_key; $tagcloud[$tag_key]['tag_weight'] = $size; $i++; } return $tagcloud; } function isRecprOnline($value, $empty, &$params, &$formvars) { global $v_path; $url = $v_path['Site_Root']; $remote_url = $value; // create a new curl resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $remote_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); // grab URL and pass it to the browser $response = curl_exec($ch); // close curl resource, and free up system resources curl_close($ch); //Look for reciprocal in any link tag preg_match_all ("`<(\s*)a([^>]*)".$url."([^>]*)>(.*)<\/a>`Ui", $response, $matches); //First check if matches array was created if (!is_array ($matches) || empty ($matches)) return 0; //Set internal pointer of array //to its first element reset ($matches); //Check if URL exists if (!is_array ($matches[key ($matches)]) || empty ($matches[key ($matches)])) return 0; //Check for nofollow foreach ($matches as $m => $match) { foreach ($match as $key => $value) { //If anything nofollow is found validation fails if (preg_match ('`rel[\s]*=[\s]*("|\')?[\s]*nofollow[\s]*("|\')`Ui', $value)) { return 0; } unset ($match[$key]); } unset ($matches[$m]); } unset ($matches, $ret); return 1; } function rebulit_url($exclude) { parse_str($_SERVER['QUERY_STRING'],$url_info); $url_tail = ''; foreach($url_info as $urlinfo_keys => $urlinfo_values ) { if(!in_array($urlinfo_keys,$exclude)) { $url_tail .="&".$urlinfo_keys."=".$urlinfo_values; } } return $url_tail; } function escape($data) { if(count($data) && is_array($data) ) { foreach($data as $key_data => $value_data ) { if(get_magic_quotes_gpc()) { $data[$key_data] = stripslashes($value_data); } } } else { if(get_magic_quotes_gpc()) { $data = stripslashes($data); } } return $data; } function get_url($site_url,$request_url) { $url_array = array(); $new_url_array = array(); $site_parse_url = parse_url($site_url); $request_parse_url = parse_url($request_url); $needed_url = str_replace('.html','',str_replace($site_parse_url['path'],'',$request_parse_url['path'])); if( $needed_url == '' || $needed_url == 'index' || $needed_url == 'index.php' ) { return $new_url_array; } else { $url_array = explode('/',$needed_url); $i=0; foreach( $url_array as $url_key => $url_value ) { if( strpos($url_value,'-alphabetic-') && strpos($url_value,'-page-') ) { preg_match_all('/(.*)-alphabetic-([a-zA-Z0-9]+)-page-([0-9]+)/', $url_value , $out_array, PREG_PATTERN_ORDER); $new_url_array[$i]['orig_data'] = $out_array[0][0]; $new_url_array[$i]['data'] = $out_array[1][0]; $new_url_array[$i]['alphabet'] = $out_array[2][0]; $new_url_array[$i]['page'] = $out_array[3][0]; } else if ( strpos($url_value,'-alphabetic-') ) { preg_match_all('/(.*)-alphabetic-([a-zA-Z0-9]+)/', $url_value , $out_array, PREG_PATTERN_ORDER); $new_url_array[$i]['orig_data'] = $out_array[0][0]; $new_url_array[$i]['data'] = $out_array[1][0]; $new_url_array[$i]['alphabet'] = $out_array[2][0]; $new_url_array[$i]['page'] = 1; } else if ( strpos($url_value,'-page-') ) { preg_match_all('/(.*)-page-([0-9]+)/', $url_value , $out_array, PREG_PATTERN_ORDER); $new_url_array[$i]['orig_data'] = $out_array[0][0]; $new_url_array[$i]['data'] = $out_array[1][0]; $new_url_array[$i]['alphabet'] = ''; $new_url_array[$i]['page'] = $out_array[2][0]; } else { $new_url_array[$i]['orig_data'] = $url_value; $new_url_array[$i]['data'] = $url_value; $new_url_array[$i]['alphabet'] = ''; $new_url_array[$i]['page'] = 1; } $i++; } } return $new_url_array; } function stripEscape($param) { if(!is_array($param) || empty($param)) { $return = preg_replace('/^ *-!/', '', $param); return $return; } foreach($param as $key => $value) { if(is_string($value)) { $return[$key] = preg_replace('/^ *-!/', '', $value); } else { foreach ($value as $array => $string) { $return[$key][$array] = preg_replace('/^ *-!/', '', $string); } } } return $return; } function array_search_recursive($needle, $haystack = array() , $a=0, $nodes_temp=array()) { global $nodes_found; $a++; foreach ($haystack as $key1=>$value1) { $nodes_temp[$a] = $key1; if (is_array($value1)){ $this->array_search_recursive($needle, $value1, $a, $nodes_temp); } else if ($value1 === $needle){ $nodes_found[] = $nodes_temp; } } return $nodes_found; } function array_map_r( $func, $arr ) { $newArr = array(); foreach( $arr as $key => $value ) { $newArr[ $key ] = ( is_array( $value ) ? $this->array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) ); } return $newArr; } function stripModelName($modelname,$post_data) { $temp_post = array(); if(is_array($post_data) && count ($post_data)) { foreach($post_data as $postdata_key => $postdata_values ) { $temp_key = preg_replace('/^'.strtolower($modelname).'_/','',$postdata_key,1); $temp_post[$temp_key] = $postdata_values; } } return $temp_post; } function addModelName($modelname,$post_data) { $temp_post = array(); if(is_array($post_data) && count ($post_data)) { foreach($post_data as $postdata_key => $postdata_values ) { $temp_key = strtolower($modelname).'_'.$postdata_key; $temp_post[$temp_key] = $postdata_values; } } return $temp_post; } function ipCheck() { if (getenv('HTTP_CLIENT_IP')) { $ip = getenv('HTTP_CLIENT_IP'); } elseif (getenv('HTTP_X_FORWARDED_FOR')) { $ip = getenv('HTTP_X_FORWARDED_FOR'); } elseif (getenv('HTTP_X_FORWARDED')) { $ip = getenv('HTTP_X_FORWARDED'); } elseif (getenv('HTTP_FORWARDED_FOR')) { $ip = getenv('HTTP_FORWARDED_FOR'); } elseif (getenv('HTTP_FORWARDED')) { $ip = getenv('HTTP_FORWARDED'); } else { $ip = $_SERVER['REMOTE_ADDR']; } return $ip; } function validateCaptcha($value, $empty, &$params, &$formvars) { if( empty($value) || strtolower($_SESSION['CAPTCHAString'])!=strtolower($value)) { unset($_SESSION['CAPTCHAString']); return false; } unset($_SESSION['CAPTCHAString']); return true; } function isAjax() { return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')); } function isValidDate($date, $empty, &$params, &$formvars) { if (!isset($date) || $date=="") { return false; } if(strtotime($date)==0) { return false; } else { $date_array = getdate(strtotime($date)); } if ($date_array['mday']!="" && $date_array['mon']!="" && $date_array['year']!="") { if (is_numeric($date_array['year']) && is_numeric($date_array['mon']) && is_numeric($date_array['mday'])) { return checkdate($date_array['mon'],$date_array['mday'],$date_array['year']); } } return false; } function random_string($type = 'alnum', $len = 8) { switch($type) { case 'alnum' : case 'numeric' : case 'nozero' : switch ($type) { case 'alnum' : $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; break; case 'numeric' : $pool = '0123456789'; break; case 'nozero' : $pool = '123456789'; break; } $str = ''; for ($i=0; $i < $len; $i++) { $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1); } return $str; break; case 'unique' : return md5(uniqid(mt_rand())); break; } } function calculateAge($birthday) { list($year,$month,$day) = explode("-",$birthday); $year_diff = date("Y") - $year; $month_diff = date("m") - $month; $day_diff = date("d") - $day; if ($month_diff < 0) $year_diff--; elseif (($month_diff==0) && ($day_diff < 0)) $year_diff--; return $year_diff; } function encodeData($array=array()) { return base64_encode(serialize($array)); } function decodeData($text=null) { return unserialize(base64_decode($text)); } function notInArray($value, $empty, &$params, &$formvars) { $array_list = $this->decodeData($params['field2']); return !in_array(trim($value),$array_list); } /* function checkPermission($session_login,$defaul_action = array() ) { if(!isset($_SESSION[$session_login])) { if((strpos($_SERVER['SCRIPT_NAME'], $defaul_action[0] )==false)) { header("location: ".$v_path['User_Root']."".$defaul_action[0]."?action=login"); exit(); } else if(strpos($_SERVER['SCRIPT_NAME'], 'user.php')==true && (($_SERVER['REQUEST_METHOD'] == 'POST' ? $_POST['action'] : $_GET['action'])!='login') ) { header("location: ".$v_path['User_Root']."user.php?action=login"); exit(); } } } */ } ?> "Inactive", 1 => 'Active' ); $const_list_yesno = array( 1 => 'Yes' , 0 => 'No' ); $const_list_letters[1] = '0-9'; foreach (range('a', 'z') as $let) { $const_list_letters[$let] = ucwords($let); } $const_menu_types = array( '1' => "CMS Page" , '2' => 'Link' ); $const_user_status = array( '0' => 'Deactivate', '1' => 'Activate', '2' => 'Ban', ); $const_user_types = array( '1' => 'Active Users', '0' => 'Inactive Users', '2' => 'Banned Users', ); ?>
Fatal error: Call-time pass-by-reference has been removed in /var/www/libs/autocrud/crud.inc.php on line 161