aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-16 20:19:31 +0200
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-16 20:19:31 +0200
commitbb5a7d9ede48558c6f096dc3c8e267f12513ec4e (patch)
treefb85a197e1916c9a4e880edfabd0f99e25b23750 /inc
parent1c9cd3463b820b874610f4fd13e0193dc9e6429c (diff)
downloadwallabag-bb5a7d9ede48558c6f096dc3c8e267f12513ec4e.tar.gz
wallabag-bb5a7d9ede48558c6f096dc3c8e267f12513ec4e.tar.zst
wallabag-bb5a7d9ede48558c6f096dc3c8e267f12513ec4e.zip
updating script
Diffstat (limited to 'inc')
-rw-r--r--inc/poche/Poche.class.php30
-rw-r--r--inc/poche/Tools.class.php26
-rwxr-xr-x[-rw-r--r--]inc/poche/config.inc.php57
-rw-r--r--inc/poche/define.inc.php30
4 files changed, 94 insertions, 49 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 4371c3d3..cb865a2a 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -41,15 +41,23 @@ class Poche
41 { 41 {
42 $msg = ''; 42 $msg = '';
43 $allIsGood = TRUE; 43 $allIsGood = TRUE;
44 if (file_exists('./install') && !DEBUG_POCHE) { 44
45 Tools::logm('folder /install exists'); 45 if (file_exists('./install/update.php') && !DEBUG_POCHE) {
46 $msg = 'A poche update is needed. Please execute this update <a href="install/update.php">by clicking here</a>. If you have already do the update, please delete /install folder.';
47 $allIsGood = FALSE;
48 }
49 else if (file_exists('./install') && !DEBUG_POCHE) {
46 $msg = 'If you want to update your poche, you just have to delete /install folder. <br />To install your poche with sqlite, copy /install/poche.sqlite in /db and delete the folder /install. you have to delete the /install folder before using poche.'; 50 $msg = 'If you want to update your poche, you just have to delete /install folder. <br />To install your poche with sqlite, copy /install/poche.sqlite in /db and delete the folder /install. you have to delete the /install folder before using poche.';
47 $allIsGood = FALSE; 51 $allIsGood = FALSE;
48 } 52 }
49 53 else if (STORAGE == 'sqlite' && !is_writable(STORAGE_SQLITE)) {
50 if (STORAGE == 'sqlite' && !is_writable(STORAGE_SQLITE)) { 54 Tools::logm('you don\'t have write access on sqlite file');
51 Tools::logm('you don\'t have write access on db file'); 55 $msg = 'You don\'t have write access on sqlite file.';
52 $msg = 'You don\'t have write access on ' . STORAGE_SQLITE . ' file.'; 56 $allIsGood = FALSE;
57 }
58 else if (!is_writable(CACHE)) {
59 Tools::logm('you don\'t have write access on cache directory');
60 $msg = 'You don\'t have write access on cache directory.';
53 $allIsGood = FALSE; 61 $allIsGood = FALSE;
54 } 62 }
55 63
@@ -118,10 +126,12 @@ class Poche
118 if (($_POST['password'] == $_POST['password_repeat']) 126 if (($_POST['password'] == $_POST['password_repeat'])
119 && $_POST['password'] != "" && $_POST['login'] != "") { 127 && $_POST['password'] != "" && $_POST['login'] != "") {
120 # let's rock, install poche baby ! 128 # let's rock, install poche baby !
121 $this->store->install($_POST['login'], Tools::encodeString($_POST['password'] . $_POST['login'])); 129 if ($this->store->install($_POST['login'], Tools::encodeString($_POST['password'] . $_POST['login'])))
122 Session::logout(); 130 {
123 Tools::logm('poche is now installed'); 131 Session::logout();
124 Tools::redirect(); 132 Tools::logm('poche is now installed');
133 Tools::redirect();
134 }
125 } 135 }
126 else { 136 else {
127 Tools::logm('error during installation'); 137 Tools::logm('error during installation');
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index 0eb0d9ea..1baf745d 100644
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -233,4 +233,30 @@ class Tools
233 233
234 return $minutes; 234 return $minutes;
235 } 235 }
236
237
238 public static function createMyConfig()
239 {
240 $myconfig_file = './inc/poche/myconfig.inc.php';
241
242 if (version_compare(POCHE_VERSION, '1.0-beta3') == 1) {
243 # $myconfig_file is only created with poche > 1.0-beta3
244 # in 1.0-beta3, the update script creates $myconfig_file
245
246 if (!is_writable('./inc/poche/')) {
247 self::logm('you don\'t have write access to create ./inc/poche/myconfig.inc.php');
248 die('You don\'t have write access to create ./inc/poche/myconfig.inc.php.');
249 }
250
251 if (!file_exists($myconfig_file))
252 {
253 $fp = fopen($myconfig_file, 'w');
254 fwrite($fp, '<?php'."\r\n");
255 fwrite($fp, "define ('POCHE_VERSION', '1.0-beta3');" . "\r\n");
256 fwrite($fp, "define ('SALT', '" . md5(time() . $_SERVER['SCRIPT_FILENAME'] . rand()) . "');" . "\r\n");
257 fwrite($fp, "define ('LANG', 'en_EN.utf8');" . "\r\n");
258 fclose($fp);
259 }
260 }
261 }
236} \ No newline at end of file 262} \ No newline at end of file
diff --git a/inc/poche/config.inc.php b/inc/poche/config.inc.php
index ecbf1ce6..4122ff10 100644..100755
--- a/inc/poche/config.inc.php
+++ b/inc/poche/config.inc.php
@@ -8,51 +8,30 @@
8 * @license http://www.wtfpl.net/ see COPYING file 8 * @license http://www.wtfpl.net/ see COPYING file
9 */ 9 */
10 10
11# storage 11require_once __DIR__ . '/../../inc/poche/define.inc.php';
12define ('STORAGE','sqlite'); # postgres, mysql, sqlite
13define ('STORAGE_SERVER', 'localhost'); # leave blank for sqlite
14define ('STORAGE_DB', 'poche'); # only for postgres & mysql
15define ('STORAGE_SQLITE', './db/poche.sqlite');
16define ('STORAGE_USER', 'postgres'); # leave blank for sqlite
17define ('STORAGE_PASSWORD', 'postgres'); # leave blank for sqlite
18
19define ('POCHE_VERSION', '1.0-beta2');
20define ('MODE_DEMO', FALSE);
21define ('DEBUG_POCHE', FALSE);
22define ('CONVERT_LINKS_FOOTNOTES', FALSE);
23define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
24define ('DOWNLOAD_PICTURES', FALSE);
25define ('SHARE_TWITTER', TRUE);
26define ('SHARE_MAIL', TRUE);
27define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX');
28define ('ABS_PATH', 'assets/');
29define ('TPL', './tpl');
30define ('LOCALE', './locale');
31define ('CACHE', './cache');
32define ('LANG', 'en_EN.UTF8');
33define ('PAGINATION', '10');
34define ('THEME', 'light');
35 12
36# /!\ Be careful if you change the lines below /!\ 13# /!\ Be careful if you change the lines below /!\
37if (!file_exists('./vendor/autoload.php')) { 14if (!file_exists(__DIR__ . '/../../vendor/autoload.php')) {
38 die('Twig does not seem installed. Have a look at <a href="http://inthepoche.com/?pages/Documentation">the documentation.</a>'); 15 die('Twig does not seem installed. Have a look at <a href="http://inthepoche.com/?pages/Documentation">the documentation.</a>');
39} 16}
40 17
41require_once './inc/poche/User.class.php'; 18if (file_exists(__DIR__ . '/../../inc/poche/myconfig.inc.php')) {
42require_once './inc/poche/Tools.class.php'; 19 require_once __DIR__ . '/../../inc/poche/myconfig.inc.php';
43require_once './inc/poche/Url.class.php'; 20}
44require_once './inc/3rdparty/class.messages.php'; 21require_once __DIR__ . '/../../inc/poche/User.class.php';
45require_once './inc/poche/Poche.class.php'; 22require_once __DIR__ . '/../../inc/poche/Url.class.php';
46require_once './inc/3rdparty/Readability.php'; 23require_once __DIR__ . '/../../inc/3rdparty/class.messages.php';
47require_once './inc/3rdparty/Encoding.php'; 24require_once __DIR__ . '/../../inc/poche/Poche.class.php';
48require_once './inc/poche/Database.class.php'; 25require_once __DIR__ . '/../../inc/3rdparty/Readability.php';
49require_once './vendor/autoload.php'; 26require_once __DIR__ . '/../../inc/3rdparty/Encoding.php';
50require_once './inc/3rdparty/simple_html_dom.php'; 27require_once __DIR__ . '/../../inc/poche/Database.class.php';
51require_once './inc/3rdparty/paginator.php'; 28require_once __DIR__ . '/../../vendor/autoload.php';
52require_once './inc/3rdparty/Session.class.php'; 29require_once __DIR__ . '/../../inc/3rdparty/simple_html_dom.php';
30require_once __DIR__ . '/../../inc/3rdparty/paginator.php';
31require_once __DIR__ . '/../../inc/3rdparty/Session.class.php';
53 32
54if (DOWNLOAD_PICTURES) { 33if (DOWNLOAD_PICTURES) {
55 require_once './inc/poche/pochePictures.php'; 34 require_once __DIR__ . '/../../inc/poche/pochePictures.php';
56} 35}
57 36
58$poche = new Poche(); 37$poche = new Poche();
diff --git a/inc/poche/define.inc.php b/inc/poche/define.inc.php
new file mode 100644
index 00000000..c32ca098
--- /dev/null
+++ b/inc/poche/define.inc.php
@@ -0,0 +1,30 @@
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
11define ('STORAGE','sqlite'); # postgres, mysql, sqlite
12define ('STORAGE_SERVER', 'localhost'); # leave blank for sqlite
13define ('STORAGE_DB', 'poche'); # only for postgres & mysql
14define ('STORAGE_SQLITE', __DIR__ . '/../../db/poche.sqlite');
15define ('STORAGE_USER', 'postgres'); # leave blank for sqlite
16define ('STORAGE_PASSWORD', 'postgres'); # leave blank for sqlite
17
18define ('MODE_DEMO', FALSE);
19define ('DEBUG_POCHE', FALSE);
20define ('CONVERT_LINKS_FOOTNOTES', FALSE);
21define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
22define ('DOWNLOAD_PICTURES', FALSE);
23define ('SHARE_TWITTER', TRUE);
24define ('SHARE_MAIL', TRUE);
25define ('ABS_PATH', 'assets/');
26define ('TPL', __DIR__ . '/../../tpl');
27define ('LOCALE', __DIR__ . '/../../locale');
28define ('CACHE', __DIR__ . '/../../cache');
29define ('PAGINATION', '10');
30define ('THEME', 'light'); \ No newline at end of file