Fixed: Video rating disable

This commit is contained in:
Arslan Hassan 2010-03-03 08:51:43 +00:00
parent 590e43bed5
commit 710fb6aa95
12 changed files with 216 additions and 24 deletions

View file

@ -1,11 +1,45 @@
<?php
/**
* Written by : Arslan Hassan
* Software : ClipBucket v2
* License : CBLA
**/
/**
* UN COMMENT IN CASE YOU ARE FACING TOO MANY MULTIPLE PROCESSESS AND CAUSING SERVER OVERLOAD
*
* Thanks to Erickson Reyes ercbluemonday at yahoo dot com | so processes dont overlap
* ref : http://www.php.net/manual/en/function.getmypid.php#94531
// Initialize variables
$found = 0;
$file = basename(__FILE__);
$commands = array();
// Get running processes.
exec("ps w", $commands);
// If processes are found
if (count($commands) > 0) {
foreach ($commands as $command) {
if (strpos($command, $file) === false) {
// Do nothin'
}
else {
// Let's count how many times the file is found.
$found++;
}
}
}
// If the instance of the file is found more than once.
if ($found > 1) {
echo "Another process is running.\n";
die();
}
*/
$in_bg_cron = true;
ini_set('mysql.connect_timeout','6000');
@ -80,10 +114,15 @@ $orig_file = CON_DIR.'/'.$tmp_file.'.'.$ext;
$ffmpeg->output_file = VIDEOS_DIR.'/'.$tmp_file.'.flv';
$ffmpeg->hq_output_file = VIDEOS_DIR.'/'.$tmp_file.'.mp4';
$ffmpeg->log_file = LOGS_DIR.'/'.$tmp_file.'.log';
//$ffmpeg->remove_input=TRUE;
//$ffmpeg->remove_input = TRUE;
$ffmpeg->keep_original = config('keep_original');
$ffmpeg->original_output_path = ORIGINAL_DIR.'/'.$tmp_file.'.'.$ext;
$ffmpeg->ClipBucket();
//Converting File In HD Format
$ffmpeg->convert_to_hd();
$hq_output = config('hq_output');
if($hq_output=='yes')
$ffmpeg->convert_to_hd();
unlink($ffmpeg->input_file);
exec(php_path()." -q ".BASEDIR."/actions/verify_converted_videos.php &> /dev/null &");

View file

@ -20,5 +20,4 @@ $userquery->admin_login_check();
template_files('index.html');
display_it();
?>

View file

