aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-08 09:11:12 +0200
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-08 09:11:12 +0200
commited06f040776d5e2f38b938005ebc2b09ddd41bd4 (patch)
tree898818d8ee3127a3c9e930ad839be03c9626fd9b
parent7aa8ccc47d511f62fc46af53f7fc43d9bedebff3 (diff)
downloadwallabag-ed06f040776d5e2f38b938005ebc2b09ddd41bd4.tar.gz
wallabag-ed06f040776d5e2f38b938005ebc2b09ddd41bd4.tar.zst
wallabag-ed06f040776d5e2f38b938005ebc2b09ddd41bd4.zip
test if /install exists
-rw-r--r--CREDITS2
-rw-r--r--inc/poche/Poche.class.php5
-rw-r--r--index.php6
-rw-r--r--install/update_sqlite_from_0_to_1.php2
4 files changed, 12 insertions, 3 deletions
diff --git a/CREDITS b/CREDITS
index d6874a7b..a6dedce4 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1,5 +1,5 @@
1poche is based on : 1poche is based on :
2* PHP Readability http://www.keyvan.net/2010/08/php-readability/ 2* PHP Readability https://bitbucket.org/fivefilters/php-readability
3* Encoding https://github.com/neitanod/forceutf8 3* Encoding https://github.com/neitanod/forceutf8
4* logo by Brightmix http://www.iconfinder.com/icondetails/43256/128/jeans_monotone_pocket_icon 4* logo by Brightmix http://www.iconfinder.com/icondetails/43256/128/jeans_monotone_pocket_icon
5* icons http://icomoon.io 5* icons http://icomoon.io
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 38b4a98e..0439f301 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -31,6 +31,11 @@ class Poche
31 31
32 private function init() 32 private function init()
33 { 33 {
34 if (file_exists('./install') && !DEBUG_POCHE) {
35 Tools::logm('folder /install exists');
36 die('the folder /install exists, you have to delete it before using poche.');
37 }
38
34 Tools::initPhp(); 39 Tools::initPhp();
35 Session::init(); 40 Session::init();
36 41
diff --git a/index.php b/index.php
index 40cadf88..353df873 100644
--- a/index.php
+++ b/index.php
@@ -10,6 +10,7 @@
10 10
11include dirname(__FILE__).'/inc/poche/config.inc.php'; 11include dirname(__FILE__).'/inc/poche/config.inc.php';
12 12
13# Parse GET & REFERER vars
13$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; 14$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
14$view = Tools::checkVar('view', 'home'); 15$view = Tools::checkVar('view', 'home');
15$action = Tools::checkVar('action'); 16$action = Tools::checkVar('action');
@@ -17,6 +18,7 @@ $id = Tools::checkVar('id');
17$_SESSION['sort'] = Tools::checkVar('sort', 'id'); 18$_SESSION['sort'] = Tools::checkVar('sort', 'id');
18$url = new Url((isset ($_GET['url'])) ? $_GET['url'] : ''); 19$url = new Url((isset ($_GET['url'])) ? $_GET['url'] : '');
19 20
21# poche actions
20if (isset($_GET['login'])) { 22if (isset($_GET['login'])) {
21 # hello you 23 # hello you
22 $poche->login($referer); 24 $poche->login($referer);
@@ -36,6 +38,7 @@ elseif (isset($_GET['export'])) {
36 $poche->export(); 38 $poche->export();
37} 39}
38 40
41# vars to send to templates
39$tpl_vars = array( 42$tpl_vars = array(
40 'referer' => $referer, 43 'referer' => $referer,
41 'view' => $view, 44 'view' => $view,
@@ -50,6 +53,7 @@ if (Session::isLogged()) {
50 $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id)); 53 $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id));
51} 54}
52else { 55else {
56 # login
53 $tpl_file = 'login.twig'; 57 $tpl_file = 'login.twig';
54} 58}
55 59
@@ -57,5 +61,5 @@ else {
57$messages = $poche->messages->display('all', FALSE); 61$messages = $poche->messages->display('all', FALSE);
58$tpl_vars = array_merge($tpl_vars, array('messages' => $messages)); 62$tpl_vars = array_merge($tpl_vars, array('messages' => $messages));
59 63
60# Aaaaaaand action ! 64# display poche
61echo $poche->tpl->render($tpl_file, $tpl_vars); \ No newline at end of file 65echo $poche->tpl->render($tpl_file, $tpl_vars); \ No newline at end of file
diff --git a/install/update_sqlite_from_0_to_1.php b/install/update_sqlite_from_0_to_1.php
index c88af540..299abf48 100644
--- a/install/update_sqlite_from_0_to_1.php
+++ b/install/update_sqlite_from_0_to_1.php
@@ -1,5 +1,5 @@
1<?php 1<?php
2 2# import script to upgrade from poche 0.3
3$db_path = 'sqlite:../db/poche.sqlite'; 3$db_path = 'sqlite:../db/poche.sqlite';
4$handle = new PDO($db_path); 4$handle = new PDO($db_path);
5$handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 5$handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);