$extension) { if($k == count($allowed_extensions) - 1){ $pat_ext .= "(" . $extension . ")"; } else{ $pat_ext .= "(" . $extension . ")|"; } } $pattern = "/^.+\.(" . $pat_ext . ")$/i"; // if(preg_match($pattern, $filename, $ext)) { return $ext[0][0]; } else { return false; } } function drawSelect($id, $array, $first, $display, $optdisplay, $value, $selected, $attributes) { echo "\n" . $helper . ""; } function drawCheckboxes($data, $selected, $display_text, $display, $dis_value, $name, $attributes) { $i=0; echo "\n" . $display_text . ""; foreach($data as $field=>$value) { if(is_array($selected)) { if(in_array($value[$dis_value], $selected)) { echo "\n
"; } } else { echo "\n
"; } $i++; } echo "

"; } function drawRadios($id, $data, $selected, $display, $value) { echo "\n"; foreach($data as $field=>$value) { echo "
"; } echo ""; } function drawTextArea($id, $value, $display, $attributes) { echo "\n"; } function drawSubmit($id, $value, $attributes = null) { echo "\n "; } function drawRatings($id, $low_name, $high_name, $scale_start, $scale_end, $name) { echo "\n" .$scale_start . "
". $low_name . ""; for($i=$scale_start+1;$i<$scale_end;$i++) { echo "\n" . $i . ""; } echo "\n" .$scale_end . "
". $high_name . ""; echo "\n"; for($j=$scale_start;$j<=$scale_end;$j++) { echo "\n"; } echo "\n"; } function make_options($array, $display, $value, $selected) { if(count($array) > 0) { foreach($array as $k=> $item) { if($item == $selected) { $output .= "\n"; } else { $output .= "\n"; } } } return $output; } function luhn($str) { $odd = !strlen($str)%2; $sum = 0; for($i=0;$i9?$x-9:$x; } } return(($sum%10)==0); } function get_random_image($image_dir) { if (is_dir($image_dir)) { if ($dh = opendir($image_dir)) { while (($the_file = readdir($dh)) !== false) { if ($the_file != "." && $the_file != "..") { $my_files[] = $the_file; } } } } return $my_files[array_rand($my_files)]; } function is_valid_email($email) { $addr_spec = '([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'. '\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x22([^\\x0d'. '\\x22\\x5c\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x22)'. '(\\x2e([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e'. '\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|'. '\\x22([^\\x0d\\x22\\x5c\\x80-\\xff]|\\x5c\\x00'. '-\\x7f)*\\x22))*\\x40([^\\x00-\\x20\\x22\\x28'. '\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d'. '\\x7f-\\xff]+|\\x5b([^\\x0d\\x5b-\\x5d\\x80-\\xff'. ']|\\x5c[\\x00-\\x7f])*\\x5d)(\\x2e([^\\x00-\\x20'. '\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40'. '\\x5b-\\x5d\\x7f-\\xff]+|\\x5b([^\\x0d\\x5b-'. '\\x5d\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x5d))*'; return preg_match("!^$addr_spec$!", $email); } } ?>