Location: PHPKode > projects > chillyCMS > chillyCMS/modules/cssgallery/cssgallery.php
<?php
defined('DOIT') or die('Restricted access');

global $backendstyle,$modinstancename;
$modsettings=explode(",",$modsettings);

$showfolder = $modsettings[0];
if (substr($showfolder,0,2)=="..") { $showfolder=substr($showfolder,2); }
$folderurl = URL.$showfolder;
$foldername = $showfolder;
$showfolder = PATH.$showfolder;
$thumbapp = $modsettings[1];

$fh = opendir($showfolder);
$verzeichnisinhalt = array();
while (true == ($file = readdir($fh))) {
	//Valid file formats
	$formats=array("jpeg",".jpg",".png",".gif");
	if (in_array(substr(strtolower($file),-4), $formats)) {        
		$verzeichnisinhalt[] = $file;
	}
}
//Check if the directory is a groupfolder
$sql = "select u.uid from system_groups as g, system_users as u where g.name='$foldername' and g.moderator=u.uid limit 1";
$this->query($sql);
$uid = $this->db->getdata();
//The moderator's uid
$moduid=$uid["uid"];
$is_mod=false;
if ($moduid == $mysession->user->uid) { $is_mod=true; }

sort($verzeichnisinhalt);

//Print section
echo "<h3>$this->name</h3>".
"<div class='cssgallery'>";
//Generate thumbnails
for($i=0;$i<sizeof($verzeichnisinhalt);$i++) {
	if ($i<sizeof($verzeichnisinhalt)) {
		$printname=explode(".",$verzeichnisinhalt[$i]);
		$fileext=$printname[1];
		$printname=$printname[0];
		//If image is no thumbnail
		if (substr($printname,-strlen($thumbapp))!=$thumbapp) {
			//is there a thumbnail for the file?
			$thumbfile="$showfolder/".$printname.$thumbapp.".".strtolower($fileext);
			$thumburl="$folderurl/".$printname.$thumbapp.".".strtolower($fileext);
			//if yes, show it, if no show file as thumbnail
			if (file_exists($thumbfile)) {
				$thumb=$thumburl;
			} else {
				$thumb="$folderurl/".$verzeichnisinhalt[$i];
			}
			echo "<a class='clickbox' href='#url'>".
				//preview
				"<span class='cssgallery_preview_shadow'><span class='cssgallery_preview_border'>".
				"<img class='cssgallery_preview_pic' src='$thumb' alt='$verzeichnisinhalt[$i]' ".
				"height='115px' width='160px' />".
				"</span></span>".
				//lightbox
				"<b class='lightbox'>".
					"<b class='light'></b>".
					"<b class='box'>".
						"<img src='$folderurl/".$verzeichnisinhalt[$i].
						"' alt='$verzeichnisinhalt[$i]'  height='' width=''/>".
						"<span>$printname<br /><i></i></span>".
					"</b>".
				"</b>".
			"</a>";
		}
	}
}
//close button
echo "<div id='close'></div>";
echo "</div><div class='clear'></div>";
?>
Return current item: chillyCMS