diff --git a/base.php b/base.php index 188dba3..388b7ac 100644 --- a/base.php +++ b/base.php @@ -10,6 +10,11 @@ define ("VERSION", "0.6.1"); define ("DB", "db"); date_default_timezone_set($config['default_timezone']); +function useServerSideRendering () { + global $config; + return preg_match("/" . $config['cops_server_side_render'] . "/", $_SERVER['HTTP_USER_AGENT']); +} + function getURLParam ($name, $default = NULL) { if (!empty ($_GET) && isset($_GET[$name]) && $_GET[$name] != "") { return $_GET[$name]; diff --git a/config_default.php b/config_default.php index 4493281..7b7101d 100644 --- a/config_default.php +++ b/config_default.php @@ -196,4 +196,20 @@ * 0 : No */ $config['cops_html_tag_filter'] = "0"; + + /* + * Thumbnails are generated on-the-fly so it can be problematic on servers with slow CPU (Raspberry Pi, Dockstar, Piratebox, ...). + * This configuration item allow to customize how thumbnail will be generated + * "" : Generate thumbnail (CPU hungry) + * "1" : always send the full size image (Network hungry) + * any url : Send a constant image as the thumbnail (you can try "images/bookcover.svg") + */ + $config['cops_thumbnail_handling'] = "images/bookcover.svg"; + + /* + * Contains a list of user agent for browsers not compatible with client side rendering + * For now : Kindle, Sony PRS-T1 + * This item is used as regular expression so "." will force server side rendering for all devices + */ + $config['cops_server_side_render'] = ".";//"Kindle|EBRD1101"; diff --git a/index.php b/index.php index 649496b..e993f89 100644 --- a/index.php +++ b/index.php @@ -17,6 +17,7 @@ require_once ("language.php"); require_once ("customcolumn.php"); require_once ("book.php"); + require_once ("resources/doT-php/doT.php"); // If we detect that an OPDS reader try to connect try to redirect to feed.php if (preg_match("/(MantanoReader|FBReader|Stanza|Aldiko|Moon+ Reader)/", $_SERVER['HTTP_USER_AGENT'])) { @@ -48,6 +49,7 @@ " /> " media="screen" /> + + +template ($page, array ("bookdetail" => $bookdetail, + "header" => $header, + "footer" => $footer, + "main" => $main)); + // Execute the template + echo $dot ($data); +} +?> \ No newline at end of file