예제 #1
0
 public static function Create($path, $title, $content)
 {
     $pdo = DataSystem::GetPDO();
     $query = "INSERT INTO " . System::GetConfigurationValue("Database.TablePrefix") . "Contents (content_Path, content_Title, content_Content, content_CreationUserID, content_CreationTimestamp) VALUES (" . ":content_Path, :content_Title, :content_Content, :content_CreationUserID, NOW())";
     $statement = $pdo->prepare($query);
     $result = $statement->execute(array(":content_Path" => $path, ":content_Title" => $title, ":content_Content" => $content, ":content_CreationUserID" => User::GetCurrent()->ID));
     return $result !== false;
 }
예제 #2
0
 public static function GetCurrent()
 {
     $user = User::GetCurrent();
     if ($user == null) {
         return null;
     }
     return $user->Theme;
 }
예제 #3
0
 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);
 }
예제 #4
0
 public static function Create($name, $title, $description, $creator = null)
 {
     if (Page::ValidateName($name) != null) {
         return false;
     }
     global $MySQL;
     if ($creator == null) {
         $creator = User::GetCurrent();
     }
     $query = "INSERT INTO " . System::$Configuration["Database.TablePrefix"] . "Pages (page_Name, page_Title, page_Description, page_CreationUserID, page_CreationTimestamp) VALUES (" . "'" . $MySQL->real_escape_string($name) . "', " . "'" . $MySQL->real_escape_string($title) . "', " . "'" . $MySQL->real_escape_string($description) . "', " . $creator->ID . ", " . "NOW()" . ")";
     $result = $MySQL->query($query);
     return $MySQL->errno == 0;
 }
예제 #5
0
 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];
     }
 }
 public static function Create($resources, $receiver = null, $sender = null, $comments = null, $creationUser = null)
 {
     $CurrentUser = User::GetCurrent();
     if ($creationUser == null) {
         $creationUser = $CurrentUser;
     }
     global $MySQL;
     $query = "INSERT INTO " . System::$Configuration["Database.TablePrefix"] . "UserResourceTransactions (transaction_SendingUserID, transaction_ReceivingUserID, transaction_Comments, transaction_CreationTimestamp, transaction_CreationUserID) VALUES (" . ($sender == null ? "NULL" : $sender->ID) . ", " . ($receiver == null ? "NULL" : $receiver->ID) . ", " . "'" . $MySQL->real_escape_string($comments) . "', " . "NOW()" . ", " . ($creationUser == null ? "NULL" : $creationUser->ID) . ")";
     $MySQL->query($query);
     if ($MySQL->errno != 0) {
         return false;
     }
     $transactionID = $MySQL->insert_id;
     foreach ($resources as $resource) {
         $query = "INSERT INTO " . System::$Configuration["Database.TablePrefix"] . "UserResourceTransactionResources (transactionresource_TransactionID, transactionresource_ResourceTypeID, transactionresource_Amount) VALUES (" . $transactionID . ", " . $resource->ResourceType->ID . ", " . $resource->Amount . ")";
         $MySQL->query($query);
         if ($MySQL->errno != 0) {
             return false;
         }
     }
 }
예제 #7
0
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);
예제 #8
0
    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 
    }
예제 #9
0
    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 &quot;cards&quot;, 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 &quot;User name&quot; for the private credential associated with your account has been changed to
        &quot;User ID&quot; 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 . " &mdash; " . $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>
        */
    }
예제 #10
0
    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 
    }
예제 #11
0
 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;
 }
예제 #12
0
 public function IsBlocked($byWhom = null)
 {
     if ($byWhom == null) {
         $byWhom = User::GetCurrent();
     }
     if ($byWhom == null) {
         return false;
     }
     global $MySQL;
     $query = "SELECT COUNT(*) FROM " . System::GetConfigurationValue("Database.TablePrefix") . "UserBlockedUsers WHERE (blocklist_UserID = " . $byWhom->ID . " AND blocklist_BlockedUserID = " . $this->ID . ") OR (blocklist_UserID = " . $this->ID . " AND blocklist_BlockedUserID = " . $byWhom->ID . ")";
     $result = $MySQL->query($query);
     $values = $result->fetch_array();
     if (is_numeric($values[0])) {
         return $values[0] > 0;
     }
     return false;
 }
예제 #13
0
 /**
  * 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;
 }
예제 #14
0
 public function AddComment($title, $content, $author = null, $reply_comment_id = null)
 {
     if ($author == null) {
         $author = User::GetCurrent();
     }
     $title = HTMLPurifier::instance()->purify($title);
     $content = HTMLPurifier::instance()->purify($content);
     global $MySQL;
     $query = "INSERT INTO " . System::$Configuration["Database.TablePrefix"] . "GroupTopicComments (grouptopiccomment_TopicID, grouptopiccomment_CreationUserID, grouptopiccomment_Title, grouptopiccomment_Content, grouptopiccomment_ReplyCommentID, grouptopiccomment_CreationTimestamp) VALUES (" . $topic->ID . ", " . $author->ID . ", " . "'" . $MySQL->real_escape_string($title) . "', " . "'" . $MySQL->real_escape_string($content) . "', " . ($reply_to == null ? "NULL" : $reply_comment_id) . ", " . "NOW()" . ");";
     $result = $MySQL->query($query);
     return $MySQL->errno == 0;
 }