php function cluster_xmlrpc return array array cluser createdomain clu

 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
<?php
function cluster_xmlrpc()
{
return array(
array(
'cluser.createdomain',
'cluser_createdomain',
t('Create Domain')
)
);
}
function cluser_createdomain($domain, $type, $server, $username, $owner, $homedir) {
$domain = trim ($domain);
// Проверям домен
if (! preg_match ("/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z]{2,4})+$/i", $domain)) {
$message->message = "Cluster :: Create Domain :: Domain wrong.";
$message->retcode = 1;
return $message;
};
if ($type != 'domain' && $type != 'alias' && $type != 'parked' ) {
$message->message = "Cluster :: Create Domain :: Domain type not supported (". $type .").";
$message->retcode = 2;
return $message;
}
$server = check_plain($server);
$server = server_load($server);
if ($server->serverobject->ipaddress != $_SERVER['REMOTE_ADDR'] ) {
$message->message = "Cluster :: Create Domain :: Access Denied (IP: ". $_SERVER['REMOTE_ADDR'] .").";
$message->retcode = 3;
return $message;
}
// Проверка пользователя
if ( trim($username) == '') {
$message->message = "Cluster :: Create Domain :: Username wrong.";
$message->retcode = 3;
return $message;
}
// Проверем на существование.
$message = '';
$message->retcode = 0;
$message->message = "Cluster :: Create Domain :: Operation Succesfull";
return $message;
}
?>