Beispiel #1
0
 public static function getNames()
 {
     $names = array();
     // Take Bibles the user has read access to.
     $bibles = Access_Bible::bibles();
     $names = array_merge($names, $bibles);
     // Take USFM Resources.
     $database_usfmresources = Database_UsfmResources::getInstance();
     $usfm_resources = $database_usfmresources->getResources();
     $names = array_merge($names, $usfm_resources);
     // Take external Resources.
     $database_resources = Database_Resources::getInstance();
     $resources = $database_resources->getNames();
     $names = array_merge($names, $resources);
     $names = array_unique($names);
     sort($names);
     return $names;
 }
Beispiel #2
0
        http_response_code(401);
        die;
    }
    $bibles = Access_Bible::bibles($username);
    $server_checksum = Checksum_Logic::getBibles($bibles);
    echo $server_checksum;
} else {
    if ($action == "bibles") {
        // The server reads the credentials from the client's user,
        // and responds with a list of Bibles this user has access to.
        if ($password != $database_users->getmd5($username)) {
            // Unauthorized.
            http_response_code(401);
            die;
        }
        $bibles = Access_Bible::bibles($username);
        $bibles = implode("\n", $bibles);
        $checksum = Checksum_Logic::get($bibles);
        echo "{$checksum}\n{$bibles}";
    } else {
        if ($action == "bible") {
            // The server responds with the checksum for the whole Bible.
            $server_checksum = Checksum_Logic::getBible($bible);
            echo $server_checksum;
        } else {
            if ($action == "books") {
                // The server responds with a checksum and then the list of books in the Bible.
                $server_books = $database_bibles->getBooks($bible);
                $server_books = implode("\n", $server_books);
                $checksum = Checksum_Logic::get($server_books);
                echo "{$checksum}\n{$server_books}";
Beispiel #3
0
    $verse = 1;
    if (!isset($switchverse)) {
        $switchverse = 1;
    }
    $ipc_focus->set($switchbook, $switchchapter, $switchverse);
    Navigation_Passage::recordHistory($switchbook, $switchchapter, $switchverse);
}
$header = new Assets_Header(Locale_Translate::_("Edit"));
$header->setNavigator();
$header->setEditorStylesheet();
$header->run();
@($changebible = $_GET['changebible']);
if (isset($changebible)) {
    if ($changebible == "") {
        $dialog_list = new Dialog_List2(Locale_Translate::_("Select which Bible to open in the editor"));
        $bibles = Access_Bible::bibles();
        foreach ($bibles as $bible) {
            $dialog_list->add_row($bible, "&changebible={$bible}");
        }
        $dialog_list->run();
    } else {
        $database_config_user->setBible($changebible);
        // Going to another Bible, ensure that the focused book exists there.
        $book = $ipc_focus->getBook();
        $books = $database_bibles->getBooks($changebible);
        if (!in_array($book, $books)) {
            if (count($books) > 0) {
                $book = $books[0];
            } else {
                $book = 0;
            }
Beispiel #4
0
    $checksum = $database_notes->getMultipleChecksum($identifiers);
    $response['t'] = count($identifiers);
    $response['c'] = $checksum;
    die_if_databases_unhealthy_or_busy();
    echo serialize($response);
} else {
    if ($action == "identifiers") {
        $user = Filter_Hex::hex2bin($_POST['u']);
        if (!$database_users->usernameExists($user)) {
            die;
        }
        $md5 = $_POST['p'];
        if ($md5 != $database_users->getmd5($user)) {
            die;
        }
        $bibles = Access_Bible::bibles($user);
        $lowId = $_POST['l'];
        $highId = $_POST['h'];
        $identifiers = $database_notes->getNotesInRangeForBibles($lowId, $highId, $bibles);
        $checksums = array();
        foreach ($identifiers as $identifier) {
            $checksum = $database_notes->getChecksum($identifier);
            $checksums[] = $checksum;
        }
        $response['i'] = $identifiers;
        $response['c'] = $checksums;
        die_if_databases_unhealthy_or_busy();
        echo serialize($response);
    } else {
        if ($action == "fetch") {
            $identifier = $_POST['i'];
Beispiel #5
0
$verse = $ipc_focus->getVerse();
$passage_selector = $database_config_user->getConsultationNotesPassageSelector();
$edit_selector = $database_config_user->getConsultationNotesEditSelector();
$non_edit_selector = $database_config_user->getConsultationNotesNonEditSelector();
$status_selector = $database_config_user->getConsultationNotesStatusSelector();
$bible_selector = $database_config_user->getConsultationNotesBibleSelector();
$assignment_selector = $database_config_user->getConsultationNotesAssignmentSelector();
$subscription_selector = $database_config_user->getConsultationNotesSubscriptionSelector();
$severity_selector = $database_config_user->getConsultationNotesSeveritySelector();
$text_selector = $database_config_user->getConsultationNotesTextSelector();
$search_text = $database_config_user->getConsultationNotesSearchText();
$passage_inclusion_selector = $database_config_user->getConsultationNotesPassageInclusionSelector();
$text_inclusion_selector = $database_config_user->getConsultationNotesTextInclusionSelector();
$view = new Assets_View(__FILE__);
// The Bibles the current user has access to.
$bibles = Access_Bible::bibles($session_logic->currentUser());
// The admin disables notes selection on Bibles, so the admin sees all notes, even notes referring to non-existing Bibles.
if ($session_logic->currentLevel() == Filter_Roles::ADMIN_LEVEL) {
    $bibles = NULL;
}
$identifiers = $database_notes->selectNotes($bibles, $book, $chapter, $verse, $passage_selector, $edit_selector, $non_edit_selector, $status_selector, $bible_selector, $assignment_selector, $subscription_selector, $severity_selector, $text_selector, $search_text, NULL);
$view->view->identifiers = $identifiers;
$count = count($identifiers);
$view->view->count = $count;
$summaries = array();
$verse_texts = array();
$contents = array();
foreach ($identifiers as $identifier) {
    $summary = $database_notes->getSummary($identifier);
    $passages = $database_notes->getPassages($identifier);
    $verses = Filter_Books::passagesDisplayInline($passages);