public function OnInit() { if ($this->IsPostback) { if (isset($_POST["user_LoginID"]) && isset($_POST["user_Password"])) { $admun = $_POST["user_LoginID"]; $admpw = $_POST["user_Password"]; $user = User::GetByCredentials($admun, $admpw); if ($user != null) { if ($user->ForcePasswordChange) { $_SESSION["ResetPasswordUserID"] = $user->ID; System::Redirect("~/account/resetPassword.page"); } else { $_SESSION["Authentication.UserName"] = $admun; $_SESSION["Authentication.Password"] = $admpw; if (isset($_SESSION["LoginRedirectURL"])) { System::Redirect($_SESSION["LoginRedirectURL"]); } else { System::Redirect("~/"); } } return true; } else { $script = new HTMLControl(); $script->TagName = "script"; $script->Attributes[] = new WebControlAttribute("type", "text/javascript"); $script->InnerHTML = "window.addEventListener(\"load\", function() { Notification.Show('The user name or password you entered is incorrect', 'Invalid Credentials', 'Error'); });"; // child control has to go into the Section (which is control at index 1 on the page) $this->Controls[1]->Controls[] = $script; } } } }
public static function GetCurrent() { $user = User::GetCurrent(); if ($user == null) { return null; } return $user->Theme; }
public function SetDefaultForUser($user = null) { if ($user == null) { $user = User::GetCurrent(); } global $MySQL; $query = "UPDATE " . System::GetConfigurationValue("Database.TablePrefix") . "Users SET user_LanguageID = " . $this->ID . " WHERE user_ID = " . $user->ID; $result = $MySQL->query($query); }
public static function GetByAssoc($values) { if ($values == null) { return null; } $content = new Content(); $content->Language = Language::GetByID($values["content_language_id"]); $content->Path = $values["content_path"]; $content->Title = $values["content_title"]; $content->Content = $values["content_content"]; $content->Creator = User::GetByID($values["content_creator_id"]); $content->DateCreated = $values["content_creator_timestamp"]; return $content; }
function IsAdministrator() { if (!isset($_SESSION["Authentication.UserName"]) || !isset($_SESSION["Authentication.Password"])) { return false; } $username = $_SESSION["Authentication.UserName"]; $password = $_SESSION["Authentication.Password"]; $user = User::GetByCredentials($username, $password); if ($user == null) { return false; } $_SESSION["Authentication.UserID"] = $user->ID; return true; }
protected function RenderContent() { $wndCreateUser = new Window(); $wndCreateUser->ID = "wndCreateUser"; $wndCreateUser->Title = "Create User"; $wndCreateUser->BeginContent(); ?> <form method="POST" action="<?php echo System::ExpandRelativePath("~/users/modify"); ?> " onsubmit="wndCreateUser.Hide();"> <div class="FormView" style="width: 100%"> <div class="Field"> <label for="txtLoginID" style="width: 280px;">Login ID:</label> <input type="text" id="txtLoginID" name="user_LoginID" /> </div> <div class="Field"> <label for="txtDisplayName">Display name:</label> <input type="text" id="txtDisplayName" name="user_DisplayName" /> </div> <div class="Field"> <label for="chkAccountLocked">Lock account</label> <input type="checkbox" name="user_AccountLocked" id="chkAccountLocked" /> </div> <div class="Field"> <label for="chkForcePasswordChange">Require password reset at next logon</label> <input type="checkbox" name="user_ForcePasswordChange" id="chkForcePasswordChange" /> </div> </div> <?php $wndCreateUser->BeginButtons(); ?> <input type="submit" class="Button Default" value="Save Changes" /> <a class="Button" href="#" onclick="wndCreateUser.Hide(); return false;">Discard Changes</a> <?php $wndCreateUser->EndButtons(); ?> </form> <?php $wndCreateUser->EndContent(); $users = User::Get(); $lv = new ListView(); $lv->Width = "100%"; $lv->Columns = array(new ListViewColumn("lvcLoginID", "Login ID"), new ListViewColumn("lvcDisplayName", "Display Name"), new ListViewColumnCheckBox("lvcAccountLocked", "Account Locked"), new ListViewColumnCheckBox("lvcPasswordChangeRequired", "Password Change Required")); foreach ($users as $user) { $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcLoginID", "<a href=\"" . System::ExpandRelativePath("~/users/modify/" . $user->ID . "\">" . $user->UserName . "</a>", $user->UserName)), new ListViewItemColumn("lvcDisplayName", $user->DisplayName), new ListViewItemColumn("lvcAccountLocked", $user->AccountLocked), new ListViewItemColumn("lvcPasswordChangeRequired", $user->ForcePasswordChange))); } $lv->Render(); }
protected function RenderContent() { ?> <div class="CardLayout"> <div class="CardSet"> <div class="Card"> <div class="Title">Users</div> <div class="Content"> <div><span class="Emphasis"><?php $count = User::Count(true); echo $count; ?> </span> registered <?php echo $count == 1 ? "user" : "users"; ?> </div> <div>Most recently active users:</div> <?php $lvUsers = new ListView(); $lvUsers->Columns = array(new ListViewColumn("lvcUserLink", "User"), new ListViewColumn("lvcUserLastActiveDate", "Last Active Date")); $lvUsers->Render(); ?> </div> <div class="Actions"> <a href="#">Manage Users</a> </div> </div> <div class="Card"> <div class="Title">Groups</div> <div class="Content"> </div> <div class="Actions"> <a href="#">Manage Groups</a> </div> </div> <div class="Card"> <div class="Title">Market</div> <div class="Content"> </div> <div class="Actions"> <a href="#">Manage Items</a> <a href="#">Manage Resources</a> </div> </div> </div> </div> <?php }
public function __construct() { parent::__construct(); $CurrentUser = User::GetCurrent(); $this->Styles = array("margin-top" => "0px"); $this->Ribbon = new Ribbon("ribbon", "PhoenixSNS Manager"); $this->Ribbon->UserName = $CurrentUser->LongName; $this->Ribbon->HelpButton->Visible = true; $this->Ribbon->ApplicationMenu->ToolTipTitle = "PhoenixSNS Manager"; $this->Ribbon->ApplicationMenu->ToolTipText = "Access quick administrative functions from the application menu."; $this->Ribbon->ApplicationMenu->Items = array(new RibbonCommandReferenceItem("rcmdUsers")); $this->Ribbon->Commands = array(new RibbonButtonCommand("rcmdUserBrowse", "Browse Users", "~/admin/users", "alert('Find a way to get user list'); return false;", null, "Browse Users", "Search for users in the social network directory"), new RibbonButtonCommand("rcmdUserBan", "Ban a User", null, "BanUserDialog.ShowDialog();", null, "Ban Specified User", "Prevents the specified user from entering the Web site."), new RibbonButtonCommand("rcmdUserResourceTransfer", "Transfer", null, "ResourceTransferDialog.ShowDialog(); return false;", null, "Transfer Resources", "Gives a particular user (the receiver) a certain amount of resources, optionally revoking the same amount of resources from another user (the sender)."), new RibbonButtonCommand("rcmdWorldCreatePlace", "Place", null, "PlacePropertiesDialog.ShowDialog(); return false;", "~/images/Common/Icons/Ribbon/Place.png", "Create Place", "Creates a new Place in the World. Places can be private or public, and can be accessed via hotspots or triggers."), new RibbonButtonCommand("rcmdWorldCreateObjectNPC", "NPC", null, "ObjectPropertiesDialog.ShowDialog(); return false;", null, "NPC", "Creates a new NPC in the World. NPCs are Avatars that roam the World and can optionally trigger an action when clicked."), new RibbonButtonCommand("rcmdWorldCreateObjectHotspot", "Hotspot", null, "ObjectPropertiesDialog.ShowDialog(); return false;", null, "Hotspot", "Creates a new Hotspot in the World. Hotspots are visible objects that activate an action when the player clicks on them."), new RibbonButtonCommand("rcmdWorldCreateObjectTrigger", "Trigger", null, "ObjectPropertiesDialog.ShowDialog(); return false;", null, "Trigger", "Creates a new Trigger in the World. Triggers are invisible blocks that activate an action when the player character enters the covered area."), new RibbonDropDownCommand("rcmdWorldCreateObject", "Object", null, null, "~/images/Common/Icons/Ribbon/Objects.png", "Create Object", "Creates a new object in the current Place.", array(new RibbonCommandReferenceItem("rcmdWorldCreateObjectNPC"), new RibbonCommandReferenceItem("rcmdWorldCreateObjectHotspot"), new RibbonCommandReferenceItem("rcmdWorldCreateObjectTrigger")))); $this->Ribbon->Tabs = array(new RibbonTab("tabHome", "Home", array()), new RibbonTab("tabUsers", "Users", array(new RibbonTabGroup("rtgUsersManagement", "Management", array(new RibbonCommandReferenceItem("rcmdUserBrowse"), new RibbonCommandReferenceItem("rcmdUserBan"))), new RibbonTabGroup("rtgUsersResources", "Resources", array(new RibbonCommandReferenceItem("rcmdUserResourceTransfer"))))), new RibbonTab("tabWorld", "World", array(new RibbonTabGroup("rtgWorldCreate", "Create", array(new RibbonCommandReferenceItem("rcmdWorldCreatePlace"), new RibbonCommandReferenceItem("rcmdWorldCreateObject")))))); if ($this->Ribbon->SelectedTab !== null) { $this->Ribbon->SelectedTab = $this->Ribbon->Tabs[0]; } }
foreach ($tables as $table) { if ($table->Exists()) { Message("Table '" . $table->Name . "' already exists, skipping creation"); } else { $retval = $table->Create(); if ($retval) { Success("Created table '" . $table->Name . "'"); } else { Failure("Could not create table '" . $table->Name . "'"); Message("Database returned error " . DataFX::$Errors->Items[0]->Code . ": " . DataFX::$Errors->Items[0]->Message); Message(DataFX::$Errors->Items[0]->Query); $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"; ?>
$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 ", ";
protected function BeforeContent() { parent::BeforeContent(); $tbsCommunity = new TabStrip("tbsCommunity"); $tbsCommunity->TabPosition = TabContainerTabPosition::Top; $tbsCommunity->Tabs[] = new TabStripTab("tabMembers", "<i class=\"fa fa-users\"></i> <span class=\"Text\">Members (" . User::Count() . ")</span>", "~/community/members", null, $this->Name == "members"); if (System::GetConfigurationValue("Groups.Enabled", false)) { $tbsCommunity->Tabs[] = new TabStripTab("tabGroups", "<i class=\"fa fa-comments\"></i> <span class=\"Text\">Groups (" . Group::Count() . ")</span>", "~/community/groups", null, $this->Name == "groups"); } if (System::GetConfigurationValue("Pages.Enabled", false)) { $tbsCommunity->Tabs[] = new TabStripTab("tabPages", "<i class=\"fa fa-flag\"></i> <span class=\"Text\">Pages (" . Page::Count() . ")</span>", "~/community/pages", null, $this->Name == "pages"); } $tbsCommunity->Render(); /* ?> <table style="width: 100%"> <tr> <td style="width: 128px; vertical-align: top;"> <?php // $actionList = new PsychaticaActionList(); // $actionList->Items = array // ( // new PsychaticaActionListItem("~/community/members", "Members (" . User::Count() . ")"), // new PsychaticaActionListItem("~/community/groups", "Groups (" . User::Count() . ")"), // new PsychaticaActionListItem("~/community/pages", "Pages (" . User::Count() . ")") // ); // $actionList->Items[1]->Selected = true; ?> <div class="ActionList"> <?php // if (System::$Configuration["Members.Enabled"]) { if ($pagename == "members") { if ($outline) { ?> <a class="Selected" href="<?php echo(System::ExpandRelativePath("~/community/members")); ?>"> <?php } else { ?> <span class="Selected"> <?php } } else { ?><a href="<?php echo(System::ExpandRelativePath("~/community/members")); ?>"> <?php } ?> Members (<?php echo(User::Count()); ?>) <?php if ($pagename == "members" && !$outline) { ?> </span> <?php } else { ?> </a> <?php } // } if (System::$Configuration["Groups.Enabled"]) { if ($pagename == "groups") { if ($outline) { ?> <a class="Selected" href="<?php echo(System::ExpandRelativePath("~/community/groups")); ?>"> <?php } else { ?> <span class="Selected"> <?php } } else { ?><a href="<?php echo(System::ExpandRelativePath("~/community/groups")); ?>"> <?php } ?> Groups (<?php echo(Group::Count()); ?>) <?php if ($pagename == "groups" && !$outline) { ?> </span> <?php } else { ?> </a> <?php } } if (System::$Configuration["Pages.Enabled"]) { if ($pagename == "pages") { if ($outline) { ?> <a class="Selected" href="<?php echo(System::ExpandRelativePath("~/community/pages")); ?>"> <?php } else { ?> <span class="Selected"> <?php } } else { ?><a href="<?php echo(System::ExpandRelativePath("~/community/pages")); ?>"> <?php } ?> Pages (<?php echo(Page::Count()); ?>) <?php if ($pagename == "pages" && !$outline) { ?> </span> <?php } else { ?> </a> <?php } } if (System::$Configuration["Forums.Enabled"]) { if ($pagename == "forums") { if ($outline) { ?> <a class="Selected" href="<?php echo(System::ExpandRelativePath("~/community/forums")); ?>"> <?php } else { ?> <span class="Selected"> <?php } } else { ?><a href="<?php echo(System::ExpandRelativePath("~/community/forums")); ?>"> <?php } ?> Forums (<?php echo(Forum::Count()); ?>) <?php if ($pagename == "forums" && !$outline) { ?> </span> <?php } else { ?> </a> <?php } } ?> </div> </td> <td> <?php */ }
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; }
function IsValidUserOrGuest() { $CurrentTenant = Tenant::GetCurrent(); if (!isset($_SESSION["CurrentUserName[" . $CurrentTenant->ID . "]"]) && !isset($_SESSION["CurrentPassword[" . $CurrentTenant->ID . "]"])) { return true; } $user = User::GetByLoginID($_SESSION["CurrentUserName[" . $CurrentTenant->ID . "]"]); if ($user == null) { return true; } return IsAuthenticated(); }
protected function RenderContent() { $CurrentUser = User::GetCurrent(); ?> <div class="CardSet" style="width: 30%"> <div class="Card"> <div class="Title"><i class="fa fa-globe"></i><span class="Title">World</span></div> <div class="Content"> <span class="Emphasis">No friends</span> are in the World at the moment </div> <div class="Actions Vertical"> <a href="#">Invite a friend to a personal Place</a> <a href="#">Explore the World</a> </div> </div> <div class="Card"> <div class="Title"> <i class="fa fa-money"></i> <span class="Text">Resources</span> </div> <div class="Content" style="text-align: center;"> <?php $resources = MarketResourceType::Get(); foreach ($resources as $resource) { ?> <div class="Resource"> <div class="Icon"><img src="<?php echo System::ExpandRelativePath("~/images/" . System::GetConfigurationValue("Application.DefaultResourceBundle") . "/Resources/24x24/" . $resource->ID . ".png"); ?> " title="<?php echo $resource->TitlePlural; ?> " /></div> <div class="Value"><?php echo MarketResourceTransaction::GetAmountByUser($CurrentUser, $resource); ?> </div> </div> <?php } ?> </div> <div class="Actions Vertical"> <a href="#">Learn more about earning credits</a> <a href="#">Earn interest by putting your credits in the Bank</a> <a href="<?php echo System::ExpandRelativePath("~/contribute/purchase"); ?> ">Get more with PsychatiGold</a> </div> </div> <div class="Card"> <div class="Title"> Fashion </div> <div class="Content"> <span class="Emphasis">No new items</span> available in the Market </div> <div class="Actions Vertical"> <a href="#"><i class="fa fa-shopping-cart"></i> <span class="Text">Visit the Market to buy and sell items</span></a> </div> </div> </div> <div class="CardSet" style="width: 30%"> <?php /* <div class="Card"> <div class="Title"><i class="fa fa-globe"></i><span class="Title">Next scheduled maintenance</span></div> <div class="Content"> <?php $et = Tenant::GetCurrent()->EndTimestamp; if ($et == null) { ?><span class="Emphasis">To be determined</span><?php } else { ?><span class="Emphasis"><?php echo($et); ?></span><?php } ?> </div> </div> */ ?> <div class="Card"> <div class="Title"><i class="fa fa-information"></i><span class="Title">Fight the evil horde!</span></div> <div class="Content"> <p>An invasion is taking place! Gather your wits and tactics to beat the enemy!</p> <p>14 friends play this</p> </div> <div class="Actions Vertical"> <a href="#">Play War of Ages</a> </div> </div> </div> <div class="CardSet" style="width: 30%"> <div class="Card"> <div class="Title"><i class="fa fa-globe"></i><span class="Title"><a href="#">alcexhim</a> invited you to his Place!</span></div> <div class="Content"> <span class="Emphasis">My Personal Room</span> </div> <div class="Actions Vertical"> <a href="#">Go to alcexhim's Place</a> </div> </div> </div> <?php /* $stories = DashboardStory::Get(); if (count($stories) > 0) { foreach ($stories as $story) { $card = new Card('card' . $story->ID, $story->Title, $story->Content, $story->ClassName, $story->IconName); $card->Actions = array ( new CardAction(LanguageString::GetByName("unlike"), "#", null, 'thumbs-o-up', '_blank', 4), new CardAction(LanguageString::GetByName("comment"), null, null, "comment", "_blank"), new CardAction(LanguageString::GetByName("share"), null, null, "share", "_blank") ); $card->Render(); } } else { ?><p>There's nothing here!</p><?php } */ /* (new Card('card1', '<a href="#">alcexhim</a> posted a video <span class="Location"> at <a href="/world/town-square">Town Square</a>', 'Just chillin\' with the peeps.', null, "video-camera", array ( new CardAction(LanguageString::GetByName("like"), "#", null, "thumbs-up", null), )))->Render(); (new Card('card2', "Ready for the next big thing in virtual concert production?", '<a href="http://www.concertroid.com" target="_blank"><img class="Advertisement" style="width: 100%;" src="http://www.concertroid.com/images/logo.png" alt="http://www.concertroid.com/" /></a>', "Sponsored", "star", array ( new CardAction("Like Concertroid on Psychatica", "#", null, 'thumbs-up', '_blank'), new CardAction("Visit Web Site", "http://www.concertroid.com", null, "external-link", "_blank") )))->Render(); (new Card('card3', "Psychatica design updated", 'The new design is based around the concept of "cards", which can update automatically over time and present you with only the most important information and an intuitive way to act upon it.', "Official", "info", array ( new CardAction(LanguageString::GetByName("unlike"), "#", null, 'thumbs-o-up', '_blank', 4), new CardAction(LanguageString::GetByName("comment"), null, null, "comment", "_blank"), new CardAction(LanguageString::GetByName("share"), null, null, "share", "_blank") )))->Render(); (new Card('card4', "Psychatica fixes and updates", 'The major issue with Journal creation has been fixed, and the Market now has some items for you to buy. Enjoy the new fashion items in the <a href="' . System::ExpandRelativePath("~/market") . '">Psychatica Market</a>!', "Official", "info", array ( new CardAction(LanguageString::GetByName("like"), "#", null, 'thumbs-up', '_blank', 1), new CardAction(LanguageString::GetByName("comment"), null, null, "comment", "_blank"), new CardAction(LanguageString::GetByName("share"), null, null, "share", "_blank") )))->Render(); (new Card('card4', "Psychatica updates", 'The terminology "User name" for the private credential associated with your account has been changed to "User ID" to avoid confusion with the publicly-visible Short and Long names so that people are not encouraged to use the same User ID as their Short or Long name. It will eventually be made impossible to create a user account with the same User ID and Short/Long name.', "Official", "info", array ( new CardAction(LanguageString::GetByName("like"), "#", null, 'thumbs-up', '_blank', 1), new CardAction(LanguageString::GetByName("comment"), null, null, "comment", "_blank"), new CardAction(LanguageString::GetByName("share"), null, null, "share", "_blank") )))->Render(); (new Card('card4', "Psychatica updates", 'The World button on the navigation bar now only displays when you are logged in. This is to avoid confusing users who don\'t realize that they must be logged in to use the World.', "Official", "info", array ( new CardAction(LanguageString::GetByName("like"), "#", null, 'thumbs-up', '_blank', 1), new CardAction(LanguageString::GetByName("comment"), null, null, "comment", "_blank"), new CardAction(LanguageString::GetByName("share"), null, null, "share", "_blank") )))->Render(); */ /* <div class="Card"> <div class="Title"><span class="Text"><?php echo(LanguageString::GetByName("currentevents")); ?></span></div> <div class="Content"> <div class="ListBox"> <?php $events = Event::Get(); foreach ($events as $event) { ?> <a href="<?php echo(\System::ExpandRelativePath("~/Events/" . $event->Name)); ?>"> <div class="ListItemTitle"> <?php echo("<span class=\"EventType\" style=\"color: " . $event->Type->Color . "; border-color: " . $event->Type->Color . ";\">" . $event->Type->Title . "</span> "); echo($event->Title); echo("<span class=\"EventDate\">" . $event->BeginDate . " — " . $event->EndDate . "</span>"); ?> </div> <div class="ListItemDescription"> <?php echo($event->Description); ?> </div> </a> <?php } ?> </div> </div> </div> */ /* $img = "~/images/wallpaper/bg1.jpg"; (new Card('card4', "New wallpaper available", '<a style="text-align: center; display: block;" href="' . System::ExpandRelativePath($img) . '" target="_blank"><img src="' . System::ExpandRelativePath($img) . '" style="width: 300px; height: auto;" /></a> <span class="Description"> Our Phoenix-human hybrid girl Phelicia loves to go sky-tumbling! She will keep you company on your desktop or laptop PC. Be on the lookout for more designs targeted at mobile devices! </span><br /><br />Designed by <a href="#">roololoo</a>', "Official", "picture-o", array ( new CardAction(LanguageString::GetByName("like"), "#", null, 'thumbs-up', '_blank', 1), new CardAction(LanguageString::GetByName("comment"), null, null, "comment", "_blank"), new CardAction(LanguageString::GetByName("download"), null, null, "download", "_blank") )))->Render(); */ /* <tr> <?php if (\System::$Configuration["Questions.Enabled"]) { ?> <td style="width: 50%; vertical-align: top;"> <div class="Panel"> <h3 class="PanelTitle"><?php echo(LanguageString::GetByName("questions")); ?></h3> <div class="PanelContent"> <?php $questions = Question::Enumerate(); if (count($questions) == 0) { ?> <p>No questionnaires yet, why not <a href="/questions/create.mmo">create one</a>!</p> <?php } ?> </div> </div> </td> <?php } if (\System::$Configuration["Suggestions.Enabled"]) { ?> <td style="vertical-align: top;"> <div class="Panel"> <h3 class="PanelTitle"><?php echo(LanguageString::GetByName("suggestions")); ?></h3> <div class="PanelContent"> <p> Help us improve and make the site even more awesome! Tell us what kind of features, games, items, and other ideas you'd like to see in Psychatica! If we use your ideas, you might win prizes! </p> <?php if ($CurrentUser == null) { ?> <p> If you are interested in contributing, please first log into Psychatica by the form on the right panel. </p> <?php } else { $form = new WebForm("modules/suggestionBoxReceive.php", "POST"); $form->Begin(); $cboSuggestionTypeID = new WebDropDownList("suggestion_type_id"); $cboSuggestionTypeID->Width = "100%"; $query = "SELECT * FROM phpmmo_suggestion_types"; $result = mysql_query($query); $count = mysql_num_rows($result); for ($i = 0; $i < $count; $i++) { $values = mysql_fetch_assoc($result); $cboSuggestionTypeID->AddItem($values["suggestion_type_id"], $values["suggestion_type_title"]); } $cboSuggestionTypeID->Render(); $txtSuggestionContent = new WebTextBox("suggestion_content"); $txtSuggestionContent->RowCount = 3; $txtSuggestionContent->Width = "100%"; $txtSuggestionContent->Multiline = true; $txtSuggestionContent->Render(); $cmdSubmit = new WebButton(); $cmdSubmit->Text = "Submit Request"; $cmdSubmit->HorizontalAlign = "right"; $cmdSubmit->Render(); $form->End(); } ?> </div> </div> </td> <?php } ?> </tr> */ }
public function Unequip($user = null) { if ($user == null) { $user = User::GetCurrent(); } if ($user == null) { return false; } if (!$user->HasInventoryItem($this)) { return false; } global $MySQL; $query = "DELETE FROM " . System::$Configuration["Database.TablePrefix"] . "UserEquippedItems WHERE equippeditem_UserID = " . $user->ID . " AND equippeditem_ItemID = " . $this->ID; $result = $MySQL->query($query); return $MySQL->errno == 0; }
public static function GetByAssoc($values) { $retval = new AvatarBase(); $retval->ID = $values["base_id"]; $retval->Name = $values["base_name"]; $retval->Width = $values["base_width"]; $retval->Height = $values["base_height"]; $retval->Creator = User::GetByID($values["base_creator_id"]); return $retval; }
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 }
public static function GetByAssoc($values) { $item = new MarketResourceTransaction(); $item->SendingUser = User::GetByID($values["transaction_SendingUserID"]); $item->ReceivingUser = User::GetByID($values["transaction_ReceivingUserID"]); $item->Comments = $values["transaction_Comments"]; $item->CreationTimestamp = $values["transaction_CreationTimestamp"]; $item->CreationUser = User::GetByID($values["transaction_CreationUserID"]); return $item; }
public static function GetByAssoc($values) { $item = new DashboardPostImpression(); $item->Post = DashboardPost::GetByID($values["share_PostID"]); $item->CreationUser = User::GetByID($values["share_CreationUserID"]); $item->CreationTimestamp = $values["share_CreationTimestamp"]; return $item; }
protected function RenderContent() { $CurrentUser = User::GetCurrent(); ?> <div class="Card"> <div class="Title"> <i class="fa fa-users"></i> <span class="Text"><?php echo $this->Group->Title; ?> </span> </div> <div class="Content"> <table style="width: 100%"> <tr> <td style="width: 128px;"><img src="<?php echo System::ExpandRelativePath("~/community/groups/" . $this->Group->Name . "/images/avatar/thumbnail.png"); ?> " style="width: 112px; height: 112px;" /></td> <td><?php echo $this->Group->Description; ?> </td> </tr> </table> <table style="width: 100%"> <tr> <td style="width: 25%">Created on:</td> <td><?php echo $this->Group->DateCreated; ?> </td> </tr> </table> </div> <div class="Actions Horizontal"> <?php if ($CurrentUser != null) { if ($this->Group->HasMember($CurrentUser)) { ?> <a title="Invite Friends" href="<?php echo System::ExpandRelativePath("~/community/groups/" . $this->Group->Name . "/invite"); ?> " onclick="InviteFriendsDialog.Show(<?php echo $this->Group->ID; ?> ); return false;"><i class="fa fa-share-square-o"></i> <span class="Text">Invite Friends</span></a> <a title="Leave Group" href="<?php echo System::ExpandRelativePath("~/community/groups/" . $this->Group->Name . "/disconnect"); ?> "><i class="fa fa-sign-out"></i> <span class="Text">Leave Group</span></a> <?php } else { if ($this->Group->HasPermission($CurrentUser, 2) || $this->Group->HasPermission($CurrentUser, 3)) { ?> <a title="Join Group" href="<?php echo System::ExpandRelativePath("~/community/groups/" . $this->Group->Name . "/connect"); ?> "><i class="fa fa-sign-in"></i> <span class="Text">Join Group</span></a> <?php } } if ($this->Group->HasPermission($CurrentUser, 4)) { ?> <a title="Change Group Settings" href="<?php echo System::ExpandRelativePath("~/community/groups/" . $this->Group->Name . "/settings"); ?> "><i class="fa fa-cog"></i> <span class="Text">Change Group Settings</span></a> <?php } if ($this->Group->Creator->ID == $CurrentUser->ID) { ?> <a title="Delete Group" href="<?php echo System::ExpandRelativePath("~/community/groups/" . $this->Group->Name . "/delete.phnx"); ?> "><i class="fa fa-trash-o"></i> <span class="Text">Delete Group</span></a> <?php } } else { ?> <i class="fa fa-warning"></i> Please log in to join this group.<?php } ?> </div> </div> <div class="Card"> <div class="Title"> <i class="fa fa-comments"></i> <span class="Text">Discussions (<?php echo $this->Group->CountTopics(); ?> )</span> </div> <div class="Content"> <div class="ListBox"> <?php $topics = $this->Group->GetTopics(5); foreach ($topics as $topic) { ?> <a href="<?php echo System::ExpandRelativePath("~/community/groups/" . $this->Group->Name . "/topics/" . $topic->Name); ?> "> <div class="ListItemTitle"><?php echo $topic->Title; ?> </div> </a> <?php } ?> </div> </div> <div class="Actions Horizontal"> <?php if ($this->Group->HasMember($CurrentUser)) { ?> <a href="<?php echo System::ExpandRelativePath("~/community/groups/" . $this->Group->Name . "/topics/create.mmo"); ?> " title="Start a discussion"><i class="fa fa-pencil-square-o"></i> <span class="Text">Start a discussion</span></a> <?php } ?> </div> </div> <div class="Card"> <div class="Title"> <i class="fa fa-shield"></i> <span class="Text">Members (<?php echo $this->Group->CountMembers(); ?> )</span> </div> <div class="Content"> <div class="ButtonGroup ButtonGroupHorizontal"> <?php $members = $this->Group->GetMembers(); foreach ($members as $member) { ?> <a class="ButtonGroupButton" href="<?php echo System::ExpandRelativePath("~/community/members/" . $member->ShortName); ?> " onclick="DisplayMemberInformation(<?php echo $member->ID; ?> ); return false;"> <img class="ButtonGroupButtonImage" src="<?php echo System::ExpandRelativePath("~/community/members/" . $member->ShortName . "/images/avatar/thumbnail.png"); ?> " /> <span class="ButtonGroupButtonText"><?php echo $member->ToString(); ?> </span> </a> <?php } ?> </div> </div> </div> <?php }
/** * Deletes this TenantObject from its parent Tenant. * @return boolean True if the delete operation completed successfully; false if the delete operation failed. */ public function Delete() { global $MySQL; $user = User::GetCurrent(); if ($user == null) { return false; } // TODO: check user permissions before deleting object! // Relationships should prevent associated tenant data from being deleted automatically. We need to delete it manually. // First we delete the Titles string table entries for this object... $query = "DELETE FROM " . System::$Configuration["Database.TablePrefix"] . "TenantObjectTitles WHERE entry_ObjectID = " . $this->ID; $result = $MySQL->query($query); if ($MySQL->errno != 0) { return false; } // ... then the Descriptions... $query = "DELETE FROM " . System::$Configuration["Database.TablePrefix"] . "TenantObjectDescriptions WHERE entry_ObjectID = " . $this->ID; $result = $MySQL->query($query); if ($MySQL->errno != 0) { return false; } // ... and finally, we can delete the object definition itself. $query = "DELETE FROM " . System::$Configuration["Database.TablePrefix"] . "TenantObjects WHERE object_ID = " . $this->ID; $result = $MySQL->query($query); if ($MySQL->errno != 0) { return false; } return true; }
public function GetFriends($max = null) { global $MySQL; $query = "SELECT " . System::GetConfigurationValue("Database.TablePrefix") . "UserFriends.userfriend_FriendID, " . System::GetConfigurationValue("Database.TablePrefix") . "UserFriends.friendship_timestamp FROM " . System::GetConfigurationValue("Database.TablePrefix") . "member_friend_circle_members, " . System::GetConfigurationValue("Database.TablePrefix") . "UserFriends, " . System::GetConfigurationValue("Database.TablePrefix") . "member_friend_circles WHERE " . System::GetConfigurationValue("Database.TablePrefix") . "member_friend_circle_members.circle_id = " . $this->ID . " AND " . System::GetConfigurationValue("Database.TablePrefix") . "member_friend_circles.circle_id = " . System::GetConfigurationValue("Database.TablePrefix") . "member_friend_circle_members.circle_id AND " . "(" . System::GetConfigurationValue("Database.TablePrefix") . "member_friend_circle_members.user_ID = " . System::GetConfigurationValue("Database.TablePrefix") . "UserFriends.userfriend_FriendID AND " . System::GetConfigurationValue("Database.TablePrefix") . "member_friend_circles.owner_id = " . System::GetConfigurationValue("Database.TablePrefix") . "UserFriends.userfriend_UserID)"; if ($max != null && is_numeric($max)) { $query .= " LIMIT " . $max; } $result = $MySQL->query($query); $count = $result->num_rows; $retval = array(); for ($i = 0; $i < $count; $i++) { $values = $result->fetch_assoc(); $user = User::GetByID($values["userfriend_FriendID"]); if ($user == null) { continue; } $friend = new Friend(); $friend->User = User::GetByID($values["userfriend_FriendID"]); $friend->Timestamp = $values["friendship_timestamp"]; $retval[] = $friend; } return $retval; }
{ $this->Title = $title; $this->Description = $description; $this->Type = $type; $this->TargetURL = $targetURL; } } $query = $_GET["q"]; $results = array(); $items = System::$Tasks; $count = count($items); for ($i = 0; $i < $count; $i++) { $item = $items[$i]; $results[] = new SearchResult($item->Title, $item->Description, "Task", $item->TargetURL); } $items = User::Get(); $count = count($items); for ($i = 0; $i < $count; $i++) { $item = $items[$i]; $displayName = $item->DisplayName == null ? $item->UserName : $item->DisplayName; $results[] = new SearchResult($displayName, "", "User", "~/users/modify/" . $item->ID); } $realResults = array(); $count = count($results); for ($i = 0; $i < $count; $i++) { $item = $results[$i]; if (strpos(strtolower($item->Title), strtolower($query)) === false) { continue; } $realResults[] = $item; }
public function Render($comment_base_url = null) { $CurrentUser = User::GetCurrent(); $ParentObjectType = 0; switch (get_class($this)) { case "GroupTopicComment": $ParentObjectType = 1; break; case "JournalEntryComment": $ParentObjectType = 2; break; } ?> <div class="Comment"> <div class="CommentTitle" id="Comment_<?php echo $this->ID; ?> _title"><?php echo $this->Title; ?> </div> <div class="CommentEditor CommentTitle" id="Comment_<?php echo $this->ID; ?> _editor_title"><input id="Comment_<?php echo $this->ID; ?> _editor_title_input" type="text" value="<?php echo $this->Title; ?> " /></div> <div class="CommentContent" id="Comment_<?php echo $this->ID; ?> _content"><?php echo $this->Content; ?> </div> <div class="CommentEditor" id="Comment_<?php echo $this->ID; ?> _editor_content"> <textarea id="Comment_<?php echo $this->ID; ?> _editor_content_input"><?php echo $this->Content; ?> </textarea> </div> <div class="CommentInformation"> <span class="PostedBy"> Posted by <span class="Author"><a href="<?php echo System::ExpandRelativePath("~/community/members/" . $this->Author->ShortName); ?> " target="_blank"><img src="<?php echo System::ExpandRelativePath("~/community/members/" . $this->Author->ShortName . "/images/avatar/thumbnail.png"); ?> " style="height: 32px;" /> <?php mmo_display_user_badges_by_user($this->Author); echo $this->Author->LongName; ?> </a></span> on <span class="Timestamp"><?php echo $this->TimestampCreated; ?> </span> </span> <span class="CommentActions"> <a id="Comment_<?php echo $this->ID; ?> _actions_like" href="#" onclick="CommentManager.SetPopularity(<?php echo $ParentObjectType; ?> , <?php echo $this->ID; ?> , 1); return false;">Like</a> | <a id="Comment_<?php echo $this->ID; ?> _actions_dislike" href="#" onclick="CommentManager.SetPopularity(<?php echo $ParentObjectType; ?> , <?php echo $this->ID; ?> , -1); return false;">Dislike</a> | <a id="Comment_<?php echo $this->ID; ?> _actions_reply" href="#" onclick="CommentManager.Reply(<?php echo $ParentObjectType; ?> , <?php echo $this->ID; ?> ); return false;">Reply</a> <?php if ($this->Author->ID == $CurrentUser->ID) { ?> | <a id="Comment_<?php echo $this->ID; ?> _actions_modify" href="#" onclick="CommentManager.BeginModify(<?php echo $ParentObjectType; ?> , <?php echo $this->ID; ?> ); return false;">Modify</a> | <a id="Comment_<?php echo $this->ID; ?> _actions_delete" href="#" onclick="CommentManager.Delete(<?php echo $ParentObjectType; ?> , <?php echo $this->ID; ?> ); return false;">Delete</a> <?php } ?> </span> </div> </div> <?php }
/** * Creates a User on the server with the given parameters. * @param string $username The user name of the user to create. * @param string $password The password of the user to create. * @return \PhoenixSNS\Objects\User|NULL The newly-created User, or NULL if the creation operation failed. */ public static function Create($username, $password) { $item = new User(); $item->UserName = $username; $item->Password = $password; if ($item->Update()) { return $item; } return null; }
use WebFX\ModulePage; use PhoenixSNS\Objects\User; use PhoenixSNS\Objects\MarketStarterPack; use PhoenixSNS\MasterPages\WebPage; use PhoenixSNS\MasterPages\ErrorPage; class MarketWebPage extends WebPage { } System::$Modules[] = new Module("net.phoenixsns.Market", array(new ModulePage("market", array(new ModulePage("items", function ($path) { require "Items/Main.inc.php"; return true; }), new ModulePage("trade", function ($path) { require "Trade/Main.inc.php"; return true; }), new ModulePage("starter", function ($path) { $CurrentUser = User::GetCurrent(); if ($path[0] == "packs") { $pack_id = $path[1]; $pack = MarketStarterPack::GetByID($pack_id); if ($path[2] == "images") { if ($path[3] == "thumbnail.png") { $filenames = array("images/avatar/base.png"); $items = $pack->GetItems(); foreach ($items as $item) { foreach ($item->Images as $image) { $filenames[] = "images/avatar/items/" . $image->ID . ".png"; } } $image = imagelayerfiles($filenames); imagesavealpha($image, true); imagealphablending($image, true);
<?php use WebFX\System; use PhoenixSNS\Objects\Item; use PhoenixSNS\Objects\User; if (count($path) > 1 && $path[1] != "") { if ($path[2] == "images") { $thisuser = User::GetByIDOrShortName($path[1], true); if ($thisuser == null) { header("HTTP/1.1 404 Not Found"); header("User-Agent: psychati/1.1"); return; } $location = "avatar"; $size = "thumbnail.png"; if (count($path) > 3) { $location = $path[3]; if (count($path) > 4) { $size = $path[4]; } } $headers = apache_request_headers(); switch ($location) { case "avatar": if (isset($headers["If-Modified-Since"]) && $headers["If-Modified-Since"] != null) { // load from cache if available $time1 = strtotime($thisuser->OutfitCacheTimestamp); $time2 = strtotime($headers["If-Modified-Since"]); if ($time1 <= $time2) { header("HTTP/1.1 304 Not Modified"); return;
/** * Begins an audit journal with the specified description. * @param string $description A brief description detailing why an audit journal is being recorded. * @return boolean True if the operation completed successfully; false if the operation failed. */ public function BeginJournal($description) { global $MySQL; $userID = "NULL"; $user = User::GetCurernt(); if ($user != null) { $userID = $user->ID; } $query = "INSERT INTO " . System::$Configuration["Database.TablePrefix"] . "TenantJournals (journal_TenantID, journal_Description, journal_CreationTimestamp, journal_CreationUserID) VALUES (" . $this->ID . ", '" . $MySQL->real_escape_string($description) . "', NOW(), " . $userID . ")"; $result = $MySQL->query($query); if ($result === false) { return false; } $this->mvarJournalID = $MySQL->insert_id; return true; }
public static function GetByAssoc($values) { $comment = new GroupTopicComment(); $comment->ID = $values["comment_id"]; $comment->ParentComment = GroupTopicComment::GetByID($values["comment_parent_id"]); $comment->Author = User::GetByID($values["author_id"]); $comment->Title = $values["comment_title"]; $comment->Content = $values["comment_content"]; $comment->TimestampCreated = $values["comment_timestamp_created"]; return $comment; }