Tuesday, November 4, 2008

[coldfusion-howto] convert code from PHP to CFM

Anybody here know PHP? Can you convert the following code to CFM? At
least give me some ideas on what the PHP code trying to do?

Thanks

<?php
$allowed_formats = array("jpg", "jpeg", "JPG", "JPEG", "png", "PNG");
$exclude_files = array(
"_derived",
"_private",
"_vti_cnf",
"_vti_pvt",
"vti_script",
"_vti_txt"
); // add any other folders or files you wish to exclude from the gallery.

$path = array();

if(isset($_GET['file_dir'])){
$file_dir = $_GET['file_dir'];
$dir=opendir($file_dir);
while ($file=readdir($dir))
{
$ext = substr($file, strpos($file, ".")+1);

if(array_search($file, $exclude_files)===false &&
array_search($ext, $allowed_formats)!==false){

$f=$file_dir.'/'.$file;

$path []=$f;

}
}

closedir($dir);
}
natcasesort($path);

print '<?xml version="1.0" encoding="iso-8859-1"?>';
print '<pics';
print '>';

$directory= $_SERVER['HTTP_HOST'] .$_SERVER['PHP_SELF'];
$directory=dirname($directory);

foreach ($path as $val) print '<pic
src="'.'http://'.$directory.'/'.$val.'" title="'.$val.'" />';;
print "</pics>";
?>


------------------------------------

~~~~~~~~~
*** Yahoo's No. 1 and the biggest group of ColdFusion Developers

ColdFusion MX Hosting - 250 MB Space/5 GB monthly Bandwidth for just $19.99/year. Free Setup, ASP.NET, HELM Control Panel. http://www.hostingatoz.com. We also offer ColdFusion Reseller Hosting Plans.

Post message: coldfusion-howto@yahoogroups.com
Subscribe: coldfusion-howto-subscribe@yahoogroups.com
Un-Subscribe: coldfusion-howto-unsubscribe@yahoogroups.com


...
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/coldfusion-howto/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/coldfusion-howto/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:coldfusion-howto-digest@yahoogroups.com
mailto:coldfusion-howto-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
coldfusion-howto-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/