protected function getDomain() { $r = '!(?:(\\w+)://)?(?:(\\w+)\\:(\\w+)@)?([^/:]+)?(?:\\:(\\d*))?([^#?]+)?(?:\\?([^#]+))?(?:#(.+$))?!i'; preg_match($r, Tools::getHttpHost(false, false), $out); if (preg_match('/^(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]{1}[0-9]|[1-9]).)' . '{1}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]).)' . '{2}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]){1}))$/', $out[4])) { return false; } if (!strstr(Tools::getHttpHost(false, false), '.')) { return false; } $domain = $out[4]; $subDomains = SubDomain::getSubDomains(); if ($subDomains === false) { die(Tools::displayError('Bad SubDomain SQL query.')); } foreach ($subDomains as $subDomain) { $subDomainLength = strlen($subDomain) + 1; if (strncmp($subDomain . '.', $domain, $subDomainLength) == 0) { $domain = substr($domain, $subDomainLength); } } return $domain; }
echo CHtml::activeLabel($filter, 'toDate'); $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $filter, 'attribute' => 'toDate', 'name' => 'toDate', 'options' => array('changeMonth' => 'true', 'changeYear' => 'true', 'showButtonPanel' => 'true'))); ?> </div> <div> <?php echo CHtml::activeLabel($filter, 'agregatedDomainID'); echo CHtml::activeDropDownList($filter, 'agregatedDomainID', CHtml::listData(Domain::model()->findAll(), 'id', 'name'), array('empty' => ' ')); ?> </div> <div> <?php $domainID = $filter->agregatedDomainID; if (isset($domainID) && $domainID > 0) { $subdomain = SubDomain::model()->findAllByAttributes(array('domain_id' => $domainID)); } else { $subdomain = array(); } echo CHtml::activeLabel($filter, 'subdomainID'); echo CHtml::activeDropDownList($filter, 'subdomainID', CHtml::listData($subdomain, 'id', 'name'), array('empty' => ' ')); ?> </div> <div> <?php echo CHtml::activeLabel($filter, 'exclusiveDomainID'); echo CHtml::activeDropDownList($filter, 'exclusiveDomainID', CHtml::listData(Domain::model()->findAll(), 'id', 'name'), array('empty' => ' ')); ?> </div> <div> <?php
public static function getAllSubdomainsInUse() { return SubDomain::model()->findAllBySql("SELECT DISTINCT subdomain.* FROM subdomain INNER JOIN ticket ON ticket.subdomain_id = subdomain.id ORDER BY subdomain.name"); }