-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdataback.php
More file actions
41 lines (34 loc) · 893 Bytes
/
databack.php
File metadata and controls
41 lines (34 loc) · 893 Bytes
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
<?php
require('init.php');
$out = null;
if (empty($_GET['do'])) {
$out['error'][] = 'No action specified.';
}
if (empty($_GET['key']) || mv_setting('datakey') != $_GET['key']) {
$out['error'][] = 'Invalid security key';
}
if (empty($out['error'])) {
if ($_GET['do'] == 'pending') {
$out['votes'] = mv_pending_votes();
$out['rewards'] = mv_pending_rewards();
$out['tactic'] = mv_setting('incentive_tactic');
$out['reward'] = $out['tactic'] == 'reward';
}
else if ($_GET['do'] == 'finalize' && !empty($_GET['ids']) && !empty($_GET['type'])) {
$ids = explode(',', $_GET['ids']);
$type = $_GET['type'] == 'rewards' ? 'rewards' : 'votes';
if ($type == 'rewards') {
foreach ($ids as $id) {
mv_finalize_reward(intval($id));
}
}
else {
foreach ($ids as $id) {
mv_finalize_vote(intval($id));
}
}
die('success');
}
}
echo(json_encode($out));
?>