ADDED : Actions System
ADDED : New Flag System ADDED : New Favorite System ADDED : New Sharing System UPDATE : FFMPEG CLASS ADDED : cbmail class UPDATE : NEW EMAIL FUNCTION
This commit is contained in:
parent
6a55148e3d
commit
6d08adb03b
20 changed files with 739 additions and 457 deletions
|
@ -127,7 +127,7 @@ include('../includes/config.inc.php');
|
|||
exit(0);
|
||||
}else{
|
||||
$Upload->add_conversion_queue($file_name);
|
||||
exec(php_path()." -q ".BASEDIR."/actions/video_convert.php &> /dev/null &");
|
||||
//exec(php_path()." -q ".BASEDIR."/actions/video_convert.php &> /dev/null &");
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* Software : ClipBucket v2
|
||||
* License : CBLA
|
||||
**/
|
||||
ini_set('mysql.connect_timeout','6000');
|
||||
|
||||
|
||||
include(dirname(__FILE__)."/../includes/config.inc.php");
|
||||
|
||||
$SYSTEM_OS = $row['sys_os'] ? $row['sys_os'] : 'linux';
|
||||
|
@ -65,9 +65,10 @@ rename($temp_file,$orig_file);
|
|||
$ffmpeg->gen_big_thumb = TRUE;
|
||||
$ffmpeg->output_file = VIDEOS_DIR.'/'.$tmp_file.'.flv';
|
||||
$ffmpeg->hq_output_file = VIDEOS_DIR.'/'.$tmp_file.'.mp4';
|
||||
$ffmpeg->h264_single_pass = TRUE;
|
||||
$ffmpeg->remove_input=FALSE;
|
||||
$ffmpeg->ClipBucket();
|
||||
//Converting File In HD Format
|
||||
$ffmpeg->convert_to_hd();
|
||||
|
||||
$db->update("conversion_queue",
|
||||
array("cqueue_conversion"),
|
||||
|
@ -75,7 +76,6 @@ rename($temp_file,$orig_file);
|
|||
|
||||
update_processed_video($queue_details);
|
||||
|
||||
|
||||
/**
|
||||
* Calling Functions before converting Video
|
||||
*/
|
||||
|
|
|
@ -19,9 +19,9 @@ Website : <a href="{$curplayer.website}">{$curplayer.website}</a></td>
|
|||
|
||||
<hr size="1" noshade />
|
||||
|
||||
<div class="setting_title">Change Player Size</div>
|
||||
<div class="setting_title"><a href="javascript:void(0)" onclick="$('#player_size').toggle()">Change Player Size</a></div>
|
||||
<div id="msg_box" style="margin:5px;"></div>
|
||||
<div>
|
||||
<div id="player_size" style="display:none">
|
||||
{literal}
|
||||
<style type="text/css">
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ a{font-size:12px; font-weight:bold; text-decoration:none; color:#147dc3; font-fa
|
|||
|
||||
|
||||
.setting_title{font-size:18px; margin-bottom:5px 0px 5px 0px;}
|
||||
.setting_title a{font-size:18px; }
|
||||
/**
|
||||
* Forms
|
||||
*/
|
||||
|
|
|
@ -36,6 +36,21 @@ class ClipBucket
|
|||
var $before_convert_functions = array();
|
||||
var $after_convert_functions = array();
|
||||
|
||||
|
||||
/**
|
||||
* This array contains
|
||||
* all functions that are called
|
||||
* when we call video to play on watch_video page
|
||||
*/
|
||||
var $watch_video_functions = array();
|
||||
|
||||
|
||||
/**
|
||||
* Email Function list
|
||||
*/
|
||||
var $email_functions = array();
|
||||
|
||||
|
||||
function ClipBucket ()
|
||||
{
|
||||
global $pages;
|
||||
|
@ -57,6 +72,7 @@ class ClipBucket
|
|||
'redir.js' => 'global',
|
||||
'functions.js' => 'global',
|
||||
'swfobject.js' => 'global',
|
||||
'swfobject.obj.js' => 'global',
|
||||
));
|
||||
|
||||
//This is used to create Admin Menu
|
||||
|
@ -343,7 +359,7 @@ class ClipBucket
|
|||
|
||||
define('TEMPLATE',$template);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
240
upload/includes/classes/actions.class.php
Normal file
240
upload/includes/classes/actions.class.php
Normal file
|
@ -0,0 +1,240 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This class is used to perform
|
||||
* Add to favorits
|
||||
* Flag content
|
||||
* share content
|
||||
* rate content
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class cbactions
|
||||
{
|
||||
/**
|
||||
* Defines what is the type of content
|
||||
* v = video
|
||||
* p = pictures
|
||||
* g = groups etc
|
||||
*/
|
||||
|
||||
var $type = 'v';
|
||||
|
||||
/**
|
||||
* Defines whats the name of the object
|
||||
* weather its 'video' , its 'picture' or its a 'group'
|
||||
*/
|
||||
var $name = 'video';
|
||||
|
||||
/**
|
||||
* Defines the database table name
|
||||
* that stores all information about these actions
|
||||
*/
|
||||
var $fav_tbl = 'favorites';
|
||||
var $flag_tbl = 'flags';
|
||||
|
||||
/**
|
||||
* Class variable ie $somevar = SomeClass;
|
||||
* $obj_class = 'somevar';
|
||||
*/
|
||||
var $obj_class = 'cbvideo';
|
||||
|
||||
|
||||
/**
|
||||
* Defines function name that is used to check
|
||||
* weather object exists or not
|
||||
* ie video_exists
|
||||
* it will be called as ${$this->obj_class}->{$this->check_func}($id);
|
||||
*/
|
||||
var $check_func = 'video_exists';
|
||||
|
||||
/**
|
||||
* This holds all options that are listed when user wants to report
|
||||
* a content ie - copyrighted content - voilance - sex or something alike
|
||||
* ARRAY = array('Copyrighted','Nudity','bla','another bla');
|
||||
*/
|
||||
var $report_opts = array('Inappropriate Content','Copyright infringement','Sexual Content','Violance or repulsive content','Spam','Disturbing','Other');
|
||||
|
||||
|
||||
/**
|
||||
* share email template name
|
||||
*/
|
||||
var $share_template_name = 'video_share_template';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Var Array for replacing text of email templates
|
||||
* see docs.clip-bucket.com for more details
|
||||
*/
|
||||
var $val_array = array();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function used to add content to favorits
|
||||
*/
|
||||
|
||||
function add_to_fav($id)
|
||||
{
|
||||
global $db;
|
||||
//First checking weather object exists or not
|
||||
if($this->exists($id))
|
||||
{
|
||||
if(userid())
|
||||
{
|
||||
if(!$this->fav_check($id))
|
||||
{
|
||||
$db->insert($this->fav_tbl,array('type','id','userid','date_added'),array($this->type,$id,userid(),NOW()));
|
||||
e(sprintf(lang('add_fav_message'),$this->name),m);
|
||||
}else{
|
||||
e(sprintf(lang('already_fav_message'),$this->name));
|
||||
}
|
||||
}else{
|
||||
e(lang("you_not_logged_in"));
|
||||
}
|
||||
}else{
|
||||
e(sprintf(lang("obj_not_exists"),$this->name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function add_to_favorites($id){ return $this->add_to_fav($id); }
|
||||
function add_favorites($id){ return $this->add_to_fav($id); }
|
||||
function add_fav($id){ return $this->add_to_fav($id); }
|
||||
|
||||
/**
|
||||
* Function used to check weather object already added to favorites or not
|
||||
*/
|
||||
function fav_check($id)
|
||||
{
|
||||
global $db;
|
||||
$results = $db->select($this->fav_tbl,"favorite_id"," id='".$id."' AND userid='".userid()."'");
|
||||
if($db->num_rows>0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to check weather object exists or not
|
||||
*/
|
||||
function exists($id)
|
||||
{
|
||||
$obj = $this->obj_class;
|
||||
global ${$obj};
|
||||
$obj = ${$obj};
|
||||
$func = $this->check_func;
|
||||
return $obj->{$func}($id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to report a content
|
||||
*/
|
||||
|
||||
function report_it($id)
|
||||
{
|
||||
global $db;
|
||||
//First checking weather object exists or not
|
||||
if($this->exists($id))
|
||||
{
|
||||
if(userid())
|
||||
{
|
||||
if(!$this->report_check($id))
|
||||
{
|
||||
$db->insert($this->flag_tbl,array('type','id','userid','flag_type','date_added'),
|
||||
array($this->type,$id,userid(),post('flag_type'),NOW()));
|
||||
e(sprintf(lang('obj_report_msg'),$this->name),m);
|
||||
}else{
|
||||
e(sprintf(lang('obj_report_err'),$this->name));
|
||||
}
|
||||
}else{
|
||||
e(lang("you_not_logged_in"));
|
||||
}
|
||||
}else{
|
||||
e(sprintf(lang("obj_not_exists"),$this->name));
|
||||
}
|
||||
}
|
||||
function flag_it($id){ return $this->report_id($id); }
|
||||
|
||||
/**
|
||||
* Function used to check weather user has already reported the object or not
|
||||
*/
|
||||
function report_check($id)
|
||||
{
|
||||
global $db;
|
||||
$results = $db->select($this->flag_tbl,"flag_id"," id='".$id."' AND userid='".userid()."'");
|
||||
if($db->num_rows>0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function used to content
|
||||
*/
|
||||
function share_content($id)
|
||||
{
|
||||
global $db,$userquery;
|
||||
$ok = true;
|
||||
$tpl = $this->share_template_name;
|
||||
$var = $this->val_array;
|
||||
|
||||
//First checking weather object exists or not
|
||||
if($this->exists($id))
|
||||
{
|
||||
if(userid())
|
||||
{
|
||||
$users = mysql_clean(post('users'));
|
||||
$users = explode(',',$users);
|
||||
if(is_array($users))
|
||||
{
|
||||
foreach($users as $user)
|
||||
{
|
||||
if(!$userquery->user_exists($user) && !isValidEmail($user))
|
||||
{
|
||||
e(sprintf(lang('user_no_exist_wid_username'),$user));
|
||||
$ok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
$email = $user;
|
||||
if(!isValidEmail($user))
|
||||
$email = $userquery->get_user_field_only($user,'email');
|
||||
$emails_array[] = $email;
|
||||
}
|
||||
|
||||
if($ok)
|
||||
{
|
||||
global $cbemail;
|
||||
$tpl = $cbemail->get_template($tpl);
|
||||
$more_var = array
|
||||
('{user_message}' => post('message'),);
|
||||
$var = array_merge($more_var,$var);
|
||||
$subj = $cbemail->replace($tpl['email_template_subject'],$var);
|
||||
$msg = $cbemail->replace($tpl['email_template'],$var);
|
||||
|
||||
//Setting Emails
|
||||
$emails = implode(',',$emails_array);
|
||||
//Now Finally Sending Email
|
||||
cbmail(array('to'=>$emails,'from'=>username(),'subject'=>$subj,'content'=>$msg));
|
||||
}
|
||||
}else{
|
||||
e(sprintf(lang("share_video_no_user_err"),$this->name));
|
||||
}
|
||||
|
||||
}else{
|
||||
e(lang("you_not_logged_in"));
|
||||
}
|
||||
}else{
|
||||
e(sprintf(lang("obj_not_exists"),$this->name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
88
upload/includes/classes/cbemail.class.php
Normal file
88
upload/includes/classes/cbemail.class.php
Normal file
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* It is better to keep everything sperated
|
||||
* and code properly
|
||||
* so i created this file coz i like it this way :p
|
||||
*
|
||||
*
|
||||
* Author : Arslan
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class CBEmail
|
||||
{
|
||||
|
||||
var $db_tpl = 'email_templates';
|
||||
|
||||
function cbemail()
|
||||
{
|
||||
//Constructor - do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to get email tempalate from database
|
||||
*/
|
||||
function get_email_template($code)
|
||||
{
|
||||
global $db;
|
||||
$result = $db->select($this->db_tpl,"*"," email_template_code='".$code."'");
|
||||
if($db->num_rows>0)
|
||||
{
|
||||
return $result[0];
|
||||
}else
|
||||
return false;
|
||||
}
|
||||
function get_template($code)
|
||||
{
|
||||
return $this->get_email_template($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check template exists or not
|
||||
*/
|
||||
function template_exists($code)
|
||||
{
|
||||
return $this->get_email_template($code);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to replace content
|
||||
* of email template with variables
|
||||
* it can either be email subject or message content
|
||||
* @param : Content STRING
|
||||
* @param : array ARRAY => array({somevar}=>$isvar)
|
||||
*/
|
||||
function replace($content,$array)
|
||||
{
|
||||
//Common Varialbs
|
||||
|
||||
$com_array = array
|
||||
('{website_title}' => TITLE,
|
||||
'{baseurl}' => BASEURL,
|
||||
'{website_url}' => BASEURL,
|
||||
'{date_format}' => cbdate(DATE_FORMAT),
|
||||
'{date}' => cbdate(),
|
||||
'{username}' => username(),
|
||||
'{userid}' => userid(),
|
||||
'{date_year}' => cbdate("Y"),
|
||||
'{date_month}' => cbdate("m"),
|
||||
'{date_day}' => cbdate("d"),
|
||||
);
|
||||
|
||||
if(is_array($array) && count($array)>0)
|
||||
$array = array_merge($com_array,$array);
|
||||
else
|
||||
$array = $com_array;
|
||||
foreach($array as $key => $val)
|
||||
{
|
||||
$var_array[] = '/'.$key.'/';
|
||||
$val_array[] = $val;
|
||||
}
|
||||
return preg_replace($var_array,$val_array,$content);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -14,6 +14,22 @@
|
|||
**************************************************************************************************
|
||||
Copyright (c) 2007-2008 Clip-Bucket.com. All rights reserved.
|
||||
**************************************************************************************************
|
||||
|
||||
DEPRECATED
|
||||
check_user
|
||||
check_email
|
||||
DeleteFlv
|
||||
DeleteOriginal
|
||||
DeleteThumbs
|
||||
DeleteVideoFiles
|
||||
UpdateVideo
|
||||
GetCategory
|
||||
RateVideo
|
||||
AddComment
|
||||
AddToFavourite
|
||||
FlagAsInappropriate
|
||||
DeleteFlag
|
||||
|
||||
**/
|
||||
|
||||
class myquery {
|
||||
|
@ -27,187 +43,75 @@ class myquery {
|
|||
|
||||
//Updating Plugin Details
|
||||
function Set_Plugin_Details($name,$value){
|
||||
mysql_query("UPDATE plugin_config SET plugin_config_value = '".$value."' WHERE plugin_config_name ='".$name."'");
|
||||
mysql_query("UPDATE plugin_config SET plugin_config_value = '".$value."' WHERE plugin_config_name ='".$name."'");
|
||||
}
|
||||
|
||||
function Set_Email_Settings($name,$value){
|
||||
mysql_query("UPDATE email_settings config SET email_settings_value = '".$value."' WHERE email_settings_name ='".$name."'");
|
||||
mysql_query("UPDATE email_settings config SET email_settings_value = '".$value."' WHERE email_settings_name ='".$name."'");
|
||||
}
|
||||
function Set_Email_Settings_Headers($name,$header){
|
||||
mysql_query("UPDATE email_settings config SET email_settings_headers = '".$header."' WHERE email_settings_name ='".$name."'");
|
||||
mysql_query("UPDATE email_settings config SET email_settings_headers = '".$header."' WHERE email_settings_name ='".$name."'");
|
||||
}
|
||||
|
||||
function Get_Website_Details(){
|
||||
$query = mysql_query("SELECT * FROM config");
|
||||
while($row = mysql_fetch_array($query)){
|
||||
$name = $row['name'];
|
||||
$data[$name] = $row['value'];
|
||||
}
|
||||
return $data;
|
||||
$query = mysql_query("SELECT * FROM config");
|
||||
while($row = mysql_fetch_array($query))
|
||||
{
|
||||
$name = $row['name'];
|
||||
$data[$name] = $row['value'];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function Get_Plugin_Details(){
|
||||
$query = mysql_query("SELECT * FROM plugin_config");
|
||||
if(mysql_num_rows($query) > 0)
|
||||
{
|
||||
while($row = mysql_fetch_array($query)){
|
||||
$name = $row['plugin_config_name'];
|
||||
$data[$name] = $row['plugin_config_value'];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
$query = mysql_query("SELECT * FROM plugin_config");
|
||||
if(mysql_num_rows($query) > 0)
|
||||
{
|
||||
while($row = mysql_fetch_array($query)){
|
||||
$name = $row['plugin_config_name'];
|
||||
$data[$name] = $row['plugin_config_value'];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
function Get_Email_Settings(){
|
||||
$query = mysql_query("SELECT * FROM email_settings");
|
||||
while($row = mysql_fetch_array($query)){
|
||||
$name = $row['email_settings_name'];
|
||||
$data[$name] = $row['email_settings_value'];
|
||||
}
|
||||
return $data;
|
||||
$query = mysql_query("SELECT * FROM email_settings");
|
||||
while($row = mysql_fetch_array($query)){
|
||||
$name = $row['email_settings_name'];
|
||||
$data[$name] = $row['email_settings_value'];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function Get_Email_Settings_Headers(){
|
||||
$query = mysql_query("SELECT * FROM email_settings");
|
||||
while($row = mysql_fetch_array($query)){
|
||||
$name = $row['email_settings_name'];
|
||||
$data[$name] = $row['email_settings_headers'];
|
||||
}
|
||||
return $data;
|
||||
$query = mysql_query("SELECT * FROM email_settings");
|
||||
while($row = mysql_fetch_array($query)){
|
||||
$name = $row['email_settings_name'];
|
||||
$data[$name] = $row['email_settings_headers'];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function check_user($username){
|
||||
$query = mysql_query("SELECT * FROM users WHERE username ='".$username."'");
|
||||
if(mysql_num_rows($query) > 0){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function check_email($email){
|
||||
$query = mysql_query("SELECT * FROM users WHERE email ='".$email."'");
|
||||
if(mysql_num_rows($query) > 0){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Function Used to Delete Flv File
|
||||
|
||||
function DeleteFlv($flv){
|
||||
$file = BASEDIR.'/files/videos/'.$flv;
|
||||
if(file_exists($file) && !empty($flv)){
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
//Function Used To Delete the Original Video
|
||||
|
||||
function DeleteOriginal($file){
|
||||
$file_path = BASEDIR.'/files/original/'.$file;
|
||||
if(file_exists($file_path) && !empty($file)){
|
||||
unlink($file_path);
|
||||
}
|
||||
}
|
||||
|
||||
//Function Used to Delete Video Thumbs
|
||||
|
||||
function DeleteThumbs($flv){
|
||||
$thumb = substr($flv, 0, strrpos($flv, '.'));
|
||||
$thumb1 = BASEDIR."/files/thumbs/".$thumb."-1.jpg";
|
||||
$thumb2 = BASEDIR."/files/thumbs/".$thumb."-2.jpg";
|
||||
$thumb3 = BASEDIR."/files/thumbs/".$thumb."-3.jpg";
|
||||
$thumb4 = BASEDIR."/files/thumbs/".$thumb."-big.jpg";
|
||||
|
||||
if(file_exists($thumb1)){
|
||||
unlink($thumb1);
|
||||
}
|
||||
if(file_exists($thumb2)){
|
||||
unlink($thumb2);
|
||||
}
|
||||
if(file_exists($thumb3)){
|
||||
unlink($thumb3);
|
||||
}
|
||||
if(file_exists($thumb4)){
|
||||
unlink($thumb4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Function Used to Check Weather Video Exists or not
|
||||
function video_exists($videoid)
|
||||
{
|
||||
return $this->VideoExists($videoid);
|
||||
}
|
||||
function VideoExists($videoid){
|
||||
global $cbvid;
|
||||
return $cbvid->exists($videoid);
|
||||
}
|
||||
function VideoExists($videoid){global $cbvid;return $cbvid->exists($videoid);}
|
||||
function video_exists($videoid){return $this->VideoExists($videoid);}
|
||||
function CheckVideoExists($videokey){return $this->VideoExists($videokey);}
|
||||
|
||||
//Function Used to Delete Video Files
|
||||
|
||||
function DeleteVideoFiles($videoid){
|
||||
$query = mysql_query("SELECT * FROM video WHERE videoid ='".$videoid."'");
|
||||
$data = mysql_fetch_array($query);
|
||||
$flv = $data['flv'];
|
||||
$query = mysql_query("SELECT * FROM video_detail WHERE flv ='".$data['flv']."'");
|
||||
$data = mysql_fetch_array($query);
|
||||
|
||||
//Updating Users Number Of Videos Added By User
|
||||
$videos_query = mysql_query("SELECT * FROM video WHERE username='".@$data['username']."'");
|
||||
|
||||
$this->DeleteOriginal($data['original']);
|
||||
$this->DeleteFlv($data['flv']);
|
||||
$this->DeleteThumbs($data['flv']);
|
||||
mysql_query("DELETE FROM video_detail WHERE flv='".$data['flv']."'");
|
||||
|
||||
$videoscount = mysql_num_rows($videos_query);
|
||||
$updatequery = mysql_query("UPDATE users SET total_videos='".$videoscount."' WHERE username = '".@$username."'");
|
||||
}
|
||||
|
||||
//Function Delete Video
|
||||
//Function used to Delete Video
|
||||
|
||||
function DeleteVideo($videoid){
|
||||
global $LANG,$stats;
|
||||
$this->DeleteVideoFiles($videoid);
|
||||
$this->DeleteFlag($videoid);
|
||||
$this->RemoveFavourite($videoid,NULL,2);
|
||||
mysql_query("DELETE FROM video WHERE videoid='".$videoid ."'");
|
||||
$msg = e($LANG['class_vdo_del_msg'],m);
|
||||
$stats->UpdateVideoRecord(2);
|
||||
return $msg;
|
||||
}
|
||||
|
||||
//Function Used to Make Video Featured
|
||||
|
||||
function MakeFeaturedVideo($videoid){
|
||||
global $cbvid;
|
||||
return $cbvid->action('feature',$videoid);
|
||||
}
|
||||
|
||||
//Function Used to Make Video UnFeatured
|
||||
|
||||
function MakeUnFeaturedVideo($videoid){
|
||||
global $cbvid;
|
||||
return $cbvid->action('unfeature',$videoid);
|
||||
}
|
||||
|
||||
//Function Used to Activate Vide
|
||||
|
||||
function ActivateVideo($videoid){
|
||||
global $cbvid;
|
||||
return $cbvid->action('activate',$videoid);
|
||||
}
|
||||
|
||||
//Function Used to Deactivate Video
|
||||
|
||||
function DeActivateVideo($videoid){
|
||||
global $cbvid;
|
||||
return $cbvid->action('deactivate',$videoid);
|
||||
return $cbvid->delete_video($videoid);
|
||||
}
|
||||
|
||||
//Video Actions - All Moved to video.class.php
|
||||
function MakeFeaturedVideo($videoid){global $cbvid;return $cbvid->action('feature',$videoid);}
|
||||
function MakeUnFeaturedVideo($videoid){global $cbvid;return $cbvid->action('unfeature',$videoid);}
|
||||
function ActivateVideo($videoid){global $cbvid;return $cbvid->action('activate',$videoid);}
|
||||
function DeActivateVideo($videoid){global $cbvid;return $cbvid->action('deactivate',$videoid);}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -215,228 +119,13 @@ class myquery {
|
|||
* from video table
|
||||
* @param INPUT vid or videokey
|
||||
*/
|
||||
function get_video_details($vid)
|
||||
{
|
||||
global $cbvid;
|
||||
return $cbvid->get_video($vid);
|
||||
}
|
||||
function GetVideoDetails($video){
|
||||
return $this->get_video_details($video);
|
||||
}
|
||||
|
||||
|
||||
//Function Used To Update Video Details
|
||||
|
||||
function UpdateVideo($video){
|
||||
global $LANG,$Upload;
|
||||
function get_video_details($vid){global $cbvid;return $cbvid->get_video($vid);}
|
||||
function GetVideoDetails($video){return $this->get_video_details($video);}
|
||||
function GetVideDetails($video){return $this->get_video_details($video);}
|
||||
|
||||
$title = mysql_clean($_POST['title']);
|
||||
$description = mysql_clean($_POST['description']);
|
||||
$tags = mysql_clean($_POST['tags']);
|
||||
$broadcast = $_POST['broadcast'];
|
||||
$comments = $_POST['comments'];
|
||||
$comment_voting = $_POST['comment_voting'];
|
||||
$rating = $_POST['rating'];
|
||||
$embedding = $_POST['embedding'];
|
||||
$country = mysql_clean($_POST['country']);
|
||||
$location = mysql_clean($_POST['location']);
|
||||
|
||||
if(!empty($_POST['year']) && !empty($_POST['day']) && !empty($_POST['month'])){
|
||||
$date = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'];
|
||||
}
|
||||
|
||||
$sql = mysql_query("SELECT * from category");
|
||||
$total_categories = mysql_num_rows($sql);
|
||||
|
||||
for($id=0;$id<=$total_categories;$id++){
|
||||
@$category = $_POST['category'][$id];
|
||||
if(!empty($category)){
|
||||
$selected[] = $category ;
|
||||
}
|
||||
}
|
||||
$category01 = $selected[0];
|
||||
@$category02 = $selected[1];
|
||||
@$category03 = $selected[2];
|
||||
|
||||
//If Video Is Updated via Admin Panel
|
||||
if($_POST['admin']=='true'){
|
||||
if(!empty($_POST['duration'])){
|
||||
$add_query = ",duration='".$_POST['duration']."'";
|
||||
}
|
||||
if(!empty($_POST['embed_code'])){
|
||||
$embedCode = $Upload->CleanEmbedCode($_POST['embed_code']);
|
||||
$add_query .= ",embed_code='".$embedCode."'";
|
||||
}
|
||||
if(!empty($_POST['flv_file_url'])){
|
||||
$file_url = mysql_clean($_POST['flv_file_url']);
|
||||
$add_query .= ",flv_file_url='".$file_url."'";
|
||||
}
|
||||
if(!empty($_POST['embeded'])){
|
||||
$add_query .= ",embeded='".$_POST['embeded']."'";
|
||||
}
|
||||
$add_query .= ",status='".$_POST['status']."'";
|
||||
|
||||
//Stats Update
|
||||
//Views
|
||||
$views = $_POST['views'];
|
||||
if(is_numeric($views) && $views > 0)
|
||||
$add_query .= ",views='".$views."'";
|
||||
//Rating
|
||||
$Totalrating = $_POST['Totalrating'];
|
||||
if(is_numeric($Totalrating)){
|
||||
$Totalrating = $Totalrating <=10 ? $Totalrating : '10';
|
||||
$Totalrating = $Totalrating >=0 ? $Totalrating : '0';
|
||||
$add_query .= ",rating='".$Totalrating."'";
|
||||
}
|
||||
//RatedBy
|
||||
$rated_by = $_POST['rated_by'];
|
||||
if(is_numeric($rated_by) && $rated_by> 0)
|
||||
$add_query .= ",rated_by='".$rated_by."'";
|
||||
}
|
||||
|
||||
mysql_query("UPDATE video SET
|
||||
title = '".$title."',
|
||||
description = '".$description."',
|
||||
tags = '".$tags."',
|
||||
broadcast = '".$broadcast."',
|
||||
allow_comments = '".$comments."',
|
||||
comment_voting = '".$comment_voting."',
|
||||
allow_rating = '".$rating."',
|
||||
allow_embedding = '".$embedding."',
|
||||
country = '".$country."',
|
||||
location = '".$location."',
|
||||
category01 = '".$category01."',
|
||||
category02 = '".$category02."',
|
||||
category03 = '".$category03."',
|
||||
datecreated = '".@$date."'
|
||||
$add_query
|
||||
WHERE videoid = '".$video."'") or die(mysql_error());
|
||||
|
||||
$msg = e($LANG['class_vdo_update_msg'],m);
|
||||
return $msg;
|
||||
}
|
||||
|
||||
//Function Used To Check Video Exists or No
|
||||
|
||||
function CheckVideoExists($videokey){
|
||||
global $LANG;
|
||||
$query = mysql_query("SELECT * FROM video WHERE videokey ='".$videokey."'");
|
||||
if(mysql_num_rows($query)>0){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Function Used To Get Video Details VIA video Key
|
||||
|
||||
function GetVideDetails($vkey){
|
||||
global $LANG,$Cbucket;
|
||||
$query = mysql_query("SELECT * FROM video WHERE videokey = '".$vkey."' ");
|
||||
$data = mysql_fetch_array($query);
|
||||
return $data;
|
||||
}
|
||||
|
||||
//Function Used To Update Videos Views
|
||||
|
||||
function UpdateVideoViews($vkey){
|
||||
global $LANG,$stats;
|
||||
$data=$this->GetVideDetails($vkey);
|
||||
if(!isset($_COOKIE['video_'.$vkey])){
|
||||
$views = $data['views'] + 1;
|
||||
mysql_query("UPDATE video SET views = '".$views."',last_viewed=now() WHERE videokey = '".$vkey."'");
|
||||
$stats->UpdateVideoRecord(5);
|
||||
setcookie('video_'.$vkey,'watched',time()+3600);
|
||||
}
|
||||
}
|
||||
|
||||
//Function Used To Get Category Details
|
||||
|
||||
function GetCategory($category,$attr=NULL){
|
||||
global $LANG;
|
||||
$query = mysql_query("SELECT * FROM category WHERE categoryid='".$category."'");
|
||||
$data = mysql_fetch_array($query);
|
||||
if(empty($attr)){
|
||||
return $data;
|
||||
}else{
|
||||
return $data[$attr];
|
||||
}
|
||||
}
|
||||
|
||||
//Function Used To Get Duration
|
||||
|
||||
function GetVideoDetail($flv){
|
||||
global $LANG;
|
||||
$query = mysql_query("SELECT * FROM video_detail WHERE flv='".$flv."'");
|
||||
$data = mysql_fetch_array($query);
|
||||
return $data;
|
||||
}
|
||||
|
||||
//Function Used To Rate Video
|
||||
|
||||
function RateVideo($videoid,$userid,$rating){
|
||||
global $LANG;
|
||||
|
||||
$query = mysql_query("select rated_by,rating,voter_ids from video where videoid='".$videoid."'");
|
||||
$data = mysql_fetch_array($query);
|
||||
$voter_id = $data['voter_ids'];
|
||||
|
||||
$niddle = "|";
|
||||
$niddle .= $userid;
|
||||
$niddle .= "|";
|
||||
$flag = strstr($voter_id, $niddle);
|
||||
|
||||
if(empty($flag)){
|
||||
if ($voter_id == "")
|
||||
{
|
||||
$voter_id .= "|";
|
||||
}
|
||||
$voter_id .= $userid;
|
||||
$voter_id .= "|";
|
||||
$t = $data['rated_by'] * $data['rating'];
|
||||
$newrby = ($data['rated_by'] + 1);
|
||||
$newrate = ($t + $rating) / $newrby;
|
||||
mysql_query("UPDATE video set
|
||||
rated_by='".$newrby."',
|
||||
rating='".$newrate."',
|
||||
voter_ids='".$voter_id."'
|
||||
WHERE videoid='".$videoid."'");
|
||||
$details=$this->GetVideoDetails($videoid);
|
||||
|
||||
$msg = round(($details['rating']/2)*20,2);
|
||||
}else{
|
||||
$msg = "already_voted";
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
//Function Used To Add Comment
|
||||
|
||||
function AddComment($videoid,$comment,$replyto=0){
|
||||
global $row,$LANG,$stats;
|
||||
if($row['user_comment_opt1'] == 'yes')
|
||||
{
|
||||
if(empty($_SESSION['username'])){
|
||||
$msg[] = e($LANG['class_comment_err']);
|
||||
}else{
|
||||
if(empty($comment)){
|
||||
$msg[] = e($LANG['class_comment_err1']);
|
||||
}
|
||||
}
|
||||
if(empty($msg)){
|
||||
mysql_query("INSERT into video_comments(comment,username,videoid,date_added,reply_to,scorer_ids)VALUES('".$comment."','".$_SESSION['username']."','".$videoid."',now(),'".$replyto."','|".$_SESSION['userid']."|')");
|
||||
mysql_query("UPDATE video SET comments_count=comments_count+1 WHERE videoid = '".$videoid."'") or die(mysql_error());
|
||||
$msg[] = e($LANG['class_comment_msg'],m);
|
||||
$stats->UpdateVideoRecord(3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg[] = "Comments Disabled";
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
function UpdateVideoViews($vkey){increment_views($vkey,'video');}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -482,15 +171,8 @@ class myquery {
|
|||
e($LANG['no_comment_del_perm']);
|
||||
}
|
||||
}
|
||||
function DeleteComment($id,$videoid){return $this->delete_comment($videoid);}
|
||||
|
||||
|
||||
//function used to delete comment
|
||||
function DeleteComment($id,$videoid){
|
||||
global $LANG,$stats;
|
||||
mysql_query("DELETE FROM video_comments WHERE comment_id = '".$id."' OR reply_to='".$id."'");
|
||||
mysql_query("UPDATE video SET comments_count=comments_count-1 WHERE videoid = '".$videoid."'") or die(mysql_error());
|
||||
$stats->UpdateVideoRecord(4);
|
||||
}
|
||||
//Function Used To Rate Comments
|
||||
function RateComment($rate,$commentid){
|
||||
global $LANG;
|
||||
|
@ -520,43 +202,7 @@ class myquery {
|
|||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
//Function Used To Add Video To Favourites
|
||||
function AddToFavourite($userid,$videoid){
|
||||
global $LANG,$stats;
|
||||
$query = mysql_query("SELECT * FROM video_favourites WHERE userid='".$userid."' AND videoid='".$videoid."'");
|
||||
if(mysql_num_rows($query)>0){
|
||||
$msg = e($LANG['class_vdo_fav_err']);
|
||||
}else{
|
||||
if($userid !=0){
|
||||
mysql_query("INSERT INTO video_favourites(videoid,userid)VALUES('".$videoid."','".$userid."')");
|
||||
$msg = e($LANG['class_vdo_fav_msg'],m);
|
||||
$stats->UpdateVideoRecord(6);
|
||||
}
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
//Function Used To Flagg Video
|
||||
function FlagAsInappropriate($username,$videoid){
|
||||
global $LANG;
|
||||
$query = mysql_query("SELECT * FROM flagged_videos WHERE username='".$username."' AND videoid='".$videoid."'");
|
||||
if(mysql_num_rows($query)>0){
|
||||
$msg = e($LANG['class_vdo_flag_err']);
|
||||
}else{
|
||||
mysql_query("INSERT INTO flagged_videos(videoid,username)VALUES('".$videoid."','".$username."')");
|
||||
$msg = e($LANG['class_vdo_flag_msg'],m);
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
//Function Delete Flag
|
||||
function DeleteFlag($videoid){
|
||||
global $LANG;
|
||||
mysql_query("DELETE FROM flagged_videos where videoid='".$videoid."'");
|
||||
return e($LANG['class_vdo_flag_rm'],m);
|
||||
}
|
||||
|
||||
//Function Used To Share Videos
|
||||
function ShareVideo($username,$videoid,$message,$emails){
|
||||
global $LANG;
|
||||
|
|
21
upload/includes/classes/search.class.php
Normal file
21
upload/includes/classes/search.class.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This class performs
|
||||
* all the search
|
||||
* Modify it at your own risk\
|
||||
* read docs.clip-bucket.com for further details
|
||||
*
|
||||
* @Author : Arslan Hassan
|
||||
* @Software: CLipBucket v2
|
||||
* @Since : 07 October 2009
|
||||
*
|
||||
* @license:CBLA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class cbsearch
|
||||
{
|
||||
|
||||
}
|
|
@ -380,13 +380,7 @@ class signup {
|
|||
//Validate Email
|
||||
|
||||
function isValidEmail($email){
|
||||
$pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
|
||||
if (eregi($pattern, $email)){
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return isValidEmail($email);
|
||||
}
|
||||
|
||||
//Validate Username
|
||||
|
|
|
@ -1158,7 +1158,7 @@ class userquery {
|
|||
function get_user_field($uid,$field)
|
||||
{
|
||||
global $db;
|
||||
$results = $db->select('users',$field,"userid='$uid'");
|
||||
$results = $db->select('users',$field,"userid='$uid' OR username='$uid'");
|
||||
|
||||
if($db->num_rows>0)
|
||||
{
|
||||
|
@ -1438,7 +1438,7 @@ class userquery {
|
|||
*/
|
||||
function get_logged_username()
|
||||
{
|
||||
return $this->get_user_fields(user_id(),'username');
|
||||
return $this->get_user_field_only(user_id(),'username');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
class CBvideo extends CBCategory
|
||||
{
|
||||
var $embed_func_list = array(); //Function list that are applied while asking for video embed code
|
||||
var $action = ''; // variable used to call action class
|
||||
var $email_template_vars = array();
|
||||
|
||||
/**
|
||||
* __Constructor of CBVideo
|
||||
|
@ -27,6 +29,7 @@ class CBvideo extends CBCategory
|
|||
{
|
||||
$this->cat_tbl = 'video_categories';
|
||||
$this->section_tbl = 'video';
|
||||
$this->init_actions();
|
||||
}
|
||||
|
||||
|
||||
|
@ -389,7 +392,42 @@ class CBvideo extends CBCategory
|
|||
return $embed_code;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function used to initialize action class
|
||||
* in order to call actions.class.php to
|
||||
* work with Video section, this function will be called first
|
||||
*/
|
||||
function init_actions()
|
||||
{
|
||||
$this->action = new cbactions();
|
||||
$this->action->type = 'v';
|
||||
$this->action->name = 'video';
|
||||
$this->action->obj_class = 'cbvideo';
|
||||
$this->actions->check_func = 'video_exists';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function used to create value array for email templates
|
||||
* @param video_details ARRAY
|
||||
*/
|
||||
function set_share_email($details)
|
||||
{
|
||||
$this->email_template_vars = array
|
||||
('{video_title}' => $details['title'],
|
||||
'{video_description}' => $details['tags'],
|
||||
'{video_tags}' => $details['description'],
|
||||
'{video_date}' => cbdate(DATE_FORMAT,strtotime($details['date_added'])),
|
||||
'{video_link}' => video_link($details),
|
||||
'{video_thumb}'=> GetThumb($details)
|
||||
);
|
||||
|
||||
$this->action->share_template_name = 'share_video_template';
|
||||
$this->action->val_array = $this->email_template_vars;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -42,6 +42,7 @@ if(file_exists(dirname(__FILE__).'/../install/isinstall.php')){
|
|||
|
||||
require_once('dbconnect.php');
|
||||
require_once('classes/pages.class.php');
|
||||
require_once('classes/actions.class.php');
|
||||
require_once('classes/my_queries.class.php');
|
||||
require_once('classes/user.class.php');
|
||||
require_once('classes/calcdate.class.php');
|
||||
|
@ -63,6 +64,7 @@ if(file_exists(dirname(__FILE__).'/../install/isinstall.php')){
|
|||
require_once('classes/category.class.php');
|
||||
require_once('classes/video.class.php');
|
||||
require_once('classes/player.class.php');
|
||||
require_once('classes/cbemail.class.php');
|
||||
require_once 'languages.php';
|
||||
|
||||
$pages = new pages();
|
||||
|
@ -86,7 +88,8 @@ if(file_exists(dirname(__FILE__).'/../install/isinstall.php')){
|
|||
$imgObj = new ResizeImage();
|
||||
$cbvideo = $cbvid = new CBvideo();
|
||||
$cbplayer = new CBPlayer();
|
||||
|
||||
$cbemail = new CBEmail();
|
||||
|
||||
//Initializng Userquery class
|
||||
$userquery->init();
|
||||
|
||||
|
@ -156,6 +159,7 @@ error_reporting(E_ALL ^ E_NOTICE ^E_DEPRECATED);
|
|||
define('WELCOME_EMAIL',$email_data['welcome_email']);
|
||||
@define('VIDEO_REQUIRE_LOGIN',$row['video_require_login']);
|
||||
define('ACTIVATION',$row['activation']);
|
||||
define('DATE_FORMAT',"d-m-Y");
|
||||
|
||||
//Listing Of Videos , Channels
|
||||
|
||||
|
@ -389,6 +393,7 @@ $Smarty->register_function('userid','userid');
|
|||
$Smarty->register_function('FlashPlayer','flashPlayer');
|
||||
$Smarty->register_function('HQFlashPlayer','HQflashPlayer');
|
||||
$Smarty->register_function('link','cblink');
|
||||
$Smarty->register_function('show_share_form','show_share_form');
|
||||
|
||||
$Smarty->register_modifier('SetTime','SetTime');
|
||||
$Smarty->register_modifier('getname','getname');
|
||||
|
|
|
@ -181,18 +181,85 @@
|
|||
|
||||
|
||||
|
||||
//Function Send Email
|
||||
function send_email($from,$to,$subj,$msg){
|
||||
$header = "From: ".$from." \r\n";
|
||||
$header .= "Content-Type: text/html; charset=utf-8 \r\n";
|
||||
$retval = mail ($to,$subj,$msg,$header);
|
||||
if( $retval == true ){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Function used to send emails
|
||||
* this is a very basic email function
|
||||
* you can extend or replace this function easily
|
||||
* read our docs.clip-bucket.com
|
||||
*/
|
||||
function cbmail($array)
|
||||
{
|
||||
$func_array = get_functions('email_functions');
|
||||
if(is_array($func_array))
|
||||
{
|
||||
foreach($func_array as $func)
|
||||
{
|
||||
if(function_exists($func))
|
||||
{
|
||||
return $func($array);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$content = $array['content'];
|
||||
$subject = $array['subject'];
|
||||
$to = $array['to'];
|
||||
$from = $array['from'];
|
||||
|
||||
//Setting Boundary
|
||||
$mime_boundary = "----ClipBucket Emailer----".md5(time());
|
||||
|
||||
$headers = "From: ".$from." \r\n";
|
||||
$headers .= "Content-Type: text/html; charset=UTF-8\n";
|
||||
$headers .= "Content-Transfer-Encoding: 7bit \r\n";
|
||||
$headers .= "MIME-Version: 1.0\r\n";
|
||||
//Checking if has CC
|
||||
if($array['cc'])
|
||||
$headers .= "cc: ".$array['cc']." \r\n";
|
||||
//Checking if has BCC
|
||||
if($array['bcc'])
|
||||
$headers .= "Bcc: ".$array['bcc']." \r\n";
|
||||
//Setting Mailer
|
||||
$headers .= "X-Mailer: ClipBucket v2 \r\n";
|
||||
|
||||
//Starting Message
|
||||
$message = "--$mime_boundary--\n";
|
||||
$message .= "Content-Type: text/html; charset=UTF-8\n";
|
||||
$message .= "Content-Transfer-Encoding: 8bit\n\n";
|
||||
|
||||
# CHecking Content
|
||||
if(preg_match('/<html>/',$content,$matches))
|
||||
{
|
||||
if(empty($matches[0]))
|
||||
{
|
||||
$content = wrap_email_content($content);
|
||||
}
|
||||
}
|
||||
$message .= $content;
|
||||
//Ending Message
|
||||
$message .= "--$mime_boundary--\n\n";
|
||||
|
||||
$email = mail ($to,$subject,$message,$headers);
|
||||
if( $email == true ){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function send_email($from,$to,$subj,$message)
|
||||
{
|
||||
return cbmail(array('from'=>$from,'to'=>$to,'subject'=>$subj,'content'=>$message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to wrap email content in
|
||||
* HTML AND BODY TAGS
|
||||
*/
|
||||
function wrap_email_content($content)
|
||||
{
|
||||
return '<html><body>'.$content.'</body></html>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to get file name
|
||||
*/
|
||||
|
@ -300,7 +367,7 @@
|
|||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -940,7 +1007,10 @@
|
|||
function user_name()
|
||||
{
|
||||
global $userquery;
|
||||
return $userquery->user_name;
|
||||
if($userquery->user_name)
|
||||
return $userquery->user_name;
|
||||
else
|
||||
return $userquery->get_logged_username();
|
||||
}
|
||||
function username(){return user_name();}
|
||||
|
||||
|
@ -1952,9 +2022,13 @@
|
|||
/**
|
||||
* Function used to check weather video has Mp4 file or not
|
||||
*/
|
||||
function has_hq($vdetails)
|
||||
function has_hq($vdetails,$is_file=false)
|
||||
{
|
||||
$file = get_hq_video_file($vdetails);
|
||||
if(!$is_file)
|
||||
$file = get_hq_video_file($vdetails);
|
||||
else
|
||||
$file = $vdetails;
|
||||
|
||||
if(getext($file)=='mp4')
|
||||
return $file;
|
||||
else
|
||||
|
@ -1978,7 +2052,7 @@
|
|||
function get_functions($name)
|
||||
{
|
||||
global $Cbucket;
|
||||
$funcs = $CBucket->get_functions;
|
||||
$funcs = $CBucket->$name;
|
||||
if(is_array($funcs) && count($funcs)>0)
|
||||
return $funcs;
|
||||
else
|
||||
|
@ -2021,4 +2095,90 @@
|
|||
}
|
||||
function get_config($input){ return config($input); }
|
||||
|
||||
|
||||
/**
|
||||
* Funcion used to call functions
|
||||
* when video is going to watched
|
||||
* ie in watch_video.php
|
||||
*/
|
||||
function call_watch_video_function($vdo)
|
||||
{
|
||||
$funcs = get_functions('watch_video_functions');
|
||||
if(is_array($funcs) && count($funcs)>0)
|
||||
{
|
||||
foreach($funcs as $func)
|
||||
{
|
||||
if(!function_exists($func))
|
||||
{
|
||||
$func($vdo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
increment_views($vdo['videoid']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to incream number of view
|
||||
* in object
|
||||
*/
|
||||
function increment_views($id,$type=NULL)
|
||||
{
|
||||
global $db;
|
||||
switch($type)
|
||||
{
|
||||
case 'v':
|
||||
case 'video':
|
||||
default:
|
||||
{
|
||||
if(!isset($_COOKIE['video_'.$id])){
|
||||
$db->update("video",array("views","last_viewed"),array("|f|views+1",NOW())," videoid='$id' OR videokey='$vkey'");
|
||||
setcookie('video_'.$id,'watched',time()+3600);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to get post var
|
||||
*/
|
||||
function post($var)
|
||||
{
|
||||
return $_POST[$var];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to show sharing form
|
||||
*/
|
||||
function show_share_form($array,&$Smarty)
|
||||
{
|
||||
$array['button_value'] = $array['button_value']?$array['button_value'] : 'Email';
|
||||
$form .='<form id="form1" name="form1" method="post" action="'.$array['link'].'" class="'.$array['class'].'">';
|
||||
$form .='<label for="users" class="label">Usernames or Emails</label><br />';
|
||||
$form .='<input type="text" name="users" id="users"><br>';
|
||||
$form .='<label for="message" class="label">Message</label>';
|
||||
$form .='<br>';
|
||||
$form .='<textarea name="message" id="message" cols="45" rows="5" ></textarea><br>';
|
||||
$form .='<input type="submit" name="send_content" value="'.$array['button_value'].'" />';
|
||||
$form .='</form>';
|
||||
return $form;
|
||||
}
|
||||
|
||||
function cbdate($format=NULL,$timestamp=NULL)
|
||||
{
|
||||
if(!$format)
|
||||
{
|
||||
$format = "d-m-Y";
|
||||
}
|
||||
if(!$timestamp)
|
||||
return date($format);
|
||||
else
|
||||
return date($format,$timestamp);
|
||||
}
|
||||
|
||||
|
||||
?>
|
Binary file not shown.
|
@ -24,17 +24,20 @@ if(!function_exists('hdflvplayer'))
|
|||
$vdata = $data['vdetails'];
|
||||
global $swfobj;
|
||||
|
||||
|
||||
$vid_file = get_video_file($vdata,$no_video,false);
|
||||
if($vid_file)
|
||||
{
|
||||
$swfobj->playerFile = PLAYER_URL.'/hd_flv_player/hdplayer.swf';
|
||||
$swfobj->FlashObj();
|
||||
//Writing Param
|
||||
$swfobj->addParam('allowfullscreen','true');
|
||||
$swfobj->addParam('allowscriptaccess','always');
|
||||
$swfobj->addParam('flashvars','playlistXML=http://localhost/clipbucket/2.x/2/upload/player/hd_flv_player/xml/playlist.xml');
|
||||
|
||||
$swfobj->addVar('file',BASEURL.'/files/videos/'.$vid_file);
|
||||
$swfobj->addParam('allowfullscreen','true');
|
||||
$swfobj->addParam('allowscriptaccess','always');
|
||||
if($data['hq'])
|
||||
$swfobj->addParam('flashvars',"playlistXML=http://clipbucket.net/v2/player/hd_flv_player/settings.php?hqid=".$vdata['videoid']);
|
||||
else
|
||||
$swfobj->addParam('flashvars',"playlistXML=http://clipbucket.net/v2/player/hd_flv_player/settings.php?vid=".$vdata['videoid']);
|
||||
|
||||
$swfobj->CreatePlayer();
|
||||
return $swfobj->code;
|
||||
|
|
28
upload/player/hd_flv_player/settings.php
Normal file
28
upload/player/hd_flv_player/settings.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
/**
|
||||
* ClipBucket Player v2 Settings File
|
||||
*/
|
||||
|
||||
include('../../includes/common.php');
|
||||
$vid = $_GET['vid'] ;
|
||||
$vid = $vid ? $vid : $_GET['hqid'];
|
||||
if($_GET['hqid'])
|
||||
$hd = 'yes';
|
||||
|
||||
$v = $cbvideo->get_video($vid);
|
||||
header ("content-type: text/xml");
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
?>
|
||||
<playlist autoplay="false" random="false">
|
||||
<mainvideo url="<?php if($hd=='yes') echo get_hq_video_file($v); else echo get_video_file($v,true,true); ?>"
|
||||
hd="<?php if(has_hq($v,true)) echo 'true'; else echo 'false'; ?>"
|
||||
hdpath="<?php echo get_hq_video_file($v);?>"
|
||||
id="100"
|
||||
thu_image=""
|
||||
Preview=""
|
||||
preroll="false"
|
||||
midroll="false"
|
||||
postroll="false"
|
||||
allow_download="false">
|
||||
</mainvideo>
|
||||
</playlist>
|
29
upload/player/hd_flv_player/xml/playlist.php
Normal file
29
upload/player/hd_flv_player/xml/playlist.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* ClipBucket Player v2 Settings File
|
||||
*/
|
||||
|
||||
include('../../../includes/common.php');
|
||||
$vid = $_GET['vid'] ;
|
||||
$vid = $vid ? $vid : $_GET['hqid'];
|
||||
if($_GET['hqid'])
|
||||
$hd = 'yes';
|
||||
|
||||
$v = $cbvideo->get_video($vid);
|
||||
header ("content-type: text/xml");
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
?>
|
||||
<playlist autoplay="false" random="false">
|
||||
<mainvideo url="<?php if($hd=='yes') echo get_hq_video_file($v); else echo get_video_file($v,true,true); ?>"
|
||||
hd="false"
|
||||
hdpath=""
|
||||
id="100"
|
||||
thu_image=""
|
||||
Preview=""
|
||||
preroll="false"
|
||||
midroll="false"
|
||||
postroll="false"
|
||||
allow_download="false">
|
||||
</mainvideo>
|
||||
</playlist>
|
||||
|
|
@ -21,8 +21,10 @@
|
|||
<a href="#"><span class="flag_video"> </span> Report this video</a>
|
||||
</div>
|
||||
|
||||
<!-- Displaying Sharing Form-->
|
||||
{show_share_form}
|
||||
|
||||
<!-- Video Comments Options -->
|
||||
<!-- Video Comments Options -->
|
||||
{include file="$style_dir/blocks/add_comment.html"}
|
||||
|
||||
<!-- Displaying Comments -->
|
||||
|
@ -40,7 +42,7 @@
|
|||
{assign var='udetails' value=$userquery->get_user_details($vdo.userid)}
|
||||
<a class="vd_thumb" href="#"><img src="{$userquery->getUserThumb($udetails)}" class="mid_user_thumb" /></a>
|
||||
{$udetails.username} uploaded on {$vdo.date_added|date_format}<br />
|
||||
{$vdo.views|number_format} times viewed<br />
|
||||
viewed {$vdo.views|number_format} times<br />
|
||||
<div class="clear"></div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -19,6 +19,17 @@ if(video_playable($vkey))
|
|||
{
|
||||
$vdo = $cbvid->get_video($vkey);
|
||||
assign('vdo',$vdo);
|
||||
|
||||
if(post('send_content'))
|
||||
{
|
||||
//Sending Video
|
||||
$cbvid->set_share_email($vdo);
|
||||
$cbvid->action->share_content($vdo['videoid']);
|
||||
}
|
||||
|
||||
//Calling Functions When Video Is Called
|
||||
call_watch_video_function($vdo);
|
||||
|
||||
//Addming Comment
|
||||
if(isset($_POST['add_comment']))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue