/**
  * Constructor
  * @global  ADONewConnection
  * @global  array
  * @global  \Cx\Core\Html\Sigma
  * @return  void
  */
 function __construct()
 {
     global $objDatabase, $_CORELANG, $objTemplate;
     $arrTables = array();
     $objRS = $objDatabase->Execute("SELECT `id` FROM " . DBPREFIX . "languages ORDER BY `id`");
     while (!$objRS->EOF) {
         array_push($this->langIDs, $objRS->fields['id']);
         $objRS->MoveNext();
     }
     $this->filePath = ASCMS_LANGUAGE_PATH . '/';
     // get tables in database
     $objResult = $objDatabase->MetaTables('TABLES');
     if ($objResult !== false) {
         $arrTables = $objResult;
     }
     if (in_array(DBPREFIX . "language_variable_names", $arrTables) && in_array(DBPREFIX . "language_variable_content", $arrTables)) {
         $this->hideVariables = false;
     }
     $objResult = $objDatabase->Execute("SELECT id,name FROM " . DBPREFIX . "languages");
     if ($objResult !== false) {
         while (!$objResult->EOF) {
             $this->arrLang[$objResult->fields['id']] = $objResult->fields['name'];
             $objResult->MoveNext();
         }
     }
     $objDatabase->Execute("OPTIMIZE TABLE " . DBPREFIX . "languages");
     $objDatabase->Execute("OPTIMIZE TABLE " . DBPREFIX . "language_variable_content");
     $objDatabase->Execute("OPTIMIZE TABLE " . DBPREFIX . "language_variable_names");
     $this->template = new \Cx\Core\Html\Sigma(ASCMS_CORE_PATH . '/LanguageManager/View/Template/Backend');
     $this->template->setErrorHandling(PEAR_ERROR_DIE);
 }
 /**
  * @override
  */
 public function getXHtml($backend = false)
 {
     global $objInit;
     $uploadPath = $this->getUploadPath('jump');
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('jump.html');
     $basePath = 'index.php?';
     $basePath .= $this->isBackendRequest ? 'cmd=Upload&act' : 'section=Upload&cmd';
     //act and cmd vary
     $appletPath = $basePath . '=jumpUploaderApplet';
     $l10nPath = $basePath . '=jumpUploaderL10n';
     $langId;
     if (!$this->isBackendRequest) {
         $langId = $objInit->getFrontendLangId();
     } else {
         //backend
         $langId = $objInit->getBackendLangId();
     }
     $langCode = \FWLanguage::getLanguageCodeById($langId);
     if (!file_exists(ASCMS_CORE_MODULE_PATH . '/Upload/ressources/uploaders/jump/messages_' . $langCode . '.zip')) {
         $langCode = 'en';
     }
     $l10nPath .= '&lang=' . $langCode;
     $tpl->setVariable('UPLOAD_CHUNK_LENGTH', \FWSystem::getMaxUploadFileSize() - 1000);
     $tpl->setVariable('UPLOAD_APPLET_URL', $appletPath);
     $tpl->setVariable('UPLOAD_LANG_URL', $l10nPath);
     $tpl->setVariable('UPLOAD_URL', $uploadPath);
     $tpl->setVariable('UPLOAD_ID', $this->uploadId);
     return $tpl->get();
 }
 /**
  * Adds the toolbar to the current html structure (after the starting body tag)
  *
  * @param ComponentController $componentController
  */
 private function prepareTemplate(\Cx\Core_Modules\FrontendEditing\Controller\ComponentController $componentController)
 {
     global $_ARRAYLANG, $objTemplate;
     // get necessary objects
     $objInit = \Env::get('init');
     $page = $this->cx->getPage();
     // init component template object
     $componentTemplate = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/' . $componentController->getName() . '/View/Template/Generic');
     $componentTemplate->setErrorHandling(PEAR_ERROR_DIE);
     // add div for toolbar after starting body tag
     $componentTemplate->loadTemplateFile('Toolbar.html');
     // @author: Michael Ritter
     // not used for contrexx 3.1
     //        global $_CORELANG;
     //        $template = $objTemplate;
     //        $root = $componentTemplate->fileRoot;
     //        $componentTemplate->setRoot(ASCMS_ADMIN_TEMPLATE_PATH);
     //        $objTemplate = $componentTemplate;
     //        \Env::get('ClassLoader')->loadFile(ASCMS_DOCUMENT_ROOT . '/lang/en/backend.php');
     //        $langCode = \FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID);
     //        if ($langCode != 'en') {
     //            \Env::get('ClassLoader')->loadFile(ASCMS_DOCUMENT_ROOT . '/lang/' . $langCode . '/backend.php');
     //        }
     //        $_CORELANG = array_merge($_CORELANG, $_ARRAYLANG);
     //        $menu = new \adminMenu('fe');
     //        $menu->getAdminNavbar();
     //        $componentTemplate->setRoot($root);
     //        $objTemplate = $template;
     // end code from Michael Ritter
     $objUser = $this->cx->getUser()->objUser;
     $firstname = $objUser->getProfileAttribute('firstname');
     $lastname = $objUser->getProfileAttribute('lastname');
     $componentTemplate->setGlobalVariable(array('LOGGED_IN_USER' => !empty($firstname) && !empty($lastname) ? $firstname . ' ' . $lastname : $objUser->getUsername(), 'TXT_LOGOUT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_TOOLBAR_LOGOUT'], 'TXT_FRONTEND_EDITING_TOOLBAR_OPEN_CM' => $_ARRAYLANG['TXT_FRONTEND_EDITING_TOOLBAR_OPEN_CM'], 'TXT_FRONTEND_EDITING_HISTORY' => $_ARRAYLANG['TXT_FRONTEND_EDITING_HISTORY'], 'TXT_FRONTEND_EDITING_OPTIONS' => $_ARRAYLANG['TXT_FRONTEND_EDITING_OPTIONS'], 'TXT_FRONTEND_EDITING_ADMINMENU' => $_ARRAYLANG['TXT_FRONTEND_EDITING_ADMINMENU'], 'TXT_FRONTEND_EDITING_CSS_CLASS' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CSS_CLASS'], 'TXT_FRONTEND_EDITING_CUSTOM_CONTENT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CUSTOM_CONTENT'], 'TXT_FRONTEND_EDITING_THEMES' => $_ARRAYLANG['TXT_FRONTEND_EDITING_THEMES'], 'TXT_FRONTEND_EDITING_TOOLBAR_SAVE_BLOCK' => $_ARRAYLANG['TXT_FRONTEND_EDITING_TOOLBAR_SAVE_BLOCK'], 'SKIN_OPTIONS' => $this->getSkinOptions(), 'LINK_LOGOUT' => $objInit->getUriBy('section', 'logout'), 'LINK_PROFILE' => ASCMS_PATH_OFFSET . '/cadmin/index.php?cmd=Access&act=user&tpl=modify&id=' . $objUser->getId(), 'LINK_CM' => ASCMS_PATH_OFFSET . '/cadmin/index.php?cmd=ContentManager&page=' . $page->getId() . '&tab=content'));
     $objTemplate->_blocks['__global__'] = preg_replace('/<body[^>]*>/', '\\0' . $componentTemplate->get(), $objTemplate->_blocks['__global__']);
 }
 public function getBackendViewMessage()
 {
     $template = new \Cx\Core\Html\Sigma();
     $template->setErrorHandling(PEAR_ERROR_DIE);
     $template->loadTemplateFile($this->templateFile);
     $template->setVariable($this->templatePlaceholders);
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($template);
     return $template->get();
 }
 /**
  * Gets the XHTML to display the widget.
  * @param string $containerSelector a jQuery selector defining the element
  *                                  where the widget should be put into.
  */
 public function getXhtml($containerSelector, $instanceName)
 {
     \JS::registerJS('core_modules/Upload/js/folderWidget.js');
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('folderWidget.html');
     $tpl->setVariable('ID', $this->id);
     //from where the combouploader gets the code on an uploader switch
     $cmdOrSection = $this->isBackendRequest ? 'cmd' : 'section';
     $actOrCmd = $this->isBackendRequest ? 'act' : 'cmd';
     $refreshUrl = ($this->isBackendRequest ? ASCMS_ADMIN_WEB_PATH : ASCMS_PATH_OFFSET) . \Env::get('virtualLanguageDirectory') . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=refreshFolder';
     $deleteUrl = ($this->isBackendRequest ? ASCMS_ADMIN_WEB_PATH : ASCMS_PATH_OFFSET) . \Env::get('virtualLanguageDirectory') . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=deleteFile';
     \ContrexxJavascript::getInstance()->setVariable(array('refreshUrl' => $refreshUrl, 'deleteUrl' => $deleteUrl, 'files' => $this->getFilesJSON(), 'containerSelector' => $containerSelector, 'instanceName' => $instanceName), 'upload/folderWidget_' . $this->id);
     return $tpl->get();
 }
Example #6
0
 /**
  * @override
  */
 public function getXHtml()
 {
     global $_CORELANG;
     // CSS dependencies
     \JS::activate('cx');
     $uploadPath = $this->getUploadPath('pl');
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('pl.html');
     $tpl->setVariable('UPLOAD_FLASH_URL', ASCMS_CORE_MODULE_WEB_PATH . '/Upload/ressources/uploaders/pl/plupload.flash.swf');
     $tpl->setVariable('UPLOAD_CHUNK_LENGTH', \FWSystem::getLiteralSizeFormat(\FWSystem::getMaxUploadFileSize() - 1000));
     $tpl->setVariable('UPLOAD_URL', $uploadPath);
     $tpl->setVariable('UPLOAD_ID', $this->uploadId);
     //I18N
     $tpl->setVariable(array('UPLOAD' => $_CORELANG['UPLOAD'], 'OTHER_UPLOADERS' => $_CORELANG['OTHER_UPLOADERS'], 'FORM_UPLOADER' => $_CORELANG['FORM_UPLOADER'], 'PL_UPLOADER' => $_CORELANG['PL_UPLOADER'], 'JUMP_UPLOADER' => $_CORELANG['JUMP_UPLOADER'], 'SELECT_FILES' => $_CORELANG['SELECT_FILES'], 'ADD_INSTRUCTIONS' => $_CORELANG['ADD_INSTRUCTIONS'], 'FILENAME' => $_CORELANG['FILENAME'], 'STATUS' => $_CORELANG['STATUS'], 'SIZE' => $_CORELANG['SIZE'], 'ADD_FILES' => $_CORELANG['ADD_FILES'], 'STOP_CURRENT_UPLOAD' => $_CORELANG['STOP_CURRENT_UPLOAD'], 'DRAG_FILES_HERE' => $_CORELANG['DRAG_FILES_HERE']));
     return $tpl->get();
 }
 public function getXHtml()
 {
     global $_CORELANG;
     \JS::registerCSS('core_modules/Upload/css/uploaders/exposedCombo/exposedCombo.css');
     \JS::registerJS('core_modules/Upload/js/uploaders/exposedCombo/exposedCombo.js');
     //back up instance name, we're going to set a temporary name for the combo uploader
     $instanceNameBak = $this->jsInstanceName;
     $this->jsInstanceName = 'exposedCombo_comboUploader_' . $this->uploadId;
     $comboXHtml = parent::getXHtml();
     $this->jsInstanceName = $instanceNameBak;
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('exposedCombo.html');
     $tpl->setVariable(array('COMBO_CODE' => $comboXHtml, 'DIALOG_TITLE' => $_CORELANG['UPLOAD_EXPOSED_DIALOG_TITLE']));
     //see Uploader::handleInstanceBusiness
     $this->handleInstanceBusiness($tpl, 'exposedCombo');
     return $tpl->get();
 }
 /**
  * This is called by the default ComponentController and does all the repeating work
  *
  * This creates a template of the page content and calls parsePage($template)
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page Resolved page
  */
 public function getPage(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $_ARRAYLANG;
     // init component template
     $componentTemplate = new \Cx\Core\Html\Sigma('.');
     $componentTemplate->setErrorHandling(PEAR_ERROR_DIE);
     $componentTemplate->setTemplate($page->getContent());
     // default css and js
     if (file_exists($this->cx->getClassLoader()->getFilePath($this->getDirectory(false) . '/View/Style/Frontend.css'))) {
         \JS::registerCSS(substr($this->getDirectory(false, true) . '/View/Style/Frontend.css', 1));
     }
     if (file_exists($this->cx->getClassLoader()->getFilePath($this->getDirectory(false) . '/View/Script/Frontend.js'))) {
         \JS::registerJS(substr($this->getDirectory(false, true) . '/View/Script/Frontend.js', 1));
     }
     // parse page
     $componentTemplate->setGlobalVariable($_ARRAYLANG);
     $this->parsePage($componentTemplate, $page->getCmd());
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($componentTemplate);
     $page->setContent($componentTemplate->get());
 }
 /**
  * Generate an articlelist
  *
  * @param $articles An array of articles
  * @param $category Category information
  * @return String
  */
 private function parseArticleList($articles, $categoryname = "", $count, $position, $standalone = false)
 {
     global $_LANGID, $_ARRAYLANG, $_CORELANG;
     $id = intval($_GET['id']);
     try {
         $articles = $this->articles->getArticlesByCategory($id);
         $category = $this->categories->getOneCategory($id);
     } catch (DatabaseError $e) {
         die($e->plain());
     }
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_MODULE_PATH . "/Knowledge/View/Template/Backend/");
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile("module_knowledge_articles_overview_articlelist.html");
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($tpl);
     $tpl->setGlobalVariable("MODULE_INDEX", MODULE_INDEX);
     $tpl->setGlobalVariable(array("TXT_NAME" => $_ARRAYLANG['TXT_NAME'], "TXT_VIEWED" => $_ARRAYLANG['TXT_KNOWLEDGE_VIEWED'], "TXT_SORT" => $_ARRAYLANG['TXT_KNOWLEDGE_SORT'], "TXT_STATE" => $_ARRAYLANG['TXT_KNOWLEDGE_STATE'], "TXT_QUESTION" => $_ARRAYLANG['TXT_KNOWLEDGE_QUESTION'], "TXT_HITS" => $_ARRAYLANG['TXT_KNOWLEDGE_HITS'], "TXT_RATING" => $_ARRAYLANG['TXT_KNOWLEDGE_RATING'], "TXT_ACTIONS" => $_ARRAYLANG['TXT_KNOWLEDGE_ACTIONS'], "TXT_CATEGORY_NAME" => $categoryname, "TXT_BY" => "bei", "TXT_VOTINGS" => "Abstimmungen"));
     if (!empty($articles)) {
         foreach ($articles as $key => $article) {
             $tpl->setVariable(array("ARTICLEID" => $key, "QUESTION" => contrexx_raw2xhtml($article['content'][$_LANGID]['question']), "ACTIVE_STATE" => abs($article['active'] - 1), "CATEGORY_ACTIVE_LED" => $article['active'] ? "green" : "red", "HITS" => $article['hits'], "VOTEVALUE" => round($article['votes'] > 0 ? $article['votevalue'] / $article['votes'] : 0, 2), "VOTECOUNT" => $article['votes'], "MAX_RATING" => $this->settings->get("max_rating")));
             $tpl->parse("row");
         }
     } else {
         $tpl->setVariable(array("TXT_NO_ARTICLES" => $_ARRAYLANG['TXT_KNOWLEDGE_NO_ARTICLES_IN_CAT']));
         $tpl->parse("no_articles");
     }
     $tpl->parse("content");
     return $tpl->get("content");
 }
