From 9e50cecf2750270e5c60a2c3fbdad5f95cdeee39 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sat, 17 Dec 2011 21:12:36 -0500 Subject: [PATCH 1/8] Fix shared status for files inside a shared folder --- apps/files_sharing/ajax/getitem.php | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php index d9df4abe98..51fda6aed4 100644 --- a/apps/files_sharing/ajax/getitem.php +++ b/apps/files_sharing/ajax/getitem.php @@ -19,6 +19,7 @@ $source = dirname($source); while ($source != "" && $source != "/" && $source != "." && $source != $userDirectory) { if ($values = OC_Share::getMySharedItem($source)) { $values = array_values($values); + $users = array(); $parentUsers = array(); for ($i = 0; $i < count($values); $i++) { if ($values[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) { From 3d1accab701730fbd2b0cb89cb8c727301f5d756 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 18 Dec 2011 03:45:13 +0100 Subject: [PATCH 2/8] add licence file for sabredav --- 3rdparty/Sabre/LICENCE | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 3rdparty/Sabre/LICENCE diff --git a/3rdparty/Sabre/LICENCE b/3rdparty/Sabre/LICENCE new file mode 100644 index 0000000000..3d07eaace8 --- /dev/null +++ b/3rdparty/Sabre/LICENCE @@ -0,0 +1,27 @@ +Copyright (C) 2007-2011 Rooftop Solutions. +Copyright (C) 2007-2009 FileMobile inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the SabreDAV nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. From 4eb36b0ecf40266ceb2abf0f5bc17dad4bde6951 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sun, 18 Dec 2011 22:58:20 +0100 Subject: [PATCH 3/8] Calendar: refactor common ajax functions to OC_Calendar_App --- apps/calendar/ajax/activation.php | 3 +- apps/calendar/ajax/createcalendar.php | 5 +- apps/calendar/ajax/deletecalendar.php | 8 +-- apps/calendar/ajax/deleteevent.php | 12 +--- apps/calendar/ajax/editcalendar.php | 4 +- apps/calendar/ajax/editevent.php | 23 +------- apps/calendar/ajax/editeventform.php | 18 ++---- apps/calendar/ajax/moveevent.php | 26 +++------ apps/calendar/ajax/neweventform.php | 6 +- apps/calendar/ajax/resizeevent.php | 35 +++--------- apps/calendar/ajax/updatecalendar.php | 6 +- apps/calendar/appinfo/app.php | 3 +- apps/calendar/export.php | 14 +---- apps/calendar/import.php | 8 +-- apps/calendar/lib/app.php | 82 +++++++++++++++++++++++++++ apps/calendar/lib/calendar.php | 4 +- apps/calendar/lib/object.php | 2 +- 17 files changed, 131 insertions(+), 128 deletions(-) create mode 100644 apps/calendar/lib/app.php diff --git a/apps/calendar/ajax/activation.php b/apps/calendar/ajax/activation.php index 72882496ab..3c2bc6de23 100644 --- a/apps/calendar/ajax/activation.php +++ b/apps/calendar/ajax/activation.php @@ -12,8 +12,9 @@ if(!OC_USER::isLoggedIn()) { } OC_JSON::checkAppEnabled('calendar'); $calendarid = $_POST['calendarid']; +$calendar = OC_Calendar_App::getCalendar($calendarid);//access check OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']); -$calendar = OC_Calendar_Calendar::findCalendar($calendarid); +$calendar = OC_Calendar_App::getCalendar($calendarid); OC_JSON::success(array( 'active' => $calendar['active'], 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar), diff --git a/apps/calendar/ajax/createcalendar.php b/apps/calendar/ajax/createcalendar.php index 325a5ec35b..f8b5974f54 100644 --- a/apps/calendar/ajax/createcalendar.php +++ b/apps/calendar/ajax/createcalendar.php @@ -8,8 +8,6 @@ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('calendar'); - // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); @@ -17,7 +15,8 @@ OC_JSON::checkAppEnabled('calendar'); $userid = OC_User::getUser(); $calendarid = OC_Calendar_Calendar::addCalendar($userid, $_POST['name'], 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']); OC_Calendar_Calendar::setCalendarActive($calendarid, 1); -$calendar = OC_Calendar_Calendar::findCalendar($calendarid); + +$calendar = OC_Calendar_Calendar::find($calendarid); $tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields'); $tmpl->assign('calendar', $calendar); OC_JSON::success(array( diff --git a/apps/calendar/ajax/deletecalendar.php b/apps/calendar/ajax/deletecalendar.php index e8ffe0d059..fc308da6da 100644 --- a/apps/calendar/ajax/deletecalendar.php +++ b/apps/calendar/ajax/deletecalendar.php @@ -7,19 +7,13 @@ */ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('calendar'); - if(!OC_USER::isLoggedIn()) { die(''); } OC_JSON::checkAppEnabled('calendar'); $cal = $_POST["calendarid"]; -$calendar = OC_Calendar_Calendar::findCalendar($cal); -if($calendar["userid"] != OC_User::getUser()){ - OC_JSON::error(array('error'=>'permission_denied')); - exit; -} +$calendar = OC_Calendar_App::getCalendar($cal); $del = OC_Calendar_Calendar::deleteCalendar($cal); if($del == true){ OC_JSON::success(); diff --git a/apps/calendar/ajax/deleteevent.php b/apps/calendar/ajax/deleteevent.php index 9e3c7dd87d..269f4a47f4 100644 --- a/apps/calendar/ajax/deleteevent.php +++ b/apps/calendar/ajax/deleteevent.php @@ -15,17 +15,7 @@ if(!OC_USER::isLoggedIn()) { OC_JSON::checkAppEnabled('calendar'); $id = $_POST['id']; -$data = OC_Calendar_Object::find($id); -if (!$data) -{ - OC_JSON::error(); - exit; -} -$calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']); -if($calendar['userid'] != OC_User::getUser()){ - OC_JSON::error(); - exit; -} +$event_object = OC_Calendar_App::getEventObject($id); $result = OC_Calendar_Object::delete($id); OC_JSON::success(); ?> diff --git a/apps/calendar/ajax/editcalendar.php b/apps/calendar/ajax/editcalendar.php index d23e528786..e44763c9aa 100644 --- a/apps/calendar/ajax/editcalendar.php +++ b/apps/calendar/ajax/editcalendar.php @@ -7,13 +7,13 @@ */ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('calendar'); if(!OC_USER::isLoggedIn()) { die(""); } OC_JSON::checkAppEnabled('calendar'); + $calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions(); -$calendar = OC_Calendar_Calendar::findCalendar($_GET['calendarid']); +$calendar = OC_Calendar_App::getCalendar($_GET['calendarid']); $tmpl = new OC_Template("calendar", "part.editcalendar"); $tmpl->assign('new', false); $tmpl->assign('calendarcolor_options', $calendarcolor_options); diff --git a/apps/calendar/ajax/editevent.php b/apps/calendar/ajax/editevent.php index e3c8452048..f00ab1d960 100644 --- a/apps/calendar/ajax/editevent.php +++ b/apps/calendar/ajax/editevent.php @@ -7,9 +7,6 @@ */ require_once('../../../lib/base.php'); - -$l10n = new OC_L10N('calendar'); - if(!OC_USER::isLoggedIn()) { die(''); } @@ -23,26 +20,12 @@ if($errarr){ }else{ $id = $_POST['id']; $cal = $_POST['calendar']; - $data = OC_Calendar_Object::find($id); - if (!$data) - { - OC_JSON::error(); - exit; - } - $calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']); - if($calendar['userid'] != OC_User::getUser()){ - OC_JSON::error(); - exit; - } + $data = OC_Calendar_App::getEventObject($id); $vcalendar = OC_VObject::parse($data['calendardata']); - $last_modified = $vcalendar->VEVENT->__get('LAST-MODIFIED'); - if($last_modified && $_POST['lastmodified'] != $last_modified->getDateTime()->format('U')){ - OC_JSON::error(array('modified'=>true)); - exit; - } - + OC_Calendar_App::isNotModified($vcalendar->VEVENT, $_POST['lastmodified']); OC_Calendar_Object::updateVCalendarFromRequest($_POST, $vcalendar); + $result = OC_Calendar_Object::edit($id, $vcalendar->serialize()); if ($data['calendarid'] != $cal) { OC_Calendar_Object::moveToCalendar($id, $cal); diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/editeventform.php index c91f136e89..fe6c6f7357 100644 --- a/apps/calendar/ajax/editeventform.php +++ b/apps/calendar/ajax/editeventform.php @@ -8,26 +8,16 @@ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('calendar'); - if(!OC_USER::isLoggedIn()) { die(''); } OC_JSON::checkAppEnabled('calendar'); -$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); -$category_options = OC_Calendar_Object::getCategoryOptions($l10n); -$repeat_options = OC_Calendar_Object::getRepeatOptions($l10n); - $id = $_GET['id']; -$data = OC_Calendar_Object::find($id); -$calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']); -if($calendar['userid'] != OC_User::getUser()){ - echo $l10n->t('Wrong calendar'); - exit; -} +$data = OC_Calendar_App::getEventObject($id); $object = OC_VObject::parse($data['calendardata']); $vevent = $object->VEVENT; + $dtstart = $vevent->DTSTART; $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); switch($dtstart->getDateType()) { @@ -66,6 +56,10 @@ if ($last_modified){ $lastmodified = 0; } +$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); +$category_options = OC_Calendar_App::getCategoryOptions(); +$repeat_options = OC_Calendar_App::getRepeatOptions(); + $tmpl = new OC_Template('calendar', 'part.editevent'); $tmpl->assign('id', $id); $tmpl->assign('lastmodified', $lastmodified); diff --git a/apps/calendar/ajax/moveevent.php b/apps/calendar/ajax/moveevent.php index 51fafdfeb9..f2256d4eee 100644 --- a/apps/calendar/ajax/moveevent.php +++ b/apps/calendar/ajax/moveevent.php @@ -5,31 +5,20 @@ * later. * See the COPYING-README file. */ -error_reporting(E_ALL); require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); -$data = OC_Calendar_Object::find($_POST["id"]); -$calendarid = $data["calendarid"]; -$cal = $calendarid; + $id = $_POST['id']; -$calendar = OC_Calendar_Calendar::findCalendar($calendarid); -if(OC_User::getUser() != $calendar['userid']){ - OC_JSON::error(); - exit; -} + +$vcalendar = OC_Calendar_App::getVCalendar($id); +$vevent = $vcalendar->VEVENT; + $allday = $_POST['allDay']; $delta = new DateInterval('P0D'); $delta->d = $_POST['dayDelta']; $delta->i = $_POST['minuteDelta']; -$vcalendar = OC_VObject::parse($data['calendardata']); -$vevent = $vcalendar->VEVENT; - -$last_modified = $vevent->__get('LAST-MODIFIED'); -if($last_modified && $_POST['lastmodified'] != $last_modified->getDateTime()->format('U')){ - OC_JSON::error(); - exit; -} +OC_Calendar_App::isNotModified($vevent, $_POST['lastmodified']); $dtstart = $vevent->DTSTART; $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); @@ -50,4 +39,5 @@ $vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Element_DateTime::UTC $vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Element_DateTime::UTC); $result = OC_Calendar_Object::edit($id, $vcalendar->serialize()); -OC_JSON::success(array('lastmodified'=>(int)$now->format('U'))); +$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime(); +OC_JSON::success(array('lastmodified'=>(int)$lastmodified->format('U'))); diff --git a/apps/calendar/ajax/neweventform.php b/apps/calendar/ajax/neweventform.php index 68423adb34..e12e99219e 100644 --- a/apps/calendar/ajax/neweventform.php +++ b/apps/calendar/ajax/neweventform.php @@ -8,8 +8,6 @@ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('calendar'); - if(!OC_USER::isLoggedIn()) { die(''); } @@ -34,8 +32,8 @@ $start->setTimezone(new DateTimeZone($timezone)); $end->setTimezone(new DateTimeZone($timezone)); $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); -$category_options = OC_Calendar_Object::getCategoryOptions($l10n); -$repeat_options = OC_Calendar_Object::getRepeatOptions($l10n); +$category_options = OC_Calendar_App::getCategoryOptions(); +$repeat_options = OC_Calendar_App::getRepeatOptions(); $tmpl = new OC_Template('calendar', 'part.newevent'); $tmpl->assign('calendar_options', $calendar_options); diff --git a/apps/calendar/ajax/resizeevent.php b/apps/calendar/ajax/resizeevent.php index 28a185411e..6834790652 100644 --- a/apps/calendar/ajax/resizeevent.php +++ b/apps/calendar/ajax/resizeevent.php @@ -5,45 +5,28 @@ * later. * See the COPYING-README file. */ -error_reporting(E_ALL); require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); -$data = OC_Calendar_Object::find($_POST["id"]); -$calendarid = $data["calendarid"]; -$cal = $calendarid; + $id = $_POST['id']; -$calendar = OC_Calendar_Calendar::findCalendar($calendarid); -if(OC_User::getUser() != $calendar['userid']){ - OC_JSON::error(); - exit; -} + +$vcalendar = OC_Calendar_App::getVCalendar($id); +$vevent = $vcalendar->VEVENT; $delta = new DateInterval('P0D'); $delta->d = $_POST['dayDelta']; $delta->i = $_POST['minuteDelta']; -$vcalendar = OC_Calendar_Object::parse($data['calendardata']); -$vevent = $vcalendar->VEVENT; - -$last_modified = $vevent->__get('LAST-MODIFIED'); -if($last_modified && $_POST['lastmodified'] != $last_modified->getDateTime()->format('U')){ - OC_JSON::error(); - exit; -} +OC_Calendar_App::isNotModified($vevent, $_POST['lastmodified']); $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); $end_type = $dtend->getDateType(); $dtend->setDateTime($dtend->getDateTime()->add($delta), $end_type); unset($vevent->DURATION); -$now = new DateTime(); -$last_modified = new Sabre_VObject_Element_DateTime('LAST-MODIFIED'); -$last_modified->setDateTime($now, Sabre_VObject_Element_DateTime::UTC); -$vevent->__set('LAST-MODIFIED', $last_modified); - -$dtstamp = new Sabre_VObject_Element_DateTime('DTSTAMP'); -$dtstamp->setDateTime($now, Sabre_VObject_Element_DateTime::UTC); -$vevent->DTSTAMP = $dtstamp; +$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Element_DateTime::UTC); +$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Element_DateTime::UTC); $result = OC_Calendar_Object::edit($id, $vcalendar->serialize()); -OC_JSON::success(array('lastmodified'=>$now->format('U'))); +$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime(); +OC_JSON::success(array('lastmodified'=>(int)$lastmodified->format('U'))); diff --git a/apps/calendar/ajax/updatecalendar.php b/apps/calendar/ajax/updatecalendar.php index e99ca16e22..14f560da5a 100644 --- a/apps/calendar/ajax/updatecalendar.php +++ b/apps/calendar/ajax/updatecalendar.php @@ -8,16 +8,16 @@ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('calendar'); - // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $calendarid = $_POST['id']; +$calendar = OC_Calendar_App::getCalendar($calendarid);//access check OC_Calendar_Calendar::editCalendar($calendarid, $_POST['name'], null, null, null, $_POST['color']); OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']); -$calendar = OC_Calendar_Calendar::findCalendar($calendarid); + +$calendar = OC_Calendar_App::getCalendar($calendarid); $tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields'); $tmpl->assign('calendar', $calendar); OC_JSON::success(array( diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 5675e624dd..ee990723c0 100644 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -1,5 +1,6 @@ \ No newline at end of file +?> diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php new file mode 100644 index 0000000000..b023d531aa --- /dev/null +++ b/apps/calendar/lib/app.php @@ -0,0 +1,82 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +/** + * This class manages our app actions + */ +OC_Calendar_App::$l10n = new OC_L10N('calendar'); +class OC_Calendar_App{ + public static $l10n; + + public static function getCalendar($id){ + $calendar = OC_Calendar_Calendar::find( $id ); + if( $calendar === false || $calendar['userid'] != OC_User::getUser()){ + OC_JSON::error(array('data' => array('message' => self::$l10n->t('Wrong calendar')))); + exit(); + } + return $calendar; + } + + public static function getEventObject($id){ + $event_object = OC_Calendar_Object::find( $id ); + if( $event_object === false ){ + OC_JSON::error(); + exit(); + } + + self::getCalendar( $event_object['calendarid'] );//access check + return $event_object; + } + + public static function getVCalendar($id){ + $event_object = self::getEventObject( $id ); + + $vcalendar = OC_VObject::parse($event_object['calendardata']); + // Check if the vcalendar is valid + if(is_null($vcalendar)){ + OC_JSON::error(); + exit(); + } + return $vcalendar; + } + + public static function isNotModified($vevent, $lastmodified) + { + $last_modified = $vevent->__get('LAST-MODIFIED'); + if($last_modified && $lastmodified != $last_modified->getDateTime()->format('U')){ + OC_JSON::error(array('modified'=>true)); + exit; + } + } + + public static function getCategoryOptions() + { + return array( + self::$l10n->t('Birthday'), + self::$l10n->t('Business'), + self::$l10n->t('Call'), + self::$l10n->t('Clients'), + self::$l10n->t('Deliverer'), + self::$l10n->t('Holidays'), + self::$l10n->t('Ideas'), + self::$l10n->t('Journey'), + self::$l10n->t('Jubilee'), + self::$l10n->t('Meeting'), + self::$l10n->t('Other'), + self::$l10n->t('Personal'), + self::$l10n->t('Projects'), + self::$l10n->t('Questions'), + self::$l10n->t('Work'), + ); + } + + public static function getRepeatOptions() + { + OC_Calendar_Object::getRepeatOptions(self::$l10n); + } +} diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php index 3db4398096..ea60526a5b 100644 --- a/apps/calendar/lib/calendar.php +++ b/apps/calendar/lib/calendar.php @@ -82,7 +82,7 @@ class OC_Calendar_Calendar{ * @param integer $id * @return associative array */ - public static function findCalendar($id){ + public static function find($id){ $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_calendars WHERE id = ?' ); $result = $stmt->execute(array($id)); @@ -148,7 +148,7 @@ class OC_Calendar_Calendar{ */ public static function editCalendar($id,$name=null,$components=null,$timezone=null,$order=null,$color=null){ // Need these ones for checking uri - $calendar = self::findCalendar($id); + $calendar = self::find($id); // Keep old stuff if(is_null($name)) $name = $calendar['name']; diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 1c14500351..58fe60611c 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -367,7 +367,7 @@ class OC_Calendar_Object{ $errarr['title'] = 'true'; $errnum++; } - $calendar = OC_Calendar_Calendar::findCalendar($request['calendar']); + $calendar = OC_Calendar_Calendar::find($request['calendar']); if($calendar['userid'] != OC_User::getUser()){ $errarr['cal'] = 'true'; $errnum++; From ff346ad1352ba5f99e409e2e1efca8a3e356af31 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sun, 18 Dec 2011 23:01:45 +0100 Subject: [PATCH 4/8] Calendar: small for loop fix --- apps/calendar/export.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/calendar/export.php b/apps/calendar/export.php index 5fbd2533ab..9b3ea5005d 100644 --- a/apps/calendar/export.php +++ b/apps/calendar/export.php @@ -16,8 +16,8 @@ if(isset($cal)){ $calobjects = OC_Calendar_Object::all($cal); header("Content-Type: text/Calendar"); header("Content-Disposition: inline; filename=calendar.ics"); - for($i = 0;$i <= count($calobjects); $i++){ - echo $calobjects[$i]["calendardata"] . "\n"; + foreach($calobjects as $calobject){ + echo $calobject["calendardata"] . "\n"; } }elseif(isset($event)){ $data = OC_Calendar_App::getEventObject($_GET["eventid"]); From dff9585f64e2723eaf2d088d9e946fe1d649ccd8 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sun, 18 Dec 2011 23:04:45 +0100 Subject: [PATCH 5/8] Contacts: add missing property_options template var --- apps/contacts/index.php | 2 ++ apps/contacts/lib/app.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/contacts/index.php b/apps/contacts/index.php index de7b56dd1a..58ddc74f53 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -74,11 +74,13 @@ if( !is_null($id)/* || count($contacts)*/){ $details = OC_Contacts_VCard::structureContact($vcard); } +$property_types = OC_Contacts_App::getAddPropertyOptions(); $adr_types = OC_Contacts_App::getTypesOfProperty('ADR'); $phone_types = OC_Contacts_App::getTypesOfProperty('TEL'); // Process the template $tmpl = new OC_Template( 'contacts', 'index', 'user' ); +$tmpl->assign('property_types',$property_types); $tmpl->assign('adr_types',$adr_types); $tmpl->assign('phone_types',$phone_types); $tmpl->assign('addressbooks', $addressbooks); diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php index ba086e4aca..79e00920a6 100644 --- a/apps/contacts/lib/app.php +++ b/apps/contacts/lib/app.php @@ -38,7 +38,7 @@ class OC_Contacts_App{ public static function getAddressbook($id){ $addressbook = OC_Contacts_Addressbook::find( $id ); - if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + if( $addressbook === false || $addressbook['userid'] != OC_User::getUser()){ OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.')))); // Same here (as with the contact error). Could this error be improved? exit(); } From fbad1da9e2cea507d7a69a0d3291268b8e76b2c2 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sun, 18 Dec 2011 23:05:36 +0100 Subject: [PATCH 6/8] Contacts: check if PREF parameter is set before useing it --- apps/contacts/templates/part.property.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php index 6264f29674..d930a9ca99 100644 --- a/apps/contacts/templates/part.property.php +++ b/apps/contacts/templates/part.property.php @@ -20,7 +20,7 @@

-

t('Preferred').' ' : '' ?>t('Phone'); ?>

+

t('Preferred').' ' : '' ?>t('Phone'); ?>

From d5e9c7d5724d30b659119e11f567492d30f0581c Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sun, 18 Dec 2011 23:06:54 +0100 Subject: [PATCH 7/8] Gallery: fix calculation of folder thumbnail selection --- apps/gallery/js/albums.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/gallery/js/albums.js b/apps/gallery/js/albums.js index 7ab243eded..fb091698a7 100644 --- a/apps/gallery/js/albums.js +++ b/apps/gallery/js/albums.js @@ -69,7 +69,7 @@ Albums={ if (albumMetadata == undefined) { return; } - var x = Math.min(Math.floor((e.clientX - this.offsetLeft)/(this.offsetWidth/albumMetadata.numOfCovers)), albumMetadata.numOfCovers-1); + var x = Math.min(Math.floor((e.layerX - this.offsetLeft)/(this.offsetWidth/albumMetadata.numOfCovers)), albumMetadata.numOfCovers-1); x *= this.offsetWidth; $(this).css('background-position', -x+'px 0'); }); From e1b9b65e4159bdd6e0ed81c8cd6b588f03b3a018 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sun, 18 Dec 2011 23:08:00 +0100 Subject: [PATCH 8/8] Use correct appid for lostpassword email preference --- core/lostpassword/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/lostpassword/index.php b/core/lostpassword/index.php index de0d393ec7..ede94dab2d 100644 --- a/core/lostpassword/index.php +++ b/core/lostpassword/index.php @@ -14,7 +14,7 @@ if (isset($_POST['user'])) { if (OC_User::userExists($_POST['user'])) { $token = sha1($_POST['user']+uniqId()); OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token); - $email = OC_Preferences::getValue($_POST['user'], 'lostpassword', 'email', ''); + $email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', ''); if (!empty($email)) { $link = OC_Helper::linkTo('core/lostpassword', 'resetpassword.php', null, true).'?user='.$_POST['user'].'&token='.$token; $tmpl = new OC_Template('core/lostpassword', 'email');