This repository has been archived by the owner on Apr 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathorder.php
177 lines (157 loc) · 5.52 KB
/
order.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
170
171
172
173
174
175
176
177
<?PHP
require 'includes/master.inc.php';
$Auth->requireAdmin('login.php');
$nav = 'orders';
$o = new Order(@$_GET['id']);
if(!$o->ok()) redirect('orders.php');
if(isset($_GET['act']) && $_GET['act'] == 'email')
$o->emailLicense();
if(isset($_GET['act']) && $_GET['act'] == 'download')
$o->downloadLicense();
if(isset($_GET['act']) && $_GET['act'] == 'upgrade')
{
$upgraded_order = $o->upgradeLicense();
redirect('order.php?id=' . $upgraded_order->id);
exit;
}
if(isset($_GET['act']) && $_GET['act'] == 'deactivate')
{
$o->deactivated = 1;
$o->update();
redirect('order.php?id=' . $o->id);
}
if(isset($_GET['act']) && $_GET['act'] == 'delete')
{
$o->delete();
redirect('orders.php');
}
if(isset($_POST['btnNotes']))
{
$o->notes = $_POST['notes'];
$o->update();
redirect('order.php?id=' . $o->id);
}
$app = new Application($o->app_id);
// Get related orders
$db = Database::getDatabase();
$orders = DBObject::glob('Order', 'SELECT * FROM shine_orders WHERE payer_email = ' . $db->quote($o->payer_email) . ' AND id <> ' . $o->id . ' ORDER BY dt DESC');
?>
<?PHP include('inc/header.inc.php'); ?>
<div id="bd">
<div id="yui-main">
<div class="yui-b"><div class="yui-g">
<div class="block">
<div class="hd">
<h2>
Order #<?PHP echo $o->id; ?>
<?PHP if($o->deactivated == 1) : ?> (Deactivated) <?PHP endif; ?>
</h2>
</div>
<div class="bd">
<table class="lines">
<?PHP foreach($o->columns as $k => $v) : ?>
<?PHP if(strlen(trim($v)) > 0) : ?>
<tr>
<th><strong><?PHP echo $k; ?></strong></th>
<td><?PHP echo $v; ?></td>
</tr>
<?PHP endif; ?>
<?PHP endforeach; ?>
</table>
</div>
</div>
<div class="block">
<div class="hd">
<h2>Order Notes</h2>
</div>
<div class="bd">
<form action="order.php?id=<?PHP echo $o->id; ?>" method="post" class="bd">
<textarea style="width:100%;" name="notes" id="notes"><?PHP echo $o->notes; ?></textarea>
<input type="submit" name="btnNotes" value="Save Notes" id="btnNotes">
<span class="info">Notes will NOT be sent or made visible to customers.</span>
</form>
</div>
</div>
</div></div>
</div>
<div id="sidebar" class="yui-b">
<div class="block">
<div class="hd">
<h3>Customer Info</h3>
</div>
<div id="rapportive" class="bd"></div>
</div>
<div class="block">
<div class="hd">
<h3>Related Orders and Activations</h3>
</div>
<div class="bd">
<p><a href="activations.php?q=<?PHP echo $o->payer_email; ?>">Activated <?PHP echo $o->activationCount(); ?> times</a></p>
<table class="lines">
<thead>
<tr>
<td>Date</td>
<td>App Name</td>
</tr>
</thead>
<tbody>
<?PHP foreach($orders as $o2) : ?>
<tr>
<td><a href="order.php?id=<?PHP echo $o2->id; ?>"><?PHP echo time2str($o2->dt); ?></a></td>
<td><?PHP echo $o2->applicationName(); ?></td>
</tr>
<?PHP endforeach; ?>
</tbody>
</table>
</div>
</div>
<div class="block">
<div class="hd">
<h3>License Options</h3>
</div>
<div class="bd">
<ul class="biglist">
<li><a href="order.php?id=<?PHP echo $o->id; ?>&act=email" id="email">Email to User</a></li>
<li><a href="<?PHP echo $o->getDownloadLink(); ?>">Download Link (does not expire)</a></li>
<li><a href="<?PHP echo $o->getDownloadLink(86400); ?>">Download Link (1 day)</a></li>
<li><a href="<?PHP echo $o->getDownloadLink(86400 * 3); ?>">Download Link (3 days)</a></li>
<li><a href="<?PHP echo $o->getDownloadLink(86400 * 7); ?>">Download Link (1 week)</a></li>
<li><a href="order.php?id=<?PHP echo $o->id; ?>&act=deactivate" id="deactivate">Deactivate License</a></li>
</ul>
</div>
</div>
<div class="block">
<div class="hd">
<h3>Order Options</h3>
</div>
<div class="bd">
<ul class="biglist">
<?PHP if($app->upgrade_app_id > 0) : ?>
<li><a href="order.php?id=<?PHP echo $o->id; ?>&act=upgrade" id="upgrade">Upgrade Order</a></li>
<?PHP endif; ?>
<li><a href="order.php?id=<?PHP echo $o->id; ?>&act=delete" id="delete">Delete Order</a></li>
</ul>
</div>
</div>
<div class="block">
<div class="hd">
<h3>Cut & Paste License</h3>
</div>
<div class="bd">
<?PHP if($app->engine_class_name == 'aquaticprime') : ?>
<textarea style="width:100%;"><?PHP echo $o->license; ?></textarea>
<?PHP elseif($app->engine_class_name == 'dual') : ?>
<textarea style="width:100%;"><?PHP echo "Email: {$o->payer_email}\nSerial Number: {$o->serial_number}"; ?></textarea>
<?PHP else : ?>
<textarea style="width:100%;"><?PHP echo "Email: {$o->payer_email}\nReg Key: {$o->license}"; ?></textarea>
<?PHP endif; ?>
</div>
</div>
</div>
</div>
<?PHP include('inc/footer.inc.php'); ?>
<script type="text/javascript" charset="utf-8">
$(function() {
$('#rapportive').load('rapportive.php?email=<?PHP echo $o->payer_email; ?>');
});
</script>