"127.0.0.1" ); $USERS_POLICY="deny"; //allow, deny $USERS_LIST=array( "wizzent" ); //*** CONFIGURE NAMEKO HERE *** STOP ***// //**************************************// $VER=array( "NAME"=>"Nameko", "WEB"=>"Wiz's Shelf", "URL"=>"http://wiz.homelinux.net/", "MAJOR"=>"0.6", "MINOR"=>"1", "BUILD"=>"115" ); $SECTION_RIGHT="Today is ".date("D, jS M Y"); if($_REQUEST[op] && $_SESSION[MESSAGES]) $SECTION_RIGHT="You are $_SESSION[username]@$_SESSION[server] | Your e-mail address is $_SESSION[email] | $SECTION_RIGHT"; $SECTION_LEFT=array( "0"=>"Login", "1"=>"Check Login", "2"=>"Inbox - ".count($_SESSION[MESSAGES][CONTENT])." message".((count($_SESSION[MESSAGES][CONTENT])>1)?"s":"")." - ".sprintf("%.2f",$_SESSION[MESSAGES][SIZE]/1024)." KB", "3"=>"Read message", "4"=>"Compose new mail", "5"=>"Delete messages", "6"=>"Send message", "999"=>"Credits" ); $COLORSET=array( "GREY"=>array("GROUND"=>"#999999","DARK"=>"#DFDFDF","MEDIUM"=>"#E8E8E8","LIGHT"=>"#F7F7F7","LINE"=>"#7F7F7F","LINKS"=>"#000000"), "VIOLET"=>array("GROUND"=>"#CA6597","DARK"=>"#F6C5DB","MEDIUM"=>"#F3DAE8","LIGHT"=>"#FDEEF6","LINE"=>"#FE00BF","LINKS"=>"#FE4100"), "GREEN"=>array("GROUND"=>"#64C969","DARK"=>"#C4F5C9","MEDIUM"=>"#D9F2D9","LIGHT"=>"#EDFCED","LINE"=>"#2FFE00","LINKS"=>"#F21DAB"), "BLUE"=>array("GROUND"=>"#6699CC","DARK"=>"#C7DDF8","MEDIUM"=>"#DBEAF5","LIGHT"=>"#F0F8FF","LINE"=>"#00BFFF","LINKS"=>"#3E00FE"), "BROWN"=>array("GROUND"=>"#C98A64","DARK"=>"#F5D9C4","MEDIUM"=>"#F2E1D9","LIGHT"=>"#FCF2ED","LINE"=>"#FE2300","LINKS"=>"#2727F9") ); $CHARSETS = array("afrikaans-iso-8859-1"=>"iso-8859-1", "afrikaans-utf-8"=>"utf-8", "albanian-iso-8859-1"=>"iso-8859-1", "albanian-utf-8"=>"utf-8", "arabic-utf-8"=>"utf-8", "arabic-windows-1256"=>"windows-1256", "azerbaijani-iso-8859-9"=>"iso-8859-9", "azerbaijani-utf-8"=>"utf-8", "bosnian-utf-8"=>"utf-8", "bosnian-windows-1250"=>"windows-1250", "brazilian_portuguese-iso-8859-1"=>"iso-8859-1", "brazilian_portuguese-utf-8"=>"utf-8", "bulgarian-koi8-r"=>"koi8-r", "bulgarian-utf-8"=>"utf-8", "bulgarian-windows-1251"=>"windows-1251", "catalan-iso-8859-1"=>"iso-8859-1", "catalan-utf-8"=>"utf-8", "chinese_big5-utf-8"=>"utf-8", "chinese_big5"=>"big5", "chinese_gb-utf-8"=>"utf-8", "chinese_gb"=>"gb2312", "croatian-iso-8859-2"=>"iso-8859-2", "croatian-utf-8"=>"utf-8", "croatian-windows-1250"=>"windows-1250", "czech-iso-8859-2"=>"iso-8859-2", "czech-utf-8"=>"utf-8", "czech-windows-1250"=>"windows-1250", "danish-iso-8859-1"=>"iso-8859-1", "danish-utf-8"=>"utf-8", "dutch-iso-8859-1"=>"iso-8859-1", "dutch-utf-8"=>"utf-8", "english-iso-8859-1"=>"iso-8859-1", "english-utf-8"=>"utf-8", "estonian-iso-8859-1"=>"iso-8859-1", "estonian-utf-8"=>"utf-8", "finnish-iso-8859-1"=>"iso-8859-1", "finnish-utf-8"=>"utf-8", "french-iso-8859-1"=>"iso-8859-1", "french-utf-8"=>"utf-8", "galician-iso-8859-1"=>"iso-8859-1", "galician-utf-8"=>"utf-8", "georgian-utf-8"=>"utf-8", "german-iso-8859-1"=>"iso-8859-1", "german-utf-8"=>"utf-8", "greek-iso-8859-7"=>"iso-8859-7", "greek-utf-8"=>"utf-8", "hebrew-iso-8859-8-i"=>"iso-8859-8-i", "hindi-utf-8"=>"utf-8", "hungarian-iso-8859-2"=>"iso-8859-2", "hungarian-utf-8"=>"utf-8", "indonesian-iso-8859-1"=>"iso-8859-1", "indonesian-utf-8"=>"utf-8", "italian-iso-8859-1"=>"iso-8859-1", "italian-utf-8"=>"utf-8", "japanese-euc"=>"euc-jp", "japanese-sjis"=>"SHIFT_JIS", "japanese-utf-8"=>"utf-8", "korean-ks_c_5601-1987"=>"ks_c_5601-1987", "latvian-utf-8"=>"utf-8", "latvian-windows-1257"=>"windows-1257", "lithuanian-utf-8"=>"utf-8", "lithuanian-windows-1257"=>"windows-1257", "malay-iso-8859-1"=>"iso-8859-1", "malay-utf-8"=>"utf-8", "norwegian-iso-8859-1"=>"iso-8859-1", "norwegian-utf-8"=>"utf-8", "persian-utf-8"=>"utf-8", "persian-windows-1256"=>"windows-1256", "polish-iso-8859-2"=>"iso-8859-2", "polish-utf-8"=>"utf-8", "portuguese-iso-8859-1"=>"iso-8859-1", "portuguese-utf-8"=>"utf-8", "romanian-iso-8859-1"=>"iso-8859-1", "romanian-utf-8"=>"utf-8", "russian-dos-866"=>"koi8-r", "russian-koi8-r"=>"koi8-r", "russian-utf-8"=>"utf-8", "russian-windows-1251"=>"windows-1251", "serbian_cyrillic-utf-8"=>"utf-8", "serbian_cyrillic-windows-1251"=>"utf-8", "serbian_latin-utf-8"=>"utf-8", "serbian_latin-windows-1250"=>"utf-8", "slovak-iso-8859-2"=>"iso-8859-2", "slovak-utf-8"=>"utf-8", "slovak-windows-1250"=>"windows-1250", "slovenian-iso-8859-2"=>"iso-8859-2", "slovenian-utf-8"=>"utf-8", "slovenian-windows-1250"=>"windows-1250", "spanish-iso-8859-1"=>"iso-8859-1", "spanish-utf-8"=>"utf-8", "swedish-iso-8859-1"=>"iso-8859-1", "swedish-utf-8"=>"utf-8", "thai-tis-620"=>"tis-620", "thai-utf-8"=>"utf-8", "turkish-iso-8859-9"=>"iso-8859-9", "turkish-utf-8"=>"utf-8", "ukrainian-utf-8"=>"utf-8", "ukrainian-windows-1251"=>"windows-1251"); if(!$_SESSION[COLORS]) $_SESSION[COLORS]=$DEFAULT_COLORSET; if(!$_SESSION[FONTSIZE]) $_SESSION[FONTSIZE]=$DEFAULT_FONTSIZE; if(!$_SESSION[CHARSET]) $_SESSION[CHARSET]=$DEFAULT_CHARSET; if($_GET[colorset]) $_SESSION[COLORS]=$_GET[colorset]; $COLORS=$_SESSION[COLORS]; if($_GET[fontsize]) $_SESSION[FONTSIZE]=$_GET[fontsize]; if($_POST[charset]) $_SESSION[CHARSET]=$_POST[charset]; $WIZ=$_SERVER[SCRIPT_NAME]; if((!$_SESSION[AUTH] && $_REQUEST[op]>1 && $_REQUEST[op]<100) || !$_REQUEST[op]) $_REQUEST[op]=0; if(!$_SESSION[MPP]) $_SESSION[MPP]=$DEFAULT_MAIL_PER_PAGE; $BOUNDARY="----------NamekoWebmailBoundary"; $LEGAL_CHARS="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._@-"; $SOCK=""; ?> <?="$VER[NAME] $VER[MAJOR].$VER[MINOR]"?> "); break; //5:DELETE MESSAGES case "5": echo(""); break; //6:SEND EMAIL case "6": echo(""); break; //999:CREDITS case "999": echo(""); break; //DEFAULT:LOGIN default: $temp_fontsize=$_SESSION[FONTSIZE]; $temp_colorset=$_SESSION[COLORS]; $temp_charset=$_SESSION[CHARSET]; session_unset(); $_SESSION[COLORS]=$temp_colorset; $_SESSION[FONTSIZE]=$temp_fontsize; $_SESSION[CHARSET]=$temp_charset; echo(""); break; } ?>
  Powered by  

 

 

