Esempio n. 1
0
 public static function burndown($bible, $mail)
 {
     if ($bible == "") {
         $bible = "-";
     }
     $mail = Filter_Bool::int($mail);
     Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/burndown.php", $bible, $mail));
 }
Esempio n. 2
0
 public static function create_all()
 {
     Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/csscli.php"));
 }
Esempio n. 3
0
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once "../bootstrap/bootstrap.php";
page_access_level(Filter_Roles::MANAGER_LEVEL);
$database_usfmresources = Database_UsfmResources::getInstance();
@($delete = $_GET['delete']);
if (isset($delete)) {
    if (Access_Bible::write($delete)) {
        $database_usfmresources->deleteResource($delete);
    } else {
        Assets_Page::error(Locale_Translate::_("You do not have write access to this resource"));
    }
}
@($convert = $_GET['convert']);
if (isset($convert)) {
    if (Access_Bible::write($convert)) {
        Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/convert2bible.php", $convert));
        Filter_Url::redirect("../journal/index.php");
        die;
    } else {
        Assets_Page::error(Locale_Translate::_("Insufficient privileges"));
    }
}
$header = new Assets_Header(Locale_Translate::_("USFM Resources"));
$header->jQueryUIOn("dialog");
$header->run();
$view = new Assets_View(__FILE__);
$resources = $database_usfmresources->getResources();
$view->view->resources = $resources;
$view->render("manage.php");
Assets_Page::footer();
Esempio n. 4
0
<?php

