| <?php | |
| function randomScreenshot () | |
| { | |
| $screenshotArray = array(); | |
| $documentRoot = $_SERVER['DOCUMENT_ROOT']; | |
| $dir = $documentRoot . "/screenshots/images/thumbnails/"; | |
| $App = new App(); | |
| $outputDir = $App->getWWWPrefix() . "/screenshots/images/thumbnails/"; | |
| if ($dh = opendir($dir)) | |
| { | |
| $i = 1; | |
| while (($file = readdir($dh)) != FALSE) { | |
| if ($file != "." && $file !=".." && $file !="CVS") | |
| { | |
| $screenshotArray[$i++] = $file; | |
| } | |
| } | |
| closedir($dh); | |
| } | |
| $random = rand(1, count($screenshotArray)); | |
| return ($outputDir . $screenshotArray[$random]); | |
| } | |
| function randomGanymedePromo() { | |
| $ganymedeArray = array(); | |
| $documentRoot = $_SERVER['DOCUMENT_ROOT']; | |
| $dir = $documentRoot . "/ganymede/images/posters/thumb/"; | |
| $outputDir = $App->WWW_PREFIX . "/ganymede/images/posters/thumb/"; | |
| if ($dh = opendir($dir)) | |
| { | |
| $i = 1; | |
| while (($file = readdir($dh)) != FALSE) { | |
| if ($file != "." && $file !=".." && $file !="CVS") | |
| { | |
| $ganymedeArray[$i++] = $file; | |
| } | |
| } | |
| closedir($dh); | |
| } | |
| $random = rand(1,2); | |
| if ($random == 1) | |
| return '<a href="/donate/"><img src="/ganymede/images/ganymede.gif"></a>'; | |
| else { | |
| $randomPoster = rand(1, count($ganymedeArray)); | |
| return '<a href="/ganymede/"><img width="160" src="'. $outputDir . $ganymedeArray[$randomPoster].'"/></a>'; | |
| } | |
| } | |
| ?> |