/** * Load your component. * * @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page */ public function load(\Cx\Core\ContentManager\Model\Entity\Page $page) { global $_CORELANG, $page, $objTemplate, $subMenuTitle; switch ($this->cx->getMode()) { case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND: $newsObj = new News(\Env::get('cx')->getPage()->getContent()); \Env::get('cx')->getPage()->setContent($newsObj->getNewsPage()); $newsObj->getPageTitle(\Env::get('cx')->getPage()->getTitle()); // Set the meta page description to the teaser text if displaying news details $teaser = $newsObj->getTeaser(); if ($teaser !== null) { //news details, else getTeaser would return null $page->setMetadesc(contrexx_raw2xhtml(contrexx_strip_tags(html_entity_decode($teaser, ENT_QUOTES, CONTREXX_CHARSET)))); } if (substr($page->getCmd(), 0, 7) == 'details') { \Env::get('cx')->getPage()->setTitle($newsObj->newsTitle); \Env::get('cx')->getPage()->setContentTitle($newsObj->newsTitle); \Env::get('cx')->getPage()->setMetaTitle($newsObj->newsTitle); } break; case \Cx\Core\Core\Controller\Cx::MODE_BACKEND: $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html'); $objTemplate = $this->cx->getTemplate(); \Permission::checkAccess(10, 'static'); $subMenuTitle = $_CORELANG['TXT_NEWS_MANAGER']; $objNews = new NewsManager(); $objNews->getPage(); break; default: break; } }
function getInputfield($intView, $arrInputfield, $intEntryId = null) { global $objDatabase, $_ARRAYLANG, $_LANGID, $objInit; switch ($intView) { default: case 1: //modify (add/edit) View $intId = intval($arrInputfield['id']); $arrValue = array(); if (!empty($intEntryId)) { $objInputfieldValue = $objDatabase->Execute("\n SELECT\n `value`,\n `lang_id`\n FROM " . DBPREFIX . "module_mediadir_rel_entry_inputfields\n WHERE field_id={$intId}\n AND entry_id={$intEntryId}"); if ($objInputfieldValue) { while (!$objInputfieldValue->EOF) { $arrValue[intval($objInputfieldValue->fields['lang_id'])] = contrexx_raw2xhtml($objInputfieldValue->fields['value']); $objInputfieldValue->MoveNext(); } $arrValue[0] = isset($arrValue[$_LANGID]) ? $arrValue[$_LANGID] : null; } } else { $arrValue = null; } $countFrontendLang = count($this->arrFrontendLanguages); $minimize = ''; if ($objInit->mode == 'backend' || $this->arrSettings['settingsFrontendUseMultilang']) { $minimize = "<a href=\"javascript:ExpandMinimize('{$intId}');\">{$_ARRAYLANG['TXT_MEDIADIR_MORE']} »</a>"; } $strDefaultValue = isset($arrValue[0]) ? $arrValue[0] : ''; $strDefaultInput = $this->getInput($intId, $strDefaultValue, 0, $arrInputfield); $strInputfield = <<<INPUT <div id="{$this->moduleNameLC}Inputfield_{$intId}_Minimized" class="{$this->moduleNameLC}GroupMultilang" style="display: block; float:left;"> {$strDefaultInput} {$minimize} </div> INPUT; if ($objInit->mode == 'backend' || $this->arrSettings['settingsFrontendUseMultilang']) { $strInputfield .= '<div id="' . $this->moduleNameLC . 'Inputfield_' . $intId . '_Expanded" class="' . $this->moduleNameLC . 'GroupMultilang" style="display: none; float:left;">'; foreach ($this->arrFrontendLanguages as $key => $arrLang) { $intLangId = $arrLang['id']; $minimize = ''; if ($key + 1 == $countFrontendLang) { $minimize = " <a href=\"javascript:ExpandMinimize('" . $intId . "');\">« " . $_ARRAYLANG['TXT_MEDIADIR_MINIMIZE'] . "</a>"; } $value = isset($arrValue[$intLangId]) ? $arrValue[$intLangId] : ''; $strInput = $this->getInput($intId, $value, $intLangId); $strInputfield .= <<<INPUT <div> {$strInput} {$minimize} </div> INPUT; } $strInputfield .= '</div>'; } return $strInputfield; break; case 2: //search View break; } }
function getHomeTopNews($catId = 0) { global $_CORELANG, $objDatabase; $catId = intval($catId); $i = 0; $this->_objTemplate->setTemplate($this->_pageContent, true, true); if ($this->_objTemplate->blockExists('newsrow')) { $this->_objTemplate->setCurrentBlock('newsrow'); } else { return null; } $newsLimit = intval($this->arrSettings['news_top_limit']); if ($newsLimit > 50) { //limit to a maximum of 50 news $newsLimit = 50; } if ($newsLimit < 1) { //do not get any news if 0 was specified as the limit. $objResult = false; } else { //fetch news $objResult = $objDatabase->SelectLimit("\n SELECT DISTINCT(tblN.id) AS id,\n tblN.`date`, \n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblN.redirect,\n tblN.publisher,\n tblN.publisher_id,\n tblN.author,\n tblN.author_id,\n tblL.title AS title, \n tblL.teaser_text\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id=tblN.id\n INNER JOIN " . DBPREFIX . "module_news_rel_categories AS tblC ON tblC.news_id=tblL.news_id\n WHERE tblN.status=1" . ($catId > 0 ? " AND tblC.category_id={$catId}" : '') . "\n AND tblN.teaser_only='0'\n AND tblL.lang_id=" . FRONTEND_LANG_ID . "\n AND (startdate<='" . date('Y-m-d H:i:s') . "' OR startdate='0000-00-00 00:00:00')\n AND (enddate>='" . date('Y-m-d H:i:s') . "' OR enddate='0000-00-00 00:00:00')" . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid=" . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '') . "ORDER BY\n (SELECT COUNT(*) FROM " . DBPREFIX . "module_news_stats_view WHERE news_id=tblN.id AND time>'" . date_format(date_sub(date_create('now'), date_interval_create_from_date_string(intval($this->arrSettings['news_top_days']) . ' day')), 'Y-m-d H:i:s') . "') DESC", $newsLimit); } if ($objResult !== false && $objResult->RecordCount()) { while (!$objResult->EOF) { $newsid = $objResult->fields['id']; $newstitle = $objResult->fields['title']; $author = \FWUser::getParsedUserTitle($objResult->fields['author_id'], $objResult->fields['author']); $publisher = \FWUser::getParsedUserTitle($objResult->fields['publisher_id'], $objResult->fields['publisher']); $newsCategories = $this->getCategoriesByNewsId($newsid); $newsUrl = empty($objResult->fields['redirect']) ? \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), array($catId))), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $objResult->fields['redirect']; $htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle)); list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($objResult->fields['teaser_image_path'], $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl); $this->_objTemplate->setVariable(array('NEWS_ID' => $newsid, 'NEWS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_TEASER' => nl2br($objResult->fields['teaser_text']), 'NEWS_LINK' => $htmlLink, 'NEWS_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher))); if (!empty($image)) { $this->_objTemplate->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage)); if ($this->_objTemplate->blockExists('news_image')) { $this->_objTemplate->parse('news_image'); } } else { if ($this->_objTemplate->blockExists('news_image')) { $this->_objTemplate->hideBlock('news_image'); } } self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'image_thumbnail'); self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_path'], $newstitle, $newsUrl, 'image_detail'); $this->_objTemplate->parseCurrentBlock(); $i++; $objResult->MoveNext(); } } else { $this->_objTemplate->hideBlock('newsrow'); } $this->_objTemplate->setVariable("TXT_MORE_NEWS", $_CORELANG['TXT_MORE_NEWS']); return $this->_objTemplate->get(); }
function getHomeHeadlines($catId = 0) { global $_CORELANG, $objDatabase, $_LANGID; $i = 0; $catId = intval($catId); $this->_objTemplate->setTemplate($this->_pageContent, true, true); $newsLimit = intval($this->arrSettings['news_headlines_limit']); if ($newsLimit > 50) { //limit to a maximum of 50 news $newsLimit = 50; } if ($newsLimit < 1) { //do not get any news if 0 was specified as the limit. $objResult = false; } else { //fetch news $objResult = $objDatabase->SelectLimit("\n SELECT DISTINCT(tblN.id) AS id,\n tblN.`date`, \n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblN.redirect,\n tblN.publisher,\n tblN.publisher_id,\n tblN.author,\n tblN.author_id,\n tblL.text NOT REGEXP '^(<br type=\"_moz\" />)?\$' AS newscontent,\n tblL.title AS title, \n tblL.teaser_text\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id=tblN.id\n INNER JOIN " . DBPREFIX . "module_news_rel_categories AS tblC ON tblC.news_id=tblL.news_id\n WHERE tblN.status=1" . ($catId > 0 ? " AND tblC.category_id={$catId}" : '') . "\n AND tblN.teaser_only='0'\n AND tblL.lang_id=" . $_LANGID . "\n AND tblL.is_active=1\n AND (startdate<='" . date('Y-m-d H:i:s') . "' OR startdate='0000-00-00 00:00:00')\n AND (enddate>='" . date('Y-m-d H:i:s') . "' OR enddate='0000-00-00 00:00:00')" . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid=" . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '') . "ORDER BY date DESC", $newsLimit); } if ($objResult !== false && $objResult->RecordCount() >= 0) { while (!$objResult->EOF) { $newsid = $objResult->fields['id']; $newstitle = $objResult->fields['title']; $newsCategories = $this->getCategoriesByNewsId($newsid); $newsUrl = empty($objResult->fields['redirect']) ? empty($objResult->fields['newscontent']) ? '' : \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), array($catId))), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $objResult->fields['redirect']; $htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle), 'headlineLink'); $htmlLinkTitle = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle)); // in case that the message is a stub, we shall just display the news title instead of a html-a-tag with no href target if (empty($htmlLinkTitle)) { $htmlLinkTitle = contrexx_raw2xhtml($newstitle); } list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($objResult->fields['teaser_image_path'], $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl); $author = \FWUser::getParsedUserTitle($objResult->fields['author_id'], $objResult->fields['author']); $publisher = \FWUser::getParsedUserTitle($objResult->fields['publisher_id'], $objResult->fields['publisher']); $this->_objTemplate->setVariable(array('NEWS_ID' => $newsid, 'NEWS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_TEASER' => nl2br($objResult->fields['teaser_text']), 'NEWS_LINK_TITLE' => $htmlLinkTitle, 'NEWS_LINK' => $htmlLink, 'NEWS_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher), 'HEADLINE_ID' => $newsid, 'HEADLINE_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'HEADLINE_TEXT' => nl2br($objResult->fields['teaser_text']), 'HEADLINE_LINK' => $htmlLinkTitle, 'HEADLINE_AUTHOR' => contrexx_raw2xhtml($author))); if (!empty($image)) { $this->_objTemplate->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage, 'HEADLINE_IMAGE_PATH' => contrexx_raw2xhtml($objResult->fields['teaser_image_path']), 'HEADLINE_THUMBNAIL_PATH' => contrexx_raw2xhtml($imageSource))); if ($this->_objTemplate->blockExists('news_image')) { $this->_objTemplate->parse('news_image'); } } else { if ($this->_objTemplate->blockExists('news_image')) { $this->_objTemplate->hideBlock('news_image'); } } self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'image_thumbnail'); self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_path'], $newstitle, $newsUrl, 'image_detail'); $this->_objTemplate->parse('headlines_row'); $i++; $objResult->MoveNext(); } } else { $this->_objTemplate->hideBlock('headlines_row'); } $this->_objTemplate->setVariable("TXT_MORE_NEWS", $_CORELANG['TXT_MORE_NEWS']); return $this->_objTemplate->get(); }
/** * 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()); }
/** * Parses a rudimentary system log backend page * @param \Cx\Core\Html\Sigma $template Backend template for this page * @param array $cmd Supplied CMD */ public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd) { $em = $this->cx->getDb()->getEntityManager(); $logRepo = $em->getRepository('Cx\\Core_Modules\\SysLog\\Model\\Entity\\Log'); // @todo: parse message if no entries (template block exists already) $parseObject = $this->getNamespace() . '\\Model\\Entity\\Log'; // set default sorting if (!isset($_GET['order'])) { $_GET['order'] = 'timestamp/DESC'; } // configure view $viewGenerator = new \Cx\Core\Html\Controller\ViewGenerator($parseObject, array('functions' => array('delete' => 'true', 'paging' => true, 'sorting' => true, 'edit' => true), 'fields' => array('id' => array('showOverview' => false), 'timestamp' => array('readonly' => true), 'severity' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) { return '<span class="' . contrexx_raw2xhtml(strtolower($data)) . '_background">' . contrexx_raw2xhtml($data) . '</span>'; })), 'message' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) { $url = clone \Cx\Core\Routing\Url::fromRequest(); $url->setMode('backend'); $url->setParam('editid', $rows['id']); return '<a href="' . $url . '">' . contrexx_raw2xhtml($data) . '</a>'; })), 'data' => array('readonly' => true, 'showOverview' => false, 'type' => 'text'), 'logger' => array('readonly' => true)))); $template->setVariable('ENTITY_VIEW', $viewGenerator); }
/** * notify the staffs regarding the account modification of a contact * * @param Integer $customerId customer id * @param String $first_name customer first name * @param String $last_name customer last name * * @access public * @global object $objTemplate * @global array $_ARRAYLANG * * @return null */ public function notifyStaffOnContactAccModification($customerId = 0, $first_name = '', $last_name = '', $gender = 0) { global $objDatabase, $_ARRAYLANG; if (empty($customerId)) { return false; } $objFWUser = \FWUser::getFWUserObject(); $settings = $this->getSettings(); $resources = $this->getResources($settings['emp_default_user_group']); $customer_name = $first_name . " " . $last_name; $contact_gender = $gender == 1 ? "gender_female" : ($gender == 2 ? "gender_male" : 'gender_undefined'); $emailIds = array(); foreach ($resources as $key => $value) { $emailIds[] = $value['email']; } $cx = \Cx\Core\Core\Controller\Cx::instanciate(); foreach ($emailIds as $emails) { if (!empty($emails)) { $objUsers = $objFWUser->objUser->getUsers($filter = array('email' => addslashes($emails))); $info['substitution'] = array('CRM_ASSIGNED_USER_NAME' => contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objUsers->getId())), 'CRM_ASSIGNED_USER_EMAIL' => $emails, 'CRM_CONTACT_FIRSTNAME' => contrexx_raw2xhtml($first_name), 'CRM_CONTACT_LASTNAME' => contrexx_raw2xhtml($last_name), 'CRM_CONTACT_GENDER' => contrexx_raw2xhtml($contact_gender), 'CRM_DOMAIN' => ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath(), 'CRM_CONTACT_DETAILS_URL' => ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . "/index.php?cmd=" . $this->moduleName . "&act=customers&tpl=showcustdetail&id={$customerId}", 'CRM_CONTACT_DETAILS_LINK' => "<a href='" . ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . "/index.php?cmd=" . $this->moduleName . "&act=customers&tpl=showcustdetail&id={$customerId}'>" . $customer_name . "</a>"); //setting email template lang id $availableMailTempLangAry = $this->getActiveEmailTemLangId('Crm', CRM_EVENT_ON_ACCOUNT_UPDATED); $availableLangId = $this->getEmailTempLang($availableMailTempLangAry, $emails); $info['lang_id'] = $availableLangId; $dispatcher = CrmEventDispatcher::getInstance(); $dispatcher->triggerEvent(CRM_EVENT_ON_ACCOUNT_UPDATED, null, $info); } } }
/** * This function returns the DataElement * * @param string $name name of the DataElement * @param string $type type of the DataElement * @param int $length length of the DataElement * @param mixed $value value of the DataElement * @param array $options options for the DataElement * @param int $entityId id of the DataElement * @return \Cx\Core\Html\Model\Entity\DataElement */ public function getDataElement($name, $type, $length, $value, &$options, $entityId) { global $_ARRAYLANG, $_CORELANG; if (isset($options['formfield'])) { $formFieldGenerator = $options['formfield']; $formField = ''; /* We use json to do the callback. The 'else if' is for backwards compatibility so you can declare * the function directly without using json. This is not recommended and not working over session */ if (is_array($formFieldGenerator) && isset($formFieldGenerator['adapter']) && isset($formFieldGenerator['method'])) { $json = new \Cx\Core\Json\JsonData(); $jsonResult = $json->data($formFieldGenerator['adapter'], $formFieldGenerator['method'], array('name' => $name, 'type' => $type, 'length' => $length, 'value' => $value, 'options' => $options)); if ($jsonResult['status'] == 'success') { $formField = $jsonResult["data"]; } } else { if (is_callable($formFieldGenerator)) { $formField = $formFieldGenerator($name, $type, $length, $value, $options); } } if (is_a($formField, 'Cx\\Core\\Html\\Model\\Entity\\HtmlElement')) { return $formField; } else { $value = $formField; } } if (isset($options['showDetail']) && $options['showDetail'] === false) { return ''; } switch ($type) { case 'bool': case 'boolean': // yes/no checkboxes $fieldset = new \Cx\Core\Html\Model\Entity\HtmlElement('div'); $inputYes = new \Cx\Core\Html\Model\Entity\DataElement($name, 'yes'); $inputYes->setAttribute('type', 'radio'); $inputYes->setAttribute('value', '1'); $inputYes->setAttribute('id', 'form-' . $this->formId . '-' . $name . '_yes'); if (isset($options['attributes'])) { $inputYes->setAttributes($options['attributes']); } $fieldset->addChild($inputYes); $labelYes = new \Cx\Core\Html\Model\Entity\HtmlElement('label'); $labelYes->setAttribute('for', 'form-' . $this->formId . '-' . $name . '_yes'); $labelYes->addChild(new \Cx\Core\Html\Model\Entity\TextElement($_ARRAYLANG['TXT_YES'])); $fieldset->addChild($labelYes); $inputNo = new \Cx\Core\Html\Model\Entity\DataElement($name, 'no'); $inputNo->setAttribute('id', 'form-' . $this->formId . '-' . $name . '_no'); $inputNo->setAttribute('type', 'radio'); $inputNo->setAttribute('value', '0'); if (isset($options['attributes'])) { $inputNo->setAttributes($options['attributes']); } $fieldset->addChild($inputNo); $labelNo = new \Cx\Core\Html\Model\Entity\HtmlElement('label'); $labelNo->setAttribute('for', 'form-' . $this->formId . '-' . $name . '_no'); $labelNo->addChild(new \Cx\Core\Html\Model\Entity\TextElement($_ARRAYLANG['TXT_NO'])); $fieldset->addChild($labelNo); if ($value) { $inputYes->setAttribute('checked'); } else { $inputNo->setAttribute('checked'); } return $fieldset; break; case 'int': case 'integer': // input field with type number $inputNumber = new \Cx\Core\Html\Model\Entity\DataElement($name, $value, \Cx\Core\Html\Model\Entity\DataElement::TYPE_INPUT, new \Cx\Core\Validate\Model\Entity\RegexValidator('/-?[0-9]*/')); if (isset($options['attributes'])) { $inputNumber->setAttributes($options['attributes']); } $inputNumber->setAttribute('type', 'number'); return $inputNumber; break; case 'Cx\\Model\\Base\\EntityBase': $associatedClass = get_class($value); \JS::registerJS('core/Html/View/Script/Backend.js'); \ContrexxJavascript::getInstance()->setVariable('Form/Error', $_ARRAYLANG['TXT_CORE_HTML_FORM_VALIDATION_ERROR'], 'core/Html/lang'); if (\Env::get('em')->getClassMetadata($this->entityClass)->isSingleValuedAssociation($name)) { // this case is used to create a select field for 1 to 1 associations $entities = \Env::get('em')->getRepository($associatedClass)->findAll(); $foreignMetaData = \Env::get('em')->getClassMetadata($associatedClass); $primaryKeyName = $foreignMetaData->getSingleIdentifierFieldName(); $selected = $foreignMetaData->getFieldValue($value, $primaryKeyName); $arrEntities = array(); $closeMetaData = \Env::get('em')->getClassMetadata($this->entityClass); $assocMapping = $closeMetaData->getAssociationMapping($name); $validator = null; if (!isset($assocMapping['joinColumns'][0]['nullable']) || $assocMapping['joinColumns'][0]['nullable']) { $arrEntities['NULL'] = $_ARRAYLANG['TXT_CORE_NONE']; } else { $validator = new \Cx\Core\Validate\Model\Entity\RegexValidator('/^(?!null$|$)/'); } foreach ($entities as $entity) { $arrEntities[\Env::get('em')->getClassMetadata($associatedClass)->getFieldValue($entity, $primaryKeyName)] = $entity; } $select = new \Cx\Core\Html\Model\Entity\DataElement($name, \Html::getOptions($arrEntities, $selected), \Cx\Core\Html\Model\Entity\DataElement::TYPE_SELECT, $validator); if (isset($options['attributes'])) { $select->setAttributes($options['attributes']); } return $select; } else { // this case is used to list all existing values and show an add button for 1 to many associations $closeMetaData = \Env::get('em')->getClassMetadata($this->entityClass); $assocMapping = $closeMetaData->getAssociationMapping($name); $mainDiv = new \Cx\Core\Html\Model\Entity\HtmlElement('div'); $mainDiv->setAttribute('class', 'entityList'); $addButton = new \Cx\Core\Html\Model\Entity\HtmlElement('input'); $addButton->setAttribute('type', 'button'); $addButton->setClass(array('form-control', 'add_' . $this->createCssClassNameFromEntity($associatedClass), 'mappedAssocciationButton')); $addButton->setAttribute('value', $_CORELANG['TXT_ADD']); $addButton->setAttribute('data-params', 'entityClass:' . $associatedClass . ';' . 'mappedBy:' . $assocMapping['mappedBy'] . ';' . 'cssName:' . $this->createCssClassNameFromEntity($associatedClass) . ';' . 'sessionKey:' . $this->entityClass); if (!isset($_SESSION['vgOptions'])) { $_SESSION['vgOptions'] = array(); } $_SESSION['vgOptions'][$this->entityClass] = $this->componentOptions; if ($entityId != 0) { // if we edit the main form, we also want to show the existing associated values we already have $existingValues = $this->getIdentifyingDisplayValue($assocMapping, $associatedClass, $entityId); } if (!empty($existingValues)) { foreach ($existingValues as $existingValue) { $mainDiv->addChild($existingValue); } } $mainDiv->addChild($addButton); // if standard tooltip is not disabled, we load the one to n association text if (!isset($options['showstanardtooltip']) || $options['showstanardtooltip']) { if (!empty($options['tooltip'])) { $options['tooltip'] = $options['tooltip'] . '<br /><br /> ' . $_ARRAYLANG['TXT_CORE_RECORD_ONE_TO_N_ASSOCIATION']; } else { $options['tooltip'] = $_ARRAYLANG['TXT_CORE_RECORD_ONE_TO_N_ASSOCIATION']; } } $cxjs = \ContrexxJavascript::getInstance(); $cxjs->setVariable('TXT_CANCEL', $_CORELANG['TXT_CANCEL'], 'Html/lang'); $cxjs->setVariable('TXT_SUBMIT', $_CORELANG['TXT_SUBMIT'], 'Html/lang'); $cxjs->setVariable('TXT_EDIT', $_CORELANG['TXT_EDIT'], 'Html/lang'); $cxjs->setVariable('TXT_DELETE', $_CORELANG['TXT_DELETE'], 'Html/lang'); return $mainDiv; } break; case 'Country': // this is for customizing only: $data = \Cx\Core\Country\Controller\Country::getNameById($value); if (empty($data)) { $value = 204; } $options = \Cx\Core\Country\Controller\Country::getMenuoptions($value); $select = new \Cx\Core\Html\Model\Entity\DataElement($name, $options, \Cx\Core\Html\Model\Entity\DataElement::TYPE_SELECT); if (isset($options['attributes'])) { $select->setAttributes($options['attributes']); } return $select; break; case 'DateTime': case 'datetime': case 'date': // input field with type text and class datepicker if ($value instanceof \DateTime) { $value = $value->format(ASCMS_DATE_FORMAT); } if (is_null($value)) { $value = ''; } $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value); $input->setAttribute('type', 'text'); $input->setAttribute('class', 'datepicker'); if (isset($options['readonly']) && $options['readonly']) { $input->setAttribute('disabled'); } if (isset($options['attributes'])) { $input->setAttributes($options['attributes']); } \DateTimeTools::addDatepickerJs(); \JS::registerCode(' cx.jQuery(function() { cx.jQuery(".datepicker").datetimepicker(); }); '); return $input; break; case 'multiselect': case 'select': $values = array(); if (isset($options['validValues'])) { if (is_array($options['validValues'])) { $values = $options['validValues']; } else { $values = explode(',', $options['validValues']); $values = array_combine($values, $values); } } if ($type == 'multiselect') { $value = explode(',', $value); $value = array_combine($value, $value); } $selectOptions = \Html::getOptions($values, $value); $select = new \Cx\Core\Html\Model\Entity\DataElement($name, $selectOptions, \Cx\Core\Html\Model\Entity\DataElement::TYPE_SELECT); if ($type == 'multiselect') { $select->setAttribute('multiple'); } if (isset($options['attributes'])) { $select->setAttributes($options['attributes']); } return $select; break; case 'slider': // this code should not be here // create sorrounding div $element = new \Cx\Core\Html\Model\Entity\HtmlElement('div'); // create div for slider $slider = new \Cx\Core\Html\Model\Entity\HtmlElement('div'); $slider->setAttribute('class', 'slider'); $element->addChild($slider); // create hidden input for slider value $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value + 0, \Cx\Core\Html\Model\Entity\DataElement::TYPE_INPUT); $input->setAttribute('type', 'hidden'); if (isset($options['attributes'])) { $input->setAttributes($options['attributes']); } $element->addChild($input); // add javascript to update input value $min = 0; $max = 10; if (isset($options['validValues'])) { $values = explode(',', $options['validValues']); $min = $values[0]; if (isset($values[1])) { $max = $values[1]; } } if (!isset($value)) { $value = 0; } $script = new \Cx\Core\Html\Model\Entity\HtmlElement('script'); $script->addChild(new \Cx\Core\Html\Model\Entity\TextElement(' cx.jQuery("#form-' . $this->formId . '-' . $name . ' .slider").slider({ value: ' . ($value + 0) . ', min: ' . ($min + 0) . ', max: ' . ($max + 0) . ', slide: function( event, ui ) { cx.jQuery("input[name=' . $name . ']").val(ui.value); cx.jQuery("input[name=' . $name . ']").change(); } }); ')); $element->addChild($script); return $element; break; case 'checkboxes': $dataElementGroupType = \Cx\Core\Html\Model\Entity\DataElementGroup::TYPE_CHECKBOX; case 'radio': $values = array(); if (isset($options['validValues'])) { $values = explode(',', $options['validValues']); $values = array_combine($values, $values); } if (!isset($dataElementGroupType)) { $dataElementGroupType = \Cx\Core\Html\Model\Entity\DataElementGroup::TYPE_RADIO; } $radio = new \Cx\Core\Html\Model\Entity\DataElementGroup($name, $values, $value, $dataElementGroupType); if (isset($options['attributes'])) { $radio->setAttributes($options['attributes']); } return $radio; break; case 'text': // textarea $textarea = new \Cx\Core\Html\Model\Entity\HtmlElement('textarea'); $textarea->setAttribute('name', $name); if (isset($options['readonly']) && $options['readonly']) { $textarea->setAttribute('disabled'); } $textarea->addChild(new \Cx\Core\Html\Model\Entity\TextElement($value)); if (isset($options['attributes'])) { $textarea->setAttributes($options['attributes']); } return $textarea; break; case 'phone': // input field with type phone $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value); $input->setAttribute('type', 'phone'); if (isset($options['readonly']) && $options['readonly']) { $input->setAttribute('disabled'); } if (isset($options['attributes'])) { $input->setAttributes($options['attributes']); } return $input; break; case 'mail': // input field with type mail $emailValidator = new \Cx\Core\Validate\Model\Entity\EmailValidator(); $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value, 'input', $emailValidator); $input->setAttribute('onkeyup', $emailValidator->getJavaScriptCode()); $input->setAttribute('type', 'mail'); if (isset($options['attributes'])) { $input->setAttributes($options['attributes']); } if (isset($options['readonly']) && $options['readonly']) { $input->setAttribute('disabled'); } return $input; break; case 'uploader': \JS::registerCode(' function javascript_callback_function(data) { if(data.type=="file") { cx.jQuery("#' . $name . '").val(data.data[0].datainfo.filepath); } } '); $mediaBrowser = new \Cx\Core_Modules\MediaBrowser\Model\Entity\MediaBrowser(); $mediaBrowser->setOptions(array('type' => 'button')); $mediaBrowser->setCallback('javascript_callback_function'); $mediaBrowser->setOptions(array('data-cx-mb-views' => 'filebrowser,uploader', 'id' => 'page_target_browse', 'cxMbStartview' => 'MediaBrowserList')); $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value); $input->setAttribute('type', 'text'); $input->setAttribute('id', $name); $div = new \Cx\Core\Html\Model\Entity\HtmlElement('div'); $div->addChild($input); $div->addChild(new \Cx\Core\Html\Model\Entity\TextElement($mb = $mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE']))); return $div; break; case 'image': \JS::registerCode(' function javascript_callback_function(data) { if ( data.data[0].datainfo.extension=="Jpg" || data.data[0].datainfo.extension=="Gif" || data.data[0].datainfo.extension=="Png" ) { cx.jQuery("#' . $name . '").attr(\'value\', data.data[0].datainfo.filepath); cx.jQuery("#' . $name . '").prevAll(\'.deletePreviewImage\').first().css(\'display\', \'inline-block\'); cx.jQuery("#' . $name . '").prevAll(\'.previewImage\').first().attr(\'src\', data.data[0].datainfo.filepath); } } jQuery(document).ready(function(){ jQuery(\'.deletePreviewImage\').click(function(){ cx.jQuery("#' . $name . '").attr(\'value\', \'\'); cx.jQuery(this).prev(\'img\').attr(\'src\', \'/images/Downloads/no_picture.gif\'); cx.jQuery(this).css(\'display\', \'none\'); cx.jQuery(this).nextAll(\'input\').first().attr(\'value\', \'\'); }); }); '); $mediaBrowser = new \Cx\Core_Modules\MediaBrowser\Model\Entity\MediaBrowser(); $mediaBrowser->setOptions(array('type' => 'button')); $mediaBrowser->setCallback('javascript_callback_function'); $defaultOptions = array('data-cx-mb-views' => 'filebrowser,uploader', 'id' => 'page_target_browse', 'cxMbStartview' => 'MediaBrowserList'); $mediaBrowser->setOptions(is_array($options['options']) ? array_merge($defaultOptions, $options['options']) : $defaultOptions); // create hidden input to save image $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value); $input->setAttribute('type', 'hidden'); $input->setAttribute('id', $name); $div = new \Cx\Core\Html\Model\Entity\HtmlElement('div'); if (isset($value) && in_array(pathinfo($value, PATHINFO_EXTENSION), array('gif', 'jpg', 'png')) || $name == 'imagePath') { // this image is meant to be a preview of the selected image $previewImage = new \Cx\Core\Html\Model\Entity\HtmlElement('img'); $previewImage->setAttribute('class', 'previewImage'); $previewImage->setAttribute('src', $value != '' ? $value : '/images/Downloads/no_picture.gif'); // this image is uesd as delete function for the selected image over javascript $deleteImage = new \Cx\Core\Html\Model\Entity\HtmlElement('img'); $deleteImage->setAttribute('class', 'deletePreviewImage'); $deleteImage->setAttribute('src', '/core/Core/View/Media/icons/delete.gif'); $div->addChild($previewImage); $div->addChild($deleteImage); $div->addChild(new \Cx\Core\Html\Model\Entity\HtmlElement('br')); } $div->addChild($input); $div->addChild(new \Cx\Core\Html\Model\Entity\TextElement($mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE']))); return $div; break; case 'sourcecode': //set mode $mode = 'html'; if (isset($options['options']['mode'])) { switch ($options['options']['mode']) { case 'js': $mode = 'javascript'; break; case 'yml': case 'yaml': $mode = 'yaml'; break; } } //define textarea $textarea = new \Cx\Core\Html\Model\Entity\HtmlElement('textarea'); $textarea->setAttribute('name', $name); $textarea->setAttribute('id', $name); $textarea->setAttribute('style', 'display:none;'); $textarea->addChild(new \Cx\Core\Html\Model\Entity\TextElement($value)); //define pre $pre = new \Cx\Core\Html\Model\Entity\HtmlElement('pre'); $pre->setAttribute('id', 'editor-' . $name); $pre->addChild(new \Cx\Core\Html\Model\Entity\TextElement(contrexx_raw2xhtml($value))); //set readonly if necessary $readonly = ''; if (isset($options['readonly']) && $options['readonly']) { $readonly = 'editor.setReadOnly(true);'; $textarea->setAttribute('disabled'); } //create div and add all stuff $div = new \Cx\Core\Html\Model\Entity\HtmlElement('div'); // required for the Ace editor to work. Otherwise // it won't be visible as the DIV does have a width of 0px. $div->setAttribute('style', 'display:block;'); $div->addChild($textarea); $div->addChild($pre); //register js $jsCode = <<<CODE var editor; \$J(function(){ if (\$J("#editor-{$name}").length) { editor = ace.edit("editor-{$name}"); editor.getSession().setMode("ace/mode/{$mode}"); editor.setShowPrintMargin(false); editor.focus(); editor.gotoLine(1); {$readonly} } \$J('form').submit(function(){ \$J('#{$name}').val(editor.getSession().getValue()); }); }); CODE; \JS::activate('ace'); \JS::registerCode($jsCode); return $div; break; case 'string': case 'hidden': default: // convert NULL to empty string if (is_null($value)) { $value = ''; } // input field with type text $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value); if (isset($options['validValues'])) { $input->setValidator(new \Cx\Core\Validate\Model\Entity\RegexValidator('/^' . $options['validValues'] . '$/')); } if ($type == 'hidden') { $input->setAttribute('type', 'hidden'); } else { $input->setAttribute('type', 'text'); $input->setClass('form-control'); } if (isset($options['readonly']) && $options['readonly']) { $input->setAttribute('disabled'); } if (isset($options['attributes'])) { $input->setAttributes($options['attributes']); } return $input; break; } }
function getInputfield($intView, $arrInputfield, $intEntryId = null) { global $objDatabase, $_LANGID, $objInit, $_ARRAYLANG; switch ($intView) { default: case 1: //modify (add/edit) View $intId = intval($arrInputfield['id']); $arrValue = null; if (!empty($intEntryId)) { $objInputfieldValue = $objDatabase->Execute("\n SELECT\n `value`,\n `lang_id`\n FROM\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_entry_inputfields\n WHERE\n field_id=" . $intId . "\n AND\n entry_id=" . $intEntryId . "\n "); if ($objInputfieldValue !== false) { while (!$objInputfieldValue->EOF) { $arrValue[intval($objInputfieldValue->fields['lang_id'])] = contrexx_raw2xhtml($objInputfieldValue->fields['value']); $objInputfieldValue->MoveNext(); } $arrValue[0] = isset($arrValue[$_LANGID]) ? $arrValue[$_LANGID] : null; } } if (empty($arrValue)) { foreach ($arrInputfield['default_value'] as $intLangKey => $strDefaultValue) { $strDefaultValue = empty($strDefaultValue) ? $arrInputfield['default_value'][0] : $strDefaultValue; if (substr($strDefaultValue, 0, 2) == '[[') { $objPlaceholder = new \Cx\Modules\MediaDir\Controller\MediaDirectoryPlaceholder($this->moduleName); $arrValue[$intLangKey] = $objPlaceholder->getPlaceholder($strDefaultValue); } else { $arrValue[$intLangKey] = $strDefaultValue; } } } $arrInfoValue = null; $strInfoClass = ''; if (!empty($arrInputfield['info'][0])) { $arrInfoValue[0] = 'title="' . $arrInputfield['info'][0] . '"'; $strInfoClass = 'mediadirInputfieldHint'; foreach ($arrInputfield['info'] as $intLangKey => $strInfoValue) { $arrInfoValue[$intLangKey] = empty($strInfoValue) ? 'title="' . $arrInputfield['info'][0] . '"' : 'title="' . $strInfoValue . '"'; } } $countFrontendLang = count($this->arrFrontendLanguages); if ($objInit->mode == 'backend') { $strInputfield = '<div id="' . $this->moduleNameLC . 'Inputfield_' . $intId . '_Minimized" style="display: block;"><textarea data-id="' . $intId . '" class="' . $this->moduleNameLC . 'InputfieldDefault" name="' . $this->moduleNameLC . 'Inputfield[' . $intId . '][0]" id="' . $this->moduleNameLC . 'Inputfield_' . $intId . '_0" style="width: 300px; height: 60px;" onfocus="this.select();" />' . $arrValue[0] . '</textarea> <a href="javascript:ExpandMinimize(\'' . $intId . '\');">' . $_ARRAYLANG['TXT_MEDIADIR_MORE'] . ' »</a></div>'; $strInputfield .= '<div id="' . $this->moduleNameLC . 'Inputfield_' . $intId . '_Expanded" style="display: none;">'; foreach ($this->arrFrontendLanguages as $key => $arrLang) { $intLangId = $arrLang['id']; $minimize = ""; if ($key + 1 == $countFrontendLang) { $minimize = " <a href=\"javascript:ExpandMinimize('" . $intId . "');\">« " . $_ARRAYLANG['TXT_MEDIADIR_MINIMIZE'] . "</a>"; } $value = isset($arrValue[$intLangId]) ? $arrValue[$intLangId] : ''; $strInputfield .= '<textarea data-id="' . $intId . '" name="' . $this->moduleNameLC . 'Inputfield[' . $intId . '][' . $intLangId . ']" id="' . $this->moduleNameLC . 'Inputfield_' . $intId . '_' . $intLangId . '" style="height: 60px; width: 279px; margin-bottom: 2px; padding-left: 21px; background: #ffffff url(\'' . \Env::get('cx')->getCodeBaseOffsetPath() . \Env::get('cx')->getCoreFolderName() . '/Country/View/Media/Flag/flag_' . $arrLang['lang'] . '.gif\') no-repeat 3px 3px;" onfocus="this.select();" />' . $value . '</textarea> ' . $arrLang['name'] . '<a href="javascript:ExpandMinimize(\'' . $intId . '\');"> ' . $minimize . '</a><br />'; } $strInputfield .= '</div>'; } else { if ($this->arrSettings['settingsFrontendUseMultilang'] == 1) { $strInputfield = '<div id="' . $this->moduleNameLC . 'Inputfield_' . $intId . '_Minimized" style="display: block; float: left;" class="' . $this->moduleNameLC . 'GroupMultilang"><textarea data-id="' . $intId . '" class="' . $this->moduleNameLC . 'InputfieldDefault" name="' . $this->moduleNameLC . 'Inputfield[' . $intId . '][0]" id="' . $this->moduleNameLC . 'Inputfield_' . $intId . '_0" class="' . $this->moduleNameLC . 'InputfieldTextarea ' . $strInfoClass . '" ' . $arrInfoValue[0] . ' onfocus="this.select();" />' . $arrValue[0] . '</textarea> <a href="javascript:ExpandMinimize(\'' . $intId . '\');">' . $_ARRAYLANG['TXT_MEDIADIR_MORE'] . ' »</a></div>'; $strInputfield .= '<div id="' . $this->moduleNameLC . 'Inputfield_' . $intId . '_Expanded" style="display: none; float: left;" class="' . $this->moduleNameLC . 'GroupMultilang">'; foreach ($this->arrFrontendLanguages as $key => $arrLang) { $intLangId = $arrLang['id']; $minimize = ""; if ($key + 1 == $countFrontendLang) { $minimize = " <a href=\"javascript:ExpandMinimize('" . $intId . "');\">« " . $_ARRAYLANG['TXT_MEDIADIR_MINIMIZE'] . "</a>"; } $value = isset($arrValue[$intLangId]) ? $arrValue[$intLangId] : ''; $strInputfield .= '<textarea data-id="' . $intId . '" name="' . $this->moduleNameLC . 'Inputfield[' . $intId . '][' . $intLangId . ']" id="' . $this->moduleNameLC . 'Inputfield_' . $intId . '_' . $intLangId . '" class="' . $this->moduleNameLC . 'InputfieldTextarea ' . $strInfoClass . '" ' . $arrInfoValue[$intLangId] . ' onfocus="this.select();" />' . $value . '</textarea> ' . $arrLang['name'] . '<a href="javascript:ExpandMinimize(\'' . $intId . '\');"> ' . $minimize . '</a><br />'; } $strInputfield .= '</div>'; } else { $strInputfield = '<textarea name="' . $this->moduleNameLC . 'Inputfield[' . $intId . '][0]" id="' . $this->moduleNameLC . 'Inputfield_' . $intId . '_0" class="' . $this->moduleNameLC . 'InputfieldTextarea ' . $strInfoClass . '" ' . $arrInfoValue[0] . ' onfocus="this.select();" />' . $arrValue[0] . '</textarea>'; } } return $strInputfield; break; case 2: //search View break; } return null; }
function getNavtreeLevels($intLevelId) { $objLevel = new MediaDirectoryLevel($intLevelId, null, 0, $this->moduleName); $objLevel->arrLevels[$intLevelId]; if (isset($_GET['cmd'])) { $strLevelCmd = '&cmd=' . $_GET['cmd']; } else { $strLevelCmd = null; } $this->arrNavtree[] = '<a href="?section=' . $this->moduleName . $strLevelCmd . '&lid=' . $objLevel->arrLevels[$intLevelId]['levelId'] . '">' . contrexx_raw2xhtml($objLevel->arrLevels[$intLevelId]['levelName'][0]) . '</a>'; if ($objLevel->arrLevels[$intLevelId]['levelParentId'] != 0) { $this->getNavtreeLevels($objLevel->arrLevels[$intLevelId]['levelParentId']); } }
/** * gets the data for the event * * @return null */ function getData() { global $objDatabase, $_ARRAYLANG, $_LANGID; $activeLangs = explode(",", $this->showIn); $this->arrData = array(); foreach ($activeLangs as $key => $langId) { $query = "SELECT field.title AS title,\n field.teaser AS teaser,\n field.description AS description,\n field.redirect AS redirect,\n field.place AS place,\n field.place_city AS place_city,\n field.place_country AS place_country,\n field.org_name AS org_name,\n field.org_city AS org_city,\n field.org_country AS org_country\n FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_event_field AS field\n WHERE field.event_id = '" . intval($this->id) . "'\n AND field.lang_id = '" . intval($langId) . "'\n LIMIT 1"; $objResult = $objDatabase->Execute($query); if ($objResult !== false) { while (!$objResult->EOF) { $this->arrData['title'][$langId] = htmlentities(stripslashes($objResult->fields['title']), ENT_QUOTES, CONTREXX_CHARSET); $this->arrData['teaser'][$langId] = htmlentities(stripslashes($objResult->fields['teaser']), ENT_QUOTES, CONTREXX_CHARSET); $this->arrData['description'][$langId] = stripslashes($objResult->fields['description']); $this->arrData['redirect'][$langId] = htmlentities(stripslashes($objResult->fields['redirect']), ENT_QUOTES, CONTREXX_CHARSET); $this->arrData['place'][$langId] = contrexx_raw2xhtml($objResult->fields['place']); $this->arrData['place_city'][$langId] = contrexx_raw2xhtml($objResult->fields['place_city']); $this->arrData['place_country'][$langId] = contrexx_raw2xhtml($objResult->fields['place_country']); $this->arrData['org_name'][$langId] = contrexx_raw2xhtml($objResult->fields['org_name']); $this->arrData['org_city'][$langId] = contrexx_raw2xhtml($objResult->fields['org_city']); $this->arrData['org_country'][$langId] = contrexx_raw2xhtml($objResult->fields['org_country']); $objResult->MoveNext(); } } } }
function _showRecipientFeedbackAnalysis() { global $objDatabase, $_ARRAYLANG, $_CONFIG; if (empty($_REQUEST['id']) || empty($_REQUEST['recipient_type']) || !in_array($_REQUEST['recipient_type'], array(self::USER_TYPE_NEWSLETTER, self::USER_TYPE_ACCESS))) { return $this->_userList(); } $recipientId = intval($_REQUEST['id']); $recipientType = $_REQUEST['recipient_type']; $linkCount = 0; if ($recipientType == self::USER_TYPE_NEWSLETTER) { $objRecipient = $objDatabase->SelectLimit('SELECT `lastname`, `firstname` FROM `' . DBPREFIX . 'module_newsletter_user` WHERE `id`=' . $recipientId, 1); if ($objRecipient !== false && $objRecipient->RecordCount() == 1) { $recipientLastname = $objRecipient->fields['lastname']; $recipientFirstname = $objRecipient->fields['firstname']; } else { return $this->_userList(); } } else { $objRecipient = \FWUser::getFWUserObject()->objUser->getUser($recipientId); if ($objRecipient) { $recipientLastname = $objRecipient->getProfileAttribute('lastname'); $recipientFirstname = $objRecipient->getProfileAttribute('firstname'); } else { return $this->_userList(); } } $this->_pageTitle = $_ARRAYLANG['TXT_NEWSLETTER_USER_ADMINISTRATION']; $this->_objTpl->addBlockfile('NEWSLETTER_USER_FILE', 'module_newsletter_user_feedback', 'module_newsletter_user_feedback.html'); $this->_objTpl->setVariable('TXT_NEWSLETTER_USER_FEEDBACK_TITLE', sprintf($_ARRAYLANG['TXT_NEWSLETTER_RECIPIENT_FEEDBACK'], contrexx_raw2xhtml(trim($recipientLastname . " " . $recipientFirstname)))); $this->_objTpl->setVariable(array('TXT_NEWSLETTER_LINK_TITLE' => $_ARRAYLANG['TXT_NEWSLETTER_LINK_TITLE'], 'TXT_NEWSLETTER_EMAIL' => $_ARRAYLANG['TXT_NEWSLETTER_EMAIL'], 'TXT_NEWSLETTER_LINK_SOURCE' => $_ARRAYLANG['TXT_NEWSLETTER_LINK_SOURCE'], 'TXT_NEWSLETTER_FUNCTIONS' => $_ARRAYLANG['TXT_NEWSLETTER_FUNCTIONS'], 'TXT_NEWSLETTER_BACK' => $_ARRAYLANG['TXT_NEWSLETTER_BACK'])); $this->_objTpl->setGlobalVariable(array('TXT_NEWSLETTER_OPEN_LINK_IN_NEW_TAB' => $_ARRAYLANG['TXT_NEWSLETTER_OPEN_LINK_IN_NEW_TAB'])); $objResultCount = $objDatabase->SelectLimit(' SELECT COUNT(1) AS `link_count` FROM `' . DBPREFIX . 'module_newsletter_email_link_feedback` WHERE `recipient_id` = ' . $recipientId . ' AND `recipient_type` = \'' . $recipientType . '\'', 1); if ($objResultCount !== false) { $linkCount = $objResultCount->fields['link_count']; } $rowNr = 0; $pos = isset($_GET['pos']) ? intval($_GET['pos']) : 0; $objResult = $objDatabase->SelectLimit("SELECT\n tblLink.id,\n tblLink.title,\n tblLink.url,\n tblMail.subject\n FROM " . DBPREFIX . "module_newsletter_email_link_feedback AS tblMailLinkFB\n INNER JOIN " . DBPREFIX . "module_newsletter AS tblMail ON tblMail.id = tblMailLinkFB.email_id\n INNER JOIN " . DBPREFIX . "module_newsletter_email_link AS tblLink ON tblMailLinkFB.link_id = tblLink.id\n WHERE tblMailLinkFB.recipient_id = " . $recipientId . " AND tblMailLinkFB.recipient_type = '" . $recipientType . "'\n ORDER BY tblLink.title ASC", $_CONFIG['corePagingLimit'], $pos); if ($objResult !== false) { while (!$objResult->EOF) { $this->_objTpl->setVariable(array('NEWSLETTER_LINK_ROW_CLASS' => $rowNr % 2 == 1 ? 'row1' : 'row2', 'NEWSLETTER_LINK_TITLE' => contrexx_raw2xhtml($objResult->fields['title']), 'NEWSLETTER_LINK_URL' => $objResult->fields['url'], 'NEWSLETTER_EMAIL' => $objResult->fields['subject'])); $this->_objTpl->setGlobalVariable('NEWSLETTER_LINK_ID', $objResult->fields['id']); $this->_objTpl->parse("link_list"); $objResult->MoveNext(); $rowNr++; } if ($rowNr > 0) { $paging = getPaging($linkCount, $pos, "&cmd=Newsletter&act=users&tpl=feedback&id=" . $recipientId, "", false, $_CONFIG['corePagingLimit']); $this->_objTpl->setVariable('NEWSLETTER_LINKS_PAGING', "<br />" . $paging . "<br />"); } else { $this->_objTpl->setVariable('NEWSLETTER_USER_NO_FEEDBACK', $_ARRAYLANG['TXT_NEWSLETTER_USER_NO_FEEDBACK']); $this->_objTpl->touchBlock('link_list_empty'); $this->_objTpl->hideBlock('link_list'); } } return true; }
/** * Set the language list page * * @global array * @global ADONewConnection * @global \Cx\Core\Html\Sigma * @return void */ function languageOverview() { global $_ARRAYLANG, $objDatabase; // init vars $i = 0; \JS::activate('cx'); $cxjs = \ContrexxJavascript::getInstance(); $cxjs->setVariable('copyTitle', $_ARRAYLANG['TXT_LANGUAGE_COPY_TITLE'], 'language/lang'); $cxjs->setVariable('copyText', $_ARRAYLANG['TXT_LANGUAGE_COPY_TEXT'], 'language/lang'); $cxjs->setVariable('copySuccess', $_ARRAYLANG['TXT_LANGUAGE_COPY_SUCCESS'], 'language/lang'); $cxjs->setVariable('linkTitle', $_ARRAYLANG['TXT_LANGUAGE_LINK_TITLE'], 'language/lang'); $cxjs->setVariable('linkText', $_ARRAYLANG['TXT_LANGUAGE_LINK_TEXT'], 'language/lang'); $cxjs->setVariable('linkSuccess', $_ARRAYLANG['TXT_LANGUAGE_LINK_SUCCESS'], 'language/lang'); $cxjs->setVariable('warningTitle', $_ARRAYLANG['TXT_LANGUAGE_WARNING_TITLE'], 'language/lang'); $cxjs->setVariable('warningText', $_ARRAYLANG['TXT_LANGUAGE_WARNING_TEXT'], 'language/lang'); $cxjs->setVariable('waitTitle', $_ARRAYLANG['TXT_LANGUAGE_WAIT_TITLE'], 'language/lang'); $cxjs->setVariable('waitText', $_ARRAYLANG['TXT_LANGUAGE_WAIT_TEXT'], 'language/lang'); $cxjs->setVariable('yesOption', $_ARRAYLANG['TXT_YES'], 'language/lang'); $cxjs->setVariable('noOption', $_ARRAYLANG['TXT_NO'], 'language/lang'); $cxjs->setVariable('langRemovalLabel', $_ARRAYLANG['TXT_LANGUAGE_MANAGER_LABEL_LANG_REMOVAL'], 'language/lang'); $cxjs->setVariable('langRemovalContent', $_ARRAYLANG['TXT_LANGUAGE_MANAGER_LANG_REMOVAL_CONTENT'], 'language/lang'); $this->template->loadTemplateFile('language_langlist.html'); $this->pageTitle = $_ARRAYLANG['TXT_LANGUAGE_LIST']; if (!$this->isInFullMode()) { $this->hideVariables = true; $this->template->hideBlock('extendedTitles'); $this->template->hideBlock('extendedHeaders'); } else { $this->template->touchBlock('extendedTitles'); } //begin language variables $this->template->setVariable(array('TXT_ADD_NEW_LANGUAGE' => $_ARRAYLANG['TXT_ADD_NEW_LANGUAGE'], 'TXT_NAME' => $_ARRAYLANG['TXT_NAME'], 'TXT_SHORT_NAME' => $_ARRAYLANG['TXT_SHORT_NAME'], 'TXT_CHARSET' => $_ARRAYLANG['TXT_CHARSET'], 'TXT_ADD' => $_ARRAYLANG['TXT_ADD'], 'TXT_LANGUAGE_LIST' => $_ARRAYLANG['TXT_LANGUAGE_LIST'], 'TXT_ID' => $_ARRAYLANG['TXT_ID'], 'TXT_SHORT_FORM' => $_ARRAYLANG['TXT_SHORT_FORM'], 'TXT_STANDARD_LANGUAGE' => $_ARRAYLANG['TXT_STANDARD_LANGUAGE'], 'TXT_ACTION' => $_ARRAYLANG['TXT_ACTION'], 'TXT_ACCEPT_CHANGES' => $_ARRAYLANG['TXT_ACCEPT_CHANGES'], 'TXT_REMARK' => $_ARRAYLANG['TXT_REMARK'], 'TXT_ADD_DELETE_LANGUAGE_REMARK' => $_ARRAYLANG['TXT_ADD_DELETE_LANGUAGE_REMARK'], 'TXT_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_CONFIRM_DELETE_DATA'], 'TXT_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_ACTION_IS_IRREVERSIBLE'], 'TXT_VALUE' => $_ARRAYLANG['TXT_VALUE'], 'TXT_MODULE' => $_ARRAYLANG['TXT_MODULE'], 'TXT_LANGUAGE' => $_ARRAYLANG['TXT_LANGUAGE'], 'TXT_STATUS' => $_ARRAYLANG['TXT_STATUS'], 'TXT_VIEW' => $_ARRAYLANG['TXT_VIEW'], 'TXT_CONTROLLED' => $_ARRAYLANG['TXT_CONTROLLED'], 'TXT_OPEN_ISSUE' => $_ARRAYLANG['TXT_OPEN_ISSUE'], 'TXT_SHORT_NAME' => $_ARRAYLANG['TXT_SHORT_NAME'], 'TXT_LANGUAGE_DEPENDANT_SYSTEM_VARIABLES' => $_ARRAYLANG['TXT_LANGUAGE_DEPENDANT_SYSTEM_VARIABLES'], 'TXT_ADMINISTRATION_PAGES' => $_ARRAYLANG['TXT_ADMINISTRATION_PAGES'], 'TXT_WEB_PAGES' => $_ARRAYLANG['TXT_WEB_PAGES'], 'TXT_SECTION' => $_ARRAYLANG['TXT_SECTION'], 'TXT_CORE_FALLBACK' => $_ARRAYLANG['TXT_CORE_FALLBACK'], 'TXT_LANGUAGE_MANAGER_OK' => $_ARRAYLANG['TXT_LANGUAGE_MANAGER_OK'])); $this->template->setGlobalVariable(array('TXT_DEFAULT_LANGUAGE' => $_ARRAYLANG['TXT_STANDARD_LANGUAGE'], 'TXT_CORE_NONE' => $_ARRAYLANG['TXT_CORE_NONE'], 'CMD' => contrexx_input2xhtml($_GET['cmd']), 'TXT_LANGUAGE_ACTION_COPY' => $_ARRAYLANG['TXT_LANGUAGE_ACTION_COPY'], 'TXT_LANGUAGE_ACTION_LINK' => $_ARRAYLANG['TXT_LANGUAGE_ACTION_LINK'])); //end language variables if ($this->hideVariables == true) { $this->template->setGlobalVariable(array('LANGUAGE_ADMIN_STYLE' => 'display: none')); } else { $this->template->setGlobalVariable(array('LANGUAGE_ADMIN_STYLE' => 'display: block')); } $arrLanguages = \FWLanguage::getActiveFrontendLanguages(); $this->template->setVariable('LANGUAGE_MANAGER_ACTIVE_LANGIDS', implode(', ', array_keys($arrLanguages))); $objResult = $objDatabase->Execute("SELECT * FROM " . DBPREFIX . "languages ORDER BY id"); if ($objResult !== false) { while (!$objResult->EOF) { $checked = ""; if ($objResult->fields['is_default'] == "true") { $checked = "checked"; } $status = "<input type='radio' name='langDefaultStatus' onchange='updateCurrent();' value='" . $objResult->fields['id'] . "' {$checked} />"; $checked = ""; if ($objResult->fields['frontend'] == 1) { $checked = "checked"; } $activeStatus = "<input type='checkbox' name='langActiveStatus[" . $objResult->fields['id'] . "]' onchange='updateCurrent();' value='1' {$checked} />"; $checked = ""; if ($objResult->fields['backend'] == 1) { $checked = "checked"; } $selectedLang = ''; switch ($objResult->fields['fallback']) { case '': $this->template->setVariable('NONE_SELECTED', 'selected="selected"'); break; case '0': $this->template->setVariable('LANGUAGE_DEFAULT_SELECTED', 'selected="selected"'); break; default: $selectedLang = $objResult->fields['fallback']; } // set fallback language drop down foreach ($arrLanguages as $langId => $arrLanguage) { $selected = $langId == $selectedLang ? 'selected="selected"' : ''; $this->template->setVariable(array('LANGUAGE_LANG_ID' => $langId, 'LANGUAGE_LANG_OPTION' => contrexx_raw2xhtml($arrLanguage['name']), 'LANGUAGE_OPTION_SELECTED' => $selected)); $this->template->parse('fallbackLanguages'); } $adminStatus = "<input type='checkbox' name='langAdminStatus[" . $objResult->fields['id'] . "]' value='1' {$checked} />"; $this->template->setVariable(array('LANGUAGE_ROWCLASS' => 'row' . ($i++ % 2 + 1), 'LANGUAGE_LANG_ID' => $objResult->fields['id'], 'LANGUAGE_LANG_NAME' => $objResult->fields['name'], 'LANGUAGE_LANG_SHORTNAME' => $objResult->fields['lang'], 'LANGUAGE_LANG_CHARSET' => $objResult->fields['charset'], 'LANGUAGE_LANG_STATUS' => $status, 'LANGUAGE_ACTIVE_STATUS' => $activeStatus, 'LANGUAGE_ADMIN_STATUS' => $adminStatus)); if (!$this->isInFullMode()) { $this->template->hideBlock('extendedOptions'); } $this->template->parse('languageRow'); $objResult->MoveNext(); } } }
/** * Register the JS code for the given input field ID * * @param type $newsTagId HMTL ID attribute Value of the input field */ public function registerTagJsCode($newsTagId = 'newsTags') { global $_ARRAYLANG; $allNewsTags = $this->getTags(); $concatedTag = ''; $tagCount = 0; foreach ($allNewsTags as $newsTag) { ++$tagCount; $concatedTag .= '"' . contrexx_raw2xhtml(addslashes($newsTag)) . '"' . ($tagCount != count($allNewsTags) ? ',' : ''); } $newsTagsFormated = htmlspecialchars_decode($concatedTag); $placeholderText = $_ARRAYLANG['TXT_NEWS_ADD_TAGS']; $jsCode = <<<EOF \$J(document).ready(function() { var encoded = [{$newsTagsFormated}]; var decoded = []; \$J.each(encoded, function(key, value){ decoded.push(\$J("<div/>").html(value).text()); }); \$J("#{$newsTagId}").tagit({ fieldName: "newsTags[]", availableTags : decoded, placeholderText : "{$placeholderText}", allowSpaces : true }); }); EOF; \JS::registerCode($jsCode); }
protected function renderElement($title, $level, $hasChilds, $lang, $path, $current, $page) { //make sure the page to render is inside our branch if (!$this->isParentNodeInsideCurrentBranch($page->getNode())) { return ''; } //are we inside the layer bounds? if (!$this->isLevelInsideLayerBound($level)) { return ''; } if (!$page->isVisible()) { return ''; } $node = $page->getNode(); reset($this->branchNodeIds); while ($node && $node->getId() != $this->activeNode->getId()) { if ($node->getPage(FRONTEND_LANG_ID) && !$node->getPage(FRONTEND_LANG_ID)->isVisible()) { return ''; } $node = $node->getParent(); } if (!isset($this->navigationIds[$level])) { $this->navigationIds[$level] = 0; } else { $this->navigationIds[$level]++; } $block = trim($this->template->_blocks['level']); $output = " <li>" . $block; //check if we need to close any <ul>'s $this->lastLevel = $level; $style = $current ? self::StyleNameActive : self::StyleNameNormal; $output = str_replace('{NAME}', contrexx_raw2xhtml($title), $output); $output = str_replace('<li>', '<li class="' . $style . '">', $output); $output = str_replace('{URL}', \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath() . $this->virtualLanguageDirectory . contrexx_raw2encodedUrl($path), $output); $linkTarget = $page->getLinkTarget(); $output = str_replace('{TARGET}', empty($linkTarget) ? '_self' : $linkTarget, $output); $output = str_replace('{CSS_NAME}', $page->getCssNavName(), $output); $output = str_replace('{PAGE_ID}', $page->getId(), $output); $output = str_replace('{PAGE_NODE_ID}', $page->getNode()->getId(), $output); $output = str_replace('{NAVIGATION_ID}', $this->navigationIds[$level], $output); return $output; }
/** * Writes RSS feed containing the latest N messages of each category the feed-directory. This is done for every language seperately. * * @global array * @global array * @global FWLanguage */ function writeCategoryRSS() { global $_CONFIG, $_ARRAYLANG; if (intval($this->_arrSettings['blog_rss_activated'])) { $arrCategories = $this->createCategoryArray(); //Iterate over all languages foreach ($this->_arrLanguages as $intLanguageId => $arrLanguageValues) { $arrEntries = $this->createEntryArray($intLanguageId); //If there exist entries in this language go on, otherwise skip if (count($arrEntries) > 0) { //Iterate over all categories foreach ($arrCategories as $intCategoryId => $arrCategoryTranslation) { //If the category is activated in this language, find assigned messages if ($arrCategoryTranslation[$intLanguageId]['is_active']) { $intNumberOfMessages = 0; //Counts found messages for this category $objRSSWriter = new \RSSWriter(); $objRSSWriter->characterEncoding = CONTREXX_CHARSET; $objRSSWriter->channelTitle = $_CONFIG['coreGlobalPageTitle'] . ' - ' . $_ARRAYLANG['TXT_BLOG_LIB_RSS_MESSAGES_TITLE']; $objRSSWriter->channelLink = \Cx\Core\Routing\Url::fromModuleAndCmd('Blog', '', $intLanguageId)->toString(); $objRSSWriter->channelDescription = $_CONFIG['coreGlobalPageTitle'] . ' - ' . $_ARRAYLANG['TXT_BLOG_LIB_RSS_MESSAGES_TITLE'] . ' (' . $arrCategoryTranslation[$intLanguageId]['name'] . ')'; $objRSSWriter->channelCopyright = 'Copyright ' . date('Y') . ', http://' . $_CONFIG['domainUrl']; //Function doesn't exist //$objRSSWriter->channelLanguage = \FWLanguage::getLanguageParameter($intLanguageId, 'lang'); $objRSSWriter->channelWebMaster = $_CONFIG['coreAdminEmail']; //Find assigned messages $entryUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Blog', 'details', $intLanguageId); foreach ($arrEntries as $intEntryId => $arrEntryValues) { if ($this->categoryMatches($intCategoryId, $arrEntryValues['categories'][$intLanguageId])) { //Message is in category, add to feed $entryUrl->setParam('id', $intEntryId); $objRSSWriter->addItem(html_entity_decode($arrEntryValues['subject'], ENT_QUOTES, CONTREXX_CHARSET), contrexx_raw2xhtml($entryUrl->toString()), htmlspecialchars($arrEntryValues['translation'][$intLanguageId]['content'], ENT_QUOTES, CONTREXX_CHARSET), htmlspecialchars($arrEntryValues['user_name'], ENT_QUOTES, CONTREXX_CHARSET), '', '', '', '', $arrEntryValues['time_created_ts'], ''); $intNumberOfMessages++; //Check for message-limit if ($intNumberOfMessages >= intval($this->_arrSettings['blog_rss_messages'])) { break; } } } $objRSSWriter->xmlDocumentPath = \Env::get('cx')->getWebsiteFeedPath() . '/blog_category_' . $intCategoryId . '_' . $arrLanguageValues['short'] . '.xml'; $objRSSWriter->write(); \Cx\Lib\FileSystem\FileSystem::makeWritable(\Env::get('cx')->getWebsiteFeedPath() . '/blog_category_' . $intCategoryId . '_' . $arrLanguageValues['short'] . '.xml'); } } } } } }
function buildDropdownmenu($arrOptions, $intSelected = null) { $strOptions = ''; foreach ($arrOptions as $intValue => $strName) { $checked = $intValue == $intSelected ? 'selected="selected"' : ''; $strOptions .= "<option value='" . $intValue . "' " . $checked . ">" . contrexx_raw2xhtml($strName) . "</option>"; } return $strOptions; }
/** * Get a list of all news messages sorted by year and month. * * @access private * @return string parsed content */ private function getArchive() { global $objDatabase, $_ARRAYLANG; $categories = ''; $i = 0; if ($categories = substr($_REQUEST['cmd'], 7)) { $categories = $this->getCatIdsFromNestedSetArray($this->getNestedSetCategories(explode(',', $categories))); } $monthlyStats = $this->getMonthlyNewsStats($categories); if (!empty($monthlyStats)) { foreach ($monthlyStats as $key => $value) { $this->_objTpl->setVariable(array('NEWS_ARCHIVE_MONTH_KEY' => $key, 'NEWS_ARCHIVE_MONTH_NAME' => $value['name'], 'NEWS_ARCHIVE_MONTH_COUNT' => count($value['news']))); $this->_objTpl->parse('news_archive_months_list_item'); foreach ($value['news'] as $news) { $newsid = $news['id']; $newstitle = $news['newstitle']; $newsCategories = $this->getCategoriesByNewsId($newsid); $newsCommentActive = $news['commentactive']; $newsUrl = empty($news['newsredirect']) ? empty($news['newscontent']) ? '' : \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), $categories)), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $news['newsredirect']; $htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml('[' . $_ARRAYLANG['TXT_NEWS_MORE'] . '...]')); list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($news['teaser_image_path'], $news['teaser_image_thumbnail_path'], $newstitle, $newsUrl); $author = \FWUser::getParsedUserTitle($news['author_id'], $news['author']); $publisher = \FWUser::getParsedUserTitle($news['publisher_id'], $news['publisher']); $objResult = $objDatabase->Execute('SELECT count(`id`) AS `countComments` FROM `' . DBPREFIX . 'module_news_comments` WHERE `newsid` = ' . $newsid); $this->_objTpl->setVariable(array('NEWS_ARCHIVE_ID' => $newsid, 'NEWS_ARCHIVE_CSS' => 'row' . ($i % 2 + 1), 'NEWS_ARCHIVE_TEASER' => nl2br($news['teaser_text']), 'NEWS_ARCHIVE_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_ARCHIVE_LONG_DATE' => date(ASCMS_DATE_FORMAT, $news['newsdate']), 'NEWS_ARCHIVE_DATE' => date(ASCMS_DATE_FORMAT_DATE, $news['newsdate']), 'NEWS_ARCHIVE_TIME' => date(ASCMS_DATE_FORMAT_TIME, $news['newsdate']), 'NEWS_ARCHIVE_LINK_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_ARCHIVE_LINK' => $htmlLink, 'NEWS_ARCHIVE_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_ARCHIVE_CATEGORY' => stripslashes($news['name']), 'NEWS_ARCHIVE_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_ARCHIVE_PUBLISHER' => contrexx_raw2xhtml($publisher), 'NEWS_ARCHIVE_COUNT_COMMENTS' => contrexx_raw2xhtml($objResult->fields['countComments'] . ' ' . $_ARRAYLANG['TXT_NEWS_COMMENTS']))); if (!$newsCommentActive || !$this->arrSettings['news_comments_activated']) { if ($this->_objTpl->blockExists('news_archive_comments_count')) { $this->_objTpl->hideBlock('news_archive_comments_count'); } } if (!empty($image)) { $this->_objTpl->setVariable(array('NEWS_ARCHIVE_IMAGE' => $image, 'NEWS_ARCHIVE_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_ARCHIVE_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_ARCHIVE_IMAGE_LINK' => $htmlLinkImage)); if ($this->_objTpl->blockExists('news_archive_image')) { $this->_objTpl->parse('news_archive_image'); } } elseif ($this->_objTpl->blockExists('news_archive_image')) { $this->_objTpl->hideBlock('news_archive_image'); } self::parseImageBlock($this->_objTpl, $news['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'archive_image_thumbnail'); self::parseImageBlock($this->_objTpl, $news['teaser_image_path'], $newstitle, $newsUrl, 'archive_image_detail'); $this->_objTpl->parse('news_archive_link'); $i++; } $this->_objTpl->setVariable(array('NEWS_ARCHIVE_MONTH_KEY' => $key, 'NEWS_ARCHIVE_MONTH_NAME' => $value['name'])); $this->_objTpl->parse('news_archive_month_list_item'); } $this->_objTpl->parse('news_archive_months_list'); $this->_objTpl->parse('news_archive_month_list'); if ($this->_objTpl->blockExists('news_archive_status_message')) { $this->_objTpl->hideBlock('news_archive_status_message'); } } else { $this->_objTpl->setVariable('TXT_NEWS_NO_NEWS_FOUND', $_ARRAYLANG['TXT_NEWS_NO_NEWS_FOUND']); if ($this->_objTpl->blockExists('news_archive_status_message')) { $this->_objTpl->parse('news_archive_status_message'); } $this->_objTpl->hideblock('news_archive_months_list'); $this->_objTpl->hideBlock('news_archive_month_list'); } return $this->_objTpl->get(); }
/** * show thread * * @param integer $intThreadId * @return bool */ function showThread($intThreadId) { global $objDatabase, $_ARRAYLANG; $objFWUser = \FWUser::getFWUserObject(); $this->_communityLogin(); $intThreadId = intval($intThreadId); if (!empty($_REQUEST['notification_update']) && $_REQUEST['notification_update'] == $_ARRAYLANG['TXT_FORUM_UPDATE_NOTIFICATION']) { $this->_updateNotification($intThreadId); } $intCatId = !empty($_REQUEST['category_id']) ? intval($_REQUEST['category_id']) : '0'; if ($intCatId == 0) { $intCatId = $this->_getCategoryIdFromThread($intThreadId); } if (empty($intCatId)) { \Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Forum'); die; } if ($objFWUser->objUser->login()) { $this->_objTpl->touchBlock('notificationRow'); } else { $this->_objTpl->hideBlock('notificationRow'); } $intPostId = !empty($_REQUEST['postid']) ? intval($_REQUEST['postid']) : 0; $intPostId = $intPostId == 0 && !empty($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : $intPostId; $this->_objTpl->setVariable('FORUM_EDIT_POST_ID', $intPostId); $_REQUEST['act'] = !empty($_REQUEST['act']) ? $_REQUEST['act'] : ''; if ($_REQUEST['act'] == 'delete') { if ($this->_checkAuth($intCatId, 'delete')) { if ($this->_deletePost($intCatId, $intThreadId, $_REQUEST['postid'])) { $this->_objTpl->setVariable('TXT_FORUM_SUCCESS', '<br />' . $_ARRAYLANG['TXT_FORUM_DELETED_SUCCESSFULLY']); } else { $this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />' . $_ARRAYLANG['TXT_FORUM_DELETE_FAILED']); } } else { $this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />' . $_ARRAYLANG['TXT_FORUM_NO_ACCESS']); } } $pos = !empty($_REQUEST['pos']) ? intval($_REQUEST['pos']) : 0; $this->_objTpl->setVariable(array('FORUM_PAGING_POS' => $pos)); if (!empty($_REQUEST['preview_new'])) { $pos = $this->_getLastPos($intPostId, $intThreadId); } if (!empty($_REQUEST['postid'])) { if ($_REQUEST['act'] == 'quote') { $pos = $this->_getLastPos($intPostId, $intThreadId); } if ($_REQUEST['act'] == 'edit') { $pos = $this->_getEditPos($intPostId, $intThreadId); } } if (!empty($_REQUEST['l']) && $_REQUEST['l'] == 1) { $pos = $this->_getEditPos($intPostId, $intThreadId); } $arrPosts = $this->createPostArray($intThreadId, $pos); if (!empty($_REQUEST['preview_edit']) && $_REQUEST['post_id'] != 0 && $_REQUEST['act'] != 'quote') { $intPostId = intval($intPostId); $pos = $this->_getEditPos($intPostId, $intThreadId); $arrPosts = $this->createPostArray($intThreadId, $pos); $arrPosts[$intPostId]['subject'] = !empty($_REQUEST['subject']) ? contrexx_strip_tags($_REQUEST['subject']) : $_ARRAYLANG['TXT_FORUM_NO_SUBJECT']; $arrPosts[$intPostId]['content'] = \Cx\Core\Wysiwyg\Wysiwyg::prepareBBCodeForOutput(contrexx_input2raw($_REQUEST['message'])); } $userId = $objFWUser->objUser->login() ? $objFWUser->objUser->getId() : 0; $icon = !empty($_REQUEST['icons']) ? intval($_REQUEST['icons']) : 1; if ($_REQUEST['act'] == 'edit') { //submit is an edit $arrEditedPost = $this->_getPostingData($intPostId); $subject = addcslashes(htmlentities($arrEditedPost['subject'], ENT_QUOTES, CONTREXX_CHARSET), '\\'); $content = $arrEditedPost['content']; $keywords = addcslashes(htmlentities($arrEditedPost['keywords'], ENT_QUOTES, CONTREXX_CHARSET), '\\'); $attachment = $arrEditedPost['attachment']; $this->_objTpl->setVariable('FORUM_POST_EDIT_USERID', $arrPosts[$intPostId]['user_id']); if (!empty($attachment)) { $this->_objTpl->setVariable('TXT_FORUM_DELETE_ATTACHMENT', sprintf($_ARRAYLANG['TXT_FORUM_DELETE_ATTACHMENT'], $attachment)); } $this->_objTpl->touchBlock('updatePost'); $this->_objTpl->hideBlock('createPost'); $this->_objTpl->hideBlock('previewNewPost'); $this->_objTpl->touchBlock('previewEditPost'); } else { //new post if ($this->_objTpl->blockExists('delAttachment')) { $this->_objTpl->hideBlock('delAttachment'); } $subject = !empty($_REQUEST['subject']) ? contrexx_strip_tags($_REQUEST['subject']) : ''; $content = !empty($_REQUEST['message']) ? contrexx_input2raw(strip_tags($_REQUEST['message'])) : ''; $keywords = !empty($_REQUEST['keywords']) ? contrexx_strip_tags($_REQUEST['keywords']) : ''; $attachment = !empty($_REQUEST['attachment']) ? contrexx_strip_tags($_REQUEST['attachment']) : ''; $this->_objTpl->touchBlock('createPost'); $this->_objTpl->hideBlock('updatePost'); $this->_objTpl->touchBlock('previewNewPost'); $this->_objTpl->hideBlock('previewEditPost'); } if ($_REQUEST['act'] == 'quote') { $quoteContent = $this->_getPostingData($intPostId); $subject = 'RE: ' . addcslashes(htmlentities($quoteContent['subject'], ENT_QUOTES, CONTREXX_CHARSET), '\\'); $content = '[quote=' . $arrPosts[$intPostId]['user_name'] . ']' . strip_tags($quoteContent['content']) . '[/quote]'; } $firstPost = current($arrPosts); if ($this->_arrSettings['wysiwyg_editor'] == 1) { //IF WYSIWIG enabled.. $strMessageInputHTML = new \Cx\Core\Wysiwyg\Wysiwyg('message', $content, 'bbcode'); } else { //plain textarea $strMessageInputHTML = '<textarea style="width: 400px; height: 150px;" rows="5" cols="10" name="message">' . contrexx_raw2xhtml($content) . '</textarea>'; } $this->_objTpl->setGlobalVariable(array('FORUM_JAVASCRIPT_GOTO' => $this->getJavascript('goto'), 'FORUM_JAVASCRIPT_DELETE' => $this->getJavascript('deletePost'), 'FORUM_JAVASCRIPT_SCROLLTO' => $this->getJavascript('scrollto'), 'FORUM_SCROLLPOS' => !empty($_REQUEST['scrollpos']) ? intval($_REQUEST['scrollpos']) : '0', 'FORUM_JAVASCRIPT_INSERT_TEXT' => $this->getJavascript('insertText', array($intCatId, $intThreadId, $firstPost)), 'FORUM_NAME' => $this->_shortenString($firstPost['subject'], $this->_maxStringlength), 'FORUM_TREE' => $this->_createNavTree($intCatId) . '<a title="' . $this->_arrTranslations[$intCatId][$this->_intLangId]['name'] . '" href="index.php?section=Forum&cmd=board&id=' . $intCatId . '">' . $this->_shortenString($this->_arrTranslations[$intCatId][$this->_intLangId]['name'], $this->_maxStringlength) . '</a> > ', 'FORUM_DROPDOWN' => $this->createForumDD('forum_quickaccess', $intCatId, 'onchange="gotoForum(this);"', ''), 'TXT_FORUM_COMMA_SEPARATED_KEYWORDS' => $_ARRAYLANG['TXT_FORUM_COMMA_SEPARATED_KEYWORDS'], 'TXT_FORUM_KEYWORDS' => $_ARRAYLANG['TXT_FORUM_KEYWORDS'], 'TXT_FORUM_FILE_ATTACHMENT' => $_ARRAYLANG['TXT_FORUM_FILE_ATTACHMENT'], 'TXT_FORUM_RATING' => $_ARRAYLANG['TXT_FORUM_RATING'], 'TXT_FORUM_ADD_POST' => $_ARRAYLANG['TXT_FORUM_ADD_POST'], 'TXT_FORUM_SUBJECT' => $_ARRAYLANG['TXT_FORUM_SUBJECT'], 'TXT_FORUM_MESSAGE' => $_ARRAYLANG['TXT_FORUM_MESSAGE'], 'TXT_FORUM_RESET' => $_ARRAYLANG['TXT_FORUM_RESET'], 'TXT_FORUM_CREATE_POST' => $_ARRAYLANG['TXT_FORUM_CREATE_POST'], 'TXT_FORUM_ICON' => $_ARRAYLANG['TXT_FORUM_ICON'], 'TXT_FORUM_QUOTE' => $_ARRAYLANG['TXT_FORUM_QUOTE'], 'TXT_FORUM_EDIT' => $_ARRAYLANG['TXT_FORUM_EDIT'], 'TXT_FORUM_DELETE' => $_ARRAYLANG['TXT_FORUM_DELETE'], 'TXT_FORUM_PREVIEW' => $_ARRAYLANG['TXT_FORUM_PREVIEW'], 'TXT_FORUM_UPDATE_POST' => $_ARRAYLANG['TXT_FORUM_UPDATE_POST'], 'TXT_FORUM_NOTIFY_NEW_POSTS' => $_ARRAYLANG['TXT_FORUM_NOTIFY_NEW_POSTS'], 'TXT_FORUM_QUICKACCESS' => $_ARRAYLANG['TXT_FORUM_QUICKACCESS'], 'TXT_FORUM_UPDATE_NOTIFICATION' => $_ARRAYLANG['TXT_FORUM_UPDATE_NOTIFICATION'], 'TXT_FORUM_THREAD_ACTION_DESC' => $_ARRAYLANG['TXT_FORUM_THREAD_ACTION_DESC'], 'TXT_FORUM_THREAD_ACTION_MOVE' => $_ARRAYLANG['TXT_FORUM_THREAD_ACTION_MOVE'], 'TXT_FORUM_THREAD_ACTION_CLOSE' => $_ARRAYLANG['TXT_FORUM_THREAD_ACTION_CLOSE_' . $firstPost['is_locked']], 'TXT_FORUM_THREAD_ACTION_STICKY' => $_ARRAYLANG['TXT_FORUM_THREAD_ACTION_STICKY_' . $firstPost['is_sticky']], 'TXT_FORUM_THREAD_ACTION_DELETE' => $_ARRAYLANG['TXT_FORUM_THREAD_ACTION_DELETE'], 'TXT_FORUM_CHOOSE_FILE' => $_ARRAYLANG['TXT_FORUM_CHOOSE_FILE'], 'FORUM_NOTIFICATION_CHECKBOX_CHECKED' => $this->_hasNotification($intThreadId) ? 'checked="checked"' : '', 'FORUM_SUBJECT' => stripslashes($subject), 'FORUM_KEYWORDS' => stripslashes($keywords), 'FORUM_ATTACHMENT_OLDNAME' => $attachment, 'FORUM_MESSAGE_INPUT' => $strMessageInputHTML, 'FORUM_CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode(), 'FORUM_THREAD_ID' => $intThreadId, 'FORUM_CATEGORY_ID' => $intCatId, 'FORUM_POSTS_PAGING' => getPaging($this->_postCount, $pos, '§ion=Forum&cmd=thread&id=' . $intThreadId, $_ARRAYLANG['TXT_FORUM_OVERVIEW_POSTINGS'], true, $this->_arrSettings['posting_paging']))); if ($objFWUser->objUser->login()) { $this->_objTpl->hideBlock('captcha'); } else { $this->_objTpl->touchBlock('captcha'); } $this->_setIcons($this->_getIcons()); if (!$this->_checkAuth($intCatId, 'read')) { $this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />' . $_ARRAYLANG['TXT_FORUM_NO_ACCESS']); return false; } $intCounter = 0; foreach ($arrPosts as $postId => $arrValues) { $strRating = '<span id="forum_current_rating_' . $postId . '" class="rating_%s">%s</span>'; if ($arrValues['rating'] == 0) { $class = 'none'; } elseif ($arrValues['rating'] > 0) { $class = 'pos'; } else { $class = 'neg'; } $strRating = sprintf($strRating, $class, $arrValues['rating']); $strUserProfileLink = $arrValues['user_id'] > 0 ? '<a title="' . $arrValues['user_name'] . '" href="index.php?section=Access&cmd=user&id=' . $arrValues['user_id'] . '">' . $arrValues['user_name'] . '</a>' : $this->_anonymousName; $arrAttachment = $this->_getAttachment($arrValues['attachment']); $this->_objTpl->setGlobalVariable(array('FORUM_POST_ROWCLASS' => $intCounter++ % 2 + 1)); $quoteLink = "id=" . $intThreadId . "&act=quote&postid=" . $postId; $quoteLinkLoggedIn = "location.href='" . \Cx\Core\Csrf\Controller\Csrf::enhanceURI("index.php?section=Forum") . "&cmd=thread&" . htmlentities($quoteLink) . "';"; $quoteLinkNotLoggedIn = "location.href='" . \Cx\Core\Csrf\Controller\Csrf::enhanceURI("index.php?section=Login") . "&redirect=" . base64_encode("index.php?section=Forum&cmd=thread&" . $quoteLink) . "';"; $this->_objTpl->setVariable(array('FORUM_POST_DATE' => $arrValues['time_created'], 'FORUM_POST_LAST_EDITED' => $arrValues['time_edited'] != date(ASCMS_DATE_FORMAT, 0) ? $_ARRAYLANG['TXT_FORUM_LAST_EDITED'] . $arrValues['time_edited'] : '', 'FORUM_USER_ID' => $arrValues['user_id'], 'FORUM_USER_NAME' => $strUserProfileLink, 'FORUM_USER_IMAGE' => !empty($arrValues['user_image']) ? '<img border="0" width="60" height="60" src="' . $arrValues['user_image'] . '" title="' . $arrValues['user_name'] . '\'s avatar" alt="' . $arrValues['user_name'] . '\'s avatar" />' : '', 'FORUM_USER_GROUP' => '', 'FORUM_USER_RANK' => '', 'FORUM_USER_REGISTERED_SINCE' => '', 'FORUM_USER_POSTING_COUNT' => '', 'FORUM_USER_CONTACTS' => '', 'FORUM_POST_NUMBER' => '#' . $arrValues['post_number'], 'FORUM_POST_ICON' => $arrValues['post_icon'], 'FORUM_POST_SUBJECT' => $arrValues['subject'], 'FORUM_POST_MESSAGE' => $arrValues['content'], 'FORUM_POST_RATING' => $strRating, 'FORUM_POST_ATTACHMENT_LINK' => $arrAttachment['webpath'], 'FORUM_POST_ATTACHMENT_FILENAME' => $arrAttachment['name'], 'FORUM_POST_ATTACHMENT_ICON' => $arrAttachment['icon'], 'FORUM_POST_ATTACHMENT_FILESIZE' => $arrAttachment['size'], 'FORUM_QUOTE_ONCLICK' => $this->_checkAuth($intCatId, 'write') ? $quoteLinkLoggedIn : $quoteLinkNotLoggedIn)); if (!$objFWUser->objUser->login() && !$this->_checkAuth($intCatId, 'write')) { $button = '<input type="button" value="' . $_ARRAYLANG['TXT_FORUM_CREATE_POST'] . '" onclick="location.href=\'' . \Cx\Core\Csrf\Controller\Csrf::enhanceURI('index.php?section=Login') . '&redirect=' . base64_encode($_SERVER['REQUEST_URI']) . '\';" />'; $this->_objTpl->setVariable(array('FORUM_POST_REPLY_REDIRECT' => $button)); } $this->_objTpl->setVariable(array('FORUM_POST_ID' => $postId, 'FORUM_RATING_POST_ID' => $postId)); if ($firstPost['is_locked'] != 1 && ($this->_checkAuth($intCatId, 'edit') || $objFWUser->objUser->login() && $arrValues['user_id'] == $objFWUser->objUser->getId())) { $this->_objTpl->touchBlock('postEdit'); } else { $this->_objTpl->hideBlock('postEdit'); } if ($firstPost['is_locked'] != 1 && ($this->_checkAuth($intCatId, 'write') || !$firstPost['is_locked'])) { $this->_objTpl->touchBlock('postQuote'); } else { $this->_objTpl->hideBlock('postQuote'); } if ($this->_checkAuth($intCatId, 'delete') && $arrValues['post_number'] != 1) { $this->_objTpl->setVariable(array('FORUM_POST_ID' => $postId)); $this->_objTpl->touchBlock('postDelete'); } else { $this->_objTpl->hideBlock('postDelete'); } if ($this->_objTpl->blockExists('rating')) { if ($objFWUser->objUser->login() && !$this->_hasRated($postId)) { $this->_objTpl->parse('rating'); } else { $this->_objTpl->hideBlock('rating'); } } if ($this->_objTpl->blockExists('attachment')) { if (!empty($arrValues['attachment'])) { $this->_objTpl->parse('attachment'); } else { $this->_objTpl->hideBlock('attachment'); } } $this->_objTpl->parse('forumPosts'); } if (!$this->_checkAuth($intCatId, 'write') || $firstPost['is_locked'] == 1) { $this->_objTpl->hideBlock('addPost'); $this->_objTpl->hideBlock('addPostAnchor'); } else { $this->_objTpl->touchBlock('addPostAnchor'); } // initialize the uploader $this->initForumUploader(); //addpost code if (!empty($_REQUEST['create']) && $_REQUEST['create'] == $_ARRAYLANG['TXT_FORUM_CREATE_POST']) { if (!$this->_checkAuth($intCatId, 'write') && $firstPost['is_locked'] != 1) { //auth check $this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />' . $_ARRAYLANG['TXT_FORUM_NO_ACCESS']); $this->_objTpl->hideBlock('addPost'); return false; } if (!$objFWUser->objUser->login() && !\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) { //captcha check return false; } if (strlen(trim($content)) < $this->_minPostlength) { //content check $this->_objTpl->setVariable('TXT_FORUM_ERROR', sprintf('<br />' . $_ARRAYLANG['TXT_FORUM_POST_EMPTY'], $this->_minPostlength)); return false; } if (false !== ($match = $this->_hasBadWords($content))) { $this->_objTpl->setVariable('TXT_FORUM_ERROR', sprintf('<br />' . $_ARRAYLANG['TXT_FORUM_BANNED_WORD'], $match[1])); return false; } $fileInfo = $this->_handleUpload('forum_attachment'); if ($fileInfo === false) { //an error occured, the file wasn't properly transferred. exit function to display error set in _handleUpload() return false; } $lastPostIdQuery = ' SELECT max( id ) as last_post_id FROM ' . DBPREFIX . 'module_forum_postings WHERE category_id = ' . $intCatId . ' AND thread_id = ' . $intThreadId; if (($objRSmaxId = $objDatabase->SelectLimit($lastPostIdQuery, 1)) !== false) { $intPrevPostId = $objRSmaxId->fields['last_post_id']; } else { die('Database error: ' . $objDatabase->ErrorMsg()); } $insertQuery = 'INSERT INTO ' . DBPREFIX . 'module_forum_postings ( id, category_id, thread_id, prev_post_id, user_id, time_created, time_edited, is_locked, is_sticky, rating, views, icon, keywords, subject, content, attachment ) VALUES ( NULL, ' . $intCatId . ', ' . $intThreadId . ', ' . $intPrevPostId . ', ' . $userId . ', ' . time() . ', 0, 0, 0, 0, 0, ' . $icon . ",\n '{$keywords}' ,'" . $subject . "', '" . contrexx_raw2db($content) . "', '" . $fileInfo['name'] . "'\n )"; if ($objDatabase->Execute($insertQuery) !== false) { $lastInsertId = $objDatabase->Insert_ID(); $this->updateViewsNewItem($intCatId, $lastInsertId, true); $this->_updateNotification($intThreadId); $this->_sendNotifications($intThreadId, $subject, $content); $pageId = \Cx\Core\Core\Controller\Cx::instanciate()->getPage()->getId(); $cacheManager = new \Cx\Core_Modules\Cache\Controller\CacheManager(); $cacheManager->deleteSingleFile($pageId); } \Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Forum&cmd=thread&id=' . $intThreadId . '&pos=' . $this->_getLastPos($postId, $intThreadId)); die; } if (!empty($_REQUEST['preview_new'])) { $content = \Cx\Core\Wysiwyg\Wysiwyg::prepareBBCodeForOutput($content); if (false !== ($match = $this->_hasBadWords($content))) { $this->_objTpl->setVariable('TXT_FORUM_ERROR', sprintf('<br />' . $_ARRAYLANG['TXT_FORUM_BANNED_WORD'], $match[1])); return false; } if (strlen(trim($content)) < $this->_minPostlength) { //content check $this->_objTpl->setVariable('TXT_FORUM_ERROR', sprintf('<br />' . $_ARRAYLANG['TXT_FORUM_POST_EMPTY'], $this->_minPostlength)); return false; } $this->_objTpl->setVariable(array('FORUM_POST_ROWCLASS' => $intCounter++ % 2 + 1, 'FORUM_POST_DATE' => date(ASCMS_DATE_FORMAT, time()), 'FORUM_USER_ID' => $userId, 'FORUM_USER_NAME' => $objFWUser->objUser->login() ? '<a href="index.php?section=Access&cmd=user&id=' . $userId . '" title="' . htmlentities($objFWUser->objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET) . '">' . htmlentities($objFWUser->objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET) . '</a>' : $this->_anonymousName, 'FORUM_USER_IMAGE' => !empty($arrValues['user_image']) ? '<img border="0" width="60" height="60" src="' . $arrValues['user_image'] . '" title="' . $arrValues['user_name'] . '\'s avatar" alt="' . $arrValues['user_name'] . '\'s avatar" />' : '', 'FORUM_USER_GROUP' => '', 'FORUM_USER_RANK' => '', 'FORUM_USER_REGISTERED_SINCE' => '', 'FORUM_USER_POSTING_COUNT' => '', 'FORUM_USER_CONTACTS' => '', 'FORUM_POST_NUMBER' => '#' . ($this->_postCount + 1), 'FORUM_POST_ICON' => $this->getThreadIcon($icon), 'FORUM_POST_SUBJECT' => stripslashes($subject), 'FORUM_POST_MESSAGE' => $content, 'FORUM_POST_RATING' => '0')); $this->_objTpl->touchBlock('createPost'); $this->_objTpl->hideBlock('updatePost'); if ($this->_objTpl->blockExists('attachment')) { $this->_objTpl->hideBlock('attachment'); } $this->_objTpl->hideBlock('postEdit'); $this->_objTpl->hideBlock('postQuote'); $this->_objTpl->touchBlock('previewNewPost'); $this->_objTpl->hideBlock('previewEditPost'); $this->_objTpl->parse('forumPosts'); } if (!empty($_REQUEST['update']) && $_REQUEST['update'] == $_ARRAYLANG['TXT_FORUM_UPDATE_POST']) { if (strlen(trim($content)) < $this->_minPostlength) { //content size check $this->_objTpl->setVariable('TXT_FORUM_ERROR', sprintf('<br />' . $_ARRAYLANG['TXT_FORUM_POST_EMPTY'], $this->_minPostlength)); return false; } if (!$this->_checkAuth($intCatId, 'edit') && (!$objFWUser->objUser->login() || $arrValues['user_id'] != $objFWUser->objUser->getId())) { $this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />' . $_ARRAYLANG['TXT_FORUM_NO_ACCESS']); $this->_objTpl->hideBlock('postEdit'); return false; } if (!$objFWUser->objUser->login() && !\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) { $this->_objTpl->touchBlock('updatePost'); $this->_objTpl->hideBlock('createPost'); return false; } if (false !== ($match = $this->_hasBadWords($content))) { $this->_objTpl->setVariable('TXT_FORUM_ERROR', sprintf('<br />' . $_ARRAYLANG['TXT_FORUM_BANNED_WORD'], $match[1])); return false; } $fileInfo = $this->_handleUpload('forum_attachment'); if ($fileInfo === false) { //an error occured, the file wasn't properly transferred. exit function to display error set in _handleUpload() return false; } if (empty($_POST['forum_delete_attachment']) && empty($fileInfo['name']) && !empty($_REQUEST['forum_attachment_oldname'])) { $fileInfo['name'] = contrexx_addslashes($_REQUEST['forum_attachment_oldname']); } elseif (!empty($_POST['forum_delete_attachment']) && $_POST['forum_delete_attachment'] == 1 || !empty($_REQUEST['forum_attachment_oldname']) && $fileInfo['name'] != $_REQUEST['forum_attachment_oldname']) { unlink(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteMediaForumUploadPath() . '/' . str_replace(array('./', '.\\'), '', $_REQUEST['forum_attachment_oldname'])); } $updateQuery = 'UPDATE ' . DBPREFIX . 'module_forum_postings SET time_edited = ' . mktime() . ', icon = ' . $icon . ', subject = \'' . $subject . '\', keywords = \'' . $keywords . '\', content = \'' . contrexx_raw2db($content) . '\', attachment = \'' . $fileInfo['name'] . '\' WHERE id = ' . $intPostId; if ($objDatabase->Execute($updateQuery) !== false) { $this->updateViews($intThreadId, $intPostId); $pageId = \Cx\Core\Core\Controller\Cx::instanciate()->getPage()->getId(); $cacheManager = new \Cx\Core_Modules\Cache\Controller\CacheManager(); $cacheManager->deleteSingleFile($pageId); } \Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Forum&cmd=thread&id=' . $intThreadId . '&pos=' . $this->_getLastPos($postId, $intThreadId)); die; } if (!empty($_REQUEST['preview_edit'])) { $this->_objTpl->touchBlock('updatePost'); $this->_objTpl->hideBlock('createPost'); $this->_objTpl->hideBlock('previewNewPost'); $this->_objTpl->touchBlock('previewEditPost'); } $hasAccess = false; foreach (array('STICKY', 'MOVE', 'CLOSE', 'DELETE') as $action) { if (!$this->_checkAuth($intCatId, strtolower($action))) { $this->_objTpl->setVariable('FORUM_THREAD_ACTIONS_DISABLED_' . $action, 'disabled="disabled"'); } else { $hasAccess = true; } } if ($this->_objTpl->blockExists('threadActionsSelect')) { if ($userId < 1 || !$hasAccess) { $this->_objTpl->hideBlock('threadActionsSelect'); } else { $this->_objTpl->touchBlock('threadActionsSelect'); } } if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'move' && !empty($_REQUEST['id'])) { $thread = intval($_REQUEST['id']); $newCat = intval($_REQUEST['moveToThread']); $oldCat = $this->_getCategoryIdFromThread($thread); $query = "UPDATE `" . DBPREFIX . "module_forum_postings` SET `category_id` = {$newCat} WHERE `thread_id` = " . $thread; if ($objDatabase->Execute($query)) { $intMovedPosts = $objDatabase->Affected_Rows(); $query = "SELECT max( `id` ) as `lastid` FROM `" . DBPREFIX . "module_forum_postings` WHERE `thread_id` = {$thread}"; $objRS = $objDatabase->SelectLimit($query, 1); $intMovedPostLastId = $objRS->fields['lastid']; $query = "SELECT max( `id` ) as `lastid` FROM `" . DBPREFIX . "module_forum_postings` WHERE `category_id` = {$oldCat}"; $objRS = $objDatabase->SelectLimit($query, 1); $query = "UPDATE `" . DBPREFIX . "module_forum_statistics` SET `thread_count` = `thread_count` - 1, `post_count` = `post_count` - {$intMovedPosts}, `last_post_id` = " . (intval($objRS->fields['lastid']) > 0 ? intval($objRS->fields['lastid']) : 0) . " WHERE `category_id` = {$oldCat}"; $objDatabase->Execute($query); $query = "SELECT `id` FROM `" . DBPREFIX . "module_forum_postings` WHERE `category_id` = {$newCat} GROUP BY `time_created` DESC"; $objRS = $objDatabase->Execute($query); $query = "UPDATE `" . DBPREFIX . "module_forum_statistics` SET `thread_count` = `thread_count` + 1, `post_count` = `post_count` + {$intMovedPosts}, `last_post_id` = " . $objRS->fields['id'] . " WHERE `category_id` = {$newCat}"; $objDatabase->Execute($query); $this->_objTpl->hideBlock('moveForm'); $this->_objTpl->setVariable(array('TXT_THREAD_ACTION_' . ($success ? 'SUCCESS' : 'ERROR') => $_ARRAYLANG['TXT_FORUM_THREAD_ACTION_MOVE' . (!$success ? 'UN' : '') . 'SUCCESSFUL'], 'FORUM_CATEGORY_ID' => $intCatId, 'FORUM_THREAD_ID' => $intThreadId)); \Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Forum&cmd=thread&id=' . $thread); } } if (!empty($_GET['a'])) { $this->_objTpl->setVariable(array('TXT_FORUM_' . ($_GET['r'] == 1 ? 'SUCCESS' : 'ERROR') => '<br />' . $_ARRAYLANG['TXT_FORUM_THREAD_ACTION_' . strtoupper($_GET['a']) . '_' . (!$_GET['r'] ? 'UN' : '') . 'SUCCESSFUL' . $_GET['s']])); } $success = false; if (!empty($_REQUEST['thread_actions'])) { $action = contrexx_addslashes($_REQUEST['thread_actions']); if ($this->_checkAuth($intCatId, $action)) { switch ($action) { case 'move': $arrForums = $this->createForumArray($this->_intLangId); foreach ($arrForums as $intCatID => $arrThread) { $strOptions .= '<option value="' . $intCatID . '" ' . ($arrThread['level'] == 0 ? 'disabled="disabled"' : '') . '>' . str_repeat(' ', $arrThread['level'] * 2) . $arrThread['name'] . '</option>'; } $this->_objTpl->setVariable(array('FORUM_THREADS' => $strOptions)); $success = true; $suffix = ''; \Env::get('cx')->getPage()->setTitle($_ARRAYLANG['TXT_FORUM_THREAD_ACTION_MOVE']); break; case 'close': $query = "UPDATE `" . DBPREFIX . "module_forum_postings` SET `is_locked` = IF(`is_locked` = '0' OR `is_locked` = '', '1', '0') WHERE thread_id = " . intval($_REQUEST['id']); if ($objDatabase->Execute($query) !== false) { $success = true; } $suffix = '_' . $firstPost['is_locked']; break; case 'sticky': $query = "UPDATE `" . DBPREFIX . "module_forum_postings` SET `is_sticky` = IF(`is_sticky` = '0' OR `is_sticky` = '', '1', '0') WHERE thread_id = " . intval($_REQUEST['id']); if ($objDatabase->Execute($query) !== false) { $success = true; } $suffix = '_' . $firstPost['is_sticky']; break; default: break; } if ($action != 'move') { \Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Forum&cmd=thread&id=' . $intThreadId . '&a=' . $action . '&r=' . $success . '&s=' . $suffix); } } else { $this->_objTpl->setVariable('TXT_THREAD_ACTION_ERROR', $_ARRAYLANG['TXT_FORUM_NO_ACCESS']); } $this->_objTpl->parse('threadActions'); $this->_objTpl->touchBlock('threadActions'); $this->_objTpl->hideBlock('threadDisplay'); } else { $this->updateViews($intThreadId, $intPostId); $this->_objTpl->hideBlock('threadActions'); } return true; }
function getRecentNewsComments() { global $objDatabase; $this->_objTemplate->setTemplate($this->_pageContent, true, true); // abort if template block is missing if (!$this->_objTemplate->blockExists('news_comments')) { return; } // abort if commenting system is not active if (!$this->arrSettings['news_comments_activated']) { $this->_objTemplate->hideBlock('news_comments'); } else { $_ARRAYLANG = \Env::get('init')->loadLanguageData('News'); $commentsCount = (int) $this->arrSettings['recent_news_message_limit']; $query = "SELECT `nComment`.`title`,\n `nComment`.`date`,\n `nComment`.`poster_name`,\n `nComment`.`userid`,\n `nComment`.`text`,\n `news`.`id`\n FROM \n `" . DBPREFIX . "module_news_comments` AS nComment\n LEFT JOIN \n `" . DBPREFIX . "module_news` AS news\n ON\n `nComment`.newsid = `news`.id\n LEFT JOIN \n `" . DBPREFIX . "module_news_locale` AS nLocale\n ON\n `news`.id = `nLocale`.news_id AND `nLocale`.lang_id = " . FRONTEND_LANG_ID . "\n WHERE\n `news`.status = 1\n AND\n `news`.allow_comments = 1\n AND\n `nLocale`.is_active = 1\n AND\n `nComment`.`is_active` = '1'\n ORDER BY\n `date` DESC \n LIMIT 0, {$commentsCount}"; $objResult = $objDatabase->Execute($query); // no comments for this message found if (!$objResult || $objResult->EOF) { if ($this->_objTemplate->blockExists('news_no_comment')) { $this->_objTemplate->setVariable('TXT_NEWS_COMMENTS_NONE_EXISTING', $_ARRAYLANG['TXT_NEWS_COMMENTS_NONE_EXISTING']); $this->_objTemplate->parse('news_no_comment'); } $this->_objTemplate->hideBlock('news_comment_list'); $this->_objTemplate->parse('news_comments'); return $this->_objTemplate->get(); } $i = 0; while (!$objResult->EOF) { self::parseUserAccountData($this->_objTemplate, $objResult->fields['userid'], $objResult->fields['poster_name'], 'news_comments_poster'); $commentTitle = $objResult->fields['title']; $newsCategories = $this->getCategoriesByNewsId($objResult->fields['id']); $newsUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', array_keys($newsCategories)), FRONTEND_LANG_ID, array('newsid' => $objResult->fields['id'])); $newsLink = self::parseLink($newsUrl, $commentTitle, contrexx_raw2xhtml($commentTitle)); $this->_objTemplate->setVariable(array('NEWS_COMMENTS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_COMMENTS_TITLE' => contrexx_raw2xhtml($commentTitle), 'NEWS_COMMENTS_MESSAGE' => nl2br(contrexx_raw2xhtml($objResult->fields['text'])), 'NEWS_COMMENTS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_COMMENTS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_COMMENTS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_COMMENT_LINK' => $newsLink, 'NEWS_COMMENT_URL' => $newsUrl)); $this->_objTemplate->parse('news_comment'); $i++; $objResult->MoveNext(); } $this->_objTemplate->parse('news_comment_list'); $this->_objTemplate->hideBlock('news_no_comment'); } return $this->_objTemplate->get(); }
/** * Show the password reset mask. * * @access private * @global array $_ARRAYLANG * @global FWUser $objFWUser */ private function showPasswordReset() { global $_ARRAYLANG; \JS::activate('jquery'); $objFWUser = \FWUser::getFWUserObject(); $this->objTemplate->addBlockfile('CONTENT_FILE', 'CONTENT_BLOCK', '/core_modules/Login/View/Template/Backend/login_reset_password.html'); $this->objTemplate->setVariable(array('TITLE' => $_ARRAYLANG['TXT_LOGIN_SET_NEW_PASSWORD'], 'TXT_LOGIN_BACK_TO_LOGIN' => $_ARRAYLANG['TXT_LOGIN_BACK_TO_LOGIN'], 'TXT_LOGIN_GO_TO_BACKEND' => $_ARRAYLANG['TXT_LOGIN_GO_TO_BACKEND'], 'TXT_LOGIN_ENTER_A_NEW_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_ENTER_A_NEW_PASSWORD'], 'TXT_LOGIN_CONFIRM_NEW_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_CONFIRM_NEW_PASSWORD'], 'JAVASCRIPT' => \JS::getCode())); $this->objTemplate->hideBlock('error_message'); $this->objTemplate->hideBlock('success_message'); $this->objTemplate->hideBlock('back_to_login'); // TODO: Why oh why isn't function resetPassword() located in the AccessLibrary? $email = isset($_POST['email']) ? contrexx_stripslashes($_POST['email']) : (isset($_GET['email']) ? contrexx_stripslashes($_GET['email']) : ''); $restoreKey = isset($_POST['restore_key']) ? contrexx_stripslashes($_POST['restore_key']) : (isset($_GET['restoreKey']) ? contrexx_stripslashes($_GET['restoreKey']) : ''); $password = isset($_POST['PASSWORD']) ? trim(contrexx_stripslashes($_POST['PASSWORD'])) : ''; $confirmedPassword = isset($_POST['password2']) ? trim(contrexx_stripslashes($_POST['password2'])) : ''; $this->objTemplate->setVariable(array('LOGIN_EMAIL' => contrexx_raw2xhtml($email), 'LOGIN_RESTORE_KEY' => contrexx_raw2xhtml($restoreKey))); if (isset($_POST['reset_password'])) { if ($objFWUser->resetPassword($email, $restoreKey, $password, $confirmedPassword, true)) { $this->objTemplate->setVariable('LOGIN_SUCCESS_MESSAGE', $_ARRAYLANG['TXT_LOGIN_PASSWORD_CHANGED_SUCCESSFULLY']); $this->objTemplate->touchBlock('success_message'); $this->objTemplate->hideBlock('login_reset_password'); $this->objTemplate->touchBlock('back_to_login'); $userFilter = array('active' => 1, 'email' => $email); $objUser = $objFWUser->objUser->getUsers($userFilter, null, null, null, 1); $objFWUser->loginUser($objUser); } else { $this->objTemplate->setVariable('LOGIN_ERROR_MESSAGE', $objFWUser->getErrorMsg()); $this->objTemplate->touchBlock('error_message'); $this->objTemplate->setVariable(array('TXT_LOGIN_EMAIL' => $_ARRAYLANG['TXT_LOGIN_EMAIL'], 'TXT_LOGIN_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_PASSWORD'], 'TXT_LOGIN_VERIFY_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_VERIFY_PASSWORD'], 'TXT_LOGIN_PASSWORD_MINIMAL_CHARACTERS' => $_ARRAYLANG['TXT_LOGIN_PASSWORD_MINIMAL_CHARACTERS'], 'TXT_LOGIN_SET_PASSWORD_TEXT' => $_ARRAYLANG['TXT_LOGIN_SET_PASSWORD_TEXT'], 'TXT_LOGIN_SET_NEW_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_SET_NEW_PASSWORD'])); $this->objTemplate->parse('login_reset_password'); } } else { $this->objTemplate->setVariable(array('TXT_LOGIN_EMAIL' => $_ARRAYLANG['TXT_LOGIN_EMAIL'], 'TXT_LOGIN_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_PASSWORD'], 'TXT_LOGIN_VERIFY_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_VERIFY_PASSWORD'], 'TXT_LOGIN_PASSWORD_MINIMAL_CHARACTERS' => $_ARRAYLANG['TXT_LOGIN_PASSWORD_MINIMAL_CHARACTERS'], 'TXT_LOGIN_SET_PASSWORD_TEXT' => $_ARRAYLANG['TXT_LOGIN_SET_PASSWORD_TEXT'], 'TXT_LOGIN_SET_NEW_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_SET_NEW_PASSWORD'])); $this->objTemplate->parse('login_reset_password'); } }
/** * Returns the HTML code for options of two separate menus of available * and assigned ShopCategories. * * The <select> tag pair is not included, nor the option for the root * ShopCategory. * Includes all ShopCategories in one list or the other. * @param string $assigned_category_ids An optional comma separated * list of ShopCategory IDs assigned to a * Product * @return string The HTML code with all <option> tags, * or the empty string on failure. * @static * @author Reto Kohli <*****@*****.**> */ static function getAssignedShopCategoriesMenuoptions($assigned_category_ids = null) { //DBG::log("Getting menuoptions for Category IDs $assigned_category_ids"); self::buildTreeArray(true, false, false, 0, 0, 0); $strOptionsAssigned = ''; $strOptionsAvailable = ''; foreach (self::$arrCategory as $arrCategory) { $level = $arrCategory['level']; $id = $arrCategory['id']; $name = $arrCategory['name']; $option = '<option value="' . $id . '">' . str_repeat('...', $level) . contrexx_raw2xhtml($name) . "</option>\n"; if (preg_match('/(?:^|,)' . $id . '(?:,|$)/', $assigned_category_ids)) { //DBG::log("Assigned: $id"); $strOptionsAssigned .= $option; } else { //DBG::log("Available: $id"); $strOptionsAvailable .= $option; } } return array('assigned' => $strOptionsAssigned, 'available' => $strOptionsAvailable); }
/** * Load the requested event by id * * @param integer $eventId Event Id * @param integer $eventStartDate Event start date * @param integer $langId Language id * * @return null */ function get($eventId, $eventStartDate = null, $langId = null) { global $objDatabase, $_ARRAYLANG, $_LANGID, $objInit; parent::getSettings(); if ($objInit->mode == 'backend' || $langId == null) { $lang_where = "AND field.lang_id = '" . intval($_LANGID) . "' "; } else { $lang_where = "AND field.lang_id = '" . intval($langId) . "' "; } $query = "SELECT event.id AS id,\n event.type AS type,\n event.startdate AS startdate,\n event.enddate AS enddate,\n event.use_custom_date_display AS useCustomDateDisplay,\n event.showStartDateList AS showStartDateList,\n event.showEndDateList AS showEndDateList,\n event.showStartTimeList AS showStartTimeList,\n event.showEndTimeList AS showEndTimeList,\n event.showTimeTypeList AS showTimeTypeList,\n event.showStartDateDetail AS showStartDateDetail,\n event.showEndDateDetail AS showEndDateDetail,\n event.showStartTimeDetail AS showStartTimeDetail,\n event.showEndTimeDetail AS showEndTimeDetail,\n event.showTimeTypeDetail AS showTimeTypeDetail,\n event.access AS access,\n event.price AS price,\n event.link AS link,\n event.pic AS pic,\n event.attach AS attach,\n event.place_mediadir_id AS place_mediadir_id,\n event.host_mediadir_id AS host_mediadir_id,\n event.priority AS priority,\n event.catid AS catid,\n event.status AS status,\n event.author AS author,\n event.confirmed AS confirmed,\n event.show_in AS show_in,\n event.google AS google,\n event.invited_groups AS invited_groups,\n event.invited_mails AS invited_mails,\n event.invitation_sent AS invitation_sent,\n event.invitation_email_template AS invitation_email_template,\n event.registration AS registration,\n event.registration_form AS registration_form,\n event.registration_num AS registration_num,\n event.registration_notification AS registration_notification,\n event.email_template AS email_template,\n event.ticket_sales AS ticket_sales,\n event.num_seating AS num_seating,\n event.series_status AS series_status,\n event.series_type AS series_type,\n event.series_pattern_count AS series_pattern_count,\n event.series_pattern_weekday AS series_pattern_weekday,\n event.series_pattern_day AS series_pattern_day,\n event.series_pattern_week AS series_pattern_week,\n event.series_pattern_month AS series_pattern_month,\n event.series_pattern_type AS series_pattern_type,\n event.series_pattern_dourance_type AS series_pattern_dourance_type,\n event.series_pattern_end AS series_pattern_end,\n event.series_pattern_end_date AS series_pattern_end_date,\n event.series_pattern_begin AS series_pattern_begin,\n event.series_pattern_exceptions AS series_pattern_exceptions,\n event.all_day,\n event.location_type AS location_type,\n event.place AS place, \n event.place_street AS place_street, \n event.place_zip AS place_zip, \n event.place_city AS place_city, \n event.place_country AS place_country, \n event.place_link AS place_link, \n event.place_map AS place_map, \n event.host_type AS host_type,\n event.org_name AS org_name, \n event.org_street AS org_street, \n event.org_zip AS org_zip, \n event.org_city AS org_city, \n event.org_country AS org_country, \n event.org_link AS org_link, \n event.org_email AS org_email, \n field.title AS title,\n field.description AS description,\n event.place AS place\n FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_event AS event,\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_event_field AS field\n WHERE event.id = '" . intval($eventId) . "' \n AND (event.id = field.event_id " . $lang_where . ") \n LIMIT 1"; $objResult = $objDatabase->Execute($query); if ($this->arrSettings['showEventsOnlyInActiveLanguage'] == 2) { if ($objResult->RecordCount() == 0) { if ($langId == null) { $langId = 1; } else { $langId++; } if ($langId <= 99) { self::get($eventId, $eventStartDate, $langId); } } else { if ($langId == null) { $langId = $_LANGID; } } } else { $langId = $_LANGID; } if ($objResult !== false) { if (!empty($objResult->fields['title'])) { $this->id = intval($eventId); $this->type = intval($objResult->fields['type']); $this->title = htmlentities(stripslashes($objResult->fields['title']), ENT_QUOTES, CONTREXX_CHARSET); $this->pic = htmlentities($objResult->fields['pic'], ENT_QUOTES, CONTREXX_CHARSET); $this->attach = htmlentities($objResult->fields['attach'], ENT_QUOTES, CONTREXX_CHARSET); $this->author = htmlentities($objResult->fields['author'], ENT_QUOTES, CONTREXX_CHARSET); $this->startDate = strtotime($objResult->fields['startdate']); $this->endDate = strtotime($objResult->fields['enddate']); $this->useCustomDateDisplay = intval($objResult->fields['useCustomDateDisplay']); $this->showStartDateList = intval($objResult->fields['showStartDateList']); $this->showEndDateList = intval($objResult->fields['showEndDateList']); $this->showStartTimeList = intval($objResult->fields['showStartTimeList']); $this->showEndTimeList = intval($objResult->fields['showEndTimeList']); $this->showTimeTypeList = intval($objResult->fields['showTimeTypeList']); $this->showStartDateDetail = intval($objResult->fields['showStartDateDetail']); $this->showEndDateDetail = intval($objResult->fields['showEndDateDetail']); $this->showStartTimeDetail = intval($objResult->fields['showStartTimeDetail']); $this->showEndTimeDetail = intval($objResult->fields['showEndTimeDetail']); $this->showTimeTypeDetail = intval($objResult->fields['showTimeTypeDetail']); $this->all_day = intval($objResult->fields['all_day']); $this->confirmed = intval($objResult->fields['confirmed']); $this->invitationSent = intval($objResult->fields['invitation_sent']); $this->invitationTemplate = json_decode($objResult->fields['invitation_email_template'], true); $this->access = intval($objResult->fields['access']); $this->price = intval($objResult->fields['price']); $this->link = htmlentities(stripslashes($objResult->fields['link']), ENT_QUOTES, CONTREXX_CHARSET); $this->priority = intval($objResult->fields['priority']); $this->description = $objResult->fields['description']; $this->locationType = (int) $objResult->fields['location_type']; $this->place_mediadir_id = (int) $objResult->fields['place_mediadir_id']; $this->place = htmlentities(stripslashes($objResult->fields['place']), ENT_QUOTES, CONTREXX_CHARSET); $this->place_street = htmlentities(stripslashes($objResult->fields['place_street']), ENT_QUOTES, CONTREXX_CHARSET); $this->place_zip = htmlentities(stripslashes($objResult->fields['place_zip']), ENT_QUOTES, CONTREXX_CHARSET); $this->place_city = htmlentities(stripslashes($objResult->fields['place_city']), ENT_QUOTES, CONTREXX_CHARSET); $this->place_country = htmlentities(stripslashes($objResult->fields['place_country']), ENT_QUOTES, CONTREXX_CHARSET); $this->place_link = contrexx_raw2xhtml($objResult->fields['place_link']); $this->place_map = contrexx_raw2xhtml($objResult->fields['place_map']); $this->hostType = (int) $objResult->fields['host_type']; $this->host_mediadir_id = (int) $objResult->fields['host_mediadir_id']; $this->org_name = contrexx_raw2xhtml($objResult->fields['org_name']); $this->org_street = contrexx_raw2xhtml($objResult->fields['org_street']); $this->org_zip = contrexx_raw2xhtml($objResult->fields['org_zip']); $this->org_city = contrexx_raw2xhtml($objResult->fields['org_city']); $this->org_country = contrexx_raw2xhtml($objResult->fields['org_country']); $this->org_link = contrexx_raw2xhtml($objResult->fields['org_link']); $this->org_email = contrexx_raw2xhtml($objResult->fields['org_email']); $this->showIn = htmlentities($objResult->fields['show_in'], ENT_QUOTES, CONTREXX_CHARSET); $this->availableLang = intval($langId); $this->status = intval($objResult->fields['status']); $this->catId = intval($objResult->fields['catid']); $this->map = intval($objResult->fields['google']); $this->seriesStatus = intval($objResult->fields['series_status']); if ($this->seriesStatus == 1) { $this->seriesData['seriesPatternCount'] = intval($objResult->fields['series_pattern_count']); $this->seriesData['seriesType'] = intval($objResult->fields['series_type']); $this->seriesData['seriesPatternCount'] = intval($objResult->fields['series_pattern_count']); $this->seriesData['seriesPatternWeekday'] = htmlentities($objResult->fields['series_pattern_weekday'], ENT_QUOTES, CONTREXX_CHARSET); $this->seriesData['seriesPatternDay'] = intval($objResult->fields['series_pattern_day']); $this->seriesData['seriesPatternWeek'] = intval($objResult->fields['series_pattern_week']); $this->seriesData['seriesPatternMonth'] = intval($objResult->fields['series_pattern_month']); $this->seriesData['seriesPatternType'] = intval($objResult->fields['series_pattern_type']); $this->seriesData['seriesPatternDouranceType'] = intval($objResult->fields['series_pattern_dourance_type']); $this->seriesData['seriesPatternEnd'] = intval($objResult->fields['series_pattern_end']); $this->seriesData['seriesPatternEndDate'] = strtotime($objResult->fields['series_pattern_end_date']); $this->seriesData['seriesPatternBegin'] = intval($objResult->fields['series_pattern_begin']); $this->seriesData['seriesPatternExceptions'] = array_map('strtotime', (array) explode(",", $objResult->fields['series_pattern_exceptions'])); } $this->invitedGroups = explode(',', $objResult->fields['invited_groups']); $this->invitedMails = htmlentities($objResult->fields['invited_mails'], ENT_QUOTES, CONTREXX_CHARSET); $this->registration = intval($objResult->fields['registration']); $this->registrationForm = intval($objResult->fields['registration_form']); $this->numSubscriber = intval($objResult->fields['registration_num']); $this->notificationTo = htmlentities($objResult->fields['registration_notification'], ENT_QUOTES, CONTREXX_CHARSET); $this->emailTemplate = json_decode($objResult->fields['email_template'], true); $this->ticketSales = intval($objResult->fields['ticket_sales']); $this->arrNumSeating = json_decode($objResult->fields['num_seating']); $this->numSeating = !empty($this->arrNumSeating) ? implode(',', $this->arrNumSeating) : ''; $queryCountRegistration = "SELECT \n COUNT(1) AS numSubscriber, \n `type` \n FROM \n `" . DBPREFIX . "module_" . $this->moduleTablePrefix . "_registration`\n WHERE \n `event_id` = " . (int) $eventId . " \n GROUP BY \n `type`"; $objCountRegistration = $objDatabase->Execute($queryCountRegistration); if ($objCountRegistration) { while (!$objCountRegistration->EOF) { switch ($objCountRegistration->fields['type']) { case 1: $this->registrationCount = (int) $objCountRegistration->fields['numSubscriber']; break; case 2: $this->waitlistCount = (int) $objCountRegistration->fields['numSubscriber']; break; case 0: $this->cancellationCount = (int) $objCountRegistration->fields['numSubscriber']; break; } $objCountRegistration->MoveNext(); } } $queryRegistrations = ' SELECT `v`.`value` AS `reserved_seating` FROM `' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field_value` AS `v` INNER JOIN `' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration` AS `r` ON `v`.`reg_id` = `r`.`id` INNER JOIN `' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field` AS `f` ON `v`.`field_id` = `f`.`id` WHERE `r`.`event_id` = ' . intval($eventId) . ' AND `r`.`type` = 1 AND `f`.`type` = "seating" '; $objResultRegistrations = $objDatabase->Execute($queryRegistrations); $reservedSeating = 0; if ($objResultRegistrations !== false) { while (!$objResultRegistrations->EOF) { $reservedSeating += intval($objResultRegistrations->fields['reserved_seating']); $objResultRegistrations->MoveNext(); } } $freePlaces = intval($this->numSubscriber - $reservedSeating); $this->freePlaces = $freePlaces < 0 ? 0 : $freePlaces; $queryHosts = ' SELECT host_id FROM ' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_rel_event_host WHERE event_id = ' . intval($eventId); $objResultHosts = $objDatabase->Execute($queryHosts); if ($objResultHosts !== false) { while (!$objResultHosts->EOF) { $this->relatedHosts[] = intval($objResultHosts->fields['host_id']); $objResultHosts->MoveNext(); } } self::getData(); } } }
/** * Show the delete confirmation form view * * @param array $file file data (source, filename, id, check) */ protected function showDeleteConfirmation($file) { global $_ARRAYLANG; $this->objTemplate->setVariable(array("FORM_ACTION" => (string) clone \Env::get("Resolver")->getUrl(), "FORM_METHOD" => "POST", 'FILESHARING_FILE_NAME' => contrexx_raw2xhtml($file['file']), 'TXT_FILESHARING_FILE_NAME' => $_ARRAYLANG['TXT_FILESHARING_FILE_NAME'], 'TXT_FILESHARING_CONFIRM_DELETE' => $_ARRAYLANG['TXT_FILESHARING_CONFIRM_DELETE'])); if ($this->objTemplate->blockExists('confirm_delete')) { $this->objTemplate->parse("confirm_delete"); } if ($this->objTemplate->blockExists('upload_form')) { $this->objTemplate->hideBlock("upload_form"); } if ($this->objTemplate->blockExists('uploaded')) { $this->objTemplate->hideBlock("uploaded"); } }
/** * Unescapes data from any request and encodes it for use with [X]HTML * * Apply to any string or array taken from a get or post request, or from a * cookie before writing it to the HTML response stream. * @param mixed $input The input string or array * @return mixed The unescaped HTML encoded string or array */ function contrexx_input2xhtml($input) { return contrexx_raw2xhtml(contrexx_input2raw($input)); }
/** * Add / Edit Event * * @param integer $eventId Event id * * @return null */ function modifyEvent($eventId = null) { global $_ARRAYLANG, $_CORELANG, $_LANGID; \JS::activate('cx'); \JS::activate('jqueryui'); \JS::registerJS('modules/Calendar/View/Script/Frontend.js'); $this->getFrontendLanguages(); $this->getSettings(); $this->_objTpl->setTemplate($this->pageContent, true, true); $showFrom = true; $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent(); $isEventLoaded = false; if (isset($_POST['submitFormModifyEvent'])) { $arrData = array(); $arrData = $_POST; $arrData['access'] = 0; $arrData['priority'] = 3; if ($objEvent->save($arrData)) { $showFrom = false; $this->_objTpl->hideBlock('calendarEventModifyForm'); $this->_objTpl->touchBlock('calendarEventOkMessage'); // refresh event data after save $objEvent->get($eventId); $objEvent->getData(); $isEventLoaded = true; $objMailManager = new \Cx\Modules\Calendar\Controller\CalendarMailManager(); $objMailManager->sendMail($objEvent, \Cx\Modules\Calendar\Controller\CalendarMailManager::MAIL_NOTFY_NEW_APP); } else { $this->_objTpl->touchBlock('calendarEventErrMessage'); } } if ($eventId && !$isEventLoaded) { $objEvent->get($eventId); $objEvent->getData(); } $dateFormat = $this->getDateFormat(1); $locationType = $this->arrSettings['placeData'] == 3 ? $eventId != 0 ? $objEvent->locationType : 1 : $this->arrSettings['placeData']; $hostType = $this->arrSettings['placeDataHost'] == 3 ? $eventId != 0 ? $objEvent->hostType : 1 : $this->arrSettings['placeDataHost']; \ContrexxJavascript::getInstance()->setVariable(array('language_id' => \FWLanguage::getDefaultLangId(), 'active_lang' => implode(',', \FWLanguage::getIdArray())), 'calendar'); $javascript = <<<EOF <script language="JavaScript" type="text/javascript"> var defaultLang = cx.variables.get('language_id', 'calendar'); var activeLang = [cx.variables.get('active_lang', 'calendar')]; cx.ready(function() { var options = { dateFormat: '{$dateFormat}', timeFormat: 'hh:mm', showSecond: false, onSelect: function(dateText, inst){ var startDate = cx.jQuery( ".startDate" ).datetimepicker("getDate"); var endDate = cx.jQuery( ".endDate" ).datetimepicker("getDate"); if ( cx.jQuery( this )[0].id == 'startDate' ) { var prevStartDate = cx.jQuery( ".startDate" ).data('prevDate'); if (cx.jQuery(".all_day").is(':checked')) { prevStartDate.setHours(0, 0, 0); startDate.setHours(0, 0, 0); endDate.setHours(0, 0, 0); } if (prevStartDate.getTime() != startDate.getTime()) { var timeDiff = Math.abs(endDate.getTime() - prevStartDate.getTime()); endDate = new Date(startDate.getTime() + timeDiff); cx.jQuery( ".endDate" ).datetimepicker('setDate', endDate); } } else if (startDate.getTime() > endDate.getTime()) { endDate = new Date(startDate.getTime() + (30*60*1000)); cx.jQuery(".endDate").datetimepicker('setDate', endDate); } cx.jQuery( ".startDate" ).data('prevDate', cx.jQuery(".startDate").datetimepicker("getDate")); cx.jQuery( ".endDate" ).data('prevDate', cx.jQuery(".endDate").datetimepicker("getDate")); cx.jQuery( this ).datetimepicker('refresh'); } }; cx.jQuery('input[name=startDate]') .datetimepicker(options) .data('prevDate', cx.jQuery(".startDate").datetimepicker("getDate")); cx.jQuery('input[name=endDate]') .datetimepicker(options) .data('prevDate', cx.jQuery(".endDate").datetimepicker("getDate")); if ( \$J(".all_day").is(':checked') ) { modifyEvent._handleAllDayEvent( \$J(".all_day") ); } showOrHidePlaceFields('{$locationType}', 'place'); showOrHidePlaceFields('{$hostType}', 'host'); }); </script> EOF; if ($showFrom) { try { $javascript .= <<<UPLOADER {$this->getUploaderCode(self::PICTURE_FIELD_KEY, 'pictureUpload')} {$this->getUploaderCode(self::MAP_FIELD_KEY, 'mapUpload')} {$this->getUploaderCode(self::ATTACHMENT_FIELD_KEY, 'attachmentUpload', 'uploadFinished', false)} UPLOADER; } catch (Exception $e) { \DBG::msg("Error in initializing uploader"); } } $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_EVENT_LANG_ID' => $_LANGID, $this->moduleLangVar . '_JAVASCRIPT' => $javascript)); $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true); $objCategoryManager->getCategoryList(); if ($eventId) { $startDate = $objEvent->startDate; $endDate = $objEvent->endDate; } else { $startDate = new \DateTime(); $endDate = new \DateTime(); } $eventStartDate = $this->format2userDateTime($startDate); $eventEndDate = $this->format2userDateTime($endDate); $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_EVENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_DETAILS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DETAILS'], 'TXT_' . $this->moduleLangVar . '_SAVE' => $_ARRAYLANG['TXT_CALENDAR_SAVE'], 'TXT_' . $this->moduleLangVar . '_EVENT_START' => $_ARRAYLANG['TXT_CALENDAR_START'], 'TXT_' . $this->moduleLangVar . '_EVENT_END' => $_ARRAYLANG['TXT_CALENDAR_END'], 'TXT_' . $this->moduleLangVar . '_EVENT_TITLE' => $_ARRAYLANG['TXT_CALENDAR_TITLE'], 'TXT_' . $this->moduleLangVar . '_EXPAND' => $_ARRAYLANG['TXT_CALENDAR_EXPAND'], 'TXT_' . $this->moduleLangVar . '_MINIMIZE' => $_ARRAYLANG['TXT_CALENDAR_MINIMIZE'], 'TXT_' . $this->moduleLangVar . '_EVENT_PLACE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PLACE'], 'TXT_' . $this->moduleLangVar . '_EVENT_STREET' => $_ARRAYLANG['TXT_CALENDAR_EVENT_STREET'], 'TXT_' . $this->moduleLangVar . '_EVENT_ZIP' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ZIP'], 'TXT_' . $this->moduleLangVar . '_EVENT_CITY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_CITY'], 'TXT_' . $this->moduleLangVar . '_EVENT_COUNTRY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_COUNTRY'], 'TXT_' . $this->moduleLangVar . '_EVENT_WEBSITE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_WEBSITE'], 'TXT_' . $this->moduleLangVar . '_EVENT_PHONE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PHONE'], 'TXT_' . $this->moduleLangVar . '_EVENT_MAP' => $_ARRAYLANG['TXT_CALENDAR_EVENT_MAP'], 'TXT_' . $this->moduleLangVar . '_EVENT_USE_GOOGLEMAPS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_USE_GOOGLEMAPS'], 'TXT_' . $this->moduleLangVar . '_EVENT_LINK' => $_ARRAYLANG['TXT_CALENDAR_EVENT_LINK'], 'TXT_' . $this->moduleLangVar . '_EVENT_EMAIL' => $_ARRAYLANG['TXT_CALENDAR_EVENT_EMAIL'], 'TXT_' . $this->moduleLangVar . '_EVENT_PICTURE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PICTURE'], 'TXT_' . $this->moduleLangVar . '_EVENT_ATTACHMENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ATTACHMENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_CATEGORY' => $_ARRAYLANG['TXT_CALENDAR_CAT'], 'TXT_' . $this->moduleLangVar . '_EVENT_DESCRIPTION' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DESCRIPTION'], 'TXT_' . $this->moduleLangVar . '_PLEASE_CHECK_INPUT' => $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHECK_INPUT'], 'TXT_' . $this->moduleLangVar . '_EVENT_HOST' => $_ARRAYLANG['TXT_CALENDAR_EVENT_HOST'], 'TXT_' . $this->moduleLangVar . '_EVENT_NAME' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NAME'], 'TXT_' . $this->moduleLangVar . '_EVENT_ALL_DAY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ALL_DAY'], 'TXT_' . $this->moduleLangVar . '_LANGUAGE' => $_ARRAYLANG['TXT_CALENDAR_LANG'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE_EVENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_EVENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE_REDIRECT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_REDIRECT'], 'TXT_' . $this->moduleLangVar . '_EVENT_DESCRIPTION' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DESCRIPTION'], 'TXT_' . $this->moduleLangVar . '_EVENT_REDIRECT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_REDIRECT'], 'TXT_' . $this->moduleLangVar . '_PLACE_DATA_DEFAULT' => $_ARRAYLANG['TXT_CALENDAR_PLACE_DATA_DEFAULT'], 'TXT_' . $this->moduleLangVar . '_PLACE_DATA_FROM_MEDIADIR' => $_ARRAYLANG['TXT_CALENDAR_PLACE_DATA_FROM_MEDIADIR'], 'TXT_' . $this->moduleLangVar . '_PREV' => $_ARRAYLANG['TXT_CALENDAR_PREV'], 'TXT_' . $this->moduleLangVar . '_NEXT' => $_ARRAYLANG['TXT_CALENDAR_NEXT'], 'TXT_' . $this->moduleLangVar . '_MORE' => $_ARRAYLANG['TXT_CALENDAR_MORE'], 'TXT_' . $this->moduleLangVar . '_MINIMIZE' => $_ARRAYLANG['TXT_CALENDAR_MINIMIZE'], $this->moduleLangVar . '_EVENT_TYPE_EVENT' => $eventId != 0 ? $objEvent->type == 0 ? 'selected="selected"' : '' : '', $this->moduleLangVar . '_EVENT_TYPE_REDIRECT' => $eventId != 0 ? $objEvent->type == 1 ? 'selected="selected"' : '' : '', $this->moduleLangVar . '_EVENT_START_DATE' => $eventStartDate, $this->moduleLangVar . '_EVENT_END_DATE' => $eventEndDate, $this->moduleLangVar . '_EVENT_PICTURE' => $objEvent->pic, $this->moduleLangVar . '_EVENT_PICTURE_THUMB' => $objEvent->pic != '' ? '<img src="' . $objEvent->pic . '.thumb" alt="' . $objEvent->title . '" title="' . $objEvent->title . '" />' : '', $this->moduleLangVar . '_EVENT_ATTACHMENT' => $objEvent->attach, $this->moduleLangVar . '_EVENT_CATEGORIES' => $objCategoryManager->getCategoryDropdown(intval($objEvent->catId), 2), $this->moduleLangVar . '_EVENT_LINK' => $objEvent->link, $this->moduleLangVar . '_EVENT_PLACE' => $objEvent->place, $this->moduleLangVar . '_EVENT_STREET' => $objEvent->place_street, $this->moduleLangVar . '_EVENT_ZIP' => $objEvent->place_zip, $this->moduleLangVar . '_EVENT_CITY' => $objEvent->place_city, $this->moduleLangVar . '_EVENT_COUNTRY' => $objEvent->place_country, $this->moduleLangVar . '_EVENT_PLACE_WEBSITE' => $objEvent->place_website, $this->moduleLangVar . '_EVENT_PLACE_MAP' => $objEvent->place_map, $this->moduleLangVar . '_EVENT_PLACE_LINK' => $objEvent->place_link, $this->moduleLangVar . '_EVENT_PLACE_PHONE' => $objEvent->place_phone, $this->moduleLangVar . '_EVENT_MAP' => $objEvent->google == 1 ? 'checked="checked"' : '', $this->moduleLangVar . '_EVENT_HOST' => $objEvent->org_name, $this->moduleLangVar . '_EVENT_HOST_ADDRESS' => $objEvent->org_street, $this->moduleLangVar . '_EVENT_HOST_ZIP' => $objEvent->org_zip, $this->moduleLangVar . '_EVENT_HOST_CITY' => $objEvent->org_city, $this->moduleLangVar . '_EVENT_HOST_COUNTRY' => $objEvent->org_country, $this->moduleLangVar . '_EVENT_HOST_WEBSITE' => $objEvent->org_website, $this->moduleLangVar . '_EVENT_HOST_LINK' => $objEvent->org_link, $this->moduleLangVar . '_EVENT_HOST_PHONE' => $objEvent->org_phone, $this->moduleLangVar . '_EVENT_HOST_EMAIL' => $objEvent->org_email, $this->moduleLangVar . '_EVENT_LOCATION_TYPE_MANUAL' => $eventId != 0 ? $objEvent->locationType == 1 ? "checked='checked'" : '' : "checked='checked'", $this->moduleLangVar . '_EVENT_LOCATION_TYPE_MEDIADIR' => $eventId != 0 ? $objEvent->locationType == 2 ? "checked='checked'" : '' : "", $this->moduleLangVar . '_EVENT_HOST_TYPE_MANUAL' => $eventId != 0 ? $objEvent->hostType == 1 ? "checked='checked'" : '' : "checked='checked'", $this->moduleLangVar . '_EVENT_HOST_TYPE_MEDIADIR' => $eventId != 0 ? $objEvent->hostType == 2 ? "checked='checked'" : '' : "", $this->moduleLangVar . '_EVENT_ID' => $eventId, $this->moduleLangVar . '_EVENT_ALL_DAY' => $eventId != 0 && $objEvent->all_day ? 'checked="checked"' : '', $this->moduleLangVar . '_HIDE_ON_SINGLE_LANG' => count($this->arrFrontendLanguages) == 1 ? "display: none;" : "")); $multiLingualFields = array('place', 'place_city', 'place_country', 'org_name', 'org_city', 'org_country'); $isOneActiveLanguage = count($this->arrFrontendLanguages) == 1; foreach ($multiLingualFields as $inputField) { if ($isOneActiveLanguage) { $this->_objTpl->hideBlock('calendar_event_' . $inputField . '_expand'); } else { $this->_objTpl->touchBlock('calendar_event_' . $inputField . '_expand'); } } foreach ($this->arrFrontendLanguages as $arrLang) { //parse globals $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_EVENT_LANG_SHORTCUT' => $arrLang['lang'], $this->moduleLangVar . '_EVENT_LANG_ID' => $arrLang['id'], 'TXT_' . $this->moduleLangVar . '_EVENT_LANG_NAME' => $arrLang['name'])); //parse "show in" checkboxes $arrShowIn = explode(",", $objEvent->showIn); $langChecked = false; if ($eventId != 0) { $langChecked = in_array($arrLang['id'], $arrShowIn) ? true : false; } else { $langChecked = $arrLang['is_default'] == 'true'; } //parse eventTabMenuDescTab $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_TAB_DISPLAY' => $langChecked ? 'block' : 'none', $this->moduleLangVar . '_EVENT_TAB_CLASS' => '')); $this->_objTpl->parse('eventTabMenuDescTab'); //parse eventDescTab $eventTitle = !empty($objEvent->arrData['title'][$arrLang['id']]) ? $objEvent->arrData['title'][$arrLang['id']] : (!empty($objEvent->arrData['redirect'][$_LANGID]) ? $objEvent->arrData['redirect'][$_LANGID] : ''); $eventDescription = !empty($objEvent->arrData['description'][$arrLang['id']]) ? $objEvent->arrData['description'][$arrLang['id']] : ''; $eventRedirect = !empty($objEvent->arrData['redirect'][$arrLang['id']]) ? $objEvent->arrData['redirect'][$arrLang['id']] : (!empty($objEvent->arrData['redirect'][$_LANGID]) ? $objEvent->arrData['redirect'][$_LANGID] : ''); $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_TAB_DISPLAY' => $langChecked ? 'block' : 'none', $this->moduleLangVar . '_EVENT_TITLE' => contrexx_raw2xhtml($eventTitle), $this->moduleLangVar . '_EVENT_DESCRIPTION' => new \Cx\Core\Wysiwyg\Wysiwyg("description[{$arrLang['id']}]", contrexx_raw2xhtml($eventDescription), $eventId != 0 ? 'small' : 'bbcode'), $this->moduleLangVar . '_EVENT_REDIRECT' => contrexx_raw2xhtml($eventRedirect), $this->moduleLangVar . '_EVENT_TYPE_EVENT_DISPLAY' => $objEvent->type == 0 ? 'block' : 'none', $this->moduleLangVar . '_EVENT_TYPE_REDIRECT_DISPLAY' => $objEvent->type == 1 ? 'block' : 'none')); $this->_objTpl->parse('eventDescTab'); //parse eventLingualFields foreach ($multiLingualFields as $inputField) { $this->_objTpl->setVariable($this->moduleLangVar . '_EVENT_' . strtoupper($inputField) . '_DEFAULT', $eventId != 0 ? $objEvent->{$inputField} : ''); $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_VALUE' => !empty($objEvent->arrData[$inputField][$arrLang['id']]) ? $objEvent->arrData[$inputField][$arrLang['id']] : ($eventId != 0 ? $objEvent->{$inputField} : ''))); $this->_objTpl->parse('calendar_event_' . $inputField); } $langChecked = $langChecked ? 'checked="checked"' : ''; $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_LANG_CHECKED' => $langChecked)); $this->_objTpl->parse('eventShowIn'); } //parse placeSelect if ((int) $this->arrSettings['placeData'] > 1) { $objMediadirEntries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry('MediaDir'); $objMediadirEntries->getEntries(null, null, null, null, null, null, true, 0, 'n', null, null, intval($this->arrSettings['placeDataForm'])); $placeOptions = '<option value="">' . $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHOOSE'] . '</option>'; foreach ($objMediadirEntries->arrEntries as $key => $arrEntry) { $selectedPlace = $arrEntry['entryId'] == $objEvent->place_mediadir_id ? 'selected="selected"' : ''; $placeOptions .= '<option ' . $selectedPlace . ' value="' . $arrEntry['entryId'] . '">' . $arrEntry['entryFields'][0] . '</option>'; } $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_PLACE_OPTIONS' => $placeOptions)); $this->_objTpl->parse('eventPlaceSelect'); if ((int) $this->arrSettings['placeData'] == 2) { $this->_objTpl->hideBlock('eventPlaceInput'); $this->_objTpl->hideBlock('eventPlaceTypeRadio'); } else { $this->_objTpl->touchBlock('eventPlaceInput'); $this->_objTpl->touchBlock('eventPlaceTypeRadio'); } } else { $this->_objTpl->touchBlock('eventPlaceInput'); $this->_objTpl->hideBlock('eventPlaceSelect'); $this->_objTpl->hideBlock('eventPlaceTypeRadio'); } //parse placeHostSelect if ((int) $this->arrSettings['placeDataHost'] > 1) { $objMediadirEntries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry('MediaDir'); $objMediadirEntries->getEntries(null, null, null, null, null, null, true, 0, 'n', null, null, intval($this->arrSettings['placeDataHostForm'])); $placeOptions = '<option value="">' . $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHOOSE'] . '</option>'; foreach ($objMediadirEntries->arrEntries as $key => $arrEntry) { $selectedPlace = $arrEntry['entryId'] == $objEvent->host_mediadir_id ? 'selected="selected"' : ''; $placeOptions .= '<option ' . $selectedPlace . ' value="' . $arrEntry['entryId'] . '">' . $arrEntry['entryFields'][0] . '</option>'; } $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_PLACE_OPTIONS' => $placeOptions)); $this->_objTpl->parse('eventHostSelect'); if ((int) $this->arrSettings['placeDataHost'] == 2) { $this->_objTpl->hideBlock('eventHostInput'); $this->_objTpl->hideBlock('eventHostTypeRadio'); } else { $this->_objTpl->touchBlock('eventHostInput'); $this->_objTpl->touchBlock('eventHostTypeRadio'); } } else { $this->_objTpl->touchBlock('eventHostInput'); $this->_objTpl->hideBlock('eventHostSelect'); $this->_objTpl->hideBlock('eventHostTypeRadio'); } }
/** * Shows the feedback message * * This parsed the feedback message and outputs it * @access private * @param array Details of the requested form * @see _getError(), \Cx\Core\Html\Sigma::setVariable */ function _showFeedback($arrFormData) { global $_ARRAYLANG; $feedback = $arrFormData['feedback']; $arrMatch = array(); if (isset($arrFormData['fields']) && preg_match_all('#\\[\\[(' . implode('|', array_unique(array_merge($this->arrFormFields, array_keys($arrFormData['data'])))) . ')\\]\\]#', $feedback, $arrMatch)) { foreach ($arrFormData['fields'] as $id => $field) { if (in_array($field['lang'][FRONTEND_LANG_ID]['name'], $arrMatch[1])) { switch ($field['type']) { case 'checkbox': $value = isset($arrFormData['data'][$id]) ? $_ARRAYLANG['TXT_CONTACT_YES'] : $_ARRAYLANG['TXT_CONTACT_NO']; break; case 'textarea': $value = isset($arrFormData['data'][$id]) ? nl2br(contrexx_raw2xhtml($arrFormData['data'][$id])) : ''; break; default: $value = isset($arrFormData['data'][$id]) ? contrexx_raw2xhtml($arrFormData['data'][$id]) : ''; break; } $feedback = str_replace('[[' . contrexx_raw2xhtml($field['lang'][FRONTEND_LANG_ID]['name']) . ']]', $value, $feedback); } } } $this->objTemplate->setVariable('CONTACT_FEEDBACK_TEXT', $this->_getError() . stripslashes($feedback) . '<br /><br />'); }
function listLevels($objTpl, $intView, $intLevelId = null, $arrParentIds = null, $intEntryId = null, $arrExistingBlocks = null, $strClass = null) { global $_ARRAYLANG, $_CORELANG, $objDatabase; if (!isset($arrParentIds)) { $arrLevels = $this->arrLevels; } else { $arrLevelChildren = $this->arrLevels; foreach ($arrParentIds as $key => $intParentId) { $arrLevelChildren = $arrLevelChildren[$intParentId]['levelChildren']; } $arrLevels = $arrLevelChildren; } switch ($intView) { case 1: //Backend View $expandLevel = isset($_GET['exp_level']) ? $_GET['exp_level'] : null; foreach ($arrLevels as $key => $arrLevel) { //generate space $spacer = null; $intSpacerSize = null; $intSpacerSize = count($arrParentIds) * 21; $spacer .= '<img src="../core/Core/View/Media/icons/pixel.gif" border="0" width="' . $intSpacerSize . '" height="11" alt="" />'; //check expanded categories if ($expandLevel == 'all') { $bolExpandLevel = true; } else { $this->arrExpandedLevelIds = array(); $bolExpandLevel = $this->getExpandedLevels($expandLevel, array($arrLevel)); } if (!empty($arrLevel['levelChildren'])) { if (in_array($arrLevel['levelId'], $this->arrExpandedLevelIds) && $bolExpandLevel || $expandLevel == 'all') { $strLevelIcon = '<a href="index.php?cmd=' . $this->moduleName . '&exp_level=' . $arrLevel['levelParentId'] . '"><img src="../core/Core/View/Media/icons/minuslink.gif" border="0" alt="{' . $this->moduleLangVar . '_LEVEL_NAME}" title="{' . $this->moduleLangVar . '_LEVEL_NAME}" /></a>'; } else { $strLevelIcon = '<a href="index.php?cmd=' . $this->moduleName . '&exp_level=' . $arrLevel['levelId'] . '"><img src="../core/Core/View/Media/icons/pluslink.gif" border="0" alt="{' . $this->moduleLangVar . '_LEVEL_NAME}" title="{' . $this->moduleLangVar . '_LEVEL_NAME}" /></a>'; } } else { $strLevelIcon = '<img src="../core/Core/View/Media/icons/pixel.gif" border="0" width="11" height="11" alt="{' . $this->moduleLangVar . '_LEVEL_NAME}" title="{' . $this->moduleLangVar . '_LEVEL_NAME}" />'; } //parse variables $objTpl->setVariable(array($this->moduleLangVar . '_LEVEL_ROW_CLASS' => $this->intRowCount % 2 == 0 ? 'row1' : 'row2', $this->moduleLangVar . '_LEVEL_ID' => $arrLevel['levelId'], $this->moduleLangVar . '_LEVEL_ORDER' => $arrLevel['levelOrder'], $this->moduleLangVar . '_LEVEL_NAME' => contrexx_raw2xhtml($arrLevel['levelName'][0]), $this->moduleLangVar . '_LEVEL_DESCRIPTION' => $arrLevel['levelDescription'][0], $this->moduleLangVar . '_LEVEL_PICTURE' => $arrLevel['levelPicture'], $this->moduleLangVar . '_LEVEL_NUM_ENTRIES' => $arrLevel['levelNumEntries'], $this->moduleLangVar . '_LEVEL_ICON' => $spacer . $strLevelIcon, $this->moduleLangVar . '_LEVEL_VISIBLE_STATE_ACTION' => $arrLevel['levelActive'] == 0 ? 1 : 0, $this->moduleLangVar . '_LEVEL_VISIBLE_STATE_IMG' => $arrLevel['levelActive'] == 0 ? 'off' : 'on')); $objTpl->parse($this->moduleNameLC . 'LevelsList'); $arrParentIds[] = $arrLevel['levelId']; $this->intRowCount++; //get children if (!empty($arrLevel['levelChildren'])) { if ($bolExpandLevel) { self::listLevels($objTpl, 1, $intLevelId, $arrParentIds); } } @array_pop($arrParentIds); } break; case 2: //Frontend View $intNumBlocks = count($arrExistingBlocks); $i = $intNumBlocks - 1; $strIndexHeader = ''; //set first index header if ($this->arrSettings['settingsLevelOrder'] == 2) { $strFirstIndexHeader = null; } foreach ($arrLevels as $key => $arrLevel) { if ($this->arrSettings['settingsLevelOrder'] == 2) { $strIndexHeader = strtoupper(substr($arrLevel['levelName'][0], 0, 1)); if ($strFirstIndexHeader != $strIndexHeader) { if ($i < $intNumBlocks - 1) { ++$i; } else { $i = 0; } $strIndexHeaderTag = '<span class="' . $this->moduleNameLC . 'LevelCategoryIndexHeader">' . $strIndexHeader . '</span><br />'; } else { $strIndexHeaderTag = null; } } else { if ($i < $intNumBlocks - 1) { ++$i; } else { $i = 0; } $strIndexHeaderTag = null; } //get ids if (isset($_GET['cmd'])) { $strLevelCmd = '&cmd=' . $_GET['cmd']; } else { $strLevelCmd = null; } //parse variables $objTpl->setVariable(array($this->moduleLangVar . '_CATEGORY_LEVEL_ID' => $arrLevel['levelId'], $this->moduleLangVar . '_CATEGORY_LEVEL_NAME' => contrexx_raw2xhtml($arrLevel['levelName'][0]), $this->moduleLangVar . '_CATEGORY_LEVEL_LINK' => $strIndexHeaderTag . '<a href="index.php?section=' . $this->moduleName . $strLevelCmd . '&lid=' . $arrLevel['levelId'] . '">' . contrexx_raw2xhtml($arrLevel['levelName'][0]) . '</a>', $this->moduleLangVar . '_CATEGORY_LEVEL_DESCRIPTION' => $arrLevel['levelDescription'][0], $this->moduleLangVar . '_CATEGORY_LEVEL_PICTURE' => '<img src="' . $arrLevel['levelPicture'] . '" border="0" alt="' . contrexx_raw2xhtml($arrLevel['levelName'][0]) . '" />', $this->moduleLangVar . '_CATEGORY_LEVEL_PICTURE_SOURCE' => $arrLevel['levelPicture'], $this->moduleLangVar . '_CATEGORY_LEVEL_NUM_ENTRIES' => isset($arrLevel['levelNumEntries']) ? $arrLevel['levelNumEntries'] : '')); $intBlockId = $arrExistingBlocks[$i]; $objTpl->parse($this->moduleNameLC . 'CategoriesLevels_row_' . $intBlockId); $objTpl->clearVariables(); $strFirstIndexHeader = $strIndexHeader; } break; case 3: //Dropdown Menu $strDropdownOptions = ''; foreach ($arrLevels as $key => $arrLevel) { $spacer = null; $intSpacerSize = null; if ($arrLevel['levelId'] == $intLevelId) { $strSelected = 'selected="selected"'; } else { $strSelected = ''; } //generate space $intSpacerSize = count($arrParentIds); for ($i = 0; $i < $intSpacerSize; $i++) { $spacer .= "----"; } if ($spacer != null) { $spacer .= " "; } $strDropdownOptions .= '<option value="' . $arrLevel['levelId'] . '" ' . $strSelected . ' >' . $spacer . contrexx_raw2xhtml($arrLevel['levelName'][0]) . '</option>'; if (!empty($arrLevel['levelChildren'])) { $arrParentIds[] = $arrLevel['levelId']; $strDropdownOptions .= self::listLevels($objTpl, 3, $intLevelId, $arrParentIds); @array_pop($arrParentIds); } } return $strDropdownOptions; break; case 4: //level Selector (modify view) if (!isset($this->arrSelectedLevels) && $intEntryId != null) { $this->arrSelectedLevels = array(); $objLevelSelector = $objDatabase->Execute("\n SELECT\n `level_id`\n FROM\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_entry_levels\n WHERE\n `entry_id` = '" . $intEntryId . "'\n "); if ($objLevelSelector !== false) { while (!$objLevelSelector->EOF) { $this->arrSelectedLevels[] = intval($objLevelSelector->fields['level_id']); $objLevelSelector->MoveNext(); } } } foreach ($arrLevels as $key => $arrLevel) { $spacer = null; $intSpacerSize = null; //generate space $intSpacerSize = count($arrParentIds); for ($i = 0; $i < $intSpacerSize; $i++) { $spacer .= "----"; } if ($spacer != null) { $spacer .= " "; } if (in_array($arrLevel['levelId'], $this->arrSelectedLevels)) { $this->strSelectedOptions .= '<option value="' . $arrLevel['levelId'] . '">' . $spacer . contrexx_raw2xhtml($arrLevel['levelName'][0]) . '</option>'; } else { $this->strNotSelectedOptions .= '<option value="' . $arrLevel['levelId'] . '">' . $spacer . contrexx_raw2xhtml($arrLevel['levelName'][0]) . '</option>'; } if (!empty($arrLevel['levelChildren'])) { $arrParentIds[] = $arrLevel['levelId']; self::listLevels($objTpl, 4, $intLevelId, $arrParentIds, $intEntryId); @array_pop($arrParentIds); } } $arrSelectorOptions['selected'] = $this->strSelectedOptions; $arrSelectorOptions['not_selected'] = $this->strNotSelectedOptions; return $arrSelectorOptions; break; case 5: //Frontend View Detail $objTpl->setVariable(array($this->moduleLangVar . '_CATEGORY_LEVEL_ID' => $arrLevels[$intLevelId]['levelId'], $this->moduleLangVar . '_CATEGORY_LEVEL_NAME' => contrexx_raw2xhtml($arrLevels[$intLevelId]['levelName'][0]), $this->moduleLangVar . '_CATEGORY_LEVEL_LINK' => '<a href="index.php?section=' . $this->moduleName . '&cid=' . $arrLevels[$intCategoryId]['levelId'] . '">' . contrexx_raw2xhtml($arrLevels[$intLevelId]['levelName'][0]) . '</a>', $this->moduleLangVar . '_CATEGORY_LEVEL_DESCRIPTION' => $arrLevels[$intLevelId]['levelDescription'][0], $this->moduleLangVar . '_CATEGORY_LEVEL_PICTURE' => '<img src="' . $arrLevels[$intLevelId]['levelPicture'] . '.thumb" border="0" alt="' . contrexx_raw2xhtml($arrLevels[$intLevelId]['levelName'][0]) . '" />', $this->moduleLangVar . '_CATEGORY_LEVEL_PICTURE_SOURCE' => $arrLevels[$intLevelId]['levelPicture'], $this->moduleLangVar . '_CATEGORY_LEVEL_NUM_ENTRIES' => $arrLevels[$intLevelId]['levelNumEntries'])); if (!empty($arrLevels[$intLevelId]['levelPicture']) && $this->arrSettings['settingsShowLevelImage'] == 1) { $objTpl->parse($this->moduleNameLC . 'CategoryLevelPicture'); } else { $objTpl->hideBlock($this->moduleNameLC . 'CategoryLevelPicture'); } if (!empty($arrLevels[$intLevelId]['levelDescription'][0]) && $this->arrSettings['settingsShowLevelDescription'] == 1) { $objTpl->parse($this->moduleNameLC . 'CategoryLevelDescription'); } else { $objTpl->hideBlock($this->moduleNameLC . 'CategoryLevelDescription'); } if (!empty($arrLevels)) { $objTpl->parse($this->moduleNameLC . 'CategoryLevelDetail'); } else { $objTpl->hideBlock($this->moduleNameLC . 'CategoryLevelDetail'); } break; case 6: //Frontend Tree Placeholder foreach ($arrLevels as $key => $arrLevel) { $this->arrExpandedLevelIds = array(); $bolExpandLevel = $this->getExpandedLevels($intLevelId, array($arrLevel)); $strLinkClass = $bolExpandLevel ? 'active' : 'inactive'; $strListClass = 'level_' . intval(count($arrParentIds) + 1); $this->strNavigationPlaceholder .= '<li class="' . $strListClass . '"><a href="index.php?section=' . $this->moduleName . '&lid=' . $arrLevel['levelId'] . '" class="' . $strLinkClass . '">' . contrexx_raw2xhtml($arrLevel['levelName'][0]) . '</a></li>'; $arrParentIds[] = $arrLevel['levelId']; //get children if (!empty($arrLevel['levelChildren']) && $arrLevel['levelShowSublevels'] == 1) { if ($bolExpandLevel) { self::listLevels($objTpl, 6, $intLevelId, $arrParentIds); } } if ($arrLevel['levelShowCategories'] == 1) { if ($bolExpandLevel) { $objCategories = new MediaDirectoryCategory(null, null, 0, $this->moduleName); $intCategoryId = isset($_GET['cid']) ? intval($_GET['cid']) : null; if ($_GET['lid'] == $arrLevel['levelId']) { $this->strNavigationPlaceholder .= $objCategories->listCategories($this->_objTpl, 6, $intCategoryId, null, null, null, intval(count($arrParentIds) + 1)); } } } @array_pop($arrParentIds); } return $this->strNavigationPlaceholder; break; } }
function getUsers($intEntryId = null) { global $objDatabase; // TODO: replace by FWUser::getParsedUserTitle() $strDropdownUsers = '<select name="userId"style="width: 302px">'; $objFWUser = \FWUser::getFWUserObject(); if ($objUser = $objFWUser->objUser->getUsers(null, null, null, array('username'))) { while (!$objUser->EOF) { if (intval($objUser->getID()) == intval($this->arrEntries[$intEntryId]['entryAddedBy'])) { $strSelected = 'selected="selected"'; } else { $strSelected = ''; } $strDropdownUsers .= '<option value="' . intval($objUser->getID()) . '" ' . $strSelected . ' >' . contrexx_raw2xhtml($objUser->getUsername()) . '</option>'; $objUser->next(); } } $strDropdownUsers .= '</select>'; return $strDropdownUsers; }
/** * Sets up the Payment settings view * @param \Cx\Core\Html\Sigma $objTemplate The optional Template, * by reference * @return boolean True on success, * false otherwise */ static function view_settings(&$objTemplate = null) { if (!$objTemplate) { $objTemplate = new \Cx\Core\Html\Sigma(); $objTemplate->loadTemplateFile('module_shop_settings_payment.html'); } else { $objTemplate->addBlockfile('SHOP_SETTINGS_FILE', 'settings_block', 'module_shop_settings_payment.html'); } $i = 0; foreach (Payment::getArray() as $payment_id => $arrPayment) { $zone_id = Zones::getZoneIdByPaymentId($payment_id); $objTemplate->setVariable(array('SHOP_PAYMENT_STYLE' => 'row' . (++$i % 2 + 1), 'SHOP_PAYMENT_ID' => $arrPayment['id'], 'SHOP_PAYMENT_NAME' => $arrPayment['name'], 'SHOP_PAYMENT_HANDLER_MENUOPTIONS' => PaymentProcessing::getMenuoptions($arrPayment['processor_id']), 'SHOP_PAYMENT_COST' => $arrPayment['fee'], 'SHOP_PAYMENT_COST_FREE_SUM' => $arrPayment['free_from'], 'SHOP_ZONE_SELECTION' => Zones::getMenu($zone_id, "zone_id[{$payment_id}]"), 'SHOP_PAYMENT_STATUS' => intval($arrPayment['active']) ? \Html::ATTRIBUTE_CHECKED : '')); $objTemplate->parse('shopPayment'); } $objTemplate->setVariable(array('SHOP_PAYMENT_HANDLER_MENUOPTIONS_NEW' => PaymentProcessing::getMenuoptions(-1), 'SHOP_ZONE_SELECTION_NEW' => Zones::getMenu(0, 'zone_id_new'))); // Payment Service Providers $objTemplate->setVariable(array('SHOP_PAYMILL_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYMILL_TEST_SELECTED' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_use_test_account', 'Shop') == 0 ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_PAYMILL_LIVE_SELECTED' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_use_test_account', 'Shop') == 1 ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_PAYMILL_TEST_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_test_private_key', 'Shop')), 'SHOP_PAYMILL_TEST_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_test_public_key', 'Shop')), 'SHOP_PAYMILL_LIVE_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_live_private_key', 'Shop')), 'SHOP_PAYMILL_LIVE_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_live_public_key', 'Shop')), 'SHOP_PAYMILL_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_private_key', 'Shop')), 'SHOP_PAYMILL_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_public_key', 'Shop')), 'SHOP_SAFERPAY_ID' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_id', 'Shop'), 'SHOP_SAFERPAY_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_TEST_ID' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_use_test_account', 'Shop'), 'SHOP_SAFERPAY_TEST_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_use_test_account', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_FINALIZE_PAYMENT' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_finalize_payment', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_WINDOW_MENUOPTIONS' => \Saferpay::getWindowMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('saferpay_window_option', 'Shop')), 'SHOP_PAYREXX_INSTANCE_NAME' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_instance_name', 'Shop'), 'SHOP_PAYREXX_API_SECRET' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_api_secret', 'Shop'), 'SHOP_PAYREXX_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_YELLOWPAY_SHOP_ID' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_shop_id', 'Shop'), 'SHOP_YELLOWPAY_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_YELLOWPAY_HASH_SIGNATURE_IN' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_hash_signature_in', 'Shop')), 'SHOP_YELLOWPAY_HASH_SIGNATURE_OUT' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_hash_signature_out', 'Shop')), 'SHOP_YELLOWPAY_AUTHORIZATION_TYPE_OPTIONS' => \Yellowpay::getAuthorizationMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_authorization_type', 'Shop')), 'SHOP_YELLOWPAY_USE_TESTSERVER_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_use_testserver', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_POSTFINANCE_MOBILE_WEBUSER' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_webuser', 'Shop')), 'SHOP_POSTFINANCE_MOBILE_SIGN' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_sign', 'Shop')), 'SHOP_POSTFINANCE_MOBILE_IJUSTWANTTOTEST_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_ijustwanttotest', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_POSTFINANCE_MOBILE_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_status', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_AUTHORIZATION_TYPE_OPTIONS' => \Datatrans::getReqtypeMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('datatrans_request_type', 'Shop')), 'SHOP_DATATRANS_MERCHANT_ID' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_merchant_id', 'Shop'), 'SHOP_DATATRANS_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_USE_TESTSERVER_YES_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_use_testserver', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_USE_TESTSERVER_NO_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_use_testserver', 'Shop') ? '' : \Html::ATTRIBUTE_CHECKED, 'SHOP_PAYPAL_EMAIL' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paypal_account_email', 'Shop')), 'SHOP_PAYPAL_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('paypal_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYPAL_DEFAULT_CURRENCY_MENUOPTIONS' => \PayPal::getAcceptedCurrencyCodeMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('paypal_default_currency', 'Shop')), 'SHOP_PAYMENT_LSV_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('payment_lsv_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYMENT_DEFAULT_CURRENCY' => Currency::getDefaultCurrencySymbol(), 'SHOP_CURRENCY_CODE' => Currency::getCurrencyCodeById(Currency::getDefaultCurrencyId()))); return true; }