ADDED : video.class.php
UPDATE : admin section Fixed : update_video function Fixed : video embed mod
This commit is contained in:
parent
cd974b3370
commit
3f368b9cd3
6 changed files with 101 additions and 148 deletions
|
@ -5,20 +5,20 @@
|
||||||
<div class="search_box"> <form id="video_search" name="video_search" method="get" action="video_manager.php" class="video_search">
|
<div class="search_box"> <form id="video_search" name="video_search" method="get" action="video_manager.php" class="video_search">
|
||||||
<table width="400" border="0" cellpadding="2" cellspacing="2">
|
<table width="400" border="0" cellpadding="2" cellspacing="2">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="106" align="right"><label for="title">Video Title</label></td>
|
<td width="106" align="right"><label for="title">Video title</label></td>
|
||||||
<td width="280"><input name="title" type="text" class="input" id="title" value="{$smarty.get.title|form_val}" //></td>
|
<td width="280"><input name="title" type="text" class="input" id="title" value="{'title'|get_form_val:true}" //></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right"><label for="videokey">Video Key</label></td>
|
<td align="right"><label for="videokey">Video key</label></td>
|
||||||
<td><input name="videokey" type="text" class="input" id="videokey" value="{$smarty.get.videokey|form_val}" //></td>
|
<td><input name="videokey" type="text" class="input" id="videokey" value="{'videokey'|get_form_val:true}" //></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right"><label for="videoid">Video Id</label></td>
|
<td align="right"><label for="videoid">Video id</label></td>
|
||||||
<td><input name="videoid" type="text" class="input" id="videoid" value="{$smarty.get.videoid|form_val}" //></td>
|
<td><input name="videoid" type="text" class="input" id="videoid" value="{'videoid'|get_form_val:true}" //></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right"><label for="tags">Video Tags</label></td>
|
<td align="right"><label for="tags">Video tags</label></td>
|
||||||
<td><input name="tags" type="text" class="input" id="tags" value="{$smarty.get.tags|form_val}" //></td>
|
<td><input name="tags" type="text" class="input" id="tags" value="{'tags'|get_form_val:true}" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -89,25 +89,25 @@ if(isset($_GET['deactivate'])){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Delete Video
|
//Delete Video
|
||||||
if(isset($_GET['delete_video'])){
|
if(isset($_GET['delete_video'])){
|
||||||
$video = mysql_clean($_GET['delete_video']);
|
$video = mysql_clean($_GET['delete_video']);
|
||||||
if($myquery->VideoExists($video)){
|
if($myquery->VideoExists($video)){
|
||||||
$msg[] = $myquery->DeleteVideo($video);
|
$msg[] = $myquery->DeleteVideo($video);
|
||||||
}else{
|
}else{
|
||||||
$msg[] = $LANG['class_vdo_del_err'];
|
$msg[] = $LANG['class_vdo_del_err'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Deleting Multiple Videos
|
//Deleting Multiple Videos
|
||||||
if(isset($_POST['delete_selected'])){
|
if(isset($_POST['delete_selected'])){
|
||||||
for($id=0;$id<=RESULTS;$id++){
|
for($id=0;$id<=RESULTS;$id++){
|
||||||
if($myquery->VideoExists($_POST['check_video'][$id])){
|
if($myquery->VideoExists($_POST['check_video'][$id])){
|
||||||
$msg[] = $myquery->DeleteVideo($_POST['check_video'][$id]);
|
$msg[] = $myquery->DeleteVideo($_POST['check_video'][$id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$msg = $LANG['vdo_del_selected'];
|
$msg = $LANG['vdo_del_selected'];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Jump To The page
|
//Jump To The page
|
||||||
if(isset($_POST['display_page'])){
|
if(isset($_POST['display_page'])){
|
||||||
|
@ -154,7 +154,7 @@ if(isset($_POST['delete_selected'])){
|
||||||
}
|
}
|
||||||
|
|
||||||
//Getting Video List
|
//Getting Video List
|
||||||
$page = $_GET['page'];
|
$page = mysql_clean($_GET['page']);
|
||||||
$get_limit = create_query_limit($page,RESULTS);
|
$get_limit = create_query_limit($page,RESULTS);
|
||||||
$videos = $db->select("video",'*',$cond,$get_limit,"date_added DESC");
|
$videos = $db->select("video",'*',$cond,$get_limit,"date_added DESC");
|
||||||
Assign('videos', $videos);
|
Assign('videos', $videos);
|
||||||
|
|
|
@ -246,12 +246,8 @@ class myquery {
|
||||||
return $this->VideoExists($videoid);
|
return $this->VideoExists($videoid);
|
||||||
}
|
}
|
||||||
function VideoExists($videoid){
|
function VideoExists($videoid){
|
||||||
$query = mysql_query("SELECT videoid FROM video WHERE videoid ='".$videoid."'");
|
global $cbvid;
|
||||||
if(mysql_num_rows($query)>0){
|
return $cbvid->exists($videoid);
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Function Used to Delete Video Files
|
//Function Used to Delete Video Files
|
||||||
|
@ -291,39 +287,29 @@ class myquery {
|
||||||
//Function Used to Make Video Featured
|
//Function Used to Make Video Featured
|
||||||
|
|
||||||
function MakeFeaturedVideo($videoid){
|
function MakeFeaturedVideo($videoid){
|
||||||
global $LANG;
|
global $cbvid;
|
||||||
mysql_query("UPDATE video SET featured = 'yes' WHERE videoid='".$videoid."'");
|
return $cbvid->action('feature',$videoid);
|
||||||
$msg = e($LANG['class_vdo_fr_msg'],m);
|
|
||||||
return $msg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Function Used to Make Video UnFeatured
|
//Function Used to Make Video UnFeatured
|
||||||
|
|
||||||
function MakeUnFeaturedVideo($videoid){
|
function MakeUnFeaturedVideo($videoid){
|
||||||
global $LANG;
|
global $cbvid;
|
||||||
mysql_query("UPDATE video SET featured = 'no' WHERE videoid='".$videoid."'");
|
return $cbvid->action('unfeature',$videoid);
|
||||||
$msg = e($LANG['class_fr_msg1'],m);
|
|
||||||
return $msg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Function Used to Activate Vide
|
//Function Used to Activate Vide
|
||||||
|
|
||||||
function ActivateVideo($videoid){
|
function ActivateVideo($videoid){
|
||||||
global $LANG,$stats;
|
global $cbvid;
|
||||||
mysql_query("UPDATE video SET active = 'yes' WHERE videoid='".$videoid."'");
|
return $cbvid->action('activate',$videoid);
|
||||||
$msg = e($LANG['class_vdo_act_msg'],m);
|
|
||||||
$stats->UpdateVideoRecord(11);
|
|
||||||
return $msg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Function Used to Deactivate Video
|
//Function Used to Deactivate Video
|
||||||
|
|
||||||
function DeActivateVideo($videoid){
|
function DeActivateVideo($videoid){
|
||||||
global $LANG,$stats;
|
global $cbvid;
|
||||||
mysql_query("UPDATE video SET active = 'no' WHERE videoid='".$videoid."'");
|
return $cbvid->action('deactivate',$videoid);
|
||||||
$msg = e($LANG['class_vdo_act_msg1'],m);
|
|
||||||
$stats->UpdateVideoRecord(12);
|
|
||||||
return $msg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -334,12 +320,11 @@ class myquery {
|
||||||
*/
|
*/
|
||||||
function get_video_details($vid)
|
function get_video_details($vid)
|
||||||
{
|
{
|
||||||
global $db;
|
global $cbvid;
|
||||||
$results = $db->select("video","*"," videoid='$vid' OR videokey='$vid'");
|
return $cbvid->get_video($vid);
|
||||||
return $results[0];
|
|
||||||
}
|
}
|
||||||
function GetVideoDetails($video){
|
function GetVideoDetails($video){
|
||||||
return $this->get_video_details;
|
return $this->get_video_details($video);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1366,87 +1351,8 @@ class myquery {
|
||||||
*/
|
*/
|
||||||
function update_video()
|
function update_video()
|
||||||
{
|
{
|
||||||
global $eh,$Cbucket,$db,$Upload;
|
global $cbvid;
|
||||||
|
return $cbvid->update_video();
|
||||||
$Upload->validate_video_upload_form(NULL,TRUE);
|
|
||||||
|
|
||||||
if(empty($eh->error_list))
|
|
||||||
{
|
|
||||||
$required_fields = $Upload->loadRequiredFields($array);
|
|
||||||
$location_fields = $Upload->loadLocationFields($array);
|
|
||||||
$option_fields = $Upload->loadOptionFields($array);
|
|
||||||
|
|
||||||
$upload_fields = array_merge($required_fields,$location_fields,$option_fields);
|
|
||||||
|
|
||||||
//Adding Custom Upload Fields
|
|
||||||
if(count($Upload->custom_upload_fields)>0)
|
|
||||||
$upload_fields = array_merge($upload_fields,$Upload->custom_upload_fields);
|
|
||||||
//Adding Custom Form Fields
|
|
||||||
if(count($Upload->custom_form_fields)>0)
|
|
||||||
$upload_fields = array_merge($upload_fields,$Upload->custom_form_fields);
|
|
||||||
|
|
||||||
$array = $_POST;
|
|
||||||
$vid = $array['videoid'];
|
|
||||||
|
|
||||||
if(is_array($_FILES))
|
|
||||||
$array = array_merge($array,$_FILES);
|
|
||||||
|
|
||||||
foreach($upload_fields as $field)
|
|
||||||
{
|
|
||||||
$name = formObj::rmBrackets($field['name']);
|
|
||||||
$val = $array[$name];
|
|
||||||
|
|
||||||
if($field['use_func_val'])
|
|
||||||
$val = $field['validate_function']($val);
|
|
||||||
|
|
||||||
|
|
||||||
if(!empty($field['db_field']))
|
|
||||||
$query_field[] = $field['db_field'];
|
|
||||||
|
|
||||||
if(is_array($val))
|
|
||||||
{
|
|
||||||
$new_val = '';
|
|
||||||
foreach($val as $v)
|
|
||||||
{
|
|
||||||
$new_val .= "#".$v."# ";
|
|
||||||
}
|
|
||||||
$val = $new_val;
|
|
||||||
}
|
|
||||||
if(!$field['clean_func'] || (!function_exists($field['clean_func']) && !is_array($field['clean_func'])))
|
|
||||||
$val = mysql_clean($val);
|
|
||||||
else
|
|
||||||
$val = apply_func($field['clean_func'],$val);
|
|
||||||
|
|
||||||
if(!empty($field['db_field']))
|
|
||||||
$query_val[] = $val;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#$query = "INSERT INTO video (";
|
|
||||||
$total_fields = count($query_field);
|
|
||||||
|
|
||||||
//Adding Fields to query
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
/*for($key=0;$key<$total_fields;$key++)
|
|
||||||
{
|
|
||||||
$query .= query_field[$key]." = '".$query_val[$key]."'" ;
|
|
||||||
if($key<$total_fields-1)
|
|
||||||
$query .= ',';
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
if(!userid())
|
|
||||||
{
|
|
||||||
e("You are not logged in");
|
|
||||||
}elseif(!$this->video_exists($vid)){
|
|
||||||
e("Video deos not exist");
|
|
||||||
}else{
|
|
||||||
$db->update('video',$query_field,$query_val," videoid='$vid'");
|
|
||||||
e("Video details have been updated",m);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ if(file_exists(dirname(__FILE__).'/../install/isinstall.php')){
|
||||||
require_once('classes/log.class.php');
|
require_once('classes/log.class.php');
|
||||||
require_once('classes/swfObj.class.php');
|
require_once('classes/swfObj.class.php');
|
||||||
require_once('classes/image.class.php');
|
require_once('classes/image.class.php');
|
||||||
|
require_once('classes/video.class.php');
|
||||||
require_once 'languages.php';
|
require_once 'languages.php';
|
||||||
|
|
||||||
$pages = new pages();
|
$pages = new pages();
|
||||||
|
@ -82,7 +83,7 @@ if(file_exists(dirname(__FILE__).'/../install/isinstall.php')){
|
||||||
$cblog = new CBLogs();
|
$cblog = new CBLogs();
|
||||||
$swfobj = new SWFObject();
|
$swfobj = new SWFObject();
|
||||||
$imgObj = new ResizeImage();
|
$imgObj = new ResizeImage();
|
||||||
|
$cbvid = new CBvideo();
|
||||||
|
|
||||||
//Initializng Userquery class
|
//Initializng Userquery class
|
||||||
$userquery->init();
|
$userquery->init();
|
||||||
|
@ -389,19 +390,21 @@ $Smarty->register_function('videoLink','videoSmartyLink');
|
||||||
$Smarty->register_function('pullRating','pullSmartyRating');
|
$Smarty->register_function('pullRating','pullSmartyRating');
|
||||||
$Smarty->register_function('ANCHOR','ANCHOR');
|
$Smarty->register_function('ANCHOR','ANCHOR');
|
||||||
$Smarty->register_function('FUNC','FUNC');
|
$Smarty->register_function('FUNC','FUNC');
|
||||||
$Smarty->register_modifier('SetTime','SetTime');
|
|
||||||
$Smarty->register_modifier('getname','getname');
|
|
||||||
$Smarty->register_modifier('getext','getext');
|
|
||||||
$Smarty->register_modifier('form_val','form_val');
|
|
||||||
$Smarty->register_function('avatar','avatar');
|
$Smarty->register_function('avatar','avatar');
|
||||||
$Smarty->register_function('load_form','load_form');
|
$Smarty->register_function('load_form','load_form');
|
||||||
$Smarty->register_function('get_all_video_files',get_all_video_files_smarty);
|
$Smarty->register_function('get_all_video_files',get_all_video_files_smarty);
|
||||||
$Smarty->register_function('input_value','input_value');
|
$Smarty->register_function('input_value','input_value');
|
||||||
|
|
||||||
$Smarty->register_function('userid','userid');
|
$Smarty->register_function('userid','userid');
|
||||||
$Smarty->register_function('FlashPlayer','flashPlayer');
|
$Smarty->register_function('FlashPlayer','flashPlayer');
|
||||||
|
|
||||||
|
|
||||||
|
$Smarty->register_modifier('SetTime','SetTime');
|
||||||
|
$Smarty->register_modifier('getname','getname');
|
||||||
|
$Smarty->register_modifier('getext','getext');
|
||||||
|
$Smarty->register_modifier('form_val','form_val');
|
||||||
|
$Smarty->register_modifier('get_from_val','get_from_val');
|
||||||
|
$Smarty->register_modifier('post_form_val','post_form_val');
|
||||||
|
$Smarty->register_modifier('request_form_val','request_form_val');
|
||||||
$Smarty->register_modifier('get_thumb_num','get_thumb_num');
|
$Smarty->register_modifier('get_thumb_num','get_thumb_num');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1384,7 +1384,6 @@ function SetTime($sec, $padHours = true) {
|
||||||
global $myquery;
|
global $myquery;
|
||||||
if(!$vid)
|
if(!$vid)
|
||||||
global $vid;
|
global $vid;
|
||||||
|
|
||||||
return $myquery->get_video_details($vid);
|
return $myquery->get_video_details($vid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2026,4 +2025,49 @@ function SetTime($sec, $padHours = true) {
|
||||||
|
|
||||||
return $from.','.$result;
|
return $from.','.$result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to get value from $_GET
|
||||||
|
*/
|
||||||
|
function get_form_val($val,$filter=false)
|
||||||
|
{
|
||||||
|
if($filter)
|
||||||
|
return form_val($_GET[$val]);
|
||||||
|
else
|
||||||
|
$_GET[$val];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to get value form $_POST
|
||||||
|
*/
|
||||||
|
function post_form_val($val,$filter=false)
|
||||||
|
{
|
||||||
|
if($filter)
|
||||||
|
return form_val($_POST[$val]);
|
||||||
|
else
|
||||||
|
$_POST[$val];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to get value from $_REQUEST
|
||||||
|
*/
|
||||||
|
function request_form_val($val,$filter=false)
|
||||||
|
{
|
||||||
|
if($filter)
|
||||||
|
return form_val($_REQUEST[$val]);
|
||||||
|
else
|
||||||
|
$_REQUEST[$val];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to return LANG variable
|
||||||
|
*/
|
||||||
|
function lang($var)
|
||||||
|
{
|
||||||
|
global $LANG;
|
||||||
|
return $LANG[$var];
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -70,9 +70,9 @@ if(!function_exists('validate_embed_code'))
|
||||||
{
|
{
|
||||||
global $LANG;
|
global $LANG;
|
||||||
|
|
||||||
if(empty($val))
|
if(empty($val) || $val=='none')
|
||||||
{
|
{
|
||||||
return ' ';
|
return 'none';
|
||||||
}else{
|
}else{
|
||||||
//Removing spaces and non required code
|
//Removing spaces and non required code
|
||||||
$val = preg_replace(array("/\r+/","/\n+/","/\t+/"),"",$val);
|
$val = preg_replace(array("/\r+/","/\n+/","/\t+/"),"",$val);
|
||||||
|
|
Loading…
Add table
Reference in a new issue