Compare commits
4 Commits
d33763a409
...
0f473eedfc
Author | SHA1 | Date |
---|---|---|
Knah Tsaeb | 0f473eedfc | |
Knah Tsaeb | a197ef5e02 | |
Knah Tsaeb | 81b9c01366 | |
Knah Tsaeb | 057fb6839c |
|
@ -149,7 +149,8 @@ class ApplicationUtils
|
|||
'application',
|
||||
'inc',
|
||||
'plugins',
|
||||
'tpl/'.$conf->get('resource.theme'),
|
||||
$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';
|
||||
|
|
|
@ -79,7 +79,7 @@ class PageBuilder
|
|||
$this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false));
|
||||
$this->tpl->assign('token', getToken($this->conf));
|
||||
// To be removed with a proper theme configuration.
|
||||
$this->tpl->assign('conf', $this->conf->get('resource.theme', 'Default'));
|
||||
$this->tpl->assign('conf', $this->conf->get('resource.theme', 'default'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -189,7 +189,7 @@ class ConfigManager
|
|||
'general.title',
|
||||
'general.header_link',
|
||||
'privacy.default_private_links',
|
||||
'redirector.url'
|
||||
'redirector.url',
|
||||
);
|
||||
|
||||
// Only logged in user can alter config.
|
||||
|
@ -296,7 +296,8 @@ class ConfigManager
|
|||
$this->setEmpty('resource.updates', 'data/updates.txt');
|
||||
$this->setEmpty('resource.log', 'data/log.txt');
|
||||
$this->setEmpty('resource.update_check', 'data/lastupdatecheck.txt');
|
||||
$this->setEmpty('resource.theme', 'Default');
|
||||
$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');
|
||||
|
|
|
@ -40,6 +40,7 @@ class ConfigPhp implements ConfigIO
|
|||
'resource.updates' => 'config.UPDATES_FILE',
|
||||
'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',
|
||||
|
@ -99,7 +100,7 @@ class ConfigPhp implements ConfigIO
|
|||
$configStr .= '$GLOBALS[\'' . $key . '\'] = ' . var_export($conf[$key], true) . ';' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Store all $conf['config']
|
||||
foreach ($conf['config'] as $key => $value) {
|
||||
$configStr .= '$GLOBALS[\'config\'][\''. $key .'\'] = '.var_export($conf['config'][$key], true).';'. PHP_EOL;
|
||||
|
|
|
@ -172,7 +172,7 @@ It might be useful if your IP adress often changes.<br />
|
|||
<strong>updates</strong>: File path for the ran updates file.<br />
|
||||
<strong>log</strong>: Log file path.<br />
|
||||
<strong>update_check</strong>: Last update check file path.<br />
|
||||
<strong>theme</strong>: Templates directory.<br />
|
||||
<strong>raintpl_tpl</strong>: Templates directory.<br />
|
||||
<strong>raintpl_tmp</strong>: Template engine cache directory.<br />
|
||||
<strong>thumbnails_cache</strong>: Thumbnails cache directory.<br />
|
||||
<strong>page_cache</strong>: Shaarli's internal cache directory.<br />
|
||||
|
@ -220,7 +220,7 @@ It might be useful if your IP adress often changes.<br />
|
|||
<span class="dt">"log"</span><span class="fu">:</span> <span class="st">"data</span><span class="ch">\/</span><span class="st">log.txt"</span><span class="fu">,</span>
|
||||
<span class="dt">"update_check"</span><span class="fu">:</span> <span class="st">"data</span><span class="ch">\/</span><span class="st">lastupdatecheck.txt"</span><span class="fu">,</span>
|
||||
<span class="dt">"raintpl_tmp"</span><span class="fu">:</span> <span class="st">"tmp</span><span class="ch">\/</span><span class="st">"</span><span class="fu">,</span>
|
||||
<span class="dt">"theme"</span><span class="fu">:</span> <span class="st">"tpl</span><span class="ch">\/</span><span class="st">"</span><span class="fu">,</span>
|
||||
<span class="dt">"raintpl_tpl"</span><span class="fu">:</span> <span class="st">"tpl</span><span class="ch">\/</span><span class="st">"</span><span class="fu">,</span>
|
||||
<span class="dt">"thumbnails_cache"</span><span class="fu">:</span> <span class="st">"cache"</span><span class="fu">,</span>
|
||||
<span class="dt">"page_cache"</span><span class="fu">:</span> <span class="st">"pagecache"</span>
|
||||
<span class="fu">},</span>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
## Foreword
|
||||
|
||||
**Do not edit configuration options in index.php! Your changes would be lost.**
|
||||
**Do not edit configuration options in index.php! Your changes would be lost.**
|
||||
|
||||
Once your Shaarli instance is installed, the file `data/config.json.php` is generated:
|
||||
* it contains all settings in JSON format, and can be edited to customize values
|
||||
|
@ -42,7 +42,7 @@ In `data/config.json.php`.
|
|||
See also [Plugin System](Plugin-System.html).[](.html)
|
||||
|
||||
### Credentials
|
||||
|
||||
|
||||
> You shouldn't edit those.
|
||||
|
||||
**login**: Login username.
|
||||
|
@ -59,12 +59,12 @@ See also [Plugin System](Plugin-System.html).[](.html)
|
|||
|
||||
### Security
|
||||
|
||||
**session_protection_disabled**: Disable session cookie hijacking protection (not recommended).
|
||||
**session_protection_disabled**: Disable session cookie hijacking protection (not recommended).
|
||||
It might be useful if your IP adress often changes.
|
||||
**ban_after**: Failed login attempts before being IP banned.
|
||||
**ban_duration**: IP ban duration in seconds.
|
||||
**open_shaarli**: Anyone can add a new link while logged out if enabled.
|
||||
**trusted_proxies**: List of trusted IP which won't be banned after failed login attemps. Useful if Shaarli is behind a reverse proxy.
|
||||
**trusted_proxies**: List of trusted IP which won't be banned after failed login attemps. Useful if Shaarli is behind a reverse proxy.
|
||||
|
||||
### Resources
|
||||
|
||||
|
@ -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.
|
||||
**theme**: Templates directory.
|
||||
**raintpl_tpl**: 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\/",
|
||||
"theme": "tpl\/",
|
||||
"raintpl_tpl": "tpl\/",
|
||||
"thumbnails_cache": "cache",
|
||||
"page_cache": "pagecache"
|
||||
},
|
||||
|
@ -205,7 +205,6 @@ It might be useful if your IP adress often changes.
|
|||
|
||||
## Additional configuration
|
||||
|
||||
The playvideos plugin may require that you adapt your server's
|
||||
The playvideos plugin may require that you adapt your server's
|
||||
[Content Security Policy](https://github.com/shaarli/Shaarli/blob/master/plugins/playvideos/README.md#troubleshooting) [](.html)
|
||||
configuration to work properly.[(.html)]((.html).html)
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
|||
<li>There should now be a <code>my-template/</code> directory under the <code>tpl/</code> dir, containing directly all the template files.</li>
|
||||
</ul></li>
|
||||
<li><p>Edit <code>data/config.php</code> to have Shaarli use this template, e.g.</p>
|
||||
<div class="sourceCode"><pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'theme'</span><span class="ot">]</span> = <span class="st">'tpl/my-template/'</span><span class="ot">;](</span><span class="st">'theme'</span><span class="ot">]</span>-=-<span class="st">'tpl/my-template/'</span><span class="ot">;</span>.html<span class="ot">)</span></code></pre></div></li>
|
||||
<div class="sourceCode"><pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'RAINTPL_TPL'</span><span class="ot">]</span> = <span class="st">'tpl/my-template/'</span><span class="ot">;](</span><span class="st">'RAINTPL_TPL'</span><span class="ot">]</span>-=-<span class="st">'tpl/my-template/'</span><span class="ot">;</span>.html<span class="ot">)</span></code></pre></div></li>
|
||||
</ul>
|
||||
<h2 id="community-themes-templates">Community themes & templates</h2>
|
||||
<ul>
|
||||
|
|
|
@ -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'['theme'] = 'tpl/my-template/';]('theme']-=-'tpl/my-template/';.html)
|
||||
$GLOBALS['config'['RAINTPL_TPL'] = 'tpl/my-template/';]('RAINTPL_TPL']-=-'tpl/my-template/';.html)
|
||||
```
|
||||
|
||||
## Community themes & templates
|
||||
|
|
|
@ -122,12 +122,13 @@ 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)));
|
||||
$conf->setEmpty('resource.theme', 'Default');
|
||||
RainTPL::$tpl_dir = 'tpl/'.$conf->get('resource.theme').'/'; // template directory
|
||||
$conf->setEmpty('resource.theme', 'default');
|
||||
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);
|
||||
$pluginManager->load($conf->get('general.enabled_plugins'));
|
||||
|
||||
date_default_timezone_set($conf->get('general.timezone', 'UTC'));
|
||||
|
||||
ob_start(); // Output buffering for the page cache.
|
||||
|
|
|
@ -288,7 +288,8 @@ 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.theme', 'tpl');
|
||||
$conf->set('resource.raintpl_tpl', 'tpl');
|
||||
$conf->set('resource.theme', 'default');
|
||||
$conf->set('resource.update_check', 'data/lastupdatecheck.txt');
|
||||
|
||||
$this->assertEquals(
|
||||
|
@ -311,11 +312,13 @@ 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.theme', 'null/tpl');
|
||||
$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',
|
||||
|
|
Loading…
Reference in New Issue