1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-11-23 17:42:15 -05:00

getPageContent moved to Tools, fix of #426

This commit is contained in:
Maryana Rozhankivska 2014-03-07 12:54:08 +02:00
parent 53e3158dfe
commit f98373cc34

View File

@ -263,11 +263,13 @@ class Tools
} }
} }
// Saving and clearing session // Saving and clearing session
if ( isset($_SESSION) ) {
$REAL_SESSION = array(); $REAL_SESSION = array();
foreach( $_SESSION as $key => $value ) { foreach( $_SESSION as $key => $value ) {
$REAL_SESSION[$key] = $value; $REAL_SESSION[$key] = $value;
unset($_SESSION[$key]); unset($_SESSION[$key]);
} }
}
// Running code in different context // Running code in different context
$scope = function() { $scope = function() {
@ -282,7 +284,8 @@ class Tools
); );
ob_start(); ob_start();
require func_get_arg(0); require func_get_arg(0);
$json = ob_get_flush(); $json = ob_get_contents();
ob_end_clean();
return $json; return $json;
}; };
$json = $scope( "inc/3rdparty/makefulltextfeed.php", array("url" => $url) ); $json = $scope( "inc/3rdparty/makefulltextfeed.php", array("url" => $url) );
@ -297,12 +300,15 @@ class Tools
$GLOBALS[$key] = $value; $GLOBALS[$key] = $value;
} }
// Clearing and restoring session // Clearing and restoring session
if ( isset($REAL_SESSION) ) {
foreach( $_SESSION as $key => $value ) { foreach( $_SESSION as $key => $value ) {
unset($_SESSION[$key]); unset($_SESSION[$key]);
} }
foreach( $REAL_SESSION as $key => $value ) { foreach( $REAL_SESSION as $key => $value ) {
$_SESSION[$key] = $value; $_SESSION[$key] = $value;
} }
}
return json_decode($json, true); return json_decode($json, true);
} }
} }