finally. real code. no. not real code. some convert tool even not finished.
[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_dir=$data_dir.$username."/";
26
27 $fp = fopen ($abook_file,"r");
28 while (!feof ($fp)) {
29 $buffer .= fgets($fp, 4096);
30 }
31
32 fclose ($fp);
33
34 $abook=explode("|",$buffer);
35 print_r($abook);
36 echo "<p>".$buffer;
37
38 while ( list($nick,$email,$fn,$ln,$email)=each($abook) ) {
39 echo "
40 BEGIN:VCARD
41 VERSION:3.0
42 N:$ln;$fn;
43 NICKNAME:$nick
44 EMAIL;INTERNET:$email
45 END:VCARD<P>
46 ";
47 }
48
49 ?>