235 lines
7.7 KiB
PHP
235 lines
7.7 KiB
PHP
<?php
|
|
|
|
/* $Id: album.php 42 2009-01-29 04:55:14Z john $ */
|
|
|
|
$page = "general";
|
|
include "header.php";
|
|
|
|
// DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION
|
|
if( !$user->user_exists && !$setting['setting_permission_album'] )
|
|
{
|
|
$page = "error";
|
|
$smarty->assign('error_header', 639);
|
|
$smarty->assign('error_message', 656);
|
|
$smarty->assign('error_submit', 641);
|
|
include "footer.php";
|
|
}
|
|
|
|
// DISPLAY ERROR PAGE IF NO OWNER
|
|
if( !$owner->user_exists)
|
|
{
|
|
$page = "error";
|
|
$smarty->assign('error_header', 639);
|
|
$smarty->assign('error_message', 828);
|
|
$smarty->assign('error_submit', 641);
|
|
include "footer.php";
|
|
}
|
|
|
|
// ENSURE ALBUMS ARE ENABLED FOR THIS USER
|
|
if( !$owner->level_info['level_album_allow'] )
|
|
{
|
|
header("Location: ".$url->url_create('profile', $owner->user_info['user_username']));
|
|
exit();
|
|
}
|
|
|
|
|
|
// PARSE GET/POST
|
|
if(isset($_POST['p'])) { $p = $_POST['p']; } elseif(isset($_GET['p'])) { $p = $_GET['p']; } else { $p = 1; }
|
|
if(isset($_GET['album_id'])) { $album_id = $_GET['album_id']; } else { $album_id = 0; }
|
|
|
|
|
|
// SET VARS
|
|
$media_per_page = 20;
|
|
|
|
// GET ALBUM INFO
|
|
$album_query = $database->database_query("SELECT * FROM se_albums WHERE album_id='{$album_id}' AND album_user_id='{$owner->user_info['user_id']}'");
|
|
if($database->database_num_rows($album_query) != 1) {
|
|
header("Location: /albums.php?user=".$owner->user_info['user_username']);
|
|
exit;
|
|
}
|
|
$album_info = $database->database_fetch_assoc($album_query);
|
|
|
|
// CREATE ALBUM OBJECT
|
|
$album = new se_album($owner->user_info['user_id']);
|
|
|
|
// SET WHERE/SORTBY
|
|
$where = "(media_album_id='{$album_info['album_id']}')";
|
|
$sortby = "media_order ASC";
|
|
$select = "";
|
|
|
|
// GET CUSTOM ALBUM STYLE IF ALLOWED
|
|
if($owner->level_info['level_album_style'] != 0) {
|
|
$albumstyle_info = $database->database_fetch_assoc($database->database_query("SELECT albumstyle_css FROM se_albumstyles WHERE albumstyle_user_id='{$owner->user_info['user_id']}' LIMIT 1"));
|
|
$global_css = $albumstyle_info['albumstyle_css'];
|
|
}
|
|
|
|
// CHECK PRIVACY
|
|
$privacy_max = $owner->user_privacy_max($user);
|
|
if(!($album_info['album_privacy'] & $privacy_max)) {
|
|
$page = "error";
|
|
$smarty->assign('error_header', 690699016);
|
|
$smarty->assign('error_message', 690699017);
|
|
$smarty->assign('error_submit', 641);
|
|
include "footer.php";
|
|
}
|
|
|
|
// UPDATE ALBUM VIEWS
|
|
if( $user->user_info[user_id] != $owner->user_info['user_id'] )
|
|
{
|
|
$album_views_new = $album_info[album_views] + 1;
|
|
$database->database_query("UPDATE se_albums SET album_views='{$album_views_new}' WHERE album_id='{$album_info['album_id']}' LIMIT 1");
|
|
}
|
|
|
|
|
|
// GET TOTAL FILES IN ALBUM
|
|
$total_files = $album->album_files($album_info['album_id'], $where);
|
|
|
|
// MAKE MEDIA PAGES
|
|
$page_vars = make_page($total_files, $media_per_page, $p);
|
|
|
|
// GET MEDIA ARRAY
|
|
$file_array = $album->album_media_list($page_vars[0], 5000000, $sortby, $where, $select);
|
|
|
|
function general()
|
|
{
|
|
global $database, $file_array, $owner, $album_id;
|
|
|
|
?>
|
|
<a href="album.php?user=<?php echo $owner->user_info["user_username"];?>&album_id=<?php echo $album_id;?>">Back to album</a>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js"></script>
|
|
<script>
|
|
loadCSS('include/flexslider/flexslider.css?s=19');
|
|
</script>
|
|
|
|
<div class="flexslider" id="flexslider">
|
|
|
|
<div class="flex-viewport" style="overflow: hidden; position: relative;"><ul class="slides" style="width: 2000%; transition-duration: 0s; transform: translate3d(-400px, 0px, 0px);">
|
|
<?php
|
|
foreach($file_array as $file)
|
|
{
|
|
?>
|
|
|
|
<li class="clone" aria-hidden="true" style="width: 200px; margin-right: 0px; float: left; display: block;">
|
|
<img data-src="<?php echo get_userdir($owner->user_info["user_id"]).$file["media_id"].".".$file["media_ext"];?>" class="lazy" draggable="false">
|
|
</li>
|
|
<!--<li data-bg="<?php echo get_userdir($owner->user_info["user_id"]).$file["media_id"].".".$file["media_ext"];?>"></li>-->
|
|
<?php
|
|
}?>
|
|
|
|
|
|
|
|
</ul></div></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/flexslider/2.7.2/jquery.flexslider-min.js"></script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
jQuery(function(){
|
|
SyntaxHighlighter.all();
|
|
});
|
|
jQuery(window).load(function(){
|
|
jQuery('.flexslider').flexslider({
|
|
animation: "slide",
|
|
slideshowSpeed: 3000,
|
|
slideshow: true,
|
|
controlNav: false,
|
|
|
|
animationLoop: false,
|
|
directionNav: true,
|
|
keyboard: false,
|
|
|
|
pauseOnAction: false, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
|
|
pauseOnHover: true,
|
|
|
|
|
|
|
|
|
|
|
|
start: function (slider) {
|
|
// lazy load
|
|
jQuery(slider).find("img.lazy").slice(0,5).each(function () {
|
|
var src = jQuery(this).attr("data-src");
|
|
jQuery(this).attr("src", src).removeAttr("data-src").removeClass("lazy");
|
|
});
|
|
},
|
|
before: function (slider) {
|
|
// lazy load
|
|
var slide = jQuery(slider).find('.slides').children().eq(slider.animatingTo+1).find('img');
|
|
var src = slide.attr("data-src");
|
|
slide.attr("src", src).removeAttr("data-src").removeClass("lazy");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/SyntaxHighlighter/3.0.83/scripts/shCore.min.js"></script>
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/SyntaxHighlighter/3.0.83/scripts/shBrushXml.min.js"></script>
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/SyntaxHighlighter/3.0.83/scripts/shBrushJScript.min.js"></script>
|
|
|
|
<!-- Optional FlexSlider Additions -->
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js"></script>
|
|
|
|
<?php
|
|
}
|
|
|
|
$y=0;
|
|
for($x=$page_vars[1]; $x<=$page_vars[2]; $x++)
|
|
{
|
|
|
|
if(($page_vars[1]+10)==$x)
|
|
{break;}
|
|
$for[$y]=$x;
|
|
$y++;
|
|
}
|
|
|
|
if(isset($_POST['favorites'])) { $fave = $_POST['favorites']; } elseif(isset($_GET['favorites'])) { $fave = $_GET['favorites']; } else { $fave = 0; }
|
|
|
|
if($fave==="delete"){
|
|
|
|
$database->database_query("DELETE FROM favorites WHERE user='".$user->user_info["user_id"]."' AND type='album' AND owner='".$owner->user_info["user_id"]."' AND objectid='".$album_info['album_id']."'");
|
|
|
|
}
|
|
|
|
|
|
if($fave==="addto"){
|
|
$query=$database->database_query("SELECT * FROM favorites WHERE user='".$user->user_info["user_id"]."' AND type='album' AND owner='".$owner->user_info["user_id"]."' AND objectid='".$album_info['album_id']."'");
|
|
|
|
if($database->database_num_rows($query)==0){
|
|
$database->database_query("INSERT INTO favorites SET user='".$user->user_info["user_id"]."', type='album', owner='".$owner->user_info["user_id"]."', objectid='".$album_info['album_id']."'");
|
|
}
|
|
}
|
|
|
|
$query=$database->database_query("SELECT * FROM favorites WHERE user='".$user->user_info["user_id"]."' AND type='album' AND owner='".$owner->user_info["user_id"]."' AND objectid='".$album_info['album_id']."'");
|
|
if($database->database_num_rows($query)>0){$smarty->assign('favorites1', 1);}
|
|
|
|
$smarty->assign('favorites', 1);
|
|
$smarty->assign('for', $for);
|
|
// SET GLOBAL PAGE TITLE
|
|
$global_page_title[0] = 1000155;
|
|
$global_page_title[1] = $owner->user_displayname;
|
|
$global_page_title[2] = $album_info['album_title'];
|
|
$global_page_description[0] = 1000156;
|
|
$global_page_description[1] = $album_info['album_desc'];
|
|
|
|
// ASSIGN VARIABLES AND DISPLAY ALBUM PAGE
|
|
$smarty->assign('album_info', $album_info);
|
|
$smarty->assign('files', $file_array);
|
|
$smarty->assign('total_files', $total_files);
|
|
$smarty->assign('p', $page_vars[1]);
|
|
$smarty->assign('maxpage', $page_vars[2]);
|
|
$smarty->assign('p_start', $page_vars[0]+1);
|
|
$smarty->assign('p_end', $page_vars[0]+count($file_array));
|
|
include "footer.php";
|
|
?>
|