/[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.5 - (show annotations)
Thu Aug 16 09:08:42 2001 UTC (22 years, 8 months ago) by ravilov
Branch: MAIN
Changes since 1.4: +0 -2 lines
Fixed HTML so it doesn't break (so badly) when resized.

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

  ViewVC Help
Powered by ViewVC 1.1.26