X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fmisc.inc.php;h=bdac4fac3913bf0a605954c5674d8716e12d2f07;hb=abb21748aff438a931f7064bd8ef4d45490d7a37;hp=4171988db684abd1e64cac1976c7f1f47efcb01d;hpb=b9ea5b300f115e6f9d592eb4f794273ec983f1f3;p=banana.git diff --git a/include/misc.inc.php b/include/misc.inc.php index 4171988..bdac4fa 100644 --- a/include/misc.inc.php +++ b/include/misc.inc.php @@ -39,8 +39,9 @@ function header_translate($hdr) { case 'references': return _b_('Références'); case 'x-face': return _b_('Image'); default: - if (function_exists('hook_header_translate')) { - return hook_header_translate($hdr); + if (function_exists('hook_headerTranslate') + && $res = hook_headerTranslate($hdr)) { + return $res; } return $hdr; } @@ -57,7 +58,7 @@ function formatDisplayHeader($_header,$_text) { $res = ""; $groups = preg_split("/[\t ]*,[\t ]*/",$_text); foreach ($groups as $g) { - $res.="$g, "; + $res.="$g, "; } return substr($res,0, -2); @@ -78,7 +79,7 @@ function formatDisplayHeader($_header,$_text) { $p = $banana->spool->overview[$p]->parent; } foreach (array_reverse($par_ok) as $p) { - $rsl .= "spool->group}&id=$p\">$ndx "; + $rsl .= "spool->group}&artid=$p\">$ndx "; $ndx++; } return $rsl; @@ -87,8 +88,10 @@ function formatDisplayHeader($_header,$_text) { return 'x-face'; default: - if (function_exists('hook_formatDisplayHeader')) { - return hook_formatDisplayHeader($_header, $_text); + if (function_exists('hook_formatDisplayHeader') + && $res = hook_formatDisplayHeader($_header, $_text)) + { + return $res; } return htmlentities($_text); } @@ -111,7 +114,7 @@ function fancyDate($stamp) { } elseif ($today == 1 + $dday) { $format = _b_('hier')." %H:%M"; } elseif ($today < 7 + $dday) { - $format = '%A %H:%M'; + $format = '%a %H:%M'; } else { $format = '%a %e %b'; } @@ -137,6 +140,47 @@ function formatFrom($text) { return preg_replace("/\\\(\(|\))/","\\1",$result); } +function displayshortcuts($first = -1) { + global $banana; + extract($banana->state); + + $res = '
'; + $res .= '['._b_('Liste des forums').'] '; + if (is_null($group)) { + return $res.'
'; + } + + $res .= "[$group] "; + + if (is_null($artid)) { + $res .= "["._b_('Nouveau message')."] "; + if (sizeof($banana->spool->overview)>$banana->tmax) { + $res .= '
'; + $n = intval(log(count($banana->spool->overview), 10))+1; + for ($ndx=1; $ndx <= sizeof($banana->spool->overview); $ndx += $banana->tmax) { + if ($first==$ndx) { + $fmt = "[%0{$n}u-%0{$n}u] "; + } else { + $fmt = "[%0{$n}u-%0{$n}u] "; + } + $res .= sprintf($fmt, $ndx, min($ndx+$banana->tmax-1,sizeof($banana->spool->overview))); + } + } + } else { + $res .= "[" + ._b_('Répondre')."] "; + if ($banana->post->checkcancel()) { + $res .= "[" + ._b_('Annuler ce message')."] "; + } + } + return $res.''; +} + +/******************************************************************************** + * FORMATTING STUFF : BODY + */ + function wrap($text, $_prefix="") { $parts = preg_split("/\n-- ?\n/", $text);