/[gnuheter]/gnuheter/mainfile.php
ViewVC logotype

Diff of /gnuheter/mainfile.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by metaur, Sun Nov 10 08:57:47 2002 UTC revision 1.25 by metaur, Wed Nov 13 08:51:39 2002 UTC
# Line 198  function nowordlinkshtml($str) { Line 198  function nowordlinkshtml($str) {
198          return strip_tags(wordlinks($str));          return strip_tags(wordlinks($str));
199  }  }
200    
201    function printAllowedHTML() {
202            global $allowed_html;
203    
204            echo "Tillåten HTML:<br>\n";
205    
206            foreach ($allowed_html as $onekey => $oneval) {
207                    echo "&lt;$onekey";
208    
209                    foreach ($oneval as $twokey => $twoval)
210                            echo " <i>$twokey=</i>";
211    
212                    echo '&gt; ';
213            }
214    
215            echo "<br>\n";
216    }
217    
218  function new_check_html($string, $strip = '') {  function new_check_html($string, $strip = '') {
219    
220  # Den här funktionen ser till att bara godkända HTML-element och deras  # Den här funktionen ser till att bara godkända HTML-element och deras
# Line 241  function new_check_html_attr($element, $ Line 258  function new_check_html_attr($element, $
258      $attr = stripslashes(stripslashes($attr));      $attr = stripslashes(stripslashes($attr));
259    
260      if (count($allowed_html[strtolower($element)]) == 0)      if (count($allowed_html[strtolower($element)]) == 0)
261        return "<$element>";          return "<$element>";
262    
263      $attr = preg_replace('%(\s+([^=\s]+)'.                    # attributnamn      $attr = preg_replace('%(\s+([^=\s]+)'.                    # attributnamn
264                           '(\s*=\s*'.                          # lika med                           '(\s*=\s*'.                          # lika med
# Line 251  function new_check_html_attr($element, $ Line 268  function new_check_html_attr($element, $
268    
269      $attr = trim($attr);      $attr = trim($attr);
270      if ($attr != '')      if ($attr != '')
271        $attr = " $attr";          $attr = " $attr";
272    
273      return "<$element$attr>";      return "<$element$attr>";
274  }  }
# Line 266  function new_check_html_attr2($element, Line 283  function new_check_html_attr2($element,
283      $wholeattribute = stripslashes($wholeattribute);      $wholeattribute = stripslashes($wholeattribute);
284    
285      if ($allowed_html[strtolower($element)][strtolower($attributename)] != 1)      if ($allowed_html[strtolower($element)][strtolower($attributename)] != 1)
286        return '';          return '';
287    
288      if ((!preg_match('%^\s+[^=\s]+\s*=\s*\'[^\']*\'$%', $wholeattribute)) and      if ((!preg_match('%^\s+[^=\s]+\s*=\s*\'[^\']*\'$%', $wholeattribute)) and
289          (!preg_match('%^\s+[^=\s]+\s*=\s*"[^"]*"$%', $wholeattribute)) and          (!preg_match('%^\s+[^=\s]+\s*=\s*"[^"]*"$%', $wholeattribute)) and
290          (preg_match('%["\']%', $wholeattribute)))          (preg_match('%["\']%', $wholeattribute)))
291        return '';          return '';
292    
293      return $wholeattribute;      return $wholeattribute;
294  }  }

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26