\n";
echo "\n";
*/
?>
//============================================================
// FUNCTIONS
//============================================================
function GetMonthFolder($strMonth, $strLastNext)
{
//------------------------------------------------------------
// dim vars
//------------------------------------------------------------
if ($strLastNext == "last")
{
$strMonth = $strMonth - 1;
if ($strMonth == 0)
$strMonth = 12;
}
else
{
$strMonth = $strMonth + 1;
if ($strMonth == 13)
$strMonth = 1;
}
//------------------------------------------------------------
// handle year
//------------------------------------------------------------
$strYear = date("Y");
if ($strMonth == 12)
{
$strYear = $strYear - 1;
}
if ($strMonth == 1 and $strLastNext == "next")
{
$strMonth = $strMonth + 1;
$strYear = $strYear + 1;
}
//------------------------------------------------------------
// handle previous month single and double digits
//------------------------------------------------------------
if ($strMonth < 10)
{
$strRetMonth = "0$strMonth-$strYear";
}
else
{
$strRetMonth = "$strMonth-$strYear";
}
//------------------------------------------------------------
// return value
//------------------------------------------------------------
return $strRetMonth;
}
function GetMonth($strMonth, $strLastNext)
{
//------------------------------------------------------------
// dim vars
//------------------------------------------------------------
if ($strLastNext == "last")
{
$strMonth = $strMonth - 1;
if ($strMonth == 0)
{
$strMonth = 12;
}
}
else
{
$strMonth = $strMonth + 1;
if ($strMonth == 13)
{
$strMonth = 1;
}
}
//------------------------------------------------------------
// handle previous month single and double digits
//------------------------------------------------------------
if ($strMonth < 10)
{
$strRetMonth = "0$strMonth";
}
else
{
$strRetMonth = "$strMonth";
}
//------------------------------------------------------------
// return value
//------------------------------------------------------------
return $strRetMonth;
}
function GetRandomPic($folder)
{
//------------------------------------------------------------
// store filenames in array
//------------------------------------------------------------
$dir = opendir($folder);
$i = 1;
while ($file = readdir($dir))
{
if (strstr($file, ".jpg") or strstr($file, ".JPG") or strstr($file, ".gif") or
strstr($file, ".GIF"))
{
$aPics[$i] = "$file";
$i++;
}
}
//------------------------------------------------------------
// cleanup
//------------------------------------------------------------
closedir($dir);
//------------------------------------------------------------
// if folder empty, return ""
//------------------------------------------------------------
if (count($aPics) == 1)
{
$RandomPic = $aPics[1];
}
else
{
//------------------------------------------------------------
// get random file
//------------------------------------------------------------
$rand_keys = array_rand($aPics, 2);
$RandomPic = $aPics[$rand_keys[0]] . "\n";
}
//------------------------------------------------------------
// return value
//------------------------------------------------------------
return $RandomPic;
}
function GetDisplayName($sfoldername)
{
$bRetValue = $sfoldername;
$nLen = strlen($sfoldername);
$nDateDash = strpos($sfoldername, "-");
$nOpenParen = strpos($sfoldername, "(");
$nCloseParen = strpos($sfoldername, ")");
//------------------------------------------------------------
// validate schema "99-99-999 (text here)" to parse
//------------------------------------------------------------
if ($nDateDash == 2 && $nOpenParen == 11)
{
$sDate = substr($sfoldername, 0, 10);
$nEventLen = $nCloseParen - $nOpenParen - 1;
$sEvent = substr($sfoldername, $nOpenParen + 1, $nEventLen);
$bRetValue = "$sDate $sEvent";
}
//echo $nLen;
if ($nLen < 40)
{
$bRetValue = "$bRetValue";
}
return $bRetValue;
}
function GetMonthText($nMonth)
{
switch ($nMonth)
{
case "01":
$bRetVal = "January";
break;
case "02":
$bRetVal = "February";
break;
case "03":
$bRetVal = "March";
break;
case "04":
$bRetVal = "April";
break;
case "05":
$bRetVal = "May";
break;
case "06":
$bRetVal = "June";
break;
case "07":
$bRetVal = "July";
break;
case "08":
$bRetVal = "August";
break;
case "09":
$bRetVal = "September";
break;
case "10":
$bRetVal = "October";
break;
case "11":
$bRetVal = "November";
break;
case "12":
$bRetVal = "December";
break;
}
return $bRetVal;
}
function ShowDropDown($folder, $CurrMonthFolder)
{
$dir = opendir($folder);
include ("../login/gui.php");
//show_tabletop("Select a Month");
//------------------------------------------------------------
// store folders in array for sorting
//------------------------------------------------------------
$i = 1;
while ($MonthFolder = readdir($dir))
{
// if($MonthFolder != "." && $MonthFolder != "..")
if (substr($MonthFolder, 0, 1) != ".")
// this takes care of parent dirs and .htaccess file
{
$sYear = substr($MonthFolder, 3, 4);
$sMonth = substr($MonthFolder, 0, 2);
$aMonthFolder[$i] = "$sYear-$sMonth";
$i++;
}
}
//------------------------------------------------------------
// sort folders array
//------------------------------------------------------------
rsort($aMonthFolder);
reset($aMonthFolder);
$sCurrYear = substr($CurrMonthFolder, 3, 4);
$sCurrMonth = substr($CurrMonthFolder, 0, 2);
$CurrMonthMenuItem = GetMenuItem("$sCurrYear-$sCurrMonth");
echo " | ";
// echo " | Month/Year ";
echo "";
echo "";
echo "";
echo " | ";
//show_tablebottom(false);
//------------------------------------------------------------
// cleanup
//------------------------------------------------------------
closedir($dir);
}
function GetMenuItem($sMonthFolder)
{
$sMonth = substr($sMonthFolder, 5, 2);
$sMonthText = GetMonthText($sMonth);
$sYear = substr($sMonthFolder, 0, 4);
$sRetVal = "$sMonthText $sYear";
return $sRetVal;
}
?>