This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ require_once "../bootstrap/bootstrap.php"; // Security: The script runs from the cli SAPI only. Filter_Cli::assert(); ignore_user_abort(true); set_time_limit(0); $bible = Filter_Cli::argument(@$argv, 1); $directory = Export_Logic::bibleDirectory($bible) . "/onlinebible"; if (!file_exists($directory)) { mkdir($directory, 0777, true); } $filename = "{$directory}/bible.exp"; $database_logs = Database_Logs::getInstance(); $database_config_bible = Database_Config_Bible::getInstance(); $database_bibles = Database_Bibles::getInstance(); $database_books = Database_Books::getInstance(); $stylesheet = $database_config_bible->getExportStylesheet($bible); $filter_text_bible = new Filter_Text($bible); $filter_text_bible->onlinebible_text = new Onlinebible_Text(); $books = $database_bibles->getBooks($bible); foreach ($books as $book) { $chapters = $database_bibles->getChapters($bible, $book); foreach ($chapters as $chapter) {
$database_bibles = Database_Bibles::getInstance(); $database_books = Database_Books::getInstance(); $stylesheet = $database_config_bible->getExportStylesheet($bible); // Create stylesheet. $styles_sheets = new Styles_Sheets(); $styles_sheets->create($stylesheet, $filecss, false, $bible); // Copy font to the output directory. $font = $database_config_bible->getTextFont($bible); if ($font) { if (Fonts_Logic::fontExists($font)) { $fontpath = Fonts_Logic::getFontPath($font); copy($fontpath, "{$directory}/{$font}"); } } $filter_text = new Filter_Text($bible); $filter_text->html_text_standard = new Html_Text(Locale_Translate::_("Bible")); $filter_text->html_text_standard->customClass = Filter_CustomCSS::getClass($bible); // Load one book. $chapters = $database_bibles->getChapters($bible, $book); foreach ($chapters as $chapter) { $usfm = $database_bibles->getChapter($bible, $book, $chapter); $usfm = trim($usfm); // Use small chunks of USFM at a time for much better performance. $filter_text->addUsfmCode($usfm); } // Convert the USFM. $filter_text->run($stylesheet); // Save file. $filter_text->html_text_standard->save($filename); $database_logs->log(Locale_Translate::_("Exported to html") . " {$bible} " . Export_Logic::baseBookFileName($book), Filter_Roles::TRANSLATOR_LEVEL);
if (!file_exists($directory)) { mkdir($directory, 0777, true); } // Filenames for the web file and stylesheet. $indexFile = "{$directory}/index.html"; $index00 = "{$directory}/00_index.html"; $filecss = "{$directory}/stylesheet.css"; $database_logs = Database_Logs::getInstance(); $database_config_bible = Database_Config_Bible::getInstance(); $database_bibles = Database_Bibles::getInstance(); $database_books = Database_Books::getInstance(); $stylesheet = $database_config_bible->getExportStylesheet($bible); // Create stylesheet. $styles_sheets = new Styles_Sheets(); $styles_sheets->create($stylesheet, $filecss, false, $bible); $backLinkPath = Export_Logic::webBackLinkDirectory($bible); // Main index file. $html_text_rich_bible_index = new Html_Text($bible); // On top are the breadcrumbs, starting with a clickable Bible name. $htmlHeader = new Html_Header($html_text_rich_bible_index); $htmlHeader->searchBackLink($backLinkPath . Filter_Paths::htmlFileNameBible(), Locale_Translate::_("Go back to Bible")); $htmlHeader->create(array(array($bible, Filter_Paths::htmlFileNameBible()))); // Prepare for the list of books in de html index file. $html_text_rich_bible_index->newParagraph("navigationbar"); $html_text_rich_bible_index->addText(" |"); // Go through the Bible books. $books = $database_bibles->getBooks($bible); foreach ($books as $book) { // Add this book to the main web index. $html_text_rich_bible_index->addLink($html_text_rich_bible_index->currentPDomElement, Filter_Paths::htmlFileNameBible("", $book), "", $database_books->getEnglishFromId($book), "", " " . $database_books->getEnglishFromId($book) . " "); $html_text_rich_bible_index->addText("|");
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ require_once "../bootstrap/bootstrap.php"; // Security: The script runs from the cli SAPI only. Filter_Cli::assert(); ignore_user_abort(true); set_time_limit(0); // The input parameters. $bible = Filter_Cli::argument(@$argv, 1); // Create folders for the information. $directory = Export_Logic::bibleDirectory($bible) . "/info"; if (!file_exists($directory)) { mkdir($directory, 0777, true); } // Filenames for the various types of OpenDocument files. $informationdFilename = "{$directory}/information.html"; $falloutFilename = "{$directory}/fallout.html"; $database_logs = Database_Logs::getInstance(); $database_config_bible = Database_Config_Bible::getInstance(); $database_bibles = Database_Bibles::getInstance(); $database_books = Database_Books::getInstance(); $stylesheet = $database_config_bible->getExportStylesheet($bible); $filter_text = new Filter_Text($bible); $books = $database_bibles->getBooks($bible); foreach ($books as $book) { $chapters = $database_bibles->getChapters($bible, $book);
if (isset($_GET['eswordtoggle'])) { $database_config_bible->setExportESwordDuringNight($bible, !$database_config_bible->getExportESwordDuringNight($bible)); $view->view->success = Locale_Translate::_("The setting for nightly export to e-Sword format was updated."); } $view->view->esword = $database_config_bible->getExportESwordDuringNight($bible); if (isset($_GET['eswordnow'])) { Export_Logic::scheduleESword($bible); $view->view->success = Locale_Translate::_("The Bible is being exported to e-Sword format."); } if (isset($_GET['onlinebibletoggle'])) { $database_config_bible->setExportOnlineBibleDuringNight($bible, !$database_config_bible->getExportOnlineBibleDuringNight($bible)); $view->view->success = Locale_Translate::_("The setting for nightly export to Online Bible format was updated."); } $view->view->onlinebible = $database_config_bible->getExportOnlineBibleDuringNight($bible); if (isset($_GET['onlinebiblenow'])) { Export_Logic::scheduleOnlineBible($bible); $view->view->success = Locale_Translate::_("The Bible is being exported to Online Bible format."); } if (isset($_GET['sheet'])) { $sheet = $_GET['sheet']; if ($sheet == "") { $dialog_list = new Dialog_List2(Locale_Translate::_("Would you like to use another stylesheet for the exports?")); $database_styles = Database_Styles::getInstance(); $sheets = $database_styles->getSheets(); foreach ($sheets as $sheet) { $parameter = "&sheet={$sheet}"; $dialog_list->add_row($sheet, $parameter); } $dialog_list->run(); } else { $database_config_bible->setExportStylesheet($bible, $sheet);
foreach ($chapters as $chapter) { // Get the USFM code for the current chapter. $chapter_data = $database_bibles->getChapter($bible, $book, $chapter); $chapter_data = trim($chapter_data); // Add the chapter USFM code to the book's USFM code. $bookUsfmDataFull .= $chapter_data; $bookUsfmDataFull .= "\n"; } // The filename for the USFM for this book. $filename = Export_Logic::baseBookFileName($book); $path = "{$usfmDirectoryFull}/{$filename}.usfm"; // Save. file_put_contents($path, $bookUsfmDataFull); } // Compress USFM files into one zip file. $zipfile = "{$usfmDirectoryFull}/" . Export_Logic::baseBookFileName(0) . ".zip"; @unlink($zipfile); $archive = Filter_Archive::zip($usfmDirectoryFull); rename($archive, $zipfile); if ($database_config_bible->getSecureUsfmExport($bible)) { // Securing the full USFM export means that there will be one zip file secured with a password. // This zip file contains all exported USFM data. // All other files will be removed. // It uses the external zip binary. // PHP 5.6 supports password protected archives: ZipArchive::setPassword ($password). $files = scandir($usfmDirectoryFull); $files = Filter_Folders::cleanup($files); $basefile = basename($zipfile); foreach ($files as $file) { if ($file != $basefile) { unlink("{$usfmDirectoryFull}/{$file}");
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ require_once "../bootstrap/bootstrap.php"; // Security: The script runs from the cli SAPI only. Filter_Cli::assert(); ignore_user_abort(true); set_time_limit(0); $bible = Filter_Cli::argument(@$argv, 1); $directory = Export_Logic::bibleDirectory($bible) . "/esword"; if (!file_exists($directory)) { mkdir($directory, 0777, true); } $filename = "{$directory}/{$bible}.bblx"; if (file_exists($filename)) { unlink($filename); } $database_logs = Database_Logs::getInstance(); $database_config_bible = Database_Config_Bible::getInstance(); $database_bibles = Database_Bibles::getInstance(); $database_books = Database_Books::getInstance(); $stylesheet = $database_config_bible->getExportStylesheet($bible); $filter_text_bible = new Filter_Text($bible); $filter_text_bible->esword_text = new Esword_Text($bible); $books = $database_bibles->getBooks($bible);
// The script itself determines what to do at which hour of the day or day of the week or day of the month. if (!$client) { if ($minute == 5) { Sprint_Logic::burndown("", false); } } // A flag is set upon installation, so it (re-)generates the stylesheets once. $create_css_flag = "../dyncss/create_css.txt"; if (file_exists($create_css_flag)) { unlink($create_css_flag); Styles_Sheets::create_all(); } // Export the Bibles to the various output formats. // This may take an hour on a production machine. if ($hour == 1 && $minute == 10) { Export_Logic::scheduleAll(); } // Re-index Bible and notes. if ($hour == 2 && $minute == 0) { $directory = dirname(__DIR__) . "/search"; Tasks_Logic::queue(Tasks_Logic::PHP, array("{$directory}/rebibles.php")); $directory = dirname(__DIR__) . "/search"; Tasks_Logic::queue(Tasks_Logic::PHP, array("{$directory}/renotes.php")); } // Delete temporal files older than a few days. if ($hour == 2 && $minute == 0) { Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/temp.php")); } // Email statistics to the users. if (!$client) { if ($hour == 3 && $minute == 0) {
foreach ($chapters as $chapter) { // The text filter for this chapter. $filter_text_chapter = new Filter_Text($bible); // Basic USFM for this chapter. $filter_text_chapter->initializeHeadingsAndTextPerVerse(); // Get the USFM code for the current chapter. $chapter_data = $database_bibles->getChapter($bible, $book, $chapter); $chapter_data = trim($chapter_data); // Add the chapter's USFM code to the Text_* filter for the book, and for the chapter. // Use small chunks of USFM at a time. This provides much better performance. $filter_text_book->addUsfmCode($chapter_data); $filter_text_chapter->addUsfmCode($chapter_data); // Convert the chapter $filter_text_chapter->run($stylesheet); // Deal with basic USFM. if ($chapter > 0) { $verses_text = $filter_text_chapter->getVersesText(); $basicUsfm = "\\c {$chapter}\n"; $basicUsfm .= "\\p\n"; foreach ($verses_text as $verse => $text) { $basicUsfm .= "\\v {$verse} {$text}\n"; } file_put_contents($usfmFilename, $basicUsfm, FILE_APPEND); } } // Convert the book. $filter_text_book->run($stylesheet); // Save the text export. $filter_text_book->text_text->save($textFilename); $database_logs->log($bible . " " . Export_Logic::baseBookFileName($book) . ": " . Locale_Translate::_("Exported to basic USFM and text"), Filter_Roles::TRANSLATOR_LEVEL);