wallabag/inc/config.php

78 lines
2.3 KiB
PHP
Raw Normal View History

<?php
/**
* poche, a read it later open source system
*
* @category poche
* @author Nicolas Lœuillet <nicolas@loeuillet.org>
* @copyright 2013
* @license http://www.wtfpl.net/ see COPYING file
*/
define ('POCHE_VERSION', '0.3');
2013-07-31 19:58:14 +02:00
define ('MODE_DEMO', FALSE);
2013-08-02 23:00:57 +02:00
define ('DEBUG_POCHE', TRUE);
2013-08-02 22:40:51 +02:00
define ('CONVERT_LINKS_FOOTNOTES', FALSE);
define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
define ('DOWNLOAD_PICTURES', FALSE);
2013-05-31 22:55:52 +02:00
define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX');
2013-08-02 22:40:51 +02:00
define ('ABS_PATH', 'assets/');
define ('TPL', './tpl');
define ('LOCALE', './locale');
define ('CACHE', './cache');
define ('LANG', 'fr_FR.UTF8');
$storage_type = 'sqlite'; # sqlite or file
2013-08-02 22:40:51 +02:00
# /!\ Be careful if you change the lines below /!\
2013-08-02 23:00:57 +02:00
require_once 'poche/pocheTools.class.php';
2013-08-02 22:43:56 +02:00
require_once 'poche/pocheCore.php';
require_once '3rdparty/Readability.php';
require_once '3rdparty/Encoding.php';
require_once '3rdparty/Session.class.php';
require_once '3rdparty/Twig/Autoloader.php';
require_once 'store/store.class.php';
2013-08-02 22:40:51 +02:00
require_once 'store/' . $storage_type . '.class.php';
2013-08-02 22:40:51 +02:00
if (DOWNLOAD_PICTURES) {
2013-08-02 22:43:56 +02:00
require_once 'poche/pochePicture.php';
2013-08-02 22:40:51 +02:00
}
# i18n
putenv('LC_ALL=' . LANG);
setlocale(LC_ALL, LANG);
bindtextdomain(LANG, LOCALE);
textdomain(LANG);
# template engine
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem(TPL);
$twig = new Twig_Environment($loader, array(
'cache' => CACHE,
));
$twig->addExtension(new Twig_Extensions_Extension_I18n());
2013-08-02 22:40:51 +02:00
Session::init();
$store = new $storage_type();
2013-05-31 22:55:52 +02:00
2013-08-02 22:40:51 +02:00
# installation
2013-05-31 22:55:52 +02:00
if(!$store->isInstalled())
{
2013-08-02 23:04:24 +02:00
pocheTools::logm('poche still not installed');
2013-08-02 22:40:51 +02:00
echo $twig->render('install.twig', array(
'token' => Session::getToken(),
));
2013-05-31 22:55:52 +02:00
if (isset($_GET['install'])) {
if (($_POST['password'] == $_POST['password_repeat'])
&& $_POST['password'] != "" && $_POST['login'] != "") {
2013-08-02 22:40:51 +02:00
# let's rock, install poche baby !
2013-05-31 22:55:52 +02:00
$store->install($_POST['login'], encode_string($_POST['password'] . $_POST['login']));
Session::logout();
2013-08-02 23:04:24 +02:00
pocheTools::redirect();
2013-05-31 22:55:52 +02:00
}
}
exit();
}
$_SESSION['login'] = (isset ($_SESSION['login'])) ? $_SESSION['login'] : $store->getLogin();
2013-08-02 22:40:51 +02:00
$_SESSION['pass'] = (isset ($_SESSION['pass'])) ? $_SESSION['pass'] : $store->getPassword();