*/ //------------------------------------------------------------------------------ // 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'; 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)) { die ('Incorrect include file: ' . $gConfig['cops_directory']); } 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: ' . $gConfig['cops_directory']); } 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'); // Html content if (isset($action) && isset($dbNum)) { if (!isset($gConfig['databases'][$dbNum])) { die ('Incorrect database num: ' . $dbNum); } $dbConfig = $gConfig['databases'][$dbNum]; $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 .= '
' . 'Db num' . ' | ' . "\n"; $str .= '' . 'Db name' . ' | ' . "\n"; $str .= '' . 'Action' . ' | ' . "\n"; $str .= '' . 'Db Path' . ' | ' . "\n"; $str .= '' . 'Epub path' . ' | ' . "\n"; $str .= '' . 'Nb Files' . ' | ' . "\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 .= '