public function Remove() { $user = User::GetCurrent(); if ($user == null) { return false; } $query = "DELETE FROM " . System::$Configuration["Database.TablePrefix"] . "member_notifications WHERE receiver_id = " . $user->ID . " AND notification_id = " . $this->ID; $result = mysql_query($query); return $result !== false; }
public function Delete() { $CurrentUser = User::GetCurrent(); if ($CurrentUser->ID != $this->CreationUser->ID) { return false; } $query = "DELETE FROM " . System::$Configuration["Database.TablePrefix"] . "forums WHERE forum_id = " . $this->ID; $result = mysql_query($query); if (!$result) { return false; } $query = "DELETE FROM " . System::$Configuration["Database.TablePrefix"] . "forum_topics WHERE forum_id = " . $this->ID; $result = mysql_query($query); if (!$result) { return false; } return true; }
protected function RenderContent() { $CurrentUser = User::GetCurrent(); $CurrentUser->SetRelativeResourceCount(MarketResource::GetByID(2), $this->Amount); ?> <div class="TicketDispenser" id="TicketDispenser_tgs" style="width: 400px; margin-left: auto; margin-right: auto;"> <div class="Prompt"> Congratulations! You earned </div> <div class="Ticket"> <span id="TicketDispenser_<?php echo $this->Name; ?> _value">0</span> </div> <div class="Prompt"> Arcade Tickets! </div> </div> <script type="text/javascript"> var <?php echo $this->Name; ?> = new TicketDispenser("<?php echo $this->Name; ?> ", <?php echo $this->Amount; ?> ); <?php echo $this->Name; ?> .Dispense(); </script> <?php }
protected function RenderContent() { $CurrentUser = User::GetCurrent(); $entry = $this->Item->GetMarketEntry(); ?> <div class="ProfilePage"> <div class="ProfileTitle"> <span class="ProfileUserName"><?php echo $this->Item->Title; ?> </span> <span class="ProfileControlBox"><?php if ($CurrentUser != null) { if ($entry != null) { ?> <a href="<?php echo System::ExpandRelativePath("~/market/items/" . $this->Item->Name . "/purchase"); ?> ">Purchase</a> <?php } ?> <a href="<?php echo System::ExpandRelativePath("~/market/items/" . $this->Item->Name . "/wish.phnx"); ?> ">Add to Wish List</a> <form action="<?php echo System::ExpandRelativePath("~/account/trade.phnx"); ?> " method="POST"> <input type="hidden" name="item_id" value="<?php echo $this->Item->ID; ?> " /> <input class="LinkButton" type="submit" value="Request a Trade" /> </form> <?php } ?> </span> </div> <div class="ProfileContent"> <table style="width: 100%"> <tr> <td rowspan="3"> <img src="<?php echo System::ExpandRelativePath("~/market/items/" . $this->Item->Name . "/images/thumbnail.png"); ?> " alt="No image available" /> </td> <td> <p> <?php if ($entry == null) { ?> <p> Sorry, this item is not purchasable at this time. </p> <?php } else { ?> Resource cost: <?php $resources = $entry->GetRequiredResources(); foreach ($resources as $resource) { ?> <div><?php echo $resource->ToHTML(); ?> </div> <?php } } ?> </p> <p> <?php if ($CurrentUser != null) { $invcount = $CurrentUser->CountInventoryItems($this->Item); if ($invcount == 0) { ?> You do not have this item in your Inventory. <?php } else { ?> You have <?php echo $invcount; ?> of these in your Inventory. <?php } } else { ?> Please log in to purchase this item. <?php } ?> </p> <p> This item has been purchased <?php $count = $this->Item->CountPurchased(); echo $count; if ($count == 1) { echo " time"; } else { echo " times"; } ?> . </p> </td> </tr> <tr> <td><hr /></td> </tr> <tr> <td><?php echo $this->Item->Description; ?> </td> </tr> </table> </div> </div> <?php }
public function RenderContent() { $CurrentUser = User::GetCurrent(); ?> <div class="Panel"> <h3 class="PanelTitle">Dressing Room</h3> <div class="PanelContent"> <p> Select an item from the list to add it to your Shopping Cart and see how it would look on your avatar. <?php if ($CurrentUser != null) { ?> Click the "Purchase" button to purchase all the items in your Shopping Cart! <?php } else { ?> <strong>You must be logged in to purchase items in your Shopping Cart.</strong> <?php } ?> </p> <table style="width: 100%"> <tr> <td style="width: 200px;"> <div class="Panel"> <h3 class="PanelTitle">Preview</h3> <div class="PanelContent" style="height: 340px;"> <div class="AvatarAdorner" style="position: relative; left: 80px;"> <?php $renderer = new AvatarRenderer("r1DressupPreview"); $renderer->ZoomFactor = 0.2; $renderer->Base = AvatarBase::GetByID(1); $renderer->Render(); ?> </div> </div> </div> </td> <td> <div class="Panel"> <h3 class="PanelTitle">Available Items</h3> <div class="PanelContent"> <script type="text/javascript"> <?php echo $renderer->Name; ?> .OnItemEquipped = function(sender, e) { for (var i = 0; i < e.Item.Images.length; i++) { var image = e.Item.Images[i]; var img = new Image(); img.src = "<?php echo System::ExpandRelativePath("~/images/avatar/items/"); ?> " + e.Item.ID + "/<?php echo $renderer->Base->ID; ?> /" + image.ID + "." + image.FileNameExtension; alert(img.src); } e.Data.Button.className = "ButtonGroupButton Selected"; }; <?php echo $renderer->Name; ?> .OnItemUnequipped = function(sender, e) { e.Data.Button.className = "ButtonGroupButton"; }; function AvatarEquipItem(itemid) { var parent = <?php echo $renderer->Name; ?> ; var btnid = "AvatarClothesBrowser_cb1_Items_" + itemid + "_Button"; var btn = document.getElementById(btnid); if (btn.className == "ButtonGroupButton Selected") { parent.Unequip(itemid, { "Button": btn }); } else { parent.Equip(itemid, { "Button": btn }); } } </script> <div class="ButtonGroup ButtonGroupHorizontal" style="height: 340px; overflow: scroll; overflow-x: hidden;"> <?php $entries = ItemMarketEntry::Get(); foreach ($entries as $entry) { ?> <a class="ButtonGroupButton" id="AvatarClothesBrowser_cb1_Items_<?php echo $entry->Item->ID; ?> _Button" href="#" onclick="AvatarEquipItem(<?php echo $entry->Item->ID; ?> ); return false;"> <img class="ButtonGroupButtonImage" src="<?php echo System::ExpandRelativePath("~/market/items/" . $entry->Item->Name . "/images/thumbnail.png"); ?> " style="width: auto;" /> <span class="ButtonGroupButtonText"><?php echo $entry->Item->Title; ?> </span> </a> <?php } ?> </div> </div> </div> </td> </tr> <?php if ($CurrentUser != null) { ?> <tr> <td colspan="2"> <div class="Panel"> <h3 class="PanelTitle">Shopping Cart</h3> <div class="PanelContent"> <div class="ProfilePage"> <div class="ProfileTitle"> <span class="ProfileUserName"><span id="lblItemCount">No</span> items in cart</span> <span class="ProfileControlBox"> <a href="#">Purchase</a> </span> </div> <div class="ProfileContent"> Please select an item from "Available Items" </div> </div> </div> </div> </td> </tr> <?php } ?> </table> </div> </div> <?php }
public static function CountByReceiver($receiver = null, $show_only_unread = false) { $query = "SELECT COUNT(*) FROM phpmmo_messages, phpmmo_message_receivers WHERE phpmmo_messages.message_id = phpmmo_message_receivers.message_id"; if ($receiver == null) { $receiver = User::GetCurrent(); } if ($receiver != null) { $query .= " AND phpmmo_message_receivers.receiver_id = " . $receiver->ID; } if ($show_only_unread) { $query .= " AND phpmmo_message_receivers.message_status = 0"; } $result = mysql_query($query); $values = mysql_fetch_array($result); return $values[0]; }
public static function Create($name, $description = null, $category = null, $user = null) { if ($user == null) { $user = User::GetCurrent(); } if ($user == null) { return null; } $query = "INSERT INTO phpmmo_storage_files (file_name, file_description, file_category_id, file_creation_member_id, file_creation_timestamp) VALUES (" . "'" . mysql_real_escape_string($name) . "', " . ($description == null ? "NULL" : "'" . mysql_real_escape_string($description) . "'") . ", " . ($category == null ? "NULL" : $category->ID) . ", " . $user->ID . ", " . "NOW()" . ")"; $result = mysql_query($query); if (mysql_errno() != 0) { return null; } $query = "SELECT LAST_INSERT_ID();"; $result = mysql_query($query); $values = mysql_fetch_array($result); $id = $values[0]; if (mysql_errno() != 0) { return null; } if (!is_numeric($id)) { return null; } $value = File::GetByID($id); if (mysql_errno() != 0) { return null; } return $value; }
public function AddComment($comment_title, $comment_content, $comment_parent = null, $comment_author = null) { // check to see if author exists if ($comment_author == null) { $comment_author = User::GetCurrent(); } if ($comment_author == null) { return false; } // HTMLPurify the parameters $comment_title = HTMLPurifier::instance()->purify($comment_title); $comment_content = HTMLPurifier::instance()->purify($comment_content); global $MySQL; $query = "INSERT INTO " . System::$Configuration["Database.TablePrefix"] . "journal_entry_comments (journal_entry_id, author_id, comment_parent_id, comment_title, comment_content, comment_timestamp_created) VALUES (" . $this->ID . ", " . $comment_author->ID . ", " . ($comment_parent == null ? "NULL" : $comment_parent->ID) . ", " . "'" . $MySQL->real_escape_string($comment_title) . "', " . "'" . $MySQL->real_escape_string($comment_content) . "', " . "NOW()" . ")"; $result = $MySQL->query($query); $success = $MySQL->errno == 0; if ($success) { // notify the user that we commented on their journal Notification::Create($this->Journal->Creator, "I commented on <a href=\"" . $this->Journal->GetURL() . "/entries/" . $this->Name . "\">" . $this->Title . "</a>!", "\"" . $comment_content . "\"", User::GetCurrent()); } return $success; }
public function Render() { $CurrentUser = User::GetCurrent(); ?> <div class="Chance" id="Chance_<?php echo $this->Name; ?> " style="background-image: url('<?php echo System::ExpandRelativePath("~/images/chance/" . $this->Chance->ID . "/kiosk_background.png"); ?> ');"> <div class="ChanceGlobe" id="Chance_<?php echo $this->Name; ?> _globe"> <div class="ChanceGlobeEggs" id="Chance_<?php echo $this->Name; ?> _globe_eggs"></div> <div class="ChanceGlobeStrip"></div> <div class="ChanceGlobeOverlay"></div> </div> <div class="ChanceControls"> <a style="background-image: url('<?php echo System::ExpandRelativePath("~/images/chance/" . $this->Chance->ID . "/kiosk_button.png"); ?> ');" id="Chance_<?php echo $this->Name; ?> _spinbutton" class="ChanceButton" href="<?php echo System::ExpandRelativePath("~/chance/" . $this->Chance->ID . "/spin"); ?> " onclick="Chance_<?php echo $this->Name; ?> .spin(); return false;"> </a> <span class="ChancePrompt">CLICK THE KNOB</span> </div> <div class="ChanceDisabled" style="display: none;"></div> <?php if ($CurrentUser == null) { ?> <div class="ChanceNotification" id="Chance_<?php echo $this->Name; ?> _bankrupt"> You must be logged in<br />to spin </div> <?php } else { if (MarketResource::GetByUser($CurrentUser, 1)->Count < 180) { ?> <div class="ChanceNotification" id="Chance_<?php echo $this->Name; ?> _bankrupt"> You do not have<br />enough money (<?php echo MarketResource::GetByID(1)->Name; ?> ) </div> <?php } } ?> <script type="text/javascript"> var Chance_<?php echo $this->Name; ?> = new Gacha("<?php echo $this->Name; ?> "); Chance_<?php echo $this->Name; ?> .completed = function() { window.location.href = "<?php echo System::ExpandRelativePath("~/chance/" . $this->Name . "/spin"); ?> "; }; </script> </div> <?php }
public static function GetByUser($user = null, $max = null) { if ($user == null) { $user = User::GetCurrent(); } if ($user == null) { return array(); } $query = "SELECT * FROM phpmmo_shoutout_messages WHERE message_receiver_id = " . $user->ID; $query .= " ORDER BY message_timestamp DESC"; if ($max != null && is_numeric($max)) { $query .= " LIMIT " . $max; } $result = mysql_query($query); $count = mysql_num_rows($result); $retval = array(); for ($i = 0; $i < $count; $i++) { $values = mysql_fetch_assoc($result); $item = ShoutoutMessage::GetByAssoc($values); if ($item == null) { continue; } $retval[] = $item; } return $retval; }