Fixed : Current page and Next Page

Fixed : Photo Download Issue
Fixed : Video by filename issue
Added : ClipBucket Security Key
Fixed : SEO URls little more
Cleaned : Functions
Added : Logout Hooks
Added : Module
Added : Signup Hooks
This commit is contained in:
Arslan Hassan 2012-03-17 12:50:07 +00:00
parent b438db4a7b
commit ee101b63b9
25 changed files with 1833 additions and 1581 deletions

View file

@ -33,6 +33,8 @@ RewriteRule ^([^.]*)/?$ index.php [L]
RewriteEngine on RewriteEngine on
RewriteBase /
# #
# #
# #
@ -109,9 +111,7 @@ RewriteRule ^rss/([a-zA-Z0-9].+)$ rss.php?mode=$1&%{QUERY_STRING} [nc]
########## End - Rewrite rules For SEO urls ###################### ########## End - Rewrite rules For SEO urls ######################
RewriteRule ^([a-zA-Z0-9-]+)/?$ view_channel.php?uid=$1&seo_diret=yes [NS] RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9.]+)\.?([a-zA-Z0-9]+)?/?$ view_channel.php?uid=$1&seo_diret=yes [NC]
#Audio Start#
RewriteRule ^audio/(.*)/(.*) module.php?s=audio&p=listen_audio&a=$1
#Audio End#

View file

@ -75,6 +75,8 @@ foreach($files as $file)
} }
} }
//Sending Subscription Emails //Sending Subscription Emails
$videoDetails = $cbvideo->get_video($file['cqueue_name'],true); $videoDetails = $cbvideo->get_video($file['cqueue_name'],true);
if($videoDetails) if($videoDetails)

View file

@ -375,6 +375,9 @@ class pages{
//Assigning Variable that can be used in templates //Assigning Variable that can be used in templates
assign('pagination',$this->pagination); assign('pagination',$this->pagination);
assign('current_page',$page);
assign('total_pages',$total);
assign('next_link',$this->next_link); assign('next_link',$this->next_link);
assign('pre_link',$this->pre_link); assign('pre_link',$this->pre_link);

View file

@ -2497,6 +2497,17 @@ class CBPhotos
if($fp=@fopen($file['file_url'],'r')) { if($fp=@fopen($file['file_url'],'r')) {
$this->incrementDownload($p); $this->incrementDownload($p);
// sending the headers // sending the headers
/* Alternate Download Method
header('Content-Type: application/octet-stream');
header("Content-Length: $size");
header("Content-Disposition: attachment; filename=\"".$p['photo_title'].".".$p['ext']."\"");
header('Content-Transfer-Encoding: binary');
header('Pragma: public');
ob_clean();
flush();
readfile($photo_file);*/
header("Content-type: $mime"); header("Content-type: $mime");
header("Content-Length: $size"); header("Content-Length: $size");
header("Content-Disposition: attachment; filename=\"".$p['photo_title'].".".$p['ext']."\""); header("Content-Disposition: attachment; filename=\"".$p['photo_title'].".".$p['ext']."\"");

View file

@ -760,7 +760,9 @@ class CBvideo extends CBCategory
}else }else
{ {
if($cond!='') if($cond!='')
$cond .= ' AND ('; $cond .= ' AND (';
else
$cond .=" ( ";
$fileNameQue = 0; $fileNameQue = 0;
foreach($params['filename'] as $filename) foreach($params['filename'] as $filename)
@ -773,6 +775,7 @@ class CBvideo extends CBCategory
$cond .=" ) "; $cond .=" ) ";
} }
} }
if($params['cond']) if($params['cond'])

View file

