diff --git a/upload/admin_area/category.php b/upload/admin_area/category.php index db26bd4e..93cded33 100644 --- a/upload/admin_area/category.php +++ b/upload/admin_area/category.php @@ -1,10 +1,10 @@ page_redir(); //Form Processing - if(isset($_POST['add_cateogry'])){ $cbvid->add_category($_POST); } - + +//Making Categoyr as Default +if(isset($_GET['make_default'])) +{ + $cid = mysql_clean($_GET['make_default']); + $cbvid->make_default_category($cid); +} + //Edit Categoty if(isset($_GET['category'])){ - $category = clean($_GET['category']); - if($myquery->CategoryExists($category)){ - if(isset($_POST['update_category'])){ - if($myquery->UpdateCategory($_GET['category'])){ - $msg[] = "Category Has Been Updated"; - } - } - - $sql = "SELECT * from category WHERE categoryid = '".$category."'"; - $rs = $db->Execute($sql); - $category_data = $rs->getrows();; - Assign('category_data',$category_data); - Assign('edit_category','show'); - }else{ - $msg[] = $LANG['cat_exist_error']; - } + assign("edit_category","show"); + if(isset($_POST['update_category'])) + { + $cbvid->update_category($_POST); } + assign('cat_details',$cbvid->get_category($_GET['category'])); +} //Delete Category if(isset($_GET['delete_category'])){ @@ -48,13 +44,6 @@ assign('category',$cbvid->get_categories()); assign('total',$cbvid->total_categories()); Assign('msg',@$msg); -/*Template('header.html'); -Template('leftmenu.html'); -Template('message.html'); -Template('category.html'); -Template('footer.html');*/ -$cbvid->get_default_category(); - template_files('category.html'); display_it(); diff --git a/upload/admin_area/styles/cbadmin/layout/category.html b/upload/admin_area/styles/cbadmin/layout/category.html index 5c2f023d..3ff30513 100644 --- a/upload/admin_area/styles/cbadmin/layout/category.html +++ b/upload/admin_area/styles/cbadmin/layout/category.html @@ -2,7 +2,7 @@ Video Categories - +
@@ -42,10 +42,9 @@

- - + + @@ -55,9 +54,10 @@ {/if} {if $edit_category == "show"} -{section name=list loop=$category_data} -
Manage Video Categories  
Category ThumbCategory Thumb +
 
+ + +
@@ -66,24 +66,31 @@ - + + + + + - + - - - -
 
Category Name*
Category Description*
Make Default Category

+ + +
+

Category ThumbCategory Thumb
 
