Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved all configuration to a YAML system #108

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ Copyright: 2011-2012, Federico Ulfo <[email protected]>
2011-2012, The Rain Team <[email protected]>
License: LGPL-3+ (https://www.gnu.org/licenses/lgpl-3.0.txt)

Files: vendor/symfony/*
License: MIT (http://opensource.org/licenses/MIT)
Copyright: (C) 2004-2015 Fabien Potencier http://symfony.com/

----------------------------------------------------
ZLIB/LIBPNG LICENSE

Expand Down
40 changes: 40 additions & 0 deletions data/conf.dist.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
dev: true
dirs:
data: data/
cache: cache/
pagecache: pagecache/
raintpl_temp: tmp/
raintpl_templates: tpl/
files:
user: config.php
datastore: datastore.php
ipbans: ipbans.php
update: lastupdatecheck.txt
bans:
ban_after: 4
ban_duration: 1800
display:
links_per_page: 20
hide_timestamps: false
show_atom: false
enable_thumbnails: true
title: 'Shared links'
page_title: ''
timezone: 'Europe/London'
default_link_name: '?'
cache:
enable: true
security:
open_shaarli: false
disable_session_protection: false
disable_jquery: false
private_links_by_default: false
pubsubhub:
url: ''
update:
interval: 86400
rss:
permalink_in_title: true
redirector: ''
plugins:
archive_org: true
390 changes: 249 additions & 141 deletions index.php
100644 → 100755

Large diffs are not rendered by default.

Empty file modified tpl/addlink.html
100644 → 100755
Empty file.
Empty file modified tpl/changepassword.html
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions tpl/changetag.html
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>{include="includes"}
{if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>{/if}
{if="!$options.security.disable_jquery"}<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>{/if}
</head>
<body onload="document.changetag.fromtag.focus();">
<div id="pageheader">
Expand All @@ -15,7 +15,7 @@
<script>function confirmDeleteTag() { var agree=confirm("Are you sure you want to delete this tag from all links ?"); if (agree) return true ; else return false ; }</script>
</div>
{include="page.footer"}
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
{if="($options.security.open_shaarli || $logged_in) && !$options.security.disable_jquery"}
<script>
$(document).ready(function()
{
Expand Down
17 changes: 11 additions & 6 deletions tpl/configure.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<body onload="document.configform.title.focus();">
<div id="pageheader">
{include="page.header"}
{$timezone_js}
{$timezone_js}
<form method="POST" action="#" name="configform" id="configform">
<input type="hidden" name="token" value="{$token}">
<table id="configuration_table">
Expand All @@ -16,18 +16,23 @@

<tr><td><b>Redirector</b></td><td><input type="text" name="redirector" id="redirector" size="50" value="{$redirector}"><br>(e.g. <i>http://anonym.to/?</i> will mask the HTTP_REFERER)</td></tr>

<tr><td><b>Security:</b></td><td><input type="checkbox" name="disablesessionprotection" id="disablesessionprotection" {if="!empty($GLOBALS['disablesessionprotection'])"}checked{/if}><label for="disablesessionprotection">&nbsp;Disable session cookie hijacking protection (Check this if you get disconnected often or if your IP address changes often.)</label></td></tr>
<tr><td><b>Security:</b></td><td><input type="checkbox" name="disablesessionprotection" id="disablesessionprotection" {if="$options.security.disable_session_protection"}checked{/if}><label for="disablesessionprotection">&nbsp;Disable session cookie hijacking protection (Check this if you get disconnected often or if your IP address changes often.)</label></td></tr>

<tr><td><b>Features:</b></td><td>
<input type="checkbox" name="disablejquery" id="disablejquery" {if="!empty($GLOBALS['disablejquery'])"}checked{/if}><label for="disablejquery">&nbsp;Disable jQuery and all heavy JavaScript (for example: Autocomplete in tags. Useful for slow computers.)</label>
<input type="checkbox" name="disablejquery" id="disablejquery" {if="$options.security.disable_jquery"}checked{/if}><label for="disablejquery">&nbsp;Disable jQuery and all heavy JavaScript (for example: Autocomplete in tags. Useful for slow computers.)</label>
</td></tr>
<tr><td valign="top"><b>New link:</b></td><td>
<input type="checkbox" name="privateLinkByDefault" id="privateLinkByDefault" {if="!empty($GLOBALS['privateLinkByDefault'])"}checked{/if}/><label for="privateLinkByDefault">&nbsp;All new links are private by default</label></td>
<tr>
<td>
<b>New link:</b>
</td>
<td>
<input type="checkbox" name="privateLinkByDefault" id="privateLinkByDefault" {if="$options.security.private_links_by_default"}checked{/if}/><label for="privateLinkByDefault">&nbsp;All new links are private by default</label>
</td>
</tr>
<tr>
<td valign="top"><b>Enable RSS Permalinks</b></td>
<td>
<input type="checkbox" name="enableRssPermalinks" id="enableRssPermalinks" {if="!empty($GLOBALS['config']['ENABLE_RSS_PERMALINKS'])"}checked{/if}/><label for="enableRssPermalinks">&nbsp;Switches the RSS feed URLs between full URLs and shortlinks. Enabling it will show a permalink in the description, and the feed item will be linked to the absolute URL. Disabling it swaps this behaviour around (permalink in title and link in description). RSS Permalinks are currently <b>{if="$GLOBALS['config']['ENABLE_RSS_PERMALINKS']"}enabled{else}disabled{/if}</b></label>
<input type="checkbox" name="enableRssPermalinks" id="enableRssPermalinks" {if="!$options.rss.permalink_in_title"}checked{/if}/><label for="enableRssPermalinks">&nbsp;Switches the RSS feed URLs between full URLs and shortlinks. Enabling it will show a permalink in the description, and the feed item will be linked to the absolute URL. Disabling it swaps this behaviour around (permalink in title and link in description). RSS Permalinks are currently <b>{if="!$options.rss.permalink_in_title"}enabled{else}disabled{/if}</b></label>
</td>
</tr>
<tr><td></td><td class="right"><input type="submit" name="Save" value="Save config" class="bigbutton"></td></tr>
Expand Down
2 changes: 1 addition & 1 deletion tpl/daily.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink">
</a>
</div>
{if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"}
{if="$options.display.hide_timestamps || $logged_in"}
<div class="dailyEntryLinkdate">
<a href="?{$link.linkdate|smallHash}">{$link.localdate}</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tpl/dailyrss.html
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{loop="links"}
<h3><a href="{$value.url}">{$value.title|htmlspecialchars}</a></h3>
<small>{if="!$GLOBALS['config']['HIDE_TIMESTAMPS']"}{$value.localdate|htmlspecialchars} - {/if}{if="$value.tags"}{$value.tags|htmlspecialchars}{/if}<br>
<small>{if="!$options.display.hide_timestamps"}{$value.localdate|htmlspecialchars} - {/if}{if="$value.tags"}{$value.tags|htmlspecialchars}{/if}<br>
{$value.url|htmlspecialchars}</small><br>
{if="$value.thumbnail"}{$value.thumbnail}{/if}<br>
{if="$value.description"}{$value.formatedDescription}{/if}
Expand Down
6 changes: 3 additions & 3 deletions tpl/editlink.html
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>{include="includes"}
{if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery-1.11.2.min.js#"></script><script src="inc/jquery-ui-1.11.2.min.js#"></script>{/if}
{if="!$options.security.disable_jquery"}<script src="inc/jquery-1.11.2.min.js#"></script><script src="inc/jquery-ui-1.11.2.min.js#"></script>{/if}
</head>
<body
{if="$link.title==''"}onload="document.linkform.lf_title.focus();"
Expand All @@ -16,7 +16,7 @@
<i>Title</i><br><input type="text" name="lf_title" value="{$link.title|htmlspecialchars}" class="lf_input"><br>
<i>Description</i><br><textarea name="lf_description" rows="4" cols="25">{$link.description|htmlspecialchars}</textarea><br>
<i>Tags</i><br><input type="text" id="lf_tags" name="lf_tags" value="{$link.tags|htmlspecialchars}" class="lf_input"><br>
{if="($link_is_new && $GLOBALS['privateLinkByDefault']==true) || $link.private == true"}
{if="($link_is_new && $options.security.private_links_by_default) || $link.private == true"}
<input type="checkbox" checked="checked" name="lf_private" id="lf_private">
&nbsp;<label for="lf_private"><i>Private</i></label><br>
{else}
Expand All @@ -32,7 +32,7 @@
</div>
</div>
{include="page.footer"}
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
{if="($options.security.open_shaarli || $logged_in) && $options.security.disable_jquery"}
<script>
$(document).ready(function()
{
Expand Down
Empty file modified tpl/export.html
100644 → 100755
Empty file.
Empty file modified tpl/import.html
100644 → 100755
Empty file.
Empty file modified tpl/includes.html
100644 → 100755
Empty file.
Empty file modified tpl/install.html
100644 → 100755
Empty file.
7 changes: 3 additions & 4 deletions tpl/linklist.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
</div>

<div id="linklist">

{include="linklist.paging"}

{if="count($links)==0"}
Expand All @@ -33,7 +32,7 @@
<a id="{$value.linkdate|smallHash}"></a>
<div class="thumbnail">{$value.url|thumbnail}</div>
<div class="linkcontainer">
{if="isLoggedIn()"}
{if="$logged_in"}
<div class="linkeditbuttons">
<form method="GET" class="buttoneditform"><input type="hidden" name="edit_link" value="{$value.linkdate}"><input type="image" alt="Edit" src="images/edit_icon.png#" title="Edit" class="button_edit"></form><br>
<form method="POST" class="buttoneditform"><input type="hidden" name="lf_linkdate" value="{$value.linkdate}">
Expand All @@ -43,12 +42,12 @@
<span class="linktitle"><a href="{$redirector}{$value.url|htmlspecialchars}">{$value.title|htmlspecialchars}</a></span>
<br>
{if="$value.description"}<div class="linkdescription">{$value.description}</div>{/if}
{if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"}
{if="!$options.display.hide_timestamps || $logged_in"}
<span class="linkdate" title="Permalink"><a href="?{$value.linkdate|smallHash}">{$value.localdate|htmlspecialchars} - permalink</a> - </span>
{else}
<span class="linkdate" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span>
{/if}
{if="$GLOBALS['config']['ARCHIVE_ORG']"}
{if="$options.plugins.archive_org"}
<span class="linkarchive"><a href="https://web.archive.org/web/{$value.url|htmlspecialchars}">archive</a> - </span>
{/if}
<div class="linkqrcode"><a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d={$scripturl|urlencode}%3F{$value.linkdate|smallHash}"
Expand Down
2 changes: 1 addition & 1 deletion tpl/linklist.paging.html
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="paging">
{if="isLoggedIn()"}
{if="$logged_in"}
<div class="paging_privatelinks">
<a href="?privateonly">
{if="$privateonly"}
Expand Down
Empty file modified tpl/loginform.html
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion tpl/page.footer.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
{if="$newversion"}
<div id="newversion"><span id="version_id">&#x25CF;</span> Shaarli {$newversion|htmlspecialchars} is <a href="https://github.com/shaarli/Shaarli/releases">available</a>.</div>
{/if}
{if="isLoggedIn()"}
{if="$logged_in"}
<script>function confirmDeleteLink() { var agree=confirm("Are you sure you want to delete this link ?"); if (agree) return true ; else return false ; }</script>
{/if}
6 changes: 3 additions & 3 deletions tpl/page.header.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
{ignore} When called as a popup from bookmarklet, do not display menu. {/ignore}
{else}
<a href="?" class="nomobile">Home</a>
{if="isLoggedIn()"}
{if="$logged_in"}
<a href="?do=logout">Logout</a><a href="?do=tools">Tools</a><a href="?do=addlink"><b>Add link</b></a>
{elseif="$GLOBALS['config']['OPEN_SHAARLI']"}
{elseif="$options.security.open_shaarli"}
<a href="?do=tools">Tools</a><a href="?do=addlink"><b>Add link</b></a>
{else}
<a href="?do=login">Login</a>
{/if}
<a href="{$feedurl}?do=rss{$searchcrits}" class="nomobile">RSS Feed</a>
{if="$GLOBALS['config']['SHOW_ATOM']"}
{if="$options.display.show_atom"}
<a href="{$feedurl}?do=atom{$searchcrits}" class="nomobile">ATOM Feed</a>
{/if}
<a href="?do=tagcloud">Tag cloud</a>
Expand Down
Empty file modified tpl/page.html
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions tpl/picwall.html
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>{include="includes"}
{if="empty($GLOBALS['disablejquery'])"}
{if="!$options.security.disable_jquery"}
<script src="inc/jquery-1.11.2.min.js#"></script>
<script src="inc/jquery-ui-1.11.2.min.js#"></script>
<script src="inc/jquery.lazyload-1.9.3.min.js#"></script>
Expand All @@ -20,7 +20,7 @@
</div>
{include="page.footer"}

{if="empty($GLOBALS['disablejquery'])"}
{if="!$options.security.disable_jquery"}
<script>
$(document).ready(function() {
$("img.lazyimage").show().lazyload();
Expand Down
Empty file modified tpl/picwall2.html
100644 → 100755
Empty file.
Empty file modified tpl/readme.txt
100644 → 100755
Empty file.
Empty file modified tpl/tagcloud.html
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion tpl/tools.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div id="pageheader">
{include="page.header"}
<div id="toolsdiv">
{if="!$GLOBALS['config']['OPEN_SHAARLI']"}<a href="?do=changepasswd"><b>Change password</b> <span>: Change your password.</span></a><br><br>{/if}
{if="!$options.security.open_shaarli"}<a href="?do=changepasswd"><b>Change password</b> <span>: Change your password.</span></a><br><br>{/if}
<a href="?do=configure"><b>Configure your Shaarli</b> <span>: Change Title, timezone...</span></a><br><br>
<a href="?do=changetag"><b>Rename/delete tags</b> <span>: Rename or delete a tag in all links</span></a><br><br>
<a href="?do=import"><b>Import</b> <span>: Import Netscape html bookmarks (as exported from Firefox, Chrome, Opera, delicious...)</span></a> <br><br>
Expand Down
3 changes: 3 additions & 0 deletions vendor/symfony/yaml/Symfony/Component/Yaml/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml
8 changes: 8 additions & 0 deletions vendor/symfony/yaml/Symfony/Component/Yaml/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CHANGELOG
=========

2.1.0
-----

* Yaml::parse() does not evaluate loaded files as PHP files by default
anymore (call Yaml::enablePhpParsing() to get back the old behavior)
73 changes: 73 additions & 0 deletions vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Yaml;

/**
* Dumper dumps PHP variables to YAML strings.
*
* @author Fabien Potencier <[email protected]>
*/
class Dumper
{
/**
* The amount of spaces to use for indentation of nested nodes.
*
* @var int
*/
protected $indentation = 4;

/**
* Sets the indentation.
*
* @param int $num The amount of spaces to use for indentation of nested nodes.
*/
public function setIndentation($num)
{
$this->indentation = (int) $num;
}

/**
* Dumps a PHP value to YAML.
*
* @param mixed $input The PHP value
* @param int $inline The level where you switch to inline YAML
* @param int $indent The level of indentation (used internally)
* @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
* @param bool $objectSupport true if object support is enabled, false otherwise
*
* @return string The YAML representation of the PHP value
*/
public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = false, $objectSupport = false)
{
$output = '';
$prefix = $indent ? str_repeat(' ', $indent) : '';

if ($inline <= 0 || !is_array($input) || empty($input)) {
$output .= $prefix.Inline::dump($input, $exceptionOnInvalidType, $objectSupport);
} else {
$isAHash = array_keys($input) !== range(0, count($input) - 1);

foreach ($input as $key => $value) {
$willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value);

$output .= sprintf('%s%s%s%s',
$prefix,
$isAHash ? Inline::dump($key, $exceptionOnInvalidType, $objectSupport).':' : '-',
$willBeInlined ? ' ' : "\n",
$this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $exceptionOnInvalidType, $objectSupport)
).($willBeInlined ? "\n" : '');
}
}

return $output;
}
}
Loading