* Reinstated the 'Delete' button in the mailbox view, for use by users who don't...
[citadel.git] / ctdlphp / CreateUserFromData.php
blob09ca5f57072f8bfe2d0ab33f0643c8479e5a21a2
1 <?PHP
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));
23 fclose($vcardfh);
25 $configfh = fopen($configname, "r");
26 $config = fread($configfh, filesize($configname));
27 fclose($configfh);
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) {
44 print_r($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.
50 if (!$ok) {
51 echo "Error: " . $response . "\n";
52 return false;
54 if (isset($fields['part']))
56 $parts = explode('|', $fields['part']);
57 print_r($parts);
58 if ($parts[4]=="text/x-vcard")
59 list($size, $OldVcard) = download_attachment($msgnum, $result[2]);
60 else
61 ctdl_dele($msgnum);
63 else if ($fields['subj'] == "__ WebCit Preferences __")
65 $Webcit_PrefMsgid = $msgnum;
66 $Webcit_Preferences = $fields;
70 "begin:vcard
71 n:Surename;CName;mitte;Mrs;IV
72 title:master
73 fn:CName Surename
74 org:citadel.org
75 adr:blarg;Road To nowhere ;10;Metropolis;NRW;12345;Country
76 tel;home:888888888
77 tel;work:99999999999
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
84 end:vcard
86 $entarray=array();
87 $entarray['post']=1;
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
96 roomlistview|rooms
97 emptyfloors|yes
98 weekstart|0
99 use_sig|no
100 startpage|dotskip&room=_BASEROOM_
101 signature|
102 daystart|8
103 floordiv_expanded|
104 current_iconbar|0
105 calhourformat|24
106 dayend|17
109 if ($Webcit_PrefMsgid != '0')
111 ctdl_dele($Webcit_PrefMsgid);
114 $entarray=array();
115 $entarray['post']=1;
116 $entarray['format_type']=FMT_FIXED;
117 $entarray['subject'] = "__ WebCit Preferences __";
118 $entarray['anon_flag'] = '0';
119 enter_message_0($entarray,
120 "",
121 "somevar|somevalue\r\n".$Webcit_Preferences);
123 ctdl_end_session();