Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/templateeditor.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-05-13 01:32:24 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2015-05-13 01:32:24 +0300
commitb9febcb27cc9703233ef9938d3883dde0de31862 (patch)
tree70c70dfc118a634fd3de025fdb13185e4d7cc11d
parentca09b744ec7af00d1253a5afe331d3e898279104 (diff)
parentdae7300793e967eb139a0608533e4f6630f9bf5d (diff)
Merge pull request #26 from owncloud/no-hardcoded-default-theme
don't hardcode default theme
-rw-r--r--lib/mailtemplate.php32
1 files changed, 25 insertions, 7 deletions
diff --git a/lib/mailtemplate.php b/lib/mailtemplate.php
index 1ea4867..df37e62 100644
--- a/lib/mailtemplate.php
+++ b/lib/mailtemplate.php
@@ -29,11 +29,22 @@ use OCA\TemplateEditor\Http\MailTemplateResponse;
class MailTemplate extends \OC_Template {
+ /** @var string */
private $path;
+
+ /** @var string */
private $theme;
+
+ /** @var array */
private $editableThemes;
+
+ /** @var array */
private $editableTemplates;
+ /**
+ * @param string string $theme
+ * @param string string $path
+ */
public function __construct($theme, $path) {
$this->theme = $theme;
$this->path = $path;
@@ -124,15 +135,22 @@ class MailTemplate extends \OC_Template {
* @return array with available themes. consists of core and subfolders in the themes folder
*/
public static function getEditableThemes() {
- $themes = array(
- 'default' => true
- );
+ $themes = [];
+ $theme = \OC::$server->getConfig()->getSystemValue('theme', null);
+ if (!empty($theme)) {
+ $themes[$theme] = true;
+ }
+
if ($handle = opendir(\OC::$SERVERROOT.'/themes')) {
while (false !== ($entry = readdir($handle))) {
- if ($entry != '.' && $entry != '..' && $entry != 'default') {
- if (is_dir(\OC::$SERVERROOT.'/themes/'.$entry)) {
- $themes[$entry] = true;
- }
+ if ($entry === '.' || $entry === '..') {
+ continue;
+ }
+ if (!is_null($theme) && $entry === $theme) {
+ continue;
+ }
+ if (is_dir(\OC::$SERVERROOT.'/themes/'.$entry)) {
+ $themes[$entry] = true;
}
}
closedir($handle);