Simplify a little getLink

This commit is contained in:
Sébastien Lucas 2014-03-10 21:14:54 +01:00
parent 133b6dc9d6
commit e67e620ba3
2 changed files with 8 additions and 2 deletions

View file

@ -1072,6 +1072,13 @@ abstract class Base
return is_array ($config['calibre_directory']);
}
public static function useAbsolutePath () {
global $config;
$path = self::getDbDirectory();
return preg_match ('/^\//', Base::getDbDirectory ()) || // Linux /
preg_match ('/^\w\:/', Base::getDbDirectory ()); // Windows X:
}
public static function noDatabaseSelected () {
return self::isMultipleDatabaseEnabled () && is_null (GetUrlParam (DB));
}

View file

@ -150,8 +150,7 @@ class Data extends Base {
$urlParam = addURLParameter("", "data", $idData);
if (preg_match ('/^\//', Base::getDbDirectory ()) || // Linux /
preg_match ('/^\w\:/', Base::getDbDirectory ()) || // Windows X:
if (Base::useAbsolutePath () ||
$rel == Link::OPDS_THUMBNAIL_TYPE ||
($type == "epub" && $config['cops_update_epub-metadata']))
{