2013-07-22 15:29:32 +03:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
2013-01-05 08:35:19 +02:00
|
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* COPS (Calibre OPDS PHP Server) Configuration check
|
|
|
|
|
*
|
|
|
|
|
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
|
|
|
|
* @author S<EFBFBD>bastien Lucas <sebastien@slucas.fr>
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
require_once ("config.php");
|
|
|
|
|
require_once ("base.php");
|
|
|
|
|
|
2013-05-16 15:41:24 +03:00
|
|
|
|
header ("Content-Type:text/html; charset=UTF-8");
|
2013-01-06 10:49:05 +02:00
|
|
|
|
|
|
|
|
|
$err = getURLParam ("err", -1);
|
|
|
|
|
$error = NULL;
|
|
|
|
|
switch ($err) {
|
|
|
|
|
case 1 :
|
|
|
|
|
$error = "Database error";
|
|
|
|
|
break;
|
|
|
|
|
}
|
2013-01-05 08:35:19 +02:00
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
<head>
|
2013-05-16 18:22:21 +03:00
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
2013-01-05 08:35:19 +02:00
|
|
|
|
<title>COPS Configuration Check</title>
|
2013-05-28 08:49:52 +03:00
|
|
|
|
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss ()) ?>" media="screen" />
|
2013-01-05 08:35:19 +02:00
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div class="container">
|
2013-05-16 15:41:24 +03:00
|
|
|
|
<header>
|
2013-01-05 08:35:19 +02:00
|
|
|
|
<div class="headcenter">
|
2013-05-16 15:41:24 +03:00
|
|
|
|
<h1>COPS Configuration Check</h1>
|
2013-01-05 08:35:19 +02:00
|
|
|
|
</div>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
</header>
|
2013-01-05 08:35:19 +02:00
|
|
|
|
<div id="content" style="display: none;"></div>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
<section>
|
2013-01-06 10:49:05 +02:00
|
|
|
|
<?php
|
|
|
|
|
if (!is_null ($error)) {
|
|
|
|
|
?>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
<article class="frontpage">
|
|
|
|
|
<h2>You've been redirected because COPS is not configured properly</h2>
|
|
|
|
|
<h4><?php echo $error ?></h4>
|
|
|
|
|
</article>
|
2013-01-06 10:49:05 +02:00
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
<article class="frontpage">
|
|
|
|
|
<h2>Check if GD is properly installed and loaded</h2>
|
|
|
|
|
<h4>
|
2013-01-05 08:35:19 +02:00
|
|
|
|
<?php
|
|
|
|
|
if (extension_loaded('gd') && function_exists('gd_info')) {
|
|
|
|
|
echo "OK";
|
|
|
|
|
} else {
|
|
|
|
|
echo "Please install the php5-gd extension and make sure it's enabled";
|
|
|
|
|
}
|
|
|
|
|
?>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
</h4>
|
|
|
|
|
</article>
|
|
|
|
|
<article class="frontpage">
|
|
|
|
|
<h2>Check if Sqlite is properly installed and loaded</h2>
|
|
|
|
|
<h4>
|
2013-01-05 08:35:19 +02:00
|
|
|
|
<?php
|
|
|
|
|
if (extension_loaded('pdo_sqlite')) {
|
|
|
|
|
echo "OK";
|
|
|
|
|
} else {
|
|
|
|
|
echo "Please install the php5-sqlite extension and make sure it's enabled";
|
|
|
|
|
}
|
|
|
|
|
?>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
</h4>
|
|
|
|
|
</article>
|
|
|
|
|
<article class="frontpage">
|
|
|
|
|
<h2>Check if libxml is properly installed and loaded</h2>
|
|
|
|
|
<h4>
|
2013-04-08 18:29:31 +03:00
|
|
|
|
<?php
|
|
|
|
|
if (extension_loaded('libxml')) {
|
|
|
|
|
echo "OK";
|
|
|
|
|
} else {
|
|
|
|
|
echo "Please make sure libxml is enabled";
|
|
|
|
|
}
|
|
|
|
|
?>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
</h4>
|
|
|
|
|
</article>
|
2013-09-03 15:30:57 +03:00
|
|
|
|
<article class="frontpage">
|
|
|
|
|
<h2>Check if the rendering will be done on client side or server side</h2>
|
|
|
|
|
<h4>
|
|
|
|
|
<?php
|
|
|
|
|
if (useServerSideRendering ()) {
|
|
|
|
|
echo "Server side rendering";
|
|
|
|
|
} else {
|
|
|
|
|
echo "Client side rendering";
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</h4>
|
|
|
|
|
</article>
|
2013-04-04 21:53:44 +03:00
|
|
|
|
<?php
|
|
|
|
|
$i = 0;
|
|
|
|
|
foreach (Base::getDbList () as $name => $database) {
|
|
|
|
|
?>
|
2013-06-26 22:36:25 +03:00
|
|
|
|
<article class="frontpage">
|
|
|
|
|
<h2>Check if Calibre database path is not an URL</h2>
|
|
|
|
|
<h4>
|
|
|
|
|
<?php
|
|
|
|
|
if (!preg_match ("#^http#", $database)) {
|
|
|
|
|
echo "OK";
|
|
|
|
|
} else {
|
|
|
|
|
echo "Calibre path has to be local (no URL allowed)";
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</h4>
|
|
|
|
|
</article>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
<article class="frontpage">
|
|
|
|
|
<h2>Check if Calibre database file exists and is readable</h2>
|
2013-01-05 08:35:19 +02:00
|
|
|
|
<?php
|
2013-04-04 21:53:44 +03:00
|
|
|
|
if (is_readable (Base::getDbFileName ($i))) {
|
|
|
|
|
echo "{$name} OK";
|
2013-01-05 08:35:19 +02:00
|
|
|
|
} else {
|
2013-04-04 21:53:44 +03:00
|
|
|
|
echo "{$name} File " . Base::getDbFileName ($i) . " not found,
|
2013-01-20 16:13:43 +02:00
|
|
|
|
Please check
|
|
|
|
|
<ul>
|
|
|
|
|
<li>Value of \$config['calibre_directory'] in config_local.php</li>
|
|
|
|
|
<li>Value of <a href='http://php.net/manual/en/ini.core.php#ini.open-basedir'>open_basedir</a> in your php.ini</li>
|
|
|
|
|
<li>The access rights of the Calibre Database</li>
|
|
|
|
|
<li>Synology users please read <a href='https://github.com/seblucas/cops/wiki/Howto---Synology'>this</a></li>
|
|
|
|
|
</ul>";
|
2013-01-05 08:35:19 +02:00
|
|
|
|
}
|
|
|
|
|
?>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
</article>
|
|
|
|
|
<article class="frontpage">
|
|
|
|
|
<h2>Check if Calibre database file can be opened with PHP</h2>
|
|
|
|
|
<h4>
|
2013-01-05 08:35:19 +02:00
|
|
|
|
<?php
|
|
|
|
|
try {
|
2013-04-04 21:53:44 +03:00
|
|
|
|
$db = new PDO('sqlite:'. Base::getDbFileName ($i));
|
|
|
|
|
echo "{$name} OK";
|
2013-01-05 08:35:19 +02:00
|
|
|
|
} catch (Exception $e) {
|
2013-04-04 21:53:44 +03:00
|
|
|
|
echo "{$name} If the file is readable, check your php configuration. Exception detail : " . $e;
|
2013-01-05 08:35:19 +02:00
|
|
|
|
}
|
|
|
|
|
?>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
</h4>
|
|
|
|
|
</article>
|
|
|
|
|
<article class="frontpage">
|
|
|
|
|
<h2>Check if Calibre database file contains at least some of the needed tables</h2>
|
|
|
|
|
<h4>
|
2013-03-19 22:11:10 +02:00
|
|
|
|
<?php
|
|
|
|
|
try {
|
2013-04-04 21:53:44 +03:00
|
|
|
|
$db = new PDO('sqlite:'. Base::getDbFileName ($i));
|
2013-03-19 22:11:10 +02:00
|
|
|
|
$count = $db->query("select count(*) FROM sqlite_master WHERE type='table' AND name in ('books', 'authors', 'tags', 'series')")->fetchColumn();
|
|
|
|
|
if ($count == 4) {
|
2013-04-04 21:53:44 +03:00
|
|
|
|
echo "{$name} OK";
|
2013-03-19 22:11:10 +02:00
|
|
|
|
} else {
|
2013-04-04 21:53:44 +03:00
|
|
|
|
echo "{$name} Not all Calibre tables were found. Are you you're using the correct database.";
|
2013-03-19 22:11:10 +02:00
|
|
|
|
}
|
|
|
|
|
} catch (Exception $e) {
|
2013-04-04 21:53:44 +03:00
|
|
|
|
echo "{$name} If the file is readable, check your php configuration. Exception detail : " . $e;
|
2013-03-19 22:11:10 +02:00
|
|
|
|
}
|
|
|
|
|
?>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
</h4>
|
|
|
|
|
</article>
|
2013-04-04 21:53:44 +03:00
|
|
|
|
<?php $i++; } ?>
|
2013-05-16 15:41:24 +03:00
|
|
|
|
</section>
|
2013-05-16 15:42:56 +03:00
|
|
|
|
<footer></footer>
|
2013-01-05 08:35:19 +02:00
|
|
|
|
</div>
|
|
|
|
|
</body>
|
2013-07-22 15:29:32 +03:00
|
|
|
|
</html>
|