Epub loader:
Add Cops feed loader Typo: Change cvs_export to csv_export Rename config.php file to epub-loader-config.php Config: Add app_name, admin_email
This commit is contained in:
parent
fce60d4079
commit
35bbf55e19
2
resources/epub-loader/app/.gitignore
vendored
2
resources/epub-loader/app/.gitignore
vendored
|
@ -1 +1 @@
|
||||||
config.php
|
epub-loader-config.php
|
||||||
|
|
27
resources/epub-loader/app/cops-feed.php
Normal file
27
resources/epub-loader/app/cops-feed.php
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Epub loader application: COPS feed loader
|
||||||
|
*
|
||||||
|
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||||
|
* @author Didier Corbière <didier.corbiere@opale-concept.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Include config file
|
||||||
|
$fileName = __DIR__ . DIRECTORY_SEPARATOR . 'epub-loader-config.php';
|
||||||
|
if (!file_exists($fileName)) {
|
||||||
|
die ('Missing configuration file: ' . $fileName);
|
||||||
|
}
|
||||||
|
require_once($fileName);
|
||||||
|
|
||||||
|
// Add cops directory to include path
|
||||||
|
$includePath = ini_get('include_path');
|
||||||
|
ini_set('include_path', $includePath . PATH_SEPARATOR . $gConfig['cops_directory']);
|
||||||
|
|
||||||
|
// Include COPS feed
|
||||||
|
$fileName = $gConfig['cops_directory'] . '/feed.php';
|
||||||
|
if (!file_exists($fileName)) {
|
||||||
|
die ('Incorrect include file: ' . $fileName);
|
||||||
|
}
|
||||||
|
require_once($fileName);
|
||||||
|
|
||||||
|
?>
|
|
@ -8,12 +8,25 @@
|
||||||
|
|
||||||
$gConfig = array();
|
$gConfig = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Application name
|
||||||
|
*/
|
||||||
|
$gConfig['app_name'] = 'Epub loader';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Admin email
|
||||||
|
*/
|
||||||
|
$gConfig['admin_email'] = 'didier.corbiere@opale-concept.com';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cops directory
|
* Cops directory
|
||||||
*
|
*
|
||||||
* This is the base path of Cops library
|
* This is the base path of Cops library
|
||||||
*/
|
*/
|
||||||
$gConfig['cops_directory'] = dirname(dirname(dirname(__DIR__)));
|
$gConfig['cops_directory'] = dirname(dirname(dirname(__DIR__)));
|
||||||
|
if (!is_dir($gConfig['cops_directory'])) {
|
||||||
|
die ('Incorrect Cops directory: ' . $gConfig['cops_directory']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Calibre databases ?
|
* Create Calibre databases ?
|
||||||
|
@ -30,17 +43,18 @@ $gConfig['create_db'] = true;
|
||||||
* name: The database name to display
|
* name: The database name to display
|
||||||
* db_path: The path where to create the database
|
* db_path: The path where to create the database
|
||||||
* epub_path: The path where to look for the epub files to load
|
* epub_path: The path where to look for the epub files to load
|
||||||
|
* pdf_path: The path where to look for pdf files
|
||||||
*/
|
*/
|
||||||
$gConfig['databases'] = array();
|
$gConfig['databases'] = array();
|
||||||
$gConfig['databases'][] = array('name' => 'Littérature classique', 'db_path' => '/opt/ebooks/calibre/demo', 'epub_path' => '/opt/ebooks/epub/demo');
|
$gConfig['databases'][] = array('name' => 'Littérature classique', 'db_path' => '/opt/ebooks/calibre/demo', 'epub_path' => '/opt/ebooks/epub/demo', 'pdf_path' => '');
|
||||||
$gConfig['databases'][] = array('name' => 'Bibliothèque numérique romande', 'db_path' => '/opt/ebooks/calibre/bnr', 'epub_path' => '/opt/ebooks/epub/bnr');
|
$gConfig['databases'][] = array('name' => 'Bibliothèque numérique romande', 'db_path' => '/opt/ebooks/calibre/bnr', 'epub_path' => '/opt/ebooks/epub/bnr', 'pdf_path' => '');
|
||||||
$gConfig['databases'][] = array('name' => 'La Bibliothèque d\'Ebooks', 'db_path' => '/opt/ebooks/calibre/bibebook', 'epub_path' => '/opt/ebooks/epub/bibebook');
|
$gConfig['databases'][] = array('name' => 'La Bibliothèque d\'Ebooks', 'db_path' => '/opt/ebooks/calibre/bibebook', 'epub_path' => '/opt/ebooks/epub/bibebook', 'pdf_path' => '');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Available actions
|
* Available actions
|
||||||
*/
|
*/
|
||||||
$gConfig['actions'] = array();
|
$gConfig['actions'] = array();
|
||||||
$gConfig['actions']['cvs_export'] = 'Cvs export';
|
$gConfig['actions']['csv_export'] = 'Csv export';
|
||||||
$gConfig['actions']['db_load'] = 'Create database';
|
$gConfig['actions']['db_load'] = 'Create database';
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -28,12 +28,18 @@
|
||||||
|
|
||||||
<!-- Footer begin -->
|
<!-- Footer begin -->
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
|
<?php
|
||||||
|
if (!empty($gConfig['admin_email'])) {
|
||||||
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/*<![CDATA[*/
|
/*<![CDATA[*/
|
||||||
document.write("<n uers=\"znvygb:<?php echo str_rot13(DEF_AppAdminMail); ?>\">".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}));
|
document.write("<n uers=\"znvygb:<?php echo str_rot13($gConfig['admin_email']); ?>\">".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}));
|
||||||
document.write("Contact<\/a>");
|
document.write("Contact<\/a>");
|
||||||
/*]]>*/
|
/*]]>*/
|
||||||
</script>
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
<!-- Footer end -->
|
<!-- Footer end -->
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ header('Content-type: text/html; charset=utf-8');
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<title><?php echo DEF_AppName; ?></title>
|
<title><?php echo $gConfig['app_name']; ?></title>
|
||||||
<meta name="author" content="opale-concept.com" />
|
<meta name="author" content="opale-concept.com" />
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
@ -80,7 +80,7 @@ header('Content-type: text/html; charset=utf-8');
|
||||||
<body>
|
<body>
|
||||||
<!-- Header begin -->
|
<!-- Header begin -->
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<?php echo ' <a href=".">' . DEF_AppName . '</a>' . "\n"; ?>
|
<a href="."><?php echo $gConfig['app_name']; ?></a>
|
||||||
</div>
|
</div>
|
||||||
<!-- Header end -->
|
<!-- Header end -->
|
||||||
|
|
||||||
|
|
|
@ -6,34 +6,17 @@
|
||||||
* @author Didier Corbière <didier.corbiere@opale-concept.com>
|
* @author Didier Corbière <didier.corbiere@opale-concept.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Global defines
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Application version
|
|
||||||
define('DEF_AppVersion', '1.0');
|
|
||||||
// Application name
|
|
||||||
define('DEF_AppName', 'epub loader');
|
|
||||||
// Admin email
|
|
||||||
define('DEF_AppAdminMail', 'didier.corbiere@opale-concept.com');
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Include files
|
// Include files
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Include config file
|
// Include config file
|
||||||
$fileName = __DIR__ . DIRECTORY_SEPARATOR . 'config.php';
|
$fileName = __DIR__ . DIRECTORY_SEPARATOR . 'epub-loader-config.php';
|
||||||
if (!file_exists($fileName)) {
|
if (!file_exists($fileName)) {
|
||||||
die ('Missing configuration file: ' . $fileName);
|
die ('Missing configuration file: ' . $fileName);
|
||||||
}
|
}
|
||||||
require_once($fileName);
|
require_once($fileName);
|
||||||
|
|
||||||
// Check Cops directory
|
|
||||||
if (!is_dir($gConfig['cops_directory'])) {
|
|
||||||
die ('Incorrect Cops directory: ' . $gConfig['cops_directory']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Include Calibre database loader class
|
// Include Calibre database loader class
|
||||||
$fileName = $gConfig['cops_directory'] . '/resources/epub-loader/CalibreDbLoader.class.php';
|
$fileName = $gConfig['cops_directory'] . '/resources/epub-loader/CalibreDbLoader.class.php';
|
||||||
if (!file_exists($fileName)) {
|
if (!file_exists($fileName)) {
|
||||||
|
|
Loading…
Reference in a new issue