$dfiles = listFiles("."); // first loop to read sub directories of items foreach ($dfiles as $dfil) { $dirname = $seq = $seqdir = $xbase = $base = $xnew = $new = $tfile = $tnew = ''; // eliminate the dot directories if ($dfil == '.' || $dfil == '..') { continue; } print "current file={$dfil} \n"; //check extension $end = substr($dfil, -4); if ($end == '.xml') { // get basename $xbase = basename($dfil, '.xml'); // check for kind of metadata, DC or MODS $meta = getmeta($dfil); // check for matching item directory if (!isDir($xbase)) { print "Error *** item/metadata mismatch ***\n"; print " there is no directory to match {$dfil}\n"; exit; } //make new location $xnew = './' . $xbase . '/' . $meta . '.xml'; if (!file_exists($xnew)) { copy($dfil, $xnew); } print "copying: {$dfil} \n to {$xnew}\n"; } elseif ($end == '.jp2') { $fromtype = 'jp2'; } elseif ($end == '.tif') {
<?php $city = $_GET['city']; function getmeta() { $cities = array_values(array_filter(glob('*'), 'is_dir')); $mail = ""; //servers mail address $meta = array('mail' => $mail, 'cities' => $cities); return $meta; } function send($msg) { $header = "From: ParkenDD\r\nX-Mailer: PHP/" . phpversion(); // mail sender and xmailer $title = "ParkenDD"; // mail title $to = ""; // servers mail address $body = htmlspecialchars($msg, ENT_QUOTES); mail($to, $title, $body, $header); } if (isset($_POST['msg'])) { send($_POST['msg']); exit(0); } if ($city === "Dresden") { echo file_get_contents('http://jkliemann.de/offenesdresden.de/json.php'); } else { echo json_encode(getmeta()); }