diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-08-15 17:18:46 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-08-31 10:47:50 +0200 |
commit | c1b11571ea53748d57241598dec71750637416cd (patch) | |
tree | c823c19b77fe4aa62142299ffe5df6b6421be63a /lib | |
parent | 298011bf296a4eda62b787bb7c8fbfe30644d488 (diff) | |
download | nextcloud-server-c1b11571ea53748d57241598dec71750637416cd.tar.gz nextcloud-server-c1b11571ea53748d57241598dec71750637416cd.zip |
Move certificate management interface from files_external to core
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/certificatemanager.php | 10 | ||||
-rw-r--r-- | lib/private/l10n.php | 2 | ||||
-rw-r--r-- | lib/public/icertificatemanager.php | 4 |
3 files changed, 9 insertions, 7 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); } diff --git a/lib/public/icertificatemanager.php b/lib/public/icertificatemanager.php index 9ce7d721178..24b8d123634 100644 --- a/lib/public/icertificatemanager.php +++ b/lib/public/icertificatemanager.php @@ -15,14 +15,14 @@ interface ICertificateManager { /** * Returns all certificates trusted by the user * - * @return string[] + * @return \OCP\ICertificate[] */ public function listCertificates(); /** * @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); |