it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

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";
Filter_Cli::assert();
$object = Filter_Cli::argument(@$argv, 1);
$database_config_bible = Database_Config_Bible::getInstance();
$database_notes = Database_Notes::getInstance();
$url = $database_config_bible->getRemoteRepositoryUrl($object);
$directory = Filter_Git::git_directory($object);
$consultationsfolder = $database_notes->mainFolder();
// Our data goes into the local repository.
echo Locale_Translate::_("Step 1/2:") . " ";
echo Locale_Translate::_("Exporting the local Bible data to the local repository") . "\n";
Filter_Git::syncBible2Git($object, $directory, true);
// Directory for use by the shell.
$shelldirectory = escapeshellarg($directory);
// Add and commit the data.
$command = "cd {$shelldirectory}; git add --all .";
echo "{$command}\n";
exec($command, $output, $exit_code);
Exemple #2
0
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

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: Page only runs from the cli SAPI.
Filter_Cli::assert();
$database_logs = Database_Logs::getInstance();
$database_logs->log("Removing expired temporal files", Filter_Roles::ADMIN_LEVEL);
$expired = strtotime("-3 days");
$directory = dirname(__DIR__) . "/tmp";
$names = scandir($directory);
$names = Filter_Folders::cleanup($names);
foreach ($names as $name) {
    $filename = "{$directory}/{$name}";
    $mtime = filemtime($filename);
    if ($mtime < $expired) {
        if (is_file($filename)) {
            unlink($filename);
        }
        if (is_dir($filename)) {
            Filter_Rmdir::rmdir($filename);
Exemple #3
0
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: Page only runs from the cli SAPI.
Filter_Cli::assert();
$database_logs = Database_Logs::getInstance();
$database_versifications = Database_Versifications::getInstance();
$database_books = Database_Books::getInstance();
$database_offlineresources = Database_OfflineResources::getInstance();
$database_resources = Database_Resources::getInstance();
$resource = Filter_Cli::argument(@$argv, 1);
$book = Filter_Cli::argument(@$argv, 2);
$bookName = $database_books->getEnglishFromId($book);
$database_logs->log("{$resource} {$bookName}: Download has started", Filter_Roles::MANAGER_LEVEL);
$versification = $database_resources->getVersification($resource);
$chapters = $database_versifications->getChapters($versification, $book, true);
foreach ($chapters as $chapter) {
    $message = "{$resource}: {$bookName} chapter {$chapter}";
    $verses = $database_versifications->getVerses($versification, $book, $chapter);
    foreach ($verses as $verse) {
        $message .= "; verse {$verse}: ";
        if ($database_offlineresources->exists($resource, $book, $chapter, $verse)) {
            $message .= "exists";
        } else {
            $html = Resource_Logic::getExternal($resource, $book, $chapter, $verse, false);
            $database_offlineresources->store($resource, $book, $chapter, $verse, $html);
            $size = strlen($html);
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

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";
Filter_Cli::assert();
$object = Filter_Cli::argument(@$argv, 1);
$directory = Filter_Cli::argument(@$argv, 2);
$escapedDir = escapeshellarg($directory);
$database_config_bible = Database_Config_Bible::getInstance();
$url = $database_config_bible->getRemoteRepositoryUrl($object);
$command = "cd {$escapedDir}; git clone {$url} .";
echo "{$command}\n";
passthru($command, $exit_code);
if ($exit_code == 0) {
    echo Locale_Translate::_("Ok: The repository was cloned successfully.");
} else {
    echo Locale_Translate::_("Error: The repository could not be cloned.");
}
echo "\n";
// Switch rename detection off.
// This is necessary for the consultation notes, since git has been seen to "detect" spurious renames.
exec("cd {$escapedDir}; git config diff.renamelimit 0");
Exemple #5
0
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";
$database_logs = Database_Logs::getInstance();
$database_logs->log(Locale_Translate::_("Import consultation notes has started"), true);
// Security: Page only runs from the cli SAPI.
Filter_Cli::assert();
$folder = Filter_Cli::argument(@$argv, 1);
$folder = "{$folder}/data";
$database_logs->log(Locale_Translate::_("Importing from folder:") . " " . $folder, true);
$counter = 0;
foreach (new DirectoryIterator($folder) as $fileInfo) {
    if ($fileInfo->isDot()) {
        continue;
    }
    if ($fileInfo->isDir()) {
        continue;
    }
    $counter++;
    $basename = $fileInfo->getFilename();
    $information = Locale_Translate::_("Note") . " " . $basename . " ({$counter}) ";
    if (is_numeric($basename)) {
        $path = "{$folder}/{$basename}";
Exemple #6
0
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();
$database_logs = Database_Logs::getInstance();
$database_config_general = Database_Config_General::getInstance();
$database_config_user = Database_Config_User::getInstance();
$database_config_bible = Database_Config_Bible::getInstance();
$database_bibles = Database_Bibles::getInstance();
$database_check = Database_Check::getInstance();
$database_users = Database_Users::getInstance();
$database_mail = Database_Mail::getInstance();
$database_books = Database_Books::getInstance();
@($bible = Filter_Cli::argument(@$argv, 1));
if ($bible == "") {
    echo "No Bible given\n";
}
$database_logs->log("Check {$bible}: Start", Filter_Roles::TRANSLATOR_LEVEL);
$database_check->truncateOutput($bible);
$stylesheet = $database_config_bible->getExportStylesheet($bible);
$check_double_spaces_usfm = $database_config_bible->getCheckDoubleSpacesUsfm($bible);
$check_full_stop_in_headings = $database_config_bible->getCheckFullStopInHeadings($bible);
$check_space_before_punctuation = $database_config_bible->getCheckSpaceBeforePunctuation($bible);
$check_sentence_structure = $database_config_bible->getCheckSentenceStructure($bible);
$check_paragraph_structure = $database_config_bible->getCheckParagraphStructure($bible);
$checks_sentences = new Checks_Sentences();
$checks_sentences->enterCapitals($database_config_bible->getSentenceStructureCapitals($bible));
$checks_sentences->enterSmallLetters($database_config_bible->getSentenceStructureSmallLetters($bible));
$end_marks = $database_config_bible->getSentenceStructureEndPunctuation($bible);
Exemple #7
0
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.
*/
// This script logs a message in the Journal through the web.
// Skip empty message.
@($msg = $_GET["msg"]);
if ($msg == "") {
    die;
}
// It can be called from localhost only for security reasons.
if ($_SERVER['SERVER_ADDR'] != $_SERVER['REMOTE_ADDR']) {
    die;
}
require_once "../bootstrap/bootstrap.php";
if (Filter_Cli::not_yet_ready()) {
    die;
}
// Keep pure text only.
$msg = Filter_Html::html2text($msg);
$msg = trim($msg);
if ($msg == "") {
    die;
}
// Log the message.
$database_logs = Database_Logs::getInstance();
$database_logs->log($msg);
Exemple #8
0
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();
// The script is called with the first and last note identifier to deal with.
$lowId = Filter_Cli::argument(@$argv, 1);
$highId = Filter_Cli::argument(@$argv, 2);
$database_logs = Database_Logs::getInstance();
$database_config_bible = Database_Config_Bible::getInstance();
$database_config_general = Database_Config_General::getInstance();
$database_notes = Database_Notes::getInstance();
$database_users = Database_Users::getInstance();
$database_bibles = Database_Bibles::getInstance();
$notes_logic = Notes_Logic::getInstance();
// Check for the health of the notes databases and take action if needed.
$healthy = true;
if (!$database_notes->healthy()) {
    $healthy = false;
}
if (!$database_notes->checksums_healthy()) {
    $healthy = false;
}
Exemple #9
0
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();
$jobId = Filter_Cli::argument(@$argv, 1);
$user = Filter_Cli::argument(@$argv, 2);
$bible = Filter_Cli::argument(@$argv, 3);
$session_logic = Session_Logic::getInstance();
$session_logic->setUsername($user);
$database_jobs = Database_Jobs::getInstance();
$database_config_user = Database_Config_User::getInstance();
$database_bibles = Database_Bibles::getInstance();
$database_jobs->setProgress($jobId, Locale_Translate::_("The document is being created..."));
$resources = $database_config_user->getPrintResourcesForUser($user);
$from = $database_config_user->getPrintPassageFromForUser($user);
$passage = explode(".", $from);
$from = Filter_Books::passage2integer($passage);
$to = $database_config_user->getPrintPassageToForUser($user);
$passage = explode(".", $to);
$to = Filter_Books::passage2integer($passage);
$result = array();
$books = $database_bibles->getBooks($bible);
Exemple #10
0
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();
// The databases.
$database_logs = Database_Logs::getInstance();
$database_books = Database_Books::getInstance();
$database_config_bible = Database_Config_Bible::getInstance();
$database_bibles = Database_Bibles::getInstance();
$database_users = Database_Users::getInstance();
$inputBible = Filter_Cli::argument(@$argv, 1);
$outputBible = "{$inputBible}-hyphenated";
$user = Filter_Cli::argument(@$argv, 2);
$database_logs->log("Reading Bible {$inputBible}, adding soft hyphens, putting it into Bible {$outputBible}");
// Get the two sets of characters as arrays.
// The /u switch treats the text as UTF8 Unicode.
preg_match_all('/./u', $database_config_bible->getHyphenationFirstSet($inputBible), $firstset);
$firstset = $firstset[0];
preg_match_all('/./u', $database_config_bible->getHyphenationSecondSet($inputBible), $secondset);
$secondset = $secondset[0];
// Delete and (re)create the hyphenated Bible, and grant privileges.
$database_bibles->deleteBible($outputBible);
$database_bibles->createBible($outputBible);
$database_users->grantAccess2Bible($user, $outputBible);
// Go through the input Bible's books and chapters.
$books = $database_bibles->getBooks($inputBible);
foreach ($books as $book) {
    $database_logs->log($database_books->getEnglishFromId($book));
Exemple #11
0
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();
$database_logs = Database_Logs::getInstance();
$bible = Filter_Cli::argument(@$argv, 1);
$compare = Filter_Cli::argument(@$argv, 2);
$jobId = Filter_Cli::argument(@$argv, 3);
$database_logs->log(Locale_Translate::_("Comparing Bibles") . " {$bible} " . Locale_Translate::_("and") . " {$compare}", Filter_Roles::CONSULTANT_LEVEL);
$database_config_bible = Database_Config_Bible::getInstance();
$database_jobs = Database_Jobs::getInstance();
$database_bibles = Database_Bibles::getInstance();
$database_usfmresources = Database_UsfmResources::getInstance();
$database_books = Database_Books::getInstance();
$stylesheet = $database_config_bible->getExportStylesheet($bible);
$database_jobs->setProgress($jobId, Locale_Translate::_("The Bibles are being compared..."));
// The results of the comparison. Will be displayed to the user.
$result = array();
$result[] = Locale_Translate::_("Bible") . " " . $bible . " " . Locale_Translate::_("has been compared with") . " " . $compare . ".";
$result[] = Locale_Translate::_("Additions are in bold.") . " " . Locale_Translate::_("Removed words are in strikethrough.");
$result[] = "";
// Get the combined books in both Bibles/Resources.
$bibleBooks = $database_bibles->getBooks($bible);
Exemple #12
0
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();
$database_logs = Database_Logs::getInstance();
$database_bibles = Database_Bibles::getInstance();
$database_usfmresources = Database_UsfmResources::getInstance();
$database_books = Database_Books::getInstance();
$database_modifications = Database_Modifications::getInstance();
$resource = Filter_Cli::argument(@$argv, 1);
$database_logs->log(Locale_Translate::_("Converting USFM Resource to Bible") . ": {$resource}");
$database_bibles->createBible($resource);
$books = $database_usfmresources->getBooks($resource);
foreach ($books as $book) {
    $bookname = $database_books->getEnglishFromId($book);
    $database_logs->log("{$bookname}");
    $chapters = $database_usfmresources->getChapters($resource, $book);
    foreach ($chapters as $chapter) {
        $usfm = $database_usfmresources->getUsfm($resource, $book, $chapter);
        $database_bibles->storeChapter($resource, $book, $chapter, $usfm);
    }
}
$database_usfmresources->deleteResource($resource);
$database_logs->log(Locale_Translate::_("Conversion completed"));
Exemple #13
0
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();
// Get the Bible.
$bible = Filter_Cli::argument(@$argv, 1);
if ($bible == "-") {
    $bible = "";
}
// Flag for sending email.
@($email = Filter_Cli::argument(@$argv, 2));
if (!isset($email)) {
    $email = false;
}
$email = $email ? true : false;
$year = date("Y");
$month = date("n");
$monthday = date("j");
// 1 to 31.
$weekday = date("w");
// 0 (for Sunday) through 6 (for Saturday).
$hour = date("G");
// 0 through 23
$sprintstart = false;
$sprintfinish = false;
// Every Friday at 2 PM (14:00h) it sends email about the sprint progress.