From: ArthurHoaro Date: Sun, 15 Jan 2017 15:49:50 +0000 (+0100) Subject: Merge pull request #727 from ArthurHoaro/api/getlinks X-Git-Tag: v0.9.0~67 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=9977c418d6d0de9e22e4ec276e7d476e184b5d01;hp=c3b00963fe22479e87998c82bc83827a54c8d972;p=github%2Fshaarli%2FShaarli.git Merge pull request #727 from ArthurHoaro/api/getlinks REST API: implement getLinks service --- diff --git a/.gitattributes b/.gitattributes index d753b1db..059fbb18 100644 --- a/.gitattributes +++ b/.gitattributes @@ -19,6 +19,7 @@ Dockerfile text # Exclude from Git archives .gitattributes export-ignore +.github export-ignore .gitignore export-ignore .travis.yml export-ignore doc/**/*.json export-ignore diff --git a/.github/mailmap b/.github/mailmap new file mode 100644 index 00000000..41d91e47 --- /dev/null +++ b/.github/mailmap @@ -0,0 +1,13 @@ +ArthurHoaro +Florian Eula feula +Florian Eula +Nicolas Danelon nicolasm +Nicolas Danelon +Nicolas Danelon +Nicolas Danelon +Sébastien Sauvage +Timo Van Neerden +Timo Van Neerden lehollandaisvolant +VirtualTam +VirtualTam +VirtualTam diff --git a/.gitignore b/.gitignore index 9121905d..19f3dc83 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,7 @@ phpmd.html # User plugin configuration plugins/*/config.php + +# 3rd party themes +tpl/* +!tpl/default diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..aa041ae9 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,40 @@ + 327 ArthurHoaro + 188 VirtualTam + 132 nodiscc + 56 Sébastien Sauvage + 15 Florian Eula + 13 Emilien Klein + 12 Nicolas Danelon + 7 Christophe HENRY + 4 Alexandre Alapetite + 4 David Sferruzza + 3 Teromene + 2 Chris Kuethe + 2 Knah Tsaeb + 2 Mathieu Chabanon + 2 Miloš Jovanović + 2 Qwerty + 2 Timo Van Neerden + 2 julienCXX + 2 kalvn + 1 Adrien Oliva + 1 Alexis J + 1 BoboTiG + 1 Bronco + 1 D Low + 1 Dimtion + 1 Fanch + 1 Felix Bartels + 1 Felix Kästner + 1 Florian Voigt + 1 Gary Marigliano + 1 Guillaume Virlet + 1 Jonathan Druart + 1 Julien Pivotto + 1 Kevin Canévet + 1 Knah Tsaeb + 1 Lionel Martin + 1 Marsup + 1 Sbgodin + 1 TsT + 1 dimtion 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/). ## [v0.9.0](https://github.com/shaarli/Shaarli/releases/tag/v0.9.0) - UNPUBLISHED -**WARNING**: Shaarli now requires PHP 5.5+. +**WARNING**: Shaarli now requires PHP 5.5+. ### Added - REST API: see [Shaarli API documentation](http://shaarli.github.io/api-documentation/) +- The theme can now be selected in the administration page. ### Changed +- Default template files are moved to a subfolder (`default`). + ### Fixed diff --git a/COPYING b/COPYING index 22929463..4bbdf2b3 100644 --- a/COPYING +++ b/COPYING @@ -1,33 +1,7 @@ Files: * License: zlib/libpng Copyright: (c) 2011-2015 Sébastien SAUVAGE - (c) 2011-2015 Alexandre Alapetite - (c) 2011-2015 David Sferruzza - (c) 2011-2015 Christophe HENRY - (c) 2011-2015 Mathieu Chabanon - (c) 2011-2015 BoboTiG - (c) 2011-2015 Bronco - (c) 2011-2015 Emilien Klein - (c) 2011-2015 Knah Tsaeb - (c) 2011-2015 Lionel Martin - (c) 2011-2015 lehollandaisvolant - (c) 2011-2015 timo van neerden - (c) 2011-2015 nodiscc - (c) 2011-2015 Florian Eula - (c) 2011-2015 Arthur Hoaro - (c) 2011-2015 Aurélien "VirtualTam" Tamisier - (c) 2011-2015 qwertygc - (c) 2011-2015 idleman - (c) 2015 Alexis Ju - (c) 2015 dimtion - (c) 2015 Fanch - (c) 2015 Guillaume Virlet - (c) 2015 Felix Bartels - (c) 2015 Marsup - (c) 2015 Miloš Jovanović - (c) 2015 Nicolás Danelón - (c) 2015 TsT - + (c) 2011-2017 The Shaarli Community, see AUTHORS Files: inc/reset.css License: BSD (http://opensource.org/licenses/BSD-3-Clause) @@ -43,7 +17,7 @@ License: CC-BY (http://creativecommons.org/licenses/by/3.0/) Copyright: (c) 2014 Designmodo Source: http://designmodo.com/linecons-free/ -Files: images/floral_left.png, images/floral_right.png, images/squiggle.png, images/squiggle2.png, images/squiggle_closing.png +Files: images/floral_left.png, images/floral_right.png, images/squiggle.png, images/squiggle_closing.png Licence: Public Domain Source: https://openclipart.org/people/j4p4n/j4p4n_ornimental_bookend_-_left.svg diff --git a/Makefile b/Makefile index 60aec9a0..f3065b77 100644 --- a/Makefile +++ b/Makefile @@ -169,6 +169,12 @@ clean: @git clean -df @rm -rf sandbox +### generate the AUTHORS file from Git commit information +authors: + @cp .github/mailmap .mailmap + @git shortlog -sne > AUTHORS + @rm .mailmap + ### generate Doxygen documentation doxygen: clean @rm -rf doxygen @@ -214,4 +220,4 @@ htmlpages: -o doc/$$base.html $$file; \ done; -htmldoc: doc htmlsidebar htmlpages +htmldoc: authors doc htmlsidebar htmlpages 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 'inc', 'plugins', $conf->get('resource.raintpl_tpl'), + $conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme'), ) as $path) { if (! is_readable(realpath($path))) { $errors[] = '"'.$path.'" directory is not readable'; diff --git a/application/Base64Url.php b/application/Base64Url.php new file mode 100644 index 00000000..61590e43 --- /dev/null +++ b/application/Base64Url.php @@ -0,0 +1,34 @@ +cacheDir = $cacheDir; - $this->url = $url; $this->filename = $this->cacheDir.'/'.sha1($url).'.cache'; $this->shouldBeCached = $shouldBeCached; } diff --git a/application/HttpUtils.php b/application/HttpUtils.php index e8fc1f5d..a81f9056 100644 --- a/application/HttpUtils.php +++ b/application/HttpUtils.php @@ -122,7 +122,7 @@ function get_http_response($url, $timeout = 30, $maxBytes = 4194304) $content = substr($response, $headSize); $headers = array(); foreach (preg_split('~[\r\n]+~', $rawHeadersLastRedir) as $line) { - if (empty($line) or ctype_space($line)) { + if (empty($line) || ctype_space($line)) { continue; } $splitLine = explode(': ', $line, 2); diff --git a/application/LinkUtils.php b/application/LinkUtils.php index cf58f808..976474de 100644 --- a/application/LinkUtils.php +++ b/application/LinkUtils.php @@ -89,7 +89,9 @@ function count_private($links) { $cpt = 0; foreach ($links as $link) { - $cpt = $link['private'] == true ? $cpt + 1 : $cpt; + if ($link['private']) { + $cpt += 1; + } } return $cpt; diff --git a/application/PageBuilder.php b/application/PageBuilder.php index 32c7f9f1..544aba7c 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php @@ -25,7 +25,7 @@ class PageBuilder * * @param ConfigManager $conf Configuration Manager instance (reference). */ - function __construct(&$conf) + public function __construct(&$conf) { $this->tpl = false; $this->conf = $conf; 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 @@ +methods == null) { + if ($this->methods === null) { throw new UpdaterException('Couldn\'t retrieve Updater class methods.'); } @@ -279,6 +279,51 @@ class Updater $this->conf->write($this->isLoggedIn); return true; } + + /** + * New setting: theme name. If the default theme is used, nothing to do. + * + * If the user uses a custom theme, raintpl_tpl dir is updated to the parent directory, + * and the current theme is set as default in the theme setting. + * + * @return bool true if the update is successful, false otherwise. + */ + public function updateMethodDefaultTheme() + { + // raintpl_tpl isn't the root template directory anymore. + // We run the update only if this folder still contains the template files. + $tplDir = $this->conf->get('resource.raintpl_tpl'); + $tplFile = $tplDir . '/linklist.html'; + if (! file_exists($tplFile)) { + return true; + } + + $parent = dirname($tplDir); + $this->conf->set('resource.raintpl_tpl', $parent); + $this->conf->set('resource.theme', trim(str_replace($parent, '', $tplDir), '/')); + $this->conf->write($this->isLoggedIn); + + // Dependency injection gore + RainTPL::$tpl_dir = $tplDir; + + return true; + } + + /** + * Move the file to inc/user.css to data/user.css. + * + * Note: Due to hardcoded paths, it's not unit testable. But one line of code should be fine. + * + * @return bool true if the update is successful, false otherwise. + */ + public function updateMethodMoveUserCss() + { + if (! is_file('inc/user.css')) { + return true; + } + + return rename('inc/user.css', 'data/user.css'); + } } /** diff --git a/application/api/ApiMiddleware.php b/application/api/ApiMiddleware.php index 162e88e0..522091ca 100644 --- a/application/api/ApiMiddleware.php +++ b/application/api/ApiMiddleware.php @@ -98,8 +98,7 @@ class ApiMiddleware * @throws ApiAuthorizationException The token couldn't be validated. */ protected function checkToken($request) { - $jwt = $request->getHeaderLine('jwt'); - if (empty($jwt)) { + if (! $request->hasHeader('Authorization')) { throw new ApiAuthorizationException('JWT token not provided'); } @@ -107,7 +106,13 @@ class ApiMiddleware throw new ApiAuthorizationException('Token secret must be set in Shaarli\'s administration'); } - ApiUtils::validateJwtToken($jwt, $this->conf->get('api.secret')); + $authorization = $request->getHeaderLine('Authorization'); + + if (! preg_match('/^Bearer (.*)/i', $authorization, $matches)) { + throw new ApiAuthorizationException('Invalid JWT header'); + } + + ApiUtils::validateJwtToken($matches[1], $this->conf->get('api.secret')); } /** diff --git a/application/api/ApiUtils.php b/application/api/ApiUtils.php index d0242919..d4015865 100644 --- a/application/api/ApiUtils.php +++ b/application/api/ApiUtils.php @@ -1,13 +1,11 @@ setEmpty('resource.log', 'data/log.txt'); $this->setEmpty('resource.update_check', 'data/lastupdatecheck.txt'); $this->setEmpty('resource.raintpl_tpl', 'tpl/'); + $this->setEmpty('resource.theme', 'default'); $this->setEmpty('resource.raintpl_tmp', 'tmp/'); $this->setEmpty('resource.thumbnails_cache', 'cache'); $this->setEmpty('resource.page_cache', 'pagecache'); diff --git a/application/config/ConfigPhp.php b/application/config/ConfigPhp.php index 27187b66..d7fd4baf 100644 --- a/application/config/ConfigPhp.php +++ b/application/config/ConfigPhp.php @@ -41,6 +41,7 @@ class ConfigPhp implements ConfigIO 'resource.log' => 'config.LOG_FILE', 'resource.update_check' => 'config.UPDATECHECK_FILENAME', 'resource.raintpl_tpl' => 'config.RAINTPL_TPL', + 'resource.theme' => 'config.theme', 'resource.raintpl_tmp' => 'config.RAINTPL_TMP', 'resource.thumbnails_cache' => 'config.CACHEDIR', 'resource.page_cache' => 'config.PAGECACHE', @@ -71,7 +72,7 @@ class ConfigPhp implements ConfigIO /** * @inheritdoc */ - function read($filepath) + public function read($filepath) { if (! file_exists($filepath) || ! is_readable($filepath)) { return array(); @@ -91,7 +92,7 @@ class ConfigPhp implements ConfigIO /** * @inheritdoc */ - function write($filepath, $conf) + public function write($filepath, $conf) { $configStr = ' $value) { $configStr .= '$GLOBALS[\'config\'][\''. $key .'\'] = '.var_export($conf['config'][$key], true).';'. PHP_EOL; @@ -125,7 +126,7 @@ class ConfigPhp implements ConfigIO /** * @inheritdoc */ - function getExtension() + public function getExtension() { return '.php'; } diff --git a/composer.json b/composer.json index cfbde1a0..2fed0df7 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ }, "autoload": { "psr-4": { + "Shaarli\\": "application", "Shaarli\\Api\\": "application/api/", "Shaarli\\Api\\Controllers\\": "application/api/controllers", "Shaarli\\Api\\Exceptions\\": "application/api/exceptions" diff --git a/docker/development/nginx.conf b/docker/development/nginx.conf index ac0c6c61..79c45bfe 100644 --- a/docker/development/nginx.conf +++ b/docker/development/nginx.conf @@ -56,7 +56,16 @@ http { alias /var/www/shaarli/images/favicon.ico; } + location / { + # Slim - rewrite URLs + try_files $uri /index.php$is_args$args; + } + location ~ (index)\.php$ { + # Slim - split URL path into (script_filename, path_info) + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + # filter and proxy PHP requests to PHP-FPM fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; diff --git a/docker/production/nginx.conf b/docker/production/nginx.conf index 5ffa02d0..e8754d9b 100644 --- a/docker/production/nginx.conf +++ b/docker/production/nginx.conf @@ -48,7 +48,16 @@ http { alias /var/www/shaarli/images/favicon.ico; } + location / { + # Slim - rewrite URLs + try_files $uri /index.php$is_args$args; + } + location ~ (index)\.php$ { + # Slim - split URL path into (script_filename, path_info) + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + # filter and proxy PHP requests to PHP-FPM fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; diff --git a/docker/production/stable/nginx.conf b/docker/production/stable/nginx.conf index 5ffa02d0..e8754d9b 100644 --- a/docker/production/stable/nginx.conf +++ b/docker/production/stable/nginx.conf @@ -48,7 +48,16 @@ http { alias /var/www/shaarli/images/favicon.ico; } + location / { + # Slim - rewrite URLs + try_files $uri /index.php$is_args$args; + } + location ~ (index)\.php$ { + # Slim - split URL path into (script_filename, path_info) + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + # filter and proxy PHP requests to PHP-FPM fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; diff --git a/images/squiggle.png b/images/squiggle.png deleted file mode 100644 index a6ce218c..00000000 Binary files a/images/squiggle.png and /dev/null differ diff --git a/index.php b/index.php index ff24ed7e..beb1cbca 100644 --- a/index.php +++ b/index.php @@ -79,6 +79,7 @@ require_once 'application/Utils.php'; require_once 'application/PluginManager.php'; require_once 'application/Router.php'; require_once 'application/Updater.php'; +use \Shaarli\ThemeUtils; // Ensure the PHP version is supported try { @@ -122,7 +123,7 @@ 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 +RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme').'/'; // template directory RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory $pluginManager = new PluginManager($conf); @@ -203,7 +204,7 @@ function setup_login_state($conf) } // If session does not exist on server side, or IP address has changed, or session has expired, logout. if (empty($_SESSION['uid']) - || ($conf->get('security.session_protection_disabled') == false && $_SESSION['ip'] != allIPs()) + || ($conf->get('security.session_protection_disabled') === false && $_SESSION['ip'] != allIPs()) || time() >= $_SESSION['expires_on']) { logout(); @@ -617,7 +618,7 @@ function showDailyRSS($conf) { $tpl->assign('links', $links); $tpl->assign('rssdate', escape($dayDate->format(DateTime::RSS))); $tpl->assign('hide_timestamps', $conf->get('privacy.hide_timestamps', false)); - $html = $tpl->draw('dailyrss', $return_string=true); + $html = $tpl->draw('dailyrss', true); echo $html . PHP_EOL; } @@ -1124,6 +1125,7 @@ function renderPage($conf, $pluginManager, $LINKSDB) $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'])); @@ -1134,6 +1136,7 @@ function renderPage($conf, $pluginManager, $LINKSDB) $conf->set('api.secret', escape($_POST['apiSecret'])); try { $conf->write(isLoggedIn()); + invalidateCaches($conf->get('resource.page_cache')); } catch(Exception $e) { error_log( @@ -1151,6 +1154,8 @@ function renderPage($conf, $pluginManager, $LINKSDB) else // Show the configuration form. { $PAGE->assign('title', $conf->get('general.title')); + $PAGE->assign('theme', $conf->get('resource.theme')); + $PAGE->assign('theme_available', ThemeUtils::getThemes($conf->get('resource.raintpl_tpl'))); $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/plugins/wallabag/WallabagInstance.php b/plugins/wallabag/WallabagInstance.php index 72cc2e5e..eb8ab618 100644 --- a/plugins/wallabag/WallabagInstance.php +++ b/plugins/wallabag/WallabagInstance.php @@ -35,7 +35,7 @@ class WallabagInstance */ private $apiVersion; - function __construct($instance, $version) + public function __construct($instance, $version) { if ($this->isVersionAllowed($version)) { $this->apiVersion = self::$wallabagVersions[$version]; 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 $conf->set('resource.page_cache', 'pagecache'); $conf->set('resource.raintpl_tmp', 'tmp'); $conf->set('resource.raintpl_tpl', 'tpl'); + $conf->set('resource.theme', 'default'); $conf->set('resource.update_check', 'data/lastupdatecheck.txt'); $this->assertEquals( @@ -312,10 +313,12 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase $conf->set('resource.page_cache', 'null/pagecache'); $conf->set('resource.raintpl_tmp', 'null/tmp'); $conf->set('resource.raintpl_tpl', 'null/tpl'); + $conf->set('resource.raintpl_theme', 'null/tpl/default'); $conf->set('resource.update_check', 'null/data/lastupdatecheck.txt'); $this->assertEquals( array( '"null/tpl" directory is not readable', + '"null/tpl/default" directory is not readable', '"null/cache" directory is not readable', '"null/cache" directory is not writable', '"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 @@ +assertTrue(in_array($theme, $themes)); + } + $this->assertFalse(in_array('supertheme', $res)); + + foreach ($themes as $theme) { + rmdir('sandbox/tpl/'. $theme); + } + unlink('sandbox/tpl/supertheme'); + rmdir('sandbox/tpl'); + } + + /** + * Test getThemes() without any theme dir. + */ + public function testGetThemesEmpty() + { + mkdir('sandbox/tpl/', 0755, true); + $this->assertEquals([], ThemeUtils::getThemes('sandbox/tpl/')); + rmdir('sandbox/tpl/'); + } + + /** + * Test getThemes() with an invalid path. + */ + public function testGetThemesInvalid() + { + $this->assertEquals([], ThemeUtils::getThemes('nope')); + } +} 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 @@ require_once 'application/config/ConfigManager.php'; require_once 'tests/Updater/DummyUpdater.php'; +require_once 'inc/rain.tpl.class.php'; /** * Class UpdaterTest. @@ -421,4 +422,48 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; $this->assertTrue($updater->updateMethodDatastoreIds()); $this->assertEquals($checksum, hash_file('sha1', self::$testDatastore)); } + + /** + * Test defaultTheme update with default settings: nothing to do. + */ + public function testDefaultThemeWithDefaultSettings() + { + $sandbox = 'sandbox/config'; + copy(self::$configFile . '.json.php', $sandbox . '.json.php'); + $this->conf = new ConfigManager($sandbox); + $updater = new Updater([], [], $this->conf, true); + $this->assertTrue($updater->updateMethodDefaultTheme()); + + $this->assertEquals('tpl/', $this->conf->get('resource.raintpl_tpl')); + $this->assertEquals('default', $this->conf->get('resource.theme')); + $this->conf = new ConfigManager($sandbox); + $this->assertEquals('tpl/', $this->conf->get('resource.raintpl_tpl')); + $this->assertEquals('default', $this->conf->get('resource.theme')); + unlink($sandbox . '.json.php'); + } + + /** + * Test defaultTheme update with a custom theme in a subfolder + */ + public function testDefaultThemeWithCustomTheme() + { + $theme = 'iamanartist'; + $sandbox = 'sandbox/config'; + copy(self::$configFile . '.json.php', $sandbox . '.json.php'); + $this->conf = new ConfigManager($sandbox); + mkdir('sandbox/'. $theme); + touch('sandbox/'. $theme .'/linklist.html'); + $this->conf->set('resource.raintpl_tpl', 'sandbox/'. $theme .'/'); + $updater = new Updater([], [], $this->conf, true); + $this->assertTrue($updater->updateMethodDefaultTheme()); + + $this->assertEquals('sandbox', $this->conf->get('resource.raintpl_tpl')); + $this->assertEquals($theme, $this->conf->get('resource.theme')); + $this->conf = new ConfigManager($sandbox); + $this->assertEquals('sandbox', $this->conf->get('resource.raintpl_tpl')); + $this->assertEquals($theme, $this->conf->get('resource.theme')); + unlink($sandbox . '.json.php'); + unlink('sandbox/'. $theme .'/linklist.html'); + rmdir('sandbox/'. $theme); + } } diff --git a/tests/Url/UrlTest.php b/tests/Url/UrlTest.php index 05862372..aa2f2234 100644 --- a/tests/Url/UrlTest.php +++ b/tests/Url/UrlTest.php @@ -157,7 +157,7 @@ class UrlTest extends PHPUnit_Framework_TestCase /** * Test add trailing slash. */ - function testAddTrailingSlash() + public function testAddTrailingSlash() { $strOn = 'http://randomstr.com/test/'; $strOff = 'http://randomstr.com/test'; @@ -168,7 +168,7 @@ class UrlTest extends PHPUnit_Framework_TestCase /** * Test valid HTTP url. */ - function testUrlIsHttp() + public function testUrlIsHttp() { $url = new Url(self::$baseUrl); $this->assertTrue($url->isHttp()); @@ -177,7 +177,7 @@ class UrlTest extends PHPUnit_Framework_TestCase /** * Test non HTTP url. */ - function testUrlIsNotHttp() + public function testUrlIsNotHttp() { $url = new Url('ftp://save.tld/mysave'); $this->assertFalse($url->isHttp()); @@ -186,7 +186,7 @@ class UrlTest extends PHPUnit_Framework_TestCase /** * Test International Domain Name to ASCII conversion */ - function testIdnToAscii() + public function testIdnToAscii() { $ind = 'http://www.académie-française.fr/'; $expected = 'http://www.xn--acadmie-franaise-npb1a.fr/'; diff --git a/tests/api/ApiMiddlewareTest.php b/tests/api/ApiMiddlewareTest.php index 4d4dd9b9..d9753b1d 100644 --- a/tests/api/ApiMiddlewareTest.php +++ b/tests/api/ApiMiddlewareTest.php @@ -143,7 +143,7 @@ class ApiMiddlewareTest extends \PHPUnit_Framework_TestCase $env = Environment::mock([ 'REQUEST_METHOD' => 'GET', 'REQUEST_URI' => '/echo', - 'HTTP_JWT'=> 'jwt', + 'HTTP_AUTHORIZATION'=> 'Bearer jwt', ]); $request = Request::createFromEnvironment($env); $response = new Response(); @@ -157,7 +157,30 @@ class ApiMiddlewareTest extends \PHPUnit_Framework_TestCase } /** - * Invoke the middleware without an invalid JWT token (debug): + * Invoke the middleware with an invalid JWT token header + */ + public function testInvalidJwtAuthHeaderDebug() + { + $this->conf->set('dev.debug', true); + $mw = new ApiMiddleware($this->container); + $env = Environment::mock([ + 'REQUEST_METHOD' => 'GET', + 'REQUEST_URI' => '/echo', + 'HTTP_AUTHORIZATION'=> 'PolarBearer jwt', + ]); + $request = Request::createFromEnvironment($env); + $response = new Response(); + /** @var Response $response */ + $response = $mw($request, $response, null); + + $this->assertEquals(401, $response->getStatusCode()); + $body = json_decode((string) $response->getBody()); + $this->assertEquals('Not authorized: Invalid JWT header', $body->message); + $this->assertContains('ApiAuthorizationException', $body->stacktrace); + } + + /** + * Invoke the middleware with an invalid JWT token (debug): * should return a 401 error Unauthorized - with a specific message and a stacktrace. * * Note: specific JWT errors tests are handled in ApiUtilsTest. @@ -169,7 +192,7 @@ class ApiMiddlewareTest extends \PHPUnit_Framework_TestCase $env = Environment::mock([ 'REQUEST_METHOD' => 'GET', 'REQUEST_URI' => '/echo', - 'HTTP_JWT'=> 'bad jwt', + 'HTTP_AUTHORIZATION'=> 'Bearer jwt', ]); $request = Request::createFromEnvironment($env); $response = new Response(); diff --git a/tests/api/ApiUtilsTest.php b/tests/api/ApiUtilsTest.php index 516ee686..b4431d1b 100644 --- a/tests/api/ApiUtilsTest.php +++ b/tests/api/ApiUtilsTest.php @@ -2,6 +2,9 @@ namespace Shaarli\Api; +use Shaarli\Base64Url; + + /** * Class ApiUtilsTest */ @@ -24,14 +27,14 @@ class ApiUtilsTest extends \PHPUnit_Framework_TestCase */ public static function generateValidJwtToken($secret) { - $header = base64_encode('{ + $header = Base64Url::encode('{ "typ": "JWT", "alg": "HS512" }'); - $payload = base64_encode('{ + $payload = Base64Url::encode('{ "iat": '. time() .' }'); - $signature = hash_hmac('sha512', $header .'.'. $payload , $secret); + $signature = Base64Url::encode(hash_hmac('sha512', $header .'.'. $payload , $secret, true)); return $header .'.'. $payload .'.'. $signature; } @@ -46,9 +49,9 @@ class ApiUtilsTest extends \PHPUnit_Framework_TestCase */ public static function generateCustomJwtToken($header, $payload, $secret) { - $header = base64_encode($header); - $payload = base64_encode($payload); - $signature = hash_hmac('sha512', $header . '.' . $payload, $secret); + $header = Base64Url::encode($header); + $payload = Base64Url::encode($payload); + $signature = Base64Url::encode(hash_hmac('sha512', $header . '.' . $payload, $secret, true)); return $header . '.' . $payload . '.' . $signature; } diff --git a/tests/plugins/PluginAddlinkTest.php b/tests/plugins/PluginAddlinkTest.php index a2f25bec..b77fe12a 100644 --- a/tests/plugins/PluginAddlinkTest.php +++ b/tests/plugins/PluginAddlinkTest.php @@ -16,7 +16,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase /** * Reset plugin path. */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -24,7 +24,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase /** * Test render_header hook while logged in. */ - function testAddlinkHeaderLoggedIn() + public function testAddlinkHeaderLoggedIn() { $str = 'stuff'; $data = array($str => $str); @@ -46,7 +46,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase /** * Test render_header hook while logged out. */ - function testAddlinkHeaderLoggedOut() + public function testAddlinkHeaderLoggedOut() { $str = 'stuff'; $data = array($str => $str); @@ -61,7 +61,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase /** * Test render_includes hook while logged in. */ - function testAddlinkIncludesLoggedIn() + public function testAddlinkIncludesLoggedIn() { $str = 'stuff'; $data = array($str => $str); @@ -86,7 +86,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase * Test render_includes hook. * Should not affect css files while logged out. */ - function testAddlinkIncludesLoggedOut() + public function testAddlinkIncludesLoggedOut() { $str = 'stuff'; $data = array($str => $str); diff --git a/tests/plugins/PluginArchiveorgTest.php b/tests/plugins/PluginArchiveorgTest.php index 4daa4c9d..fecd5f2c 100644 --- a/tests/plugins/PluginArchiveorgTest.php +++ b/tests/plugins/PluginArchiveorgTest.php @@ -15,7 +15,7 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -23,7 +23,7 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase /** * Test render_linklist hook on external links. */ - function testArchiveorgLinklistOnExternalLinks() + public function testArchiveorgLinklistOnExternalLinks() { $str = 'http://randomstr.com/test'; @@ -48,13 +48,12 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase // plugin data $this->assertEquals(1, count($link['link_plugin'])); $this->assertNotFalse(strpos($link['link_plugin'][0], $str)); - } /** * Test render_linklist hook on internal links. */ - function testArchiveorgLinklistOnInternalLinks() + public function testArchiveorgLinklistOnInternalLinks() { $internalLink1 = 'http://shaarli.shaarli/?qvMAqg'; $internalLinkRealURL1 = '?qvMAqg'; @@ -101,7 +100,6 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase ) ); - $data = hook_archiveorg_render_linklist($data); // Case n°1: first link type, public @@ -136,7 +134,5 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase $link = $data['links'][5]; $this->assertArrayNotHasKey('link_plugin', $link); - } - } diff --git a/tests/plugins/PluginIssoTest.php b/tests/plugins/PluginIssoTest.php index 6b7904dd..03def208 100644 --- a/tests/plugins/PluginIssoTest.php +++ b/tests/plugins/PluginIssoTest.php @@ -12,7 +12,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -20,7 +20,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test Isso init without errors. */ - function testWallabagInitNoError() + public function testWallabagInitNoError() { $conf = new ConfigManager(''); $conf->set('plugins.ISSO_SERVER', 'value'); @@ -31,7 +31,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test Isso init with errors. */ - function testWallabagInitError() + public function testWallabagInitError() { $conf = new ConfigManager(''); $errors = isso_init($conf); @@ -41,7 +41,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test render_linklist hook with valid settings to display the comment form. */ - function testIssoDisplayed() + public function testIssoDisplayed() { $conf = new ConfigManager(''); $conf->set('plugins.ISSO_SERVER', 'value'); @@ -81,7 +81,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test isso plugin when multiple links are displayed (shouldn't be displayed). */ - function testIssoMultipleLinks() + public function testIssoMultipleLinks() { $conf = new ConfigManager(''); $conf->set('plugins.ISSO_SERVER', 'value'); @@ -113,7 +113,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test isso plugin when using search (shouldn't be displayed). */ - function testIssoNotDisplayedWhenSearch() + public function testIssoNotDisplayedWhenSearch() { $conf = new ConfigManager(''); $conf->set('plugins.ISSO_SERVER', 'value'); @@ -141,7 +141,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test isso plugin without server configuration (shouldn't be displayed). */ - function testIssoWithoutConf() + public function testIssoWithoutConf() { $data = 'abc'; $conf = new ConfigManager(''); diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index 17ef2280..d359b2a1 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php @@ -16,7 +16,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -25,7 +25,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase * Test render_linklist hook. * Only check that there is basic markdown rendering. */ - function testMarkdownLinklist() + public function testMarkdownLinklist() { $markdown = '# My title' . PHP_EOL . 'Very interesting content.'; $data = array( @@ -45,7 +45,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase * Test render_daily hook. * Only check that there is basic markdown rendering. */ - function testMarkdownDaily() + public function testMarkdownDaily() { $markdown = '# My title' . PHP_EOL . 'Very interesting content.'; $data = array( @@ -69,7 +69,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test reverse_text2clickable(). */ - function testReverseText2clickable() + public function testReverseText2clickable() { $text = 'stuff http://hello.there/is=someone#here otherstuff'; $clickableText = text2clickable($text, ''); @@ -80,7 +80,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test reverse_nl2br(). */ - function testReverseNl2br() + public function testReverseNl2br() { $text = 'stuff' . PHP_EOL . 'otherstuff'; $processedText = nl2br($text); @@ -91,7 +91,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test reverse_space2nbsp(). */ - function testReverseSpace2nbsp() + public function testReverseSpace2nbsp() { $text = ' stuff' . PHP_EOL . ' otherstuff and another'; $processedText = space2nbsp($text); @@ -102,7 +102,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test sanitize_html(). */ - function testSanitizeHtml() + public function testSanitizeHtml() { $input = '< script src="js.js"/>'; $input .= '< script attr>alert(\'xss\');'; @@ -119,7 +119,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test the no markdown tag. */ - function testNoMarkdownTag() + public function testNoMarkdownTag() { $str = 'All _work_ and `no play` makes Jack a *dull* boy.'; $data = array( @@ -158,7 +158,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test that a close value to nomarkdown is not understand as nomarkdown (previous value `.nomarkdown`). */ - function testNoMarkdownNotExcactlyMatching() + public function testNoMarkdownNotExcactlyMatching() { $str = 'All _work_ and `no play` makes Jack a *dull* boy.'; $data = array( @@ -176,7 +176,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test hashtag links processed with markdown. */ - function testMarkdownHashtagLinks() + public function testMarkdownHashtagLinks() { $md = file_get_contents('tests/plugins/resources/markdown.md'); $md = format_description($md); diff --git a/tests/plugins/PluginPlayvideosTest.php b/tests/plugins/PluginPlayvideosTest.php index be1ef774..29ad047f 100644 --- a/tests/plugins/PluginPlayvideosTest.php +++ b/tests/plugins/PluginPlayvideosTest.php @@ -16,7 +16,7 @@ class PluginPlayvideosTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -24,7 +24,7 @@ class PluginPlayvideosTest extends PHPUnit_Framework_TestCase /** * Test render_linklist hook. */ - function testPlayvideosHeader() + public function testPlayvideosHeader() { $str = 'stuff'; $data = array($str => $str); @@ -43,7 +43,7 @@ class PluginPlayvideosTest extends PHPUnit_Framework_TestCase /** * Test render_footer hook. */ - function testPlayvideosFooter() + public function testPlayvideosFooter() { $str = 'stuff'; $data = array($str => $str); diff --git a/tests/plugins/PluginPubsubhubbubTest.php b/tests/plugins/PluginPubsubhubbubTest.php index 24dd7a11..1bd87935 100644 --- a/tests/plugins/PluginPubsubhubbubTest.php +++ b/tests/plugins/PluginPubsubhubbubTest.php @@ -17,7 +17,7 @@ class PluginPubsubhubbubTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -25,7 +25,7 @@ class PluginPubsubhubbubTest extends PHPUnit_Framework_TestCase /** * Test render_feed hook with an RSS feed. */ - function testPubSubRssRenderFeed() + public function testPubSubRssRenderFeed() { $hub = 'http://domain.hub'; $conf = new ConfigManager(self::$configFile); @@ -40,7 +40,7 @@ class PluginPubsubhubbubTest extends PHPUnit_Framework_TestCase /** * Test render_feed hook with an ATOM feed. */ - function testPubSubAtomRenderFeed() + public function testPubSubAtomRenderFeed() { $hub = 'http://domain.hub'; $conf = new ConfigManager(self::$configFile); diff --git a/tests/plugins/PlugQrcodeTest.php b/tests/plugins/PluginQrcodeTest.php similarity index 86% rename from tests/plugins/PlugQrcodeTest.php rename to tests/plugins/PluginQrcodeTest.php index 86dc7f29..211ee89c 100644 --- a/tests/plugins/PlugQrcodeTest.php +++ b/tests/plugins/PluginQrcodeTest.php @@ -1,29 +1,29 @@ $str); diff --git a/tests/plugins/PluginReadityourselfTest.php b/tests/plugins/PluginReadityourselfTest.php index 532db146..30470ab7 100644 --- a/tests/plugins/PluginReadityourselfTest.php +++ b/tests/plugins/PluginReadityourselfTest.php @@ -15,7 +15,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -23,7 +23,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase /** * Test Readityourself init without errors. */ - function testReadityourselfInitNoError() + public function testReadityourselfInitNoError() { $conf = new ConfigManager(''); $conf->set('plugins.READITYOUSELF_URL', 'value'); @@ -34,7 +34,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase /** * Test Readityourself init with errors. */ - function testReadityourselfInitError() + public function testReadityourselfInitError() { $conf = new ConfigManager(''); $errors = readityourself_init($conf); @@ -44,7 +44,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase /** * Test render_linklist hook. */ - function testReadityourselfLinklist() + public function testReadityourselfLinklist() { $conf = new ConfigManager(''); $conf->set('plugins.READITYOUSELF_URL', 'value'); @@ -72,7 +72,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase /** * Test without config: nothing should happened. */ - function testReadityourselfLinklistWithoutConfig() + public function testReadityourselfLinklistWithoutConfig() { $conf = new ConfigManager(''); $conf->set('plugins.READITYOUSELF_URL', null); diff --git a/tests/plugins/PluginWallabagTest.php b/tests/plugins/PluginWallabagTest.php index 2c268cbd..30351f46 100644 --- a/tests/plugins/PluginWallabagTest.php +++ b/tests/plugins/PluginWallabagTest.php @@ -15,7 +15,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -23,7 +23,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase /** * Test wallabag init without errors. */ - function testWallabagInitNoError() + public function testWallabagInitNoError() { $conf = new ConfigManager(''); $conf->set('plugins.WALLABAG_URL', 'value'); @@ -34,7 +34,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase /** * Test wallabag init with errors. */ - function testWallabagInitError() + public function testWallabagInitError() { $conf = new ConfigManager(''); $errors = wallabag_init($conf); @@ -44,7 +44,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase /** * Test render_linklist hook. */ - function testWallabagLinklist() + public function testWallabagLinklist() { $conf = new ConfigManager(''); $conf->set('plugins.WALLABAG_URL', 'value'); diff --git a/tests/plugins/WallabagInstanceTest.php b/tests/plugins/WallabagInstanceTest.php index 7c14c1df..2c466871 100644 --- a/tests/plugins/WallabagInstanceTest.php +++ b/tests/plugins/WallabagInstanceTest.php @@ -15,7 +15,7 @@ class WallabagInstanceTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { $this->instance = 'http://some.url'; } @@ -23,7 +23,7 @@ class WallabagInstanceTest extends PHPUnit_Framework_TestCase /** * Test WallabagInstance with API V1. */ - function testWallabagInstanceV1() + public function testWallabagInstanceV1() { $instance = new WallabagInstance($this->instance, 1); $expected = $this->instance . '/?plainurl='; @@ -34,7 +34,7 @@ class WallabagInstanceTest extends PHPUnit_Framework_TestCase /** * Test WallabagInstance with API V2. */ - function testWallabagInstanceV2() + public function testWallabagInstanceV2() { $instance = new WallabagInstance($this->instance, 2); $expected = $this->instance . '/bookmarklet?url='; @@ -45,7 +45,7 @@ class WallabagInstanceTest extends PHPUnit_Framework_TestCase /** * Test WallabagInstance with an invalid API version. */ - function testWallabagInstanceInvalidVersion() + public function testWallabagInstanceInvalidVersion() { $instance = new WallabagInstance($this->instance, false); $expected = $this->instance . '/?plainurl='; 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 @@ }, "resource": { "datastore": "tests\/utils\/config\/datastore.php", - "data_dir": "tests\/utils\/config" + "data_dir": "tests\/utils\/config", + "raintpl_tpl": "tpl/" }, "plugins": { "WALLABAG_VERSION": 1 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 94% rename from tpl/changetag.html rename to tpl/default/changetag.html index 13cc5cf1..a0df3328 100644 --- a/tpl/changetag.html +++ b/tpl/default/changetag.html @@ -1,7 +1,7 @@ {include="includes"} - + diff --git a/tpl/configure.html b/tpl/default/configure.html similarity index 91% rename from tpl/configure.html rename to tpl/default/configure.html index b4197bf9..5820e6e4 100644 --- a/tpl/configure.html +++ b/tpl/default/configure.html @@ -19,6 +19,20 @@
+ + + Theme: + + + + + Timezone: {$timezone_form} diff --git a/inc/reset.css b/tpl/default/css/reset.css similarity index 100% rename from inc/reset.css rename to tpl/default/css/reset.css diff --git a/inc/shaarli.css b/tpl/default/css/shaarli.css similarity index 98% rename from inc/shaarli.css rename to tpl/default/css/shaarli.css index a24d4b7c..6d73af3e 100644 --- a/inc/shaarli.css +++ b/tpl/default/css/shaarli.css @@ -42,7 +42,7 @@ strong { } /* Buttons */ -.bigbutton { +.bigbutton, #pageheader a.bigbutton { background-color: #c0c0c0; background: -moz-linear-gradient(#c0c0c0, #ffffff) repeat scroll 0 0 transparent; background: -webkit-gradient(linear, 0 0, 0 bottom, from(#c0c0c0), to(#ffffff)); @@ -54,11 +54,17 @@ strong { box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5); cursor: pointer; height: 24px; - margin-left: 5px; padding: 0 5px; + margin: 5px 5px 0 0; color: #606060; border-style: outset; border-width: 1px; + display: inline-block; +} + +a.bigbutton, #pageheader a.bigbutton { + height: 22px; + line-height: 22px; } .smallbutton { @@ -103,7 +109,7 @@ strong { } #pageheader #logo { - background-image: url('../images/logo.png'); + background-image: url('../../../images/logo.png'); background-repeat: no-repeat; float: left; margin: 0 10px 0 10px; @@ -803,6 +809,10 @@ div.dailyAbout img { height: 14px; } +div.dailyEntryPermalink { + float: right; +} + div.dailyTitle { font-weight: bold; font-size: 44pt; @@ -1005,7 +1015,7 @@ div.dailyNoEntry { display: inline !important; } - .tagfilter input.bigbutton, .searchform input.bigbutton, .addform input.bigbutton { + .tagfilter input.bigbutton, .searchform input.bigbutton, .addform input.bigbutton, a.bigbutton { width: 30%; font-size: smaller; } 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 eba0af3b..e86e90b1 100644 --- a/tpl/daily.html +++ b/tpl/default/daily.html @@ -28,9 +28,9 @@
- floral_left + floral_left The Daily Shaarli - floral_right + floral_right
@@ -50,7 +50,7 @@
{if="!$hide_timestamps || isLoggedIn()"} @@ -94,7 +94,7 @@ {$value} {/loop}
-
-
+
-
{include="page.footer"} 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 86% rename from tpl/editlink.html rename to tpl/default/editlink.html index 870cc168..a2d9b78f 100644 --- a/tpl/editlink.html +++ b/tpl/default/editlink.html @@ -1,7 +1,7 @@ {include="includes"} - + - {if="!$link_is_new"}{/if} + {if="!$link_is_new && isset($link.id)"} + + {'Delete'|t} + + {/if} {if="$http_referer"}{/if} 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/images/50pc_transparent.png b/tpl/default/images/50pc_transparent.png similarity index 100% rename from images/50pc_transparent.png rename to tpl/default/images/50pc_transparent.png diff --git a/images/Paper_texture_v5_by_bashcorpo_w1000.jpg b/tpl/default/images/Paper_texture_v5_by_bashcorpo_w1000.jpg similarity index 100% rename from images/Paper_texture_v5_by_bashcorpo_w1000.jpg rename to tpl/default/images/Paper_texture_v5_by_bashcorpo_w1000.jpg diff --git a/images/calendar.png b/tpl/default/images/calendar.png similarity index 100% rename from images/calendar.png rename to tpl/default/images/calendar.png diff --git a/images/floral_left.png b/tpl/default/images/floral_left.png similarity index 100% rename from images/floral_left.png rename to tpl/default/images/floral_left.png diff --git a/images/floral_right.png b/tpl/default/images/floral_right.png similarity index 100% rename from images/floral_right.png rename to tpl/default/images/floral_right.png diff --git a/images/private.png b/tpl/default/images/private.png similarity index 100% rename from images/private.png rename to tpl/default/images/private.png diff --git a/images/squiggle2.png b/tpl/default/images/squiggle.png similarity index 100% rename from images/squiggle2.png rename to tpl/default/images/squiggle.png diff --git a/images/squiggle_closing.png b/tpl/default/images/squiggle_closing.png similarity index 100% rename from images/squiggle_closing.png rename to tpl/default/images/squiggle_closing.png diff --git a/images/tag_blue.png b/tpl/default/images/tag_blue.png similarity index 100% rename from images/tag_blue.png rename to tpl/default/images/tag_blue.png 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 77% rename from tpl/includes.html rename to tpl/default/includes.html index 7b2997ce..17b78b17 100644 --- a/tpl/includes.html +++ b/tpl/default/includes.html @@ -6,9 +6,9 @@ - - -{if="is_file('inc/user.css')"}{/if} + + +{if="is_file('data/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 d4232342..5accc92f 100644 --- a/tpl/linklist.html +++ b/tpl/default/linklist.html @@ -1,7 +1,7 @@ - + {include="includes"} diff --git a/tpl/linklist.paging.html b/tpl/default/linklist.paging.html similarity index 100% rename from tpl/linklist.paging.html rename to tpl/default/linklist.paging.html diff --git a/tpl/loginform.html b/tpl/default/loginform.html similarity index 100% rename from tpl/loginform.html rename to tpl/default/loginform.html diff --git a/tpl/opensearch.html b/tpl/default/opensearch.html similarity index 100% rename from tpl/opensearch.html rename to tpl/default/opensearch.html diff --git a/tpl/page.footer.html b/tpl/default/page.footer.html similarity index 100% rename from tpl/page.footer.html rename to tpl/default/page.footer.html diff --git a/tpl/page.header.html b/tpl/default/page.header.html similarity index 100% rename from tpl/page.header.html rename to tpl/default/page.header.html diff --git a/tpl/page.html b/tpl/default/page.html similarity index 100% rename from tpl/page.html rename to tpl/default/page.html diff --git a/tpl/picwall.html b/tpl/default/picwall.html similarity index 100% rename from tpl/picwall.html rename to tpl/default/picwall.html diff --git a/tpl/pluginsadmin.html b/tpl/default/pluginsadmin.html similarity index 100% rename from tpl/pluginsadmin.html rename to tpl/default/pluginsadmin.html diff --git a/tpl/readme.txt b/tpl/default/readme.txt similarity index 100% rename from tpl/readme.txt rename to tpl/default/readme.txt diff --git a/tpl/tagcloud.html b/tpl/default/tagcloud.html similarity index 100% rename from tpl/tagcloud.html rename to tpl/default/tagcloud.html diff --git a/tpl/tools.html b/tpl/default/tools.html similarity index 100% rename from tpl/tools.html rename to tpl/default/tools.html