2013-10-07 12:17:06 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Manage Playlist Page
|
|
|
|
* @author : Arslan hassan
|
|
|
|
* @Software: ClipBucket
|
|
|
|
* @License : Attribution Assurance License -- http://www.opensource.org/licenses/attribution.php
|
|
|
|
*/
|
|
|
|
|
|
|
|
define("THIS_PAGE",'manage_playlists');
|
|
|
|
define("PARENT_PAGE",'videos');
|
|
|
|
|
|
|
|
require 'includes/config.inc.php';
|
|
|
|
$userquery->logincheck();
|
|
|
|
$udetails = $userquery->get_user_details(userid());
|
|
|
|
assign('user',$udetails);
|
|
|
|
assign('p',$userquery->get_user_profile($udetails['userid']));
|
|
|
|
|
|
|
|
|
|
|
|
$mode = $_GET['mode'];
|
|
|
|
|
|
|
|
$page = mysql_clean($_GET['page']);
|
|
|
|
$get_limit = create_query_limit($page,VLISTPP);
|
|
|
|
|
|
|
|
|
|
|
|
switch($mode)
|
|
|
|
{
|
|
|
|
case 'manage_playlist':
|
|
|
|
case 'manage_video_playlist':
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
|
|
|
|
//Deleting Playlist
|
2014-02-20 10:30:44 +00:00
|
|
|
|
2013-10-07 12:17:06 +00:00
|
|
|
if(!empty($_GET['delete_pl']))
|
|
|
|
{
|
|
|
|
$plid = mysql_clean($_GET['delete_pl']);
|
|
|
|
$cbvid->action->delete_playlist($plid);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_POST['delete_playlists']))
|
|
|
|
{
|
|
|
|
$playlists = post('check_playlist');
|
|
|
|
|
|
|
|
if(count($playlists)>0)
|
|
|
|
{
|
|
|
|
foreach($playlists as $playlist)
|
|
|
|
{
|
|
|
|
$playlist = mysql_clean($playlist);
|
|
|
|
$cbvid->action->delete_playlist($playlist);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!error())
|
|
|
|
{
|
|
|
|
$eh->flush();
|
|
|
|
e(lang("playlists_have_been_removed"),"m");
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
$eh->flush();
|
|
|
|
e(lang("playlist_not_exist"));
|
|
|
|
}
|
|
|
|
}else
|
|
|
|
e(lang("no_playlist_was_selected_to_delete"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Adding New Playlist
|
|
|
|
if(isset($_POST['add_playlist']))
|
|
|
|
{
|
2013-11-19 12:01:56 +00:00
|
|
|
$cbvid->action->create_playlist();
|
2013-10-07 12:17:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
assign('mode','manage_playlist');
|
|
|
|
//Getting List of available playlists
|
2013-11-26 12:06:14 +00:00
|
|
|
$playlists = $cbvid->action->get_playlists( array( 'order' => 'playlists.date_added DESC' ) );
|
2013-10-07 12:17:06 +00:00
|
|
|
assign('playlists',$playlists);
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'edit_playlist':
|
|
|
|
{
|
|
|
|
|
|
|
|
if(isset($_POST['delete_playlist_item']))
|
|
|
|
{
|
|
|
|
$items = post('check_playlist_items');
|
|
|
|
|
|
|
|
if(count($items)>0)
|
|
|
|
{
|
|
|
|
foreach($items as $item)
|
|
|
|
{
|
|
|
|
$item = mysql_clean($item);
|
|
|
|
$cbvid->action->delete_playlist_item($item);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!error())
|
|
|
|
{
|
|
|
|
$eh->flush();
|
|
|
|
e(lang("playlist_items_have_been_removed"),"m");
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
$eh->flush();
|
2013-11-19 12:01:56 +00:00
|
|
|
e(lang("playlist_item_doesnt_exist"));
|
2013-10-07 12:17:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}else
|
|
|
|
e(lang("no_item_was_selected_to_delete"));
|
|
|
|
}
|
|
|
|
|
|
|
|
assign('mode','edit_playlist');
|
|
|
|
$pid = $_GET['pid'];
|
|
|
|
|
|
|
|
if(isset($_POST['edit_playlist']))
|
|
|
|
{
|
2013-11-17 09:20:17 +00:00
|
|
|
#$params = array('name'=>mysql_clean($_POST['name']),'pid'=>mysql_clean($pid));
|
|
|
|
$_POST[ 'list_id' ] = $pid;
|
|
|
|
$cbvid->action->edit_playlist();
|
2013-10-07 12:17:06 +00:00
|
|
|
}
|
2013-11-19 12:01:56 +00:00
|
|
|
|
|
|
|
if ( isset( $_POST[ 'upload_playlist_cover' ] ) ) {
|
|
|
|
$cover = $_FILES[ 'playlist_cover' ];
|
|
|
|
$cover[ 'playlist_id' ] = $pid;
|
|
|
|
|
|
|
|
if ( playlist_upload_cover( $cover ) ) {
|
|
|
|
e( lang( 'Playlist cover has been uploaded' ), 'm' );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( file_exists( $cover[ 'tmp_name' ] ) ) {
|
|
|
|
unlink( $cover[ 'tmp_name' ] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-07 12:17:06 +00:00
|
|
|
$playlist = $cbvid->action->get_playlist($pid,userid());
|
|
|
|
|
|
|
|
//Deleting Item
|
|
|
|
if(!empty($_GET['delete_item']))
|
|
|
|
{
|
|
|
|
$delid = mysql_clean($_GET['delete_item']);
|
|
|
|
$cbvid->action->delete_playlist_item($delid);
|
|
|
|
}
|
|
|
|
|
|
|
|
if($playlist)
|
|
|
|
{
|
|
|
|
assign('playlist',$playlist);
|
|
|
|
//Getting Playlist Item
|
2013-11-26 12:06:14 +00:00
|
|
|
$items = $cbvid->get_playlist_items( $pid, 'playlist_items.date_added DESC' );
|
2013-10-07 12:17:06 +00:00
|
|
|
assign('items',$items);
|
|
|
|
|
|
|
|
}else
|
|
|
|
e(lang('playlist_not_exist'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
subtitle(lang("manage_playlist"));
|
|
|
|
template_files('manage_playlists.html');
|
|
|
|
display_it();
|
|
|
|
?>
|