Fixed : Object counts does not update on video delete in collection

Fixed : UPPER case video extension cause problem
Fixed : Hard coded letters in users watch channel links
This commit is contained in:
Arslan Hassan 2011-06-02 12:56:50 +00:00
parent 0fbf51fe87
commit d119dd6dcb
6 changed files with 38 additions and 7 deletions

View file

@ -122,7 +122,7 @@ switch($mode)
//Checking file type
$types_array = preg_replace('/,/',' ',$types);
$types_array = explode(' ',$types_array);
$file_ext = getExt($_FILES['Filedata']['name']);
$file_ext = strtolower(getExt($_FILES['Filedata']['name']));
if(!in_array($file_ext,$types_array))
{
upload_error("Invalid file extension");

View file

@ -1695,6 +1695,27 @@ class Collections extends CBCategory
}
/**
* Function used to remove item from collections
* and decrement collection item count
* @param : itemID
* @param : type
*/
function deleteItemFromCollections($objId,$type=NULL)
{
global $db,$cbvid;
if(!$type)
$type = $this->objType;
$db->update(tbl('collections,collection_items'),array('total_objects'),array('|f|total_objects -1'),
tbl("collections.collection_id")." = ".tbl("collection_items.collection_id")." AND "
.tbl("collection_items.type='".$type."'")." AND ".tbl("collection_items.object_id='".$objId."'"));
$db->execute("DELETE FROM ".tbl('collection_items')." WHERE "
.("type='".$type."'")." AND ".("object_id='".$objId."'"));
}
}
?>

View file

@ -2761,11 +2761,10 @@ class userquery extends CBCategory{
*/
function get_channel_action_links($u)
{
return array(lang('Send Message')=>array('link'=>cblink(array('name'=>'compose_new','extra_params'=>'to='.$u['username']))),
lang('Add as friend')=>array('link'=>'javascript:void(0)','onclick'=>"add_friend('".$u['userid']."','result_cont')"),
lang('Block user')=>array('link'=>'javascript:void(0)','onclick'=>"block_user('".$u['username']."','result_cont')")
);
}
return array(lang('send_message')=>array('link'=>cblink(array('name'=>'compose_new','extra_params'=>'to='.$u['username']))),
lang('add_as_friend')=>array('link'=>'javascript:void(0)','onclick'=>"add_friend('".$u['userid']."','result_cont')"),
lang('block_user')=>array('link'=>'javascript:void(0)','onclick'=>"block_user('".$u['username']."','result_cont')")
); }
/**
* Function used to get user videos link

View file

@ -51,6 +51,8 @@ class CBvideo extends CBCategory
if(isSectionEnabled('videos'))
$Cbucket->search_types['videos'] = "cbvid";
$Cbucket->clipbucket_footer[] = 'check_cbvideo';
$this->video_delete_functions[] = 'delete_video_from_collection';
}
/**

View file

@ -5647,4 +5647,13 @@
global $userquery;
return $userquery->update_user_voted($array,$userid);
}
/**
* function used to delete vidoe from collections
*/
function delete_video_from_collection($vdetails)
{
global $cbvid;
$cbvid->collection->deleteItemFromCollections($vdetails['videoid']);
}
?>

File diff suppressed because one or more lines are too long