/** * Show the last run's crawler result * * @global array $_ARRAYLANG */ public function showCrawlerResult() { global $_ARRAYLANG; \JS::activate('cx'); $objCx = \ContrexxJavascript::getInstance(); $objCx->setVariable(array('updateSuccessMsg' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_UPDATE_SUCCESS_MSG'], 'loadingLabel' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LABEL_LOADING']), 'LinkManager'); if (isset($_POST['checkAgain'])) { $this->recheckSelectedLinks(); } //show crawler results //get parameters $pos = isset($_GET['pos']) ? $_GET['pos'] : 0; //set the settings value from DB \Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config'); $pageLimit = \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager'); $parameter = './index.php?cmd=' . $this->moduleName . '&act=crawlerResult'; $this->template->setVariable('ENTRIES_PAGING', \Paging::get($parameter, $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LINKS'], $this->linkRepository->brokenLinkCount(), $pageLimit, true, $pos, 'pos')); $brokenLinks = $this->linkRepository->getBrokenLinks($pos, $pageLimit); $i = 1; $objUser = new \Cx\Core_Modules\LinkManager\Controller\User(); if ($brokenLinks && $brokenLinks->count() > 0) { foreach ($brokenLinks as $brokenLink) { $this->template->setVariable(array($this->moduleNameLang . '_BROKEN_LINK_ID' => contrexx_raw2xhtml($brokenLink->getId()), $this->moduleNameLang . '_BROKEN_LINK_IMAGE' => $brokenLink->getBrokenLinkText() == $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NO_IMAGE'] ? 'brokenImage' : 'brokenLinkImage', $this->moduleNameLang . '_BROKEN_LINK_TEXT' => $brokenLink->getBrokenLinkText(), $this->moduleNameLang . '_BROKEN_LINK_URL' => contrexx_raw2xhtml($brokenLink->getRequestedPath()), $this->moduleNameLang . '_BROKEN_LINK_REFERER' => contrexx_raw2xhtml($brokenLink->getLeadPath()) . '&pos=' . $pos . '&csrf=' . \Cx\Core\Csrf\Controller\Csrf::code(), $this->moduleNameLang . '_BROKEN_LINK_MODULE_NAME' => contrexx_raw2xhtml($brokenLink->getModuleName()), $this->moduleNameLang . '_BROKEN_LINK_ENTRY_TITLE' => contrexx_raw2xhtml($brokenLink->getEntryTitle()), $this->moduleNameLang . '_BROKEN_LINK_STATUS_CODE' => $brokenLink->getLinkStatusCode() == 0 ? $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NON_EXISTING_DOMAIN'] : contrexx_raw2xhtml($brokenLink->getLinkStatusCode()), $this->moduleNameLang . '_BROKEN_LINK_STATUS' => $brokenLink->getLinkStatus() ? $brokenLink->getLinkStatus() : 0, $this->moduleNameLang . '_BROKEN_LINK_STATUS_CHECKED' => $brokenLink->getLinkStatus() ? 'checked' : '', $this->moduleNameLang . '_BROKEN_LINK_DETECTED' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($brokenLink->getDetectedTime()), $this->moduleNameLang . '_BROKEN_LINK_UPDATED_BY' => $brokenLink->getUpdatedBy() ? contrexx_raw2xhtml($objUser->getUpdatedUserName($brokenLink->getUpdatedBy(), 0)) : '', $this->moduleNameLang . '_CRAWLER_BROKEN_LINK' => $brokenLink->getLinkRecheck() && $brokenLink->getLinkStatus() ? 'brokenLink' : '', $this->moduleNameLang . '_CRAWLER_RUN_ROW' => 'row' . (++$i % 2 + 1))); $this->template->parse($this->moduleName . 'CrawlerResultList'); } $this->template->hideBlock('LinkManagerNoCrawlerResultFound'); } else { $this->template->touchBlock('LinkManagerNoCrawlerResultFound'); } }
public function showSubscriptions() { global $_ARRAYLANG; $term = isset($_GET['term']) ? contrexx_input2raw($_GET['term']) : ''; $filterProduct = isset($_GET['filter_product']) ? contrexx_input2raw($_GET['filter_product']) : array(); $filterState = isset($_GET['filter_state']) ? contrexx_input2raw($_GET['filter_state']) : array(); if (!empty($term) || !empty($filterProduct) || !empty($filterState)) { $filter = array('term' => $term, 'filterProduct' => $filterProduct, 'filterState' => $filterState); $subscriptions = $this->subscriptionRepo->findSubscriptionsBySearchTerm($filter); } else { $subscriptions = $this->subscriptionRepo->getSubscriptionsByCriteria(null, array('s.id' => 'DESC')); } $subscriptions = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($subscriptions); // setDataType is used to make the ViewGenerator load the proper options if $subscriptions is empty $subscriptions->setDataType('Cx\\Modules\\Order\\Model\\Entity\\Subscription'); $products = \Env::get('em')->getRepository('Cx\\Modules\\Pim\\Model\\Entity\\Product')->findAll(); $this->getSearchFilterDropDown($products, $filterProduct, 'product'); $subscriptionStates = array(\Cx\Modules\Order\Model\Entity\Subscription::STATE_ACTIVE, \Cx\Modules\Order\Model\Entity\Subscription::STATE_INACTIVE, \Cx\Modules\Order\Model\Entity\Subscription::STATE_TERMINATED, \Cx\Modules\Order\Model\Entity\Subscription::STATE_CANCELLED); $this->getSearchFilterDropDown($subscriptionStates, $filterState, 'state'); $options = $this->getController('Backend')->getAllViewGeneratorOptions(); $view = new \Cx\Core\Html\Controller\ViewGenerator($subscriptions, $options); $this->template->setVariable(array('TXT_ORDER_SUBSCRIPTIONS_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_ORDER_SUBSCRIPTIONS_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_ORDER_SUBSCRIPTIONS_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SUBSCRIPTIONS_SEARCH_VALUE' => contrexx_raw2xhtml($term))); if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) { $this->template->hideBlock("subscription_filter"); } $this->template->setVariable('SUBSCRIPTIONS_CONTENT', $view->render()); }
public function showOrders() { global $_ARRAYLANG; $term = isset($_GET['filter-term']) ? contrexx_input2raw($_GET['filter-term']) : ''; $filterUserId = isset($_GET['filter-user-id']) ? contrexx_input2raw($_GET['filter-user-id']) : 0; $objFilterUser = null; if (!empty($term) || !empty($filterUserId)) { if ($filterUserId) { $objFilterUser = \FWUser::getFWUserObject()->objUser->getUser($filterUserId); } $orders = $this->orderRepository->findOrdersBySearchTerm($term, $objFilterUser); } else { $orders = $this->orderRepository->getAllByDesc(); } $orders = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($orders); // setDataType is used to make the ViewGenerator load the proper options if $orders is empty $orders->setDataType('Cx\\Modules\\Order\\Model\\Entity\\Order'); $options = $this->getController('Backend')->getAllViewGeneratorOptions(); $view = new \Cx\Core\Html\Controller\ViewGenerator($orders, $options); if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) { $this->template->hideBlock("order_filter"); } else { \FWUser::getUserLiveSearch(array('minLength' => 1, 'canCancel' => true, 'canClear' => true)); $this->template->setVariable(array('TXT_MODULE_ORDER_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_MODULE_ORDER_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_MODULE_ORDER_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SEARCH_VALUE' => isset($_GET['filter-term']) ? contrexx_input2xhtml($_GET['filter-term']) : '', 'ORDER_USER_ID' => contrexx_raw2xhtml($filterUserId), 'ORDER_USER_NAME' => $objFilterUser ? contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFilterUser)) : '')); } $this->template->setVariable('ORDERS_CONTENT', $view->render()); }
/** * Show all the runs and last runs detail * * @global array $_ARRAYLANG */ public function showCrawlerRuns() { global $_ARRAYLANG; //show the last runs details $lastRunResult = $this->crawlerRepository->getLatestRunDetails(); if ($lastRunResult) { $this->template->setVariable(array($this->moduleNameLang . '_LAST_RUN_STARTTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($lastRunResult[0]->getStartTime()), $this->moduleNameLang . '_LAST_RUN_ENDTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($lastRunResult[0]->getEndTime()), $this->moduleNameLang . '_LAST_RUN_DURATION' => \Cx\Core_Modules\LinkManager\Controller\DateTime::diffTime($lastRunResult[0]->getStartTime(), $lastRunResult[0]->getEndTime()), $this->moduleNameLang . '_LAST_RUN_TOTAL_LINKS' => $lastRunResult[0]->getTotalLinks(), $this->moduleNameLang . '_LAST_RUN_BROKEN_LINKS' => $lastRunResult[0]->getTotalBrokenLinks())); } else { if ($this->template->blockExists('showLastRun')) { $this->template->hideBlock('showLastRun'); } } //show Crawler Runs table //get parameters $pos = isset($_GET['pos']) ? $_GET['pos'] : 0; $langArray = \FWLanguage::getLanguageArray(); //set the settings value from DB \Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config'); $pageLimit = \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager'); $parameter = './index.php?cmd=' . $this->moduleName; $this->template->setVariable('ENTRIES_PAGING', \Paging::get($parameter, $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LINKS'], $this->crawlerRepository->crawlerEntryCount(), $pageLimit, true, $pos, 'pos')); $crawlers = $this->crawlerRepository->getCrawlerRunEntries($pos, $pageLimit); $i = 1; if ($crawlers && $crawlers->count() > 0) { foreach ($crawlers as $crawler) { $this->template->setVariable(array($this->moduleNameLang . '_CRAWLER_RUN_ID' => $crawler->getId(), $this->moduleNameLang . '_CRAWLER_RUN_LANGUAGE' => $langArray[$crawler->getLang()]['name'], $this->moduleNameLang . '_CRAWLER_RUN_STARTTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($crawler->getStartTime()), $this->moduleNameLang . '_CRAWLER_RUN_ENDTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($crawler->getEndTime()), $this->moduleNameLang . '_CRAWLER_RUN_DURATION' => \Cx\Core_Modules\LinkManager\Controller\DateTime::diffTime($crawler->getStartTime(), $crawler->getEndTime()), $this->moduleNameLang . '_CRAWLER_RUN_TOTAL_LINKS' => $crawler->getTotalLinks(), $this->moduleNameLang . '_CRAWLER_RUN_BROKEN_LINKS' => $crawler->getTotalBrokenLinks(), $this->moduleNameLang . '_CRAWLER_RUN_STATUS' => ucfirst($crawler->getRunStatus()), $this->moduleNameLang . '_CRAWLER_RUN_ROW' => 'row' . (++$i % 2 + 1))); $this->template->parse($this->moduleName . 'CrawlerRuns'); } $this->template->hideBlock($this->moduleName . 'NoCrawlerRunsFound'); } else { $this->template->touchBlock($this->moduleName . 'NoCrawlerRunsFound'); } }
function showQuestions() { global $objInit; $objTpl = new \Cx\Core\Html\Sigma(ASCMS_MODULE_PATH . "/{$this->moduleName}/View/Template/Backend"); $objTpl->loadTemplateFile("module_survey_questions.html"); $_ARRAYLANG = $objInit->loadLanguageData('Survey'); if (empty($this->questions)) { $objTpl->setVariable('TXT_SERVEY_NO_QUESTIONS', $_ARRAYLANG['TXT_SERVEY_NO_QUESTIONS']); $objTpl->parse('noSurveyQuestions'); } else { $objTpl->hideBlock('noSurveyQuestions'); } foreach ($this->questions as $questionId => $question) { $comment = $question['isCommentable'] ? $_ARRAYLANG['TXT_YES'] : $_ARRAYLANG['TXT_NO']; $InputType = $question['questionType']; if (!empty($InputType)) { switch ($InputType) { case "1": $Radio = $_ARRAYLANG['TXT_MULTIPLE_CHOICE_ONE_ANSWER']; break; case "2": $Radio = $_ARRAYLANG['TXT_MULTIPLE_CHOICE_MULTIPLE_ANSWER']; break; case "3": $Radio = $_ARRAYLANG['TXT_MATRIX_CHOICE_ONE_ANSWER_PER_ROW']; break; case "4": $Radio = $_ARRAYLANG['TXT_MATRIX_CHOICE_MULTIPLE_ANSWER_PER_ROW']; break; case "5": $Radio = $_ARRAYLANG['TXT_SINGLE_TEXTBOX']; break; case "6": $Radio = $_ARRAYLANG['TXT_MULTIPLE_TEXTBOX']; break; case "7": $Radio = $_ARRAYLANG['TXT_TEXT_ROW']; break; } } // for question Title with tool tip $surveynameVar = contrexx_raw2xhtml($question['question']); $surveyTemp = ''; if ($surveynameVar != "") { $surveyShot = substr($surveynameVar, 0, 20); if (strlen($surveynameVar) > 20) { $surveyTemp = $surveyShot . '..<a href="#" title="' . $surveynameVar . '" class="tooltip"><img border="0" src="' . ASCMS_PATH_OFFSET . ASCMS_MODULE_FOLDER . '/Survey/View/Media/comment.gif"><a>'; } else { $surveyTemp = $surveyShot; } } $objTpl->setVariable(array('SURVEY_ID' => contrexx_raw2xhtml($questionId), 'TXT_SURVEY_POS' => contrexx_raw2xhtml($question['pos']), 'SURVEY_QUESTION' => $surveyTemp, 'SURVEY_QUESTION_CREATED_AT' => contrexx_raw2xhtml($question['created']), 'SURVEY_QUESTION_TYPE' => contrexx_raw2xhtml($Radio), 'SURVEY_QUESTION_COMMENTABLE' => contrexx_raw2xhtml($comment), 'SURVEY_COUNTER' => contrexx_raw2xhtml($question['votes']) . " votes", 'ENTRY_ROWCLASS' => $row = $row == 'row1' ? 'row2' : 'row1', 'TXT_ANALYSE_QUESTION_PREVIEW' => $_ARRAYLANG['TXT_ANALYSE_QUESTION_PREVIEW'], 'TXT_SURVEY_EDIT_TXT' => $_ARRAYLANG['TXT_SURVEY_EDIT_TXT'], 'TXT_SURVEY_DELETE_TXT' => $_ARRAYLANG['TXT_SURVEY_DELETE_TXT'])); $objTpl->parse('ShowQuestions'); } return $objTpl->get(); }
public function showOrders() { global $_ARRAYLANG; $term = isset($_GET['filter-term']) ? contrexx_input2raw($_GET['filter-term']) : ''; $filterUserId = isset($_GET['filter-user-id']) ? contrexx_input2raw($_GET['filter-user-id']) : 0; $objFilterUser = null; if (!empty($term) || !empty($filterUserId)) { if ($filterUserId) { $objFilterUser = \FWUser::getFWUserObject()->objUser->getUser($filterUserId); } $orders = $this->orderRepository->findOrdersBySearchTerm($term, $objFilterUser); } else { $orders = $this->orderRepository->getAllByDesc(); } $view = new \Cx\Core\Html\Controller\ViewGenerator($orders, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_DEFAULT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('contactId' => array('header' => 'contactId', 'table' => array('parse' => function ($value) { global $_ARRAYLANG; $userId = \Cx\Modules\Crm\Controller\CrmLibrary::getUserIdByCrmUserId($value); $userName = \FWUser::getParsedUserTitle($userId); $crmDetailLink = "<a href='index.php?cmd=Crm&act=customers&tpl=showcustdetail&id={$value}' \n title='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'>\n <img \n src='" . \Env::get('cx')->getCodeBaseCoreWebPath() . "/Core/View/Media/navigation_level_1_189.png' \n width='16' height='16' \n alt='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'\n />\n </a>"; $url = "<a href='index.php?cmd=Access&act=user&tpl=modify&id={$userId}'\n title='{$_ARRAYLANG['TXT_MODULE_ORDER_MODIY_USER_ACCOUNT']}'>" . $userName . "</a>" . $crmDetailLink; return $url; })), 'subscriptions' => array('header' => 'subscriptions', 'table' => array('parse' => function ($subscriptions) { $result = array(); foreach ($subscriptions as $subscription) { $productEntity = $subscription->getProductEntity(); $productEntityName = $subscription->getProduct()->getName(); if (!$productEntity) { continue; } $productEditLink = $productEntity; if (method_exists($productEntity, 'getEditLink')) { $productEditLink = $productEntity->getEditLink(); } $subscriptionEditUrl = '<a href=index.php?cmd=Order&act=subscription&editid=' . $subscription->getId() . '>' . $productEntityName . '</a>'; $result[] = $subscriptionEditUrl . ' (' . $productEditLink . ')'; } return implode(', ', $result); }))))); if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) { $this->template->hideBlock("order_filter"); } else { \FWUser::getUserLiveSearch(array('minLength' => 1, 'canCancel' => true, 'canClear' => true)); $this->template->setVariable(array('TXT_MODULE_ORDER_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_MODULE_ORDER_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_MODULE_ORDER_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SEARCH_VALUE' => isset($_GET['filter-term']) ? contrexx_input2xhtml($_GET['filter-term']) : '', 'ORDER_USER_ID' => contrexx_raw2xhtml($filterUserId), 'ORDER_USER_NAME' => $objFilterUser ? contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFilterUser)) : '')); } $this->template->setVariable('ORDERS_CONTENT', $view->render()); }
/** * Sends an email with the contact details to the responsible persons * * This methode sends an email to all email addresses that are defined in the * option "Receiver address(es)" of the requested contact form. * @access private * @global array * @global array * @param array Details of the contact request * @see _getEmailAdressOfString(), phpmailer::From, phpmailer::FromName, phpmailer::AddReplyTo(), phpmailer::Subject, phpmailer::IsHTML(), phpmailer::Body, phpmailer::AddAddress(), phpmailer::Send(), phpmailer::ClearAddresses() */ private function sendMail($arrFormData) { global $_ARRAYLANG, $_CONFIG; $plaintextBody = ''; $replyAddress = ''; $firstname = ''; $lastname = ''; $senderName = ''; $isHtml = $arrFormData['htmlMail'] == 1 ? true : false; // stop send process in case no real data had been submitted if (!isset($arrFormData['data']) && !isset($arrFormData['uploadedFiles'])) { return false; } // check if we shall send the email as multipart (text/html) if ($isHtml) { // setup html mail template $objTemplate = new \Cx\Core\Html\Sigma('.'); $objTemplate->setErrorHandling(PEAR_ERROR_DIE); $objTemplate->setTemplate($arrFormData['mailTemplate']); $objTemplate->setVariable(array('DATE' => date(ASCMS_DATE_FORMAT, $arrFormData['meta']['time']), 'HOSTNAME' => contrexx_raw2xhtml($arrFormData['meta']['host']), 'IP_ADDRESS' => contrexx_raw2xhtml($arrFormData['meta']['ipaddress']), 'BROWSER_LANGUAGE' => contrexx_raw2xhtml($arrFormData['meta']['lang']), 'BROWSER_VERSION' => contrexx_raw2xhtml($arrFormData['meta']['browser']))); } // TODO: check if we have to excape $arrRecipients later in the code $arrRecipients = $this->getRecipients(intval($_GET['cmd'])); // calculate the longest field label. // this will be used to correctly align all user submitted data in the plaintext e-mail // TODO: check if the label of upload-fields are taken into account as well $maxlength = 0; foreach ($arrFormData['fields'] as $arrField) { $length = strlen($arrField['lang'][FRONTEND_LANG_ID]['name']); $maxlength = $maxlength < $length ? $length : $maxlength; } // try to fetch a user submitted e-mail address to which we will send a copy to if (!empty($arrFormData['fields'])) { foreach ($arrFormData['fields'] as $fieldId => $arrField) { // check if field validation is set to e-mail if ($arrField['check_type'] == '2') { $mail = trim($arrFormData['data'][$fieldId]); if (\FWValidator::isEmail($mail)) { $replyAddress = $mail; break; } } if ($arrField['type'] == 'special') { switch ($arrField['special_type']) { case 'access_firstname': $firstname = trim($arrFormData['data'][$fieldId]); break; case 'access_lastname': $lastname = trim($arrFormData['data'][$fieldId]); break; default: break; } } } } if ($arrFormData['useEmailOfSender'] == 1 && (!empty($firstname) || !empty($lastname))) { $senderName = trim($firstname . ' ' . $lastname); } else { $senderName = $_CONFIG['coreGlobalPageTitle']; } // a recipient mail address which has been picked by sender $chosenMailRecipient = null; // fill the html and plaintext body with the submitted form data foreach ($arrFormData['fields'] as $fieldId => $arrField) { if ($fieldId == 'unique_id') { //generated for uploader. no interesting mail content. continue; } $htmlValue = ''; $plaintextValue = ''; $textAreaKeys = array(); switch ($arrField['type']) { case 'label': case 'fieldset': // TODO: parse TH row instead // TODO: parse TH row instead case 'horizontalLine': // TODO: add visual horizontal line // we need to use a 'continue 2' here to first break out of the switch and then move over to the next iteration of the foreach loop continue 2; break; case 'file': case 'multi_file': $htmlValue = ""; $plaintextValue = ""; if (isset($arrFormData['uploadedFiles'][$fieldId])) { $htmlValue = "<ul>"; foreach ($arrFormData['uploadedFiles'][$fieldId] as $file) { $htmlValue .= "<li><a href='" . ASCMS_PROTOCOL . "://" . $_CONFIG['domainUrl'] . \Env::get('cx')->getWebsiteOffsetPath() . contrexx_raw2xhtml($file['path']) . "' >" . contrexx_raw2xhtml($file['name']) . "</a></li>"; $plaintextValue .= ASCMS_PROTOCOL . "://" . $_CONFIG['domainUrl'] . \Env::get('cx')->getWebsiteOffsetPath() . $file['path'] . "\r\n"; } $htmlValue .= "</ul>"; } break; case 'checkbox': $plaintextValue = !empty($arrFormData['data'][$fieldId]) ? $_ARRAYLANG['TXT_CONTACT_YES'] : $_ARRAYLANG['TXT_CONTACT_NO']; $htmlValue = $plaintextValue; break; case 'recipient': // TODO: check for XSS $plaintextValue = $arrRecipients[$arrFormData['data'][$fieldId]]['lang'][FRONTEND_LANG_ID]; $htmlValue = $plaintextValue; $chosenMailRecipient = $arrRecipients[$arrFormData['data'][$fieldId]]['email']; break; case 'textarea': //we need to know all textareas - they're indented differently then the rest of the other field types $textAreaKeys[] = $fieldId; default: $plaintextValue = isset($arrFormData['data'][$fieldId]) ? $arrFormData['data'][$fieldId] : ''; $htmlValue = contrexx_raw2xhtml($plaintextValue); break; } $fieldLabel = $arrField['lang'][FRONTEND_LANG_ID]['name']; // try to fetch an e-mail address from submitted form date in case we were unable to fetch one from an input type with e-mail validation if (empty($replyAddress)) { $mail = $this->_getEmailAdressOfString($plaintextValue); if (\FWValidator::isEmail($mail)) { $replyAddress = $mail; } } // parse html body if ($isHtml) { if (!empty($htmlValue)) { if ($objTemplate->blockExists('field_' . $fieldId)) { // parse field specific template block $objTemplate->setVariable(array('FIELD_' . $fieldId . '_LABEL' => contrexx_raw2xhtml($fieldLabel), 'FIELD_' . $fieldId . '_VALUE' => $htmlValue)); $objTemplate->parse('field_' . $fieldId); } elseif ($objTemplate->blockExists('form_field')) { // parse regular field template block $objTemplate->setVariable(array('FIELD_LABEL' => contrexx_raw2xhtml($fieldLabel), 'FIELD_VALUE' => $htmlValue)); $objTemplate->parse('form_field'); } } elseif ($objTemplate->blockExists('field_' . $fieldId)) { // hide field specific template block, if present $objTemplate->hideBlock('field_' . $fieldId); } } // parse plaintext body $tabCount = $maxlength - strlen($fieldLabel); $tabs = $tabCount == 0 ? 1 : $tabCount + 1; // TODO: what is this all about? - $value is undefined if ($arrFormData['fields'][$fieldId]['type'] == 'recipient') { $value = $arrRecipients[$value]['lang'][FRONTEND_LANG_ID]; } if (in_array($fieldId, $textAreaKeys)) { // we're dealing with a textarea, don't indent value $plaintextBody .= $fieldLabel . ":\n" . $plaintextValue . "\n"; } else { $plaintextBody .= $fieldLabel . str_repeat(" ", $tabs) . ": " . $plaintextValue . "\n"; } } $arrSettings = $this->getSettings(); // TODO: this is some fixed plaintext message data -> must be ported to html body $message = $_ARRAYLANG['TXT_CONTACT_TRANSFERED_DATA_FROM'] . " " . $_CONFIG['domainUrl'] . "\n\n"; if ($arrSettings['fieldMetaDate']) { $message .= $_ARRAYLANG['TXT_CONTACT_DATE'] . " " . date(ASCMS_DATE_FORMAT, $arrFormData['meta']['time']) . "\n\n"; } $message .= $plaintextBody . "\n\n"; if ($arrSettings['fieldMetaHost']) { $message .= $_ARRAYLANG['TXT_CONTACT_HOSTNAME'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['host']) . "\n"; } if ($arrSettings['fieldMetaIP']) { $message .= $_ARRAYLANG['TXT_CONTACT_IP_ADDRESS'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['ipaddress']) . "\n"; } if ($arrSettings['fieldMetaLang']) { $message .= $_ARRAYLANG['TXT_CONTACT_BROWSER_LANGUAGE'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['lang']) . "\n"; } $message .= $_ARRAYLANG['TXT_CONTACT_BROWSER_VERSION'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['browser']) . "\n"; if (@(include_once \Env::get('cx')->getCodeBaseLibraryPath() . '/phpmailer/class.phpmailer.php')) { $objMail = new \phpmailer(); if ($_CONFIG['coreSmtpServer'] > 0 && @(include_once \Env::get('cx')->getCodeBaseCorePath() . '/SmtpSettings.class.php')) { if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) { $objMail->IsSMTP(); $objMail->Host = $arrSmtp['hostname']; $objMail->Port = $arrSmtp['port']; $objMail->SMTPAuth = true; $objMail->Username = $arrSmtp['username']; $objMail->Password = $arrSmtp['password']; } } $objMail->CharSet = CONTREXX_CHARSET; $objMail->From = $_CONFIG['coreAdminEmail']; $objMail->FromName = $senderName; if (!empty($replyAddress)) { $objMail->AddReplyTo($replyAddress); if ($arrFormData['sendCopy'] == 1) { $objMail->AddAddress($replyAddress); } if ($arrFormData['useEmailOfSender'] == 1) { $objMail->From = $replyAddress; } } $objMail->Subject = $arrFormData['subject']; if ($isHtml) { $objMail->Body = $objTemplate->get(); $objMail->AltBody = $message; } else { $objMail->IsHTML(false); $objMail->Body = $message; } // attach submitted files to email if (count($arrFormData['uploadedFiles']) > 0 && $arrFormData['sendAttachment'] == 1) { foreach ($arrFormData['uploadedFiles'] as $arrFilesOfField) { foreach ($arrFilesOfField as $file) { $objMail->AddAttachment(\Env::get('cx')->getWebsiteDocumentRootPath() . $file['path'], $file['name']); } } } if ($chosenMailRecipient !== null) { if (!empty($chosenMailRecipient)) { $objMail->AddAddress($chosenMailRecipient); $objMail->Send(); $objMail->ClearAddresses(); } } else { foreach ($arrFormData['emails'] as $sendTo) { if (!empty($sendTo)) { $objMail->AddAddress($sendTo); $objMail->Send(); $objMail->ClearAddresses(); } } } } return true; }
/** * 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(); } } }
public function render() { if ($this->output) { return $this->output; } $template = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Html/View/Template/Generic'); $template->loadTemplateFile('HtmlElement.html'); $parsedChildren = null; foreach ($this->getChildren() as $child) { $parsedChildren .= $child->render(); } $template->setVariable(array('ELEMENT_NAME' => $this->name)); if ($parsedChildren === null && $this->allowDirectClose) { $template->hideBlock('children'); $template->touchBlock('nochildren'); } else { $template->hideBlock('nochildren'); $template->touchBlock('children'); $template->setVariable(array('CHILDREN' => $parsedChildren)); } foreach ($this->getAttributes() as $name => $value) { $template->setVariable(array('ATTRIBUTE_NAME' => $name, 'ATTRIBUTE_VALUE' => preg_replace(array("/{/", "/}/"), array("{", "}"), contrexx_raw2xhtml((string) $value), -1))); $template->parse('attribute'); } $template->setVariable(array('ATTRIBUTE_NAME' => 'class', 'ATTRIBUTE_VALUE' => contrexx_raw2xhtml($this->getClasses()))); $template->parse('attribute'); $this->output = $template->get(); return $this->output; }
/** * Show the picture with the id $intPicId (with popup) * * @global ADONewConnection * @global array * @param integer $intPicId: The id of the picture which should be shown */ function showPicture($intPicId) { global $objDatabase, $_ARRAYLANG; $arrPictures = array(); $intPicId = intval($intPicId); // Never used // $intCatId = intval($_GET['cid']); // we need to read the category id out of the database to prevent abusement $intCatId = $this->getCategoryId($intPicId); $categoryProtected = $this->categoryIsProtected($intCatId); if ($categoryProtected > 0) { if (!\Permission::checkAccess($categoryProtected, 'dynamic', true)) { $link = base64_encode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']); \Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Login&cmd=noaccess&redirect=" . $link); exit; } } // POPUP Code $objTpl = new \Cx\Core\Html\Sigma(ASCMS_MODULE_PATH . '/Gallery/View/Template/Backend'); $objTpl->loadTemplateFile('module_gallery_show_picture.html', true, true); // get category description $objResult = $objDatabase->Execute("SELECT value FROM " . DBPREFIX . "module_gallery_language " . "WHERE gallery_id={$intCatId} AND lang_id={$this->langId} " . "AND name='desc' LIMIT 1"); $strCategoryComment = ''; if ($objResult && $objResult->RecordCount()) { $strCategoryComment = $objResult->fields['value']; } $objResult = $objDatabase->Execute("SELECT comment, voting " . "FROM " . DBPREFIX . "module_gallery_categories " . "WHERE id={$intCatId}"); $boolComment = ''; $boolVoting = ''; if ($objResult && $objResult->RecordCount()) { $boolComment = $objResult->fields['comment']; $boolVoting = $objResult->fields['voting']; } // get picture informations $objResult = $objDatabase->Execute("SELECT id, path, link, size_show " . "FROM " . DBPREFIX . "module_gallery_pictures " . "WHERE id={$intPicId}"); $objSubResult = $objDatabase->Execute("SELECT p.name, p.desc FROM " . DBPREFIX . "module_gallery_language_pics p " . "WHERE picture_id={$intPicId} AND lang_id={$this->langId} LIMIT 1"); while (!$objResult->EOF) { $imageReso = getimagesize($this->strImagePath . $objResult->fields['path']); $strImagePath = $this->strImageWebPath . $objResult->fields['path']; $imageName = $objSubResult->fields['name']; $imageDesc = $objSubResult->fields['desc']; //show image size based on the settings of "Show image size" $showImageSize = $this->arrSettings['show_image_size'] == 'on' && $objResult->fields['size_show']; $imageSize = $showImageSize ? round(filesize($this->strImagePath . $objResult->fields['path']) / 1024, 2) : ''; $strImageWebPath = ASCMS_PROTOCOL . '://' . $_SERVER['SERVER_NAME'] . CONTREXX_SCRIPT_PATH . '?section=Gallery' . $this->strCmd . '&cid=' . $intCatId . '&pId=' . $intPicId; $objResult->MoveNext(); } // get pictures of the current category $objResult = $objDatabase->Execute("SELECT id FROM " . DBPREFIX . "module_gallery_pictures " . "WHERE status='1' AND validated='1' AND catid={$intCatId} " . "ORDER BY sorting, id"); if ($objResult && $objResult->RecordCount()) { while (!$objResult->EOF) { array_push($arrPictures, $objResult->fields['id']); $objResult->MoveNext(); } } // get next picture id if (array_key_exists(array_search($intPicId, $arrPictures) + 1, $arrPictures)) { $intPicIdNext = $arrPictures[array_search($intPicId, $arrPictures) + 1]; } else { $intPicIdNext = $arrPictures[0]; } // get previous picture id if (array_key_exists(array_search($intPicId, $arrPictures) - 1, $arrPictures)) { $intPicIdPrevious = $arrPictures[array_search($intPicId, $arrPictures) - 1]; } else { $intPicIdPrevious = end($arrPictures); } $strImageTitle = substr(strrchr($strImagePath, '/'), 1); // chop the file extension if the settings tell us to do so if ($this->arrSettings['show_ext'] == 'off') { $strImageTitle = substr($strImageTitle, 0, strrpos($strImageTitle, '.')); } // set language variables $objTpl->setVariable(array('TXT_CLOSE_WINDOW' => $_ARRAYLANG['TXT_CLOSE_WINDOW'], 'TXT_ZOOM_OUT' => $_ARRAYLANG['TXT_ZOOM_OUT'], 'TXT_ZOOM_IN' => $_ARRAYLANG['TXT_ZOOM_IN'], 'TXT_CHANGE_BG_COLOR' => $_ARRAYLANG['TXT_CHANGE_BG_COLOR'], 'TXT_PRINT' => $_ARRAYLANG['TXT_PRINT'], 'TXT_PREVIOUS_IMAGE' => $_ARRAYLANG['TXT_PREVIOUS_IMAGE'], 'TXT_NEXT_IMAGE' => $_ARRAYLANG['TXT_NEXT_IMAGE'], 'TXT_USER_DEFINED' => $_ARRAYLANG['TXT_USER_DEFINED'])); $imageSize = $showImageSize ? $_ARRAYLANG['TXT_FILESIZE'] . ': ' . $imageSize . ' kB<br />' : ''; // set variables $objTpl->setVariable(array('CONTREXX_CHARSET' => CONTREXX_CHARSET, 'GALLERY_WINDOW_WIDTH' => $imageReso[0] < 420 ? 500 : $imageReso[0] + 80, 'GALLERY_WINDOW_HEIGHT' => $imageReso[1] + 120, 'GALLERY_PICTURE_ID' => $intPicId, 'GALLERY_CATEGORY_ID' => $intCatId, 'GALLERY_TITLE' => $strCategoryComment, 'IMAGE_THIS' => $strImagePath, 'IMAGE_PREVIOUS' => '?section=Gallery' . $this->strCmd . '&cid=' . $intCatId . '&pId=' . $intPicIdPrevious, 'IMAGE_NEXT' => '?section=Gallery' . $this->strCmd . '&cid=' . $intCatId . '&pId=' . $intPicIdNext, 'IMAGE_WIDTH' => $imageReso[0], 'IMAGE_HEIGHT' => $imageReso[1], 'IMAGE_LINK' => $strImageWebPath, 'IMAGE_NAME' => $strImageTitle, 'IMAGE_DESCRIPTION' => $_ARRAYLANG['TXT_IMAGE_NAME'] . ': ' . $imageName . '<br />' . $imageSize . $_ARRAYLANG['TXT_RESOLUTION'] . ': ' . $imageReso[0] . 'x' . $imageReso[1] . ' Pixel', 'IMAGE_DESC' => !empty($imageDesc) ? $imageDesc . '<br /><br />' : '')); $objTpl->setGlobalVariable('CONTREXX_DIRECTORY_INDEX', CONTREXX_DIRECTORY_INDEX); //voting if ($objTpl->blockExists('votingTab')) { if ($this->arrSettings['show_voting'] == 'on' && $boolVoting) { $objTpl->setVariable(array('TXT_VOTING_TITLE' => $_ARRAYLANG['TXT_VOTING_TITLE'], 'TXT_VOTING_STATS_ACTUAL' => $_ARRAYLANG['TXT_VOTING_STATS_ACTUAL'], 'TXT_VOTING_STATS_WITH' => $_ARRAYLANG['TXT_VOTING_STATS_WITH'], 'TXT_VOTING_STATS_VOTES' => $_ARRAYLANG['TXT_VOTING_STATS_VOTES'])); if (isset($_COOKIE["Gallery_Voting_{$intPicId}"])) { $objTpl->hideBlock('showVotingBar'); $objTpl->setVariable(array('TXT_VOTING_ALREADY_VOTED' => $_ARRAYLANG['TXT_VOTING_ALREADY_VOTED'], 'VOTING_ALREADY_VOTED_MARK' => intval($_COOKIE['Gallery_Voting_' . $intPicId]))); } else { $objTpl->setVariable(array('TXT_VOTING_ALREADY_VOTED' => '', 'VOTING_ALREADY_VOTED_MARK' => '')); for ($i = 1; $i <= 10; $i++) { $objTpl->setVariable(array('VOTING_BAR_SRC' => ASCMS_MODULE_WEB_PATH . '/Gallery/View/Media/voting/' . $i . '.gif', 'VOTING_BAR_ALT' => $_ARRAYLANG['TXT_VOTING_RATE'] . ': ' . $i, 'VOTING_BAR_MARK' => $i, 'VOTING_BAR_CID' => $intCatId, 'VOTING_BAR_PICID' => $intPicId)); $objTpl->parse('showVotingBar'); } } $objResult = $objDatabase->Execute("SELECT mark FROM " . DBPREFIX . "module_gallery_votes " . "WHERE picid={$intPicId}"); if ($objResult->RecordCount() > 0) { $intCount = 0; $intMark = 0; while (!$objResult->EOF) { $intCount++; $intMark = $intMark + intval($objResult->fields['mark']); $objResult->MoveNext(); } $objTpl->setVariable(array('VOTING_STATS_MARK' => number_format(round($intMark / $intCount, 1), 1, '.', '\''), 'VOTING_STATS_VOTES' => $intCount)); } else { $objTpl->setVariable(array('VOTING_STATS_MARK' => 0, 'VOTING_STATS_VOTES' => 0)); } } else { $objTpl->hideBlock('votingTab'); } } //comments if ($this->arrSettings['show_comments'] == 'on' && $boolComment) { $objResult = $objDatabase->Execute("SELECT date, name, email, www, comment FROM " . DBPREFIX . "module_gallery_comments " . "WHERE picid={$intPicId} ORDER BY date ASC"); $objTpl->setVariable(array('TXT_COMMENTS_TITLE' => $objResult->RecordCount() . ' ' . $_ARRAYLANG['TXT_COMMENTS_TITLE'], 'TXT_COMMENTS_ADD_TITLE' => $_ARRAYLANG['TXT_COMMENTS_ADD_TITLE'], 'TXT_COMMENTS_ADD_NAME' => $_ARRAYLANG['TXT_COMMENTS_ADD_NAME'], 'TXT_COMMENTS_ADD_EMAIL' => $_ARRAYLANG['TXT_COMMENTS_ADD_EMAIL'], 'TXT_COMMENTS_ADD_HOMEPAGE' => $_ARRAYLANG['TXT_COMMENTS_ADD_HOMEPAGE'], 'TXT_COMMENTS_ADD_TEXT' => $_ARRAYLANG['TXT_COMMENTS_ADD_TEXT'], 'TXT_COMMENTS_ADD_SUBMIT' => $_ARRAYLANG['TXT_COMMENTS_ADD_SUBMIT'])); if ($objResult->RecordCount() == 0) { // no comments, hide the block $objTpl->hideBlock('showComments'); } else { $i = 0; while (!$objResult->EOF) { if ($i % 2 == 0) { $intRowClass = '1'; } else { $intRowClass = '2'; } if ($objResult->fields['www'] != '') { $strWWW = '<a href="' . $objResult->fields['www'] . '"><img alt="' . $objResult->fields['www'] . '" src="' . ASCMS_MODULE_WEB_PATH . '/Gallery/View/Media/www.gif" align="baseline" border="0" /></a>'; } else { $strWWW = '<img src="' . ASCMS_MODULE_WEB_PATH . '/Gallery/View/Media/pixel.gif" width="16" height="16" alt="" align="baseline" border="0" />'; } if ($objResult->fields['email'] != '') { $strEmail = '<a href="mailto:' . $objResult->fields['email'] . '"><img alt="' . $objResult->fields['email'] . '" src="' . ASCMS_MODULE_WEB_PATH . '/Gallery/View/Media/email.gif" align="baseline" border="0" /></a>'; } else { $strEmail = '<img src="' . ASCMS_MODULE_WEB_PATH . '/Gallery/View/Media/pixel.gif" width="16" height="16" alt="" align="baseline" border="0" />'; } $objTpl->setVariable(array('COMMENTS_NAME' => html_entity_decode($objResult->fields['name']), 'COMMENTS_DATE' => date($_ARRAYLANG['TXT_COMMENTS_DATEFORMAT'], $objResult->fields['date']), 'COMMENTS_WWW' => $strWWW, 'COMMENTS_EMAIL' => $strEmail, 'COMMENTS_TEXT' => nl2br($objResult->fields['comment']), 'COMMENTS_ROWCLASS' => $intRowClass)); $objTpl->parse('showComments'); $objResult->MoveNext(); $i++; } } } else { $objTpl->hideBlock('commentTab'); } $objTpl->show(); die; }
/** * This is called by the default ComponentController and does all the repeating work * * This loads a template named after current $act and calls parsePage($actTemplate) * @todo $this->cx->getTemplate()->setVariable() should not be called here but in Cx class * @global array $_ARRAYLANG Language data * @global $subMenuTitle * @param \Cx\Core\ContentManager\Model\Entity\Page $page Resolved page */ public function getPage(\Cx\Core\ContentManager\Model\Entity\Page $page) { global $_ARRAYLANG, $subMenuTitle; $subMenuTitle = $_ARRAYLANG['TXT_' . strtoupper($this->getType()) . '_' . strtoupper($this->getName())]; $cmd = array(''); if (isset($_GET['act'])) { $cmd = explode('/', contrexx_input2raw($_GET['act'])); } else { $cmd[0] = 'Wysiwyg'; } $actTemplate = new \Cx\Core\Html\Sigma($this->getDirectory(true) . '/View/Template/Backend'); $filename = $cmd[0] . '.html'; $testFilename = $cmd[0]; if (!\Env::get('ClassLoader')->getFilePath($actTemplate->getRoot() . '/' . $filename)) { $filename = 'Default.html'; $testFilename = 'Default'; } foreach ($cmd as $index => $name) { if ($index == 0) { continue; } $testFilename .= $name; if (\Env::get('ClassLoader')->getFilePath($actTemplate->getRoot() . '/' . $testFilename . '.html')) { $filename = $testFilename . '.html'; } else { break; } } $actTemplate->loadTemplateFile($filename); // todo: Messages $this->parsePage($actTemplate, $cmd); // set tabs $navigation = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Core/View/Template/Backend'); $navigation->loadTemplateFile('Navigation.html'); $commands = array_merge($this->getCommands()); foreach ($commands as $key => $command) { $subnav = array(); if (is_array($command)) { $subnav = array_merge(array(''), $command); $command = $key; } if ($key !== '') { if ($cmd[0] == $command) { $navigation->touchBlock('tab_active'); } else { $navigation->hideBlock('tab_active'); } $act = '&act=' . $command; $txt = $command; if (empty($command)) { $act = ''; $txt = 'DEFAULT'; } $actTxtKey = 'TXT_' . strtoupper($this->getType()) . '_' . strtoupper($this->getName() . '_ACT_' . $txt); $actTitle = isset($_ARRAYLANG[$actTxtKey]) ? $_ARRAYLANG[$actTxtKey] : $actTxtKey; $navigation->setVariable(array('HREF' => 'index.php?cmd=' . $this->getName() . $act, 'TITLE' => $actTitle)); $navigation->parse('tab_entry'); } // subnav if ($cmd[0] == $command && count($subnav)) { $first = true; foreach ($subnav as $subcommand) { if (!isset($cmd[1]) && $first || (isset($cmd[1]) ? $cmd[1] : '') == $subcommand) { $navigation->touchBlock('subnav_active'); } else { $navigation->hideBlock('subnav_active'); } $act = '&act=' . $cmd[0] . '/' . $subcommand; $txt = (empty($cmd[0]) ? 'DEFAULT' : $cmd[0]) . '_'; if (empty($subcommand)) { $act = '&act=' . $cmd[0] . '/'; $txt .= 'DEFAULT'; } else { $txt .= strtoupper($subcommand); } $actTxtKey = 'TXT_' . strtoupper($this->getType()) . '_' . strtoupper($this->getName() . '_ACT_' . $txt); $actTitle = isset($_ARRAYLANG[$actTxtKey]) ? $_ARRAYLANG[$actTxtKey] : $actTxtKey; $navigation->setVariable(array('HREF' => 'index.php?cmd=' . $this->getName() . $act, 'TITLE' => $actTitle)); $navigation->parse('subnav_entry'); $first = false; } } } $txt = $cmd[0]; if (empty($txt)) { $txt = 'DEFAULT'; } // default css and js if (file_exists($this->cx->getClassLoader()->getFilePath($this->getDirectory(false) . '/View/Style/Backend.css'))) { \JS::registerCSS(substr($this->getDirectory(false, true) . '/View/Style/Backend.css', 1)); } if (file_exists($this->cx->getClassLoader()->getFilePath($this->getDirectory(false) . '/View/Script/Backend.js'))) { \JS::registerJS(substr($this->getDirectory(false, true) . '/View/Script/Backend.js', 1)); } // finish $actTemplate->setGlobalVariable($_ARRAYLANG); \Cx\Core\Csrf\Controller\Csrf::add_placeholder($actTemplate); $page->setContent($actTemplate->get()); $cachedRoot = $this->cx->getTemplate()->getRoot(); $this->cx->getTemplate()->setRoot(\Env::get('cx')->getCodeBaseCorePath() . '/Core/View/Template/Backend'); $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'ContentMaster.html'); $this->cx->getTemplate()->setRoot($cachedRoot); $this->cx->getTemplate()->setVariable(array('CONTENT_NAVIGATION' => $navigation->get(), 'ADMIN_CONTENT' => $page->getContent(), 'CONTENT_TITLE' => $_ARRAYLANG['TXT_' . strtoupper($this->getType()) . '_' . strtoupper($this->getName() . '_ACT_' . $txt)])); }
public function showSubscriptions() { global $_ARRAYLANG; $term = isset($_GET['term']) ? contrexx_input2raw($_GET['term']) : ''; $filterProduct = isset($_GET['filter_product']) ? contrexx_input2raw($_GET['filter_product']) : array(); $filterState = isset($_GET['filter_state']) ? contrexx_input2raw($_GET['filter_state']) : array(); if (!empty($term) || !empty($filterProduct) || !empty($filterState)) { $filter = array('term' => $term, 'filterProduct' => $filterProduct, 'filterState' => $filterState); $subscriptions = $this->subscriptionRepo->findSubscriptionsBySearchTerm($filter); } else { $subscriptions = $this->subscriptionRepo->getSubscriptionsByCriteria(null, array('s.id' => 'DESC')); } $products = \Env::get('em')->getRepository('Cx\\Modules\\Pim\\Model\\Entity\\Product')->findAll(); $this->getSearchFilterDropDown($products, $filterProduct, 'product'); $subscriptionStates = array(\Cx\Modules\Order\Model\Entity\Subscription::STATE_ACTIVE, \Cx\Modules\Order\Model\Entity\Subscription::STATE_INACTIVE, \Cx\Modules\Order\Model\Entity\Subscription::STATE_TERMINATED, \Cx\Modules\Order\Model\Entity\Subscription::STATE_CANCELLED); $this->getSearchFilterDropDown($subscriptionStates, $filterState, 'state'); $view = new \Cx\Core\Html\Controller\ViewGenerator($subscriptions, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_SUBSCRIPTION'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('id' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_ID']), 'subscriptionDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_DATE']), 'expirationDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_EXPIRATION_DATE']), 'productEntityId' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_PRODUCT_ENTITY'], 'table' => array('parse' => function ($value, $rowData) { $subscription = $this->subscriptionRepo->findOneBy(array('id' => $rowData['id'])); $productEntity = $subscription->getProductEntity(); if (!$productEntity) { return; } $productEditLink = $productEntity; if (method_exists($productEntity, 'getEditLink')) { $productEditLink = $productEntity->getEditLink(); } return $productEditLink; })), 'paymentAmount' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_PAYMENT_AMOUNT'], 'table' => array('parse' => function ($value, $rowData) { if (\FWValidator::isEmpty(floatval($value))) { return null; } $subscription = $this->subscriptionRepo->findOneBy(array('id' => $rowData['id'])); $currency = ''; $order = $subscription->getOrder(); if ($order) { $currency = !\FWValidator::isEmpty($order->getCurrency()) ? $order->getCurrency() : ''; } $paymentInterval = $subscription->getRenewalUnit(); return $value . ' ' . $currency . ' / ' . $paymentInterval; })), 'renewalUnit' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_RENEWAL_UNIT'], 'table' => array('parse' => function ($value, $rowData) { if (empty($value)) { return null; } $subscription = $this->subscriptionRepo->findOneBy(array('id' => $rowData['id'])); $renewalDate = ''; if ($subscription->getRenewalDate()) { $renewalDate = $subscription->getRenewalDate(); $quantifier = $subscription->getRenewalQuantifier(); $renewalDate->modify("-{$quantifier} {$value}"); return $renewalDate->format('d.M.Y H:i:s'); } return $renewalDate; })), 'renewalQuantifier' => array('showOverview' => false), 'renewalDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_RENEWAL_DATE']), 'description' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_DESCRIPTION']), 'state' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_STATE']), 'terminationDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_TERMI_DATE']), 'note' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_NOTE']), 'product' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_PRODUCT'], 'table' => array('parse' => function ($value, $rowData) { $subscription = $this->subscriptionRepo->findOneBy(array('id' => $rowData['id'])); $product = $subscription->getProduct(); if (!$product) { return; } return $product->getName(); })), 'paymentState' => array('showOverview' => false), 'externalSubscriptionId' => array('showOverview' => false), 'order' => array('showOverview' => false)))); $this->template->setVariable(array('TXT_ORDER_SUBSCRIPTIONS_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_ORDER_SUBSCRIPTIONS_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_ORDER_SUBSCRIPTIONS_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SUBSCRIPTIONS_SEARCH_VALUE' => contrexx_raw2xhtml($term))); if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) { $this->template->hideBlock("subscription_filter"); } $this->template->setVariable('SUBSCRIPTIONS_CONTENT', $view->render()); }