diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | COPYING | 2 | ||||
-rw-r--r-- | application/ApplicationUtils.php | 1 | ||||
-rw-r--r-- | application/ThemeUtils.php | 33 | ||||
-rw-r--r-- | application/Updater.php | 29 | ||||
-rw-r--r-- | application/config/ConfigManager.php | 1 | ||||
-rw-r--r-- | application/config/ConfigPhp.php | 3 | ||||
-rw-r--r-- | images/squiggle.png | bin | 684 -> 0 bytes | |||
-rw-r--r-- | index.php | 7 | ||||
-rw-r--r-- | tests/ApplicationUtilsTest.php | 3 | ||||
-rw-r--r-- | tests/ThemeUtilsTest.php | 55 | ||||
-rw-r--r-- | tests/Updater/UpdaterTest.php | 45 | ||||
-rw-r--r-- | tests/utils/config/configJson.json.php | 3 | ||||
-rw-r--r-- | tpl/default/404.html (renamed from tpl/404.html) | 0 | ||||
-rw-r--r-- | tpl/default/addlink.html (renamed from tpl/addlink.html) | 0 | ||||
-rw-r--r-- | tpl/default/changepassword.html (renamed from tpl/changepassword.html) | 0 | ||||
-rw-r--r-- | tpl/default/changetag.html (renamed from tpl/changetag.html) | 2 | ||||
-rw-r--r-- | tpl/default/configure.html (renamed from tpl/configure.html) | 14 | ||||
-rw-r--r-- | tpl/default/css/reset.css (renamed from inc/reset.css) | 0 | ||||
-rw-r--r-- | tpl/default/css/shaarli.css (renamed from inc/shaarli.css) | 6 | ||||
-rw-r--r-- | tpl/default/daily.html (renamed from tpl/daily.html) | 8 | ||||
-rw-r--r-- | tpl/default/dailyrss.html (renamed from tpl/dailyrss.html) | 0 | ||||
-rw-r--r-- | tpl/default/editlink.html (renamed from tpl/editlink.html) | 2 | ||||
-rw-r--r-- | tpl/default/export.bookmarks.html (renamed from tpl/export.bookmarks.html) | 0 | ||||
-rw-r--r-- | tpl/default/export.html (renamed from tpl/export.html) | 0 | ||||
-rw-r--r-- | tpl/default/feed.atom.html (renamed from tpl/feed.atom.html) | 0 | ||||
-rw-r--r-- | tpl/default/feed.rss.html (renamed from tpl/feed.rss.html) | 0 | ||||
-rw-r--r-- | tpl/default/images/50pc_transparent.png (renamed from images/50pc_transparent.png) | bin | 599 -> 599 bytes | |||
-rw-r--r-- | tpl/default/images/Paper_texture_v5_by_bashcorpo_w1000.jpg (renamed from images/Paper_texture_v5_by_bashcorpo_w1000.jpg) | bin | 127449 -> 127449 bytes | |||
-rw-r--r-- | tpl/default/images/calendar.png (renamed from images/calendar.png) | bin | 650 -> 650 bytes | |||
-rw-r--r-- | tpl/default/images/floral_left.png (renamed from images/floral_left.png) | bin | 1284 -> 1284 bytes | |||
-rw-r--r-- | tpl/default/images/floral_right.png (renamed from images/floral_right.png) | bin | 1309 -> 1309 bytes | |||
-rw-r--r-- | tpl/default/images/private.png (renamed from images/private.png) | bin | 813 -> 813 bytes | |||
-rw-r--r-- | tpl/default/images/squiggle.png (renamed from images/squiggle2.png) | bin | 720 -> 720 bytes | |||
-rw-r--r-- | tpl/default/images/squiggle_closing.png (renamed from images/squiggle_closing.png) | bin | 1244 -> 1244 bytes | |||
-rw-r--r-- | tpl/default/images/tag_blue.png (renamed from images/tag_blue.png) | bin | 714 -> 714 bytes | |||
-rw-r--r-- | tpl/default/import.html (renamed from tpl/import.html) | 0 | ||||
-rw-r--r-- | tpl/default/includes.html (renamed from tpl/includes.html) | 6 | ||||
-rw-r--r-- | tpl/default/install.html (renamed from tpl/install.html) | 0 | ||||
-rw-r--r-- | tpl/default/linklist.html (renamed from tpl/linklist.html) | 2 | ||||
-rw-r--r-- | tpl/default/linklist.paging.html (renamed from tpl/linklist.paging.html) | 0 | ||||
-rw-r--r-- | tpl/default/loginform.html (renamed from tpl/loginform.html) | 0 | ||||
-rw-r--r-- | tpl/default/opensearch.html (renamed from tpl/opensearch.html) | 0 | ||||
-rw-r--r-- | tpl/default/page.footer.html (renamed from tpl/page.footer.html) | 0 | ||||
-rw-r--r-- | tpl/default/page.header.html (renamed from tpl/page.header.html) | 0 | ||||
-rw-r--r-- | tpl/default/page.html (renamed from tpl/page.html) | 0 | ||||
-rw-r--r-- | tpl/default/picwall.html (renamed from tpl/picwall.html) | 0 | ||||
-rw-r--r-- | tpl/default/pluginsadmin.html (renamed from tpl/pluginsadmin.html) | 0 | ||||
-rw-r--r-- | tpl/default/readme.txt (renamed from tpl/readme.txt) | 0 | ||||
-rw-r--r-- | tpl/default/tagcloud.html (renamed from tpl/tagcloud.html) | 0 | ||||
-rw-r--r-- | tpl/default/tools.html (renamed from tpl/tools.html) | 0 |
52 files changed, 215 insertions, 16 deletions
@@ -28,3 +28,7 @@ phpmd.html | |||
28 | 28 | ||
29 | # User plugin configuration | 29 | # User plugin configuration |
30 | plugins/*/config.php | 30 | plugins/*/config.php |
31 | |||
32 | # 3rd party themes | ||
33 | tpl/* | ||
34 | !tpl/default | ||
diff --git a/CHANGELOG.md b/CHANGELOG.md index fe775b3e..d3ecc1e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
@@ -7,14 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/). | |||
7 | 7 | ||
8 | ## [v0.9.0](https://github.com/shaarli/Shaarli/releases/tag/v0.9.0) - UNPUBLISHED | 8 | ## [v0.9.0](https://github.com/shaarli/Shaarli/releases/tag/v0.9.0) - UNPUBLISHED |
9 | 9 | ||
10 | **WARNING**: Shaarli now requires PHP 5.5+. | 10 | **WARNING**: Shaarli now requires PHP 5.5+. |
11 | 11 | ||
12 | ### Added | 12 | ### Added |
13 | 13 | ||
14 | - REST API: see [Shaarli API documentation](http://shaarli.github.io/api-documentation/) | 14 | - REST API: see [Shaarli API documentation](http://shaarli.github.io/api-documentation/) |
15 | - The theme can now be selected in the administration page. | ||
15 | 16 | ||
16 | ### Changed | 17 | ### Changed |
17 | 18 | ||
19 | - Default template files are moved to a subfolder (`default`). | ||
20 | |||
18 | ### Fixed | 21 | ### Fixed |
19 | 22 | ||
20 | 23 | ||
@@ -43,7 +43,7 @@ License: CC-BY (http://creativecommons.org/licenses/by/3.0/) | |||
43 | Copyright: (c) 2014 Designmodo | 43 | Copyright: (c) 2014 Designmodo |
44 | Source: http://designmodo.com/linecons-free/ | 44 | Source: http://designmodo.com/linecons-free/ |
45 | 45 | ||
46 | Files: images/floral_left.png, images/floral_right.png, images/squiggle.png, images/squiggle2.png, images/squiggle_closing.png | 46 | Files: images/floral_left.png, images/floral_right.png, images/squiggle.png, images/squiggle_closing.png |
47 | Licence: Public Domain | 47 | Licence: Public Domain |
48 | Source: https://openclipart.org/people/j4p4n/j4p4n_ornimental_bookend_-_left.svg | 48 | Source: https://openclipart.org/people/j4p4n/j4p4n_ornimental_bookend_-_left.svg |
49 | 49 | ||
diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php index 7f963e97..a0f482b0 100644 --- a/application/ApplicationUtils.php +++ b/application/ApplicationUtils.php | |||
@@ -150,6 +150,7 @@ class ApplicationUtils | |||
150 | 'inc', | 150 | 'inc', |
151 | 'plugins', | 151 | 'plugins', |
152 | $conf->get('resource.raintpl_tpl'), | 152 | $conf->get('resource.raintpl_tpl'), |
153 | $conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme'), | ||
153 | ) as $path) { | 154 | ) as $path) { |
154 | if (! is_readable(realpath($path))) { | 155 | if (! is_readable(realpath($path))) { |
155 | $errors[] = '"'.$path.'" directory is not readable'; | 156 | $errors[] = '"'.$path.'" directory is not readable'; |
diff --git a/application/ThemeUtils.php b/application/ThemeUtils.php new file mode 100644 index 00000000..2718ed13 --- /dev/null +++ b/application/ThemeUtils.php | |||
@@ -0,0 +1,33 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Shaarli; | ||
4 | |||
5 | /** | ||
6 | * Class ThemeUtils | ||
7 | * | ||
8 | * Utility functions related to theme management. | ||
9 | * | ||
10 | * @package Shaarli | ||
11 | */ | ||
12 | class ThemeUtils | ||
13 | { | ||
14 | /** | ||
15 | * Get a list of available themes. | ||
16 | * | ||
17 | * It will return the name of any directory present in the template folder. | ||
18 | * | ||
19 | * @param string $tplDir Templates main directory. | ||
20 | * | ||
21 | * @return array List of theme names. | ||
22 | */ | ||
23 | public static function getThemes($tplDir) | ||
24 | { | ||
25 | $allTheme = glob($tplDir.'/*', GLOB_ONLYDIR); | ||
26 | $themes = []; | ||
27 | foreach ($allTheme as $value) { | ||
28 | $themes[] = str_replace($tplDir.'/', '', $value); | ||
29 | } | ||
30 | |||
31 | return $themes; | ||
32 | } | ||
33 | } | ||
diff --git a/application/Updater.php b/application/Updater.php index 38de3350..621c7238 100644 --- a/application/Updater.php +++ b/application/Updater.php | |||
@@ -279,6 +279,35 @@ class Updater | |||
279 | $this->conf->write($this->isLoggedIn); | 279 | $this->conf->write($this->isLoggedIn); |
280 | return true; | 280 | return true; |
281 | } | 281 | } |
282 | |||
283 | /** | ||
284 | * New setting: theme name. If the default theme is used, nothing to do. | ||
285 | * | ||
286 | * If the user uses a custom theme, raintpl_tpl dir is updated to the parent directory, | ||
287 | * and the current theme is set as default in the theme setting. | ||
288 | * | ||
289 | * @return bool true if the update is successful, false otherwise. | ||
290 | */ | ||
291 | public function updateMethodDefaultTheme() | ||
292 | { | ||
293 | // raintpl_tpl isn't the root template directory anymore. | ||
294 | // We run the update only if this folder still contains the template files. | ||
295 | $tplDir = $this->conf->get('resource.raintpl_tpl'); | ||
296 | $tplFile = $tplDir . '/linklist.html'; | ||
297 | if (! file_exists($tplFile)) { | ||
298 | return true; | ||
299 | } | ||
300 | |||
301 | $parent = dirname($tplDir); | ||
302 | $this->conf->set('resource.raintpl_tpl', $parent); | ||
303 | $this->conf->set('resource.theme', trim(str_replace($parent, '', $tplDir), '/')); | ||
304 | $this->conf->write($this->isLoggedIn); | ||
305 | |||
306 | // Dependency injection gore | ||
307 | RainTPL::$tpl_dir = $tplDir; | ||
308 | |||
309 | return true; | ||
310 | } | ||
282 | } | 311 | } |
283 | 312 | ||
284 | /** | 313 | /** |
diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index ca8918b5..a401887c 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php | |||
@@ -299,6 +299,7 @@ class ConfigManager | |||
299 | $this->setEmpty('resource.log', 'data/log.txt'); | 299 | $this->setEmpty('resource.log', 'data/log.txt'); |
300 | $this->setEmpty('resource.update_check', 'data/lastupdatecheck.txt'); | 300 | $this->setEmpty('resource.update_check', 'data/lastupdatecheck.txt'); |
301 | $this->setEmpty('resource.raintpl_tpl', 'tpl/'); | 301 | $this->setEmpty('resource.raintpl_tpl', 'tpl/'); |
302 | $this->setEmpty('resource.theme', 'default'); | ||
302 | $this->setEmpty('resource.raintpl_tmp', 'tmp/'); | 303 | $this->setEmpty('resource.raintpl_tmp', 'tmp/'); |
303 | $this->setEmpty('resource.thumbnails_cache', 'cache'); | 304 | $this->setEmpty('resource.thumbnails_cache', 'cache'); |
304 | $this->setEmpty('resource.page_cache', 'pagecache'); | 305 | $this->setEmpty('resource.page_cache', 'pagecache'); |
diff --git a/application/config/ConfigPhp.php b/application/config/ConfigPhp.php index 9dd9a65d..d7fd4baf 100644 --- a/application/config/ConfigPhp.php +++ b/application/config/ConfigPhp.php | |||
@@ -41,6 +41,7 @@ class ConfigPhp implements ConfigIO | |||
41 | 'resource.log' => 'config.LOG_FILE', | 41 | 'resource.log' => 'config.LOG_FILE', |
42 | 'resource.update_check' => 'config.UPDATECHECK_FILENAME', | 42 | 'resource.update_check' => 'config.UPDATECHECK_FILENAME', |
43 | 'resource.raintpl_tpl' => 'config.RAINTPL_TPL', | 43 | 'resource.raintpl_tpl' => 'config.RAINTPL_TPL', |
44 | 'resource.theme' => 'config.theme', | ||
44 | 'resource.raintpl_tmp' => 'config.RAINTPL_TMP', | 45 | 'resource.raintpl_tmp' => 'config.RAINTPL_TMP', |
45 | 'resource.thumbnails_cache' => 'config.CACHEDIR', | 46 | 'resource.thumbnails_cache' => 'config.CACHEDIR', |
46 | 'resource.page_cache' => 'config.PAGECACHE', | 47 | 'resource.page_cache' => 'config.PAGECACHE', |
@@ -99,7 +100,7 @@ class ConfigPhp implements ConfigIO | |||
99 | $configStr .= '$GLOBALS[\'' . $key . '\'] = ' . var_export($conf[$key], true) . ';' . PHP_EOL; | 100 | $configStr .= '$GLOBALS[\'' . $key . '\'] = ' . var_export($conf[$key], true) . ';' . PHP_EOL; |
100 | } | 101 | } |
101 | } | 102 | } |
102 | 103 | ||
103 | // Store all $conf['config'] | 104 | // Store all $conf['config'] |
104 | foreach ($conf['config'] as $key => $value) { | 105 | foreach ($conf['config'] as $key => $value) { |
105 | $configStr .= '$GLOBALS[\'config\'][\''. $key .'\'] = '.var_export($conf['config'][$key], true).';'. PHP_EOL; | 106 | $configStr .= '$GLOBALS[\'config\'][\''. $key .'\'] = '.var_export($conf['config'][$key], true).';'. PHP_EOL; |
diff --git a/images/squiggle.png b/images/squiggle.png deleted file mode 100644 index a6ce218c..00000000 --- a/images/squiggle.png +++ /dev/null | |||
Binary files differ | |||
@@ -79,6 +79,7 @@ require_once 'application/Utils.php'; | |||
79 | require_once 'application/PluginManager.php'; | 79 | require_once 'application/PluginManager.php'; |
80 | require_once 'application/Router.php'; | 80 | require_once 'application/Router.php'; |
81 | require_once 'application/Updater.php'; | 81 | require_once 'application/Updater.php'; |
82 | use \Shaarli\ThemeUtils; | ||
82 | 83 | ||
83 | // Ensure the PHP version is supported | 84 | // Ensure the PHP version is supported |
84 | try { | 85 | try { |
@@ -122,7 +123,7 @@ if (isset($_COOKIE['shaarli']) && !is_session_id_valid($_COOKIE['shaarli'])) { | |||
122 | $conf = new ConfigManager(); | 123 | $conf = new ConfigManager(); |
123 | $conf->setEmpty('general.timezone', date_default_timezone_get()); | 124 | $conf->setEmpty('general.timezone', date_default_timezone_get()); |
124 | $conf->setEmpty('general.title', 'Shared links on '. escape(index_url($_SERVER))); | 125 | $conf->setEmpty('general.title', 'Shared links on '. escape(index_url($_SERVER))); |
125 | RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl'); // template directory | 126 | RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme').'/'; // template directory |
126 | RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory | 127 | RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory |
127 | 128 | ||
128 | $pluginManager = new PluginManager($conf); | 129 | $pluginManager = new PluginManager($conf); |
@@ -1124,6 +1125,7 @@ function renderPage($conf, $pluginManager, $LINKSDB) | |||
1124 | $conf->set('general.timezone', $tz); | 1125 | $conf->set('general.timezone', $tz); |
1125 | $conf->set('general.title', escape($_POST['title'])); | 1126 | $conf->set('general.title', escape($_POST['title'])); |
1126 | $conf->set('general.header_link', escape($_POST['titleLink'])); | 1127 | $conf->set('general.header_link', escape($_POST['titleLink'])); |
1128 | $conf->set('resource.theme', escape($_POST['theme'])); | ||
1127 | $conf->set('redirector.url', escape($_POST['redirector'])); | 1129 | $conf->set('redirector.url', escape($_POST['redirector'])); |
1128 | $conf->set('security.session_protection_disabled', !empty($_POST['disablesessionprotection'])); | 1130 | $conf->set('security.session_protection_disabled', !empty($_POST['disablesessionprotection'])); |
1129 | $conf->set('privacy.default_private_links', !empty($_POST['privateLinkByDefault'])); | 1131 | $conf->set('privacy.default_private_links', !empty($_POST['privateLinkByDefault'])); |
@@ -1134,6 +1136,7 @@ function renderPage($conf, $pluginManager, $LINKSDB) | |||
1134 | $conf->set('api.secret', escape($_POST['apiSecret'])); | 1136 | $conf->set('api.secret', escape($_POST['apiSecret'])); |
1135 | try { | 1137 | try { |
1136 | $conf->write(isLoggedIn()); | 1138 | $conf->write(isLoggedIn()); |
1139 | invalidateCaches($conf->get('resource.page_cache')); | ||
1137 | } | 1140 | } |
1138 | catch(Exception $e) { | 1141 | catch(Exception $e) { |
1139 | error_log( | 1142 | error_log( |
@@ -1151,6 +1154,8 @@ function renderPage($conf, $pluginManager, $LINKSDB) | |||
1151 | else // Show the configuration form. | 1154 | else // Show the configuration form. |
1152 | { | 1155 | { |
1153 | $PAGE->assign('title', $conf->get('general.title')); | 1156 | $PAGE->assign('title', $conf->get('general.title')); |
1157 | $PAGE->assign('theme', $conf->get('resource.theme')); | ||
1158 | $PAGE->assign('theme_available', ThemeUtils::getThemes($conf->get('resource.raintpl_tpl'))); | ||
1154 | $PAGE->assign('redirector', $conf->get('redirector.url')); | 1159 | $PAGE->assign('redirector', $conf->get('redirector.url')); |
1155 | list($timezone_form, $timezone_js) = generateTimeZoneForm($conf->get('general.timezone')); | 1160 | list($timezone_form, $timezone_js) = generateTimeZoneForm($conf->get('general.timezone')); |
1156 | $PAGE->assign('timezone_form', $timezone_form); | 1161 | $PAGE->assign('timezone_form', $timezone_form); |
diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php index 861b8d4e..634bd0ed 100644 --- a/tests/ApplicationUtilsTest.php +++ b/tests/ApplicationUtilsTest.php | |||
@@ -289,6 +289,7 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase | |||
289 | $conf->set('resource.page_cache', 'pagecache'); | 289 | $conf->set('resource.page_cache', 'pagecache'); |
290 | $conf->set('resource.raintpl_tmp', 'tmp'); | 290 | $conf->set('resource.raintpl_tmp', 'tmp'); |
291 | $conf->set('resource.raintpl_tpl', 'tpl'); | 291 | $conf->set('resource.raintpl_tpl', 'tpl'); |
292 | $conf->set('resource.theme', 'default'); | ||
292 | $conf->set('resource.update_check', 'data/lastupdatecheck.txt'); | 293 | $conf->set('resource.update_check', 'data/lastupdatecheck.txt'); |
293 | 294 | ||
294 | $this->assertEquals( | 295 | $this->assertEquals( |
@@ -312,10 +313,12 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase | |||
312 | $conf->set('resource.page_cache', 'null/pagecache'); | 313 | $conf->set('resource.page_cache', 'null/pagecache'); |
313 | $conf->set('resource.raintpl_tmp', 'null/tmp'); | 314 | $conf->set('resource.raintpl_tmp', 'null/tmp'); |
314 | $conf->set('resource.raintpl_tpl', 'null/tpl'); | 315 | $conf->set('resource.raintpl_tpl', 'null/tpl'); |
316 | $conf->set('resource.raintpl_theme', 'null/tpl/default'); | ||
315 | $conf->set('resource.update_check', 'null/data/lastupdatecheck.txt'); | 317 | $conf->set('resource.update_check', 'null/data/lastupdatecheck.txt'); |
316 | $this->assertEquals( | 318 | $this->assertEquals( |
317 | array( | 319 | array( |
318 | '"null/tpl" directory is not readable', | 320 | '"null/tpl" directory is not readable', |
321 | '"null/tpl/default" directory is not readable', | ||
319 | '"null/cache" directory is not readable', | 322 | '"null/cache" directory is not readable', |
320 | '"null/cache" directory is not writable', | 323 | '"null/cache" directory is not writable', |
321 | '"null/data" directory is not readable', | 324 | '"null/data" directory is not readable', |
diff --git a/tests/ThemeUtilsTest.php b/tests/ThemeUtilsTest.php new file mode 100644 index 00000000..e44564be --- /dev/null +++ b/tests/ThemeUtilsTest.php | |||
@@ -0,0 +1,55 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Shaarli; | ||
4 | |||
5 | /** | ||
6 | * Class ThemeUtilsTest | ||
7 | * | ||
8 | * @package Shaarli | ||
9 | */ | ||
10 | class ThemeUtilsTest extends \PHPUnit_Framework_TestCase | ||
11 | { | ||
12 | /** | ||
13 | * Test getThemes() with existing theme directories. | ||
14 | */ | ||
15 | public function testGetThemes() | ||
16 | { | ||
17 | $themes = ['theme1', 'default', 'Bl1p_- bL0p']; | ||
18 | foreach ($themes as $theme) { | ||
19 | mkdir('sandbox/tpl/'. $theme, 0755, true); | ||
20 | } | ||
21 | |||
22 | // include a file which should be ignored | ||
23 | touch('sandbox/tpl/supertheme'); | ||
24 | |||
25 | $res = ThemeUtils::getThemes('sandbox/tpl/'); | ||
26 | foreach ($res as $theme) { | ||
27 | $this->assertTrue(in_array($theme, $themes)); | ||
28 | } | ||
29 | $this->assertFalse(in_array('supertheme', $res)); | ||
30 | |||
31 | foreach ($themes as $theme) { | ||
32 | rmdir('sandbox/tpl/'. $theme); | ||
33 | } | ||
34 | unlink('sandbox/tpl/supertheme'); | ||
35 | rmdir('sandbox/tpl'); | ||
36 | } | ||
37 | |||
38 | /** | ||
39 | * Test getThemes() without any theme dir. | ||
40 | */ | ||
41 | public function testGetThemesEmpty() | ||
42 | { | ||
43 | mkdir('sandbox/tpl/', 0755, true); | ||
44 | $this->assertEquals([], ThemeUtils::getThemes('sandbox/tpl/')); | ||
45 | rmdir('sandbox/tpl/'); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * Test getThemes() with an invalid path. | ||
50 | */ | ||
51 | public function testGetThemesInvalid() | ||
52 | { | ||
53 | $this->assertEquals([], ThemeUtils::getThemes('nope')); | ||
54 | } | ||
55 | } | ||
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php index 0171daad..1d15cfaa 100644 --- a/tests/Updater/UpdaterTest.php +++ b/tests/Updater/UpdaterTest.php | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | require_once 'application/config/ConfigManager.php'; | 3 | require_once 'application/config/ConfigManager.php'; |
4 | require_once 'tests/Updater/DummyUpdater.php'; | 4 | require_once 'tests/Updater/DummyUpdater.php'; |
5 | require_once 'inc/rain.tpl.class.php'; | ||
5 | 6 | ||
6 | /** | 7 | /** |
7 | * Class UpdaterTest. | 8 | * Class UpdaterTest. |
@@ -421,4 +422,48 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; | |||
421 | $this->assertTrue($updater->updateMethodDatastoreIds()); | 422 | $this->assertTrue($updater->updateMethodDatastoreIds()); |
422 | $this->assertEquals($checksum, hash_file('sha1', self::$testDatastore)); | 423 | $this->assertEquals($checksum, hash_file('sha1', self::$testDatastore)); |
423 | } | 424 | } |
425 | |||
426 | /** | ||
427 | * Test defaultTheme update with default settings: nothing to do. | ||
428 | */ | ||
429 | public function testDefaultThemeWithDefaultSettings() | ||
430 | { | ||
431 | $sandbox = 'sandbox/config'; | ||
432 | copy(self::$configFile . '.json.php', $sandbox . '.json.php'); | ||
433 | $this->conf = new ConfigManager($sandbox); | ||
434 | $updater = new Updater([], [], $this->conf, true); | ||
435 | $this->assertTrue($updater->updateMethodDefaultTheme()); | ||
436 | |||
437 | $this->assertEquals('tpl/', $this->conf->get('resource.raintpl_tpl')); | ||
438 | $this->assertEquals('default', $this->conf->get('resource.theme')); | ||
439 | $this->conf = new ConfigManager($sandbox); | ||
440 | $this->assertEquals('tpl/', $this->conf->get('resource.raintpl_tpl')); | ||
441 | $this->assertEquals('default', $this->conf->get('resource.theme')); | ||
442 | unlink($sandbox . '.json.php'); | ||
443 | } | ||
444 | |||
445 | /** | ||
446 | * Test defaultTheme update with a custom theme in a subfolder | ||
447 | */ | ||
448 | public function testDefaultThemeWithCustomTheme() | ||
449 | { | ||
450 | $theme = 'iamanartist'; | ||
451 | $sandbox = 'sandbox/config'; | ||
452 | copy(self::$configFile . '.json.php', $sandbox . '.json.php'); | ||
453 | $this->conf = new ConfigManager($sandbox); | ||
454 | mkdir('sandbox/'. $theme); | ||
455 | touch('sandbox/'. $theme .'/linklist.html'); | ||
456 | $this->conf->set('resource.raintpl_tpl', 'sandbox/'. $theme .'/'); | ||
457 | $updater = new Updater([], [], $this->conf, true); | ||
458 | $this->assertTrue($updater->updateMethodDefaultTheme()); | ||
459 | |||
460 | $this->assertEquals('sandbox', $this->conf->get('resource.raintpl_tpl')); | ||
461 | $this->assertEquals($theme, $this->conf->get('resource.theme')); | ||
462 | $this->conf = new ConfigManager($sandbox); | ||
463 | $this->assertEquals('sandbox', $this->conf->get('resource.raintpl_tpl')); | ||
464 | $this->assertEquals($theme, $this->conf->get('resource.theme')); | ||
465 | unlink($sandbox . '.json.php'); | ||
466 | unlink('sandbox/'. $theme .'/linklist.html'); | ||
467 | rmdir('sandbox/'. $theme); | ||
468 | } | ||
424 | } | 469 | } |
diff --git a/tests/utils/config/configJson.json.php b/tests/utils/config/configJson.json.php index 06a302e8..13d38c66 100644 --- a/tests/utils/config/configJson.json.php +++ b/tests/utils/config/configJson.json.php | |||
@@ -24,7 +24,8 @@ | |||
24 | }, | 24 | }, |
25 | "resource": { | 25 | "resource": { |
26 | "datastore": "tests\/utils\/config\/datastore.php", | 26 | "datastore": "tests\/utils\/config\/datastore.php", |
27 | "data_dir": "tests\/utils\/config" | 27 | "data_dir": "tests\/utils\/config", |
28 | "raintpl_tpl": "tpl/" | ||
28 | }, | 29 | }, |
29 | "plugins": { | 30 | "plugins": { |
30 | "WALLABAG_VERSION": 1 | 31 | "WALLABAG_VERSION": 1 |
diff --git a/tpl/404.html b/tpl/default/404.html index 53e98e2e..53e98e2e 100644 --- a/tpl/404.html +++ b/tpl/default/404.html | |||
diff --git a/tpl/addlink.html b/tpl/default/addlink.html index da50f45e..da50f45e 100644 --- a/tpl/addlink.html +++ b/tpl/default/addlink.html | |||
diff --git a/tpl/changepassword.html b/tpl/default/changepassword.html index c40daf9d..c40daf9d 100644 --- a/tpl/changepassword.html +++ b/tpl/default/changepassword.html | |||
diff --git a/tpl/changetag.html b/tpl/default/changetag.html index 13cc5cf1..a0df3328 100644 --- a/tpl/changetag.html +++ b/tpl/default/changetag.html | |||
@@ -1,7 +1,7 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | <head>{include="includes"} | 3 | <head>{include="includes"} |
4 | <link type="text/css" rel="stylesheet" href="../inc/awesomplete.css" /> | 4 | <link type="text/css" rel="stylesheet" href="inc/awesomplete.css#" /> |
5 | <script src="inc/awesomplete.min.js#"></script> | 5 | <script src="inc/awesomplete.min.js#"></script> |
6 | </head> | 6 | </head> |
7 | <body onload="document.changetag.fromtag.focus();"> | 7 | <body onload="document.changetag.fromtag.focus();"> |
diff --git a/tpl/configure.html b/tpl/default/configure.html index b4197bf9..5820e6e4 100644 --- a/tpl/configure.html +++ b/tpl/default/configure.html | |||
@@ -19,6 +19,20 @@ | |||
19 | <td><input type="text" name="titleLink" id="titleLink" size="50" value="{$titleLink}"><br/><label | 19 | <td><input type="text" name="titleLink" id="titleLink" size="50" value="{$titleLink}"><br/><label |
20 | for="titleLink">(default value is: ?)</label></td> | 20 | for="titleLink">(default value is: ?)</label></td> |
21 | </tr> | 21 | </tr> |
22 | |||
23 | <tr> | ||
24 | <td><b>Theme:</b></td> | ||
25 | <td> | ||
26 | <select name="theme" id="theme"> | ||
27 | {loop="$theme_available"} | ||
28 | <option value="{$value}" {if="$value===$theme"}selected{/if}> | ||
29 | {$value|ucfirst} | ||
30 | </option> | ||
31 | {/loop} | ||
32 | </select> | ||
33 | </td> | ||
34 | </tr> | ||
35 | |||
22 | <tr> | 36 | <tr> |
23 | <td><b>Timezone:</b></td> | 37 | <td><b>Timezone:</b></td> |
24 | <td>{$timezone_form}</td> | 38 | <td>{$timezone_form}</td> |
diff --git a/inc/reset.css b/tpl/default/css/reset.css index e29699e2..e29699e2 100644 --- a/inc/reset.css +++ b/tpl/default/css/reset.css | |||
diff --git a/inc/shaarli.css b/tpl/default/css/shaarli.css index a24d4b7c..10709b6a 100644 --- a/inc/shaarli.css +++ b/tpl/default/css/shaarli.css | |||
@@ -103,7 +103,7 @@ strong { | |||
103 | } | 103 | } |
104 | 104 | ||
105 | #pageheader #logo { | 105 | #pageheader #logo { |
106 | background-image: url('../images/logo.png'); | 106 | background-image: url('../../../images/logo.png'); |
107 | background-repeat: no-repeat; | 107 | background-repeat: no-repeat; |
108 | float: left; | 108 | float: left; |
109 | margin: 0 10px 0 10px; | 109 | margin: 0 10px 0 10px; |
@@ -803,6 +803,10 @@ div.dailyAbout img { | |||
803 | height: 14px; | 803 | height: 14px; |
804 | } | 804 | } |
805 | 805 | ||
806 | div.dailyEntryPermalink { | ||
807 | float: right; | ||
808 | } | ||
809 | |||
806 | div.dailyTitle { | 810 | div.dailyTitle { |
807 | font-weight: bold; | 811 | font-weight: bold; |
808 | font-size: 44pt; | 812 | font-size: 44pt; |
diff --git a/tpl/daily.html b/tpl/default/daily.html index eba0af3b..e86e90b1 100644 --- a/tpl/daily.html +++ b/tpl/default/daily.html | |||
@@ -28,9 +28,9 @@ | |||
28 | </div> | 28 | </div> |
29 | 29 | ||
30 | <div class="dailyTitle"> | 30 | <div class="dailyTitle"> |
31 | <img src="../images/floral_left.png" width="51" height="50" class="nomobile" alt="floral_left"> | 31 | <img src="images/floral_left.png" width="51" height="50" class="nomobile" alt="floral_left"> |
32 | The Daily Shaarli | 32 | The Daily Shaarli |
33 | <img src="../images/floral_right.png" width="51" height="50" class="nomobile" alt="floral_right"> | 33 | <img src="images/floral_right.png" width="51" height="50" class="nomobile" alt="floral_right"> |
34 | </div> | 34 | </div> |
35 | 35 | ||
36 | <div class="dailyDate"> | 36 | <div class="dailyDate"> |
@@ -50,7 +50,7 @@ | |||
50 | <div class="dailyEntry"> | 50 | <div class="dailyEntry"> |
51 | <div class="dailyEntryPermalink"> | 51 | <div class="dailyEntryPermalink"> |
52 | <a href="?{$value.shorturl}"> | 52 | <a href="?{$value.shorturl}"> |
53 | <img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink"> | 53 | <img src="images/squiggle.png" width="25" height="26" title="permalink" alt="permalink"> |
54 | </a> | 54 | </a> |
55 | </div> | 55 | </div> |
56 | {if="!$hide_timestamps || isLoggedIn()"} | 56 | {if="!$hide_timestamps || isLoggedIn()"} |
@@ -94,7 +94,7 @@ | |||
94 | {$value} | 94 | {$value} |
95 | {/loop} | 95 | {/loop} |
96 | </div> | 96 | </div> |
97 | <div id="closing"><img src="../images/squiggle_closing.png" width="66" height="61" alt="-"></div> | 97 | <div id="closing"><img src="images/squiggle_closing.png" width="66" height="61" alt="-"></div> |
98 | </div> | 98 | </div> |
99 | {include="page.footer"} | 99 | {include="page.footer"} |
100 | </body> | 100 | </body> |
diff --git a/tpl/dailyrss.html b/tpl/default/dailyrss.html index ddbd6c5e..ddbd6c5e 100644 --- a/tpl/dailyrss.html +++ b/tpl/default/dailyrss.html | |||
diff --git a/tpl/editlink.html b/tpl/default/editlink.html index 870cc168..d3f99fe6 100644 --- a/tpl/editlink.html +++ b/tpl/default/editlink.html | |||
@@ -1,7 +1,7 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | <head>{include="includes"} | 3 | <head>{include="includes"} |
4 | <link type="text/css" rel="stylesheet" href="../inc/awesomplete.css" /> | 4 | <link type="text/css" rel="stylesheet" href="inc/awesomplete.css#" /> |
5 | </head> | 5 | </head> |
6 | <body | 6 | <body |
7 | {if="$link.title==''"}onload="document.linkform.lf_title.focus();" | 7 | {if="$link.title==''"}onload="document.linkform.lf_title.focus();" |
diff --git a/tpl/export.bookmarks.html b/tpl/default/export.bookmarks.html index 127a5c20..127a5c20 100644 --- a/tpl/export.bookmarks.html +++ b/tpl/default/export.bookmarks.html | |||
diff --git a/tpl/export.html b/tpl/default/export.html index 67c3d05f..67c3d05f 100644 --- a/tpl/export.html +++ b/tpl/default/export.html | |||
diff --git a/tpl/feed.atom.html b/tpl/default/feed.atom.html index 49798e85..49798e85 100644 --- a/tpl/feed.atom.html +++ b/tpl/default/feed.atom.html | |||
diff --git a/tpl/feed.rss.html b/tpl/default/feed.rss.html index ee3fef88..ee3fef88 100644 --- a/tpl/feed.rss.html +++ b/tpl/default/feed.rss.html | |||
diff --git a/images/50pc_transparent.png b/tpl/default/images/50pc_transparent.png index 8d8f99de..8d8f99de 100644 --- a/images/50pc_transparent.png +++ b/tpl/default/images/50pc_transparent.png | |||
Binary files differ | |||
diff --git a/images/Paper_texture_v5_by_bashcorpo_w1000.jpg b/tpl/default/images/Paper_texture_v5_by_bashcorpo_w1000.jpg index dd8e67ac..dd8e67ac 100644 --- a/images/Paper_texture_v5_by_bashcorpo_w1000.jpg +++ b/tpl/default/images/Paper_texture_v5_by_bashcorpo_w1000.jpg | |||
Binary files differ | |||
diff --git a/images/calendar.png b/tpl/default/images/calendar.png index 81c74519..81c74519 100644 --- a/images/calendar.png +++ b/tpl/default/images/calendar.png | |||
Binary files differ | |||
diff --git a/images/floral_left.png b/tpl/default/images/floral_left.png index f09a861d..f09a861d 100644 --- a/images/floral_left.png +++ b/tpl/default/images/floral_left.png | |||
Binary files differ | |||
diff --git a/images/floral_right.png b/tpl/default/images/floral_right.png index 0dfb6112..0dfb6112 100644 --- a/images/floral_right.png +++ b/tpl/default/images/floral_right.png | |||
Binary files differ | |||
diff --git a/images/private.png b/tpl/default/images/private.png index 8919d658..8919d658 100644 --- a/images/private.png +++ b/tpl/default/images/private.png | |||
Binary files differ | |||
diff --git a/images/squiggle2.png b/tpl/default/images/squiggle.png index c795f0a3..c795f0a3 100644 --- a/images/squiggle2.png +++ b/tpl/default/images/squiggle.png | |||
Binary files differ | |||
diff --git a/images/squiggle_closing.png b/tpl/default/images/squiggle_closing.png index 3f9d02b1..3f9d02b1 100644 --- a/images/squiggle_closing.png +++ b/tpl/default/images/squiggle_closing.png | |||
Binary files differ | |||
diff --git a/images/tag_blue.png b/tpl/default/images/tag_blue.png index 7ec902fc..7ec902fc 100644 --- a/images/tag_blue.png +++ b/tpl/default/images/tag_blue.png | |||
Binary files differ | |||
diff --git a/tpl/import.html b/tpl/default/import.html index 071e1160..071e1160 100644 --- a/tpl/import.html +++ b/tpl/default/import.html | |||
diff --git a/tpl/includes.html b/tpl/default/includes.html index 7b2997ce..c3b837f5 100644 --- a/tpl/includes.html +++ b/tpl/default/includes.html | |||
@@ -6,9 +6,9 @@ | |||
6 | <link rel="alternate" type="application/rss+xml" href="{$feedurl}?do=rss{$searchcrits}#" title="RSS Feed" /> | 6 | <link rel="alternate" type="application/rss+xml" href="{$feedurl}?do=rss{$searchcrits}#" title="RSS Feed" /> |
7 | <link rel="alternate" type="application/atom+xml" href="{$feedurl}?do=atom{$searchcrits}#" title="ATOM Feed" /> | 7 | <link rel="alternate" type="application/atom+xml" href="{$feedurl}?do=atom{$searchcrits}#" title="ATOM Feed" /> |
8 | <link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" /> | 8 | <link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" /> |
9 | <link type="text/css" rel="stylesheet" href="../inc/reset.css" /> | 9 | <link type="text/css" rel="stylesheet" href="css/reset.css" /> |
10 | <link type="text/css" rel="stylesheet" href="../inc/shaarli.css" /> | 10 | <link type="text/css" rel="stylesheet" href="css/shaarli.css" /> |
11 | {if="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="../inc/user.css" />{/if} | 11 | {if="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="inc/user.css#" />{/if} |
12 | {loop="$plugins_includes.css_files"} | 12 | {loop="$plugins_includes.css_files"} |
13 | <link type="text/css" rel="stylesheet" href="{$value}#"/> | 13 | <link type="text/css" rel="stylesheet" href="{$value}#"/> |
14 | {/loop} | 14 | {/loop} |
diff --git a/tpl/install.html b/tpl/default/install.html index 42874dcd..42874dcd 100644 --- a/tpl/install.html +++ b/tpl/default/install.html | |||
diff --git a/tpl/linklist.html b/tpl/default/linklist.html index d4232342..5accc92f 100644 --- a/tpl/linklist.html +++ b/tpl/default/linklist.html | |||
@@ -1,7 +1,7 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | <head> | 3 | <head> |
4 | <link type="text/css" rel="stylesheet" href="../inc/awesomplete.css" /> | 4 | <link type="text/css" rel="stylesheet" href="inc/awesomplete.css#" /> |
5 | {include="includes"} | 5 | {include="includes"} |
6 | </head> | 6 | </head> |
7 | <body> | 7 | <body> |
diff --git a/tpl/linklist.paging.html b/tpl/default/linklist.paging.html index 86019c01..86019c01 100644 --- a/tpl/linklist.paging.html +++ b/tpl/default/linklist.paging.html | |||
diff --git a/tpl/loginform.html b/tpl/default/loginform.html index 84176385..84176385 100644 --- a/tpl/loginform.html +++ b/tpl/default/loginform.html | |||
diff --git a/tpl/opensearch.html b/tpl/default/opensearch.html index 3fcc30b7..3fcc30b7 100644 --- a/tpl/opensearch.html +++ b/tpl/default/opensearch.html | |||
diff --git a/tpl/page.footer.html b/tpl/default/page.footer.html index 006d1d68..006d1d68 100644 --- a/tpl/page.footer.html +++ b/tpl/default/page.footer.html | |||
diff --git a/tpl/page.header.html b/tpl/default/page.header.html index cce61ec4..cce61ec4 100644 --- a/tpl/page.header.html +++ b/tpl/default/page.header.html | |||
diff --git a/tpl/page.html b/tpl/default/page.html index 834915ec..834915ec 100644 --- a/tpl/page.html +++ b/tpl/default/page.html | |||
diff --git a/tpl/picwall.html b/tpl/default/picwall.html index 4e227e37..4e227e37 100644 --- a/tpl/picwall.html +++ b/tpl/default/picwall.html | |||
diff --git a/tpl/pluginsadmin.html b/tpl/default/pluginsadmin.html index ead1734e..ead1734e 100644 --- a/tpl/pluginsadmin.html +++ b/tpl/default/pluginsadmin.html | |||
diff --git a/tpl/readme.txt b/tpl/default/readme.txt index b18deaed..b18deaed 100644 --- a/tpl/readme.txt +++ b/tpl/default/readme.txt | |||
diff --git a/tpl/tagcloud.html b/tpl/default/tagcloud.html index 05e45273..05e45273 100644 --- a/tpl/tagcloud.html +++ b/tpl/default/tagcloud.html | |||
diff --git a/tpl/tools.html b/tpl/default/tools.html index e06d239d..e06d239d 100644 --- a/tpl/tools.html +++ b/tpl/default/tools.html | |||