From: Hendrik B. <nh...@us...> - 2010-08-27 22:41:24
|
Update of /cvsroot/arianne/website In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv20541 Modified Files: download.php Log Message: completed constant download script and preconfigured it for jmapachman, marauroa, marboard and stendhal (needs a <product>.version file in the root folder which is currently only the case for stendhal) Index: download.php =================================================================== RCS file: /cvsroot/arianne/website/download.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** download.php 27 Aug 2010 22:20:24 -0000 1.1 --- download.php 27 Aug 2010 22:41:12 -0000 1.2 *************** *** 1,5 **** <?php ! $products = array('stendhal'); $filesShort = array( --- 1,5 ---- <?php ! $products = array('jmapacman', 'marauroa', 'marboard', 'stendhal'); $filesShort = array( *************** *** 14,34 **** 'stendhal-(version).zip', 'stendhal-FULL-(version).zip', 'stendhal-server-(version).zip', 'stendhal-(version)-src.tar.gz', 'stendhal-(version)-changes.txt'); ! function getVersion($file) { ! preg_match('/^([^-.]*)/', $file, $matches, PREG_OFFSET_CAPTURE); ! $product = $matches[0][0]; ! ! if (!in_array($product, array('stendhal'))) { ! return null; ! } $version = file_get_contents(dirname(__FILE__).'/'.$product.'.version'); - return trim($version); } ! echo '<pre>'; ! echo 'File: '.htmlspecialchars($_REQUEST['file']); ! $version = getVersion($_REQUEST['file']); ! echo trim($version); ! echo 'B</pre>'; ?> \ No newline at end of file --- 14,33 ---- 'stendhal-(version).zip', 'stendhal-FULL-(version).zip', 'stendhal-server-(version).zip', 'stendhal-(version)-src.tar.gz', 'stendhal-(version)-changes.txt'); + $file = $_REQUEST['file']; ! preg_match('/^([^-.]*)/', $file, $matches, PREG_OFFSET_CAPTURE); ! $product = $matches[0][0]; + if (in_array($product, array('stendhal'))) { $version = file_get_contents(dirname(__FILE__).'/'.$product.'.version'); } ! if (!isset($version) || $version == '') { ! header('HTTP/1.1 404 Not Found'); ! echo 'The file '.htmlspecialchars($file).' could not be found'; ! } else { ! $rewrittenFilename = str_replace($filesShort, $filesLong, $file); ! $rewrittenFilename = str_replace('(version)', $version, $rewrittenFilename); ! header('Location: https://sourceforge.net/projects/arianne/files/'.$product.'/'.$version.'/'.$rewrittenFilename.'/download'); ! } ?> \ No newline at end of file |