本文整理汇总了PHP中UserManager::getFromBLID方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManager::getFromBLID方法的具体用法?PHP UserManager::getFromBLID怎么用?PHP UserManager::getFromBLID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserManager
的用法示例。
在下文中一共展示了UserManager::getFromBLID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toHTML
public function toHTML()
{
$returnHtml = $this->text;
if (isset($this->params->vars)) {
foreach ($this->params->vars as $i => $var) {
$html = "<s>invalid</s>";
switch ($var->type) {
case "user":
$user = UserManager::getFromBLID($var->blid);
$html = "<a href=\"/user/view.php?blid=" . $var->blid . "\">" . $user->getUserName() . "</a>";
break;
case "addon":
$addon = AddonManager::getFromID($var->id);
if ($addon) {
$html = "<a href=\"/addons/addon.php?id=" . $var->id . "\">" . $addon->getName() . "</a>";
} else {
$html = "<a href=\"/addons/addon.php?id=" . $var->id . "\">{error}</a>";
}
break;
}
$returnHtml = str_replace('$' . ($i + 1), $html, $returnHtml);
}
}
return $returnHtml;
}
示例2: hasGlassAccount
function hasGlassAccount()
{
$user = UserManager::getFromBLID($this->blid);
if ($user !== false) {
return true;
} else {
return false;
}
}
示例3: getCurrent
public static function getCurrent()
{
if (!isset($_SESSION)) {
return false;
}
if (isset($_SESSION['blid'])) {
return UserManager::getFromBLID($_SESSION['blid']);
} else {
return false;
}
}
示例4: addEntry
public static function addEntry($blid, $username, $ip = null)
{
if (isset($ip)) {
if (!UserLog::isRemoteVerified($blid, $username, $ip)) {
return "auth.blockland.us verification failed";
}
}
$db = new DatabaseManager();
UserLog::verifyTable($db);
$resource = $db->query("SELECT * FROM `user_log` WHERE `blid`='" . $db->sanitize($blid) . "' AND `username`='" . $db->sanitize($username) . "'");
if ($resource->num_rows == 0) {
$db->query("INSERT INTO `user_log` (`blid`, `firstseen`, `lastseen`, `username`) VALUES ('" . $db->sanitize($blid) . "', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '" . $db->sanitize($username) . "');");
} else {
$db->query("UPDATE `user_log` SET `lastseen` = CURRENT_TIMESTAMP WHERE `blid`='" . $db->sanitize($blid) . "' AND `username`='" . $db->sanitize($username) . "'");
}
//update username
if ($user = UserManager::getFromBLID($blid)) {
if ($username != $user->getUsername()) {
$user->setUsername($username);
}
}
}
示例5: login
public static function login($identifier, $password, $redirect = "/index.php")
{
if (is_numeric($identifier)) {
$blid = intval($identifier);
if (is_int($blid)) {
$loginDetails = UserManager::getLoginDetailsFromBLID($blid);
if (!$loginDetails) {
return ["message" => "This BL_ID has not been verified yet, please use your E-mail instead"];
}
} else {
return ["message" => "Invalid BL_ID"];
}
} elseif (filter_var($identifier, FILTER_VALIDATE_EMAIL)) {
$email = $identifier;
$loginDetails = UserManager::getLoginDetailsFromEmail($email);
} else {
return ["message" => "Invalid E-mail/BL_ID"];
}
if (!$loginDetails) {
//username not found
return ["message" => "Incorrect login credentials"];
}
$hash = $loginDetails['hash'];
$salt = $loginDetails['salt'];
if ($hash === hash("sha256", $password . $salt)) {
$_SESSION['loggedin'] = 1;
$_SESSION['blid'] = $loginDetails['blid'];
$_SESSION['email'] = $loginDetails['email'];
$_SESSION['username'] = $loginDetails['username'];
$userObject = UserManager::getFromBLID($_SESSION['blid']);
if ($userObject == false || $userObject->isMigrated()) {
return ["redirect" => $redirect];
} else {
return ["redirect" => "/user/migrate.php"];
}
}
return ["message" => "Incorrect login credentials"];
}
示例6: UserHandler
//$uo->initFromId($authors[0]->id);
$uo = UserManager::getFromBLID($authors[0]->blid);
$uo2 = new UserHandler();
$uo2->initFromId($authors[1]->id);
$uo2 = UserManager::getFromBLID($authors[1]->blid);
echo "<a href=\"#\">" . $uo->getName() . "</a>";
echo " and ";
echo "<a href=\"#\">" . $uo2->getName() . "</a>";
} else {
$count = sizeof($authors);
//echo("DATA: ");
//print_r($authors);
foreach ($authors as $num => $author) {
//$uo = new UserHandler();
//$uo->initFromId($auth->id);
$uo = UserManager::getFromBLID($author->blid);
if ($count - $num == 1) {
echo "and <a href=\"#\">" . $uo->getName() . "</a>";
} else {
echo "<a href=\"#\">" . $uo->getName() . "</a>, ";
}
}
}
}
?>
</td>
<td>
<image src="http://blocklandglass.com/icon/icons16/star.png" />
<image src="http://blocklandglass.com/icon/icons16/star.png" />
<image src="http://blocklandglass.com/icon/icons16/star.png" />
<image src="http://blocklandglass.com/icon/icons16/star.png" />
示例7: addBLIDToGroupID
public static function addBLIDToGroupID($blid, $gid)
{
//make sure addon exists
$user = UserManager::getFromBLID($blid);
if ($user === false) {
return false;
}
$group = GroupManager::getFromID($gid);
if ($group === false) {
return false;
}
//call real function
return GroupManager::addUserToGroup($user, $group);
}
示例8: dirname
<?php
require_once dirname(__DIR__) . '/class/UserManager.php';
$user = UserManager::getFromBLID(9789);
UserManager::sendPasswordResetEmail($user);
//UserManager::email($user, "Password Reset", $body);
示例9: realpath
<?php
//this page is designed to be requested by ajax or the in-game client
require_once realpath(dirname(__DIR__) . "/private/class/DatabaseManager.php");
require_once realpath(dirname(__DIR__) . "/private/lib/Parsedown.php");
if (!isset($_POST['query'])) {
echo "Invalid search";
} else {
$db = new DatabaseManager();
$baseQuery = "SELECT * FROM `addon_addons` WHERE `name` LIKE '%" . $db->sanitize($_POST['query']) . "%'";
//later on we can make it so administrators can search for deleted add-ons
$extendedQuery = " AND `deleted` = 0";
if (isset($_POST['blid'])) {
try {
require_once realpath(dirname(__DIR__) . "/private/class/UserManager.php");
$user = UserManager::getFromBLID($_POST['blid']);
$extendedQuery = $extendedQuery . " AND `author` = '" . $db->sanitize($_POST['blid']) . "'";
} catch (Exception $e) {
echo "<p>User " . htmlspecialchars($_POST['blid']) . " not found.</p>";
}
}
//One of the few time's we'll use a direct SQL query on a page
$result = $db->query($baseQuery . $extendedQuery);
echo "<h2>Search Results for ";
echo "\"<u>" . htmlspecialchars($_POST['query']) . "</u>\"";
if (isset($user) && $user) {
echo " by <a href=\"/user/view.php?id=" . $user->getID() . "\">" . htmlspecialchars($user->getUsername()) . "</a>";
}
echo "</h2><hr />";
if ($result->num_rows) {
while ($row = $result->fetch_object()) {
示例10: realpath
<?php
$addons = (include realpath(dirname(__FILE__) . "/searchAddons.php"));
require_once realpath(dirname(__DIR__) . "/class/UserManager.php");
$users = [];
foreach ($addons as $addon) {
if (!isset($users[$addon->blid])) {
$users[$addon->blid] = UserManager::getFromBLID($addon->blid);
}
}
$response = ["addons" => $addons, "users" => $users];
return $response;
示例11: stdClass
$board[3] = "Bricks";
$board[4] = "Cosmetics";
$board[5] = "Gamemodes";
$board[6] = "Tools";
$board[7] = "Weapons";
$board[8] = "Colorsets";
$board[9] = "Vehicles";
$board[10] = "Bargain Bin";
$board[11] = "Sounds";
$o = new stdClass();
$o->id = $ao->getId();
$o->name = $ao->getName();
$o->board = $board[$ao->getBoard()];
$un = utf8_encode(UserLog::getCurrentUsername($ao->getManagerBLID()));
if ($un === false) {
$un = UserManager::getFromBLID($ao->getManagerBLID())->getUsername();
}
$o->author = $un;
$ar[] = $o;
}
$dlg->uploads = $ar;
$ar = array();
foreach ($recentUpdates as $r) {
$ao = $r->getAddon();
if (!$ao->getApproved()) {
continue;
}
if ($ao->getBoard() == 10) {
// bargain bin
continue;
}
示例12: createGroupWithLeaderBLID
public static function createGroupWithLeaderBLID($name, $description, $color, $icon, $blid)
{
$user = UserManager::getFromBLID($blid);
if ($user === false) {
return false;
}
return GroupManager::createGroupWithLeader($name, $description, $color, $icon, $user);
}
示例13: realpath
require_once realpath(dirname(__DIR__) . "/private/class/NotificationManager.php");
require_once realpath(dirname(__DIR__) . "/private/class/NotificationObject.php");
if (isset($_REQUEST['token']) && isset($_REQUEST['id'])) {
if (isset($_REQUEST['password']) && isset($_REQUEST['confirm'])) {
if ($_REQUEST['password'] == $_REQUEST['confirm']) {
UserManager::updatePassword($_REQUEST['id'], $_REQUEST['password']);
header('Location: /login.php');
return;
} else {
$response = ["message" => "Passwords dont match!", "form" => true];
}
} else {
$blid = $_REQUEST['id'];
$token = $_REQUEST['token'];
apc_delete('userObject_' . $_REQUEST['id']);
$userObj = UserManager::getFromBLID($blid);
if ($userObj->getResetKey() !== $token) {
$response = ["message" => "<b>Invalid reset token.</b> Did you request a password reset twice on accident?", "form" => false];
} else {
if (time() - $userObj->getResetTime() > 1800) {
$response = ["message" => "<b>Your password reset has expired!</b> Try resending the email. " . (time() - $userObj->getResetTime()), "form" => false];
} else {
$response = ["message" => null, "form" => true];
}
}
}
} else {
$response = ["message" => "Reset token/id missing", "form" => false];
}
?>
<div class="maincontainer">
示例14: testGetFromBLID2
public function testGetFromBLID2()
{
$this->testRegisterSuccess();
$response = UserManager::getFromBLID(1234);
$this->assertFalse($response);
$response = UserManager::getAllAccountsFromBLID(1234);
$this->assertNotEquals(false, $response);
$this->assertEquals(1, count($response));
$acc = $response[0];
$this->assertEquals(1234, $acc->getBLID());
}
示例15: realpath
if (!isset($_GET['id'])) {
$response = ["redirect" => "/builds/index.php"];
return $response;
}
require_once realpath(dirname(__DIR__) . "/class/BuildManager.php");
require_once realpath(dirname(__DIR__) . "/class/UserManager.php");
require_once realpath(dirname(__DIR__) . "/class/ScreenshotManager.php");
// require_once(realpath(dirname(__DIR__) . "/class/TagManager.php"));
// require_once(realpath(dirname(__DIR__) . "/class/DependencyManager.php"));
$build = BuildManager::getFromID($_GET['id'] + 0);
if ($build === false) {
$response = ["redirect" => "/builds/index.php"];
return $response;
}
$user = UserManager::getFromBLID($build->blid);
// $tagIDs = $build->getTags();
// $dependencyIDs = $build->getDependencies();
// $tags = [];
// $dependencies = [];
//
// foreach($tagIDS as $tid) {
// $tags[] = TagManager::getFromID($tid);
// }
//
// foreach($dependencyIDs as $did) {
// $dependencies[] = DependencyManager::getFromID($did);
// }
$screenshotIDs = ScreenshotManager::getScreenshotsFromBuild($build->id);
$primaryScreenshotID = ScreenshotManager::getBuildPrimaryScreenshot($build->id);
$screenshots = [];