예제 #1
0
 public function GetMembers($max = null)
 {
     global $MySQL;
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "Users, " . System::$Configuration["Database.TablePrefix"] . "PageMembers WHERE " . System::$Configuration["Database.TablePrefix"] . "PageMembers.pagemember_PageID = " . $this->ID . " AND " . System::$Configuration["Database.TablePrefix"] . "PageMembers.pagemember_UserID = " . System::$Configuration["Database.TablePrefix"] . "Users.user_ID";
     $result = $MySQL->query($query);
     $count = $result->num_rows;
     $retval = array();
     for ($i = 0; $i < $count; $i++) {
         $values = $result->fetch_assoc();
         $retval[] = User::GetByAssoc($values);
     }
     return $retval;
 }
예제 #2
0
 public static function GetRandom()
 {
     global $MySQL;
     $query = "SELECT * FROM " . System::GetConfigurationValue("Database.TablePrefix") . "Users ORDER BY RAND() LIMIT 1";
     $result = $MySQL->query($query);
     $values = $result->fetch_assoc();
     return User::GetByAssoc($values);
 }
예제 #3
0
 /**
  * Retrieves a single User with the given credentials.
  * @param string $username The user name of the User to search for.
  * @param string $password The password of the User to search for.
  * @return NULL|\PhoenixSNS\Objects\User The User with the given credentials, or null if no User with the given credentials was found or the credentials were invalid
  */
 public static function GetByCredentials($username, $password)
 {
     global $pdo;
     $query = $pdo->prepare("SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "Users WHERE user_LoginID = :LoginID");
     $query->bindParam(":LoginID", $username);
     $result = $query->execute();
     if ($result === false) {
         return null;
     }
     $values = $query->fetch(PDO::FETCH_ASSOC);
     $passwordSalt = $values["user_PasswordSalt"];
     $passwordHashCmp = $values["user_PasswordHash"];
     $passwordHash = hash("sha512", $password . $passwordSalt);
     if ($passwordHash == $passwordHashCmp) {
         return User::GetByAssoc($values);
     }
     return null;
 }
예제 #4
0
    $includes = explode(",", $include);
    foreach ($availableTables as $key => $value) {
        $availableTables[$key] = false;
    }
    foreach ($includes as $include) {
        $availableTables[$include] = true;
    }
}
if ($availableTables["Users"]) {
    $lookupTables[] = new LookupTable("Users", "user_DisplayName", function ($table, $totalCount, $previousCount) {
        $result = $table->Result;
        $items = array();
        $c = 0;
        for ($i = 0; $i < $result->num_rows; $i++) {
            $values = $result->fetch_assoc();
            $item = User::GetByAssoc($values);
            if (!$item->IsVisible()) {
                $c++;
                continue;
            }
            $items[] = $item;
        }
        $totalCount -= $c;
        $count = count($items);
        for ($i = 0; $i < $count; $i++) {
            $item = $items[$i];
            echo "{ \"Category\": \"Members\", \"Item\": ";
            echo $item->ToJSON();
            echo " }";
            if ($i + $previousCount < $totalCount - 1) {
                echo ", ";