mirror of
https://github.com/moparisthebest/wallabag
synced 2024-12-24 08:18:48 -05:00
more verif while installing
This commit is contained in:
parent
ca1b0a1a6f
commit
4a2912880f
@ -18,11 +18,10 @@ class Poche
|
|||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
if (file_exists('./install') && !DEBUG_POCHE) {
|
$this->initTpl();
|
||||||
Tools::logm('folder /install exists');
|
if (!$this->checkBeforeInstall()) {
|
||||||
die('If you want to update your poche, you just have to delete /install folder. <br />To install your poche with sqlite, copy /install/poche.sqlite in /db and delete the folder /install. you have to delete the /install folder before using poche.');
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->store = new Database();
|
$this->store = new Database();
|
||||||
$this->init();
|
$this->init();
|
||||||
$this->messages = new Messages();
|
$this->messages = new Messages();
|
||||||
@ -34,6 +33,56 @@ class Poche
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* all checks before installation.
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
private function checkBeforeInstall()
|
||||||
|
{
|
||||||
|
$msg = '';
|
||||||
|
$allIsGood = TRUE;
|
||||||
|
if (file_exists('./install') && !DEBUG_POCHE) {
|
||||||
|
Tools::logm('folder /install exists');
|
||||||
|
$msg = 'If you want to update your poche, you just have to delete /install folder. <br />To install your poche with sqlite, copy /install/poche.sqlite in /db and delete the folder /install. you have to delete the /install folder before using poche.';
|
||||||
|
$allIsGood = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (STORAGE == 'sqlite' && !is_writable(STORAGE_SQLITE)) {
|
||||||
|
Tools::logm('you don\'t have write access on db file');
|
||||||
|
$msg = 'You don\'t have write access on ' . STORAGE_SQLITE . ' file.';
|
||||||
|
$allIsGood = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$allIsGood) {
|
||||||
|
echo $this->tpl->render('error.twig', array(
|
||||||
|
'msg' => $msg
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $allIsGood;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function initTpl()
|
||||||
|
{
|
||||||
|
# template engine
|
||||||
|
$loader = new Twig_Loader_Filesystem(TPL);
|
||||||
|
if (DEBUG_POCHE) {
|
||||||
|
$twig_params = array();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$twig_params = array('cache' => CACHE);
|
||||||
|
}
|
||||||
|
$this->tpl = new Twig_Environment($loader, $twig_params);
|
||||||
|
$this->tpl->addExtension(new Twig_Extensions_Extension_I18n());
|
||||||
|
# filter to display domain name of an url
|
||||||
|
$filter = new Twig_SimpleFilter('getDomain', 'Tools::getDomain');
|
||||||
|
$this->tpl->addFilter($filter);
|
||||||
|
|
||||||
|
# filter for reading time
|
||||||
|
$filter = new Twig_SimpleFilter('getReadingTime', 'Tools::getReadingTime');
|
||||||
|
$this->tpl->addFilter($filter);
|
||||||
|
}
|
||||||
|
|
||||||
private function init()
|
private function init()
|
||||||
{
|
{
|
||||||
Tools::initPhp();
|
Tools::initPhp();
|
||||||
@ -55,24 +104,6 @@ class Poche
|
|||||||
bindtextdomain($language, LOCALE);
|
bindtextdomain($language, LOCALE);
|
||||||
textdomain($language);
|
textdomain($language);
|
||||||
|
|
||||||
# template engine
|
|
||||||
$loader = new Twig_Loader_Filesystem(TPL);
|
|
||||||
if (DEBUG_POCHE) {
|
|
||||||
$twig_params = array();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$twig_params = array('cache' => CACHE);
|
|
||||||
}
|
|
||||||
$this->tpl = new Twig_Environment($loader, $twig_params);
|
|
||||||
$this->tpl->addExtension(new Twig_Extensions_Extension_I18n());
|
|
||||||
# filter to display domain name of an url
|
|
||||||
$filter = new Twig_SimpleFilter('getDomain', 'Tools::getDomain');
|
|
||||||
$this->tpl->addFilter($filter);
|
|
||||||
|
|
||||||
# filter for reading time
|
|
||||||
$filter = new Twig_SimpleFilter('getReadingTime', 'Tools::getReadingTime');
|
|
||||||
$this->tpl->addFilter($filter);
|
|
||||||
|
|
||||||
# Pagination
|
# Pagination
|
||||||
$this->pagination = new Paginator($this->user->getConfigValue('pager'), 'p');
|
$this->pagination = new Paginator($this->user->getConfigValue('pager'), 'p');
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,10 @@ define ('PAGINATION', '10');
|
|||||||
define ('THEME', 'light');
|
define ('THEME', 'light');
|
||||||
|
|
||||||
# /!\ Be careful if you change the lines below /!\
|
# /!\ Be careful if you change the lines below /!\
|
||||||
|
if (!file_exists('./vendor/autoload.php')) {
|
||||||
|
die('Twig does not seem installed. Have a look at <a href="http://inthepoche.com/?pages/Documentation">the documentation.</a>');
|
||||||
|
}
|
||||||
|
|
||||||
require_once './inc/poche/User.class.php';
|
require_once './inc/poche/User.class.php';
|
||||||
require_once './inc/poche/Tools.class.php';
|
require_once './inc/poche/Tools.class.php';
|
||||||
require_once './inc/poche/Url.class.php';
|
require_once './inc/poche/Url.class.php';
|
||||||
|
7
tpl/error.twig
Normal file
7
tpl/error.twig
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{% extends "layout.twig" %}
|
||||||
|
{% block title %}{% trans "error" %}{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<h1>error</h1>
|
||||||
|
<p>{{ msg|raw }}</p>
|
||||||
|
<p>Don't forget <a href="http://inthepoche.com/?pages/Documentation">the documentation</a>.</p>
|
||||||
|
{% endblock %}
|
@ -7,21 +7,21 @@
|
|||||||
<p>
|
<p>
|
||||||
{% trans "poche is still not installed. Please fill the below form to install it. Don't hesitate to <a href='http://inthepoche.com/?pages/Documentation'>read the documentation on poche website</a>." %}
|
{% trans "poche is still not installed. Please fill the below form to install it. Don't hesitate to <a href='http://inthepoche.com/?pages/Documentation'>read the documentation on poche website</a>." %}
|
||||||
</p>
|
</p>
|
||||||
<div class="row">
|
<p class="row">
|
||||||
<label class="col w150p" for="login">{% trans "Login" %}</label>
|
<label class="col w150p" for="login">{% trans "Login" %}</label>
|
||||||
<input class="col" type="text" id="login" name="login" placeholder="Login" tabindex="1" autofocus />
|
<input class="col" type="text" id="login" name="login" placeholder="Login" tabindex="1" autofocus />
|
||||||
</div>
|
</p>
|
||||||
<div class="row">
|
<p class="row">
|
||||||
<label class="col w150p" for="password">{% trans "Password" %}</label>
|
<label class="col w150p" for="password">{% trans "Password" %}</label>
|
||||||
<input class="col" type="password" id="password" name="password" placeholder="Password" tabindex="2">
|
<input class="col" type="password" id="password" name="password" placeholder="Password" tabindex="2">
|
||||||
</div>
|
</p>
|
||||||
<div class="row">
|
<p class="row">
|
||||||
<label class="col w150p" for="password_repeat">{% trans "Repeat your password" %}</label>
|
<label class="col w150p" for="password_repeat">{% trans "Repeat your password" %}</label>
|
||||||
<input class="col" type="password" id="password_repeat" name="password_repeat" placeholder="Password" tabindex="3">
|
<input class="col" type="password" id="password_repeat" name="password_repeat" placeholder="Password" tabindex="3">
|
||||||
</div>
|
</p>
|
||||||
<div class="row mts txtcenter">
|
<p class="row mts txtcenter">
|
||||||
<button class="bouton" type="submit" tabindex="4">{% trans "Install" %}</button>
|
<button class="bouton" type="submit" tabindex="4">{% trans "Install" %}</button>
|
||||||
</div>
|
</p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<input type="hidden" name="token" value="{{ token }}">
|
<input type="hidden" name="token" value="{{ token }}">
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user