@ -21,9 +21,15 @@
ob_start(); ob_start();
define('IN_CLIPBUCKET',true); define('IN_CLIPBUCKET',true);
define("DEVELOPMENT_MODE",FALSE); //ClipBucket Website secret key
//Check docs.clip-bucket.com for more about secret key
define('CB_SECRET_KEY','0?hx4]{o?Wu');
define("DEVELOPMENT_MODE",true);
define("DEV_INGNORE_SYNTAX",TRUE); define("DEV_INGNORE_SYNTAX",TRUE);
//Setting Cookie Timeout //Setting Cookie Timeout
define('COOKIE_TIMEOUT',86400*1); // 1 define('COOKIE_TIMEOUT',86400*1); // 1
define('GARBAGE_TIMEOUT',COOKIE_TIMEOUT); define('GARBAGE_TIMEOUT',COOKIE_TIMEOUT);
@ -45,7 +51,12 @@ if(!@$in_bg_cron)
ini_set('session.save_path', $sessdir);*/ ini_set('session.save_path', $sessdir);*/
session_start(); if (array_key_exists('session', $_REQUEST))
session_id($_REQUEST['session']);
session_start();
} }
//Required Files //Required Files
@ -67,6 +78,7 @@ if(!@$in_bg_cron)
$row = $myquery->Get_Website_Details(); $row = $myquery->Get_Website_Details();
define('DEBUG_LEVEL', 2); define('DEBUG_LEVEL', 2);
switch(DEBUG_LEVEL) switch(DEBUG_LEVEL)
@ -96,7 +108,7 @@ if(!@$in_bg_cron)
else else
{ {
error_reporting(E_ALL ^E_NOTICE); error_reporting(E_ALL ^E_NOTICE);
ini_set('display_errors', '1'); //ini_set('display_errors', '1');
} }
} }
} }
@ -423,6 +435,7 @@ if(!@$in_bg_cron)
//Assigning Smarty Tags & Values //Assigning Smarty Tags & Values
Assign('CB_VERSION',CB_VERSION); Assign('CB_VERSION',CB_VERSION);
assign('session_id',session_id());
Assign('FFMPEG_FLVTOOLS_BINARY',FFMPEG_FLVTOOLS_BINARY); Assign('FFMPEG_FLVTOOLS_BINARY',FFMPEG_FLVTOOLS_BINARY);
Assign('FFMPEG_MPLAYER_BINARY',FFMPEG_MPLAYER_BINARY); Assign('FFMPEG_MPLAYER_BINARY',FFMPEG_MPLAYER_BINARY);
Assign('PHP_PATH',PHP_PATH); Assign('PHP_PATH',PHP_PATH);

View file

