From 87b5ce8767ab105045eaf5f5f2a567fa33d032fd Mon Sep 17 00:00:00 2001 From: Balfear Date: Thu, 11 Jan 2024 23:04:28 +0300 Subject: [PATCH] Remove cash shop module --- config/access.php | 7 -- config/application.php | 4 -- lib/Flux/CashShop.php | 102 ----------------------------- modules/cashshop/add.php | 52 --------------- modules/cashshop/delete.php | 20 ------ modules/cashshop/edit.php | 59 ----------------- modules/cashshop/index.php | 31 --------- modules/item/pagemenu/view.php | 3 - themes/default/cashshop/add.php | 41 ------------ themes/default/cashshop/delete.php | 3 - themes/default/cashshop/edit.php | 41 ------------ themes/default/cashshop/index.php | 23 ------- 12 files changed, 386 deletions(-) delete mode 100644 lib/Flux/CashShop.php delete mode 100644 modules/cashshop/add.php delete mode 100644 modules/cashshop/delete.php delete mode 100644 modules/cashshop/edit.php delete mode 100644 modules/cashshop/index.php delete mode 100644 themes/default/cashshop/add.php delete mode 100644 themes/default/cashshop/delete.php delete mode 100644 themes/default/cashshop/edit.php delete mode 100644 themes/default/cashshop/index.php diff --git a/config/access.php b/config/access.php index 54598d711..6a1c9b415 100644 --- a/config/access.php +++ b/config/access.php @@ -32,12 +32,6 @@ 'delete' => AccountLevel::ADMIN, 'imagedel' => AccountLevel::ADMIN ), - 'cashshop' => array( - 'index' => AccountLevel::ADMIN, - 'add' => AccountLevel::ADMIN, - 'edit' => AccountLevel::ADMIN, - 'delete' => AccountLevel::ADMIN - ), 'account' => array( 'index' => AccountLevel::LOWGM, 'view' => AccountLevel::NORMAL, @@ -220,7 +214,6 @@ 'AddShopItem' => AccountLevel::ADMIN, // Ability to add an item to the shop. 'EditShopItem' => AccountLevel::ADMIN, // Ability to modify a shop item's details. 'DeleteShopItem' => AccountLevel::ADMIN, // Ability to remove an item for sale on the shop. - 'ManageCashShop' => AccountLevel::ADMIN, // Ability to manage the in-game cash shop. 'ViewGuild' => AccountLevel::ADMIN, // Ability to view another guild's details. 'SearchWhosOnline' => AccountLevel::ANYONE, // Ability to search the "Who's Online" page. 'ViewOnlinePosition' => AccountLevel::LOWGM, // Ability to see a character's current map on "Who's Online" page. diff --git a/config/application.php b/config/application.php index 64a614ae9..109d75d10 100644 --- a/config/application.php +++ b/config/application.php @@ -304,7 +304,6 @@ 'ReInstallLabel' => array('module' => 'install', 'action' => 'reinstall'), 'SendMailLabel' => array('module' => 'mail'), 'WCTitleLabel' => array('module' => 'webcommands'), - 'Cash Shop' => array('module' => 'cashshop'), //'Auction' => array('module' => 'auction'), //'Economy' => array('module' => 'economy') ) @@ -494,9 +493,6 @@ // Item shop categories. 'ShopCategories' => include('shopcategories.php'), - // Cash shop categories. - 'CashShopCategories' => include('cashshopcategories.php'), - // Item pick and zeny log types. 'PickTypes' => include('picktypes.php'), diff --git a/lib/Flux/CashShop.php b/lib/Flux/CashShop.php deleted file mode 100644 index abfbe842b..000000000 --- a/lib/Flux/CashShop.php +++ /dev/null @@ -1,102 +0,0 @@ -server = $server; - } - - /** - * Add an item to the cash shop. - */ - public function add($tab, $itemID, $price) { - $db = $this->server->charMapDatabase; - $sql = "INSERT INTO $db.`item_cash_db` (tab, item_id, price) VALUES (?, ?, ?)"; - $sth = $this->server->connection->getStatement($sql); - $res = $sth->execute(array($tab, $itemID, $price)); - - if ($res) { - return true; - } else { - return false; - } - } - - /** - * Modify item info in the shop. - */ - public function edit($shopItemID, $tab = null, $price = null) { - $tabQ = ''; - $priceQ = ''; - $bind = array(); - - if (!is_null($tab)) { - $tabQ = "tab = ? "; - $bind[] = (int)$tab; - } - - if (!is_null($price)) { - if ($tabQ) { - $priceQ = ", price = ? "; - } else { - $priceQ = "price = ? "; - } - $bind[] = (int)$price; - } - - if (empty($bind)) { return false; } - - $db = $this->server->charMapDatabase; - $sql = "UPDATE $db.`item_cash_db` SET $tabQ $priceQ WHERE item_id = ?"; - $sth = $this->server->connection->getStatement($sql); - - $bind[] = $shopItemID; - return $sth->execute($bind); - } - - /** - * - */ - public function delete($ItemID) { - $db = $this->server->charMapDatabase; - $sql = "DELETE FROM $db.`item_cash_db` WHERE item_id = ?"; - $sth = $this->server->connection->getStatement($sql); - - return $sth->execute(array($ItemID)); - } - - /** - * - */ - public function getItem($shopItemID) { - $db = $this->server->charMapDatabase; - - if($this->server->isRenewal) { - $fromTables = array("$db.item_db_re", "$db.item_db2_re"); - } else { - $fromTables = array("$db.item_db", "$db.item_db2"); - } - - $temp = new Flux_TemporaryTable($this->server->connection, "$db.items", $fromTables); - $shop = 'item_cash_db'; - $col = "$shop.item_id AS shop_item_id, $shop.tab AS shop_item_tab, $shop.price AS shop_item_price, "; - $col .= "items.name_english AS shop_item_name"; - $sql = "SELECT $col FROM $db.$shop LEFT OUTER JOIN $db.items ON items.id = $shop.item_id WHERE $shop.item_id = ?"; - $sth = $this->server->connection->getStatement($sql); - - if ($sth->execute(array($shopItemID))) { - return $sth->fetch(); - } else { - return false; - } - } - -} -?> diff --git a/modules/cashshop/add.php b/modules/cashshop/add.php deleted file mode 100644 index 5e546fbcd..000000000 --- a/modules/cashshop/add.php +++ /dev/null @@ -1,52 +0,0 @@ -loginRequired(); - -if (!$auth->allowedToManageCashShop) { - $this->deny(); -} -$title = 'Add Item to Cash Shop'; - -require_once 'Flux/TemporaryTable.php'; -require_once 'Flux/CashShop.php'; - -$itemID = $params->get('id'); - -$category = null; -$categories = Flux::config('CashShopCategories')->toArray(); - -if($server->isRenewal) { - $fromTables = array("{$server->charMapDatabase}.item_db_re", "{$server->charMapDatabase}.item_db2_re"); -} else { - $fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2"); -} -$tableName = "{$server->charMapDatabase}.items"; -$tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables); - -$col = "id AS item_id, name_english AS item_name, type"; -$sql = "SELECT $col FROM $tableName WHERE items.id = ?"; -$sth = $server->connection->getStatement($sql); - -$sth->execute(array($itemID)); -$item = $sth->fetch(); - -if ($item && count($_POST)) { - $tab = $params->get('tab'); - $shop = new Flux_CashShop($server); - $price = (int)$params->get('price'); - - if (!$price) { - $errorMessage = 'You must input a cashpoint cost greater than zero.'; - } else { - if ($shop->add($tab, $itemID, $price)) { - $message = 'Item has been successfully added to the CashShop'; - $session->setMessageData($message); - $this->redirect($this->url('cashshop')); - } else { - $errorMessage = 'Failed to add the item to the CashShop.'; - } - } -} - -?> diff --git a/modules/cashshop/delete.php b/modules/cashshop/delete.php deleted file mode 100644 index 4220491ed..000000000 --- a/modules/cashshop/delete.php +++ /dev/null @@ -1,20 +0,0 @@ -loginRequired(); - -if (!$auth->allowedToManageCashShop) { - $this->deny(); -} - -require_once 'Flux/CashShop.php'; - -$shop = new Flux_CashShop($server); -$shopItemID = $params->get('id'); -$deleted = $shopItemID ? $shop->delete($shopItemID) : false; - -if ($deleted) { - $session->setMessageData('Item successfully deleted from the CashShop. You will need to reload your itemdb for this to take effect in-game.'); - $this->redirect($this->url('cashshop')); -} -?> diff --git a/modules/cashshop/edit.php b/modules/cashshop/edit.php deleted file mode 100644 index a8c9fc663..000000000 --- a/modules/cashshop/edit.php +++ /dev/null @@ -1,59 +0,0 @@ -loginRequired(); - -if (!$auth->allowedToManageCashShop) { - $this->deny(); -} -$title = 'Modify Item in the CashShop'; - -require_once 'Flux/TemporaryTable.php'; -require_once 'Flux/CashShop.php'; - -$shopItemID = $params->get('id'); -$shop = new Flux_CashShop($server); -$tabs = Flux::config('CashShopCategories')->toArray(); -$item = $shop->getItem($shopItemID); - -if ($item) { - if($server->isRenewal) { - $fromTables = array("{$server->charMapDatabase}.item_db_re", "{$server->charMapDatabase}.item_db2_re"); - } else { - $fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2"); - } - $tableName = "{$server->charMapDatabase}.items"; - $tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables); - - $col = "id AS item_id, name_english AS item_name, type"; - $sql = "SELECT $col FROM $tableName WHERE items.id = ?"; - $sth = $server->connection->getStatement($sql); - - $sth->execute(array($shopItemID)); - $originalItem = $sth->fetch(); - - if (count($_POST)) { - $tab = $params->get('tab'); - $price = (int)$params->get('price'); - - if (!$price) { - $errorMessage = 'You must input a cash point cost greater than zero.'; - } else { - if ($shop->edit($shopItemID, $tab, $price)) { - $session->setMessageData('Item has been successfully modified.'); - $this->redirect($this->url('cashshop')); - } else { - $errorMessage = 'Failed to modify the item.'; - } - } - } - - if (empty($tab)) { - $tab = $item->shop_item_tab; - } - if (empty($price)) { - $price = $item->shop_item_price; - } -} - -?> diff --git a/modules/cashshop/index.php b/modules/cashshop/index.php deleted file mode 100644 index 110d4e9b0..000000000 --- a/modules/cashshop/index.php +++ /dev/null @@ -1,31 +0,0 @@ -loginRequired(); - -if (!$auth->allowedToManageCashShop) { - $this->deny(); -} -$title = 'CashShop'; - -require_once 'Flux/TemporaryTable.php'; - -$tabs = Flux::config('CashShopCategories')->toArray(); - -if($server->isRenewal) { - $fromTables = array("{$server->charMapDatabase}.item_db_re", "{$server->charMapDatabase}.item_db2_re"); -} else { - $fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2"); -} -$tableName = "{$server->charMapDatabase}.items"; -$tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables); - -$col = "cash.tab AS tab, cash.item_id AS item_id, cash.price AS price, items.name_english AS item_name"; -$sql = "SELECT $col FROM {$server->charMapDatabase}.`item_cash_db` AS cash "; -$sql.= "LEFT OUTER JOIN {$server->charMapDatabase}.items ON items.id = cash.item_id ORDER BY tab"; -$sth = $server->connection->getStatement($sql); - -$sth->execute(); -$items = $sth->fetchAll(); - -?> diff --git a/modules/item/pagemenu/view.php b/modules/item/pagemenu/view.php index 3c2d237a0..ecd4b4d80 100644 --- a/modules/item/pagemenu/view.php +++ b/modules/item/pagemenu/view.php @@ -8,8 +8,5 @@ $pageMenu['Add to Item Shop'] = $this->url('itemshop', 'add', array('id' => $item->item_id)); } } -if ($auth->actionAllowed('cashshop', 'add') && $auth->allowedToManageCashShop) { - $pageMenu['Add to Cash Shop'] = $this->url('cashshop', 'add', array('id' => $item->item_id)); -} return $pageMenu; ?> diff --git a/themes/default/cashshop/add.php b/themes/default/cashshop/add.php deleted file mode 100644 index 4e62edb66..000000000 --- a/themes/default/cashshop/add.php +++ /dev/null @@ -1,41 +0,0 @@ - -

CashShop

-

Add Item to the CashShop

- - -

- -
- - - - - - - - - - - - - - - - - - - - -
Item IDlinkToItem($item->item_id, $item->item_id) ?>
Nameitem_name) ?>
- -
- -
-
- -

