X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=inc%2Fpoche%2FTools.class.php;h=6c176eae5c3048dd53368284aed2a1988f69647f;hb=984805649e38c0fc83cde0345ac99b74c8b66e61;hp=f803e3b57b1435e6064cefea5e9e48e08b6672ee;hpb=153237671001225dea40957e33e67fe16e6124fc;p=github%2Fwallabag%2Fwallabag.git diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index f803e3b5..6c176eae 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -40,6 +40,8 @@ final class Tools */ public static function getPocheUrl() { + $baseUrl = ""; + $https = (!empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) || (isset($_SERVER["SERVER_PORT"]) @@ -72,8 +74,16 @@ final class Tools $serverport = ''; } - return 'http' . ($https ? 's' : '') . '://' - . $host . $serverport . $scriptname; + // check if BASE_URL is configured + if(BASE_URL) { + print_r(BASE_URL); + $baseUrl = BASE_URL; + } else { + $baseUrl = 'http' . ($https ? 's' : '') . '://' . $host . $serverport; + } + + return $baseUrl . $scriptname; + } /** @@ -117,7 +127,7 @@ final class Tools { $views = array( 'install', 'import', 'export', 'config', 'tags', - 'edit-tags', 'view', 'login', 'error', 'about' + 'edit-tags', 'view', 'login', 'error', 'about', 'register' ); return (in_array($view, $views) ? $view . '.twig' : 'home.twig'); @@ -342,7 +352,10 @@ final class Tools return $json; }; - $json = $scope("inc/3rdparty/makefulltextfeed.php", array("url" => $url)); + // Silence $scope function to avoid + // issues with FTRSS when error_reporting is to high + // FTRSS generates PHP warnings which break output + $json = @$scope("inc/3rdparty/makefulltextfeed.php", array("url" => $url)); // Clearing and restoring context foreach ($GLOBALS as $key => $value) { @@ -389,8 +402,11 @@ final class Tools ); foreach ($files as $fileInfo) { - $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink'); - $todo($fileInfo->getRealPath()); + $filename = $fileInfo->getFilename(); + if (!$filename[0] == '.') { + $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink'); + $todo($fileInfo->getRealPath()); + } } Tools::logm('empty cache'); @@ -414,4 +430,23 @@ final class Tools return str_replace('+', '', $token); } + /** + * + * Returns the doctype for an HTML document (used for Mozilla Bookmarks) + * @param simple_html_dom $doc + * @return doctype $el + * + */ + + public static function get_doctype($doc) + { + $els = $doc->find('unknown'); + + foreach ($els as $e => $el) + if ($el->parent()->tag == 'root') + return $el; + + return NULL; + } + }