-{/section} {/if} @@ -100,25 +106,38 @@ {if $total != 0} - +
- + - - + + + - {assign var = bgcolor value = ""} +{assign var = bgcolor value = ""} {section name=list loop=$category} - + + - - + + + + {if $bgcolor == ""} {assign var = bgcolor value = "#EEEEEE"} diff --git a/upload/admin_area/styles/cbadmin/layout/global_header.html b/upload/admin_area/styles/cbadmin/layout/global_header.html index 9186c506..d2dadf0c 100644 --- a/upload/admin_area/styles/cbadmin/layout/global_header.html +++ b/upload/admin_area/styles/cbadmin/layout/global_header.html @@ -61,11 +61,11 @@ var baseurl = "{$baseurl}"; tooltip : 'Click to edit...', }); }); - - - + + + {/literal} \ No newline at end of file diff --git a/upload/admin_area/styles/cbadmin/theme/stylesheet.css b/upload/admin_area/styles/cbadmin/theme/stylesheet.css index 605b631c..707a50fa 100644 --- a/upload/admin_area/styles/cbadmin/theme/stylesheet.css +++ b/upload/admin_area/styles/cbadmin/theme/stylesheet.css @@ -1,3 +1,7 @@ +/* +Link Color : #0c4469 +*/ + @import url("slidemenu.css"); @import url("pagination.css"); @import url("cbtab.css"); @@ -110,4 +114,10 @@ padding-left:5px; font-size:16px; font-weight:bold; font-family:Arial, Helvetica .search_box{margin:5px; padding:5px; border:1px solid #146194; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; background:#eff9ff} -.video_search .input{border:1px solid #666} \ No newline at end of file +.video_search .input{border:1px solid #666} + + +.item_listing td{border-bottom:1px solid #ccc} + +.item_listing li{list-style:none} +.item_listing a{color:#0c4469; font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; font-style:italic} \ No newline at end of file diff --git a/upload/includes/classes/category.class.php b/upload/includes/classes/category.class.php new file mode 100644 index 00000000..19b7f6d2 --- /dev/null +++ b/upload/includes/classes/category.class.php @@ -0,0 +1,337 @@ + + * This class is used to create + * and manage categories + * its an abstract class + * it will be used in plugins or built-in + * sections to use category system like videos, groups , channels etc + * + * this abstract class has some rules + * each section's category column should be named as "category" + * each section's category table must have same columns as video_categories + */ + + + +abstract class CBCategory +{ + var $cat_tbl = ''; //Name of category Table + var $section_tbl = ''; //Name of table that related to $cat_tbl + var $cat_thumb_height = '125'; + var $cat_thumb_width = '125'; + var $default_thumb = 'no_thumb.jpg'; + + /** + * Function used to check weather category exists or not + */ + function category_exists($cid) + { + global $db; + return $this->get_category($cid); + } + + + /** + * Function used to get category details + */ + function get_category($cid) + { + global $db; + $results = $db->select($this->cat_tbl,"*"," category_id='$cid' "); + if($db->num_rows>0) + { + return $results[0]; + }else{ + return false; + } + } + + + /** + * Function used to get category by name + */ + function get_cat_by_name($name) + { + global $db; + $results = $db->select($this->cat_tbl,"*"," category_name='$name' "); + if($db->num_rows>0) + { + return $results[0]; + }else{ + return false; + } + } + + + /** + * Function used to add new category + */ + function add_category($array) + { + global $db; + $name = mysql_clean($array['name']); + $desc = mysql_clean($array['desc']); + $default = mysql_clean($array['default']); + + if($this->get_cat_by_name($name)) + { + e(lang("add_cat_erro")); + + }elseif(empty($name)) + { + e(lang("add_cat_no_name_err")); + }else{ + $cid = $db->insert($this->cat_tbl, + array("category_name","category_desc","date_added"), + array($name,$desc,now()) + ); + $cid = $db->insert_id(); + if($default=='yes' || !$this->get_default_category()) + $this->make_default_category($cid); + e(lang("cat_add_msg"),m); + + //Uploading thumb + if(!empty($_FILES['cat_thumb']['tmp_name'])) + $this->add_category_thumb($cid,$_FILES['cat_thumb']); + } + + } + + + + /** + * Function used to make category as default + */ + function make_default_category($cid) + { + global $db; + if($this->category_exists($cid)) + { + $db->update($this->cat_tbl,array("isdefault"),array("no")," isdefault='yes' "); + $db->update($this->cat_tbl,array("isdefault"),array("yes")," category_id='$cid' "); + e(lang("cat_set_default_ok"),m); + }else + e(lang("cat_exist_error")); + } + + + /** + * Function used to get list of categories + */ + function get_categories() + { + global $db; + $select = $db->select($this->cat_tbl,"*"); + return $select; + } + + + /** + * Function used to count total number of categoies + */ + function total_categories() + { + global $db; + return $db->count($this->cat_tbl,"*"); + } + + + /** + * Function used to delete category + */ + function delete_category($cid) + { + global $db; + $cat_details = $this->category_exists($cid); + if(!$cat_details) + e(lang("cat_exist_error")); + //CHecking if category is default or not + elseif($cat_details['isdefault'] == 'yes') + e(lang("cat_default_err")); + else{ + //Moving all contents to default category + $this->change_category($cid); + //Removing Category + $db->execute("DELETE FROM ".$this->cat_tbl." WHERE category_id='$cid'"); + e(lang("class_cat_del_msg"),m); + } + + } + + /** + * Functon used to get dafault categry + */ + function get_default_category() + { + global $db; + $results = $db->select($this->cat_tbl,"*"," isdefault='yes' "); + if($db->num_rows>0) + return $results[0]; + else + return false; + } + + /** + * Function used to get default category ID + */ + function get_default_cid() + { + $default = $this->get_default_category(); + return $default['category_id']; + } + + + + /** + * Function used to move contents from one section to other + */ + function change_category($from,$to=NULL,$check_multiple=false) + { + global $db; + if(!$this->category_exists($to)) + $to = $this->get_default_cid(); + $db->execute("UPDATE ".$this->section_tbl." SET category = replace(category,'#".$from."#','#".$to."#') WHERE category LIKE '%#".$from."#%'"); + $db->execute("UPDATE ".$this->section_tbl." SET category = replace(category,'#".$to."# #".$to."#','#".$to."#') WHERE category LIKE '%#".$to."#%'"); + } + + + /** + * Function used to edit category + * submit values and it will update category + */ + function update_category($array) + { + global $db; + $name = mysql_clean($array['name']); + $desc = mysql_clean($array['desc']); + $default = mysql_clean($array['default']); + + $cur_name = mysql_clean($array['cur_name']); + $cid = mysql_clean($array['cid']); + + + if($this->get_cat_by_name($name) && $cur_name !=$name ) + { + e(lang("add_cat_erro")); + + }elseif(empty($name)) + { + e(lang("add_cat_no_name_err")); + }else{ + $db->update($this->cat_tbl, + array("category_name","category_desc"), + array($name,$desc), + " category_id='$cid' " + ); + if($default=='yes' || !$this->get_default_category()) + $this->make_default_category($cid); + e(lang("cat_update_msg"),m); + + //Uploading thumb + if(!empty($_FILES['cat_thumb']['tmp_name'])) + $this->add_category_thumb($cid,$_FILES['cat_thumb']); + } + } + + + /** + * Function used to add category thumbnail + * @param $Cid and Array + */ + function add_category_thumb($cid,$file) + { + global $imgObj; + if($this->category_exists($cid)) + { + //Checking for category thumbs direcotry + if(isset($this->thumb_dir)) + $dir = $this->thumb_dir; + else + $dir = $this->section_tbl; + + //Checking File Extension + $ext = strtolower(getext($file['name'])); + + if($ext=='jpg' || $ext =='png' || $ext=='gif') + { + $dir_path = CAT_THUMB_DIR.'/'.$dir; + if(!is_dir($dir_path)) + @mkdir($dir_path,0777); + + if(is_dir($dir_path)) + { + $path = $dir_path.'/'.$cid.'.'.$ext; + + //Removing File if already exists + if(file_exists($path)) + unlink($path); + move_uploaded_file($file['tmp_name'],$path); + + //Now checking if file is really an image + if(!@$imgObj->ValidateImage($path,$ext)) + e(lang("pic_upload_vali_err")); + else + { + $imgObj->CreateThumb($path,$path,$this->cat_thumb_width,$ext,$this->cat_thumb_height,true); + } + }else{ + e(lang("cat_dir_make_err")); + } + }else{ + e(lang("cat_img_error")); + } + } + } + + + /** + * Function used to get category thumb + */ + function get_cat_thumb($cat_details) + { + //Checking for category thumbs direcotry + if(isset($this->thumb_dir)) + $dir = $this->thumb_dir; + else + $dir = $this->section_tbl; + + $cid = $cat_details['category_id']; + $path = CAT_THUMB_DIR.'/'.$dir.'/'.$cid.'.'; + $exts = array('jpg','png','gif'); + + $file_exists = false; + foreach($exts as $ext) + { + $cur_ext = $ext; + if(file_exists($path.$ext)) + { + $file_exists = true; + break; + } + } + + if($file_exists) + return CAT_THUMB_URL.'/'.$dir.'/'.$cid.'.'.$ext; + else + return $this->default_thumb(); + } + function get_category_thumb($i) + { + return $this->get_cat_thumb($i); + } + + /** + * function used to return default thumb + */ + function default_thumb() + { + if(empty($this->default_thumb)) + $this->default_thumb = 'no_thumb.jpg'; + return CAT_THUMB_URL.'/'.$this->default_thumb; + } + +} + +?> \ No newline at end of file diff --git a/upload/includes/classes/plugin.class.php b/upload/includes/classes/plugin.class.php index 52d6ae01..34a17f43 100644 --- a/upload/includes/classes/plugin.class.php +++ b/upload/includes/classes/plugin.class.php @@ -32,6 +32,13 @@ --- in_header + You can additionally add admin area options + such as if you want to add new option in admin panel + you can add links at following places + + -- in_video_manage_links + -- in_video_manage_buttons + function -- get_plugin_details reads the file and parse plugin details diff --git a/upload/includes/classes/video.class.php b/upload/includes/classes/video.class.php new file mode 100644 index 00000000..56a2854a --- /dev/null +++ b/upload/includes/classes/video.class.php @@ -0,0 +1,212 @@ +cat_tbl = 'video_categories'; + $this->section_tbl = 'video'; + } + + + /** + * Function used to check weather video exists or not + * @param VID or VKEY + */ + function video_exists($vid) + { + return $this->get_video($vid); + } + function exists($vid){return $this->video_exists($vid);} + function videoexists($vid){return $this->video_exists($vid);} + + + /** + * Function used to get video data + */ + function get_video($vid) + { + global $db; + $results = $db->select("video","*"," videoid='$vid' OR videokey='$vid'"); + if($db->num_rows>0) + { + return $results[0]; + }else{ + return false; + } + } + function getvideo($vid){return $this->get_video($vid);} + function get_video_data($vid){return $this->get_video($vid);} + function getvideodata($vid){return $this->get_video($vid);} + function get_video_details($vid){return $this->get_video($vid);} + function getvideodetails($vid){return $this->get_video($vid);} + + + /** + * Function used to perform several actions with a video + */ + function action($case,$vid) + { + global $db; + if(!$this->exists($vid)) + return false; + //Lets just check weathter video exists or not + switch($case) + { + //Activating a video + case 'activate': + case 'av': + case 'a': + { + $db->update("video",array('active'),array('yes')," videoid='$vid' OR videokey = '$vid' "); + e(lang("class_vdo_act_msg"),m); + } + break; + + //Deactivating a video + case "deactivate": + case "dav": + case "d": + { + $db->update("video",array('active'),array('no')," videoid='$vid' OR videokey = '$vid' "); + e(lang("class_vdo_act_msg1"),m); + } + break; + + //Featuring Video + case "feature": + case "featured": + case "f": + { + $db->update("video",array('featured'),array('yes')," videoid='$vid' OR videokey = '$vid' "); + e(lang("class_vdo_fr_msg"),m); + } + break; + + + //Unfeatured video + case "unfeature": + case "unfeatured": + case "uf": + { + $db->update("video",array('featured'),array('no')," videoid='$vid' OR videokey = '$vid' "); + e(lang("class_fr_msg1"),m); + } + break; + } + } + + + + /** + * Function used to update video + */ + function update_video() + { + global $eh,$Cbucket,$db,$Upload; + + $Upload->validate_video_upload_form(NULL,TRUE); + + if(empty($eh->error_list)) + { + $required_fields = $Upload->loadRequiredFields($array); + $location_fields = $Upload->loadLocationFields($array); + $option_fields = $Upload->loadOptionFields($array); + + $upload_fields = array_merge($required_fields,$location_fields,$option_fields); + + //Adding Custom Upload Fields + if(count($Upload->custom_upload_fields)>0) + $upload_fields = array_merge($upload_fields,$Upload->custom_upload_fields); + //Adding Custom Form Fields + if(count($Upload->custom_form_fields)>0) + $upload_fields = array_merge($upload_fields,$Upload->custom_form_fields); + + $array = $_POST; + $vid = $array['videoid']; + + if(is_array($_FILES)) + $array = array_merge($array,$_FILES); + + foreach($upload_fields as $field) + { + $name = formObj::rmBrackets($field['name']); + $val = $array[$name]; + + if($field['use_func_val']) + $val = $field['validate_function']($val); + + + if(!empty($field['db_field'])) + $query_field[] = $field['db_field']; + + if(is_array($val)) + { + $new_val = ''; + foreach($val as $v) + { + $new_val .= "#".$v."# "; + } + $val = $new_val; + } + if(!$field['clean_func'] || (!apply_func($field['clean_func'],$val) && !is_array($field['clean_func']))) + $val = mysql_clean($val); + else + $val = apply_func($field['clean_func'],$val); + + if(!empty($field['db_field'])) + $query_val[] = $val; + + } + + #$query = "INSERT INTO video ("; + $total_fields = count($query_field); + + //Adding Fields to query + $i = 0; + + /*for($key=0;$key<$total_fields;$key++) + { + $query .= query_field[$key]." = '".$query_val[$key]."'" ; + if($key<$total_fields-1) + $query .= ','; + }*/ + + + if(!userid()) + { + e("You are not logged in"); + }elseif(!$this->video_exists($vid)){ + e("Video deos not exist"); + }else{ + $db->update('video',$query_field,$query_val," videoid='$vid'"); + e("Video details have been updated",m); + } + + } + } + +} + + +?> \ No newline at end of file diff --git a/upload/includes/common.php b/upload/includes/common.php index 06bc96ad..1cae31a3 100644 --- a/upload/includes/common.php +++ b/upload/includes/common.php @@ -257,8 +257,14 @@ error_reporting(E_ALL ^ E_NOTICE); define('MAX_COMMENT_CHR',$Cbucket->configs['max_comment_chr']); define('USER_COMMENT_OWN',$Cbucket->configs['user_comment_own']); + + //Defining Category Thumbs directory + define('CAT_THUMB_DIR',BASEDIR.'/images/category_thumbs'); + define('CAT_THUMB_URL',BASEURL.'/images/category_thumbs'); + //Assigning Smarty Tags & Values include 'functions.php'; + include 'plugin.functions.php'; include 'plugins_functions.php'; require BASEDIR.'/includes/templatelib/Template.class.php'; require BASEDIR.'/includes/classes/template.class.php'; @@ -288,7 +294,7 @@ error_reporting(E_ALL ^ E_NOTICE); Assign('flvplayer',FLVPLAYER); Assign('avatardir',BASEURL.'/images/avatars'); Assign('whatis',$row['whatis']); - Assign('category_thumbs',BASEURL.'/images/category_thumbs'); + Assign('category_thumbs',CAT_THUMB_URL); Assign('video_thumbs',THUMBS_URL); //Assign('ads',$ads); Assign('meta_keywords',$row['keywords']); @@ -377,7 +383,7 @@ $Smarty->assign_by_ref('formObj', $formObj); $Smarty->assign_by_ref('Cbucket', $Cbucket);$Smarty->assign_by_ref('ClipBucket', $Cbucket); $Smarty->assign_by_ref('eh', $eh); $Smarty->assign_by_ref('lang_obj', $lang_obj); - +$Smarty->assign_by_ref('cbvid', $cbvid); /* REGISERTING FUNCTION FOR SMARTY TEMPLATES diff --git a/upload/includes/functions.php b/upload/includes/functions.php index 0fac671d..8fea1ed8 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -793,30 +793,7 @@ function SetTime($sec, $padHours = true) { } - /** - * FUNCTION USED TO REGISTER ACTIONS THAT ARE TO APPLIED - * ON COMMENTS , TITLE, DESCRIPTIONS etc - */ - function register_action($name,$type=NULL) - { - global $Cbucket; - if(is_array($name)) - { - foreach($name as $key => $naam) - if(is_array($naam)) - { - foreach($naam as $name) - { - $Cbucket->actionList[$name][] = $key; - } - }else{ - - $Cbucket->actionList[$naam][] = $key; - } - }elseif($type!=NULL){ - $Cbucket->actionList[$type][] = $name; - } - } + //Function used to register function as multiple modifiers @@ -934,104 +911,6 @@ function SetTime($sec, $padHours = true) { } - /** - * FUNCTION USED TO CREATE ANCHOR PLACEMENT - * these are the placement where we can add plugin's or widget's code, - * e.g if we want to display a new WYSIWYG box before comment text area - * we will create anchor before text area as {ANCHOR place='before_compose_box'} - * code will be written in plugin file and its place will point 'before_compose_box' - * then our function will get all the code for this placement and will display it - * @param : array(Ad Code, LIMIT); - */ - function ANCHOR($params,&$Smarty) - { - global $Cbucket; - //Getting List of codes to display at this anchor - $codes = $Cbucket->get_anchor_codes($params['place']); - if(!empty($codes)) - { - if(is_array($codes)) - { - foreach($codes as $code) - { - echo $code; - } - }else{ - echo $codes; - } - } - - //Getting list of function that will be performed while calling achor - $funcs = $Cbucket->get_anchor_function_list($params['place']); - - if(!empty($funcs)) - { - if(is_array($funcs)) - { - foreach($funcs as $func) - { - if(function_exists($func)) - $func(); - } - }else{ - $funcs(); - } - } - } - - /** - * FUNCTION USED TO REGISTER ANCHORS - * before_comments etc.. see complete list on http://docs.clip-bucket.com - */ - function register_anchor($name,$type=NULL) - { - global $Cbucket; - if(is_array($name)) - { - foreach($name as $key => $naam) - if(is_array($naam)) - { - foreach($naam as $name) - { - $Cbucket->anchorList[$name][] = $key; - } - }else{ - - $Cbucket->anchorList[$naam][] = $key; - } - }elseif($type!=NULL){ - $Cbucket->anchorList[$type][] = $name; - } - } - - - - /** - * FUNCTION USED TO REGISTER FUNCTION - * If you want to perform some function on - * some place, you can simple register function that will be execute where anchor points are - * placed - */ - function register_anchor_function($name,$type=NULL) - { - global $Cbucket; - if(is_array($name)) - { - foreach($name as $key => $naam) - if(is_array($naam)) - { - foreach($naam as $name) - { - $Cbucket->anchor_function_list[$name][] = $key; - } - }else{ - - $Cbucket->anchor_function_list[$naam][] = $key; - } - }elseif($type!=NULL){ - $Cbucket->anchor_function_list[$type][] = $name; - } - } /** * Insert Id @@ -1053,28 +932,6 @@ function SetTime($sec, $padHours = true) { return $Cbucket->ids[$code]=$id; } - - /** - * Function used to add items in admin menu - * This function will insert new item in admin menu - * under given header, if the header is not available - * 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. for reference - * @param STRING name - * @param STRING link - * That will add new item in admin menu - */ - function add_admin_menu($header='Tool Box',$name,$link) - { - global $Cbucket; - //Gett Menu - $menu = $Cbucket->AdminMenu; - //Add New Meny - $menu[$header][$name] = $link; - $Cbucket->AdminMenu = $menu; - } - /** * Function used to select data from database @@ -1553,60 +1410,6 @@ function SetTime($sec, $padHours = true) { - /** - * Function used to add custom upload fields - * In this you will provide an array that has a complete - * details of the field such as 'name',validate_func etc - * please check docs.clip-bucket.com for "how to add custom upload field" - */ - function register_custom_upload_field($array) - { - global $Upload; - $name = key($array); - if(is_array($array) && !empty($array[$name]['name'])) - { - foreach($array as $key => $arr) - $Upload->custom_upload_fields[$key] = $arr; - } - } - - /** - * Function used to add custom form fields - * In this you will provide an array that has a complete - * details of the field such as 'name',validate_func etc - * please check docs.clip-bucket.com for "how to add custom form field" - */ - function register_custom_form_field($array) - { - global $Upload; - $name = key($array); - if(is_array($array) && !empty($array[$name]['name'])) - { - foreach($array as $key => $arr) - $Upload->custom_form_fields[$key] = $arr; - } - } - - - /** - * Function used to add custom signup form fields - * In this you will provide an array that has a complete - * details of the field such as 'name',validate_func etc - * please check docs.clip-bucket.com for "how to add custom signup field" - */ - function register_signup_field($array) - { - global $signup; - $name = key($array); - if(is_array($array) && !empty($array[$name]['name'])) - { - foreach($array as $key => $arr) - $signup->custom_signup_fields[$key] = $arr; - } - } - - - /** * Function used to get PHP Path */ @@ -1617,28 +1420,6 @@ function SetTime($sec, $padHours = true) { - /** - * Function used to add actions that will be performed - * when video is uploaded - * @param Function name - */ - function register_after_video_upload_action($func) - { - global $Upload; - $Upload->actions_after_video_upload[] = $func; - } - - /** - * Function used to add actions that will be performed - * when video is going to play, it will check which player to use - * what type to use and what to do - * @param Function name - */ - function register_actions_play_video($func) - { - global $Cbucket; - $Cbucket->actions_play_video[] = $func; - } diff --git a/upload/includes/plugin.functions.php b/upload/includes/plugin.functions.php new file mode 100644 index 00000000..74496d0d --- /dev/null +++ b/upload/includes/plugin.functions.php @@ -0,0 +1,253 @@ + $naam) + if(is_array($naam)) + { + foreach($naam as $name) + { + $Cbucket->actionList[$name][] = $key; + } + }else{ + + $Cbucket->actionList[$naam][] = $key; + } + }elseif($type!=NULL){ + $Cbucket->actionList[$type][] = $name; + } + } + + + + + + /** + * FUNCTION USED TO CREATE ANCHOR PLACEMENT + * these are the placement where we can add plugin's or widget's code, + * e.g if we want to display a new WYSIWYG box before comment text area + * we will create anchor before text area as {ANCHOR place='before_compose_box'} + * code will be written in plugin file and its place will point 'before_compose_box' + * then our function will get all the code for this placement and will display it + * @param : array(Ad Code, LIMIT); + */ + function ANCHOR($params,&$Smarty) + { + global $Cbucket; + //Getting List of codes to display at this anchor + $codes = $Cbucket->get_anchor_codes($params['place']); + if(!empty($codes)) + { + if(is_array($codes)) + { + foreach($codes as $code) + { + echo $code; + } + }else{ + echo $codes; + } + } + + //Getting list of function that will be performed while calling achor + $funcs = $Cbucket->get_anchor_function_list($params['place']); + + if(!empty($funcs)) + { + if(is_array($funcs)) + { + foreach($funcs as $func) + { + if(function_exists($func)) + $func(); + } + }else{ + $funcs(); + } + } + } + + /** + * FUNCTION USED TO REGISTER ANCHORS + * before_comments etc.. see complete list on http://docs.clip-bucket.com + */ + function register_anchor($name,$type=NULL) + { + global $Cbucket; + if(is_array($name)) + { + foreach($name as $key => $naam) + if(is_array($naam)) + { + foreach($naam as $name) + { + $Cbucket->anchorList[$name][] = $key; + } + }else{ + + $Cbucket->anchorList[$naam][] = $key; + } + }elseif($type!=NULL){ + $Cbucket->anchorList[$type][] = $name; + } + } + + + + /** + * FUNCTION USED TO REGISTER FUNCTION + * If you want to perform some function on + * some place, you can simple register function that will be execute where anchor points are + * placed + */ + function register_anchor_function($name,$type=NULL) + { + global $Cbucket; + if(is_array($name)) + { + foreach($name as $key => $naam) + if(is_array($naam)) + { + foreach($naam as $name) + { + $Cbucket->anchor_function_list[$name][] = $key; + } + }else{ + + $Cbucket->anchor_function_list[$naam][] = $key; + } + }elseif($type!=NULL){ + $Cbucket->anchor_function_list[$type][] = $name; + } + } + + + /** + * Function used to add items in admin menu + * This function will insert new item in admin menu + * under given header, if the header is not available + * 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. for reference + * @param STRING name + * @param STRING link + * That will add new item in admin menu + */ + function add_admin_menu($header='Tool Box',$name,$link) + { + global $Cbucket; + //Gett Menu + $menu = $Cbucket->AdminMenu; + //Add New Meny + $menu[$header][$name] = $link; + $Cbucket->AdminMenu = $menu; + } + + + + + /** + * Function used to add custom upload fields + * In this you will provide an array that has a complete + * details of the field such as 'name',validate_func etc + * please check docs.clip-bucket.com for "how to add custom upload field" + */ + function register_custom_upload_field($array) + { + global $Upload; + $name = key($array); + if(is_array($array) && !empty($array[$name]['name'])) + { + foreach($array as $key => $arr) + $Upload->custom_upload_fields[$key] = $arr; + } + } + + /** + * Function used to add custom form fields + * In this you will provide an array that has a complete + * details of the field such as 'name',validate_func etc + * please check docs.clip-bucket.com for "how to add custom form field" + */ + function register_custom_form_field($array) + { + global $Upload; + $name = key($array); + if(is_array($array) && !empty($array[$name]['name'])) + { + foreach($array as $key => $arr) + $Upload->custom_form_fields[$key] = $arr; + } + } + + + /** + * Function used to add custom signup form fields + * In this you will provide an array that has a complete + * details of the field such as 'name',validate_func etc + * please check docs.clip-bucket.com for "how to add custom signup field" + */ + function register_signup_field($array) + { + global $signup; + $name = key($array); + if(is_array($array) && !empty($array[$name]['name'])) + { + foreach($array as $key => $arr) + $signup->custom_signup_fields[$key] = $arr; + } + } + + + + + /** + * Function used to add actions that will be performed + * when video is uploaded + * @param Function name + */ + function register_after_video_upload_action($func) + { + global $Upload; + $Upload->actions_after_video_upload[] = $func; + } + + /** + * Function used to add actions that will be performed + * when video is going to play, it will check which player to use + * what type to use and what to do + * @param Function name + */ + function register_actions_play_video($func) + { + global $Cbucket; + $Cbucket->actions_play_video[] = $func; + } + + + + /** + * Function used to add links in admin area + */ + function add_admin_link($array) + { + $area = $array['area']; + $title = $array['title']; + $link = $array['link']; + } + +?> \ No newline at end of file
Category NameCategory Name Thumb DescriptionDefaulActionDefaultAction 
{$category[list].category_name}View Thumb{$category[list].category_desc}View Thumb + {if $category[list].category_desc}{$category[list].category_desc}{else}N/A{/if} {$category[list].isdefault} -
  • Edit
  • +
  • Edit
  • Delete
  • + {if $category[list].isdefault!="yes"}
  • Make Default
  • {/if}