Example #10
0
 /**
  * Sets up the JavsScript cart
  *
  * Searches all $themesPages elements for the first occurrence of the
  * "shopJsCart" template block.
  * Generates the structure of the Javascript cart, puts it in the template,
  * and registers all required JS code.
  * Note that this is only ever called when the JS cart is enabled in the
  * extended settings!
  * @access  public
  * @global  array   $_ARRAYLANG   Language array
  * @global  array   $themesPages  Theme template array
  * @return  void
  * @static
  */
 static function setJsCart()
 {
     global $_ARRAYLANG, $themesPages;
     if (!\Cx\Core\Setting\Controller\Setting::getValue('use_js_cart', 'Shop')) {
         return;
     }
     $objTemplate = new \Cx\Core\Html\Sigma('.');
     $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
     $match = null;
     $div_cart = $div_product = '';
     foreach ($themesPages as $index => $content) {
         //\DBG::log("Shop::setJsCart(): Section $index");
         $objTemplate->setTemplate($content, false, false);
         if (!$objTemplate->blockExists('shopJsCart')) {
             continue;
         }
         //\DBG::log("Shop::setJsCart(): In themespage $index: {$themesPages[$index]}");
         $objTemplate->setCurrentBlock('shopJsCart');
         // Set all language entries and replace formats
         $objTemplate->setGlobalVariable($_ARRAYLANG);
         if ($objTemplate->blockExists('shopJsCartProducts')) {
             $objTemplate->parse('shopJsCartProducts');
             $div_product = $objTemplate->get('shopJsCartProducts');
             //\DBG::log("Shop::setJsCart(): Got Product: $div_product");
             $objTemplate->replaceBlock('shopJsCartProducts', '[[SHOP_JS_CART_PRODUCTS]]');
         }
         $objTemplate->touchBlock('shopJsCart');
         $objTemplate->parse('shopJsCart');
         $div_cart = $objTemplate->get('shopJsCart');
         //\DBG::log("Shop::setJsCart(): Got Cart: $div_cart");
         if (preg_match('#^([\\n\\r]?[^<]*<.*id=["\']shopJsCart["\'][^>]*>)(([\\n\\r].*)*)(</[^>]*>[^<]*[\\n\\r]?)$#', $div_cart, $match)) {
             //\DBG::log("Shop::setJsCart(): Matched DIV {$match[1]}, content: {$match[2]}");
             $themesPages[$index] = preg_replace('@(<!--\\s*BEGIN\\s+(shopJsCart)\\s*-->.*?<!--\\s*END\\s+\\2\\s*-->)@s', $match[1] . $_ARRAYLANG['TXT_SHOP_CART_IS_LOADING'] . $match[4], $content);
             /*
             // Template use won't work, because it kills the remaining <!-- blocks -->!
                             $objTemplate->setTemplate($content, false, false);
                             $objTemplate->replaceBlock('shopJsCart',
                                 $match[1].
                                 $_ARRAYLANG['TXT_SHOP_CART_IS_LOADING'].
                                 $match[4]);
                             $themesPages[$index] = $objTemplate->get();
             */
             //\DBG::log("Shop::setJsCart(): Out themespage $index: {$themesPages[$index]}");
         }
         // One instance only (mind that there's a unique id attribute)
         self::$use_js_cart = true;
         break;
     }
     if (!self::$use_js_cart) {
         return;
     }
     self::registerJavascriptCode();
     \ContrexxJavascript::getInstance()->setVariable('TXT_SHOP_CART_IS_LOADING', $_ARRAYLANG['TXT_SHOP_CART_IS_LOADING'], 'shop/cart');
     \ContrexxJavascript::getInstance()->setVariable('TXT_SHOP_COULD_NOT_LOAD_CART', $_ARRAYLANG['TXT_SHOP_COULD_NOT_LOAD_CART'], 'shop/cart');
     \ContrexxJavascript::getInstance()->setVariable('TXT_EMPTY_SHOPPING_CART', $_ARRAYLANG['TXT_EMPTY_SHOPPING_CART'], 'shop/cart');
     \ContrexxJavascript::getInstance()->setVariable("url", (string) \Cx\Core\Routing\URL::fromModuleAndCMd('Shop' . MODULE_INDEX, 'cart', FRONTEND_LANG_ID, array('remoteJs' => 'addProduct')), 'shop/cart');
     \JS::registerJS(substr(\Cx\Core\Core\Controller\Cx::instanciate()->getModuleFolderName() . '/Shop/View/Script/cart.js', 1));
     \JS::registerCode("cartTpl = '" . preg_replace(array('/\'/', '/[\\n\\r]/', '/\\//'), array('\\\'', '\\n', '\\/'), $div_cart) . "';\n" . "cartProductsTpl = '" . preg_replace(array('/\'/', '/[\\n\\r]/', '/\\//'), array('\\\'', '\\n', '\\/'), $div_product) . "';\n");
 }
