]>
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 | |
d178419c | 11 | if (!is_dir('db/')) { |
12 | @mkdir('db/',0705); | |
13 | } | |
14 | ||
e46efced | 15 | define ('DB_PATH', 'sqlite:./db/poche.sqlite'); |
d178419c | 16 | define ('ABS_PATH', 'assets/'); |
d06f30ef | 17 | define ('CONVERT_LINKS_FOOTNOTES', TRUE); |
64458521 | 18 | define ('DOWNLOAD_PICTURES', TRUE); |
e46efced | 19 | |
20 | include 'db.php'; | |
21 | include 'functions.php'; | |
22 | require_once 'Readability.php'; | |
23 | require_once 'Encoding.php'; | |
8046748b | 24 | require_once 'rain.tpl.class.php'; |
25 | ||
26 | $db = new db(DB_PATH); | |
27 | ||
139769aa | 28 | # Initialisation de RainTPL |
8046748b | 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); | |
cf3180f6 | 34 | $tpl = new raintpl(); |
35 | ||
139769aa | 36 | # Démarrage session et initialisation du jeton de sécurité |
cf3180f6 | 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(); | |
139769aa | 43 | } |
44 | ||
45 | # Traitement des paramètres et déclenchement des actions | |
9fee2e72 | 46 | $view = (isset ($_REQUEST['view'])) ? htmlentities($_REQUEST['view']) : 'index'; |
139769aa | 47 | $action = (isset ($_REQUEST['action'])) ? htmlentities($_REQUEST['action']) : ''; |
139769aa | 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 != '') { | |
d06f30ef | 54 | action_to_do($action, $url, $token, $id); |
1c182b6c | 55 | } |