".$db_query; $result = mysql_query($db_query, $db_link); return $result; } function tep_db_fetch_array($db_query) { $result = mysql_fetch_array($db_query); return $result; } function tep_db_num_rows($db_query) { $result = mysql_num_rows($db_query); return $result; } function tep_db_num_field($db_query) { $result = mysql_num_fields($db_query); return $result; } function tep_db_field_name($db_query,$i) { $result = mysql_field_name($db_query, $i); return $result; } function tep_db_field_flags($db_query,$i) { $result = mysql_field_flags($db_query, $i); return $result; } function tep_db_field_len($db_query,$i) { $result = mysql_field_len($db_query, $i); return $result; } function tep_db_field_type($db_query,$i) { $result = mysql_field_type($db_query, $i); return $result; } function tep_db_data_seek($db_query, $row_number) { $result = mysql_data_seek($db_query, $row_number); return $result; } function tep_db_insert_id() { $result = mysql_insert_id(); return $result; } function tep_db_free_result($db_query) { $result = mysql_free_result($db_query); return $result; } function trunc($phrase, $max_words) { $phrase_array = explode(' ',$phrase); if(count($phrase_array) > $max_words && $max_words > 0) $phrase = implode(' ',array_slice($phrase_array, 0, $max_words)).'...'; return $phrase; } function vclean($content) { return $content; } function vcleans($content) { return $content; } function safedata($content) { $content=@trim($content); $content = stripslashes(trim($content)); $content = nl2br($content); $content = htmlentities($content); if(get_magic_quotes_gpc()){$content = stripslashes($content);} $content=mysql_real_escape_string($content); $search = array( '@]*?>.*?@si', // Strip out javascript '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags '@]*?>.*?@siU', // Strip style tags properly '@@', // Strip multi-line comments '/[^0-9\.]/' // Strip multi-line comments ); $content = preg_replace($search, '', $content); $content=filter_var($content, FILTER_VALIDATE_INT); return $content; } function safedatastr($content) { $content=@trim($content); $content = stripslashes(trim($content)); $content = nl2br($content); $content = htmlentities($content); if(get_magic_quotes_gpc()){$content = stripslashes($content);} $content=mysql_real_escape_string($content); $search = array( '@]*?>.*?@si', // Strip out javascript '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags '@]*?>.*?@siU', // Strip style tags properly '@@' // Strip multi-line comments ); $content = preg_replace($search, '', $content); //$content=filter_var($content, FILTER_VALIDATE_INT); return $content; } function convert_to_uk($redate) { $dday = substr($redate,8,2); $mmonth = substr($redate,5,2); $yyear = substr($redate,0,4); $redate="$dday.$mmonth.$yyear"; return $redate; } function convert_to_us($redate) { $dday = substr($redate,0,2); $mmonth = substr($redate,3,2); $yyear = substr($redate,6,4); $min_sec = substr($redate,11,5); $redate="$yyear-$mmonth-$dday $min_sec"; return $redate; } function generateuid ($length = 8) { // start with a blank password $password = ""; // define possible characters - any character in this string can be // picked for use in the password, so if you want to put vowels back in // or add special characters such as exclamation marks, this is where // you should do it $possible = "12346789"; // we refer to the length of $possible a few times, so let's grab it now $maxlength = strlen($possible); // check for length overflow and truncate if necessary if ($length > $maxlength) { $length = $maxlength; } // set up a counter for how many characters are in the password so far $i = 0; // add random characters to $password until $length is reached while ($i < $length) { // pick a random character from the possible ones $char = substr($possible, mt_rand(0, $maxlength-1), 1); // have we already used this character in $password? if (!strstr($password, $char)) { // no, so it's OK to add it onto the end of whatever we've already got... $password .= $char; // ... and increase the counter by one $i++; } } // done! return $password; } function niceFileSize($file) { //store the actual size of the file $size = filesize($file); if($size >= 1073741824) { $size = round($size / 1073741824) . " GB "; } elseif($size >= 1048756) { $size = round($size / 1048576) . " MB"; } elseif($size >= 1024) { $size = round($size / 1024) . " KB"; } else { $size = $size . " B"; } return $size; } //End of file size function function findexts ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } ?>