forked from anvyst/domain_blocker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdomain_blocker.php
69 lines (51 loc) · 1.78 KB
/
domain_blocker.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
/**
* DomainBlocker addon with main
* WHMCS addon hook configs
* */
if (!defined("WHMCS"))
die("This file cannot be accessed directly");
require_once dirname(__FILE__).'/DomainBlocker.php';
function domain_blocker_config() {
$configarray = array(
'name' => 'Domain Blocker',
'description' => 'Helps preventing fraudulent domains from being registered',
'version' => '1.0',
'language' => 'english',
'author' => 'Andrey Vystavkin',
'fields' => array(),
);
return $configarray;
}
function domain_blocker_activate() {
$activated = DomainBlocker::activate();
$result = array();
$result['status'] = ($activated['status'] == 1) ? 'error' : 'success';
$result['description'] = implode('.', $result['msg']);
return $result;
}
function domain_blocker_deactivate() {
$deactivated = DomainBlocker::deactivate();
$result['status'] = ($deactivated['status'] == 1) ? 'error' : 'success';
$result['description'] = implode('.', $result['msg']);
return $result;
}
function domain_blocker_output($vars) {
$smarty = new Smarty();
$smarty->caching = false;
$smarty->compile_dir = $GLOBALS['templates_compiledir'];
echo DomainBlocker::getStyles();
$page = isset($_GET['page']) ? $_GET['page'] : 'index';
switch($page) {
case 'index':
$data = DomainBlocker::getBlockStrings();
$smarty->assign('block_strings', $data);
$blocked_domains = DomainBlocker::getBlockedDomains();
$smarty->assign('blocked_domains', $blocked_domains);
break;
}
//where all $_POST's go to
DomainBlocker::dispatchActions();
$smarty->display(dirname(__FILE__)."/templates/$page.tpl");
}
?>