finishing up default domain types admin
This commit is contained in:
		
							parent
							
								
									f7ab0d0846
								
							
						
					
					
						commit
						21e4fbd973
					
				| 
						 | 
					@ -133,6 +133,7 @@ bureau/admin/bro_view.php -text
 | 
				
			||||||
bureau/admin/browseforfolder.php -text
 | 
					bureau/admin/browseforfolder.php -text
 | 
				
			||||||
bureau/admin/cron.php -text
 | 
					bureau/admin/cron.php -text
 | 
				
			||||||
bureau/admin/dom_add.php -text
 | 
					bureau/admin/dom_add.php -text
 | 
				
			||||||
 | 
					bureau/admin/dom_defdel.php -text
 | 
				
			||||||
bureau/admin/dom_doadd.php -text
 | 
					bureau/admin/dom_doadd.php -text
 | 
				
			||||||
bureau/admin/dom_dodel.php -text
 | 
					bureau/admin/dom_dodel.php -text
 | 
				
			||||||
bureau/admin/dom_edit.inc.php -text
 | 
					bureau/admin/dom_edit.inc.php -text
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,14 @@ if (!$admin->enabled) {
 | 
				
			||||||
    <h3><?php __("Manage defaults domains type"); ?></h3>
 | 
					    <h3><?php __("Manage defaults domains type"); ?></h3>
 | 
				
			||||||
    <hr id="topbar" />
 | 
					    <hr id="topbar" />
 | 
				
			||||||
      <p><?php __("If you don't know what this page is about, don't touch anything, and read AlternC documentation about domain types"); ?></p>
 | 
					      <p><?php __("If you don't know what this page is about, don't touch anything, and read AlternC documentation about domain types"); ?></p>
 | 
				
			||||||
 | 
					      <p><?php __("The Type column contains a type of available VirtualHost config on The server."); ?></p>
 | 
				
			||||||
 | 
					      <p><?php __("The Setting column contains the variables to be expanded in the defaults configuration. Available values are:  "); ?></p>
 | 
				
			||||||
 | 
					      <ul>
 | 
				
			||||||
 | 
					        <li><?php __("%%DOMAIN%% : the Domain name"); ?></li>
 | 
				
			||||||
 | 
					        <li><?php __("%%TARGETDOM%%: The destination domain"); ?></li>
 | 
				
			||||||
 | 
					        <li><?php __("%%SUB%% : The subdomain name"); ?></li>
 | 
				
			||||||
 | 
					        <li><?php __("%%DOMAINDIR%%: the domain directory on the file system"); ?></li>
 | 
				
			||||||
 | 
					      </ul>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      <br />
 | 
					      <br />
 | 
				
			||||||
      <?php
 | 
					      <?php
 | 
				
			||||||
| 
						 | 
					@ -35,7 +43,7 @@ if (!empty($domup)) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$tab=$dom->lst_default_subdomains();
 | 
					$tab=$dom->lst_default_subdomains();
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
<form method="post" action="dom_defedit.php" name="main" id="main">
 | 
					<form method="post" action="adm_doms_def_type.php" name="main" id="main">
 | 
				
			||||||
<table class="tlist">
 | 
					<table class="tlist">
 | 
				
			||||||
   <tr><th> </th><th><?php __("Sub"); ?></th><th><?php __("Type"); ?></th><th><?php __("settings"); ?></th><th><?php __("Concerned"); ?></th><th><?php __("Activation"); ?></th></tr>
 | 
					   <tr><th> </th><th><?php __("Sub"); ?></th><th><?php __("Type"); ?></th><th><?php __("settings"); ?></th><th><?php __("Concerned"); ?></th><th><?php __("Activation"); ?></th></tr>
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
| 
						 | 
					@ -48,17 +56,20 @@ for($i=0;$i<count($tab)+1;$i++) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
	<tr  class="lst<?php echo $col; ?>">
 | 
						<tr  class="lst<?php echo $col; ?>">
 | 
				
			||||||
  <td></td>
 | 
					  <td>
 | 
				
			||||||
  <td><input type='text' name='domup[<?php echo $i; ?>][sub]' value="<?php echo $val['sub']; ?>"/></td>
 | 
					  <div class="ina"><a href=dom_defdel.php?id=<?php echo $val['id']; ?> type=''><img src="images/delete.png" alt="<?php __("Delete"); ?>" /><?php __("Delete"); ?></a></div>
 | 
				
			||||||
 | 
					  </td>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <td><input type='text' size="16" name='domup[<?php echo $i; ?>][sub]' value="<?php echo $val['sub']; ?>"/></td>
 | 
				
			||||||
  <?php $type=array("VHOST","URL","WEBMAIL","");
 | 
					  <?php $type=array("VHOST","URL","WEBMAIL","");
 | 
				
			||||||
  if(in_array($val['domain_type'],$type)){?> 
 | 
					  if(in_array($val['domain_type'],$type)){?> 
 | 
				
			||||||
  <td><select name='domup[<?php echo $i; ?>][domain_type]'>
 | 
					  <td><select width="100px" style="width:100px"  name='domup[<?php echo $i; ?>][domain_type]'>
 | 
				
			||||||
        <option value='VHOST' <?php if($val['domain_type']=='VHOST') echo "selected=\"selected\""; ?> >VHOST</option>
 | 
					        <option value='VHOST' <?php if($val['domain_type']=='VHOST') echo "selected=\"selected\""; ?> >VHOST</option>
 | 
				
			||||||
        <option value='URL' <?php if($val['domain_type']=='URL') echo "selected=\"selected\""; ?> >URL</option>
 | 
					        <option value='URL' <?php if($val['domain_type']=='URL') echo "selected=\"selected\""; ?> >URL</option>
 | 
				
			||||||
        <option value='WEBMAIL' <?php if($val['domain_type']=='WEBMAIL') echo "selected=\"selected\""; ?> >WEBMAIL</option>
 | 
					        <option value='WEBMAIL' <?php if($val['domain_type']=='WEBMAIL') echo "selected=\"selected\""; ?> >WEBMAIL</option>
 | 
				
			||||||
      </select>
 | 
					      </select>
 | 
				
			||||||
  <?php }else{?>
 | 
					  <?php }else{?>
 | 
				
			||||||
    <td><input type ='text' name='domup[<?php echo $i; ?>][domain_type]' value='<?php echo $val['domain_type']?>' ></td>
 | 
					    <td><input type ='text'  width="100px" style="width:100px" name='domup[<?php echo $i; ?>][domain_type]' value='<?php echo $val['domain_type']?>' ></td>
 | 
				
			||||||
 <? }?>
 | 
					 <? }?>
 | 
				
			||||||
  </td>
 | 
					  </td>
 | 
				
			||||||
  <td><input type ='text' name='domup[<?php echo $i; ?>][domain_type_parameter]' value='<?php echo $val['domain_type_parameter']?>' ></td>
 | 
					  <td><input type ='text' name='domup[<?php echo $i; ?>][domain_type_parameter]' value='<?php echo $val['domain_type_parameter']?>' ></td>
 | 
				
			||||||
| 
						 | 
					@ -74,8 +85,8 @@ for($i=0;$i<count($tab)+1;$i++) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <td><p><input type="submit" class="inb" name="submit" value="<?php __("Save"); ?>" /></p></td>
 | 
				
			||||||
</table>
 | 
					</table>
 | 
				
			||||||
  <p><input type="submit" class="inb" name="submit" value="<?php __("Save"); ?>" /></p>
 | 
					 | 
				
			||||||
</form>
 | 
					</form>
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
 include_once("foot.php"); ?>
 | 
					 include_once("foot.php"); ?>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,15 @@
 | 
				
			||||||
 | 
					<?php 
 | 
				
			||||||
 | 
					require_once("../class/config.php");
 | 
				
			||||||
 | 
					include_once("head.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$fields = array (
 | 
				
			||||||
 | 
					        "id"     => array ("request", "integer", ""),
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					getFields($fields);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//checker admin rights
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$dom->del_default_type($id);
 | 
				
			||||||
 | 
					include_once("adm_doms_def_type.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -391,6 +391,7 @@ class m_dom {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function create_default_subdomains($domain,$target_domain=""){
 | 
					  function create_default_subdomains($domain,$target_domain=""){
 | 
				
			||||||
    global $db;
 | 
					    global $db;
 | 
				
			||||||
 | 
					    $err->log("dom","create_default_subdomains",$domain);
 | 
				
			||||||
    $query="SELECT sub, domain_type, domain_type_parameter FROM default_subdomains WHERE concerned = 'SLAVE' or concerned = 'BOTH' and enabled=1;";
 | 
					    $query="SELECT sub, domain_type, domain_type_parameter FROM default_subdomains WHERE concerned = 'SLAVE' or concerned = 'BOTH' and enabled=1;";
 | 
				
			||||||
    if(empty($target_domain)) {
 | 
					    if(empty($target_domain)) {
 | 
				
			||||||
      $query="SELECT sub, domain_type, domain_type_parameter FROM default_subdomains WHERE concerned = 'MAIN' or concerned = 'BOTH' and enabled=1;";
 | 
					      $query="SELECT sub, domain_type, domain_type_parameter FROM default_subdomains WHERE concerned = 'MAIN' or concerned = 'BOTH' and enabled=1;";
 | 
				
			||||||
| 
						 | 
					@ -419,6 +420,7 @@ class m_dom {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function lst_default_subdomains(){
 | 
					  function lst_default_subdomains(){
 | 
				
			||||||
    global $db,$err;
 | 
					    global $db,$err;
 | 
				
			||||||
 | 
					    $err->log("dom","lst_default_subdomains");
 | 
				
			||||||
    $c=array();
 | 
					    $c=array();
 | 
				
			||||||
    $db->query("select * from default_subdomains;");
 | 
					    $db->query("select * from default_subdomains;");
 | 
				
			||||||
     
 | 
					     
 | 
				
			||||||
| 
						 | 
					@ -437,13 +439,14 @@ class m_dom {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  function update_default_subdomains($arr) {
 | 
					  function update_default_subdomains($arr) {
 | 
				
			||||||
 | 
					    global $err;
 | 
				
			||||||
 | 
					    $err->log("dom","update_default_subdomains");
 | 
				
			||||||
    $ok=true;
 | 
					    $ok=true;
 | 
				
			||||||
    foreach ($arr as $a) {
 | 
					    foreach ($arr as $a) {
 | 
				
			||||||
      if (! isset($a['id'])) $a['id']=null;
 | 
					      if (! isset($a['id'])) $a['id']=null;
 | 
				
			||||||
      if(!empty($a['sub']) || !empty($a['domain_type_parameter'])){
 | 
					      if(!empty($a['sub']) || !empty($a['domain_type_parameter'])){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (! isset($a['enabled'])) $a['enabled']=0;
 | 
					        if (! isset($a['enabled'])) $a['enabled']=0;
 | 
				
			||||||
        printvar($a);
 | 
					 | 
				
			||||||
        if (! $this->update_one_default($a['domain_type'],$a['sub'], $a['domain_type_parameter'], $a['concerned'], $a['enabled'],$a['id']) ) {
 | 
					        if (! $this->update_one_default($a['domain_type'],$a['sub'], $a['domain_type_parameter'], $a['concerned'], $a['enabled'],$a['id']) ) {
 | 
				
			||||||
         $ok=false;
 | 
					         $ok=false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -454,15 +457,30 @@ class m_dom {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function update_one_default($domain_type,$sub,$domain_type_parameter,$concerned,$enabled,$id=null){
 | 
					  function update_one_default($domain_type,$sub,$domain_type_parameter,$concerned,$enabled,$id=null){
 | 
				
			||||||
    global $db,$err;
 | 
					    global $db,$err;
 | 
				
			||||||
 | 
					    $err->log("dom","update_one_default");
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if($id==null)
 | 
					    if($id==null)
 | 
				
			||||||
      $db->query("INSERT INTO default_subdomains values ('','".$sub."','".$domain_type."','".$domain_type_parameter."','".$concerned."','".$enabled."');");
 | 
					      $db->query("INSERT INTO default_subdomains values ('','".addslashes($sub)."','".addslashes($domain_type)."','".addslashes($domain_type_parameter)."','".addslashes($concerned)."','".addslashes($enabled)."');");
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    $db->query("UPDATE default_subdomains set sub='".$sub."', domain_type='".$domain_type."',domain_type_parameter='".$domain_type_parameter."',concerned='".$concerned."',enabled='".$enabled."' where id=".$id.";");
 | 
					    $db->query("UPDATE default_subdomains set sub='".addslashes($sub)."', domain_type='".addslashes($domain_type)."',domain_type_parameter='".addslashes($domain_type_parameter)."',concerned='".addslashes($concerned)."',enabled='".addslashes($enabled)."' where id=".addslashes($id).";");
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
      //update
 | 
					      //update
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  function del_default_type($id){
 | 
				
			||||||
 | 
					    global $err,$db;
 | 
				
			||||||
 | 
					    $err->log("dom","del_default_type");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if(!$db->query("delete from default_subdomains where id=$id;")){
 | 
				
			||||||
 | 
					      $err->raise("dom",_("Could not delete default type"));
 | 
				
			||||||
 | 
					      return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* ----------------------------------------------------------------- */
 | 
					  /* ----------------------------------------------------------------- */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue