/[pliva-si]/inc/quoted-printable.inc
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /inc/quoted-printable.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Tue Nov 20 16:42:36 2001 UTC (22 years, 5 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
symlink from corp_html

1 ravilov 1.1 <?
2    
3     // encode quoted-printable
4     // php port by Dobrica Pavlinusic <dpavlin@rot13.org>
5     // from encdec.c-1.1 by Jörgen Hägg 1993 <jh@efd.lth.se>
6    
7     function e_qp($foo) {
8    
9     $count=0;
10     $out="";
11    
12     for($i=0; $i<strlen($foo); $i++) {
13     if ($count > 73) {
14     $out.="\n";
15     $count = 0;
16     }
17     $c=substr($foo,$i,1);
18     $p=ord($c);
19     if ($p == 10) {
20     $out.="\n";
21     $count = 0;
22     } else if ($p == 9 || $p == 32) {
23     // if (!*(p+1))
24     // {
25     $out.=sprintf("=%02X", $p);
26     $count += 3;
27     // }
28     // else
29     // {
30     // $out.=$c;
31     // $count++;
32     // }
33     continue;
34     } else if (($p >= 33 && $p <= 60) ||
35     ($p >= 62 && $p <= 126)) {
36     $out.=$c;
37     $count++;
38     } else {
39     $out.=sprintf("=%02X", $p);
40     $count += 3;
41     }
42    
43     }
44     $out.="\n";
45     return $out;
46     }
47    
48     // mail function replacement
49    
50     // example: iso_mail("From name <from_address@domain.dot>",
51     // "to_addrress@domain.dot",
52     // "subject of message",
53     // "body of message"
54    
55     function iso_mail($from,$to,$subject,$msg) {
56     $mail=popen("/usr/sbin/sendmail -t","w");
57     if (! $mail) {
58     return 0; // error!
59     }
60     fputs($mail,'To: '.$to.'
61     From: '.$from.'
62     Subject: '.$subject.'
63     X-Mailer: php-quotedprintable-mailer
64     Content-Type: text/plain; charset="iso-8859-2"
65     Content-Transfer-Encoding: quoted-printable
66     '.$headers.'
67    
68     '.e_qp($msg));
69     pclose($mail);
70     return 1;
71     }
72    
73     ?>

  ViewVC Help
Powered by ViewVC 1.1.26