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">
|
||||
<table width="400" border="0" cellpadding="2" cellspacing="2">
|
||||
<tr>
|
||||
<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="106" align="right"><label for="title">Video title</label></td>
|
||||
<td width="280"><input name="title" type="text" class="input" id="title" value="{'title'|get_form_val:true}" //></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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 align="right"><label for="videokey">Video key</label></td>
|
||||
<td><input name="videokey" type="text" class="input" id="videokey" value="{'videokey'|get_form_val:true}" //></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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 align="right"><label for="videoid">Video id</label></td>
|
||||
<td><input name="videoid" type="text" class="input" id="videoid" value="{'videoid'|get_form_val:true}" //></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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 align="right"><label for="tags">Video tags</label></td>
|
||||
<td><input name="tags" type="text" class="input" id="tags" value="{'tags'|get_form_val:true}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
|
@ -82,7 +82,7 @@
|
|||
|
||||
<a href="view_video.php?video={$videos[list].videoid}">View</a> |
|
||||
<a href="edit_video.php?video={$videos[list].videoid}">Edit</a> {if $videos[list].featured == yes} |
|
||||
<a href="javascript:Confirm_Delete('?delete_video={$videos[list].videoid}')">Delete</a> |
|
||||
<a href="javascript:Confirm_Delete('?delete_video={$videos[list].videoid}')">Delete</a> |
|
||||
<a href="?make_unfeature={$videos[list].videoid}">Make Unfeatured</a> {/if}
|
||||
{if $videos[list].featured == no} |
|
||||
<a href="?make_feature={$videos[list].videoid}">Make Featured</a> {/if}
|
||||
|
|
|
@ -88,26 +88,26 @@ if(isset($_GET['deactivate'])){
|
|||
$msg = "Selected Videos Have Been Dectivated";
|
||||
}
|
||||
|
||||
|
||||
//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'];
|
||||
|
||||
//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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Deleting Multiple Videos
|
||||
if(isset($_POST['delete_selected'])){
|
||||
for($id=0;$id<=RESULTS;$id++){
|
||||
if($myquery->VideoExists($_POST['check_video'][$id])){
|
||||
$msg[] = $myquery->DeleteVideo($_POST['check_video'][$id]);
|
||||
|
||||
//Deleting Multiple Videos
|
||||
if(isset($_POST['delete_selected'])){
|
||||
for($id=0;$id<=RESULTS;$id++){
|
||||
if($myquery->VideoExists($_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
|
||||
if(isset($_POST['display_page'])){
|
||||
|
@ -154,7 +154,7 @@ if(isset($_POST['delete_selected'])){
|
|||
}
|
||||
|
||||
//Getting Video List
|
||||
$page = $_GET['page'];
|
||||
$page = mysql_clean($_GET['page']);
|
||||
$get_limit = create_query_limit($page,RESULTS);
|
||||
$videos = $db->select("video",'*',$cond,$get_limit,"date_added DESC");
|
||||
Assign('videos', $videos);
|
||||
|
|
|
@ -246,12 +246,8 @@ class myquery {
|
|||
return $this->VideoExists($videoid);
|
||||
}
|
||||
function VideoExists($videoid){
|
||||
$query = mysql_query("SELECT videoid FROM video WHERE videoid ='".$videoid."'");
|
||||
if(mysql_num_rows($query)>0){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
global $cbvid;
|
||||
return $cbvid->exists($videoid);
|
||||
}
|
||||
|
||||
//Function Used to Delete Video Files
|
||||
|
@ -291,39 +287,29 @@ class myquery {
|
|||
//Function Used to Make Video Featured
|
||||
|
||||
function MakeFeaturedVideo($videoid){
|
||||
global $LANG;
|
||||
mysql_query("UPDATE video SET featured = 'yes' WHERE videoid='".$videoid."'");
|
||||
$msg = e($LANG['class_vdo_fr_msg'],m);
|
||||
return $msg;
|
||||
global $cbvid;
|
||||
return $cbvid->action('feature',$videoid);
|
||||
}
|
||||
|
||||
//Function Used to Make Video UnFeatured
|
||||
|
||||
function MakeUnFeaturedVideo($videoid){
|
||||
global $LANG;
|
||||
mysql_query("UPDATE video SET featured = 'no' WHERE videoid='".$videoid."'");
|
||||
$msg = e($LANG['class_fr_msg1'],m);
|
||||
return $msg;
|
||||
global $cbvid;
|
||||
return $cbvid->action('unfeature',$videoid);
|
||||
}
|
||||
|
||||
//Function Used to Activate Vide
|
||||
|
||||
function ActivateVideo($videoid){
|
||||
global $LANG,$stats;
|
||||
mysql_query("UPDATE video SET active = 'yes' WHERE videoid='".$videoid."'");
|
||||
$msg = e($LANG['class_vdo_act_msg'],m);
|
||||
$stats->UpdateVideoRecord(11);
|
||||
return $msg;
|
||||
global $cbvid;
|
||||
return $cbvid->action('activate',$videoid);
|
||||
}
|
||||
|
||||
//Function Used to Deactivate Video
|
||||
|
||||
function DeActivateVideo($videoid){
|
||||
global $LANG,$stats;
|
||||
mysql_query("UPDATE video SET active = 'no' WHERE videoid='".$videoid."'");
|
||||
$msg = e($LANG['class_vdo_act_msg1'],m);
|
||||
$stats->UpdateVideoRecord(12);
|
||||
return $msg;
|
||||
global $cbvid;
|
||||
return $cbvid->action('deactivate',$videoid);
|
||||
}
|
||||
|
||||
|
||||
|
@ -334,12 +320,11 @@ class myquery {
|
|||
*/
|
||||
function get_video_details($vid)
|
||||
{
|
||||
global $db;
|
||||
$results = $db->select("video","*"," videoid='$vid' OR videokey='$vid'");
|
||||
return $results[0];
|
||||
global $cbvid;
|
||||
return $cbvid->get_video($vid);
|
||||
}
|
||||
function GetVideoDetails($video){
|
||||
return $this->get_video_details;
|
||||
return $this->get_video_details($video);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1366,87 +1351,8 @@ class myquery {
|
|||
*/
|
||||
function update_video()
|
||||
{
|
||||
global $eh,$Cbucket,$db,$Upload;
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
}
|
||||
global $cbvid;
|
||||
return $cbvid->update_video();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ if(file_exists(dirname(__FILE__).'/../install/isinstall.php')){
|
|||
require_once('classes/log.class.php');
|
||||
require_once('classes/swfObj.class.php');
|
||||
require_once('classes/image.class.php');
|
||||
require_once('classes/video.class.php');
|
||||
require_once 'languages.php';
|
||||
|
||||
$pages = new pages();
|
||||
|
@ -78,11 +79,11 @@ if(file_exists(dirname(__FILE__).'/../install/isinstall.php')){
|
|||
$cbplugin = new CBPlugin();
|
||||
$eh = new EH();
|
||||
$lang_obj = new language;
|
||||
$sess = new Session();
|
||||
$sess = new Session();
|
||||
$cblog = new CBLogs();
|
||||
$swfobj = new SWFObject();
|
||||
$imgObj = new ResizeImage();
|
||||
|
||||
$cbvid = new CBvideo();
|
||||
|
||||
//Initializng Userquery class
|
||||
$userquery->init();
|
||||
|
@ -389,19 +390,21 @@ $Smarty->register_function('videoLink','videoSmartyLink');
|
|||
$Smarty->register_function('pullRating','pullSmartyRating');
|
||||
$Smarty->register_function('ANCHOR','ANCHOR');
|
||||
$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('load_form','load_form');
|
||||
$Smarty->register_function('get_all_video_files',get_all_video_files_smarty);
|
||||
$Smarty->register_function('input_value','input_value');
|
||||
|
||||
$Smarty->register_function('userid','userid');
|
||||
$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');
|
||||
|
||||
|
||||
|
|
|
@ -1383,8 +1383,7 @@ function SetTime($sec, $padHours = true) {
|
|||
{
|
||||
global $myquery;
|
||||
if(!$vid)
|
||||
global $vid;
|
||||
|
||||
global $vid;
|
||||
return $myquery->get_video_details($vid);
|
||||
}
|
||||
|
||||
|
@ -2026,4 +2025,49 @@ function SetTime($sec, $padHours = true) {
|
|||
|
||||
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;
|
||||
|
||||
if(empty($val))
|
||||
if(empty($val) || $val=='none')
|
||||
{
|
||||
return ' ';
|
||||
return 'none';
|
||||
}else{
|
||||
//Removing spaces and non required code
|
||||
$val = preg_replace(array("/\r+/","/\n+/","/\t+/"),"",$val);
|
||||
|
|
Loading…
Add table
Reference in a new issue