Cleaned up the config interface.
authorArt Cancro <ajc@citadel.org>
Thu, 2 Aug 2007 21:19:54 +0000 (21:19 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 2 Aug 2007 21:19:54 +0000 (21:19 +0000)
* Eliminated SOCKET_PREFIX because unix:// works on PHP4 too, so
  we can use it all the time.
* Prefix has been moved to CITADEL_HOSTNAME
* Added config_ctdlclient_local.php and added it to .svnignore, so
  site operators and developers can override without wreaking havoc
  in svn.

ctdlphp/.svnignore [new file with mode: 0644]
ctdlphp/config_ctdlclient.php
ctdlphp/ctdlsession.php
ctdlphp/sessionproxy.php

diff --git a/ctdlphp/.svnignore b/ctdlphp/.svnignore
new file mode 100644 (file)
index 0000000..6e158d8
--- /dev/null
@@ -0,0 +1 @@
+config_ctdlclient_local.php
index bfedf45fcb8f7e43034d3e71e5a17d2a7b67e35e..bcbdf45c1751a7ec889cab36b794b25f6b28d167 100644 (file)
@@ -1,16 +1,33 @@
 <?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');
+// Please override these defaults in config_ctdlclient_local.php, not here.
 
-#do you want to see the server conversation for exploring the protocol?
-define('CITADEL_DEBUG_CITPROTO',0);
-define('CITADEL_DEBUG_PROXY', FALSE);
-#switch this if you're using php5
-#define('SOCKET_PREFIX', "unix://");
-define('SOCKET_PREFIX', "");
+include "config_ctdlclient_local.php";
 
-?>
\ No newline at end of file
+// Examples:
+// 
+// On the same host:
+// unix:///var/run/citadel/citadel.sock
+//
+// On a different host (or via loopback):
+// tcp://citserver.example.com
+// tcp://127.0.0.1
+
+if (!defined('CITADEL_HOSTNAME')) {
+       define('CITADEL_HOSTNAME',"tcp://127.0.0.1");
+}
+
+// make it 0 to use unix domain sockets
+if (!defined('CITADEL_TCP_PORTNO')) {
+       define('CITADEL_TCP_PORTNO','504');
+}
+
+// do you want to see the server conversation for exploring the protocol?
+if (!defined('CITADEL_DEBUG_CITPROTO')) {
+       define('CITADEL_DEBUG_CITPROTO',0);
+}
+if (!defined('CITADEL_DEBUG_PROXY')) {
+       define('CITADEL_DEBUG_PROXY', FALSE);
+}
+
+?>
index 988839cc885286be72454637a97b9aa0c5a416f7..672d6f636aa7f23fabd87f2d0ef5054072a79461 100644 (file)
@@ -35,7 +35,7 @@ function establish_citadel_session() {
 
        $sockname = "/tmp/" . $session . ".socket" ;
 
-       $clientsocket = fsockopen(SOCKET_PREFIX.$sockname, 0, $errno, $errstr, 5);
+       $clientsocket = fsockopen('unix://' . $sockname, 0, $errno, $errstr, 5);
        if (!$clientsocket) {
                // It ain't there, dude.  Open up the proxy. (C version)
                //$cmd = "./sessionproxy " . $sockname ;
index fdb7b699dfbfe98dd4c68dc31b1d74ca63706903..22f4d4a0eddc1272e5e210b17088de6b85c2bc6e 100755 (executable)
@@ -14,10 +14,10 @@ include "config_ctdlclient.php";
 // Copyright (c) 2003 by Art Cancro <ajc@uncensored.citadel.org>
 // This program is released under the terms of the GNU General Public License.
 
+global $msgsock;
 
 // sock_gets() -- reads one line of text from a socket
 // 
-$msgsock;
 if (CITADEL_DEBUG_PROXY)
 {
        define_syslog_variables();
@@ -96,7 +96,7 @@ chmod($sockname, 0600);
 
 // We need to get a connection to the Citadel server going now.
 
-$ctdlsock = fsockopen(SOCKET_PREFIX.CITADEL_HOSTNAME, CITADEL_TCP_PORTNO, $errno, $errstr, 30);
+$ctdlsock = fsockopen(CITADEL_HOSTNAME, CITADEL_TCP_PORTNO, $errno, $errstr, 30);
 if (!$ctdlsock) {
        socket_close ($sock);
        system("/bin/rm -f " . $sockname);