From: Art Cancro Date: Mon, 3 Nov 2003 05:32:57 +0000 (+0000) Subject: * Minor code cleanups X-Git-Tag: v7.86~5716 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=b1912027b6df1d27c27a8a163645754d4af4bfa6 * Minor code cleanups * ctdl_mesg() now returns ready-to-output HTML to the caller, instead of outputting it itself. --- diff --git a/ctdlphp/ChangeLog b/ctdlphp/ChangeLog index 03e0c9552..017052299 100644 --- a/ctdlphp/ChangeLog +++ b/ctdlphp/ChangeLog @@ -1,4 +1,9 @@ $Log$ + Revision 1.11 2003/11/03 05:32:57 ajc + * Minor code cleanups + * ctdl_mesg() now returns ready-to-output HTML to the caller, instead of + outputting it itself. + Revision 1.10 2003/11/02 05:35:11 ajc * who.php: added * ctdlprotocol.php: worked out a tentative data API using this function. @@ -45,3 +50,4 @@ Revision 1.1 2003/10/31 03:47:13 ajc * Initial CVS import + diff --git a/ctdlphp/ctdlprotocol.php b/ctdlphp/ctdlprotocol.php index e197952cd..45c136e3d 100644 --- a/ctdlphp/ctdlprotocol.php +++ b/ctdlphp/ctdlprotocol.php @@ -123,8 +123,12 @@ function ctdl_get_serv_info() { $i = 0; do { $buf = serv_gets(); + if ($i == 1) $_SESSION["serv_nodename"] = $buf; if ($i == 2) $_SESSION["serv_humannode"] = $buf; + if ($i == 3) $_SESSION["serv_fqdn"] = $buf; if ($i == 4) $_SESSION["serv_software"] = $buf; + if ($i == 6) $_SESSION["serv_city"] = $buf; + if ($i == 7) $_SESSION["serv_sysadmin"] = $buf; $i = $i + 1; } while (strcasecmp($buf, "000")); } @@ -133,40 +137,30 @@ function ctdl_get_serv_info() { // -// Temporary function to verify communication with the Citadel server. -// -function test_for_echo() { - global $clientsocket, $session; - - $command = "ECHO Video vertigo ... test for echo."; - serv_puts($command); - $response = serv_gets(); - echo $response, "
"; - flush(); -} - - -// -// Display a system banner. +// Display a system banner. (Returns completed HTML.) // (This is probably temporary because it outputs more or less finalized // markup. For now it's just usable.) // function ctdl_mesg($msgname) { global $clientsocket; + $msgtext = "
\n"; + serv_puts("MESG " . $msgname); $response = serv_gets(); - + if (substr($response, 0, 1) == "1") { - echo "
\n"; while (strcmp($buf = serv_gets(), "000")) { - echo "", $buf, "
\n" ; + $msgtext .= "" . htmlspecialchars($buf) + . "
\n" ; } - echo "
\n"; } else { - echo "", substr($response, 4), "
\n"; + $msgtext .= "" . substr($response, 4) . "
\n"; } + + $msgtext .= "
\n"; + return($msgtext); } diff --git a/ctdlphp/login.php b/ctdlphp/login.php index 1a084aae8..cf88c2a4b 100644 --- a/ctdlphp/login.php +++ b/ctdlphp/login.php @@ -11,7 +11,7 @@ include "ctdlheader.php"; bbs_page_header(); - ctdl_mesg("hello"); + echo ctdl_mesg("hello"); ?>
diff --git a/ctdlphp/logout.php b/ctdlphp/logout.php index 66eb5c890..c338b77c1 100644 --- a/ctdlphp/logout.php +++ b/ctdlphp/logout.php @@ -12,7 +12,7 @@ bbs_page_header(); - ctdl_mesg("goodbye"); + echo ctdl_mesg("goodbye"); echo "Log in again
\n" ; diff --git a/ctdlphp/sessionproxy.php b/ctdlphp/sessionproxy.php index 9f56d18b5..986eb2a52 100755 --- a/ctdlphp/sessionproxy.php +++ b/ctdlphp/sessionproxy.php @@ -107,6 +107,9 @@ if (substr($buf, 0, 1) != "2") { do { // Wait for connections, but time out after 15 minutes. + // socket_select() is completely b0rken in PHP 4.1, which is why + // this program requires PHP 4.3 or newer. + // if (socket_select($readsock = array($sock), $writesock = NULL, $exceptsock = NULL,