示例#1
0
 public function testPassagesDisplayInline()
 {
     $this->assertEquals("Genesis 10:2", Filter_Books::passagesDisplayInline(array(array(1, 10, 2))));
     $this->assertEquals("", Filter_Books::passagesDisplayInline(array()));
     $this->assertEquals("Genesis 10:2 | Exodus 777:777", Filter_Books::passagesDisplayInline(array(array(1, 10, 2), array(2, 777, 777))));
     $this->assertEquals("Unknown 10:2 | Exodus 777:777", Filter_Books::passagesDisplayInline(array(array(-1, 10, 2), array(2, 777, 777))));
 }
示例#2
0
 public function consultationNote($id)
 {
     $database_notes = Database_Notes::getInstance();
     $database_logs = Database_Logs::getInstance();
     $passage = $database_notes->getPassages($id);
     $passageText = Filter_Books::passagesDisplayInline($passage);
     $summary = $database_notes->getSummary($id);
     $contents = $database_notes->getContents($id);
     $contents = Filter_Html::html2text($contents);
     $session_logic = Session_Logic::getInstance();
     $username = $session_logic->currentUser();
     $database_logs->log("{$username} deleted / marked for deletion consultation note {$passageText} | {$summary} | {$contents}");
 }
示例#3
0
 /**
  * This handles email to users.
  * $identifier: the note that is being handled.
  * $label: prefix to the subject line of the email.
  * $users: array of users to be mailed.
  * $postpone: whether to postpone sending the email till the evening.
  */
 private function emailUsers($identifier, $label, $users, $postpone)
 {
     // Databases.
     $database_notes = Database_Notes::getInstance();
     $database_config_user = Database_Config_User::getInstance();
     $database_users = Database_Users::getInstance();
     $database_mail = Database_Mail::getInstance();
     $database_config_general = Database_Config_General::getInstance();
     // Send mail to all users.
     $summary = $database_notes->getSummary($identifier);
     $passages = Filter_Books::passagesDisplayInline($database_notes->getPassages($identifier));
     $contents = $database_notes->getContents($identifier);
     // Include a link to the note on the site.
     $contents .= "<br>\n";
     $siteUrl = $database_config_general->getSiteURL();
     $link = "{$siteUrl}/notes/note.php?id={$identifier}";
     $contents .= "<p><a href=\"{$link}\">View or respond online</a></p>\n";
     $mailto = "mailto:" . $database_config_general->getSiteMailAddress() . "?subject=(CNID{$identifier})";
     $contents .= "<p><a href=\"{$mailto}\">Respond by email</a></p>\n";
     // Deal with possible postponing email.
     $timestamp = time();
     if ($postpone) {
         $postpone = strtotime("today +21 hours");
         if ($postpone > $timestamp) {
             $timestamp = $postpone;
         }
     }
     // Send (but not in client mode).
     foreach ($users as $user) {
         if (!Filter_Client::enabled()) {
             $database_mail->send($user, "{$label} | {$passages} | {$summary} | (CNID{$identifier})", $contents, $timestamp);
         }
     }
 }
