\n";
if ($data['photo_description']) echo nl2br(parseubb($data['photo_description']))."
\n";
echo $locale['433'].showdate("shortdate", $data['photo_datestamp'])."
\n";
echo $locale['434']."
".$data['user_name']."\n";
echo $locale['454']."$photo_size[0] x $photo_size[1] ".$locale['455']."
\n";
echo $locale['456'].parsebytesize(filesize($photo_file))."
\n";
echo $locale['436'].dbcount("(comment_id)", "comments", "comment_type='P' AND comment_item_id='".$data['photo_id']."'")."
\n";
echo $locale['437'].($data['count_votes'] > 0 ? str_repeat("

", ceil($data['sum_rating'] / $data['count_votes'])) : $locale['438'])."
\n";
echo $locale['457'].$data['photo_views']."
[color=#cc0033]
Pozycja ".number_format($data2['nr'])."";[/color]
closetable();
if ($data['photo_allow_comments'] == "1") showcomments("P","photos","photo_id",$photo_id,FUSION_SELF."?photo_id=$photo_id");
if ($data['photo_allow_ratings']) showratings("P",$photo_id,FUSION_SELF."?photo_id=$photo_id");
}
} elseif (isset($album_id)) {
define("PHOTODIR", PHOTOS.(!SAFEMODE ? "album_".$album_id."/" : ""));
$result = dbquery(
"SELECT ta.* FROM ".$db_prefix."photo_albums ta WHERE album_id='$album_id'"
);
if (!dbrows($result)) {
fallback(FUSION_SELF);
} else {
$data = dbarray($result);
if (!checkgroup($data['album_access'])) {
fallback(FUSION_SELF);
} else {
$rows = dbcount("(photo_id)", "photos", "album_id='$album_id'");
opentable($locale['420']);
tablebreak();
echo "
\n\n";
echo " | \n";
echo "".$locale['421'].$data['album_title']." \n";
echo "".nl2br(parseubb($data['album_description']))." \n | \n
\n";
echo "\n\n\n";
if ($rows) {
$pdata = dbarray(dbquery("SELECT tp.*, tu.user_id,user_name FROM ".$db_prefix."photos tp LEFT JOIN ".$db_prefix."users tu ON tp.photo_user=tu.user_id WHERE album_id='$album_id' ORDER BY photo_datestamp DESC LIMIT 1"));
echo $locale['422']."$rows \n";
echo $locale['423']." ".$pdata['user_name']."".$locale['424'].showdate("longdate", $pdata['photo_datestamp'])."\n";
} else {
echo $locale['425']."\n";
}
echo " \n | \n
\n
";
tablebreak();
closetable();
if ($rows) {
tablebreak();
opentable($locale['430']);
$result = dbquery(
"SELECT tp.*, tu.user_id,user_name, SUM(tr.rating_vote) AS sum_rating, COUNT(tr.rating_item_id) AS count_votes
FROM ".$db_prefix."photos tp
LEFT JOIN ".$db_prefix."users tu ON tp.photo_user=tu.user_id
LEFT JOIN ".$db_prefix."ratings tr ON tr.rating_item_id = tp.photo_id AND tr.rating_type='P'
WHERE album_id=$album_id GROUP BY photo_id ORDER BY photo_order LIMIT $rowstart,".$settings['thumbs_per_page']
);
$counter = 0;
echo "
\n";
tablebreak();
echo "
\n\n";
while ($data = dbarray($result)) {
if ($counter != 0 && ($counter % $settings['thumbs_per_row'] == 0)) echo "
\n\n";
echo "\n";
echo "".$data['photo_title']."
\n";
if ($data['photo_thumb1'] && file_exists(PHOTODIR.$data['photo_thumb1'])){
echo " ";
} else {
echo $locale['432'];
}
echo "
\n\n";
echo $locale['433'].showdate("shortdate", $data['photo_datestamp'])." \n";
echo $locale['434']."".$data['user_name']." \n";
echo $locale['436'].dbcount("(comment_id)", "comments", "comment_type='P' AND comment_item_id='".$data['photo_id']."'")." \n";
echo $locale['437'].($data['count_votes'] > 0 ? str_repeat(" ", ceil($data['sum_rating'] / $data['count_votes'])) : $locale['438'])." \n";
echo $locale['435'].$data['photo_views']."[color=#cc0033] Pozycja";
$fotka_id = $data['photo_id'];
$id = dbquery("set @id='$fotka_id', @nr = 0, @idnr = 0");
$id1 = dbquery("select @idnr AS nr FROM
(SELECT @nr:=@nr+1, if(photo_id=@id, @idnr := @nr, @idnr=@idnr),
tp.*, (SELECT COUNT(rating_id) FROM ".$db_prefix."ratings c
WHERE c.rating_type='P' AND (c.rating_item_id = tp.photo_id)) AS ile,
(SELECT ROUND(AVG(rating_vote), 2) FROM ".$db_prefix."ratings c
WHERE c.rating_type='P' AND (c.rating_item_id = tp.photo_id)) AS srednia
FROM ".$db_prefix."photos tp ORDER BY srednia DESC, ile DESC) podsel WHERE podsel.photo_id = @id");
$data = dbarray($id1);
echo " ".number_format($data['nr'])."[/color] \n";
echo " | \n";
$counter++;
}
echo "
\n
\n";
closetable();
}
if ($rows > $settings['thumbs_per_page']) echo "
\n".makePageNav($rowstart,$settings['thumbs_per_page'],$rows,3,FUSION_SELF."?album_id=$album_id&")."\n
\n";
}
}
} else {
opentable($locale['400']);
$rows = dbcount("(album_id)", "photo_albums", groupaccess('album_access'));
if ($rows) {
$result = dbquery(
"SELECT ta.*, tu.user_id,user_name FROM ".$db_prefix."photo_albums ta
LEFT JOIN ".$db_prefix."users tu ON ta.album_user=tu.user_id
WHERE ".groupaccess('album_access')." ORDER BY album_order
LIMIT $rowstart,".$settings['thumbs_per_page']
);
$counter = 0; $r = 0; $k = 1;
echo "
\n";
closetable();
if ($rows > $settings['thumbs_per_page']) echo "
\n".makePageNav($rowstart,$settings['thumbs_per_page'],$rows,3)."\n
\n";
}else{
echo "
".$locale['406']."
\n";
closetable();
}
}
require "side_right.php";
require "footer.php";
?>