diff --git a/resources/epub-loader/app/.gitignore b/resources/epub-loader/app/.gitignore index 4e9b47a..0d00eb9 100644 --- a/resources/epub-loader/app/.gitignore +++ b/resources/epub-loader/app/.gitignore @@ -1 +1 @@ -config.php \ No newline at end of file +epub-loader-config.php diff --git a/resources/epub-loader/app/action_cvs_export.php b/resources/epub-loader/app/action_csv_export.php similarity index 100% rename from resources/epub-loader/app/action_cvs_export.php rename to resources/epub-loader/app/action_csv_export.php diff --git a/resources/epub-loader/app/cops-feed.php b/resources/epub-loader/app/cops-feed.php new file mode 100644 index 0000000..698404b --- /dev/null +++ b/resources/epub-loader/app/cops-feed.php @@ -0,0 +1,27 @@ + + */ + +// 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); + +?> diff --git a/resources/epub-loader/app/config.php.example b/resources/epub-loader/app/epub-loader-config.php.example similarity index 71% rename from resources/epub-loader/app/config.php.example rename to resources/epub-loader/app/epub-loader-config.php.example index 802b1ca..a0140d5 100644 --- a/resources/epub-loader/app/config.php.example +++ b/resources/epub-loader/app/epub-loader-config.php.example @@ -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'; ?> diff --git a/resources/epub-loader/app/footer.php b/resources/epub-loader/app/footer.php index 43eab64..13b1631 100644 --- a/resources/epub-loader/app/footer.php +++ b/resources/epub-loader/app/footer.php @@ -28,12 +28,18 @@ diff --git a/resources/epub-loader/app/header.php b/resources/epub-loader/app/header.php index db10ce0..a4a93a2 100644 --- a/resources/epub-loader/app/header.php +++ b/resources/epub-loader/app/header.php @@ -5,7 +5,7 @@ header('Content-type: text/html; charset=utf-8'); "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - <?php echo DEF_AppName; ?> + <?php echo $gConfig['app_name']; ?>