Added : proper video thumbs custom functions
Added : proper video files custom functions Fixed : HTML in phrases Fixed : Slashes in email templates Updated : Search Engine Added : Count only option in get contacts Updated : Related videos Fixed : Description New lines Fixed : Install lock Fixed : RSS Fixed : Category based search Fixed : Edit video Fixed : Friend Request
This commit is contained in:
parent
b1ec3197d2
commit
17ec491b41
16 changed files with 190 additions and 38 deletions
|
@ -14,7 +14,7 @@ $userquery->admin_login_check();
|
|||
$phrase_id = $_POST['id'];
|
||||
$value = $_POST['value'];
|
||||
|
||||
$lang_obj->update_phrase($phrase_id,$value);
|
||||
$lang_obj->update_phrase($phrase_id,'|no_mc|'.$value);
|
||||
|
||||
echo ($value);
|
||||
?>
|
||||
|
|
|
@ -275,4 +275,9 @@ margin-top: 0;
|
|||
.admin_links a{font-weight:bold; font-size:12px; color:#09c; display:block}
|
||||
.admin_links a:hover{color:#d54e21}
|
||||
|
||||
.edit_comment{display:block; }
|
||||
.edit_comment{display:block; }
|
||||
|
||||
.cb_div{border:1px solid #CCC; padding:10px; margin:10px; margin-left:0px }
|
||||
.cb_div td{border-bottom:1px solid #CCC}
|
||||
.cb_div .heading{background-color:#F2F2F2; font-weight:bold}
|
||||
.cb_div input[type=submit]{padding:5px}
|
|
@ -30,6 +30,8 @@ class CBEmail
|
|||
$result = $db->select(tbl($this->db_tpl),"*"," email_template_code='".$code."' OR email_template_id='$code' ");
|
||||
if($db->num_rows>0)
|
||||
{
|
||||
$result[0]['email_template'] = stripslashes($result[0]['email_template']);
|
||||
$result[0]['email_template_subject'] = stripslashes($result[0]['email_template_subject']);
|
||||
return $result[0];
|
||||
}else
|
||||
return false;
|
||||
|
|
|
@ -56,7 +56,7 @@ class cbsearch
|
|||
* user details where user_id = table.useri_id
|
||||
*/
|
||||
var $has_user_id = false;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ClipBucket Search System works pretty easily
|
||||
|
@ -69,6 +69,18 @@ class cbsearch
|
|||
var $display_template = '';
|
||||
var $template_var = '';
|
||||
|
||||
|
||||
/**
|
||||
* want to use MATCH - AGAINST method instead of LIKE
|
||||
* simply set this variable to true
|
||||
*/
|
||||
var $use_match_method = false;
|
||||
|
||||
/**
|
||||
* Fields to use for MATCH - AGAINST method
|
||||
*/
|
||||
var $match_fields = array();
|
||||
|
||||
/**
|
||||
* INITIATION SEARCH
|
||||
*/
|
||||
|
@ -98,11 +110,31 @@ class cbsearch
|
|||
function search()
|
||||
{
|
||||
global $db;
|
||||
|
||||
|
||||
$ma_query = "";
|
||||
#Checking for columns
|
||||
if(!$this->use_match_method)
|
||||
foreach($this->columns as $column)
|
||||
{
|
||||
$this->query_cond($column);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->key)
|
||||
{
|
||||
$this->set_the_key();
|
||||
$ma_query = $this->match_against_query();
|
||||
$this->add_cond($ma_query);
|
||||
//add order
|
||||
$add_select_field = ",".$ma_query." AS Resource";
|
||||
$sorting = "Resource ASC";
|
||||
}else
|
||||
{
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
|
||||
#Checking for category
|
||||
if(isset($this->category))
|
||||
{
|
||||
|
@ -115,7 +147,7 @@ class cbsearch
|
|||
}
|
||||
|
||||
#Sorting
|
||||
if(isset($this->sort_by))
|
||||
if(isset($this->sort_by) && !$sorting)
|
||||
{
|
||||
$sorting = $this->sorting[$this->sort_by];
|
||||
}
|
||||
|
@ -135,8 +167,9 @@ class cbsearch
|
|||
else
|
||||
$query_cond = $condition;
|
||||
$results = $db->select(tbl($this->db_tbl.",users"),
|
||||
tbl($this->db_tbl.'.*,users.userid,users.username'),
|
||||
tbl($this->db_tbl.'.*,users.userid,users.username').$add_select_field,
|
||||
$query_cond." ".tbl($this->db_tbl).".userid=".tbl("users.userid"),$this->limit,$sorting);
|
||||
$db->db_query;
|
||||
$this->total_results = $db->count(tbl($this->db_tbl),'*',$condition);
|
||||
|
||||
}else
|
||||
|
@ -172,7 +205,7 @@ class cbsearch
|
|||
{
|
||||
//Checking Condition Type
|
||||
$type = strtolower($array['type']);
|
||||
if($type !='=' && $type!='<' && $type!='>' && $type!='<=' && $type!='>=' && $type!='like')
|
||||
if($type !='=' && $type!='<' && $type!='>' && $type!='<=' && $type!='>=' && $type!='like' && $type!='match')
|
||||
{
|
||||
$type = '=';
|
||||
}
|
||||
|
@ -188,9 +221,12 @@ class cbsearch
|
|||
$op = $array['op'];
|
||||
else
|
||||
$op = '';
|
||||
if(!empty($this->key))
|
||||
if(!empty($this->key) && $type != 'match')
|
||||
$this->query_conds[] = $op." ".tbl($this->db_tbl).".".$array['field']." ".$type." '".preg_replace("/{KEY}/",$this->key,$var)."'";
|
||||
|
||||
if(!empty($this->key) && $type == 'match')
|
||||
$this->query_conds[] = $op." MATCH(".tbl($this->db_tbl).".".$array['field'].") AGAINST('".preg_replace("/{KEY}/",$this->key,$var)."'
|
||||
IN BOOLEAN MODE)";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -334,7 +370,45 @@ class cbsearch
|
|||
|
||||
return $this->date_margins;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function used to create match_against query
|
||||
* it will simple loop the input fields
|
||||
* add table prefix and create MATCH(fields) AGAINST (keyword) query
|
||||
* @return - MATCH (fields) AGAINST (kewyord)
|
||||
*/
|
||||
function match_against_query()
|
||||
{
|
||||
$cond = " MATCH ( ";
|
||||
$count = 0;
|
||||
foreach($this->match_fields as $field)
|
||||
{
|
||||
if($count>0)
|
||||
$cond .= ",";
|
||||
$cond .= tbl($this->db_tbl).".".$field;
|
||||
|
||||
$count++;
|
||||
}
|
||||
$cond .= ")"; //Here match(fields1,field2) thing is finished
|
||||
|
||||
//now add against
|
||||
$cond .= " AGAINST ('".$this->key."' IN BOOLEAN MODE) ";
|
||||
|
||||
return $cond;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to set the key
|
||||
*/
|
||||
function set_the_key($string=null)
|
||||
{
|
||||
if(!$string)
|
||||
$string = $this->key;
|
||||
$pattern = array('/(\w+)/i','/(\++)/i',"/(\-\+)/i",'/(\-+)/i');
|
||||
$replacement = array('+$1',"+","-","-");
|
||||
return $this->key = preg_replace($pattern, $replacement, $string);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
/*
|
||||
**************************
|
||||
* @ Author : Arslan Hassan
|
||||
|
@ -956,17 +956,28 @@ class userquery extends CBCategory{
|
|||
/**
|
||||
* Function used to get pending contacts
|
||||
*/
|
||||
function get_pending_contacts($uid,$group=0)
|
||||
function get_pending_contacts($uid,$group=0,$count_only=false)
|
||||
{
|
||||
global $db;
|
||||
$result = $db->select(tbl("contacts,users"),
|
||||
|
||||
if(!$count_only)
|
||||
{
|
||||
$result = $db->select(tbl("contacts,users"),
|
||||
tbl("contacts.userid,contacts.confirmed,contacts.request_type ,users.*"),
|
||||
tbl("contacts.contact_userid")."='$uid' AND ".tbl("users.userid")."=".tbl("contacts.userid")."
|
||||
AND ".tbl("contacts.confirmed")."='no' AND ".tbl("contacts").".contact_group_id='$group' ");
|
||||
if($db->num_rows>0)
|
||||
return $result;
|
||||
else
|
||||
return false;
|
||||
if($db->num_rows>0)
|
||||
return $result;
|
||||
else
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
$count = $db->count(tbl("contacts"),
|
||||
tbl("contacts.contact_userid"),
|
||||
tbl("contacts.contact_userid")."='$uid' AND ".tbl("contacts.confirmed")."='no' AND ".tbl("contacts").".contact_group_id='$group' ");
|
||||
//echo $db->db_query;
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -213,7 +213,7 @@ class CBvideo extends CBCategory
|
|||
$val = $new_val;
|
||||
}
|
||||
if(!$field['clean_func'] || (!apply_func($field['clean_func'],$val) && !is_array($field['clean_func'])))
|
||||
$val = mysql_clean($val);
|
||||
$val = ($val);
|
||||
else
|
||||
$val = apply_func($field['clean_func'],sql_free('|no_mc|'.$val));
|
||||
|
||||
|
@ -284,7 +284,9 @@ class CBvideo extends CBCategory
|
|||
e(lang("no_edit_video"));
|
||||
}else{
|
||||
//pr($upload_fields);
|
||||
|
||||
$db->update(tbl('video'),$query_field,$query_val," videoid='$vid'");
|
||||
//echo $db->db_query;
|
||||
e(lang("class_vdo_update_msg"),'m');
|
||||
}
|
||||
|
||||
|
@ -565,7 +567,7 @@ class CBvideo extends CBCategory
|
|||
$cond .= " ".$params['cond'];
|
||||
|
||||
|
||||
if(!$params['count_only'])
|
||||
if(!$params['count_only'] && !$params['show_related'])
|
||||
{
|
||||
if(!empty($cond))
|
||||
$cond .= " AND ";
|
||||
|
@ -573,7 +575,22 @@ class CBvideo extends CBCategory
|
|||
}
|
||||
|
||||
|
||||
if($params['show_related'])
|
||||
{
|
||||
$cond = "MATCH(".tbl("video.title,video.tags").")
|
||||
AGAINST ('".cbsearch::set_the_key($params['title'])."' IN BOOLEAN MODE) ";
|
||||
if($params['exclude'])
|
||||
{
|
||||
if($cond!='')
|
||||
$cond .= ' AND ';
|
||||
$cond .= " ".tbl('video.videoid')." <> '".$params['exclude']."' ";
|
||||
}
|
||||
$result = $db->select(tbl('video,users'),tbl('video.*,users.userid,users.username'),
|
||||
$cond." AND ".tbl("video.userid")." = ".tbl("users.userid"),$limit,$order);
|
||||
|
||||
assign($params['assign'],$result);
|
||||
}
|
||||
|
||||
if($params['count_only'])
|
||||
return $result = $db->count(tbl('video'),'*',$cond);
|
||||
if($params['assign'])
|
||||
|
@ -718,8 +735,8 @@ class CBvideo extends CBCategory
|
|||
{
|
||||
$this->email_template_vars = array
|
||||
('{video_title}' => $details['title'],
|
||||
'{video_description}' => $details['tags'],
|
||||
'{video_tags}' => $details['description'],
|
||||
'{video_description}' => $details['description'],
|
||||
'{video_tags}' => $details['tags'],
|
||||
'{video_date}' => cbdate(DATE_FORMAT,strtotime($details['date_added'])),
|
||||
'{video_link}' => video_link($details),
|
||||
'{video_thumb}'=> GetThumb($details)
|
||||
|
@ -736,12 +753,15 @@ class CBvideo extends CBCategory
|
|||
*/
|
||||
function init_search()
|
||||
{
|
||||
$this->search = new cbsearch;
|
||||
$this->search = new cbsearch;
|
||||
$this->search->db_tbl = "video";
|
||||
$this->search->columns =array(
|
||||
array('field'=>'title','type'=>'LIKE','var'=>'%{KEY}%'),
|
||||
array('field'=>'tags','type'=>'LIKE','var'=>'%{KEY}%','op'=>'OR')
|
||||
);
|
||||
$this->search->use_match_method = true;
|
||||
$this->search->match_fields = array("title","tags");
|
||||
|
||||
$this->search->cat_tbl = $this->cat_tbl;
|
||||
|
||||
$this->search->display_template = LAYOUT.'/blocks/video.html';
|
||||
|
|
|
@ -440,7 +440,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* Get Directory Size
|
||||
* Get Directory Size - get_video_file($vdata,$no_video,false);
|
||||
*/
|
||||
function get_directory_size($path)
|
||||
{
|
||||
|
@ -555,11 +555,27 @@
|
|||
}
|
||||
|
||||
#Checking if there is any custom function for
|
||||
if(count($Cbucket->custom_get_thumb_funcs)>0)
|
||||
foreach($Cbucket->custom_get_thumb_funcs as $funcs)
|
||||
if(count($Cbucket->custom_get_thumb_funcs) > 0)
|
||||
{
|
||||
if(function_exists($funcs))
|
||||
return $funcs($vdetails);
|
||||
|
||||
foreach($Cbucket->custom_get_thumb_funcs as $funcs)
|
||||
{
|
||||
|
||||
//Merging inputs
|
||||
$in_array = array(
|
||||
'num' => $num,
|
||||
'multi' => $multi,
|
||||
'count' => $count,
|
||||
'return_full_path' => $return_full_path,
|
||||
'return_big' => $return_big
|
||||
);
|
||||
if(function_exists($funcs))
|
||||
{
|
||||
$func_returned = $funcs($vdetails,$in_array);
|
||||
if($func_returned)
|
||||
return $func_returned;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#get all possible thumbs of video
|
||||
|
@ -919,6 +935,7 @@
|
|||
|
||||
if($all_cat && is_array($cats))
|
||||
$cats = array_merge($all_cat,$cats);
|
||||
|
||||
return $cats;
|
||||
}
|
||||
break;
|
||||
|
@ -1421,7 +1438,11 @@
|
|||
if(is_array($Cbucket->custom_video_file_funcs))
|
||||
foreach($Cbucket->custom_video_file_funcs as $func)
|
||||
if(function_exists($func))
|
||||
return $func($vdetails, $hq);
|
||||
{
|
||||
$func_returned = $func($vdetails, $hq);
|
||||
if($func_returned)
|
||||
return $func_returned;
|
||||
}
|
||||
|
||||
#Now there is no function so lets continue as
|
||||
$vid_files = glob(VIDEOS_DIR."/".$vdetails['file_name']."*");
|
||||
|
@ -4169,4 +4190,17 @@
|
|||
return $code;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* function used to convert input to proper date created formate
|
||||
*/
|
||||
function datecreated($in)
|
||||
{
|
||||
|
||||
if($in)
|
||||
return date("Y-m-d",strtotime($in));
|
||||
else
|
||||
return '0000-00-00';
|
||||
}
|
||||
|
||||
?>
|
|
@ -179,7 +179,7 @@ switch($step)
|
|||
|
||||
// file_put_contents(SCRIPT_DIR.'/files/install.lock',time());
|
||||
// file_put_contents(SCRIPT_DIR.'/includes/clipbucket.php',file_get_contents('clipbucket.php'));
|
||||
copy("install.loc",SCRIPT_DIR.'/files/install.lock');
|
||||
copy("install.lock",SCRIPT_DIR.'/files/install.lock');
|
||||
copy("clipbucket.php",SCRIPT_DIR."/includes/clipbucket.php");
|
||||
unlink(SCRIPT_DIR.'/files/temp/install.me');
|
||||
|
||||
|
@ -357,7 +357,7 @@ switch($step)
|
|||
|
||||
//file_put_contents(SCRIPT_DIR.'/files/install.lock',time());
|
||||
//file_put_contents(SCRIPT_DIR.'/includes/clipbucket.php',file_get_contents('clipbucket.php'));
|
||||
copy("install.loc",SCRIPT_DIR.'/files/install.lock');
|
||||
copy("install.lock",SCRIPT_DIR.'/files/install.lock');
|
||||
unlink(SCRIPT_DIR."/includes/clipbucket.php");
|
||||
copy("clipbucket.php",SCRIPT_DIR."/includes/clipbucket.php");
|
||||
unlink(SCRIPT_DIR.'/files/temp/install.me');
|
||||
|
|
|
@ -5,7 +5,7 @@ var page = "./upgrader.php";
|
|||
|
||||
function import_users()
|
||||
{
|
||||
$("#the_results").html("<strong>Step 2/6 - Importing Users , Pleae wait while ClipBucket imports users....</strong>");
|
||||
$("#the_results").html("<strong>Step 2/6 - Importing Users , Please wait while ClipBucket imports users....</strong>");
|
||||
$.post(page,
|
||||
{
|
||||
"upgrade" : "yes",
|
||||
|
@ -20,7 +20,7 @@ function import_users()
|
|||
|
||||
function import_vids()
|
||||
{
|
||||
$("#the_results").html("<strong>Step 3/6 - Importing Videos , Pleae wait while ClipBucket imports videos....</strong>");
|
||||
$("#the_results").html("<strong>Step 3/6 - Importing Videos , Please wait while ClipBucket imports videos....</strong>");
|
||||
$.post(page,
|
||||
{
|
||||
"upgrade" : "yes",
|
||||
|
@ -34,7 +34,7 @@ function import_vids()
|
|||
|
||||
function import_comments()
|
||||
{
|
||||
$("#the_results").html("<strong>Step 4/6 - Importing Comments , Pleae wait while ClipBucket imports video comments....</strong>");
|
||||
$("#the_results").html("<strong>Step 4/6 - Importing Comments , Please wait while ClipBucket imports video comments....</strong>");
|
||||
$.post(page,
|
||||
{
|
||||
"upgrade" : "yes",
|
||||
|
|
|
@ -51,7 +51,7 @@ if($_POST['upgrade'])
|
|||
|
||||
//Getting List Of User
|
||||
$users = $db->select("users","*"," userid<>'1'");
|
||||
|
||||
if(is_array($users))
|
||||
foreach($users as $user)
|
||||
{
|
||||
$array['username'] = $user['username'];
|
||||
|
@ -229,6 +229,7 @@ if($_POST['upgrade'])
|
|||
{
|
||||
//Getting list Of Comments
|
||||
$coms = $db->select("video_comments","*");
|
||||
if(is_array($coms))
|
||||
foreach($coms as $com)
|
||||
{
|
||||
$vid = $com['videoid'];
|
||||
|
|
|
@ -44,7 +44,7 @@ switch($mode)
|
|||
$videos = get_videos(array('limit'=>$limit,'order'=>'last_viewed DESC'));
|
||||
$title = "Videos Being Watched";
|
||||
}
|
||||
|
||||
break;
|
||||
case 'user':
|
||||
{
|
||||
$user = mysql_clean($_GET['username']);
|
||||
|
|
|
@ -16,7 +16,11 @@ $type = $type ? $type : 'videos';
|
|||
$search = cbsearch::init_search($type);
|
||||
|
||||
$search->key = mysql_clean($_GET['query']);
|
||||
$search->category = mysql_clean($_GET['category']);
|
||||
|
||||
if(!is_array($_GET['category']))
|
||||
$_GET['category'] = mysql_clean($_GET['category']);
|
||||
|
||||
$search->category = $_GET['category'];
|
||||
$search->date_margin = mysql_clean($_GET['datemargin']);
|
||||
$search->sort_by = mysql_clean($_GET['sort']);
|
||||
$search->limit = create_query_limit($page,$search->results_per_page);
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
|
||||
|
||||
{* Loading Custom Fields *}
|
||||
{if $custom_fields.0.title !=''}
|
||||
{if count($custom_form_fields)>0}
|
||||
<fieldset class="fieldset">
|
||||
<legend>{lang code='more_options'}</legend>
|
||||
{foreach from=$custom_fields item=field}
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<li><a href="{link name='my_videos'}">{lang code='com_my_videos'}</a></li>
|
||||
<li><a href="{link name='my_favorites'}">{lang code='Favorites'}</a></li>
|
||||
<li><a href="{link name='my_playlists'}">{lang code='playlists'}</a></li>
|
||||
<li><a href="{link name='my_contacts'}">{lang code='friend_requests'} ({$userquery->get_contacts($userquery->userid,0,no,true,'in')})</a></li>
|
||||
<li><a href="{link name='my_contacts'}">{lang code='friend_requests'} ({$userquery->get_pending_contacts($userquery->userid,0,true)})</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
<div class="search_con">
|
||||
|
|
|
@ -180,7 +180,7 @@
|
|||
|
||||
<!-- Getting Related videos -->
|
||||
{assign var=videos_items_columns value=func->config(videos_items_columns)}
|
||||
{get_videos tags=$vdo.tags limit=$videos_items_columns assign=related_vids exclude=$vdo.videoid}
|
||||
{get_videos tags=$vdo.tags limit=$videos_items_columns assign=related_vids exclude=$vdo.videoid title=$vdo.title show_related=true}
|
||||
{if $related_vids}
|
||||
<span class="watch_vids_head" onclick='$(this).toggleClass("watch_vids_head_closed");$("#related_vids").slideToggle("fast")'>Related Videos</span>
|
||||
<div class="watch_vids_cont" id="related_vids">
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
If you are reading this, I beg you please update your browser to Firefox or Chrome or Safari or Opera. If you still insists using on Internet Explorer, please use Internet Explorer 8
|
||||
*/
|
||||
|
||||
#container{overflow-x:hidden}
|
||||
.clearfix { display:inline-block; }
|
||||
.foot_s_con { margin:10px auto 0; padding:0px; }
|
||||
.foot_s_con input[type=submit] { background:url(../images/foot_search.png) top repeat-x; border:1px solid #555555; height:35px; padding:0px 6px; margin:1px 0px 0px; color:#FFF; font-family:Verdana,Tahoma,Arial,sans-serif; }
|
||||
|
|
Loading…
Add table
Reference in a new issue