public function preInit(\Cx\Core\Core\Controller\Cx $cx) { global $_CONFIG; $domainRepo = new \Cx\Core\Net\Model\Repository\DomainRepository(); $_CONFIG['domainUrl'] = $domainRepo->getMainDomain()->getName(); \Env::set('config', $_CONFIG); }
/** * 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()); }
header("content-type: application/javascript"); if (strpos(dirname(__FILE__), 'customizing') === false) { $contrexx_path = dirname(dirname(dirname(__FILE__))); } else { // this files resides within the customizing directory, therefore we'll have to strip // out one directory more than usually $contrexx_path = dirname(dirname(dirname(dirname(__FILE__)))); } require_once $contrexx_path . '/core/Core/init.php'; $cx = init('minimal'); $sessionObj = \cmsSession::getInstance(); $_SESSION->cmsSessionStatusUpdate('backend'); $pageId = !empty($_GET['pageId']) ? $_GET['pageId'] : null; //get the main domain $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository(); $mainDomain = $domainRepository->getMainDomain()->getName(); //find the right css files and put it into the wysiwyg $em = $cx->getDb()->getEntityManager(); $componentRepo = $em->getRepository('Cx\\Core\\Core\\Model\\Entity\\SystemComponent'); $wysiwyg = $componentRepo->findOneBy(array('name' => 'Wysiwyg')); $pageRepo = $em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); \Cx\Core\Setting\Controller\Setting::init('Wysiwyg', 'config', 'Yaml'); $skinId = 0; if (!empty($pageId) && $pageId != 'new') { $skinId = $pageRepo->find($pageId)->getSkin(); } $ymlOption = $wysiwyg->getCustomCSSVariables($skinId); ?> //if the wysiwyg css not defined in the session, then load the css variables and put it into the session if(!cx.variables.get('css', 'wysiwyg')) { cx.variables.set('css', [<?php
/** * This function returns the ViewGeneration options for a given entityClass * * @access protected * @global $_ARRAYLANG * @param $entityClassName contains the FQCN from entity * @return array with options */ protected function getViewGeneratorOptions($entityClassName) { global $_ARRAYLANG; $classNameParts = explode('\\', $entityClassName); $classIdentifier = end($classNameParts); $langVarName = 'TXT_' . strtoupper($this->getType() . '_' . $this->getName() . '_ACT_' . $classIdentifier); $header = ''; if (isset($_ARRAYLANG[$langVarName])) { $header = $_ARRAYLANG[$langVarName]; } switch ($entityClassName) { case 'Cx\\Core\\Net\\Model\\Entity\\Domain': return 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; })); default: return array('header' => $header, 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false)); break; } }
/** * Renders the PageTree element * @param type $title * @param type $level * @param type $hasChilds * @param type $lang * @param type $path * @param type $current * @param type $page * @return type */ protected function renderElement($title, $level, $hasChilds, $lang, $path, $current, $page) { global $_CONFIG; $domainRepo = new \Cx\Core\Net\Model\Repository\DomainRepository(); $mainDn = $domainRepo->getMainDomain()->getName(); $location = \Env::get('cx')->getRequest()->getUrl()->getProtocol() . '://' . $mainDn . ($_SERVER['SERVER_PORT'] == 80 ? null : ':' . intval($_SERVER['SERVER_PORT'])) . \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath() . '/' . \FWLanguage::getLanguageCodeById($this->lang) . $page->getPath(); return "\t" . '<url>' . "\n\t\t" . '<loc>' . $location . '</loc>' . "\n\t\t" . '<lastmod>' . $this->getLastModificationDate($page) . '</lastmod>' . "\n\t\t" . '<changefreq>' . $this->getChangingFrequency($page) . '</changefreq>' . "\n\t\t" . '<priority>0.5</priority>' . "\n\t" . '</url>' . "\n"; }
/** * Send a invitation mail to the created user. * It used the old mail function * * @param string $generatedPassword */ protected function sendUserAccountInvitationMail($generatedPassword) { $objUserMail = \FWUser::getFWUserObject()->getMail(); if (($objUserMail->load('user_account_invitation', $_LANGID) || $objUserMail->load('user_account_invitation')) && \Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php') && ($objMail = new \PHPMailer()) !== false) { if ($_CONFIG['coreSmtpServer'] > 0 && \Env::get('ClassLoader')->loadFile(ASCMS_CORE_PATH . '/SmtpSettings.class.php')) { if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) { $objMail->IsSMTP(); $objMail->Host = $arrSmtp['hostname']; $objMail->Port = $arrSmtp['port']; $objMail->SMTPAuth = true; $objMail->Username = $arrSmtp['username']; $objMail->Password = $arrSmtp['password']; } } $objMail->CharSet = CONTREXX_CHARSET; $objMail->From = $objUserMail->getSenderMail(); $objMail->FromName = $objUserMail->getSenderName(); $objMail->AddReplyTo($objUserMail->getSenderMail()); $objMail->Subject = $objUserMail->getSubject(); $placeholders = array('[[WEBSITE]]', '[[FIRSTNAME]]', '[[LASTNAME]]', '[[EMAIL]]', '[[PASSWORD]]', '[[LINK]]', '[[SENDER]]'); $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository(); $mainDomain = $domainRepository->getMainDomain()->getName(); $placeholdersVal = array($mainDomain, contrexx_raw2xhtml($this->getProfileAttribute('firstname')), contrexx_raw2xhtml($this->getProfileAttribute('lastname')), $this->getEmail(), $generatedPassword, ASCMS_PROTOCOL . '://' . $mainDomain . \Cx\Core\Core\Controller\Cx::getBackendFolderName(), contrexx_raw2xhtml($objUserMail->getSenderName())); if (in_array($objUserMail->getFormat(), array('multipart', 'text'))) { $objUserMail->getFormat() == 'text' ? $objMail->IsHTML(false) : false; $objMail->{($objUserMail->getFormat() == 'text' ? '' : 'Alt') . 'Body'} = str_replace($placeholders, $placeholdersVal, $objUserMail->getBodyText()); } if (in_array($objUserMail->getFormat(), array('multipart', 'html'))) { $objUserMail->getFormat() == 'html' ? $objMail->IsHTML(true) : false; $objMail->Body = str_replace($placeholders, $placeholdersVal, $objUserMail->getBodyHtml()); } $objMail->AddAddress($this->getEmail()); $objMail->Send(); } }