"); if($fields_not_filled) { ShowMessage("ERROR!","

You must fill all the fields of the login form!

\n

Try again

"); } else { if(is_array($USERS_LIST) && count($USERS_LIST)>0 && (($USERS_POLICY=="allow" && in_array($_SESSION[username],$USERS_LIST)) || ($USERS_POLICY!="allow" && !in_array($_SESSION[username],$USERS_LIST)))) { ShowMessage("ERROR!","

Access denied for user $_SESSION[username] by access control list!

\n

Try again (with another user)

"); } else { switch(POP3OpenConnectionAndLogin()) { case "1": //BAD CONNECTION ShowMessage("ERROR!","

Connect to address ".$_SESSION[server].":
connection refused

\n

Try again

"); break; case "2": //LOGIN FAILED ShowMessage("ERROR!","

Authentication failed (bad password?)
Connection closed by foreign host.

\n

Try again

"); break; case "3": //LOGIN OK, RETRIEVE MESSAGES $retr_code=POP3RetrieveHeaders(count($_SESSION[MESSAGES][CONTENT])+1); switch($retr_code) { case "31": $_SESSION[AUTH]=1; ShowMessage("OK!","

Messages fully retrieved!
Waiting while creating the GUI...

\n

If you are not automatically redirect to the next page into 5 seconds,
click here!

