public function IsEnabled() { global $sso_settings, $sso_db, $sso_db_apikeys; if (!$sso_settings["sso_remote"]["enabled"]) { return false; } if (!SSO_IsIPAllowed($sso_settings["sso_remote"]["iprestrict"])) { return false; } if (!isset($_REQUEST["sso_remote_id"]) || !is_string($_REQUEST["sso_remote_id"])) { return false; } $remoteid = explode("-", $_REQUEST["sso_remote_id"]); if (count($remoteid) != 2) { return false; } $sso_db_sso_remote = SSO_DB_PREFIX . "p_sso_remote"; try { $row = $sso_db->GetRow("SELECT", array("*", "FROM" => "?", "WHERE" => "id = ? AND remotekey = ?"), $sso_db_sso_remote, $remoteid[1], $remoteid[0]); if ($row === false) { return false; } $this->info["row"] = $row; $this->info["display_name"] = BB_Translate("%s Login", $row->name); $info = unserialize($row->info); if (!isset($info["iprestrict"]) || !SSO_IsIPAllowed($info["iprestrict"]) || SSO_IsSpammer($info["iprestrict"])) { return false; } $this->info["row_info"] = $info; $apirow = $sso_db->GetRow("SELECT", array("*", "FROM" => "?", "WHERE" => "id = ?"), $sso_db_apikeys, $row->apikey_id); if ($apirow === false) { return false; } $this->info["apirow"] = $apirow; } catch (Exception $e) { SSO_DisplayError("A database error has occurred. Most likely cause: Bad SQL query."); } // Set a cookie so future requests succeed. if (!isset($_COOKIE["sso_remote_id"])) { SetCookieFixDomain("sso_remote_id", $_REQUEST["sso_remote_id"], 0, "", "", SSO_IsSSLRequest(), true); } return true; }
<div class="sso_selector_header"><?php echo htmlspecialchars(BB_Translate("Select Sign In Method")); ?> </div> <div class="sso_selectors"> <?php $outputmap = array(); foreach ($sso_providers as $sso_provider => &$instance) { $sso_target_url = SSO_ROOT_URL . "/" . $sso_indexphp . "?sso_provider=" . urlencode($sso_provider) . (isset($_REQUEST["lang"]) ? "&lang=" . urlencode($_REQUEST["lang"]) : ""); ob_start(); $sso_providers[$sso_provider]->GenerateSelector(); $order = isset($sso_settings[""]["order"][$sso_provider]) ? $sso_settings[""]["order"][$sso_provider] : $instance->DefaultOrder(); SSO_AddSortedOutput($outputmap, $order, $sso_provider, ob_get_contents()); ob_end_clean(); } SSO_DisplaySortedOutput($outputmap); ?> </div> </div> </div> <?php echo $sso_footer; } } } } } } } catch (Exception $e) { SSO_DisplayError("A database error has occurred. Most likely cause: Bad SQL query."); }
if (file_exists("upgrade_hook.php")) { require_once "upgrade_hook.php"; } // Initialize language settings. BB_InitLangmap(SSO_ROOT_PATH . "/" . SSO_LANG_PATH . "/", SSO_DEFAULT_LANG); if (isset($_REQUEST["lang"]) && $_REQUEST["lang"] == "") { unset($_REQUEST["lang"]); } if (isset($_REQUEST["lang"])) { BB_SetLanguage(SSO_ROOT_PATH . "/" . SSO_LANG_PATH . "/", $_REQUEST["lang"]); } // Connect to the database and generate database globals. try { SSO_DBConnect(true); } catch (Exception $e) { SSO_DisplayError("Unable to connect to the database."); } // Load in fields without admin select. SSO_LoadFields(false); // Load in $sso_settings and initialize it. SSO_LoadSettings(); if (SSO_USE_HTTPS && !BB_IsSSLRequest()) { UpgradeError("SSL expected. Most likely cause: Bad server configuration."); } function DisplayMessage($str) { echo BB_Translate($str) . "<br />\n"; } function UpgradeError($str) { echo BB_Translate($str) . "<br />\n";