Skip to content

Commit

Permalink
remove CURLOPT_BINARYTRANSFER + update prod
Browse files Browse the repository at this point in the history
  • Loading branch information
tontof committed Jan 13, 2025
1 parent a6cfb2d commit eda4ed8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ An example is available on [tontof.net](http://tontof.net/feed).

This is an alternative to Google Reader or other RSS feed readers:
- It does not require SQL or database.
- It works with PHP 5.2
- It works with PHP 5.4+

More information here: [KrISS feed](http://tontof.net/kriss/feed).

Expand Down
26 changes: 15 additions & 11 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// KrISS feed: a simple and smart (or stupid) feed reader
// Copyleft (ɔ) - Tontof - http://tontof.net
// use KrISS feed at your own risk
define('FEED_VERSION', 8.19);
define('FEED_VERSION', 8.23);

define('DATA_DIR', 'data');
define('INC_DIR', 'inc');
Expand Down Expand Up @@ -3958,7 +3958,6 @@ public static function loadUrl($url)
}
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);

Expand Down Expand Up @@ -4273,7 +4272,6 @@ public static function grabToLocal($url, $file, $force = false)
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$raw = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200) {
$fp = fopen($file, 'x');
Expand Down Expand Up @@ -4643,6 +4641,7 @@ public static function convertOpmlArray($array, $listFolders = array())
class PageBuilder
{
private $pageClass;
public $tpl;
public $var = array();

public function __construct($pageClass)
Expand Down Expand Up @@ -4984,28 +4983,30 @@ class Session

public static function init()
{
$lifetime = null;
if (!empty($_SESSION['longlastingsession'])) {
$lifetime = $_SESSION['longlastingsession'];
}
$lifetime = 0;
self::setCookie($lifetime);
// Use cookies to store session.
ini_set('session.use_cookies', 1);
// Force cookies for session (phpsessionID forbidden in URL)
ini_set('session.use_only_cookies', 1);
if (!session_id()) {
if (session_status() !== PHP_SESSION_ACTIVE) {
// Prevent php to use sessionID in URL if cookies are disabled.
ini_set('session.use_trans_sid', false);
if (!empty(self::$sessionName)) {
session_name(self::$sessionName);
}
session_start();
if (!empty($_SESSION['longlastingsession'])) {
$lifetime = time()+$_SESSION['longlastingsession'];
}
self::setCookie($lifetime);
}
}

public static function setCookie($lifetime = null)
{
$cookie = session_get_cookie_params();

// Do not change lifetime
if ($lifetime === null) {
$lifetime = $cookie['lifetime'];
Expand All @@ -5021,13 +5022,17 @@ public static function setCookie($lifetime = null)
$domain = $_SERVER['HTTP_HOST'];
}
// remove port from domain : http://php.net/manual/en/function.setcookie.php#36202
$domain = parse_url($domain, PHP_URL_HOST);
$domain = (string)parse_url($domain, PHP_URL_HOST);
// Check if secure
$secure = false;
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
$secure = true;
}
session_set_cookie_params($lifetime, $path, $domain, $secure);
if (session_status() !== PHP_SESSION_ACTIVE) {
session_set_cookie_params($lifetime, $path, $domain, $secure);
} else {
setcookie(session_name(), session_id(), $lifetime, $path, $domain, $secure);
}
}

private static function _allIPs()
Expand Down Expand Up @@ -9394,4 +9399,3 @@ function removeEvent(obj, evType, fn, useCapture) {
$pb->renderPage('login');
}
}

2 changes: 0 additions & 2 deletions src/class/MyTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public static function loadUrl($url)
}
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);

Expand Down Expand Up @@ -478,7 +477,6 @@ public static function grabToLocal($url, $file, $force = false)
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$raw = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200) {
$fp = fopen($file, 'x');
Expand Down
4 changes: 1 addition & 3 deletions src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// KrISS feed: a simple and smart (or stupid) feed reader
// Copyleft (ɔ) - Tontof - http://tontof.net
// use KrISS feed at your own risk
define('FEED_VERSION', 8.22);
define('FEED_VERSION', 8.23);

define('DATA_DIR', 'data');
define('INC_DIR', 'inc');
Expand Down Expand Up @@ -3958,7 +3958,6 @@ public static function loadUrl($url)
}
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);

Expand Down Expand Up @@ -4273,7 +4272,6 @@ public static function grabToLocal($url, $file, $force = false)
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$raw = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200) {
$fp = fopen($file, 'x');
Expand Down
2 changes: 1 addition & 1 deletion src/kriss_feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// KrISS feed: a simple and smart (or stupid) feed reader
// Copyleft (ɔ) - Tontof - http://tontof.net
// use KrISS feed at your own risk
define('FEED_VERSION', 8.22);
define('FEED_VERSION', 8.23);

define('DATA_DIR', 'data');
define('INC_DIR', 'inc');
Expand Down

0 comments on commit eda4ed8

Please sign in to comment.