Changeset 17589

Show
Ignore:
Timestamp:
09/18/08 18:09:11 (2 years ago)
Author:
piotras
Message:

Refactored host's alias creation for report.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midgard.admin.wizards/plugins/default_create_website.php

    r17588 r17589  
    9898                $pieces = explode('.', $host->name); 
    9999                $alias = ''; 
     100                $i = 0; 
    100101                
    101                 if(!empty($pieces)) 
    102                 { 
    103                     if ($pieces[0] == 'www') 
     102                /* Check if there is at least: www.site.com or sub.site.com */ 
     103                if(count($pieces) > 2) 
     104                { 
     105                    foreach($pieces as $token) 
    104106                    { 
    105                         $alias = $pieces[1] . "." . $pieces[2]; 
     107                        if($token == 'www') 
     108                        { 
     109                            continue; 
     110                        } 
     111 
     112                        if($i > 1) 
     113                        { 
     114                            $alias .= "."; 
     115                        } 
     116                         
     117                        $alias .= $token; 
    106118                    } 
    107119                }