]> git.immae.eu Git - github/wallabag/wallabag.git/blob - inc/config.php
386fd0360fb941f193b86ef39aef04a9d8e1410e
[github/wallabag/wallabag.git] / inc / config.php
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 */
10
11 if (!is_dir('db/')) {
12 @mkdir('db/',0705);
13 }
14
15 define ('DB_PATH', 'sqlite:./db/poche.sqlite');
16 define ('ABS_PATH', 'assets/');
17 define ('CONVERT_LINKS_FOOTNOTES', TRUE);
18 define ('DOWNLOAD_PICTURES', TRUE);
19
20 include 'db.php';
21 include 'functions.php';
22 require_once 'Readability.php';
23 require_once 'Encoding.php';
24 require_once 'rain.tpl.class.php';
25
26 $db = new db(DB_PATH);
27
28 # Initialisation de RainTPL
29 raintpl::$tpl_dir = './tpl/';
30 raintpl::$cache_dir = './cache/';
31 raintpl::$base_url = get_poche_url();
32 raintpl::configure('path_replace', false);
33 raintpl::configure('debug', false);
34 $tpl = new raintpl();
35
36 # Démarrage session et initialisation du jeton de sécurité
37 session_start();
38
39 if (!isset($_SESSION['token_poche'])) {
40 $token = md5(uniqid(rand(), TRUE));
41 $_SESSION['token_poche'] = $token;
42 $_SESSION['token_time_poche'] = time();
43 }
44
45 # Traitement des paramètres et déclenchement des actions
46 $view = (isset ($_REQUEST['view'])) ? htmlentities($_REQUEST['view']) : 'index';
47 $action = (isset ($_REQUEST['action'])) ? htmlentities($_REQUEST['action']) : '';
48 $_SESSION['sort'] = (isset ($_REQUEST['sort'])) ? htmlentities($_REQUEST['sort']) : 'id';
49 $id = (isset ($_REQUEST['id'])) ? htmlspecialchars($_REQUEST['id']) : '';
50 $url = (isset ($_GET['url'])) ? $_GET['url'] : '';
51 $token = (isset ($_REQUEST['token'])) ? $_REQUEST['token'] : '';
52
53 if ($action != '') {
54 action_to_do($action, $url, $token, $id);
55 }