diff options
author | Nicolas Lœuillet <nicolas.loeuillet@gmail.com> | 2013-08-16 20:19:31 +0200 |
---|---|---|
committer | Nicolas Lœuillet <nicolas.loeuillet@gmail.com> | 2013-08-16 20:19:31 +0200 |
commit | bb5a7d9ede48558c6f096dc3c8e267f12513ec4e (patch) | |
tree | fb85a197e1916c9a4e880edfabd0f99e25b23750 /inc | |
parent | 1c9cd3463b820b874610f4fd13e0193dc9e6429c (diff) | |
download | wallabag-bb5a7d9ede48558c6f096dc3c8e267f12513ec4e.tar.gz wallabag-bb5a7d9ede48558c6f096dc3c8e267f12513ec4e.tar.zst wallabag-bb5a7d9ede48558c6f096dc3c8e267f12513ec4e.zip |
updating script
Diffstat (limited to 'inc')
-rw-r--r-- | inc/poche/Poche.class.php | 30 | ||||
-rw-r--r-- | inc/poche/Tools.class.php | 26 | ||||
-rwxr-xr-x[-rw-r--r--] | inc/poche/config.inc.php | 57 | ||||
-rw-r--r-- | inc/poche/define.inc.php | 30 |
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 | 11 | require_once __DIR__ . '/../../inc/poche/define.inc.php'; |
12 | define ('STORAGE','sqlite'); # postgres, mysql, sqlite | ||
13 | define ('STORAGE_SERVER', 'localhost'); # leave blank for sqlite | ||
14 | define ('STORAGE_DB', 'poche'); # only for postgres & mysql | ||
15 | define ('STORAGE_SQLITE', './db/poche.sqlite'); | ||
16 | define ('STORAGE_USER', 'postgres'); # leave blank for sqlite | ||
17 | define ('STORAGE_PASSWORD', 'postgres'); # leave blank for sqlite | ||
18 | |||
19 | define ('POCHE_VERSION', '1.0-beta2'); | ||
20 | define ('MODE_DEMO', FALSE); | ||
21 | define ('DEBUG_POCHE', FALSE); | ||
22 | define ('CONVERT_LINKS_FOOTNOTES', FALSE); | ||
23 | define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); | ||
24 | define ('DOWNLOAD_PICTURES', FALSE); | ||
25 | define ('SHARE_TWITTER', TRUE); | ||
26 | define ('SHARE_MAIL', TRUE); | ||
27 | define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX'); | ||
28 | define ('ABS_PATH', 'assets/'); | ||
29 | define ('TPL', './tpl'); | ||
30 | define ('LOCALE', './locale'); | ||
31 | define ('CACHE', './cache'); | ||
32 | define ('LANG', 'en_EN.UTF8'); | ||
33 | define ('PAGINATION', '10'); | ||
34 | define ('THEME', 'light'); | ||
35 | 12 | ||
36 | # /!\ Be careful if you change the lines below /!\ | 13 | # /!\ Be careful if you change the lines below /!\ |
37 | if (!file_exists('./vendor/autoload.php')) { | 14 | if (!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 | ||
41 | require_once './inc/poche/User.class.php'; | 18 | if (file_exists(__DIR__ . '/../../inc/poche/myconfig.inc.php')) { |
42 | require_once './inc/poche/Tools.class.php'; | 19 | require_once __DIR__ . '/../../inc/poche/myconfig.inc.php'; |
43 | require_once './inc/poche/Url.class.php'; | 20 | } |
44 | require_once './inc/3rdparty/class.messages.php'; | 21 | require_once __DIR__ . '/../../inc/poche/User.class.php'; |
45 | require_once './inc/poche/Poche.class.php'; | 22 | require_once __DIR__ . '/../../inc/poche/Url.class.php'; |
46 | require_once './inc/3rdparty/Readability.php'; | 23 | require_once __DIR__ . '/../../inc/3rdparty/class.messages.php'; |
47 | require_once './inc/3rdparty/Encoding.php'; | 24 | require_once __DIR__ . '/../../inc/poche/Poche.class.php'; |
48 | require_once './inc/poche/Database.class.php'; | 25 | require_once __DIR__ . '/../../inc/3rdparty/Readability.php'; |
49 | require_once './vendor/autoload.php'; | 26 | require_once __DIR__ . '/../../inc/3rdparty/Encoding.php'; |
50 | require_once './inc/3rdparty/simple_html_dom.php'; | 27 | require_once __DIR__ . '/../../inc/poche/Database.class.php'; |
51 | require_once './inc/3rdparty/paginator.php'; | 28 | require_once __DIR__ . '/../../vendor/autoload.php'; |
52 | require_once './inc/3rdparty/Session.class.php'; | 29 | require_once __DIR__ . '/../../inc/3rdparty/simple_html_dom.php'; |
30 | require_once __DIR__ . '/../../inc/3rdparty/paginator.php'; | ||
31 | require_once __DIR__ . '/../../inc/3rdparty/Session.class.php'; | ||
53 | 32 | ||
54 | if (DOWNLOAD_PICTURES) { | 33 | if (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 | |||
11 | define ('STORAGE','sqlite'); # postgres, mysql, sqlite | ||
12 | define ('STORAGE_SERVER', 'localhost'); # leave blank for sqlite | ||
13 | define ('STORAGE_DB', 'poche'); # only for postgres & mysql | ||
14 | define ('STORAGE_SQLITE', __DIR__ . '/../../db/poche.sqlite'); | ||
15 | define ('STORAGE_USER', 'postgres'); # leave blank for sqlite | ||
16 | define ('STORAGE_PASSWORD', 'postgres'); # leave blank for sqlite | ||
17 | |||
18 | define ('MODE_DEMO', FALSE); | ||
19 | define ('DEBUG_POCHE', FALSE); | ||
20 | define ('CONVERT_LINKS_FOOTNOTES', FALSE); | ||
21 | define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); | ||
22 | define ('DOWNLOAD_PICTURES', FALSE); | ||
23 | define ('SHARE_TWITTER', TRUE); | ||
24 | define ('SHARE_MAIL', TRUE); | ||
25 | define ('ABS_PATH', 'assets/'); | ||
26 | define ('TPL', __DIR__ . '/../../tpl'); | ||
27 | define ('LOCALE', __DIR__ . '/../../locale'); | ||
28 | define ('CACHE', __DIR__ . '/../../cache'); | ||
29 | define ('PAGINATION', '10'); | ||
30 | define ('THEME', 'light'); \ No newline at end of file | ||