login=$login; $this->password=$password; if (!empty($server)) $this->servername=$server; if (!empty($proto)) $this->protocol=$proto; if (!empty($folder)) $this->folder=$folder; $this->mbox=-1; $this->Messages=0; $this->dispos=0; } /* function Open used to establish a connection to the mail server. Once connected succesfully, it retrieves the number of messages, sets the mailbox identifier, and returns true. If unsuccesfull, returns false */ function open() { $fqsn="{".$this->servername.":".$this->protocol."}".$this->folder; $_mbox=imap_open($fqsn,$this->login,$this->password); if ($_mbox) { $_headers=imap_headers($_mbox); $this->Messages=count($_headers); $this->mbox=$_mbox; return true; } else { return false; } } /* Function Close used to close the connection to the server */ function close() { imap_close($this->mbox); } /* Internal function _decodeString used to decode a string from bas64 or quoted_printable thanks to PHP.net user comments */ function _decodeString($theString) { if(ereg("=\?.{0,}\?[Bb]\?",$theString)){ $arrHead=split("=\?.{0,}\?[Bb]\?",$theString); while(list($key,$value)=each($arrHead)){ if(ereg("\?=",$value)){ $arrTemp=split("\?=",$value); $arrTemp[0]=base64_decode($arrTemp[0]); $arrHead[$key]=join("",$arrTemp); } } $strHead=join("",$arrHead); } elseif(ereg("=\?.{0,}\?[Qq]\?",$theString)){ $strHead=quoted_printable_decode($theString); $strHead=ereg_replace("=\?.{0,}\?[Qq]\?","",$strHead); $strHead=ereg_replace("\?=","",$strHead); } else { $strHead=$theString; } return $strHead; } /* function getMessage retrieves the message given as parameter. */ function getMessage($msgNo) { // sets the internal message pointer $this->currMsg=$msgNo; // creates a new instance of clsMessage $theMessage = new clsMessage; // get the header info for the message $_theHeader=imap_headerinfo($this->mbox,$msgNo); // ---- Start Block /* This block sets the from field */ $_from=array(); while (list($k,$v)=each($_theHeader->from)){ if (!empty($v->personal)) { $strHead=$this->_decodeString($v->personal); $_address="\"".$strHead."\" <".$v->mailbox."@".$v->host.">"; } else $_address=$v->mailbox."@".$v->host; $_from[]="$_address"; } $theMessage->from=implode(";",$_from); // ---- End Block // ---- Start Block /* This block sets the to field */ $_to=array(); if (is_array($_theHeader->to)) { while (list($k,$v)=each($_theHeader->to)){ if (!empty($v->personal)) { $strHead=$this->_decodeString($v->personal); $_address="\"".$strHead."\" <".$v->mailbox."@".$v->host.">"; } else $_address=$v->mailbox."@".$v->host; $_to[]=$_address; } } else $_to[]=$_theHeader->to; $theMessage->to=implode(";",$_to); // ---- End Block // ---- Start Block /* This block sets the cc field */ $_cc=array(); if (is_array($_theHeader->cc)) { while (list($k,$v)=each($_theHeader->cc)){ if (!empty($v->personal)) { $strHead=$this->_decodeString($v->personal); $_address="\"".$strHead."\" <".$v->mailbox."@".$v->host.">"; } else $_address=$v->mailbox."@".$v->host; $_cc[]=$_address; } } else $_cc[]=$_theHeader->cc; $theMessage->cc=implode(";",$_cc); // ---- End Block // ---- Start Block /* This block sets the cco field */ $_cco=array(); if (is_array($_theHeader->cco)) { while (list($k,$v)=each($_theHeader->cco)){ if (!empty($v->personal)) { $strHead=$this->_decodeString($v->personal); $_address="\"".$strHead."\" <".$v->mailbox."@".$v->host.">"; } else $_address=$v->mailbox."@".$v->host; $_cco[]=$_address; } } else $_cco[]=$_theHeader->cco; $theMessage->cco=implode(";",$_cco); // ---- End Block // sets date, subject and msgID fields $theMessage->date=$_theHeader->udate; $theMessage->subject=$_theHeader->subject; $theMessage->msgID=$_theHeader->message_id; // Fetchs the structure for the message $_theStructure=imap_fetchstructure($this->mbox,$msgNo); $theMessage->size = ceil(($_theStructure->bytes/1024)); // tries to guess if the message has or not any attachment. if ((count($_theStructure->parts)==2) and (($_theStructure->parts[0]->type==0 and $_theStructure->parts[0]->subtype=="PLAIN") and ($_theStructure->parts[1]->type==0 and $_theStructure->parts[1]->subtype=="HTML"))) { $theMessage->hasAttachs=0; } else { $theMessage->hasAttachs=1; } // if the message has any attach, get them if ($theMessage->hasAttachs==1) { $this->_getAttachments($theMessage,$_theStructure,1); } $sections = $this->parse($_theStructure); if(count($theMessage->attachments)>1) { $theMessage->body = imap_fetchbody($this->mbox, $msgNo, $sections[0]["pid"]); } else { // sets the body wenn kein attachment $theMessage->body = imap_body($this->mbox,$msgNo); } // returns the message. return $theMessage; } /* internal function _getAttachments This is a recursive function, used to traversing the message to gaet all the attachments to it. */ function _getAttachments(&$theMessage,$part,$id){ // How many attachments had we processed so far? $ans=sizeof($theMessage->attachments); // if this part has an attach, increase the level. if($part->ifdisposition){ $this->dispos++; } switch($part->type){ // depending on what kind of part we have here... case 1: // is this a multipart type? so, skip that... if((strtolower($part->subtype)=="mixed") or (strtolower($part->subtype)=="alternative") or (strtolower($part->subtype)=="related")) break; default: // Otherwise... // How many attachments had we processed so far? $an = sizeof($theMessage->attachments); if($part->ifdparameters){ // do we have any disposition parameter in this part? $dpara = $part->dparameters; // get the parameters for ($v=0;$vattribute)) // is a filename? $fname = $dpara[$v]->value; // so, get it... } } if($part->ifparameters){ // do we have any disposition parameter in this part? if(empty($fname)){ // is $fname empty? so... $para = $part->parameters; // get parameters for ($v=0;$vattribute)) // do we have a file name ? $fname = $para[$v]->value; // so get it... } } } if ($this->dispos<=1) { // the attachment level is main? if(empty($fname)) $fname = "Unknown"; // no file name... :( $theMessage->attachments[$an]->id = ($an+1); // sets the attachment ID $theMessage->attachments[$an]->part = $id; // sets the attachment part number // let's get the mime part number, in the form x.y[.z] $_thePartsArray=explode(".",$id); $_theParts=array(); for ($_theIndex=1; $_theIndexattachments[$an]->mime_part=$_theMimePart; $theMessage->attachments[$an]->filename = $fname; $theMessage->attachments[$an]->type=$part->type; $theMessage->attachments[$an]->subtype=$part->subtype; $theMessage->attachments[$an]->dispos=$this->dispos; $theMessage->attachments[$an]->disposition=$part->disposition; $theMessage->attachments[$an]->size=$part->bytes; $theMessage->attachments[$an]->encoding=$part->encoding; $theMessage->attachments[$an]->mime_type=$this->_get_mime_type($part); $theMessage->attachments[$an]->content=imap_fetchbody($this->mbox,$this->currMsg,$_theMimePart); } break; } // now, we'll recurse with all the parts found so far... for($x = 0; $x < count($part->parts); $x++){ $this->_getAttachments($theMessage,$part->parts[$x], $id.".".($x+1)); } if($part->ifdisposition) $this->dispos--; } /* internal function _get_mime_type used to get a text representation of the mime part */ 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"; } /* internal function _get_encoding not implemented yet. reserved for future extensions. */ function _get_enconding(&$structure) { } // parse message body function parse($structure){ // Thanks to Harry Wiens global $type; global $encoding; // create an array to hold message sections $ret = array(); // split structure into parts $parts = $structure->parts; /* iterate through parts and create an array whose every element represents one part each element is itself an associative array with keys representing the - part number - part type - encoding - disposition - size - filename */ for($x=0; $xtype == "") $_this->type = 0; $ret[$x]["type"] = $type[$_this->type] . "/" . strtolower($_this->subtype); // default to 7bit if ($_this->encoding == "") $_this->encoding = 0; $ret[$x]["encoding"] = $encoding[$_this->encoding]; $ret[$x]["size"] = strtolower($_this->bytes); $ret[$x]["disposition"] = strtolower($_this->disposition); if (strtolower($_this->disposition) == "attachment") { $params = $_this->dparameters; foreach ($params as $p) { if($p->attribute == "FILENAME") { $ret[$x]["name"] = $p->value; break; } } } return $ret; } } } ?> Emil | Reservierungen

Loading...
RESTAURANT
DE
DE
EN
1/6
<< January 2021
>>
MO TU WE TH FR SA SU
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20
21
22
23
24
25 26
27
28
29
30
31
             
RESTAURANT
DE
DE
EN
2/6
Time
Number of persons
RESTAURANT
DE
DE
EN
3/6
Personal data
Forename:
 
Surname:
 
E-Mail:
 
Phone:
RESTAURANT
DE
DE
EN
4/6
Special foods
RESTAURANT
DE
DE
EN
5/6
Comment
Newsltter
Subscribe newsletter
RESTAURANT
DE
DE
EN
6/6
Summary
Date:
 
Persons:
 
Foods:
 
Name:
 
E-Mail:
 
Phone:
Comment
* Durch das Klicken auf "Reservieren" stimmen Sie unseren Datenschutzbestimmungen zu.