Merge pull request #5 from fatihorhan/master

Some fixes and improvements
This commit is contained in:
Nicolas Lœuillet 2013-04-04 09:25:40 -07:00
commit 56dacad507
3 changed files with 13 additions and 5 deletions

View file

@ -80,7 +80,7 @@ class Readability
public $debug = false;
protected $body = null; //
protected $bodyCache = null; // Cache the body HTML in case we need to re-use it later
protected $flags = FLAG_CLEAN_CONDITIONALLY; // 1 | 2 | 4; // Start with all flags set.
protected $flags = self::FLAG_CLEAN_CONDITIONALLY; // 1 | 2 | 4; // Start with all flags set.
protected $success = false; // indicates whether we were able to extract or not
/**

View file

@ -53,7 +53,11 @@ switch ($action) {
}
function url(){
$protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http";
$protocol = "http";
if(isset($_SERVER['HTTPS']))
if($_SERVER['HTTPS'] != "off")
$protocol = "https";
return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}
?>
@ -80,7 +84,7 @@ function url(){
<li><a href="index.php">home</a></li>
<li><a href="#">favorites</a></li>
<li><a href="#">archive</a></li>
<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>
<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>
</ul>
<?php
$query = $db_handle->prepare("SELECT * FROM entries WHERE read=?");

View file

@ -26,7 +26,11 @@ require_once dirname(__FILE__).'/inc/rain.tpl.class.php';
function url(){
$protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http";
$protocol = "http";
if(isset($_SERVER['HTTPS']))
if($_SERVER['HTTPS'] != "off")
$protocol = "https";
return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}
@ -92,7 +96,7 @@ function get_external_file($url, $timeout) {
}
// if response is not empty and response is OK
if (isset($data) and isset($httpcodeOK) and httpcodeOK ) {
if (isset($data) and isset($httpcodeOK) and $httpcodeOK ) {
// take charset of page and get it
preg_match('#<meta .*charset=.*>#Usi', $data, $meta);