示例#1
0
 public static function GetByPath($path)
 {
     $pdo = DataSystem::GetPDO();
     $query = "SELECT * FROM " . System::GetConfigurationValue("Database.TablePrefix") . "Contents WHERE content_Path = :content_Path AND content_LanguageID = :content_LanguageID";
     $statement = $pdo->prepare($query);
     $result = $statement->execute(array(":content_Path" => $path, ":content_LanguageID" => Language::GetCurrent()->ID));
     if ($statement->rowCount() < 1) {
         return null;
     }
     $values = $statement->fetch(PDO::FETCH_ASSOC);
     return Content::GetByAssoc($values);
 }
示例#2
0
 /**
  * Retrieves the language currently in use by the currently logged-in user.
  * @return \PhoenixSNS\Objects\Language The language currently in use by the currently logged-in user.
  */
 public static function GetCurrent()
 {
     return Language::GetByID(1);
 }
示例#3
0
 public static function GetByName($stringName, $language = null)
 {
     if ($language == null) {
         $language = Language::GetCurrent();
     }
     if ($language == null) {
         return "@TRANSLATE['" . $stringName . "']@";
     }
     global $MySQL;
     $query = "SELECT languagestring_StringValue FROM " . System::GetConfigurationValue("Database.TablePrefix") . "LanguageStrings WHERE languagestring_StringName = '" . $MySQL->real_escape_string($stringName) . "' AND languagestring_LanguageID  = " . $language->ID;
     $result = $MySQL->query($query);
     if ($result === false) {
         return "@TRANSLATE['" . $stringName . "']@";
     }
     $count = $result->num_rows;
     if ($count == 0) {
         return "@TRANSLATE['" . $stringName . "']@";
     }
     $values = $result->fetch_array();
     return $values[0];
 }
示例#4
0
echo LanguageString::GetByName("shortname_label");
?>
</label>
					<input type="text" accesskey="U" id="txtShortName" name="member_shortname" value="<?php 
echo $CurrentUser->ShortName;
?>
" />
				</div>
				<div class="FormItem">
					<label for="cboLanguage"><?php 
echo LanguageString::GetByName("language_label");
?>
</label>
					<select id="cboLanguage" accesskey="L" name="member_language_id">
						<?php 
$languages = Language::Get();
foreach ($languages as $language) {
    ?>
						<option value="<?php 
    echo $language->ID;
    ?>
"<?php 
    if ($language->ID == $CurrentUser->Language->ID) {
        echo " selected=\"selected\"";
    }
    ?>
><?php 
    echo $language->Title;
    ?>
</option>
						<?php 
示例#5
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;
 }
示例#6
0
 /**
  * Sets the description of this TenantObject to the specified value for the given language.
  * @param Language $language The Language for which to set this description.
  * @param string $value The description to set.
  * @return boolean True if the operation completed successfully; false if the operation failed.
  */
 public function SetDescription($language, $value)
 {
     if ($language == null) {
         $language = Language::GetCurrent();
     }
     global $MySQL;
     $query = "SELECT COUNT(*) FROM " . System::$Configuration["Database.TablePrefix"] . "TenantObjectDescriptions WHERE entry_LanguageID = " . $language->ID . " AND entry_ObjectID = " . $this->ID;
     $result = $MySQL->query($query);
     if ($result === false) {
         return false;
     }
     $values = $result->fetch_array();
     if (is_numeric($values[0]) && $values[0] > 0) {
         $query = "UPDATE " . System::$Configuration["Database.TablePrefix"] . "TenantObjectDescriptions SET entry_Value = '" . $MySQL->real_escape_string($value) . "' WHERE entry_LanguageID = " . $language->ID . " AND entry_ObjectID = " . $this->ID;
         $result = $MySQL->query($query);
         if ($result === false) {
             return false;
         }
     } else {
         $query = "INSERT INTO " . System::$Configuration["Database.TablePrefix"] . "TenantObjectDescriptions (entry_LanguageID, entry_ObjectID, entry_Value) VALUES (" . $language->ID . ", " . $this->ID . ", '" . $MySQL->real_escape_string($value) . "')";
         $result = $MySQL->query($query);
         if ($result === false) {
             return false;
         }
     }
     return true;
 }
<?php

use PhoenixSNS\Objects\Language;
$langEnglish = Language::GetByID(1);