Exemple #1
0
 public static function GetByName($name)
 {
     $pdo = DataSystem::GetPDO();
     $query = "SELECT * FROM " . System::GetConfigurationValue("Database.TablePrefix") . "Themes WHERE theme_Name = :theme_Name";
     $statement = $pdo->prepare($query);
     $result = $statement->execute(array(":theme_Name" => $name));
     if ($statement->rowCount() > 0) {
         $values = $statement->fetch(PDO::FETCH_ASSOC);
         return Theme::GetByAssoc($values);
     }
     return null;
 }
Exemple #2
0
 public static function GetByAssoc($values, $allusers = false)
 {
     $user = new User();
     $user->ID = $values["user_ID"];
     $user->UserName = $values["user_LoginID"];
     $user->ShortName = $values["user_URLName"];
     $user->LongName = $values["user_DisplayName"];
     $user->EmailAddress = $values["user_EmailAddress"];
     $user->BirthDate = $values["user_BirthDate"];
     $user->RealName = $values["user_RealName"];
     $user->Theme = Theme::GetByID($values["user_ThemeID"]);
     $user->ConsecutiveLoginCount = $values["user_ConsecutiveLoginCount"];
     $user->ConsecutiveLoginFailures = $values["user_ConsecutiveLoginFailures"];
     $user->LastLoginDate = $values["user_LastLoginTimestamp"];
     $user->RegistrationDate = $values["user_RegistrationTimestamp"];
     $user->RegistrationIPAddress = $values["user_RegistrationIPAddress"];
     if (isset($_SESSION["CurrentUserID"])) {
         $user->IsAuthenticated = $_SESSION["CurrentUserID"] == $user->ID;
     } else {
         $user->IsAuthenticated = false;
     }
     $user->Language = Language::GetByID($values["user_LanguageID"]);
     $user->ProfileVisibility = UserProfileVisibility::FromIndex($values["user_ProfileVisibility"]);
     $presence = new UserPresence();
     $presence->Status = $values["user_PresenceStatus"];
     $presence->Message = $values["user_PresenceMessage"];
     $user->Presence = $presence;
     $user->StartPage = StartPage::GetByID($values["user_StartPageID"]);
     $user->LastLoginDate = $values["user_LastLoginTimestamp"];
     if (!$allusers) {
         // check for blocked users
         if (isset($_SESSION["CurrentUserID"])) {
             if ($user->ID != $_SESSION["CurrentUserID"]) {
                 if (!$user->IsVisible()) {
                     return null;
                 }
             }
         }
     }
     return $user;
 }