本文整理汇总了PHP中lms_steam::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP lms_steam::connect方法的具体用法?PHP lms_steam::connect怎么用?PHP lms_steam::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lms_steam
的用法示例。
在下文中一共展示了lms_steam::connect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: http_auth
function http_auth()
{
// Abfragen ob man bereits über das koaLA Interface eingeloggt ist
// Wenn ja, kein HTTP_AUTH notwendig
if (isset($_SESSION["LMS_USER"]) && $_SESSION["LMS_USER"] instanceof lms_user && $_SESSION["LMS_USER"]->is_logged_in()) {
$lms_user = $_SESSION["LMS_USER"];
lms_steam::connect(STEAM_SERVER, STEAM_PORT, $lms_user->get_login(), $lms_user->get_password());
return true;
} else {
// Wenn nicht, untenstehende checks durchführen
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] === "" || $_SERVER['PHP_AUTH_PW'] === "") {
// User abort
header('WWW-Authenticate: Basic realm="koaLA"');
header('HTTP/1.0 401 Unauthorized');
return false;
} else {
// Correct Login
$lms_user_new = new lms_user($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
if (!$lms_user_new->login()) {
header('WWW-Authenticate: Basic realm="koaLA"');
header('HTTP/1.0 401 Unauthorized');
return false;
}
$_SESSION["LMS_USER"] = $lms_user_new;
return true;
}
}
}
示例2: handleRequest
public function handleRequest($pathArray)
{
$frame = lms_portal::get_instance();
//$frame->initialize(GUEST_NOT_ALLOWED, false);
$frame->init_login(GUEST_ALLOWED, false);
lms_steam::connect(STEAM_SERVER, STEAM_PORT, $frame->get_user()->get_login(), $frame->get_user()->get_password());
$urlRequestObject = new UrlRequestObject();
$urlRequestObject->setParams($pathArray);
$command = new \Wave\Commands\Index();
if ($command->validateData($urlRequestObject)) {
$command->processData($urlRequestObject);
try {
$frameResponeObject = $command->frameResponse(new FrameResponseObject());
} catch (steam_exception $e) {
if ($e->get_code() === 300) {
die("no read access");
}
}
$data = \Widgets\Widget::getData($frameResponeObject->getWidgets());
echo $data["html"];
}
}
示例3: login
public function login($login = "", $password = "")
{
if (empty($login)) {
$login = $this->login;
$password = $this->get_password();
} else {
if (empty($password)) {
throw new Exception("Password not given ({$login}).", E_USER_LOGIN);
}
$this->login = $login;
$this->set_password($password);
}
if (lms_steam::is_connected()) {
lms_steam::disconnect();
}
lms_steam::connect(STEAM_SERVER, STEAM_PORT, $login, $password);
if (!lms_steam::is_logged_in()) {
return FALSE;
}
// ASSIGN COMMON ATTRIBUTES
$this->logged_in = TRUE;
// INITIALIZE ATTRIBUTES
$this->init_attributes();
// INITIALIZE NETWORKING_PROFILE
$steam_user = lms_steam::get_current_user();
if (!$steam_user->get_attribute("LLMS_NETWORKING_PROFILE") instanceof steam_object) {
$profile = new lms_networking_profile($steam_user);
$profile->initialize();
logging::write_log(LOG_MESSAGES, "REGISTRATION\t" . $login);
}
// NEW ENTRY IN LOGFILE
logging::write_log(LOG_MESSAGES, "LOGIN\t\t" . $login);
$_SESSION["last_login"] = $steam_user->get_attribute("LMS_LAST_LOGIN");
$steam_user->set_attribute("LMS_LAST_LOGIN", time());
return TRUE;
}
示例4: initialize
public function initialize($guest_allowed = FALSE, $offline = FALSE)
{
if ($this->init_done) {
return;
}
$this->init_login($guest_allowed, $offline);
// LOG OUT ON POST-EVENT
if (isset($_GET["action"]) && $_GET["action"] == "sign_out") {
$this->set_confirmation(gettext("You are logged out."));
$this->logout();
}
if (isset($_GET["action"]) && $_GET["action"] == "search") {
}
if (!$offline) {
lms_steam::connect(STEAM_SERVER, STEAM_PORT, $this->lms_user->get_login(), $this->lms_user->get_password());
}
// DISCLAIMER HANDLING
if (DISCLAIMER && isset($GLOBALS['STEAM']) && $this->lms_user->get_login() != "guest") {
$steam_user = $GLOBALS['STEAM']->get_current_steam_user();
if ($steam_user instanceof steam_user) {
$user_disclaimer = $steam_user->get_attribute("USER_ACCEPTED_DISCLAIMER");
if ($user_disclaimer === 0 || !$user_disclaimer === "TRUE") {
if (strpos($_SERVER['REQUEST_URI'], "disclaimer_local.php") == null) {
throw new Exception("Disclaimer must be accepted.", E_USER_DISCLAIMER);
}
}
}
}
// CHANGE PASSWORD
if (CHANGE_PASSWORD && isset($GLOBALS['STEAM']) && isset($GLOBALS['STEAM'])) {
$steam_user = $GLOBALS['STEAM']->get_current_steam_user();
if ($steam_user instanceof steam_user) {
$user_generated_password = $steam_user->get_attribute("USER_GENERATED_PASSWORD");
if ($user_generated_password != "") {
if (strpos($_SERVER['REQUEST_URI'], "usermanagement") == null && strpos($_SERVER['REQUEST_URI'], "disclaimer_local.php") == null) {
throw new Exception("Change Password.", E_USER_CHANGE_PASSWORD);
}
}
}
}
// CHOOSE RIGHT LANGUAGE AND SET LOCALES FOR GETTEXT
language_support::choose_language();
// SET LOGO URL
$this->template->setVariable("PATH_URL", PATH_URL);
// SET STYLEPATH AND ADDITIONAL HEADERS
$this->template->setVariable("STYLE_PATH", PATH_STYLE);
$this->template->setVariable("STANDARD_STYLE_PATH", PATH_URL);
// LOAD JAVA-SCRIPTS
// $this->add_javascript( PATH_JAVASCRIPT . "bbcode.js?version=".KOALA_VERSION );
// $this->add_javascript( PATH_JAVASCRIPT . "javascript_minimized.js?version=".KOALA_VERSION );
$this->template->setVariable("PATH_JAVASCRIPT", PATH_JAVASCRIPT);
$this->template->setVariable("KOALA_VERSION", KOALA_VERSION);
// GENERATE HTML FOR STATUS-DIV
$this->set_status($offline);
// SET CONFIRMATION
$this->set_confirmation();
// SET ERROR
$this->set_problem_description("");
// Set default page title
$this->set_page_title("");
$this->template->setVariable("DEVELOPER_MODE", DEVELOPMENT_MODE);
$this->template->setVariable("PATH_URL", PATH_URL);
// SET USER ID FOR JAVASCRIPTS
$this->template->setVariable("USER_LOGIN", $this->lms_user->get_login());
// LANGUAGE
if (isset($_SESSION["LMS_USER"]) && $_SESSION["LMS_USER"]->is_logged_in() && isset($GLOBALS["STEAM"]) && is_object($GLOBALS["STEAM"]->get_current_steam_user())) {
$ulang = $GLOBALS["STEAM"]->get_current_steam_user()->get_attribute("USER_LANGUAGE");
if (!is_string($ulang) || $ulang === "0") {
$ulang = LANGUAGE_DEFAULT_STEAM;
}
$languages = array("english" => array("name" => gettext("English"), "icon" => "flag_gb.gif", "lang_key" => "en_US"), "german" => array("name" => gettext("German"), "icon" => "flag_de.gif", "lang_key" => "de_DE"));
if (!array_key_exists($ulang, $languages)) {
$ulang = LANGUAGE_DEFAULT_STEAM;
}
/*
$this->template->setCurrentBlock("PORTAL_LANGUAGES");
$this->template->setVariable("PORTAL_LANGUAGES_REDIRECT", $_SERVER["REQUEST_URI"] );
$this->template->setVariable("PORTAL_LANGUAGES_ACTION", PATH_URL . "?action=switch_language");
foreach( $languages as $key => $language) {
$this->template->setCurrentBlock("LANGUAGE");
$this->template->setVariable("LABEL_LANGUAGE_LABEL", "language_" . $key);
$this->template->setVariable("LANGUAGE_ICON", PATH_URL . "styles/" . STYLE . "/images/" . $language["icon"]);
$this->template->setVariable("LABEL_LANGUAGE", $language["name"]);
$this->template->setVariable("LANGUAGE_VALUE", $key);
if ( $ulang == $key ) {
$this->template->setVariable("LANGUAGE_CHECKED", "checked=\"checked\"");
}
$this->template->parse("LANGUAGE");
}
$this->template->parse("PORTAL_LANGUAGES");
*/
}
$this->template->setVariable("COPYRIGHT_INFO", "© " . strftime("%Y") . " " . secure_gettext(COPYRIGHT_NAME));
$this->template->setVariable("IMPRESSUM_INFO", " | " . " <a href='" . PATH_URL . "imprint/'>" . gettext("Imprint") . "</a>");
DISCLAIMER ? $this->template->setVariable("SECURITY_INFO", " | " . " <a href='" . PATH_URL . "disclaimer_static.php'>" . "Nutzerordnung" . "</a>") : "";
// $this->template->setVariable( "SECURITY_INFO", " | " . " <a target='_blank' href='".PATH_URL."html/datenschutzerklaerung.html' >Datenschutzerklärung</a>" );
// $this->template->setVariable( "POLICY_INFO", " | " . " <a target='_blank' href='".PATH_URL."html/policy.html' >Policy</a>" );
// $this->template->setVariable( "FUNDING_INFO", " | " . str_replace( "%NAME", " <a href='http://www.bmbf.de' target='_blank'>BMBF</a>", gettext( "funded by %NAME" ) ) );
// $this->template->setVariable( "POWERED_BY_INFO", " | " . str_replace( "%NAME", " <a href='http://www.open-steam.org' target='_blank'>open-sTeam</a>", gettext( "powered by %NAME" ) ) );
logging::write_log(LOG_MESSAGES, "RELOAD\t" . $this->lms_user->get_login());
//.........这里部分代码省略.........