-
Notifications
You must be signed in to change notification settings - Fork 1
/
bank_groupcurrencies.php
169 lines (150 loc) · 5.71 KB
/
bank_groupcurrencies.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
$whereat = 'bank';
$wiki = 'The_Bank';
$require_petload = 'no';
// confirm the session...
require_once 'commons/dbconnect.php';
require_once 'commons/rpgfunctions.php';
require_once 'commons/sessions.php';
require_once 'commons/grammar.php';
require_once 'commons/inventory.php';
require_once 'commons/formatting.php';
require_once 'commons/messages.php';
require_once 'commons/userlib.php';
require_once 'commons/questlib.php';
require_once 'commons/economylib.php';
$command = '
SELECT
a.currencyid,
a.amount,
a.hidden,
b.name,
b.symbol,
b.groupid,
c.name AS group_name,
c.leaderid
FROM
psypets_group_player_currencies AS a
LEFT JOIN psypets_group_currencies AS b
ON a.currencyid=b.idnum
LEFT JOIN psypets_groups AS c
ON b.groupid=c.idnum
WHERE
a.userid=' . $user['idnum'] . '
';
$group_currencies = $database->FetchMultiple($command, 'fetching extra currencies');
if($_POST['action'] == 'Apply')
{
foreach($group_currencies as $i=>$currency)
{
$id = $currency['currencyid'];
if($_POST['currency_' . $id] == 'yes' || $_POST['currency_' . $id] == 'on')
{
if($currency['hidden'] == 'yes')
{
$command = 'UPDATE psypets_group_player_currencies SET hidden=\'no\' WHERE userid=' . $user['idnum'] . ' AND currencyid=' . $id . ' LIMIT 1';
$database->FetchNone($command, 'updating settings');
$group_currencies[$i]['hidden'] = 'no';
}
}
else
{
if($currency['hidden'] == 'no')
{
$command = 'UPDATE psypets_group_player_currencies SET hidden=\'yes\' WHERE userid=' . $user['idnum'] . ' AND currencyid=' . $id . ' LIMIT 1';
$database->FetchNone($command, 'updating settings');
$group_currencies[$i]['hidden'] = 'yes';
}
}
}
}
include 'commons/html.php';
?>
<head>
<title><?= $SETTINGS['site_name'] ?> > The Bank > Group Currencies</title>
<?php include 'commons/head.php'; ?>
<script type="text/javascript">
function check_all()
{
i = document.trades.elements.length;
for(j = 1; j < i; ++j)
{
document.trades.elements[j].checked = document.trades.checkall.checked;
}
}
</script>
</head>
<body>
<?php include 'commons/header_2.php'; ?>
<h4>The Bank > Group Currencies</h4>
<ul class="tabbed">
<li><a href="bank.php">The Bank</a></li>
<li class="activetab"><a href="bank_groupcurrencies.php">Group Currencies</a></li>
<li><a href="bank_exchange.php">Exchanges</a></li>
<li><a href="ltc.php">License to Commerce</a></li>
<li><a href="allowance.php">Allowance Preference</a></li>
<?= $st_patricks ? '<li class="stpatrick"><a href="stpatricks.php?where=bank">St. Patrick\'s Day Competition</a></li>' : '' ?>
</ul>
<?php
// BANKER LAKISHA
echo '<a href="npcprofile.php?npc=Lakisha+Pawlak"><img src="//' . $SETTINGS['static_domain'] . '/gfx/npcs/banker_lakisha.png" align="right" width="350" height="427" alt="(Lakisha the Banker)" /></a>';
include 'commons/dialog_open.php';
if($_GET['dialog'] == 'splain')
{
echo '
<p>The distribution and use of a Group Currency is handled entirely by the group who created that currency. The group organizer may, without restriction, give or take their currencies from any resident.</p>
<p>That may sound scary, but don\'t worry: most group organizers are decent enough!</p>
<p>Remember that a Group Currency does not necessarily represent material wealth. A group may use a currency to measure status, rank, good deeds, or anything else; how it\'s used is entirely up to the group organizer.</p>
<p>If you have questions about what you can do with some Group Currency you\'ve received, check out the group\'s page or forums - that\'s usually where the currency would be explained - or ask the group\'s organizer directly.</p>
';
}
else
{
echo '
<p>If you\'ve received any Group Currencies, you can review them here.</p>
<p>If you don\'t like seeing a particular Group Currency on the top of every page, let me know, and I\'ll hide it for you. You can always come back here to review the currencies you\'ve received, and change your preferences on which are shown.</p>
';
$options[] = '<a href="bank_groupcurrencies.php?dialog=splain">Ask what Group Currencies are all about</a>';
}
include 'commons/dialog_close.php';
if(count($options) > 0)
echo '<ul><li>' . implode('</li><li>', $options) . '</li></ul>';
if(strlen($_GET['msg']) > 0)
$error_message = form_message(explode(',', $_GET['msg']));
echo '
<form method="post">
<table>
<thead>
<tr class="titlerow">
<th class="centered"><img src="gfx/the_eye.png" width="15" height="15" alt="Visible?" title="Visible?" style="display:block;" /></th><th colspan="2" class="centered">Currency</th><th>Group</th><th>Group Organizer</th>
</tr>
</thead>
<tbody>
';
if(count($group_currencies) > 0)
{
$rowclass = begin_row_class();
foreach($group_currencies as $currency)
{
$leader = get_user_byid($currency['leaderid'], 'display');
echo '
<tr class="' . $rowclass . '">
<td class="centered"><input type="checkbox" name="currency_' . $currency['currencyid'] . '"' . ($currency['hidden'] == 'no' ? ' checked="checked"' : '') . ' /></td>
<td class="righted">' . $currency['amount'] . '</td><td><abbr title="' . $currency['name'] . '">' . $currency['symbol'] . '</abbr></td>
<td><a href="grouppage.php?id=' . $currency['groupid'] . '">' . $currency['group_name'] . '</a></td>
<td>' . resident_link($leader['display']) . '</td>
</tr>
';
$rowclass = alt_row_class($rowclass);
}
}
echo '
</tbody>
</table>
<p><input type="submit" name="action" value="Apply" /></p>
</form>
';
?>
<?php include 'commons/footer_2.php'; ?>
</body>
</html>