FIXED : Group Category '%s'
FIXED : Button disable while adding comment FIXED : Template Editor Strip Slashes FIXED : Groups Privacy Setting ADDED : Owner can delete comments ADDED : download option
This commit is contained in:
parent
fdbbce54ce
commit
959122f086
11 changed files with 159 additions and 59 deletions
|
@ -53,7 +53,7 @@ if(!$cbtpl->is_template($sel_dir))
|
|||
//echo $file;
|
||||
$data = $_POST['thecontent'];
|
||||
$open_file = fopen($file, "w");
|
||||
fwrite($open_file, $data);
|
||||
fwrite($open_file, stripslashes($data));
|
||||
e("File has been updated","m");
|
||||
}else
|
||||
e("Unable to write file");
|
||||
|
|
|
@ -239,7 +239,7 @@ class CBGroups extends CBCategory
|
|||
'name'=> 'category[]',
|
||||
'id'=> 'category',
|
||||
'value'=> array('category',$cat_array),
|
||||
'hint_1'=> lang('vdo_cat_msg'),
|
||||
'hint_1'=> sprintf(lang('vdo_cat_msg'),ALLOWED_GROUP_CATEGORIES),
|
||||
'db_field'=>'category',
|
||||
'required'=>'yes',
|
||||
'validate_function'=>'validate_group_category',
|
||||
|
@ -257,16 +257,16 @@ class CBGroups extends CBCategory
|
|||
/**
|
||||
* Function used to load other group option fields
|
||||
*/
|
||||
function load_other_fields()
|
||||
function load_other_fields($default=NULL)
|
||||
{
|
||||
global $LANG,$uploadFormOptionFieldsArray;
|
||||
|
||||
|
||||
if($default == NULL)
|
||||
if(!$default)
|
||||
$default = $_POST;
|
||||
|
||||
$gpprivacy = $default['group_privacy'];
|
||||
$gpposting = $dafaul['post_type'];
|
||||
$gpposting = $default['post_type'];
|
||||
|
||||
$group_option_fields = array
|
||||
(
|
||||
|
@ -1506,23 +1506,30 @@ class CBGroups extends CBCategory
|
|||
function add_comment($comment,$obj_id,$reply_to=NULL)
|
||||
{
|
||||
global $myquery,$db;
|
||||
$add_comment = $myquery->add_comment($comment,$obj_id,$reply_to,'t');
|
||||
if($add_comment)
|
||||
|
||||
if(!$this->topic_exists($obj_id))
|
||||
e("Topic does not exist");
|
||||
else
|
||||
{
|
||||
//Loggin Comment
|
||||
$log_array = array
|
||||
(
|
||||
'success'=>'yes',
|
||||
'details'=> "comment on a topic",
|
||||
'action_obj_id' => $obj_id,
|
||||
'action_done_id' => $add_comment,
|
||||
);
|
||||
insert_log('topic_comment',$log_array);
|
||||
|
||||
//Updating Number of comments of topics
|
||||
$this->update_comments_count($obj_id);
|
||||
$owner = $this->get_group_owner_from_topic($obj_id);
|
||||
$add_comment = $myquery->add_comment($comment,$obj_id,$reply_to,'t',$owner);
|
||||
if($add_comment)
|
||||
{
|
||||
//Loggin Comment
|
||||
$log_array = array
|
||||
(
|
||||
'success'=>'yes',
|
||||
'details'=> "comment on a topic",
|
||||
'action_obj_id' => $obj_id,
|
||||
'action_done_id' => $add_comment,
|
||||
);
|
||||
insert_log('topic_comment',$log_array);
|
||||
|
||||
//Updating Number of comments of topics
|
||||
$this->update_comments_count($obj_id);
|
||||
}
|
||||
return $add_comment;
|
||||
}
|
||||
return $add_comment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2049,5 +2056,20 @@ class CBGroups extends CBCategory
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get group owner from topic
|
||||
*/
|
||||
function get_group_owner_from_topic($tid)
|
||||
{
|
||||
global $db;
|
||||
$results = $db->select("group_topics,groups","group_topics.group_id,group_topics.topic_id,groups.userid,groups.group_id","group_topics.group_id = groups.group_id AND group_topics.topic_id='$tid'");
|
||||
|
||||
if($db->num_rows>0)
|
||||
return $results[0]['userid'];
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -155,6 +155,7 @@ class myquery {
|
|||
$uid = user_id();
|
||||
|
||||
if(($uid == $cdetails['userid'] && $cdetails['userid']!='')
|
||||
|| $cdetails['type_owner_id'] == userid()
|
||||
|| has_access("admin_del_access",false)
|
||||
|| $is_reply==TRUE || $forceDelete)
|
||||
{
|
||||
|
@ -844,7 +845,7 @@ class myquery {
|
|||
* This is more advance function ,
|
||||
* in this function functions can be applied on comments
|
||||
*/
|
||||
function add_comment($comment,$obj_id,$reply_to=NULL,$type='v')
|
||||
function add_comment($comment,$obj_id,$reply_to=NULL,$type='v',$obj_owner=NULL)
|
||||
{
|
||||
global $userquery,$eh,$db,$Cbucket;
|
||||
//Checking maximum comments characters allowed
|
||||
|
@ -890,9 +891,9 @@ class myquery {
|
|||
if(empty($eh->error_list))
|
||||
{
|
||||
$db->insert("comments",array
|
||||
('type,comment,type_id,userid,date_added,parent_id,anonym_name,anonym_email','comment_ip'),
|
||||
('type,comment,type_id,userid,date_added,parent_id,anonym_name,anonym_email','comment_ip','type_owner_id'),
|
||||
array
|
||||
($type,$comment,$obj_id,userid(),NOW(),$reply_to,$name,$email,$_SERVER['REMOTE_ADDR']));
|
||||
($type,$comment,$obj_id,userid(),NOW(),$reply_to,$name,$email,$_SERVER['REMOTE_ADDR'],$obj_owner));
|
||||
$db->update("users",array("total_comments"),array("|f|total_comments+1")," userid='".userid()."'");
|
||||
|
||||
e("Comment has been added",m);
|
||||
|
|
|
@ -1107,7 +1107,10 @@ class userquery extends CBCategory{
|
|||
{
|
||||
$db->insert($this->dbtbl['subtbl'],array('userid','subscribed_to','date_added'),
|
||||
array($user,$to,NOW()));
|
||||
|
||||
$db->update($this->dbtbl['users'],array('subscribers'),
|
||||
array($this->get_user_subscribers($to,true))," userid='$to' ");
|
||||
$db->update($this->dbtbl['users'],array('total_subscriptions'),
|
||||
array($this->get_user_subscriptions($user,'count'))," userid='$user' ");
|
||||
//Loggin Comment
|
||||
$log_array = array
|
||||
(
|
||||
|
@ -1153,6 +1156,13 @@ class userquery extends CBCategory{
|
|||
{
|
||||
$db->execute("DELETE FROM ".$this->dbtbl['subtbl']." WHERE userid='$uid' AND subscribed_to='$subid'");
|
||||
e("You have unsubscribed sucessfully","m");
|
||||
|
||||
$db->update($this->dbtbl['users'],array('subscribers'),
|
||||
array($this->get_user_subscribers($subid,true))," userid='$subid' ");
|
||||
$db->update($this->dbtbl['users'],array('total_subscriptions'),
|
||||
array($this->get_user_subscriptions($uid,'count'))," userid='$uid' ");
|
||||
|
||||
|
||||
return true;
|
||||
}else
|
||||
e("You are not subscribed");
|
||||
|
@ -1165,14 +1175,18 @@ class userquery extends CBCategory{
|
|||
* Function used to get user subscibers
|
||||
* @param userid
|
||||
*/
|
||||
function get_user_subscribers($id)
|
||||
function get_user_subscribers($id,$count=false)
|
||||
{
|
||||
global $id;
|
||||
$result = $db->select($this->dbtbl['subtbl'],"*"," subscribed_to='$to' ");
|
||||
if($db->num_rows>0)
|
||||
return $result;
|
||||
else
|
||||
return false;
|
||||
global $db;
|
||||
if(!$count)
|
||||
{
|
||||
$result = $db->select($this->dbtbl['subtbl'],"*"," subscribed_to='$id' ");
|
||||
if($db->num_rows>0)
|
||||
return $result;
|
||||
else
|
||||
return false;
|
||||
}else
|
||||
return $db->count($this->dbtbl['subtbl'],"subscription_id"," subscribed_to='$id' ");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1194,11 +1208,18 @@ class userquery extends CBCategory{
|
|||
function get_user_subscriptions($id,$limit=NULL)
|
||||
{
|
||||
global $db;
|
||||
$result = $db->select("users,".$this->dbtbl['subtbl'],"*"," subscriptions.userid = '$id' AND subscriptions.subscribed_to=users.userid",$limit);
|
||||
if($db->num_rows>0)
|
||||
if($limit!='count')
|
||||
{
|
||||
$result = $db->select("users,".$this->dbtbl['subtbl'],"*"," subscriptions.userid = '$id' AND subscriptions.subscribed_to=users.userid",$limit);
|
||||
if($db->num_rows>0)
|
||||
return $result;
|
||||
else
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
$result = $db->count($this->dbtbl['subtbl'],"subscription_id"," userid = '$id'");
|
||||
return $result;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1751,7 +1772,9 @@ class userquery extends CBCategory{
|
|||
if(!$this->user_exists($obj_id))
|
||||
e("User does not exists");
|
||||
else
|
||||
$add_comment = $myquery->add_comment($comment,$obj_id,$reply_to,$type);
|
||||
{
|
||||
$add_comment = $myquery->add_comment($comment,$obj_id,$reply_to,$type,$obj_id);
|
||||
}
|
||||
if($add_comment)
|
||||
{
|
||||
//Loggin Comment
|
||||
|
|
|
@ -44,7 +44,9 @@ class CBvideo extends CBCategory
|
|||
*/
|
||||
function video_exists($vid)
|
||||
{
|
||||
return $this->get_video($vid);
|
||||
global $db;
|
||||
return $db->count("video","videoid"," videoid='$vid' ");
|
||||
//return $this->get_video($vid);
|
||||
}
|
||||
function exists($vid){return $this->video_exists($vid);}
|
||||
function videoexists($vid){return $this->video_exists($vid);}
|
||||
|
@ -544,23 +546,31 @@ class CBvideo extends CBCategory
|
|||
function add_comment($comment,$obj_id,$reply_to=NULL)
|
||||
{
|
||||
global $myquery,$db;
|
||||
$add_comment = $myquery->add_comment($comment,$obj_id,$reply_to,'v');
|
||||
if($add_comment)
|
||||
|
||||
if(!$this->video_exists($obj_id))
|
||||
e("Video doesn't exist");
|
||||
else
|
||||
{
|
||||
//Loggin Comment
|
||||
$log_array = array
|
||||
(
|
||||
'success'=>'yes',
|
||||
'details'=> "comment on a video",
|
||||
'action_obj_id' => $obj_id,
|
||||
'action_done_id' => $add_comment,
|
||||
);
|
||||
insert_log('video_comment',$log_array);
|
||||
|
||||
//Updating Number of comments of video
|
||||
$this->update_comments_count($obj_id);
|
||||
//Getting Owner Id
|
||||
$owner_id = $this->get_video_owner($obj_id,true);
|
||||
$add_comment = $myquery->add_comment($comment,$obj_id,$reply_to,'v',$owner_id);
|
||||
if($add_comment)
|
||||
{
|
||||
//Loggin Comment
|
||||
$log_array = array
|
||||
(
|
||||
'success'=>'yes',
|
||||
'details'=> "comment on a video",
|
||||
'action_obj_id' => $obj_id,
|
||||
'action_done_id' => $add_comment,
|
||||
);
|
||||
insert_log('video_comment',$log_array);
|
||||
|
||||
//Updating Number of comments of video
|
||||
$this->update_comments_count($obj_id);
|
||||
}
|
||||
return $add_comment;
|
||||
}
|
||||
return $add_comment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -759,6 +769,28 @@ class CBvideo extends CBCategory
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to get video owner
|
||||
*/
|
||||
function get_video_owner($vid,$idonly=false)
|
||||
{
|
||||
global $db;
|
||||
if($idonly)
|
||||
{
|
||||
$results = $db->select("video","userid"," videoid='$vid' ",1);
|
||||
if($db->num_rows>0)
|
||||
return $results[0]['userid'];
|
||||
else
|
||||
return false;
|
||||
}else{
|
||||
$results = $db->select("video","*"," videoid='$vid' ",1);
|
||||
if($db->num_rows>0)
|
||||
return $results[0];
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to check weather current user is video owner or not
|
||||
*/
|
||||
|
|
|
@ -1549,7 +1549,7 @@
|
|||
$code = $param['code'];
|
||||
$height = $param['height'] = $param['height'] ? $param['height'] : config('player_height');
|
||||
$width = $param['width'] = $param['width'] ? $param['width'] : config('player_width');
|
||||
$params['autoplay'] = $params['autoplay'] ? $params['autoplay'] : 'true';
|
||||
$param['autoplay'] = $param['autoplay'] ? $param['autoplay'] : 'true';
|
||||
|
||||
if(count($Cbucket->actions_play_video)>0)
|
||||
{
|
||||
|
|
|
@ -414,6 +414,8 @@ var loading = loading_img+" Loading...";
|
|||
{
|
||||
$("#add_comment_result").css("display","block");
|
||||
$("#add_comment_result").html(loading);
|
||||
$("#add_comment_button").attr("disabled","disabled");
|
||||
|
||||
$.post(page,
|
||||
{
|
||||
mode : 'add_comment',
|
||||
|
@ -430,6 +432,8 @@ var loading = loading_img+" Loading...";
|
|||
alert("No data");
|
||||
else
|
||||
{
|
||||
$("#add_comment_button").attr("disabled","");
|
||||
|
||||
$("#add_comment_result").css("display","block");
|
||||
if(data.err!='')
|
||||
$("#add_comment_result").html(data.err);
|
||||
|
|
|
@ -31,14 +31,16 @@ if(!function_exists('flowplayer'))
|
|||
define("AUTOPLAY",false);
|
||||
define("SKIN","default.swf");
|
||||
|
||||
function flowplayer($vdata)
|
||||
function flowplayer($data)
|
||||
{
|
||||
$vid_file = get_video_file($vdata,false,false);
|
||||
$vdata = $data['vdetails'];
|
||||
$vid_file = get_video_file($vdata,true,true);
|
||||
|
||||
$code = '';
|
||||
if($vid_file)
|
||||
{
|
||||
$code .= "swfobject.embedSWF(\"".PLAYER_URL.'/flow_player/flowplayer.swf'."\", \"videoPlayer\", \"".$vdata['width']."\", \"".$vdata['height']."\", \"9.0.0\", null, { \n";
|
||||
$code .= "config: \"{'clip': '".BASEURL.'/files/videos/'.$vid_file."','autoPlay':'".$vdata['autoplay']."' }}\"\n" ;
|
||||
$code .= "swfobject.embedSWF(\"".PLAYER_URL.'/flow_player/flowplayer.swf'."\", \"videoPlayer\", \"".$data['width']."\", \"".$data['height']."\", \"9.0.0\", null, { \n";
|
||||
$code .= "config: \"{'clip': '".$vid_file."','autoPlay':'".$data['autoplay']."' }}\"\n" ;
|
||||
$code .= "} \n";
|
||||
$code .= "); \n";
|
||||
return $code;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
{ANCHOR place='before_compose_box'}
|
||||
<textarea name="comment" id="comment_box" cols="45" rows="5" class="input" ></textarea>
|
||||
<br>
|
||||
<div style="margin-top:5px"><input type="button" name="add_comment" id="add_comment" value="Add Comment" class="cb_button" onclick="add_comment_js('comment_form','{$type}')"></div>
|
||||
<div style="margin-top:5px"><input type="button" name="add_comment" id="add_comment_button" value="Add Comment" class="cb_button" onclick="add_comment_js('comment_form','{$type}')"></div>
|
||||
</form>
|
||||
{else}
|
||||
Please login to comment
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
</div>
|
||||
<div style="width:28%; float:right" align="right"><a href="javascript:void(0)" onclick="to_reply('{$comment.comment_id}')">Reply</a> | <a href="javascript:void(0)" onclick="spam_comment('{$comment.comment_id}')">Spam</a>
|
||||
|
||||
{if has_access('admin_del_access') || $comment.userid==userid()} | <a href="javascript:void(0)" onclick="delete_comment('{$comment.comment_id}','{$type}')">Delete</a>{/if}</div>
|
||||
{if has_access('admin_del_access') || $comment.userid==userid() || $comment.type_owner_id==userid()} | <a href="javascript:void(0)" onclick="delete_comment('{$comment.comment_id}','{$type}')">Delete</a>{/if}</div>
|
||||
<div class="cleafix"></div>
|
||||
</div>
|
||||
|
||||
|
|
16
upload/styles/cbv2new/layout/download.html
Normal file
16
upload/styles/cbv2new/layout/download.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
<script>
|
||||
var download_file = '{$vdo.download_file}';
|
||||
{literal}
|
||||
$(document).ready
|
||||
(function()
|
||||
{
|
||||
setTimeout("location.href='"+download_file+"'",3000);
|
||||
}
|
||||
)
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
<div style="width:98%; margin:auto">
|
||||
<h2>Downloading {$vdo.title}...</h2>
|
||||
<p><a href="{$vdo.download_file}">click here if you don't redirect automatically</a> - <a href="{videoLink vdetails=$vdo}"> Click Here to Go Back to Video Page</a></p></div>
|
Loading…
Add table
Reference in a new issue