From cd662abeeaff63f8a4e150d58ee8627c2ad5e0e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sun, 27 Jan 2008 18:31:56 +0000 Subject: [PATCH] * user creation commandline tool * some sample data --- ctdlphp/CreateUserFromData.php | 125 +++++++++++++++++++++++++++++++++ ctdlphp/ctdlprotocol.php | 6 +- ctdlphp/testuser/config.txt | 14 ++++ ctdlphp/testuser/vcard.txt | 16 +++++ 4 files changed, 158 insertions(+), 3 deletions(-) create mode 100644 ctdlphp/CreateUserFromData.php create mode 100644 ctdlphp/testuser/config.txt create mode 100644 ctdlphp/testuser/vcard.txt diff --git a/ctdlphp/CreateUserFromData.php b/ctdlphp/CreateUserFromData.php new file mode 100644 index 000000000..09ca5f570 --- /dev/null +++ b/ctdlphp/CreateUserFromData.php @@ -0,0 +1,125 @@ + 0) foreach ($msgs as $msgnum) { + print_r($msgnum); + + // Fetch the message from the server + list($ok, $response, $fields) = ctdl_fetch_message($msgnum); + + // Bail out gracefully if the message isn't there. + if (!$ok) { + echo "Error: " . $response . "\n"; + return false; + } + if (isset($fields['part'])) + { + $parts = explode('|', $fields['part']); + print_r($parts); + if ($parts[4]=="text/x-vcard") + list($size, $OldVcard) = download_attachment($msgnum, $result[2]); + else + ctdl_dele($msgnum); + } + else if ($fields['subj'] == "__ WebCit Preferences __") + { + $Webcit_PrefMsgid = $msgnum; + $Webcit_Preferences = $fields; + } +} + +"begin:vcard +n:Surename;CName;mitte;Mrs;IV +title:master +fn:CName Surename +org:citadel.org +adr:blarg;Road To nowhere ;10;Metropolis;NRW;12345;Country +tel;home:888888888 +tel;work:99999999999 +email;internet:user@samplecitadel.org +email;internet:me@samplecitadel.org +email;internet:myself@samplecitadel.org +email;internet:i@samplecitadel.org +FBURL;PREF:http://samplecitadel.org/Cname_Lastname.vfb +UID:Citadel vCard: personal card for Cname Lastname at samplecitadel.org +end:vcard +"; +$entarray=array(); +$entarray['post']=1; +$entarray['format_type']=FMT_RFC822; +enter_message_0($entarray, "text/x-vcard; charset=UTF-8", $vcard); + + +$Webcit_Preferences=$config; +" +iconbar|ib_displayas=0,ib_logo=0,ib_summary=1,ib_inbox=1,ib_calendar=1,ib_contacts=1,ib_notes=1,ib +_tasks=1,ib_rooms=1,ib_users=2,ib_chat=1,ib_advanced=1,ib_logoff=0,ib_citadel=1 +roomlistview|rooms +emptyfloors|yes +weekstart|0 +use_sig|no +startpage|dotskip&room=_BASEROOM_ +signature| +daystart|8 +floordiv_expanded| +current_iconbar|0 +calhourformat|24 +dayend|17 +"; + +if ($Webcit_PrefMsgid != '0') +{ + ctdl_dele($Webcit_PrefMsgid); + +} +$entarray=array(); +$entarray['post']=1; +$entarray['format_type']=FMT_FIXED; +$entarray['subject'] = "__ WebCit Preferences __"; +$entarray['anon_flag'] = '0'; +enter_message_0($entarray, + "", + "somevar|somevalue\r\n".$Webcit_Preferences); + +ctdl_end_session(); + +?> \ No newline at end of file diff --git a/ctdlphp/ctdlprotocol.php b/ctdlphp/ctdlprotocol.php index 6f434822a..6ce5381dd 100644 --- a/ctdlphp/ctdlprotocol.php +++ b/ctdlphp/ctdlprotocol.php @@ -26,7 +26,7 @@ function dbgprintf_wrapin($string, $html) { if (!CITADEL_DEBUG_HTML){ if ($html) - debugLog("<< ".$string); + debugLog("<< ".$string."\n"); } else printf($string); @@ -35,7 +35,7 @@ function dbgprintf_wrapout($string, $html) { if (!CITADEL_DEBUG_HTML){ if ($html) - debugLog("<< ".$string); + debugLog("<< ".$string."\n"); } else printf($string); @@ -786,7 +786,7 @@ function ctdl_msg4_from_server() { } else if (!strcasecmp($msgformat, "text/plain")) { $txt .= "\r\n".$buf; - $modified_ .= "" . htmlspecialchars($buf) . "
\n" ; + $modified_txt .= "" . htmlspecialchars($buf) . "
\n" ; } else if (!strcasecmp($msgformat, "text/x-citadel-variformat")) { diff --git a/ctdlphp/testuser/config.txt b/ctdlphp/testuser/config.txt new file mode 100644 index 000000000..f39b458f5 --- /dev/null +++ b/ctdlphp/testuser/config.txt @@ -0,0 +1,14 @@ +iconbar|ib_displayas=0,ib_logo=0,ib_summary=1,ib_inbox=1,ib_calendar=1,ib_contacts=1,ib_notes=1,ib +_tasks=1,ib_rooms=1,ib_users=2,ib_chat=1,ib_advanced=1,ib_logoff=0,ib_citadel=1 +roomlistview|rooms +emptyfloors|yes +weekstart|0 +use_sig|no +startpage|dotskip&room=_BASEROOM_ +signature| +daystart|8 +floordiv_expanded| +current_iconbar|0 +calhourformat|24 +dayend|17 + diff --git a/ctdlphp/testuser/vcard.txt b/ctdlphp/testuser/vcard.txt new file mode 100644 index 000000000..710aa43ba --- /dev/null +++ b/ctdlphp/testuser/vcard.txt @@ -0,0 +1,16 @@ +begin:vcard +n:Surename;CName;mitte;Mrs;IV +title:master +fn:CName Surename +org:citadel.org +adr:blarg;Road To nowhere ;10;Metropolis;NRW;12345;Country +tel;home:888888888 +tel;work:99999999999 +email;internet:user@samplecitadel.org +email;internet:me@samplecitadel.org +email;internet:myself@samplecitadel.org +email;internet:i@samplecitadel.org +FBURL;PREF:http://samplecitadel.org/Cname_Lastname.vfb +UID:Citadel vCard: personal card for Cname Lastname at samplecitadel.org +end:vcard + -- 2.30.2