Example #11
0
 /**
  * get crm module placeholders
  *
  * @return array
  */
 function getCrmModulePlaceHolders()
 {
     global $_ARRAYLANG;
     $objTemplate = new \Cx\Core\Html\Sigma(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseModulePath() . '/' . $this->moduleName . '/View/Template/Backend');
     $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
     if (!$objTemplate->loadTemplateFile('module_' . $this->moduleNameLC . '_settings_placeholders.html')) {
         die("Failed to load template 'module_'.{$this->moduleNameLC}.'_settings_placeholders.html'");
     }
     $objTemplate->setVariable(array('TXT_CRM_PLACEHOLDERS' => $_ARRAYLANG['TXT_CRM_PLACEHOLDERS'], 'TXT_CRM_GENERAL' => $_ARRAYLANG['TXT_CRM_GENERAL'], 'TXT_CRM_MAIL_TEMPLATE_ONE' => CRM_EVENT_ON_ACCOUNT_UPDATED, 'TXT_CRM_MAIL_TEMPLATE_TWO' => CRM_EVENT_ON_USER_ACCOUNT_CREATED, 'TXT_CRM_MAIL_TEMPLATE_THREE' => CRM_EVENT_ON_TASK_CREATED, 'TXT_CRM_ASSIGNED_USER_EMAIL' => $_ARRAYLANG['TXT_CRM_ASSIGNED_USER_EMAIL'], 'TXT_CRM_ASSIGNED_USER_NAME' => $_ARRAYLANG['TXT_CRM_ASSIGNED_USER_NAME'], 'TXT_CRM_CONTACT_DETAILS_LINK' => $_ARRAYLANG['TXT_CRM_CONTACT_DETAILS_LINK'], 'TXT_CRM_CONTACT_DETAILS_URL' => $_ARRAYLANG['TXT_CRM_CONTACT_DETAILS_URL'], 'TXT_CRM_TASK_NAME' => $_ARRAYLANG['TXT_CRM_TASK_NAME'], 'TXT_CRM_DOMAIN' => $_ARRAYLANG['TXT_CRM_DOMAIN'], 'TXT_CRM_TASK_LINK' => $_ARRAYLANG['TXT_CRM_TASK_LINK'], 'TXT_CRM_TASK_LINK_SOURCE' => $_ARRAYLANG['TXT_CRM_TASK_LINK_SOURCE'], 'TXT_CRM_TASK_DUE_DATE' => $_ARRAYLANG['TXT_CRM_TASK_DUE_DATE'], 'TXT_CRM_TASK_CREATED_USER' => $_ARRAYLANG['TXT_CRM_TASK_CREATED_USER'], 'TXT_CRM_TASK_DESCRIPTION_TEXT_VERSION' => $_ARRAYLANG['TXT_CRM_TASK_DESCRIPTION_TEXT_VERSION'], 'TXT_CRM_TASK_DESCRIPTION_HTML_VERSION' => $_ARRAYLANG['TXT_CRM_TASK_DESCRIPTION_HTML_VERSION'], 'TXT_CRM_CONTACT_FIRSTNAME' => $_ARRAYLANG['TXT_CRM_CONTACT_FIRSTNAME'], 'TXT_CRM_CONTACT_LASTNAME' => $_ARRAYLANG['TXT_CRM_CONTACT_LASTNAME'], 'TXT_CRM_CONTACT_SALUTATION' => $_ARRAYLANG['TXT_CRM_CONTACT_SALUTATION'], 'TXT_CRM_CONTACT_GENDER' => $_ARRAYLANG['TXT_CRM_CONTACT_GENDER'], 'TXT_CRM_CUSTOMER_CONTACT_EMAIL' => $_ARRAYLANG['TXT_CRM_CUSTOMER_CONTACT_EMAIL'], 'TXT_CRM_CUSTOMER_COMPANY' => $_ARRAYLANG['TXT_CRM_CUSTOMER_COMPANY'], 'TXT_CRM_CUSTOMER_CONTACT_USER_NAME' => $_ARRAYLANG['TXT_CRM_CUSTOMER_CONTACT_USER_NAME'], 'TXT_CRM_CUSTOMER_CONTACT_PASSWORD' => $_ARRAYLANG['TXT_CRM_CUSTOMER_CONTACT_PASSWORD'], 'TXT_CRM_CONTACT_KEY' => $_ARRAYLANG['TXT_CRM_CONTACT_KEY']));
     return $objTemplate->get();
 }
