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:
Marsender 2013-10-10 05:21:19 +01:00
parent fce60d4079
commit 35bbf55e19
7 changed files with 56 additions and 26 deletions

View file

@ -1 +1 @@
config.php
epub-loader-config.php

View 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);
?>

View file

@ -8,12 +8,25 @@
$gConfig = array();
/**
* Application name
*/
$gConfig['app_name'] = 'Epub loader';
/**
* Admin email
*/
$gConfig['admin_email'] = 'didier.corbiere@opale-concept.com';
/**
* Cops directory
*
* This is the base path of Cops library
*/
$gConfig['cops_directory'] = dirname(dirname(dirname(__DIR__)));
if (!is_dir($gConfig['cops_directory'])) {
die ('Incorrect Cops directory: ' . $gConfig['cops_directory']);
}
/**
* Create Calibre databases ?
@ -30,17 +43,18 @@ $gConfig['create_db'] = true;
* name: The database name to display
* db_path: The path where to create the database
* 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('name' => 'Littérature classique', 'db_path' => '/opt/ebooks/calibre/demo', 'epub_path' => '/opt/ebooks/epub/demo');
$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' => 'La Bibliothèque d\'Ebooks', 'db_path' => '/opt/ebooks/calibre/bibebook', 'epub_path' => '/opt/ebooks/epub/bibebook');
$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', 'pdf_path' => '');
$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
*/
$gConfig['actions'] = array();
$gConfig['actions']['cvs_export'] = 'Cvs export';
$gConfig['actions']['csv_export'] = 'Csv export';
$gConfig['actions']['db_load'] = 'Create database';
?>

View file

@ -28,12 +28,18 @@
<!-- Footer begin -->
<div class="footer">
<?php
if (!empty($gConfig['admin_email'])) {
?>
<script type="text/javascript">
/*<![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>");
/*]]>*/
</script>
<?php
}
?>
</div>
<!-- Footer end -->

View file

@ -5,7 +5,7 @@ header('Content-type: text/html; charset=utf-8');
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo DEF_AppName; ?></title>
<title><?php echo $gConfig['app_name']; ?></title>
<meta name="author" content="opale-concept.com" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
@ -80,7 +80,7 @@ header('Content-type: text/html; charset=utf-8');
<body>
<!-- Header begin -->
<div class="header">
<?php echo ' <a href=".">' . DEF_AppName . '</a>' . "\n"; ?>
<a href="."><?php echo $gConfig['app_name']; ?></a>
</div>
<!-- Header end -->

View file

@ -6,34 +6,17 @@
* @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 config file
$fileName = __DIR__ . DIRECTORY_SEPARATOR . 'config.php';
$fileName = __DIR__ . DIRECTORY_SEPARATOR . 'epub-loader-config.php';
if (!file_exists($fileName)) {
die ('Missing configuration file: ' . $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
$fileName = $gConfig['cops_directory'] . '/resources/epub-loader/CalibreDbLoader.class.php';
if (!file_exists($fileName)) {