Changeset 2821
- Timestamp:
- 01/29/11 18:58:19 (2 years ago)
- Location:
- alternc/trunk
- Files:
-
- 6 edited
-
bureau/admin/dom_edit.php (modified) (2 diffs)
-
bureau/class/m_dom.php (modified) (8 diffs)
-
install/upgrades/1.0.sql (modified) (1 diff)
-
src/dns.sh (modified) (1 diff)
-
src/hosting_functions_v2.sh (modified) (1 diff)
-
src/update_domains.sh (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
alternc/trunk/bureau/admin/dom_edit.php
r2817 r2821 95 95 --> 96 96 <table class="tlist"> 97 <tr><th colspan="2"><?php __("Actions"); ?></th><th><?php __("Subdomain"); ?></th><th><?php __("Type");?></th><th><?php __("Place"); ?></th>< /tr>97 <tr><th colspan="2"><?php __("Actions"); ?></th><th><?php __("Subdomain"); ?></th><th><?php __("Type");?></th><th><?php __("Place"); ?></th><th><?php __("Enable")?></th><th><?php __("Pending");?></tr> 98 98 <?php 99 99 $col=1; … … 111 111 <td><?php __($r['sub'][$i]['type_desc']);?></td> 112 112 <td><?php echo $r["sub"][$i]['type'] === 'LOCAL' ? '<a href="bro_main.php?R='.urlencode($r["sub"][$i]["dest"]).'">'.htmlspecialchars($r["sub"][$i]["dest"]).'</a>' : htmlspecialchars($r["sub"][$i]["dest"]); ?> </td> 113 <td><?php 114 switch ($r['sub'][$i]['enable']) { 115 case 'ENABLED': 116 __("Enabled"); 117 break; 118 case 'ENABLE': 119 __("Activation pending"); 120 break; 121 case 'DISABLED': 122 __("Disabled"); 123 break; 124 case 'DISABLE': 125 __("Desactivation pending"); 126 break; 127 }?></td> 128 <td><?php 129 switch ($r['sub'][$i]['web_action']) { 130 case 'UPDATE': 131 __("Update pending"); 132 break; 133 case 'DELETE': 134 __("Deletion pending"); 135 break; 136 case 'OK': 137 default: 138 __("Up to date"); 139 break; 140 }?></td> 141 113 142 </tr> 114 143 <?php } ?> -
alternc/trunk/bureau/class/m_dom.php
r2817 r2821 647 647 $r["nsub"]=$db->Record["cnt"]; 648 648 $db->free(); 649 $db->query("select sd.*, dt.description as type_desc from sub_domaines sd, domaines_type dt where compte='$cuid' and domaine='$dom' and upper(dt.name)=upper(sd.type)");649 $db->query("select sd.*, dt.description as type_desc, dt.only_dns from sub_domaines sd, domaines_type dt where compte='$cuid' and domaine='$dom' and upper(dt.name)=upper(sd.type)"); 650 650 // Pas de webmail, on le cochera si on le trouve. 651 651 $this->webmail=0; … … 656 656 $r["sub"][$i]["dest"]=$db->Record["valeur"]; 657 657 $r["sub"][$i]["type"]=$db->Record["type"]; 658 $r["sub"][$i]["enable"]=$db->Record["enable"]; 658 659 $r["sub"][$i]["type_desc"]=$db->Record["type_desc"]; 660 $r["sub"][$i]["only_dns"]=$db->Record["only_dns"]; 661 $r["sub"][$i]["web_action"]=$db->Record["web_action"]; 659 662 /* 660 663 if ($db->Record["type"]==3) { // Webmail … … 704 707 } 705 708 */ 706 $db->query("select sd.*, dt.description as type_desc from sub_domaines sd, domaines_type dt where compte='$cuid' and domaine='$dom' and sub='$sub' and ( length('$type')=0 or type='$type') and (length('$value')=0 or '$value'=valeur) and upper(dt.name)=upper(sd.type);");709 $db->query("select sd.*, dt.description as type_desc, dt.only_dns from sub_domaines sd, domaines_type dt where compte='$cuid' and domaine='$dom' and sub='$sub' and ( length('$type')=0 or type='$type') and (length('$value')=0 or '$value'=valeur) and upper(dt.name)=upper(sd.type);"); 707 710 if ($db->num_rows()==0) { 708 711 $err->raise("dom",14); … … 713 716 $r["name"]=$db->Record["sub"]; 714 717 $r["dest"]=$db->Record["valeur"]; 715 $r[" type"]=$db->Record["type"];718 $r["enable"]=$db->Record["enable"]; 716 719 $r["type_desc"]=$db->Record["type_desc"]; 720 $r["only_dns"]=$db->Record["only_dns"]; 721 $r["web_action"]=$db->Record["web_action"]; 717 722 $db->free(); 718 723 return $r; … … 738 743 return false; 739 744 } 745 return true; 740 746 break; 741 747 case 'IP': … … 759 765 760 766 761 function can_create_subdomain($dom,$sub,$type ) {767 function can_create_subdomain($dom,$sub,$type,$value_old='') { 762 768 global $db,$err,$cuid; 763 769 $err->log("dom","can_create_subdomain",$dom."/".$sub); … … 769 775 770 776 # Get the list of type of subdomains already here who have the same name 771 $db->query("select distinct type from sub_domaines where sub='$sub' and domaine='$dom';"); 777 $db->query("select * from sub_domaines where sub='$sub' and domaine='$dom' and not (type='$type' and valeur='$value_old')"); 778 #$db->query("select * from sub_domaines where sub='$sub' and domaine='$dom';"); 772 779 while ($db->next_record()) { 773 780 # And if there is a domain with a incompatible type, return false … … 829 836 } 830 837 831 if (! $this->can_create_subdomain($dom,$sub,$type )) {838 if (! $this->can_create_subdomain($dom,$sub,$type,$value_old)) { 832 839 # TODO have a real error code 833 840 $err->raise("dom", 654); -
alternc/trunk/install/upgrades/1.0.sql
r2820 r2821 35 35 alter table domaines add column dns_action enum ('OK','UPDATE','DELETE') NOT NULL default 'UPDATE'; 36 36 alter table domaines add column dns_result varchar(255) not null default ''; 37 alter table sub_domaines add column web_action enum ('OK','UPDATE','ENABLE','DISABLE','DELETE') NOT NULL default 'UPDATE'; 38 alter table sub add column dns_result varchar(255) not null default ''; 37 alter table sub_domaines add column web_action enum ('OK','UPDATE','DELETE') NOT NULL default 'UPDATE'; 38 alter table sub_domaines add column dns_result varchar(255) not null default ''; 39 alter table sub_domaines add column enable enum ('ENABLED', 'ENABLE', 'DISABLED', 'DISABLE') NOT NULL DEFAULT 'ENABLED'; 39 40 drop table sub_domaines_standby; 40 41 drop table domaines_standby; -
alternc/trunk/src/dns.sh
r2819 r2821 94 94 file=$( 95 95 echo -e "$file" 96 $MYSQL_DO "select distinct replace(replace(dt.entry,'%TARGET%',sd.valeur), '%SUB%', if(length(sd.sub)>0,sd.sub,'@')) as entry from sub_domaines sd,domaines_type dt where sd.type=dt.name and sd.domaine='$domain' order by entry ;"96 $MYSQL_DO "select distinct replace(replace(dt.entry,'%TARGET%',sd.valeur), '%SUB%', if(length(sd.sub)>0,sd.sub,'@')) as entry from sub_domaines sd,domaines_type dt where sd.type=dt.name and sd.domaine='$domain' and sd.enable in ('ENABLE', 'ENABLED') order by entry ;" 97 97 ) 98 99 98 100 99 # Get some usefull vars -
alternc/trunk/src/hosting_functions_v2.sh
r2820 r2821 114 114 115 115 local FQDN=$2 116 local TYPE=$3 # no use here, but one day, maybe... So here he is 116 117 local USER=$(get_account_by_domain $FQDN) 117 118 local user_letter=`print_user_letter "$USER"` -
alternc/trunk/src/update_domains.sh
r2820 r2821 43 43 # Sub_domaines we want to delete 44 44 # sub_domaines.web_action = delete 45 for sub in $( $MYSQL_DO "select if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine) from sub_domaines sd where web_action ='DELETE';") ; do46 host_delete $ sub45 for sub in $( $MYSQL_DO "select concat_ws('|µ',if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine),sd.type) from sub_domaines sd where web_action ='DELETE';") ; do 46 host_delete $(echo $sub|tr '|µ' ' ') 47 47 # TODO Update the entry in the DB with the result and the action 48 48 done … … 52 52 params=$( $MYSQL_DO " 53 53 select concat_ws('|µ',lower(sd.type), if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine), valeur) 54 from sub_domaines sd , domaines_type dt54 from sub_domaines sd 55 55 where sd.web_action ='UPDATE' 56 and lower(sd.type) = lower(dt.name)57 and dt.only_dns = false58 56 ;") 59 57 for sub in $params;do 60 58 host_create $(echo $sub|tr '|µ' ' ') 61 # TODO Update the entry in the DB with the result and the action59 $MYSQL_DO "update sub_domaines sd set web_action='OK',web_result='$?' where concat_ws('|µ',lower(sd.type),if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine),valeur)='$sub'" 62 60 done 63 61 64 62 # Domaine to enable 65 for sub in $( $MYSQL_DO "select if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine) from sub_domaines sd where sd.web_action='ENABLE' ;");do66 host_enable $ sub67 # TODO Update the entry in the DB with the result and the action63 for sub in $( $MYSQL_DO "select concat_ws('|µ',if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine),lower(sd.type)) from sub_domaines sd where sd.enable ='ENABLE' ;");do 64 host_enable $(echo $sub|tr '|µ' ' ') 65 $MYSQL_DO "update sub_domaines sd set enable='ENABLED' where concat_ws('|µ',if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine),lower(sd.type)) = '$sub';" 68 66 done 69 67 70 68 # Domains to disable 71 for sub in $( $MYSQL_DO "select if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine) from sub_domaines sd where sd.web_action='DISABLE' ;");do72 host_disable $ sub73 # TODO Update the entry in the DB with the result and the action69 for sub in $( $MYSQL_DO "select concat_ws('|µ',if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine),lower(sd.type)) from sub_domaines sd where sd.enable ='DISABLE' ;");do 70 host_disable $(echo $sub|tr '|µ' ' ') 71 $MYSQL_DO "update sub_domaines sd set enable='DISABLED' where concat_ws('|µ',if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine),lower(sd.type)) = '$sub';" 74 72 done 75 73
Note: See TracChangeset
for help on using the changeset viewer.