\n"); break; default: //UNKNOWN ANSWER ShowMessage("ERROR!","

Retrieving messages from server ".$_SESSION[server].":
unknown answer from the server ($retr_code)

\n

Try again

"); break; } break; default: //UNKNOWN ANSWER ShowMessage("ERROR!","

Connect to address ".$_SESSION[server].":
unknown answer from the server

\n

Try again

"); break; } if($SOCK) POP3CloseConnection(); } } echo(""); break; //2:SHOW MESSAGE LIST case "2": $msgnum=count($_SESSION[MESSAGES][CONTENT]); if($_GET[toggle_delete]) $_SESSION[MESSAGES][CONTENT][$_GET[toggle_delete]][DELETE]*=(-1); if(isset($_GET[change_limit])) $_SESSION[LIMIT]=$_GET[change_limit]; if($_GET[change_mpp]) { $_SESSION[MPP]=$_GET[change_mpp]; $_SESSION[LIMIT]=0; } if($_POST[auto_mark_deletion]) { for($i=0;$i<$msgnum;$i++) { $header=MessageParseHeader(split("\r\n",$_SESSION[MESSAGES][CONTENT][$i][HEADER])); if(strstr($header[subject],$_POST[auto_mark_deletion]) || strstr($header[from],$_POST[auto_mark_deletion])) $_SESSION[MESSAGES][CONTENT][$i][DELETE]=$message[DELETE]=1; } } if($_GET[mark_all_messages]) { for($i=$msgnum;$i>0;$i--) $_SESSION[MESSAGES][CONTENT][$i][DELETE]=$_GET[mark_all_messages]; } $marked_messages_num=0; for($i=0;$i<($msgnum+1);$i++) if($_SESSION[MESSAGES][CONTENT][$i][DELETE]>0) $marked_messages_num++; echo(""); break; //3:READ MAIL case "3": if($_GET[toggle_delete]) $_SESSION[MESSAGES][CONTENT][$_GET[toggle_delete]][DELETE]*=(-1); $_SESSION[MESSAGES][CONTENT][$_GET[id]][READ]=1; $getid=$_GET[id]; $header=MessageParseHeader(split("\r\n",$_SESSION[MESSAGES][CONTENT][$getid][HEADER])); echo(""); $_SESSION[refw][text]=split("\n",wordwrap(strip_tags($message["text-plain"]), 60, "\n", 1)); for($x=0;$x
  .: :.  

