summaryrefslogtreecommitdiffstats
path: root/apps/calendar/lib
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-03-31 16:12:27 -0400
committerGeorg Ehrke <dev@georgswebsite.de>2012-03-31 16:12:27 -0400
commit10fc51dc925ab4655c8efb11cf476b021f67078e (patch)
tree89bdfd13269b68337286c2df090cb0707cba05f9 /apps/calendar/lib
parentcf26f8a6a7751bd32eeb449ef39b743248ae3d1a (diff)
downloadnextcloud-server-10fc51dc925ab4655c8efb11cf476b021f67078e.tar.gz
nextcloud-server-10fc51dc925ab4655c8efb11cf476b021f67078e.zip
add public sharing fir calendars and events - add function in Share class
Diffstat (limited to 'apps/calendar/lib')
-rw-r--r--apps/calendar/lib/share.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php
index 42dfc8a3101..3e03a2d7ccf 100644
--- a/apps/calendar/lib/share.php
+++ b/apps/calendar/lib/share.php
@@ -218,4 +218,27 @@ class OC_Calendar_Share{
}
return false;
}
+ /*
+ * @brief: returns the calendardata of an event or a calendar
+ * @param: (string) $token - token which should be searched
+ * @return: mixed - bool if false, array with type and id if true
+ */
+ public static function getElementByToken($token){
+ $stmt_calendar = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . OC_Calendar_Share::CALENDAR . ' WHERE sharetype = "public" AND share = ?');
+ $result_calendar = $stmt_calendar->execute(array($token));
+ $stmt_event = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . OC_Calendar_Share::EVENT . ' WHERE sharetype = "public" AND share = ?');
+ $result_event = $stmt_calendar->execute(array($token));
+ $return = array();
+ if($result_calendar->numRows() == 0 && $result_event->numRows() == 0){
+ return false;
+ }elseif($result_calendar->numRows() != 0){
+ $return ['type'] = 'calendar';
+ $calendar = $result_calendar->fetchRow();
+ $return ['id'] = $calendar['calendarid'];
+ }else{
+ $return ['type'] = 'event';
+ $event = $result_event->fetchRow();
+ $return ['id'] = $event['eventid'];
+ }
+ }
} \ No newline at end of file