]> git.immae.eu Git - github/wallabag/wallabag.git/blame - inc/config.php
rename pocheTool -> pocheTools
[github/wallabag/wallabag.git] / inc / config.php
CommitLineData
e46efced 1<?php
2/**
3 * poche, a read it later open source system
4 *
5 * @category poche
6 * @author Nicolas Lœuillet <nicolas@loeuillet.org>
7 * @copyright 2013
8 * @license http://www.wtfpl.net/ see COPYING file
9 */
1c182b6c 10
538cdfa8 11define ('POCHE_VERSION', '0.3');
4d8bcc0c 12define ('MODE_DEMO', FALSE);
5ffe5cf5 13define ('DEBUG_POCHE', TRUE);
a4565e88
NL
14define ('CONVERT_LINKS_FOOTNOTES', FALSE);
15define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
16define ('DOWNLOAD_PICTURES', FALSE);
aa8c9f2a 17define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX');
a4565e88
NL
18define ('ABS_PATH', 'assets/');
19define ('TPL', './tpl');
20define ('LOCALE', './locale');
21define ('CACHE', './cache');
2ee436ea
NL
22define ('LANG', 'fr_FR.UTF8');
23
14890de3 24$storage_type = 'sqlite'; # sqlite or file
e46efced 25
a4565e88
NL
26# /!\ Be careful if you change the lines below /!\
27
5ffe5cf5 28require_once 'poche/pocheTools.class.php';
8069e235
NL
29require_once 'poche/pocheCore.php';
30require_once '3rdparty/Readability.php';
31require_once '3rdparty/Encoding.php';
32require_once '3rdparty/Session.class.php';
33require_once '3rdparty/Twig/Autoloader.php';
14890de3 34require_once 'store/store.class.php';
a4565e88 35require_once 'store/' . $storage_type . '.class.php';
8046748b 36
a4565e88 37if (DOWNLOAD_PICTURES) {
8069e235 38 require_once 'poche/pochePicture.php';
a4565e88
NL
39}
40
41# i18n
42putenv('LC_ALL=' . LANG);
43setlocale(LC_ALL, LANG);
44bindtextdomain(LANG, LOCALE);
45textdomain(LANG);
46
47# template engine
48Twig_Autoloader::register();
49$loader = new Twig_Loader_Filesystem(TPL);
50$twig = new Twig_Environment($loader, array(
51 'cache' => CACHE,
52));
53$twig->addExtension(new Twig_Extensions_Extension_I18n());
f0070a15 54
a4565e88
NL
55Session::init();
56$store = new $storage_type();
aa8c9f2a 57
a4565e88 58# installation
aa8c9f2a
NL
59if(!$store->isInstalled())
60{
a4565e88
NL
61 pocheTool::logm('poche still not installed');
62 echo $twig->render('install.twig', array(
63 'token' => Session::getToken(),
64 ));
aa8c9f2a
NL
65 if (isset($_GET['install'])) {
66 if (($_POST['password'] == $_POST['password_repeat'])
67 && $_POST['password'] != "" && $_POST['login'] != "") {
a4565e88 68 # let's rock, install poche baby !
aa8c9f2a
NL
69 $store->install($_POST['login'], encode_string($_POST['password'] . $_POST['login']));
70 Session::logout();
a4565e88 71 pocheTool::redirect();
aa8c9f2a
NL
72 }
73 }
74 exit();
75}
76
77$_SESSION['login'] = (isset ($_SESSION['login'])) ? $_SESSION['login'] : $store->getLogin();
a4565e88 78$_SESSION['pass'] = (isset ($_SESSION['pass'])) ? $_SESSION['pass'] : $store->getPassword();