]>
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/'); |
e46efced | 17 | |
18 | include 'db.php'; | |
19 | include 'functions.php'; | |
20 | require_once 'Readability.php'; | |
21 | require_once 'Encoding.php'; | |
8046748b | 22 | require_once 'rain.tpl.class.php'; |
23 | ||
24 | $db = new db(DB_PATH); | |
25 | ||
139769aa | 26 | # Initialisation de RainTPL |
8046748b | 27 | raintpl::$tpl_dir = './tpl/'; |
28 | raintpl::$cache_dir = './cache/'; | |
29 | raintpl::$base_url = get_poche_url(); | |
30 | raintpl::configure('path_replace', false); | |
31 | raintpl::configure('debug', false); | |
cf3180f6 | 32 | $tpl = new raintpl(); |
33 | ||
139769aa | 34 | # Démarrage session et initialisation du jeton de sécurité |
cf3180f6 | 35 | session_start(); |
36 | ||
37 | if (!isset($_SESSION['token_poche'])) { | |
38 | $token = md5(uniqid(rand(), TRUE)); | |
39 | $_SESSION['token_poche'] = $token; | |
40 | $_SESSION['token_time_poche'] = time(); | |
139769aa | 41 | } |
42 | ||
43 | # Traitement des paramètres et déclenchement des actions | |
9fee2e72 | 44 | $view = (isset ($_REQUEST['view'])) ? htmlentities($_REQUEST['view']) : 'index'; |
139769aa | 45 | $action = (isset ($_REQUEST['action'])) ? htmlentities($_REQUEST['action']) : ''; |
139769aa | 46 | $_SESSION['sort'] = (isset ($_REQUEST['sort'])) ? htmlentities($_REQUEST['sort']) : 'id'; |
47 | $id = (isset ($_REQUEST['id'])) ? htmlspecialchars($_REQUEST['id']) : ''; | |
48 | $url = (isset ($_GET['url'])) ? $_GET['url'] : ''; | |
49 | $token = (isset ($_REQUEST['token'])) ? $_REQUEST['token'] : ''; | |
50 | ||
51 | if ($action != '') { | |
52 | action_to_do($action, $id, $url, $token); | |
1c182b6c | 53 | } |