]> code.citadel.org Git - citadel.git/blobdiff - ctdlphp/ctdlsession.php
* parse function reply properly
[citadel.git] / ctdlphp / ctdlsession.php
index 996975d7a6d6b2b62d78cf6dd89f39d50d1bd762..3ee4984311e9443a14632ff1b1db9a099fac3d5c 100644 (file)
@@ -42,8 +42,15 @@ function establish_citadel_session() {
                //exec($cmd);
 
                // It ain't there, dude.  Open up the proxy.  (PHP version)
+               if (CITADEL_DEBUG_PROXY){
+                       $stdout = '>>/tmp/sessionproxyout.txt';
+               }
+               else{
+                       $stdout = '>/dev/null';
+               }
+
                $cmd = "./sessionproxy.php " . $sockname .
-                       " </dev/null >/dev/null 2>&1 " .
+                       " </dev/null ".$stdout."2>&1 " .
                        " 3>&1 4>&1 5>&1 6>&1 7>&1 8>&1 & " ;
                exec($cmd);
 
@@ -62,17 +69,23 @@ function establish_citadel_session() {
                }
 
                // At this point we have a good connection to Citadel.
-
-               ctdl_iden();    // Identify client
-
-               if ($_SESSION["username"]) {
+               $identity=array(
+                       "DevelNr" => '0',
+                       "ClientID" => '8',
+                       "VersionNumber" => '001',
+                       "ClientInfoString" => 'PHP web client|',
+                       "Remote Address" => $_SERVER['REMOTE_ADDR'] );
+
+               ctdl_iden($identity);   // Identify client
+               ctdl_MessageFormatsPrefered(array("text/html","text/plain"));
+               if (isset($_SESSION["username"])) {
                        login_existing_user(
                                $_SESSION["username"],
                                $_SESSION["password"]
                        );
                }
 
-               if ($_SESSION["room"]) {
+               if (isset($_SESSION["room"])) {
                        ctdl_goto($_SESSION["room"]);
                }
                else {
@@ -81,7 +94,11 @@ function establish_citadel_session() {
        }
 
        if (!isset($_SESSION["serv_humannode"])) {
-               ctdl_get_serv_info();
+               $server_info = ctdl_get_serv_info();
+               print_r($server_info);
+               $keys = array_keys($server_info);
+               foreach ($keys as $key)
+                       $_SESSION[$key] = $server_info[$key];
        }
 
        // If the user is trying to call up any page other than