本文整理汇总了PHP中Cx\Core\Routing\Url::fromModuleAndCmd方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::fromModuleAndCmd方法的具体用法?PHP Url::fromModuleAndCmd怎么用?PHP Url::fromModuleAndCmd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Routing\Url
的用法示例。
在下文中一共展示了Url::fromModuleAndCmd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHomeTopNews
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();
}
示例2: getHomeHeadlines
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();
}
示例3: getForm
/**
* Returns the PayPal form for initializing the payment process
* @param string $account_email The PayPal account e-mail address
* @param string $order_id The Order ID
* @param string $currency_code The Currency code
* @param string $amount The amount
* @param string $item_name The description used for the payment
* @return string The HTML code for the PayPal form
*/
static function getForm($account_email, $order_id, $currency_code, $amount, $item_name)
{
global $_ARRAYLANG;
//DBG::log("getForm($account_email, $order_id, $currency_code, $amount, $item_name): Entered");
$return = \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'success', FRONTEND_LANG_ID, array('handler' => 'paypal', 'result' => '1', 'order_id' => $order_id))->toString();
$cancel_return = \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'success', FRONTEND_LANG_ID, array('handler' => 'paypal', 'result' => '2', 'order_id' => $order_id))->toString();
$notify_url = \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'success', FRONTEND_LANG_ID, array('handler' => 'paypal', 'result' => '-1', 'order_id' => $order_id))->toString();
$retval = (\Cx\Core\Setting\Controller\Setting::getValue('paypal_active', 'Shop') ? '<script type="text/javascript">
// <![CDATA[
function go() { document.paypal.submit(); }
window.setTimeout("go()", 3000);
// ]]>
</script>
<form name="paypal" method="post"
action="https://www.paypal.com/ch/cgi-bin/webscr">
' : '<form name="paypal" method="post"
action="https://www.sandbox.paypal.com/ch/cgi-bin/webscr">
') . Html::getHidden('cmd', '_xclick') . Html::getHidden('business', $account_email) . Html::getHidden('item_name', $item_name) . Html::getHidden('currency_code', $currency_code) . Html::getHidden('amount', $amount) . Html::getHidden('custom', $order_id) . Html::getHidden('notify_url', $notify_url) . Html::getHidden('return', $return) . Html::getHidden('cancel_return', $cancel_return) . $_ARRAYLANG['TXT_PAYPAL_SUBMIT'] . '<br /><br />' . '<input type="submit" name="submitbutton" value="' . $_ARRAYLANG['TXT_PAYPAL_SUBMIT_BUTTON'] . "\" />\n</form>\n";
return $retval;
}
示例4: SearchFindContent
/**
* Global search event listener
* Appends the News search results to the search object
*
* @param array $eventArgs
*/
private function SearchFindContent(array $eventArgs)
{
$search = current($eventArgs);
$term_db = contrexx_raw2db($search->getTerm());
$query = "SELECT id, text AS content, title, date, redirect,\n MATCH (text,title,teaser_text) AGAINST ('%{$term_db}%') AS score\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id = tblN.id\n WHERE ( text LIKE ('%{$term_db}%')\n OR title LIKE ('%{$term_db}%')\n OR teaser_text LIKE ('%{$term_db}%'))\n AND lang_id=" . FRONTEND_LANG_ID . "\n AND status=1\n AND is_active=1\n AND (startdate<='" . date('Y-m-d') . "' OR startdate='0000-00-00')\n AND (enddate>='" . date('Y-m-d') . "' OR enddate='0000-00-00')";
$pageUrl = function ($pageUri, $searchData) {
static $objNewsLib = null;
if (!$objNewsLib) {
$objNewsLib = new \Cx\Core_Modules\News\Controller\NewsLibrary();
}
if (empty($searchData['redirect'])) {
$newsId = $searchData['id'];
$newsCategories = $objNewsLib->getCategoriesByNewsId($newsId);
$objUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('News', $objNewsLib->findCmdById('details', array_keys($newsCategories)), FRONTEND_LANG_ID, array('newsid' => $newsId));
$pageUrlResult = $objUrl->toString();
} else {
$pageUrlResult = $searchData['redirect'];
}
return $pageUrlResult;
};
$result = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($search->getResultArray($query, 'News', '', $pageUrl, $search->getTerm()));
$search->appendResult($result);
}
示例5: showCategory
/**
* Show one category
* @param unknown_type $id
*/
function showCategory($id)
{
global $_ARRAYLANG;
$arrEntries = $this->createEntryArray($this->_intLanguageId);
$this->createSettingsArray();
foreach ($arrEntries as $key => $value) {
if ($value['active']) {
// check date
if ($value['release_time'] != 0) {
if ($value['release_time'] > time()) {
// too old
continue;
}
// if it is not endless (0), check if 'now' is past the given date
if ($value['release_time_end'] != 0 && time() > $value['release_time_end']) {
continue;
}
}
if ($this->categoryMatches($id, $value['categories'][$this->_intLanguageId])) {
$this->_objTpl->setVariable(array("ENTRY_TITLE" => $value['translation'][$this->_intLanguageId]['subject'], "ENTRY_CONTENT" => $this->getIntroductionText($value['translation'][$this->_intLanguageId]['content']), "ENTRY_ID" => $key, "ENTRY_HREF" => \Cx\Core\Routing\Url::fromModuleAndCmd('Data', $this->curCmd, '', array('id' => $key)), "TXT_MORE" => $_ARRAYLANG['TXT_DATA_MORE'], "CMD" => $this->curCmd));
$this->_objTpl->parse("entry");
}
}
}
$this->_objTpl->parse("showDataCategory");
}
示例6: writeCategoryRSS
/**
* 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');
}
}
}
}
}
}
示例7: showThreeBoxes
/**
* Performs the box view
*
* @return null
*/
function showThreeBoxes()
{
global $_ARRAYLANG;
$objEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager($this->startDate, $this->endDate, $this->categoryId, $this->searchTerm, true, $this->needAuth, true, 0, 'n', $this->sortDirection, true, $this->author);
$objEventManager->getEventList();
$this->_objTpl->setTemplate($this->pageContent);
if ($_REQUEST['cmd'] == 'boxes') {
$objEventManager->calendarBoxUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', 'boxes')->toString() . "?act=list";
$objEventManager->calendarBoxMonthNavUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', 'boxes')->toString();
} else {
$objEventManager->calendarBoxUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', '')->toString() . "?act=list";
$objEventManager->calendarBoxMonthNavUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', '')->toString();
}
if (empty($_GET['catid'])) {
$catid = 0;
} else {
$catid = $_GET['catid'];
}
if (isset($_GET['yearID']) && isset($_GET['monthID']) && isset($_GET['dayID'])) {
$day = $_GET['dayID'];
$month = $_GET['monthID'];
$year = $_GET['yearID'];
} elseif (isset($_GET['yearID']) && isset($_GET['monthID']) && !isset($_GET['dayID'])) {
$day = 0;
$month = $_GET['monthID'];
$year = $_GET['yearID'];
} elseif (isset($_GET['yearID']) && !isset($_GET['monthID']) && !isset($_GET['dayID'])) {
$day = 0;
$month = 0;
$year = $_GET['yearID'];
} else {
$day = date("d");
$month = date("m");
$year = date("Y");
}
$calendarbox = $objEventManager->getBoxes($this->boxCount, $year, $month, $day, $catid);
$objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true);
$objCategoryManager->getCategoryList();
$this->_objTpl->setVariable(array("TXT_{$this->moduleLangVar}_ALL_CAT" => $_ARRAYLANG['TXT_CALENDAR_ALL_CAT'], "{$this->moduleLangVar}_BOX" => $calendarbox, "{$this->moduleLangVar}_JAVA_SCRIPT" => $objEventManager->getCalendarBoxJS(), "{$this->moduleLangVar}_CATEGORIES" => $objCategoryManager->getCategoryDropdown($catid, 1)));
}
示例8: getArchive
/**
* 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();
}
示例9: getDetail
/**
* Get a single entry view
* @param int $id
* @return string
*/
function getDetail($id)
{
global $_LANGID;
if ($this->entryArray === false) {
$this->entryArray = $this->createEntryArray();
}
$entry = $this->entryArray[$id];
$title = $entry['translation'][$_LANGID]['subject'];
$content = $this->getIntroductionText($entry['translation'][$_LANGID]['content']);
$this->_objTpl->setTemplate($this->adjustTemplatePlaceholders($this->_arrSettings['data_template_entry']));
$translation = $entry['translation'][$_LANGID];
$image = $this->getThumbnailImage($id, $translation['image'], $translation['thumbnail'], $translation['thumbnail_type']);
$lang = $_LANGID;
$width = $this->_arrSettings['data_shadowbox_width'];
$height = $this->_arrSettings['data_shadowbox_height'];
if ($entry['mode'] == "normal") {
if ($this->_arrSettings['data_entry_action'] == "content") {
$cmd = $this->_arrSettings['data_target_cmd'];
$url = \Cx\Core\Routing\Url::fromModuleAndCmd('Data', $cmd, '', array('id' => $id));
} else {
$url = \Cx\Core\Routing\Url::fromModuleAndCmd('Data', '', '', array('height' => $height, 'width' => $width, 'id' => $id, 'lang' => $lang));
}
} else {
$url = $entry['translation'][$_LANGID]['forward_url'] . '&id=' . $id;
}
$templateVars = array("TITLE" => $title, "IMAGE" => $image, "CONTENT" => $content, "HREF" => $url, "CLASS" => $this->_arrSettings['data_entry_action'] == "overlaybox" && $entry['mode'] == "normal" ? "rel=\"shadowbox;width=" . $width . ";height=" . $height . "\"" : "", "TXT_MORE" => $this->langVars['TXT_DATA_MORE']);
$this->_objTpl->setVariable($templateVars);
$this->_objTpl->parse("datalist_entry");
return $this->_objTpl->get();
}
示例10: showCams
/**
* Show the cameras
*
* @access private
* @global array
* @global array
* @global array
*/
function showCams()
{
global $_ARRAYLANG, $_CONFIG, $_CORELANG;
$this->_pageTitle = $_ARRAYLANG['TXT_SETTINGS'];
$this->_objTpl->loadTemplateFile('module_livecam_cams.html');
$amount = $this->arrSettings['amount_of_cams'];
$cams = $this->getCamSettings();
$this->_objTpl->setGlobalVariable(array('TXT_SETTINGS' => $_ARRAYLANG['TXT_SETTINGS'], 'TXT_CURRENT_IMAGE_URL' => $_ARRAYLANG['TXT_CURRENT_IMAGE_URL'], 'TXT_ARCHIVE_PATH' => $_ARRAYLANG['TXT_ARCHIVE_PATH'], 'TXT_SAVE' => $_ARRAYLANG['TXT_SAVE'], 'TXT_THUMBNAIL_PATH' => $_ARRAYLANG['TXT_THUMBNAIL_PATH'], 'TXT_SHADOWBOX_ACTIVE' => $_CORELANG['TXT_ACTIVATED'], 'TXT_SHADOWBOX_INACTIVE' => $_CORELANG['TXT_DEACTIVATED'], 'TXT_ACTIVATE_SHADOWBOX' => $_ARRAYLANG['TXT_ACTIVATE_SHADOWBOX'], 'TXT_ACTIVATE_SHADOWBOX_INFO' => $_ARRAYLANG['TXT_ACTIVATE_SHADOWBOX_INFO'], 'TXT_MAKE_A_FRONTEND_PAGE' => $_ARRAYLANG['TXT_MAKE_A_FRONTEND_PAGE'], 'TXT_CURRENT_IMAGE_MAX_SIZE' => $_ARRAYLANG['TXT_CURRENT_IMAGE_MAX_SIZE'], 'TXT_THUMBNAIL_MAX_SIZE' => $_ARRAYLANG['TXT_THUMBNAIL_MAX_SIZE'], 'TXT_CAM' => $_ARRAYLANG['TXT_CAM'], 'TXT_SUCCESS' => $_CORELANG['TXT_SETTINGS_UPDATED'], 'TXT_TO_MODULE' => $_ARRAYLANG['TXT_LIVECAM_TO_MODULE'], 'TXT_SHOWFROM' => $_ARRAYLANG['TXT_LIVECAM_SHOWFROM'], 'TXT_SHOWTILL' => $_ARRAYLANG['TXT_LIVECAM_SHOWTILL'], 'TXT_OCLOCK' => $_ARRAYLANG['TXT_LIVECAM_OCLOCK']));
for ($i = 1; $i <= $amount; $i++) {
if ($cams[$i]['shadowboxActivate'] == 1) {
$shadowboxActive = 'checked="checked"';
$shadowboxInctive = '';
} else {
$shadowboxActive = '';
$shadowboxInctive = 'checked="checked"';
}
try {
// fetch CMD specific livecam page
$camUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Livecam', $i, FRONTEND_LANG_ID, array(), '', false);
} catch (\Cx\Core\Routing\UrlException $e) {
// fetch generic livecam page
$camUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Livecam');
}
$this->_objTpl->setVariable(array('CAM_NUMBER' => $i, 'LIVECAM_CAM_URL' => $camUrl, 'CURRENT_IMAGE_URL' => $cams[$i]['currentImagePath'], 'ARCHIVE_PATH' => $cams[$i]['archivePath'], 'THUMBNAIL_PATH' => $cams[$i]['thumbnailPath'], 'SHADOWBOX_ACTIVE' => $shadowboxActive, 'SHADOWBOX_INACTIVE' => $shadowboxInctive, 'CURRENT_IMAGE_MAX_SIZE' => $cams[$i]['maxImageWidth'], 'THUMBNAIL_MAX_SIZE' => $cams[$i]['thumbMaxSize'], 'HOUR_FROM' => $this->getHourOptions($cams[$i]['showFrom']), 'MINUTE_FROM' => $this->getMinuteOptions($cams[$i]['showFrom']), 'HOUR_TILL' => $this->getHourOptions(!empty($cams[$i]['showTill']) ? $cams[$i]['showTill'] : mktime(23)), 'MINUTE_TILL' => $this->getMinuteOptions(!empty($cams[$i]['showTill']) ? $cams[$i]['showTill'] : mktime(0, 59))));
if (preg_match("/^https{0,1}:\\/\\//", $cams[$i]['currentImagePath'])) {
$filepath = $cams[$i]['currentImagePath'];
$this->_objTpl->setVariable("PATH", $filepath);
$this->_objTpl->parse("current_image");
} else {
$filepath = \Cx\Core\Core\Controller\Cx::instanciate()->getWebsitePath() . $cams[$i]['currentImagePath'];
if (\Cx\Lib\FileSystem\FileSystem::exists($filepath) && is_file($filepath)) {
$this->_objTpl->setVariable("PATH", $cams[$i]['currentImagePath']);
$this->_objTpl->parse("current_image");
} else {
$this->_objTpl->hideBlock("current_image");
}
}
$this->_objTpl->parse("cam");
/*
$this->_objTpl->setVariable('BLOCK_USE_BLOCK_SYSTEM', $_CONFIG['blockStatus'] == '1' ? 'checked="checked"' : '');
*/
}
}
示例11: view_list
/**
* Sets up the Order list view
*
* Sets the $objTemplate parameter to the default backend template,
* if empty.
* @param \Cx\Core\Html\Sigma $objTemplate The Template, by reference
* @param array $filter The optional filter
* @return boolean True on success,
* false otherwise
*/
static function view_list(&$objTemplate = null, $filter = NULL)
{
global $_ARRAYLANG, $objInit;
$backend = $objInit->mode == 'backend';
if (!$objTemplate) {
$objTemplate = new \Cx\Core\Html\Sigma(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseModulePath() . '/Shop/View/Template/Backend');
//DBG::log("Orders::view_list(): new Template: ".$objTemplate->get());
$objTemplate->loadTemplateFile('module_shop_orders.html');
//DBG::log("Orders::view_list(): loaded Template: ".$objTemplate->get());
}
$uri = $backend ? \Html::getRelativeUri_entities() : \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'history', NULL);
//DBG::log("Orders::view_list(): URI: $uri");
// TODO: Better use a redirect after doing stuff!
\Html::stripUriParam($uri, 'act');
\Html::stripUriParam($uri, 'searchterm');
\Html::stripUriParam($uri, 'listletter');
\Html::stripUriParam($uri, 'customer_type');
\Html::stripUriParam($uri, 'status');
\Html::stripUriParam($uri, 'show_pending_orders');
\Html::stripUriParam($uri, 'order_id');
\Html::stripUriParam($uri, 'changeOrderStatus');
\Html::stripUriParam($uri, 'sendMail');
if (!is_array($filter)) {
$filter = array();
}
if (!empty($_REQUEST['searchterm'])) {
$filter['term'] = trim(strip_tags(contrexx_input2raw($_REQUEST['searchterm'])));
\Html::replaceUriParameter($uri, 'searchterm=' . $filter['term']);
} elseif (!empty($_REQUEST['listletter'])) {
$filter['letter'] = trim(strip_tags(contrexx_input2raw($_REQUEST['listletter'])));
\Html::replaceUriParameter($uri, 'listletter=' . $filter['letter']);
}
$customer_type = $usergroup_id = null;
// Ignore
if (isset($_REQUEST['customer_type']) && $_REQUEST['customer_type'] !== '') {
$customer_type = intval($_REQUEST['customer_type']);
\Html::replaceUriParameter($uri, 'customer_type=' . $customer_type);
if ($customer_type == 0) {
$usergroup_id = \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_customer', 'Shop');
}
if ($customer_type == 1) {
$usergroup_id = \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_reseller', 'Shop');
}
$objFWUser = \FWUser::getFWUserObject();
$objGroup = $objFWUser->objGroup->getGroup($usergroup_id);
if ($objGroup) {
$filter['customer_id'] = $objGroup->getAssociatedUserIds();
// No customers of that type, so suppress all results
if (empty($filter['customer_id'])) {
$filter['customer_id'] = array(0);
}
//DBG::log("Orders::view_list(): Group ID $usergroup_id, Customers: ".var_export($filter['customer_id'], true));
}
}
$status = null;
// Ignore
$arrStatus = null;
if (isset($_REQUEST['status']) && $_REQUEST['status'] !== '') {
$status = intval($_REQUEST['status']);
if ($status >= Order::STATUS_PENDING && $status < Order::STATUS_MAX) {
$arrStatus = array($status => true);
\Html::replaceUriParameter($uri, 'status=' . $status);
if ($status == Order::STATUS_PENDING) {
$_REQUEST['show_pending_orders'] = true;
}
}
}
// Let the user choose whether to see pending orders, too
$show_pending_orders = false;
if ($backend) {
if (empty($_REQUEST['show_pending_orders'])) {
if (empty($arrStatus)) {
$arrStatus = self::getStatusArray();
unset($arrStatus[Order::STATUS_PENDING]);
}
} else {
if ($arrStatus) {
$arrStatus[Order::STATUS_PENDING] = true;
}
$show_pending_orders = true;
\Html::replaceUriParameter($uri, 'show_pending_orders=1');
}
}
if ($arrStatus) {
$filter['status'] = array_keys($arrStatus);
}
//DBG::log("Orders::view_list(): URI for Sorting: $uri, decoded ".html_entity_decode($uri));
$arrSorting = array('id' => $_ARRAYLANG['TXT_SHOP_ID'], 'date_time' => $_ARRAYLANG['TXT_SHOP_ORDER_DATE'], 'customer_name' => $_ARRAYLANG['TXT_SHOP_CUSTOMER'], 'sum' => $_ARRAYLANG['TXT_SHOP_ORDER_SUM'], 'status' => $_ARRAYLANG['TXT_SHOP_ORDER_STATUS']);
$objSorting = new \Sorting($uri, $arrSorting, false, 'order_shop_orders');
$uri_search = $uri;
//.........这里部分代码省略.........
示例12: send
function send()
{
global $objDatabase, $_ARRAYLANG, $_CONFIG;
$this->_objTpl->setTemplate($this->pageContent);
// Initialize variables
$code = substr(md5(rand()), 1, 10);
$url = \Cx\Core\Routing\Url::fromModuleAndCmd('Ecard', 'show', '', array('code' => $code))->toString();
// Initialize POST variables
$id = intval($_POST['selectedEcard']);
$message = contrexx_addslashes($_POST['ecardMessage']);
$recipientSalutation = contrexx_stripslashes($_POST['ecardRecipientSalutation']);
$senderName = contrexx_stripslashes($_POST['ecardSenderName']);
$senderEmail = \FWValidator::isEmail($_POST['ecardSenderEmail']) ? $_POST['ecardSenderEmail'] : '';
$recipientName = contrexx_stripslashes($_POST['ecardRecipientName']);
$recipientEmail = \FWValidator::isEmail($_POST['ecardRecipientEmail']) ? $_POST['ecardRecipientEmail'] : '';
if (empty($senderEmail) || empty($recipientEmail)) {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_SENDING_ERROR']));
return false;
}
$query = "\n SELECT `setting_name`, `setting_value`\n FROM " . DBPREFIX . "module_ecard_settings";
$objResult = $objDatabase->Execute($query);
while (!$objResult->EOF) {
switch ($objResult->fields['setting_name']) {
case 'validdays':
$validdays = $objResult->fields['setting_value'];
break;
// Never used
// case 'greetings':
// $greetings = $objResult->fields['setting_value'];
// break;
// Never used
// case 'greetings':
// $greetings = $objResult->fields['setting_value'];
// break;
case 'subject':
$subject = $objResult->fields['setting_value'];
break;
case 'emailText':
$emailText = strip_tags($objResult->fields['setting_value']);
break;
}
$objResult->MoveNext();
}
$timeToLife = $validdays * 86400;
// Replace placeholders with used in notification mail with user data
$emailText = str_replace('[[ECARD_RECIPIENT_SALUTATION]]', $recipientSalutation, $emailText);
$emailText = str_replace('[[ECARD_RECIPIENT_NAME]]', $recipientName, $emailText);
$emailText = str_replace('[[ECARD_RECIPIENT_EMAIL]]', $recipientEmail, $emailText);
$emailText = str_replace('[[ECARD_SENDER_NAME]]', $senderName, $emailText);
$emailText = str_replace('[[ECARD_SENDER_EMAIL]]', $senderEmail, $emailText);
$emailText = str_replace('[[ECARD_VALID_DAYS]]', $validdays, $emailText);
$emailText = str_replace('[[ECARD_URL]]', $url, $emailText);
$body = $emailText;
// Insert ecard to DB
$query = "\n INSERT INTO `" . DBPREFIX . "module_ecard_ecards` (\n code, date, TTL, salutation,\n senderName, senderEmail,\n recipientName, recipientEmail,\n message\n ) VALUES (\n '" . $code . "',\n '" . time() . "',\n '" . $timeToLife . "',\n '" . addslashes($recipientSalutation) . "',\n '" . addslashes($senderName) . "',\n '" . $senderEmail . "',\n '" . addslashes($recipientName) . "',\n '" . $recipientEmail . "',\n '" . $message . "');";
if ($objDatabase->Execute($query)) {
$query = "\n SELECT setting_value\n FROM " . DBPREFIX . "module_ecard_settings\n WHERE setting_name='motive_{$id}'";
$objResult = $objDatabase->SelectLimit($query, 1);
// Copy motive to new file with $code as filename
$fileExtension = preg_replace('/^.+(\\.[^\\.]+)$/', '$1', $objResult->fields['setting_value']);
$fileName = $objResult->fields['setting_value'];
$objFile = new \File();
if ($objFile->copyFile(ASCMS_ECARD_OPTIMIZED_PATH . '/', $fileName, ASCMS_ECARD_SEND_ECARDS_PATH . '/', $code . $fileExtension)) {
$objMail = new \phpmailer();
// Check e-mail settings
if ($_CONFIG['coreSmtpServer'] > 0 && @(include_once ASCMS_CORE_PATH . '/SmtpSettings.class.php')) {
$objSmtpSettings = new \SmtpSettings();
if (($arrSmtp = $objSmtpSettings->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'];
}
}
// Send notification mail to ecard-recipient
$objMail->CharSet = CONTREXX_CHARSET;
$objMail->SetFrom($senderEmail, $senderName);
$objMail->Subject = $subject;
$objMail->IsHTML(false);
$objMail->Body = $body;
$objMail->AddAddress($recipientEmail);
if ($objMail->Send()) {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_HAS_BEEN_SENT']));
} else {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_MAIL_SENDING_ERROR']));
}
}
} else {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_SENDING_ERROR']));
}
}
示例13: from_order
/**
* Restores the Cart from the Order ID given
*
* Redirects to the login when nobody is logged in.
* Redirects to the history overview when the Order cannot be loaded,
* or when it does not belong to the current Customer.
* When $editable is true, redirects to the detail view of the first
* Item for editing. Editing will be disabled otherwise.
* @global array $_ARRAYLANG
* @param integer $order_id The Order ID
* @param boolean $editable Items in the Cart are editable iff true
*/
static function from_order($order_id, $editable = false)
{
global $_ARRAYLANG;
$objCustomer = Shop::customer();
if (!$objCustomer) {
\Message::information($_ARRAYLANG['TXT_SHOP_ORDER_LOGIN_TO_REPEAT']);
\Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'login') . '?redirect=' . base64_encode(\Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'cart') . '?order_id=' . $order_id));
}
$customer_id = $objCustomer->getId();
$order = Order::getById($order_id);
if (!$order || $order->customer_id() != $customer_id) {
\Message::warning($_ARRAYLANG['TXT_SHOP_ORDER_INVALID_ID']);
\Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'history'));
}
// Optional!
self::destroy();
$_SESSION['shop']['shipperId'] = $order->shipment_id();
$_SESSION['shop']['paymentId'] = $order->payment_id();
$order_attributes = $order->getOptionArray();
$count = null;
$arrAttributes = Attributes::getArray($count, 0, -1, null, array());
// Find an Attribute and option IDs for the reprint type
$attribute_id_reprint = $option_id_reprint = NULL;
if (!$editable) {
//DBG::log("Cart::from_order(): Checking for reprint...");
foreach ($arrAttributes as $attribute_id => $objAttribute) {
if ($objAttribute->getType() == Attribute::TYPE_EZS_REPRINT) {
//DBG::log("Cart::from_order(): TYPE reprint");
$options = $objAttribute->getOptionArray();
if ($options) {
$option_id_reprint = current(array_keys($options));
$attribute_id_reprint = $attribute_id;
//DBG::log("Cart::from_order(): Found reprint Attribute $attribute_id_reprint, option $option_id_reprint");
break;
}
}
}
}
foreach ($order->getItems() as $item) {
$item_id = $item['item_id'];
$attributes = $order_attributes[$item_id];
$options = array();
foreach ($attributes as $attribute_id => $attribute) {
// foreach (array_keys($attribute['options']) as $option_id) {
foreach ($attribute['options'] as $option_id => $option) {
//DBG::log("Cart::from_order(): Option: ".var_export($option, true));
switch ($arrAttributes[$attribute_id]->getType()) {
case Attribute::TYPE_TEXT_OPTIONAL:
case Attribute::TYPE_TEXT_MANDATORY:
case Attribute::TYPE_TEXTAREA_OPTIONAL:
case Attribute::TYPE_TEXTAREA_MANDATORY:
case Attribute::TYPE_EMAIL_OPTIONAL:
case Attribute::TYPE_EMAIL_MANDATORY:
case Attribute::TYPE_URL_OPTIONAL:
case Attribute::TYPE_URL_MANDATORY:
case Attribute::TYPE_DATE_OPTIONAL:
case Attribute::TYPE_DATE_MANDATORY:
case Attribute::TYPE_NUMBER_INT_OPTIONAL:
case Attribute::TYPE_NUMBER_INT_MANDATORY:
case Attribute::TYPE_NUMBER_FLOAT_OPTIONAL:
case Attribute::TYPE_NUMBER_FLOAT_MANDATORY:
case Attribute::TYPE_EZS_ACCOUNT_3:
case Attribute::TYPE_EZS_ACCOUNT_4:
case Attribute::TYPE_EZS_IBAN:
case Attribute::TYPE_EZS_IN_FAVOR_OF:
case Attribute::TYPE_EZS_REFERENCE:
case Attribute::TYPE_EZS_CLEARING:
case Attribute::TYPE_EZS_DEPOSIT_FOR_6:
case Attribute::TYPE_EZS_DEPOSIT_FOR_2L:
case Attribute::TYPE_EZS_DEPOSIT_FOR_2H:
case Attribute::TYPE_EZS_PURPOSE_35:
case Attribute::TYPE_EZS_PURPOSE_50:
$options[$attribute_id][] = $option['name'];
break;
case Attribute::TYPE_EZS_REDPLATE:
case Attribute::TYPE_EZS_CONFIRMATION:
if (!$attribute_id_reprint) {
//DBG::log("Cart::from_order(): No reprint, adding option {$option['name']}");
$options[$attribute_id][] = $option_id;
}
break;
case Attribute::TYPE_EZS_REPRINT:
// Automatically added below when appropriate
break;
default:
// case Attribute::TYPE_EZS_ZEWOLOGO:
// case Attribute::TYPE_EZS_EXPRESS:
// case Attribute::TYPE_EZS_PURPOSE_BOLD:
//.........这里部分代码省略.........
示例14: checkPageFrontendProtection
/**
* Checks if this page can be displayed in frontend, redirects to login of not
* @param \Cx\Core\ContentManager\Model\Entity\Page $page Page to check
* @param int $history (optional) Revision of page to use, 0 means current, default 0
*/
public function checkPageFrontendProtection($page, $history = 0)
{
global $sessionObj;
$page_protected = $page->isFrontendProtected();
$pageAccessId = $page->getFrontendAccessId();
if ($history) {
$pageAccessId = $page->getBackendAccessId();
}
// login pages are unprotected by design
$checkLogin = array($page);
while (count($checkLogin)) {
$currentPage = array_pop($checkLogin);
if ($currentPage->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_FALLBACK) {
try {
array_push($checkLogin, $this->getFallbackPage($currentPage));
} catch (ResolverException $e) {
}
}
if ($currentPage->getModule() == 'Login') {
return;
}
}
// Authentification for protected pages
if (($page_protected || $history || !empty($_COOKIE['PHPSESSID'])) && (!isset($_REQUEST['section']) || $_REQUEST['section'] != 'Login')) {
if (empty($sessionObj)) {
$sessionObj = \cmsSession::getInstance();
}
$_SESSION->cmsSessionStatusUpdate('frontend');
if (\FWUser::getFWUserObject()->objUser->login()) {
if ($page_protected) {
if (!\Permission::checkAccess($pageAccessId, 'dynamic', true)) {
$link = base64_encode(\Env::get('cx')->getRequest()->getUrl()->toString());
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . \Cx\Core\Routing\Url::fromModuleAndCmd('Login', 'noaccess', '', array('redirect' => $link)));
exit;
}
}
if ($history && !\Permission::checkAccess(78, 'static', true)) {
$link = base64_encode(\Env::get('cx')->getRequest()->getUrl()->toString());
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . \Cx\Core\Routing\Url::fromModuleAndCmd('Login', 'noaccess', '', array('redirect' => $link)));
exit;
}
} elseif (!empty($_COOKIE['PHPSESSID']) && !$page_protected) {
unset($_COOKIE['PHPSESSID']);
} else {
if (isset($_GET['redirect'])) {
$link = $_GET['redirect'];
} else {
$link = base64_encode(\Env::get('cx')->getRequest()->getUrl()->toString());
}
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . \Cx\Core\Routing\Url::fromModuleAndCmd('Login', '', '', array('redirect' => $link)));
exit;
}
}
}
示例15: overview
//.........这里部分代码省略.........
// get comments count
if ($this->arrSettings['news_comments_activated'] == 1) {
$ccResult = $objDatabase->Execute('
SELECT COUNT(1) AS `com_num`
FROM `' . DBPREFIX . 'module_news_comments`
WHERE `newsid` = ' . $newsId . '
');
if ($ccResult !== false && !empty($ccResult->fields['com_num'])) {
$this->_objTpl->setVariable('NEWS_COMMENTS_COUNT', $ccResult->fields['com_num']);
$this->_objTpl->parse('news_comments_data');
} else {
$this->_objTpl->hideBlock('news_comments_data');
}
} else {
$this->_objTpl->hideBlock('news_comments_data');
}
if ($this->arrSettings['news_use_types'] == 1) {
$this->_objTpl->setVariable('NEWS_TYPE', contrexx_raw2xhtml($news['lang'][$selectedInterfaceLanguage]['typename']));
$this->_objTpl->parse('news_type_data');
} else {
$this->_objTpl->hideBlock('news_type_data');
}
$langString = '';
if (count(\FWLanguage::getActiveFrontendLanguages()) > 1) {
$langState = array();
foreach ($news['lang'] as $langId => $langValues) {
$langState[$langId] = 'active';
}
$langString = \Html::getLanguageIcons($langState, 'index.php?cmd=News&act=edit&newsId=' . $newsId . '&langId=%1$d');
$this->_objTpl->touchBlock('txt_languages_block');
} else {
$this->_objTpl->hideBlock('txt_languages_block');
}
$previewLink = \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', $news['catIds']), '', array('newsid' => $newsId));
$previewLink .= '&newsPreview=1';
$this->_objTpl->setVariable(array('NEWS_ID' => $newsId, 'NEWS_DATE' => date(ASCMS_DATE_FORMAT, $news['date']), 'NEWS_TITLE' => contrexx_raw2xhtml($news['lang'][$selectedInterfaceLanguage]['title']), 'NEWS_USER' => $author, 'NEWS_CHANGELOG' => date(ASCMS_DATE_FORMAT, $news['changelog']), 'NEWS_LIST_PARSING' => $paging, 'NEWS_CLASS' => $class, 'NEWS_CATEGORY' => contrexx_raw2xhtml($news['lang'][$selectedInterfaceLanguage]['catname']), 'NEWS_STATUS' => $news['status'], 'NEWS_STATUS_PICTURE' => $statusPicture, 'NEWS_LANGUAGES' => $langString, 'NEWS_PREVIEW_LINK_HREF' => $previewLink));
$this->_objTpl->setVariable(array('NEWS_ACTIVATE' => $_ARRAYLANG['TXT_ACTIVATE'], 'NEWS_DEACTIVATE' => $_ARRAYLANG['TXT_DEACTIVATE']));
if ($this->arrSettings['news_message_protection'] == '1' && $news['frontend_access_id']) {
$this->_objTpl->touchBlock('news_message_protected_icon');
$this->_objTpl->hideBlock('news_message_not_protected_icon');
} else {
$this->_objTpl->touchBlock('news_message_not_protected_icon');
$this->_objTpl->hideBlock('news_message_protected_icon');
}
$this->_objTpl->parse('newsrow');
}
}
// set unvalidated list
$query = "SELECT n.id AS id,\n n.date AS date,\n n.changelog AS changelog,\n n.status AS status,\n n.validated AS validated,\n n.typeid AS typeid,\n n.frontend_access_id,\n n.userid\n FROM " . DBPREFIX . "module_news AS n\n WHERE n.validated='0'";
$objResult = $objDatabase->Execute($query);
if ($objResult != false) {
$count = $objResult->RecordCount();
if (isset($_GET['show']) && $_GET['show'] == 'archive' && isset($_GET['pos'])) {
$pos = 0;
} else {
$pos = isset($_GET['pos']) ? intval($_GET['pos']) : 0;
}
if ($count > intval($_CONFIG['corePagingLimit'])) {
$paging = getPaging($count, $pos, '&cmd=News', $_ARRAYLANG['TXT_NEWS_MESSAGES'], true);
} else {
$paging = '';
}
$objResult = $objDatabase->SelectLimit($query, $_CONFIG['corePagingLimit'], $pos);
$arrNews = array();
while (!$objResult->EOF) {
$arrNews[$objResult->fields['id']] = array('date' => $objResult->fields['date'], 'changelog' => $objResult->fields['changelog'], 'status' => $objResult->fields['status'], 'validated' => $objResult->fields['validated'], 'frontend_access_id' => $objResult->fields['frontend_access_id'], 'userid' => $objResult->fields['userid']);