Esempio n. 1
0
 private function send_prep($prep)
 {
     global $Conf;
     $cbkey = "c" . join("_", $prep->contacts) . "p" . $prep->paperId;
     if ($this->sending && !defval($_REQUEST, $cbkey)) {
         return;
     }
     set_time_limit(30);
     $this->echo_prologue();
     self::fix_body($prep);
     ++$this->mcount;
     if ($this->sending) {
         Mailer::send_preparation($prep);
         foreach ($prep->contacts as $cid) {
             $Conf->log("Account was sent mail" . $this->mailid_text, $cid, $prep->paperId);
         }
     }
     // hide passwords from non-chair users
     $show_prep = $prep;
     if (get($prep, "sensitive")) {
         $show_prep = $prep->sensitive;
         $show_prep->to = $prep->to;
         self::fix_body($show_prep);
     }
     echo '<div class="mail"><table>';
     $nprintrows = 0;
     foreach (array("To", "cc", "bcc", "reply-to", "Subject") as $k) {
         if ($k == "To") {
             $vh = array();
             foreach ($show_prep->to as $to) {
                 $vh[] = htmlspecialchars(MimeText::decode_header($to));
             }
             $vh = '<div style="max-width:60em"><span class="nw">' . join(',</span> <span class="nw">', $vh) . '</span></div>';
         } else {
             if ($k == "Subject") {
                 $vh = htmlspecialchars(MimeText::decode_header($show_prep->subject));
             } else {
                 if ($line = get($show_prep->headers, $k)) {
                     $k = substr($line, 0, strlen($k));
                     $vh = htmlspecialchars(MimeText::decode_header(substr($line, strlen($k) + 2)));
                 } else {
                     continue;
                 }
             }
         }
         echo " <tr>";
         if (++$nprintrows > 1) {
             echo "<td class='mhpad'></td>";
         } else {
             if ($this->sending) {
                 echo "<td class='mhx'></td>";
             } else {
                 ++$this->cbcount;
                 echo '<td class="mhcb"><input type="checkbox" class="cb" name="', $cbkey, '" value="1" checked="checked" data-range-type="mhcb" id="psel', $this->cbcount, '" onclick="rangeclick(event,this)" /></td>';
             }
         }
         echo '<td class="mhnp nw">', $k, ":</td>", '<td class="mhdp">', $vh, "</td></tr>\n";
     }
     echo " <tr><td></td><td></td><td class='mhb'><pre class='email'>", Ht::link_urls(htmlspecialchars($show_prep->body)), "</pre></td></tr>\n", "<tr><td class='mhpad'></td><td></td><td class='mhpad'></td></tr>", "</table></div>\n";
 }
 private function unparse_html($row, PaperOptionValue $ov, PaperList $pl = null)
 {
     if ($ov->data === null || $ov->data === "") {
         return "";
     }
     if ($format = $row->format_of($ov->data)) {
         if ($pl) {
             $pl->need_render = true;
         }
         return '<div class="need-format" data-format="' . $format . ($pl ? '.plx' : '.abs') . '">' . htmlspecialchars($ov->data) . '</div>';
     } else {
         return '<div class="format0">' . Ht::link_urls(htmlspecialchars($ov->data)) . '</div>';
     }
 }
 public function content($pl, $row, $rowidx)
 {
     $t = Text::highlight($row->abstract, get($pl->search->matchPreg, "abstract"), $highlight_count);
     if (!$highlight_count && ($format = $row->format_of($row->abstract))) {
         $pl->need_render = true;
         $t = '<div class="need-format" data-format="' . $format . '.abs.plx">' . $t . '</div>';
     } else {
         $t = Ht::link_urls(Text::single_line_paragraphs($t));
         $t = preg_replace('/(?:\\r\\n?){2,}|\\n{2,}/', " ¶ ", $t);
     }
     return $t;
 }