aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Tools.class.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-25 12:12:53 -0700
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-25 12:12:53 -0700
commitc51be6b697da573cdcf0788eb8617130ce5517a4 (patch)
tree642eaf70afb134dee5f274c84bf15b8aab00c117 /inc/poche/Tools.class.php
parent7ba37bd91a43321196e6d867caf9e298e82c6d6c (diff)
parent063fc1a7baaf6f7e1fb08eced058962a6140a471 (diff)
downloadwallabag-c51be6b697da573cdcf0788eb8617130ce5517a4.tar.gz
wallabag-c51be6b697da573cdcf0788eb8617130ce5517a4.tar.zst
wallabag-c51be6b697da573cdcf0788eb8617130ce5517a4.zip
Merge pull request #181 from inthepoche/dev
beta4
Diffstat (limited to 'inc/poche/Tools.class.php')
-rw-r--r--inc/poche/Tools.class.php37
1 files changed, 13 insertions, 24 deletions
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index 1baf745d..3a792d43 100644
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -216,13 +216,7 @@ class Tools
216 216
217 public static function getDomain($url) 217 public static function getDomain($url)
218 { 218 {
219 $pieces = parse_url($url); 219 return parse_url($url, PHP_URL_HOST);
220 $domain = isset($pieces['host']) ? $pieces['host'] : '';
221 if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) {
222 return $regs['domain'];
223 }
224
225 return FALSE;
226 } 220 }
227 221
228 public static function getReadingTime($text) { 222 public static function getReadingTime($text) {
@@ -239,24 +233,19 @@ class Tools
239 { 233 {
240 $myconfig_file = './inc/poche/myconfig.inc.php'; 234 $myconfig_file = './inc/poche/myconfig.inc.php';
241 235
242 if (version_compare(POCHE_VERSION, '1.0-beta3') == 1) { 236 if (!is_writable('./inc/poche/')) {
243 # $myconfig_file is only created with poche > 1.0-beta3 237 self::logm('you don\'t have write access to create ./inc/poche/myconfig.inc.php');
244 # in 1.0-beta3, the update script creates $myconfig_file 238 die('You don\'t have write access to create ./inc/poche/myconfig.inc.php.');
245 239 }
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 240
251 if (!file_exists($myconfig_file)) 241 if (!file_exists($myconfig_file))
252 { 242 {
253 $fp = fopen($myconfig_file, 'w'); 243 $fp = fopen($myconfig_file, 'w');
254 fwrite($fp, '<?php'."\r\n"); 244 fwrite($fp, '<?php'."\r\n");
255 fwrite($fp, "define ('POCHE_VERSION', '1.0-beta3');" . "\r\n"); 245 fwrite($fp, "define ('POCHE_VERSION', '1.0-beta4');" . "\r\n");
256 fwrite($fp, "define ('SALT', '" . md5(time() . $_SERVER['SCRIPT_FILENAME'] . rand()) . "');" . "\r\n"); 246 fwrite($fp, "define ('SALT', '" . md5(time() . $_SERVER['SCRIPT_FILENAME'] . rand()) . "');" . "\r\n");
257 fwrite($fp, "define ('LANG', 'en_EN.utf8');" . "\r\n"); 247 fwrite($fp, "define ('LANG', 'en_EN.utf8');" . "\r\n");
258 fclose($fp); 248 fclose($fp);
259 }
260 } 249 }
261 } 250 }
262} \ No newline at end of file 251} \ No newline at end of file