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();
     $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&amp;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&amp;deleteid=' . (empty($ids[0][1]) ? 0 : $ids[0][1]) . '&amp;vg_increment_number=' . (empty($ids[0][0]) ? 0 : $ids[0][0]) . '&amp;' . $csrfParams . '\');" href="javascript:void(0);" class="delete" title="Delete entry"></a>';
         }
         return $actionIcons;
     })));
     $this->template->setVariable('DOMAINS_CONTENT', $view->render());
 }
示例#4
0
 */
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')) {
示例#5
0
 /**
  * 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);
 }
 /**
  * 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&amp;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&amp;deleteid=' . (empty($ids[0][1]) ? 0 : $ids[0][1]) . '&amp;vg_increment_number=' . (empty($ids[0][0]) ? 0 : $ids[0][0]) . '&amp;' . $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";
 }
示例#8
0
 /**
  * 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();
     }
 }
 /**
  * FeedBack Form
  * 
  * @global array $_ARRAYLANG
  */
 public function showFeedBackForm()
 {
     global $_ARRAYLANG;
     $objUser = \FWUser::getFWUserObject();
     //feed back types
     $feedBackTypes = array($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_SELECT_FEEDBACK'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_BUG_REPORT'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_FEATURE_REQUEST'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_HAVE_QUESTION']);
     \Cx\Core\Setting\Controller\Setting::init('Support', 'setup', 'Yaml');
     $faqUrl = \Cx\Core\Setting\Controller\Setting::getValue('faqUrl', 'Support');
     $recipientMailAddress = \Cx\Core\Setting\Controller\Setting::getValue('recipientMailAddress', 'Support');
     $faqLink = '<a target="_blank" title="click to FAQ page" href=' . $faqUrl . '>' . $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_FAQ'] . '</a>';
     //Get License information
     $license = \Env::get('cx')->getLicense();
     $licenseName = $license->getEditionName();
     $licenseValid = date(ASCMS_DATE_FORMAT_DATE, $license->getValidToDate());
     $licenseVersion = $license->getVersion()->getNumber();
     //get the input datas
     $feedBackType = isset($_POST['feedBackType']) ? contrexx_input2raw($_POST['feedBackType']) : '';
     $feedBackSubject = isset($_POST['feedBackSubject']) ? contrexx_input2raw($_POST['feedBackSubject']) : '';
     $feedBackComment = isset($_POST['feedBackComment']) ? contrexx_input2raw($_POST['feedBackComment']) : '';
     $customerName = isset($_POST['customerName']) ? contrexx_input2raw($_POST['customerName']) : '';
     $customerEmailId = isset($_POST['customerEmailId']) ? contrexx_input2raw($_POST['customerEmailId']) : '';
     $feedBackUrl = isset($_POST['feedBackUrl']) ? contrexx_input2raw($_POST['feedBackUrl']) : '';
     if (isset($_POST['sendAndSave'])) {
         if (!empty($feedBackSubject) && !empty($feedBackComment)) {
             //get the hostname domain
             $domainRepo = new \Cx\Core\Net\Model\Repository\DomainRepository();
             $domain = $domainRepo->findOneBy(array('id' => 0));
             $arrFields = array('name' => contrexx_raw2xhtml($customerName), 'fromEmail' => contrexx_raw2xhtml($customerEmailId), 'feedBackType' => $feedBackType != 0 ? contrexx_raw2xhtml($feedBackTypes[$feedBackType]) : '', 'url' => $faqUrl, 'comments' => contrexx_raw2xhtml($feedBackComment), 'subject' => contrexx_raw2xhtml($feedBackSubject), 'firstName' => $objUser->objUser->getProfileAttribute('firstname'), 'lastName' => $objUser->objUser->getProfileAttribute('lastname'), 'phone' => !$objUser->objUser->getProfileAttribute('phone_office') ? $objUser->objUser->getProfileAttribute('phone_mobile') : $objUser->objUser->getProfileAttribute('phone_office'), 'company' => $objUser->objUser->getProfileAttribute('company'), 'toEmail' => $recipientMailAddress, 'licenseName' => $licenseName, 'licenseValid' => $licenseValid, 'licenseVersion' => $licenseVersion, 'domainName' => $domain ? $domain->getName() : '');
             //send the feedBack mail
             $this->sendMail($arrFields) ? \Message::ok($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_EMAIL_SEND_SUCESSFULLY']) : \Message::error($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_EMAIL_SEND_FAILED']);
         } else {
             \Message::error($_ARRAYLANG['TXT_SUPPORT_ERROR_MSG_FIELDS_EMPTY']);
             $this->template->setVariable(array('TXT_SUPPORT_ERROR_CLASS_SUBJECT' => !empty($feedBackSubject) ? "" : "errBoxStyle", 'TXT_SUPPORT_ERROR_CLASS_COMMENT' => !empty($feedBackComment) ? "" : "errBoxStyle", 'SUPPORT_FEEDBACK_SUBJECT' => contrexx_raw2xhtml($feedBackSubject), 'SUPPORT_FEEDBACK_COMMENT' => contrexx_raw2xhtml($feedBackComment)));
         }
     }
     //show FeedBack Types
     foreach ($feedBackTypes as $key => $feedbackType) {
         $this->template->setVariable(array('SUPPORT_FEEDBACK_TYPES' => $feedbackType, 'SUPPORT_FEEDBACK_SELECTED_TYPE' => !empty($feedBackType) && $feedBackType == $key ? 'selected' : '', 'SUPPORT_FEEDBACK_ID' => $key));
         $this->template->parse('showFeedBackTypes');
     }
     $this->template->setVariable(array('SUPPORT_FEEDBACK_FAQ' => $faqLink, 'SUPPORT_FEEDBACK_CUSTOMER_NAME' => $objUser->objUser->getUsername(), 'SUPPORT_FEEDBACK_CUSTOMER_EMAIL' => $objUser->objUser->getEmail()));
     $this->template->setVariable(array('TXT_SUPPORT_FEEDBACK' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK'], 'TXT_SUPPORT_FEEDBACK_SUBJECT' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_SUBJECT'], 'TXT_SUPPORT_FEEDBACK_COMMENTS' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_COMMENTS']));
 }