require ("header.php");
/*
Copyright Notice
Web Site URL: http://www.ezonelink.co.uk
Script Owner eMail: webmaster@ezonelink.co.uk
Date: Oct, 2006
Script Name: eZonelink Photo Stock site Php Script
Copyright Details: This script is not free. Do not Remove this Copy Right notice.
*/
include_once ("class/photos.class.php");
$photos = new Photos();
//List data
$template->set_filenames(array("body" => "photo_view.html"));
if (isset($_REQUEST["photo_sid"]) && $photo_info = mysql_fetch_array($photos->GetBySId($_REQUEST["photo_sid"])))
{
if (isset($_POST["post_comment"]) && $_POST["comment_text"] != "")
{
$photos->InsertComment($_REQUEST["photo_sid"], $_POST["comment_text"], $_SESSION["suserid"], DatetimeFormat(time()));
}
if ($photo_info['photo_designer'] != $_SESSION["suserid"])
$photos->UpdateViewNumber($photo_info["photo_sid"]);
$_SESSION["notyetorder"] = true;
$w = $clsSite_config->sample_size;
$h = (double) $w*($photo_info['photo_height']/$photo_info['photo_width']);
$catfull = $cats->GetCatFullName($photo_info['category'], "sidelinks2");
$comment_list = $photos->GetListComment($photo_info["photo_sid"]);
$photo_tag = "";//$photo_info['photo_des'] != ""?"
":"";
if ($photo_info['photo_tag'] != "") //Phan tich tag
{
$photo_tag .= "Tags: ";
$vtags = split(',',$photo_info['photo_tag']);
$vtagshtml = "";
foreach($vtags as $vtag)
{
$vtagshtml .= $vtagshtml == ""?"":", ";
$vtagshtml .= "".trim($vtag)."";
}
$photo_tag .= $vtagshtml;
}
if ($photo_info["photo_designer"] == $_SESSION["suserid"])
{
$template->assign_block_vars("your_own",array(
));
}else
{
$template->assign_block_vars("not_your_own",array(
));
if ($photo_info["is_free"]>=time())
{
$template->assign_block_vars("free",array(
"IS_FREE" => date("m/d/Y",$photo_info["is_free"])
));
}else
{
$template->assign_block_vars("no_free",array(
));
//Selling the photos
$photo_level = $photos->GetLevel($photo_info["download"],$photo_info["resolution"]);
while ($photo_level_r = mysql_fetch_array($photo_level))
{
$template->assign_block_vars("photo_level",array(
"PHOTO_SID" => $photo_info["photo_sid"],
"LEVEL_ID" => $photo_level_r["level_id"],
"MIN_IMG_DOWN" => $photo_level_r["min_img_down"],
"MAX_IMG_DOWN" => $photo_level_r['max_img_down'],
'LEVEL_NAME' => $photo_level_r['level_name'],
'LICENSE' => $photo_level_r['license'],
'PHOTO_SIZE' => $photo_info['photo_size']/1000,
'PHOTO_FORMAT' => $photo_info['photo_format'],
'RESOLUTION' => $photo_level_r['resolution'],
'PRICE' => $photo_level_r['price']
));
}
}
}
$template->assign_vars(array(
"PHOTO_SID" => $photo_info["photo_sid"],
"PHOTO_TITLE" => $photo_info["photo_title"],
"PHOTO_THUMB" => $photo_info["photo_thumb"],
'USERNAME' => $photo_info['username'],
"PHOTO_DESIGNER" => $photo_info["photo_designer"],
"RESOLUTION" => $photo_info["resolution"],
"PHOTO_FORMAT" => $photo_info["photo_format"],
'PHOTO_SIZE' => $photo_info['photo_size']/1000,
'PHOTO_PWIDTH' => CurrencyFormat1($w),
'PHOTO_PHEIGHT' => CurrencyFormat1($h),
'PHOTO_WIDTH' => $photo_info['photo_width'],
'PHOTO_HEIGHT' => $photo_info['photo_height'],
'PHOTO_DESIGNER' => $photo_info['photo_designer'],
"PHOTO_PRICE" => $photo_level['price'],
"PHOTO_LEVEL" => $photo_level["level_name"],
'PHOTO_POST_DATE' => $photo_info['photo_post_date'],
'CATEGORY' => $photo_info['category'],
'FULLNAME' => $catfull,
"SITENAME" => $clsSite_config->site_title,
'PHOTO_PREVIEW'=> $photo_info['photo_preview'],
'PHOTO_DES'=> $photo_info['photo_des'] != ""?"Description: ".$photo_info['photo_des']:"",
'PHOTO_TAG'=> $photo_info['photo_des'] != ""?"
".$photo_tag:$photo_tag,
'PHOTO_FREE' => $photo_info["is_free"]>=time()?"":"",
'PHOTO_LICENSE' => $photo_info['photo_license'] != ""?$photo_info['photo_license']:"No more license include",
"VIEW" => $photo_info["view"],
"DOWNLOAD" => $photo_info["download"],
"TOTAL_COMMENT" => mysql_num_rows($comment_list)
));
//Comments_list
while ($comment = mysql_fetch_array($comment_list))
{
$template->assign_block_vars("comment_list",array(
"COMMENT_POSTER" => $comment["comment_poster"],
"USERNAME" => $comment['username'],
'COMMENT_POST_DATE' => $comment['comment_post_date'],
'COMMENT_TEXT' => $comment['comment_text']
));
}
//Similiar image
$result = $photos->GetPhotosLimitWhere(0, $clsSite_config->home_size, " WHERE `approved` = 1 and `category` = '".$photo_info['category']."' and `photo_sid` != '".$photo_info['photo_sid']."'", "`photo_id` DESC");
if (mysql_num_rows($result)>0)
{
$template->assign_block_vars("similar",array(
));
$w = $clsSite_config->sample_size;
while ($row = mysql_fetch_array($result))
{
$fullname = $cats->GetCatFullName($row["category"]);
$username = $photos->GetPosterName($row["photo_designer"]);
$photo_level = $photos->GetLevel($row["download"],$row["resolution"]);
$h = (double) $w*($row['photo_height']/$row['photo_width']);
$template->assign_block_vars("indexcol",array(
"PHOTO_SID" => $row["photo_sid"],
"PHOTO_TITLE" => $row["photo_title"],
"PHOTO_THUMB" => $row["photo_thumb"],
"PHOTO_DESIGNER" => $row["photo_designer"],
"RESOLUTION" => $row["resolution"],
'PHOTO_SIZE' => $row['photo_size']/1000000,
'PHOTO_PWIDTH' => CurrencyFormat1($w),
'PHOTO_PHEIGHT' => CurrencyFormat1($h),
'PHOTO_WIDTH' => $row['photo_width'],
'PHOTO_HEIGHT' => $row['photo_height'],
'PHOTO_DESIGNER' => $row['photo_designer'],
"PHOTO_PRICE" => $photo_level['price'],
"PHOTO_LEVEL" => $photo_level["level_name"],
'PHOTO_POST_DATE' => $row['photo_post_date'],
'FULLNAME' => $fullname,
'USERNAME' => $username,
"SITENAME" => $clsSite_config->site_title,
'PHOTO_PREVIEW'=> $row['photo_preview'],
"VIEW" => $row["view"],
"DOWNLOAD" => $row["download"],
"APPROVED" => $row["approved"] == "0"?"Unapproved":"Approved"
));
}
}
$template->pparse("body");
}
include("footer.php");
?>