From ee101b63b9f5cf3e9fd736371e66a0b4351c1110 Mon Sep 17 00:00:00 2001 From: Arslan Hassan Date: Sat, 17 Mar 2012 12:50:07 +0000 Subject: [PATCH] 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 --- upload/.htaccess | 10 +- upload/actions/verify_converted_videos.php | 2 + upload/includes/classes/pages.class.php | 3 + upload/includes/classes/photos.class.php | 11 + upload/includes/classes/video.class.php | 7 +- upload/includes/common.php | 19 +- upload/includes/define_php_links.php | 8 +- upload/includes/functions.php | 1006 +++++++++++- upload/includes/functions1.php | 1415 ----------------- upload/includes/functions2.php | 72 +- upload/includes/functions3.php | 38 +- upload/includes/functions_collections.php | 15 + upload/includes/functions_groups.php | 14 + upload/includes/functions_users.php | 140 ++ upload/includes/functions_videos.php | 466 ++++++ upload/includes/plugin.functions.php | 14 +- upload/index.php | 4 +- upload/logout.php | 3 + upload/module.php | 4 +- upload/out.php | 21 + upload/player/cbplayer/cbplayer.php | 3 +- .../plugins/cb_link_video/cb_link_video.php | 10 +- upload/signup.php | 10 +- upload/styles/cbv2new/layout/collections.html | 117 ++ upload/styles/cbv2new/layout/header.html | 2 +- 25 files changed, 1833 insertions(+), 1581 deletions(-) delete mode 100644 upload/includes/functions1.php create mode 100644 upload/includes/functions_collections.php create mode 100644 upload/includes/functions_groups.php create mode 100644 upload/includes/functions_users.php create mode 100644 upload/out.php diff --git a/upload/.htaccess b/upload/.htaccess index a35b6d55..2f86d835 100644 --- a/upload/.htaccess +++ b/upload/.htaccess @@ -33,6 +33,8 @@ RewriteRule ^([^.]*)/?$ index.php [L] 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 ###################### -RewriteRule ^([a-zA-Z0-9-]+)/?$ view_channel.php?uid=$1&seo_diret=yes [NS] +RewriteCond %{SCRIPT_FILENAME} !-d +RewriteCond %{SCRIPT_FILENAME} !-f - -#Audio Start# -RewriteRule ^audio/(.*)/(.*) module.php?s=audio&p=listen_audio&a=$1 -#Audio End# \ No newline at end of file +RewriteRule ^([a-zA-Z0-9.]+)\.?([a-zA-Z0-9]+)?/?$ view_channel.php?uid=$1&seo_diret=yes [NC] \ No newline at end of file diff --git a/upload/actions/verify_converted_videos.php b/upload/actions/verify_converted_videos.php index b8f52c44..8e41a187 100644 --- a/upload/actions/verify_converted_videos.php +++ b/upload/actions/verify_converted_videos.php @@ -75,6 +75,8 @@ foreach($files as $file) } } + + //Sending Subscription Emails $videoDetails = $cbvideo->get_video($file['cqueue_name'],true); if($videoDetails) diff --git a/upload/includes/classes/pages.class.php b/upload/includes/classes/pages.class.php index 584c0b7c..3b1c53b9 100644 --- a/upload/includes/classes/pages.class.php +++ b/upload/includes/classes/pages.class.php @@ -375,6 +375,9 @@ class pages{ //Assigning Variable that can be used in templates assign('pagination',$this->pagination); + assign('current_page',$page); + assign('total_pages',$total); + assign('next_link',$this->next_link); assign('pre_link',$this->pre_link); diff --git a/upload/includes/classes/photos.class.php b/upload/includes/classes/photos.class.php index 185bb202..5dc5d397 100644 --- a/upload/includes/classes/photos.class.php +++ b/upload/includes/classes/photos.class.php @@ -2497,6 +2497,17 @@ class CBPhotos if($fp=@fopen($file['file_url'],'r')) { $this->incrementDownload($p); // 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-Length: $size"); header("Content-Disposition: attachment; filename=\"".$p['photo_title'].".".$p['ext']."\""); diff --git a/upload/includes/classes/video.class.php b/upload/includes/classes/video.class.php index b4e8f5f0..a05b5d90 100644 --- a/upload/includes/classes/video.class.php +++ b/upload/includes/classes/video.class.php @@ -760,8 +760,10 @@ class CBvideo extends CBCategory }else { if($cond!='') - $cond .= ' AND ('; - + $cond .= ' AND ('; + else + $cond .=" ( "; + $fileNameQue = 0; foreach($params['filename'] as $filename) { @@ -773,6 +775,7 @@ class CBvideo extends CBCategory $cond .=" ) "; } + } if($params['cond']) diff --git a/upload/includes/common.php b/upload/includes/common.php index 6da7b692..008cc733 100644 --- a/upload/includes/common.php +++ b/upload/includes/common.php @@ -21,9 +21,15 @@ ob_start(); 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); + + //Setting Cookie Timeout define('COOKIE_TIMEOUT',86400*1); // 1 define('GARBAGE_TIMEOUT',COOKIE_TIMEOUT); @@ -45,7 +51,12 @@ if(!@$in_bg_cron) ini_set('session.save_path', $sessdir);*/ - session_start(); + if (array_key_exists('session', $_REQUEST)) + session_id($_REQUEST['session']); + + session_start(); + + } //Required Files @@ -67,6 +78,7 @@ if(!@$in_bg_cron) $row = $myquery->Get_Website_Details(); + define('DEBUG_LEVEL', 2); switch(DEBUG_LEVEL) @@ -96,7 +108,7 @@ if(!@$in_bg_cron) else { 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 Assign('CB_VERSION',CB_VERSION); + assign('session_id',session_id()); Assign('FFMPEG_FLVTOOLS_BINARY',FFMPEG_FLVTOOLS_BINARY); Assign('FFMPEG_MPLAYER_BINARY',FFMPEG_MPLAYER_BINARY); Assign('PHP_PATH',PHP_PATH); diff --git a/upload/includes/define_php_links.php b/upload/includes/define_php_links.php index d1d49439..d8da01e3 100644 --- a/upload/includes/define_php_links.php +++ b/upload/includes/define_php_links.php @@ -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 $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 + if($iconv) $text = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text); $text = preg_replace('/ \&\#?[(0-9a-zA-Z){4}]+\;/','',$text); $entities_match = array('"','!','@','#','%','^','&','*','_','(',')','+','{','}','|',':','"','<','>','?','[',']','\\',';','"',',','.','/','*','+','~','`','=',"'"); - $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('','','','','','','','','','','','','','','','','','','','','','','',''); $clean_text = str_replace($entities_match, $entities_replace, $text); diff --git a/upload/includes/functions.php b/upload/includes/functions.php index d2a0fad4..b98d7305 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -70,7 +70,8 @@ return $string; } - function cb_clean($string,$array=array('no_html'=>true,'mysql_clean'=>false)) + function cb_clean($string,$array=array('no_html'=>true, + 'mysql_clean'=>false)) { if($array['no_html']) $string = htmlentities($string); @@ -83,7 +84,9 @@ return $string; } - //This Fucntion is for Securing Password, you may change its combination for security reason but make sure dont not rechange once you made your script run + //This Fucntion is for Securing Password, + // you may change its combination for security reason but make + // sure dont not rechange once you made your script run function pass_code($string) { $password = md5(md5(sha1(sha1(md5($string))))); @@ -350,7 +353,7 @@ //Function Used TO Get Extensio Of File function GetExt($file){ - return substr($file, strrpos($file,'.') + 1); + return strtolower(substr($file, strrpos($file,'.') + 1)); } @@ -649,40 +652,40 @@ */ function getComments($params=NULL) { - global $db; - $order = $params['order']; - $limit = $params['limit']; - $type = $params['type']; - $cond = ''; - if(empty($type)) - $type = "v"; - $cond .= tbl("comments.type")." = '".$type."'"; - - if($params['type_id'] && $params['sectionTable']) - { - if($cond != "") - $cond .= " AND "; - $cond .= tbl("comments.type_id")." = ".tbl($params['sectionTable'].".".$params['type_id']); - } - - if($params['cond']) - { - if($cond != "") - $cond .= " AND "; - $cond .= $params['cond']; - } - - if(!$params['count_only']) - $result = $db->select(tbl("comments".($params['sectionTable']?",".$params['sectionTable']:NULL)),"*",$cond,$limit,$order); - - //echo $db->db_query; - if($params['count_only']) - $result = $db->count(tbl("comments"),"*",$cond); - - if($result) - return $result; - else - return false; + global $db; + $order = $params['order']; + $limit = $params['limit']; + $type = $params['type']; + $cond = ''; + if(empty($type)) + $type = "v"; + $cond .= tbl("comments.type")." = '".$type."'"; + + if($params['type_id'] && $params['sectionTable']) + { + if($cond != "") + $cond .= " AND "; + $cond .= tbl("comments.type_id")." = ".tbl($params['sectionTable'].".".$params['type_id']); + } + + if($params['cond']) + { + if($cond != "") + $cond .= " AND "; + $cond .= $params['cond']; + } + + if(!$params['count_only']) + $result = $db->select(tbl("comments".($params['sectionTable']?",".$params['sectionTable']:NULL)),"*",$cond,$limit,$order); + + //echo $db->db_query; + if($params['count_only']) + $result = $db->count(tbl("comments"),"*",$cond); + + if($result) + return $result; + else + return false; } @@ -690,12 +693,937 @@ { return BASEURL.'/out.php?l='.urlencode($link); } - + + + + /** + * this_page() + * + * get current page name as defined in THIS_PAGE static variable + * + * @param STRING $page_name + * @return STRING current_page + */ + function this_page($page) + { + if(defined('THIS_PAGE')) + return THIS_PAGE; + else + return 'index'; + } + /** + * isValidToken() + * + * validate input token given in $_POST request when submitting data in + * ClipBucket. + * + * @param STRING $token + * @param STRING $method + * + * return BOOLEAN + */ + function isValidToken($token,$method=NULL) + { + $fullToken = getToken($method); + if($fullToken!=$token) + return false; + else { + return true; + } + } + + /** + * getToken() + * + * Function used to get current token + * + * @param STRING $method + * @return STRING $token + */ + function getToken($method=NULL) + { + $sess = session_id(); + $ip = $_SERVER['REMOTE_ADDR']; + $webkey = ""; + + if(defined('CB_WEBSITE_KEY')) + { + $webkey = CB_WEBSITE_KEY; + } + + if($webkey) + $fullToken = md5($sess.$method.$ip.$webkey); + else + $fullToken = md5($sess.$method.$ip); + + return $fullToken; + } + + /** + * createDataFolders() + * + * create date folders with respect to date. so that no folder gets overloaded + * with number of files. + * + * @param string FOLDER, if set to null, sub-date-folders will be created in + * all data folders + * @return string + */ + function createDataFolders($headFolder=NULL) + { + $year = date("Y"); + $month = date("m"); + $day = date("d"); + $folder = $year.'/'.$month.'/'.$day; + if(!$headFolder) + { + @mkdir(VIDEOS_DIR.'/'.$folder,0777,true); + @mkdir(THUMBS_DIR.'/'.$folder,0777,true); + @mkdir(ORIGINAL_DIR.'/'.$folder,0777,true); + @mkdir(PHOTOS_DIR.'/'.$folder,0777,true); + }else + { + @mkdir($headFolder.'/'.$folder,0777,true); + } + return $folder; + } + + + /** + * Gets the list of comments and assign it the given paramter + * @global type $myquery + * @param type $params ARGUMENTS , assign=variable to assign comments array + * in smarty template, read getComments for more information + * @return ARRAY $comments + */ + function getSmartyComments($params) + { + global $myquery; + $comments = $myquery->getComments($params); + + if($params['assign']) + assign($params['assign'],$comments); + else + return $comments; + } + + + /** + * This wil get an Advertisment from database and display it + * + * @global type $adsObj + * @param ARRAY (style,class,align,place) + * style = Css Styling on div wrapping AD + * class = class of div wrapping AD + * place = AD placement code e.g ad_300x250 + * @return string + */ + function getAd($params) + { + global $adsObj; + $data = ''; + if($params['style'] || $params['class'] || $params['align']) + $data .= '
'; + $data .= ad($adsObj->getAd($params['place'])); + if($params['style'] || $params['class'] || $params['align']) + $data .= '
'; + return $data; + } + + + /** + * FUNCTION USED TO GET VIDEO RATING IN SMARTY + * @param : array(pullRating($videos[$id]['videoid'],false,false,false,'novote'); + */ + function pullSmartyRating($param) + { + return pullRating($param['id'],$param['show5'],$param['showPerc'],$aram['showVotes'],$param['static']); + } + + + /** + * FUNCTION USED TO CLEAN VALUES THAT CAN BE USED IN FORMS + */ + function cleanForm($string) + { + if(is_string($string)) + $string = htmlspecialchars($string); + if(get_magic_quotes_gpc()) + if(!is_array($string)) + $string = stripslashes($string); + return $string; + } + function form_val($string){return cleanForm($string); } + + //Escaping Magic Quotes + + /** + * FUNCTION USED TO MAKE TAGS MORE PERFECT + * @Author : Arslan Hassan + * @param tags text unformatted + * returns tags formatted + */ + function genTags($tags,$sep=',') + { + //Remove fazool spaces + $tags = preg_replace(array('/ ,/','/, /'),',',$tags); + $tags = preg_replace( "`[,]+`" , ",", $tags); + $tag_array = explode($sep,$tags); + foreach($tag_array as $tag) + { + if(isValidtag($tag)) + { + $newTags[] = $tag; + } + + } + //Creating new tag string + if(is_array($newTags)) + $tagString = implode(',',$newTags); + else + $tagString = 'no-tag'; + return $tagString; + } + + /** + * FUNCTION USED TO VALIDATE TAG + * @Author : Arslan Hassan + * @param tag + * return true or false + */ + function isValidtag($tag) + { + $disallow_array = array + ('of','is','no','on','off','a','the','why','how','what','in'); + if(!in_array($tag,$disallow_array) && strlen($tag)>2) + return true; + else + return false; + } + + + /** + * FUNCTION USED TO GET CATEGORY LIST + */ + function getCategoryList($params=false) + { + global $cats; + $cats = ""; + + $type = $params['type']; + switch($type) + { + default: + { + cb_call_functions('categoryListing',$params); + } + break; + + case "video":case "videos": + case "v": + { + global $cbvid; + $cats = $cbvid->cbCategories($params); + } + break; + + case "users":case "user": + case "u": case "channels": case "channels": + { + global $userquery; + $cats = $userquery->cbCategories($params); + } + break; + + case "group":case "groups": + case "g": + { + global $cbgroup; + $cats = $cbgroup->cbCategories($params); + } + break; + + case "collection":case "collections": + case "cl": + { + global $cbcollection; + $cats = $cbcollection->cbCategories($params); + } + break; + } + + return $cats; + } + + + function cb_bottom() + { + //Woops..its gone + } + + function getSmartyCategoryList($params) + { + return getCategoryList($params); + } + + + + /** + * Function used to insert data in database + * @param : table name + * @param : fields array + * @param : values array + * @param : extra params + */ + function dbInsert($tbl,$flds,$vls,$ep=NULL) + { + global $db ; + $db->insert($tbl,$flds,$vls,$ep); + } + + /** + * Function used to Update data in database + * @param : table name + * @param : fields array + * @param : values array + * @param : Condition params + * @params : Extra params + */ + function dbUpdate($tbl,$flds,$vls,$cond,$ep=NULL) + { + global $db ; + return $db->update($tbl,$flds,$vls,$cond,$ep); + } + + + + /** + * Function used to Delete data in database + * @param : table name + * @param : fields array + * @param : values array + * @params : Extra params + */ + function dbDelete($tbl,$flds,$vls,$ep=NULL) + { + global $db ; + return $db->delete($tbl,$flds,$vls,$ep); + } + + + /** + ** + */ + function cbRocks() + { + define("isCBSecured",TRUE); + //echo cbSecured(CB_SIGN); + } + + /** + * Insert Id + */ + function get_id($code) + { + global $Cbucket; + $id = $Cbucket->ids[$code]; + if(empty($id)) $id = $code; + return $id; + } + + /** + * Set Id + */ + function set_id($code,$id) + { + global $Cbucket; + return $Cbucket->ids[$code]=$id; + } + + + /** + * Function used to select data from database + */ + function dbselect($tbl,$fields='*',$cond=false,$limit=false,$order=false,$p=false) + { + global $db; + return $db->dbselect($tbl,$fields,$cond,$limit,$order,$p); + } + + + /** + * Function used to count fields in mysql + * @param TABLE NAME + * @param Fields + * @param condition + */ + function dbcount($tbl,$fields='*',$cond=false) + { + global $db; + if($cond) + $condition = " Where $cond "; + $query = "Select Count($fields) From $tbl $condition"; + $result = $db->Execute($query); + $db->total_queries++; + $db->total_queries_sql[] = $query; + return $result->fields[0]; + } + + /** + * An easy function for erorrs and messages (e is basically short form of exception) + * I dont want to use the whole Trigger and Exception code, so e pretty works for me :D + * @param TEXT $msg + * @param TYPE $type (e for Error, m for Message + * @param INT $id Any Predefined Message ID + */ + + function e($msg=NULL,$type='e',$id=NULL) + { + global $eh; + if(!empty($msg)) + return $eh->e($msg,$type,$id); + } + + + /** + * Function used to get subscription template + */ + function get_subscription_template() + { + global $LANG; + return lang('user_subscribe_message'); + } + + + /** + * Short form of print_r as pr + */ + function pr($text,$wrap_pre=false) + { + if(!$wrap_pre) + print_r($text); + else + { + echo "
";
+			print_r($text);
+			echo "
"; + } + } + + + /** + * This function is used to call function in smarty template + * This wont let you pass parameters to the function, but it will only call it + */ + function FUNC($params) + { + global $Cbucket; + //Function used to call functions by + //{func namefunction_name} + // in smarty + $func=$params['name']; + if(function_exists($func)) + $func(); + } + + + + /** + * Function used to return mysql time + * @author : Fwhite + */ + function NOW() + { + return date('Y-m-d H:i:s', time()); + } + + + /** + * Function used to get Regular Expression from database + * @param : code + */ + function get_re($code) + { + global $db; + $results = $db->select(tbl("validation_re"),"*"," re_code='$code'"); + if($db->num_rows>0) + { + return $results[0]['re_syntax']; + }else{ + return false; + } + } + function get_regular_expression($code) + { + return get_re($code); + } + + /** + * Function used to check weather input is valid or not + * based on preg_match + */ + function check_re($syntax,$text) + { + preg_match('/'.$syntax.'/i',$text,$matches); + if(!empty($matches[0])) + { + return true; + }else{ + return false; + } + } + function check_regular_expression($code,$text) + { + return check_re($code,$text); + } + + /** + * Function used to check field directly + */ + function validate_field($code,$text) + { + $syntax = get_re($code); + if(empty($syntax)) + return true; + return check_regular_expression($syntax,$text); + } + + function is_valid_syntax($code,$text) + { + if(DEVELOPMENT_MODE && DEV_INGNORE_SYNTAX) + return true; + return validate_field($code,$text); + } + + /** + * Function used to apply function on a value + */ + function is_valid_value($func,$val) + { + if(!function_exists($func)) + return true; + elseif(!$func($val)) + return false; + else + return true; + } + + function apply_func($func,$val) + { + if(is_array($func)) + { + foreach($func as $f) + if(function_exists($f)) + $val = $f($val); + }else{ + $val = $func($val); + } + return $val; + } + + /** + * Function used to validate YES or NO input + */ + function yes_or_no($input,$return=yes) + { + $input = strtolower($input); + if($input!=yes && $input !=no) + return $return; + else + return $input; + } + + + + /** + * Function used to display flash player for ClipBucket video + */ + function flashPlayer($param) + { + global $Cbucket,$swfobj; + + $param['player_div'] = $param['player_div'] ? $param['player_div'] : 'videoPlayer'; + + $key = $param['key']; + $flv = $param['flv'].'.flv'; + $code = $param['code']; + $flv_url = $file; + $embed = $param['embed']; + $code = $param['code']; + $height = $param['height'] ? $param['height'] : config('player_height'); + $width = $param['width'] ? $param['width'] : config('player_width'); + $param['height'] = $height; + $param['width'] = $width ; + + if(!$param['autoplay']) + $param['autoplay'] = config('autoplay_video'); + + assign('player_params',$param); + if(count($Cbucket->actions_play_video)>0) + { + foreach($Cbucket->actions_play_video as $funcs ) + { + + if(function_exists($funcs)) + { + $func_data = $funcs($param); + } + if($func_data) + { + $player_code = $func_data; + break; + } + } + } + + if(function_exists('cbplayer') && empty($player_code)) + $player_code = cbplayer($param,true); + + global $pak_player; + + if($player_code) + if(!$pak_player && $show_player) + { + assign("player_js_code",$player_code); + Template(PLAYER_DIR.'/player.html',false); + return false; + }else + { + return false; + } + + return blank_screen($param); + } + + + /** + * FUnctiuon used to plya HQ videos + */ + function HQflashPlayer($param) + { + return flashPlayer($param); + } + + + /** + * Function used to get player from website settings + */ + function get_player() + { + global $Cbucket; + return $Cbucket->configs['player_file']; + } + + + /** + * This funcion used to call function dynamically in smarty + */ + function load_form($param) + { + $func = $param['name']; + if(function_exists($func)) + return $func($param); + } + + /** + * Function used to get PHP Path + */ + function php_path() + { + if(PHP_PATH !='') + return PHP_PATH; + else + return "/usr/bin/php"; + } + + + /** + * Functon used to get binary paths + */ + function get_binaries($path) + { + if(is_array($path)) + { + $type = $path['type']; + $path = $path['path']; + } + + if($type=='' || $type=='user') + { + $path = strtolower($path); + switch($path) + { + case "php": + return php_path(); + break; + + case "mp4box": + return config("mp4boxpath"); + break; + + case "flvtool2": + return config("flvtool2path"); + break; + + case "ffmpeg": + return config("ffmpegpath"); + break; + } + }else{ + $path = strtolower($path); + switch($path) + { + case "php": + $return_path = shell_output("which php"); + if($return_path) + return $return_path; + else + return "Unable to find PHP path"; + break; + + case "mp4box": + $return_path = shell_output("which MP4Box"); + if($return_path) + return $return_path; + else + return "Unable to find mp4box path"; + break; + + case "flvtool2": + $return_path = shell_output("which flvtool2"); + if($return_path) + return $return_path; + else + return "Unable to find flvtool2 path"; + break; + + case "ffmpeg": + $return_path = shell_output("which ffmpeg"); + if($return_path) + return $return_path; + else + return "Unable to find ffmpeg path"; + break; + } + } + } + + + /** + * Function in case htmlspecialchars_decode does not exist + */ + function unhtmlentities ($string) + { + $trans_tbl =get_html_translation_table (HTML_ENTITIES ); + $trans_tbl =array_flip ($trans_tbl ); + return strtr ($string ,$trans_tbl ); + } + + + /** + * Function used to execute command in background + */ + function bgexec($cmd) { + if (substr(php_uname(), 0, 7) == "Windows"){ + //exec($cmd." >> /dev/null &"); + exec($cmd); + //pclose(popen("start \"bla\" \"" . $exe . "\" " . escapeshellarg($args), "r")); + }else{ + exec($cmd . " > /dev/null &"); + } + } + + + /** + * Function used to get array value + * if you know partial value of array and wants to know complete + * value of an array, this function is being used then + */ + function array_find($needle, $haystack) + { + foreach ($haystack as $item) + { + if (strpos($item, $needle) !== FALSE) + { + return $item; + break; + } + } + } + + + + /** + * Function used to give output in proper form + */ + function input_value($params) + { + $input = $params['input']; + $value = $input['value']; + + if($input['value_field']=='checked') + $value = $input['checked']; + + if($input['return_checked']) + return $input['checked']; + + if(function_exists($input['display_function'])) + return $input['display_function']($value); + elseif($input['type']=='dropdown') + { + if($input['checked']) + return $value[$input['checked']]; + else + return $value[0]; + }else + return $input['value']; + } + + /** + * Function used to convert input to categories + * @param input can be an array or #12# like + */ + function convert_to_categories($input) + { + if(is_array($input)) + { + foreach($input as $in) + { + if(is_array($in)) + { + foreach($in as $i) + { + if(is_array($i)) + { + foreach($i as $info) + { + $cat_details = get_category($info); + $cat_array[] = array($cat_details['categoryid'],$cat_details['category_name']); + } + }elseif(is_numeric($i)){ + $cat_details = get_category($i); + $cat_array[] = array($cat_details['categoryid'],$cat_details['category_name']); + } + } + }elseif(is_numeric($in)){ + $cat_details = get_category($in); + $cat_array[] = array($cat_details['categoryid'],$cat_details['category_name']); + } + } + }else{ + preg_match_all('/#([0-9]+)#/',$default['category'],$m); + $cat_array = array($m[1]); + foreach($cat_array as $i) + { + $cat_details = get_category($i); + $cat_array[] = array($cat_details['categoryid'],$cat_details['category_name']); + } + } + + $count = 1; + if(is_array($cat_array)) + { + foreach($cat_array as $cat) + { + echo ''.$cat[1].''; + if($count!=count($cat_array)) + echo ', '; + $count++; + } + } + } + + + + /** + * Function used to get categorie details + */ + function get_category($id) + { + global $myquery; + return $myquery->get_category($id); + } + + + /** + * Sharing OPT displaying + */ + function display_sharing_opt($input) + { + foreach($input as $key => $i) + { + return $key; + break; + } + } + + + + + + /** + * Function used to get error_list + */ + function error_list() + { + global $eh; + return $eh->error_list; + } + + + /** + * Function used to get msg_list + */ + function msg_list() + { + global $eh; + return $eh->message_list; + } + + + /** + * Function used to add tempalte in display template list + * @param File : file of the template + * @param Folder : weather to add template folder or not + * if set to true, file will be loaded from inside the template + * such that file path will becom $templatefolder/$file + * @param follow_show_page : this param tells weather to follow ClipBucket->show_page + * variable or not, if show_page is set to false and follow is true, this template will not load + * otherwise there it WILL + */ + function template_files($file,$folder=false,$follow_show_page=true) + { + global $ClipBucket; + if(!$folder) + $ClipBucket->template_files[] = array('file' => $file,'follow_show_page'=>$follow_show_page); + else + $ClipBucket->template_files[] = array('file'=>$file, + 'folder'=>$folder,'follow_show_page'=>$follow_show_page); + } + + /** + * Function used to include file + */ + function include_template_file($params) + { + $file = $params['file']; + + if(file_exists(LAYOUT.'/'.$file)) + Template($file); + elseif(file_exists($file)) + Template($file,false); + } + //Including videos functions include("functions_videos.php"); +//Including Users Functions +include("functions_users.php"); +//Group Functions +include("functions_groups.php"); +//Collections Functions +include("functions_collections.php"); -include("functions1.php"); include("functions2.php"); include("functions3.php"); ?> \ No newline at end of file diff --git a/upload/includes/functions1.php b/upload/includes/functions1.php deleted file mode 100644 index 7302605e..00000000 --- a/upload/includes/functions1.php +++ /dev/null @@ -1,1415 +0,0 @@ -getComments($params); - - if($params['assign']) - assign($params['assign'],$comments); - else - return $comments; - } - - /** - * FUNCTION USED TO GET ADVERTISMENT - * @param : array(Ad Code, LIMIT); - */ - function getAd($params) - { - global $adsObj; - $data = ''; - if($params['style'] || $params['class'] || $params['align']) - $data .= '
'; - $data .= ad($adsObj->getAd($params['place'])); - if($params['style'] || $params['class'] || $params['align']) - $data .= '
'; - return $data; - } - - - /** - * Function Used to format video duration - * @param : array(videoKey or ID,videok TITLE) - */ - - function videoSmartyLink($params) - { - $link = VideoLink($params['vdetails'],$params['type']); - if(!$params['assign']) - return $link; - else - assign($params['assign'],$link); - } - - /** - * FUNCTION USED TO GET VIDEO RATING IN SMARTY - * @param : array(pullRating($videos[$id]['videoid'],false,false,false,'novote'); - */ - function pullSmartyRating($param) - { - return pullRating($param['id'],$param['show5'],$param['showPerc'],$aram['showVotes'],$param['static']); - } - - /** - * FUNCTION USED TO CLEAN VALUES THAT CAN BE USED IN FORMS - */ - function cleanForm($string) - { - if(is_string($string)) - $string = htmlspecialchars($string); - if(get_magic_quotes_gpc()) - if(!is_array($string)) - $string = stripslashes($string); - return $string; - } - function form_val($string){return cleanForm($string); } - - //Escaping Magic Quotes - - /** - * FUNCTION USED TO MAKE TAGS MORE PERFECT - * @Author : Arslan Hassan - * @param tags text unformatted - * returns tags formatted - */ - function genTags($tags,$sep=',') - { - //Remove fazool spaces - $tags = preg_replace(array('/ ,/','/, /'),',',$tags); - $tags = preg_replace( "`[,]+`" , ",", $tags); - $tag_array = explode($sep,$tags); - foreach($tag_array as $tag) - { - if(isValidtag($tag)) - { - $newTags[] = $tag; - } - - } - //Creating new tag string - if(is_array($newTags)) - $tagString = implode(',',$newTags); - else - $tagString = 'no-tag'; - return $tagString; - } - - /** - * FUNCTION USED TO VALIDATE TAG - * @Author : Arslan Hassan - * @param tag - * return true or false - */ - function isValidtag($tag) - { - $disallow_array = array - ('of','is','no','on','off','a','the','why','how','what','in'); - if(!in_array($tag,$disallow_array) && strlen($tag)>2) - return true; - else - return false; - } - - - /** - * FUNCTION USED TO GET CATEGORY LIST - */ - function getCategoryList($params=false) - { - global $cats; - $cats = ""; - - $type = $params['type']; - switch($type) - { - default: - { - cb_call_functions('categoryListing',$params); - } - break; - - case "video":case "videos": - case "v": - { - global $cbvid; - $cats = $cbvid->cbCategories($params); - } - break; - - case "users":case "user": - case "u": case "channels": case "channels": - { - global $userquery; - $cats = $userquery->cbCategories($params); - } - break; - - case "group":case "groups": - case "g": - { - global $cbgroup; - $cats = $cbgroup->cbCategories($params); - } - break; - - case "collection":case "collections": - case "cl": - { - global $cbcollection; - $cats = $cbcollection->cbCategories($params); - } - break; - } - - return $cats; - } - /*function getCategoryList($type='video',$with_all=false,$return_html=false) - { - $use_subs = config('use_subs'); - - switch ($type) - { - case "video": - default: - { - global $cbvid; - - if($return_html && $use_subs == "1") { - $cats = $cbvid->cb_list_categories($type,$with_all); - } else { - if($with_all) - $all_cat = array(array('category_id'=>'all','category_name'=>'All')); - - $cats = $cbvid->get_categories(); - - if($all_cat && is_array($cats)) - $cats = array_merge($all_cat,$cats); - } - return $cats; - } - break; - case "user": - { - global $userquery; - - - if($return_html && $use_subs == "1") { - $cats = $userquery->cb_list_categories($type,$with_all); - } else { - if($with_all) - $all_cat = array(array('category_id'=>'all','category_name'=>'All')); - - $cats = $userquery->get_categories(); - - if($all_cat && is_array($cats)) - $cats = array_merge($all_cat,$cats); - } - return $cats; - } - break; - - case "group": - case "groups": - { - global $cbgroup; - - - if($return_html && $use_subs == "1") { - $cats = $cbgroup->cb_list_categories($type,$with_all); - } else { - if($with_all) - $all_cat = array(array('category_id'=>'all','category_name'=>'All')); - - $cats = $cbgroup->get_categories(); - - if($all_cat && is_array($cats)) - $cats = array_merge($all_cat,$cats); - } - return $cats; - } - break; - - case "collection": - case "collections": - { - global $cbcollection; - - - if($return_html && $use_subs == "1") { - $cats = $cbcollection->cb_list_categories($type,$with_all); - } else { - if($with_all) - $all_cat = array(array('category_id'=>'all','category_name'=>'All')); - - $cats = $cbcollection->get_categories(); - - if($all_cat && is_array($cats)) - $cats = array_merge($all_cat,$cats); - } - return $cats; - } - break; - } - }*/ - function cb_bottom() - { - //Woops..its gone - } - - - function getSmartyCategoryList($params) - { - return getCategoryList($params); - } - - - //Function used to register function as multiple modifiers - - - - /** - * Function used to insert data in database - * @param : table name - * @param : fields array - * @param : values array - * @param : extra params - */ - function dbInsert($tbl,$flds,$vls,$ep=NULL) - { - global $db ; - $db->insert($tbl,$flds,$vls,$ep); - } - - /** - * Function used to Update data in database - * @param : table name - * @param : fields array - * @param : values array - * @param : Condition params - * @params : Extra params - */ - function dbUpdate($tbl,$flds,$vls,$cond,$ep=NULL) - { - global $db ; - return $db->update($tbl,$flds,$vls,$cond,$ep); - } - - - - /** - * Function used to Delete data in database - * @param : table name - * @param : fields array - * @param : values array - * @params : Extra params - */ - function dbDelete($tbl,$flds,$vls,$ep=NULL) - { - global $db ; - return $db->delete($tbl,$flds,$vls,$ep); - } - - - /** - ** - */ - function cbRocks() - { - define("isCBSecured",TRUE); - //echo cbSecured(CB_SIGN); - } - - /** - * Insert Id - */ - function get_id($code) - { - global $Cbucket; - $id = $Cbucket->ids[$code]; - if(empty($id)) $id = $code; - return $id; - } - - /** - * Set Id - */ - function set_id($code,$id) - { - global $Cbucket; - return $Cbucket->ids[$code]=$id; - } - - - /** - * Function used to select data from database - */ - function dbselect($tbl,$fields='*',$cond=false,$limit=false,$order=false,$p=false) - { - global $db; - return $db->dbselect($tbl,$fields,$cond,$limit,$order,$p); - } - - - /** - * Function used to count fields in mysql - * @param TABLE NAME - * @param Fields - * @param condition - */ - function dbcount($tbl,$fields='*',$cond=false) - { - global $db; - if($cond) - $condition = " Where $cond "; - $query = "Select Count($fields) From $tbl $condition"; - $result = $db->Execute($query); - $db->total_queries++; - $db->total_queries_sql[] = $query; - return $result->fields[0]; - } - - /** - * An easy function for erorrs and messages (e is basically short form of exception) - * I dont want to use the whole Trigger and Exception code, so e pretty works for me :D - * @param TEXT $msg - * @param TYPE $type (e for Error, m for Message - * @param INT $id Any Predefined Message ID - */ - - function e($msg=NULL,$type='e',$id=NULL) - { - global $eh; - if(!empty($msg)) - return $eh->e($msg,$type,$id); - } - - - /** - * Function used to get subscription template - */ - function get_subscription_template() - { - global $LANG; - return lang('user_subscribe_message'); - } - - - /** - * Short form of print_r as pr - */ - function pr($text,$wrap_pre=false) - { - if(!$wrap_pre) - print_r($text); - else - { - echo "
";
-			print_r($text);
-			echo "
"; - } - } - - - /** - * This function is used to call function in smarty template - * This wont let you pass parameters to the function, but it will only call it - */ - function FUNC($params) - { - global $Cbucket; - //Function used to call functions by - //{func namefunction_name} - // in smarty - $func=$params['name']; - if(function_exists($func)) - $func(); - } - - /** - * 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; - } - //replica - 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 return mysql time - * @author : Fwhite - */ - function NOW() - { - return date('Y-m-d H:i:s', time()); - } - - - /** - * Function used to get Regular Expression from database - * @param : code - */ - function get_re($code) - { - global $db; - $results = $db->select(tbl("validation_re"),"*"," re_code='$code'"); - if($db->num_rows>0) - { - return $results[0]['re_syntax']; - }else{ - return false; - } - } - function get_regular_expression($code) - { - return get_re($code); - } - - /** - * Function used to check weather input is valid or not - * based on preg_match - */ - function check_re($syntax,$text) - { - preg_match('/'.$syntax.'/i',$text,$matches); - if(!empty($matches[0])) - { - return true; - }else{ - return false; - } - } - function check_regular_expression($code,$text) - { - return check_re($code,$text); - } - - /** - * Function used to check field directly - */ - function validate_field($code,$text) - { - $syntax = get_re($code); - if(empty($syntax)) - return true; - return check_regular_expression($syntax,$text); - } - - function is_valid_syntax($code,$text) - { - if(DEVELOPMENT_MODE && DEV_INGNORE_SYNTAX) - return true; - return validate_field($code,$text); - } - - /** - * Function used to apply function on a value - */ - function is_valid_value($func,$val) - { - if(!function_exists($func)) - return true; - elseif(!$func($val)) - return false; - else - return true; - } - - function apply_func($func,$val) - { - if(is_array($func)) - { - foreach($func as $f) - if(function_exists($f)) - $val = $f($val); - }else{ - $val = $func($val); - } - return $val; - } - - /** - * Function used to validate YES or NO input - */ - function yes_or_no($input,$return=yes) - { - $input = strtolower($input); - if($input!=yes && $input !=no) - return $return; - else - return $input; - } - - /** - * Function used to validate category - * INPUT $cat array - */ - 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 validate category - * INPUT $cat array - */ - function validate_group_category($array=NULL) - { - global $cbgroup; - return $cbgroup->validate_group_category($array); - } - - /** - * Function used to validate category - * INPUT $cat array - */ - function validate_collection_category($array=NULL) - { - global $cbcollection; - return $cbcollection->validate_collection_category($array); - } - - /** - * 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 display flash player for ClipBucket video - */ - function flashPlayer($param) - { - global $Cbucket,$swfobj; - - $param['player_div'] = $param['player_div'] ? $param['player_div'] : 'videoPlayer'; - - $key = $param['key']; - $flv = $param['flv'].'.flv'; - $code = $param['code']; - $flv_url = $file; - $embed = $param['embed']; - $code = $param['code']; - $height = $param['height'] ? $param['height'] : config('player_height'); - $width = $param['width'] ? $param['width'] : config('player_width'); - $param['height'] = $height; - $param['width'] = $width ; - - if(!$param['autoplay']) - $param['autoplay'] = config('autoplay_video'); - - assign('player_params',$param); - if(count($Cbucket->actions_play_video)>0) - { - foreach($Cbucket->actions_play_video as $funcs ) - { - - if(function_exists($funcs)) - { - $func_data = $funcs($param); - } - if($func_data) - { - $player_code = $func_data; - break; - } - } - } - - if(function_exists('cbplayer') && empty($player_code)) - $player_code = cbplayer($param,true); - - global $pak_player; - - if($player_code) - if(!$pak_player && $show_player) - { - assign("player_js_code",$player_code); - Template(PLAYER_DIR.'/player.html',false); - return false; - }else - { - return false; - } - - return blank_screen($param); - } - - - /** - * FUnctiuon used to plya HQ videos - */ - function HQflashPlayer($param) - { - return flashPlayer($param); - } - - - /** - * Function used to get player from website settings - */ - function get_player() - { - global $Cbucket; - return $Cbucket->configs['player_file']; - } - - - /** - * 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); - } - - - /** - * This funcion used to call function dynamically in smarty - */ - function load_form($param) - { - $func = $param['name']; - if(function_exists($func)) - return $func($param); - } - - - - /** - * Function used to get PHP Path - */ - function php_path() - { - if(PHP_PATH !='') - return PHP_PATH; - else - return "/usr/bin/php"; - } - - /** - * Functon used to get binary paths - */ - function get_binaries($path) - { - if(is_array($path)) - { - $type = $path['type']; - $path = $path['path']; - } - - if($type=='' || $type=='user') - { - $path = strtolower($path); - switch($path) - { - case "php": - return php_path(); - break; - - case "mp4box": - return config("mp4boxpath"); - break; - - case "flvtool2": - return config("flvtool2path"); - break; - - case "ffmpeg": - return config("ffmpegpath"); - break; - } - }else{ - $path = strtolower($path); - switch($path) - { - case "php": - $return_path = shell_output("which php"); - if($return_path) - return $return_path; - else - return "Unable to find PHP path"; - break; - - case "mp4box": - $return_path = shell_output("which MP4Box"); - if($return_path) - return $return_path; - else - return "Unable to find mp4box path"; - break; - - case "flvtool2": - $return_path = shell_output("which flvtool2"); - if($return_path) - return $return_path; - else - return "Unable to find flvtool2 path"; - break; - - case "ffmpeg": - $return_path = shell_output("which ffmpeg"); - if($return_path) - return $return_path; - else - return "Unable to find ffmpeg path"; - break; - } - } - } - - - /** - * Function in case htmlspecialchars_decode does not exist - */ - function unhtmlentities ($string) - { - $trans_tbl =get_html_translation_table (HTML_ENTITIES ); - $trans_tbl =array_flip ($trans_tbl ); - return strtr ($string ,$trans_tbl ); - } - - - - /** - * 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> /dev/null &"); - exec($cmd); - //pclose(popen("start \"bla\" \"" . $exe . "\" " . escapeshellarg($args), "r")); - }else{ - exec($cmd . " > /dev/null &"); - } - } - - - /** - * 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')); - } - } - - - /** - * Function used to get array value - * if you know partial value of array and wants to know complete - * value of an array, this function is being used then - */ - function array_find($needle, $haystack) - { - foreach ($haystack as $item) - { - if (strpos($item, $needle) !== FALSE) - { - return $item; - break; - } - } - } - - - - /** - * Function used to give output in proper form - */ - function input_value($params) - { - $input = $params['input']; - $value = $input['value']; - - if($input['value_field']=='checked') - $value = $input['checked']; - - if($input['return_checked']) - return $input['checked']; - - if(function_exists($input['display_function'])) - return $input['display_function']($value); - elseif($input['type']=='dropdown') - { - if($input['checked']) - return $value[$input['checked']]; - else - return $value[0]; - }else - return $input['value']; - } - - /** - * Function used to convert input to categories - * @param input can be an array or #12# like - */ - function convert_to_categories($input) - { - if(is_array($input)) - { - foreach($input as $in) - { - if(is_array($in)) - { - foreach($in as $i) - { - if(is_array($i)) - { - foreach($i as $info) - { - $cat_details = get_category($info); - $cat_array[] = array($cat_details['categoryid'],$cat_details['category_name']); - } - }elseif(is_numeric($i)){ - $cat_details = get_category($i); - $cat_array[] = array($cat_details['categoryid'],$cat_details['category_name']); - } - } - }elseif(is_numeric($in)){ - $cat_details = get_category($in); - $cat_array[] = array($cat_details['categoryid'],$cat_details['category_name']); - } - } - }else{ - preg_match_all('/#([0-9]+)#/',$default['category'],$m); - $cat_array = array($m[1]); - foreach($cat_array as $i) - { - $cat_details = get_category($i); - $cat_array[] = array($cat_details['categoryid'],$cat_details['category_name']); - } - } - - $count = 1; - if(is_array($cat_array)) - { - foreach($cat_array as $cat) - { - echo ''.$cat[1].''; - if($count!=count($cat_array)) - echo ', '; - $count++; - } - } - } - - - - /** - * Function used to get categorie details - */ - function get_category($id) - { - global $myquery; - return $myquery->get_category($id); - } - - - /** - * Sharing OPT displaying - */ - function display_sharing_opt($input) - { - foreach($input as $key => $i) - { - return $key; - break; - } - } - - /** - * 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 get error_list - */ - function error_list() - { - global $eh; - return $eh->error_list; - } - - - /** - * Function used to get msg_list - */ - function msg_list() - { - global $eh; - return $eh->message_list; - } - - - /** - * Function used to add tempalte in display template list - * @param File : file of the template - * @param Folder : weather to add template folder or not - * if set to true, file will be loaded from inside the template - * such that file path will becom $templatefolder/$file - * @param follow_show_page : this param tells weather to follow ClipBucket->show_page - * variable or not, if show_page is set to false and follow is true, this template will not load - * otherwise there it WILL - */ - function template_files($file,$folder=false,$follow_show_page=true) - { - global $ClipBucket; - if(!$folder) - $ClipBucket->template_files[] = array('file' => $file,'follow_show_page'=>$follow_show_page); - else - $ClipBucket->template_files[] = array('file'=>$file, - 'folder'=>$folder,'follow_show_page'=>$follow_show_page); - } - - /** - * Function used to include file - */ - function include_template_file($params) - { - $file = $params['file']; - - if(file_exists(LAYOUT.'/'.$file)) - Template($file); - elseif(file_exists($file)) - Template($file,false); - } - - - -?> \ No newline at end of file diff --git a/upload/includes/functions2.php b/upload/includes/functions2.php index f922ac9a..490aac11 100644 --- a/upload/includes/functions2.php +++ b/upload/includes/functions2.php @@ -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 @@ -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 @@ -676,7 +630,6 @@ } function get_config($input){ return config($input); } - /** * Funcion used to call functions * when video is going to watched @@ -1014,15 +967,7 @@ 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); - } + /** diff --git a/upload/includes/functions3.php b/upload/includes/functions3.php index 9743adcd..120d760a 100644 --- a/upload/includes/functions3.php +++ b/upload/includes/functions3.php @@ -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 @@ -1649,24 +1642,7 @@ global $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; 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); $query_md5 = md5($je_query); $count = $db->count(tbl('counters'),"*","section='$section' AND query_md5='$query_md5'"); diff --git a/upload/includes/functions_collections.php b/upload/includes/functions_collections.php new file mode 100644 index 00000000..48f39dfd --- /dev/null +++ b/upload/includes/functions_collections.php @@ -0,0 +1,15 @@ +validate_collection_category($array); + } + + +?> \ No newline at end of file diff --git a/upload/includes/functions_groups.php b/upload/includes/functions_groups.php new file mode 100644 index 00000000..22df3984 --- /dev/null +++ b/upload/includes/functions_groups.php @@ -0,0 +1,14 @@ +validate_group_category($array); + } + +?> \ No newline at end of file diff --git a/upload/includes/functions_users.php b/upload/includes/functions_users.php new file mode 100644 index 00000000..b5363a32 --- /dev/null +++ b/upload/includes/functions_users.php @@ -0,0 +1,140 @@ +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); +} +?> diff --git a/upload/includes/functions_videos.php b/upload/includes/functions_videos.php index c2d1a6f8..112cc0fb 100644 --- a/upload/includes/functions_videos.php +++ b/upload/includes/functions_videos.php @@ -425,3 +425,469 @@ function getSmartyThumb($params) { 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;$ipage_redir(); if(is_installed('editorspick')) { - assign('editor_picks',get_ep_videos()); + assign('editor_picks',get_ep_videos()); } // i love coding :) diff --git a/upload/logout.php b/upload/logout.php index 45018086..c0687505 100644 --- a/upload/logout.php +++ b/upload/logout.php @@ -1,6 +1,9 @@ logout(); +if(cb_get_functions('logout')) cb_call_functions('logout'); + setcookie('is_logout','yes',time()+3600,'/'); redirect_to(BASEURL); ?> \ No newline at end of file diff --git a/upload/module.php b/upload/module.php index 4f1346b6..a81bbbc9 100644 --- a/upload/module.php +++ b/upload/module.php @@ -8,8 +8,6 @@ */ define("IN_MODULE",true); -define("PARENT_PAGE",$_GET['s']); -define("THIS_PAGE",$_GET['p']); require 'includes/config.inc.php'; @@ -19,7 +17,7 @@ $pages->page_redir(); load_modules(); if(!defined("THIS_PAGE")) - e("Invalid module"); +e("Invalid module"); display_it(); diff --git a/upload/out.php b/upload/out.php new file mode 100644 index 00000000..b4a07819 --- /dev/null +++ b/upload/out.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/upload/player/cbplayer/cbplayer.php b/upload/player/cbplayer/cbplayer.php index 2dc4a9cc..3c0dc8cd 100644 --- a/upload/player/cbplayer/cbplayer.php +++ b/upload/player/cbplayer/cbplayer.php @@ -46,7 +46,8 @@ if(!function_exists('cb_player')) { $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); diff --git a/upload/plugins/cb_link_video/cb_link_video.php b/upload/plugins/cb_link_video/cb_link_video.php index b17cee3e..1d36f830 100644 --- a/upload/plugins/cb_link_video/cb_link_video.php +++ b/upload/plugins/cb_link_video/cb_link_video.php @@ -10,11 +10,11 @@ $Cbucket->upload_opt_list['link_video_link'] = - array( - 'title' => lang('remote_play'), - 'load_func' => 'load_link_video_form', - ); - + array( + 'title' => lang('remote_play'), + 'load_func' => 'load_link_video_form', + ); + /** * Function used create duration from input diff --git a/upload/signup.php b/upload/signup.php index 9e0f679b..066ea7fc 100644 --- a/upload/signup.php +++ b/upload/signup.php @@ -57,10 +57,12 @@ if(isset($_POST['login'])){ if($userquery->login_user($username,$password,$remember)) { - if($_COOKIE['pageredir']) - redirect_to($_COOKIE['pageredir']); - else - redirect_to(cblink(array('name'=>'my_account'))); + if(cb_get_functions('login_success')) cb_call_functions('login_success'); + + if($_COOKIE['pageredir']) + redirect_to($_COOKIE['pageredir']); + else + redirect_to(cblink(array('name'=>'my_account'))); } } diff --git a/upload/styles/cbv2new/layout/collections.html b/upload/styles/cbv2new/layout/collections.html index 0f0caa4d..f4304ae4 100644 --- a/upload/styles/cbv2new/layout/collections.html +++ b/upload/styles/cbv2new/layout/collections.html @@ -1,3 +1,120 @@ +
+ +
+ {assign var=sort value=$smarty.get.sort|replace:'most_commented':'commented'} +
+ {lang code=$sort} +
+ + +
+ + {assign var=time_frame value=$smarty.get.time|replace:'_':''"} +
+ {lang code=$time_frame} +
+ + +
+ + {cbCategories assign="category_list" type='v' with_all=TRUE echo=TRUE} +
+ {if $smarty.get.cat == 'all' || $smarty.get.cat == ''} + All Categories + {else} + {$cbvid->get_category_field($smarty.get.cat,'category_name')} + {/if} + +
+ + +
+ +
+
+ + + + + + + + + + +
+ +
+ {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} +
+ {include file="$style_dir/blocks/pagination.html"} +
+
+ + + + + + + + + + + + + + + + {include file="$style_dir/blocks/category_list.html" type='collections'} diff --git a/upload/styles/cbv2new/layout/header.html b/upload/styles/cbv2new/layout/header.html index 81f93d4a..0b9d82f4 100644 --- a/upload/styles/cbv2new/layout/header.html +++ b/upload/styles/cbv2new/layout/header.html @@ -10,7 +10,7 @@ {ANCHOR place='mature_content'} - + {ANCHOR place='above_menu'} {ANCHOR place='premium_button'}