@ -11,19 +11,21 @@
// We Can Set SEO urls or Simple Urls by selecting following options, by selecting YES , make sure that all ReWrites are defined in .httaccess // We Can Set SEO urls or Simple Urls by selecting following options, by selecting YES , make sure that all ReWrites are defined in .httaccess
$seo_urls = @SEO; // yes/no $seo_urls = @SEO; // yes/no
function SEO( $text, $slash=false ) { function SEO( $text, $slash=false,$iconv=true ) {
//This is the MOOOOOOOOOOST BEATUIFUL PART OF SEO URL //This is the MOOOOOOOOOOST BEATUIFUL PART OF SEO URL
if($iconv)
$text = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text); $text = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text);
$text = preg_replace('/ \&\#?[(0-9a-zA-Z){4}]+\;/','',$text); $text = preg_replace('/ \&\#?[(0-9a-zA-Z){4}]+\;/','',$text);
$entities_match = array('&quot;','!','@','#','%','^','&','*','_','(',')','+','{','}','|',':','"','<','>','?','[',']','\\',';','"',',','.','/','*','+','~','`','=',"'"); $entities_match = array('&quot;','!','@','#','%','^','&','*','_','(',')','+','{','}','|',':','"','<','>','?','[',']','\\',';','"',',','.','/','*','+','~','`','=',"'");
$new_props = array('£','¥','|','§','«','¬','¯','º','±','ª',',','µ','»','¼','½','¿','À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','Ø','Ù','Ú','Û','Ü','Ý','Þ','ß','à ','á','â','ã','ä','å','æ','ç ','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý','þ','ÿ'); $new_props = array('£','¥','|','§','«','¬','¯','º','±','ª',',','µ','»','¼','½','¿','À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','Ø','Ù','Ú','Û','Ü','Ý','Þ','ß','à ','á','â','ã','ä','å','æ','ç ','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý','þ','ÿ','%E9');
$new_replace = array('','','','','','','','','','','','u','','','','','A','A','A','A','A','A','E','C','E','E','E','E','I','I','I','I','D','N','O','O','O','O','O','O','U','U ','U','U','Y','b','B','a','a','a','a','a','a','a','c ','e','e','e','e','i','í','i','i','o','n','o','o','o','o','o','','','u','u','u','u','y','p','y'); $new_replace = array('','','','','','','','','','','','u','','','','','A','A','A','A','A','A','E','C','E','E','E','E','I','I','I','I','D','N','O','O','O','O','O','O','U','U ','U','U','Y','b','B','a','a','a','a','a','a','a','c ','e','e','e','e','i','í','i','i','o','n','o','o','o','o','o','','','u','u','u','u','y','p','y','e');
$entities_replace = array('','','','','','','','','','','','','','','','','','','','','','','',''); $entities_replace = array('','','','','','','','','','','','','','','','','','','','','','','','');
$clean_text = str_replace($entities_match, $entities_replace, $text); $clean_text = str_replace($entities_match, $entities_replace, $text);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -72,45 +72,13 @@
} }
/**
* Function used to validate username
* @input USERNAME
*/
function username_check($username)
{
global $Cbucket;
$banned_words = $Cbucket->configs['disallowed_usernames'];
$banned_words = explode(',',$banned_words);
foreach($banned_words as $word)
{
preg_match("/$word/Ui",$username,$match);
if(!empty($match[0]))
return false;
}
//Checking if its syntax is valid or not
$multi = config('allow_unicode_usernames');
//Checking Spaces
if(!config('allow_username_spaces'))
preg_match('/ /',$username,$matches);
if(!is_valid_syntax('username',$username) && $multi!='yes' || $matches)
e(lang("class_invalid_user"));
return true;
}
/**
* Function used to check weather username already exists or not
* @input USERNAME
*/
function user_exists($user)
{
global $userquery;
return $userquery->username_exists($user);
}
/** /**
* Function used to check weather email already exists or not * Function used to check weather email already exists or not
@ -595,21 +563,7 @@
} }
/**
* Function used to check weather video has Mp4 file or not
*/
function has_hq($vdetails,$is_file=false)
{
if(!$is_file)
$file = get_hq_video_file($vdetails);
else
$file = $vdetails;
if(getext($file)=='mp4' && !strstr($file,'-m'))
return $file;
else
return false;
}
/** /**
* Function used to display an ad * Function used to display an ad
@ -676,7 +630,6 @@
} }
function get_config($input){ return config($input); } function get_config($input){ return config($input); }
/** /**
* Funcion used to call functions * Funcion used to call functions
* when video is going to watched * when video is going to watched
@ -1014,15 +967,7 @@
return $total_pages = round($records+0.49,0); return $total_pages = round($records+0.49,0);
} }
/**
* Function used to return level name
* @param levelid
*/
function get_user_level($id)
{
global $userquery;
return $userquery->usr_levels[$id];
}
@ -1298,14 +1243,7 @@
} }
/**
* function used to get vidos
*/
function get_users($param)
{
global $userquery;
return $userquery->get_users($param);
}
/** /**

View file

@ -117,14 +117,7 @@
} }
/**
* FUnction used to get username from userid
*/
function get_username($uid)
{
global $userquery;
return $userquery->get_username($uid,'username');
}
/** /**
* Function used to get collection name from id * Function used to get collection name from id
@ -1650,23 +1643,6 @@
return basename(dirname($pluginFile)); return basename(dirname($pluginFile));
} }
/**
* function used to create folder for video
* and files
*/
function createDataFolders()
{
$year = date("Y");
$month = date("m");
$day = date("d");
$folder = $year.'/'.$month.'/'.$day;
@mkdir(VIDEOS_DIR.'/'.$folder,0777,true);
@mkdir(THUMBS_DIR.'/'.$folder,0777,true);
@mkdir(ORIGINAL_DIR.'/'.$folder,0777,true);
@mkdir(PHOTOS_DIR.'/'.$folder,0777,true);
return $folder;
}
/** /**
@ -1867,6 +1843,16 @@
{ {
global $db; global $db;
unset($query['order']); unset($query['order']);
$newQuery = array();
//Cleaning values...
foreach($query as $field => $value)
$newQuery[$field] = mysql_clean($value);
$counter = mysql_clean($counter);
$query = $newQuery;
$je_query = json_encode($query); $je_query = json_encode($query);
$query_md5 = md5($je_query); $query_md5 = md5($je_query);
$count = $db->count(tbl('counters'),"*","section='$section' AND query_md5='$query_md5'"); $count = $db->count(tbl('counters'),"*","section='$section' AND query_md5='$query_md5'");

View file

@ -0,0 +1,15 @@
<?php
/**
* Function used to validate category
* INPUT $cat array
*/
function validate_collection_category($array=NULL)
{
global $cbcollection;
return $cbcollection->validate_collection_category($array);
}
?>

View file

@ -0,0 +1,14 @@
<?php
/**
* Function used to validate category
* INPUT $cat array
*/
function validate_group_category($array=NULL)
{
global $cbgroup;
return $cbgroup->validate_group_category($array);
}
?>

View file

