Пример #1
0
 public static function GetByAssoc($values)
 {
     $theme = new Theme();
     $theme->ID = $values["theme_ID"];
     $theme->Name = $values["theme_Name"];
     $theme->Title = $values["theme_Title"];
     if ($values["theme_CreationUserID"] != null) {
         $theme->CreationUser = User::GetByID($values["theme_CreationUserID"]);
     } else {
         $theme->CreationUser = null;
     }
     return $theme;
 }
Пример #2
0
 public static function GetByAssoc($values)
 {
     if ($values == null) {
         return null;
     }
     $page = new Page();
     $page->ID = $values["page_ID"];
     $page->Name = $values["page_Name"];
     $page->Title = $values["page_Title"];
     $page->Description = $values["page_Description"];
     $page->Creator = User::GetByID($values["page_CreationUserID"]);
     $page->TimestampCreated = $values["page_CreationTimestamp"];
     return $page;
 }
Пример #3
0
 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;
 }
 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;
 }
Пример #5
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;
 }
Пример #6
0
 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;
 }
Пример #7
0
 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;
 }
Пример #8
0
												</div>
												<div style="text-align: center;">
													<input class="LinkButton" type="submit" value="Reset Password" />
												</div>
											</form>
										</div>
									</div>
									<?php 
                        $page->EndContent();
                        return true;
                    }
                }
            } else {
                if ($_POST["member_id"] != null) {
                    $id = $_POST["member_id"];
                    $member = User::GetByID($id);
                    $member_emailcode = get_random_string("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", 16);
                    $query = "UPDATE phpmmo_members SET member_emailcode = '" . $member_emailcode . "' WHERE member_id = " . $id;
                    $result = $MySQL->query($query);
                    $errno = $MySQL->errno;
                    $error = $MySQL->error;
                    if ($errno != 0) {
                        $page = new ErrorPage();
                        $page->Mesasge = "An error has occurred, and the confirmation e-mail could not be sent.";
                        $page->ReturnButtonURL = System::$Configuration["Account.ResetPasswordPath"];
                        $page->ReturnButtonText = "Return to Password Reset";
                        $page->Render();
                        return true;
                    }
                    $result = mail($member->EmailAddress, "Password reset confirmation", "<p>Before you can reset your password, you must confirm your e-mail address. Please click the link below (or copy-and-paste it into your browser's address bar) to continue.</p><p><a href=\"" . System::ExpandRelativePath(System::$Configuration["Account.ResetPasswordPath"]) . "/" . $member_emailcode . "\">" . System::ExpandRelativePath(System::$Configuration["Account.ResetPasswordPath"]) . "/" . $member_emailcode . "</a></p><p>Thank you for being a part of Psychatica!</p>", "From: noreply@psychatica.com\r\nContent-Type: text/html");
                    if (!$result) {
Пример #9
0
    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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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 . "\">&nbsp;</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 
    }
Пример #10
0
    return true;
}), new ModulePage("create", function ($page, $path) {
    $user = new User();
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $user->UserName = $_POST["user_LoginID"];
        $user->DisplayName = $_POST["user_DisplayName"];
        $user->Update();
        System::Redirect("~/users");
    } else {
        $page = new UserManagementPage();
        $page->CurrentObject = null;
        $page->Render();
    }
    return true;
}), new ModulePage("modify", function ($page, $path) {
    $user = User::GetByID($path[0]);
    if ($user == null) {
        $user = new User();
    }
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $user->UserName = $_POST["user_LoginID"];
        $user->DisplayName = $_POST["user_DisplayName"];
        $user->AccountLocked = $_POST["user_AccountLocked"] != "" ? true : false;
        $user->ForcePasswordChange = $_POST["user_ForcePasswordChange"] != "" ? true : false;
        $user->Update();
        System::Redirect("~/users");
    } else {
        $page = new UserManagementPage();
        $page->CurrentObject = $user;
        $page->Render();
    }
Пример #11
0
<?php

global $RootPath;
$RootPath = dirname(__FILE__) . "/../";
require_once "WebFX/WebFX.inc.php";
use WebFX\System;
use PhoenixSNS\Objects\User;
switch ($_POST["Action"]) {
    case "Retrieve":
        if ($_POST["ID"] != null) {
            $id = $_POST["ID"];
            if (!is_numeric($id)) {
                echo "{ \"Success\": false, \"ErrorMessage\": \"ID must be an integer\" }";
                return;
            }
            $item = User::GetByID($id);
            if ($item == null) {
                echo "{ \"Success\": false, \"ErrorMessage\": \"User with ID " . $id . " does not exist\" }";
                return;
            }
            echo "{ \"Success\": true, \"Items\": [ ";
            echo $item->ToJSON();
            echo " ] }";
        } else {
            $items = User::Get();
            echo "{ \"Success\": true, \"Items\": [ ";
            $count = count($items);
            for ($i = 0; $i < $count; $i++) {
                $item = $items[$i];
                echo $item->ToJSON();
                if ($i < $count - 1) {
Пример #12
0
                }
                return true;
            } else {
                $page->InvalidCredentials = true;
            }
        }
    }
    $page->Render();
    return true;
}), new ModulePage("logout.page", function ($page, $path) {
    $_SESSION["Authentication.UserName"] = null;
    $_SESSION["Authentication.Password"] = null;
    System::Redirect("~/");
    return true;
}), new ModulePage("resetPassword.page", function ($page, $path) {
    $user = User::GetByID($_SESSION["ResetPasswordUserID"]);
    if ($user == null) {
        System::Redirect("~/");
        return true;
    }
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $user->Password = $_POST["user_Password"];
        $user->AccountLocked = false;
        $user->ForcePasswordChange = false;
        if (!$user->Update(true, $_POST["user_PasswordOld"])) {
            global $MySQL;
            if ($MySQL->errno == 0) {
                echo "Password hash mismatch";
            } else {
                echo $MySQL->errno . ": " . $MySQL->error;
            }
Пример #13
0
 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;
 }