예제 #1
0
        }
        echo "{$key}\n";
    }
    die;
}
@($id = $_GET['id']);
if (isset($id)) {
    // Get the and passage for this identifier.
    $passage = Filter_Books::integer2passage($id);
    $book = $passage[0];
    $chapter = $passage[1];
    $verse = $passage[2];
    // Get the plain text.
    $text = $database_search->getBibleVerseText($bible, $book, $chapter, $verse);
    // Format it.
    $link = Filter_Books::linkForOpeningEditorAt($book, $chapter, $verse);
    $output = "<div>{$link} {$text}</div>";
    // Output to browser.
    echo $output;
    // Done.
    die;
}
$header = new Assets_Header(Locale_Translate::_("Search"));
$header->run();
$view = new Assets_View(__FILE__);
$view->view->bible = $bible;
$script = <<<EOD
var searchBible = "{$bible}";
EOD;
$view->view->script = $script;
$view->render("strongs.php");
예제 #2
0
} else {
    if ($filter == "team") {
        $ids = $database_modifications->getNotificationTeamIdentifiers($username, "♺", true);
        $view->view->filter = 2;
    } else {
        $ids = $database_modifications->getNotificationIdentifiers($username, true);
        $view->view->filter = 0;
    }
}
$view->view->ids = $ids;
$links = array();
$categories = array();
$modifications = array();
foreach ($ids as $id) {
    $passage = $database_modifications->getNotificationPassage($id);
    $link = Filter_Books::linkForOpeningEditorAt($passage['book'], $passage['chapter'], $passage['verse']);
    $links[] = $link;
    $category = $database_modifications->getNotificationCategory($id);
    $category = Filter_Html::sanitize($category);
    $categories[] = $category;
    $modification = $database_modifications->getNotificationModification($id);
    $modifications[] = $modification;
}
$view->view->links = $links;
$view->view->categories = $categories;
$view->view->modifications = $modifications;
$loading = '"' . Locale_Translate::_("Loading ...") . '"';
$script = <<<EOD
var loading = {$loading};
EOD;
$view->view->script = $script;
예제 #3
0
파일: logic.php 프로젝트: alerque/bibledit
 public function response()
 {
     // The databases to access.
     $database_config_user = Database_Config_User::getInstance();
     $database_volatile = Database_Volatile::getInstance();
     $database_bibles = Database_Bibles::getInstance();
     // The resources to display in the Consistency tool.
     $resources = array();
     $resources[] = Access_Bible::clamp($database_config_user->getBible());
     $resources = array_merge($resources, $database_config_user->getConsistencyResources());
     // The passages entered in the Consistency tool.
     $passages = $database_volatile->getValue($this->id, "passages");
     $passages = trim($passages);
     $passages = Filter_String::string2array($passages);
     // The translations from the Consistency tool.
     $translations = $database_volatile->getValue($this->id, "translations");
     $translations = trim($translations);
     $translations = Filter_String::string2array($translations);
     // Contains the response to display.
     $response = array();
     // Go through the passages interpreting them.
     $previousPassage = array(1, 1, 1);
     foreach ($passages as $line) {
         $line = trim($line);
         if ($line == "") {
             continue;
         }
         $range_sequence = Filter_Books::handleSequencesRanges($line);
         foreach ($range_sequence as $line) {
             $passage = Filter_Books::interpretPassage($previousPassage, $line);
             if ($passage[0] != 0) {
                 $book = $passage[0];
                 $chapter = $passage[1];
                 $verse = $passage[2];
                 $line = Filter_Books::linkForOpeningEditorAt($book, $chapter, $verse);
                 $line .= " ";
                 // Check whether the chapter identifier has changed for this reference.
                 // If so, set a flag so the data can be re-assembled for this verse.
                 // If there was no change, then the data can be fetched from the volatile database.
                 $redoPassage = false;
                 $passageKey = "{$book}.{$chapter}.{$verse}";
                 $currentChapterId = $database_bibles->getChapterId($resources[0], $book, $chapter);
                 $storedChapterId = $database_volatile->getValue($this->id, "{$passageKey}.id");
                 if ($currentChapterId != $storedChapterId) {
                     $database_volatile->setValue($this->id, "{$passageKey}.id", $currentChapterId);
                     $redoPassage = true;
                 }
                 // Go through each resource.
                 foreach ($resources as $resource) {
                     // Produce new verse text if the passage is to be redone, or else fetch the existing text.
                     if ($redoPassage) {
                         $text = $this->verseText($resource, $book, $chapter, $verse);
                         if ($translations != "") {
                             $text = Filter_Markup::words($translations, $text);
                         }
                         $database_volatile->setValue($this->id, "{$passageKey}.{$resource}", $text);
                     } else {
                         $text = $database_volatile->getValue($this->id, "{$passageKey}.{$resource}");
                     }
                     // Formatting.
                     if (count($resources) > 1) {
                         $line .= "<br>";
                     }
                     $line .= $text;
                 }
                 $response[] = $line;
                 $previousPassage = $passage;
             } else {
                 $response[] = '<span class="error">' . Locale_Translate::_("Unknown passage") . " " . $line . '</span>';
             }
         }
     }
     $output = "";
     foreach ($response as $line) {
         $output .= "<div>{$line}</div>\n";
     }
     return $output;
 }
예제 #4
0
파일: search.php 프로젝트: alerque/bibledit
// Search the Bible text.
$hits = $database_search->searchText($queryString, $bibles);
$textCount = count($hits);
$view->view->textCount = $textCount;
// Assemble the search results.
$textLinks = array();
$textExcerpts = array();
foreach ($hits as $hit) {
    // Get the details of this search hit.
    $details = $database_search->getBiblePassage($hit);
    $bible = $details["bible"];
    $book = $details["book"];
    $chapter = $details["chapter"];
    $verse = $details["verse"];
    // The title plus link.
    $link = "{$bible}" . " | " . Filter_Books::linkForOpeningEditorAt($book, $chapter, $verse);
    $textLinks[] = $link;
    // The excerpt.
    $text = $database_search->getBibleVerseText($bible, $book, $chapter, $verse);
    $text = explode("\n", $text);
    $excerpt = "";
    // Go through each line of text separately.
    foreach ($text as $line) {
        $markedLine = Filter_Markup::words($queryWords, $line);
        if ($markedLine != $line) {
            // Store this bit of the excerpt.
            $excerpt .= "<p style=\"margin-top: 0em\">{$markedLine}</p>\n";
        }
    }
    $textExcerpts[] = $excerpt;
}