diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2013-04-04 09:25:40 -0700 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2013-04-04 09:25:40 -0700 |
commit | 56dacad5074a21ae65fbf4fd6a625f259cc6d1f9 (patch) | |
tree | 6a0e4391026e62254ecda9b9b59ee651e93ec943 | |
parent | 634cf566f5d6aa92ca2c409932181a76bcfb91d0 (diff) | |
parent | 1f1a6157aa480553afba0e1ed2537fff94dc7a6b (diff) | |
download | wallabag-56dacad5074a21ae65fbf4fd6a625f259cc6d1f9.tar.gz wallabag-56dacad5074a21ae65fbf4fd6a625f259cc6d1f9.tar.zst wallabag-56dacad5074a21ae65fbf4fd6a625f259cc6d1f9.zip |
Merge pull request #5 from fatihorhan/master
Some fixes and improvements
-rwxr-xr-x | inc/Readability.php | 2 | ||||
-rwxr-xr-x | index.php | 8 | ||||
-rwxr-xr-x | readityourself.php | 8 |
3 files changed, 13 insertions, 5 deletions
diff --git a/inc/Readability.php b/inc/Readability.php index 52a37d50..c50bf2ef 100755 --- a/inc/Readability.php +++ b/inc/Readability.php | |||
@@ -80,7 +80,7 @@ class Readability | |||
80 | public $debug = false; | 80 | public $debug = false; |
81 | protected $body = null; // | 81 | protected $body = null; // |
82 | protected $bodyCache = null; // Cache the body HTML in case we need to re-use it later | 82 | protected $bodyCache = null; // Cache the body HTML in case we need to re-use it later |
83 | protected $flags = FLAG_CLEAN_CONDITIONALLY; // 1 | 2 | 4; // Start with all flags set. | 83 | protected $flags = self::FLAG_CLEAN_CONDITIONALLY; // 1 | 2 | 4; // Start with all flags set. |
84 | protected $success = false; // indicates whether we were able to extract or not | 84 | protected $success = false; // indicates whether we were able to extract or not |
85 | 85 | ||
86 | /** | 86 | /** |
@@ -53,7 +53,11 @@ switch ($action) { | |||
53 | } | 53 | } |
54 | 54 | ||
55 | function url(){ | 55 | function url(){ |
56 | $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http"; | 56 | $protocol = "http"; |
57 | if(isset($_SERVER['HTTPS'])) | ||
58 | if($_SERVER['HTTPS'] != "off") | ||
59 | $protocol = "https"; | ||
60 | |||
57 | return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | 61 | return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
58 | } | 62 | } |
59 | ?> | 63 | ?> |
@@ -80,7 +84,7 @@ function url(){ | |||
80 | <li><a href="index.php">home</a></li> | 84 | <li><a href="index.php">home</a></li> |
81 | <li><a href="#">favorites</a></li> | 85 | <li><a href="#">favorites</a></li> |
82 | <li><a href="#">archive</a></li> | 86 | <li><a href="#">archive</a></li> |
83 | <li><a href="javascript:(function(){var%20url%20=%20location.href;var%20title%20=%20document.title%20||%20url;window.open('<? echo url()?>index.php?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">poche it !</a></li> | 87 | <li><a href="javascript:(function(){var%20url%20=%20location.href;var%20title%20=%20document.title%20||%20url;window.open('<?php echo url()?>?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">poche it !</a></li> |
84 | </ul> | 88 | </ul> |
85 | <?php | 89 | <?php |
86 | $query = $db_handle->prepare("SELECT * FROM entries WHERE read=?"); | 90 | $query = $db_handle->prepare("SELECT * FROM entries WHERE read=?"); |
diff --git a/readityourself.php b/readityourself.php index 4a4661c2..c59bb9d1 100755 --- a/readityourself.php +++ b/readityourself.php | |||
@@ -26,7 +26,11 @@ require_once dirname(__FILE__).'/inc/rain.tpl.class.php'; | |||
26 | 26 | ||
27 | 27 | ||
28 | function url(){ | 28 | function url(){ |
29 | $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http"; | 29 | $protocol = "http"; |
30 | if(isset($_SERVER['HTTPS'])) | ||
31 | if($_SERVER['HTTPS'] != "off") | ||
32 | $protocol = "https"; | ||
33 | |||
30 | return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | 34 | return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
31 | } | 35 | } |
32 | 36 | ||
@@ -92,7 +96,7 @@ function get_external_file($url, $timeout) { | |||
92 | } | 96 | } |
93 | 97 | ||
94 | // if response is not empty and response is OK | 98 | // if response is not empty and response is OK |
95 | if (isset($data) and isset($httpcodeOK) and httpcodeOK ) { | 99 | if (isset($data) and isset($httpcodeOK) and $httpcodeOK ) { |
96 | 100 | ||
97 | // take charset of page and get it | 101 | // take charset of page and get it |
98 | preg_match('#<meta .*charset=.*>#Usi', $data, $meta); | 102 | preg_match('#<meta .*charset=.*>#Usi', $data, $meta); |