/[informatika.old]/html/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 /html/inc/quoted-printable.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Wed Jul 5 07:34:57 2000 UTC (23 years, 10 months ago) by dpavlin
Branch: MAIN
php-only implementacija quoted-printable encodinga i zamjene za internu mail
funkciju (iso_mail)

1 dpavlin 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     popen("/usr/sbin/sendmail -t")
57     ($to,$subject,e_qp($msg),'From: '.$from.'
58     X-Mailer: php-quotedprintable-mailer
59     Content-Type: text/plain; charset="iso-8859-2"
60     Content-Transfer-Encoding: quoted-printable
61     ');
62     }
63    
64     ?>

  ViewVC Help
Powered by ViewVC 1.1.26