"); $i=($_SESSION[LIMIT])?$_SESSION[LIMIT]:0; $i_max=(($i+$_SESSION[MPP])>$msgnum)?$msgnum:$i+$_SESSION[MPP]; if($msgnum>0) { for($i;$i<$i_max;$i++) { $ir=$msgnum-$i; $header=MessageParseHeader(split("\r\n",$_SESSION[MESSAGES][CONTENT][$ir][HEADER])); while(strstr($header[date]," ")) $header[date]=str_replace(" "," ",$header[date]); $messageDate=split(" ",$header[date]); echo(""); } } else { echo(""); } echo("
From Subject Date Size  
".htmlentities($header[from])." ".(($header[subject])?htmlentities($header[subject]):"[no subject]")." ".sprintf("%02d",$messageDate[1])." $messageDate[2] $messageDate[3] ".sprintf("%.2f",$_SESSION[MESSAGES][CONTENT][$ir][SIZE]/1024)." KB 0)?"checked":"")." onClick='javascript:window.location=\"$WIZ?op=2&toggle_delete=$ir\"'>


Inbox empty

 
Tools
Show messages per page, $msgnum)?"disabled":"").">
Auto mark for deletion messages that contains in From or Subject field
\n

".htmlentities($header[subject])."
"); if($header["disposition-notification-to"]) echo(""); echo("
From: ".htmlentities($header[from])."
To: ".htmlentities($header[to])."
Date: ".htmlentities($header[date])."
Sender ask for read notification to address ".$header["disposition-notification-to"]."!
"); $_SESSION[refw][date]=htmlentities($header[date]); $_SESSION[refw][from]=GetAddressFromFromHeader($header[from]); $_SESSION[refw][subject]=htmlentities($header[subject]); foreach($header as $hd_name=>$hd_content) if(($hd_name!="from") && ($hd_name!="subject") && ($hd_name!="to") && ($hd_name!="date") && (trim($hd_content)!="")) echo("\n"); if($_SESSION[MESSAGES][CONTENT][$_GET[id]][DELETE]>0) { $del_message="This message is marked for deletion
"; $del_button="Unmark"; } else { $del_button="Mark"; } echo("
$del_message



