3 define('CITADEL_DEBUG_HTML', FALSE);
5 if ($_SERVER["argc"] < 3)
6 die("need at least two params Call me CreateUserFromData.php testuser opensesame.\n");
9 $user = $_SERVER["argv"][1];
10 $password = $_SERVER["argv"][1];
11 echo "----------------------- Creating User $user -------------------\n";
12 $vcardname = $user."/vcard.txt";
13 if (! is_array(stat($vcardname)))
14 die("\nCouldn't find vcard in $vcardname\n");
16 $configname= $user."/config.txt";
17 if (!is_array(stat($configname)))
18 die("\nCouldn't find users config in $configname\n");
21 $vcardfh = fopen($vcardname, "r");
22 $vcard = fread($vcardfh, filesize($vcardname));
25 $configfh = fopen($configname, "r");
26 $config = fread($configfh, filesize($configname));
30 include "ctdlsession.php";
31 include "ctdlprotocol.php";
32 include "ctdlelements.php";
34 //define(CITADEL_DEBUG_HTML, FALSE);
35 establish_citadel_session();
36 create_new_user($user, $password);
38 ctdl_goto("My Citadel Config");
39 list($num_msgs, $response, $msgs) = ctdl_msgs("", "");
41 $Webcit_Preferences = array();
42 $Webcit_PrefMsgid = 0;
43 if ($num_msgs > 0) foreach ($msgs as $msgnum) {
46 // Fetch the message from the server
47 list($ok, $response, $fields) = ctdl_fetch_message($msgnum);
49 // Bail out gracefully if the message isn't there.
51 echo "Error: " . $response . "\n";
54 if (isset($fields['part']))
56 $parts = explode('|', $fields['part']);
58 if ($parts[4]=="text/x-vcard")
59 list($size, $OldVcard) = download_attachment($msgnum, $result[2]);
63 else if ($fields['subj'] == "__ WebCit Preferences __")
65 $Webcit_PrefMsgid = $msgnum;
66 $Webcit_Preferences = $fields;
71 n:Surename;CName;mitte;Mrs;IV
75 adr:blarg;Road To nowhere ;10;Metropolis;NRW;12345;Country
78 email;internet:user@samplecitadel.org
79 email;internet:me@samplecitadel.org
80 email;internet:myself@samplecitadel.org
81 email;internet:i@samplecitadel.org
82 FBURL;PREF:http://samplecitadel.org/Cname_Lastname.vfb
83 UID:Citadel vCard: personal card for Cname Lastname at samplecitadel.org
88 $entarray['format_type']=FMT_RFC822
;
89 enter_message_0($entarray, "text/x-vcard; charset=UTF-8", $vcard);
92 $Webcit_Preferences=$config;
94 iconbar|ib_displayas=0,ib_logo=0,ib_summary=1,ib_inbox=1,ib_calendar=1,ib_contacts=1,ib_notes=1,ib
95 _tasks=1,ib_rooms=1,ib_users=2,ib_chat=1,ib_advanced=1,ib_logoff=0,ib_citadel=1
100 startpage|dotskip&room=_BASEROOM_
109 if ($Webcit_PrefMsgid != '0')
111 ctdl_dele($Webcit_PrefMsgid);
116 $entarray['format_type']=FMT_FIXED
;
117 $entarray['subject'] = "__ WebCit Preferences __";
118 $entarray['anon_flag'] = '0';
119 enter_message_0($entarray,
121 "somevar|somevalue\r\n".$Webcit_Preferences);