?? functions.php
字號:
<?/*$Header: /home/cvsroot/pofhq-wapmail/functions.php,v 1.7 2002/12/13 19:20:13 pau Exp $Copyright (c) 2002 Pau Oliva Fora <pau@eSlack.org> Licensed under the GNU GPL. For full terms see the file COPYING.*/header("content-type:text/vnd.wap.wml");header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the pastheader("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modifiedheader("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1header("Cache-Control: post-check=0, pre-check=0", false);header("Pragma: no-cache"); // HTTP/1.0$VERSION="1.3beta2";function wmlheader() { echo("<?xml version=\"1.0\"?>\n"); echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n\n"); echo("<wml>\n"); }function wmlmeta() { echo("<head>\n"); echo("<meta http-equiv=\"Cache-Control\" content=\"max-age=0\" forua=\"true\"/>\n"); echo("<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" forua=\"true\"/>\n"); echo("<meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/>\n"); echo("</head>\n"); }function wmlfooter() { echo("</card>\n</wml>\n"); }function get_mime_type(&$structure) { $primary_mime_type = array("TEXT", "MULTIPART", "MESSAGE", "APPLICATION", "AUDIO", "IMAGE", "VIDEO", "OTHER"); if($structure->subtype) { return $primary_mime_type[(int) $structure->type] . '/' . $structure->subtype; } return "TEXT/PLAIN"; } function get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false) { /* yields the part of a message with a particular MIME type. Thanks to */ /* <cleong@organic.com> for this function in php manual user contributed notes. */ if(!$structure) { $structure = imap_fetchstructure($stream, $msg_number); } if($structure) { if($mime_type == get_mime_type($structure)) { if(!$part_number) { $part_number = "1"; } $text = imap_fetchbody($stream, $msg_number, $part_number); if($structure->encoding == 3) { return decode2(imap_base64($text)); } else if($structure->encoding == 4) { $text = imap_qprint($text); if (ereg("=\n", $text)) $text = ereg_replace ("=\n", "", $text); return decode2($text); } else { return decode2($text); } } if($structure->type == 1) { /* multipart */ while(list($index, $sub_structure) = each($structure->parts)) { if($part_number) { $prefix = $part_number . '.'; } $data = get_part($stream, $msg_number, $mime_type, $sub_structure, $prefix . ($index + 1)); if($data) { return $data; } } } } return false; } function decode($string) { /* Decodes base64 and quoted printable to a 'human readable' format */ if(ereg("=\?.{0,}\?[Bb]\?",$string)){ $arrHead=split("=\?.{0,}\?[Bb]\?",$string); while(list($key,$value)=each($arrHead)){ if(ereg("\?=",$value)){ $arrTemp=split("\?=",$value); $arrTemp[0]=base64_decode($arrTemp[0]); $arrHead[$key]=join("",$arrTemp); } } $string=join("",$arrHead); } if(ereg("=\?.{0,}\?[Qq]\?",$string)){ $string=quoted_printable_decode($string); $string=ereg_replace("=\?.{0,}\?[Qq]\?","",$string); $string=ereg_replace("\?=","",$string); } return decode2($string);}function decode2($string) { /* Displays message correctly when there is a '$' sign on it */ /* and reduces redundant signs usually used in signatures. */ if (ereg("\\$",$string)) $string=ereg_replace("\\$","\$$","$string"); if (ereg(" />",$string)) $string=ereg_replace(" />","/>","$string"); if (ereg("\ \ ",$string)) $string=ereg_replace("\ \ "," ","$string"); if (ereg("----",$string)) $string=ereg_replace("----","--","$string"); if (ereg("____",$string)) $string=ereg_replace("____","__","$string"); if (ereg("====",$string)) $string=ereg_replace("====","==","$string"); if (ereg("####",$string)) $string=ereg_replace("####","##","$string"); if (ereg("&nbsp;",$string)) $string=ereg_replace("&nbsp;","","$string"); return $string;}function waplink($title,$name,$href,$fields) { /* generates the needed link in wml from an array */ echo "<anchor title=\"$title\">$name\n"; echo "<go href=\"$href\" method=\"post\">\n"; foreach ($fields as $key => $value) echo "<postfield name=\"$key\" value=\"$value\"/>\n"; echo "</go></anchor><br/>\n"; }function wapbutton($form,$label,$href,$fields) { /* generates a wml button in the browser (similar to a link) */ echo "<do type=\"accept\" label=\"$label\">\n"; echo "<go href=\"$href\" method=\"post\">\n"; if ($form) foreach ($fields as $key => $value) echo "<postfield name=\"$key\" value=\"$".$value."\"/>\n"; else foreach ($fields as $key => $value) echo "<postfield name=\"$key\" value=\"$value\"/>\n"; echo "</go></do>\n";}function isutf8($string) { /* try to see if $msgbody is encoded in UTF-8, otherwise encode it. */ if (ereg("醸閨韡髚鷟鄚鑭靯騶鵿鋦雦飢鰘鼃羭蓔蛗觸趞纜葇蘾襹質(zhì)膢藎蟶謡軀駖褆鐋
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -