[mw-devel] MW3 r1230 - trunk/webclient

dez at sucs.org dez at sucs.org
Fri Nov 12 21:08:39 GMT 2010


Author: dez
Date: 2010-11-12 21:08:39 +0000 (Fri, 12 Nov 2010)
New Revision: 1230

Modified:
   trunk/webclient/startup.php
Log:
Adds basic SUCSsite integration.


Modified: trunk/webclient/startup.php
===================================================================
--- trunk/webclient/startup.php	2010-11-12 20:54:52 UTC (rev 1229)
+++ trunk/webclient/startup.php	2010-11-12 21:08:39 UTC (rev 1230)
@@ -1,6 +1,5 @@
 <?
 $mwpoll = "/usr/lib64/mw/mwpoll";
-$realuser = "Dez3"; // sucssite username - temporary bodge until we integrate with the site
 $username = trim($_REQUEST['username']);
 $password = trim($_REQUEST['password']);
 
@@ -56,6 +55,22 @@
 $pipes = array();
 
 if (@$_REQUEST['sucssite_loggedin']=="true" && empty($username)) {
+	# Do the bare minimum of SUCSsite init to retrieve the username for the session we've been passed
+	# We should probably do this more intelligently to fail silently if it doesn't work...
+	include("../settings.php");
+	// Initialise the database
+	require("/usr/share/php/adodb/adodb.inc.php");
+	$DB = NewADOConnection('postgres8');
+	$DB->Connect('dbname='.$dbname.' user=apache');
+	$DB->SetFetchMode(ADODB_FETCH_ASSOC);
+	
+	// Include the session library
+	require($base."lib/session.php");
+	$session = new Session;
+	$smarty->assign_by_ref("session", $session);
+	$realuser = $session->username;
+	
+
 	if ($action == "create") {
 		$p = proc_open($mwpoll." -a -u ".$realuser." -s", $desc, $pipes);	
 	} else {




More information about the mw-devel mailing list