"); $message=MessageRetrieveContent($header,POP3RetrieveMessage($_GET[id])); if(count($message["attachments"])) { echo("
Attachments:
\n"); foreach($message["attachments"] as $atc) { $ctparts=split(";",$atc["header"]["content-type"]); foreach($ctparts as $ctpart) { if(strstr($ctpart,"name=")) { $filename=split("=",$ctpart); $filename=str_replace("\"","",$filename[1]); } } for($d=0;$d$filename
"); if($attach_handle=@fopen("tmp_nameko/$filename","w")) @fwrite($attach_handle,$atc[content]); @fclose($attach_handle); @chmod("tmp_nameko/$filename",0600); } echo("
\n"); } echo("

"); $button_show_plain="

\n"; $button_show_html="

\n"; if($message["text-plain"] && $message["text-html"]) { if($_GET[show_html]) echo($button_show_plain . $message["text-html"]); else echo($button_show_html . $message["text-plain"]); } elseif($message["text-plain"] && !$message["text-html"]) { echo($message["text-plain"]); } elseif(!$message["text-plain"] && $message["text-html"]) { echo($message["text-html"]); } else { echo("This e-mail doesn't contain any text."); } echo("

From:
To:
Cc:
Bcc:
Subject:
Options:
Ask for notification
Attachments:
#1
#2
#3

Message



"); POP3DeleteMessages(); echo("

 

 

"); $email_fields=array("from","to","cc","bcc"); foreach($email_fields as $ef) { $eas=split('[;,]',$_POST[$ef]); foreach($eas as $ea) { if($ea=trim($ea)) { if(!ValidateEmailAddress($ea)) { $invalid_email_address.="$ea in ".ucfirst($ef)." field
"; echo("
"); } $email_address[$ef].="$ea, "; } } $email_address[$ef]=substr($email_address[$ef],0,-2); } if($invalid_email_address || !$email_address[to]) { ShowMessage("ERROR!","

Error during delivering mail.

\n

E-mail address(es)
$invalid_email_address is(are) not valid e-mail address(es).

\n

Back

"); } else { $content_type="text/plain"; $message=explode("\n",$_POST[message]); foreach($message as $line) $text.=stripslashes(rtrim($line))."\n"; for($i=0;$i<3;$i++) { if($_FILES['atc']['name'][$i]) { $content_type="multipart/mixed;\n charset=\"iso-8859-1\";\n boundary=\"$BOUNDARY\""; $headertext="This is a multi-part message in MIME format.\n\n--$BOUNDARY\nContent-Type: text/plain;\n charset=\"iso-8859-1\"\nContent-Transfer-Encoding: quoted-printable\n\n"; $footertext="--$BOUNDARY--\n"; $fattach=@fopen($_FILES['atc']['tmp_name'][$i],"r"); $attach=chunk_split(base64_encode(@fread($fattach,@filesize($_FILES['atc']['tmp_name'][$i])))); @fclose($fattach); $text.="\n--$BOUNDARY\nContent-Type: ".$_FILES['atc']['type'][$i].";\n charset=\"iso-8859-1\";\n name=\"".$_FILES['atc']['name'][$i]."\"\nContent-Transfer-Encoding: base64\nContent-Disposition: attachment; filename=\"".$_FILES['atc']['name'][$i]."\"\n\n$attach\n"; } } $text=$headertext.$text.$footertext; $headermail="From: $email_address[from]\nReply-to: $email_address[from]\n".(($email_address[cc])?"Cc: $email_address[cc]\n":"").(($email_address[bcc])?"Bcc: $email_address[bcc]\n":"")."MIME-Version: 1.0\nContent-Type: $content_type\nX-Sender-IP-Address: $_SERVER[REMOTE_ADDR]\nX-Mailer: $VER[NAME] $VER[MAJOR].$VER[MINOR]\n"; if($_POST[notification]) $headermail.="Disposition-Notification-To: $email_address[from]\n"; if(@mail("$email_address[to]","$_POST[subject]","$text","$headermail","-f$email_address[from]")) { ShowMessage("SUCCESS!","

Mail correctly delivered.

\n

Back to Inbox

"); } else { ShowMessage("ERROR!","

Error during delivering mail.

\n

Mail command failed.

\n

Back

"); } } echo("


Maintainer:
  Marco Avidano

Thanks to:
  Sven (bug report [ver. 0.6.1])
  Fred Bonani (bug report [ver. 0.6.1, 0.4.4, 0.4.3])
  Steven Albarracin (bug report [ver. 0.6.1, 0.5.3, 0.4.4])
  Simon Hickman (bug report [ver. 0.4.3])
  Philip Chapman-Bell (bug report [ver. 0.2.2])
  Roberto Bertuol

Some information about this program:
  Project name: $VER[NAME]
  Major version: $VER[MAJOR]
  Minor version: $VER[MINOR]
  Build: $VER[BUILD]
  Shortly: $VER[MAJOR].$VER[MINOR]
  Web site: $VER[WEB]
  URL: $VER[URL]

Support my work:
Nameko is totally free. I to not make any profit by its development and maintenance.
If you think it's great and useful, you can make me a little donation through Paypal.
Not a lot: only 2 or 3 Euros (or dollars, it's the same for me), and I'll drink a pineapple juice to yours health!
If you want go to:
https://www.paypal.com/xclick/business=paypal%40wiz.homelinux.net&item_name=Wiz%27s+Shelf+-+Nameko&no_note=1&tax=0¤cy_code=EUR
and fill the Paypal form to make me a donation.
Thank you in advance!

License:
Copyright (C) 2004 Marco Avidano
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
See http://www.gnu.org/licenses/gpl.html for the complete text of the license.

Something else:
  "I will suppose, then, not that a Deity, who is sovereignly good and the fountain
  of truth but that some Malignant Demon, who is at once potent and deceitful,
  has employed all his artifice to deceive me.
  I will suppose that Paradise, the sky, the earth, colors, and all external things,
  are nothing better than the illusions of dreams, by means of which this being
  has laid snares for my credulity.
  I will consider myself as without hands, eyes, flesh, blood, or any of the senses,
  nevetheless I will falsely believe that I am in possession of all of these."
  - Descartes, "Of the Things of Which We May Doubt", 1641.

 

"); if(!FlushTmpDir()) { echo("

An error occour trying to flush the temporary directory.
The attachment download should not work.
You can fix this error creating a directory
called "tmp_nameko" where you put the $VER[NAME] script.
For any request contact $VER[WEB].

\n"); } echo("
Welcome to $VER[NAME] $VER[MAJOR].$VER[MINOR]
Username  
Password / Secret  
E-mail address  
Auth method  
Charset  
Server   "); if($SERVERS) { echo(""); } else { echo(""); } echo("
  .: Utils :. Font size:   |   Colorset:   |   Functions: Login/Logout | Check for new mail | Back to Inbox | Compose new e-mail | "); ?> Credits |
$title $message "); return; } function POP3OpenConnectionAndLogin() { if(!$GLOBALS[SOCK]=@fsockopen($_SESSION[server],110)) return "1"; $rs=@fgets($GLOBALS[SOCK],512); if($_SESSION[auth_type]=="apop") { $rs=split(" ",$rs); $secret=md5(trim($rs[count($rs)-1]).$_SESSION[password]); @fputs($GLOBALS[SOCK],"apop ".$_SESSION[username]." $secret\r\n"); if(!strstr(@fgets($GLOBALS[SOCK],512),"+OK")) return "2"; } else { @fputs($GLOBALS[SOCK],"user ".$_SESSION[username]."\r\n"); $rs=@fgets($GLOBALS[SOCK],512); @fputs($GLOBALS[SOCK],"pass ".$_SESSION[password]."\r\n"); if(!strstr(@fgets($GLOBALS[SOCK],512),"+OK")) return "2"; } return "3"; } function POP3RetrieveHeaders($start) { if($start==0) $start=1; @fputs($GLOBALS[SOCK],"stat\r\n"); $stat=split(" ",@fgets($GLOBALS[SOCK],512)); if($stat[0]!="+OK") return "391"; $_SESSION[MESSAGES][SIZE]=$stat[2]; for($i=$start;$i<($stat[1]+1);$i++) { @fputs($GLOBALS[SOCK],"list $i\r\n"); $list=split(" ",@fgets($GLOBALS[SOCK],512)); if($list[0]!="+OK") return "392"; $_SESSION[MESSAGES][CONTENT][$i][SIZE]=$list[2]; $header=""; fputs($GLOBALS[SOCK],"top $i 0\r\n"); while(($rs=fgets($GLOBALS[SOCK],512))!=".\r\n") $header.=$rs; $_SESSION[MESSAGES][CONTENT][$i][HEADER]=$header; $_SESSION[MESSAGES][CONTENT][$i][READ]=0; $_SESSION[MESSAGES][CONTENT][$i][DELETE]=(-1); } return "31"; } function POP3RetrieveMessage($i) { POP3OpenConnectionAndLogin(); fputs($GLOBALS[SOCK],"retr $i\r\n"); if(strstr(@fgets($GLOBALS[SOCK],512),"+OK")) { while(($rs=@fgets($GLOBALS[SOCK],512))!="\r\n") { } while(($rs=@fgets($GLOBALS[SOCK],512))!=".\r\n") $message[]=trim($rs); } else { $message="Error trying to retrieve message ID #$i"; } if($GLOBALS[SOCK]) POP3CloseConnection(); return $message; } function POP3DeleteMessages() { POP3OpenConnectionAndLogin(); for($i=1,$j=1;$i0) { fputs($GLOBALS[SOCK],"dele $i\r\n"); $del=split(" ",fgets($GLOBALS[SOCK],512)); echo(((trim($del[0])=="+OK")?"Message number $i deleted":"Error deleting message number $i")."
\n"); } else { $new_message_list[$j]=$_SESSION[MESSAGES][CONTENT][$i]; $j++; } } $_SESSION[MESSAGES][CONTENT]=$new_message_list; echo("

Wait while realoading messages...

\n"); if($GLOBALS[SOCK]) POP3CloseConnection(); } function POP3CloseConnection() { @fputs($GLOBALS[SOCK],"quit\r\n"); @fclose($GLOBALS[SOCK]); sleep(1); return; } function MessageParseHeader($header) { for($j=0;$j$hd_content) { $start_enc_tag=$stop_enc_tag=0; $pre_text=$enc_text=$post_text=""; while(1) { if(strstr($hd_content,"=?") && strstr($hd_content,"?=") && substr_count($hd_content,"?")>3) { $start_enc_tag=strpos($hd_content,"=?"); $pre_text=substr($hd_content,0,$start_enc_tag); do { $stop_enc_tag=strpos($hd_content,"?=",$stop_enc_tag)+2; $enc_text=substr($hd_content,$start_enc_tag,$stop_enc_tag); } while (!(substr_count($enc_text,"?")>3)); $enc_text=explode("?",$enc_text,5); switch(strtoupper($enc_text[2])) { case "B": $dec_text=base64_decode($enc_text[3]); break; case "Q": default: $dec_text=quoted_printable_decode($enc_text[3]); $dec_text=str_replace("_"," ",$dec_text); break; } $post_text=substr($hd_content,$stop_enc_tag); if(substr(ltrim($post_text),0,2)=="=?") $post_text=ltrim($post_text); $hd_content=$pre_text.$dec_text.$post_text; $parsed_header[$hd_name]=$hd_content; } else break; } } return $parsed_header; } function MessageRetrieveContent($header,$message) { $content_transfer_encoding=strtolower(trim($header["content-transfer-encoding"])); if($content_transfer_encoding=="") $content_transfer_encoding="8bit"; $message=TextDecode($content_transfer_encoding,$message); $content_type=split(";",$header["content-type"],2); for($i=0;$i$header, "content"=>@implode("\n",$message)); } else { switch(trim(strtolower($content_type[0]))) { case "text/plain": $GLOBALS[parsed_message]["text-plain"]=nl2br(htmlentities(implode("\n",$message))); break; case "text/html": $GLOBALS[parsed_message]["text-html"]=implode("\n",$message); break; case "multipart": $content_type[1]=split(";",$content_type[1]); foreach($content_type[1] as $ct_pars) { if(strstr($ct_pars,"boundary")) { $ct_pars=split("=",trim($ct_pars),2); if(strtolower($ct_pars[0])=="boundary") $boundary=str_replace("\"","",$ct_pars[1]); } } if($boundary) { $parts=MessageSplitMultipart($boundary,$message); foreach($parts as $part) ParsePart($part); } else { $GLOBALS[parsed_message]["text-plain"]="

".$GLOBALS[VER][NAME]." ".$GLOBALS[VER][MAJOR].".".$GLOBALS[VER][MINOR]."
Sorry, I'm unable to read this mail.
Please, report this error to Wiz's Shelf Staff

"; } break; default: $GLOBALS[parsed_message]["attachments"][]=array("header"=>$header, "content"=>@implode("\n",$message)); break; } } return($GLOBALS[parsed_message]); } function MessageSplitMultipart($boundary,$text) { $parts=array(); $tmp=array(); foreach($text as $line) { if(strstr($line,"--$boundary")) { $parts[]=$tmp; $tmp=array(); } else $tmp[]=$line; } for($i=0;$i($addr_len-5)) || ($at_pos>($lastdot_pos-2)) || ($lastdot_pos>$addr_len-3) || (substr_count($addr,"@")>1)) return 0; return 1; } function GetAddressFromFromHeader($addr) { $atpos=strpos($addr,"@"); $minpos=strpos($addr,"<"); $majpos=strpos($addr,">"); $fromstart=0; $fromend=strlen($addr); if($minpos<$atpos && $majpos>$atpos) { $fromstart=$minpos+1; $fromend=$majpos; } return substr($addr,$fromstart,$fromend-$fromstart); } function FlushTmpDir() { if(!is_dir("tmp_nameko")) @mkdir("tmp_nameko",0700); if(is_dir("tmp_nameko")) { $tmpdir=opendir("tmp_nameko"); while(($tmpfile=readdir($tmpdir))!=false) { if(($tmpfile!="..")&&($tmpfile!=".")) { $tmpfiledate=filectime("tmp_nameko/$tmpfile"); if((filectime("tmp_nameko/$tmpfile"))<(time()-300)) @unlink("tmp_nameko/$tmpfile"); } } closedir($tmpdir); return 1; } else { return 0; } } ?>