Alternc
3.2
Alternc logiel libre pour l'hébergement
|
Classe de gestion des domaines de l'hébergé. More...
Public Member Functions | |
m_dom () | |
Constructeur. | |
get_panel_url_list () | |
get_sub_domain_id_and_member_by_name ($fqdn) | |
hook_menu () | |
domains_type_lst () | |
Retourne un tableau contenant les types de domaines. | |
domains_type_enable_values () | |
domains_type_target_values ($type=null) | |
import_manual_dns_zone ($zone, $domain, $detect_redirect=true, $save=false) | |
import_manual_dns_entry ($zone, $domain, $detect_redirect=true, $save=false) | |
is_it_a_redirect ($url) | |
domains_type_regenerate ($name) | |
domains_type_get ($name) | |
domains_type_del ($name) | |
domains_type_update ($name, $description, $target, $entry, $compatibility, $enable, $only_dns, $need_dns, $advanced, $create_tmpdir, $create_targetdir) | |
sub_domain_change_status ($sub_id, $status) | |
enum_domains ($uid=-1) | |
Retourne un tableau contenant les domaines d'un membre. | |
del_domain_cancel ($dom) | |
del_domain ($dom) | |
Efface un domaine du membre courant, et tous ses sous-domaines. | |
domshort ($dom, $sub="") | |
add_domain ($domain, $dns, $noerase=0, $force=0, $isslave=0, $slavedom="") | |
Installe un domaine sur le compte courant. | |
create_default_subdomains ($domain, $target_domain="") | |
domdefaultdir ($domain) | |
dump_axfr ($domain, $ns='localhost') | |
lst_default_subdomains () | |
update_default_subdomains ($arr) | |
update_one_default ($domain_type, $sub, $domain_type_parameter, $concerned, $enabled, $id=null) | |
del_default_type ($id) | |
whois ($domain) | |
Retourne les entrées DNS du domaine $domain issues du WHOIS. | |
checkmx ($domaine, $ref_domain=false) | |
vérifie la presence d'un champs mx valide sur un serveur DNS $domaine est le domaine dont on veux véririfer les MX $ref_domaine est le domaine avec lequel on veux comparer les MX si $ref_domaine == false, on prend les MX par default | |
get_domain_all ($dom) | |
retourne TOUTES les infos d'un domaine | |
get_sub_domain_all ($sub_domain_id) | |
Retourne TOUTES les infos d'un sous domaine du compte courant. | |
check_type_value ($type, $value) | |
can_create_subdomain ($dom, $sub, $type, $sub_domain_id='null') | |
Check the compatibility of the POSTed parameters with the chosen domain type. | |
set_sub_domain ($dom, $sub, $type, $dest, $sub_domain_id=null) | |
Modifier les information du sous-domaine demandé. | |
del_sub_domain ($sub_domain_id) | |
Supprime le sous-domaine demandé | |
set_ttl ($dom_id, $ttl) | |
edit_domain ($dom, $dns, $gesmx, $force=0, $ttl=86400) | |
Modifie les information du domaine précisé. | |
enum_slave_ip () | |
Return the list of ip addresses and classes that are allowed access to domain list through AXFR Transfers from the bind server. | |
add_slave_ip ($ip, $class="32") | |
Add an ip address (or a ip class) to the list of allowed slave ip access list. | |
del_slave_ip ($ip) | |
Remove an ip address (or a ip class) from the list of allowed slave ip access list. | |
check_slave_account ($login, $pass) | |
Check for a slave account. | |
echo_domain_list ($integrity=false) | |
Out (echo) the complete hosted domain list : | |
get_domain_list ($uid=-1) | |
Returns the complete hosted domain list : | |
get_domain_all_summary () | |
get_domain_byid ($dom_id) | |
Returns the name of a domain for the current user, from it's domain_id. | |
get_domain_byname ($domain) | |
Returns the id of a domain for the current user, from it's domain name. | |
count_domains_all () | |
Count all domains, for all users. | |
enum_slave_account () | |
Return the list of allowed slave accounts. | |
add_slave_account ($login, $pass) | |
Add a slave account that will be allowed to access the domain list. | |
del_slave_account ($login) | |
Remove a slave account. | |
lock () | |
Try to lock a domain private. | |
unlock () | |
Unlock the cron for domain management return true private. | |
hook_dom_add_mx_domain ($dom_id) | |
Declare that a domain's emails are hosted in this server : This adds 2 MX entries in this domain (if required) | |
hook_admin_del_member () | |
Delete an account (all his domains) | |
hook_quota_get () | |
Returns the used quota for the $name service for the current user. | |
alternc_export_conf () | |
Returns the global domain(s) configuration(s) of a particular user No parameters needed. | |
generation_parameters ($id=null, $only_apache=true) | |
Return an array with all the needed parameters to generate conf of a vhost. | |
generation_domains_type () | |
Return an array with all informations of the domains_type used to generate Apache conf. | |
generate_conf_oldhook ($action, $lst_sub, $sub_obj=null) | |
generate_apacheconf ($p=null) | |
Generate apache configuration. | |
generation_todo () | |
subdomain_modif_are_done ($sub_domain_id, $action) | |
set_dns_action ($domain, $dns_action) | |
set_dns_result ($domain, $dns_result) | |
hook_upnp_list () | |
hook function called by AlternC-upnp to know which open tcp or udp ports this class requires or suggests | |
get_problems ($domain) | |
default_domain_type () |
Data Fields | |
$domains | |
$domains : Cache des domaines du membre private | |
$dns | |
$dns : Liste des dns trouvés par la fonction whois private | |
$webmail | |
Flag : a-t-on trouvé un sous-domaine Webmail pour ce domaine ? private. | |
$fic_lock_cron = "/var/run/alternc/cron.lock" | |
Système de verrouillage du cron Ce fichier permet de verrouiller le cron en attendant la validation du domaine par update_domains.sh private. | |
$islocked = false | |
Le cron a-t-il été bloqué ? Il faut appeler les fonctions privées lock et unlock entre les appels aux domaines. | |
$type_local = "VHOST" | |
$type_url = "URL" | |
$type_ip = "IP" | |
$type_webmail = "WEBMAIL" | |
$type_ipv6 = "IPV6" | |
$type_cname = "CNAME" | |
$type_txt = "TXT" | |
$type_defmx = "DEFMX" | |
$type_defmx2 = "DEFMX2" | |
$action_insert = "0" | |
$action_update = "1" | |
$action_delete = "2" | |
$tld_no_check_at_all = "1" |
Private Member Functions | |
import_manual_dns_entry_doit ($entry) | |
import_manual_dns_prep_zone ($domain) |
Classe de gestion des domaines de l'hébergé.
Cette classe permet de gérer les domaines / sous-domaines, redirections dns et mx des domaines d'un membre hébergé.
add_domain | ( | $domain, | |
$dns, | |||
$noerase = 0 , |
|||
$force = 0 , |
|||
$isslave = 0 , |
|||
$slavedom = "" |
|||
) |
Installe un domaine sur le compte courant.
Si le domaine existe déjà ou est interdit, ou est celui du serveur, l'installation est refusée. Si l'hébergement DNS est demandé, la fonction checkhostallow vérifiera que le domaine peut être installé conformément aux demandes des super-admin. Si le dns n'est pas demandé, le domaine peut être installé s'il est en seconde main d'un tld (exemple : test.eu.org ou test.com, mais pas toto.test.org ou test.test.asso.fr)
Chaque classe peut définir une fonction add_dom($dom) qui sera appellée lors de l'installation d'un nouveau domaine.
string | $dom | nom fqdn du domaine à installer |
integer | $dns | 1 ou 0 pour héberger le DNS du domaine ou pas. |
integer | $noerase | 1 ou 0 pour rendre le domaine inamovible ou non |
integer | $force | 1 ou 0, si 1, n'effectue pas les tests de DNS. force ne devrait être utilisé que par le super-admin. $ |
Definition at line 651 of file m_dom.php.
References $classes, $cuid, $db, $dns, $domain, $err, $force, $hooks, $t, checkfqdn(), checkhostallow(), checkhostallow_nodns(), create_default_subdomains(), and whois().
Referenced by import_manual_dns_prep_zone().
add_slave_account | ( | $login, | |
$pass | |||
) |
add_slave_ip | ( | $ip, | |
$class = "32" |
|||
) |
Add an ip address (or a ip class) to the list of allowed slave ip access list.
Definition at line 1518 of file m_dom.php.
References $db, $err, checkip(), and SLAVE_FLAG.
alternc_export_conf | ( | ) |
Returns the global domain(s) configuration(s) of a particular user No parameters needed.
Definition at line 1815 of file m_dom.php.
References $d, $db, $err, $sub, enum_domains(), get_domain_all(), lock(), and unlock().
can_create_subdomain | ( | $dom, | |
$sub, | |||
$type, | |||
$sub_domain_id = 'null' |
|||
) |
Check the compatibility of the POSTed parameters with the chosen domain type.
string | $dom | FQDN of the domain name |
string | $sub | SUBdomain |
Definition at line 1250 of file m_dom.php.
References $cuid, $db, $dom, $err, and $sub.
Referenced by set_sub_domain(), and sub_domain_change_status().
check_slave_account | ( | $login, | |
$pass | |||
) |
check_type_value | ( | $type, | |
$value | |||
) |
Definition at line 1172 of file m_dom.php.
References $cuid, $db, $err, $value, checkcname(), checkip(), checkipv6(), checkuserpath(), and domains_type_target_values().
Referenced by set_sub_domain().
checkmx | ( | $domaine, | |
$ref_domain = false |
|||
) |
vérifie la presence d'un champs mx valide sur un serveur DNS $domaine est le domaine dont on veux véririfer les MX $ref_domaine est le domaine avec lequel on veux comparer les MX si $ref_domaine == false, on prend les MX par default
Definition at line 1021 of file m_dom.php.
Referenced by edit_domain().
count_domains_all | ( | ) |
create_default_subdomains | ( | $domain, | |
$target_domain = "" |
|||
) |
Definition at line 758 of file m_dom.php.
References $db, $domain, $err, $query, domdefaultdir(), and set_sub_domain().
Referenced by add_domain().
default_domain_type | ( | ) |
Definition at line 2094 of file m_dom.php.
del_default_type | ( | $id | ) |
del_domain | ( | $dom | ) |
Efface un domaine du membre courant, et tous ses sous-domaines.
Cette fonction efface un domaine et tous ses sous-domaines, ainsi que les autres services attachés à celui-ci. Elle appelle donc les autres classe. Chaque classe peut déclarer une fonction del_dom qui sera appellée lors de la destruction d'un domaine.
string | $dom | nom de domaine à effacer |
Definition at line 600 of file m_dom.php.
References $classes, $cuid, $db, $dom, $err, $hooks, $r, get_domain_all(), lock(), set_dns_action(), and unlock().
Referenced by hook_admin_del_member().
del_domain_cancel | ( | $dom | ) |
del_slave_account | ( | $login | ) |
del_slave_ip | ( | $ip | ) |
Remove an ip address (or a ip class) from the list of allowed slave ip access list.
Definition at line 1542 of file m_dom.php.
References $db, $err, checkip(), and SLAVE_FLAG.
del_sub_domain | ( | $sub_domain_id | ) |
Supprime le sous-domaine demandé
string | $dom | Domaine dont on souhaite supprimer un sous-domaine |
string | $sub | Sous-domaine que l'on souhaite supprimer |
Definition at line 1376 of file m_dom.php.
References $cuid, $db, $err, $r, and get_sub_domain_all().
Referenced by import_manual_dns_prep_zone(), and set_sub_domain().
domains_type_del | ( | $name | ) |
domains_type_get | ( | $name | ) |
domains_type_lst | ( | ) |
Retourne un tableau contenant les types de domaines.
Definition at line 150 of file m_dom.php.
References $cuid, $db, and $err.
Referenced by import_manual_dns_entry_doit().
domains_type_target_values | ( | $type = null | ) |
Definition at line 175 of file m_dom.php.
References $cuid, $db, $err, $r, $t, and $tab.
Referenced by check_type_value().
domains_type_update | ( | $name, | |
$description, | |||
$target, | |||
$entry, | |||
$compatibility, | |||
$enable, | |||
$only_dns, | |||
$need_dns, | |||
$advanced, | |||
$create_tmpdir, | |||
$create_targetdir | |||
) |
Definition at line 518 of file m_dom.php.
References $cuid, $db, and $err.
domdefaultdir | ( | $domain | ) |
domshort | ( | $dom, | |
$sub = "" |
|||
) |
dump_axfr | ( | $domain, | |
$ns = 'localhost' |
|||
) |
echo_domain_list | ( | $integrity = false | ) |
edit_domain | ( | $dom, | |
$dns, | |||
$gesmx, | |||
$force = 0 , |
|||
$ttl = 86400 |
|||
) |
Modifie les information du domaine précisé.
string | $dom | Domaine du compte courant que l'on souhaite modifier |
integer | $dns | Vaut 1 ou 0 pour héberger ou pas le DNS du domaine |
integer | $gesmx | Héberge-t-on le emails du domaines sur ce serveur ? |
boolean | $force | Faut-il passer les checks DNS ou MX ? (admin only) |
Definition at line 1420 of file m_dom.php.
References $classes, $cuid, $db, $dns, $dom, $err, $force, $hooks, $r, $t, checkfqdn(), checkhostallow(), checkmx(), get_domain_all(), and whois().
Referenced by import_manual_dns_prep_zone(), and set_ttl().
enum_domains | ( | $uid = -1 | ) |
Retourne un tableau contenant les domaines d'un membre.
Par défaut le membre connecté
Definition at line 562 of file m_dom.php.
References $cuid, $db, $domains, $err, and $uid.
Referenced by alternc_export_conf(), hook_admin_del_member(), and hook_menu().
enum_slave_account | ( | ) |
enum_slave_ip | ( | ) |
generate_apacheconf | ( | $p = null | ) |
Generate apache configuration.
Die if a specific FQDN have 2 vhost conf.
Definition at line 1960 of file m_dom.php.
References $p, generation_domains_type(), generation_parameters(), and getuserpath().
generate_conf_oldhook | ( | $action, | |
$lst_sub, | |||
$sub_obj = null |
|||
) |
Definition at line 1931 of file m_dom.php.
References generation_parameters(), and isset.
generation_domains_type | ( | ) |
Return an array with all informations of the domains_type used to generate Apache conf.
Die if templates missing. Warning: an Apache domains_type must have 'only_dns' == TRUE
Definition at line 1916 of file m_dom.php.
References $d, $dom, and ALTERNC_APACHE2_GEN_TMPL_DIR.
Referenced by generate_apacheconf().
generation_parameters | ( | $id = null , |
|
$only_apache = true |
|||
) |
Return an array with all the needed parameters to generate conf of a vhost.
If no parameters, return the parameters for ALL the vhost. Optionnal parameters: id of the sub_domaines
Definition at line 1867 of file m_dom.php.
Referenced by generate_apacheconf(), and generate_conf_oldhook().
generation_todo | ( | ) |
get_domain_all | ( | $dom | ) |
retourne TOUTES les infos d'un domaine
string | $dom | Domaine dont on souhaite les informations |
$r["name"] = Nom fqdn $r["dns"] = Gestion du dns ou pas ? $r["mx"] = Valeur du champs MX si "dns"=true $r["mail"] = Heberge-t-on le mail ou pas ? (si "dns"=false) $r["nsub"] = Nombre de sous-domaines $r["sub"] = tableau associatif des sous-domaines $r["sub"][0-(nsub-1)]["name"] = nom du sous-domaine (NON-complet) $r["sub"][0-(nsub-1)]["dest"] = Destination (url, ip, local ...) $r["sub"][0-(nsub-1)]["type"] = Type (0-n) de la redirection.Retourne FALSE si une erreur s'est produite.
Definition at line 1077 of file m_dom.php.
References $cuid, $db, $dom, $err, $i, $r, $t, and checkfqdn().
Referenced by alternc_export_conf(), del_domain(), edit_domain(), get_problems(), import_manual_dns_prep_zone(), and set_ttl().
get_domain_all_summary | ( | ) |
Definition at line 1605 of file m_dom.php.
References $db, $err, and $res.
get_domain_byid | ( | $dom_id | ) |
Returns the name of a domain for the current user, from it's domain_id.
$dom_id | integer the domain_id to search for |
Definition at line 1626 of file m_dom.php.
References $cuid, $db, $domain, and $err.
Referenced by hook_dom_add_mx_domain(), and set_ttl().
get_domain_byname | ( | $domain | ) |
Returns the id of a domain for the current user, from it's domain name.
$domain | string the domain name to search for |
Definition at line 1650 of file m_dom.php.
References $cuid, $db, $domain, and $err.
Referenced by import_manual_dns_entry_doit().
get_domain_list | ( | $uid = -1 | ) |
get_panel_url_list | ( | ) |
get_problems | ( | $domain | ) |
Definition at line 2060 of file m_dom.php.
References $domain, $sub, get_domain_all(), isset, lock(), and unlock().
get_sub_domain_all | ( | $sub_domain_id | ) |
Retourne TOUTES les infos d'un sous domaine du compte courant.
integer | sub_domain_id id du subdomain |
$r["name"]= nom du sous-domaine (NON-complet) $r["dest"]= Destination (url, ip, local ...)$r["type"]= Type (0-n) de la redirection. Retourne FALSE si une erreur s'est produite.
Definition at line 1144 of file m_dom.php.
References $cuid, $db, $err, and $r.
Referenced by del_sub_domain(), and sub_domain_change_status().
get_sub_domain_id_and_member_by_name | ( | $fqdn | ) |
Definition at line 102 of file m_dom.php.
References $cuid, $db, and $err.
Referenced by m_variables\get_impersonated().
hook_admin_del_member | ( | ) |
Delete an account (all his domains)
Definition at line 1782 of file m_dom.php.
References $dom, $err, del_domain(), and enum_domains().
hook_dom_add_mx_domain | ( | $dom_id | ) |
Declare that a domain's emails are hosted in this server : This adds 2 MX entries in this domain (if required)
Definition at line 1766 of file m_dom.php.
References $domain, $err, get_domain_byid(), and set_sub_domain().
hook_menu | ( | ) |
Definition at line 111 of file m_dom.php.
References $d, and enum_domains().
hook_quota_get | ( | ) |
hook_upnp_list | ( | ) |
hook function called by AlternC-upnp to know which open tcp or udp ports this class requires or suggests
Definition at line 2051 of file m_dom.php.
Definition at line 213 of file m_dom.php.
References $cuid, $domain, $err, $val, import_manual_dns_entry_doit(), and is_it_a_redirect().
Referenced by import_manual_dns_zone().
|
private |
Definition at line 390 of file m_dom.php.
References $err, $val, domains_type_lst(), get_domain_byname(), lock(), set_sub_domain(), set_ttl(), and unlock().
Referenced by import_manual_dns_entry().
|
private |
Definition at line 425 of file m_dom.php.
References $d, $domain, $err, add_domain(), del_sub_domain(), edit_domain(), get_domain_all(), lock(), and unlock().
Referenced by import_manual_dns_zone().
Definition at line 195 of file m_dom.php.
References $domain, $err, $val, import_manual_dns_entry(), and import_manual_dns_prep_zone().
is_it_a_redirect | ( | $url | ) |
Definition at line 455 of file m_dom.php.
References isset.
Referenced by import_manual_dns_entry().
lock | ( | ) |
Try to lock a domain private.
Definition at line 1732 of file m_dom.php.
Referenced by alternc_export_conf(), del_domain(), get_problems(), import_manual_dns_entry_doit(), import_manual_dns_prep_zone(), and set_ttl().
lst_default_subdomains | ( | ) |
Definition at line 792 of file m_dom.php.
m_dom | ( | ) |
Constructeur.
Definition at line 86 of file m_dom.php.
References variable_get().
set_dns_action | ( | $domain, | |
$dns_action | |||
) |
Definition at line 2033 of file m_dom.php.
Referenced by del_domain(), del_domain_cancel(), and sub_domain_change_status().
set_dns_result | ( | $domain, | |
$dns_result | |||
) |
set_sub_domain | ( | $dom, | |
$sub, | |||
$type, | |||
$dest, | |||
$sub_domain_id = null |
|||
) |
Modifier les information du sous-domaine demandé.
Note : si le sous-domaine $sub.$dom n'existe pas, il est créé.
Note : TODO : vérification de concordance de $dest
string | $dom | Domaine dont on souhaite modifier/ajouter un sous domaine |
string | $subk | Sous domaine à modifier / créer |
integer | $type | Type de sous-domaine (local, ip, url ...) |
string | $action | Action : vaut "add" ou "edit" selon que l'on Crée (add) ou Modifie (edit) le sous-domaine |
string | $dest | Destination du sous-domaine, dépend de la valeur de $type (url, ip, dossier...) |
Definition at line 1287 of file m_dom.php.
References $cuid, $db, $dom, $err, $sub, $t, can_create_subdomain(), check_type_value(), checkfqdn(), del_sub_domain(), and domshort().
Referenced by create_default_subdomains(), hook_dom_add_mx_domain(), and import_manual_dns_entry_doit().
set_ttl | ( | $dom_id, | |
$ttl | |||
) |
Definition at line 1395 of file m_dom.php.
References $d, $err, edit_domain(), get_domain_all(), get_domain_byid(), lock(), and unlock().
Referenced by import_manual_dns_entry_doit().
sub_domain_change_status | ( | $sub_id, | |
$status | |||
) |
Definition at line 532 of file m_dom.php.
References $cuid, $db, $err, can_create_subdomain(), get_sub_domain_all(), and set_dns_action().
subdomain_modif_are_done | ( | $sub_domain_id, | |
$action | |||
) |
Definition at line 2019 of file m_dom.php.
References $db.
unlock | ( | ) |
Unlock the cron for domain management return true private.
Definition at line 1751 of file m_dom.php.
Referenced by alternc_export_conf(), del_domain(), get_problems(), import_manual_dns_entry_doit(), import_manual_dns_prep_zone(), and set_ttl().
update_default_subdomains | ( | $arr | ) |
Definition at line 812 of file m_dom.php.
References $err, isset, and update_one_default().
update_one_default | ( | $domain_type, | |
$sub, | |||
$domain_type_parameter, | |||
$concerned, | |||
$enabled, | |||
$id = null |
|||
) |
Definition at line 829 of file m_dom.php.
References $db, $err, and $sub.
Referenced by update_default_subdomains().
whois | ( | $domain | ) |
Retourne les entrées DNS du domaine $domain issues du WHOIS.
Cette fonction effectue un appel WHOIS($domain) sur Internet, et extrait du whois les serveurs DNS du domaine demandé. En fonction du TLD, on sait (ou pas) faire le whois correspondant. Actuellement, les tld suivants sont supportés : .com .net .org .be .info .ca .cx .fr .biz .name
string | $domain | Domaine fqdn dont on souhaite les serveurs DNS |
Definition at line 872 of file m_dom.php.
References $db, $domain, $err, and $found.
Referenced by add_domain(), and edit_domain().
$dns |
$dns : Liste des dns trouvés par la fonction whois private
Definition at line 44 of file m_dom.php.
Referenced by add_domain(), and edit_domain().
$domains |
$domains : Cache des domaines du membre private
Definition at line 39 of file m_dom.php.
Referenced by enum_domains().
$fic_lock_cron = "/var/run/alternc/cron.lock" |
$islocked = false |
$webmail |