Location: PHPKode > projects > Basic Announce > Basic Announce Version 4.0/public/gallery.php
<?php
################################################################################
##              -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =-                 #
## --------------------------------------------------------------------------- #
##  ApPHP AdminPanel Pro                                                       #
##  Developed by:  ApPHP <hide@address.com>                                      #
##  License:       GNU LGPL v.3                                                #
##  Site:          http://www.apphp.com/php-adminpanel/                        #
##  Copyright:     ApPHP AdminPanel (c) 2006-2011. All rights reserved.        #
##                                                                             #
################################################################################

    header("content-type: text/html; charset=utf-8");

    // Initialize the session.
    session_start();
    
	define("AP_PATH", "../");
    
    require_once(AP_PATH."inc/settings.inc.php");
	require_once(AP_PATH."inc/languages/".$SETTINGS['site_language'].".php");
	
	if(!module_istalled('gallery')) redirect_to(AP_PATH."html/404.html");
    
    $page = isset($_GET['page']) ? (int)$_GET['page'] : "";

	$output = "";
	$albums_per_line = "5";
	$icon_width  = "120px";
	$icon_height = "90px";

	$sql = "SELECT id, album_code, name, description, priority_order, is_active 
			FROM ".TABLE_GALLERY_ALBUMS."
			WHERE is_active = 1
			ORDER BY priority_order ASC";
    $res = $db->Query($sql);
    if($db->RowCount() > 0){
		$output .= "<table class='gallery_table' border='0' cellspacing='7'>";
		$output .= "<tr>";
		$i = "0";
		while($row = $res->fetch()){
			if(($i != 0) && ($i % $albums_per_line == 0)){
				$output .= "</tr><tr>";	
			}
			$output .= "<td valign='top' align='center'>";	
			$sql1 = "SELECT
						album_code,
						image_file,
						IF(image_file_thumb != '', image_file_thumb, image_file) as image_file_thumb, 
						image_text
					FROM ".TABLE_GALLERY_IMAGES."
					WHERE image_file != '' AND album_code = '".$row['album_code']."' AND is_active = 1 
					ORDER BY priority_order ASC";
			$res1 = $db->Query($sql1);
			$res1_count = $db->RowCount();
			$gallery_icon = $gallery_links = "";
			while($row1 = $res1->fetch()){
				if($gallery_icon == "" && $row1['image_file_thumb'] != ""){
					$gallery_icon = "<a href='../images/gallery/".$row1['image_file']."' rel='lyteshow[".$row1['album_code']."]' title='".$row1['image_text']."'><img src='../images/gallery/".$row1['image_file_thumb']."' width='".$icon_width."' height='".$icon_height."' alt='' title='' style='border:1px solid #cccccc; margin-bottom:3px;' /></a>";
				}else{
					$gallery_links .= "<a href='../images/gallery/".$row1['image_file']."' rel='lyteshow[".$row1['album_code']."]' title='".$row1['image_text']."'></a>";
				}
			}
			$output .= $gallery_icon;
			$output .= $gallery_links;
			if($res1_count == 0){
				$output .= "<img src='../images/gallery/no_image.png' width='".$icon_width."' height='".$icon_height."' alt='' title='' style='border:1px solid #cccccc; margin-bottom:3px;' />";
				$output .= "<br /><span title='".$row['description']."'><b>".$row['name']."</b> (".$res1_count.")</span>";
			}else{
				$output .= "<br /><a href='gallery_album.php?acode=".$row['album_code']."'><span title='".$row['description']."'><b>".$row['name']."</b> (".$res1_count.")</span></a>";					
			}
			$output .= "</td>";
			$i++;
		}
		$output .= "</tr>";
		$output .= "</table>";
	}
  
   	$template = get_include_contents("templates/gallery.tpl");
	$template = str_replace("{SITE_NAME}", $SETTINGS['site_name'], $template);
	$template = str_replace("{TITLE}", lang('gallery'), $template);
	$template = str_replace("{STYLE}", "../styles/".$SETTINGS['css_style']."/style.css", $template);
	$template = str_replace("{GALLERY}", $output, $template);

	echo $template;

?>
Return current item: Basic Announce