@ -61,9 +61,13 @@ if(isset($_POST['update'])){
'ffmpeg_type',
'gravatars',
'grp_categories',
'hq_output',
'keywords' ,
'keep_original',
'keep_mp4_as_is',
'r_height',
'r_width',
@ -118,6 +122,7 @@ if(isset($_POST['update'])){
'users_items_group_page',
'user_max_chr',
'vid_categories',
'videos_items_grp_page',
'videos_items_hme_page',
'videos_items_columns',

View file

@ -216,6 +216,41 @@ $(document).ready(function(){
<td><labe for="video_download">Allow video download</labe></td>
<td><input name="video_download" type="checkbox" id="video_download" value="1" {if $row.video_download=='1'}checked="checked"{/if} /></td>
</tr>
<tr>
<td>Max categories for each video</td>
<td><input name="video_categories" type="text" id="php_path8" value="{$row.video_categories}" size="15" maxlength="5" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="settings_inner_title">Groups</td>
</tr>
<tr>
<td>Group Thumb Height</td>
<td><input name="grp_thumb_height" type="text" id="grp_thumb_height" value="{$row.grp_thumb_height}" size="15" maxlength="5" /></td>
</tr>
<tr>
<td>Group Thumb Width</td>
<td><input name="grp_thumb_width" type="text" id="grp_thumb_width" value="{$row.grp_thumb_width}" size="15" maxlength="5" /></td>
</tr>
<tr>
<td>Group Max Title</td>
<td><input name="grp_max_title" type="text" id="grp_max_title" value="{$row.grp_max_title}" size="15" maxlength="5" /></td>
</tr>
<tr>
<td>Group Max Description</td>
<td><input name="grp_max_desc" type="text" id="grp_max_desc" value="{$row.grp_max_desc}" size="15" maxlength="5" /></td>
</tr>
<tr>
<td>Max categories for each group</td>
<td><input name="grp_categories" type="text" id="grp_categories" value="{$row.grp_categories}" size="15" maxlength="5" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
@ -288,6 +323,16 @@ $(document).ready(function(){
<td>Save original file </td>
<td><input name="keep_original" type="checkbox" id="keep_original" value="1" {if $row.keep_original} checked="checked"{/if} /></td>
</tr>
<tr>
<td>Mp4 HQ Output</td>
<td><input name="hq_output" type="checkbox" id="hq_output" value="yes" {if $row.hq_output} checked="checked"{/if} />
<a href="javascript:void(0)" target="_blank"><img src="{$imageurl}/help.png" alt="" border="0" class="tipsy_tip" title="if enabled, ClipBucket will generate Highh Quality mp4 video if possible" /></a></td>
</tr>
<tr>
<td>Keep Mp4 As Is</td>
<td><input name="keep_mp4_as_is" type="checkbox" id="keep_mp4_as_is" value="yes" {if $row.keep_mp4_as_is} checked="checked"{/if} />
<a href="javascript:void(0)" target="_blank"><img src="{$imageurl}/help.png" border="0" class="tipsy_tip" title="if enabled, ClipBucket will keep mp4 vieo as is and will be playable as HQ video" /></a></td>
</tr>
<tr>
<td>Activation required</td>
<td><input name="activation" type="checkbox" id="activation" value="1" {if $row.activation==1} checked="checked"{/if} /></td>
@ -317,14 +362,7 @@ $(document).ready(function(){
-
<input name="max_video_tags" type="text" id="php_path7" value="{$row.max_video_tags}" size="20" /></td>
</tr>
<tr>
<td>Allowed Categories</td>
<td><input name="video_categories" type="text" id="php_path8" value="{$row.video_categories}" size="45" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>

View file

@ -10,7 +10,7 @@
*/
define("KEEP_MP4_AS_IS","yes");
define("KEEP_MP4_AS_IS",config('keep_mp4_as_is'));
define("MP4Box_BINARY",get_binaries('MP4Box'));
define("FLVTool2_BINARY",get_binaries('flvtool2'));
define('FFMPEG_BINARY', get_binaries('ffmpeg'));
@ -640,6 +640,17 @@ class ffmpeg
$this->convert();
$this->end_time_check();
$this->total_time();
//Copying File To Original Folder
if($this->keep_original=='yes')
{
$this->log .= "\r\nCopy File to original Folder";
if(copy($this->input_file,$this->original_output_path))
$this->log .= "\r\File Copied to original Folder...";
else
$this->log .= "\r\Unable to copy file to original folder...";
}
$this->output_details = $this->get_file_info($this->output_file);
$this->log .= "\r\n\r\n";
$this->log_ouput_file_info();

View file

@ -5,7 +5,6 @@
* @License : CBLA
* @Since : 15 December 2009
*/
define("ALLOWED_GROUP_CATEGORIES","3");
class CBGroups extends CBCategory
{

View file

@ -869,9 +869,9 @@ class CBvideo extends CBCategory
global $db;
if(is_numeric($vid))
{
$results = $db->select(tbl("video"),"*"," videoid='$vid'");
$results = $db->select(tbl("video"),"allow_rating,rating,rated_by"," videoid='$vid'");
}else
$results = $db->select(tbl("video"),"*"," videokey='$vid'");
$results = $db->select(tbl("video"),"allow_rating,rating,rated_by"," videokey='$vid'");
if($db->num_rows>0)
return $result[0];
else
@ -952,10 +952,15 @@ class CBvideo extends CBCategory
$niddle .= "|";
$flag = strstr($voter_id, $niddle);
//checking if raings are allowed or not
$vid_rating = config('video_rating');
if(!empty($flag))
e(lang("you_hv_already_rated_vdo"));
elseif(!userid())
e(lang("please_login_to_rate"));
elseif($vid_rating!=1 || $vid_rating )
e(lang("Video rating is disabled"));
else
{
if(empty($voter_id))

View file

@ -170,9 +170,6 @@ else
define('RVLIST',$row['recently_viewed_limit']); //Search Results List Per page
//Video Options
define('ALLOWED_VDO_CATS',$row['video_categories']);
define('ALLOWED_CATEGORIES',3);
define('VIDEO_COMMENT',$row['video_comments']);
define('VIDEO_RATING',$row['video_rating']);
define('COMMENT_RATING',$row['comment_rating']);
@ -293,6 +290,10 @@ else
$thisurl = curPageURL();
Assign('THIS_URL', $thisurl);
define("ALLOWED_GROUP_CATEGORIES",$row['grp_categories']);
define('ALLOWED_VDO_CATS',$row['video_categories']);
define('ALLOWED_CATEGORIES',3);
//Assigning Smarty Tags & Values
Assign('CB_VERSION',CB_VERSION);
Assign('FFMPEG_FLVTOOLS_BINARY',FFMPEG_FLVTOOLS_BINARY);

View file

@ -0,0 +1,53 @@
<p><span class="page_title">ClipBucket Cron Jobs</span><br>
Need help about crons ? here you can find some solutions</p>
<p>Following are cron job commands, please read cron <a href="http://docs.clip-bucket.com/clipbucket-docs/clipbucket-installation#after_installation">tutorial here </a>, Lat run tells you when your cron was called last time, if its &quot;No date provided&quot;, it means your cron jobs are not set properly</p>
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" align="center" valign="middle" class="left_head">&nbsp;</td>
<td width="220" class="head">Time</td>
<td class="head">Command</td>
<td width="10" class="right_head">&nbsp;</td>
</tr>
</table>
<table width="98%" border="0" cellpadding="0" cellspacing="0" class="block">
<tr>
<td width="5" align="center" valign="middle">&nbsp;</td>
<td width="220" style="font-size:14px;">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:50px">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px"></td>
<td style="font-size:14px;"><input value="php -q {$smarty.const.BASEDIR}/actions/video_convert.php &gt;/dev/null 2&gt;&amp;1 " style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:500px" onClick="this.select()">
Last Run : {$video_convert_cron|niceTime}</td>
{check_module_path path='ffmpeg' get_path='true' assign='ffmpeg_status'}
<td width="10">&nbsp;</td>
</tr>
<tr>
<td width="5" align="center" valign="middle">&nbsp;</td>
<td width="220" style="font-size:14px;">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:50px">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px"></td>
<td style="font-size:14px;"><input value="php -q {$smarty.const.BASEDIR}/actions/verify_converted_videos.php &gt;/dev/null 2&gt;&amp;1 " style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:500px" onClick="this.select()">
Last Run : {$verify_converted_videos_cron|niceTime} </td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="5" align="center" valign="middle">&nbsp;</td>
<td width="220" style="font-size:14px;">
<input value="0" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px">
<input value="0,12,13" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:50px">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px">
<input value="*" style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:10px"></td>
<td style="font-size:14px;"><input value="php -q {$smarty.const.BASEDIR}/actions/update_cb_stats.php &gt;/dev/null 2&gt;&amp;1 " style="padding:4px; margin:5px; background-color:#F2F2F2; display:inline-block; border:1px solid #CCC; width:500px" onClick="this.select()">
Last Run : {$update_cb_stats_cron|niceTime} </td>
<td>&nbsp;</td>
</tr>
</table>

View file

@ -0,0 +1,4 @@
<?php
template_files('cron_jobs.html',PLUG_DIR.'/clipbucket_helper/admin');
?>

View file

@ -0,0 +1,41 @@
<?php
/*
Plugin Name: ClipBucket Helper v1
Description: This will help you set troubleshoot your problems.
Author: Arslan Hassan
Author Website: http://clip-bucket.com/
ClipBucket Version: 2
Version: 1.0
Website: http://clip-bucket.com/
Plugin Type: global
*/
//Adding Admin Menu
add_admin_menu("ClipBucket Helper","Cron Jobs",'cron_jobs.php','clipbucket_helper/admin');
//Functions
function cron_call_writer($file)
{
$tmp_file = TEMP_DIR.'/'.$file;
$file = fopen($tmp_file,"w");
fwrite($file,now());
}
//Registering Functions
cb_register_function('cron_call_writer','video_convert_cron','video_convert_cron.txt');
cb_register_function('cron_call_writer','verify_converted_videos_cron','verify_converted_videos_cron.txt');
cb_register_function('cron_call_writer','update_cb_stats_cron','update_cb_stats_cron.txt');
$array = array('video_convert_cron.txt','verify_converted_videos_cron.txt','update_cb_stats_cron.txt');
//Reading and registering Contentings
foreach($array as $arr)
if(file_exists(TEMP_DIR.'/'.$arr))
assign(getName($arr),file_get_contents(TEMP_DIR.'/'.$arr));
?>

View file

@ -1,7 +1,4 @@
<div id="rating_container">{$Cbucket->configs.video_rating}
{if $Cbucket->configs.video_rating !=1}
{assign var="disable" value="disable"}
{/if}
<div id="rating_container">
<ul class="big_stars" id="rating_container_{$id}">
<li class="current-rating" style="width:{$perc}"></li>
<li>