]>
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 | |
69ca1455 | 11 | define ('POCHE_VERSION', '0.2.1'); |
bf18db78 | 12 | |
d178419c | 13 | if (!is_dir('db/')) { |
14 | @mkdir('db/',0705); | |
15 | } | |
16 | ||
6499b26a | 17 | define ('MODE_DEMO', FALSE); |
d178419c | 18 | define ('ABS_PATH', 'assets/'); |
d06f30ef | 19 | define ('CONVERT_LINKS_FOOTNOTES', TRUE); |
2987031b | 20 | define ('REVERT_FORCED_PARAGRAPH_ELEMENTS',FALSE); |
64458521 | 21 | define ('DOWNLOAD_PICTURES', TRUE); |
aa8c9f2a | 22 | define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX'); |
14890de3 | 23 | $storage_type = 'sqlite'; # sqlite or file |
e46efced | 24 | |
e46efced | 25 | include 'functions.php'; |
26 | require_once 'Readability.php'; | |
27 | require_once 'Encoding.php'; | |
8046748b | 28 | require_once 'rain.tpl.class.php'; |
e4d2565e | 29 | require_once 'MyTool.class.php'; |
30 | require_once 'Session.class.php'; | |
14890de3 | 31 | require_once 'store/store.class.php'; |
32 | require_once 'store/sqlite.class.php'; | |
33 | require_once 'store/file.class.php'; | |
f0070a15 | 34 | require_once 'class.messages.php'; |
8046748b | 35 | |
f0070a15 | 36 | Session::init(); |
37 | ||
aa8c9f2a | 38 | $store = new $storage_type(); |
e4d2565e | 39 | # initialisation de RainTPL |
8046748b | 40 | raintpl::$tpl_dir = './tpl/'; |
41 | raintpl::$cache_dir = './cache/'; | |
42 | raintpl::$base_url = get_poche_url(); | |
43 | raintpl::configure('path_replace', false); | |
44 | raintpl::configure('debug', false); | |
f0070a15 | 45 | $tpl = new raintpl(); |
aa8c9f2a NL |
46 | |
47 | if(!$store->isInstalled()) | |
48 | { | |
49 | logm('poche still not installed'); | |
50 | $tpl->draw('install'); | |
51 | if (isset($_GET['install'])) { | |
52 | if (($_POST['password'] == $_POST['password_repeat']) | |
53 | && $_POST['password'] != "" && $_POST['login'] != "") { | |
54 | $store->install($_POST['login'], encode_string($_POST['password'] . $_POST['login'])); | |
55 | Session::logout(); | |
56 | MyTool::redirect(); | |
57 | } | |
58 | } | |
59 | exit(); | |
60 | } | |
61 | ||
62 | $_SESSION['login'] = (isset ($_SESSION['login'])) ? $_SESSION['login'] : $store->getLogin(); | |
63 | $_SESSION['pass'] = (isset ($_SESSION['pass'])) ? $_SESSION['pass'] : $store->getPassword(); | |
64 | ||
65 | $msg = new Messages(); | |
f0070a15 | 66 | $tpl->assign('msg', $msg); |