Example #12
0
 /**
  * Sends an email with the contact details to the responsible persons
  *
  * This methode sends an email to all email addresses that are defined in the
  * option "Receiver address(es)" of the requested contact form.
  * @access private
  * @global array
  * @global array
  * @param array Details of the contact request
  * @see _getEmailAdressOfString(), phpmailer::From, phpmailer::FromName, phpmailer::AddReplyTo(), phpmailer::Subject, phpmailer::IsHTML(), phpmailer::Body, phpmailer::AddAddress(), phpmailer::Send(), phpmailer::ClearAddresses()
  */
 private function sendMail($arrFormData)
 {
     global $_ARRAYLANG, $_CONFIG;
     $plaintextBody = '';
     $replyAddress = '';
     $firstname = '';
     $lastname = '';
     $senderName = '';
     $isHtml = $arrFormData['htmlMail'] == 1 ? true : false;
     // stop send process in case no real data had been submitted
     if (!isset($arrFormData['data']) && !isset($arrFormData['uploadedFiles'])) {
         return false;
     }
     // check if we shall send the email as multipart (text/html)
     if ($isHtml) {
         // setup html mail template
         $objTemplate = new \Cx\Core\Html\Sigma('.');
         $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
         $objTemplate->setTemplate($arrFormData['mailTemplate']);
         $objTemplate->setVariable(array('DATE' => date(ASCMS_DATE_FORMAT, $arrFormData['meta']['time']), 'HOSTNAME' => contrexx_raw2xhtml($arrFormData['meta']['host']), 'IP_ADDRESS' => contrexx_raw2xhtml($arrFormData['meta']['ipaddress']), 'BROWSER_LANGUAGE' => contrexx_raw2xhtml($arrFormData['meta']['lang']), 'BROWSER_VERSION' => contrexx_raw2xhtml($arrFormData['meta']['browser'])));
     }
     // TODO: check if we have to excape $arrRecipients later in the code
     $arrRecipients = $this->getRecipients(intval($_GET['cmd']));
     // calculate the longest field label.
     // this will be used to correctly align all user submitted data in the plaintext e-mail
     // TODO: check if the label of upload-fields are taken into account as well
     $maxlength = 0;
     foreach ($arrFormData['fields'] as $arrField) {
         $length = strlen($arrField['lang'][FRONTEND_LANG_ID]['name']);
         $maxlength = $maxlength < $length ? $length : $maxlength;
     }
     // try to fetch a user submitted e-mail address to which we will send a copy to
     if (!empty($arrFormData['fields'])) {
         foreach ($arrFormData['fields'] as $fieldId => $arrField) {
             // check if field validation is set to e-mail
             if ($arrField['check_type'] == '2') {
                 $mail = trim($arrFormData['data'][$fieldId]);
                 if (\FWValidator::isEmail($mail)) {
                     $replyAddress = $mail;
                     break;
                 }
             }
             if ($arrField['type'] == 'special') {
                 switch ($arrField['special_type']) {
                     case 'access_firstname':
                         $firstname = trim($arrFormData['data'][$fieldId]);
                         break;
                     case 'access_lastname':
                         $lastname = trim($arrFormData['data'][$fieldId]);
                         break;
                     default:
                         break;
                 }
             }
         }
     }
     if ($arrFormData['useEmailOfSender'] == 1 && (!empty($firstname) || !empty($lastname))) {
         $senderName = trim($firstname . ' ' . $lastname);
     } else {
         $senderName = $_CONFIG['coreGlobalPageTitle'];
     }
     // a recipient mail address which has been picked by sender
     $chosenMailRecipient = null;
     // fill the html and plaintext body with the submitted form data
     foreach ($arrFormData['fields'] as $fieldId => $arrField) {
         if ($fieldId == 'unique_id') {
             //generated for uploader. no interesting mail content.
             continue;
         }
         $htmlValue = '';
         $plaintextValue = '';
         $textAreaKeys = array();
         switch ($arrField['type']) {
             case 'label':
             case 'fieldset':
                 // TODO: parse TH row instead
             // TODO: parse TH row instead
             case 'horizontalLine':
                 // TODO: add visual horizontal line
                 // we need to use a 'continue 2' here to first break out of the switch and then move over to the next iteration of the foreach loop
                 continue 2;
                 break;
             case 'file':
             case 'multi_file':
                 $htmlValue = "";
                 $plaintextValue = "";
                 if (isset($arrFormData['uploadedFiles'][$fieldId])) {
                     $htmlValue = "<ul>";
                     foreach ($arrFormData['uploadedFiles'][$fieldId] as $file) {
                         $htmlValue .= "<li><a href='" . ASCMS_PROTOCOL . "://" . $_CONFIG['domainUrl'] . \Env::get('cx')->getWebsiteOffsetPath() . contrexx_raw2xhtml($file['path']) . "' >" . contrexx_raw2xhtml($file['name']) . "</a></li>";
                         $plaintextValue .= ASCMS_PROTOCOL . "://" . $_CONFIG['domainUrl'] . \Env::get('cx')->getWebsiteOffsetPath() . $file['path'] . "\r\n";
                     }
                     $htmlValue .= "</ul>";
                 }
                 break;
             case 'checkbox':
                 $plaintextValue = !empty($arrFormData['data'][$fieldId]) ? $_ARRAYLANG['TXT_CONTACT_YES'] : $_ARRAYLANG['TXT_CONTACT_NO'];
                 $htmlValue = $plaintextValue;
                 break;
             case 'recipient':
                 // TODO: check for XSS
                 $plaintextValue = $arrRecipients[$arrFormData['data'][$fieldId]]['lang'][FRONTEND_LANG_ID];
                 $htmlValue = $plaintextValue;
                 $chosenMailRecipient = $arrRecipients[$arrFormData['data'][$fieldId]]['email'];
                 break;
             case 'textarea':
                 //we need to know all textareas - they're indented differently then the rest of the other field types
                 $textAreaKeys[] = $fieldId;
             default:
                 $plaintextValue = isset($arrFormData['data'][$fieldId]) ? $arrFormData['data'][$fieldId] : '';
                 $htmlValue = contrexx_raw2xhtml($plaintextValue);
                 break;
         }
         $fieldLabel = $arrField['lang'][FRONTEND_LANG_ID]['name'];
         // try to fetch an e-mail address from submitted form date in case we were unable to fetch one from an input type with e-mail validation
         if (empty($replyAddress)) {
             $mail = $this->_getEmailAdressOfString($plaintextValue);
             if (\FWValidator::isEmail($mail)) {
                 $replyAddress = $mail;
             }
         }
         // parse html body
         if ($isHtml) {
             if (!empty($htmlValue)) {
                 if ($objTemplate->blockExists('field_' . $fieldId)) {
                     // parse field specific template block
                     $objTemplate->setVariable(array('FIELD_' . $fieldId . '_LABEL' => contrexx_raw2xhtml($fieldLabel), 'FIELD_' . $fieldId . '_VALUE' => $htmlValue));
                     $objTemplate->parse('field_' . $fieldId);
                 } elseif ($objTemplate->blockExists('form_field')) {
                     // parse regular field template block
                     $objTemplate->setVariable(array('FIELD_LABEL' => contrexx_raw2xhtml($fieldLabel), 'FIELD_VALUE' => $htmlValue));
                     $objTemplate->parse('form_field');
                 }
             } elseif ($objTemplate->blockExists('field_' . $fieldId)) {
                 // hide field specific template block, if present
                 $objTemplate->hideBlock('field_' . $fieldId);
             }
         }
         // parse plaintext body
         $tabCount = $maxlength - strlen($fieldLabel);
         $tabs = $tabCount == 0 ? 1 : $tabCount + 1;
         // TODO: what is this all about? - $value is undefined
         if ($arrFormData['fields'][$fieldId]['type'] == 'recipient') {
             $value = $arrRecipients[$value]['lang'][FRONTEND_LANG_ID];
         }
         if (in_array($fieldId, $textAreaKeys)) {
             // we're dealing with a textarea, don't indent value
             $plaintextBody .= $fieldLabel . ":\n" . $plaintextValue . "\n";
         } else {
             $plaintextBody .= $fieldLabel . str_repeat(" ", $tabs) . ": " . $plaintextValue . "\n";
         }
     }
     $arrSettings = $this->getSettings();
     // TODO: this is some fixed plaintext message data -> must be ported to html body
     $message = $_ARRAYLANG['TXT_CONTACT_TRANSFERED_DATA_FROM'] . " " . $_CONFIG['domainUrl'] . "\n\n";
     if ($arrSettings['fieldMetaDate']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_DATE'] . " " . date(ASCMS_DATE_FORMAT, $arrFormData['meta']['time']) . "\n\n";
     }
     $message .= $plaintextBody . "\n\n";
     if ($arrSettings['fieldMetaHost']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_HOSTNAME'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['host']) . "\n";
     }
     if ($arrSettings['fieldMetaIP']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_IP_ADDRESS'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['ipaddress']) . "\n";
     }
     if ($arrSettings['fieldMetaLang']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_BROWSER_LANGUAGE'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['lang']) . "\n";
     }
     $message .= $_ARRAYLANG['TXT_CONTACT_BROWSER_VERSION'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['browser']) . "\n";
     if (@(include_once \Env::get('cx')->getCodeBaseLibraryPath() . '/phpmailer/class.phpmailer.php')) {
         $objMail = new \phpmailer();
         if ($_CONFIG['coreSmtpServer'] > 0 && @(include_once \Env::get('cx')->getCodeBaseCorePath() . '/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 = $_CONFIG['coreAdminEmail'];
         $objMail->FromName = $senderName;
         if (!empty($replyAddress)) {
             $objMail->AddReplyTo($replyAddress);
             if ($arrFormData['sendCopy'] == 1) {
                 $objMail->AddAddress($replyAddress);
             }
             if ($arrFormData['useEmailOfSender'] == 1) {
                 $objMail->From = $replyAddress;
             }
         }
         $objMail->Subject = $arrFormData['subject'];
         if ($isHtml) {
             $objMail->Body = $objTemplate->get();
             $objMail->AltBody = $message;
         } else {
             $objMail->IsHTML(false);
             $objMail->Body = $message;
         }
         // attach submitted files to email
         if (count($arrFormData['uploadedFiles']) > 0 && $arrFormData['sendAttachment'] == 1) {
             foreach ($arrFormData['uploadedFiles'] as $arrFilesOfField) {
                 foreach ($arrFilesOfField as $file) {
                     $objMail->AddAttachment(\Env::get('cx')->getWebsiteDocumentRootPath() . $file['path'], $file['name']);
                 }
             }
         }
         if ($chosenMailRecipient !== null) {
             if (!empty($chosenMailRecipient)) {
                 $objMail->AddAddress($chosenMailRecipient);
                 $objMail->Send();
                 $objMail->ClearAddresses();
             }
         } else {
             foreach ($arrFormData['emails'] as $sendTo) {
                 if (!empty($sendTo)) {
                     $objMail->AddAddress($sendTo);
                     $objMail->Send();
                     $objMail->ClearAddresses();
                 }
             }
         }
     }
     return true;
 }
 /**
  * @override
  */
 public function getXHtml()
 {
     global $_CORELANG;
     //JS / CSS dependencies
     \JS::activate('cx');
     \JS::registerJS('lib/javascript/swfobject.js');
     //        JS::registerJS('lib/javascript/deployJava.js');
     \JS::registerJS('core_modules/Upload/js/uploaders/combo/combo.js');
     \JS::registerCSS('core_modules/Upload/css/uploaders/combo/combo.css');
     \JS::registerJS('core_modules/Upload/js/uploaders/pl/plupload.full.js');
     \JS::registerJS('core_modules/Upload/js/uploaders/pl/jquery.plupload.queue.js');
     \JS::registerCSS('core_modules/Upload/css/uploaders/pl/plupload.queue.css');
     $formUploader = UploadFactory::getInstance()->newUploader('form', $this->uploadId);
     //i18n of uploader descriptions
     $formUploaderDescription = $_CORELANG['FORM_UPLOADER'];
     $plUploaderDescription = $_CORELANG['PL_UPLOADER'];
     $jumpUploaderDescription = $_CORELANG['JUMP_UPLOADER'];
     $alternativesCaption = $_CORELANG['OTHER_UPLOADERS'];
     //combuploader js config: available uploaders
     $uploaders = array("{type:'form',description:'" . $formUploaderDescription . "'}");
     if (in_array('Pl', $this->enabledUploaders)) {
         array_push($uploaders, "{type:'pl',description:'" . $plUploaderDescription . "'}");
     }
     if (in_array('Jump', $this->enabledUploaders)) {
         array_push($uploaders, "{type:'jump',description:'" . $jumpUploaderDescription . "'}");
     }
     $uploaders = '[' . join(',', $uploaders) . ']';
     $cmdOrSection = $this->isBackendRequest ? 'cmd' : 'section';
     $actOrCmd = $this->isBackendRequest ? 'act' : 'cmd';
     //from where the combouploader gets the code on an uploader switch
     $switchUrl;
     //from where the combouploader gets the response for finished uploads
     $responseUrl;
     if ($this->isBackendRequest) {
         $switchUrl = ASCMS_ADMIN_WEB_PATH . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=ajaxUploaderCode';
         $responseUrl = ASCMS_ADMIN_WEB_PATH . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=response';
     } else {
         $switchUrl = CONTREXX_SCRIPT_PATH . '?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=ajaxUploaderCode';
         $responseUrl = CONTREXX_SCRIPT_PATH . '?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=response';
     }
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('combo.html');
     $tpl->setVariable(array('CONFIG_UPLOADERS_JS' => $uploaders, 'RESPONSE_URL' => $responseUrl, 'UPLOAD_ID' => $this->uploadId, 'SWITCH_URL' => $switchUrl, 'OTHER_UPLOADERS_CAPTION' => $_CORELANG['OTHER_UPLOADERS'], 'TXT_CORE_UPLOAD_MORE' => $_CORELANG['TXT_CORE_UPLOAD_MORE'], 'TXT_CORE_FINISH_UPLOADING' => $_CORELANG['TXT_CORE_FINISH_UPLOADING'], 'TXT_CORE_FILES_UPLOADED' => $_CORELANG['TXT_CORE_FILES_UPLOADED'], 'TXT_CORE_FILES_NOT_UPLOADED' => $_CORELANG['TXT_CORE_FILES_NOT_UPLOADED']));
     $tpl->setVariable('UPLOADER_CODE', $formUploader->getXHtml());
     //see Uploader::handleInstanceBusiness
     $this->handleInstanceBusiness($tpl, 'cu');
     return $tpl->get();
 }
 /**
  * Add the necessary divs for the inline editing around the content and around the title
  *
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page
  */
 public function preContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     // Is frontend editing active?
     if (!$this->frontendEditingIsActive() || !$this->userHasPermissionToEditPage()) {
         return;
     }
     $componentTemplate = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/' . $this->getName() . '/View/Template/Generic');
     $componentTemplate->setErrorHandling(PEAR_ERROR_DIE);
     // add div around content
     // not used at the moment, because we have no proper way to "not parse" blocks in content and
     // it should only print a div around the content without parsing the content at this time
     //        $componentTemplate->loadTemplateFile('ContentDiv.html');
     //        $componentTemplate->setVariable('CONTENT', $page->getContent());
     //        $page->setContent($componentTemplate->get());
     $page->setContent('<div id="fe_content">' . $page->getContent() . '</div>');
     // add div around the title
     $componentTemplate->loadTemplateFile('TitleDiv.html');
     $componentTemplate->setVariable('TITLE', $page->getContentTitle());
     $page->setContentTitle($componentTemplate->get());
 }
Example #15
0
 private static function __kill()
 {
     global $_CORELANG;
     $data = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
     self::add_code();
     $tpl = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Csrf/View/Template/Generic/');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('Warning.html');
     $form = '';
     foreach ($data as $key => $value) {
         if ($key == self::$formkey || $key == 'amp;' . self::$formkey || $key == '__cap') {
             continue;
         }
         // There *MUST NOT* be any form element with a name attribute
         // value of "submit" -- this will break the form's submit() method!
         if ($key == 'submit') {
             continue;
         }
         $form .= self::parseRequestParametersForForm($key, $value);
     }
     $csrfContinue = 'javascript:sendData();';
     $csrfAbort = 'index.php' . (isset($_GET['cmd']) ? '?cmd=' . $_GET['cmd'] : '');
     $_CORELANG['TXT_CSRF_DESCR'] = str_replace('%1$s', $csrfContinue . '" tabindex="-1', $_CORELANG['TXT_CSRF_DESCR']);
     $_CORELANG['TXT_CSRF_DESCR'] = str_replace('%2$s', $csrfAbort . '" tabindex="-1', $_CORELANG['TXT_CSRF_DESCR']);
     $action = $_SERVER['REQUEST_URI'];
     $tpl->setGlobalVariable(array('TXT_CSRF_TITLE' => $_CORELANG['TXT_CSRF_TITLE'], 'TXT_CSRF_DESCR' => $_CORELANG['TXT_CSRF_DESCR'], 'TXT_CSRF_CONTINUE' => $_CORELANG['TXT_CSRF_CONTINUE'], 'TXT_CSRF_ABORT' => $_CORELANG['TXT_CSRF_ABORT'], 'CSRF_CONTINUE' => $csrfContinue . '" tabindex="1', 'CSRF_ABORT' => $csrfAbort . '" tabindex="2', 'REQUEST_METHOD' => strtolower($_SERVER['REQUEST_METHOD']), 'ACTION' => $action, 'FORM_ELEMENTS' => $form, 'IMAGES_PATH' => ASCMS_ADMIN_WEB_PATH . '/images/csrfprotection'));
     $tpl->parse();
     $endcode = $tpl->get();
     // replace links from before contrexx 3
     $ls = new \LinkSanitizer(ASCMS_PATH_OFFSET . ASCMS_BACKEND_PATH . '/', $endcode);
     $endcode = $ls->replace();
     echo $endcode;
     die;
 }
 /**
  * Get available placeholders in newsletter notification mails
  *
  * @return string Newsletter placehodlers list
  */
 public function getNewsletterPlaceHoldersList()
 {
     global $_ARRAYLANG;
     $objTemplate = new \Cx\Core\Html\Sigma(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseModulePath() . '/Newsletter/View/Template/Backend');
     $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
     $objTemplate->loadTemplateFile('module_newsletter_config_placeholders.html');
     $objTemplate->setVariable(array('TXT_NEWSLETTER_PLACEHOLDERS' => $_ARRAYLANG['TXT_NEWSLETTER_PLACEHOLDERS'], 'TXT_NEWSLETTER_GENERAL' => $_ARRAYLANG['TXT_NEWSLETTER_GENERAL'], 'TXT_NEWSLETTER_USER_TITLE' => $_ARRAYLANG['TXT_TITLE'], 'TXT_NEWSLETTER_USER_SEX' => $_ARRAYLANG['TXT_NEWSLETTER_SEX'], 'TXT_NEWSLETTER_USER_FIRSTNAME' => $_ARRAYLANG['TXT_FIRSTNAME'], 'TXT_NEWSLETTER_USER_LASTNAME' => $_ARRAYLANG['TXT_LASTNAME'], 'TXT_NEWSLETTER_USER_EMAIL' => $_ARRAYLANG['TXT_EMAIL'], 'TXT_NEWSLETTER_DOMAIN_URL' => $_ARRAYLANG['TXT_NEWSLETTER_URL'], 'TXT_NEWSLETTER_CURRENT_DATE' => $_ARRAYLANG['TXT_DATE'], 'TXT_NEWSLETTER_CONFIRM_CODE' => $_ARRAYLANG['TXT_NEWSLETTER_CONFIRM_CODE'], 'TXT_NEWSLETTER_NOTIFICATION_ACTION' => $_ARRAYLANG['TXT_NEWSLETTER_NOTIFICATION_ACTION'], 'TXT_NEWSLETTER_SUBJECT' => $_ARRAYLANG['TXT_NEWSLETTER_SUBJECT'], 'TXT_NEWSLETTER_USER_EDIT_LINK' => $_ARRAYLANG['TXT_NEWSLETTER_USER_EDIT_LINK']));
     return $objTemplate->get();
 }
Example #17
0
 private static function loadTemplate($template)
 {
     $objTemplate = new \Cx\Core\Html\Sigma(ASCMS_THEMES_PATH);
     $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
     $objTemplate->setTemplate($template[0]);
     self::parseLoggedInOutBlocks($objTemplate);
     return $objTemplate->get();
 }
Example #18
0
 /**
  * send a mail to the email with the message
  *
  * @static
  * @param integer $uploadId the upload id
  * @param string $subject the subject of the mail for the recipient
  * @param string $email the recipient's mail address
  * @param null|string $message the message for the recipient
  */
 public static function sendMail($uploadId, $subject, $emails, $message = null)
 {
     global $objDatabase, $_CONFIG;
     /**
      * get all file ids from the last upload
      */
     $objResult = $objDatabase->Execute("SELECT `id` FROM " . DBPREFIX . "module_filesharing WHERE `upload_id` = '" . intval($uploadId) . "'");
     if ($objResult !== false && $objResult->RecordCount() > 0) {
         while (!$objResult->EOF) {
             $files[] = $objResult->fields["id"];
             $objResult->MoveNext();
         }
     }
     if (!is_int($uploadId) && empty($files)) {
         $files[] = $uploadId;
     }
     /**
      * init mail data. Mail template, Mailsubject and PhpMailer
      */
     $objMail = $objDatabase->SelectLimit("SELECT `subject`, `content` FROM " . DBPREFIX . "module_filesharing_mail_template WHERE `lang_id` = " . FRONTEND_LANG_ID, 1, -1);
     $content = str_replace(array(']]', '[['), array('}', '{'), $objMail->fields["content"]);
     if (empty($subject)) {
         $subject = $objMail->fields["subject"];
     }
     $cx = \Cx\Core\Core\Controller\Cx::instanciate();
     if (\Env::get('ClassLoader')->loadFile($cx->getCodeBaseLibraryPath() . '/phpmailer/class.phpmailer.php')) {
         $objMail = new \phpmailer();
         /**
          * Load mail template and parse it
          */
         $objTemplate = new \Cx\Core\Html\Sigma('.');
         $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
         $objTemplate->setTemplate($content);
         $objTemplate->setVariable(array("DOMAIN" => $_CONFIG["domainUrl"], 'MESSAGE' => $message));
         if ($objTemplate->blockExists('filesharing_file')) {
             foreach ($files as $file) {
                 $objTemplate->setVariable(array('FILE_DOWNLOAD' => self::getDownloadLink($file)));
                 $objTemplate->parse('filesharing_file');
             }
         }
         if ($_CONFIG['coreSmtpServer'] > 0 && \Env::get('ClassLoader')->loadFile($cx->getCodeBaseCorePath() . '/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->SetFrom($_CONFIG['coreAdminEmail'], $_CONFIG['coreGlobalPageTitle']);
         $objMail->Subject = $subject;
         $objMail->Body = $objTemplate->get();
         foreach ($emails as $email) {
             $objMail->AddAddress($email);
             $objMail->Send();
             $objMail->ClearAddresses();
         }
     }
 }
Example #19
0
 /**
  * pops up the google map window for choosing coordinates for an object
  *
  * @return void
  */
 function _showMapPopup()
 {
     global $_ARRAYLANG;
     $objTpl = new \Cx\Core\Html\Sigma(ASCMS_MODULE_PATH . '/immo/template');
     $objTpl->setErrorHandling(PEAR_ERROR_DIE);
     $objTpl->loadTemplateFile('module_immo_map_popup.html');
     $googlekey = !empty($this->arrSettings['GOOGLE_API_KEY_' . $_SERVER['SERVER_NAME']]) ? $this->arrSettings['GOOGLE_API_KEY_' . $_SERVER['SERVER_NAME']] : '';
     $objTpl->setVariable(array('CONTREXX_CHARSET' => CONTREXX_CHARSET, 'TXT_IMMO_BROWSER_NOT_SUPPORTED' => $_ARRAYLANG['TXT_IMMO_BROWSER_NOT_SUPPORTED'], 'TXT_IMMO_CLOSE' => $_ARRAYLANG['TXT_IMMO_CLOSE'], 'TXT_IMMO_DBLCLICK_TO_SET_POINT' => $_ARRAYLANG['TXT_IMMO_DBLCLICK_TO_SET_POINT'], 'TXT_IMMO_ACCEPT' => $_ARRAYLANG['TXT_IMMO_ACCEPT'], 'IMMO_MAP_LAT_BACKEND' => $this->arrSettings['lat_backend'], 'IMMO_MAP_LON_BACKEND' => $this->arrSettings['lon_backend'], 'IMMO_MAP_ZOOM_BACKEND' => $this->arrSettings['zoom_backend'], 'IMMO_GOOGLE_API_KEY' => $googlekey));
     $objTpl->show();
 }
 public function getFrameFinishedXHtml()
 {
     global $_CORELANG;
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('formFrameFinished.html');
     $tpl->setVariable('FINISHED_MESSAGE', htmlentities($_CORELANG['UPLOAD_FINISHED'], ENT_QUOTES, CONTREXX_CHARSET));
     return $tpl->get();
 }
 /**
  * Show the selected mail template for editing
  *
  * Stores the MailTemplate if the 'bsubmit' parameter has been posted.
  * If the $key argument is empty, tries to pick the value from
  * $_REQUEST['key'].
  * @param   mixed     $section      The section of the mail template
  *                                  to be edited
  * @param   string    $key          The optional key of the mail template
  *                                  to be edited
  * @param   string    $act          The action of the mail template
  * @return  \Cx\Core\Html\Sigma     The template object
  */
 static function edit($section, $key = '', $useDefaultActs = true, $act = 'mailtemplate_overview')
 {
     global $_CORELANG;
     // If the $key parameter is empty, check the request
     if (empty($key)) {
         if (isset($_REQUEST['key'])) {
             $key = $_REQUEST['key'];
         }
     }
     // Try to load an existing template for any non-empty key
     $arrTemplate = null;
     if ($key != '') {
         $arrTemplate = self::get($section, $key, FRONTEND_LANG_ID);
     }
     // If there is none, get an empty template
     $new = false;
     if (!$arrTemplate) {
         $new = true;
         $arrTemplate = self::getEmpty($key);
     }
     // Copy the template?
     if (isset($_REQUEST['copy'])) {
         $arrTemplate['key'] = '';
         $new = true;
     }
     $objTemplate = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/MailTemplate/View/Template/Generic');
     $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTemplate);
     if (!$objTemplate->loadTemplateFile('Edit.html')) {
         die("Failed to load template Edit.html");
     }
     $uri = \Html::getRelativeUri_entities();
     \Html::stripUriParam($uri, 'key');
     $uriAppendix = '';
     if ($useDefaultActs) {
         \Html::stripUriParam($uri, 'act');
         $uriAppendix = '&amp;act=' . $act;
     }
     $tab_index = \Cx\Core\Setting\Controller\Setting::tab_index();
     \Html::replaceUriParameter($uri, 'active_tab=' . $tab_index);
     \Html::replaceUriParameter($uri, 'userFrontendLangId=' . FRONTEND_LANG_ID);
     $objTemplate->setGlobalVariable($_CORELANG + array('CORE_MAILTEMPLATE_EDIT_TITLE' => $new ? $_CORELANG['TXT_CORE_MAILTEMPLATE_ADD'] : $_CORELANG['TXT_CORE_MAILTEMPLATE_EDIT'], 'CORE_MAILTEMPLATE_CMD' => isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : '', 'CORE_MAILTEMPLATE_ACTIVE_TAB' => $tab_index, 'URI_BASE' => $uri . $uriAppendix));
     $i = 0;
     foreach ($arrTemplate as $name => $value) {
         // See if there is a posted parameter value
         if (isset($_POST[$name])) {
             $value = $_POST[$name];
         }
         // IDs are set up as hidden fields.
         // They *MUST NOT* be edited!
         if (preg_match('/(?:_id)$/', $name)) {
             // For copies, IDs *MUST NOT* be reused!
             if (isset($_REQUEST['copy'])) {
                 $value = 0;
             }
             $objTemplate->setVariable('MAILTEMPLATE_HIDDEN', \Html::getHidden($name, $value));
             $objTemplate->parse('core_mailtemplate_hidden');
             continue;
         }
         // Regular inputs of various kinds
         $input = '';
         $attribute = '';
         //            $arrMimetype = '';
         switch ($name) {
             case 'available':
                 continue 2;
                 /*
                 TODO: WARNING: FCKEditor v2.x f***s up the blocks in the mail template!
                 Use plain text areas instead.  See below.
                 */
             /*
             TODO: WARNING: FCKEditor v2.x f***s up the blocks in the mail template!
             Use plain text areas instead.  See below.
             */
             case 'message_html':
                 // Show WYSIWYG only if HTML is enabled
                 if (empty($arrTemplate['html'])) {
                     continue 2;
                 }
                 $objTemplate->setVariable(array('MAILTEMPLATE_ROWCLASS' => ++$i % 2 + 1, 'MAILTEMPLATE_SPECIAL' => $_CORELANG['TXT_CORE_MAILTEMPLATE_' . strtoupper($name)]));
                 $objTemplate->touchBlock('core_mailtemplate_special');
                 $objTemplate->parse('core_mailtemplate_special');
                 $objTemplate->setVariable(array('MAILTEMPLATE_ROWCLASS' => ++$i % 2 + 1, 'MAILTEMPLATE_SPECIAL' => new \Cx\Core\Wysiwyg\Wysiwyg($name, $value, 'fullpage')));
                 $objTemplate->touchBlock('core_mailtemplate_special');
                 $objTemplate->parse('core_mailtemplate_special');
                 continue 2;
                 //$objTemplate->replaceBlock('core_mailtemplate_special', '', true);
                 //              case 'message_html':
             //$objTemplate->replaceBlock('core_mailtemplate_special', '', true);
             //              case 'message_html':
             case 'message':
                 $input = \Html::getTextarea($name, $value, '', 10, 'style="width: 600px;"');
                 break;
             case 'protected':
                 $attribute = \Html::ATTRIBUTE_DISABLED;
                 $input = \Html::getCheckbox($name, 1, '', $value, '', $attribute);
                 break;
             case 'html':
                 $input = \Html::getCheckbox($name, 1, '', $value, '', $attribute) . '&nbsp;' . $_CORELANG['TXT_CORE_MAILTEMPLATE_STORE_TO_SWITCH_EDITOR'];
                 break;
             case 'inline':
             case 'attachments':
                 continue 2;
                 // TODO: These do not work properly yet
                 /*
                               // These are identical except for the MIME types
                               case 'inline':
                                 $arrMimetype = \Filetype::getImageMimetypes();
                               case 'attachments':
                                 $arrAttachments = self::attachmentsToArray($arrTemplate[$name]);
                                 // Show at least one empty attachment/inline row
                                 if (empty($arrAttachments))
                                     $arrAttachments = array(array('path' => '', ), );
                                 $i = 0;
                                 foreach ($arrAttachments as $arrAttachment) {
                                     $div_id = $name.'-'.(++$i);
                                     $element_name = $name.'['.$i.']';
                                     $input .=
                                         '<div id="'.$div_id.'">'.
                                           \Html::getHidden(
                                               $element_name.'[old]', $arrAttachment['path'],
                                               $name.'-hidden-'.$i).
                                           $arrAttachment['path'].'&nbsp;'.
                                           $_CORELANG['TXT_CORE_MAILTEMPLATE_ATTACHMENT_UPLOAD'].
                                           \Html::getInputFileupload(
                                               $element_name.'[new]', $name.'-file-'.$i,
                                               \Filetype::MAXIMUM_UPLOAD_FILE_SIZE,
                                               $arrMimetype).
                                           // Links for adding/removing inputs
                                           \Html::getRemoveAddLinks($div_id).
                                         '</div>';
                                 }
                 //echo("$name => ".htmlentities($input)."<hr />");
                                 break;
                 */
                 // Once the key is defined, it cannot be changed.
                 // To fix a wrong key, copy the old template and enter a new key,
                 // then delete the old one.
             // TODO: These do not work properly yet
             /*
                           // These are identical except for the MIME types
                           case 'inline':
                             $arrMimetype = \Filetype::getImageMimetypes();
                           case 'attachments':
                             $arrAttachments = self::attachmentsToArray($arrTemplate[$name]);
                             // Show at least one empty attachment/inline row
                             if (empty($arrAttachments))
                                 $arrAttachments = array(array('path' => '', ), );
                             $i = 0;
                             foreach ($arrAttachments as $arrAttachment) {
                                 $div_id = $name.'-'.(++$i);
                                 $element_name = $name.'['.$i.']';
                                 $input .=
                                     '<div id="'.$div_id.'">'.
                                       \Html::getHidden(
                                           $element_name.'[old]', $arrAttachment['path'],
                                           $name.'-hidden-'.$i).
                                       $arrAttachment['path'].'&nbsp;'.
                                       $_CORELANG['TXT_CORE_MAILTEMPLATE_ATTACHMENT_UPLOAD'].
                                       \Html::getInputFileupload(
                                           $element_name.'[new]', $name.'-file-'.$i,
                                           \Filetype::MAXIMUM_UPLOAD_FILE_SIZE,
                                           $arrMimetype).
                                       // Links for adding/removing inputs
                                       \Html::getRemoveAddLinks($div_id).
                                     '</div>';
                             }
             //echo("$name => ".htmlentities($input)."<hr />");
                             break;
             */
             // Once the key is defined, it cannot be changed.
             // To fix a wrong key, copy the old template and enter a new key,
             // then delete the old one.
             case 'key':
                 $input = $arrTemplate['key'] ? $value . \Html::getHidden($name, $value) : \Html::getInputText($name, $value, '', 'style="width: 300px;"');
                 //echo("Key /$key/ -> attr $attribute<br />");
                 break;
             default:
                 $input = \Html::getInputText($name, $value, '', 'style="width: 300px;"');
         }
         $name_upper = strtoupper($name);
         $objTemplate->setVariable(array('MAILTEMPLATE_ROWCLASS' => ++$i % 2 + 1, 'MAILTEMPLATE_NAME' => $_CORELANG['TXT_CORE_MAILTEMPLATE_' . $name_upper], 'MAILTEMPLATE_VALUE' => $input));
         // Add note with helpful hints, if available
         if (isset($_CORELANG['TXT_CORE_MAILTEMPLATE_NOTE_' . $name_upper])) {
             $objTemplate->setVariable('MAILTEMPLATE_VALUE_NOTE', $_CORELANG['TXT_CORE_MAILTEMPLATE_NOTE_' . $name_upper]);
         }
         $objTemplate->parse('core_mailtemplate_row');
     }
     // Send the (possibly edited and now stored) mail, if requested
     if (empty($_POST['to_test'])) {
         return $objTemplate;
     }
     if (empty($key)) {
         \Message::error($_CORELANG['TXT_CORE_MAILTEMPLATE_ERROR_NO_KEY']);
         return $objTemplate;
     }
     $to_test = contrexx_input2raw($_POST['to_test']);
     $objTemplate->setVariable('CORE_MAILTEMPLATE_TO_TEST', $to_test);
     self::sendTestMail($section, $key, $to_test);
     return $objTemplate;
 }