ADDED : Editor's PICK plugins

UPDATE : Index Page
This commit is contained in:
Arslan Hassan 2009-11-05 21:50:39 +00:00
parent 6131a4c6ea
commit fcd28e49b8
25 changed files with 614 additions and 617 deletions

View file

@ -12,41 +12,27 @@ $userquery->admin_login_check();
$pages->page_redir();
//Move Video Up
if(isset($_GET['up'])){
$id = mysql_clean($_GET['up']);
$msg = $myquery->MovePickUp($id);
if(isset($_GET['move_up'])){
$id = mysql_clean($_GET['move_up']);
move_pick_up($id);
}
//Move Down Up
if(isset($_GET['down'])){
$id = mysql_clean($_GET['down']);
$msg = $myquery->MovePickDown($id);
if(isset($_GET['move_down'])){
$id = mysql_clean($_GET['move_down']);
move_pick_down($id);
}
//Removing From Editor's List
//Removing
if(isset($_GET['remove'])){
$id = mysql_clean($_GET['remove']);
$msg = $myquery->DeleteEditorPick($id);
remove_vid_editors_pick($id);
}
//Geting List Of Videos From Editor PIcks table
$query = "SELECT * FROM editors_picks ORDER BY sort ASC";
$data = $db->Execute($query);
$videos = $data->getrows();
$total_videos = $data->recordcount()+0;
for($id=0;$id<=$total_videos;$id++){
$details = @$myquery->GetVideDetails($videos[$id]['videokey']);
$videos[$id]['title'] = $details['title'];
$videos[$id]['views'] = $details['views'];
$videos[$id]['rating'] = pullRating($details['views'],true,false,true,'novote');
}
Assign('total_videos',$total_videos);
Assign('videos',$videos);
assign('videos',get_ep_videos());
assign('max',get_highest_sort_number());
assign('min',get_lowest_sort_number());
Assign('msg', @$msg);
Template('header.html');
Template('leftmenu.html');
Template('message.html');
Template('editor_pick.html');
Template('footer.html');
template_files('editor_pick.html');
display_it();
?>

View file

@ -8,106 +8,21 @@
*/
require_once '../includes/admin_config.php';
$userquery->admin_login_check();
$pages->page_redir();
$userquery->login_check('video_moderation');
//Function Used To Remove Flag
//Getting Video List
$page = mysql_clean($_GET['page']);
$get_limit = create_query_limit($page,RESULTS);
$videos = $cbvid->action->get_flagged_objects($get_limit);
Assign('videos', $videos);
if(isset($_GET['remove_flags'])){
$video = mysql_clean($_GET['remove_flags']);
if($myquery->VideoExists($video)){
$msg[] = $myquery->DeleteFlag($video);
}else{
$msg[] = $LANG['class_vdo_del_err'];
}
}
//Collecting Data for Pagination
$total_rows = $cbvid->action->count_flagged_objects();
$total_pages = count_pages($total_rows,VLISTPP);
//Activate / Deactivate
if(isset($_GET['activate'])){
$video = mysql_clean($_GET['activate']);
if($myquery->VideoExists($video)){
$msg[] = $myquery->ActivateVideo($video);
}else{
$msg[] = $LANG['class_vdo_del_err'];
}
}
if(isset($_GET['deactivate'])){
$video = mysql_clean($_GET['deactivate']);
if($myquery->DeActivateVideo($video)){
$msg[] = $myquery->DeActivateVideo($video);
}else{
$msg[] = $LANG['class_vdo_del_err'];
}
}
//Delete Video
if(isset($_GET['delete_video'])){
$video = mysql_clean($_GET['delete_video']);
if($myquery->VideoExists($video)){
$msg[] = $myquery->DeleteVideo($video);
}else{
$msg[] = $LANG['class_vdo_del_err'];
}
}
//Getting List From Flaggeed Videos
$limit = 15;
Assign('limit',$limit);
$page = mysql_clean(@$_GET['page']);
Assign('limit',$limit);
if(empty($page) || $page == 0){
$page = 1;
}
$from = $page-1;
$from = $from*$limit;
//Pagination
$pages->paginate($total_pages,$page);
$query_limit = "limit $from,$limit";
$query = "SELECT videoid, count(*) AS flags FROM flagged_videos GROUP BY videoid ORDER BY flags DESC $query_limit";
$sql_p = "SELECT videoid, count(*) AS flags FROM flagged_videos GROUP BY videoid ORDER BY flags DESC ";
$data = $db->Execute($query);
$videos = $data->getrows();
$total_videos = $data->recordcount()+0;
for($id=0;$id<$total_videos;$id++){
$vdo_data = $myquery->GetVideoDetails($videos[$id]['videoid']);
$title = $vdo_data['title'];
$videokey = $vdo_data['videokey'];
$active = $vdo_data['active'];
$username = $vdo_data['username'];
$type = $vdo_data['broadcast'];
$videos[$id]['title'] = $title;
$videos[$id]['videokey'] = $videokey;
$videos[$id]['active'] = $active;
$videos[$id]['username'] = $username;
$videos[$id]['broadcast'] = $type;
$$vdo_data[$id] = $vdo_data;
}
Assign('videos',$videos);
//Pagination
$query = mysql_query($sql_p);
Assign('grand_total',mysql_num_rows($query));
$total_rows = mysql_num_rows($query);
$page_id=1;
$id = 1;
//$all_pages[0]['page'] = $page_id;
$records = $total_rows/$limit;
$pages = round($records+0.49,0);
Assign('pages',$pages+1);
Assign('cur_page',$page);
Assign('nextpage',$page+1);
Assign('prepage',$page-1);
Assign('total_pages',$page_id);
Assign('msg', @$msg);
Template('header.html');
Template('leftmenu.html');
Template('message.html');
Template('flagged_videos.html');
Template('footer.html');
template_files('video_manager.php');
display_it();
?>

View file

@ -0,0 +1,46 @@
<span class="page_title">Editor's Pick</span>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="30" align="center" valign="middle" class="left_head">
<input type="checkbox" name="checkall" onclick="checkUncheckAll(this);"/></td>
<td width="50" class="head_sep_left">Num</td>
<td width="100" class="head_sep_left">Sort</td>
<td class="head"><div class="head_sep_left" style="width:250px">Details</div></td>
<td width="50" class="right_head">&nbsp;</td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
{assign var = bgcolor value = ""}
{section name=list loop=$videos}
<tr class="video_opt_td" bgcolor="{$bgcolor}">
<td width="30" align="center" valign="top" class="video_opt_td"> <input name="check_video[]" type="checkbox" id="check_video" value="{$videos[list].videoid}" /></td>
<td width="50" align="center" valign="top" class="video_opt_td">{$videos[list].sort}</td>
<td width="100" align="center" valign="top" class="video_opt_td">{if $videos[list].sort > $min}<a href="?move_up={$videos[list].pick_id}">Up</a>{/if} &#8211; {if $videos[list].sort < $max}<a href="?move_down={$videos[list].pick_id}">Down</a>{/if}</td>
<td valign="top" class="video_opt_td" style="padding-left:15px">
<a href="{$baseurl}/watch_video.php?v={$videos[list].videokey}" target="_blank" style="text-indent:10px">
{$videos[list].title}
</a> &#8211;<a href="?remove={$videos[list].videoid}"> Remove from editor's pick</a>&#8212;
<span class="vdo_sets">
Featured:<strong>{$videos[list].featured} </strong> &#8226;
Active:<strong>{$videos[list].active}</strong> &#8226;
Status:<strong>{$videos[list].status}</strong>
</span>
<br />
</td>
<td width="50" valign="top" class="video_opt_td">&nbsp;</td>
</tr>
{if $bgcolor == ""}
{assign var = bgcolor value = "#EEEEEE"}
{else}
{assign var = bgcolor value = ""}
{/if}
{/section}
</table>

View file

@ -89,9 +89,11 @@
{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="?editor_pick={$videos[list].videoid}">Add To Editor's Pick</a> |
<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}
</div>
</td>
<td width="50" valign="top" class="video_opt_td">&nbsp;</td>

View file

@ -1,12 +1,5 @@
<div class="setting_title">Editor's Pick<br>
</div>
<table width="800" border="0" cellspacing="2" cellpadding="0">
<tr bgcolor="{$bgcolor}">
<td width="300">Title</td>
<td width="200">Date Added</td>
<td>Action</td>
</tr>
</table>
<table width="800" border="0" cellspacing="2" cellpadding="0">
{assign var = bgcolor value = ""}

View file

@ -1,4 +1,3 @@
<link href="../theme/stylesheet.css" rel="stylesheet" type="text/css" />
<div class="setting_title">{$data.title}</div>
{assign var='requiredFields' value=$Upload->loadRequiredFields($data)}
{assign var='optionFields' value=$Upload->loadOptionFields($data)}

View file

@ -8,7 +8,7 @@
*/
require_once '../includes/admin_config.php';
$userquery->admin_login_check();
$userquery->login_check('video_moderation');
$pages->page_redir();
//Feature / UnFeature Video
@ -35,18 +35,6 @@ if(isset($_POST['make_unfeatured_selected'])){
e("Selected videos have been removed from featured list",m);
}
//Add To Editor's Pick
if(isset($_GET['editor_pick'])){
$video = mysql_clean($_GET['editor_pick']);
if($myquery->VideoExists($video)){
$msg[] = $myquery->AddToEditorPick($video);
}else{
$msg[] = $LANG['class_vdo_del_err'];
}
}
//Activate / Deactivate
if(isset($_GET['activate'])){
@ -89,6 +77,10 @@ if(isset($_POST['delete_selected']))
$eh->flush();
e(lang("vdo_multi_del_erro"),m);
}
//Calling Video Manager Functions
call_functions($cbvid->video_manager_funcs);
//Jump To The page
if(isset($_POST['display_page'])){

View file

@ -277,6 +277,39 @@ class cbactions
}else
e(sprintf(lang('unknown_favorite'),$this->name));
}
/**
* Function used to get object flags
*/
function get_flagged_objects($limit=NULL)
{
global $db;
$type = $this->type;
$results = $db->select($this->flag_tbl.",".$this->type_tbl,"*,
count(*) AS total_flags",$this->flag_tbl.".id = ".$this->type_tbl.".".$this->type_id_field."
AND type='".$this->type."' GROUP BY ".$this->flag_tbl.".id ,".$this->flag_tbl.".type ",$limit);
if($db->num_rows>0)
return $results;
else
return false;
}
/**
* Function used to count object flags
*/
function count_flagged_objects()
{
global $db;
$type = $this->type;
$results = $db->select($this->flag_tbl.",".$this->type_tbl,"id",$this->flag_tbl.".id = ".$this->type_tbl.".".$this->type_id_field."
AND type='".$this->type."' GROUP BY ".$this->flag_tbl.".id ,".$this->flag_tbl.".type ");
if($db->num_rows>0)
return count($results);
else
return false;
}
}
?>

View file

@ -15,445 +15,6 @@
class Stats {
//This Variable will be used to store all stats of the websites
var $stats;
function Stats($refresh=false){
$query = mysql_query("SELECT * FROM stats");
while($data = mysql_fetch_array($query)){
$details[$data['name']] = $data['value'];
}
$this->stats = $details;
if($refresh=true){
$this->Refresh();
}
}
//FUNCTION USED TO REFRESH STATS DATA
function Refresh(){
$today = date("Y-m-d");
$query = mysql_query("SELECT * FROM users WHERE doj like '%$today%'");
$array['today_signups'] = mysql_num_rows($query);
$query = mysql_query("SELECT * FROM users WHERE last_logged like '%$today%'");
$array['todays_logins'] = mysql_num_rows($query);
$query = mysql_query("SELECT * FROM video WHERE date_added like '%$today%'");
$array['videos_added_today'] = mysql_num_rows($query);
$month = date("Y-m");
//if(date("Y-m",strtotime($this->stats['last_update'])) != $month ){
$query = mysql_query("SELECT * FROM users WHERE last_logged like '%$month%'");
$array['months_logins'] = mysql_num_rows($query);
$query = mysql_query("SELECT * FROM video WHERE date_added like '%$month%'");
$array['videos_added_this_month'] = mysql_num_rows($query);
//}
$query = mysql_query("SELECT videoid, count(*) AS flags FROM flagged_videos GROUP BY videoid ORDER BY flags DESC ");
$array['total_flagged_videos'] = mysql_num_rows($query);
mysql_query("UPDATE stats SET value='".$array['today_signups']."' WHERE name='today_signups'");
mysql_query("UPDATE stats SET value='".$array['todays_logins']."' WHERE name='todays_logins'");
mysql_query("UPDATE stats SET value='".$array['videos_added_today']."' WHERE name='videos_added_today'");
mysql_query("UPDATE stats SET value='".$array['months_logins']."' WHERE name='months_logins'");
mysql_query("UPDATE stats SET value='".$array['videos_added_this_month']."' WHERE name='videos_added_this_month'");
mysql_query("UPDATE stats SET value='".$array['total_flagged_videos']."' WHERE name='total_flagged_videos'");
mysql_query("UPDATE stats SET value=now() WHERE name='last_update'");
$this->UpdateGroupRecord();
$query = mysql_query("SELECT * FROM stats");
while($data = mysql_fetch_array($query)){
$details[$data['name']] = $data['value'];
}
if($query)
mysql_free_result($query);
$this->stats = $details;
}
//FUNCTION USED TO UPDATE USER RECORD
function UpdateUserRecord($type=1){
$today = date("Y-m-d");
$month = date("Y-m");
switch($type){
//TYPE 1 , INCREASE TOTAL USERS
case 1;
$update = $this->stats['total_users'] + 1;
break;
//TYPE 2 , Decrease TOTAL USERS
case 2;
$update = $this->stats['total_users'] - 1;
break;
//Type 3, Update Users Signup Today
case 3;
$query = mysql_query("SELECT * FROM users WHERE doj like '%$today%'");
$array['today_logins'] = mysql_num_rows($query);
mysql_query("UPDATE stats SET value='".$array['today_logins']."' WHERE name='today_signups'");
break;
//Type 4, Update Users Login Today
case 4;
$query = mysql_query("SELECT * FROM users WHERE last_logged like '%$today%'");
$array['today_logins'] = mysql_num_rows($query);
mysql_query("UPDATE stats SET value='".$array['today_logins']."' WHERE name='todays_logins'");
break;
//Type 5, Update Users Login This Month
case 5;
$query = mysql_query("SELECT * FROM users WHERE last_logged like '%$month%'");
$array['months_logins'] = mysql_num_rows($query);
mysql_query("UPDATE stats SET value='".$array['months_logins']."' WHERE name='months_logins'");
break;
//Type 6, Update Number of total user comments
case 6;
$update = $this->stats['total_user_comments'] + 1;
if(!mysql_query("UPDATE stats SET value = '".$update."' WHERE name='total_user_comments'"))die(mysql_error());
break;
}
if($type<=2){
mysql_query("UPDATE stats SET value = '".$update."' WHERE name='total_users'");
}
if(@$query)
mysql_free_result($query);
}
//FUNCTION USED TO UPDATE VIDEO RECORD
function UpdateVideoRecord($type=1){
switch($type){
//Case1: Increase 1 Video
case 1;
$update = $this->stats['total_videos'] + 1;
break;
case 2;
$update = $this->stats['total_videos'] - 1;
break;
case 3;
$update = $this->stats['total_video_comments'] + 1;
break;
case 4;
$update = $this->stats['total_video_comments'] - 1;
break;
case 5;
$update = $this->stats['total_watched_videos'] + 1;
mysql_query("UPDATE stats SET value = '".$update."' WHERE name='total_watched_videos'");
break;
case 6;
$update = $this->stats['total_added_favorites'] + 1;
break;
case 7;
$update = $this->stats['total_added_favorites'] - 1;
break;
case 8;
$update = $this->stats['total_success_videos'] + 1;
$update2 = $this->stats['total_videos_processing'] - 1;
mysql_query("UPDATE stats SET value = '".$update."' WHERE name='total_success_videos'");
mysql_query("UPDATE stats SET value = '".$update2."' WHERE name='total_videos_processing'");
break;
case 9;
$update = $this->stats['total_videos_processing'] + 1;
mysql_query("UPDATE stats SET value = '".$update."' WHERE name='total_videos_processing'");
break;
case 10;
$update = $this->stats['total_failed_videos'] + 1;
$update2 = $this->stats['total_videos_processing'] - 1;
mysql_query("UPDATE stats SET value = '".$update."' WHERE name='total_failed_videos'");
mysql_query("UPDATE stats SET value = '".$update2."' WHERE name='total_videos_processing'");
break;
case 11;
$update = $this->stats['total_active_videos'] + 1;
mysql_query("UPDATE stats SET value = '".$update."' WHERE name='total_active_videos'");
break;
case 12;
$update = $this->stats['total_active_videos'] - 1;
mysql_query("UPDATE stats SET value = '".$update."' WHERE name='total_active_videos'");
break;
}
if($type<=2){
mysql_query("UPDATE stats SET value = '".$update."' WHERE name='total_videos'");
}
if($type==4 || $type==3){
mysql_query("UPDATE stats SET value = '".$update."' WHERE name='total_video_comments'");
}
if($type==6 || $type==7){
mysql_query("UPDATE stats SET value = '".$update."' WHERE name='total_added_favorites'");
}
if(@$query)
mysql_free_result($query);
}
//Update Group Record
function UpdateGroupRecord(){
$details = $this->GetGroupStats();
mysql_query("UPDATE stats SET value='".$details['total' ]."' WHERE name='total_groups'");
mysql_query("UPDATE stats SET value='".$details['total_topics' ]."' WHERE name='total_topics'");
mysql_query("UPDATE stats SET value='".$details['total_posts' ]."' WHERE name='total_posts'");
mysql_query("UPDATE stats SET value='".$details['group_invitations' ]."' WHERE name='group_invitations'");
mysql_query("UPDATE stats SET value='".$details['groups_added_today']."' WHERE name='groups_added_today'");
mysql_query("UPDATE stats SET value='".$details['groups_added_month']."' WHERE name='groups_added_month'");
mysql_query("UPDATE stats SET value='".$details['group_members' ]."' WHERE name='group_members'");
}
//FUNCTIONS USED TO GET USER STATSS
function GetUsersStats(){
//Query of total users
$query = mysql_query("SELECT * FROM users");
$array['total'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Query For Active Users Only
$query = mysql_query("SELECT * FROM users WHERE usr_status='Ok'");
$array['active'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Query For Todays Signups
$today = date("Y-m-d");
$query = mysql_query("SELECT * FROM users WHERE doj like '%$today%'");
$array['today_singups'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Query for todays Logins
$query = mysql_query("SELECT * FROM users WHERE last_logged like '%$today%'");
$array['today_logins'] = mysql_num_rows($query);
//Query for Active Users in This Month
$month = date("Y-m");
$query = mysql_query("SELECT * FROM users WHERE last_logged like '%$month%'");
$array['months_logins'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Query For counting comments on user profiles
$query = mysql_query("SELECT * FROM channel_comments");
$array['total_comments'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
return $array;
}
//FUNCTION USED TO GET VIDEO DETAILS
function GetVideoStats(){
$today = date("Y-m-d");
$month = date("Y-m");
//Query User To Get Total Videos
$query = mysql_query("SELECT * FROM video");
$array['total'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Query User To Get Total Active Videos
$query = mysql_query("SELECT * FROM video WHERE active='yes'");
$array['total_active'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Query User To Get FlaggedVideos
$query = mysql_query("SELECT videoid, count(*) AS flags FROM flagged_videos GROUP BY videoid ORDER BY flags DESC ");
$array['total_flags'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Videos Added Today
$query = mysql_query("SELECT * FROM video WHERE date_added like '%$today%'");
$array['added_today'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
$query = mysql_query("SELECT * FROM video WHERE date_added like '%$month%'");
$array['added_this_month'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Total Videos Watched
$query = mysql_query("SELECT views FROM video ");
$views = 0;
while($data = mysql_fetch_array($query)){
@$views = $views + $data['views'];
}
$array['total_watched'] = $views;
//Used To Count Comment Of Videos
$query = mysql_query("SELECT * FROM video_comments");
$array['total_comments'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Used To Count Number Videos in Favourites
$query = mysql_query("SELECT * FROM video_favourites");
$array['total_favorites'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Get Total Processed Videos
$query = mysql_query("SELECT * FROM video WHERE status='Processing'");
$array['total_videos_processing'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Get Total Successfull Videos
$query = mysql_query("SELECT * FROM video WHERE status='Successful'");
$array['total_success_videos'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Get Total Failed Videos
$query = mysql_query("SELECT * FROM video WHERE status='Failed'");
$array['total_failed_videos'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
return $array;
}
//Function Used Get Group Details
function GetGroupStats($type=false){
$today = date("Y-m-d");
$month = date("Y-m");
if($type==FALSE){
//Used To Get Total Number Of Groups
$query = mysql_query("SELECT * FROM groups");
$array['total'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Used To Get Total Number Of Topics
$query = mysql_query("SELECT * FROM group_topics");
$array['total_topics'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Used To Get Total Number Of Posts
$query = mysql_query("SELECT * FROM group_posts");
$array['total_posts'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Used To Get Total Number Of Invitations
$query = mysql_query("SELECT * FROM group_invitations");
$array['group_invitations'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Groups Added Today
$query = mysql_query("SELECT * FROM groups WHERE date_added like '%$today%'");
$array['groups_added_today'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Groups Added This Month
$query = mysql_query("SELECT * FROM groups WHERE date_added like '%$month%'");
$array['groups_added_month'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
//Total Members
$query = mysql_query("SELECT * FROM group_members");
$array['group_members'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
}else{
switch($type){
case 1;
//Used To Get Total Number Of Groups
$query = mysql_query("SELECT * FROM groups");
$array['total'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
break;
case 2;
//Used To Get Total Number Of Topics
$query = mysql_query("SELECT * FROM group_topics");
$array['total_topics'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
break;
case 3;
//Used To Get Total Number Of Posts
$query = mysql_query("SELECT * FROM group_posts");
$array['total_posts'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
break;
case 4;
//Used To Get Total Number Of Invitations
$query = mysql_query("SELECT * FROM group_invitations");
$array['group_invitations'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
break;
case 5;
//Groups Added Today
$query = mysql_query("SELECT * FROM groups WHERE date_added like '%$today%'");
$array['groups_added_today'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
break;
case 6;
//Groups Added This Month
$query = mysql_query("SELECT * FROM groups WHERE date_added like '%$month%'");
$array['groups_added_today'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
break;
case 7;
//Total Members
$query = mysql_query("SELECT * FROM group_members");
$array['group_members'] = mysql_num_rows($query);
if($query)
mysql_free_result($query);
break;
}
}
return $array;
}
//Use To Get Database Stats
function ServerDetails(){
global $db;
$status['mysql_ver'] = mysql_get_server_info();
$result = mysql_query( "SHOW TABLE STATUS" );
$dbsize = 0;
while( $row = mysql_fetch_array( $result ) ) {
$dbsize += $row[ "Data_length" ] + $row[ "Index_length" ];
}
$status['db_size'] = formatfilesize($dbsize);
$status['disk_space'] = formatfilesize(disk_total_space(BASEDIR));
$status['space_free'] = formatfilesize(disk_free_space(BASEDIR));
$status['space_used'] = formatfilesize(disk_total_space(BASEDIR)-disk_free_space(BASEDIR));
$status['php_ver'] = PHP_VERSION;
return $status ;
}
//Function Force Update
//FUNCTION USED TO COUNT THE DETAIL FROMT THE TABLES
//1 by 1
function __FORCEUPDATE__(){
//Update User Stats
$user_details = $this->GetUsersStats();
mysql_query("UPDATE stats SET value='".$user_details['total' ]."' WHERE name='total_users'");
mysql_query("UPDATE stats SET value='".$user_details['active' ]."' WHERE name='total_active_users'");
mysql_query("UPDATE stats SET value='".$user_details['today_singups' ]."' WHERE name='today_signups'");
mysql_query("UPDATE stats SET value='".$user_details['today_logins' ]."' WHERE name='todays_logins'");
mysql_query("UPDATE stats SET value='".$user_details['months_logins' ]."' WHERE name='months_logins'");
mysql_query("UPDATE stats SET value='".$user_details['total_comments' ]."' WHERE name='total_user_comments'");
//Update Video Stats
$video_details = $this->GetVideoStats();
mysql_query("UPDATE stats SET value='".$video_details['total' ]."' WHERE name='total_videos'");
mysql_query("UPDATE stats SET value='".$video_details['total_active' ]."' WHERE name='total_active_videos'");
mysql_query("UPDATE stats SET value='".$video_details['total_flags' ]."' WHERE name='total_flagged_videos'");
mysql_query("UPDATE stats SET value='".$video_details['added_today' ]."' WHERE name='videos_added_today'");
mysql_query("UPDATE stats SET value='".$video_details['added_this_month']."' WHERE name='videos_added_this_month'");
mysql_query("UPDATE stats SET value='".$video_details['total_watched' ]."' WHERE name='total_watched_videos'");
mysql_query("UPDATE stats SET value='".$video_details['total_comments' ]."' WHERE name='total_video_comments'");
mysql_query("UPDATE stats SET value='".$video_details['total_favorites' ]."' WHERE name='total_added_favorites'");
mysql_query("UPDATE stats SET value='".$video_details['total_videos_processing']."' WHERE name='total_videos_processing'");
mysql_query("UPDATE stats SET value='".$video_details['total_success_videos']."' WHERE name='total_success_videos'");
mysql_query("UPDATE stats SET value='".$video_details['total_failed_videos']."' WHERE name='total_failed_videos'");
}
function UpdateDate(){
mysql_query("UPDATE stats SET value=now() WHERE name='date_updated'");
}
}
?>

View file

@ -289,7 +289,7 @@ class userquery {
global $db;
$results = $db->select("users",
"userid,email,level,usr_status,user_session_key,user_session_code",
"username='$username' OR userid='$username' AND password='$pass'");
"(username='$username' OR userid='$username') AND password='$pass'");
if($db->num_rows > 0)
{
return $results[0];
@ -2395,5 +2395,17 @@ class userquery {
else
return false;
}
/**
* function used to get user details with profile
*/
function get_user_details_with_profile($uid=NULL)
{
global $db;
if(!$uid)
$uid = userid();
$result = $db->select($this->dbtbl['users'].",".$this->dbtbl['user_profile'],"*",$this->dbtbl['users'].".userid ='$uid' AND ".$this->dbtbl['users'].".userid = ".$this->dbtbl['user_profile'].".userid");
return $result[0];
}
}
?>

View file

@ -23,6 +23,10 @@ class CBvideo extends CBCategory
var $email_template_vars = array();
var $dbtbl = array('video'=>'video');
var $video_manager_links = array();
var $video_manager_funcs = array();
/**
* __Constructor of CBVideo
*/
@ -103,7 +107,7 @@ class CBvideo extends CBCategory
case "featured":
case "f":
{
$db->update("video",array('featured'),array('yes')," videoid='$vid' OR videokey = '$vid' ");
$db->update("video",array('featured','featured_date'),array('yes',now())," videoid='$vid' OR videokey = '$vid' ");
e(lang("class_vdo_fr_msg"),m);
}
break;
@ -407,6 +411,15 @@ class CBvideo extends CBCategory
$cond .= " ($tag_n_title) ";
}
//FEATURED
if($params['featured'])
{
if($cond!='')
$cond .= ' AND ';
$featured .= " featured = 'yes' ";
}
$result = $db->select('video','*',$cond,$limit,$order);
@ -584,7 +597,7 @@ class CBvideo extends CBCategory
}
/**
/*
* Function used to update video and set a thumb as default
* @param VID
* @param THUMB NUM
@ -618,6 +631,22 @@ class CBvideo extends CBCategory
return false;
}
/**
* Function used to display video manger link
*/
function video_manager_link($link,$vid)
{
if(function_exists($link) && !is_array($link))
{
return $link($vid);
}else
{
if(!empty($link['title']) && !empty($link['link']))
{
return ' | <a href="'.$link['link'].'">'.$link['title'].'</a>';
}
}
}
}
?>

View file

@ -11,6 +11,7 @@ $Cbucket->links = array
'login' =>array('signup.php','login'),
'logout' =>array('logout.php','logout'),
'videos' =>array('videos.php','videos'),
'my_account'=>array('myaccount.php','my_account'),
);
?>

View file

@ -2494,4 +2494,30 @@
global $cbvideo;
return $cbvideo->get_videos($param);
}
/**
* Function used to call functions
*/
function call_functions($in,$params=NULL)
{
if(is_array($in))
{
foreach($in as $i)
{
if(function_exists($i))
if(!$params)
$i();
else
$i($params);
}
}else
{
if(function_exists($in))
if(!$params)
$in();
else
$in($params);
}
}
?>

View file

@ -10,12 +10,29 @@ define('THIS_PAGE','index');
require 'includes/config.inc.php';
$pages->page_redir();
pr($userquery);
//Get Videos Beign Watched
$being_watched = array
('limit' => 6,
'order' => 'last_viewed DESC',
);
if(isset($_GET['cb_ver']) && $is_admin)
{
$msg = "ClipBucket&nbsp;".CB_VERSION."";
}
assign('being_watched',$cbvid->get_videos($being_watched));
//GettinG list Of Featured Videos
$featured = array
('limit' => 4,
'featured' => 'yes',
'order' => ' featured_date DESC ',
);
assign('featured_videos',$cbvid->get_videos($featured));
//GettinG list Of recently added Videos
$recently_added = array
('limit' => 12,
'order' => ' date_added DESC ',
);
assign('recently_added',$cbvid->get_videos($recently_added));
//Displaying The Template

View file

@ -44,7 +44,7 @@ register_action(array('bb_to_html'=>array('comment','description','pm_compose_bo
register_anchor("<script>edToolbar('comment_box'); </script>",'before_compose_box');
register_anchor("<script>edToolbar('comment_box-reply'); </script>",'before_reply_compose_box');
register_anchor("<script>edToolbar('desc'); </script>",'before_desc_compose_box');
register_anchor("<script>edToolbar('desc'); </script>",'before_pm_compose_box');
register_anchor("<script>edToolbar('pm_content'); </script>",'before_pm_compose_box');
//Adding JS Code
$Cbucket->addJS(array('bbcode_js/ed.js'=>'global'));

View file

@ -9,26 +9,21 @@
| @ License: Addon With ClipBucket |
****************************************************************************************************
*/
include ("../includes/config.inc.php");
include ("../../includes/config.inc.php");
echo"<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo"<options>\n\t";
echo"<videos>\n\t";
$query = mysql_query("SELECT * FROM editors_picks WHERE status = '1' ORDER BY sort ASC LIMIT 0,10 ");
while($data = mysql_fetch_array($query)){
$videos = $myquery->GetVideDetails($data['videokey']);
$filename = GetName($videos['flv']);
$image = BASEURL."/files/thumbs/$filename-big.jpg";
$thumb = BASEURL."/files/thumbs/$filename-1.jpg";
$flv = BASEURL."/files/videos/".$videos['flv'];
$title = $videos['title'];
if(!empty($title)){
echo" <imageName target=\"_self\" html=\"\" flv=\"$flv\" autoStart=\"false\">$image</imageName>\n\t\t";
}
$ep_videos = get_ep_videos();
foreach($ep_videos as $video)
{
if(!empty($video['title']))
{
echo" <imageName target=\"_self\" html=\"\" flv=\"".get_video_file($video,true,true)."\" autoStart=\"false\">".getthumb($video,'big')."</imageName>\n\t\t";
}
}
echo "\n\t";
echo"</videos>\n";
echo"</options>";

View file

@ -0,0 +1,206 @@
<?php
/*
Plugin Name: ClipBucket Editor's Pick Plugin
Description: This plugin is used to display Editor's Pick Player On Home Page and also let you pick videos for editor's pick
Author: Arslan Hassan
Author Website: http://clip-bucket.com/
ClipBucket Version: 2
Version: 1.0
Website: http://clip-bucket.com/
Plugin Type: global
*/
if(!function_exists('editors_pick'))
{
function editors_pick()
{
if($_GET['add_editor_pick'])
{
$vid = mysql_clean($_GET['add_editor_pick']);
add_to_editor_pick($vid);
}
if($_GET['remove_editor_pick'])
{
$vid = mysql_clean($_GET['remove_editor_pick']);
remove_vid_editors_pick($vid);
}
}
/**
* Function used to add video to editor's pick;
*/
function add_to_editor_pick($vid)
{
global $cbvid,$db;
if($cbvid->video_exists($vid))
{
if(!is_video_in_editors_pick($vid))
{
$sort = get_highest_sort_number() + 1 ;
$db->insert("cb_editors_picks",array("videoid","sort","date_added"),array($vid,$sort,now()));
e(lang("Video has been added to editor's pick"),"m");
}else{
e(lang("Video is already in editor's pick"),"e");
}
}else
e(lang("video_exist_err"));
}
/**
* Remove Video From Editor's Pick
*/
function remove_vid_editors_pick($vid)
{
global $db;
if(is_array($vid))
$vid = $vid['videoid'];
if(is_video_in_editors_pick($vid))
{
$db->delete('cb_editors_picks',array('videoid'),array($vid));
e(lang("Video has been removed from editor's pick"),"m");
}
}
/**
* Function used to check weather video already exisrts in editors pick or not
*/
function is_video_in_editors_pick($vid)
{
global $db;
$count = $db->count("cb_editors_picks","videoid"," videoid='$vid'");
if($count>0)
return true;
else
return false;
}
/**
* Function used to get highest sort number
*/
function get_highest_sort_number()
{
global $db;
$result = $db->select("cb_editors_picks","sort",NULL,NULL," sort DESC ");
return $result[0]['sort'];
}
/**
* Function used to get highest sort number
*/
function get_lowest_sort_number()
{
global $db;
$result = $db->select("cb_editors_picks","sort",NULL,NULL," sort ASC ");
return $result[0]['sort'];
}
/**
* Function used to display video manager link|
*/
function video_manager_ep_link($vid)
{
if(is_video_in_editors_pick($vid['videoid']))
return ' | <a href="?remove_editor_pick='.$vid['videoid'].'">Remove From Editor\'s Pick</a>';
else
return ' | <a href="?add_editor_pick='.$vid['videoid'].'">Add To Editor\'s Pick</a>';
}
/**
* Function used to get editor picks videos and details
*/
function get_ep_videos()
{
global $db;
$results = $db->select('cb_editors_picks,video',"*"," cb_editors_picks.videoid = video.videoid ORDER BY cb_editors_picks.sort ASC");
return $results;
}
/**
* Function used to move pic up
*/
function move_pick_up($id)
{
global $db;
$result = $db->select("cb_editors_picks","*"," pick_id='$id'");
if($db->num_rows>0)
{
$result = $result[0];
$sort = $result['sort'];
if($sort>get_lowest_sort_number())
{
$less_result = $db->select("cb_editors_picks","*"," sort<$sort",1);
if($db->num_rows>0)
{
$less_result = $less_result[0];
$new_sort = $less_result['sort'];
$db->update('cb_editors_picks',array('sort'),$new_sort," pick_id='$id'");
$db->update('cb_editors_picks',array('sort'),$sort," pick_id='".$less_result['pick_id']."'");
}
}
}
}
/**
* Function used to move pic up
*/
function move_pick_down($id)
{
global $db;
$result = $db->select("cb_editors_picks","*"," pick_id='$id'");
if($db->num_rows>0)
{
$result = $result[0];
$sort = $result['sort'];
if($sort<get_highest_sort_number())
{
$less_result = $db->select("cb_editors_picks","*"," sort>$sort",1);
if($db->num_rows>0)
{
$less_result = $less_result[0];
$new_sort = $less_result['sort'];
$db->update('cb_editors_picks',array('sort'),$new_sort," pick_id='$id'");
$db->update('cb_editors_picks',array('sort'),$sort," pick_id='".$less_result['pick_id']."'");
}
}
}
}
/**
* Function used to display editors pick
*/
function show_editor_pick()
{
echo '<div id="editors_pick" style="padding-bottom:10px">
This content requires JavaScript and Macromedia Flash Player 7 or higher. <a href=http://www.macromedia.com/go/getflash/>Get Flash</a><br/><br/>
</div>
<script type="text/javascript">
var ep = new FlashObject("'.BASEURL.'/plugins/editors_pick/editors_pick_player.swf?xmlfile='.BASEURL.'/plugins/editors_pick/editors_pick_player.php", "sotester", "340", "243", "9", "#FFFFFF");
ep.addParam("wmode", "opaque");
ep.addParam("allowFullScreen", "true");
ep.write("editors_pick");
</script>';
}
//Adding Editor's Pick Link
$cbvid->video_manager_links[] = 'video_manager_ep_link';
//Calling Editor Picks Function
$cbvid->video_manager_funcs[] = 'editors_pick';
//ADding Admin Menu
add_admin_menu('Videos','Editor\'s Pick','editor_pick.php');
//Adding Anchor Function
register_anchor_function(array('show_editor_pick'=>'index_right_top'));
//Registering Delete Action
register_action_remove_video('remove_vid_editors_pick');
}
?>

View file

@ -0,0 +1,27 @@
<?php
require_once('../includes/common.php');
//Creating Table for anncoument if not exists
function install_editors_pick()
{
global $db;
$db->Execute(
"CREATE TABLE IF NOT EXISTS `cb_editors_picks` (
`pick_id` int(225) NOT NULL AUTO_INCREMENT,
`videoid` int(225) NOT NULL,
`sort` bigint(5) NOT NULL DEFAULT '1',
`date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`pick_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;"
);
//inserting new announcment
$db->Execute("INSERT INTO cb_global_announcement (announcement) VALUES ('')");
}
//This will first check if plugin is installed or not, if not this function will install the plugin details
install_editors_pick();
?>

View file

@ -0,0 +1,12 @@
<?php
//Function used to uninstall Plugin
function un_install_editors_pick()
{
global $db;
$db->Execute(
'DROP TABLE `cb_editors_picks`'
);
}
un_install_editors_pick();
?>

View file

@ -1,3 +1,6 @@
<!-- Video Box -->
{if $display_type =='normal' || $display_type==''}
<div class="video_block" align="center" {if $only_once} style="float:none" {/if}>
<div class="vdo_thumb_container" id="video_{$video.videoid}">
<a href="{videoLink vdetails=$video}"><img src="{getThumb vdetails=$video}" width="120" height="90" border="0" {ANCHOR place="video_thumb"} /></a>
@ -9,4 +12,32 @@
{if $only_once}
<div class="clear"></div>
{/if}
{/if}
{/if}
<!-- Video Box -->
<!-- Video Box verticle-->
{if $display_type =='verticle'}
<div class="video_block_verticle" align="center" {if $only_once} style="float:none" {/if}>
<div class="vdo_thumb_container" id="video_{$video.videoid}" style="float:left;" >
<a href="{videoLink vdetails=$video}"><img src="{getThumb vdetails=$video}" width="120" height="90" border="0" {ANCHOR place="video_thumb"} /></a>
{ANCHOR place="video_thumb_div" data=$video}
<span class="vdo_duration">{$video.duration|SetTime:false}</span>
</div>
<div style="float:right; width:120px" align="left">
<div style="height:33px">
<a href="{videoLink vdetails=$video}">{$video.title|truncate:40}</a></div>
<div style="height:30px; font-size:10px; color:#666">{$video.views|number_format} {lang code='views'}<br />
{$video.comments_count|number_format} {lang code='comments'}</div>
by <a href="{$userquery->profile_link($video.userid)}">{$userquery->get_user_field_only($video.userid,'username')}</a> {show_rating class='small_stars' rating='$videos.rating' ratings='$videos.rated_by' total='10'}</div></div>
{if $only_once}
<div class="clear"></div>
{/if}
{/if}
<!-- Video Box verticle-->

View file

@ -6,7 +6,7 @@
{if !$userquery->login_check('',true)}
Welcome Guest, Click here to <a href="{link name='login' }">Login</a> or <a href="{link name='signup' }">Register</a>
{else}
Hello {$userquery->username} | <a href="#">Inbox ({$cbpm->get_new_messages()}) </a>| <a href="#">Notifications ({$cbpm->get_new_messages('','notification')})</a> | <a href="#">Account</a> | <a href="#">Videos</a>
Hello {$userquery->username} | <a href="#">Inbox ({$cbpm->get_new_messages()}) </a>| <a href="#">Notifications ({$cbpm->get_new_messages('','notification')})</a> | <a href="{link name='my_account'}">Account</a> | <a href="#">Videos</a>
{/if}
</div>
<div class="clear"></div>

View file

@ -1,4 +1,104 @@
asdasd
asd
asd
as
<div class="index_left_column">
<!-- Videos Beign Watched -->
<div class="index_box">
<div class="heading">Videos Being Watched</div>
<div class="content">
{section name=vlist loop=$being_watched}
{include file="$style_dir/blocks/video.html" video=$being_watched[vlist] display_type="verticle"}
{sectionelse}
No Videos
{/section}
<div class="clear"></div>
</div>
</div>
<!-- Featured Videos -->
<div class="index_box">
<div class="heading">Featured Video</div>
<div class="content">
{section name=vlist loop=$featured_videos}
{include file="$style_dir/blocks/video.html" video=$featured_videos[vlist] display_type="normal"}
{sectionelse}
No Featured Videos
{/section}
<div class="clear"></div>
</div>
</div>
<!-- Recently Added Videos -->
<div class="index_box">
<div class="heading">Recently Added Video</div>
<div class="content">
{section name=vlist loop=$recently_added}
{include file="$style_dir/blocks/video.html" video=$recently_added[vlist] display_type="normal"}
{sectionelse}
No Featured Videos
{/section}
<div class="clear"></div>
</div>
</div>
</div>
<div class="index_right_column">
<!-- Editor's Pick, Top Place-->
<div class="index_box">
<div class="heading">Editor's Picks</div>
<div class="content">
{ANCHOR place='index_right_top'}
</div>
</div>
<!-- Login Box -->
{if !$userquery->login_check('',true)}
<div class="index_box">
<div class="heading">Login Now</div>
<div class="content">
<form id="login_form" name="login" method="post" action="{link name='login'}" class="index_login">
<label for="username">Username</label><br />
<input type="text" name="username" id="username" />
<label for="password"><br />
Password</label><br />
<input type="password" name="password" id="password" /><br />
<button type="submit" class="cb_button" value="Login" name="login">Login</button> or<a href="{link name='signup'}"> Signup Here</a>
</form>
</div>
</div>
{else}
<!-- User Box -->
<div class="index_box">
<div class="heading">My Account</div>
<div class="content">
{assign var=user value=$userquery->get_user_details($userquery->userid)}
<div class="account_thumb_container" align="center">
<a href="{$userquery->profile_link($user)}"><img src="{$userquery->getUserThumb($user)}" alt="{$user.username}" class="account_thumb" style="max-width:100px"><br />
View Profile / Channel </a><br />
<a href="{link name='my_account'}">My Account</a><br />
</div>
<div class="stats" style="width:200px">
<span class="account_stat">username : <strong>{$user.username}</strong></span>
<span class="account_stat">joined : <strong>{$user.doj|date_format}</strong></span>
<span class="account_stat">last logged in : <strong>{$user.last_logged|nicetime}</strong></span>
<span class="account_stat">last active : <strong>{$user.last_active|nicetime}</strong></span>
<span class="account_stat">total logins : <strong>{$user.num_visits|number_format}</strong></span>
<span class="account_stat">profile views: <strong>{$user.profile_hits|number_format}</strong></span>
<span class="account_stat">total videos: <strong>{$user.total_videos|number_format}</strong></span>
<span class="account_stat">total videos watched: <strong>{$user.total_watched|number_format}</strong></span>
<span class="account_stat">subscribers: <strong>{$user.subscribers|number_format}</strong></span>
<span class="account_stat">country: <strong>{$user.country|country}</strong></span>
</div>
<div class="clear"></div>
</div>
</div>
{/if}
<!-- Ad Box -->
<div align="center">{AD place=336x280}</div>
<!-- Ad Box End -->
</div>

View file

@ -1,7 +1,7 @@
@charset "utf-8";
/* CSS Document */
.video_block{width:130px; margin:5px; float:left}
.video_block_verticle{width:250px; margin:5px; float:left}
/* Category List */
.category_list{width:160px; float:left; margin-right:10px;}
.category_list ul, .category_list ul li{margin:0px; padding:0px; list-style:none}

View file

@ -104,4 +104,18 @@ a{text-decoration:none; font-family:Arial, Helvetica, sans-serif;color:#333; }
.reply_icon{background-position:-30px -63px }
.video_control{font-weight:normal; margin-left:10px; font-size:10px}
.arrow_pointing{background-position:-0px -78px; width:24px; height:14px;}
.arrow_pointing{background-position:-0px -78px; width:24px; height:14px;}
/**
index
*/
.index_left_column{width:600px; float:left}
.index_box{}
.index_box .heading{ display:block; border-radius-topleft:5px; -webkit-border-radius-topleft:5px; -moz-border-radius-topleft:5px; border:1px solid #CCC; font-size:15px; font-weight:bold;border-radius-topright:5px; -webkit-border-radius-topright:5px; -moz-border-radius-topright:5px; padding:5px ; border-bottom:0px;}
.index_box .content{ display:block; border-radius-bottomleft:5px; -webkit-border-radius-bottomleft:5px; -moz-border-radius-bottomleft:5px; border:1px solid #CCC; font-size:12px; font-weight:bold;border-radius-bottomright:5px; -webkit-border-radius-bottomright:5px; -moz-border-radius-bottomright:5px; padding:5px ; border-top:0px; margin-bottom:15px}
.index_right_column{float:right; width:350px; margin-right:5px}
.index_login{padding:10px}
.index_login,.index_login a{font-size:16px; font-weight:bold}
.index_login input{border:1px solid #999; width:300px; padding:5px; margin-bottom:10px}