From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Francesco =?utf-8?Q?Potort=C3=AC?= Newsgroups: gmane.emacs.devel Subject: Re: Patch for PHP5 support for etags Date: Sun, 17 Apr 2011 15:17:33 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: dough.gmane.org 1303046335 23042 80.91.229.12 (17 Apr 2011 13:18:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 17 Apr 2011 13:18:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: james borden Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 17 15:18:51 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QBRsI-0002Ne-NU for ged-emacs-devel@m.gmane.org; Sun, 17 Apr 2011 15:18:51 +0200 Original-Received: from localhost ([::1]:49880 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBRsI-000207-57 for ged-emacs-devel@m.gmane.org; Sun, 17 Apr 2011 09:18:50 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBRs9-0001zq-Kb for emacs-devel@gnu.org; Sun, 17 Apr 2011 09:18:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QBRs7-0007L1-HY for emacs-devel@gnu.org; Sun, 17 Apr 2011 09:18:41 -0400 Original-Received: from blade3.isti.cnr.it ([194.119.192.19]:54403) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBRs7-0007Kg-54 for emacs-devel@gnu.org; Sun, 17 Apr 2011 09:18:39 -0400 Original-Received: from conversionlocal.isti.cnr.it by mx.isti.cnr.it (PMDF V6.5-x5 #31825) id <01O086R0T9F4RLZ0UD@mx.isti.cnr.it> for emacs-devel@gnu.org; Sun, 17 Apr 2011 15:17:35 +0200 (MEST) Original-Received: from tucano.isti.cnr.it (tucano.isti.cnr.it [146.48.81.102]) by mx.isti.cnr.it (PMDF V6.5-x5 #31826) with ESMTPSA id <01O086QZHSYKRZMR8R@mx.isti.cnr.it>; Sun, 17 Apr 2011 15:17:33 +0200 (MEST) Original-Received: from pot by tucano.isti.cnr.it with local (Exim 4.75) (envelope-from ) id 1QBRr3-0008P8-OX; Sun, 17 Apr 2011 15:17:33 +0200 In-reply-to: X-INSM-ip-source: 146.48.81.102 Auth Done X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 194.119.192.19 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138539 Archived-At: >Etags in the current Emacs distribution (23.3) does not support the = OOP >syntax of PHP5. I found a patch at >http://old.nabble.com/-Patch--etags-support-for-php5-td12843865.html= and >applied it to etags.c found in the lib-src of the emacs source code.= This >patch applies, compiles and works as-is on my Mac OS X 10.6.7 machin= e. It >produces a very nice TAGS file for my PHP projects. I think this pat= ch would >make Emacs much more attractive to PHP coders. My question is, why w= as this >patch not incorporated into the main emacs distribution? I will gla= dly >offer any help or support to make this happen! I have this old mail in my archive, to which I never got an answer. Date: 12 Oct 2009 21:47:01 +0200 =46rom: Francesco Potort=C3=AC To: Jordi Guti=C3=A9rrez Hermoso , Lennart Borgman CC: Emacs-devel@gnu.org In-reply-to: <25857155.post@talk.nabble.com> (jordigh@gmail.com) Subject: Re: [Fwd: [Patch] etags support for php5] >Lennart Borgman (gmail) wrote: >> Was this ever added to etags? > >Indeed, I'd like to know too. Was this ever added to etags? It doesn= 't look >like it was, two years later. >- Jordi G. H. No, it wasn't. I am guilty of not having solicited a response. This= is a mail I sent long ago to which I did not receive any answer. Again,= my fault to have forgotten this. Would someone please reply? ________________________________________________________________ Date: 17 Aug 2008 19:47:47 +0200 =46rom: Francesco Potorti` To: Lennart Borgman , Bas Kok Cc: Stefan Monnier In-reply-to: Subject: Re: [Lennart Borgman (gmail)] [Fwd: [Patch] etags support fo= r php5] Organization: ISTI-CNR, via Moruzzi 1, I-56124 Pisa, +39-0503153058 Dear Lennart and Bas, thank you for your patch to etags to support php5 keywords, and sorry for the delay in checking it. I only managed to test it now, during = my vacations. However, I obtain strange results from my tests, so I would ask you t= o send me a php5 source file together with the expected results. Just to let you know, I tried your patch on the appended file. Again= , sorry for the delay, and hope you can follow up to this. =3D=3D=3DFile ~/gnu/etags/sendmail.php=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D array( "modifiable" =3D> true, "values" =3D> array( "iso-8859-1", "iso-8859-15", "utf-8", "utf-16" ) ), "content-transfer-encoding" =3D> array( "modifiable" =3D> true, "values" =3D> array( "7bit", "8bit", "quoted-printable" ) ) ); private $attachmentProperties=3Darray( "content-type" =3D> array( "modifiable" =3D> false, "values" =3D> array( "application/octet-stream" ) ), "content-transfer-encoding" =3D> array( "modifiable" =3D> false, "values" =3D> array( "base64" ) ), "content-disposition" =3D> array( "modifiable" =3D> true, "values" =3D> array( "attachment", "inline" ) ) ); private static $relatedProperties=3Darray( "content-transfer-encoding" =3D> array( "modifiable" =3D> false, "values" =3D> array( "base64" ) ) ); private $html; private $text; private $related; private $attachments; public static function valid_eMailAddress($eMailAddress) { if(ereg("^[^@ ]+@[^@ ]+\.[^@ ]+$", $eMailAddress)) return true; else return false; } public static function validContentId($contentId) { if(ereg("^[a-zA-Z0-9]+$", $contentId)) return true; else return false; } public static function validContentKey($contentKey) { if(ereg("^[a-zA-Z0-9]+$", $contentKey)) return true; else return false; } public static function mime_content_type($filename) { $mime=3Darray( '.3dmf' =3D> 'x-world/x-3dmf', '.a' =3D> 'application/octet-stream', '.aab' =3D> 'application/x-authorware-bin', '.xwd' =3D> 'image/x-xwd', '.xyz' =3D> 'chemical/x-pdb', '.z' =3D> 'application/x-compressed', '.zip' =3D> 'application/x-zip-compressed', '.zoo' =3D> 'application/octet-stream', '.zsh' =3D> 'text/x-script.zsh', '.css' =3D> 'text/css' ); return $mime[strrchr($filename, '.')]; } private $from; private $to; private $subject; private $finalized; private $headerMessage; private $bodyMessage; private $boundaries; public function __construct($from, $to, $subject=3Dself::defaultSub= ject) { // set from if(!self::valid_eMailAddress($from)) die(self::eMailAddressErrorMessage); else $this->from=3D$from; // set to if(!self::valid_eMailAddress($to)) die(self::eMailAddressErrorMessage); else $this->to=3D$to; // set subject $this->subject=3D$subject; // set text $this->text=3Darray( "message" =3D> self::defaultTextMessage, "properties" =3D> array( "charset" =3D> self::$messageProperties["charset"]["values"][= 0], "content-transfer-encoding" =3D> self::$messageProperties["co= ntent-transfer-encoding"]["values"][0] ) ); // set html $this->html=3Darray( "message" =3D> self::defaultHtmlMessage, "properties" =3D> array( "charset" =3D> self::$messageProperties["charset"]["values"][= 0], "content-transfer-encoding" =3D> self::$messageProperties["co= ntent-transfer-encoding"]["values"][1] ) ); // set related and attachments $this->related=3Darray(); $this->attachments=3Darray(); // set finalizater counter $this->finalized=3Dfalse; $this->headerMessage=3D""; $this->bodyMessage=3D""; $this->boundaries=3Darray( "multipart/alternative" =3D> md5(uniqid(microtime())), "multipart/related" =3D> md5(uniqid(microtime())), "multipart/mixed" =3D> md5(uniqid(microtime())) ); } public function setTo($to, &$errorString) { if(self::valid_eMailAddress($to)) { $this->to=3D$to; return true; } else { $errorString=3DeMailAddressErrorMessage; return false; } } public function setFrom($from, &$errorString) { if(self::valid_eMailAddress($from)) { $this->from=3D$from; return true; } else { $errorString=3DeMailAddressErrorMessage; return false; } } public function setSubject($subject=3Dself::defaultSubject) { $this->subject=3D$subject; } public function setTextMessage($textMessage=3Dself::defaultTextMess= age) { $this->text["message"]=3D$textMessage; } public function setTextMessageProperty($key, $value, &$errorString)= { $key=3Dstrtolower($key); $value=3Dstrtolower($value); if(isset(self::$messageProperties[$key])) { if(in_array($value, self::$messageProperties[$key]["values"])) { if(self::$messageProperties[$key]["modifiable"]) { $this->text["properties"][$key]=3D$value; return true; } else { $errorString=3D"Il valore della propriet? indicata non ? modifi= cabile."; return false; } } else { $errorString=3D"Il valore indicato per questa propriet? non ? va= lido."; return false; } } else { $errorString=3D"Non esiste questa propriet? per i messaggi html."= ; return false; } } public function setHtmlMessage($htmlMessage=3Dself::defaultHtmlMess= age) { $this->html["message"]=3D$htmlMessage; } public function setHtmlMessageProperty($key, $value, &$errorString)= { $key=3Dstrtolower($key); $value=3Dstrtolower($value); if(isset(self::$messageProperties[$key])) { if(in_array($value, self::$messageProperties[$key]["values"])) { if(self::$messageProperties[$key]["modifiable"]) { $this->html["properties"][$key]=3D$value; return true; } else { $errorString=3D"Il valore della propriet? indicata non ? modifi= cabile."; return false; } } else { $errorString=3D"Il valore indicato per questa propriet? non ? va= lido."; return false; } } else { $errorString=3D"Non esiste questa propriet? per i messaggi html."= ; return false; } } public function addRelated($fileName, $relatedKey, $contentId, &$er= rorString) { if(is_file($fileName)) { if($fileHandle=3Dfopen($fileName, "r")) { if(self::validContentId($contentId)) { if(!isset($this->related[$relatedKey])) { if(self::validContentKey($relatedKey)) { $this->related[$relatedKey]=3Darray( "fileName" =3D> basename($fileName), "properties" =3D> array( "content-type" =3D> self::mime_content_type($fileName), "content-transfer-encoding" =3D> self::$relatedProperties["co= ntent-transfer-encoding"]["values"][0], "content-id" =3D> $contentId ), "source" =3D> base64_encode( fread($fileHandle, filesize($fileName)) ) ); return true; } else { $errorString=3D"L' id specificato non ? valido."; return false; } } else { $errorString=3D"La chiave specificata ? gi? associata ad un al= tro related."; return false; } } else { $errorString=3D"La chiave specificata per il related non ? vali= da."; return false; } } else { $errorString=3D"Non ? possibile aprire il file indicato."; return false; } } else { $errorString=3D"Il nome del file indicato non ? valido."; return false; } } public function setRelatedProperty($relatedKey, $key, $value, &$err= orString) { $key=3Dstrtolower($key); $value=3Dstrtolower($value); =20 if(isset(self::$relatedProperties[$key])) { if(in_array($value, self::$relatedProperties[$key]["values"])) { if(self::$relatedProperties[$key]["modifiable"]) { if(isset($this->related[$relatedKey])) { $this->related[$relatedKey]["properties"][$key]=3D$value; return true; } else { $errorString=3D"Il related indicato non esiste."; return false; } } else { $errorString=3D"Il valore della propriet? indicata non ? modifi= cabile."; return false; } } else { $errorString=3D"Il valore indicato per questa propriet? non ? va= lido."; return false; } } else { $errorString=3D"Non esiste questa propriet? per i related."; return false; } } public function addAttachment($fileName, $attachmentKey, &$errorStr= ing) { if(is_file($fileName)) { if($fileHandle=3Dfopen($fileName, "r")) { if(self::validContentKey($attachmentKey)) { if(!isset($this->attachments[$attachmentKey])) { $this->attachments[$attachmentKey]=3Darray( "fileName" =3D> basename($fileName), "properties" =3D> array( "content-type" =3D> self::$attachmentProperties["content-type= "]["values"][0], "content-disposition" =3D> self::$attachmentProperties["conte= nt-disposition"]["values"][0], "content-transfer-encoding" =3D> self::$attachmentProperties[= "content-transfer-encoding"]["values"][0] ), "source" =3D> base64_encode( fread($fileHandle, filesize($fileName)) ) ); return true; } else { $errorString=3D"La chiave specificata ? gi? associata ad un al= tro allegato."; return false; } } else { $errorString=3D"La chiave specificata per l'allegato non ? vali= da."; return false; } } else { $errorString=3D"Non ? possibile aprire il file indicato."; return false; } } else { $errorString=3D"Il nome del file indicato non ? valido."; return false; } } public function setAttachmentProperty($attachmentKey, $key, $value,= &$errorString) { $key=3Dstrtolower($key); $value=3Dstrtolower($value); if(isset(self::$attachmentProperties[$key])) { if(in_array($value, self::$attachmentProperties[$key]["values"]))= { if(self::$attachmentProperties[$key]["modifiable"]) { if(isset($this->attachments[$attachmentKey])) { $this->attachments[$attachmentKey]["properties"][$key]=3D$valu= e; return true; } else { $errorString=3D"L'allegato indicato non esiste."; return false; } } else { $errorString=3D"Il valore della propriet? indicata non ? modifi= cabile."; return false; } } else { $errorString=3D"Il valore indicato per questa propriet? non ? va= lido."; return false; } } else { $errorString=3D"Non esiste questa propriet? per gli allegati."; return false; } } public function finalize(&$errorString) { if(!$this->finalized) { $this->headerMessage=3D"from: ".($this->from)."\n"; $this->headerMessage.=3D"to: ".($this->to)."\n"; $this->headerMessage.=3D"subject: ".($this->subject)."\n"; $this->headerMessage.=3D"mime-version: 1.0\n"; if(($countAttachments=3Dcount($this->attachments))>0) { $this->headerMessage.=3D"content-type: multipart/mixed; boundary= =3D\"".($this->boundaries["multipart/mixed"])."\"\n\n"; $this->headerMessage.=3Dself::defaultHeaderMessage; $this->headerMessage.=3D"\n\n"; $this->bodyMessage=3D"--".($this->boundaries["multipart/mixed"])= ."\n"; if(($countRelated=3Dcount($this->related))>0) { $this->bodyMessage.=3D"content-type: multipart/related; type= =3D\"multipart/alternative\"; boundary=3D\"".($this->boundaries["mult= ipart/related"])."\"\n\n"; $this->bodyMessage.=3D"--".($this->boundaries["multipart/relate= d"])."\n"; $this->bodyMessage.=3D"content-type: multipart/alternative; bou= ndary=3D\"".($this->boundaries["multipart/alternative"])."\"\n\n"; $this->createMultipartAlternativeMessage($this->boundaries["mul= tipart/alternative"]); $this->bodyMessage.=3D"--".($this->boundaries["multipart/altern= ative"])."--\n\n"; // aggiungere i related e chiudere $relatedCounter=3D0; while(list($key,)=3Deach($this->related)) { $relatedCounter++; =20 $this->bodyMessage.=3D"--".$this->boundaries["multipart/relate= d"]."\n"; $this->createMultipartRelatedMessage($key); if($relatedCounter!=3D$countRelated) $this->bodyMessage.=3D"--= ".($this->boundaries["multipart/related"])."\n"; else $this->bodyMessage.=3D"--".($this->boundaries["multipart/= related"])."--\n\n"; } } else { $this->bodyMessage.=3D"content-type: multipart/alternative; bou= ndary=3D\"".($this->boundaries["multipart/alternative"])."\"\n\n"; $this->createMultipartAlternativeMessage(); $this->bodyMessage.=3D"--".($this->boundaries["multipart/altern= ative"])."--\n\n"; } $attachmentsCounter=3D0; while(list($key,)=3Deach($this->attachments)) { $attachmentsCounter++; $this->bodyMessage.=3D"--".($this->boundaries["multipart/mixed"= ])."\n"; $this->createMultipartMixedMessage($key); if($attachmentsCounter!=3D$countAttachments) $this->bodyMessage= .=3D"--".($this->boundaries["multipart/mixed"])."\n"; else $this->bodyMessage.=3D"--".($this->boundaries["multipart/m= ixed"])."--\n\n"; } } else { if(($countRelated=3Dcount($this->related))>0) { $this->headerMessage.=3D"content-type: multipart/related; type= =3D\"multipart/alternative\"; boundary=3D\"".($this->boundaries["mult= ipart/related"])."\"\n\n"; $this->headerMessage.=3Dself::defaultHeaderMessage; $this->headerMessage.=3D"\n\n"; $this->bodyMessage=3D"--".($this->boundaries["multipart/related= "])."\n"; $this->bodyMessage.=3D"content-type: multipart/alternative; bou= ndary=3D\"".($this->boundaries["multipart/alternative"])."\"\n\n"; $this->createMultipartAlternativeMessage(); $this->bodyMessage.=3D"--".($this->boundaries["multipart/altern= ative"])."--\n\n"; $relatedCounter=3D0; while(list($key,)=3Deach($this->related)) { $relatedCounter++; $this->bodyMessage.=3D"--".$this->boundaries["multipart/relate= d"]."\n"; $this->createMultipartRelatedMessage($key); if($relatedCounter!=3D$countRelated) $this->bodyMessage.=3D"--= ".($this->boundaries["multipart/related"])."\n"; else $this->bodyMessage.=3D"--".($this->boundaries["multipart/= related"])."--\n\n"; } } else { $this->headerMessage.=3D"content-type: multipart/alternative; b= oundary=3D\"".($this->boundaries["multipart/alternative"])."\"\n\n"; $this->headerMessage.=3Dself::defaultHeaderMessage; $this->headerMessage.=3D"\n\n"; $this->createMultipartAlternativeMessage(); $this->bodyMessage.=3D"--".($this->boundaries["multipart/altern= ative"])."--"; } } $this->finalized=3Dtrue; return true; } else { $errorString=3D"Al momento non ? possibile finalizzare."; return false; } } private function createMultipartAlternativeMessage() { $multipartAlternativeBoundary=3D$this->boundaries["multipart/alter= native"]; $this->bodyMessage.=3D"--$multipartAlternativeBoundary\n"; $this->bodyMessage.=3D"content-type: text/plain; charset=3D\"".($t= his->text["properties"]["charset"])."\"\n"; $this->bodyMessage.=3D"content-transfer-encoding: ".($this->text["= properties"]["content-transfer-encoding"])."\n\n"; $this->bodyMessage.=3D$this->text["message"]; $this->bodyMessage.=3D"\n\n"; $this->bodyMessage.=3D"--$multipartAlternativeBoundary\n"; $this->bodyMessage.=3D"content-type: text/html; charset=3D\"".($th= is->html["properties"]["charset"])."\"\n"; $this->bodyMessage.=3D"content-transfer-encoding: ".($this->html["= properties"]["content-transfer-encoding"])."\n\n"; $this->bodyMessage.=3D$this->html["message"]; $this->bodyMessage.=3D"\n\n"; } private function createMultipartRelatedMessage($key) { $obj=3D$this->related[$key]; $this->bodyMessage.=3D"content-type: ".($obj["properties"]["conten= t-type"])."; name=3D\"".($obj["fileName"])."\"\n"; $this->bodyMessage.=3D"content-transfer-encoding: ".($obj["propert= ies"]["content-transfer-encoding"])."\n"; $this->bodyMessage.=3D"content-id: <".($obj["properties"]["content= -id"]).">\n\n"; $this->bodyMessage.=3D$obj["source"]; $this->bodyMessage.=3D"\n\n"; } private function createMultipartMixedMessage($key) { $obj=3D$this->attachments[$key]; $this->bodyMessage.=3D"content-type: ".($obj["properties"]["conten= t-type"])."; name=3D\"".($obj["fileName"])."\"\n"; $this->bodyMessage.=3D"content-transfer-encoding: ".($obj["propert= ies"]["content-transfer-encoding"])."\n"; $this->bodyMessage.=3D"content-disposition: ".($obj["properties"][= "content-disposition"])."; filename=3D\"".($obj["fileName"])."\"\n\n"= ; $this->bodyMessage.=3D$obj["source"]; $this->bodyMessage.=3D"\n\n"; } public function getSource(&$errorString) { if($this->finalized) { return ($this->headerMessage).($this->bodyMessage); } else { $errorString=3D"Ancora non ? avvenuta la finalizzazione."; return false; } } public function sendMail(&$errorString) { if($this->finalized) { mail($this->to, $this->subject, $this->bodyMessage, $this->header= Message); $this->finalized=3Dfalse; return true; } else { $errorString=3D"Ancora non ? avvenuta la finalizzazione."; return false; } } } ?> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D