$allowed_extensions = array ("gif", "jpg", "png", "jpe", "jpeg" );
$allowed_video = array ("avi", "mp4", "wmv", "mpg", "flv", "mp3", "swf", "m4v", "m4a", "mov", "3gp", "f4v" );
$allow_conf = str_replace("php",md5(time() - rand(30,60)),strtolower( $config['files_type'] ));
$allow_conf = str_replace("phtml",md5(time() - rand(30,60)), $allow_conf);
$allowed_files = explode( ',', $allow_conf );
$img_result_th = "";
$img_result = "";
Или даже проще
$allow_conf = str_replace(array("php","phtml"), md5(time() - rand(30,60)), strtolower( $config['files_type'] ));