/[health_html]/inc/global.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /inc/global.php

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

revision 1.6 by ravilov, Mon Aug 27 09:17:40 2001 UTC revision 1.7 by ravilov, Thu Aug 30 16:35:36 2001 UTC
# Line 8  Line 8 
8                  $str = ereg_replace("\"", """, $str);                  $str = ereg_replace("\"", """, $str);
9                  return $str;                  return $str;
10          }          }
11          function ParseNewline($str) {  
12            function ParseNewline($str, $paragraphs = false) {
13                  if (!$str) return $str;                  if (!$str) return $str;
14                  $str = preg_replace('/\s*(\r\n\r\n|\n\r\n\r|\n\n|\r\r)/m', '</p> <p class="ptext">', $str);                  if ($paragraphs) $str = preg_replace('/\s*(\r\n\r\n|\n\r\n\r|\n\n|\r\r)/m', ' </p><p class="ptext">', $str);
15                  $str = preg_replace('/\s*(\r\n|\n\r|\r|\n)/m', '<br>', $str);                  $str = ereg_replace("[ \t]*(\r\n?|\n\r?)", '<br>', $str);
16                  return $str;                  return $str;
17          }          }
18          function MyQuote($str) {  
19                  global $dbh;          function Slova() {
20                  if (!$dbh) return "'$str'";                  return array("@", "A", "B", "C", "È", "Æ", "D", "Ð", "E", "F",
21                  return $dbh->quote($str);                          "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q",
22          }                          "R", "S", "©", "T", "U", "V", "W", "X", "Y", "Z", "®");
         function MyMove($src, $dest) {  
                 $cmd = "mv -f '".EscapeShellCmd($src)."' '".EscapeShellCmd($dest)."'";  
                 return exec($cmd);  
         }  
         function MyDelete($src) {  
                 @unlink($src);  
23          }          }
24    
25          function error($msg) {          function error($msg) {
26                  if (is_array($msg)) $msg = implode(" ", $msg);                  if (is_array($msg)) $msg = implode(" ", $msg);
27                  echo "<BR>\n<FONT COLOR=\"#FF0000\">[".HTMLSpecialChars($msg).                  echo "<BR>\n<FONT COLOR=\"#FF0000\">[".HTMLSpecialChars($msg)."]</FONT><BR>\n";
                         "]</FONT><BR>\n";  
28          }          }
29          function PicSize($pic) {  
30                  global $syspicdir;          function convert_html($str) {
31                  $ret = array(0, 0);                  $entities = array(
32                  if ($pic) {                          "nbsp" => " ", "#160" => " ",   # nbsp
33                          @$size = GetImageSize($syspicdir."/".$pic);                          "amp" => " ", "#38" => " ",     # amp
34                          $ret = array($size[0], $size[1]);                          "quot" => "\"", "#34" => "\"",  # quot
35                  }                          "lt" => "<", "#60" => "<",      # lt
36                  return $ret;                          "gt" => ">", "#62" => ">",      # gt
37                            "Scaron" => "©", "#352" => "©",
38                            "scaron" => "¹", "#353" => "¹",
39                            "Ccaron" => "È", "#" => "È", "#268" => "È",
40                            "ccaron" => "è", "#232" => "è", "#269" => "è",
41                            "Cgrave" => "Æ", "#" => "Æ", "#" => "Æ",
42                            "cgrave" => "æ", "#230" => "æ", "#263" => "æ",
43                            "?" => "Ð", "#" => "Ð", "#" => "Ð",
44                            "?" => "ð", "#" => "ð", "#273" => "ð",
45                            "Zcaron" => "®", "#" => "®", "#381" => "®",
46                            "zcaron" => "¾", "#" => "¾", "#382" => "¾"
47                    );
48                    $t = intval($str);
49                    # Skip if not a scalar
50                    if (!is_scalar($str)) return $str;
51                    # If a number, don't touch it
52                    if (strcmp(intval($str), $str) == 0) return $str;
53                    # Replace "<BR>" with "\n"
54                    $str = preg_replace("/\<BR\>/m", "\n", $str);
55                    # Replace "<...>\n" with "<...>"
56                    $str = preg_replace("/(\<[^\/][^\>]*\>)\s*(\r\n?|\n\r?)\s*/m", '$1', $str);
57                    # Replace "\n</...>" with "</...>\n"
58                    $str = preg_replace("/\s*(\r\n?|\n\r?)\s*(\<\/[^\>]+\>)/m", '$2$1', $str);
59                    # Remove "<HEAD>"/"</HEAD>", and anything in between.
60                    $str = preg_replace("/\<\s*HEAD[^\>]*\>.*\<\/\s*HEAD\s*\>(\r\n?|\n\r?)*/ims", '', $str);
61                    # Remove all "<HTML>", "<HEAD>", "<BODY>", "<FONT>" and "<P>" tags
62                    $str = preg_replace("/(\<\s*(HTML|HEAD|BODY|FONT|P)[^\>]*\>|\<\/\s*(HTML|HEAD|BODY|FONT|P)\s*\>)/im", '', $str);
63                    # Replace "\n<LI>" or "<LI>\n" with "<LI>"
64                    $str = preg_replace("/(\s*(\r\n?|\n\r?))*(\<\/\s*LI\s*\>)(\s*(\r\n?|\n\r?))*/m", '$3', $str);
65                    # Replace "<UL>\n" or "<OL>\n" with "<UL>" or "<OL>", respectively
66                    $str = preg_replace("/(\<\s*(UL|OL)\s*\>)(\s*(\r\n?|\n\r?))+/m", '$1', $str);
67                    # Replace "\n</UL>" or "\n</OL>" with "</UL>" or "</OL>", respectively
68                    $str = preg_replace("/(\s*(\r\n?|\n\r?))+(\<\/\s*(UL|OL)\s*\>)/m", '$3', $str);
69                    # Replace "``" and "''" with """ (a single double quote)
70                    $str = str_replace("“", '"', $str);
71                    $str = str_replace("”", '"', $str);
72                    # Replace "-" with "-"
73                    $str = str_replace("—", '-', $str);
74                    # Replace character references ("&...;" and "&#...;") with its value
75                    $str = preg_replace("/\&([^;]+);/em", '$entities["$1"]?$entities["$1"]:"?"', $str);
76                    # Remove all whitespace at beginning or ending of a line
77                    $str = preg_replace("/(^\s+|\s+$)/", '', $str);
78                    # Convert Win1250 to ISO8859-2
79                    $str = strtr($str, "ŠÐÈÆŽšðèæž", "©ÐÈÆ®¹ðèæ¾");
80                    return $str;
81          }          }
         $isEdit = stristr($PHP_SELF, "/edit/") ? true : false;  
         $isMed = false; /* */  
82  ?>  ?>

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.26