Cannot add an unknown item to the item shop. Go back.

- diff --git a/themes/default/cashshop/delete.php b/themes/default/cashshop/delete.php deleted file mode 100644 index eefeb9cc7..000000000 --- a/themes/default/cashshop/delete.php +++ /dev/null @@ -1,3 +0,0 @@ - -

CashShop

-

Failed to delete item. Go back.

diff --git a/themes/default/cashshop/edit.php b/themes/default/cashshop/edit.php deleted file mode 100644 index a32338a25..000000000 --- a/themes/default/cashshop/edit.php +++ /dev/null @@ -1,41 +0,0 @@ - -

CashShop

-

Modify Item in the CashShop

- - -

- -
- - - - - - - - - - - - - - - - - - - - -
Item IDlinkToItem($item->shop_item_id, $item->shop_item_id) ?>
Nameshop_item_name) ?>
- -
- -
-
- -

Cannot modify an unknown item to the cashshop. Go back.

- diff --git a/themes/default/cashshop/index.php b/themes/default/cashshop/index.php deleted file mode 100644 index 2f467c42e..000000000 --- a/themes/default/cashshop/index.php +++ /dev/null @@ -1,23 +0,0 @@ - -

CashShop

- -

- - - - - - - - - - - - - - - - - - -
TabItem IDItem NamePriceOptions
tab] ?>linkToItem($item->item_id, $item->item_id) ?>linkToItem($item->item_id, htmlspecialchars($item->item_name)) ?>price ?>Edit | Remove