#################################################################################################### # SmartSite Version 1.0 # Copyright 2004 BusinessMedia Ltd. info@businessmedia.ru #################################################################################################### # COPYRIGHT NOTICE # Copyright 2004 BusinessMedia Ltd. - All Rights Reserved. # http://www.businessmedia.ru/ # # Selling the code for this program without prior written consent is # expressly forbidden. # # Obtain written permission before redistributing this software over the Internet or # in any other medium. In all cases copyright and header must remain intact. # #################################################################################################### session_start(); include("./inc/config.php"); include("./inc/funcs.php"); include("./inc/content_funcs.php"); $DB_LINK=mysql_connect($MYSQL_SERVER,$MYSQL_USER,$MYSQL_PASS); mysql_select_db($MYSQL_DB); mysql_query("SET NAMES 'cp1251'",$DB_LINK); mysql_query("SET CHARACTER SET 'cp1251'",$DB_LINK); mysql_query("SET SESSION collation_connection = 'cp1251_general_ci'",$DB_LINK); /*TEMPLATE MAIN CONFIG*/ $TEMPLATES_MAIN_EXTENSION = 'htm';//templates EXTENSION $TEMPLATES_MAIN_TABLE = 'html_templates';//table name $TEMPLATES_MAIN_CODE_FIELD = 'code';//code field name $TEMPLATES_MAIN_TEMPLATE_FIELD = 'html_code';//template field name /* TEMPLATER */ include($_SERVER['DOCUMENT_ROOT']."/inc/class.template.inc.php"); $tpl = new template('mysql'); $tpl->setMysql($TEMPLATES_MAIN_TABLE, $TEMPLATES_MAIN_TEMPLATE_FIELD, $TEMPLATES_MAIN_CODE_FIELD); $id = $_GET['id']==""?$_POST['id']:$_GET['id']; if(!is_numeric($id)){ $id=-1; } $g_row = mysql_fetch_object(mysql_query("select * from galleries where status=1 and id=$id")); if($g_row->id==""){ header("Location: ./index.php"); exit; } $page_row = mysql_fetch_object(mysql_query("select pages.*, html_templates.html_code from pages left outer join html_templates on html_templates.id = pages.template_id where pages.id=$g_row->dep_id")); if($page_row->id==""){ header("Location: ./index.php"); exit; } $page = $_GET['page']==""?$_POST['page']:$_GET['page']; $page = is_numeric($page)?$page:1; $row = mysql_fetch_object(mysql_query("select * from galleries where id=$id")); $items_per_line = $PHOTOS_PER_LINE; $items_per_page = $PHOTOS_PER_PAGE; $row = mysql_fetch_row(mysql_query("select count(*) from photos where g_id=$id")); $total_amount = $row[0]; $num_pages = floor($total_amount/$items_per_page); $start_item = ($page-1)*$items_per_page + 1; $end_item = $page*$items_per_page; if($total_amount==0){ $start_item = 0; $end_item = 0; } if($end_item > $total_amount){ $end_item = $total_amont; } if($total_amount > $num_pages*$items_per_page){ $num_pages++; } $row = mysql_fetch_object(mysql_query("select * from galleries where id=$id")); $script = ' '; $gal_name = stripslashes($row->name); #$content .='
| $img_text ".stripslashes($row->description)." | ";
$tmp .= stripslashes( $tpl->get("GPAGE_ROW") );
$tmp = str_replace("[[SITE_URL]]", $SITE_URL, $tmp);
$tmp = str_replace("[[id]]", $row->id, $tmp);
$tmp = str_replace("[[file]]", $row->file, $tmp);
$tmp = str_replace("[[size0]]", $size[0],$tmp);
$tmp = str_replace("[[size1]]", $size[1], $tmp);
$tmp = str_replace("[[g_id]]",$row->g_id,$tmp);
$tmp = str_replace("[[description]]",stripslashes($row->description),$tmp);
$photo_body .= $tmp;
$tmp = "";
}
$num_items -= $items_per_line;
}
else{
for($i=1;$i<=$num_items;$i++){
if($i>1){
$row=mysql_fetch_object($res);
}
$size = @getimagesize($PHOTO_PATH."/".$row->file);
# $img_text='$img_text ".stripslashes($row->description)." | ";
$tmp .= stripslashes( $tpl->get("GPAGE_ROW") );
$tmp = str_replace("[[SITE_URL]]", $SITE_URL, $tmp);
$tmp = str_replace("[[id]]", $row->id, $tmp);
$tmp = str_replace("[[file]]", $row->file, $tmp);
$tmp = str_replace("[[size0]]", $size[0],$tmp);
$tmp = str_replace("[[size1]]", $size[1], $tmp);
$tmp = str_replace("[[g_id]]",$row->g_id,$tmp);
$tmp = str_replace("[[description]]",stripslashes($row->description),$tmp);
$photo_body .= $tmp;
$tmp = "";
}
for($i=1;$i<=($items_per_line-$num_items);$i++){
$photo_body .= ""; } } $photo_body .= " |