示例#4
0
    $start = -1;
    $end = 0;
}
$view->view->start = $start + 1;
$view->view->end = $end;
// The various bits of the history from the database.
$passageTexts = array();
$authors = array();
$dates = array();
$bibles = array();
$oldTexts = array();
$modifications = array();
$newTexts = array();
$data = $database_history->get($author_filter, $myBibles, $book_filter, $chapter_filter, $verse_filter, $start);
foreach ($data as $entry) {
    $passageText = Filter_Books::passagesDisplayInline(array(array($entry['book'], $entry['chapter'], $entry['verse'])));
    $passageText = Filter_Html::sanitize($passageText);
    $passageTexts[] = $passageText;
    $authors[] = Filter_Html::sanitize($entry['author']);
    $dates[] = $timestamp = date('j F Y g:i:s a', $entry['timestamp']);
    $bibles[] = Filter_Html::sanitize($entry['bible']);
    $oldTexts[] = $entry['oldtext'];
    $modifications[] = $entry['modification'];
    $newTexts[] = $entry['newtext'];
}
$view->view->passageTexts = $passageTexts;
$view->view->authors = $authors;
$view->view->dates = $dates;
$view->view->bibles = $bibles;
$view->view->oldTexts = $oldTexts;
$view->view->modifications = $modifications;
示例#5
0
        if ($check_missing_punctuation_end_verse) {
            Checks_Verses::missingPunctuationAtEnd($bible, $book, $chapter, $verses_text, $center_marks, $end_marks);
        }
        if ($check_patterns) {
            Checks_Verses::patterns($bible, $book, $chapter, $verses_text, $checking_patterns);
        }
    }
}
// Identifier for this $bible.
$bibleID = $database_bibles->getID($bible);
// Create an email with the checking results for this $bible.
$emailBody = array();
$hits = $database_check->getHits();
foreach ($hits as $hit) {
    if ($hit['bible'] == $bibleID) {
        $passage = Filter_Books::passagesDisplayInline(array(array($hit['book'], $hit['chapter'], $hit['verse'])));
        $data = Filter_Html::sanitize($hit['data']);
        $result = "<p>{$passage} {$data}</p>";
        $emailBody[] = $result;
    }
}
// Send email to users with write access to the Bible and a subscription to the notification.
if (count($emailBody) > 0) {
    $subject = Locale_Translate::_("Bible Checks") . " " . $bible;
    $emailBody = implode("\n", $emailBody);
    $users = $database_users->getUsers();
    foreach ($users as $user) {
        if ($database_config_user->getUserBibleChecksNotification($user)) {
            if (Access_Bible::write($bible, $user)) {
                if (!Filter_Client::enabled()) {
                    $database_mail->send($user, $subject, $emailBody);
示例#6
0
$database_bibles = Database_Bibles::getInstance();
$database_search = Database_Search::getInstance();
$siteUrl = $database_config_general->getSiteURL();
// Search the notes.
$bibles = Access_Bible::bibles();
$identifiers = $database_notes->searchNotes($queryString, $bibles);
$noteCount = count($identifiers);
$view->view->noteCount = $noteCount;
// Assemble the search results.
$noteTitles = array();
$noteUrls = array();
$noteExcerpts = array();
foreach ($identifiers as $identifier) {
    // The title.
    $summary = $database_notes->getSummary($identifier);
    $verses = Filter_Books::passagesDisplayInline($database_notes->getPassages($identifier));
    $title = "{$summary} | {$verses}";
    $title = Filter_Html::sanitize($title);
    $noteTitles[] = $title;
    // The url.
    $url = "{$siteUrl}/notes/note.php?id={$identifier}";
    $noteUrls[] = $url;
    // The excerpt.
    $text = $database_notes->getSearchField($identifier);
    $text = explode("\n", $text);
    $excerpt = "";
    // Go through each line of text separately.
    foreach ($text as $line) {
        $markedLine = Filter_Markup::words($queryWords, $line);
        // If the line is marked up, add it to the excerpts.
        if ($markedLine != $line) {
示例#7
0
    $database_check->release($release);
    $view->view->success = Locale_Translate::_("The check result will no longer be suppressed.");
}
// Get the Bibles the user has write-access to.
$bibleIDs = array();
$bibles = $database_bibles->getBibles();
foreach ($bibles as $bible) {
    if (Access_Bible::write($bible)) {
        $id = $database_bibles->getID($bible);
        $bibleIDs[] = $id;
    }
}
$ids = array();
$data = array();
$suppressions = $database_check->getSuppressions();
foreach ($suppressions as $suppression) {
    $bibleID = $suppression['bible'];
    // Only display entries for Bibles the user has write access to.
    if (in_array($bibleID, $bibleIDs)) {
        $ids[] = $suppression['rowid'];
        $bible = Filter_Html::sanitize($database_bibles->getName($bibleID));
        $passage = Filter_Books::passagesDisplayInline(array(array($suppression['book'], $suppression['chapter'], $suppression['verse'])));
        $result = Filter_Html::sanitize($suppression['data']);
        $result = "{$bible} {$passage} {$result}";
        $data[] = $result;
    }
}
$view->view->ids = $ids;
$view->view->data = $data;
$view->render("suppress.php");
Assets_Page::footer();
示例#8
0
$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);
    $summaries[] = $summary . " | " . $verses;
    $verse_text = "";
    if ($passage_inclusion_selector) {
        $passages = $database_notes->getPassages($identifier);
        foreach ($passages as $passage) {
            $usfm = $database_bibles->getChapter($bible, $passage[0], $passage[1]);
            $text = Filter_Usfm::getVerseText($usfm, $passage[2]);
            $verse_text .= $text;
            $verse_text .= "\n";
        }
    }
    $verse_texts[] = nl2br($verse_text);
    $content = "";
    if ($text_inclusion_selector) {
        $content = $database_notes->getContents($identifier);