]>
Commit | Line | Data |
---|---|---|
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 | 11 | define ('POCHE_VERSION', '0.3'); |
4d8bcc0c | 12 | define ('MODE_DEMO', FALSE); |
5ffe5cf5 | 13 | define ('DEBUG_POCHE', TRUE); |
a4565e88 NL |
14 | define ('CONVERT_LINKS_FOOTNOTES', FALSE); |
15 | define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); | |
16 | define ('DOWNLOAD_PICTURES', FALSE); | |
aa8c9f2a | 17 | define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX'); |
a4565e88 NL |
18 | define ('ABS_PATH', 'assets/'); |
19 | define ('TPL', './tpl'); | |
20 | define ('LOCALE', './locale'); | |
21 | define ('CACHE', './cache'); | |
2ee436ea NL |
22 | define ('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 | 28 | require_once 'poche/pocheTools.class.php'; |
8069e235 NL |
29 | require_once 'poche/pocheCore.php'; |
30 | require_once '3rdparty/Readability.php'; | |
31 | require_once '3rdparty/Encoding.php'; | |
32 | require_once '3rdparty/Session.class.php'; | |
33 | require_once '3rdparty/Twig/Autoloader.php'; | |
14890de3 | 34 | require_once 'store/store.class.php'; |
a4565e88 | 35 | require_once 'store/' . $storage_type . '.class.php'; |
8046748b | 36 | |
a4565e88 | 37 | if (DOWNLOAD_PICTURES) { |
8069e235 | 38 | require_once 'poche/pochePicture.php'; |
a4565e88 NL |
39 | } |
40 | ||
41 | # i18n | |
42 | putenv('LC_ALL=' . LANG); | |
43 | setlocale(LC_ALL, LANG); | |
44 | bindtextdomain(LANG, LOCALE); | |
45 | textdomain(LANG); | |
46 | ||
47 | # template engine | |
48 | Twig_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 |
55 | Session::init(); |
56 | $store = new $storage_type(); | |
aa8c9f2a | 57 | |
a4565e88 | 58 | # installation |
aa8c9f2a NL |
59 | if(!$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(); |