55 $db->query(
"SELECT su FROM membres WHERE uid='$cuid';");
60 0 => _(
"This TLD is forbidden"),
61 1 => _(
"primary DNS is checked in WHOIS db"),
62 2 => _(
"primary & secondary DNS are checked in WHOIS db"),
63 3 => _(
"Domain must exist, but don't do any DNS check"),
64 4 => _(
"Domain can be installed, no check at all"),
65 5 => _(
"Domain can be installed, force NO DNS hosting"),
67 $this->archive=
variable_get(
'archive_del_data',
'',
'If folder specified html folder of deleted user is archived, else it is deleted. ');
71 global
$mem,
$cuid, $debug_alternc, $L_INOTIFY_UPDATE_DOMAIN;
72 if (!$mem->checkRight())
return false;
75 'title' => _(
"Administration"),
76 'ico' =>
'images/admin.png',
78 'class' =>
'adminmenu',
83 'txt' => _(
"Manage AlternC accounts"),
84 'url' =>
'adm_list.php',
85 'class' =>
'adminmenu'
88 'txt' => _(
"User Quotas"),
89 'url' =>
'quotas_users.php?mode=4',
90 'class' =>
'adminmenu'
98 'txt' => _(
"Admin Control Panel"),
99 'url' =>
'adm_panel.php',
100 'class' =>
'adminmenu'
104 'txt' => _(
"PhpMyAdmin"),
105 'url' =>
'/alternc-sql/',
106 'class' =>
'adminmenu',
107 'target' =>
'_blank',
111 'txt' => ($debug_alternc->status)?_(
"Switch debug Off"):_(
"Switch debug On"),
112 'url' =>
"alternc_debugme.php?enable=".($debug_alternc->status?
"0":
"1"),
113 'class' =>
'adminmenu'
115 if (empty($L_INOTIFY_UPDATE_DOMAIN) || file_exists(
"$L_INOTIFY_UPDATE_DOMAIN") ) {
118 'txt' => _(
"Applying..."),
119 'url' =>
'javascript:alert(\''._(
"Domain changes are already applying").
'\');
',
120 'class' => 'adminmenu
',
125 'txt
' => _("Apply changes"),
126 'url
' => 'adm_update_domains.php
',
127 'class' => 'adminmenu
',
128 'onclick
' => 'return confirm(
"'.addslashes(_("Server configuration changes are applied every 5 minutes. Do you want to
do it right now?
")).'");
',
131 } // L_INOTIFY_UPDATE_DOMAIN
139 function stop_if_jobs_locked() {
140 if ( file_exists(ALTERNC_LOCK_JOBS)) {
141 echo "There is a file ".ALTERNC_LOCK_JOBS."\n";
142 echo "So no jobs are allowed\n";
143 echo "Did you launch alternc.install ?\n";
148 # return the uid of an alternc account
149 function get_uid_by_login($login) {
151 $db->query("SELECT uid FROM membres WHERE login='$login
';");
152 if (! $db->next_record()) {
155 return $db->f('uid
');
159 /* ----------------------------------------------------------------- */
170 function get($uid,$recheck=false) {
171 global $err,$db,$lst_users_properties;
172 // $err->log("admin","get",$uid);
173 if (!$this->enabled) {
174 $err->raise("admin",_("-- Only administrators can access this page! --"));
178 if (!isset($lst_users_properties) || empty($lst_users_properties) || !is_array($lst_users_properties) || $recheck ) {
179 $lst_users_properties=array();
185 parent.login as parentlogin,
186 dbs.name as db_server_name,
187 m.renewed + INTERVAL m.duration MONTH as expiry,
189 WHEN m.duration IS NULL THEN 0
190 WHEN m.renewed + INTERVAL m.duration MONTH <= NOW() THEN 3
191 WHEN m.renewed <= NOW() THEN 2
195 LEFT JOIN membres as parent ON (parent.uid = m.creator)
196 LEFT JOIN db_servers as dbs ON (m.db_server_id = dbs.id)
197 LEFT JOIN local as l ON (m.uid = l.uid) ;");
198 while ($db->next_record()) {
199 $lst_users_properties[$db->f('muid
')]=$db->Record;
203 if ( !isset($lst_users_properties[$uid]) ) {
205 // don't exist, but is not a forced check. Do a forced check
206 return $this->
get(
$uid,
true);
208 $err->raise(
"admin",_(
"Account not found"));
212 return $lst_users_properties[
$uid];
224 $err->raise(
"admin",_(
"-- Only administrators can access this page! --"));
228 $db->query(
"SELECT m.*, parent.login as parentlogin FROM membres as m LEFT JOIN membres as parent ON (parent.uid = m.creator) WHERE m.uid='$uid';");
230 if ($db->num_rows()) {
234 $err->raise(
"admin",_(
"Account not found"));
238 $db->query(
"SELECT * FROM local WHERE uid='$uid';");
239 if ($db->num_rows()) {
242 while (list(
$key,
$val)=each($db->Record)) {
247 $db->query(
"SELECT count(*) as nbcreated FROM membres WHERE creator='$uid';");
248 if ($db->num_rows()) {
251 while (list(
$key,
$val)=each($db->Record)) {
267 $db->query(
"SELECT COUNT(*) AS cnt FROM membres WHERE su=1");
269 return ($db->f(
"cnt")==1);
286 $err->log(
"admin",
"get_list");
288 $err->raise(
"admin",_(
"-- Only administrators can access this page! --"));
296 if ($pattern_type ===
'domaine') {
298 $request =
'SELECT compte AS uid FROM domaines WHERE 1';
300 if ($pattern && preg_match(
'/[.a-zA-Z0-9]+/', $pattern))
301 $request .= sprintf(
' AND domaine LIKE "%%%s%%"', $pattern);
304 $request .= sprintf(
' AND compte in (select uid from membres where creator = "%s" ) ',
$creator);
306 if ($mem->user[
'uid']!=2000 && !$all)
307 $request .= sprintf(
' AND compte in (select uid from membres where creator = "%s") ', $cuid);
310 $request .=
' GROUP BY uid';
312 } elseif ($pattern_type ===
'login') {
314 $request =
'SELECT uid FROM membres WHERE 1';
316 if ($pattern && preg_match(
'/[a-zA-Z0-9]+/', $pattern))
317 $request .= sprintf(
' AND login LIKE "%%%s%%"', $pattern);
320 $request .= sprintf(
' AND creator = "%s"',
$creator);
322 if ($mem->user[
'uid']!=2000 && !$all)
323 $request .= sprintf(
' AND creator = "%s"', $cuid);
325 $request .=
' ORDER BY login;';
329 $err->raise(
"admin", _(
"Invalid pattern type provided. Are you even performing a legitimate action?"));
339 $request =
"SELECT uid FROM membres WHERE creator='".$creator.
"' ORDER BY login;";
340 } elseif ($mem->user[
'uid']==2000 || $all) {
341 $request =
"SELECT uid FROM membres ORDER BY login;";
343 $request =
"SELECT uid FROM membres WHERE creator='".$cuid.
"' ORDER BY login;";
347 $db->query($request);
349 if (
$db->num_rows()) {
350 while (
$db->next_record()) {
351 $c[
$db->f(
"uid")]=$this->
get(
$db->f(
"uid"));
369 $err->log(
"admin",
"mailallmembers");
371 $err->raise(
"admin",_(
"-- Only administrators can access this page! --"));
374 $subject=trim($subject);
375 $message=trim($message);
378 if (empty($subject) || empty($message) || empty($from) ){
379 $err->raise(
"admin",_(
"Subject, message and sender are mandatory"));
384 $err->raise(
"admin",_(
"Sender is syntaxically incorrect"));
388 @set_time_limit(1200);
389 $db->query(
"SELECT DISTINCT mail FROM membres WHERE mail!='';");
390 while ($db->next_record()) {
393 mail($db->f(
'mail'), $subject, $message, null,
"-f$from");
410 $err->log(
"admin",
"get_reseller_list");
411 if (!$this->
enabled || $cuid!=2000) {
412 $err->raise(
"admin",_(
"-- Only administrators can access this page! --"));
417 $db->query(
"SELECT DISTINCT creator FROM membres WHERE creator <> 0 ORDER BY creator ASC;");
418 if (
$db->num_rows()) {
419 while (
$db->next_record()) {
423 $creators2 = array();
424 foreach ($creators as $cc ) {
425 $creators2[$cc[
'uid']] = $cc;
440 $db->query(
"SELECT creator FROM membres WHERE uid='$uid';");
442 if ($db->Record[
"creator"]!=$cuid) {
443 $err->raise(
"admin",_(
"-- Only administrators can access this page! --"));
452 $err->log(
"admin",
"add_shared_domain",$u.
"/".$domain_name);
454 if (! $mem->checkright() ) {
455 $err->raise(
"admin",_(
"-- Only administrators can do that! --"));
460 if (! in_array($domain_name, $dom->enum_domains())) {
461 $err->raise(
"admin",_(
"You don't seem to be allowed to delegate this domain"));
462 $err->log(
"admin",
"add_shared_domain",
"domain not allowed");
467 $domain_name=preg_replace(
"/^\.\.*/",
"", $domain_name);
472 $dom->add_domain($mem->user[
'login'].
".".$domain_name,1,1,1);
494 function add_mem($login, $pass, $nom, $prenom, $mail, $canpass=1, $type=
'default', $duration=0, $notes =
"",
$force=0, $create_dom=
false, $db_server_id) {
496 $err->log(
"admin",
"add_mem",$login.
"/".$mail);
498 $err->raise(
"admin",_(
"-- Only administrators can access this page! --"));
501 if (empty($db_server_id)) {
502 $err->raise(
"admin",_(
"Missing db_server field"));
505 if (($login==
"")||($pass==
"")) {
506 $err->raise(
"admin",_(
"All fields are mandatory"));
511 $err->raise(
"admin",_(
"All fields are mandatory"));
515 $err->raise(
"admin",_(
"Please enter a valid email address"));
519 $login=strtolower($login);
520 if (!preg_match(
"#^[a-z0-9]+$#",$login)) {
521 $err->raise(
"admin", _(
"Login can only contains characters a-z and 0-9"));
524 if (strlen($login) > 14) {
528 $err->raise(
"admin",_(
"The login is too long (14 chars max)"));
532 if ($login==$L_MYSQL_DATABASE || $login==$L_MYSQL_LOGIN || $login==
"mysql" || $login==
"root") {
533 $err->raise(
"admin",_(
"Login can only contains characters a-z, 0-9 and -"));
538 $notes = mysql_real_escape_string($notes);
540 $db->query(
"SELECT count(*) AS cnt FROM membres WHERE login='$login';");
542 if (!
$db->f(
"cnt")) {
543 $db->query(
"SELECT max(m.uid)+1 as nextid FROM membres m");
544 if (!
$db->next_record()) {
550 $db->query(
"INSERT INTO membres (uid,login,pass,mail,creator,canpass,type,created,notes,db_server_id) VALUES ('$uid','$login','$pass','$mail','$cuid','$canpass', '$type', NOW(), '$notes', '$db_server_id');");
551 $db->query(
"INSERT INTO local(uid,nom,prenom) VALUES('$uid','$nom','$prenom');");
553 #exec("sudo /usr/lib/alternc/mem_add ".$login." ".$uid);
555 $action->fix_user(
$uid);
567 $hooks->invoke(
"alternc_add_member");
569 $hooks->invoke(
"hook_admin_add_member", array(), array(
'quota'));
570 $hooks->invoke(
"hook_admin_add_member");
573 if (!empty($create_dom)) {
579 $err->raise(
"admin",_(
"This login already exists"));
590 $dest =
variable_get(
'new_email',
'0',
'An email will be sent to this address when new accounts are created if set.', array(array(
'desc'=>
'Enabled',
'type'=>
'boolean')));
595 if (!
$db->query(
"SELECT m.*, parent.login as parentlogin FROM membres m LEFT JOIN membres parent ON parent.uid=m.creator WHERE m.uid='$cuid'")) {
596 $err->raise(
"admin",sprintf(_(
"query failed: %s "),
$db->Error));
599 if (
$db->next_record()) {
602 A
new AlternC account was created on %fqdn by %creator.
609 createor: %creator (%cuid)
610 can change password: %canpass
614 $mail = strtr($mail, array(
'%fqdn' => $L_FQDN,
615 '%creator' =>
$db->Record[
'parentlogin'],
616 '%uid' =>
$db->Record[
'uid'],
617 '%login' =>
$db->Record[
'login'],
618 '%mail' =>
$db->Record[
'mail'],
619 '%cuid' =>
$db->Record[
'creator'],
620 '%canpass' =>
$db->Record[
'canpass'],
621 '%type' =>
$db->Record[
'type'],
622 '%notes' =>
$db->Record[
'notes']));
623 $subject=sprintf(_(
"New account %s from %s on %s"),
$db->Record[
'login'],
$db->Record[
'parentlogin'], $L_HOSTING);
624 if (mail($dest,$subject,$mail,
"From: postmaster@$L_FQDN")) {
628 $err->raise(
"admin",sprintf(_(
"Cannot send email to %s"), $dest));
632 $err->raise(
"admin",sprintf(_(
"Query failed: %s"),
$db->Error));
656 function update_mem(
$uid, $mail, $nom, $prenom, $pass,
$enabled, $canpass, $type=
'default', $duration=0, $notes =
"",$reset_quotas=
false) {
658 global
$cuid, $quota;
660 $notes=addslashes($notes);
662 $err->log(
"admin",
"update_mem",
$uid);
664 $err->raise(
"admin",_(
"-- Only administrators can access this page! --"));
670 $ssq=
" ,pass='$pass' ";
675 $old_mem = $this->
get(
$uid);
677 if (($db->query(
"UPDATE local SET nom='$nom', prenom='$prenom' WHERE uid='$uid';"))
678 &&($db->query(
"UPDATE membres SET mail='$mail', canpass='$canpass', enabled='$enabled', `type`='$type', notes='$notes' $ssq WHERE uid='$uid';"))){
679 if($reset_quotas ==
"on" || $type != $old_mem[
'type'] ) {
681 $quota->synchronise_user_profile();
687 $err->raise(
"admin",_(
"Account not found"));
701 $err->log(
"admin",
"lock_mem",
$uid);
703 $err->raise(
"admin",_(
"-- Only administrators can access this page! --"));
707 if ($db->query(
"UPDATE membres SET enabled='0' WHERE uid='$uid';")) {
711 $err->raise(
"admin",_(
"Account not found"));
725 $err->log(
"admin",
"unlock_mem",
$uid);
727 $err->raise(
"admin",_(
"-- Only administrators can access this page! --"));
731 if ($db->query(
"UPDATE membres SET enabled='1' WHERE uid='$uid';")) {
735 $err->raise(
"admin",_(
"Account not found"));
750 $err->log(
"admin",
"del_mem",
$uid);
753 $err->raise(
"admin",_(
"-- Only administrators can access this page! --"));
757 $tt=$this->
get(
$uid);
763 $dom->hook_admin_del_member();
765 # New way of deleting or backup delted user html folders using action class
767 $action->archive($path);
769 $hooks->invoke(
"alternc_del_member");
770 $hooks->invoke(
"hook_admin_del_member");
772 if ((
$db->query(
"DELETE FROM membres WHERE uid='$uid';")) &&
773 (
$db->query(
"DELETE FROM local WHERE uid='$uid';"))) {
776 $db->query(
"UPDATE membres SET creator=2000 WHERE creator='$uid';");
779 $err->raise(
"admin",_(
"Account not found"));
796 $periods = intval($periods);
800 $query =
"UPDATE membres SET renewed = renewed + INTERVAL (duration * $periods) MONTH WHERE uid=${uid};";
804 $err->raise(
"admin",_(
"Account not found"));
820 if($db->query(
"UPDATE membres SET duration = NULL, renewed = NULL WHERE uid=$uid;"))
823 if($db->query(
"UPDATE membres SET duration = $duration WHERE uid=$uid") &&
824 $db->query(
"UPDATE membres SET renewed = NOW() WHERE uid=$uid and renewed is null;"))
828 $err->raise(
"admin",_(
"Account not found"));
839 $jj=$this->
get(
$uid);
840 if (
isset($jj) &&
isset($jj[
'expiry']) && ! empty($jj[
'expiry']) ) {
841 return $jj[
'expiry'];
857 $jj=$this->
get(
$uid);
859 if (
isset($jj) &&
isset($jj[
'status']) && ! empty($jj[
'status']) ) {
860 return $jj[
'status'];
874 if(!$db->query(
"SELECT *, m.renewed + INTERVAL duration MONTH 'expiry'," .
875 " CASE WHEN m.duration IS NULL THEN 0" .
876 " WHEN m.renewed + INTERVAL m.duration MONTH <= NOW() THEN 3" .
877 " WHEN m.renewed <= NOW() THEN 2" .
878 " ELSE 1 END 'status' FROM membres m, local l" .
879 " WHERE m.uid = l.uid" .
880 " HAVING status=2 or status=3 ORDER BY status DESC, expiry;"))
884 while($db->next_record())
885 $res[] = $db->Record;
899 $db->query(
"SELECT su FROM membres WHERE uid='$uid';");
900 if (!$db->next_record()) {
901 $err->raise(
"admin",_(
"Account not found"));
904 if ($db->Record[
"su"]!=0) {
905 $err->raise(
"admin",_(
"This account is ALREADY an administrator account"));
908 $db->query(
"UPDATE membres SET su=1 WHERE uid='$uid';");
921 $db->query(
"SELECT su FROM membres WHERE uid='$uid';");
922 if (!$db->next_record()) {
923 $err->raise(
"admin",_(
"Account not found"));
926 if ($db->Record[
"su"]!=1) {
927 $err->raise(
"admin",_(
"This account is NOT an administrator account!"));
930 $db->query(
"UPDATE membres SET su=0 WHERE uid='$uid';");
948 $db->query(
"SELECT tld,mode FROM tld ORDER BY tld;");
949 while ($db->next_record()) {
965 $cachefile=
"/tmp/alternc_dig_check_cache";
968 if (!
$forcecheck && file_exists($cachefile) && filemtime($cachefile)+$cachetime>time()) {
969 $checked=unserialize(file_get_contents($cachefile));
973 file_put_contents($cachefile,serialize($checked));
976 $db->query(
"SELECT m.uid,m.login,d.domaine,d.gesdns,d.gesmx,d.noerase FROM domaines d LEFT JOIN membres m ON m.uid=d.compte ORDER BY domaine;");
977 while ($db->next_record()) {
980 $tmp[
"errstr"]=$checked[$tmp[
"domaine"]][
"errstr"];
981 $tmp[
"errno"]=$checked[$tmp[
"domaine"]][
"errno"];
993 global
$db,$L_NS1,$L_NS2,$L_MX,$L_PUBLIC_IP;
995 $r=$db->query(
"SELECT * FROM domaines ORDER BY domaine;");
997 while ($db->next_record()) {
998 $dl[$db->Record[
"domaine"]]=$db->Record;
1001 foreach($dl as
$c) {
1007 if ($c[
"gesdns"]==1) {
1010 exec(
"dig +short NS ".escapeshellarg($c[
"domaine"]),$out);
1011 if (count($out)==0) {
1014 if (!in_array($L_NS1.
".",$out) || !in_array($L_NS2.
".",$out)) {
1015 $errno=1; $errstr.=
"NS for this domain are not $L_NS1 and $L_NS2 BUT ".implode(
",",$out).
"\n";
1019 if ($c[
"gesmx"]==1 && !$dontexist) {
1021 exec(
"dig +short MX ".escapeshellarg($c[
"domaine"]),$out);
1023 foreach($out as $o) {
1024 list(
$t,$out2[])=explode(
" ",$o);
1026 if (!in_array($L_MX.
".",$out2)) {
1027 $errno=1; $errstr.=
"MX is not $L_MX BUT ".implode(
",",$out2).
"\n";
1032 $db->query(
"SELECT * FROM sub_domaines WHERE domaine='".addslashes($c[
"domaine"]).
"' ORDER BY sub;");
1033 while ($db->next_record()) {
1035 if (
$d[
"type"]==0) {
1038 exec(
"dig +short A ".escapeshellarg(
$d[
"sub"].((
$d[
"sub"]!=
"")?
".":
"").$c[
"domaine"]),$out);
1039 if (!in_array($L_PUBLIC_IP,$out)) {
1040 $errstr.=
"subdomain '".$d[
"sub"].
"' don't point to $L_PUBLIC_IP but to ".implode(
",",$out).
"\n";
1048 $errstr=
"Domain don't exist anymore !";
1050 if ($errno==0) $errstr=
"OK";
1051 $checked[$c[
"domaine"]]=array(
"errno"=>$errno,
"errstr"=>$errstr);
1066 $db->query(
"SELECT compte FROM domaines WHERE domaine='$domain';");
1067 if (!$db->next_record()) {
1068 $err->raise(
"dom",_(
"Domain '%s' not found."),
$domain);
1071 $db->query(
"UPDATE domaines SET noerase=1-noerase WHERE domaine='$domain';");
1085 $db->query(
"SELECT mode FROM tld WHERE tld='$tld';");
1086 if (!$db->next_record()) {
1087 $err->raise(
"admin",_(
"This TLD does not exist"));
1090 return $db->Record[
"mode"];
1099 for(
$i=0;
$i<count($this->tldmode);
$i++) {
1100 echo
"<option value=\"$i\"";
1101 if ($current==
$i) echo
" selected=\"selected\"";
1102 echo
">"._($this->tldmode[
$i]).
"</option>\n";
1117 $db->query(
"SELECT tld FROM tld WHERE tld='$tld';");
1118 if (!$db->next_record()) {
1119 $err->raise(
"admin",_(
"This TLD does not exist"));
1122 $db->query(
"DELETE FROM tld WHERE tld='$tld';");
1140 $err->raise(
"admin",_(
"The TLD name is mandatory"));
1145 $db->query(
"SELECT tld FROM tld WHERE tld='$tld';");
1146 if ($db->next_record()) {
1147 $err->raise(
"admin",_(
"This TLD already exist"));
1150 if (substr($tld,0,1)==
".") $tld=substr($tld,1);
1153 $db->query(
"INSERT INTO tld (tld,mode) VALUES ('$tld','$mode');");
1167 $db->query(
"SELECT tld FROM tld WHERE tld='$tld';");
1168 if (!$db->next_record()) {
1169 $err->raise(
"admin",_(
"This TLD does not exist"));
1174 $db->query(
"UPDATE tld SET mode='$mode' WHERE tld='$tld';");
1185 $db->query(
"SELECT login FROM membres WHERE uid = '2000';");
1187 return $db->f(
"login");
1201 $db->query(
"SELECT * FROM policy;");
1202 while ($db->next_record()) {
1203 $tmp1[$db->Record[
"name"]]=$db->Record;
1215 $tmp3=$hooks->invoke(
"alternc_password_policy");
1216 foreach ($tmp3 as $v) {
1217 foreach ($v as $l=>$m) {
1221 foreach($tmp2 as $k=>$v) {
1222 if (!
isset($tmp1[$k])) {
1224 $db->query(
"INSERT INTO policy SET name='".addslashes($k).
"', minsize=0, maxsize=64, classcount=0, allowlogin=0;");
1226 "minsize"=>0,
"maxsize"=>64,
"classcount"=>0,
"allowlogin"=>0
1229 $policies[$k]=$tmp1[$k];
1230 $policies[$k][
"description"]=_($v);
1233 foreach ($tmp1 as $k=>$v) {
1235 $db->query(
"DELETE FROM policy WHERE name='".addslashes($k).
"';");
1251 function editPolicy($policy,$minsize,$maxsize,$classcount,$allowlogin) {
1253 $minsize=intval($minsize);
1254 $maxsize=intval($maxsize);
1255 $classcount=intval($classcount);
1256 $allowlogin=intval($allowlogin);
1258 $db->query(
"SELECT * FROM policy WHERE name='".addslashes($policy).
"';");
1259 if (!$db->next_record()) {
1262 if ($minsize<0 || $minsize>64 || $maxsize<0 || $maxsize>64 || $maxsize<$minsize || $classcount<0 || $classcount>4) {
1265 $allowlogin=($allowlogin)?1:0;
1266 $db->query(
"UPDATE policy SET minsize=$minsize, maxsize=$maxsize, classcount=$classcount, allowlogin=$allowlogin WHERE name='".addslashes($policy).
"';");
1281 if (empty($login)) {
1282 $err->raise(
"admin",_(
"Please enter a login"));
1286 $err->raise(
"admin",_(
"Please enter a password"));
1291 if (!$pol[$policy]) {
1292 $err->raise(
"admin",_(
"-- Program error -- The requested password policy does not exist!"));
1299 if ($plen<$pol[
"minsize"]) {
1300 $err->raise(
"admin",_(
"The password length is too short according to the password policy"));
1304 if ($plen>$pol[
"maxsize"]) {
1305 $err->raise(
"admin",_(
"The password is too long according to the password policy"));
1309 if (!$pol[
"allowlogin"]) {
1311 $logins=explode(
"@",$login);
1313 foreach($logins as $l) {
1315 $err->raise(
"admin",_(
"The password policy prevents you to use your login name inside your password"));
1321 if ($pol[
"classcount"]>0) {
1322 $cls=array(0,0,0,0,0);
1325 if (strpos(
"abcdefghijklmnopqrstuvwxyz",
$p)!==
false) {
1327 } elseif (strpos(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
$p)!==
false) {
1329 } elseif (strpos(
"0123456789",
$p)!==
false) {
1331 } elseif (strpos(
'!"#$%&\'()*+,-./:;<=>?@[\\]^_`',
$p)!==
false) {
1337 $clc=array_sum($cls);
1338 if ($clc<$pol[
"classcount"]) {
1339 $err->raise(
"admin",_(
"Your password contains not enough different classes of character, between low-case, up-case, figures and special characters."));
1355 "http" => array(
"port" => 80,
"protocol" =>
"tcp",
"mandatory" => 1),
1356 "https" => array(
"port" => 443,
"protocol" =>
"tcp",
"mandatory" => 0),
1357 "ssh" => array(
"port" => 22,
"protocol" =>
"tcp",
"mandatory" => 0),