ADDED : Flagged Moderation in admin panel
Fixed : Confirm JS
This commit is contained in:
parent
a74c549393
commit
a055ace334
7 changed files with 225 additions and 38 deletions
|
@ -10,19 +10,106 @@
|
|||
require_once '../includes/admin_config.php';
|
||||
$userquery->login_check('video_moderation');
|
||||
|
||||
//Getting Video List
|
||||
$page = mysql_clean($_GET['page']);
|
||||
$get_limit = create_query_limit($page,5);
|
||||
$videos = $cbvid->action->get_flagged_objects($get_limit);
|
||||
Assign('videos', $videos);
|
||||
$mode = $_GET['mode'];
|
||||
|
||||
//Collecting Data for Pagination
|
||||
$total_rows = $cbvid->action->count_flagged_objects();
|
||||
$total_pages = count_pages($total_rows,5);
|
||||
|
||||
//Pagination
|
||||
$pages->paginate($total_pages,$page);
|
||||
//Delete Video
|
||||
if(isset($_GET['delete_video'])){
|
||||
$video = mysql_clean($_GET['delete_video']);
|
||||
$cbvideo->delete_video($video);
|
||||
}
|
||||
|
||||
//Deleting Multiple Videos
|
||||
if(isset($_POST['delete_selected']))
|
||||
{
|
||||
for($id=0;$id<=RESULTS;$id++)
|
||||
{
|
||||
$cbvideo->delete_video($_POST['check_video'][$id]);
|
||||
}
|
||||
$eh->flush();
|
||||
e(lang("vdo_multi_del_erro"),"m");
|
||||
}
|
||||
//Activate / Deactivate
|
||||
|
||||
if(isset($_GET['activate'])){
|
||||
$video = mysql_clean($_GET['activate']);
|
||||
$cbvid->action('activate',$video);
|
||||
}
|
||||
if(isset($_GET['deactivate'])){
|
||||
$video = mysql_clean($_GET['deactivate']);
|
||||
$cbvid->action('deactivate',$video);
|
||||
}
|
||||
|
||||
//Using Multple Action
|
||||
if(isset($_POST['activate_selected'])){
|
||||
for($id=0;$id<=RESULTS;$id++){
|
||||
$cbvid->action('activate',$_POST['check_video'][$id]);
|
||||
}
|
||||
e("Selected Videos Have Been Activated","m");
|
||||
}
|
||||
if(isset($_POST['deactivate_selected'])){
|
||||
for($id=0;$id<=RESULTS;$id++){
|
||||
$cbvid->action('deactivate',$_POST['check_video'][$id]);
|
||||
}
|
||||
e("Selected Videos Have Been Dectivated","m");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(isset($_REQUEST['delete_flags']))
|
||||
{
|
||||
$video = mysql_clean($_GET['delete_flags']);
|
||||
$cbvid->action->delete_flags($video);
|
||||
}
|
||||
|
||||
//Deleting Multiple Videos
|
||||
if(isset($_POST['delete_flags']))
|
||||
{
|
||||
for($id=0;$id<=RESULTS;$id++)
|
||||
{
|
||||
$eh->flush();
|
||||
$cbvid->action->delete_flags($_POST['check_video'][$id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case "view":
|
||||
default:
|
||||
{
|
||||
assign("mode","view");
|
||||
//Getting Video List
|
||||
$page = mysql_clean($_GET['page']);
|
||||
$get_limit = create_query_limit($page,5);
|
||||
$videos = $cbvid->action->get_flagged_objects($get_limit);
|
||||
Assign('videos', $videos);
|
||||
|
||||
//Collecting Data for Pagination
|
||||
$total_rows = $cbvid->action->count_flagged_objects();
|
||||
$total_pages = count_pages($total_rows,5);
|
||||
|
||||
//Pagination
|
||||
$pages->paginate($total_pages,$page);
|
||||
}
|
||||
break;
|
||||
|
||||
case "view_flags":
|
||||
{
|
||||
assign("mode","view_flags");
|
||||
$vid = mysql_clean($_GET['vid']);
|
||||
$vdetails = $cbvid->get_video($vid);
|
||||
if($vdetails)
|
||||
{
|
||||
$flags = $cbvid->action->get_flags($vid);
|
||||
assign('flags',$flags);
|
||||
assign('video',$vdetails);
|
||||
}else
|
||||
e("Video does not exist");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template_files('flagged_videos.html');
|
||||
display_it();
|
||||
?>
|
|
@ -1,7 +1,8 @@
|
|||
|
||||
<span class="page_title">Video Manager</span>
|
||||
{if $mode=='view'}
|
||||
<span class="page_title">Flagged Videos Manager</span>
|
||||
<!-- DIsplaying Videos -->
|
||||
<form name="video_manage" method="post">
|
||||
<form name="flagged_video" method="post" id="flagged_video">
|
||||
|
||||
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
|
@ -9,9 +10,9 @@
|
|||
<td height="50" style="padding-left:15px">
|
||||
<input type="submit" name="activate_selected" value="Activate" class="button"/>
|
||||
<input type="submit" name="deactivate_selected" value="Deactivate" class="button" />
|
||||
<input type="submit" name="make_featured_selected" value="Make Featured" class="button"/>
|
||||
<input type="submit" name="make_unfeatured_selected" value="Make Unfeatured" class="button"/>
|
||||
<input type="submit" name="delete_selected" value="Delete" class="button" onclick="Confirm_Delete('')"/>
|
||||
<input type="submit" name="delete_selected" value="Delete Videos" class="button" onclick="return confirm_it('Are you sure you want to delete these videos')"/>
|
||||
|
||||
<input type="submit" name="delete_flags" value="Delete Flags" class="button" onclick="return confirm_it('Are you sure you want to delete flags of selected videos')"/>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -45,28 +46,20 @@
|
|||
{$videos[list].title}
|
||||
</a> —
|
||||
<span class="vdo_sets">
|
||||
Featured:<strong>{$videos[list].featured} </strong> •
|
||||
Active:<strong>{$videos[list].active}</strong> •
|
||||
Status:<strong>{$videos[list].status}</strong>
|
||||
Status:<strong>{$videos[list].status}</strong> •
|
||||
Flags:<strong>{$videos[list].total_flags}</strong>
|
||||
</span>
|
||||
|
||||
<br />
|
||||
<div id="vid_opt-{$videos[list].videoid}" style="display:none" class="vid_opts">
|
||||
|
||||
<a href="view_video.php?video={$videos[list].videoid}">View</a> |
|
||||
<a href="edit_video.php?video={$videos[list].videoid}">Edit</a> {if $videos[list].featured == yes} |
|
||||
<a href="javascript:Confirm_Delete('?delete_video={$videos[list].videoid}')">Delete</a> |
|
||||
<a href="?make_unfeature={$videos[list].videoid}">Make Unfeatured</a> {/if}
|
||||
{if $videos[list].featured == no} |
|
||||
<a href="?make_feature={$videos[list].videoid}">Make Featured</a> {/if}
|
||||
{if $videos[list].active == yes} |
|
||||
<a href="?deactivate={$videos[list].videoid}">Deactivate</a> {else} |
|
||||
<a href="?activate={$videos[list].videoid}">Activate</a> {/if} |
|
||||
<a href="view_conversion_log.php?file_name={$videos[list].file_name}">File conversion details</a> |
|
||||
<a href="?delete_video={$videos[list].videoid}">Delete</a>
|
||||
{foreach from=$cbvid->video_manager_links item=links}
|
||||
{$cbvid->video_manager_link($links,$videos[list])}
|
||||
{/foreach}
|
||||
<a href="edit_video.php?video={$videos[list].videoid}">Edit</a> |
|
||||
<a href="?mode=view_flags&vid={$videos[list].videoid}">View Flags</a> |
|
||||
<a href="?delete_video={$videos[list].videoid}">Delete Video</a> |
|
||||
<a href="?delete_flags={$videos[list].videoid}">Delete Flags</a>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td width="50" valign="top" class="video_opt_td"> </td>
|
||||
|
@ -87,9 +80,9 @@
|
|||
<td height="50" style="padding-left:15px">
|
||||
<input type="submit" name="activate_selected" value="Activate" class="button"/>
|
||||
<input type="submit" name="deactivate_selected" value="Deactivate" class="button" />
|
||||
<input type="submit" name="make_featured_selected" value="Make Featured" class="button"/>
|
||||
<input type="submit" name="make_unfeatured_selected" value="Make Unfeatured" class="button"/>
|
||||
<input type="submit" name="delete_selected" value="Delete" class="button" onclick="Confirm_Delete('')"/>
|
||||
<input type="submit" name="delete_selected" value="Delete Videos" class="button" onclick="return confirm_it('Are you sure you want to delete these videos')"/>
|
||||
|
||||
<input type="submit" name="delete_flags" value="Delete Flags" class="button" onclick="return confirm_it('Are you sure you want to delete flags of selected videos')"/>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -98,4 +91,46 @@
|
|||
</form>
|
||||
|
||||
<!-- DIsplaying Videos Ends-->
|
||||
{include file="$style_dir/blocks/pagination.html" }
|
||||
{include file="$style_dir/blocks/pagination.html" }
|
||||
|
||||
{/if}
|
||||
|
||||
|
||||
{if $mode=='view_flags'}
|
||||
<span class="page_title">Viewing {$video.title} flags</span> — <a href="{$baseurl}/watch_video.php?v={$video.videokey}">View video</a> • <a href="edit_video.php?video={$video.videoid}">Edit video</a> • <a href="?delete_flags={$video.videoid}">Delete Flags</a> • <a href="?delete_video={$video.videoid}">Delete Video</a>
|
||||
<div style="margin-bottom:10px"></div>
|
||||
<!-- DIsplaying Videos -->
|
||||
<form name="video_manage" method="post">
|
||||
|
||||
|
||||
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td width="30" align="center" valign="middle" class="left_head"> </td>
|
||||
<td class="head">Flag Details</td>
|
||||
<td width="50" class="right_head"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||
{assign var = bgcolor value = ""}
|
||||
{section name=list loop=$flags}
|
||||
<tr class="video_opt_td" bgcolor="{$bgcolor}">
|
||||
<td width="30" align="left" valign="top" class="video_opt_td">{$smarty.section.list.iteration}</td>
|
||||
<td align="left" valign="top" class="video_opt_td">Reported as "{$flags[list].flag_type|flag_type}" by {$flags[list].userid|get_username} {$flags[list].date_added|niceTime}</td>
|
||||
<td width="50" valign="top" class="video_opt_td"> </td>
|
||||
</tr>
|
||||
{if $bgcolor == ""}
|
||||
{assign var = bgcolor value = "#EEEEEE"}
|
||||
{else}
|
||||
{assign var = bgcolor value = ""}
|
||||
{/if}
|
||||
|
||||
{/section}
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{/if}
|
|
@ -173,6 +173,18 @@ class cbactions
|
|||
}
|
||||
function flag_it($id){ return $this->report_id($id); }
|
||||
|
||||
|
||||
/**
|
||||
* Function used to delete flags
|
||||
*/
|
||||
function delete_flags($id)
|
||||
{
|
||||
global $db;
|
||||
$db->delete($this->flag_tbl,array("id","type"),array($id,$this->type));
|
||||
e(sprintf(lang("type_flags_removed"),$this->name),"m");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to check weather user has already reported the object or not
|
||||
*/
|
||||
|
@ -324,6 +336,20 @@ class cbactions
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to get all flags of an object
|
||||
*/
|
||||
function get_flags($id)
|
||||
{
|
||||
global $db;
|
||||
$type = $this->type;
|
||||
$results = $db->select($this->flag_tbl,"*","id = '$id' AND type='".$this->type."'");
|
||||
if($db->num_rows>0)
|
||||
return $results;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to count object flags
|
||||
|
|
|
@ -1663,6 +1663,14 @@ class userquery extends CBCategory{
|
|||
{
|
||||
return $this->get_user_field_only(user_id(),'username');
|
||||
}
|
||||
|
||||
/**
|
||||
* FUnction used to get username from userid
|
||||
*/
|
||||
function get_username($uid)
|
||||
{
|
||||
return $this->get_user_field_only($uid,'username');
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to create profile link
|
||||
|
|
|
@ -412,6 +412,8 @@ $Smarty->register_modifier('outgoing_link','outgoing_link');
|
|||
$Smarty->register_modifier('nicetime','nicetime');
|
||||
$Smarty->register_modifier('country','get_country');
|
||||
$Smarty->register_modifier('cbsearch',new cbsearch());
|
||||
$Smarty->register_modifier('flag_type','flag_type');
|
||||
$Smarty->register_modifier('get_username','get_username');
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -3012,6 +3012,15 @@
|
|||
return $action->report_opts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to display flag type
|
||||
*/
|
||||
function flag_type($id)
|
||||
{
|
||||
$flag_opts = get_flag_options();
|
||||
return $flag_opts[$id];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to load captcha field
|
||||
|
@ -3141,5 +3150,14 @@
|
|||
global $cbsubtitle;
|
||||
$cbsubtitle = $title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* FUnction used to get username from userid
|
||||
*/
|
||||
function get_username($uid)
|
||||
{
|
||||
global $userquery;
|
||||
return $userquery->get_username($uid,'username');
|
||||
}
|
||||
?>
|
|
@ -37,7 +37,19 @@ var page = baseurl+'/ajax.php';
|
|||
if (confirm('Are you sure you want to remove this video?'))
|
||||
{
|
||||
document.formname.submit();
|
||||
}
|
||||
}else
|
||||
return false;
|
||||
}
|
||||
|
||||
function confirm_it(msg)
|
||||
{
|
||||
var action = confirm(msg);
|
||||
if(action)
|
||||
{
|
||||
return true;
|
||||
}else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
function reloadImage(captcha_src,imgid)
|
||||
|
@ -354,12 +366,11 @@ var page = baseurl+'/ajax.php';
|
|||
|
||||
function flag_object(form_id,id,type)
|
||||
{
|
||||
|
||||
$.post(page,
|
||||
{
|
||||
mode : 'flag_object',
|
||||
type : type,
|
||||
flag_type : $("#"+form_id+" input:#flag_type").val(),
|
||||
flag_type : $("#"+form_id+" select:#flag_type").val(),
|
||||
id : id,
|
||||
},
|
||||
function(data)
|
||||
|
|
Loading…
Add table
Reference in a new issue