/** * Retrieves all TenantObjects, optionally associated with the given Tenant. * @param string $max The maximum number of TenantObjects to return * @param Tenant $tenant The tenant whose TenantObjects to return (or null to return all TenantObjects) * @return TenantObject[] array of TenantObjects residing on the server and optionally associated with the specified Tenant */ public static function Get($max = null, $tenant = null) { global $MySQL; $retval = array(); if ($tenant == null) { $tenant = Tenant::GetCurrent(); } if ($tenant == null) { return $retval; } $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "TenantObjects WHERE object_TenantID = " . $tenant->ID; if (is_numeric($max)) { $query .= " LIMIT " . $max; } $result = $MySQL->query($query); if ($result === false) { return $retval; } $count = $result->num_rows; for ($i = 0; $i < $count; $i++) { $values = $result->fetch_assoc(); $retval[] = TenantObject::GetByAssoc($values); } return $retval; }
public static function GetByAssoc($values) { $item = new TenantProperty(); $item->ID = $values["property_ID"]; $item->Tenant = Tenant::GetByID($values["property_TenantID"]); $item->Name = $values["property_Name"]; $item->Description = $values["property_Description"]; $item->DataType = DataType::GetByID($values["property_DataTypeID"]); $item->DefaultValue = $item->DataType->Decode($values["property_DefaultValue"]); return $item; }
public static function GetByID($id) { if (!is_numeric($id)) { return null; } $tenant = Tenant::GetCurrent(); $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "TenantEnumerations WHERE enum_ID = " . $id . " AND enum_TenantID = " . $tenant->ID; $result = $MySQL->query($query); if ($result === false) { return null; } $count = $result->num_rows; if ($count == 0) { return null; } $values = $result->fetch_assoc(); return TenantEnumeration::GetByAssoc($values); }
public static function Log($message, $params = null, $severity = LogMessageSeverity::Error) { $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); if ($params == null) { $params = array(); } global $MySQL; $tenant = Tenant::GetCurrent(); $query = "INSERT INTO " . System::$Configuration["Database.TablePrefix"] . "DebugMessages (message_TenantID, message_Content, message_SeverityID, message_Timestamp, message_IPAddress) VALUES ("; $query .= ($tenant == null ? "NULL" : $tenant->ID) . ", "; $query .= "'" . $MySQL->real_escape_string($message) . "', "; $query .= $severity . ", "; $query .= "NOW(), "; $query .= "'" . $MySQL->real_escape_string($_SERVER["REMOTE_ADDR"]) . "'"; $query .= ")"; $MySQL->query($query); $msgid = $MySQL->insert_id; foreach ($bt as $bti) { $filename = "(unknown)"; $lineNumber = "(unknown)"; if (isset($bti["file"])) { $filename = $bti["file"]; } if (isset($bti["line"])) { $lineNumber = $bti["line"]; } $query = "INSERT INTO " . System::$Configuration["Database.TablePrefix"] . "DebugMessageBacktraces (bt_MessageID, bt_FileName, bt_LineNumber) VALUES ("; $query .= $msgid . ", "; $query .= "'" . $MySQL->real_escape_string($filename) . "', "; $query .= $lineNumber; $query .= ")"; $MySQL->query($query); } foreach ($params as $key => $value) { $query = "INSERT INTO " . System::$Configuration["Database.TablePrefix"] . "DebugMessageParameters (mp_MessageID, mp_Name, mp_Value) VALUES ("; $query .= $msgid . ", "; $query .= "'" . $MySQL->real_escape_string($key) . "', "; $query .= "'" . $MySQL->real_escape_string($value) . "'"; $query .= ")"; $MySQL->query($query); } }
public static function RegisterUser($loginID, $password, $longName, $shortName, $emailAddress = null) { $CurrentTenant = Tenant::GetCurrent(); // create an instance of the User object in this tenant $obj = $CurrentTenant->GetObject("User"); // retrieve the salted password from the User object $pwsalt = $obj->GetMethod("SaltPassword")->Execute(); // tell the User object to hash the password $pwhash = $obj->GetMethod("HashPassword")->Execute(array(new TenantObjectMethodParameterValue("input", $pwsalt . $password))); $inst = $obj->CreateInstance(array(new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("LoginID"), $loginID), new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("DisplayName"), $longName), new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("URL"), $shortName), new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("EmailAddress"), $emailAddress), new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("PasswordHash"), $pwhash), new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("PasswordSalt"), $pwsalt))); if ($inst != null) { return UserRegistrationStatus::AwaitingVerification; } global $MySQL; RegistrationManager::$ErrorCode = $MySQL->errno; // DataFX::$Errors->Items[0]->Code; RegistrationManager::$ErrorMessage = $MySQL->error; // DataFX::$Errors->Items[0]->Message; return UserRegistrationStatus::GeneralError; }
function displayProfileTitle() { $path = System::GetVirtualPath(); $id = $path[1]; $CurrentTenant = Tenant::GetCurrent(); $objUser = $CurrentTenant->GetObject("User"); $thisuser = $objUser->GetInstance(new TenantQueryParameter("URL", $id)); if ($thisuser == null) { return; } ?> <div class="ProfileTitle"> <?php mmo_display_user_badges_by_user($thisuser); ?> <span class="ProfileUserName"><?php echo $thisuser->LongName; ?> </span> <?php if ($action != "customize") { ?> <span class="ProfileControlBox"> <?php if ($CurrentUser != null && $thisuser->ID != $CurrentUser->ID) { if (mmo_has_user_friend_request(null, $thisuser)) { ?> <a href="<?php echo System::$Configuration["Application.BasePath"]; ?> /community/members/<?php echo $id; ?> /Disconnect">Withdraw Friend Request</a> <?php } else { if (mmo_has_user_friend_request($thisuser, $CurrentUser)) { ?> <a href="<?php echo System::$Configuration["Application.BasePath"]; ?> /community/members/<?php echo $id; ?> /Connect/<?php echo mmo_get_user_friendship_auth_key($thisuser, $CurrentUser); ?> ">Confirm Friendship</a> <?php } else { if ($CurrentUser->HasFriend($thisuser)) { ?> <a href="<?php echo System::$Configuration["Application.BasePath"]; ?> /community/members/<?php echo $id; ?> /Disconnect"><?php echo LanguageString::GetByName("friend_disconnect"); ?> </a> <?php } else { ?> <a href="<?php echo System::$Configuration["Application.BasePath"]; ?> /community/members/<?php echo $id; ?> /Connect"><?php echo LanguageString::GetByName("friend_connect"); ?> </a> <?php } } } ?> <form action="<?php echo System::$Configuration["Application.BasePath"]; ?> /Account/Messages/Create" method="POST"> <input type="hidden" name="message_receiver" value="<?php echo $thisuser->ID; ?> " /> <input class="LinkButton" type="submit" value="<?php echo LanguageString::GetByName("message_send"); ?> " /> </form> <a href="<?php echo System::$Configuration["Application.BasePath"]; ?> /community/members/<?php echo $id; ?> /trade/"><?php echo LanguageString::GetByName("resource_trade"); ?> </a> <a href="<?php echo System::$Configuration["Application.BasePath"]; ?> /community/members/<?php echo $id; ?> /block" onclick="/* ReportBlockDialog.Show(); return false; */">Report/Block</a> <?php } if ($thisuser->IsAuthenticated) { ?> <a href="<?php echo System::$Configuration["Application.BasePath"]; ?> /community/members/<?php echo $id; ?> /Customize">Customize Profile</a> <?php } } ?> </span> </div> <?php }
/** * Copies all objects (and, optionally, data) from this tenant to the specified tenant. * @param Tenant $tenant The tenant to which to copy the data. * @param boolean $includeData True if data (tenant property values and object instances) should be copied; false otherwise. */ public function CopyTo(Tenant $tenant, $includeData = true) { $properties = $this->GetProperties(); foreach ($properties as $property) { $tenant->CreateProperty($property); $tenant->SetPropertyValue($property, $this->GetPropertyValue($property)); } $objects = $this->GetObjects(); foreach ($objects as $object) { $instances = null; if ($includeData) { $instances = $object->GetInstances(); } $tenant->CreateObject($object->Name, $object->GetTitles(), $object->GetDescriptions(), $object->GetProperties(), $object->ParentObject, $instances); } }
protected function RenderContent() { ?> <div class="Jumbotron"> <div class="Title">The new PhoenixSNS is here</div> <div class="Content">Upgrade to the latest version for important security updates and bug fixes</div> <div class="Buttons"><a href="#" class="Button Default">Download now</a> <a href="#" class="Button">Learn more</a></div> </div> <div class="PanelContainer ThreeColumn"> <?php $countActive = Tenant::Count(true, false); $countInactive = Tenant::Count(false, true); ?> <div class="Panel Primary"> <div class="Header"> <div class="Expand"> <div> <div class="Icon"><i class="fa fa-building-o fa-5x"> </i></div> </div> <div> <div class="PrimaryContent"><?php echo $countActive; ?> </div> <div class="SecondaryContent">active tenant<?php echo $countActive != 1 ? "s" : ""; ?> </div> </div> </div> </div> <div class="Footer Dark Borderless"> <a href="<?php echo System::ExpandRelativePath("~/tenant"); ?> ">Manage Tenants</a> </div> </div> <div class="Panel Warning"> <div class="Header"> <div class="Expand"> <div> <div class="Icon"><i class="fa fa-warning fa-5x"> </i></div> </div> <div> <div class="PrimaryContent"><?php echo $countInactive; ?> </div> <div class="SecondaryContent">inactive or expired tenant<?php echo $countInactive != 1 ? "s" : ""; ?> </div> </div> </div> </div> <div class="Footer Dark Borderless"> <a href="<?php echo System::ExpandRelativePath("~/tenant"); ?> ">Manage Tenants</a> </div> </div> <div class="Panel Success"> <div class="Header"> <div class="Expand"> <div> <div class="Icon"><i class="fa fa-warning fa-5x"> </i></div> </div> <div> <div class="PrimaryContent">0</div> <div class="SecondaryContent">issues to resolve</div> </div> </div> </div> <div class="Footer Dark Borderless"> <a href="#">View Details</a> </div> </div> </div> <?php }
<?php // We need to get the root path of the Web site. It's usually something like // /var/www/yourdomain.com. global $RootPath; $RootPath = dirname(__FILE__) . "/.."; // Now that we have defined the root path, load the WebFX content (which also // include_once's the modules and other WebFX-specific stuff) require_once "WebFX/WebFX.inc.php"; // Bring in the WebFX\System and WebFX\IncludeFile classes so we can simply refer // to them (in this file only) as "System" and "IncludeFile", respectively, from // now on use WebFX\System; use WebFX\IncludeFile; use PhoenixSNS\Objects\Tenant; if ($_GET["action"] == "exists") { $query = $_GET["q"]; if (Tenant::Exists($query)) { echo "{ \"result\": \"success\", \"exists\": true }"; return; } echo "{ \"result\": \"success\", \"exists\": false }"; }
protected function RenderContent() { $tenants = Tenant::Get(); ?> <p>There are <?php echo count($tenants); ?> tenants in total.</p> <?php $countActive = 0; $countExpired = 0; foreach ($tenants as $tenant) { if ($tenant->IsExpired()) { $countExpired++; } else { $countActive++; } } $disclosure = new Disclosure(); $disclosure->Title = "Active Tenants (" . $countActive . ")"; $disclosure->Expanded = true; $disclosure->BeginContent(); /* $lv = new ListView("lvInactive"); $lv->Columns = array ( new ListViewColumn("chTenantName", "Tenant Name"), new ListViewColumn("chTenantType", "Tenant Type"), new ListViewColumn("chDataCenters", "Data Centers"), new ListViewColumn("chPaymentPlan", "Payment Plan"), new ListViewColumn("chActivationDate", "Activation Date"), new ListViewColumn("chTerminationDate", "Termination Date"), new ListViewColumn("chDescription", "Description"), new ListViewColumn("chActions", "Actions") ); */ $lv = new ListView(); $lv->EnableRowCheckBoxes = true; $lv->Width = "100%"; $lv->Columns = array(new ListViewColumn("lvcDescription", "Description"), new ListViewColumn("lvcTenantType", "Type"), new ListViewColumn("lvcPaymentPlan", "Payment Plan"), new ListViewColumn("lvcDataCenters", "Data Centers"), new ListViewColumn("lvcStartDate", "Start Date"), new ListViewColumn("lvcEndDate", "End Date")); foreach ($tenants as $tenant) { if ($tenant->IsExpired()) { continue; } $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcDescription", "<div class=\"Title\">" . $tenant->URL . "</div><div class=\"Content\">" . $tenant->Description . "</div>" . "<div class=\"Footer\" style=\"padding: 8px;\">" . "<a class=\"Button Default\" href=\"" . System::ExpandRelativePath("~/tenant/launch/" . $tenant->URL) . "\" target=\"_blank\">Launch</a>" . "<span class=\"Separator\" />" . "<a class=\"Button\" href=\"" . System::ExpandRelativePath("~/tenant/modify/" . $tenant->URL) . "\">Modify</a>" . "<a class=\"Button\" href=\"" . System::ExpandRelativePath("~/tenant/clone/" . $tenant->URL) . "\">Clone</a>" . "<a class=\"Button\" href=\"" . System::ExpandRelativePath("~/tenant/delete/" . $tenant->URL) . "\">Delete</a>" . "</div>", $tenant->Description . " " . $tenant->URL), new ListViewItemColumn("lvcTenantType", $tenant->Type->Title), new ListViewItemColumn("lvcPaymentPlan", $tenant->PaymentPlan->Title), new ListViewItemColumn("lvcDataCenters", null), new ListViewItemColumn("lvcStartDate", $tenant->BeginTimestamp == null ? "(none)" : $tenant->BeginTimestamp), new ListViewItemColumn("lvcEndDate", $tenant->EndTimestamp == null ? "(none)" : $tenant->EndTimestamp))); /* ?> <div class="Footer"> <a class="Button Default" href="<?php echo(System::ExpandRelativePath("~/tenant/launch/" . $tenant->URL)); ?>" target="_blank">Launch</a> <span class="Separator" /> <a class="Button" onclick="return nav('/tenant/modify/<?php echo($tenant->URL); ?>');" href="<?php echo(System::ExpandRelativePath("~/tenant/modify/" . $tenant->URL)); ?>">Modify</a> <a class="Button" href="<?php echo(System::ExpandRelativePath("~/tenant/clone/" . $tenant->URL)); ?>">Clone</a> <a class="Button" href="<?php echo(System::ExpandRelativePath("~/tenant/delete/" . $tenant->URL)); ?>">Delete</a> </div> </div> <?php */ } $lv->Render(); $disclosure->EndContent(); $disclosure = new Disclosure(); $disclosure->Title = "Inactive Tenants (" . $countExpired . ")"; $disclosure->Expanded = true; $disclosure->BeginContent(); $lv = new ListView(); $lv->EnableRowCheckBoxes = true; $lv->Width = "100%"; $lv->Columns = array(new ListViewColumn("lvcDescription", "Description"), new ListViewColumn("lvcTenantType", "Type"), new ListViewColumn("lvcPaymentPlan", "Payment Plan"), new ListViewColumn("lvcDataCenters", "Data Centers"), new ListViewColumn("lvcStartDate", "Start Date"), new ListViewColumn("lvcEndDate", "End Date")); foreach ($tenants as $tenant) { if (!$tenant->IsExpired()) { continue; } $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcDescription", "<div class=\"Title\">" . $tenant->URL . "</div><div class=\"Content\">" . $tenant->Description . "</div>", $tenant->Description . " " . $tenant->URL), new ListViewItemColumn("lvcTenantType", $tenant->Type->Title), new ListViewItemColumn("lvcPaymentPlan", $tenant->PaymentPlan->Title), new ListViewItemColumn("lvcDataCenters", null), new ListViewItemColumn("lvcStartDate", $tenant->BeginTimestamp == null ? "(none)" : $tenant->BeginTimestamp), new ListViewItemColumn("lvcEndDate", $tenant->EndTimestamp == null ? "(none)" : $tenant->EndTimestamp))); } $lv->Render(); $disclosure->EndContent(); }
protected function RenderContent() { $CurrentTenant = Tenant::GetCurrent(); $objUser = $CurrentTenant->GetObject("User"); $CurrentUser = $objUser->GetMethod("GetCurrentUser")->Execute(); $members = $objUser->GetInstances(); $count = count($members); foreach ($members as $member) { $description = $member->GetPropertyValue("Description"); // SingleInstance<Gender> $gender = $member->GetPropertyValue("Gender"); // SingleInstance<Gender> if ($gender != null) { $gender = $gender->ToString(); } $age = null; $birthdate = $member->GetPropertyValue("BirthDate"); // DateTime if ($birthdate != null) { // TODO: calculate age from birth date $age = $birthdate; } $location = $member->GetPropertyValue("Location"); // SingleInstance<Place> if ($location != null) { $location = $location->ToString(); } ?> <div class="Card MemberCard"> <div class="Title"> <table style="width: 100%;"> <tr> <td rowspan="2" style="width: 96px;"><img src="<?php echo System::ExpandRelativePath("~/community/members/" . $member->GetPropertyValue("URL") . "/images/avatar/thumbnail.png"); ?> " alt="<?php echo $member->GetPropertyValue("DisplayName"); ?> " title="<?php echo $member->GetPropertyValue("DisplayName"); ?> " /></td> <td class="MemberName"><?php echo $member->GetPropertyValue("DisplayName"); ?> </td> </tr> <tr> <td><?php if ($gender != null) { echo $gender . " - "; } if ($age != null) { echo $age . " - "; } if ($location != null) { echo $location->ToString(); } ?> </td> </tr> </table> </div> <?php if ($description != null) { ?> <div class="Content"><?php echo $description; ?> </div><?php } ?> <div class="Actions Horizontal"> <div class="Left" style="background-color: #3366FF;"> <div style="padding-left: 16px; color: #FFFFFF; font-weight: bold;">Member</div> </div> <div class="Right"> <?php if ($CurrentUser != null) { $hasfriend = false; /* $hasfriend = $CurrentUser->GetMethod("HasFriend")->Execute(array ( new TenantQueryParameter("member", $member) )); */ if ($hasfriend) { ?> <strong>Friends</strong> <?php } else { ?> <a href="#" title="Add Friend"><i class="fa fa-plus"></i> <span class="Text">Add Friend</span></a> <?php } ?> <a href="#" title="Poke"><i class="fa fa-hand-o-right"></i> <span class="Text">Poke</span></a> <a href="#" title="View Profile"><i class="fa fa-eye"></i> <span class="Text">View Profile</span></a> <?php } ?> </div> </div> </div> <?php } ?> </div> <?php }
$failed = true; } } } $user = User::Create($_POST["TenantManager_UserName"], $_POST["TenantManager_Password"]); if ($user == null) { global $MySQL; Failure("Could not create user '" . $_POST["TenantManager_UserName"] . "'"); Message("Database returned error " . $MySQL->errno . ": " . $MySQL->error); $failed = true; } $tenant = Tenant::Create($_POST["Application_DefaultTenant"], "The default tenant for PhoenixSNS."); $tablefilepath = dirname(__FILE__) . "/TenantObjects/*.inc.php"; $tablefiles = glob($tablefilepath); foreach ($tablefiles as $tablefile) { $tenant = Tenant::GetByID(1); require $tablefile; } require dirname(__FILE__) . "/DefaultTenant.inc.php"; ?> </table> <?php if (!$failed) { echo "<script type=\"text/javascript\">window.location.href='" . System::ExpandRelativePath("~/") . "';</script>"; return true; } return true; } $page = new SetupPage(); $page->BeginContent(); ?>
/** * Creates a new TenantObjectProperty object based on the given values from the database. * @param array $values * @return \PhoenixSNS\Objects\TenantObjectProperty based on the values of the fields in the given associative array */ public static function GetByAssoc($values) { $item = new TenantObjectProperty(); $item->ID = $values["property_ID"]; $item->Tenant = Tenant::GetByID($values["property_TenantID"]); $item->ParentObject = TenantObject::GetByID($values["property_ObjectID"]); $item->Name = $values["property_Name"]; $item->Description = $values["property_Description"]; $item->DataType = DataType::GetByID($values["property_DataTypeID"]); $item->DefaultValue = $values["property_DefaultValue"]; $item->Required = $values["property_IsRequired"] == 1; $item->Enumeration = TenantEnumeration::GetByID($values["property_EnumerationID"]); $item->RequireChoiceFromEnumeration = $values["property_RequireChoiceFromEnumeration"] == 1; return $item; }
break; case "": $tenant = Tenant::GetByURL($path[0]); $object = TenantObject::GetByID($path[2]); if ($_SERVER["REQUEST_METHOD"] == "POST") { $count = $_POST["InstanceProperty_NewPropertyCount"]; for ($i = $count; $i > 0; $i--) { $name = $_POST["InstanceProperty_" . $i . "_Name"]; $dataType = DataType::GetByID($_POST["InstanceProperty_" . $i . "_DataTypeID"]); $defaultValue = $_POST["InstanceProperty_" . $i . "_DefaultValue"]; $object->CreateInstanceProperty(new TenantObjectInstanceProperty($name, $dataType, $defaultValue)); } System::Redirect("~/tenant/manage/" . $tenant->URL . "/objects/" . $object->ID); return true; } else { $page = new TenantObjectManagementPage(); $page->CurrentTenant = $tenant; $page->CurrentObject = $object; $page->Render(); } break; } } break; } } return true; }), new ModulePage("launch", function ($page, $path) { $tenant = Tenant::GetByURL($path[0]); header("Location: http://" . $tenant->DataCenters->Items[0]->HostName . "/" . $tenant->URL); })))));
public static function GetCurrent() { $CurrentTenant = Tenant::GetCurrent(); if ($CurrentTenant == null) { return null; } // prevent a NOTICE from cluttering the log if (!isset($_SESSION["CurrentUserName[" . $CurrentTenant->ID . "]"]) || !isset($_SESSION["CurrentPassword[" . $CurrentTenant->ID . "]"])) { return null; } return User::GetByCredentials($_SESSION["CurrentUserName[" . $CurrentTenant->ID . "]"], $_SESSION["CurrentPassword[" . $CurrentTenant->ID . "]"]); }
function IsAuthenticated() { $CurrentTenant = Tenant::GetCurrent(); if (isset($_SESSION["CurrentUserName[" . $CurrentTenant->ID . "]"]) && isset($_SESSION["CurrentPassword[" . $CurrentTenant->ID . "]"])) { $user = $CurrentTenant->GetObject("User")->GetMethod("ValidateCredentials")->Execute(array(new TenantObjectMethodParameterValue("username", $_SESSION["CurrentUserName[" . $CurrentTenant->ID . "]"]), new TenantObjectMethodParameterValue("password", $_SESSION["CurrentPassword[" . $CurrentTenant->ID . "]"]))); return $user != null; } return false; }
protected function BeforeFullContent() { ?> <div class="Page<?php if (!$this->RenderHeader) { echo " HideHeader"; } if (!$this->RenderSidebar) { echo " HideSidebar"; } ?> "> <nav class="Top"> <a class="MenuButton" onclick="toggleSidebarExpanded(); return false;" href="#"><i class="fa fa-bars"> </i></a> <img class="Logo" src="<?php echo System::ExpandRelativePath("~/Images/Logo.png"); ?> " alt="<?php echo System::GetConfigurationValue("Application.Name"); ?> " /> <?php $txtSearch = new TextBox(); $txtSearch->ClassList[] = "SearchBar"; $txtSearch->PlaceholderText = "Type to search for tasks"; $txtSearch->SuggestionURL = "~/API/Search.php?q=%1"; $txtSearch->Render(); ?> <div class="UserInfo"> <div class="DropDownButton"> <i class="fa fa-user"> </i> <img class="UserIcon" alt="" /> <span class="UserName"><?php $user = User::GetByID($_SESSION["Authentication.UserID"]); if ($user == null) { echo "Not logged in"; } else { if ($user->DisplayName != null) { echo $user->DisplayName; } else { echo $user->UserName; } } ?> </span> <div class="Menu DropDownMenu"> <a href="<?php echo System::ExpandRelativePath("~/account/settings.page"); ?> "> <span class="Icon"><i class="fa fa-cogs"> </i></span> <span class="Text">Change Settings</span> </a> <a href="<?php echo System::ExpandRelativePath("~/account/logout.page"); ?> "> <span class="Icon"><i class="fa fa-sign-out"> </i></span> <span class="Text">Log Out</span> </a> </div> </div> </div> </nav> <nav class="Sidebar" id="__SidebarFrame"> <ul> <?php foreach ($this->SidebarButtons as $button) { $this->RenderSidebarButton($button); } ?> </ul> <div class="BackstageView"> <div class="Content"> <div class="Column" style="width: 25%;"> <div class="Title">Tenants</div> <?php $tenants = Tenant::Get(); foreach ($tenants as $tenant) { echo "<a href=\"" . System::ExpandRelativePath("~/tenant/modify/" . $tenant->URL) . "\">" . $tenant->URL . "</a>"; } ?> <div class="Title">Actions</div> <a href="<?php echo System::ExpandRelativePath("~/account/logout.page"); ?> "><i class="fa fa-sign-out"></i> <span class="Text">Log Out</span></a> </div> <div class="Column"> <div class="Title">About</div> <div><img src="<?php echo System::ExpandRelativePath("~/Images/Billboard.png"); ?> " /></div> <p> PhoenixSNS version 1.0 </p> </div> </div> </div> </nav> <header> <div class="Title" id="__TitleFrame"><?php echo $this->Title; ?> </div> <div class="Subtitle" id="__SubtitleFrame"><?php echo $this->Subtitle; ?> </div> <div class="Buttons"> <?php foreach ($this->HeaderButtons as $button) { echo "<a class=\"Button"; if ($button->CssClass != "") { echo " " . $button->CssClass; } echo "\""; if ($button->TargetURL != "") { echo " href=\"" . System::ExpandRelativePath($button->TargetURL) . "\""; } if ($button->TargetScript != "") { echo " onclick=\"" . $button->TargetScript . "\""; } echo ">"; if ($button->IconName != "") { echo "<i class=\"fa " . $button->IconName . "\"> </i>"; } echo "<span class=\"Text\">"; echo $button->Title; echo "</span>"; echo "</a>"; } ?> </div> </header> <div class="Content" id="__ContentFrame"> <script type="text/javascript"> function nav(url) { // disable AJAX navigation temporarily until it's figured out return true; // Add an item to the history log history.pushState(url, "", url); loadc(url); setSidebarExpanded(false); return false; } function toggleSidebarExpanded() { setSidebarExpanded(!getSidebarExpanded()); } function getSidebarExpanded() { var u = document.getElementById("__SidebarFrame"); return (u.className == "Sidebar Expanded"); } function setSidebarExpanded(value) { var u = document.getElementById("__SidebarFrame"); if (value) { u.className = "Sidebar Expanded"; } else { u.className = "Sidebar"; } } function loadc(url) { if (url == null) url = ""; var contentFrame = document.getElementById("__ContentFrame"); if (url.indexOf('?') != -1) { url += "&partial"; } else { url += "?partial"; } WebFramework.Navigation.LoadPartialContent(url, contentFrame); var event = new Event("load"); window.dispatchEvent(event); } function setTitles(title, subtitle) { if (title) { var titleFrame = document.getElementById("__TitleFrame"); titleFrame.innerHTML = title; } if (subtitle) { var subtitleFrame = document.getElementById("__SubtitleFrame"); subtitleFrame.innerHTML = subtitle; } } // Revert to a previously saved state window.addEventListener('popstate', function(event) { loadc(event.state); }); window.addEventListener("load", function(e) { var url = window.location.pathname.substring(1); var sidebar = document.getElementById("__SidebarFrame"); var navs = sidebar.childNodes; for (var i = 0; i < navs.length; i++) { if (navs[i].tagName != "A") continue; if (navs[i].attributes["data-id"] != null && navs[i].attributes["data-id"].value == url) { navs[i].className = "Selected"; } else { navs[i].className = ""; } } }); </script> <?php }