/[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.3 - (show annotations)
Wed Aug 8 12:58:08 2001 UTC (22 years, 8 months ago) by ravilov
Branch: MAIN
Changes since 1.2: +4 -0 lines
Conditions and Lifestyle news are now displayed in groups of 10.
mkdir.sh replaced with more general fix.sh.

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 return $str;
9 }
10 function ParseNewline($str) {
11 if (!$str) return $str;
12 $str = preg_replace('/\s*(\r\n\r\n|\n\r\n\r|\n\n|\r\r)/m', '</p> <p class="ptext">', $str);
13 $str = preg_replace('/\s*(\r\n|\n\r|\r|\n)/m', '<br>', $str);
14 return $str;
15 }
16 function MyQuote($str) {
17 global $dbh;
18 if (!$dbh) return "'$str'";
19 return $dbh->quote($str);
20 }
21 function MyMove($src, $dest) {
22 $cmd = "mv -f '".EscapeShellCmd($src)."' '".EscapeShellCmd($dest)."'";
23 return exec($cmd);
24 }
25 function MyDelete($src) {
26 @unlink($src);
27 }
28 function error($msg) {
29 if (is_array($msg)) $msg = implode(" ", $msg);
30 echo "<BR>\n<FONT COLOR=\"#FF0000\">[".HTMLSpecialChars($msg).
31 "]</FONT><BR>\n";
32 }
33 function PicSize($pic) {
34 global $syspicdir;
35 $ret = array(0, 0);
36 if ($pic) {
37 @$size = GetImageSize($syspicdir."/".$pic);
38 $ret = array($size[0], $size[1]);
39 }
40 return $ret;
41 }
42 function isEdit() {
43 global $PHP_SELF;
44 return stristr($PHP_SELF, "/edit/") ? true : false;
45 }
46 ?>

  ViewVC Help
Powered by ViewVC 1.1.26