diff --git a/.gitignore b/.gitignore
index e2ff07d14d..ae63693170 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,9 @@ RCS/*
# netbeans
nbproject
+# phpStorm
+.idea
+
# geany
*.geany
diff --git a/3rdparty/Sabre/DAV/Client.php b/3rdparty/Sabre/DAV/Client.php
index d257c86da1..075e84caa1 100644
--- a/3rdparty/Sabre/DAV/Client.php
+++ b/3rdparty/Sabre/DAV/Client.php
@@ -22,7 +22,6 @@ class Sabre_DAV_Client {
protected $userName;
protected $password;
protected $proxy;
- protected $capath;
/**
* Constructor
@@ -50,10 +49,6 @@ class Sabre_DAV_Client {
'proxy'
);
- $this->capath = '';
- if (isset($settings['capath'])) {
- $this->capath = $settings['capath'];
- }
foreach($validSettings as $validSetting) {
if (isset($settings[$validSetting])) {
@@ -259,8 +254,6 @@ class Sabre_DAV_Client {
//CURLOPT_SSL_VERIFYPEER => false,
);
- if ($this->capath != '') $curlSettings[CURLOPT_CAPATH] = $this->capath;
-
switch ($method) {
case 'PUT':
$curlSettings[CURLOPT_PUT] = true;
diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php
index 6b5a0f71d4..483716405a 100644
--- a/apps/bookmarks/ajax/addBookmark.php
+++ b/apps/bookmarks/ajax/addBookmark.php
@@ -28,6 +28,8 @@ $RUNTIME_NOSETUPFS=true;
// Check if we are a user
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+
OCP\JSON::checkAppEnabled('bookmarks');
require_once(OC_App::getAppPath('bookmarks').'/bookmarksHelper.php');
diff --git a/apps/bookmarks/ajax/delBookmark.php b/apps/bookmarks/ajax/delBookmark.php
index 5a067701c9..f40f02ebab 100644
--- a/apps/bookmarks/ajax/delBookmark.php
+++ b/apps/bookmarks/ajax/delBookmark.php
@@ -28,6 +28,8 @@ $RUNTIME_NOSETUPFS=true;
// Check if we are a user
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+
OCP\JSON::checkAppEnabled('bookmarks');
$id = $_POST['id'];
diff --git a/apps/bookmarks/ajax/editBookmark.php b/apps/bookmarks/ajax/editBookmark.php
index 439b680dc2..0b37d161af 100644
--- a/apps/bookmarks/ajax/editBookmark.php
+++ b/apps/bookmarks/ajax/editBookmark.php
@@ -28,6 +28,8 @@ $RUNTIME_NOSETUPFS=true;
// Check if we are a user
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+
OCP\JSON::checkAppEnabled('bookmarks');
$CONFIG_DBTYPE = OCP\Config::getSystemValue( "dbtype", "sqlite" );
diff --git a/apps/bookmarks/lib/bookmarks.php b/apps/bookmarks/lib/bookmarks.php
index e0005968f3..86fba45a50 100644
--- a/apps/bookmarks/lib/bookmarks.php
+++ b/apps/bookmarks/lib/bookmarks.php
@@ -145,5 +145,4 @@ class OC_Bookmarks_Bookmarks{
$result = $query->execute();
return true;
}
-}
-?>
+}
\ No newline at end of file
diff --git a/apps/calendar/appinfo/remote.php b/apps/calendar/appinfo/remote.php
index 7ab546245f..e8f9e80c7a 100644
--- a/apps/calendar/appinfo/remote.php
+++ b/apps/calendar/appinfo/remote.php
@@ -34,6 +34,6 @@ $server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud'));
$server->addPlugin(new Sabre_CalDAV_Plugin());
$server->addPlugin(new Sabre_DAVACL_Plugin());
$server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
-
+$server->addPlugin(new Sabre_CalDAV_ICSExportPlugin());
// And off we go!
$server->exec();
diff --git a/apps/calendar/settings.php b/apps/calendar/settings.php
index a18b1ca9f4..eaa20c6c9b 100644
--- a/apps/calendar/settings.php
+++ b/apps/calendar/settings.php
@@ -10,6 +10,7 @@ $tmpl = new OCP\Template( 'calendar', 'settings');
$timezone=OCP\Config::getUserValue(OCP\USER::getUser(),'calendar','timezone','');
$tmpl->assign('timezone',$timezone);
$tmpl->assign('timezones',DateTimeZone::listIdentifiers());
+$tmpl->assign('calendars', OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()), false);
OCP\Util::addscript('calendar','settings');
diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php
index 6d018f1511..28c357621a 100644
--- a/apps/calendar/templates/settings.php
+++ b/apps/calendar/templates/settings.php
@@ -56,6 +56,12 @@
inc('part.contact');
}
else{
diff --git a/apps/contacts/templates/part.importaddressbook.php b/apps/contacts/templates/part.importaddressbook.php
index 01f8dd77d0..8ceb5f3538 100644
--- a/apps/contacts/templates/part.importaddressbook.php
+++ b/apps/contacts/templates/part.importaddressbook.php
@@ -12,6 +12,7 @@
t('Select address book to import to:') ?> |
diff --git a/apps/files_external/ajax/addMountPoint.php b/apps/files_external/ajax/addMountPoint.php
index 549cb6a342..e08f805942 100644
--- a/apps/files_external/ajax/addMountPoint.php
+++ b/apps/files_external/ajax/addMountPoint.php
@@ -1,6 +1,8 @@
diff --git a/apps/files_external/ajax/addRootCertificate.php b/apps/files_external/ajax/addRootCertificate.php
index 33cd64d2c7..d28a7d24b2 100644
--- a/apps/files_external/ajax/addRootCertificate.php
+++ b/apps/files_external/ajax/addRootCertificate.php
@@ -4,9 +4,25 @@ OCP\JSON::checkAppEnabled('files_external');
$view = \OCP\Files::getStorage("files_external");
$from = $_FILES['rootcert_import']['tmp_name'];
-$to = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").$_FILES['rootcert_import']['name'];
+$path = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").'uploads/';
+if(!file_exists($path)) mkdir($path,0700,true);
+$to = $path.$_FILES['rootcert_import']['name'];
move_uploaded_file($from, $to);
+//check if it is a PEM certificate, otherwise convert it if possible
+$fh = fopen($to, 'r');
+$data = fread($fh, filesize($to));
+fclose($fh);
+if (!strpos($data, 'BEGIN CERTIFICATE')) {
+ $pem = chunk_split(base64_encode($data), 64, "\n");
+ $pem = "-----BEGIN CERTIFICATE-----\n".$pem."-----END CERTIFICATE-----\n";
+ $fh = fopen($to, 'w');
+ fwrite($fh, $pem);
+ fclose($fh);
+}
+
+OC_Mount_Config::createCertificateBundle();
+
header("Location: settings/personal.php");
exit;
?>
\ No newline at end of file
diff --git a/apps/files_external/ajax/removeMountPoint.php b/apps/files_external/ajax/removeMountPoint.php
index b77b306bcb..aa44642620 100644
--- a/apps/files_external/ajax/removeMountPoint.php
+++ b/apps/files_external/ajax/removeMountPoint.php
@@ -1,6 +1,8 @@
diff --git a/apps/files_external/ajax/removeRootCertificate.php b/apps/files_external/ajax/removeRootCertificate.php
index 05f2fdef2d..a00922f421 100644
--- a/apps/files_external/ajax/removeRootCertificate.php
+++ b/apps/files_external/ajax/removeRootCertificate.php
@@ -4,6 +4,7 @@ OCP\JSON::checkAppEnabled('files_external');
$view = \OCP\Files::getStorage("files_external");
$cert = $_POST['cert'];
-$file = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").$cert;
+$file = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").'uploads/'.$cert;
unlink($file);
+OC_Mount_Config::createCertificateBundle();
?>
\ No newline at end of file
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 4e82e6b254..5630df77a9 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -244,7 +244,8 @@ class OC_Mount_Config {
*/
public static function getCertificates() {
$view = \OCP\Files::getStorage('files_external');
- $path=\OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("");
+ $path=\OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").'uploads/';
+ if (!is_dir($path)) mkdir($path);
$result = array();
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
@@ -252,6 +253,30 @@ class OC_Mount_Config {
}
return $result;
}
+
+ /**
+ * creates certificate bundle
+ */
+ public static function createCertificateBundle() {
+ $view = \OCP\Files::getStorage("files_external");
+ $path = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("");
+
+ $certs = OC_Mount_Config::getCertificates();
+ $fh_certs = fopen($path."/rootcerts.crt", 'w');
+ foreach ($certs as $cert) {
+ $file=$path.'/uploads/'.$cert;
+ $fh = fopen($file, "r");
+ $data = fread($fh, filesize($file));
+ fclose($fh);
+ if (strpos($data, 'BEGIN CERTIFICATE')) {
+ fwrite($fh_certs, $data);
+ }
+ }
+
+ fclose($fh_certs);
+
+ return true;
+ }
}
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 32dd26ae6c..3d13518f57 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -36,18 +36,20 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$this->root.='/';
}
- $capath = '';
- if($caview = \OCP\Files::getStorage('files_external')) {
- $capath=\OCP\Config::getSystemValue('datadirectory').$caview->getAbsolutePath("");
- }
$settings = array(
'baseUri' => $this->createBaseUri(),
'userName' => $this->user,
'password' => $this->password,
- 'capath' => $capath,
);
- $this->client = new Sabre_DAV_Client($settings);
+ $this->client = new OC_Connector_Sabre_Client($settings);
+
+ if($caview = \OCP\Files::getStorage('files_external')) {
+ $certPath=\OCP\Config::getSystemValue('datadirectory').$caview->getAbsolutePath("").'rootcerts.crt';
+ if (file_exists($certPath)) {
+ $this->client->addTrustedCertificates($certPath);
+ }
+ }
//create the root folder if necesary
$this->mkdir('');
}
diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php
index 8f8fe8d527..e8bc94790d 100644
--- a/apps/files_external/templates/settings.php
+++ b/apps/files_external/templates/settings.php
@@ -1,4 +1,4 @@
- |