/** * Show all the Domain Alias * * @global array $_ARRAYLANG */ public function showDomains() { global $_ARRAYLANG, $objInit; $langData = $objInit->loadLanguageData('Config'); $_ARRAYLANG = array_merge($_ARRAYLANG, $langData); $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository(); $domains = $domainRepository->findAll(); $options = $this->getController('Backend')->getAllViewGeneratorOptions(); $view = new \Cx\Core\Html\Controller\ViewGenerator($domains, $options); $this->template->setVariable('DOMAINS_CONTENT', $view->render()); }
/** * Show all the Domain Alias * * @global array $_ARRAYLANG */ public function showDomains() { global $_ARRAYLANG, $objInit; $langData = $objInit->loadLanguageData('Config'); $_ARRAYLANG = array_merge($_ARRAYLANG, $langData); $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository(); $domains = $domainRepository->findAll(); $view = new \Cx\Core\Html\Controller\ViewGenerator($domains, array('header' => $_ARRAYLANG['TXT_CORE_NETMANAGER'], 'entityName' => $_ARRAYLANG['TXT_CORE_NETMANAGER_ENTITY'], 'fields' => array('name' => array('header' => $_ARRAYLANG['TXT_NAME'], 'table' => array('parse' => function ($value) { global $_ARRAYLANG; static $mainDomainName; if (empty($mainDomainName)) { $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository(); $mainDomainName = $domainRepository->getMainDomain()->getName(); } $domainName = contrexx_raw2xhtml(\Cx\Core\Net\Controller\ComponentController::convertIdnToUtf8Format($value)); if ($domainName != contrexx_raw2xhtml($value)) { $domainName .= ' (' . contrexx_raw2xhtml($value) . ')'; } $mainDomainIcon = ''; if ($value == $mainDomainName) { $mainDomainIcon = ' <img src="' . \Env::get('cx')->getCodeBaseCoreWebPath() . '/Core/View/Media/icons/Home.png" title="' . $_ARRAYLANG['TXT_CORE_CONFIG_MAINDOMAINID'] . '" />'; } return $domainName . $mainDomainIcon; }), 'formfield' => function ($fieldname, $fieldtype, $fieldlength, $fieldvalue, $fieldoptions) { return \Cx\Core\Net\Controller\ComponentController::convertIdnToUtf8Format($fieldvalue); }), 'id' => array('showOverview' => false)), 'functions' => array('add' => true, 'edit' => false, 'allowEdit' => true, 'delete' => false, 'allowDelete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false, 'actions' => function ($rowData, $rowId) { global $_CORELANG; static $mainDomainName; if (empty($mainDomainName)) { $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository(); $mainDomainName = $domainRepository->getMainDomain()->getName(); } preg_match_all('/\\d+/', $rowId, $ids, null, 0); $actionIcons = ''; $csrfParams = \Cx\Core\Csrf\Controller\Csrf::param(); if ($mainDomainName !== $rowData['name']) { $actionIcons = '<a href="' . \Env::get('cx')->getWebsiteBackendPath() . '/?cmd=NetManager&editid=' . $rowId . '" class="edit" title="Edit entry"></a>'; $actionIcons .= '<a onclick=" if(confirm(\'' . $_CORELANG['TXT_CORE_RECORD_DELETE_CONFIRM'] . '\'))window.location.replace(\'' . \Env::get('cx')->getWebsiteBackendPath() . '/?cmd=NetManager&deleteid=' . (empty($ids[0][1]) ? 0 : $ids[0][1]) . '&vg_increment_number=' . (empty($ids[0][0]) ? 0 : $ids[0][0]) . '&' . $csrfParams . '\');" href="javascript:void(0);" class="delete" title="Delete entry"></a>'; } return $actionIcons; }))); $this->template->setVariable('DOMAINS_CONTENT', $view->render()); }
/** * Returns all domains and ports this instance of cloudrexx can be reached at * @return array List of domains and ports (array(array(0=>{domain}, 1=>{port}))) */ protected function getDomainsAndPorts() { $domainsAndPorts = array(); $domainRepo = new \Cx\Core\Net\Model\Repository\DomainRepository(); $domains = $domainRepo->findAll(); foreach (array('http', 'https') as $protocol) { foreach ($domains as $domain) { $domainsAndPorts[] = array($domain->getName(), \Cx\Core\Setting\Controller\Setting::getValue('portFrontend' . strtoupper($protocol), 'Config')); } } return $domainsAndPorts; $requestDomain = $_CONFIG['domainUrl']; $domainOffset = ASCMS_PATH_OFFSET; $request = "BAN {$domainOffset} HTTP/1.0\r\n"; $request .= "Host: {$requestDomain}\r\n"; $request .= "User-Agent: Cloudrexx Varnish Cache Clear\r\n"; $request .= "Connection: Close\r\n\r\n"; fwrite($varnishSocket, $request); fclose($varnishSocket); }