forked from poweradmin/poweradmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgh.php
98 lines (82 loc) · 2.22 KB
/
gh.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
<?php
error_reporting(E_ALL);
global $using_api;
$using_api = true;
require_once("inc/toolkit.inc.php");
// POWERADMIN API ABSTRACTION
// ACTIONS :
// create_zone
// domain
// content
// owner_id
extract($_GET);
$_SESSION['userid'] = 2;
switch($action){
case "create_zone" :
gh_create_zone($domain, $content, $owner_id);
break;
case "set_google_apps_records" :
gh_set_google_apps_records($domain);
break;
case "create_subdomain" :
gh_create_subdomain($domain, $subdomain, $content);
break;
}
function gh_create_zone($domain, $content, $owner_id){
$domain = strtolower($domain);
$dom_type = 'MASTER';
$zone_template = 'none';
add_domain($domain, $owner_id, $dom_type, '', $zone_template);
$zoneid = get_zone_id_from_name($domain);
$type = 'A';
$content = $content;
$ttl = 86400;
$prio = 0;
$name = $domain;
add_record($zoneid, $name, $type, $content, $ttl, $prio);
$name = "www.{$domain}";
add_record($zoneid, $name, $type, $content, $ttl, $prio);
return $zoneid;
}
function gh_set_google_apps_records($domain){
$domain = strtolower($domain);
$zoneid = get_zone_id_from_name($domain);
$type = 'MX';
$ttl = 86400;
$prio = 0;
$name = $domain;
$contents[] = "ASPMX.L.GOOGLE.COM.";
$contents[] = "ALT1.ASPMX.L.GOOGLE.COM.";
$contents[] = "ALT2.ASPMX.L.GOOGLE.COM.";
$contents[] = "ASPMX2.GOOGLEMAIL.COM.";
$contents[] = "ASPMX3.GOOGLEMAIL.COM.";
foreach($contents as $content){
add_record($zoneid, $name, $type, $content, $ttl, $prio += 10);
}
$names = array("mail", "calendar", "docs", "start", "sites");
$content = "ghs.google.com";
$type = 'CNAME';
foreach($names as $name){
add_record($zoneid, $name, $type, $content, $ttl, 0);
}
}
function gh_create_subdomain($domain, $subdomain, $content=null){
$zoneid = get_zone_id_from_name($domain);
$type = 'A';
$content = $content;
$ttl = 86400;
$prio = 0;
$name = "{$subdomain}";
$content = ($content) ? $content : get_domain_ip($domain);
add_record($zoneid, $name, $type, $content, $ttl, $prio);
return $zoneid;
}
function gh_set_cpanel_mx($domain){
$zoneid = get_zone_id_from_name($domain);
$type = 'MX';
$content = "mx.registrar.com.uy";
$ttl = 86400;
$prio = 0;
add_record($zoneid, "", $type, $content, $ttl, $prio);
return $zoneid;
}