aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormarijus <mario@localhost.localdomain>2014-01-30 09:57:31 +0100
committermarijus <mario@localhost.localdomain>2014-01-30 09:57:31 +0100
commit91e9e3be91e9fd6ba73085066d34a4c6daf27ee9 (patch)
treeaa53cc5185c5b1a58f0bb8e30609da6bcdc0b5ad /include
parent5e952e3738293ce24309fddaff04350e735e449a (diff)
parent080928f214c9f83879f1578e05baa6032fa2b7b8 (diff)
downloadvolse-hubzilla-91e9e3be91e9fd6ba73085066d34a4c6daf27ee9.tar.gz
volse-hubzilla-91e9e3be91e9fd6ba73085066d34a4c6daf27ee9.tar.bz2
volse-hubzilla-91e9e3be91e9fd6ba73085066d34a4c6daf27ee9.zip
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'include')
-rw-r--r--include/chat.php31
-rw-r--r--include/reddav.php2
-rw-r--r--include/widgets.php6
3 files changed, 29 insertions, 10 deletions
diff --git a/include/chat.php b/include/chat.php
index 6bcb003ff..aef154fe6 100644
--- a/include/chat.php
+++ b/include/chat.php
@@ -20,6 +20,18 @@ function chatroom_create($channel,$arr) {
return $ret;
}
+ $r = q("select count(cr_id) as total from chatroom where cr_aid = %d",
+ intval($channel['channel_account_id'])
+ );
+ if($r)
+ $limit = service_class_fetch($channel_id,'chatrooms');
+
+ if(($r) && ($limit !== false) && ($r[0]['total'] >= $limit)) {
+ $ret['message'] = upgrade_message();
+ return $ret;
+ }
+
+
$created = datetime_convert();
$x = q("insert into chatroom ( cr_aid, cr_uid, cr_name, cr_created, cr_edited, allow_cid, allow_gid, deny_cid, deny_gid )
@@ -83,18 +95,20 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) {
$r = q("select * from chatroom where cr_id = %d limit 1",
intval($room_id)
);
- if(! $r)
- return;
+ if(! $r) {
+ notice( t('Room not found.') . EOL);
+ return false;
+ }
require_once('include/security.php');
$sql_extra = permissions_sql($r[0]['cr_uid']);
- $x = q("select * from chatroom where cr_id = %d and uid = %d $sql_extra limit 1",
- intval($room_id)
+ $x = q("select * from chatroom where cr_id = %d and cr_uid = %d $sql_extra limit 1",
+ intval($room_id),
intval($r[0]['cr_uid'])
);
if(! $x) {
notice( t('Permission denied.') . EOL);
- return;
+ return false;
}
$r = q("select * from chatpresence where cp_xchan = '%s' and cp_room = %d limit 1",
@@ -122,12 +136,13 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) {
}
-function chatroom_leave($observer_xchan,$room_id,$status) {
+function chatroom_leave($observer_xchan,$room_id,$client) {
if(! $room_id || ! $observer_xchan)
return;
- $r = q("select * from chatpresence where cp_xchan = '%s' and cp_room = %d limit 1",
+ $r = q("select * from chatpresence where cp_xchan = '%s' and cp_room = %d and cp_client = '%s' limit 1",
dbesc($observer_xchan),
- intval($room_id)
+ intval($room_id),
+ dbesc($client)
);
if($r) {
q("delete from chatpresence where cp_id = %d limit 1",
diff --git a/include/reddav.php b/include/reddav.php
index c5ef39097..e6e066770 100644
--- a/include/reddav.php
+++ b/include/reddav.php
@@ -628,7 +628,7 @@ function RedFileData($file, &$auth,$test = false) {
}
if((! $file) || ($file === '/')) {
- return RedDirectory('/',$auth);
+ return new RedDirectory('/',$auth);
}
diff --git a/include/widgets.php b/include/widgets.php
index 8b22515b1..0151f7c27 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -580,8 +580,12 @@ function widget_menu_preview($arr) {
function widget_chatroom_list($arr) {
require_once("include/chat.php");
$r = chatroom_list(local_user());
+ $channel = get_app()->get_channel();
return replace_macros(get_markup_template('chatroomlist.tpl'),array(
'$header' => t('Chat Rooms'),
+ '$baseurl' => z_root(),
+ '$nickname' => $channel['channel_address'],
'$items' => $r,
));
-} \ No newline at end of file
+}
+