summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-07-18 00:04:17 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-07-18 00:04:17 +0200
commitf0c82686fdd8fb033ccd2aa034ce61e33cc8a70b (patch)
tree479b5fa47b9470216e77de686b8d400693ca0dcf
parent4700222ea91a20fad40c5c6dfb50ab2f943731cc (diff)
parentec4891b7d3a57b92cd833d6cbd1109ba1c45376e (diff)
downloadnextcloud-server-f0c82686fdd8fb033ccd2aa034ce61e33cc8a70b.tar.gz
nextcloud-server-f0c82686fdd8fb033ccd2aa034ce61e33cc8a70b.zip
Merge branch 'master' into subadmin
-rw-r--r--apps/calendar/ajax/calendar/activation.php2
-rw-r--r--apps/calendar/ajax/calendar/delete.php1
-rw-r--r--apps/calendar/ajax/calendar/new.php3
-rw-r--r--apps/calendar/ajax/calendar/update.php1
-rw-r--r--apps/calendar/ajax/categories/rescan.php1
-rw-r--r--apps/calendar/ajax/event/delete.php1
-rw-r--r--apps/calendar/ajax/event/edit.php1
-rw-r--r--apps/calendar/ajax/event/move.php1
-rw-r--r--apps/calendar/ajax/event/new.php1
-rw-r--r--apps/calendar/ajax/event/resize.php1
-rw-r--r--apps/calendar/ajax/import/import.php1
-rw-r--r--apps/calendar/ajax/settings/setfirstday.php1
-rw-r--r--apps/calendar/ajax/settings/settimeformat.php1
-rw-r--r--apps/calendar/ajax/settings/settimezone.php1
-rw-r--r--apps/calendar/appinfo/app.php1
-rw-r--r--apps/calendar/lib/hooks.php13
-rw-r--r--apps/calendar/templates/calendar.php8
-rw-r--r--apps/contacts/ajax/categories/delete.php3
-rw-r--r--apps/contacts/ajax/categories/rescan.php1
-rw-r--r--apps/contacts/ajax/contactdetails.php3
-rw-r--r--apps/contacts/ajax/saveproperty.php11
-rw-r--r--apps/contacts/appinfo/update.php2
-rw-r--r--apps/contacts/css/contacts.css2
-rw-r--r--apps/contacts/import.php5
-rw-r--r--apps/contacts/js/contacts.js147
-rw-r--r--apps/contacts/lib/hooks.php6
-rw-r--r--apps/contacts/lib/vcard.php2
-rw-r--r--apps/files_sharing_log/appinfo/database.xml2
-rw-r--r--apps/files_versions/ajax/expireAll.php1
-rw-r--r--apps/files_versions/ajax/rollbackVersion.php1
-rw-r--r--apps/files_versions/ajax/togglesettings.php1
-rw-r--r--apps/remoteStorage/appinfo/info.xml3
-rw-r--r--apps/remoteStorage/appinfo/version2
-rw-r--r--apps/remoteStorage/appinfo/webfinger.php6
-rw-r--r--apps/remoteStorage/oauth_ro_auth.php20
-rw-r--r--apps/remoteStorage/webdav.php (renamed from apps/remoteStorage/WebDAV.php)36
-rw-r--r--apps/tasks/ajax/addtask.php1
-rw-r--r--apps/tasks/ajax/delete.php1
-rw-r--r--apps/tasks/ajax/edittask.php1
-rw-r--r--apps/tasks/ajax/update_property.php1
-rw-r--r--apps/user_webfinger/.htaccess5
-rw-r--r--apps/user_webfinger/host-meta.php19
-rwxr-xr-xautotest.sh95
-rw-r--r--lib/connector/sabre/auth.php17
-rw-r--r--lib/connector/sabre/file.php2
-rw-r--r--lib/l10n.php7
-rw-r--r--lib/user.php2
-rw-r--r--tests/index.php10
48 files changed, 292 insertions, 162 deletions
diff --git a/apps/calendar/ajax/calendar/activation.php b/apps/calendar/ajax/calendar/activation.php
index e31908beb14..f4aadc5b017 100644
--- a/apps/calendar/ajax/calendar/activation.php
+++ b/apps/calendar/ajax/calendar/activation.php
@@ -9,6 +9,8 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
+
$calendarid = $_POST['calendarid'];
$calendar = OC_Calendar_App::getCalendar($calendarid, true);
if(!$calendar){
diff --git a/apps/calendar/ajax/calendar/delete.php b/apps/calendar/ajax/calendar/delete.php
index 4d6706f6002..089255cae39 100644
--- a/apps/calendar/ajax/calendar/delete.php
+++ b/apps/calendar/ajax/calendar/delete.php
@@ -9,6 +9,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
$cal = $_POST["calendarid"];
$calendar = OC_Calendar_App::getCalendar($cal, true);
diff --git a/apps/calendar/ajax/calendar/new.php b/apps/calendar/ajax/calendar/new.php
index e77d4ebff03..67d12822378 100644
--- a/apps/calendar/ajax/calendar/new.php
+++ b/apps/calendar/ajax/calendar/new.php
@@ -6,11 +6,10 @@
* See the COPYING-README file.
*/
-
-
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
if(trim($_POST['name']) == ''){
OCP\JSON::error(array('message'=>'empty'));
diff --git a/apps/calendar/ajax/calendar/update.php b/apps/calendar/ajax/calendar/update.php
index a2c898c8075..c09b1008c9c 100644
--- a/apps/calendar/ajax/calendar/update.php
+++ b/apps/calendar/ajax/calendar/update.php
@@ -11,6 +11,7 @@
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
if(trim($_POST['name']) == ''){
OCP\JSON::error(array('message'=>'empty'));
diff --git a/apps/calendar/ajax/categories/rescan.php b/apps/calendar/ajax/categories/rescan.php
index f0060cb23b2..08c32865b6f 100644
--- a/apps/calendar/ajax/categories/rescan.php
+++ b/apps/calendar/ajax/categories/rescan.php
@@ -9,6 +9,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
foreach ($_POST as $key=>$element) {
debug('_POST: '.$key.'=>'.print_r($element, true));
diff --git a/apps/calendar/ajax/event/delete.php b/apps/calendar/ajax/event/delete.php
index f183d431afa..17e45c001e8 100644
--- a/apps/calendar/ajax/event/delete.php
+++ b/apps/calendar/ajax/event/delete.php
@@ -9,6 +9,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
$id = $_POST['id'];
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
diff --git a/apps/calendar/ajax/event/edit.php b/apps/calendar/ajax/event/edit.php
index 1c3babc3d90..db78bf6e5e0 100644
--- a/apps/calendar/ajax/event/edit.php
+++ b/apps/calendar/ajax/event/edit.php
@@ -9,6 +9,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
$id = $_POST['id'];
diff --git a/apps/calendar/ajax/event/move.php b/apps/calendar/ajax/event/move.php
index 04cf2fb0513..f4e2b36376d 100644
--- a/apps/calendar/ajax/event/move.php
+++ b/apps/calendar/ajax/event/move.php
@@ -7,6 +7,7 @@
*/
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
$id = $_POST['id'];
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
diff --git a/apps/calendar/ajax/event/new.php b/apps/calendar/ajax/event/new.php
index 30e2b0cae36..bc0439cc315 100644
--- a/apps/calendar/ajax/event/new.php
+++ b/apps/calendar/ajax/event/new.php
@@ -10,6 +10,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
$errarr = OC_Calendar_Object::validateRequest($_POST);
if($errarr){
diff --git a/apps/calendar/ajax/event/resize.php b/apps/calendar/ajax/event/resize.php
index 56b83205e85..15b687b55da 100644
--- a/apps/calendar/ajax/event/resize.php
+++ b/apps/calendar/ajax/event/resize.php
@@ -7,6 +7,7 @@
*/
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
$id = $_POST['id'];
diff --git a/apps/calendar/ajax/import/import.php b/apps/calendar/ajax/import/import.php
index 1facedfe0da..38008af4a9d 100644
--- a/apps/calendar/ajax/import/import.php
+++ b/apps/calendar/ajax/import/import.php
@@ -10,6 +10,7 @@ ob_start();
OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
session_write_close();
$nl="\r\n";
diff --git a/apps/calendar/ajax/settings/setfirstday.php b/apps/calendar/ajax/settings/setfirstday.php
index 056a6037524..73cf0c19b78 100644
--- a/apps/calendar/ajax/settings/setfirstday.php
+++ b/apps/calendar/ajax/settings/setfirstday.php
@@ -7,6 +7,7 @@
*/
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
if(isset($_POST["firstday"])){
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'firstday', $_POST["firstday"]);
OCP\JSON::success();
diff --git a/apps/calendar/ajax/settings/settimeformat.php b/apps/calendar/ajax/settings/settimeformat.php
index 8e95f6f3bf5..6136857e2fe 100644
--- a/apps/calendar/ajax/settings/settimeformat.php
+++ b/apps/calendar/ajax/settings/settimeformat.php
@@ -7,6 +7,7 @@
*/
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
if(isset($_POST["timeformat"])){
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
OCP\JSON::success();
diff --git a/apps/calendar/ajax/settings/settimezone.php b/apps/calendar/ajax/settings/settimezone.php
index 6d029a6643a..06db66d578e 100644
--- a/apps/calendar/ajax/settings/settimezone.php
+++ b/apps/calendar/ajax/settings/settimezone.php
@@ -14,6 +14,7 @@ $l=OC_L10N::get('calendar');
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
// Get data
if( isset( $_POST['timezone'] ) ){
diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php
index 3c8cc76133e..c8fccc326c3 100644
--- a/apps/calendar/appinfo/app.php
+++ b/apps/calendar/appinfo/app.php
@@ -10,6 +10,7 @@ OC::$CLASSPATH['OC_Calendar_Share'] = 'apps/calendar/lib/share.php';
OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php';
OC::$CLASSPATH['OC_Calendar_Export'] = 'apps/calendar/lib/export.php';
//General Hooks
+OCP\Util::connectHook('OC_User', 'post_createUser', 'OC_Calendar_Hooks', 'createUser');
OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser');
//Repeating Events Hooks
OCP\Util::connectHook('OC_Calendar', 'addEvent', 'OC_Calendar_Repeat', 'generate');
diff --git a/apps/calendar/lib/hooks.php b/apps/calendar/lib/hooks.php
index 328d2951d23..bc0b02c62b8 100644
--- a/apps/calendar/lib/hooks.php
+++ b/apps/calendar/lib/hooks.php
@@ -11,7 +11,18 @@
*/
class OC_Calendar_Hooks{
/**
- * @brief Deletes all Addressbooks of a certain user
+ * @brief Creates default calendar for a user
+ * @param paramters parameters from postCreateUser-Hook
+ * @return array
+ */
+ public static function createUser($parameters) {
+ OC_Calendar_Calendar::addCalendar($parameters['uid'],'Default calendar');
+
+ return true;
+ }
+
+ /**
+ * @brief Deletes all calendars of a certain user
* @param paramters parameters from postDeleteUser-Hook
* @return array
*/
diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php
index 2246a0178e3..29b9bf6bc54 100644
--- a/apps/calendar/templates/calendar.php
+++ b/apps/calendar/templates/calendar.php
@@ -2,10 +2,10 @@
var defaultView = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') ?>';
var eventSources = <?php echo json_encode($_['eventSources']) ?>;
var categories = <?php echo json_encode($_['categories']); ?>;
- var dayNames = <?php echo json_encode($l->tA(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'))) ?>;
- var dayNamesShort = <?php echo json_encode($l->tA(array('Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'))) ?>;
- var monthNames = <?php echo json_encode($l->tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>;
- var monthNamesShort = <?php echo json_encode($l->tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>;
+ var dayNames = new Array("<?php echo $l -> t("Sunday");?>", "<?php echo $l -> t("Monday");?>", "<?php echo $l -> t("Tuesday");?>", "<?php echo $l -> t("Wednesday");?>", "<?php echo $l -> t("Thursday");?>", "<?php echo $l -> t("Friday");?>", "<?php echo $l -> t("Saturday");?>");
+ var dayNamesShort = new Array("<?php echo $l -> t("Sun.");?>", "<?php echo $l -> t("Mon.");?>", "<?php echo $l -> t("Tue.");?>", "<?php echo $l -> t("Wed.");?>", "<?php echo $l -> t("Thu.");?>", "<?php echo $l -> t("Fri.");?>", "<?php echo $l -> t("Sat.");?>");
+ var monthNames = new Array("<?php echo $l -> t("January");?>", "<?php echo $l -> t("February");?>", "<?php echo $l -> t("March");?>", "<?php echo $l -> t("April");?>", "<?php echo $l -> t("May");?>", "<?php echo $l -> t("June");?>", "<?php echo $l -> t("July");?>", "<?php echo $l -> t("August");?>", "<?php echo $l -> t("September");?>", "<?php echo $l -> t("October");?>", "<?php echo $l -> t("November");?>", "<?php echo $l -> t("December");?>");
+ var monthNamesShort = new Array("<?php echo $l -> t("Jan.");?>", "<?php echo $l -> t("Feb.");?>", "<?php echo $l -> t("Mar.");?>", "<?php echo $l -> t("Apr.");?>", "<?php echo $l -> t("May.");?>", "<?php echo $l -> t("Jun.");?>", "<?php echo $l -> t("Jul.");?>", "<?php echo $l -> t("Aug.");?>", "<?php echo $l -> t("Sep.");?>", "<?php echo $l -> t("Oct.");?>", "<?php echo $l -> t("Nov.");?>", "<?php echo $l -> t("Dec.");?>");
var agendatime = '<?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>{ - <?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>}';
var defaulttime = '<?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>';
var allDayText = '<?php echo addslashes($l->t('All day')) ?>';
diff --git a/apps/contacts/ajax/categories/delete.php b/apps/contacts/ajax/categories/delete.php
index 7c3261446bb..f53d852d603 100644
--- a/apps/contacts/ajax/categories/delete.php
+++ b/apps/contacts/ajax/categories/delete.php
@@ -9,8 +9,9 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
+OCP\JSON::callCheck();
-require_once('../loghandler.php');
+require_once(__DIR__.'/../loghandler.php');
$categories = isset($_POST['categories'])?$_POST['categories']:null;
diff --git a/apps/contacts/ajax/categories/rescan.php b/apps/contacts/ajax/categories/rescan.php
index fd875a965dc..a06e7803955 100644
--- a/apps/contacts/ajax/categories/rescan.php
+++ b/apps/contacts/ajax/categories/rescan.php
@@ -9,6 +9,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
+OCP\JSON::callCheck();
OC_Contacts_App::scanCategories();
$categories = OC_Contacts_App::getCategories();
diff --git a/apps/contacts/ajax/contactdetails.php b/apps/contacts/ajax/contactdetails.php
index b697b1a8e5b..d438f708b46 100644
--- a/apps/contacts/ajax/contactdetails.php
+++ b/apps/contacts/ajax/contactdetails.php
@@ -30,6 +30,7 @@ $id = isset($_GET['id'])?$_GET['id']:null;
if(is_null($id)) {
bailOut(OC_Contacts_App::$l10n->t('Missing ID'));
}
+$card = OC_Contacts_VCard::find($id);
$vcard = OC_Contacts_App::getContactVCard( $id );
if(is_null($vcard)) {
bailOut(OC_Contacts_App::$l10n->t('Error parsing VCard for ID: "'.$id.'"'));
@@ -50,5 +51,7 @@ if(isset($details['PHOTO'])) {
$details['PHOTO'] = false;
}
$details['id'] = $id;
+$details['displayname'] = $card['fullname'];
+$details['addressbookid'] = $card['addressbookid'];
OC_Contacts_App::setLastModifiedHeader($vcard);
OCP\JSON::success(array('data' => $details));
diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php
index 34fc3cc5351..5a0a7c14882 100644
--- a/apps/contacts/ajax/saveproperty.php
+++ b/apps/contacts/ajax/saveproperty.php
@@ -66,8 +66,7 @@ if($element != $name) {
switch($element) {
case 'BDAY':
$date = New DateTime($value);
- //$vcard->setDateTime('BDAY', $date, Sabre_VObject_Element_DateTime::DATE);
- $value = $date->format(DateTime::ATOM);
+ $value = $date->format('Y-m-d');
break;
case 'FN':
if(!$value) {
@@ -89,6 +88,14 @@ if(!$value) {
} else {
/* setting value */
switch($element) {
+ case 'BDAY':
+ // I don't use setDateTime() because that formats it as YYYYMMDD instead of YYYY-MM-DD
+ // which is what the RFC recommends.
+ $vcard->children[$line]->setValue($value);
+ $vcard->children[$line]->parameters = array();
+ $vcard->children[$line]->add(new Sabre_VObject_Parameter('VALUE', 'DATE'));
+ debug('Setting value:'.$name.' '.$vcard->children[$line]);
+ break;
case 'CATEGORIES':
debug('Setting string:'.$name.' '.$value);
$vcard->children[$line]->setValue($value);
diff --git a/apps/contacts/appinfo/update.php b/apps/contacts/appinfo/update.php
index 873899f578b..21e736bb446 100644
--- a/apps/contacts/appinfo/update.php
+++ b/apps/contacts/appinfo/update.php
@@ -1,7 +1,7 @@
<?php
$installedVersion=OCP\Config::getAppValue('contacts', 'installed_version');
-if (version_compare($installedVersion, '0.2.90', '<')) {
+if (version_compare($installedVersion, '0.2.3', '<')) {
// First set all address books in-active.
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET active=0' );
$result = $stmt->execute(array());
diff --git a/apps/contacts/css/contacts.css b/apps/contacts/css/contacts.css
index de7950ecc61..27a796a15f5 100644
--- a/apps/contacts/css/contacts.css
+++ b/apps/contacts/css/contacts.css
@@ -5,7 +5,7 @@
#leftcontent a { padding: 0 0 0 25px; }
#rightcontent { top: 3.5em !important; padding-top: 5px; }
#leftcontent h3 { cursor: pointer; -moz-transition: background 300ms ease 0s; background: none no-repeat scroll 1em center #eee; border-bottom: 1px solid #ddd; border-top: 1px solid #fff; display: block; max-width: 100%; padding: 0.5em 0.8em; color: #666; text-shadow: 0 1px 0 #f8f8f8; font-size: 1.2em; }
-#leftcontent h3:hover,#leftcontent h3:active,#leftcontent h3.active { background-color: #DBDBDB; border-bottom: 1px solid #CCCCCC; border-top: 1px solid #D4D4D4; color: #333333; }
+#leftcontent h3:hover,#leftcontent h3:active,#leftcontent h3.active { background-color: #DBDBDB; border-bottom: 1px solid #CCCCCC; border-top: 1px solid #D4D4D4; color: #333333; font-weight: bold; }
#contacts { position: fixed; background: #fff; max-width: 100%; width: 20em; left: 12.5em; top: 3.7em; bottom: 3em; overflow: auto; padding: 0; margin: 0; }
.contacts a { height: 23px; display: block; left: 12.5em; margin: 0 0 0 0; padding: 0 0 0 25px; }
.contacts li.ui-draggable { height: 23px; }
diff --git a/apps/contacts/import.php b/apps/contacts/import.php
index ed1b80e132a..7d3acf86cf8 100644
--- a/apps/contacts/import.php
+++ b/apps/contacts/import.php
@@ -80,6 +80,11 @@ $imported = 0;
$failed = 0;
if(!count($parts) > 0) {
OCP\JSON::error(array('data' => array('message' => 'No contacts to import in '.$_POST['file'].'. Please check if the file is corrupted.', 'file'=>$_POST['file'])));
+ if(isset($_POST['fstype']) && $_POST['fstype'] == 'OC_FilesystemView') {
+ if(!$view->unlink('/imports/' . $_POST['file'])) {
+ OCP\Util::writeLog('contacts','Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'], OCP\Util::ERROR);
+ }
+ }
exit();
}
foreach($parts as $part){
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index b4e7cdba444..990d83c00bc 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -285,7 +285,7 @@ Contacts={
data:undefined,
update:function(params) { // params {cid:int, aid:int}
if(!params) { params = {}; }
- $('#contacts li').removeClass('active');
+ $('#contacts li,#contacts h3').removeClass('active');
console.log('Card, cid: ' + params.cid + ' aid: ' + params.aid);
var newid, bookid, firstitem;
if(!parseInt(params.cid) && !parseInt(params.aid)) {
@@ -299,7 +299,13 @@ Contacts={
newid = parseInt($('#contacts').find('li[data-bookid="'+bookid+'"]').first().data('id'));
} else if(parseInt(params.cid) && !parseInt(params.aid)) {
newid = parseInt(params.cid);
- bookid = parseInt($('#contacts li[data-id="'+newid+'"]').data('bookid'));
+ var listitem = $('#contacts li[data-id="'+newid+'"]');
+ console.log('Is contact in list? ' + listitem.length);
+ if(listitem.length) {
+ bookid = parseInt($('#contacts li[data-id="'+newid+'"]').data('bookid'));
+ } else { // contact isn't in list yet.
+ bookid = 'unknown';
+ }
} else {
newid = parseInt(params.cid);
bookid = parseInt(params.aid);
@@ -311,9 +317,14 @@ Contacts={
console.log('newid: ' + newid + ' bookid: ' +bookid);
var localLoadContact = function(newid, bookid) {
if($('.contacts li').length > 0) {
- $('#contacts li[data-id="'+newid+'"]').addClass('active');
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':newid},function(jsondata){
if(jsondata.status == 'success'){
+ if(bookid == 'unknown') {
+ bookid = jsondata.data.addressbookid;
+ var entry = Contacts.UI.Card.createEntry(jsondata.data);
+ $('#contacts ul[data-id="'+bookid+'"]').append(entry);
+ }
+ $('#contacts li[data-id="'+newid+'"],#contacts h3[data-id="'+bookid+'"]').addClass('active');
$('#contacts ul[data-id="'+bookid+'"]').slideDown(300);
Contacts.UI.Card.loadContact(jsondata.data, bookid);
} else {
@@ -1334,8 +1345,6 @@ Contacts={
},
},
Addressbooks:{
- droptarget:undefined,
- droptext:t('contacts', 'Drop a VCF file<br />to import contacts.'),
overview:function(){
if($('#chooseaddressbook_dialog').dialog('isOpen') == true){
$('#chooseaddressbook_dialog').dialog('moveToTop');
@@ -1456,12 +1465,18 @@ Contacts={
batchnum:50,
drop:function(event, ui) {
var dragitem = ui.draggable, droptarget = $(this);
- //console.log('Drop ' + dragitem.data('id') +' on: ' + droptarget.data('id'));
+ if(dragitem.is('li')) {
+ Contacts.UI.Contacts.dropContact(event, dragitem, droptarget);
+ } else {
+ Contacts.UI.Contacts.dropAddressbook(event, dragitem, droptarget);
+ }
+ },
+ dropContact:function(event, dragitem, droptarget) {
if(dragitem.data('bookid') == droptarget.data('id')) {
return false;
}
var droplist = (droptarget.is('ul'))?droptarget:droptarget.next();
- $.post(OC.filePath('contacts', 'ajax', 'movetoaddressbook.php'), { ids: dragitem.data('id'), aid: $(this).data('id') },
+ $.post(OC.filePath('contacts', 'ajax', 'movetoaddressbook.php'), { ids: dragitem.data('id'), aid: droptarget.data('id') },
function(jsondata){
if(jsondata.status == 'success'){
// Do some inserting/removing/sorting magic
@@ -1485,6 +1500,9 @@ Contacts={
}
});
},
+ dropAddressbook:function(event, dragitem, droptarget) {
+ alert('Dropping address books not implemented yet');
+ },
// Reload the contacts list.
update:function(params){
if(!params) { params = {}; }
@@ -1534,7 +1552,7 @@ Contacts={
$('#contacts ul[data-id="'+b+'"]').slideToggle(300);
return false;
});
- var accept = 'li:not([data-bookid="'+b+'"])';
+ var accept = 'li:not([data-bookid="'+b+'"]),h3:not([data-id="'+b+'"])';
$('#contacts h3[data-id="'+b+'"],#contacts ul[data-id="'+b+'"]').droppable({
drop: Contacts.UI.Contacts.drop,
activeClass: 'ui-state-hover',
@@ -1542,9 +1560,10 @@ Contacts={
});
}
var contactlist = $('#contacts ul[data-id="'+b+'"]');
+ var contacts = $('#contacts ul[data-id="'+b+'"] li');
for(var c in book.contacts) {
if(book.contacts[c].id == undefined) { continue; }
- if($('#contacts li[data-id="'+book.contacts[c]['id']+'"][data-id="'+book.contacts[c]['bookid']+'"]').length == 0) {
+ if(!$('#contacts li[data-id="'+book.contacts[c]['id']+'"]').length) {
var contact = Contacts.UI.Card.createEntry(book.contacts[c]);
if(c == self.batchnum-5) {
contact.bind('inview', function(event, isInView, visiblePartX, visiblePartY) {
@@ -1557,12 +1576,22 @@ Contacts={
}
});
}
- contactlist.append(contact);
+ var added = false;
+ contacts.each(function(){
+ if ($(this).text().toLowerCase() > book.contacts[c].displayname.toLowerCase()) {
+ $(this).before(contact);
+ added = true;
+ return false;
+ }
+ });
+ if(!added) {
+ contactlist.append(contact);
+ }
}
}
});
if($('#contacts h3').length > 1) {
- $('#contacts li').draggable({
+ $('#contacts li,#contacts h3').draggable({
revert: 'invalid',
axis: 'y', containment: '#contacts',
scroll: true, scrollSensitivity: 100,
@@ -1625,7 +1654,13 @@ $(document).ready(function(){
item.addClass('active');
var oldid = $('#rightcontent').data('id');
if(oldid != 0){
- $('.contacts li[data-id="'+oldid+'"]').removeClass('active');
+ var olditem = $('.contacts li[data-id="'+oldid+'"]');
+ var oldbookid = olditem.data('bookid');
+ olditem.removeClass('active');
+ if(oldbookid != bookid) {
+ $('#contacts h3[data-id="'+oldbookid+'"]').removeClass('active');
+ $('#contacts h3[data-id="'+bookid+'"]').addClass('active');
+ }
}
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':id},function(jsondata){
if(jsondata.status == 'success'){
@@ -1643,53 +1678,55 @@ $(document).ready(function(){
Contacts.UI.Card.saveProperty(this);
});
- // Upload function for dropped contact photos files. Should go in the Contacts class/object.
- $.fileUpload = function(files){
- var file = files[0];
- if(file.size > $('#max_upload').val()){
- OC.dialogs.alert(t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'), t('contacts','Upload too large'));
- return;
- }
- if (file.type.indexOf("image") != 0) {
- OC.dialogs.alert(t('contacts','Only image files can be used as profile picture.'), t('contacts','Wrong file type'));
- return;
- }
- var xhr = new XMLHttpRequest();
+ $(function() {
+ // Upload function for dropped contact photos files. Should go in the Contacts class/object.
+ $.fileUpload = function(files){
+ var file = files[0];
+ if(file.size > $('#max_upload').val()){
+ OC.dialogs.alert(t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'), t('contacts','Upload too large'));
+ return;
+ }
+ if (file.type.indexOf("image") != 0) {
+ OC.dialogs.alert(t('contacts','Only image files can be used as profile picture.'), t('contacts','Wrong file type'));
+ return;
+ }
+ var xhr = new XMLHttpRequest();
- if (!xhr.upload) {
- OC.dialogs.alert(t('contacts', 'Your browser doesn\'t support AJAX upload. Please click on the profile picture to select a photo to upload.'), t('contacts', 'Error'))
- }
- fileUpload = xhr.upload,
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4){
- response = $.parseJSON(xhr.responseText);
- if(response.status == 'success') {
- if(xhr.status == 200) {
- Contacts.UI.Card.editPhoto(response.data.id, response.data.tmp);
+ if (!xhr.upload) {
+ OC.dialogs.alert(t('contacts', 'Your browser doesn\'t support AJAX upload. Please click on the profile picture to select a photo to upload.'), t('contacts', 'Error'))
+ }
+ fileUpload = xhr.upload,
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4){
+ response = $.parseJSON(xhr.responseText);
+ if(response.status == 'success') {
+ if(xhr.status == 200) {
+ Contacts.UI.Card.editPhoto(response.data.id, response.data.tmp);
+ } else {
+ OC.dialogs.alert(xhr.status + ': ' + xhr.responseText, t('contacts', 'Error'));
+ }
} else {
- OC.dialogs.alert(xhr.status + ': ' + xhr.responseText, t('contacts', 'Error'));
+ OC.dialogs.alert(response.data.message, t('contacts', 'Error'));
}
- } else {
- OC.dialogs.alert(response.data.message, t('contacts', 'Error'));
}
- }
- };
-
- fileUpload.onprogress = function(e){
- if (e.lengthComputable){
- var _progress = Math.round((e.loaded * 100) / e.total);
- //if (_progress != 100){
- //}
- }
- };
- xhr.open('POST', OC.filePath('contacts', 'ajax', 'uploadphoto.php')+'?id='+Contacts.UI.Card.id+'&requesttoken='+requesttoken+'&imagefile='+encodeURIComponent(file.name), true);
- xhr.setRequestHeader('Cache-Control', 'no-cache');
- xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
- xhr.setRequestHeader('X_FILE_NAME', encodeURIComponent(file.name));
- xhr.setRequestHeader('X-File-Size', file.size);
- xhr.setRequestHeader('Content-Type', file.type);
- xhr.send(file);
- }
+ };
+
+ fileUpload.onprogress = function(e){
+ if (e.lengthComputable){
+ var _progress = Math.round((e.loaded * 100) / e.total);
+ //if (_progress != 100){
+ //}
+ }
+ };
+ xhr.open('POST', OC.filePath('contacts', 'ajax', 'uploadphoto.php')+'?id='+Contacts.UI.Card.id+'&requesttoken='+requesttoken+'&imagefile='+encodeURIComponent(file.name), true);
+ xhr.setRequestHeader('Cache-Control', 'no-cache');
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+ xhr.setRequestHeader('X_FILE_NAME', encodeURIComponent(file.name));
+ xhr.setRequestHeader('X-File-Size', file.size);
+ xhr.setRequestHeader('Content-Type', file.type);
+ xhr.send(file);
+ }
+ });
$(document).bind('drop dragover', function (e) {
e.preventDefault(); // prevent browser from doing anything, if file isn't dropped in dropZone
diff --git a/apps/contacts/lib/hooks.php b/apps/contacts/lib/hooks.php
index d91d3c565b5..6239aec49ef 100644
--- a/apps/contacts/lib/hooks.php
+++ b/apps/contacts/lib/hooks.php
@@ -34,12 +34,12 @@
*/
class OC_Contacts_Hooks{
/**
- * @brief Add default Addressbooks of a certain user
- * @param paramters parameters from postDeleteUser-Hook
+ * @brief Add default Addressbook for a certain user
+ * @param paramters parameters from postCreateUser-Hook
* @return array
*/
static public function createUser($parameters) {
- OC_Contacts_Addressbook::addDefault($parameters['uid'],'default','Default Address Book');
+ OC_Contacts_Addressbook::addDefault($parameters['uid']);
return true;
}
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index e3b65605624..4f1ba5f08df 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -430,7 +430,6 @@ class OC_Contacts_VCard{
* @return boolean
*/
public static function delete($id){
- // FIXME: Add error checking.
OC_Hook::emit('OC_Contacts_VCard', 'pre_deleteVCard', array('aid' => null, 'id' => $id, 'uri' => null));
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' );
try {
@@ -451,7 +450,6 @@ class OC_Contacts_VCard{
* @return boolean
*/
public static function deleteFromDAVData($aid,$uri){
- // FIXME: Add error checking. Deleting a card gives an Kontact/Akonadi error.
OC_Hook::emit('OC_Contacts_VCard', 'pre_deleteVCard', array('aid' => $aid, 'id' => null, 'uri' => $uri));
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' );
try {
diff --git a/apps/files_sharing_log/appinfo/database.xml b/apps/files_sharing_log/appinfo/database.xml
index 92e5f0125bd..dae811f87fa 100644
--- a/apps/files_sharing_log/appinfo/database.xml
+++ b/apps/files_sharing_log/appinfo/database.xml
@@ -3,7 +3,7 @@
<name>*dbname*</name>
<create>true</create>
<overwrite>false</overwrite>
- <charset>latin1</charset>
+ <charset>utf8</charset>
<table>
<name>*dbprefix*sharing_log</name>
<declaration>
diff --git a/apps/files_versions/ajax/expireAll.php b/apps/files_versions/ajax/expireAll.php
index 4f165be0ae9..2a678c7f0a5 100644
--- a/apps/files_versions/ajax/expireAll.php
+++ b/apps/files_versions/ajax/expireAll.php
@@ -27,6 +27,7 @@
// Check user and app status
OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('files_versions');
+OCP\JSON::callCheck();
$versions = new OCA_Versions\Storage();
diff --git a/apps/files_versions/ajax/rollbackVersion.php b/apps/files_versions/ajax/rollbackVersion.php
index 8d1092f8b8e..24d71a914a4 100644
--- a/apps/files_versions/ajax/rollbackVersion.php
+++ b/apps/files_versions/ajax/rollbackVersion.php
@@ -1,6 +1,7 @@
<?php
OCP\JSON::checkAppEnabled('files_versions');
+OCP\JSON::callCheck();
$userDirectory = "/".OCP\USER::getUser()."/files";
diff --git a/apps/files_versions/ajax/togglesettings.php b/apps/files_versions/ajax/togglesettings.php
index 86f614c5c89..546b37ae1aa 100644
--- a/apps/files_versions/ajax/togglesettings.php
+++ b/apps/files_versions/ajax/togglesettings.php
@@ -2,6 +2,7 @@
OCP\JSON::checkAppEnabled('files_versions');
OCP\JSON::checkAdminUser();
+OCP\JSON::callCheck();
if (OCP\Config::getSystemValue('versions', 'true')=='true') {
OCP\Config::setSystemValue('versions', 'false');
} else {
diff --git a/apps/remoteStorage/appinfo/info.xml b/apps/remoteStorage/appinfo/info.xml
index fa878762a05..1388ad9c316 100644
--- a/apps/remoteStorage/appinfo/info.xml
+++ b/apps/remoteStorage/appinfo/info.xml
@@ -7,4 +7,7 @@
<author>Michiel de Jong</author>
<require>4</require>
<shipped>true</shipped>
+ <remote>
+ <remoteStorage>webdav.php</remoteStorage>
+ </remote>
</info>
diff --git a/apps/remoteStorage/appinfo/version b/apps/remoteStorage/appinfo/version
index 490f510fc27..0e2c93950bb 100644
--- a/apps/remoteStorage/appinfo/version
+++ b/apps/remoteStorage/appinfo/version
@@ -1 +1 @@
-0.6 \ No newline at end of file
+0.7 \ No newline at end of file
diff --git a/apps/remoteStorage/appinfo/webfinger.php b/apps/remoteStorage/appinfo/webfinger.php
index 5d481f315f8..e8b237628c4 100644
--- a/apps/remoteStorage/appinfo/webfinger.php
+++ b/apps/remoteStorage/appinfo/webfinger.php
@@ -1,8 +1,8 @@
-<?php if(OC_User::userExists(WF_USER)) { ?>
+<?php if(OC_User::userExists(WF_USER)): ?>
{
"rel":"remoteStorage",
- "template":"<?php echo WF_BASEURL; ?>/apps/remoteStorage/WebDAV.php/<?php echo WF_USER; ?>/remoteStorage/{category}/",
+ "template":"<?php echo WF_BASEURL; ?>/remote.php/remoteStorage/<?php echo WF_USER; ?>/remoteStorage/{category}/",
"api":"WebDAV",
"auth":"<?php echo WF_BASEURL; ?>/?app=remoteStorage&getfile=auth.php&userid=<?php echo WF_USER; ?>"
}
-<?php } ?>
+<?php endif ?>
diff --git a/apps/remoteStorage/oauth_ro_auth.php b/apps/remoteStorage/oauth_ro_auth.php
index 12d02d1cf5d..bed3093c3b3 100644
--- a/apps/remoteStorage/oauth_ro_auth.php
+++ b/apps/remoteStorage/oauth_ro_auth.php
@@ -9,10 +9,10 @@
class OC_Connector_Sabre_Auth_ro_oauth extends Sabre_DAV_Auth_Backend_AbstractBasic {
private $validTokens;
- private $category;
+ private $category;
public function __construct($validTokensArg, $categoryArg) {
$this->validTokens = $validTokensArg;
- $this->category = $categoryArg;
+ $this->category = $categoryArg;
}
/**
@@ -25,16 +25,16 @@ class OC_Connector_Sabre_Auth_ro_oauth extends Sabre_DAV_Auth_Backend_AbstractBa
*/
protected function validateUserPass($username, $password){
//always give read-only:
- if(($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
+ if(($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
|| (isset($this->validTokens[$password]))
- || (($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
- ) {
+ || (($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
+ ) {
OC_Util::setUpFS();
return true;
} else {
- //var_export($_SERVER);
- //var_export($this->validTokens);
- //die('not getting in with "'.$username.'"/"'.$password.'"!');
+ //var_export($_SERVER);
+ //var_export($this->validTokens);
+ //die('not getting in with "'.$username.'"/"'.$password.'"!');
return false;
}
}
@@ -48,8 +48,8 @@ class OC_Connector_Sabre_Auth_ro_oauth extends Sabre_DAV_Auth_Backend_AbstractBa
$userpass = $auth->getUserPass();
if (!$userpass) {
if(($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
- ||(($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
- ) {
+ ||(($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
+ ) {
$userpass = array('', '');
} else {
$auth->requireLogin();
diff --git a/apps/remoteStorage/WebDAV.php b/apps/remoteStorage/webdav.php
index 7a81c18e0af..8d8ec6a45a1 100644
--- a/apps/remoteStorage/WebDAV.php
+++ b/apps/remoteStorage/webdav.php
@@ -25,22 +25,7 @@
*
*/
-
-// Do not load FS ...
-$RUNTIME_NOSETUPFS = true;
-
-
-require_once('../../lib/base.php');
-
-require_once('../../lib/user.php');
-require_once('../../lib/public/user.php');
-
-require_once('../../lib/app.php');
-require_once('../../lib/public/app.php');
-
-require_once('../../3rdparty/Sabre/DAV/Auth/IBackend.php');
-require_once('../../3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php');
-require_once('../../lib/connector/sabre/auth.php');
+OC_App::loadApps(array('filesystem','authentication'));
OCP\App::checkAppEnabled('remoteStorage');
require_once('lib_remoteStorage.php');
@@ -61,14 +46,15 @@ if(isset($_SERVER['HTTP_ORIGIN'])) {
header('Access-Control-Allow-Origin: *');
}
-$path = substr($_SERVER["REQUEST_URI"], strlen($_SERVER["SCRIPT_NAME"]));
+$path = substr($_SERVER["REQUEST_URI"], strlen($baseuri));
+
$pathParts = explode('/', $path);
// for webdav:
-// 0/ 1 / 2 / 3...
-// /$ownCloudUser/remoteStorage/$category/
+// 0 / 1 / 2...
+// $ownCloudUser/remoteStorage/$category/
-if(count($pathParts) >= 3 && $pathParts[0] == '') {
- list($dummy, $ownCloudUser, $dummy2, $category) = $pathParts;
+if(count($pathParts) >= 2) {
+ list($ownCloudUser, $dummy2, $category) = $pathParts;
OC_Util::setupFS($ownCloudUser);
@@ -77,13 +63,13 @@ if(count($pathParts) >= 3 && $pathParts[0] == '') {
$server = new Sabre_DAV_Server($publicDir);
// Path to our script
- $server->setBaseUri(OC::$WEBROOT."/apps/remoteStorage/WebDAV.php/$ownCloudUser");
+ $server->setBaseUri($baseuri.$ownCloudUser);
// Auth backend
$authBackend = new OC_Connector_Sabre_Auth_ro_oauth(
- OC_remoteStorage::getValidTokens($ownCloudUser, $category),
- $category
- );
+ OC_remoteStorage::getValidTokens($ownCloudUser, $category),
+ $category
+ );
$authPlugin = new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud');//should use $validTokens here
$server->addPlugin($authPlugin);
diff --git a/apps/tasks/ajax/addtask.php b/apps/tasks/ajax/addtask.php
index 9f35e7f21ec..188e179236a 100644
--- a/apps/tasks/ajax/addtask.php
+++ b/apps/tasks/ajax/addtask.php
@@ -3,6 +3,7 @@
// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
+OCP\JSON::callCheck();
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
$first_calendar = reset($calendars);
diff --git a/apps/tasks/ajax/delete.php b/apps/tasks/ajax/delete.php
index e29add9b556..cc22c3e3873 100644
--- a/apps/tasks/ajax/delete.php
+++ b/apps/tasks/ajax/delete.php
@@ -23,6 +23,7 @@
// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
+OCP\JSON::callCheck();
$id = $_POST['id'];
$task = OC_Calendar_App::getEventObject( $id );
diff --git a/apps/tasks/ajax/edittask.php b/apps/tasks/ajax/edittask.php
index edcc8a7cdcd..77ecff13e66 100644
--- a/apps/tasks/ajax/edittask.php
+++ b/apps/tasks/ajax/edittask.php
@@ -3,6 +3,7 @@
// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
+OCP\JSON::callCheck();
$l10n = new OC_L10N('tasks');
diff --git a/apps/tasks/ajax/update_property.php b/apps/tasks/ajax/update_property.php
index 46521cf6c58..f47040a77d4 100644
--- a/apps/tasks/ajax/update_property.php
+++ b/apps/tasks/ajax/update_property.php
@@ -9,6 +9,7 @@
// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
+OCP\JSON::callCheck();
$id = $_POST['id'];
$property = $_POST['type'];
diff --git a/apps/user_webfinger/.htaccess b/apps/user_webfinger/.htaccess
new file mode 100644
index 00000000000..1b13cf788ff
--- /dev/null
+++ b/apps/user_webfinger/.htaccess
@@ -0,0 +1,5 @@
+<IfModule mod_rewrite.c>
+RewriteEngine on
+RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+RewriteRule ^host-meta host-meta.php [QSA,L]
+</IfModule>
diff --git a/apps/user_webfinger/host-meta.php b/apps/user_webfinger/host-meta.php
index 32ffb512057..4ac37b1ea09 100644
--- a/apps/user_webfinger/host-meta.php
+++ b/apps/user_webfinger/host-meta.php
@@ -1,10 +1,27 @@
<?php
+
+if(class_exists('OC')){
+ $WEBROOT=OC::$WEBROOT;
+}else{//not called trough remote.php try to guess the webroot the best we can from here
+ // calculate the root directories
+ $SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-strlen('apps/user_webfinger/host-meta.php')));
+ $WEBROOT=substr($SERVERROOT,strlen(realpath($_SERVER['DOCUMENT_ROOT'])));
+
+ if($WEBROOT!='' and $WEBROOT[0]!=='/'){
+ $WEBROOT='/'.$WEBROOT;
+ }
+}
+
+if(substr($WEBROOT,-1)==='/'){
+ $WEBROOT=substr($WEBROOT,0,-1);
+}
+
$hostMetaHeader = array(
'Access-Control-Allow-Origin' => '*',
'Content-Type' => 'application/xrd+json'
);
$serverName = $_SERVER['SERVER_NAME'];
-$hostMetaContents = '{"links":[{"rel":"lrdd","template":"http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$serverName.'/public.php?service=webfinger&q={uri}"}]}';
+$hostMetaContents = '{"links":[{"rel":"lrdd","template":"http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$serverName.$WEBROOT.'/public.php?service=webfinger&q={uri}"}]}';
foreach($hostMetaHeader as $header => $value) {
header($header . ": " . $value);
}
diff --git a/autotest.sh b/autotest.sh
index 06605687d1d..bf98932a4af 100755
--- a/autotest.sh
+++ b/autotest.sh
@@ -1,53 +1,36 @@
+#!/bin/bash
#
-# sqlite testing now
+# ownCloud
#
-echo "Setup environment for sqlite testing ..."
+# @author Thomas Müller
+# @copyright 2012 Thomas Müller thomas.mueller@tmit.eu
+#
+
DATADIR=data-autotest
-rm -rf $DATADIR
-mkdir $DATADIR
-rm -rf config/config.php
-#cp autotest/config.sqlite.php config/autoconfig.php
-cat > ./config/autoconfig.php <<DELIM
+BASEDIR=$PWD
+
+# create autoconfig for sqlite, mysql and (soon) postgresql
+cat > ./tests/autoconfig-sqlite.php <<DELIM
<?php
\$AUTOCONFIG = array (
'installed' => false,
'dbtype' => 'sqlite',
'dbtableprefix' => 'oc_',
- 'datadirectory' => 'data',
'adminlogin' => 'admin',
'adminpass' => 'admin',
- 'directory' => '$PWD/$DATADIR',
+ 'directory' => '$BASEDIR/$DATADIR',
);
DELIM
-php -f index.php
-
-#test execution
-echo 'Testing with sqlite ...'
-cd tests
-php -f index.php -- xml > autotest-results-sqlite.xml
-
-#
-# mysql testing now
-#
-# NOTES:
-# - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
-#
-echo "Setup environment for MySql testing ..."
-DATADIR=data-autotest
-rm -rf $DATADIR
-mkdir $DATADIR
-rm -rf config/config.php
-cat > ./config/autoconfig.php <<DELIM
+cat > ./tests/autoconfig-mysql.php <<DELIM
<?php
\$AUTOCONFIG = array (
'installed' => false,
'dbtype' => 'mysql',
'dbtableprefix' => 'oc_',
- 'datadirectory' => 'data',
'adminlogin' => 'admin',
'adminpass' => 'admin',
- 'directory' => '$PWD/$DATADIR',
+ 'directory' => '$BASEDIR/$DATADIR',
'dbuser' => 'oc_autotest',
'dbname' => 'oc_autotest',
'dbhost' => 'localhost',
@@ -55,18 +38,52 @@ cat > ./config/autoconfig.php <<DELIM
);
DELIM
-#drop the database
-mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"
-#setup
-php -f index.php
+function execute_tests {
+ echo "Setup environment for $1 testing ..."
+ # back to root folder
+ cd $BASEDIR
+ echo $BASEDIR
+
+ # revert changes to tests/data
+ git checkout tests/data/*
-#test execution
-echo 'Testing with MySql ...'
-cd tests
-php -f index.php -- xml > autotest-results-MySql.xml
+ # reset data directory
+ rm -rf $DATADIR
+ mkdir $DATADIR
+ # remove the old config file
+ rm -rf config/config.php
+
+ # drop database
+ if [ "$1" == "mysql" ] ; then
+ mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"
+ fi
+
+ # copy autoconfig
+ cp $BASEDIR/tests/autoconfig-$1.php $BASEDIR/config/autoconfig.php
+
+ # trigger installation
+ php -f index.php
+
+ #test execution
+ echo "Testing with $1 ..."
+ cd tests
+ php -f index.php -- xml $1 > autotest-results-$1.xml
+}
+
+#
+# start test execution
#
-# TODO: create config for postgres
+execute_tests "sqlite"
+execute_tests 'mysql'
+
+# TODO: implement this
+#execute_tests 'postgresql'
+
+#
+# NOTES:
+# - CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud';
+# - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
#
diff --git a/lib/connector/sabre/auth.php b/lib/connector/sabre/auth.php
index ee680391626..99f696e3a07 100644
--- a/lib/connector/sabre/auth.php
+++ b/lib/connector/sabre/auth.php
@@ -31,13 +31,18 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
* @return bool
*/
protected function validateUserPass($username, $password){
- OC_Util::setUpFS();//login hooks may need early access to the filesystem
- if(OC_User::login($username,$password)){
- OC_Util::setUpFS($username);
+ if (OC_User::isLoggedIn()) {
+ OC_Util::setupFS($username);
return true;
- }
- else{
- return false;
+ } else {
+ OC_Util::setUpFS();//login hooks may need early access to the filesystem
+ if(OC_User::login($username,$password)){
+ OC_Util::setUpFS($username);
+ return true;
+ }
+ else{
+ return false;
+ }
}
}
}
diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php
index e4dc8c93445..4700dbf8b89 100644
--- a/lib/connector/sabre/file.php
+++ b/lib/connector/sabre/file.php
@@ -42,7 +42,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
*/
public function get() {
- return OC_Filesystem::readfile($this->path);
+ return OC_Filesystem::fopen($this->path,'rb');
}
diff --git a/lib/l10n.php b/lib/l10n.php
index de8514573d3..e7f5ffea0e4 100644
--- a/lib/l10n.php
+++ b/lib/l10n.php
@@ -154,8 +154,15 @@ class OC_L10N{
*
* Returns the translation. If no translation is found, $textArray will be
* returned.
+ *
+ *
+ * @deprecated deprecated since ownCloud version 5.0
+ * This method will probably be removed with ownCloud 6.0
+ *
+ *
*/
public function tA($textArray){
+ OC_Log::write('core', 'DEPRECATED: the method tA is deprecated and will be removed soon.',OC_Log::WARN);
$result = array();
foreach($textArray as $key => $text){
$result[$key] = (string)$this->t($text);
diff --git a/lib/user.php b/lib/user.php
index f1903093d6d..230efe71394 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -200,7 +200,7 @@ class OC_User {
if( $run ){
$uid=self::checkPassword( $uid, $password );
if($uid){
- session_regenerate_id();
+ session_regenerate_id(true);
self::setUserId($uid);
OC_Hook::emit( "OC_User", "post_login", array( "uid" => $uid, 'password'=>$password ));
return true;
diff --git a/tests/index.php b/tests/index.php
index e91b3f0da56..935ce39531a 100644
--- a/tests/index.php
+++ b/tests/index.php
@@ -26,8 +26,7 @@ require_once 'simpletest/mock_objects.php';
require_once 'simpletest/collector.php';
require_once 'simpletest/default_reporter.php';
-// test suite instance
-$testSuite=new TestSuite("ownCloud Unit Test Suite");
+$testSuiteName="ownCloud Unit Test Suite";
// prepare the reporter
if(OC::$CLI){
@@ -37,12 +36,19 @@ if(OC::$CLI){
{
$reporter= new XmlReporter;
$test=false;
+
+ if(isset($_SERVER['argv'][2])){
+ $testSuiteName=$testSuiteName." (".$_SERVER['argv'][2].")";
+ }
}
}else{
$reporter='HtmlReporter';
$test=isset($_GET['test'])?$_GET['test']:false;
}
+// test suite instance
+$testSuite=new TestSuite($testSuiteName);
+
//load core test cases
loadTests(dirname(__FILE__), $testSuite, $test);