Просмотр файла index.php

Размер файла: 6.37Kb
<?PHP

########################################################
#This script is written by Daynah at http://daynah.net #
#and Dodo at http://regretless.com. Please credit us if#
#you decide to use it! Thanks!                         #
#						       #
#Description: This is the index.php for either your av-#
#atars or emoticons directory for ikonboard. Please re-#
#ad the readme files before you use it!		       #
########################################################

// Include the settings
include('settings.inc');

print "
<html>
<head>
	<title>$ikonboardname";
if ($kind == 1)
{
print "&nbsp;Avatars";
}
else
{
print "&nbsp;Emoticons";
}
print "</title>
	<link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\">
	</style>
	<style type=\"text/css\">
	TR, TD, BODY {font-family:$font; font-size:10pt}
	</style>
</head>

<body bgcolor=$backgroundcolor text=$textcolor link=$linkcolor 
vlink=$vlinkcolor alink=$alinkcolor>";

print "<center><h3>$ikonboardname";
if ($kind == 1)
{
print "&nbsp;Avatars";
}
else
{
print "&nbsp;Emoticons";
}
print "</h3></center>";

// File handle variable to open current directory
$handle = opendir('.');

// Initialize the color change counter
$color_change = 0;

// This while loop is used to sort the array

$index = 0;
$smile;
$last_updated;
while ($file = readdir($handle)) 
{

	
	if($file != '.' && $file != '..')
	{
		$myfile  = explode (".", $file); // test whether is a gif file
		if($myfile[1] == 'gif') // if it's a gif file
		{
		$smile[$index] = $file; // then add it to the array
		$index ++;
		}
	}	
}
sort ($smile); // sort the array with the gif alphebatically
reset ($smile); // reset the array

// Print out the header of the page
print "<center>";
print "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\">\n";
print "<tr>";

// if user wants to show the index number
if($shownums)
{
	print "<th align=\"left\">#:&nbsp;&nbsp;</th>";
}

// if user wants to use this for emoticons and wishes to show images
if($kind == 0)
{
	if ($showsmiles)
	{
	print "<th  align=\"center\">&nbsp;&nbsp;Emoticons:&nbsp;&nbsp;</th>";
	}
	print "<th align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type this:</th>";
}
// if user wants to use this for avtars and wishes to show images
else if ($kind == 1)
{
	if ($showsmiles)
	{
	print "<th  align=\"center\">&nbsp;&nbsp;Avatars:&nbsp;&nbsp;</th>";
	}
	print "<th align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gif File:</th>";
}
	
	if ($showsizes)
	{
	print "<th align=\"left\">Size:</th>";
	}
	if ($showlastupdates)
	{
	print "<th align=\"left\">Last Updated:</th></tr>";
	}

$findex = 0; // set the array index to 0
$updatearry; // the updated array
	// While the array still has elements
	while (list ($key, $val) = each ($smile)) 
	{

		// Color change of the table
		if($color_change%3 == 2)
		{
			$bgcolor = $bgcolor02;
			$mouseovercolor = $mouseovercolor02;
		}	
		else if($color_change%3 == 1)
		{
			$bgcolor = $bgcolor01;
			$mouseovercolor = $mouseovercolor01;
		}
		else
		{
			$bgcolor = $bgcolor03;
			$mouseovercolor = $mouseovercolor03;
		}

		
		// taking the string name from the gif file
		$smilegif = $smile[$findex];
		$mysmile  = explode (".", $smilegif);



		echo "<tr>";

		if($shownums)
		{
			$indexnum = $findex + 1;
			print "<td bgcolor=\"$bgcolor\"

onMouseOver=\"this.style.backgroundColor='$mouseovercolor';\" 
			
onMouseOut=\"this.style.backgroundColor='$bgcolor';\">

			$indexnum</td>";
		}		

		if($showsmiles)
		{
			printf("<td bgcolor=\"$bgcolor\" align=\"center\"
			
onMouseOver=\"this.style.backgroundColor='$mouseovercolor';\" 
			
onMouseOut=\"this.style.backgroundColor='$bgcolor';\"

onClick=\"location.href='%s.gif';\">
			<img src=\"%s.gif\"></td>\n", $mysmile[0], $mysmile[0]);
		}		
		
		if ($kind == 1) // if it's for emoticons, then print out the ":"
		{
		printf("<td bgcolor=\"$bgcolor\" 
			
onMouseOver=\"this.style.backgroundColor='$mouseovercolor';\" 
			
onMouseOut=\"this.style.backgroundColor='$bgcolor';\"

onClick=\"location.href='%s';\">
			&nbsp;&nbsp;&nbsp;&nbsp;
			<a href=\"%s\"><b><font 
color=black>%s</font></b></a><br></td>\n",
			$smile[$findex], $smile[$findex], $mysmile[0]);
		}
		else
		{
		printf("<td bgcolor=\"$bgcolor\" 
			
onMouseOver=\"this.style.backgroundColor='$mouseovercolor';\" 
			
onMouseOut=\"this.style.backgroundColor='$bgcolor';\"

onClick=\"location.href='%s';\">
			&nbsp;&nbsp;&nbsp;&nbsp;
			<a href=\"%s\"><b><font 
color=black>:%s:</font></b></a><br></td>\n",
			$smile[$findex], $smile[$findex], $mysmile[0]);
		}

		

		if ($showsizes)
		{
		// Varible for file size
		$filesize  = filesize($smile[$findex])/1000;	
		$filesizek = number_format($filesize, 2);

		echo "<td bgcolor=\"$bgcolor\"

onMouseOver=\"this.style.backgroundColor='$mouseovercolor';\" 
			
onMouseOut=\"this.style.backgroundColor='$bgcolor';\">

$filesizek KB&nbsp;&nbsp;<br></td>\n";
		}


		// Variables for the time output
		$last_updated1 = filemtime($smile[$findex]);
		$last_updated  = date("m/d/Y h:i:s A",$last_updated1);
		$updatearray [$last_updated] = $smile[$findex];
		
		if ($showlastupdates)
		{
		echo "<td bgcolor=\"$bgcolor\"

onMouseOver=\"this.style.backgroundColor='$mouseovercolor';\" 
			
onMouseOut=\"this.style.backgroundColor='$bgcolor';\">

<font size=1>$last_updated</font>&nbsp;&nbsp;<br></td>\n";
		}


		$color_change++;
		$findex++;
	}
	

print "</table><br><center><b>Back to <a href=\"$ikonboardurl\">$ikonboardname</a></b>";

if ($showuploadlink)
{
print " | <b>Or <a href=\"uploadfile.php\">Upload Another</a></b>";
}

print "<br>\n";

if ($showtotalfiles)
{
print "<br><font size=\"1\">Total Number of Images: <b>$findex</b></font>";
}

if ($showlastupdatedfile)
{
	krsort ($updatearray); // sort the array keys reversely
	reset ($updatearray); // reset the array
	$keyfile = array_values ($updatearray);
	$keytime = array_keys ($updatearray);       
	print "<br><font size=1>Last upated <b>$keyfile[0]</b> at <b>$keytime[0]</b></font>"; 
}

print "<br><a href=\"http://daynah.net/downloads/\"><font size=\"1\">PHP Avatars/Emoticons List Version 1.0</a><br>
	Written by <a href=\"http://daynah.net\">Daynah</a> 
	and <a href=\"http://regretless.com\">Dodo</a></font></center>";

closedir($handle); 

?>

</body>
</html>