Added a comma after each msgnum exported. The parser was globbing them all together...
[citadel.git] / ctdlphp / myinfo.php
1 <?PHP
2 $vcard="";
3 include "ctdlheader.php";
4 bbs_page_header();
5
6 echo    "This is an example of the use of " .
7 "ctdl_get_registration_info() to display " .
8 "your personal data.<BR><BR>\n" ;
9
10 echo    "<TABLE border=1>" .
11 "<TR>" .
12 "<TD><B>User</B></TD>" .
13 "<TD><B>Room</B></TD>" .
14 "<TD><B>Host</B></TD>" .
15 "</TR>" ;
16
17 ctdl_goto("My Citadel Config");
18 list($num_msgs, $response, $msgs) = ctdl_msgs("", "");
19
20 echo "num_msgs: " . $num_msgs . "<BR>\n" ;
21 echo "response: " . htmlspecialchars($response) . "<BR>\n" ;
22 $Webcit_Preferences = array();
23 $Webcit_PrefMsgid = 0;
24 if ($num_msgs > 0) foreach ($msgs as $msgnum) {
25         print_r($msgnum);
26
27         // Fetch the message from the server
28         list($ok, $response, $fields) = ctdl_fetch_message($msgnum);
29
30         // Bail out gracefully if the message isn't there.
31         if (!$ok) {
32                 echo "Error: " . htmlspecialchars($response) . "<BR>" ;
33                 return false;
34         }
35         if (isset($fields['part']))
36         {
37                 $parts = explode('|', $fields['part']);
38                 print_r($parts);
39                 if ($parts[4]=="text/x-vcard")
40                         list($size, $vcard) = download_attachment($msgnum, $result[2]);
41                 else
42                         ctdl_dele($msgnum);
43         }
44         else if ($fields['subj'] == "__ WebCit Preferences __")
45         {
46                 $Webcit_PrefMsgid = $msgnum;
47                 $Webcit_Preferences = $fields;
48         } 
49 }
50
51 echo "</TABLE>\n--------------------------------------- <pre>\n". $vcard."</pre>";
52
53 echo "putting it back in!";
54
55 $vcard = 
56 "begin:vcard
57 n:Surename;CName;mitte;Mrs;IV
58 title:master
59 fn:CName Surename
60 org:citadel.org
61 adr:blarg;Road To nowhere ;10;Metropolis;NRW;12345;Country
62 tel;home:888888888
63 tel;work:99999999999
64 email;internet:user@samplecitadel.org
65 email;internet:me@samplecitadel.org
66 email;internet:myself@samplecitadel.org
67 email;internet:i@samplecitadel.org
68 FBURL;PREF:http://samplecitadel.org/Cname_Lastname.vfb
69 UID:Citadel vCard: personal card for Cname Lastname at samplecitadel.org
70 end:vcard
71 ";
72 preg_replace('/Sir/', 'Mrs',$vcard);
73 echo "Now its: <pre>\n".$vcard."</pre>";
74 $entarray=array();
75 $entarray['post']=1;
76 $entarray['format_type']=FMT_RFC822;
77 enter_message_0($entarray, "text/x-vcard; charset=UTF-8", $vcard);
78
79
80 if ($Webcit_PrefMsgid != '0')
81 {
82         ctdl_dele($Webcit_PrefMsgid);
83         
84         $entarray=array();
85         $entarray['post']=1;
86         $entarray['format_type']=FMT_FIXED;
87         $entarray['subject'] = $Webcit_Preferences['subj'];
88         $entarray['anon_flag'] = '0';
89         enter_message_0($entarray,
90                         "", 
91                         "somevar|somevalue\r\n".$Webcit_Preferences['text']);
92 }
93 ?>
94
95 <BR>Sample links<BR>
96 <a href="welcome.php">Page One</a><BR>
97 <a href="page3.php">Page Three</a><BR>
98
99 <?PHP
100         bbs_page_footer();
101 ?>