source: trunk/expressoMail1_2/inc/class.exporteml.inc.php @ 1040

Revision 1040, 19.3 KB checked in by amuller, 15 years ago (diff)

Ticket #559 - Atualização de download de arquivos e sessão

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2if(!isset($GLOBALS['phpgw_info'])){
3        $GLOBALS['phpgw_info']['flags'] = array(
4                'currentapp' => 'expressoMail1_2',
5                'nonavbar'   => true,
6                'noheader'   => true
7        );
8}
9require_once '../header.inc.php';
10/***************************************************************************************\
11* Export EML Format Message Mail                                                                                                                *
12* Written by Nilton Neto (Celepar) <niltonneto@celepar.pr.gov.br>                                               *
13* ------------------------------------------------------------------------------------  *
14*  This program is free software; you can redistribute it and/or modify it                              *
15*   under the terms of the GNU General Public License as published by the                               *
16*  Free Software Foundation; either version 2 of the License, or (at your                               *
17*  option) any later version.                                                                                                                   *
18\****************************************************************************************/
19// BEGIN CLASS
20class ExportEml
21{
22        var $msg;
23        var $folder;
24        var $mbox_stream;
25       
26        function connectImap(){
27       
28                $username = $_SESSION['phpgw_info']['expressomail']['user']['userid'];
29                $password = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
30                $imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
31                $imap_port      = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort'];
32               
33                if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes')
34                {
35                        $imap_options = '/tls/novalidate-cert';
36                }
37                else
38                {
39                        $imap_options = '/notls/novalidate-cert';
40                }
41                $this->mbox_stream = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$this->folder, $username, $password);
42        }
43       
44        //export message to EML Format
45        function parseEml($header, $body)       
46        {               
47                $sEmailHeader = $header;
48                $sEmailBody = $body;
49                $sEMail = $sEmailHeader . "\r\n\r\n" . $sEmailBody;             
50                return $sEMail;
51        }
52       
53        // create EML File.
54        // Funcao alterada para tratar a exportacao
55        // de mensagens arquivadas localmente.
56        // Rommel Cysne (rommel.cysne@serpro.gov.br)
57        // em 17/12/2008.
58        function createFileEml($sEMLData, $tempDir, $id, $subject=false, $i)
59    {
60        if($id)
61        {
62            $header    = imap_headerinfo($this->mbox_stream, imap_msgno($this->mbox_stream, $id), 80, 255);
63            $subject = $this->decode_subject($header->fetchsubject);
64           
65            if (strlen($subject) > 60)
66                $subject = substr($subject, 0, 59);
67 
68                        //$subject = ereg_replace('/', '\'', $subject);
69                        $from = "áàâãäéèêëíìîïóòôõöúùûüç?\"!@#$%š&*()-=+Ž`[]{}~^,<>;:/?\\|¹²³£¢¬§ªº°ÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ";
70                        $to =   "aaaaaeeeeiiiiooooouuuuc__________________________________________AAAAAEEEEIIIIOOOOOUUUUC";
71                        $subject = strtr($subject,$from,$to);
72            $file =    $subject."_".$id.".eml";
73                } else{
74                        // Se mensagem for arquivada localmente, $subject (assunto da mensagem)
75                        // sera passado para compor o nome do arquivo .eml;
76
77                        if($subject){
78                                $from = "áàâãäéèêëíìîïóòôõöúùûüç?\"!@#$%š&*()-=+Ž`[]{}~^,<>;:/?\\|¹²³£¢¬§ªº°ÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ";
79                                $to =   "aaaaaeeeeiiiiooooouuuuc__________________________________________AAAAAEEEEIIIIOOOOOUUUUC";
80                                $subject = strtr($subject,$from,$to);
81                                //$subject = ereg_replace(':', '_', $subject);
82                                //$subject = ereg_replace('/', '_', $subject);
83                                $file = $subject."_".$i.".eml";
84                        } else{
85                                $file = "email_".$GLOBALS['phpgw']->session->sessionid.".eml";
86        }   
87        }
88       
89        $f = fopen($tempDir.'/'.$file,"w");
90        if(!$f)
91            return False;
92       
93        fputs($f,$sEMLData);
94        fclose($f);
95       
96        return $file;
97    }
98
99        function createFileZip($files, $tempDir){               
100                $tmp_zip_filename = "email_".$GLOBALS['phpgw']->session->sessionid.".zip";
101                $command = "cd " . escapeshellarg($tempDir) . " && nice zip -m9 " . escapeshellarg($tmp_zip_filename) . " " .  escapeshellcmd($files);
102                if(!exec($command)) {
103                        $command = "cd " .  escapeshellarg($tempDir) . " && rm ".escapeshellcmd($files)." ". escapeshellarg($tmp_zip_filename);
104                        exec($command);
105                        return null;
106                }
107               
108                return $tmp_zip_filename;
109                               
110        }
111
112        function export_all($params){
113               
114                $this->folder = $params['folder'];
115                $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8");
116                $fileNames = "";
117                $tempDir = ini_get("session.save_path");
118                $this->connectImap();
119               
120                $msgs = imap_search($this->mbox_stream,"ALL",SE_UID);
121                foreach($msgs as $nMsgs){
122                        $header         = $this-> getHeader($nMsgs);                                                                   
123                        $body           = $this-> getBody($nMsgs);                     
124                        $sEMLData       = $this -> parseEml($header, $body);
125                        $fileName       = $this -> CreateFileEml($sEMLData, $tempDir,$nMsgs);
126                        if(!$fileName)  {
127                                $error = True;                                 
128                                break;
129                        }
130                        else
131                                $fileNames .= "\"".$fileName."\" ";                     
132                       
133                }
134                imap_close($this->mbox_stream);
135               
136                $nameFileZip = 'False';                 
137                if($fileNames && !$error) {                     
138                        $nameFileZip = $this -> createFileZip($fileNames, $tempDir);
139                        if($nameFileZip)                       
140                                $file = $tempDir.'/'.$nameFileZip;
141                        else {
142                                $file = false;
143                        }                                                               
144                }
145                else
146                        $file = false;
147                       
148                return $file;
149               
150        }
151
152        // Funcao alterada para tratar a exportacao
153        // de mensagens arquivadas localmente.
154        // Rommel Cysne (rommel.cysne@serpro.gov.br)
155        // em 17/12/2008.
156        function makeAll($params) {
157                // Exportacao de mensagens arquivadas localmente
158                if($params['l_msg'] == "t"){
159                // Recebe todos os subjects e bodies das mensagens locais selecionadas para exportacao
160                // e gera arrays com os conteudos separados;
161                $array_mesgs = explode('@@',$params['mesgs']);
162                $array_subjects = explode('@@',$params['subjects']);
163            $array_ids = explode(',', $params['msgs_to_export']);
164            $tempDir = ini_get("session.save_path");
165                        // Para cada mensagem selecionada sera gerado um arquivo .eml cujo titulo sera o assunto (subject) da mesma;
166                        include_once("class.imap_functions.inc.php");
167                        $imapf = new imap_functions();
168                foreach($array_ids as $i=>$id) {
169                                $sEMLData=$imapf->treat_base64_from_post($array_mesgs[$i]);
170                                $fileName=$this->CreateFileEml($sEMLData, $tempDir,'',$array_subjects[$i],$i);
171                                if(!$fileName){
172                                        $error = True;
173                                        break;
174                                } else{
175                                        $fileNames .= "\"".$fileName."\" ";
176                                }
177                        }
178                        $nameFileZip = 'False';
179                        if($fileNames && !$error) {
180                                $nameFileZip = $this -> createFileZip($fileNames, $tempDir);
181                                if($nameFileZip){
182                                        $file = $tempDir.'/'.$nameFileZip;
183                                } else{
184                                        $file = false;
185                                }
186
187                        } else{
188                                $file = false;
189                        }
190
191            return $file;
192
193                // Exportacao de mensagens da caixa de entrada (imap) - processo original do Expresso
194                } else{
195            $this-> folder = $params['folder'];
196            $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8");
197            $array_ids = explode(',', $params['msgs_to_export']);
198            $error = False;
199            $fileNames = "";
200            $tempDir = ini_get("session.save_path");
201            $this->connectImap();
202                        for($i = 0; $i < count($array_ids); $i++) {
203                        $header         = $this-> getHeader($array_ids[$i]);                                                                                   
204                        $body           = $this-> getBody($array_ids[$i]);                     
205                        $sEMLData       = $this -> parseEml($header, $body);                   
206                        $fileName       = $this -> CreateFileEml($sEMLData, $tempDir, $array_ids[$i]);
207                       
208                        if(!$fileName)  {
209                                $error = True;                                 
210                                break;
211                        }
212                        else
213                                $fileNames .= "\"".$fileName."\" ";                     
214                       
215                }
216                imap_close($this->mbox_stream);
217               
218               
219                $nameFileZip = 'False';                 
220                if($fileNames && !$error) {                     
221                        $nameFileZip = $this -> createFileZip($fileNames, $tempDir);
222                        if($nameFileZip)                       
223                                $file = $tempDir.'/'.$nameFileZip;
224                        else {
225                                $file = false;
226                        }                                                               
227                }
228                else
229                        $file = false;
230                       
231                return $file;
232        }
233    }
234
235        function export_msg($params) {
236                $this-> folder = $params['folder'];
237                $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8");
238                $id_number = $params['msgs_to_export'];
239                $tempDir = ini_get("session.save_path");
240               
241                $this->connectImap();
242                $header         = $this-> getHeader($id_number);
243                $body           = $this-> getBody($id_number);
244               
245                $file = "source_".$GLOBALS['phpgw']->session->sessionid.".txt";
246                $f = fopen($tempDir.'/'.$file,"w");
247                fputs($f,$header ."\r\n\r\n". $body);
248                fclose($f);
249               
250                imap_close($this->mbox_stream);
251                return $tempDir.'/'.$file;
252        }
253
254    function export_msg_data($id_msg,$folder) {
255                $this->folder = $folder;
256                $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8");
257
258                $this->connectImap();
259                $header         = $this-> getHeader($id_msg);
260                $body           = $this-> getBody($id_msg);
261
262                $msg_data = $header ."\r\n\r\n". $body;
263
264                imap_close($this->mbox_stream);
265                return $msg_data;
266        }
267
268        function export_to_archive($id_msg,$folder) {
269                $this->folder = $folder;
270                $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8");
271                $tempDir = dirname( __FILE__ ) . '/../tmpLclAtt';
272               
273                $phpheader = "<?php header('Content-Type: text/plain');
274                                header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
275                                header('Pragma: public');
276                                header('Expires: 0'); // set expiration time
277                                header('Content-Disposition: attachment; filename=\"fonte_da_mensagem.txt\"');?>";
278               
279                $this->connectImap();
280                $header         = $this-> getHeader($id_msg);
281                $body           = $this-> getBody($id_msg);
282               
283                $file = "source_".$GLOBALS['phpgw']->session->sessionid.".php";
284                $f = fopen($tempDir.'/'.$file,"w");
285                fputs($f,$phpheader.$header ."\r\n\r\n". $body);
286                fclose($f);
287                $urlPath = 'tmpLclAtt/'.$file;
288               
289                imap_close($this->mbox_stream);
290                return $urlPath;
291        }
292
293        function remove_accents($string) {
294                /*
295                        $array1 = array("á", "à", "â", "ã", "ä", "é", "è", "ê", "ë", "í", "ì", "î", "ï", "ó", "ò", "ô", "õ", "ö", "ú", "ù", "û", "ü", "ç" , "?", "\"", "!", "@", "#", "$", "%", "š", "&", "*", "(", ")", "-", "=", "+", "Ž", "`", "[", "]", "{", "}", "~", "^", ",", "<", ">", ";", ":", "/", "?", "\\", "|", "¹", "²", "³", "£", "¢", "¬", "§", "ª", "º", "°", "Á", "À", "Â", "Ã", "Ä", "É", "È", "Ê", "Ë", "Í", "Ì", "Î", "Ï", "Ó", "Ò", "Ô", "Õ", "Ö", "Ú", "Ù", "Û", "Ü", "Ç");
296                        $array2 = array("a", "a", "a", "a", "a", "e", "e", "e", "e", "i", "i", "i", "i", "o", "o", "o", "o", "o", "u", "u", "u", "u", "c" , "" , ""  , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" ,  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "A", "A", "A", "A", "A", "E", "E", "E", "E", "I", "I", "I", "I", "O", "O", "O", "O", "O", "U", "U", "U", "U", "C");
297                        return str_replace( $array1, $array2, $string );
298                */
299                return strtr($string,
300                        "áàâãäéèêëíìîïóòôõöúùûüç?\"!@#$%š&*()-=+Ž`[]{}~^,<>;:/?\\|¹²³£¢¬§ªº°ÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ",
301                        "aaaaaeeeeiiiiooooouuuuc__________________________________________AAAAAEEEEIIIIOOOOOUUUUC");
302        }
303       
304        function get_attachments_in_array($params) {
305                $return_attachments = array();
306
307                $id_number = $params['num_msg'];               
308                $attachments =unserialize(rawurldecode($params['s_attachments']));
309               
310                $tempDir = dirname( __FILE__ ) . '/../tmpLclAtt';
311//              $tempDir = $_SERVER["DOCUMENT_ROOT"]."tmpLclAtt";
312                $tempSubDir = md5(microtime());
313                exec('mkdir ' . $tempDir . '/'.$tempSubDir.'; cd ' . $tempDir . '/'.$tempSubDir);
314               
315                $this-> folder = $params['folder'];
316                $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8");
317                $this->connectImap();
318
319                include_once("class.imap_attachment.inc.php");
320
321                $imap_attachment = new imap_attachment();
322                $attachments = $imap_attachment->download_attachment($this->mbox_stream, $id_number);
323                foreach($attachments as $i => $attachment){
324                        if($i && $i == 'names')
325                                continue;
326                        $fileNameReal = $this->remove_accents($attachment['name']);
327                        $ContentType = $this->getFileType($fileNameReal);
328                        $fileName = $fileNameReal . ".php";
329                        $f = fopen($tempDir . '/'.$tempSubDir.'/'.$fileName,"wb");
330                        if(!$f)
331                                return $tempDir . '/'.$tempSubDir.'/'.$fileName;                       
332
333                        $fileContent = imap_fetchbody($this->mbox_stream, $id_number,$attachment['pid'], FT_UID);
334                        $urlPath = 'tmpLclAtt/'.$tempSubDir.'/'.$fileName;
335                       
336                        $headers = "<?php header('Content-Type: ".$ContentType."');
337                                header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
338                                header('Pragma: public');
339                                header('Expires: 0'); // set expiration time
340                                header('Content-Disposition: attachment; filename=\"". addslashes($fileNameReal) ."\"');\n echo ";
341                       
342                        if($attachment['encoding'] == 'base64') {
343                                $headers.=" imap_base64('".$fileContent."');?>";
344                        }
345                        else if($attachment['encoding'] == 'quoted_printable_decode') {
346                                $headers.=" quoted_printable_decode('".$fileContent."');?>";
347                        }
348                        else {
349                                $headers.=" '".$fileContent."';?>";
350                        }
351                       
352                        fputs($f,$headers);
353
354                        array_push($return_attachments,array('name' => $fileName,'url' => $urlPath,'pid' =>$attachment['pid']));
355                        fclose($f);
356                }
357                imap_close($this->mbox_stream);
358                return $return_attachments;
359        }
360       
361        private function getFileType($nameFile) {
362                $strFileType = strrev(substr(strrev(strtolower($nameFile)),0,4));
363                $ContentType = "application/octet-stream";
364                if ($strFileType == ".asf")
365                        $ContentType = "video/x-ms-asf";
366                if ($strFileType == ".avi")
367                        $ContentType = "video/avi";
368                if ($strFileType == ".doc")
369                        $ContentType = "application/msword";
370                if ($strFileType == ".zip")
371                        $ContentType = "application/zip";
372                if ($strFileType == ".xls")
373                        $ContentType = "application/vnd.ms-excel";
374                if ($strFileType == ".gif")
375                        $ContentType = "image/gif";
376                if ($strFileType == ".jpg" || $strFileType == "jpeg")
377                        $ContentType = "image/jpeg";
378                if ($strFileType == ".wav")
379                        $ContentType = "audio/wav";
380                if ($strFileType == ".mp3")
381                        $ContentType = "audio/mpeg3";
382                if ($strFileType == ".mpg" || $strFileType == "mpeg")
383                        $ContentType = "video/mpeg";
384                if ($strFileType == ".rtf")
385                        $ContentType = "application/rtf";
386                if ($strFileType == ".htm" || $strFileType == "html")
387                        $ContentType = "text/html";
388                if ($strFileType == ".xml")
389                        $ContentType = "text/xml";
390                if ($strFileType == ".xsl")
391                        $ContentType = "text/xsl";
392                if ($strFileType == ".css")
393                        $ContentType = "text/css";
394                if ($strFileType == ".php")
395                        $ContentType = "text/php";
396                if ($strFileType == ".asp")
397                        $ContentType = "text/asp";
398                if ($strFileType == ".pdf")
399                        $ContentType = "application/pdf";
400                if ($strFileType == ".txt")
401                        $ContentType = "text/plain";
402                if ($strFileType == ".log")
403                        $ContentType = "text/plain";
404                if ($strFileType == ".wmv")
405                        $ContentType = "video/x-ms-wmv";
406                if ($strFileType == ".sxc")
407                        $ContentType = "application/vnd.sun.xml.calc";
408                if ($strFileType == ".odt")
409                        $ContentType = "application/vnd.oasis.opendocument.text";
410                if ($strFileType == ".stc")
411                        $ContentType = "application/vnd.sun.xml.calc.template";
412                if ($strFileType == ".sxd")
413                        $ContentType = "application/vnd.sun.xml.draw";
414                if ($strFileType == ".std")
415                        $ContentType = "application/vnd.sun.xml.draw.template";
416                if ($strFileType == ".sxi")
417                        $ContentType = "application/vnd.sun.xml.impress";
418                if ($strFileType == ".sti")
419                        $ContentType = "application/vnd.sun.xml.impress.template";
420                if ($strFileType == ".sxm")
421                        $ContentType = "application/vnd.sun.xml.math";
422                if ($strFileType == ".sxw")
423                        $ContentType = "application/vnd.sun.xml.writer";
424                if ($strFileType == ".sxq")
425                        $ContentType = "application/vnd.sun.xml.writer.global";
426                if ($strFileType == ".stw")
427                        $ContentType = "application/vnd.sun.xml.writer.template";
428                if ($strFileType == ".ps")
429                        $ContentType = "application/postscript";
430                if ($strFileType == ".pps")
431                        $ContentType = "application/vnd.ms-powerpoint";
432                if ($strFileType == ".odt")
433                        $ContentType = "application/vnd.oasis.opendocument.text";
434                if ($strFileType == ".ott")
435                        $ContentType = "application/vnd.oasis.opendocument.text-template";
436                if ($strFileType == ".oth")
437                        $ContentType = "application/vnd.oasis.opendocument.text-web";
438                if ($strFileType == ".odm")
439                        $ContentType = "application/vnd.oasis.opendocument.text-master";
440                if ($strFileType == ".odg")
441                        $ContentType = "application/vnd.oasis.opendocument.graphics";
442                if ($strFileType == ".otg")
443                        $ContentType = "application/vnd.oasis.opendocument.graphics-template";
444                if ($strFileType == ".odp")
445                        $ContentType = "application/vnd.oasis.opendocument.presentation";
446                if ($strFileType == ".otp")
447                        $ContentType = "application/vnd.oasis.opendocument.presentation-template";
448                if ($strFileType == ".ods")
449                        $ContentType = "application/vnd.oasis.opendocument.spreadsheet";
450                if ($strFileType == ".ots")
451                        $ContentType = "application/vnd.oasis.opendocument.spreadsheet-template";
452                if ($strFileType == ".odc")
453                        $ContentType = "application/vnd.oasis.opendocument.chart";
454                if ($strFileType == ".odf")
455                        $ContentType = "application/vnd.oasis.opendocument.formula";
456                if ($strFileType == ".odi")
457                        $ContentType = "application/vnd.oasis.opendocument.image";
458                if ($strFileType == ".ndl")
459                        $ContentType = "application/vnd.lotus-notes";
460                return $ContentType;
461        }
462       
463        function download_all_attachments($params) {
464               
465                $id_number = $params['num_msg'];               
466                $attachments =unserialize(rawurldecode($params['s_attachments']));
467               
468                $tempDir = ini_get("session.save_path");
469                $tempSubDir = md5(microtime());
470                $fileNames = '';
471                exec('mkdir ' . $tempDir . '/'.$tempSubDir.'; cd ' . $tempDir . '/'.$tempSubDir);
472                $this-> folder = $params['folder'];
473                $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8");
474                $this->connectImap();
475                include("class.imap_attachment.inc.php");
476                $imap_attachment = new imap_attachment();
477                $attachments = $imap_attachment->download_attachment($this->mbox_stream, $id_number);
478               
479                foreach($attachments as $i => $attachment){
480                        if($i && $i == 'names')
481                                continue;
482                                                                                                                                               
483                       
484                        $fileName = $this->remove_accents($attachment['name']);
485                        $f = fopen($tempDir . '/'.$tempSubDir.'/'.$fileName,"wb");
486                        if(!$f)
487                                return False;                   
488                                               
489                        $fileNames .= "'".$fileName."' ";
490                        $fileContent = imap_fetchbody($this->mbox_stream, $id_number,$attachment['pid'], FT_UID);
491                        if($attachment['encoding'] == 'base64')
492                                fputs($f,imap_base64($fileContent));
493                        else           
494                                fputs($f,$fileContent);
495                               
496                        fclose($f);
497               
498                }
499                imap_close($this->mbox_stream);
500                $nameFileZip = '';
501               
502                if($fileNames) {
503                        $nameFileZip = $this -> createFileZip($fileNames, $tempDir . '/'.$tempSubDir);                                         
504                        if($nameFileZip)
505                                $file =  $tempDir . '/'.$tempSubDir.'/'.$nameFileZip;
506                        else {
507                                $file = false;
508                        }
509                }
510                else
511                        $file = false;
512                               
513                return $file;
514        }
515
516        function getHeader($msg_number){                       
517                return imap_fetchheader($this->mbox_stream, $msg_number, FT_UID);
518        }
519       
520        function getBody($msg_number){
521                $header = imap_headerinfo($this->mbox_stream, imap_msgno($this->mbox_stream, $msg_number), 80, 255);
522                $body = imap_body($this->mbox_stream, $msg_number, FT_UID);
523                if(($header->Unseen == 'U') || ($header->Recent == 'N')){
524                        imap_clearflag_full($this->mbox_stream, $msg_number, "\\Seen", ST_UID);
525                }
526                return $body;
527        }
528
529        function decode_subject($string){
530                if ((strpos(strtolower($string), '=?iso-8859-1') !== false)
531                        || (strpos(strtolower($string), '=?windows-1252') !== false)){
532                        $elements = imap_mime_header_decode($string);
533                        foreach ($elements as $el)
534                                $return .= $el->text;
535                }
536                else if (strpos(strtolower($string), '=?utf-8') !== false) {
537                        $elements = imap_mime_header_decode($string);
538                        foreach ($elements as $el){
539                                $charset = $el->charset;
540                                $text    = $el->text;
541                                if(!strcasecmp($charset, "utf-8") ||
542                                !strcasecmp($charset, "utf-7")) {
543                                $text = iconv($charset, "ISO-8859-1", $text);
544                        }
545                        $return .= $text;
546                        }
547                }
548                else
549                        $return = $string;
550
551                return $this->remove_accents($return);         
552        }
553}
554// END CLASS
555?>
Note: See TracBrowser for help on using the repository browser.