fix for unsafe images links. Somehow the wrong were in de view unsafe images
[squirrelmail.git] / src / abook2vcard.php
1 <?php
2
3 /**
4 * read_body.php
5 *
6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * This file is used for reading the msgs array and displaying
10 * the resulting emails in the right frame.
11 *
12 * $Id$
13 */
14
15 /* Path for SquirrelMail required files. */
16 define('SM_PATH','../');
17
18 /* SquirrelMail required files. */
19 require_once(SM_PATH . 'include/validate.php');
20 require_once(SM_PATH . 'functions/strings.php');
21 require_once(SM_PATH . 'functions/prefs.php');
22 require_once(SM_PATH . 'config/config.php');
23
24 $abook_file=$data_dir.$username.".abook";
25 $vcard_base=$data_dir.$username;
26 $i=0;
27
28 $fp = fopen ($abook_file,"r");
29 while (!feof ($fp)) {
30 $buffer = fgets($fp, 8096);
31 $line=explode("|",$buffer);
32 if (count($line)>1) {
33 write_vcard($line);
34 }
35 }
36
37 fclose ($fp);
38
39
40 function write_vcard($abook) {
41 global $vcard_base,$i;
42
43
44 // FIXME check if filename is ok
45 $vcard_fn = $vcard_base.".".$abook[0].".vcard";
46
47 $fp0 = fopen ($vcard_fn,"w");
48
49 fputs($fp0, "BEGIN:VCARD
50 VERSION:3.0
51 N:$abook[1];$abook[2];
52 NICKNAME:$abook[0]
53 EMAIL;INTERNET:$abook[3];
54 END:VCARD<P>
55 ");
56 $i++;
57 fclose($fp0);
58
59 }
60
61 echo "done ;) seem to have written $i files.";
62 ?>