/[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

Contents of /inc/global.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Mon Aug 13 08:16:02 2001 UTC (22 years, 9 months ago) by ravilov
Branch: MAIN
Changes since 1.3: +3 -0 lines
Fixed a flaw in MyEscape().

1 <?php
2 function MyEscape($str) {
3 $allowed = array("", "B", "I", "U", "UL", "OL", "LI");
4 $str = preg_replace("/(\<\/?\s*(\w+)>[^\>]*\>)/e",
5 "array_search(strtoupper('\\2'),\$allowed,false)?'\\1':HTMLSpecialChars('\\1')",
6 $str);
7 $str = preg_replace("/(^\s+|\s+$)/", "", $str);
8 $str = ereg_replace("\<", "&lt;", $str);
9 $str = ereg_replace("\>", "&gt;", $str);
10 $str = ereg_replace("\"", "&quot;", $str);
11 return $str;
12 }
13 function ParseNewline($str) {
14 if (!$str) return $str;
15 $str = preg_replace('/\s*(\r\n\r\n|\n\r\n\r|\n\n|\r\r)/m', '</p> <p class="ptext">', $str);
16 $str = preg_replace('/\s*(\r\n|\n\r|\r|\n)/m', '<br>', $str);
17 return $str;
18 }
19 function MyQuote($str) {
20 global $dbh;
21 if (!$dbh) return "'$str'";
22 return $dbh->quote($str);
23 }
24 function MyMove($src, $dest) {
25 $cmd = "mv -f '".EscapeShellCmd($src)."' '".EscapeShellCmd($dest)."'";
26 return exec($cmd);
27 }
28 function MyDelete($src) {
29 @unlink($src);
30 }
31 function error($msg) {
32 if (is_array($msg)) $msg = implode(" ", $msg);
33 echo "<BR>\n<FONT COLOR=\"#FF0000\">[".HTMLSpecialChars($msg).
34 "]</FONT><BR>\n";
35 }
36 function PicSize($pic) {
37 global $syspicdir;
38 $ret = array(0, 0);
39 if ($pic) {
40 @$size = GetImageSize($syspicdir."/".$pic);
41 $ret = array($size[0], $size[1]);
42 }
43 return $ret;
44 }
45 function isEdit() {
46 global $PHP_SELF;
47 return stristr($PHP_SELF, "/edit/") ? true : false;
48 }
49 ?>

  ViewVC Help
Powered by ViewVC 1.1.26