/*
Copyright (©) 2003-2014 Teus Benschop.

This program is free software; you can redistribute it and/or modify
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";
page_access_level(Filter_Roles::ADMIN_LEVEL);
Assets_Page::header(Locale_Translate::_("Removing duplicate consultation notes"));
set_time_limit(0);
$workingdirectory = dirname(__FILE__);
Tasks_Logic::queue(Tasks_Logic::PHP, array("{$workingdirectory}/cleancli.php"));
$view = new Assets_View(__FILE__);
$view->render("clean.php");
Assets_Page::footer();
Esempio n. 5
0
// The name of the Bible.
$bible = Access_Bible::clamp($_GET['bible']);
$view->view->bible = Filter_Html::sanitize($bible);
// Data submission.
if (isset($_POST['submit'])) {
    // Whether to keep the grammatical tags.
    $tags = isset($_POST['tags']);
    // The BibleWorks text.
    $data = $_POST['data'];
    $data = trim($data);
    if ($data != "") {
        if (Validate_Utf8::valid($data)) {
            // Convert the BibleWorks text to USFM.
            $usfm = Filter_Bibleworks::import($data, $tags);
            // Import the USFM.
            $datafile = tempnam(sys_get_temp_dir(), '');
            file_put_contents($datafile, $usfm);
            $success_message = Locale_Translate::_("Import has started. See Journal for progress.");
            $workingdirectory = dirname(__FILE__);
            Tasks_Logic::queue(Tasks_Logic::PHP, array("{$workingdirectory}/importcli.php", $datafile, $bible));
        } else {
            $error_message = Locale_Translate::_("Please supply valid Unicode UTF-8 text.");
        }
    } else {
        $success_message = Locale_Translate::_("Nothing was imported.");
    }
}
@($view->view->success_message = $success_message);
@($view->view->error_message = $error_message);
$view->render("import_bibleworks.php");
Assets_Page::footer();
Esempio n. 6
0
foreach ($ids as $id) {
    // Get and serialize the setting.
    $setting = null;
    switch ($id) {
        case Sync_Logic::WORKBENCH_SETTING:
            $urls = $database_config_user->getWorkbenchURLs();
            $urls = unserialize($urls);
            $widths = $database_config_user->getWorkbenchWidths();
            $widths = unserialize($widths);
            $heights = $database_config_user->getWorkbenchHeights();
            $heights = unserialize($heights);
            $setting = array();
            $setting['urls'] = $urls;
            $setting['widths'] = $widths;
            $setting['heights'] = $heights;
            break;
    }
    // POST the setting to the server.
    $post = array("u" => bin2hex($user), "p" => $database_users->getmd5($user), "l" => $database_users->getUserLevel($user), "i" => $id, "s" => serialize($setting));
    $response = Sync_Logic::post($post, $url);
    // Handle server's response.
    if ($response === false) {
        $database_logs->log("Failure sending setting to server", Filter_Roles::TRANSLATOR_LEVEL);
    } else {
        $database_config_user->removeUpdatedSetting($id);
    }
}
// All changed settings have now been sent to the server.
// The client will now synchronize its settings with the server's settings.
Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/syncsettings.php"));
Esempio n. 7
0
                            }
                        } else {
                            $database_logs->log("The server says: {$checksum_message}", Filter_Roles::TRANSLATOR_LEVEL);
                        }
                    } else {
                        // If the server sends no response,
                        // then the server decided that there is no need to send the updated chapter back to the client,
                        // as it considers the client as already up to date.
                    }
                }
            }
        }
    }
}
// Test the following:
// * Slight edits on client: Transfer to the server.
// * Edits on client and on server: Merge both versions.
// * Big edits on client: Transfer to server.
// * Empty data on server: The client version is stored on the server.
// * Client has no access: It displays message in the journal.
// * Merge conflict: Takes the server's copy, and the server emails the user.
// * Network latency: Test it by adding delays here and there.
// After all Bible actions have been sent to the server, and the chapters updated on the client,
// the client will now sync its Bibles with the server's Bibles.
// But if there was a communications error during sending a change to the server,
// then the client should not download changes from the server,
// because downloading them would overwrite the changes on the client.
// The client only downloads changes from the server after it has sent all local edits successfully.
if (!$communication_errors) {
    Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/syncbibles.php"));
}
Esempio n. 8
0
 public static function start()
 {
     Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/modifications.php"));
 }
Esempio n. 9
0
    // 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}");
        }
    }
    $directory = escapeshellarg($usfmDirectoryFull);
    $password = escapeshellarg($database_config_bible->getExportPassword($bible));
    $command = "cd {$directory}; zip -P {$password} bible.zip {$basefile}; rm {$basefile}";
    Tasks_Logic::save($command);
}
$database_logs->log($bible . ": " . Locale_Translate::_("Exported to USFM"), Filter_Roles::TRANSLATOR_LEVEL);
Esempio n. 10
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";
page_access_level(Filter_Roles::CONSULTANT_LEVEL);
$database_config_user = Database_Config_User::getInstance();
$database_books = Database_Books::getInstance();
$database_bibles = Database_Bibles::getInstance();
$database_jobs = Database_Jobs::getInstance();
$session_logic = Session_Logic::getInstance();
$bible = $database_config_user->getBible();
if (isset($_GET["generate"])) {
    $jobId = $database_jobs->getNewId();
    $database_jobs->setLevel($jobId, Filter_Roles::CONSULTANT_LEVEL);
    $username = $session_logic->currentUser();
    Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/printcli.php", $jobId, $username, $bible));
    Filter_Url::redirect("../jobs/index.php?id={$jobId}");
    die;
}
$header = new Assets_Header(Locale_Translate::_("Print"));
$header->jQueryUIOn("sortable");
$header->run();
@($add = $_GET['add']);
if (isset($add)) {
    if ($add == "") {
        $dialog_list = new Dialog_List2(Locale_Translate::_("Select a resource to add"));
        // The selectable resources are the available ones minus the already selected ones.
        $resources = Resource_Logic::getNames();
        $resources = array_diff($resources, $database_config_user->getPrintResources());
        foreach ($resources as $resource) {
            $parameter = "&add={$resource}";
Esempio n. 11
0
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once "../bootstrap/bootstrap.php";
page_access_level(Filter_Roles::MANAGER_LEVEL);
$view = new Assets_View(__FILE__);
@($bible = $_GET['bible']);
$view->view->bible = $bible;
$database_resources = Database_Resources::getInstance();
$database_usfmresources = Database_UsfmResources::getInstance();
$usfmResources = $database_usfmresources->getResources();
if (in_array($bible, $usfmResources)) {
    $view->view->error = Locale_Translate::_("A USFM Resource with this name already exists");
}
$externalResources = $database_resources->getNames();
if (in_array($bible, $externalResources)) {
    $view->view->error = Locale_Translate::_("An external resource with this name already exists");
}
@($convert = $_GET['convert']);
if (isset($convert)) {
    if (Access_Bible::write($bible)) {
        Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/convert2resource.php", $bible));
        Filter_Url::redirect("../journal/index.php");
        die;
    } else {
        Assets_Page::error(Locale_Translate::_("Insufficient privileges to complete operation."));
    }
}
$header = new Assets_Header(Locale_Translate::_("Convert"));
$header->run();
$view->render("bible2resource.php");
Assets_Page::footer();
Esempio n. 12
0
// Email statistics to the users.
if (!$client) {
    if ($hour == 3 && $minute == 0) {
        Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/statistics.php"));
    }
}
// A flag is set on setup to (re-)create a number of databases.
$create_databases_flag = "../config/databases";
if (file_exists($create_databases_flag)) {
    unlink($create_databases_flag);
    // Strong's numbers and English glosses for Bible.
    $directory = dirname(__DIR__) . "/kjv";
    Tasks_Logic::queue(Tasks_Logic::PHP, array("{$directory}/import.php"));
    // Hebrew Bible.
    $directory = dirname(__DIR__) . "/morphhb";
    Tasks_Logic::queue(Tasks_Logic::PHP, array("{$directory}/import.php"));
    // Greek Bible.
    $directory = dirname(__DIR__) . "/sblgnt";
    Tasks_Logic::queue(Tasks_Logic::PHP, array("{$directory}/import.php"));
}
// Check open installation.
if ($minute == 10) {
    include "config/open.php";
    if ($open_installation) {
        $directory = dirname(__DIR__) . "/demo";
        Tasks_Logic::queue(Tasks_Logic::PHP, array("{$directory}/index.php"));
    }
}
// Kick the watchdog for the minutely tasks.
$watchdog = dirname(__DIR__) . "/config/watchdog";
file_put_contents($watchdog, "");
Esempio n. 13
0
 public static function scheduleESword($bible)
 {
     Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/esword.php", $bible));
 }
Esempio n. 14
0
            $status = $response['st'];
            $severity = $response['se'];
            $summary = $response['sum'];
            $contents = $response['c'];
            $database_notes->setAssignees($note, $assignees);
            $database_notes->setSubscribers($note, $subscribers);
            $database_notes->setBible($note, $bible);
            $database_notes->setPassages($note, $passages);
            $database_notes->setStatus($note, $status);
            $database_notes->setRawSeverity($note, $severity);
            $database_notes->setSummary($note, $summary);
            $database_notes->setContents($note, $contents);
            // Set modified field last as it is affected by the previous store actions.
            $database_notes->setModified($note, $modified);
            $database_logs->log("Updated note received from server" . ": " . $summary, Filter_Roles::MANAGER_LEVEL);
            // Update search and checksum.
            $database_notes->updateSearchFields($note);
            $database_notes->updateChecksum($note);
        } else {
            $database_logs->log($response, Filter_Roles::TRANSLATOR_LEVEL);
        }
        // Delete this note action because it has been dealt with.
        $database_noteactions->delete($rowid);
    }
}
// After all note actions have been sent to the server, and the notes updated on the client,
// the client will now sync its notes with the server's notes.
$lowId = Notes_Logic::lowNoteIdentifier;
$highId = Notes_Logic::highNoteIdentifier;
Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/syncnotes.php", "{$lowId}", "{$highId}"));
Esempio n. 15
0
Copyright (©) 2003-2014 Teus Benschop.

This program is free software; you can redistribute it and/or modify
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";
page_access_level(Filter_Roles::MANAGER_LEVEL);
Assets_Page::header(Locale_Translate::_("Import"));
set_time_limit(0);
$folder = $_GET['folder'];
if (file_exists($folder)) {
    $workingdirectory = dirname(__FILE__);
    $command = "php {$workingdirectory}/importcli.php {$folder}";
    Tasks_Logic::queue(Tasks_Logic::PHP, array("{$workingdirectory}/importcli.php", $folder));
    $view = new Assets_View(__FILE__);
    $view->render("import4.php");
} else {
    Assets_Page::error(Locale_Translate::_("Could not find the folder with the consultation notes"));
}
Assets_Page::footer();
Esempio n. 16
0
 public static function syncqueued()
 {
     if (Tasks_Logic::queued("sendnotes.php")) {
         return true;
     }
     if (Tasks_Logic::queued("sendbibles.php")) {
         return true;
     }
     if (Tasks_Logic::queued("sendsettings.php")) {
         return true;
     }
     if (Tasks_Logic::queued("syncnotes.php")) {
         return true;
     }
     if (Tasks_Logic::queued("syncbibles.php")) {
         return true;
     }
     if (Tasks_Logic::queued("syncsettings.php")) {
         return true;
     }
     if (Tasks_Logic::queued("externalresources.php")) {
         return true;
     }
     if (Tasks_Logic::queued("usfmresources.php")) {
         return true;
     }
     return false;
 }
Esempio n. 17
0
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";
page_access_level(Filter_Roles::CONSULTANT_LEVEL);
@($bible = $_GET["bible"]);
@($compare = $_GET["compare"]);
if (isset($compare)) {
    $database_jobs = Database_Jobs::getInstance();
    $jobId = $database_jobs->getNewId();
    $database_jobs->setLevel($jobId, Filter_Roles::CONSULTANT_LEVEL);
    Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/comparecli.php", $bible, $compare, "{$jobId}"));
    Filter_Url::redirect("../jobs/index.php?id={$jobId}");
    die;
}
$header = new Assets_Header(Locale_Translate::_("Compare"));
$header->run();
// Names of the Bibles and the USFM Resources.
$names = array();
$database_bibles = Database_Bibles::getInstance();
$bibles = $database_bibles->getBibles();
$names = array_merge($names, $bibles);
$database_usfmresources = Database_UsfmResources::getInstance();
$usfm_resources = $database_usfmresources->getResources();
$names = array_merge($names, $usfm_resources);
$names = array_diff($names, array($bible));
$view = new Assets_View(__FILE__);
Esempio n. 18
0
 public static function start($bible)
 {
     Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/checkcli.php", $bible));
 }
Esempio n. 19
0
        }
        $dialog_list->run();
    } else {
        $database_config_user->setBible($bible);
    }
}
$bible = Access_Bible::clamp($database_config_user->getBible());
if (isset($_GET['run'])) {
    if ($bible == "") {
        $error = Locale_Translate::_("No Bible given");
    } else {
        if ($firstset == "") {
            $error = Locale_Translate::_("No first set of characters given");
        } else {
            if ($secondset == "") {
                $error = Locale_Translate::_("No second set of characters given");
            } else {
                $workingdirectory = __DIR__;
                Tasks_Logic::queue(Tasks_Logic::PHP, array("{$workingdirectory}/hyphenate.php", $bible, $session_logic->currentUser()));
                $success = Locale_Translate::_("The Bible is being hyphenated. See the Journal for details.");
            }
        }
    }
}
$view->view->firstset = $firstset;
$view->view->secondset = $secondset;
$view->view->bible = $bible;
$view->view->success = $success;
$view->view->error = $error;
$view->render("hyphenation.php");
Assets_Page::footer();
Esempio n. 20
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";
page_access_level(Filter_Roles::MANAGER_LEVEL);
$view = new Assets_View(__FILE__);
$database_resources = Database_Resources::getInstance();
$database_offlineresources = Database_OfflineResources::getInstance();
$database_versifications = Database_Versifications::getInstance();
@($name = $_GET['name']);
$view->view->name = $name;
if (isset($_GET['download'])) {
    $versification = "English";
    $books = $database_versifications->getBooks($versification);
    foreach ($books as $book) {
        // Schedule the task with low priority so it does not get in the way of regular tasks.
        Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/downloadcli.php", $name, $book));
    }
    Filter_Url::redirect("../journal/index.php");
    die;
}
if (isset($_GET['clear'])) {
    $database_offlineresources->delete($name);
}
$count = $database_offlineresources->count($name);
$view->view->count = $count;
$header = new Assets_Header(Locale_Translate::_("Download resource"));
$header->run();
$view->render("download.php");
Assets_Page::footer();
Esempio n. 21
0
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";
page_access_level(Filter_Roles::MANAGER_LEVEL);
@($refresh = $_GET['refresh']);
if ($refresh == "bibles") {
    $directory = dirname(__DIR__) . "/search";
    Tasks_Logic::queue(Tasks_Logic::PHP, array("{$directory}/rebibles.php"));
    Filter_Url::redirect("../journal/index.php");
    die;
}
if ($refresh == "notes") {
    $directory = dirname(__DIR__) . "/search";
    Tasks_Logic::queue(Tasks_Logic::PHP, array("{$directory}/renotes.php"));
    Filter_Url::redirect("../journal/index.php");
    die;
}
Assets_Page::header(Locale_Translate::_("Indexing"));
$view = new Assets_View(__FILE__);
$view->render("indexing.php");
Assets_Page::footer();