@ -0,0 +1,140 @@
<?php
/*
* $Id$
*
* @Since : 12/7/2011 - 2.7
*
* All users related functions
*/
/**
* Function used to get number of videos uploaded by user
* @param INT userid
* @param Conditions
*/
function get_user_vids($uid,$cond=NULL,$count_only=false)
{
global $userquery;
return $userquery->get_user_vids($uid,$cond,$count_only);
}
/**
* Function used to return level name
* @param levelid
*/
function get_user_level($id)
{
global $userquery;
return $userquery->usr_levels[$id];
}
/**
* function used to get vidos
*/
function get_users($param)
{
global $userquery;
return $userquery->get_users($param);
}
/**
* Function used to check weather username already exists or not
* @input USERNAME
*/
function user_exists($user)
{
global $userquery;
return $userquery->username_exists($user);
}
/**
* Function used to validate username
* @input USERNAME
*/
function username_check($username)
{
global $Cbucket;
$banned_words = $Cbucket->configs['disallowed_usernames'];
$banned_words = explode(',',$banned_words);
foreach($banned_words as $word)
{
preg_match("/$word/Ui",$username,$match);
if(!empty($match[0]))
return false;
}
//Checking if its syntax is valid or not
$multi = config('allow_unicode_usernames');
//Checking Spaces
if(!config('allow_username_spaces'))
preg_match('/ /',$username,$matches);
if(!is_valid_syntax('username',$username) && $multi!='yes' || $matches)
e(lang("class_invalid_user"));
return true;
}
/**
* FUnction used to get username from userid
*/
function get_username($uid)
{
global $userquery;
return $userquery->get_username($uid,'username');
}
/**
* Function used to get userid anywhere
* if there is no user_id it will return false
*/
function user_id()
{
global $userquery;
if($userquery->userid !='' && $userquery->is_login) return $userquery->userid; else false;
}
//alias
function userid(){return user_id();}
/**
* Function used to get username anywhere
* if there is no usern_name it will return false
*/
function user_name()
{
global $userquery;
if($userquery->user_name)
return $userquery->user_name;
else
return $userquery->get_logged_username();
}
function username(){return user_name();}
/**
* Function used to check weather user access or not
*/
function has_access($access,$check_only=TRUE,$verify_logged_user=true)
{
global $userquery;
return $userquery->login_check($access,$check_only,$verify_logged_user);
}
/**
* Function used to get user avatar
* @param ARRAY $userdetail
* @param SIZE $int
*/
function avatar($param)
{
global $userquery;
$udetails = $param['details'];
$size = $param['size'];
$uid = $param['uid'];
return $userquery->avatar($udetails,$size,$uid);
}
?>

View file

