Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-04-08 06:39:02 +0400
committerGeorg Ehrke <dev@georgswebsite.de>2012-04-08 06:39:02 +0400
commite940152bcef6394e3a4bc75d0d3054f6a18e0ce4 (patch)
treeaf095a7ee3f999b70ad5afab99d4849019c2f29e /apps/calendar
parenteef9a1e7ed63a3d6506afd0dbf84d16fbf8c1064 (diff)
fix bugs in share lib of calendar
Diffstat (limited to 'apps/calendar')
-rw-r--r--apps/calendar/lib/share.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php
index 3e03a2d7ccf..b4abcc08dd9 100644
--- a/apps/calendar/lib/share.php
+++ b/apps/calendar/lib/share.php
@@ -20,7 +20,11 @@ class OC_Calendar_Share{
public static function allSharedwithuser($userid, $type, $active=null, $permission=null){
$group_where = self::group_sql(OC_Group::getUserGroups($userid));
$permission_where = self::permission_sql($permission);
- $active_where = self::active_sql($active);
+ if($type == self::CALENDAR){
+ $active_where = self::active_sql($active);
+ }else{
+ $active_where = '';
+ }
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = "user") ' . $group_where . ') AND owner <> ? ' . $permission_where . ' ' . $active_where);
$result = $stmt->execute(array($userid, $userid));
$return = array();
@@ -66,7 +70,7 @@ class OC_Calendar_Share{
return false;
}
if($sharetype == 'public'){
- $share = self::generate_token();
+ $share = self::generate_token($id, $type);
}
$stmt = OC_DB::prepare('INSERT INTO *PREFIX*calendar_share_' . $type . ' (owner,share,sharetype,' . $type . 'id,permissions' . (($type == self::CALENDAR)?', active':'') . ') VALUES(?,?,?,?,0' . (($type == self::CALENDAR)?', 1':'') . ')' );
$result = $stmt->execute(array($owner,$share,$sharetype,$id));
@@ -193,8 +197,8 @@ class OC_Calendar_Share{
return true;
}
if($type == self::EVENT){
- $calendar == OC_Calendar_App::getCalendar($id);
- return self::is_editing_allowed($share, $calendar['id'], self::CALENDAR);
+ $event = OC_Calendar_App::getEventObject($id, false, false);
+ return self::is_editing_allowed($share, $event['calendarid'], self::CALENDAR);
}
return false;
}
@@ -213,8 +217,8 @@ class OC_Calendar_Share{
return true;
}
if($type == self::EVENT){
- $calendar == OC_Calendar_App::getCalendar($id);
- return self::check_access($share, $calendar['id'], self::CALENDAR);
+ $event = OC_Calendar_App::getEventObject($id, false, false);
+ return self::is_editing_allowed($share, $event['calendarid'], self::CALENDAR);
}
return false;
}