diff --git a/resources/epub-loader/app/index.php b/resources/epub-loader/app/index.php
new file mode 100644
index 0000000..ce78a1f
--- /dev/null
+++ b/resources/epub-loader/app/index.php
@@ -0,0 +1,151 @@
+
+ */
+
+//------------------------------------------------------------------------------
+// Include files
+//------------------------------------------------------------------------------
+
+// Include config file
+$fileName = __DIR__ . DIRECTORY_SEPARATOR . 'epub-loader-config.php';
+if (!file_exists($fileName)) {
+ die ('Missing configuration file: ' . $fileName);
+}
+require_once($fileName);
+
+// Include Calibre database loader class
+$fileName = $gConfig['cops_directory'] . '/resources/epub-loader/CalibreDbLoader.class.php';
+if (!file_exists($fileName)) {
+ die ('Incorrect include file: ' . $fileName);
+}
+require_once($fileName);
+
+// Include book export class
+$fileName = $gConfig['cops_directory'] . '/resources/epub-loader/BookExport.class.php';
+if (!file_exists($fileName)) {
+ die ('Incorrect include file: ' . $fileName);
+}
+require_once($fileName);
+
+//------------------------------------------------------------------------------
+// Start application
+//------------------------------------------------------------------------------
+
+// Global vars
+$gErrorArray = array();
+
+// Get the url parameters
+$action = isset($_GET['action']) ? $_GET['action'] : null;
+$dbNum = isset($_GET['dbnum']) ? (int)$_GET['dbnum'] : null;
+
+// Include html header
+require_once(__DIR__ . DIRECTORY_SEPARATOR . 'header.php');
+
+/**
+ * Recursive get files
+ *
+ * @param string Base directory to search in
+ * @param string Search pattern
+ */
+function RecursiveGlob($inPath = '', $inPattern = '*')
+{
+ $res = array();
+
+ // Check path
+ if (!is_dir($inPath)) {
+ return $res;
+ }
+
+ // Get the list of directories
+ if (substr($inPath, -1) != DIRECTORY_SEPARATOR) {
+ $inPath .= DIRECTORY_SEPARATOR;
+ }
+
+ // Add files from the current directory
+ $files = glob($inPath . $inPattern, GLOB_MARK | GLOB_NOSORT);
+ foreach ($files as $item) {
+ if (substr($item, -1) == DIRECTORY_SEPARATOR) {
+ continue;
+ }
+ $res[] = $item;
+ }
+
+ // Scan sub directories
+ $paths = glob($inPath . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT);
+ foreach ($paths as $path) {
+ $res = array_merge($res, RecursiveGlob($path, $inPattern));
+ }
+
+ return $res;
+}
+
+// Html content
+if (isset($action) && isset($dbNum)) {
+ if (!isset($gConfig['databases'][$dbNum])) {
+ die ('Incorrect database num: ' . $dbNum);
+ }
+ $dbConfig = $gConfig['databases'][$dbNum];
+ $dbPath = $dbConfig['db_path'];
+ if (!is_dir($dbPath)) {
+ if (!mkdir($dbPath, 0755, true)) {
+ die ('Cannot create directory: ' . $dbPath);
+ }
+ }
+ $fileName = sprintf('%s%saction_%s.php', __DIR__, DIRECTORY_SEPARATOR, $action);
+ if (!file_exists($fileName)) {
+ die ('Incorrect action file: ' . $fileName);
+ }
+ require_once($fileName);
+}
+else {
+ if (!isset($action)) {
+ // Display the available actions
+ $str = '';
+ $str .= '
' . 'Select action' . '
' . "\n";
+ $str .= '
' . "\n";
+ foreach ($gConfig['actions'] as $action => $actionInfo) {
+ $str .= ' - ' . "\n";
+ $str .= ' ' . $actionInfo . '' . "\n";
+ $str .= '
' . "\n";
+ }
+ $str .= '
' . "\n";
+ echo $str;
+ }
+ else {
+ // Display databases
+ $str = '';
+ $str .= '
' . "\n";
+ $str .= '' . "\n";
+ $str .= '' . 'Db num' . ' | ' . "\n";
+ $str .= '' . 'Db name' . ' | ' . "\n";
+ $str .= '' . 'Action' . ' | ' . "\n";
+ $str .= '' . 'Db Path' . ' | ' . "\n";
+ $str .= '' . 'Epub path' . ' | ' . "\n";
+ $str .= '' . 'Nb Files' . ' | ' . "\n";
+ $str .= '
' . "\n";
+ $actionTitle = $gConfig['actions'][$action];
+ foreach ($gConfig['databases'] as $dbNum => $dbConfig) {
+ $fileList = RecursiveGlob($dbConfig['epub_path'], '*.epub');
+ $str .= '' . "\n";
+ $str .= '' . $dbNum . ' | ' . "\n";
+ $str .= '' . $dbConfig['name'] . ' | ' . "\n";
+ $str .= '' . '' . $actionTitle . '' . ' | ' . "\n";
+ $str .= '' . $dbConfig['db_path'] . ' | ' . "\n";
+ $str .= '' . $dbConfig['epub_path'] . ' | ' . "\n";
+ $str .= '' . count($fileList) . ' | ' . "\n";
+ $str .= '
' . "\n";
+ $numWork++;
+ }
+ $str .= '
' . "\n";
+ echo $str;
+ }
+}
+
+// Include html footer
+require_once(__DIR__ . DIRECTORY_SEPARATOR . 'footer.php');
+
+?>
diff --git a/resources/php-epub-meta/epub.php b/resources/php-epub-meta/epub.php
index 6dcc19f..c7d6b28 100644
--- a/resources/php-epub-meta/epub.php
+++ b/resources/php-epub-meta/epub.php
@@ -322,6 +322,30 @@ class EPub {
return $res;
}
+ /**
+ * Set or get the book's creation date
+ *
+ * @param string Date eg: 2012-05-19T12:54:25Z
+ */
+ public function CreationDate($date = false)
+ {
+ $res = $this->getset('dc:date', $date, 'opf:event', 'creation');
+
+ return $res;
+ }
+
+ /**
+ * Set or get the book's modification date
+ *
+ * @param string Date eg: 2012-05-19T12:54:25Z
+ */
+ public function ModificationDate($date = false)
+ {
+ $res = $this->getset('dc:date', $date, 'opf:event', 'modification');
+
+ return $res;
+ }
+
/**
* Set or get the book's URI
*