<?php
function tdbg($msg, $funnycolor='red', $indent=0) { echo "<table>"; echo "<tr><td class=stuff>"; dbg($msg, $funnycolor, $indent); echo "</td></tr>\n"; echo "</table>"; }
function dbg($inmsg, $funnycolor='red', $indent=0) { for($i=0; $i<$indent; $i++) echo "   "; $msg = sprintf("<b><font color=$funnycolor>%s</font></b><br>", $inmsg); echo "$msg"; }
function Alert($msg) { echo "<script language=javascript> alert('$msg'); </script>"; }
function fixPath($path) { if($path[0] != "/") $path = "/" . $path; $length = strlen($path); if($path[$length-1] != "/") $path .= "/"; return ($path); }
function dispLabel($str) { $tmpLabel = basename($str); $tmpLabel = ereg_replace ("^.+\-", "", $tmpLabel); $tmpLabel = ereg_replace ("\..*$", "", $tmpLabel); $tmpLabel = ereg_replace("_", " " , $tmpLabel); return($tmpLabel); }
function mkLabel ($str) { $tmp = basename($str); $label = ereg_replace ("\..*$", "", $tmp); return ($label); }
function swapSuffix($srcfile, $tosuffix) { $dotPos = strrpos($srcfile,"."); $length = strlen($srcfile); $goodLength = $dotPos+1; $ret = substr($srcfile,0, $goodLength) . $tosuffix; return $ret; }
function stripSuffix($srcfile) { $dotPos = strrpos($srcfile,"."); $ret = substr($srcfile,0, $dotPos); return $ret; }
function getSuffix($srcfile) { $dotPos = strrpos($srcfile,"."); if($dotPos == true) $ret = substr($srcfile, $dotPos+1); else $ret = $srcfile; // $ret = ""; return $ret; }
function stripHttpStuff($srcfile) { $dotPos = strrpos($srcfile,"/"); $ret = substr($srcfile, $dotPos+1); return $ret; }
function getMimeType($file) { $mime_type = "unknown"; $suffix = substr($file, strrpos($file,".")); if(strstr($suffix, "jpg")) $mime_type = "image/jpeg"; elseif (strstr($suffix, "gif")) $mime_type = "image/gif"; elseif (strstr($suffix, "\.txt")) $mime_type = "text/plain"; elseif (strstr($suffix, "\.htm")) $mime_type = "text/html"; elseif (strstr($suffix, "\.cgi")) $mime_type = "text/html"; elseif (strstr($suffix, "\.php")) $mime_type = "text/html"; elseif (strstr($suffix, "\.cap")) $mime_type = "text/plain"; return($mime_type); }
function getPageType ($file) { $tmp = basename($file); $retval="unknown"; if (is_dir($file)) { $retval = "dir"; } elseif (strstr ($tmp, "html") || strstr ($tmp, ".php")) $retval = "html"; elseif (strstr ($tmp, ".cap")) $retval = "image_caption"; elseif (strstr ($tmp, "htm") && !stristr ($tmp, "html")) $retval = "htm"; elseif (strstr ($tmp, ".furl")) $retval = "furl"; elseif (strstr ($tmp, ".url")) $retval = "url"; elseif (strstr ($tmp, ".txt")) $retval = "text"; elseif (strstr ($tmp, ".lbl")) $retval = "lbl"; elseif (stristr ($tmp, ".pdf")) $retval = "downloadable"; elseif (stristr ($tmp, ".jpg") || stristr ($tmp, ".gif") || stristr ($tmp, ".png") || stristr ($tmp, ".jpeg")) $retval = "std_one_image"; elseif (strstr ($tmp, "gz") || stristr ($tmp, "zip") || stristr ($tmp, "dxf") || stristr ($tmp, "xls")) $retval = "downloadable"; elseif (stristr ($tmp, "css")) $retval = "css"; elseif ($tmp == "keywords") $retval = "keywords"; //echo "retval: ", $retval, "<br/>"; return ($retval); } ?>
|