From d33763a409bbc11198e56764f43093bb18eeb91f Mon Sep 17 00:00:00 2001
From: Knah Tsaeb Edit
updates: File path for the ran updates file.
log: Log file path.
update_check: Last update check file path.
-raintpl_tpl: Templates directory.
+theme: Templates directory.
raintpl_tmp: Template engine cache directory.
thumbnails_cache: Thumbnails cache directory.
page_cache: Shaarli's internal cache directory.
@@ -220,7 +220,7 @@ It might be useful if your IP adress often changes.
"log": "data\/log.txt",
"update_check": "data\/lastupdatecheck.txt",
"raintpl_tmp": "tmp\/",
- "raintpl_tpl": "tpl\/",
+ "theme": "tpl\/",
"thumbnails_cache": "cache",
"page_cache": "pagecache"
},
diff --git a/doc/Shaarli-configuration.md b/doc/Shaarli-configuration.md
index 4a783c0..430bc5f 100644
--- a/doc/Shaarli-configuration.md
+++ b/doc/Shaarli-configuration.md
@@ -73,7 +73,7 @@ It might be useful if your IP adress often changes.
**updates**: File path for the ran updates file.
**log**: Log file path.
**update_check**: Last update check file path.
-**raintpl_tpl**: Templates directory.
+**theme**: Templates directory.
**raintpl_tmp**: Template engine cache directory.
**thumbnails_cache**: Thumbnails cache directory.
**page_cache**: Shaarli's internal cache directory.
@@ -134,7 +134,7 @@ It might be useful if your IP adress often changes.
"log": "data\/log.txt",
"update_check": "data\/lastupdatecheck.txt",
"raintpl_tmp": "tmp\/",
- "raintpl_tpl": "tpl\/",
+ "theme": "tpl\/",
"thumbnails_cache": "cache",
"page_cache": "pagecache"
},
diff --git a/doc/Theming.html b/doc/Theming.html
index 13e6acf..13dda02 100644
--- a/doc/Theming.html
+++ b/doc/Theming.html
@@ -120,7 +120,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
my-template/
directory under the tpl/
dir, containing directly all the template files.data/config.php
to have Shaarli use this template, e.g.$GLOBALS['config'['RAINTPL_TPL'] = 'tpl/my-template/';]('RAINTPL_TPL']-=-'tpl/my-template/';.html)
$GLOBALS['config'['theme'] = 'tpl/my-template/';]('theme']-=-'tpl/my-template/';.html)
Community themes & templates
diff --git a/doc/Theming.md b/doc/Theming.md
index 7fb8d92..9287d12 100644
--- a/doc/Theming.md
+++ b/doc/Theming.md
@@ -18,7 +18,7 @@ _WARNING - This feature is currently being worked on and will be improved in the
- There should now be a `my-template/` directory under the `tpl/` dir, containing directly all the template files.
- Edit `data/config.php` to have Shaarli use this template, e.g.
```php
-$GLOBALS['config'['RAINTPL_TPL'] = 'tpl/my-template/';]('RAINTPL_TPL']-=-'tpl/my-template/';.html)
+$GLOBALS['config'['theme'] = 'tpl/my-template/';]('theme']-=-'tpl/my-template/';.html)
```
## Community themes & templates
diff --git a/index.php b/index.php
index 5366cb0..16d1e46 100644
--- a/index.php
+++ b/index.php
@@ -122,12 +122,12 @@ if (isset($_COOKIE['shaarli']) && !is_session_id_valid($_COOKIE['shaarli'])) {
$conf = new ConfigManager();
$conf->setEmpty('general.timezone', date_default_timezone_get());
$conf->setEmpty('general.title', 'Shared links on '. escape(index_url($_SERVER)));
-RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl'); // template directory
+$conf->setEmpty('resource.theme', 'Default');
+RainTPL::$tpl_dir = 'tpl/'.$conf->get('resource.theme').'/'; // template directory
RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory
$pluginManager = new PluginManager($conf);
$pluginManager->load($conf->get('general.enabled_plugins'));
-
date_default_timezone_set($conf->get('general.timezone', 'UTC'));
ob_start(); // Output buffering for the page cache.
@@ -1148,6 +1148,7 @@ function renderPage($conf, $pluginManager)
$conf->set('general.timezone', $tz);
$conf->set('general.title', escape($_POST['title']));
$conf->set('general.header_link', escape($_POST['titleLink']));
+ $conf->set('resource.theme', escape($_POST['theme']));
$conf->set('redirector.url', escape($_POST['redirector']));
$conf->set('security.session_protection_disabled', !empty($_POST['disablesessionprotection']));
$conf->set('privacy.default_private_links', !empty($_POST['privateLinkByDefault']));
@@ -1173,6 +1174,8 @@ function renderPage($conf, $pluginManager)
else // Show the configuration form.
{
$PAGE->assign('title', $conf->get('general.title'));
+ $PAGE->assign('theme', $conf->get('resource.theme'));
+ $PAGE->assign('theme_avaible', getAllTheme());
$PAGE->assign('redirector', $conf->get('redirector.url'));
list($timezone_form, $timezone_js) = generateTimeZoneForm($conf->get('general.timezone'));
$PAGE->assign('timezone_form', $timezone_form);
diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php
index 861b8d4..c80e134 100644
--- a/tests/ApplicationUtilsTest.php
+++ b/tests/ApplicationUtilsTest.php
@@ -288,7 +288,7 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase
$conf->set('resource.log', 'data/log.txt');
$conf->set('resource.page_cache', 'pagecache');
$conf->set('resource.raintpl_tmp', 'tmp');
- $conf->set('resource.raintpl_tpl', 'tpl');
+ $conf->set('resource.theme', 'tpl');
$conf->set('resource.update_check', 'data/lastupdatecheck.txt');
$this->assertEquals(
@@ -311,7 +311,7 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase
$conf->set('resource.log', 'null/data/log.txt');
$conf->set('resource.page_cache', 'null/pagecache');
$conf->set('resource.raintpl_tmp', 'null/tmp');
- $conf->set('resource.raintpl_tpl', 'null/tpl');
+ $conf->set('resource.theme', 'null/tpl');
$conf->set('resource.update_check', 'null/data/lastupdatecheck.txt');
$this->assertEquals(
array(
diff --git a/tpl/404.html b/tpl/Default/404.html
similarity index 100%
rename from tpl/404.html
rename to tpl/Default/404.html
diff --git a/tpl/addlink.html b/tpl/Default/addlink.html
similarity index 100%
rename from tpl/addlink.html
rename to tpl/Default/addlink.html
diff --git a/tpl/changepassword.html b/tpl/Default/changepassword.html
similarity index 100%
rename from tpl/changepassword.html
rename to tpl/Default/changepassword.html
diff --git a/tpl/changetag.html b/tpl/Default/changetag.html
similarity index 100%
rename from tpl/changetag.html
rename to tpl/Default/changetag.html
diff --git a/tpl/configure.html b/tpl/Default/configure.html
similarity index 86%
rename from tpl/configure.html
rename to tpl/Default/configure.html
index 983bcd0..9b3feae 100644
--- a/tpl/configure.html
+++ b/tpl/Default/configure.html
@@ -19,6 +19,23 @@
+
+
+
+
Theme:
+
+
+
+
+
Timezone:
{$timezone_form}
diff --git a/tpl/daily.html b/tpl/Default/daily.html
similarity index 88%
rename from tpl/daily.html
rename to tpl/Default/daily.html
index b82ad48..217e492 100644
--- a/tpl/daily.html
+++ b/tpl/Default/daily.html
@@ -28,9 +28,9 @@
diff --git a/tpl/dailyrss.html b/tpl/Default/dailyrss.html similarity index 100% rename from tpl/dailyrss.html rename to tpl/Default/dailyrss.html diff --git a/tpl/editlink.html b/tpl/Default/editlink.html similarity index 100% rename from tpl/editlink.html rename to tpl/Default/editlink.html diff --git a/tpl/export.bookmarks.html b/tpl/Default/export.bookmarks.html similarity index 100% rename from tpl/export.bookmarks.html rename to tpl/Default/export.bookmarks.html diff --git a/tpl/export.html b/tpl/Default/export.html similarity index 100% rename from tpl/export.html rename to tpl/Default/export.html diff --git a/tpl/feed.atom.html b/tpl/Default/feed.atom.html similarity index 100% rename from tpl/feed.atom.html rename to tpl/Default/feed.atom.html diff --git a/tpl/feed.rss.html b/tpl/Default/feed.rss.html similarity index 100% rename from tpl/feed.rss.html rename to tpl/Default/feed.rss.html diff --git a/tpl/import.html b/tpl/Default/import.html similarity index 100% rename from tpl/import.html rename to tpl/Default/import.html diff --git a/tpl/includes.html b/tpl/Default/includes.html similarity index 83% rename from tpl/includes.html rename to tpl/Default/includes.html index 7b2997c..50298da 100644 --- a/tpl/includes.html +++ b/tpl/Default/includes.html @@ -6,9 +6,9 @@ - - -{if="is_file('inc/user.css')"}{/if} + + +{if="is_file('inc/user.css')"}{/if} {loop="$plugins_includes.css_files"} {/loop} diff --git a/tpl/install.html b/tpl/Default/install.html similarity index 100% rename from tpl/install.html rename to tpl/Default/install.html diff --git a/tpl/linklist.html b/tpl/Default/linklist.html similarity index 98% rename from tpl/linklist.html rename to tpl/Default/linklist.html index ddfd729..a06cec3 100644 --- a/tpl/linklist.html +++ b/tpl/Default/linklist.html @@ -1,7 +1,7 @@
- + {include="includes"}