@ -425,3 +425,469 @@ function getSmartyThumb($params)
{ {
return get_thumb($params['vdetails'],$params['num'],$params['multi'],$params['count_only'],true,true,$params['size']); return get_thumb($params['vdetails'],$params['num'],$params['multi'],$params['count_only'],true,true,$params['size']);
} }
/**
* Function used to check weather video has Mp4 file or not
*/
function has_hq($vdetails,$is_file=false)
{
$custom_funcs = cb_get_functions('has_hq');
if($custom_funcs && !$is_file)
foreach($custom_funcs as $func)
{
if(function_exists($func))
{
return $func($vdetails);
}
}
if(!$is_file)
$file = get_hq_video_file($vdetails);
else
$file = $vdetails;
if(getext($file)=='mp4' && !strstr($file,'-m'))
return $file;
else
return false;
}
/**
* Gets video link , used in Smarty
* {VideoLink vdetails=$vdata type=link,playlist assign=somevar}
* @param type $params
* @return type
*/
function videoSmartyLink($params)
{
$link = VideoLink($params['vdetails'],$params['type']);
if(!$params['assign'])
return $link;
else
assign($params['assign'],$link);
}
/**
* function used to validate Video Category
*
* @global type $myquery
* @global type $LANG
* @global type $cbvid
* @param type $array
* @return type
*/
function validate_vid_category($array=NULL)
{
global $myquery,$LANG,$cbvid;
if($array==NULL)
$array = $_POST['category'];
if(count($array)==0)
return false;
else
{
foreach($array as $arr)
{
if($cbvid->category_exists($arr))
$new_array[] = $arr;
}
}
if(count($new_array)==0)
{
e(lang('vdo_cat_err3'));
return false;
}elseif(count($new_array)>ALLOWED_VDO_CATS)
{
e(sprintf(lang('vdo_cat_err2'),ALLOWED_VDO_CATS));
return false;
}
return true;
}
/**
* Function used to check videokey exists or not
* key_exists
*/
function vkey_exists($key)
{
global $db;
$db->select(tbl("video"),"videokey"," videokey='$key'");
if($db->num_rows>0)
return true;
else
return false;
}
/**
* Function used to check file_name exists or not
* as its a unique name so it will not let repost the data
*/
function file_name_exists($name)
{
global $db;
$results = $db->select(tbl("video"),"videoid,file_name"," file_name='$name'");
if($db->num_rows >0)
return $results[0]['videoid'];
else
return false;
}
/**
* Function used to get video from conversion queue
*/
function get_queued_video($update=TRUE,$fileName=NULL)
{
global $db;
$max_conversion = config('max_conversion');
$max_conversion = $max_conversion ? $max_conversion : 2;
$max_time_wait = config('max_time_wait'); //Maximum Time Wait to make PRocessing Video Automatcially OK
$max_time_wait = $max_time_wait ? $max_time_wait : 7200;
//First Check How Many Videos Are In Queu Already
$processing = $db->count(tbl("conversion_queue"),"cqueue_id"," cqueue_conversion='p' ");
if(true)
{
if($fileName)
{
$queueName = getName($fileName);
$ext = getExt($fileName);
$fileNameQuery = " AND cqueue_name ='$queueName' AND cqueue_ext ='$ext' ";
}
$results = $db->select(tbl("conversion_queue"),"*","cqueue_conversion='no' $fileNameQuery",1);
$result = $results[0];
if($update)
$db->update(tbl("conversion_queue"),array("cqueue_conversion","time_started"),array("p",time())," cqueue_id = '".$result['cqueue_id']."'");
return $result;
}else
{
//Checking if video is taking more than $max_time_wait to convert so we can change its time to
//OK Automatically
//Getting All Videos That are being processed
$results = $db->select(tbl("conversion_queue"),"*"," cqueue_conversion='p' ");
foreach($results as $vid)
{
if($vid['time_started'])
{
if($vid['time_started'])
$time_started = $vid['time_started'];
else
$time_started = strtotime($vid['date_added']);
$elapsed_time = time()-$time_started;
if($elapsed_time>$max_time_wait)
{
//CHanging Status TO OK
$db->update(tbl("conversion_queue"),array("cqueue_conversion"),
array("yes")," cqueue_id = '".$result['cqueue_id']."'");
}
}
}
return false;
}
}
/**
* Function used to get video being processed
*/
function get_video_being_processed($fileName=NULL)
{
global $db;
if($fileName)
{
$queueName = getName($fileName);
$ext = getExt($fileName);
$fileNameQuery = " AND cqueue_name ='$queueName' AND cqueue_ext ='$ext' ";
}
$results = $db->select(tbl("conversion_queue"),"*","cqueue_conversion='p' $fileNameQuery");
return $results;
}
function get_video_details($vid=NULL)
{
global $myquery;
if(!$vid)
global $vid;
return $myquery->get_video_details($vid);
}
/**
* Function used to get all video files
* @param Vdetails
* @param $count_only
* @param $with_path
*/
function get_all_video_files($vdetails,$count_only=false,$with_path=false)
{
$details = get_video_file($vdetails,true,$with_path,true,$count_only);
if($count_only)
return count($details);
return $details;
}
function get_all_video_files_smarty($params)
{
$vdetails = $params['vdetails'];
$count_only = $params['count_only'];
$with_path = $params['with_path'];
return get_all_video_files($vdetails,$count_only,$with_path);
}
/**
* Function use to get video files
*/
function get_video_file($vdetails,$return_default=true,$with_path=true,$multi=false,$count_only=false,$hq=false)
{
global $Cbucket;
# checking if there is any other functions
# available
if(is_array($Cbucket->custom_video_file_funcs))
foreach($Cbucket->custom_video_file_funcs as $func)
if(function_exists($func))
{
$func_returned = $func($vdetails, $hq);
if($func_returned)
return $func_returned;
}
#Now there is no function so lets continue as (WITH .files)
if($vdetails['file_name'])
$vid_files = glob(VIDEOS_DIR."/".$vdetails['file_name'].".*");
#Now there is no function so lets continue as (WITH - files)
if($vdetails['file_name'])
$vid_files_more = glob(VIDEOS_DIR."/".$vdetails['file_name']."-*");
if($vid_files && $vid_files_more)
$vid_files = array_merge($vid_files,$vid_files_more);
#replace Dir with URL
if(is_array($vid_files))
foreach($vid_files as $file)
{
$files_part = explode('/',$file);
$video_file = $files_part[count($files_part)-1];
if($with_path)
$files[] = VIDEOS_URL.'/'.$video_file;
else
$files[] = $video_file;
}
if(count($files)==0 && !$multi && !$count_only)
{
if($return_default)
{
if($with_path)
return VIDEOS_URL.'/no_video.flv';
else
return 'no_video.flv';
}else{
return false;
}
}else{
if($multi)
return $files;
if($count_only)
return count($files);
foreach($files as $file)
{
if($hq)
{
if(getext($file)=='mp4' && !strstr($file,'-m'))
{
return $file;
break;
}
}else{
return $file;
break;
}
}
return $files[0];
}
}
/**
* FUnction used to get HQ ie mp4 video
*/
function get_hq_video_file($vdetails,$return_default=true)
{
return get_video_file($vdetails,$return_default,true,false,false,true);
}
/**
* Function used to update processed video
* @param Files details
*/
function update_processed_video($file_array,$status='Successful',$ingore_file_status=false,$failed_status='')
{
global $db;
$file = $file_array['cqueue_name'];
$array = explode('-',$file);
if(!empty($array[0]))
$file_name = $array[0];
$file_name = $file;
$file_path = VIDEOS_DIR.'/'.$file_array['cqueue_name'].'.flv';
$file_size = @filesize($file_path);
if(file_exists($file_path) && $file_size>0 && !$ingore_file_status)
{
$stats = get_file_details($file_name);
//$duration = $stats['output_duration'];
//if(!$duration)
// $duration = $stats['duration'];
$duration = parse_duration(LOGS_DIR.'/'.$file_array['cqueue_name'].'.log');
$db->update(tbl("video"),array("status","duration","failed_reason"),
array($status,$duration,$failed_status)," file_name='".$file_name."'");
}else
{
$stats = get_file_details($file_name);
//$duration = $stats['output_duration'];
//if(!$duration)
// $duration = $stats['duration'];
$duration = parse_duration(LOGS_DIR.'/'.$file_array['cqueue_name'].'.log');
$db->update(tbl("video"),array("status","duration","failed_reason"),
array('Failed',$duration,$failed_status)," file_name='".$file_name."'");
}
}
/**
* This function will activate the video if file exists
*/
function activate_video_with_file($vid)
{
global $db;
$vdetails = get_video_details($vid);
$file_name = $vdetails['file_name'];
$results = $db->select(tbl("conversion_queue"),"*"," cqueue_name='$file_name' AND cqueue_conversion='yes'");
$result = $results[0];
update_processed_video($result);
}
/**
* Function Used to get video file stats from database
* @param FILE_NAME
*/
function get_file_details($file_name)
{
global $db;
//$result = $db->select(tbl("video_files"),"*"," id ='$file_name' OR src_name = '$file_name' ");
//Reading Log File
$file = LOGS_DIR.'/'.$file_name.'.log';
if(!file_exists($file))
$file = $file_name;
if(file_exists($file))
{
$data = file_get_contents($file);
//$file = file_get_contents('1260270267.log');
preg_match_all('/(.*) : (.*)/',trim($data),$matches);
$matches_1 = ($matches[1]);
$matches_2 = ($matches[2]);
for($i=0;$i<count($matches_1);$i++)
{
$statistics[trim($matches_1[$i])] = trim($matches_2[$i]);
}
if(count($matches_1)==0)
{
return false;
}
$statistics['conversion_log'] = $data;
return $statistics;
}else
return false;
}
function parse_duration($log)
{
$duration = false;
$log_details = get_file_details($log);
$duration = $log['output_duration'];
if(!$duration || !is_numeric($duration))
$duration = $log['duration'];
if(!$duration || !is_numeric($duration))
{
if(file_exists($log))
$log_content = file_get_contents($log);
//Parse duration..
preg_match_all('/Duration: ([0-9]{1,2}):([0-9]{1,2}):([0-9.]{1,5})/i',$log_content,$matches);
unset($log_content);
//Now we will multiple hours, minutes accordingly and then add up with seconds to
//make a single variable of duration
$hours = $matches[1][0];
$minutes = $matches[2][0];
$seconds = $matches[3][0];
$hours = $hours * 60 * 60;
$minutes = $minutes * 60;
$duration = $hours+$minutes+$seconds;
$duration;
}
return $duration;
}
/**
* Function used to get thumbnail number from its name
* Updated: If we provide full path for some reason and
* web-address has '-' in it, this means our result is messed.
* But we know our number will always be in last index
* So wrap it with end() and problem solved.
*/
function get_thumb_num($name)
{
$list = end(explode('-',$name));
$list = explode('.',$list);
return $list[0];
}
/**
* Function used to remove thumb
*/
function delete_video_thumb($file)
{
global $LANG;
$path = THUMBS_DIR.'/'.$file;
if(file_exists($path))
{
unlink($path);
e(lang('video_thumb_delete_msg'),'m');
}else{
e(lang('video_thumb_delete_err'));
}
}

