# HG changeset patch # User Tom Fredrik "BFG" Klaussen # Date 1305890753 -7200 # Node ID 18aafb1a8986ec199e8234b16c767dc35500ebbe # Parent 74196528fc649da202f1bbb331a56856b4657005 Better handling of errors and globals. diff -r 74196528fc64 -r 18aafb1a8986 common-functions.inc --- a/common-functions.inc Thu May 19 18:04:33 2011 +0200 +++ b/common-functions.inc Fri May 20 13:25:53 2011 +0200 @@ -1,4 +1,6 @@ = 4.3) { @@ -21,4 +23,32 @@ } return $sData; } -?> + +function errorPage($errorText, $errorCode=403) +{ + header(StatusCodes::httpHeaderFor($errorCode)); + print "

${errorText}

"; + exit; +} + +function genUrl($keys=array()) { + $out="?"; + $first=1; + $URL_PARAMS=$GLOBALS['URL_PARAMS']; + $new_params=array(); + foreach($URL_PARAMS as $param) { + $new_params[$param]=$GLOBALS[$param]; + } + foreach($keys as $param => $val) { + $new_params[$param]=$val; + } + foreach($new_params as $param => $val) { + if($first) + $first=0; + else + $out.="&"; + $out.=urlencode($param).'='.urlencode($val); + } + return $out; +} +?> \ No newline at end of file diff -r 74196528fc64 -r 18aafb1a8986 filters.inc --- a/filters.inc Thu May 19 18:04:33 2011 +0200 +++ b/filters.inc Fri May 20 13:25:53 2011 +0200 @@ -1,26 +1,38 @@ ]*)>/is"; $replacement = "
  • "; $output= preg_replace($pattern, $replacement, $input); $pattern = '/
  • ]*)>(.*?)<\/li>/is'; - $replacement = "
  • \$3
  • "; + $replacement = "
  • "$1" ))."\">\$3
  • "; $output=preg_replace($pattern, $replacement, $output); return $output; } -function addLangBar($input, $lang) { +function addLangBar($input) { + $name=$GLOBALS['name']; + $lang=$GLOBALS['lang']; $languages = array("no","en"); $langbar='