Files
Testing/videoalbum.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

154 lines
4.8 KiB
PHP

<?php
/* $Id: album.php 42 2009-01-29 04:55:14Z john $ */
$page = "videoalbum";
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 = 12;
// GET ALBUM INFO
$album_query = $database->database_query("SELECT * FROM se_videoalbums WHERE album_id='{$album_id}' AND album_user_id='{$owner->user_info['user_id']}'");
if($database->database_num_rows($album_query) != 1&&$album_id>0) {
header("Location: /videoalbums.php?user=".$owner->user_info['user_username']);
exit;
}
$album_info = $database->database_fetch_assoc($album_query);
// CREATE ALBUM OBJECT
$album = new se_video($owner->user_info['user_id']);
// SET WHERE/SORTBY
$where = "(video_album='{$album_info['album_id']}')";
//$sortby = "media_order ASC";
$sortby = "video_id DESC";
$select = "";
// GET CUSTOM ALBUM STYLE IF ALLOWED
// CHECK PRIVACY
$privacy_max = $owner->user_privacy_max($user);
/*if(!($album_info['album_privacy'] & $privacy_max)&&$album_info['album_privacy']!=35) {
$page = "error";
$smarty->assign('error_header', 690699016);
$smarty->assign('error_message', 690699017);
$smarty->assign('error_submit', 641);
include "footer.php";
}*/
if($user->user_info["user_id"]!=$owner->user_info["user_id"]){
}
//if only showing certain albums here
// 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_videoalbums SET album_views='{$album_views_new}' WHERE album_id='{$album_info['album_id']}' LIMIT 1");
}
$video_privacy_max = $owner->user_privacy_max($user);
$where = "video_is_converted=1 AND (video_privacy & $video_privacy_max)";
// 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->video_list($page_vars[0], $media_per_page, $sortby, $where, 1, $album_id);
$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', 0);
$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('album_id', $album_id);
$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";
?>