]> git.immae.eu Git - github/wallabag/wallabag.git/blame - inc/config.php
add Twig & refactor poche
[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);
a4565e88
NL
13define ('CONVERT_LINKS_FOOTNOTES', FALSE);
14define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
15define ('DOWNLOAD_PICTURES', FALSE);
aa8c9f2a 16define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX');
a4565e88
NL
17define ('ABS_PATH', 'assets/');
18define ('TPL', './tpl');
19define ('LOCALE', './locale');
20define ('CACHE', './cache');
2ee436ea
NL
21define ('LANG', 'fr_FR.UTF8');
22
14890de3 23$storage_type = 'sqlite'; # sqlite or file
e46efced 24
a4565e88
NL
25# /!\ Be careful if you change the lines below /!\
26
27require_once 'pocheCore.php';
e46efced 28require_once 'Readability.php';
29require_once 'Encoding.php';
a4565e88 30require_once 'pocheTool.class.php';
e4d2565e 31require_once 'Session.class.php';
a4565e88 32require_once 'Twig/Autoloader.php';
14890de3 33require_once 'store/store.class.php';
a4565e88 34require_once 'store/' . $storage_type . '.class.php';
8046748b 35
a4565e88
NL
36if (DOWNLOAD_PICTURES) {
37 require_once 'pochePicture.php';
38}
39
40# i18n
41putenv('LC_ALL=' . LANG);
42setlocale(LC_ALL, LANG);
43bindtextdomain(LANG, LOCALE);
44textdomain(LANG);
45
46# template engine
47Twig_Autoloader::register();
48$loader = new Twig_Loader_Filesystem(TPL);
49$twig = new Twig_Environment($loader, array(
50 'cache' => CACHE,
51));
52$twig->addExtension(new Twig_Extensions_Extension_I18n());
f0070a15 53
a4565e88
NL
54Session::init();
55$store = new $storage_type();
aa8c9f2a 56
a4565e88 57# installation
aa8c9f2a
NL
58if(!$store->isInstalled())
59{
a4565e88
NL
60 pocheTool::logm('poche still not installed');
61 echo $twig->render('install.twig', array(
62 'token' => Session::getToken(),
63 ));
aa8c9f2a
NL
64 if (isset($_GET['install'])) {
65 if (($_POST['password'] == $_POST['password_repeat'])
66 && $_POST['password'] != "" && $_POST['login'] != "") {
a4565e88 67 # let's rock, install poche baby !
aa8c9f2a
NL
68 $store->install($_POST['login'], encode_string($_POST['password'] . $_POST['login']));
69 Session::logout();
a4565e88 70 pocheTool::redirect();
aa8c9f2a
NL
71 }
72 }
73 exit();
74}
75
76$_SESSION['login'] = (isset ($_SESSION['login'])) ? $_SESSION['login'] : $store->getLogin();
a4565e88 77$_SESSION['pass'] = (isset ($_SESSION['pass'])) ? $_SESSION['pass'] : $store->getPassword();