blob: fbef395d834d81a1c31c1e6b6db909f6f74ec2ad [file] [log] [blame]
<?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>';
}
}
?>