View file

@ -141,15 +141,19 @@
/** /**
* add link in admin area left menu
*
* Function used to add items in admin menu * Function used to add items in admin menu
* This function will insert new item in admin menu * This function will insert new item in admin menu
* under given header, if the header is not available * under given header, if the header is not available
* it will create one, ( Header means titles ie 'Plugins' 'Videos' etc) * it will create one, ( Header means titles ie 'Plugins' 'Videos' etc)
* @param STRING $header - Could be Plugin , Videos, Users , please check * http://docs.clip-bucket.com/add_admin_menu-function for reference
* http://docs.clip-bucket.com. for reference *
* @param STRING name * @param STRING $header - Could be Plugin , Videos, Users ,
* @param STRING link * @param STRING $name - Menu title
* That will add new item in admin menu * @param STRING $link - Menu Link
* @param STRING $plug_folder - Path to plugin folder
* @param STRING $is_player_file - Just to tell if plugin is somehow related to players
*/ */
function add_admin_menu($header='Tool Box',$name,$link,$plug_folder=false,$is_player_file=false) function add_admin_menu($header='Tool Box',$name,$link,$plug_folder=false,$is_player_file=false)
{ {

View file

@ -3,7 +3,7 @@
*************************************************************** ***************************************************************
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved. | Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
| @ Author : ArslanHassan | @ Author : ArslanHassan
| @ Software : ClipBucket , © PHPBucket.com | @ Software : ClipBucket , <EFBFBD> PHPBucket.com
**************************************************************** ****************************************************************
*/ */
@ -14,7 +14,7 @@ $pages->page_redir();
if(is_installed('editorspick')) if(is_installed('editorspick'))
{ {
assign('editor_picks',get_ep_videos()); assign('editor_picks',get_ep_videos());
} }
// i love coding :) // i love coding :)

View file

@ -1,6 +1,9 @@
<?php <?php
require_once 'includes/config.inc.php'; require_once 'includes/config.inc.php';
$userquery->logout(); $userquery->logout();
if(cb_get_functions('logout')) cb_call_functions('logout');
setcookie('is_logout','yes',time()+3600,'/'); setcookie('is_logout','yes',time()+3600,'/');
redirect_to(BASEURL); redirect_to(BASEURL);
?> ?>

View file

@ -8,8 +8,6 @@
*/ */
define("IN_MODULE",true); define("IN_MODULE",true);
define("PARENT_PAGE",$_GET['s']);
define("THIS_PAGE",$_GET['p']);
require 'includes/config.inc.php'; require 'includes/config.inc.php';
@ -19,7 +17,7 @@ $pages->page_redir();
load_modules(); load_modules();
if(!defined("THIS_PAGE")) if(!defined("THIS_PAGE"))
e("Invalid module"); e("Invalid module");
display_it(); display_it();

21
upload/out.php Normal file
View file

@ -0,0 +1,21 @@
<?php
/**
* file used to redirect links to outer website
*/
include("includes/config.inc.php");
$link = urldecode($_GET['l']);
if(!$link)
redirect_to(BASEURL);
if(!strstr($link,'http'))
$link = "http://".$link;
redirect_to($link);
exit();
?>

View file

@ -46,7 +46,8 @@ if(!function_exists('cb_player'))
{ {
$hd = $data['hq']; $hd = $data['hq'];
if($hd=='yes') $file = get_hq_video_file($vdetails); else $file = get_video_file($vdetails,true,true); if($hd=='yes') $file = get_hq_video_file($vdetails);
else $file = get_video_file($vdetails,true,true);
$hd_file = get_hq_video_file($vdetails); $hd_file = get_hq_video_file($vdetails);

View file

@ -10,10 +10,10 @@
$Cbucket->upload_opt_list['link_video_link'] = $Cbucket->upload_opt_list['link_video_link'] =
array( array(
'title' => lang('remote_play'), 'title' => lang('remote_play'),
'load_func' => 'load_link_video_form', 'load_func' => 'load_link_video_form',
); );
/** /**

View file

@ -57,10 +57,12 @@ if(isset($_POST['login'])){
if($userquery->login_user($username,$password,$remember)) if($userquery->login_user($username,$password,$remember))
{ {
if($_COOKIE['pageredir']) if(cb_get_functions('login_success')) cb_call_functions('login_success');
redirect_to($_COOKIE['pageredir']);
else if($_COOKIE['pageredir'])
redirect_to(cblink(array('name'=>'my_account'))); redirect_to($_COOKIE['pageredir']);
else
redirect_to(cblink(array('name'=>'my_account')));
} }
} }

View file

@ -1,3 +1,120 @@
<div id="wrap">
<div class="inner_wrap">
{assign var=sort value=$smarty.get.sort|replace:'most_commented':'commented'}
<div class="itemListTitle br3 b89" id="sortingDD">
{lang code=$sort} <span class="itemListTitleArrow"></span>
<div style="border-bottom:1px solid #ddd; width:150px; position:absolute;bottom:-2px; left:0px"></div>
<div class="itemListDD br3_bottom b89" style="display:none" id="sortingDDList">
<ul>
{assign var=sorting_links value=func->sorting_links()}
{foreach from=$sorting_links item=name key=sort name=sorts}
<li><a href="{link name=sort sort=$sort type=videos}">{$name}</a></li>
{/foreach}
</ul>
</div>
</div>
{assign var=time_frame value=$smarty.get.time|replace:'_':''"}
<div class="itemListTitle br3 b89" id="timingDD">
{lang code=$time_frame} <span class="itemListTitleArrow"></span>
<div style="border-bottom:1px solid #ddd; width:150px; position:absolute;bottom:-2px; left:0px"></div>
<div class="itemListDD br3_bottom b89" style="display:none" id="timingDDList">
<ul>
{assign var=time_links value=func->time_links()}
{foreach from=$time_links item=name key=sort name=times}
<li><a href="{link name=time sort=$sort type=videos}">{$name}</a></li>
{/foreach}
</ul>
</div>
</div>
{cbCategories assign="category_list" type='v' with_all=TRUE echo=TRUE}
<div class="itemListTitle br3 b89" id="catDD" style="float:right">
{if $smarty.get.cat == 'all' || $smarty.get.cat == ''}
All Categories
{else}
{$cbvid->get_category_field($smarty.get.cat,'category_name')}
{/if}
<span class="itemListTitleArrow"></span>
<div style="border-bottom:1px solid #ddd; width:150px; position:absolute;bottom:-2px; left:0px"></div>
<div class="itemListDD br3_bottom b89" style="display:none" id="catDDList">
{if $category_list}
<ul>
{$category_list}
</ul>
{/if}
</div>
</div>
<div style="clear:both"></div>
</div>
<script>
{literal}
$('#sortingDD')
.bind('mouseenter',function(){ $('#sortingDDList').show()});
$('#sortingDDList,#sortingDD').bind('mouseleave',function(){ $('#sortingDDList').hide() });
$('#timingDD')
.bind('mouseenter',function(){ $('#timingDDList').show()});
$('#timingDDList,#timingDD').bind('mouseleave',function(){ $('#timingDDList').hide() });
$('#catDD')
.bind('mouseenter',function(){ $('#catDDList').show()});
$('#catDDList,#catDD').bind('mouseleave',function(){ $('#catDDList').hide() });
{/literal}
</script>
<div class="break2"></div>
<div class="inner_wrap clearfix">
{section name=v_list loop=$videos}
{include file="$style_dir/blocks/video.html"
view_video="normal" video=$videos[v_list] number=$smarty.section.v_list.iteration}
{sectionelse}
{lang code='no_results_found'}
{/section}
<div class="clear"></div>
{include file="$style_dir/blocks/pagination.html"}
</div> <!--inner_wrap end-->
</div>
<!-- Listing Categories --> <!-- Listing Categories -->
{include file="$style_dir/blocks/category_list.html" type='collections'} {include file="$style_dir/blocks/category_list.html" type='collections'}
<!-- Listing Categories End --> <!-- Listing Categories End -->

View file

@ -10,7 +10,7 @@
{ANCHOR place='mature_content'} {ANCHOR place='mature_content'}
{ANCHOR place='above_menu'}
{ANCHOR place='premium_button'} {ANCHOR place='premium_button'}