-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathget_enom_pro.php
69 lines (69 loc) · 2.32 KB
/
get_enom_pro.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
<?php
define( "WHMCS", true );
require( "init.php" );
if ( ! isset( $_REQUEST['key'] ) ) {
die( 'No Key' );
}
if ( ! isset( $_REQUEST['id'] ) ) {
die( 'Missing Product ID' );
}
/*
* id serviceid licensekey validdomain validip validdirectory reissues status lastaccess
*/
$result = select_query( 'mod_licensing',
'licensekey,status,validip,serviceid',
array( 'licensekey' => $_REQUEST['key'] ) );
$data = mysql_fetch_assoc( $result );
if ( $data ) {
//Check parent account for at least one active addon
$tblHosting = mysql_fetch_assoc( select_query( 'tblhosting', 'userid', array( 'id' => $data['serviceid'] ) ) );
$userID = $tblHosting['userid'];
$result1 = select_query( 'tblhosting', 'id', array( 'packageid' => 31, 'userid' => (int) $userID ) );
$hostingIDs = array();
while ( $activeProducts = mysql_fetch_row( $result1 ) ) {
$hostingIDs[] = reset( $activeProducts );
}
$foundActiveUpdates = false;
foreach ( $hostingIDs as $thisHostingID ) {
$tblAddons = mysql_fetch_assoc( select_query( 'tblhostingaddons',
'status',
array(
'addonid' => 7,
'status' => "Active",
//Only get active status, in case there are > 1 addon (one expired, one paid today, for example)
'hostingid' => $thisHostingID
) ) );
if ( $tblAddons && $tblAddons['status'] == "Active" ) {
$foundActiveUpdates = true;
break;
}
}
if ( ! $foundActiveUpdates ) {
header( 'Location: https://mycircletree.com/client-area/cart.php?gid=addons' );
die( 'Support & Updates Expired' );
}
if ( $data['status'] == 'Active' || $data['status'] == 'Reissued' ) {
if ( isset( $_REQUEST['beta'] ) && 1 == $_REQUEST['beta'] ) {
$ctwpf_zip = '/home/mycircle/downloads/enom_pro_BETA.zip';
} else {
$ctwpf_zip = '/home/mycircle/downloads/enom_pro.zip';
}
if ( ! file_exists( $ctwpf_zip ) ) {
die( 'Error reading release: ' . basename( $ctwpf_zip ) );
}
header( 'HTTP/1.1 200 OK' );
header( "Content-Transfer-Encoding: binary" );
header( 'Cache-Control: public' );
header( 'Content-Description: File Transfer' );
header( 'Content-Type: application/zip' );
header( 'Content-Disposition: attachment; filename="enom_pro.zip"' );
header( 'Content-Length: ' . filesize( $ctwpf_zip ) );
readfile( $ctwpf_zip );
} else {
echo $data['status'];
}
} else {
header( 'HTTP/1.1 404 Not Found' );
echo 'No license found';
}
die;