-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoints.php
More file actions
155 lines (134 loc) · 4.1 KB
/
points.php
File metadata and controls
155 lines (134 loc) · 4.1 KB
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
<?php
define("INCLUDED", true); //This is for returning a die message if INCLUDED is not defined on any of the template
$AJAX_PAGE = false;
//################ Required Resources ################
$REQUIRED_RESOURCES = array(
'WoW' => true,
'Realm' => true,
);
//################ Required Files ################
require_once("init.php");
//################ PAGE ACCESS ################
$cms->BannedAccess(true);
if($_GET['act'] == 'validate' || $_GET['act'] == 'faq' || $_GET['act'] == 'refundpolicy')
{
eval($cms->SetPageAccess(ACCESS_ALL));
}
else
{
eval($cms->SetPageAccess(ACCESS_REGISTERED));
}
//################ General Variables ################
$page_name[] = array($cms->config['websitename']." Points"=>"points.php");
WoW::getZonesArray();
//################ Page Functions ################
function FetchTransactionsPayPal($uid)
{
global $DB;
$query = new Query();
$query->Select("`log_payments_paypal`")->Columns("*")->Where("`account_id` = '%s'", $uid)->Order("`transaction_id` DESC, `timestamp` ASC")->Build();
$return = MySQLiFetch($DB->query($query, DBNAME));
return $return;
}
function FetchTransactionsMoneyBookers($uid)
{
global $DB;
$query = new Query();
$query->Select("`log_payments_moneybookers`")->Columns("*")->Where("`account_id` = '%s'", $uid)->Order("`transaction_id` DESC, `timestamp` ASC")->Build();
$return = MySQLiFetch($DB->query($query, DBNAME));
return $return;
}
function FetchTransactionsAlertPay($uid)
{
global $DB;
$query = new Query();
$query->Select("`log_payments_alertpay`")->Columns("*")->Where("`account_id` = '%s'", $uid)->Order("`transaction_id` DESC, `timestamp` ASC")->Build();
$return = MySQLiFetch($DB->query($query, DBNAME));
return $return;
}
function FetchDonationRewards($rid)
{
global $DB;
$query = new Query();
$query->Select("`rewards_donation`")->Columns("*")->Where("`realm` = '%s' AND `disabled` = '0'", $rid)->Build();
$return = MySQLiFetch($DB->query($query, DBNAME));
return $return;
}
$action = $_GET['act'];
switch($action)
{
case "spend":
if(empty($_GET['rid']) || empty($REALM[$_GET['rid']]))
{
$page_name[] = array("Select Realm");
$tplname = "realm_selection";
}
else
{
$page_name[] = array("Buy ".$cms->config['websitename']." Points Rewards"=>"points.php?act=spend");
$page_name[] = array($REALM[$_GET['rid']]['NAME']=>$_SERVER['REQUEST_URI']);
$rclass = new Realm($_GET['rid']);
//If Submitted ... Check for erros
if(isset($_POST['submit']))
{
if(empty($_POST['character_selected']))
{
$cms->ErrorPopulate("You did not select a character.");
}
if(empty($_POST['reward_selected']))
{
$cms->ErrorPopulate("You did not select a reward.");
}
}
//Prepare page variables
$CHARACTERLIST_RID = $_GET['rid'];
$CHARACTERLIST_SHOW_TOOLS = false;
$CHARACTERLIST_MUSTBEONLINE = false;
$CHARACTERLIST_MUSTBEOFFLINE = false;
$CHARACTERLIST_SELECTION = true;
$characters = $rclass->FetchCharactersByAccountID("", $USER['id']);
$rewards = FetchDonationRewards($_GET['rid']);
$itemnames = FetchItemsData($rewards, $_GET['rid']);
//If there is an error
if($cms->ErrorExists())
{
$tplname = "points_spend";
}
else //Or else we'll continue on sending the items
{
if(isset($_POST['submit']))
{
$result = $rclass->SendReward($_POST['reward_selected'], $_POST['character_selected'], REWARD_DONATE);
if($result['bool'])
{
$successmessage = $result['message'];
}
else
{
$cms->ErrorPopulate($result['message']);
}
}
$tplname = "points_spend";
}
}
break;
case "faq":
$page_name[] = array("FAQ"=>$_SERVER['REQUEST_URI']);
$tplname = "points_faq";
break;
case "refundpolicy":
$page_name[] = array("Refund Policy"=>$_SERVER['REQUEST_URI']);
$tplname = "points_refundpolicy";
break;
default:
$transactions_paypal = FetchTransactionsPayPal($USER['id']);
$transactions_moneybookers = FetchTransactionsMoneyBookers($USER['id']);
$transactions_alertpay = FetchTransactionsAlertPay($USER['id']);
$tplname = "points_info";
break;
}
if($tplname)
{
eval($templates->Output($tplname));
}
?>