/** * Load your component. * * @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page */ public function load(\Cx\Core\ContentManager\Model\Entity\Page $page) { global $objTemplate, $sessionObj; switch ($this->cx->getMode()) { case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND: if (!isset($sessionObj) || !is_object($sessionObj)) { $sessionObj = \cmsSession::getInstance(); } $objLogin = new \Cx\Core_Modules\Login\Controller\Login(\Env::get('cx')->getPage()->getContent()); $pageTitle = \Env::get('cx')->getPage()->getTitle(); $pageMetaTitle = \Env::get('cx')->getPage()->getMetatitle(); \Env::get('cx')->getPage()->setContent($objLogin->getContent($pageMetaTitle, $pageTitle)); break; case \Cx\Core\Core\Controller\Cx::MODE_BACKEND: if (\FWUser::getFWUserObject()->objUser->login(true)) { \Cx\Core\Csrf\Controller\Csrf::header('location: index.php'); } $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html'); $objTemplate = $this->cx->getTemplate(); $objLoginManager = new \Cx\Core_Modules\Login\Controller\LoginManager(); $objLoginManager->getPage(); break; default: break; } }
/** * Redirects the browser to the noaccess webpage. * * @return void */ public static function noAccess($redirect = null) { global $objInit; $objFWUser = FWUser::getFWUserObject(); \Cx\Core\Csrf\Controller\Csrf::header('Location: ' . CONTREXX_DIRECTORY_INDEX . '?' . ($objInit->mode == 'backend' ? '' : 'section=Login&' . (!empty($redirect) ? 'redirect=' . $redirect . '&' : '')) . ($objFWUser->objUser->login() ? 'cmd=noaccess' : '')); exit; }
/** * Constructor */ function __construct($intAction, $intEntryId, $name) { global $objDatabase, $_CONFIG; parent::__construct('.', $name); $this->intAction = intval($intAction); $this->intEntryId = intval($intEntryId); $objRSCheckAction = $objDatabase->Execute("SELECT default_recipient, need_auth FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_mail_actions WHERE id='" . $this->intAction . "' LIMIT 1"); if ($objRSCheckAction !== false) { $this->intNeedAuth = $objRSCheckAction->fields['need_auth']; $objRSEntryUserId = $objDatabase->Execute("SELECT added_by FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_entries WHERE id='" . $this->intEntryId . "' LIMIT 1"); $objFWUser = \FWUser::getFWUserObject(); if (!($this->objUser = $objFWUser->objUser->getUser($id = intval($objRSEntryUserId->fields['added_by'])))) { $this->objUser = false; } if ($objRSCheckAction->fields['default_recipient'] == 'admin') { $this->arrRecipients[] = $_CONFIG['coreAdminEmail']; } else { if ($this->objUser != false) { $this->arrRecipients[] = $this->objUser->getEmail(); } } } if (!empty($this->arrRecipients)) { self::loadTemplate(); if (!empty($this->strTemplate) && !empty($this->strTitle)) { self::parsePlaceholders(); self::sendMail(); } } }
function __getAccessUserPlaceholder($strPlaceHolder) { global $objDatabase, $objInit; if ($objInit->mode == 'frontend') { if (!\FWUser::getFWUserObject()->objUser->login()) { return; } $objFWUser = \FWUser::getFWUserObject(); $objUser = $objFWUser->objUser; $strFieldName = substr($strPlaceHolder, 14); $strFieldName = strtolower(substr($strFieldName, 0, -2)); if ($objUser->getId()) { $intUserId = intval($objUser->getId()); switch ($strFieldName) { case 'email': $strValue = $objUser->getEmail() != "" ? $objUser->getEmail() : ''; break; case 'username': $strValue = $objUser->getUsername() != "" ? $objUser->getUsername() : ''; break; case 'country': //if(intval($strFieldName) != 0) { $strValue = $objUser->getProfileAttribute($strFieldName); //} else { // $strValue = $objFWUser->objUser->objAttribute->getById('country_'.$objUser->getProfileAttribute($strFieldName))->getId(); //} break; default: $strValue = $objUser->getProfileAttribute($strFieldName) != "" ? $objUser->getProfileAttribute($strFieldName) : ''; break; } } } return $strValue; }
/** * Sets the user's and the database timezone * @param \Cx\Core\Routing\Url $request Request URL */ public function preResolve(\Cx\Core\Routing\Url $request) { $databaseTimezoneString = $this->cx->getDb()->getDb()->getTimezone(); $this->databaseTimezone = new \DateTimeZone($databaseTimezoneString); $internalTimezoneString = \Cx\Core\Setting\Controller\Setting::getValue('timezone', 'Config'); $this->internalTimezone = new \DateTimeZone($internalTimezoneString); $this->userTimezone = \FWUser::getFWUserObject()->objUser->getTimezone(); }
/** * Returns all series dates from the given post data * * @return array Array of dates */ public function getExeceptionDates() { global $objInit, $_CORELANG; if (!\FWUser::getFWUserObject()->objUser->login() || $objInit->mode != 'backend') { throw new \Exception($_CORELANG['TXT_ACCESS_DENIED_DESCRIPTION']); } $calendarLib = new \Cx\Modules\Calendar\Controller\CalendarLibrary(); return $calendarLib->getExeceptionDates(); }
function getHomeTopNews($catId = 0) { global $_CORELANG, $objDatabase; $catId = intval($catId); $i = 0; $this->_objTemplate->setTemplate($this->_pageContent, true, true); if ($this->_objTemplate->blockExists('newsrow')) { $this->_objTemplate->setCurrentBlock('newsrow'); } else { return null; } $newsLimit = intval($this->arrSettings['news_top_limit']); if ($newsLimit > 50) { //limit to a maximum of 50 news $newsLimit = 50; } if ($newsLimit < 1) { //do not get any news if 0 was specified as the limit. $objResult = false; } else { //fetch news $objResult = $objDatabase->SelectLimit("\n SELECT DISTINCT(tblN.id) AS id,\n tblN.`date`, \n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblN.redirect,\n tblN.publisher,\n tblN.publisher_id,\n tblN.author,\n tblN.author_id,\n tblL.title AS title, \n tblL.teaser_text\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id=tblN.id\n INNER JOIN " . DBPREFIX . "module_news_rel_categories AS tblC ON tblC.news_id=tblL.news_id\n WHERE tblN.status=1" . ($catId > 0 ? " AND tblC.category_id={$catId}" : '') . "\n AND tblN.teaser_only='0'\n AND tblL.lang_id=" . FRONTEND_LANG_ID . "\n AND (startdate<='" . date('Y-m-d H:i:s') . "' OR startdate='0000-00-00 00:00:00')\n AND (enddate>='" . date('Y-m-d H:i:s') . "' OR enddate='0000-00-00 00:00:00')" . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid=" . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '') . "ORDER BY\n (SELECT COUNT(*) FROM " . DBPREFIX . "module_news_stats_view WHERE news_id=tblN.id AND time>'" . date_format(date_sub(date_create('now'), date_interval_create_from_date_string(intval($this->arrSettings['news_top_days']) . ' day')), 'Y-m-d H:i:s') . "') DESC", $newsLimit); } if ($objResult !== false && $objResult->RecordCount()) { while (!$objResult->EOF) { $newsid = $objResult->fields['id']; $newstitle = $objResult->fields['title']; $author = \FWUser::getParsedUserTitle($objResult->fields['author_id'], $objResult->fields['author']); $publisher = \FWUser::getParsedUserTitle($objResult->fields['publisher_id'], $objResult->fields['publisher']); $newsCategories = $this->getCategoriesByNewsId($newsid); $newsUrl = empty($objResult->fields['redirect']) ? \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), array($catId))), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $objResult->fields['redirect']; $htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle)); list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($objResult->fields['teaser_image_path'], $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl); $this->_objTemplate->setVariable(array('NEWS_ID' => $newsid, 'NEWS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_TEASER' => nl2br($objResult->fields['teaser_text']), 'NEWS_LINK' => $htmlLink, 'NEWS_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher))); if (!empty($image)) { $this->_objTemplate->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage)); if ($this->_objTemplate->blockExists('news_image')) { $this->_objTemplate->parse('news_image'); } } else { if ($this->_objTemplate->blockExists('news_image')) { $this->_objTemplate->hideBlock('news_image'); } } self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'image_thumbnail'); self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_path'], $newstitle, $newsUrl, 'image_detail'); $this->_objTemplate->parseCurrentBlock(); $i++; $objResult->MoveNext(); } } else { $this->_objTemplate->hideBlock('newsrow'); } $this->_objTemplate->setVariable("TXT_MORE_NEWS", $_CORELANG['TXT_MORE_NEWS']); return $this->_objTemplate->get(); }
function getHomeHeadlines($catId = 0) { global $_CORELANG, $objDatabase, $_LANGID; $i = 0; $catId = intval($catId); $this->_objTemplate->setTemplate($this->_pageContent, true, true); $newsLimit = intval($this->arrSettings['news_headlines_limit']); if ($newsLimit > 50) { //limit to a maximum of 50 news $newsLimit = 50; } if ($newsLimit < 1) { //do not get any news if 0 was specified as the limit. $objResult = false; } else { //fetch news $objResult = $objDatabase->SelectLimit("\n SELECT DISTINCT(tblN.id) AS id,\n tblN.`date`, \n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblN.redirect,\n tblN.publisher,\n tblN.publisher_id,\n tblN.author,\n tblN.author_id,\n tblL.text NOT REGEXP '^(<br type=\"_moz\" />)?\$' AS newscontent,\n tblL.title AS title, \n tblL.teaser_text\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id=tblN.id\n INNER JOIN " . DBPREFIX . "module_news_rel_categories AS tblC ON tblC.news_id=tblL.news_id\n WHERE tblN.status=1" . ($catId > 0 ? " AND tblC.category_id={$catId}" : '') . "\n AND tblN.teaser_only='0'\n AND tblL.lang_id=" . $_LANGID . "\n AND tblL.is_active=1\n AND (startdate<='" . date('Y-m-d H:i:s') . "' OR startdate='0000-00-00 00:00:00')\n AND (enddate>='" . date('Y-m-d H:i:s') . "' OR enddate='0000-00-00 00:00:00')" . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid=" . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '') . "ORDER BY date DESC", $newsLimit); } if ($objResult !== false && $objResult->RecordCount() >= 0) { while (!$objResult->EOF) { $newsid = $objResult->fields['id']; $newstitle = $objResult->fields['title']; $newsCategories = $this->getCategoriesByNewsId($newsid); $newsUrl = empty($objResult->fields['redirect']) ? empty($objResult->fields['newscontent']) ? '' : \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), array($catId))), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $objResult->fields['redirect']; $htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle), 'headlineLink'); $htmlLinkTitle = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle)); // in case that the message is a stub, we shall just display the news title instead of a html-a-tag with no href target if (empty($htmlLinkTitle)) { $htmlLinkTitle = contrexx_raw2xhtml($newstitle); } list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($objResult->fields['teaser_image_path'], $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl); $author = \FWUser::getParsedUserTitle($objResult->fields['author_id'], $objResult->fields['author']); $publisher = \FWUser::getParsedUserTitle($objResult->fields['publisher_id'], $objResult->fields['publisher']); $this->_objTemplate->setVariable(array('NEWS_ID' => $newsid, 'NEWS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_TEASER' => nl2br($objResult->fields['teaser_text']), 'NEWS_LINK_TITLE' => $htmlLinkTitle, 'NEWS_LINK' => $htmlLink, 'NEWS_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher), 'HEADLINE_ID' => $newsid, 'HEADLINE_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'HEADLINE_TEXT' => nl2br($objResult->fields['teaser_text']), 'HEADLINE_LINK' => $htmlLinkTitle, 'HEADLINE_AUTHOR' => contrexx_raw2xhtml($author))); if (!empty($image)) { $this->_objTemplate->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage, 'HEADLINE_IMAGE_PATH' => contrexx_raw2xhtml($objResult->fields['teaser_image_path']), 'HEADLINE_THUMBNAIL_PATH' => contrexx_raw2xhtml($imageSource))); if ($this->_objTemplate->blockExists('news_image')) { $this->_objTemplate->parse('news_image'); } } else { if ($this->_objTemplate->blockExists('news_image')) { $this->_objTemplate->hideBlock('news_image'); } } self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'image_thumbnail'); self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_path'], $newstitle, $newsUrl, 'image_detail'); $this->_objTemplate->parse('headlines_row'); $i++; $objResult->MoveNext(); } } else { $this->_objTemplate->hideBlock('headlines_row'); } $this->_objTemplate->setVariable("TXT_MORE_NEWS", $_CORELANG['TXT_MORE_NEWS']); return $this->_objTemplate->get(); }
/** * Constructor -> Create the module-menu and an internal template-object * @global object $objInit * @global object $objTemplate * @global array $_CORELANG */ function __construct() { global $objInit, $objTemplate, $_ARRAYLANG, $_CORELANG; $this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_MODULE_PATH . '/U2u/View/Template/Backend'); \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl); $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE); $this->_intLanguageId = $objInit->userFrontendLangId; $objFWUser = \FWUser::getFWUserObject(); $this->_intCurrentUserId = $objFWUser->objUser->getId(); }
function initializeTeasers() { global $objDatabase, $_CORELANG; $this->arrTeasers = array(); $this->getSettings(); $objResult = $objDatabase->Execute("\n SELECT tblN.id,\n tblN.date,\n tblN.userid,\n tblN.teaser_frames,\n tblN.redirect,\n tblN.teaser_show_link,\n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblL.title,\n tblL.text AS teaser_full_text,\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 WHERE tblL.lang_id=" . FRONTEND_LANG_ID . ($this->administrate == false ? " AND tblN.validated='1'\n AND tblN.status='1'\n AND tblL.is_active=1\n AND (tblN.startdate<='" . date('Y-m-d H:i:s') . "' OR tblN.startdate='0000-00-00 00:00:00') AND (tblN.enddate>='" . date('Y-m-d H:i:s') . "' OR tblN.enddate='0000-00-00 00:00:00')" : "") . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (tblN.frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid = " . $objFWUser->objUser->getId() . ") " : " AND tblN.frontend_access_id=0 " : '') . "\n ORDER BY date DESC"); if ($objResult !== false) { while (!$objResult->EOF) { $arrFrames = explode(';', $objResult->fields['teaser_frames']); foreach ($arrFrames as $frameId) { if (!isset($this->arrFrameTeaserIds[$frameId])) { $this->arrFrameTeaserIds[$frameId] = array(); } array_push($this->arrFrameTeaserIds[$frameId], $objResult->fields['id']); } if (!empty($objResult->fields['redirect'])) { $extUrl = substr($objResult->fields['redirect'], 7); $tmp = explode('/', $extUrl); $extUrl = "(" . $tmp[0] . ")"; } else { $extUrl = ""; } if ($this->administrate == false) { $objFWUser = \FWUser::getFWUserObject(); $objUser = $objFWUser->objUser->getUser($objResult->fields['userid']); if ($objUser) { $firstname = $objUser->getProfileAttribute('firstname'); $lastname = $objUser->getProfileAttribute('lastname'); if (!empty($firstname) && !empty($lastname)) { $author = contrexx_raw2xhtml($firstname . ' ' . $lastname); } else { $author = contrexx_raw2xhtml($objUser->getUsername()); } } else { $author = $_CORELANG['TXT_ANONYMOUS']; } } else { $author = ''; } if (!empty($objResult->fields['teaser_image_thumbnail_path'])) { $image = $objResult->fields['teaser_image_thumbnail_path']; } elseif (!empty($objResult->fields['teaser_image_path']) && file_exists(ASCMS_PATH . \ImageManager::getThumbnailFilename($objResult->fields['teaser_image_path']))) { $image = \ImageManager::getThumbnailFilename($objResult->fields['teaser_image_path']); } elseif (!empty($objResult->fields['teaser_image_path'])) { $image = $objResult->fields['teaser_image_path']; } else { $image = ASCMS_CORE_MODULE_WEB_PATH . '/News/View/Media/pixel.gif'; } $newsCategories = $this->getCategoriesByNewsId($objResult->fields['id']); $this->arrTeasers[$objResult->fields['id']] = array('id' => $objResult->fields['id'], 'date' => $objResult->fields['date'], 'title' => $objResult->fields['title'], 'teaser_frames' => $objResult->fields['teaser_frames'], 'redirect' => $objResult->fields['redirect'], 'ext_url' => $extUrl, 'category' => implode(', ', contrexx_raw2xhtml($newsCategories)), 'category_id' => array_keys($newsCategories), 'teaser_full_text' => $objResult->fields['teaser_full_text'], 'teaser_text' => $objResult->fields['teaser_text'], 'teaser_show_link' => $objResult->fields['teaser_show_link'], 'author' => $author, 'teaser_image_path' => $image); $objResult->MoveNext(); } } }
/** * Returns an array of method names accessable from a JSON request * @return array List of method names */ public function getAccessableMethods() { // at the moment we only allow backend users to edit ViewGenerator over json/ajax. // As soon as we have permissions on entity level we can change this, so getViewOverJson can also be used from frontend $objBackendGroups = \FWUser::getFWUserObject()->objGroup->getGroups(array('is_active' => true, 'type' => 'backend'), null, array('group_id')); $backendGroups = array(); while (!$objBackendGroups->EOF) { $backendGroups[] = $objBackendGroups->getId(); $objBackendGroups->next(); } return array('getViewOverJson' => new \Cx\Core_Modules\Access\Model\Entity\Permission(null, null, true, $backendGroups), 'updateOrder' => new \Cx\Core_Modules\Access\Model\Entity\Permission(array('http', 'https'), array('post'), true)); }
public function jumpUploaderL10n($langCode) { //the messages are sent via request because of basic auth problems with a path for the .zip-file that is different from the path the browser authenticated himself against. require_once ASCMS_LIBRARY_PATH . '/PEAR/Download.php'; $download = new HTTP_Download(); //load correct language file $objFWUser = \FWUser::getFWUserObject(); $download->setFile(ASCMS_CORE_MODULE_PATH . '/Upload/ressources/uploaders/jump/messages_' . $langCode . '.zip'); $download->setContentType('application/zip'); $download->send(); die; }
protected function setUpdatedByCurrentlyLoggedInUser($eventArgs) { $entity = $eventArgs->getEntity(); $em = $eventArgs->getEntityManager(); $uow = $em->getUnitOfWork(); if ($entity instanceof \Cx\Core\ContentManager\Model\Entity\Page) { $entity->setUpdatedBy(\FWUser::getFWUserObject()->objUser->getUsername()); if (\Env::get('em')->contains($entity)) { $uow->recomputeSingleEntityChangeSet($em->getClassMetadata('Cx\\Core\\ContentManager\\Model\\Entity\\Page'), $entity); } else { $uow->computeChangeSet($em->getClassMetadata('Cx\\Core\\ContentManager\\Model\\Entity\\Page'), $entity); } } }
/** * Create's new rss feed for the calendar module * * @global array $_CONFIG * @global object $objDatabase */ function creatFeed() { global $_CONFIG, $objDatabase; parent::getFrontendLanguages(); parent::getSettings(); $this->objEventManager->getEventlist(); foreach ($this->arrFrontendLanguages as $langKey => $arrFrontendLanguage) { $objRSSWriter = new \RSSWriter(); $objRSSWriter->characterEncoding = CONTREXX_CHARSET; $objRSSWriter->channelTitle = contrexx_raw2xml($this->arrSettings['rssFeedTitle']); $objRSSWriter->channelLink = contrexx_raw2xml($this->domainUrl . 'index.php?section=' . $this->moduleName); $objRSSWriter->channelDescription = contrexx_raw2xml($this->arrSettings['rssFeedDescription']); $objRSSWriter->channelLanguage = contrexx_raw2xml($arrFrontendLanguage['lang']); $objRSSWriter->channelCopyright = contrexx_raw2xml('Copyright ' . date('Y') . ', ' . $this->domainUrl); if (!empty($this->arrSettings['rssFeedImage'])) { $objRSSWriter->channelImageUrl = $this->arrSettings['rssFeedImage']; $objRSSWriter->channelImageTitle = $objRSSWriter->channelTitle; $objRSSWriter->channelImageLink = $objRSSWriter->channelLink; } $objRSSWriter->channelWebMaster = $_CONFIG['coreAdminEmail']; $objRSSWriter->channelLastBuildDate = date('r', mktime()); foreach ($this->objEventManager->eventList as $eventKey => $objEvent) { $objFWUser = \FWUser::getFWUserObject(); $showIn = explode(',', $objEvent->showIn); if (in_array($arrFrontendLanguage['id'], $showIn)) { $itemTitle = contrexx_raw2xml(html_entity_decode($objEvent->arrData['title'][$arrFrontendLanguage['id']], ENT_QUOTES, CONTREXX_CHARSET)); $itemLink = $objEvent->type == 0 ? $this->domainUrl . $this->objEventManager->_getDetailLink($objEvent) : $objEvent->arrData['redirect'][$arrFrontendLanguage['id']]; $itemLink = contrexx_raw2xml(html_entity_decode($itemLink)); $itemDescription = contrexx_raw2xml($objEvent->arrData['description'][$arrFrontendLanguage['id']]); if ($objUser = $objFWUser->objUser->getUser(intval($objEvent->author))) { $itemAuthor = $objUser->getEmail(); } else { $itemAuthor = "unknown"; } $itemAuthor = contrexx_raw2xml($itemAuthor); $itemCategory = array(); $itemComments = null; $itemEnclosure = array(); $itemGuid = array(); $itemPubDate = contrexx_raw2xml($objEvent->startDate); $itemSource = array(); $objRSSWriter->addItem($itemTitle, $itemLink, $itemDescription, $itemAuthor, $itemCategory, $itemComments, $itemEnclosure, $itemGuid, $itemPubDate, $itemSource); } } $objRSSWriter->feedType = 'xml'; $objRSSWriter->xmlDocumentPath = \Env::get('cx')->getWebsiteFeedPath() . '/calendar_all_' . $arrFrontendLanguage['lang'] . '.' . $objRSSWriter->feedType; $objRSSWriter->write(); } }
/** * Get the user name * * @param integer $userId * * @return string */ public function getUpdatedUserName($userId, $currentUser) { $objFwUser = \FWUser::getFWUserObject(); if (!empty($userId)) { $objUser = $objFwUser->objUser->getUser($userId); if ($objUser) { return $objUser->getUsername(); } } else { if (empty($userId) && $currentUser) { return array('id' => $objFwUser->objUser->getId(), 'name' => $objFwUser->objUser->getUsername()); } } return false; }
/** * Load your component. * * @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page */ public function load(\Cx\Core\ContentManager\Model\Entity\Page $page) { global $_CORELANG, $subMenuTitle, $objTemplate; switch ($this->cx->getMode()) { case \Cx\Core\Core\Controller\Cx::MODE_BACKEND: $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html'); $cachedRoot = $this->cx->getTemplate()->getRoot(); $this->cx->getTemplate()->setRoot($this->getDirectory() . '/View/Template/Backend'); $objTemplate->setVariable('CONTAINER_DASHBOARD_CLASS', 'dashboard'); $objFWUser = \FWUser::getFWUserObject(); $subMenuTitle = $_CORELANG['TXT_WELCOME_MESSAGE'] . ", <a href='index.php?cmd=Access&act=user&tpl=modify&id=" . $objFWUser->objUser->getId() . "' title='" . $objFWUser->objUser->getId() . "'>" . ($objFWUser->objUser->getProfileAttribute('firstname') || $objFWUser->objUser->getProfileAttribute('lastname') ? htmlentities($objFWUser->objUser->getProfileAttribute('firstname'), ENT_QUOTES, CONTREXX_CHARSET) . ' ' . htmlentities($objFWUser->objUser->getProfileAttribute('lastname'), ENT_QUOTES, CONTREXX_CHARSET) : htmlentities($objFWUser->objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET)) . "</a>"; $objAdminNav = new Home(); $objAdminNav->getPage(); $this->cx->getTemplate()->setRoot($cachedRoot); break; } }
/** * Constructor * * @param string * @access public */ function __construct() { global $_CORELANG, $objTemplate; $administratorsOnline = ''; if ($objUser = \FWUser::getFWUserObject()->objUser->getUsers($filter = array('is_admin' => true, 'active' => true, 'last_activity' => array('>' => time() - 3600)))) { $arrAdministratorsOnline = array(); $i = 0; while (!$objUser->EOF) { $arrAdministratorsOnline[$i]['id'] = $objUser->getId(); $arrAdministratorsOnline[$i++]['username'] = $objUser->getUsername(); $objUser->next(); } for ($i = 0; $i < count($arrAdministratorsOnline); $i++) { $administratorsOnline .= '<a href="index.php?cmd=Access&act=user&tpl=modify&id=' . $arrAdministratorsOnline[$i]['id'] . '">' . $arrAdministratorsOnline[$i]['username'] . ($i == count($arrAdministratorsOnline) - 1 ? '' : ',') . '</a>'; } } $objTemplate->setVariable('CONTENT_NAVIGATION', '<span id="administrators_online">' . $_CORELANG['TXT_ADMINISTSRATORS_ONLINE'] . ': </span>' . $administratorsOnline); }
/** * FeedBack Form * * @global array $_ARRAYLANG */ public function showFeedBackForm() { global $_ARRAYLANG; $objUser = \FWUser::getFWUserObject(); //feed back types $feedBackTypes = array($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_SELECT_FEEDBACK'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_BUG_REPORT'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_FEATURE_REQUEST'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_HAVE_QUESTION']); \Cx\Core\Setting\Controller\Setting::init('Support', 'setup', 'Yaml'); $faqUrl = \Cx\Core\Setting\Controller\Setting::getValue('faqUrl', 'Support'); $recipientMailAddress = \Cx\Core\Setting\Controller\Setting::getValue('recipientMailAddress', 'Support'); $faqLink = '<a target="_blank" title="click to FAQ page" href=' . $faqUrl . '>' . $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_FAQ'] . '</a>'; //Get License information $license = \Env::get('cx')->getLicense(); $licenseName = $license->getEditionName(); $licenseValid = date(ASCMS_DATE_FORMAT_DATE, $license->getValidToDate()); $licenseVersion = $license->getVersion()->getNumber(); //get the input datas $feedBackType = isset($_POST['feedBackType']) ? contrexx_input2raw($_POST['feedBackType']) : ''; $feedBackSubject = isset($_POST['feedBackSubject']) ? contrexx_input2raw($_POST['feedBackSubject']) : ''; $feedBackComment = isset($_POST['feedBackComment']) ? contrexx_input2raw($_POST['feedBackComment']) : ''; $customerName = isset($_POST['customerName']) ? contrexx_input2raw($_POST['customerName']) : ''; $customerEmailId = isset($_POST['customerEmailId']) ? contrexx_input2raw($_POST['customerEmailId']) : ''; $feedBackUrl = isset($_POST['feedBackUrl']) ? contrexx_input2raw($_POST['feedBackUrl']) : ''; if (isset($_POST['sendAndSave'])) { if (!empty($feedBackSubject) && !empty($feedBackComment)) { //get the hostname domain $domainRepo = new \Cx\Core\Net\Model\Repository\DomainRepository(); $domain = $domainRepo->findOneBy(array('id' => 0)); $arrFields = array('name' => contrexx_raw2xhtml($customerName), 'fromEmail' => contrexx_raw2xhtml($customerEmailId), 'feedBackType' => $feedBackType != 0 ? contrexx_raw2xhtml($feedBackTypes[$feedBackType]) : '', 'url' => $faqUrl, 'comments' => contrexx_raw2xhtml($feedBackComment), 'subject' => contrexx_raw2xhtml($feedBackSubject), 'firstName' => $objUser->objUser->getProfileAttribute('firstname'), 'lastName' => $objUser->objUser->getProfileAttribute('lastname'), 'phone' => !$objUser->objUser->getProfileAttribute('phone_office') ? $objUser->objUser->getProfileAttribute('phone_mobile') : $objUser->objUser->getProfileAttribute('phone_office'), 'company' => $objUser->objUser->getProfileAttribute('company'), 'toEmail' => $recipientMailAddress, 'licenseName' => $licenseName, 'licenseValid' => $licenseValid, 'licenseVersion' => $licenseVersion, 'domainName' => $domain ? $domain->getName() : ''); //send the feedBack mail $this->sendMail($arrFields) ? \Message::ok($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_EMAIL_SEND_SUCESSFULLY']) : \Message::error($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_EMAIL_SEND_FAILED']); } else { \Message::error($_ARRAYLANG['TXT_SUPPORT_ERROR_MSG_FIELDS_EMPTY']); $this->template->setVariable(array('TXT_SUPPORT_ERROR_CLASS_SUBJECT' => !empty($feedBackSubject) ? "" : "errBoxStyle", 'TXT_SUPPORT_ERROR_CLASS_COMMENT' => !empty($feedBackComment) ? "" : "errBoxStyle", 'SUPPORT_FEEDBACK_SUBJECT' => contrexx_raw2xhtml($feedBackSubject), 'SUPPORT_FEEDBACK_COMMENT' => contrexx_raw2xhtml($feedBackComment))); } } //show FeedBack Types foreach ($feedBackTypes as $key => $feedbackType) { $this->template->setVariable(array('SUPPORT_FEEDBACK_TYPES' => $feedbackType, 'SUPPORT_FEEDBACK_SELECTED_TYPE' => !empty($feedBackType) && $feedBackType == $key ? 'selected' : '', 'SUPPORT_FEEDBACK_ID' => $key)); $this->template->parse('showFeedBackTypes'); } $this->template->setVariable(array('SUPPORT_FEEDBACK_FAQ' => $faqLink, 'SUPPORT_FEEDBACK_CUSTOMER_NAME' => $objUser->objUser->getUsername(), 'SUPPORT_FEEDBACK_CUSTOMER_EMAIL' => $objUser->objUser->getEmail())); $this->template->setVariable(array('TXT_SUPPORT_FEEDBACK' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK'], 'TXT_SUPPORT_FEEDBACK_SUBJECT' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_SUBJECT'], 'TXT_SUPPORT_FEEDBACK_COMMENTS' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_COMMENTS'])); }
private function init() { global $_CORELANG, $_ARRAYLANG, $objDatabase; $objFWUser = FWUser::getFWUserObject(); $sqlWhereString = ""; if (!$objFWUser->objUser->getAdminStatus()) { if (count($objFWUser->objUser->getStaticPermissionIds()) > 0) { $sqlWhereString = " AND (areas.access_id = " . implode(' OR areas.access_id = ', $objFWUser->objUser->getStaticPermissionIds()) . ")"; } else { $sqlWhereString = " AND areas.access_id='' "; } $sqlWhereString .= " OR areas.access_id='0' "; } $query = "\n SELECT\n areas.area_id AS area_id,\n areas.parent_area_id AS parent_area_id,\n areas.area_name AS area_name,\n areas.type AS type,\n areas.uri AS uri,\n areas.target AS target,\n modules.name AS module_name,\n modules.is_active,\n modules.is_licensed,\n areas.module_id\n FROM\n " . DBPREFIX . "backend_areas AS areas\n INNER JOIN\n " . DBPREFIX . "modules AS modules\n ON\n modules.id=areas.module_id\n WHERE\n areas.is_active=1\n AND (areas.type = 'group' OR areas.type = 'navigation')\n " . "\n " . $sqlWhereString . "\n ORDER BY\n areas.order_id ASC\n "; $objResult = $objDatabase->Execute($query); // ADD A JOIN TO MODULE TABLE HERE TO SEE IF THE MODULE IS ACTIVE if ($objResult !== false) { while (!$objResult->EOF) { if ($objResult->fields['type'] == "group") { $this->arrMenuGroups[$objResult->fields['area_id']] = $objResult->fields['area_name']; } if (isset($_CORELANG[$objResult->fields['area_name']])) { $name = $_CORELANG[$objResult->fields['area_name']]; } else { $arrLang = $_ARRAYLANG; // load language file \Env::get('init')->loadLanguageData($objResult->fields['module_name']); if (isset($_ARRAYLANG[$objResult->fields['area_name']])) { $name = $_ARRAYLANG[$objResult->fields['area_name']]; } else { $name = ''; } $_ARRAYLANG = $arrLang; } $this->arrMenuItems[$objResult->fields['area_id']] = array($objResult->fields['parent_area_id'], $name, $objResult->fields['uri'], $objResult->fields['target'], $objResult->fields['module_name'], $objResult->fields['is_licensed'] == 1 || $objResult->fields['module_id'] == 0); $objResult->MoveNext(); } } }
public function SearchFindContent($search) { $term_db = $search->getTerm(); $flagIsReseller = false; $objUser = \FWUser::getFWUserObject()->objUser; if ($objUser->login()) { $objCustomer = \Cx\Modules\Shop\Controller\Customer::getById($objUser->getId()); \Cx\Core\Setting\Controller\Setting::init('Shop', 'config'); if ($objCustomer && $objCustomer->is_reseller()) { $flagIsReseller = true; } } $querySelect = $queryCount = $queryOrder = null; list($querySelect, $queryCount, $queryTail, $queryOrder) = \Cx\Modules\Shop\Controller\Products::getQueryParts(null, null, null, $term_db, false, false, '', $flagIsReseller); $query = $querySelect . $queryTail . $queryOrder; //Search query $parseSearchData = function (&$searchData) { $searchData['title'] = $searchData['name']; $searchData['content'] = $searchData['long'] ? $searchData['long'] : $searchData['short']; $searchData['score'] = $searchData['score1'] + $searchData['score2'] + $searchData['score3']; }; $result = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($search->getResultArray($query, 'Shop', 'details', 'productId=', $search->getTerm(), $parseSearchData)); $search->appendResult($result); }
/** * This function returns the ViewGeneration options for a given entityClass * * @access protected * @global $_ARRAYLANG * @param $entityClassName contains the FQCN from entity * @return array with options */ protected function getViewGeneratorOptions($entityClassName) { global $_ARRAYLANG; $classNameParts = explode('\\', $entityClassName); $classIdentifier = end($classNameParts); $langVarName = 'TXT_' . strtoupper($this->getType() . '_' . $this->getName() . '_ACT_' . $classIdentifier); $header = ''; if (isset($_ARRAYLANG[$langVarName])) { $header = $_ARRAYLANG[$langVarName]; } switch ($entityClassName) { case 'Cx\\Modules\\Order\\Model\\Entity\\Order': return 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(); if (!$productEntity) { continue; } $productEntityName = $subscription->getProduct()->getName(); $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); })))); break; case 'Cx\\Modules\\Order\\Model\\Entity\\Subscription': return 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) { $subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription'); $subscription = $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; } $subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription'); $subscription = $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; } $subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription'); $subscription = $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) { $subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription'); $subscription = $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))); break; default: return array('header' => $header, 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false)); } }
/** * Get username * * @param Integer $userId * * @return String */ function getEmail($userId) { if (!empty($userId)) { $objFWUser = \FWUser::getFWUserObject(); $objUser = $objFWUser->objUser->getUser($userId); $email = $objUser ? $objUser->getEmail() : ''; if ($email) { return $email; } return false; } }
/** * Display and editing Media settings * * @return string parsed content */ function _settings() { global $_CORELANG, $_ARRAYLANG, $objDatabase; \JS::activate('jquery'); $this->_arrSettings = $this->createSettingsArray(); $objFWUser = \FWUser::getFWUserObject(); $this->_objTpl->loadTemplateFile('module_media_settings.html', true, true); $archive = ''; if (isset($_GET['archive'])) { $archive = contrexx_input2raw($_GET['archive']); } if ($archive == 'FileSharing') { $this->_objTpl->hideBlock('mediaarchive_section'); $objFileshare = new \Cx\Modules\FileSharing\Controller\FileSharingManager($this->_objTpl); $objFileshare->parseSettingsPage(); } else { $this->_objTpl->touchBlock('mediaarchive_section'); } $this->pageTitle = $_ARRAYLANG['TXT_MEDIA_SETTINGS']; $this->_objTpl->setGlobalVariable(array('TXT_MEDIA_ARCHIVE' => $_ARRAYLANG['TXT_MEDIA_ARCHIVE'], 'TXT_FILESHARING' => $_ARRAYLANG['TXT_FILESHARING_MODULE'], 'TXT_MEDIA_SETTINGS' => $_ARRAYLANG['TXT_MEDIA_SETTINGS'], 'TXT_MEDIA_ADD' => $_ARRAYLANG['TXT_MEDIA_ADD'], 'TXT_MEDIA_MANAGE' => $_ARRAYLANG['TXT_MEDIA_MANAGE'], 'TXT_MEDIA_ACCESS_SETTINGS' => $_ARRAYLANG['TXT_MEDIA_ACCESS_SETTINGS'], 'TXT_MEDIA_FRONTEND_FILE_UPLOAD_DESC' => $_ARRAYLANG['TXT_MEDIA_FRONTEND_FILE_UPLOAD_DESC'], 'TXT_MEDIA_FRONTEND_FILE_UPLOAD' => $_ARRAYLANG['TXT_MEDIA_FRONTEND_FILE_UPLOAD'], 'TXT_MEDIA_ADDING_DENIED_FOR_ALL' => $_ARRAYLANG['TXT_MEDIA_ADDING_DENIED_FOR_ALL'], 'TXT_MEDIA_ADDING_ALLOWED_FOR_ALL' => $_ARRAYLANG['TXT_MEDIA_ADDING_ALLOWED_FOR_ALL'], 'TXT_MEDIA_ADDING_ALLOWED_FOR_GROUP' => $_ARRAYLANG['TXT_MEDIA_ADDING_ALLOWED_FOR_GROUP'], 'TXT_MEDIA_AVAILABLE_USER_GROUPS' => $_ARRAYLANG['TXT_MEDIA_AVAILABLE_USER_GROUPS'], 'TXT_MEDIA_ASSIGNED_USER_GROUPS' => $_ARRAYLANG['TXT_MEDIA_ASSIGNED_USER_GROUPS'], 'TXT_MEDIA_CHECK_ALL' => $_ARRAYLANG['TXT_MEDIA_CHECK_ALL'], 'TXT_MEDIA_UNCHECK_ALL' => $_ARRAYLANG['TXT_MEDIA_UNCHECK_ALL'], 'TXT_BUTTON_SAVE' => $_ARRAYLANG['TXT_MEDIA_SAVE'])); for ($k = 1; $k <= 4; $k++) { $arrAssociatedGroupOptions = array(); $arrNotAssociatedGroupOptions = array(); $arrAssociatedGroups = array(); $arrAssociatedGroupManageOptions = array(); $arrNotAssociatedGroupManageOptions = array(); $arrAssociatedManageGroups = array(); $mediaAccessSetting = $this->_arrSettings['media' . $k . '_frontend_changable']; $mediaManageSetting = $this->_arrSettings['media' . $k . '_frontend_managable']; if (!is_numeric($mediaAccessSetting)) { // Get all groups $objGroup = $objFWUser->objGroup->getGroups(); } else { // Get access groups $objGroup = $objFWUser->objGroup->getGroups(array('dynamic' => $mediaAccessSetting)); $arrAssociatedGroups = $objGroup->getLoadedGroupIds(); } $objGroup = $objFWUser->objGroup->getGroups(); while (!$objGroup->EOF) { $option = '<option value="' . $objGroup->getId() . '">' . htmlentities($objGroup->getName(), ENT_QUOTES, CONTREXX_CHARSET) . ' [' . $objGroup->getType() . ']</option>'; if (in_array($objGroup->getId(), $arrAssociatedGroups)) { $arrAssociatedGroupOptions[] = $option; } else { $arrNotAssociatedGroupOptions[] = $option; } $objGroup->next(); } if (!is_numeric($mediaManageSetting)) { // Get all groups $objGroup = $objFWUser->objGroup->getGroups(); } else { // Get access groups $objGroup = $objFWUser->objGroup->getGroups(array('dynamic' => $mediaManageSetting)); $arrAssociatedManageGroups = $objGroup->getLoadedGroupIds(); } $objGroup = $objFWUser->objGroup->getGroups(); while (!$objGroup->EOF) { $option = '<option value="' . $objGroup->getId() . '">' . htmlentities($objGroup->getName(), ENT_QUOTES, CONTREXX_CHARSET) . ' [' . $objGroup->getType() . ']</option>'; if (in_array($objGroup->getId(), $arrAssociatedManageGroups)) { $arrAssociatedGroupManageOptions[] = $option; } else { $arrNotAssociatedGroupManageOptions[] = $option; } $objGroup->next(); } $this->_objTpl->setVariable(array('MEDIA_ARCHIVE_NUMBER' => $k, 'MEDIA_TAB_STYLE' => $k == 1 ? 'block' : 'none', 'MEDIA_ALLOW_USER_CHANGE_ON' => $this->_arrSettings['media' . $k . '_frontend_changable'] == 'on' ? 'checked="checked"' : '', 'MEDIA_ALLOW_USER_CHANGE_OFF' => $this->_arrSettings['media' . $k . '_frontend_changable'] == 'off' ? 'checked="checked"' : '', 'MEDIA_ALLOW_USER_CHANGE_GROUP' => is_numeric($this->_arrSettings['media' . $k . '_frontend_changable']) ? 'checked="checked"' : '', 'MEDIA_ACCESS_DISPLAY' => is_numeric($this->_arrSettings['media' . $k . '_frontend_changable']) ? 'block' : 'none', 'MEDIA_ACCESS_ASSOCIATED_GROUPS' => implode("\n", $arrAssociatedGroupOptions), 'MEDIA_ACCESS_NOT_ASSOCIATED_GROUPS' => implode("\n", $arrNotAssociatedGroupOptions), 'MEDIA_ALLOW_USER_MANAGE_ON' => $this->_arrSettings['media' . $k . '_frontend_managable'] == 'on' ? 'checked="checked"' : '', 'MEDIA_ALLOW_USER_MANAGE_OFF' => $this->_arrSettings['media' . $k . '_frontend_managable'] == 'off' ? 'checked="checked"' : '', 'MEDIA_ALLOW_USER_MANAGE_GROUP' => is_numeric($this->_arrSettings['media' . $k . '_frontend_managable']) ? 'checked="checked"' : '', 'MEDIA_MANAGE_DISPLAY' => is_numeric($this->_arrSettings['media' . $k . '_frontend_managable']) ? 'block' : 'none', 'MEDIA_MANAGE_ASSOCIATED_GROUPS' => implode("\n", $arrAssociatedGroupManageOptions), 'MEDIA_MANAGE_NOT_ASSOCIATED_GROUPS' => implode("\n", $arrNotAssociatedGroupManageOptions))); if ($this->_objTpl->blockExists("mediaAccessSection")) { $this->_objTpl->parse("mediaAccessSection"); } } }
/** * Save the event to the database * * @param array $data * * @return boolean true if saved successfully, false otherwise */ function save($data) { global $objDatabase, $_LANGID, $_CONFIG, $objInit; parent::getSettings(); if (empty($data['startDate']) || empty($data['endDate']) || empty($data['category']) || $data['seriesStatus'] == 1 && $data['seriesType'] == 2 && empty($data['seriesWeeklyDays'])) { return false; } foreach ($_POST['showIn'] as $key => $langId) { if (empty($_POST['title'][$langId]) && empty($_POST['title'][$_LANGID])) { return false; } } list($startDate, $strStartTime) = explode(' ', $data['startDate']); list($startHour, $startMin) = explode(':', $strStartTime); list($endDate, $strEndTime) = explode(' ', $data['endDate']); list($endHour, $endMin) = explode(':', $strEndTime); if ($data['all_day']) { list($startHour, $startMin) = array(0, 0); list($endHour, $endMin) = array(23, 59); } //event data $id = isset($data['copy']) && !empty($data['copy']) ? 0 : (isset($data['id']) ? intval($data['id']) : 0); $type = isset($data['type']) ? intval($data['type']) : 0; $startDate = date("Y-m-d H:i:s", parent::getDateTimestamp($startDate, intval($startHour), intval($startMin))); $endDate = date("Y-m-d H:i:s", parent::getDateTimestamp($endDate, intval($endHour), intval($endMin))); $google = isset($data['map'][$_LANGID]) ? intval($data['map'][$_LANGID]) : 0; $allDay = isset($data['all_day']) ? 1 : 0; $convertBBCode = $objInit->mode == 'frontend' && empty($id); $useCustomDateDisplay = isset($data['showDateSettings']) ? 1 : 0; $showStartDateList = isset($data['showStartDateList']) ? $data['showStartDateList'] : 0; $showEndDateList = isset($data['showEndDateList']) ? $data['showEndDateList'] : 0; if ($objInit->mode == 'backend') { // reset time values if "no time" is selected if ($data['showTimeTypeList'] == 0) { $showStartTimeList = 0; $showEndTimeList = 0; } else { $showStartTimeList = isset($data['showStartTimeList']) ? $data['showStartTimeList'] : ''; $showEndTimeList = isset($data['showEndTimeList']) ? $data['showEndTimeList'] : ''; } $showTimeTypeList = isset($data['showTimeTypeList']) ? $data['showTimeTypeList'] : ''; $showStartDateDetail = isset($data['showStartDateDetail']) ? $data['showStartDateDetail'] : ''; $showEndDateDetail = isset($data['showEndDateDetail']) ? $data['showEndDateDetail'] : ''; // reset time values if "no time" is selected if ($data['showTimeTypeDetail'] == 0) { $showStartTimeDetail = 0; $showEndTimeDetail = 0; } else { $showStartTimeDetail = isset($data['showStartTimeDetail']) ? $data['showStartTimeDetail'] : ''; $showEndTimeDetail = isset($data['showEndTimeDetail']) ? $data['showEndTimeDetail'] : ''; } $showTimeTypeDetail = isset($data['showTimeTypeDetail']) ? $data['showTimeTypeDetail'] : ''; } else { $showStartDateList = $this->arrSettings['showStartDateList'] == 1 ? 1 : 0; $showEndDateList = $this->arrSettings['showEndDateList'] == 1 ? 1 : 0; $showStartTimeList = $this->arrSettings['showStartTimeList'] == 1 ? 1 : 0; $showEndTimeList = $this->arrSettings['showEndTimeList'] == 1 ? 1 : 0; // reset time values if "no time" is selected if ($showStartTimeList == 1 || $showEndTimeList == 1) { $showTimeTypeList = 1; } else { $showStartTimeList = 0; $showEndTimeList = 0; $showTimeTypeList = 0; } $showStartDateDetail = $this->arrSettings['showStartDateDetail'] == 1 ? 1 : 0; $showEndDateDetail = $this->arrSettings['showEndDateDetail'] == 1 ? 1 : 0; $showStartTimeDetail = $this->arrSettings['showStartTimeDetail'] == 1 ? 1 : 0; $showEndTimeDetail = $this->arrSettings['showEndTimeDetail'] == 1 ? 1 : 0; // reset time values if "no time" is selected if ($showStartTimeDetail == 1 || $showEndTimeDetail == 1) { $showTimeTypeDetail = 1; } else { $showStartTimeDetail = 0; $showEndTimeDetail = 0; $showTimeTypeDetail = 0; } } $access = isset($data['access']) ? intval($data['access']) : 0; $priority = isset($data['priority']) ? intval($data['priority']) : 0; $placeMediadir = isset($data['placeMediadir']) ? intval($data['placeMediadir']) : 0; $hostMediadir = isset($data['hostMediadir']) ? intval($data['hostMediadir']) : 0; $price = isset($data['price']) ? contrexx_addslashes(contrexx_strip_tags($data['price'])) : 0; $link = isset($data['link']) ? contrexx_addslashes(contrexx_strip_tags($data['link'])) : ''; $pic = isset($data['picture']) ? contrexx_addslashes(contrexx_strip_tags($data['picture'])) : ''; $attach = isset($data['attachment']) ? contrexx_addslashes(contrexx_strip_tags($data['attachment'])) : ''; $catId = isset($data['category']) ? intval($data['category']) : ''; $showIn = isset($data['showIn']) ? contrexx_addslashes(contrexx_strip_tags(join(",", $data['showIn']))) : ''; $invited_groups = isset($data['selectedGroups']) ? join(',', $data['selectedGroups']) : ''; $invited_mails = isset($data['invitedMails']) ? contrexx_addslashes(contrexx_strip_tags($data['invitedMails'])) : ''; $send_invitation = isset($data['sendInvitation']) ? intval($data['sendInvitation']) : 0; $invitationTemplate = isset($data['invitationEmailTemplate']) ? contrexx_input2db($data['invitationEmailTemplate']) : 0; $registration = isset($data['registration']) ? intval($data['registration']) : 0; $registration_form = isset($data['registrationForm']) ? intval($data['registrationForm']) : 0; $registration_num = isset($data['numSubscriber']) ? intval($data['numSubscriber']) : 0; $registration_notification = isset($data['notificationTo']) ? contrexx_addslashes(contrexx_strip_tags($data['notificationTo'])) : ''; $email_template = isset($data['emailTemplate']) ? contrexx_input2db($data['emailTemplate']) : 0; $ticket_sales = isset($data['ticketSales']) ? intval($data['ticketSales']) : 0; $num_seating = isset($data['numSeating']) ? json_encode(explode(',', $data['numSeating'])) : ''; $related_hosts = isset($data['selectedHosts']) ? $data['selectedHosts'] : ''; $locationType = isset($data['eventLocationType']) ? (int) $data['eventLocationType'] : $this->arrSettings['placeData']; $hostType = isset($data['eventHostType']) ? (int) $data['eventHostType'] : $this->arrSettings['placeDataHost']; $place = isset($data['place']) ? contrexx_input2db(contrexx_strip_tags($data['place'])) : ''; $street = isset($data['street']) ? contrexx_input2db(contrexx_strip_tags($data['street'])) : ''; $zip = isset($data['zip']) ? contrexx_input2db(contrexx_strip_tags($data['zip'])) : ''; $city = isset($data['city']) ? contrexx_input2db(contrexx_strip_tags($data['city'])) : ''; $country = isset($data['country']) ? contrexx_input2db(contrexx_strip_tags($data['country'])) : ''; $placeLink = isset($data['placeLink']) ? contrexx_input2db($data['placeLink']) : ''; $placeMap = isset($data['placeMap']) ? contrexx_input2db($data['placeMap']) : ''; $update_invitation_sent = $send_invitation == 1; if (!empty($placeLink)) { if (!preg_match('%^(?:ftp|http|https):\\/\\/%', $placeLink)) { $placeLink = "http://" . $placeLink; } } if ($objInit->mode == 'frontend') { $unique_id = intval($_REQUEST[self::MAP_FIELD_KEY]); if (!empty($unique_id)) { $picture = $this->_handleUpload('mapUpload', $unique_id); if (!empty($picture)) { $placeMap = $picture; } } } $orgName = isset($data['organizerName']) ? contrexx_input2db($data['organizerName']) : ''; $orgStreet = isset($data['organizerStreet']) ? contrexx_input2db($data['organizerStreet']) : ''; $orgZip = isset($data['organizerZip']) ? contrexx_input2db($data['organizerZip']) : ''; $orgCity = isset($data['organizerCity']) ? contrexx_input2db($data['organizerCity']) : ''; $orgCountry = isset($data['organizerCountry']) ? contrexx_input2db($data['organizerCountry']) : ''; $orgLink = isset($data['organizerLink']) ? contrexx_input2db($data['organizerLink']) : ''; $orgEmail = isset($data['organizerEmail']) ? contrexx_input2db($data['organizerEmail']) : ''; if (!empty($orgLink)) { if (!preg_match('%^(?:ftp|http|https):\\/\\/%', $orgLink)) { $orgLink = "http://" . $orgLink; } } // create thumb if not exists if (!file_exists(\Env::get('cx')->getWebsitePath() . "{$placeMap}.thumb")) { $objImage = new \ImageManager(); $objImage->_createThumb(dirname(\Env::get('cx')->getWebsitePath() . "{$placeMap}") . "/", '', basename($placeMap), 180); } //frontend picture upload & thumbnail creation if ($objInit->mode == 'frontend') { $unique_id = intval($_REQUEST[self::PICTURE_FIELD_KEY]); $attachmentUniqueId = intval($_REQUEST[self::ATTACHMENT_FIELD_KEY]); if (!empty($unique_id)) { $picture = $this->_handleUpload('pictureUpload', $unique_id); if (!empty($picture)) { //delete thumb if (file_exists("{$this->uploadImgPath}{$pic}.thumb")) { \Cx\Lib\FileSystem\FileSystem::delete_file($this->uploadImgPath . "/.{$pic}.thumb"); } //delete image if (file_exists("{$this->uploadImgPath}{$pic}")) { \Cx\Lib\FileSystem\FileSystem::delete_file($this->uploadImgPath . "/.{$pic}"); } $pic = $picture; } } if (!empty($attachmentUniqueId)) { $attachment = $this->_handleUpload('attachmentUpload', $attachmentUniqueId); if ($attachment) { //delete file if (file_exists("{$this->uploadImgPath}{$attach}")) { \Cx\Lib\FileSystem\FileSystem::delete_file($this->uploadImgPath . "/.{$attach}"); } $attach = $attachment; } } } else { // create thumb if not exists if (!file_exists(\Env::get('cx')->getWebsitePath() . "{$pic}.thumb")) { $objImage = new \ImageManager(); $objImage->_createThumb(dirname(\Env::get('cx')->getWebsitePath() . "{$pic}") . "/", '', basename($pic), 180); } } $seriesStatus = isset($data['seriesStatus']) ? intval($data['seriesStatus']) : 0; //series pattern $seriesStatus = isset($data['seriesStatus']) ? intval($data['seriesStatus']) : 0; $seriesType = isset($data['seriesType']) ? intval($data['seriesType']) : 0; $seriesPatternCount = 0; $seriesPatternWeekday = 0; $seriesPatternDay = 0; $seriesPatternWeek = 0; $seriesPatternMonth = 0; $seriesPatternType = 0; $seriesPatternDouranceType = 0; $seriesPatternEnd = 0; $seriesExeptions = ''; $seriesPatternEndDate = 0; if ($seriesStatus == 1) { if (!empty($data['seriesExeptions'])) { $exeptions = array(); foreach ($data['seriesExeptions'] as $key => $exeptionDate) { $exeptions[] = date("Y-m-d", parent::getDateTimestamp($exeptionDate, 23, 59)); } sort($exeptions); $seriesExeptions = join(",", $exeptions); } switch ($seriesType) { case 1: if ($seriesStatus == 1) { $seriesPatternType = isset($data['seriesDaily']) ? intval($data['seriesDaily']) : 0; if ($seriesPatternType == 1) { $seriesPatternWeekday = 0; $seriesPatternDay = isset($data['seriesDailyDays']) ? intval($data['seriesDailyDays']) : 0; } else { $seriesPatternWeekday = "1111100"; $seriesPatternDay = 0; } $seriesPatternWeek = 0; $seriesPatternMonth = 0; $seriesPatternCount = 0; } break; case 2: if ($seriesStatus == 1) { $seriesPatternWeek = isset($data['seriesWeeklyWeeks']) ? intval($data['seriesWeeklyWeeks']) : 0; for ($i = 1; $i <= 7; $i++) { if (isset($data['seriesWeeklyDays'][$i])) { $weekdayPattern .= "1"; } else { $weekdayPattern .= "0"; } } $seriesPatternWeekday = $weekdayPattern; $seriesPatternCount = 0; $seriesPatternDay = 0; $seriesPatternMonth = 0; $seriesPatternType = 0; } break; case 3: if ($seriesStatus == 1) { $seriesPatternType = isset($data['seriesMonthly']) ? intval($data['seriesMonthly']) : 0; if ($seriesPatternType == 1) { $seriesPatternMonth = isset($data['seriesMonthlyMonth_1']) ? intval($data['seriesMonthlyMonth_1']) : 0; $seriesPatternDay = isset($data['seriesMonthlyDay']) ? intval($data['seriesMonthlyDay']) : 0; $seriesPatternWeekday = 0; } else { $seriesPatternCount = isset($data['seriesMonthlyDayCount']) ? intval($data['seriesMonthlyDayCount']) : 0; $seriesPatternMonth = isset($data['seriesMonthlyMonth_2']) ? intval($data['seriesMonthlyMonth_2']) : 0; if ($seriesPatternMonth < 1) { // the increment must be at least once a month, otherwise we will end up in a endless loop in the presence $seriesPatternMonth = 1; } $seriesPatternWeekday = isset($data['seriesMonthlyWeekday']) ? $data['seriesMonthlyWeekday'] : ''; $seriesPatternDay = 0; } $seriesPatternWeek = 0; } break; } $seriesPatternDouranceType = isset($data['seriesDouranceType']) ? intval($data['seriesDouranceType']) : 0; switch ($seriesPatternDouranceType) { case 1: $seriesPatternEnd = 0; break; case 2: $seriesPatternEnd = isset($data['seriesDouranceEvents']) ? intval($data['seriesDouranceEvents']) : 0; break; case 3: $seriesPatternEndDate = date("Y-m-d H:i:s", parent::getDateTimestamp($data['seriesDouranceDate'], 23, 59)); break; } } $formData = array('type' => $type, 'startdate' => $startDate, 'enddate' => $endDate, 'use_custom_date_display' => $useCustomDateDisplay, 'showStartDateList' => $showStartDateList, 'showEndDateList' => $showEndDateList, 'showStartTimeList' => $showStartTimeList, 'showEndTimeList' => $showEndTimeList, 'showTimeTypeList' => $showTimeTypeList, 'showStartDateDetail' => $showStartDateDetail, 'showEndDateDetail' => $showEndDateDetail, 'showStartTimeDetail' => $showStartTimeDetail, 'showEndTimeDetail' => $showEndTimeDetail, 'showTimeTypeDetail' => $showTimeTypeDetail, 'google' => $google, 'access' => $access, 'priority' => $priority, 'price' => $price, 'link' => $link, 'pic' => $pic, 'catid' => $catId, 'attach' => $attach, 'place_mediadir_id' => $placeMediadir, 'host_mediadir_id' => $hostMediadir, 'show_in' => $showIn, 'invited_groups' => $invited_groups, 'invited_mails' => $invited_mails, 'invitation_email_template' => json_encode($invitationTemplate), 'registration' => $registration, 'registration_form' => $registration_form, 'registration_num' => $registration_num, 'registration_notification' => $registration_notification, 'email_template' => json_encode($email_template), 'ticket_sales' => $ticket_sales, 'num_seating' => $num_seating, 'series_status' => $seriesStatus, 'series_type' => $seriesType, 'series_pattern_count' => $seriesPatternCount, 'series_pattern_weekday' => $seriesPatternWeekday, 'series_pattern_day' => $seriesPatternDay, 'series_pattern_week' => $seriesPatternWeek, 'series_pattern_month' => $seriesPatternMonth, 'series_pattern_type' => $seriesPatternType, 'series_pattern_dourance_type' => $seriesPatternDouranceType, 'series_pattern_end' => $seriesPatternEnd, 'series_pattern_end_date' => $seriesPatternEndDate, 'series_pattern_exceptions' => $seriesExeptions, 'all_day' => $allDay, 'location_type' => $locationType, 'host_type' => $hostType, 'place' => $place, 'place_id' => 0, 'place_street' => $street, 'place_zip' => $zip, 'place_city' => $city, 'place_country' => $country, 'place_link' => $placeLink, 'place_map' => $placeMap, 'org_name' => $orgName, 'org_street' => $orgStreet, 'org_zip' => $orgZip, 'org_city' => $orgCity, 'org_country' => $orgCountry, 'org_link' => $orgLink, 'org_email' => $orgEmail, 'invitation_sent' => $update_invitation_sent ? 1 : 0); if ($id != 0) { $query = \SQL::update("module_{$this->moduleTablePrefix}_event", $formData) . " WHERE id = '{$id}'"; $objResult = $objDatabase->Execute($query); if ($objResult !== false) { $this->id = $id; $query = "DELETE FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_event_field\n WHERE event_id = '" . $id . "'"; $objResult = $objDatabase->Execute($query); $query = "DELETE FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_event_host\n WHERE event_id = '" . $id . "'"; $objResult = $objDatabase->Execute($query); } else { return false; } } else { $objFWUser = \FWUser::getFWUserObject(); $objUser = $objFWUser->objUser; if ($objInit->mode == 'frontend') { $status = 1; $confirmed = $this->arrSettings['confirmFrontendEvents'] == 1 ? 0 : 1; $author = $objUser->login() ? intval($objUser->getId()) : 0; } else { $status = 0; $confirmed = 1; $author = intval($objUser->getId()); } $formData['status'] = $status; $formData['confirmed'] = $confirmed; $formData['author'] = $author; $query = \SQL::insert("module_{$this->moduleTablePrefix}_event", $formData); $objResult = $objDatabase->Execute($query); if ($objResult !== false) { $id = intval($objDatabase->Insert_ID()); $this->id = $id; } else { return false; } } if ($id != 0) { foreach ($data['showIn'] as $key => $langId) { $title = contrexx_addslashes(contrexx_strip_tags($data['title'][$langId])); $description = contrexx_addslashes($data['description'][$langId]); if ($convertBBCode) { $description = \Cx\Core\Wysiwyg\Wysiwyg::prepareBBCodeForDb($data['description'][$langId], true); } $redirect = contrexx_addslashes($data['calendar-redirect'][$langId]); if ($type == 0) { $redirect = ''; } else { $description = ''; } $query = "INSERT INTO " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_event_field\n (`event_id`,`lang_id`,`title`, `description`,`redirect`)\n VALUES\n ('" . intval($id) . "','" . intval($langId) . "','" . $title . "','" . $description . "','" . $redirect . "')"; $objResult = $objDatabase->Execute($query); if ($objResult === false) { return false; } } if (!empty($related_hosts)) { foreach ($related_hosts as $key => $hostId) { $query = "INSERT INTO " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_event_host\n (`host_id`,`event_id`) \n VALUES ('" . intval($hostId) . "','" . intval($id) . "')"; $objResult = $objDatabase->Execute($query); } } } if ($send_invitation == 1) { $objMailManager = new \Cx\Modules\Calendar\Controller\CalendarMailManager(); foreach ($invitationTemplate as $templateId) { $objMailManager->sendMail(intval($id), \Cx\Modules\Calendar\Controller\CalendarMailManager::MAIL_INVITATION, null, $templateId); } } return true; }
/** * @covers \Cx\Modules\Block\Controller\JsonBlockController::saveBlockContent */ public function testSaveBlockContent() { $sessionObj = self::$cx->getComponent('Session')->getSession(); $user = \FWUser::getFWUserObject()->objUser->getUser(1); \FWUser::loginUser($user); $jsonBlock = $this->getJsonBlockController(); $jsonBlock->saveBlockContent(array('get' => array('block' => 32, 'lang' => 'de'), 'post' => array('content' => 'bla'))); $result = $jsonBlock->getBlockContent(array('get' => array('block' => 32, 'lang' => 'de'))); $this->assertEquals('bla', $result['content']); }
function showMyEntries() { global $_ARRAYLANG, $_CORELANG; $this->_objTpl->setTemplate($this->pageContent, true, true); //get user attributes $objFWUser = \FWUser::getFWUserObject(); $objUser = $objFWUser->objUser; $intUserId = intval($objUser->getId()); //get searchform if ($this->_objTpl->blockExists($this->moduleNameLC . 'Searchform')) { $objSearch = new MediaDirectorySearch($this->moduleName); $objSearch->getSearchform($this->_objTpl, 1); } $objEntry = new MediaDirectoryEntry($this->moduleName); if ($this->arrSettings['settingsReadyToConfirm'] == 1) { $objEntry->getEntries(null, null, null, null, null, null, true, null, 'n', $intUserId, null, null, true); } else { $objEntry->getEntries(null, null, null, null, null, null, true, null, 'n', $intUserId); } $objEntry->listEntries($this->_objTpl, 2); }
/** * show and update notifications * */ function showNotifications() { global $objDatabase, $_ARRAYLANG; $this->_communityLogin(); $this->_objTpl->setVariable(array('TXT_FORUM_THREAD_NOTIFICATION' => $_ARRAYLANG['TXT_FORUM_THREAD_NOTIFICATION'], 'TXT_SELECT_ALL' => $_ARRAYLANG['TXT_SELECT_ALL'], 'TXT_DESELECT_ALL' => $_ARRAYLANG['TXT_DESELECT_ALL'], 'TXT_FORUM_NOTIFICATION_HELPTEXT' => $_ARRAYLANG['TXT_FORUM_NOTIFICATION_HELPTEXT'], 'TXT_FORUM_NOTIFICATION_SUBMIT' => $_ARRAYLANG['TXT_FORUM_NOTIFICATION_SUBMIT'], 'TXT_FORUM_NOTIFICATION_HELPTEXT' => $_ARRAYLANG['TXT_FORUM_NOTIFICATION_HELPTEXT'], 'TXT_FORUM_NOTIFICATION_SUBMIT' => $_ARRAYLANG['TXT_FORUM_NOTIFICATION_SUBMIT'], 'TXT_FORUM_UNSUBSCRIBED_THREADS' => $_ARRAYLANG['TXT_FORUM_UNSUBSCRIBED_THREADS'], 'TXT_FORUM_SUBSCRIBED_THREADS' => $_ARRAYLANG['TXT_FORUM_SUBSCRIBED_THREADS'])); $objFWUser = \FWUser::getFWUserObject(); if (!$objFWUser->objUser->login()) { $this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />' . $_ARRAYLANG['TXT_FORUM_MUST_BE_AUTHENTICATED']); $this->_objTpl->hideBlock('notification'); return false; } $this->_objTpl->setVariable('FORUM_JAVASCRIPT_NOTIFICATION', $this->getJavascript('notification')); if (isset($_REQUEST['forumNotificationSubmit'])) { //drop and update notifications $query = " DELETE FROM `" . DBPREFIX . "module_forum_notification`\n WHERE `user_id` = " . $objFWUser->objUser->getId() . "\n AND thread_id = 0"; if ($objDatabase->Execute($query) === false) { $this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />Database error: ' . $objDatabase->ErrorMsg()); $this->_objTpl->hideBlock('notification'); return false; } foreach ($_REQUEST['subscribed'] as $intCategoryId) { $intCategoryId = intval($intCategoryId); if ($intCategoryId > 0) { $query = " INSERT INTO `" . DBPREFIX . "module_forum_notification`\n VALUES ( " . $intCategoryId . ", 0, " . $objFWUser->objUser->getId() . ", '0')"; if ($objDatabase->Execute($query) === false) { $this->_objTpl->setVariable('TXT_FORUM_ERROR', '<br />Database error: ' . $objDatabase->ErrorMsg()); $this->_objTpl->hideBlock('notification'); return false; } } } $this->_objTpl->setVariable('TXT_FORUM_SUCCESS', '<br />' . $_ARRAYLANG['TXT_FORUM_NOTIFICATION_UPDATED']); } $arrUnsubscribedThreads = $arrForums = $this->createForumArray($this->_intLangId); $strOptionsUnsubscribed = $strOptionsSubscribed = ''; $query = " SELECT `n`.`category_id`, `l`.`name` , `c`.`status`\n FROM `" . DBPREFIX . "module_forum_notification` AS `n`\n LEFT JOIN " . DBPREFIX . "module_forum_categories_lang AS `l` USING ( `category_id` )\n LEFT JOIN " . DBPREFIX . "module_forum_categories AS `c` ON ( `c`.`id` = `n`.`category_id` )\n WHERE `n`.`user_id` = " . $objFWUser->objUser->getId() . "\n AND `n`.`thread_id` = 0\n AND `l`.`lang_id` = " . $this->_intLangId . "\n AND `c`.`status` = '1'\n ORDER BY `c`.`id` ASC"; if (($objRS = $objDatabase->Execute($query)) === false) { die('DB error: ' . $objDatabase->ErrorMsg()); } while (!$objRS->EOF) { $arrSubscribedThreads[$objRS->fields['category_id']] = $objRS->fields; unset($arrUnsubscribedThreads[$objRS->fields['category_id']]); $objRS->MoveNext(); } if (!empty($arrSubscribedThreads)) { foreach ($arrSubscribedThreads as $intCatID => $arrThread) { $strOptionsSubscribed .= '<option value="' . $intCatID . '">' . str_repeat(' ', $arrForums[$intCatID]['level'] * 2) . $arrThread['name'] . '</option>'; } } if (!empty($arrUnsubscribedThreads)) { foreach ($arrUnsubscribedThreads as $intCatID => $arrThread) { $strOptionsUnsubscribed .= '<option value="' . $intCatID . '">' . str_repeat(' ', $arrForums[$intCatID]['level'] * 2) . $arrThread['name'] . '</option>'; } } $this->_objTpl->setVariable(array('FORUM_NOTIFICATION_UNSUBSCRIBED' => $strOptionsUnsubscribed, 'FORUM_NOTIFICATION_SUBSCRIBED' => $strOptionsSubscribed)); }
private function setProfileData() { if (!\FWUser::getFWUserObject()->objUser->login()) { return false; } $objUser = \FWUser::getFWUserObject()->objUser; $this->objTemplate->setVariable('ACCESS_USER_EMAIL', htmlentities($objUser->getEmail(), ENT_QUOTES, CONTREXX_CHARSET)); $objUser->objAttribute->reset(); while (!$objUser->objAttribute->EOF) { $objAttribute = $objUser->objAttribute->getById($objUser->objAttribute->getId()); switch ($objAttribute->getType()) { case 'menu': if ($objAttribute->isCoreAttribute()) { foreach ($objAttribute->getChildren() as $childAttributeId) { $objChildAtrribute = $objAttribute->getById($childAttributeId); if ($objChildAtrribute->getMenuOptionValue() == $objUser->getProfileAttribute($objAttribute->getId())) { $value = $objChildAtrribute->getName(); break; } } } else { $objSelectedAttribute = $objAttribute->getById($objUser->getProfileAttribute($objAttribute->getId())); $value = $objSelectedAttribute->getName(); } break; case 'date': $value = $objUser->getProfileAttribute($objAttribute->getId()); $value = $value !== false && $value !== '' ? date(ASCMS_DATE_FORMAT_DATE, intval($value)) : ''; break; default: $value = $objUser->getProfileAttribute($objAttribute->getId()); break; } $this->objTemplate->setGlobalVariable('ACCESS_PROFILE_ATTRIBUTE_' . strtoupper($objAttribute->getId()), htmlentities($value, ENT_QUOTES, CONTREXX_CHARSET)); $objUser->objAttribute->next(); } return true; }
function getUsers($intEntryId = null) { global $objDatabase; // TODO: replace by FWUser::getParsedUserTitle() $strDropdownUsers = '<select name="userId"style="width: 302px">'; $objFWUser = \FWUser::getFWUserObject(); if ($objUser = $objFWUser->objUser->getUsers(null, null, null, array('username'))) { while (!$objUser->EOF) { if (intval($objUser->getID()) == intval($this->arrEntries[$intEntryId]['entryAddedBy'])) { $strSelected = 'selected="selected"'; } else { $strSelected = ''; } $strDropdownUsers .= '<option value="' . intval($objUser->getID()) . '" ' . $strSelected . ' >' . contrexx_raw2xhtml($objUser->getUsername()) . '</option>'; $objUser->next(); } } $strDropdownUsers .= '</select>'; return $strDropdownUsers; }
/** * Show the login mask. * * @access private * @global array $_ARRAYLANG * @global FWUser $objFWUser */ private function showLogin() { global $_CORELANG, $_ARRAYLANG; $this->objTemplate->addBlockfile('CONTENT_FILE', 'CONTENT_BLOCK', '/core_modules/Login/View/Template/Backend/login.html'); $frontendLink = ASCMS_INSTANCE_OFFSET; if (empty($frontendLink)) { $frontendLink = '/'; } $this->objTemplate->setVariable(array('TITLE' => $_ARRAYLANG['TXT_LOGIN_LOGIN'], 'TXT_LOGIN_LOGIN' => $_ARRAYLANG['TXT_LOGIN_LOGIN'], 'TXT_FRONTEND_LINK' => $_ARRAYLANG['TXT_FRONTEND_LINK'], 'TXT_LOGIN_ENTER_A_LOGIN' => $_ARRAYLANG['TXT_LOGIN_ENTER_A_LOGIN'], 'TXT_LOGIN_ENTER_A_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_ENTER_A_PASSWORD'], 'TXT_LOGIN_ENTER_CAPTCHA' => $_ARRAYLANG['TXT_LOGIN_ENTER_CAPTCHA'], 'TXT_LOGIN_USERNAME' => $_ARRAYLANG['TXT_LOGIN_USERNAME'], 'TXT_LOGIN_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_PASSWORD'], 'TXT_LOGIN_PASSWORD_LOST' => $_ARRAYLANG['TXT_LOGIN_PASSWORD_LOST'], 'TXT_LOGIN_REMEMBER_ME' => $_CORELANG['TXT_CORE_REMEMBER_ME'], 'REDIRECT_URL' => !empty($_POST['redirect']) ? $_POST['redirect'] : ASCMS_PATH_OFFSET . ASCMS_BACKEND_PATH . substr(getenv('REQUEST_URI'), strlen(\Env::get('cx')->getWebsiteBackendPath())), 'FRONTEND_LINK' => $frontendLink, 'JAVASCRIPT' => \JS::getCode())); if (\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) { $this->objTemplate->setVariable('LOGIN_ERROR_MESSAGE', \FWUser::getFWUserObject()->getErrorMsg()); $this->objTemplate->parse('error_message'); } else { $this->objTemplate->hideBlock('error_message'); } if (isset($_SESSION['auth']['loginLastAuthFailed'])) { $this->objTemplate->setVariable(array('TXT_LOGIN_SECURITY_CODE' => $_ARRAYLANG['TXT_LOGIN_SECURITY_CODE'], 'CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode(3))); $this->objTemplate->parse('captcha'); } else { $this->objTemplate->hideBlock('captcha'); } }