summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-08-15 17:18:46 +0200
committerRobin Appelman <icewind@owncloud.com>2014-08-31 10:47:50 +0200
commitc1b11571ea53748d57241598dec71750637416cd (patch)
treec823c19b77fe4aa62142299ffe5df6b6421be63a /lib/private
parent298011bf296a4eda62b787bb7c8fbfe30644d488 (diff)
downloadnextcloud-server-c1b11571ea53748d57241598dec71750637416cd.tar.gz
nextcloud-server-c1b11571ea53748d57241598dec71750637416cd.zip
Move certificate management interface from files_external to core
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/certificatemanager.php10
-rw-r--r--lib/private/l10n.php2
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/private/certificatemanager.php b/lib/private/certificatemanager.php
index 3a934945786..90a30182c65 100644
--- a/lib/private/certificatemanager.php
+++ b/lib/private/certificatemanager.php
@@ -29,7 +29,7 @@ class CertificateManager implements ICertificateManager {
/**
* Returns all certificates trusted by the user
*
- * @return string[]
+ * @return \OCP\ICertificate[]
*/
public function listCertificates() {
$path = $this->user->getHome() . '/files_external/uploads/';
@@ -45,7 +45,9 @@ class CertificateManager implements ICertificateManager {
return array();
}
while (false !== ($file = readdir($handle))) {
- if ($file != '.' && $file != '..') $result[] = $file;
+ if ($file != '.' && $file != '..') {
+ $result[] = new Certificate(file_get_contents($path . $file), $file);
+ }
}
return $result;
}
@@ -75,7 +77,7 @@ class CertificateManager implements ICertificateManager {
/**
* @param string $certificate the certificate data
* @param string $name the filename for the certificate
- * @return bool
+ * @return bool | \OCP\ICertificate
*/
public function addCertificate($certificate, $name) {
if (!\OC\Files\Filesystem::isValidPath($name)) {
@@ -93,7 +95,7 @@ class CertificateManager implements ICertificateManager {
$file = $this->user->getHome() . '/files_external/uploads/' . $name;
file_put_contents($file, $certificate);
$this->createCertificateBundle();
- return true;
+ return new Certificate($certificate, $name);
} else {
return false;
}
diff --git a/lib/private/l10n.php b/lib/private/l10n.php
index 28b35e92a2f..57886a796cd 100644
--- a/lib/private/l10n.php
+++ b/lib/private/l10n.php
@@ -354,7 +354,7 @@ class OC_L10N implements \OCP\IL10N {
case 'datetime':
case 'time':
if($data instanceof DateTime) {
- return $data->format($this->localizations[$type]);
+ $data = $data->getTimestamp();
} elseif(is_string($data) && !is_numeric($data)) {
$data = strtotime($data);
}