function authenticate($username, $password) { global $alfTicket, $alfRepository, $alfWikiSpaceNodeRef, $alfLog; $result = false; $localTicket = MediaWikiSpace::validate($alfRepository, $alfWikiSpaceNodeRef, $username, $password); if ($localTicket != null) { // Store the ticket for later use now we know it's good $alfTicket = $localTicket; $_SESSION["alfTicket"] = $localTicket; $result = true; } return $result; }
// Create a reference to the media wiki node if ($alfWikiSpaceNodeRef != null) { $alfMediaWikiNode = $alfSession->getNodeFromString($alfWikiSpaceNodeRef); } else { // Use the default wiki node $nodes = $alfSession->query(new SpacesStore($alfSession), "TYPE:\"mw:mediaWiki\""); if (sizeof($nodes) == 0) { // Redirect to the login page, since we can't find the mediaWiki space (probably means incorrect permissions) header("Location: " . $loginURL); exit; } $alfMediaWikiNode = $nodes[0]; $alfWikiSpaceNodeRef = $alfMediaWikiNode->__toString(); } // Validate the ticket (checks you have correct permissions on the wiki space and that the ticket is valid) if (MediaWikiSpace::validate($alfRepository, $alfWikiSpaceNodeRef, "", $alfTicket) == false) { // Redirect to the login page, since the ticket is knacked or you don't have permissions header("Location: " . $loginURL); exit; } // Set the configuration values eval(MediaWikiSpace::getEvaluationString($alfRepository, $alfWikiSpaceNodeRef)); // Make sure the setup is not included later define(MW_NO_SETUP, true); require_once "Setup.php"; // Check to see if we should be doing an 'auto' login if ($doLogin == true) { // Authenticate the mediawiki user $u = User::newFromName($passedUser); if (is_null($u) == false && User::isUsableName($u->getName()) == true) { // Check to see if the user already exists