$result = htmlentities($_text); if (preg_match("/^([^ ]+)@([^ ]+)$/",$_text,$regs)) $result="".htmlentities($regs[1]. "@".$regs[2]).""; if (preg_match("/^([^ ]+)@([^ ]+) \((.*)\)$/",$_text,$regs)) $result="".htmlentities($regs[3]).""; if (preg_match("/^\"?([^<>\"]+)\"? +<(.+)@(.+)>$/",$_text,$regs)) $result="".htmlentities($regs[1]).""; return preg_replace("/\\\(\(|\))/","\\1",$result); case "subject": if ($_isref) { return ''.htmlentities($_text).''; } else { if ($_isread) { return "" .htmlentities($_text).""; }else { return "" .htmlentities($_text).""; } } default: return htmlentities($_text); } } /** produces HTML ouput for header section in post.php * @param $_header STRING name of the header * @param $_text STRING value of the header * @param $_spool OBJECT spool object for building references * @return STRING HTML output */ function formatDisplayHeader($_header,$_text,$_spool) { global $locale; switch ($_header) { case "date": return locale_date($_text); case "followup": case "newsgroups": $res = ""; $groups = preg_split("/(\t| )*,(\t| )*/",$_text); foreach ($groups as $g) { $res.=''.$g.', '; } return substr($res,0, -2); case "from": # From: mark@cbosgd.ATT.COM # From: mark@cbosgd.ATT.COM (Mark Horton) # From: Mark Horton # From: Anonymous $result = htmlentities($_text); if (preg_match("/^([^ ]+)@([^ ]+)$/",$_text,$regs)) $result="".htmlentities($regs[1]) ."@{$regs[2]}"; if (preg_match("/^([^ ]+)@([^ ]+) \((.*)\)$/",$_text,$regs)) $result="".htmlentities($regs[3]) .""; if (preg_match("/^\"?([^<>\"]+)\"? +<(.+)@(.+)>$/",$_text,$regs)) $result="".htmlentities($regs[1]) .""; return preg_replace("/\\\(\(|\))/","\\1",$result); case "references": $rsl = ""; $ndx = 1; $text=str_replace("><","> <",$_text); $text=preg_split("/( |\t)/",strtr($text,$_spool->ids)); $parents=preg_grep("/^\d+$/",$text); $p=array_pop($parents); while ($p) { $rsl .= "group}" ."&id=$p\">$ndx "; $_spool->overview[$p]->desc++; $p = $_spool->overview[$p]->parent; $ndx++; } return $rsl; case "xface": return 'x-face'; default: return htmlentities($_text); } } /** produces HTML output for message body * @param $_text STRING message body * @return STRING HTML output */ function formatbody($_text) { global $news; $res ="\n\n"; $res .= htmlentities(wrap($_text,"",$news['wrap']))."\n"; $res = preg_replace("/(<|>|")/"," \\1 ",$res); $res = preg_replace('/(["\[])?((https?|ftp|news):\/\/[a-z@0-9.~%$£µ&i#\-+=_\/\?]*)(["\]])?/i', "\\1\\2\\4", $res); $res = preg_replace("/ (<|>|") /","\\1",$res); return $res."\n"; } /** contextual links * @return STRING HTML output */ function displayshortcuts() { global $news,$locale,$first,$spool,$group,$post,$id; $sname = $_SERVER['SCRIPT_NAME']; $array = explode('/',$sname); $sname = array_pop($array); echo '
'; echo '['.$locale['format']['disconnection'] .'] '; switch ($sname) { case 'thread.php' : echo '['.$locale['format']['grouplist'] .'] '; echo "[" .$locale['format']['newpost']."] "; if (sizeof($spool->overview)>$news['max']) { for ($ndx=1; $ndx<=sizeof($spool->overview); $ndx += $news['max']) { if ($first==$ndx) { echo "[$ndx-".min($ndx+$news['max']-1,sizeof($spool->overview))."] "; } else { echo "[$ndx-".min($ndx+$news['max']-1,sizeof($spool->overview)) ."] "; } } } break; case 'article.php' : echo '['.$locale['format']['grouplist'] .'] '; echo "[" .$locale['format']['group_b'].$group .$locale['format']['group_a']."] "; echo "[" .$locale['format']['followup']."] "; if (checkcancel($post->headers)) { echo "[" .$locale['format']['cancel']."] "; } break; case 'post.php' : echo '['.$locale['format']['grouplist'] .'] '; echo "[" .$locale['format']['group_b'].$group .$locale['format']['group_a']."] "; break; } echo '
'; } ?>