aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/config.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/config.php')
-rw-r--r--inc/config.php76
1 files changed, 40 insertions, 36 deletions
diff --git a/inc/config.php b/inc/config.php
index 6e3f80b8..7470f0c3 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -9,65 +9,69 @@
9 */ 9 */
10 10
11define ('POCHE_VERSION', '0.3'); 11define ('POCHE_VERSION', '0.3');
12
13if (!is_dir('db/')) {
14 @mkdir('db/',0705);
15}
16
17define ('MODE_DEMO', FALSE); 12define ('MODE_DEMO', FALSE);
18define ('ABS_PATH', 'assets/'); 13define ('CONVERT_LINKS_FOOTNOTES', FALSE);
19define ('CONVERT_LINKS_FOOTNOTES', TRUE); 14define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
20define ('REVERT_FORCED_PARAGRAPH_ELEMENTS',FALSE); 15define ('DOWNLOAD_PICTURES', FALSE);
21define ('DOWNLOAD_PICTURES', TRUE);
22define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX'); 16define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX');
17define ('ABS_PATH', 'assets/');
18define ('TPL', './tpl');
19define ('LOCALE', './locale');
20define ('CACHE', './cache');
23define ('LANG', 'fr_FR.UTF8'); 21define ('LANG', 'fr_FR.UTF8');
24 22
25putenv("LC_ALL=".LANG);
26setlocale(LC_ALL, LANG);
27bindtextdomain(LANG, "./locale");
28textdomain(LANG);
29
30$storage_type = 'sqlite'; # sqlite or file 23$storage_type = 'sqlite'; # sqlite or file
31 24
32include 'functions.php'; 25# /!\ Be careful if you change the lines below /!\
26
27require_once 'pocheCore.php';
33require_once 'Readability.php'; 28require_once 'Readability.php';
34require_once 'Encoding.php'; 29require_once 'Encoding.php';
35require_once 'rain.tpl.class.php'; 30require_once 'pocheTool.class.php';
36require_once 'MyTool.class.php';
37require_once 'Session.class.php'; 31require_once 'Session.class.php';
32require_once 'Twig/Autoloader.php';
38require_once 'store/store.class.php'; 33require_once 'store/store.class.php';
39require_once 'store/sqlite.class.php'; 34require_once 'store/' . $storage_type . '.class.php';
40require_once 'store/file.class.php';
41require_once 'class.messages.php';
42 35
43Session::init(); 36if (DOWNLOAD_PICTURES) {
37 require_once 'pochePicture.php';
38}
39
40# i18n
41putenv('LC_ALL=' . LANG);
42setlocale(LC_ALL, LANG);
43bindtextdomain(LANG, LOCALE);
44textdomain(LANG);
45
46# template engine
47Twig_Autoloader::register();
48$loader = new Twig_Loader_Filesystem(TPL);
49$twig = new Twig_Environment($loader, array(
50 'cache' => CACHE,
51));
52$twig->addExtension(new Twig_Extensions_Extension_I18n());
44 53
45$store = new $storage_type(); 54Session::init();
46# initialisation de RainTPL 55$store = new $storage_type();
47raintpl::$tpl_dir = './tpl/';
48raintpl::$cache_dir = './cache/';
49raintpl::$base_url = get_poche_url();
50raintpl::configure('path_replace', false);
51raintpl::configure('debug', false);
52$tpl = new raintpl();
53 56
57# installation
54if(!$store->isInstalled()) 58if(!$store->isInstalled())
55{ 59{
56 logm('poche still not installed'); 60 pocheTool::logm('poche still not installed');
57 $tpl->draw('install'); 61 echo $twig->render('install.twig', array(
62 'token' => Session::getToken(),
63 ));
58 if (isset($_GET['install'])) { 64 if (isset($_GET['install'])) {
59 if (($_POST['password'] == $_POST['password_repeat']) 65 if (($_POST['password'] == $_POST['password_repeat'])
60 && $_POST['password'] != "" && $_POST['login'] != "") { 66 && $_POST['password'] != "" && $_POST['login'] != "") {
67 # let's rock, install poche baby !
61 $store->install($_POST['login'], encode_string($_POST['password'] . $_POST['login'])); 68 $store->install($_POST['login'], encode_string($_POST['password'] . $_POST['login']));
62 Session::logout(); 69 Session::logout();
63 MyTool::redirect(); 70 pocheTool::redirect();
64 } 71 }
65 } 72 }
66 exit(); 73 exit();
67} 74}
68 75
69$_SESSION['login'] = (isset ($_SESSION['login'])) ? $_SESSION['login'] : $store->getLogin(); 76$_SESSION['login'] = (isset ($_SESSION['login'])) ? $_SESSION['login'] : $store->getLogin();
70$_SESSION['pass'] = (isset ($_SESSION['pass'])) ? $_SESSION['pass'] : $store->getPassword(); 77$_SESSION['pass'] = (isset ($_SESSION['pass'])) ? $_SESSION['pass'] : $store->getPassword(); \ No newline at end of file
71
72$msg = new Messages();
73$tpl->assign('msg', $msg); \ No newline at end of file