* use isset() to be correct and don't produce warnings
authorWilfried Göesgens <willi@citadel.org>
Sun, 4 Feb 2007 15:52:40 +0000 (15:52 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sun, 4 Feb 2007 15:52:40 +0000 (15:52 +0000)
* have a config.php containing our server connection.

ctdlphp/config.php [new file with mode: 0644]
ctdlphp/ctdlelements.php
ctdlphp/ctdlheader.php
ctdlphp/ctdlsession.php
ctdlphp/sessionproxy.php

diff --git a/ctdlphp/config.php b/ctdlphp/config.php
new file mode 100644 (file)
index 0000000..ff8b767
--- /dev/null
@@ -0,0 +1,10 @@
+<?PHP
+#could be: "uncensored.citadel.org"
+# or the path of the unix domain socket: /var/run/citadel/citadel.sock
+define('CITADEL_HOSTNAME',"127.0.0.1");
+
+#make it 0 to use unix domain sockets
+define('CITADEL_TCP_PORTNO','504');
+
+
+?>
\ No newline at end of file
index 31ab4d28d46bf1fd782b0febf9215cd3be60d418..8834601c4e7657a03c4cd235cefd8d127072e8d2 100644 (file)
@@ -30,7 +30,7 @@ function display_message($msgnum) {
        echo strftime("%b %d %Y %I:%M%p ", $fields["time"]) ;
        echo " from " . htmlspecialchars($fields["from"]) ;
        
-       if (strlen($fields["rfca"]) > 0) {
+       if (isset($fields["rfca"]) && strlen($fields["rfca"]) > 0) {
                echo " &lt;" . htmlspecialchars($fields["rfca"]) . "&gt;" ;
        }
        else if ( (strlen($fields["node"]) > 0) 
@@ -41,7 +41,7 @@ function display_message($msgnum) {
                }
        }
 
-       if (strlen($fields["rcpt"]) > 0) {
+       if (isset($fields["rcpt"]) && strlen($fields["rcpt"]) > 0) {
                echo " to " . htmlspecialchars($fields["rcpt"]) ;
        }
        echo "</I></B><BR>\n" ;
index 39aadf9ea9718fdeac99b289675ccfe713bd54bd..9e8dfde61e5795d1b233361002bb9135e5f3891e 100644 (file)
@@ -61,14 +61,14 @@ LITERAL;
        echo '<TABLE BORDER=0 WIDTH=100%>';
        echo '<TR>';
        echo '<TD>' . $_SESSION["serv_humannode"] . '</TD>' ;
-       echo '<TD>' . $_SESSION["username"] . '</TD>' ;
-       echo '<TD>' . $_SESSION["room"] . '</TD>' ;
+       echo '<TD>' . (isset($_SESSION["username"]))?'':$_SESSION["username"] . '</TD>' ;
+       echo '<TD>' . (isset($_SESSION["room"]))?'':$_SESSION["room"] . '</TD>' ;
        echo '<TD ALIGN=RIGHT><A HREF="logout.php">Log out</A></TD>' ;
        echo '</TR></TABLE>';
        echo '</div>';
 
        // Temporary menu
-       if ($_SESSION["logged_in"]) {
+       if (isset($_SESSION["logged_in"])) {
                echo    '<div id="Menu">' .
                        '<a href="listrooms.php">' .
                        'room list</A><BR>' .
index a120094023eac2a073c69cf551af9421d0006bfa..996975d7a6d6b2b62d78cf6dd89f39d50d1bd762 100644 (file)
@@ -1,5 +1,4 @@
 <?PHP
-
 // $Id$
 //
 // This gets called from within the header functions.  It establishes or
@@ -22,7 +21,7 @@ function establish_citadel_session() {
 
        session_start();
 
-       if ($_SESSION["ctdlsession"]) {
+       if (isset($_SESSION["ctdlsession"])) {
                $session = $_SESSION["ctdlsession"];
        }
        else {
@@ -81,7 +80,7 @@ function establish_citadel_session() {
                }
        }
 
-       if (!$_SESSION["serv_humannode"]) {
+       if (!isset($_SESSION["serv_humannode"])) {
                ctdl_get_serv_info();
        }
 
@@ -89,7 +88,7 @@ function establish_citadel_session() {
        // login.php logout.php do_login.php,
        // and the session is not logged in, redirect to login.php
        //
-       if ($_SESSION["logged_in"] != 1) {
+       if (isset($_SESSION["logged_in"]) && ($_SESSION["logged_in"] != 1)) {
                $filename = basename(getenv('SCRIPT_NAME'));
                if (    (strcmp($filename, "login.php"))
                   &&   (strcmp($filename, "logout.php"))
index 75bd902438306cc0160626bc4d1a35bf86546fee..2e59e81dfae80e451afe7d3e77901ab075599707 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/php -q
 
 <?php
-
+include "config.php";
 // $Id$
 //
 // This is the session proxy that binds a unix domain socket to a Citadel
@@ -86,8 +86,7 @@ chmod($sockname, 0600);
 
 // We need to get a connection to the Citadel server going now.
 
-$ctdlsock = fsockopen("uncensored.citadel.org", 504, $errno, $errstr, 30);
-//$ctdlsock = fsockopen("/appl/citadel/citadel.socket", 0, $errno, $errstr, 30);
+$ctdlsock = fsockopen(CITADEL_HOSTNAME, CITADEL_TCP_PORTNO, $errno, $errstr, 30);
 if (!$ctdlsock) {
        socket_close ($sock);
        system("/bin/rm -f " . $sockname);