/** * Load your component. * * @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page */ public function load(\Cx\Core\ContentManager\Model\Entity\Page $page) { global $_CORELANG, $page, $objTemplate, $subMenuTitle; switch ($this->cx->getMode()) { case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND: $newsObj = new News(\Env::get('cx')->getPage()->getContent()); \Env::get('cx')->getPage()->setContent($newsObj->getNewsPage()); $newsObj->getPageTitle(\Env::get('cx')->getPage()->getTitle()); // Set the meta page description to the teaser text if displaying news details $teaser = $newsObj->getTeaser(); if ($teaser !== null) { //news details, else getTeaser would return null $page->setMetadesc(contrexx_raw2xhtml(contrexx_strip_tags(html_entity_decode($teaser, ENT_QUOTES, CONTREXX_CHARSET)))); } if (substr($page->getCmd(), 0, 7) == 'details') { \Env::get('cx')->getPage()->setTitle($newsObj->newsTitle); \Env::get('cx')->getPage()->setContentTitle($newsObj->newsTitle); \Env::get('cx')->getPage()->setMetaTitle($newsObj->newsTitle); } break; case \Cx\Core\Core\Controller\Cx::MODE_BACKEND: $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html'); $objTemplate = $this->cx->getTemplate(); \Permission::checkAccess(10, 'static'); $subMenuTitle = $_CORELANG['TXT_NEWS_MANAGER']; $objNews = new NewsManager(); $objNews->getPage(); break; default: break; } }
/** * 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; }
function saveInputfield($intInputfieldId, $strValue, $langId = 0) { $strValue = contrexx_strip_tags(contrexx_input2raw($strValue)); return $strValue; }
/** * update category * @access public * @global array * @global ADONewConnection * @global array */ function updateCategorie() { global $_CONFIG, $objDatabase, $_ARRAYLANG; //get post data if (isset($_POST['edit_submit'])) { $catCategorie = intval($_POST['edit_category']); $catParentid = intval($_POST['edit_parentid']); $catName = contrexx_strip_tags($_POST['edit_name']); $catDescription = contrexx_strip_tags($_POST['edit_description']); $catMetadesc = contrexx_strip_tags($_POST['edit_metadesc']); $catMetakeys = contrexx_strip_tags($_POST['edit_metakeys']); $catShowEntries = contrexx_strip_tags($_POST['edit_showentries']); $catId = intval($_POST['edit_id']); //check parent id if ($catCategorie == $catId) { $catParentid = $catParentid; } else { $catParentid = $catCategorie; } //update categorie $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_categories SET\n name='" . $catName . "',\n description='" . $catDescription . "',\n parentid=" . $catParentid . ",\n metadesc='" . $catMetadesc . "',\n metakeys='" . $catMetakeys . "',\n showentries='" . $catShowEntries . "' WHERE id='" . $catId . "'"); //status and back to ooverview if ($objResult !== false) { $this->showCategories(); $this->strOkMessage = $_ARRAYLANG['TXT_CAT_SUCCESSFULL_EDIT']; } else { $this->strErrMessage = $_ARRAYLANG['TXT_CAT_CORRUPT_EDIT']; } } }
/** * Show picture * * Either show the current picture of the livecam or one from the archive * * @access private */ function _showPicture() { $this->camSettings = $this->getCamSettings($this->cam); //var_dump($this->camSettings); \JS::activate("shadowbox", array('players' => array('img'))); \JS::activate('jqueryui'); \JS::registerCode("\n cx.ready(function() {\n cx.jQuery('input[name=date]').datepicker({dateFormat: 'yy-mm-dd'});\n });\n "); if ($this->camSettings['shadowboxActivate'] == 1) { $imageLink = $this->camSettings['currentImagePath']; } else { // reset archive file path in case the current picture has been requested if ($this->_action == 'current') { unset($_GET['file']); } if (isset($_GET['file'])) { $archiveDate = substr($_GET['file'], 0, 10); $imageLink = '[[NODE_LIVECAM]]?act=archive&date=' . $archiveDate; } else { $cmd = ''; if (!empty($_GET['cmd'])) { $cmd = '&cmd=' . intval($_GET['cmd']); } $imageLink = '[[NODE_LIVECAM]]?act=today'; } } $this->_objTpl->setVariable(array('LIVECAM_CURRENT_IMAGE' => isset($_GET['file']) ? \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath() . $this->camSettings['archivePath'] . '/' . $_GET['file'] : $this->camSettings['currentImagePath'], 'LIVECAM_IMAGE_TEXT' => isset($_GET['file']) ? contrexx_strip_tags($_GET['file']) : 'Aktuelles Webcam Bild', 'LIVECAM_IMAGE_SHADOWBOX' => $this->camSettings['shadowboxActivate'] == 1 ? 'shadowboxgallery' : '', 'LIVECAM_IMAGE_LINK' => $imageLink, 'LIVECAM_IMAGE_SIZE' => $this->camSettings['currentMaxSize'])); }
function saveInputfield($intInputfieldId, $arrValue, $intLangId) { $arrValues = array(); foreach ($arrValue as $intKey => $arrValuesTmp) { $arrValues[] = join("##", $arrValuesTmp); } $strValue = contrexx_strip_tags(contrexx_input2raw(join("||", $arrValues))); return $strValue; }
function saveInputfield($intInputfieldId, $arrValue, $langId = 0) { //$strValue = join(',', array_map('intval', explode(',', $strValue))); $strValue = contrexx_strip_tags(contrexx_input2raw(join(",", $arrValue))); return $strValue; }
function saveInputfield($intInputfieldId, $arrValue, $intLangId) { global $objInit, $_LANGID; $arrValues = array(); if ($objInit->mode == 'backend') { foreach ($arrValue as $intKey => $arrValuesTmp) { $arrValues[] = join("##", $arrValuesTmp); } } else { $uploaderId = !empty($_POST['uploaderId']) ? $_POST['uploaderId'] : ''; foreach ($arrValue as $intKey => $arrValuesTmp) { if ($_POST['mediadirInputfieldSource'][$intInputfieldId][0][$intKey] != '' && $intLangId == $_LANGID) { $this->deleteFile($arrValuesTmp['file']); $filePath = $this->getUploadedFilePath($uploaderId, $_POST['mediadirInputfieldSource'][$intInputfieldId][0][$intKey]); if ($filePath) { $arrValuesTmp['file'] = $this->uploadMedia($filePath); // ugly way,try to get it from post $_POST['mediadirInputfieldSource'][$intInputfieldId][$intKey]['defaultFile'] = $arrValuesTmp['file']; } } if ($_POST['mediadirInputfieldSource'][$intInputfieldId][$intLangId][$intKey] != '') { $this->deleteFile($arrValuesTmp['file']); $filePath = $this->getUploadedFilePath($uploaderId, $_POST['mediadirInputfieldSource'][$intInputfieldId][$intLangId][$intKey]); $arrValuesTmp['file'] = $this->uploadMedia($filePath); } else { if ($arrValuesTmp['file'] == '' || $arrValuesTmp['file'] == 'new_file') { $arrValuesTmp['file'] = $_POST['mediadirInputfieldSource'][$intInputfieldId][$intKey]['defaultFile']; } } $arrValues[] = join("##", $arrValuesTmp); } } $strValue = contrexx_input2raw(contrexx_strip_tags(join("||", $arrValues))); return $strValue; }
/** * Show the form when someone is interested * @return unknown */ function _showInterestForm() { global $objDatabase, $_ARRAYLANG, $_CONFIG; require_once ASCMS_LIBRARY_PATH . DIRECTORY_SEPARATOR . 'phpmailer' . DIRECTORY_SEPARATOR . "class.phpmailer.php"; if (!empty($_REQUEST['immoid'])) { $this->_objTpl->setVariable('IMMO_ID', intval($_REQUEST['immoid'])); } if (!empty($_REQUEST['submitContactForm'])) { $immoid = intval($_REQUEST['contactFormField_immoid']); //hidden field: immoid $name = !empty($_REQUEST['contactFormField_name']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_name'])) : ''; $firstname = !empty($_REQUEST['contactFormField_vorname']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_vorname'])) : ''; $street = !empty($_REQUEST['contactFormField_strasse']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_strasse'])) : ''; $zip = !empty($_REQUEST['contactFormField_postleitzahl']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_postleitzahl'])) : ''; $location = !empty($_REQUEST['contactFormField_ortschaft']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_ortschaft'])) : ''; $email = !empty($_REQUEST['contactFormField_email']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_email'])) : ''; $phone_office = !empty($_REQUEST['contactFormField_fongeschaeft']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_fongeschaeft'])) : ''; $phone_home = !empty($_REQUEST['contactFormField_fonprivat']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_fonprivat'])) : ''; $phone_mobile = !empty($_REQUEST['contactFormField_fonmobil']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_fonmobil'])) : ''; $doc_via_mail = !empty($_REQUEST['contactFormField_dokuperpost']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_dokuperpost'])) : ''; $funding_advice = !empty($_REQUEST['contactFormField_beratungfinanzierung']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_beratungfinanzierung'])) : ''; $inspection = !empty($_REQUEST['contactFormField_besichtigung']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_besichtigung'])) : ''; $contact_via_phone = !empty($_REQUEST['contactFormField_kontakttelefon']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_kontakttelefon'])) : ''; $comment = !empty($_REQUEST['contactFormField_bemerkungen']) ? contrexx_addslashes(contrexx_strip_tags($_REQUEST['contactFormField_bemerkungen'])) : ''; $query = "\n INSERT INTO " . DBPREFIX . "module_immo_interest VALUES (\n NULL, {$immoid}, '{$name}', '{$firstname}',\n '{$street}', '{$zip}', '{$location}', '{$email}',\n '{$phone_office}', '{$phone_home}', '{$phone_mobile}',\n '{$doc_via_mail}', '{$funding_advice}', '{$inspection}',\n '{$contact_via_phone}', '{$comment}', " . mktime() . ")"; if (!$objDatabase->Execute($query)) { $this->_objTpl->setVariable('CONTACT_FEEDBACK_TEXT', $_ARRAYLANG['TXT_IMMO_DATABASE_ERROR']); return false; } $query = "\n SELECT reference, ref_nr_note\n FROM " . DBPREFIX . "module_immo\n WHERE id={$immoid}"; $objRS = $objDatabase->Execute($query); if ($objRS) { $reference = $objRS->fields['reference']; $ref_note = $objRS->fields['ref_nr_note']; } //set immo ID for _getFieldFromText function $this->_getFieldNames($immoid); $this->_currFieldID = $immoid; $address = $this->_getFieldFromText('adresse'); $location = $this->_getFieldFromText('ort'); $mailer = new PHPMailer(); $objRS = $objDatabase->Execute(' SELECT setvalue FROM ' . DBPREFIX . 'module_immo_settings WHERE setname="contact_receiver"'); //set recipients $emails = explode(',', $objRS->fields['setvalue']); foreach ($emails as $email) { $mailer->AddAddress($email); } if ($_CONFIG['coreSmtpServer'] > 0 && @(include_once ASCMS_CORE_PATH . '/SmtpSettings.class.php')) { if (($arrSmtp = SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) { $mailer->IsSMTP(); $mailer->Host = $arrSmtp['hostname']; $mailer->Port = $arrSmtp['port']; $mailer->SMTPAuth = true; $mailer->Username = $arrSmtp['username']; $mailer->Password = $arrSmtp['password']; } } $mailer->CharSet = CONTREXX_CHARSET; $mailer->SetFrom(contrexx_addslashes($_REQUEST['contactFormField_email']), 'Interessent'); $mailer->Subject = 'Neuer Interessent für ' . $ref_note . ' Ref-Nr.: ' . $reference; $mailer->IsHTML(false); $mailer->Body = 'Jemand interessiert sich für das Objekt ' . $ref_note . ' Ref-Nr.: ' . $reference . "\n \nhttp://" . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . "/admin/index.php?cmd=immo&act=stats\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_E_MAIL'] . ': ' . contrexx_addslashes($_REQUEST['contactFormField_email']) . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_NAME'] . ': ' . $name . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_FIRSTNAME'] . ': ' . $firstname . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_STREET'] . ': ' . $street . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_LOCATION'] . ': ' . $location . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_TELEPHONE'] . ': ' . $phone_home . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_TELEPHONE_OFFICE'] . ': ' . $phone_office . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_TELEPHONE_MOBILE'] . ': ' . $phone_mobile . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_DOC_VIA_MAIL'] . ': ' . ($doc_via_mail ? $_ARRAYLANG['TXT_IMMO_YES'] : $_ARRAYLANG['TXT_IMMO_NO']) . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_FUNDING_ADVICE'] . ': ' . ($funding_advice ? $_ARRAYLANG['TXT_IMMO_YES'] : $_ARRAYLANG['TXT_IMMO_NO']) . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_CONTACT_FOR_INSPECTION'] . ': ' . ($inspection ? $_ARRAYLANG['TXT_IMMO_YES'] : $_ARRAYLANG['TXT_IMMO_NO']) . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_CONTACT_VIA_PHONE'] . ': ' . ($contact_via_phone ? $_ARRAYLANG['TXT_IMMO_YES'] : $_ARRAYLANG['TXT_IMMO_NO']) . "\n"; $mailer->Body .= $_ARRAYLANG['TXT_IMMO_COMMENTS'] . ': ' . $comment . "\n"; $mailer->Send(); //mail for interested customer $mailer->ClearAddresses(); $mailer->SetFrom($this->arrSettings['sender_email'], $this->arrSettings['sender_name']); $mailer->AddAddress($_REQUEST['contactFormField_email']); $mailer->Subject = $this->arrSettings['interest_confirm_subject']; $message = str_replace('[[IMMO_OBJECT]]', $address . ', ' . $location . " (Ref.Nr.: {$reference})", $this->arrSettings['interest_confirm_message']); $mailer->Body = $message; $mailer->Send(); $this->_objTpl->setVariable('CONTACT_FEEDBACK_TEXT', $_ARRAYLANG['TXT_IMMO_CONTACT_SUCCESSFUL']); } return true; }
function saveForm($arrData, $intFormId = null) { global $_ARRAYLANG, $_CORELANG, $objDatabase, $_LANGID; $intId = intval($intFormId); $strPicture = contrexx_addslashes(contrexx_strip_tags($arrData['formImage'])); $arrName = $arrData['formName']; $arrDescription = $arrData['formDescription']; $strCmd = strtolower(contrexx_addslashes(contrexx_strip_tags($arrData['formCmd']))); $intUseCategory = intval($arrData['formUseCategory']); $intUseLevel = isset($arrData['formUseLevel']) ? contrexx_input2int($arrData['formUseLevel']) : 0; $intUseReadyToConfirm = isset($arrData['formUseReadyToConfirm']) ? contrexx_input2int($arrData['formUseReadyToConfirm']) : 0; $intEntriesPerPage = isset($arrData['formEntriesPerPage']) ? contrexx_input2int($arrData['formEntriesPerPage']) : 0; if (empty($intId)) { //insert new form $objInsertAttributes = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_forms\n SET\n `order`='99',\n `picture`='" . $strPicture . "',\n `cmd`='" . $strCmd . "',\n `use_category`='" . $intUseCategory . "',\n `use_level`='" . $intUseLevel . "',\n `use_ready_to_confirm`='" . $intUseReadyToConfirm . "',\n `entries_per_page`='" . $intEntriesPerPage . "',\n `active`='0'\n "); if ($objInsertAttributes !== false) { $intId = $objDatabase->Insert_ID(); foreach ($this->arrFrontendLanguages as $key => $arrLang) { if (empty($arrName[0])) { $arrName[0] = ""; } $strName = $arrName[$arrLang['id']]; $strDescription = $arrDescription[$arrLang['id']]; if (empty($strName)) { $strName = $arrName[0]; } if (empty($strDescription)) { $strDescription = $arrDescription[0]; } $objInsertNames = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_form_names\n SET\n `lang_id`='" . intval($arrLang['id']) . "',\n `form_id`='" . intval($intId) . "',\n `form_name`='" . contrexx_raw2db(contrexx_input2raw($strName)) . "',\n `form_description`='" . contrexx_raw2db(contrexx_input2raw($strDescription)) . "'\n "); } $objCreateCatSelectors = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_order_rel_forms_selectors\n SET\n `selector_id`='9',\n `form_id`='" . intval($intId) . "',\n `selector_order`='0',\n `exp_search`='1'\n "); $objCreateLevelSelectors = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_order_rel_forms_selectors\n SET\n `selector_id`='10',\n `form_id`='" . intval($intId) . "',\n `selector_order`='1',\n `exp_search`='1'\n "); //permissions parent::getCommunityGroups(); foreach ($this->arrCommunityGroups as $intGroupId => $arrGroup) { $objInsertPerm = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_perm_group_forms\n SET\n `group_id`='" . intval($intGroupId) . "',\n `form_id`='" . intval($intId) . "',\n `status_group`='1'\n "); } if ($objInsertNames !== false && $objCreateCatSelectors !== false && $objCreateLevelSelectors !== false) { return true; } else { return false; } } else { return false; } } else { //update form $objUpdateAttributes = $objDatabase->Execute("\n UPDATE\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_forms\n SET\n `picture`='" . $strPicture . "',\n `cmd`='" . $strCmd . "',\n `use_category`='" . $intUseCategory . "',\n `use_level`='" . $intUseLevel . "',\n `use_ready_to_confirm`='" . $intUseReadyToConfirm . "',\n `entries_per_page`='" . $intEntriesPerPage . "'\n WHERE\n `id`='" . $intId . "'\n "); if ($objUpdateAttributes !== false) { //permissions $objDeletePerm = $objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_perm_group_forms WHERE form_id='" . $intId . "'"); $settingsPermissionGroupForm = isset($arrData['settingsPermGroupForm'][$intId]) ? $arrData['settingsPermGroupForm'][$intId] : array(); foreach ($settingsPermissionGroupForm as $intGroupId => $intGroupStatus) { $objInsertPerm = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_perm_group_forms\n SET\n `group_id`='" . intval($intGroupId) . "',\n `form_id`='" . intval($intId) . "',\n `status_group`='" . intval($intGroupStatus) . "'\n "); } $objInsertNames = $this->updateFormLocale($arrName, $arrDescription, $intId); if ($objInsertNames !== false) { return true; } else { return false; } } else { return false; } } }
/** * Get the recipient addresses from the post * * @author Comvation AG <*****@*****.**> * @author Stefan Heinemann <*****@*****.**> * @return string */ private function getPostRecipients() { global $_CONFIG; $formEmailsTmp = isset($_POST['contactFormEmail']) ? explode(',', strip_tags(contrexx_stripslashes($_POST['contactFormEmail']))) : ''; if (empty($formEmails)) { $formEmails = $_CONFIG['contactFormEmail']; } if (is_array($formEmailsTmp)) { $formEmails = array(); foreach ($formEmailsTmp as $email) { $email = trim(contrexx_strip_tags($email)); if (!empty($email)) { array_push($formEmails, $email); } } $formEmails = implode(',', $formEmails); } else { $formEmails = ''; } return $formEmails; }
/** * Save the Host data's into database * * @param array $data posted data from the form * * @return boolean true if the data updated successfully, false otherwise */ function save($data) { global $objDatabase; $title = contrexx_addslashes(contrexx_strip_tags($data['title'])); $uri = contrexx_addslashes(contrexx_strip_tags($data['uri'])); if (substr($uri, -1) != '/') { $uri = $uri . "/"; } $category = intval($data['category']); $key = contrexx_addslashes(contrexx_strip_tags($data['key'])); $status = intval($data['status']); $confirmed = intval(1); if (empty($key)) { $key = $this->generateKey(); } if (intval($this->id) == 0) { $query = "INSERT INTO " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_host\n (`title`,`uri`,`cat_id`,`key`,`confirmed`,`status`) \n VALUES ('" . $title . "','" . $uri . "','" . $category . "','" . $key . "','" . $confirmed . "','" . $status . "')"; } else { $query = "UPDATE " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_host\n SET `title` = '" . $title . "',\n `uri` = '" . $uri . "',\n `cat_id` = '" . $category . "',\n `key` = '" . $key . "',\n `status` = '" . $status . "'\n WHERE `id` = '" . intval($this->id) . "'"; } $objResult = $objDatabase->Execute($query); if ($objResult !== false) { return true; } else { return false; } }
/** * Save the category * * @param array $data posted data from the user * * @return boolean true if data saved successfully, false otherwise */ function save($data) { global $objDatabase, $_LANGID; $arrHosts = array(); $arrHosts = $data['selectedHosts']; $arrNames = array(); $arrNames = $data['name']; if (intval($this->id) == 0) { $query = "INSERT INTO " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_category\n \t\t (`pos`,`status`)\n VALUES ('0','0')"; $objResult = $objDatabase->Execute($query); if ($objResult === false) { return false; } $this->id = intval($objDatabase->Insert_ID()); } //names $query = "DELETE FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_category_name\n WHERE cat_id = '" . intval($this->id) . "'"; $objResult = $objDatabase->Execute($query); if ($objResult !== false) { foreach ($arrNames as $langId => $categoryName) { if ($langId != 0) { $categoryName = $categoryName == '' ? $arrNames[0] : $categoryName; if ($_LANGID == $langId) { $categoryName = $arrNames[0] != $this->name ? $arrNames[0] : $categoryName; } $query = "INSERT INTO " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_category_name\n\t (`cat_id`,`lang_id`,`name`)\n\t VALUES ('" . intval($this->id) . "','" . intval($langId) . "','" . contrexx_addslashes(contrexx_strip_tags($categoryName)) . "')"; $objResult = $objDatabase->Execute($query); } } if ($objResult !== false) { //hosts foreach ($arrHosts as $key => $hostId) { $query = "UPDATE " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_host\n\t\t\t SET cat_id = '" . intval($this->id) . "' \n\t\t\t WHERE id = '" . intval($hostId) . "'"; $objResult = $objDatabase->Execute($query); } if ($objResult !== false) { return true; } else { return false; } } else { return false; } } else { return false; } }
/** * Store the form data for the product */ function _saveForm() { global $_CONFIG; if (empty($_REQUEST['saveForm'])) { return true; } $formId = isset($_REQUEST['formId']) ? intval($_REQUEST['formId']) : 0; $productName = isset($_POST['productFormName']) ? contrexx_addslashes(strip_tags($_POST['productFormName'])) : ''; $contactFormDesc = isset($_POST['contactFormDesc']) ? contrexx_addslashes($_POST['contactFormDesc']) : ''; $productFormTargetUrl = isset($_POST['productFormTargetUrl']) ? contrexx_addslashes(strip_tags($_POST['productFormTargetUrl'])) : ''; $productFormTargetMessage = isset($_POST['productFormTargetMessage']) ? contrexx_addslashes($_POST['productFormTargetMessage']) : ''; $productFormPerDay = intval($_POST['productFormPerDay']); $productFormQuantity = intval($_POST['productFormQuantity']); $productQuantityLimit = intval($_POST['productQuantityLimit']); $productFormPrice = floatval($_POST['productFormPrice']); $productAutoStatus = intval($_POST['productAutoStatus']); $productFile = isset($_POST['productFile']) ? contrexx_addslashes($_POST['productFile']) : ''; $productSenderName = isset($_POST['productSenderName']) ? contrexx_addslashes(strip_tags($_POST['productSenderName'])) : ''; $productSenderEmail = isset($_POST['productSenderEmail']) ? contrexx_addslashes(strip_tags($_POST['productSenderEmail'])) : ''; $productTargetSubject = isset($_POST['productTargetSubject']) ? contrexx_addslashes(strip_tags($_POST['productTargetSubject'])) : ''; $productTargetBody = isset($_POST['productTargetBody']) ? contrexx_addslashes(strip_tags($_POST['productTargetBody'])) : ''; $productPayPal = intval($_POST['paypal']); $productPayPalSandbox = isset($_POST['sandbox_mail']) ? contrexx_addslashes(strip_tags($_POST['sandbox_mail'])) : ''; $productPayPalCurrency = isset($_POST['general_currency']) ? contrexx_addslashes(strip_tags($_POST['general_currency'])) : ''; $productYellowpay = intval($_POST['yellowpay_enable']); // Alternative payment methods, comma separated list $productAlternativePaymentMethods = isset($_POST['alternative_names']) ? contrexx_addslashes(strip_tags($_POST['alternative_names'])) : ''; if ($productQuantityLimit < 1) { $productQuantityLimit = 1; } if ($productQuantityLimit >= $productFormQuantity) { $productQuantityLimit = $productFormQuantity - 1; } $FileErr = ''; // Disallow the config file to be used as product file if ($productFile == 'config/configuration.php' || $productFile == '/config/configuration.php') { $productFile = ''; $FileErr = 2; } $productState = isset($_POST['productState']) ? 1 : 0; $productElectro = isset($_POST['ElectroProduct']) ? 1 : 0; $uniqueFieldNames = true; $arrFields = $this->_getFormFieldsFromPost($uniqueFieldNames); if (!$uniqueFieldNames) { $this->_products(1); return false; } $formEmailsTmp = isset($_POST['productFormEmail']) ? explode(',', contrexx_addslashes($_POST['productFormEmail'])) : ''; $formEmails = ''; if (is_array($formEmailsTmp)) { $formEmails = array(); foreach ($formEmailsTmp as $email) { $email = trim(contrexx_strip_tags($email)); if (!empty($email)) { array_push($formEmails, $email); } } $formEmails = implode(',', $formEmails); } if (empty($formEmails)) { $formEmails = $_CONFIG['contactFormEmail']; } $result = false; if ($formId > 0) { $result = $this->_updateProduct($formId, $productName, $contactFormDesc, $productFormTargetUrl, $productFormTargetMessage, $productFormPerDay, $productFormQuantity, $productQuantityLimit, $productFormPrice, $arrFields, $formEmails, $productState, $productAutoStatus, $productElectro, $productFile, $productSenderName, $productSenderEmail, $productTargetSubject, $productTargetBody, $productPayPal, $productPayPalSandbox, $productPayPalCurrency, $productYellowpay, $productAlternativePaymentMethods); } else { $result = $this->_saveProduct($formId, $productName, $contactFormDesc, $productFormTargetUrl, $productFormTargetMessage, $productFormPerDay, $productFormQuantity, $productQuantityLimit, $productFormPrice, $arrFields, $formEmails, $productState, $productAutoStatus, $productElectro, $productFile, $productSenderName, $productSenderEmail, $productTargetSubject, $productTargetBody, $productPayPal, $productPayPalSandbox, $productPayPalCurrency, $productYellowpay, $productAlternativePaymentMethods); } $this->_products($FileErr); return $result; }
/** * Generate the form and show hints if necessary. * If user input validation is successful a new transaction will be added. * In this case the form will be hidden and only a status message will be shown. * * @access private */ private function renderForm() { global $objDatabase, $_ARRAYLANG, $_CORELANG; //check the payment service provider configuration $objSettingsGeneral = new SettingsGeneral($objDatabase); if (!$objSettingsGeneral->getEpaymentStatus()) { $this->arrStatusMessages['error'][] = $_ARRAYLANG['TXT_CHECKOUT_EPAYMENT_DEACTIVATED']; $this->objTemplate->hideblock('form'); $this->objTemplate->hideblock('redirect'); return; } //initialize variables $arrFieldValues = array(); $arrFieldsToHighlight = array(); $arrCssClasses = array(); $cssHighlightingClass = 'highlight'; $cssLabelClass = 'label'; $htmlRequiredField = ' *'; $arrSelectOptions[] = array(); //validate submitted user data if (isset($_REQUEST['submit'])) { $arrFieldValues['invoice_number'] = !empty($_REQUEST['invoice_number']) && $_REQUEST['invoice_number'] !== $_ARRAYLANG['TXT_CHECKOUT_INVOICE_NUMBER'] . $htmlRequiredField ? $_REQUEST['invoice_number'] : ''; $arrFieldValues['invoice_currency'] = !empty($_REQUEST['invoice_currency']) ? $_REQUEST['invoice_currency'] : ''; $arrFieldValues['invoice_amount'] = !empty($_REQUEST['invoice_amount']) && $_REQUEST['invoice_amount'] !== $_ARRAYLANG['TXT_CHECKOUT_INVOICE_AMOUNT'] . $htmlRequiredField ? $_REQUEST['invoice_amount'] : ''; $arrFieldValues['contact_title'] = !empty($_REQUEST['contact_title']) ? $_REQUEST['contact_title'] : ''; $arrFieldValues['contact_forename'] = !empty($_REQUEST['contact_forename']) && $_REQUEST['contact_forename'] !== $_ARRAYLANG['TXT_CHECKOUT_CONTACT_FORENAME'] . $htmlRequiredField ? contrexx_input2raw(contrexx_strip_tags($_REQUEST['contact_forename'])) : ''; $arrFieldValues['contact_surname'] = !empty($_REQUEST['contact_surname']) && $_REQUEST['contact_surname'] !== $_ARRAYLANG['TXT_CHECKOUT_CONTACT_SURNAME'] . $htmlRequiredField ? contrexx_input2raw(contrexx_strip_tags($_REQUEST['contact_surname'])) : ''; $arrFieldValues['contact_company'] = !empty($_REQUEST['contact_company']) && $_REQUEST['contact_company'] !== $_ARRAYLANG['TXT_CHECKOUT_CONTACT_COMPANY'] ? contrexx_input2raw(contrexx_strip_tags($_REQUEST['contact_company'])) : ''; $arrFieldValues['contact_street'] = !empty($_REQUEST['contact_street']) && $_REQUEST['contact_street'] !== $_ARRAYLANG['TXT_CHECKOUT_CONTACT_STREET'] . $htmlRequiredField ? contrexx_input2raw(contrexx_strip_tags($_REQUEST['contact_street'])) : ''; $arrFieldValues['contact_postcode'] = !empty($_REQUEST['contact_postcode']) && $_REQUEST['contact_postcode'] !== $_ARRAYLANG['TXT_CHECKOUT_CONTACT_POSTCODE'] . $htmlRequiredField ? contrexx_input2raw(contrexx_strip_tags($_REQUEST['contact_postcode'])) : ''; $arrFieldValues['contact_place'] = !empty($_REQUEST['contact_place']) && $_REQUEST['contact_place'] !== $_ARRAYLANG['TXT_CHECKOUT_CONTACT_PLACE'] . $htmlRequiredField ? contrexx_input2raw(contrexx_strip_tags($_REQUEST['contact_place'])) : ''; $arrFieldValues['contact_country'] = !empty($_REQUEST['contact_country']) ? $_REQUEST['contact_country'] : ''; $arrFieldValues['contact_phone'] = !empty($_REQUEST['contact_phone']) && $_REQUEST['contact_phone'] !== $_ARRAYLANG['TXT_CHECKOUT_CONTACT_PHONE'] . $htmlRequiredField ? contrexx_input2raw(contrexx_strip_tags($_REQUEST['contact_phone'])) : ''; $arrFieldValues['contact_email'] = !empty($_REQUEST['contact_email']) && $_REQUEST['contact_email'] !== $_ARRAYLANG['TXT_CHECKOUT_CONTACT_EMAIL'] . $htmlRequiredField ? contrexx_input2raw(contrexx_strip_tags($_REQUEST['contact_email'])) : ''; //get keys of passed data if (!isset($this->arrCurrencies[$invoiceCurrency]) && ($key = array_search(strtoupper($invoiceCurrency), $this->arrCurrencies))) { $invoiceCurrency = $key; } if (strtolower($contactTitle) !== self::MISTER && strtolower($contactTitle) !== self::MISS) { if (ucfirst(strtolower($contactTitle)) == $_ARRAYLANG['TXT_CHECKOUT_CONTACT_TITLE_MISTER']) { $contactTitle = self::MISTER; } elseif (ucfirst(strtolower($contactTitle)) == $_ARRAYLANG['TXT_CHECKOUT_CONTACT_TITLE_MISS']) { $contactTitle = self::MISS; } } else { $contactTitle = strtolower($contactTitle); } if (!isset($this->arrCountries[$contactCountry]) && ($key = array_search(ucfirst(strtolower($contactCountry)), $this->arrCountries))) { $contactCountry = $key; } $arrUserData['text']['invoice_number']['name'] = $_ARRAYLANG['TXT_CHECKOUT_INVOICE_NUMBER']; $arrUserData['text']['invoice_number']['value'] = $arrFieldValues['invoice_number']; $arrUserData['text']['invoice_number']['length'] = 255; $arrUserData['text']['invoice_number']['mandatory'] = 1; $arrUserData['selection']['invoice_currency']['name'] = $_ARRAYLANG['TXT_CHECKOUT_INVOICE_CURRENCY']; $arrUserData['selection']['invoice_currency']['value'] = $arrFieldValues['invoice_currency']; $arrUserData['selection']['invoice_currency']['options'] = $this->arrCurrencies; $arrUserData['selection']['invoice_currency']['mandatory'] = 1; $arrUserData['numeric']['invoice_amount']['name'] = $_ARRAYLANG['TXT_CHECKOUT_INVOICE_AMOUNT']; $arrUserData['numeric']['invoice_amount']['value'] = $arrFieldValues['invoice_amount']; $arrUserData['numeric']['invoice_amount']['length'] = 15; $arrUserData['numeric']['invoice_amount']['mandatory'] = 1; $arrUserData['selection']['contact_title']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_TITLE']; $arrUserData['selection']['contact_title']['value'] = $arrFieldValues['contact_title']; $arrUserData['selection']['contact_title']['options'] = array(self::MISTER => '', self::MISS => ''); $arrUserData['selection']['contact_title']['mandatory'] = 1; $arrUserData['text']['contact_forename']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_FORENAME']; $arrUserData['text']['contact_forename']['value'] = $arrFieldValues['contact_forename']; $arrUserData['text']['contact_forename']['length'] = 255; $arrUserData['text']['contact_forename']['mandatory'] = 1; $arrUserData['text']['contact_surname']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_SURNAME']; $arrUserData['text']['contact_surname']['value'] = $arrFieldValues['contact_surname']; $arrUserData['text']['contact_surname']['length'] = 255; $arrUserData['text']['contact_surname']['mandatory'] = 1; $arrUserData['text']['contact_company']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_COMPANY']; $arrUserData['text']['contact_company']['value'] = $arrFieldValues['contact_company']; $arrUserData['text']['contact_company']['length'] = 255; $arrUserData['text']['contact_company']['mandatory'] = 0; $arrUserData['text']['contact_street']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_STREET']; $arrUserData['text']['contact_street']['value'] = $arrFieldValues['contact_street']; $arrUserData['text']['contact_street']['length'] = 255; $arrUserData['text']['contact_street']['mandatory'] = 1; $arrUserData['text']['contact_postcode']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_POSTCODE']; $arrUserData['text']['contact_postcode']['value'] = $arrFieldValues['contact_postcode']; $arrUserData['text']['contact_postcode']['length'] = 255; $arrUserData['text']['contact_postcode']['mandatory'] = 1; $arrUserData['text']['contact_place']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_PLACE']; $arrUserData['text']['contact_place']['value'] = $arrFieldValues['contact_place']; $arrUserData['text']['contact_place']['length'] = 255; $arrUserData['text']['contact_place']['mandatory'] = 1; $arrUserData['selection']['contact_country']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_COUNTRY']; $arrUserData['selection']['contact_country']['value'] = $arrFieldValues['contact_country']; $arrUserData['selection']['contact_country']['options'] = $this->arrCountries; $arrUserData['selection']['contact_country']['mandatory'] = 1; $arrUserData['text']['contact_phone']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_PHONE']; $arrUserData['text']['contact_phone']['value'] = $arrFieldValues['contact_phone']; $arrUserData['text']['contact_phone']['length'] = 255; $arrUserData['text']['contact_phone']['mandatory'] = 1; $arrUserData['email']['contact_email']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_EMAIL']; $arrUserData['email']['contact_email']['value'] = $arrFieldValues['contact_email']; $arrUserData['email']['contact_email']['length'] = 255; $arrUserData['email']['contact_email']['mandatory'] = 1; $arrFieldsToHighlight = $this->validateUserData($arrUserData); if (empty($arrFieldsToHighlight)) { //validation was successful. now add a new transaction. $id = $this->objTransaction->add(self::WAITING, $arrUserData['text']['invoice_number']['value'], $arrUserData['selection']['invoice_currency']['value'], $arrUserData['numeric']['invoice_amount']['value'], $arrUserData['selection']['contact_title']['value'], $arrUserData['text']['contact_forename']['value'], $arrUserData['text']['contact_surname']['value'], $arrUserData['text']['contact_company']['value'], $arrUserData['text']['contact_street']['value'], $arrUserData['text']['contact_postcode']['value'], $arrUserData['text']['contact_place']['value'], $arrUserData['selection']['contact_country']['value'], $arrUserData['text']['contact_phone']['value'], $arrUserData['email']['contact_email']['value']); if ($id) { $objSettingsYellowpay = new SettingsYellowpay($objDatabase); $arrYellowpay = $objSettingsYellowpay->get(); $arrOrder = array('ORDERID' => $id, 'AMOUNT' => intval($arrFieldValues['invoice_amount'] * 100), 'CURRENCY' => $this->arrCurrencies[$arrFieldValues['invoice_currency']], 'PARAMPLUS' => 'section=Checkout'); $arrSettings['postfinance_shop_id']['value'] = $arrYellowpay['pspid']; $arrSettings['postfinance_hash_signature_in']['value'] = $arrYellowpay['sha_in']; $arrSettings['postfinance_authorization_type']['value'] = $arrYellowpay['operation']; $arrSettings['postfinance_use_testserver']['value'] = $arrYellowpay['testserver']; $landingPage = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page')->findOneByModuleCmdLang('Checkout', '', FRONTEND_LANG_ID); $this->objTemplate->setVariable('CHECKOUT_YELLOWPAY_FORM', \Yellowpay::getForm($arrOrder, $_ARRAYLANG['TXT_CHECKOUT_START_PAYMENT'], false, $arrSettings, $landingPage)); if (\Yellowpay::$arrError) { $this->arrStatusMessages['error'][] = $_ARRAYLANG['TXT_CHECKOUT_FAILED_TO_INITIALISE_YELLOWPAY']; } else { $this->arrStatusMessages['ok'][] = $_ARRAYLANG['TXT_CHECKOUT_ENTRY_SAVED_SUCCESSFULLY']; } $this->objTemplate->hideBlock('form'); $this->objTemplate->touchBlock('redirect'); return; } else { $this->arrStatusMessages['error'][] = $_ARRAYLANG['TXT_CHECKOUT_ENTRY_SAVED_ERROR']; } } } else { //get passed data $arrFieldValues['invoice_number'] = !empty($_REQUEST['invoice_number']) ? $_REQUEST['invoice_number'] : ''; $arrFieldValues['invoice_currency'] = !empty($_REQUEST['invoice_currency']) ? $_REQUEST['invoice_currency'] : ''; $arrFieldValues['invoice_amount'] = !empty($_REQUEST['invoice_amount']) ? $_REQUEST['invoice_amount'] : ''; $arrFieldValues['contact_title'] = !empty($_REQUEST['contact_title']) ? $_REQUEST['contact_title'] : ''; $arrFieldValues['contact_forename'] = !empty($_REQUEST['contact_forename']) ? $_REQUEST['contact_forename'] : ''; $arrFieldValues['contact_surname'] = !empty($_REQUEST['contact_surname']) ? $_REQUEST['contact_surname'] : ''; $arrFieldValues['contact_company'] = !empty($_REQUEST['contact_company']) ? $_REQUEST['contact_company'] : ''; $arrFieldValues['contact_street'] = !empty($_REQUEST['contact_street']) ? $_REQUEST['contact_street'] : ''; $arrFieldValues['contact_postcode'] = !empty($_REQUEST['contact_postcode']) ? $_REQUEST['contact_postcode'] : ''; $arrFieldValues['contact_place'] = !empty($_REQUEST['contact_place']) ? $_REQUEST['contact_place'] : ''; $arrFieldValues['contact_country'] = !empty($_REQUEST['contact_country']) ? $_REQUEST['contact_country'] : ''; $arrFieldValues['contact_phone'] = !empty($_REQUEST['contact_phone']) ? $_REQUEST['contact_phone'] : ''; $arrFieldValues['contact_email'] = !empty($_REQUEST['contact_email']) ? $_REQUEST['contact_email'] : ''; //get keys of passed options selection if (!isset($this->arrCurrencies[$arrFieldValues['invoice_currency']]) && ($key = array_search(strtoupper($arrFieldValues['invoice_currency']), $this->arrCurrencies))) { $arrFieldValues['invoice_currency'] = $key; } if (strtolower($arrFieldValues['contact_title']) !== self::MISTER && strtolower($arrFieldValues['contact_title']) !== self::MISS) { if (ucfirst(strtolower($arrFieldValues['contact_title'])) == $_ARRAYLANG['TXT_CHECKOUT_CONTACT_TITLE_MISTER']) { $arrFieldValues['contact_title'] = self::MISTER; } elseif (ucfirst(strtolower($arrFieldValues['contact_title'])) == $_ARRAYLANG['TXT_CHECKOUT_CONTACT_TITLE_MISS']) { $arrFieldValues['contact_title'] = self::MISS; } } else { $arrFieldValues['contact_title'] = strtolower($arrFieldValues['contact_title']); } if (!isset($this->arrCountries[$arrFieldValues['contact_country']]) && ($key = array_search(ucfirst(strtolower($arrFieldValues['contact_country'])), $this->arrCountries))) { $arrFieldValues['contact_country'] = $key; } } //get currency options $arrSelectOptions['currencies'][] = '<option value="0">' . $_ARRAYLANG['TXT_CHECKOUT_INVOICE_CURRENCY'] . $htmlRequiredField . '</option>'; foreach ($this->arrCurrencies as $id => $currency) { $selected = $id == $arrFieldValues['invoice_currency'] ? ' selected="selected"' : ''; $arrSelectOptions['currencies'][] = '<option value="' . $id . '"' . $selected . '>' . contrexx_raw2xhtml($currency) . '</option>'; } //get title options $selectedMister = self::MISTER == $arrFieldValues['contact_title'] ? ' selected="selected"' : ''; $selectedMiss = self::MISS == $arrFieldValues['contact_title'] ? ' selected="selected"' : ''; $arrSelectOptions['titles'][] = '<option value="0">' . $_ARRAYLANG['TXT_CHECKOUT_CONTACT_TITLE'] . $htmlRequiredField . '</option>'; $arrSelectOptions['titles'][] = '<option value="' . self::MISTER . '"' . $selectedMister . '>' . $_ARRAYLANG['TXT_CHECKOUT_CONTACT_TITLE_MISTER'] . '</option>'; $arrSelectOptions['titles'][] = '<option value="' . self::MISS . '"' . $selectedMiss . '>' . $_ARRAYLANG['TXT_CHECKOUT_CONTACT_TITLE_MISS'] . '</option>'; //get country options if (!empty($this->arrCountries)) { //$arrSelectOptions['countries'][] = '<option value="0">'.$_ARRAYLANG['TXT_CHECKOUT_CONTACT_COUNTRY'].$htmlRequiredField.'</option>'; foreach ($this->arrCountries as $id => $name) { if (\Cx\Core\Country\Controller\Country::getAlpha2ById($id) != 'CH') { continue; } $selected = $id == $arrFieldValues['contact_country'] ? ' selected="selected"' : ''; $arrSelectOptions['countries'][] = '<option value="' . $id . '"' . $selected . '>' . contrexx_raw2xhtml($name) . '</option>'; } } // check wihch css classes have to be set foreach ($arrFieldValues as $name => $value) { if (isset($arrFieldsToHighlight[$name])) { $arrCssClasses[$name][] = $cssHighlightingClass; } if (empty($value)) { $arrCssClasses[$name][] = $cssLabelClass; } $arrCssClasses[$name] = implode(' ', $arrCssClasses[$name]); } \JS::activate('jquery'); \JS::registerCode($this->getJavascript($htmlRequiredField)); $this->objTemplate->setVariable(array('TXT_CHECKOUT_DESCRIPTION' => $_ARRAYLANG['TXT_CHECKOUT_DESCRIPTION'], 'TXT_CHECKOUT_BILL_DATA' => $_ARRAYLANG['TXT_CHECKOUT_BILL_DATA'], 'TXT_CHECKOUT_CONTACT_DATA' => $_ARRAYLANG['TXT_CHECKOUT_CONTACT_DATA'], 'CHECKOUT_INVOICE_NUMBER' => !empty($arrFieldValues['invoice_number']) ? $arrFieldValues['invoice_number'] : $_ARRAYLANG['TXT_CHECKOUT_INVOICE_NUMBER'] . $htmlRequiredField, 'CHECKOUT_INVOICE_CURRENCY_OPTIONS' => !empty($arrSelectOptions['currencies']) ? implode($arrSelectOptions['currencies']) : '', 'CHECKOUT_INVOICE_AMOUNT' => !empty($arrFieldValues['invoice_amount']) ? $arrFieldValues['invoice_amount'] : $_ARRAYLANG['TXT_CHECKOUT_INVOICE_AMOUNT'] . $htmlRequiredField, 'CHECKOUT_CONTACT_TITLE_OPTIONS' => !empty($arrSelectOptions['titles']) ? implode($arrSelectOptions['titles']) : '', 'CHECKOUT_CONTACT_FORENAME' => !empty($arrFieldValues['contact_forename']) ? $arrFieldValues['contact_forename'] : $_ARRAYLANG['TXT_CHECKOUT_CONTACT_FORENAME'] . $htmlRequiredField, 'CHECKOUT_CONTACT_SURNAME' => !empty($arrFieldValues['contact_surname']) ? $arrFieldValues['contact_surname'] : $_ARRAYLANG['TXT_CHECKOUT_CONTACT_SURNAME'] . $htmlRequiredField, 'CHECKOUT_CONTACT_COMPANY' => !empty($arrFieldValues['contact_company']) ? $arrFieldValues['contact_company'] : $_ARRAYLANG['TXT_CHECKOUT_CONTACT_COMPANY'], 'CHECKOUT_CONTACT_STREET' => !empty($arrFieldValues['contact_street']) ? $arrFieldValues['contact_street'] : $_ARRAYLANG['TXT_CHECKOUT_CONTACT_STREET'] . $htmlRequiredField, 'CHECKOUT_CONTACT_POSTCODE' => !empty($arrFieldValues['contact_postcode']) ? $arrFieldValues['contact_postcode'] : $_ARRAYLANG['TXT_CHECKOUT_CONTACT_POSTCODE'] . $htmlRequiredField, 'CHECKOUT_CONTACT_PLACE' => !empty($arrFieldValues['contact_place']) ? $arrFieldValues['contact_place'] : $_ARRAYLANG['TXT_CHECKOUT_CONTACT_PLACE'] . $htmlRequiredField, 'CHECKOUT_CONTACT_COUNTRY_OPTIONS' => !empty($arrSelectOptions['countries']) ? implode($arrSelectOptions['countries']) : '', 'CHECKOUT_CONTACT_PHONE' => !empty($arrFieldValues['contact_phone']) ? $arrFieldValues['contact_phone'] : $_ARRAYLANG['TXT_CHECKOUT_CONTACT_PHONE'] . $htmlRequiredField, 'CHECKOUT_CONTACT_EMAIL' => !empty($arrFieldValues['contact_email']) ? $arrFieldValues['contact_email'] : $_ARRAYLANG['TXT_CHECKOUT_CONTACT_EMAIL'] . $htmlRequiredField, 'CHECKOUT_INVOICE_NUMBER_CLASS' => $arrCssClasses['invoice_number'], 'CHECKOUT_INVOICE_CURRENCY_CLASS' => $arrCssClasses['invoice_currency'], 'CHECKOUT_INVOICE_AMOUNT_CLASS' => $arrCssClasses['invoice_amount'], 'CHECKOUT_CONTACT_TITLE_CLASS' => $arrCssClasses['contact_title'], 'CHECKOUT_CONTACT_FORENAME_CLASS' => $arrCssClasses['contact_forename'], 'CHECKOUT_CONTACT_SURNAME_CLASS' => $arrCssClasses['contact_surname'], 'CHECKOUT_CONTACT_COMPANY_CLASS' => $arrCssClasses['contact_company'], 'CHECKOUT_CONTACT_STREET_CLASS' => $arrCssClasses['contact_street'], 'CHECKOUT_CONTACT_POSTCODE_CLASS' => $arrCssClasses['contact_postcode'], 'CHECKOUT_CONTACT_PLACE_CLASS' => $arrCssClasses['contact_place'], 'CHECKOUT_CONTACT_COUNTRY_CLASS' => $arrCssClasses['contact_country'], 'CHECKOUT_CONTACT_PHONE_CLASS' => $arrCssClasses['contact_phone'], 'CHECKOUT_CONTACT_EMAIL_CLASS' => $arrCssClasses['contact_email'], 'TXT_CORE_SUBMIT' => $_CORELANG['TXT_CORE_SUBMIT'], 'TXT_CORE_RESET' => $_CORELANG['TXT_CORE_RESET'])); $this->objTemplate->hideBlock('redirect'); $this->objTemplate->parse('form'); }
/** * Checks if the user has been successfully authenticated * * If a user has been successfully authenticated then he will be * redirected to the requested page, otherwise the login page will be displayed * * @access private * @global array * @see cmsSession::cmsSessionStatusUpdate(), contrexx_strip_tags, \Cx\Core\Html\Sigma::get() * @return string \Cx\Core\Html\Sigma::get() */ function _login() { global $_CORELANG, $sessionObj; $objFWUser = \FWUser::getFWUserObject(); if (isset($_REQUEST['redirect'])) { $redirect = contrexx_strip_tags($_REQUEST['redirect']); } elseif (isset($_SESSION['redirect'])) { $redirect = $_SESSION['redirect']; } else { $redirect = ""; } \Cx\Lib\SocialLogin::parseSociallogin($this->_objTpl); $arrSettings = \User_Setting::getSettings(); if (function_exists('curl_init') && $arrSettings['sociallogin']['status'] && !empty($_GET['provider'])) { $providerLogin = $this->loginWithProvider($_GET['provider']); if ($providerLogin) { return $providerLogin; } } if ($objFWUser->objUser->login()) { if (isset($_POST['login']) && $objFWUser->checkLogin() || isset($_GET['auth-token']) && isset($_GET['user-id'])) { $objFWUser->objUser->reset(); $objFWUser->logoutAndDestroySession(); $sessionObj = \cmsSession::getInstance(); } elseif (isset($_POST['login'])) { $_GET['relogin'] = '******'; } } if ((!isset($_GET['relogin']) || $_GET['relogin'] != 'true') && $objFWUser->objUser->login() || $objFWUser->checkAuth()) { $groupRedirect = ($objGroup = $objFWUser->objGroup->getGroup($objFWUser->objUser->getPrimaryGroupId())) && $objGroup->getHomepage() ? preg_replace('/\\[\\[([A-Z0-9_-]+)\\]\\]/', '{\\1}', $objGroup->getHomepage()) : CONTREXX_SCRIPT_PATH; \LinkGenerator::parseTemplate($groupRedirect); if (isset($_SESSION['redirect'])) { unset($_SESSION['redirect']); } if (!empty($redirect)) { $redirect = \FWUser::getRedirectUrl(urlencode(base64_decode($redirect))); } \Cx\Core\Csrf\Controller\Csrf::header('Location: ' . (empty($redirect) ? $groupRedirect : $redirect)); exit; } else { if (isset($_POST['login'])) { $this->_statusMessage = $_CORELANG['TXT_PASSWORD_OR_USERNAME_IS_INCORRECT']; } } if (isset($_SESSION['auth']['loginLastAuthFailed'])) { $this->_objTpl->setVariable(array('TXT_CORE_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], 'CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode())); $this->_objTpl->parse('captcha'); } else { $this->_objTpl->hideBlock('captcha'); } // TODO: loading the language data of component Access at this // point is a workaround as the integration of the Access // component's functionality itself is hard-coded too and // has not been implemented through the system component // framework. $accessLang = \Env::get('init')->getComponentSpecificLanguageData('Access'); $this->_objTpl->setVariable(array('TXT_ACCESS_SIGNUP_BY_FACEBOOK' => $accessLang['TXT_ACCESS_SIGNUP_BY_FACEBOOK'], 'TXT_ACCESS_SIGNUP_BY_GOOGLE' => $accessLang['TXT_ACCESS_SIGNUP_BY_GOOGLE'], 'TXT_ACCESS_SIGNUP_BY_TWITTER' => $accessLang['TXT_ACCESS_SIGNUP_BY_TWITTER'], 'TXT_CORE_SIGN_UP' => $_CORELANG['TXT_CORE_SIGN_UP'], 'TXT_LOGIN' => $_CORELANG['TXT_LOGIN'], 'TXT_USER_NAME' => $_CORELANG['TXT_USER_NAME'], 'TXT_EMAIL' => $_CORELANG['TXT_EMAIL'], 'TXT_PASSWORD' => $_CORELANG['TXT_PASSWORD'], 'TXT_LOGIN_REMEMBER_ME' => $_CORELANG['TXT_CORE_REMEMBER_ME'], 'TXT_PASSWORD_LOST' => $_CORELANG['TXT_PASSWORD_LOST'], 'LOGIN_REDIRECT' => $redirect, 'LOGIN_STATUS_MESSAGE' => $this->_statusMessage)); return $this->_objTpl->get(); }
function saveInputfield($intInputfieldId, $strValue, $langId = 0) { $arrValue = $strValue; foreach ($arrValue as $intKey => $strValue) { $arrValue[$intKey] = $strValue = contrexx_strip_tags(contrexx_input2raw($strValue)); } $strValue = join(",", $arrValue); return $strValue; }
/** * Save the mail data * * @param type $data Posted data from the user * * @return boolean true if data updated, false otherwise */ function save($data) { global $objDatabase; $title = contrexx_addslashes(contrexx_strip_tags($data['title'])); $content_text = contrexx_addslashes(contrexx_strip_tags($data['content_text'])); $content_html = contrexx_addslashes($data['content_html']); $lang_id = intval($data['lang']); $action_id = intval($data['action']); $recipients = contrexx_addslashes(contrexx_strip_tags($data['recipients'])); if (intval($this->id) == 0) { $query = "INSERT INTO " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_mail\r\n (`title`,`content_text`,`content_html`,`recipients`,`lang_id`,`action_id`,`status`) \r\n VALUES ('" . $title . "','" . $content_text . "','" . $content_html . "','" . $recipients . "','" . $lang_id . "','" . $action_id . "','0')"; } else { $query = "UPDATE " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_mail\r\n SET `title` = '" . $title . "',\r\n `content_text` = '" . $content_text . "',\r\n `content_html` = '" . $content_html . "',\r\n `recipients` = '" . $recipients . "',\r\n `lang_id` = '" . $lang_id . "',\r\n `action_id` = '" . $action_id . "'\r\n WHERE `id` = '" . intval($this->id) . "'"; } $objResult = $objDatabase->Execute($query); if ($objResult !== false) { return true; } else { return false; } }
/** * update selected file * @access public * @global array * @global ADONewConnection * @global array */ function updateFile($addedby) { global $_CONFIG, $objDatabase, $_ARRAYLANG; //get post data if (isset($_POST['edit_submit'])) { $dirId = intval($_POST['edit_id']); $query = "UPDATE " . DBPREFIX . "module_directory_dir SET "; foreach ($_POST["inputValue"] as $inputName => $inputValue) { switch ($inputName) { case 'lat': case 'lat_fraction': case 'lon': case 'lon_fraction': case 'zoom': continue 2; } //check links if ($inputName == "relatedlinks" || $inputName == "homepage" || $inputName == "link") { if (substr($inputValue, 0, 7) != "http://" && $inputValue != "") { $inputValue = "http://" . $inputValue; } } //check rss if ($inputName == "rss_link") { $objResultRSS = $objDatabase->SelectLimit("SELECT rss_link, rss_file FROM " . DBPREFIX . "module_directory_dir WHERE id = '" . $dirId . "'", 1); $oldRssLink = $objResultRSS->fields['rss_link']; $oldRssFile = $objResultRSS->fields['rss_file']; if ($inputValue != $oldRssLink) { $obj_file = new \File(); $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "ext_feeds/" . $oldRssFile); //create rss $link = $inputValue; $rss_file = $this->createXML($link); if (substr($inputValue, 0, 7) != "http://" && $inputValue != "") { $inputValue = "http://" . $inputValue; } if ($rss_file == "error") { $inputValue = ""; $rss_file = ""; } } else { $inputValue = $oldRssLink; $rss_file = $oldRssLink; } } //get author id if ($inputName == "addedby") { if ($addedby != '') { $inputValue = $addedby; } else { $inputValue = $this->getAuthorID($inputValue); } } //check pics if ($inputName == "logo" || $inputName == "lokal" || $inputName == "map" || $inputName == "spez_field_11" || $inputName == "spez_field_12" || $inputName == "spez_field_13" || $inputName == "spez_field_14" || $inputName == "spez_field_15" || $inputName == "spez_field_16" || $inputName == "spez_field_17" || $inputName == "spez_field_18" || $inputName == "spez_field_19" || $inputName == "spez_field_20") { if (!empty($_FILES[$inputName]['name']) || $_POST["deleteMedia"][$inputName] == 1) { $obj_file = new \File(); //thumb if (file_exists($this->mediaPath . "thumbs/" . $_POST["inputValue"][$inputName])) { $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "thumbs/" . $_POST["inputValue"][$inputName]); } //picture if (file_exists($this->mediaPath . "images/" . $_POST["inputValue"][$inputName]) && $_POST["inputValue"][$inputName] != 'no_picture.gif') { $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "images/" . $_POST["inputValue"][$inputName]); } if ($_POST["deleteMedia"][$inputName] != 1) { $inputValue = $this->uploadMedia($inputName, "images/"); if ($inputValue == "error") { $inputValue = ""; } } else { $inputValue = ""; } } } //check uploads $arrSpezialUploadFields = array('attachment', 'spez_field_25', 'spez_field_26', 'spez_field_27', 'spez_field_28', 'spez_field_29'); if (in_array($inputName, $arrSpezialUploadFields)) { if (!empty($_FILES[$inputName]['name']) || $_POST["deleteMedia"][$inputName] == 1) { $obj_file = new \File(); //upload if (file_exists($this->mediaPath . "uploads/" . $_POST["inputValue"][$inputName])) { $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "uploads/" . $_POST["inputValue"][$inputName]); } if ($_POST["deleteMedia"][$inputName] != 1) { $inputValue = $this->uploadMedia($inputName, "uploads/"); if ($inputValue == "error") { $inputValue = ""; } } else { $inputValue = ""; } } else { $inputValue = ""; } } /* * spezial upload fields must be updated only when new file is uploaded or old one is deleted * other input types must be updated unconditionally. */ if (!in_array($inputName, $arrSpezialUploadFields)) { $query .= contrexx_addslashes($inputName) . " ='" . contrexx_strip_tags(contrexx_addslashes($inputValue)) . "', "; } else { if (in_array($inputName, $arrSpezialUploadFields) && (!empty($_FILES[$inputName]['name']) || $_POST["deleteMedia"][$inputName] == 1)) { $query .= contrexx_addslashes($inputName) . " ='" . contrexx_strip_tags(contrexx_addslashes($inputValue)) . "', "; } } } //get status settings $objResult = $objDatabase->Execute("SELECT setvalue FROM " . DBPREFIX . "module_directory_settings WHERE setname = 'editFeed_status' LIMIT 1"); if ($objResult !== false) { while (!$objResult->EOF) { $entryStatus = $objResult->fields['setvalue']; $objResult->MoveNext(); } } //numbers could be too big for intavl(), use contrexx_addslashes() instead... $query .= " premium='" . $_POST["premium"] . "', status='" . intval($entryStatus) . "', validatedate='" . mktime("now") . "', longitude='" . contrexx_addslashes($_REQUEST['inputValue']['lon']) . '.' . contrexx_addslashes($_POST['inputValue']['lon_fraction']) . "', latitude='" . contrexx_addslashes($_REQUEST['inputValue']['lat']) . '.' . contrexx_addslashes($_REQUEST['inputValue']['lat_fraction']) . "', zoom='" . intval($_REQUEST['inputValue']['zoom']) . "' WHERE id='" . $dirId . "'"; //edit entry $objResult = $objDatabase->Execute($query); if ($objResult !== false) { $objResult = $objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_directory_rel_dir_cat WHERE dir_id='" . $dirId . "'"); $objResult = $objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_directory_rel_dir_level WHERE dir_id='" . $dirId . "'"); foreach ($_POST["selectedCat"] as $inputName => $inputValue) { $query = "INSERT INTO " . DBPREFIX . "module_directory_rel_dir_cat SET dir_id='" . $dirId . "', cat_id='" . $inputValue . "'"; $objDatabase->query($query); } foreach ($_POST["selectedLevel"] as $inputName => $inputValue) { $query = "INSERT INTO " . DBPREFIX . "module_directory_rel_dir_level SET dir_id='" . $dirId . "', level_id='" . $inputValue . "'"; $objDatabase->query($query); } if ($entryStatus == 1) { // TODO: $id is never set! $this->confirmEntry_step2($id); } $this->strOkMessage = $_ARRAYLANG['TXT_FEED_SUCCESSFULL_ADDED']; $status = $dirId; $this->createRSS(); } //update xml $this->createRSS(); return $status; } return false; }
/** * Performs the Event details page * * @return null */ function showEvent($page) { global $_ARRAYLANG, $_CORELANG, $_LANGID; if (empty($this->objEventManager->eventList)) { \Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd($this->moduleName)); exit; } $this->_objTpl->setTemplate($this->pageContent, true, true); $this->pageTitle = html_entity_decode($this->objEventManager->eventList[0]->title, ENT_QUOTES, CONTREXX_CHARSET); // Set the meta page description to the teaser text if displaying calendar details $teaser = html_entity_decode($this->objEventManager->eventList[0]->teaser, ENT_QUOTES, CONTREXX_CHARSET); if ($teaser) { $page->setMetadesc(contrexx_raw2xhtml(contrexx_strip_tags($teaser))); } else { $description = html_entity_decode($this->objEventManager->eventList[0]->description, ENT_QUOTES, CONTREXX_CHARSET); $page->setMetadesc(contrexx_raw2xhtml(contrexx_strip_tags($description))); } // Set the meta page image to event picture if displaying calendar details $picture = $this->objEventManager->eventList[0]->pic; if ($picture) { $page->setMetaimage($picture); } $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_ATTACHMENT' => $_ARRAYLANG['TXT_CALENDAR_ATTACHMENT'], 'TXT_' . $this->moduleLangVar . '_THUMBNAIL' => $_ARRAYLANG['TXT_CALENDAR_THUMBNAIL'], 'TXT_' . $this->moduleLangVar . '_OPTIONS' => $_ARRAYLANG['TXT_CALENDAR_OPTIONS'], 'TXT_' . $this->moduleLangVar . '_CATEGORY' => $_ARRAYLANG['TXT_CALENDAR_CAT'], 'TXT_' . $this->moduleLangVar . '_PLACE' => $_ARRAYLANG['TXT_CALENDAR_PLACE'], 'TXT_' . $this->moduleLangVar . '_EVENT_HOST' => $_ARRAYLANG['TXT_CALENDAR_EVENT_HOST'], 'TXT_' . $this->moduleLangVar . '_PRIORITY' => $_ARRAYLANG['TXT_CALENDAR_PRIORITY'], 'TXT_' . $this->moduleLangVar . '_START' => $_ARRAYLANG['TXT_CALENDAR_START'], 'TXT_' . $this->moduleLangVar . '_END' => $_ARRAYLANG['TXT_CALENDAR_END'], 'TXT_' . $this->moduleLangVar . '_COMMENT' => $_ARRAYLANG['TXT_CALENDAR_COMMENT'], 'TXT_' . $this->moduleLangVar . '_OCLOCK' => $_ARRAYLANG['TXT_CALENDAR_OCLOCK'], 'TXT_' . $this->moduleLangVar . '_EXPORT' => $_ARRAYLANG['TXT_CALENDAR_EXPORT'], 'TXT_' . $this->moduleLangVar . '_EVENT_PRICE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PRICE'], 'TXT_' . $this->moduleLangVar . '_EVENT_FREE_PLACES' => $_ARRAYLANG['TXT_CALENDAR_EVENT_FREE_PLACES'], 'TXT_' . $this->moduleLangVar . '_DATE' => $_CORELANG['TXT_DATE'], 'TXT_' . $this->moduleLangVar . '_NAME' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NAME'], 'TXT_' . $this->moduleLangVar . '_LINK' => $_ARRAYLANG['TXT_CALENDAR_EVENT_LINK'], 'TXT_' . $this->moduleLangVar . '_EVENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT'], 'TXT_' . $this->moduleLangVar . '_STREET' => $_ARRAYLANG['TXT_CALENDAR_EVENT_STREET'], 'TXT_' . $this->moduleLangVar . '_ZIP' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ZIP'], 'TXT_' . $this->moduleLangVar . '_MAP' => $_ARRAYLANG['TXT_CALENDAR_EVENT_MAP'], 'TXT_' . $this->moduleLangVar . '_HOST' => $_ARRAYLANG['TXT_CALENDAR_HOST'], 'TXT_' . $this->moduleLangVar . '_MAIL' => $_ARRAYLANG['TXT_CALENDAR_EVENT_EMAIL'], 'TXT_' . $this->moduleLangVar . '_HOST_NAME' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NAME'], 'TXT_' . $this->moduleLangVar . '_TITLE' => $_ARRAYLANG['TXT_CALENDAR_TITLE'], 'TXT_' . $this->moduleLangVar . '_ACCESS' => $_ARRAYLANG['TXT_CALENDAR_ACCESS'], 'TXT_' . $this->moduleLangVar . '_REGISTRATION' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATION'], 'TXT_' . $this->moduleLangVar . '_REGISTRATION_INFO' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_INFO'])); $this->objEventManager->showEvent($this->_objTpl, intval($_GET['id']), intval($_GET['date'])); }
/** * Show picture * * Either show the current picture of the livecam or one from the archive * * @access private */ function _showPicture() { $this->camSettings = $this->getCamSettings($this->cam); //var_dump($this->camSettings); \JS::activate("shadowbox", array('players' => array('img'))); \JS::activate('jqueryui'); \JS::registerCode("\r\n cx.ready(function() {\r\n cx.jQuery('input[name=date]').datepicker({dateFormat: 'yy-mm-dd'});\r\n });\r\n "); if ($this->camSettings['shadowboxActivate'] == 1) { $imageLink = $this->camSettings['currentImagePath']; } else { if (isset($_GET['file'])) { $archiveDate = substr($_GET['file'], 0, 10); $imageLink = 'index.php?section=Livecam&act=archive&date=' . $archiveDate; } else { $cmd = ''; if (!empty($_GET['cmd'])) { $cmd = '&cmd=' . intval($_GET['cmd']); } $imageLink = "?section=Livecam{$cmd}&act=today"; } } $this->_objTpl->setVariable(array('LIVECAM_CURRENT_IMAGE' => isset($_GET['file']) ? ASCMS_PATH_OFFSET . $this->camSettings['archivePath'] . '/' . $_GET['file'] : $this->camSettings['currentImagePath'], 'LIVECAM_IMAGE_TEXT' => isset($_GET['file']) ? contrexx_strip_tags($_GET['file']) : 'Aktuelles Webcam Bild', 'LIVECAM_IMAGE_SHADOWBOX' => $this->camSettings['shadowboxActivate'] == 1 ? 'shadowboxgallery' : '', 'LIVECAM_IMAGE_LINK' => $imageLink, 'LIVECAM_IMAGE_SIZE' => $this->camSettings['currentMaxSize'])); }
function _editTeaserFrame() { global $_ARRAYLANG; $this->_objTpl->addBlockFile('NEWS_TEASERS_FILE', 'news_teasers_block', 'module_news_teasers_modify_frame.html'); $this->_objTpl->setVariable(array('TXT_BOX_NAME' => $_ARRAYLANG['TXT_BOX_NAME'], 'TXT_BOX_TEMPLATE' => $_ARRAYLANG['TXT_BOX_TEMPLATE'], 'TXT_CANCEL' => $_ARRAYLANG['TXT_CANCEL'], 'TXT_SAVE' => $_ARRAYLANG['TXT_SAVE'])); // get teaser frame id if (isset($_GET['frameId'])) { $teaserFrameId = intval($_GET['frameId']); } else { $teaserFrameId = 0; } // set teaser frame name if (isset($_POST['teaserFrameName'])) { $teaserFrameName = preg_replace('/[^a-zA-Z0-9]+/', '', $_POST['teaserFrameName']); $teaserFrameName = htmlentities(contrexx_strip_tags($teaserFrameName), ENT_QUOTES, CONTREXX_CHARSET); } elseif (isset($this->_objTeaser->arrTeaserFrames[$teaserFrameId])) { $teaserFrameName = $this->_objTeaser->arrTeaserFrames[$teaserFrameId]['name']; } else { $teaserFrameName = ''; } // set teaser frame template if (isset($_POST['teaserFrameTemplateId'])) { $teaserFrameTemplateId = intval($_POST['teaserFrameTemplateId']); } elseif (isset($this->_objTeaser->arrTeaserFrames[$teaserFrameId])) { $teaserFrameTemplateId = $this->_objTeaser->arrTeaserFrames[$teaserFrameId]['frame_template_id']; } else { $teaserFrameTemplateId = $this->_objTeaser->getFirstTeaserFrameTemplateId(); } $this->pageTitle = $teaserFrameId != 0 ? $_ARRAYLANG['TXT_EDIT_TEASER_BOX'] : $_ARRAYLANG['TXT_ADD_TEASER_BOX']; $this->_objTpl->setVariable(array('NEWS_TEASER_FRAME_ID' => $teaserFrameId, 'NEWS_TEASER_FRAME_NAME' => $teaserFrameName, 'NEWS_TEASER_FRAME_TEMPLATE_MENU' => $this->_objTeaser->getTeaserFrameTemplateMenu($teaserFrameTemplateId), 'NEWS_TEASER_FRAME_PREVIEW' => $this->_objTeaser->_getTeaserFrame($teaserFrameId, $teaserFrameTemplateId), 'NEWS_TEASER_TITLE_TXT' => $teaserFrameId != 0 ? $_ARRAYLANG['TXT_EDIT_TEASER_BOX'] : $_ARRAYLANG['TXT_ADD_TEASER_BOX'])); $this->_objTpl->parse('news_teasers_block'); }
function saveLevel($arrData, $intLevelId = null) { global $_ARRAYLANG, $_CORELANG, $objDatabase, $_LANGID; //get data $intId = intval($intLevelId); $intParentId = intval($arrData['levelPosition']); $intShowEntries = intval($arrData['levelShowEntries']); $intShowSublevels = isset($arrData['levelShowSublevels']) ? contrexx_input2int($arrData['levelShowSublevels']) : 0; $intShowCategories = intval($arrData['levelShowCategories']); $intActive = intval($arrData['levelActive']); $strPicture = contrexx_addslashes(contrexx_strip_tags($arrData['levelImage'])); $arrName = $arrData['levelName']; $arrDescription = $arrData['levelDescription']; if (empty($intId)) { //insert new category $objInsertAttributes = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_levels\n SET\n `parent_id`='" . $intParentId . "',\n `order`=0,\n `show_entries`='" . $intShowEntries . "',\n `show_sublevels`='" . $intShowSublevels . "',\n `show_categories`='" . $intShowCategories . "',\n `picture`='" . $strPicture . "',\n `active`='" . $intActive . "'\n "); if ($objInsertAttributes !== false) { $intId = $objDatabase->Insert_ID(); foreach ($this->arrFrontendLanguages as $key => $arrLang) { if (empty($arrName[0])) { $arrName[0] = "[[" . $_ARRAYLANG['TXT_MEDIADIR_NEW_LEVEL'] . "]]"; } if (empty($arrDescription[0])) { $arrDescription[0] = isset($arrDescription[$_LANGID]) ? $arrDescription[$_LANGID] : ''; } $strName = $arrName[$arrLang['id']]; $strDescription = $arrDescription[$arrLang['id']]; if (empty($strName)) { $strName = $arrName[0]; } if (empty($strDescription)) { $strDescription = $arrDescription[0]; } $objInsertNames = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_level_names\n SET\n `lang_id`='" . intval($arrLang['id']) . "',\n `level_id`='" . intval($intId) . "',\n `level_name`='" . contrexx_raw2db(contrexx_input2raw($strName)) . "',\n `level_description`='" . contrexx_raw2db(contrexx_input2raw($strDescription)) . "'\n "); } if ($objInsertNames !== false) { return true; } else { return false; } } else { return false; } } else { //update category if ($intParentId == $intLevelId) { $parentSql = null; } else { $parentSql = "`parent_id`='" . $intParentId . "',"; } $objUpdateAttributes = $objDatabase->Execute("\n UPDATE\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_levels\n SET\n " . $parentSql . "\n `show_entries`='" . $intShowEntries . "',\n `show_sublevels`='" . $intShowSublevels . "',\n `show_categories`='" . $intShowCategories . "',\n `picture`='" . $strPicture . "',\n `active`='" . $intActive . "'\n WHERE\n `id`='" . $intId . "'\n "); if ($objUpdateAttributes !== false) { $objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_level_names WHERE level_id='" . $intId . "'"); foreach ($this->arrFrontendLanguages as $key => $arrLang) { if (empty($arrName[0])) { $arrName[0] = "[[" . $_ARRAYLANG['TXT_MEDIADIR_NEW_LEVEL'] . "]]"; } if (empty($arrDescription[0])) { $arrDescription[0] = isset($arrDescription[$_LANGID]) ? $arrDescription[$_LANGID] : ''; } $strName = $arrName[$arrLang['id']]; $strDescription = $arrDescription[$arrLang['id']]; if (empty($strName)) { $strName = $arrName[0]; } if (empty($strDescription)) { $strDescription = $arrDescription[0]; } $objInsertNames = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_level_names\n SET\n `lang_id`='" . intval($arrLang['id']) . "',\n `level_id`='" . intval($intId) . "',\n `level_name`='" . contrexx_raw2db(contrexx_input2raw($strName)) . "',\n `level_description`='" . contrexx_raw2db(contrexx_input2raw($strDescription)) . "'\n "); } if ($objInsertNames !== false) { return true; } else { return false; } } else { return false; } } }
function saveInputfield($intInputfieldId, $arrValue, $intLangId) { global $objInit, $_LANGID; $arrValues = array(); if ($objInit->mode == 'backend') { foreach ($arrValue as $intKey => $arrValuesTmp) { $arrValues[] = join("##", $arrValuesTmp); } } else { foreach ($arrValue as $intKey => $arrValuesTmp) { if ($_FILES['fileUpload_' . $intInputfieldId]['name'][0][$intKey] != '' && $intLangId == $_LANGID) { $this->deleteFile($arrValuesTmp['file']); $arrValuesTmp['file'] = $this->uploadMedia($intInputfieldId, $intKey, 0); } if ($_FILES['fileUpload_' . $intInputfieldId]['name'][$intLangId][$intKey] != '') { $this->deleteFile($arrValuesTmp['file']); $arrValuesTmp['file'] = $this->uploadMedia($intInputfieldId, $intKey, $intLangId); } else { if ($arrValuesTmp['file'] == '' || $arrValuesTmp['file'] == 'new_file') { $arrValuesTmp['file'] = $this->imageWebPath . 'uploads/' . $_FILES['fileUpload_' . $intInputfieldId]['name'][0][$intKey]; } } $arrValues[] = join("##", $arrValuesTmp); } } $strValue = contrexx_input2raw(contrexx_strip_tags(join("||", $arrValues))); return $strValue; }
/** * send email notifications * * @param integer $intThreadId * @param string $strSubject subject of the last message in the thread * @param string $strContent content of the last message in the thread * @return void */ function _sendNotifications($intThreadId, $strSubject, $strContent) { global $objDatabase, $_CONFIG; require_once ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php'; $arrTempSubcribers = array(); $arrSubscribers = array(); $intCategoryId = $this->_getCategoryIdFromThread($intThreadId); $mail = new \PHPMailer(); $query = ' SELECT `subject`, `user_id` FROM `' . DBPREFIX . 'module_forum_postings` WHERE `thread_id` = ' . $intThreadId . ' AND `prev_post_id` = 0'; if (($objRS = $objDatabase->SelectLimit($query, 1)) !== false) { $strFirstPostSubject = $objRS->fields['subject']; $strFirstPostAuthor = $this->_getUserName($objRS->fields['user_id']); } else { die('Database error: ' . $objDatabase->ErrorMsg()); } //fetch thread subscribers $query = ' SELECT `users`.`username`, `users`.`email`, `users`.`id` FROM `' . DBPREFIX . 'access_users` AS `users` INNER JOIN `' . DBPREFIX . 'module_forum_notification` AS `notification` ON `users`.`id` = `notification`.`user_id` WHERE `notification`.`thread_id` = ' . $intThreadId . ' AND `notification`.`category_id` = 0'; if (($objRS = $objDatabase->Execute($query)) !== false) { while (!$objRS->EOF) { $arrTempSubcribers[] = $objRS->fields; $objRS->MoveNext(); } } //fetch category subscribers $query = ' SELECT `users`.`username`, `users`.`email`, `users`.`id` FROM `' . DBPREFIX . 'access_users` AS `users` INNER JOIN `' . DBPREFIX . 'module_forum_notification` AS `notification` ON `users`.`id` = `notification`.`user_id` WHERE `notification`.`category_id` = ' . $intCategoryId . ' AND `notification`.`thread_id` = 0'; if (($objRS = $objDatabase->Execute($query)) !== false) { while (!$objRS->EOF) { $arrTempSubcribers[] = $objRS->fields; $objRS->MoveNext(); } } foreach ($arrTempSubcribers as $entry) { if (!in_array($entry, $arrSubscribers)) { $arrSubscribers[] = $entry; } } if (!empty($arrSubscribers)) { $mail->CharSet = CONTREXX_CHARSET; $mail->IsHTML(false); $mail->SetFrom($this->_arrSettings['notification_from_email'], $this->_arrSettings['notification_from_name']); $strThreadURL = 'http://' . $_CONFIG['domainUrl'] . CONTREXX_SCRIPT_PATH . '?section=Forum&cmd=thread&id=' . $intThreadId; $arrSearch = array('[[FORUM_THREAD_SUBJECT]]', '[[FORUM_THREAD_STARTER]]', '[[FORUM_LATEST_SUBJECT]]', '[[FORUM_LATEST_MESSAGE]]', '[[FORUM_THREAD_URL]]'); $arrReplace = array($strFirstPostSubject, $strFirstPostAuthor, $strSubject, $strContent, $strThreadURL); $_strMailTemplate = html_entity_decode(str_replace($arrSearch, $arrReplace, $this->_arrSettings['notification_template'])); $_strMailSubject = html_entity_decode(str_replace($arrSearch, $arrReplace, $this->_arrSettings['notification_subject'])); $objFWUser = \FWUser::getFWUserObject(); foreach ($arrSubscribers as $arrSubscriber) { if ($objFWUser->objUser->login() && $arrSubscriber['id'] == $objFWUser->objUser->getId()) { //creator of the new post/thread doesn't want a notification continue; } $mail->ClearAddresses(); $strUsername = htmlentities($arrSubscriber['username'], ENT_QUOTES, CONTREXX_CHARSET); $strMailTemplate = str_replace('[[FORUM_USERNAME]]', $strUsername, $_strMailTemplate); $strMailSubject = str_replace('[[FORUM_USERNAME]]', $strUsername, $_strMailSubject); $mail->AddAddress($arrSubscriber['email']); $mail->Subject = stripslashes(contrexx_strip_tags($strMailSubject)); $mail->Body = stripslashes(contrexx_strip_tags($strMailTemplate)); $mail->Send(); } } }
/** * Log the user session. * * Create a log entry in the database containing the users' details. * @global ADONewConnection */ function log() { global $objDatabase; if (!isset($_SESSION['auth']['log'])) { $remote_host = @gethostbyaddr($_SERVER['REMOTE_ADDR']); $referer = isset($_SERVER['HTTP_REFERER']) ? contrexx_strip_tags(strtolower($_SERVER['HTTP_REFERER'])) : ''; $httpUserAgent = get_magic_quotes_gpc() ? strip_tags($_SERVER['HTTP_USER_AGENT']) : addslashes(strip_tags($_SERVER['HTTP_USER_AGENT'])); $httpAcceptLanguage = get_magic_quotes_gpc() ? strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']) : addslashes(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE'])); $objFWUser = FWUser::getFWUserObject(); $objDatabase->Execute("INSERT INTO " . DBPREFIX . "log\n SET userid=" . $objFWUser->objUser->getId() . ",\n datetime = " . $objDatabase->DBTimeStamp(time()) . ",\n useragent = '" . substr($httpUserAgent, 0, 250) . "',\n userlanguage = '" . substr($httpAcceptLanguage, 0, 250) . "',\n remote_addr = '" . substr(strip_tags($_SERVER['REMOTE_ADDR']), 0, 250) . "',\n remote_host = '" . substr($remote_host, 0, 250) . "',\n http_x_forwarded_for = '" . (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? substr(strip_tags($_SERVER['HTTP_X_FORWARDED_FOR']), 0, 250) : '') . "',\n http_via = '" . (isset($_SERVER['HTTP_VIA']) ? substr(strip_tags($_SERVER['HTTP_VIA']), 0, 250) : '') . "',\n http_client_ip = '" . (isset($_SERVER['HTTP_CLIENT_IP']) ? substr(strip_tags($_SERVER['HTTP_CLIENT_IP']), 0, 250) : '') . "',\n referer ='" . substr($referer, 0, 250) . "'"); $_SESSION['auth']['log'] = true; } }
/** * Inserts the contact form submit into the database * * This method does store the request in the database * @access private * @global ADONewConnection * @global array * @param array Details of the contact request * @see errorMsg * @return boolean TRUE on succes, otherwise FALSE */ function _insertIntoDatabase($arrFormData) { global $objDatabase, $_ARRAYLANG, $_LANGID; if (!empty($this->errorMsg)) { return false; } //handle files and collect the filenames //for legacy mode this has already been done in the first //_uploadFiles() call in getContactPage(). if (!$this->legacyMode) { $arrFormData['uploadedFiles'] = $this->_uploadFiles($arrFormData['fields'], true); } $objResult = $objDatabase->Execute("INSERT INTO " . DBPREFIX . "module_contact_form_data\n (`id_form`, `id_lang`, `time`, `host`, `lang`, `browser`, `ipaddress`)\n VALUES\n (" . $arrFormData['id'] . ",\n " . $_LANGID . ",\n " . $arrFormData['meta']['time'] . ",\n '" . contrexx_raw2db($arrFormData['meta']['host']) . "',\n '" . contrexx_raw2db($arrFormData['meta']['lang']) . "',\n '" . contrexx_raw2db($arrFormData['meta']['browser']) . "',\n '" . contrexx_raw2db($arrFormData['meta']['ipaddress']) . "')"); if ($objResult === false) { $this->errorMsg .= $_ARRAYLANG['TXT_CONTACT_FAILED_SUBMIT_REQUEST'] . '<br />'; return false; } $lastInsertId = $objDatabase->insert_id(); foreach ($arrFormData['fields'] as $key => $arrField) { $value = ''; if ($arrField['type'] == 'file' || $arrField['type'] == 'multi_file') { if ($key === 0) { throw new \Cx\Core_Modules\Contact\Controller\ContactException('could not find file field for form with id ' . $arrFormData['id']); } if ($this->legacyMode) { //store files according to their inputs name // TODO: check legacyMode $arrDBEntry = array(); foreach ($arrFormData['uploadedFiles'] as $key => $file) { $arrDbEntry[] = base64_encode($key) . "," . base64_encode(contrexx_strip_tags($file)); } $value = implode(';', $arrDbEntry); } elseif (isset($arrFormData['uploadedFiles'][$key]) && count($arrFormData['uploadedFiles'][$key]) > 0) { //assign all files uploaded to the uploader fields name $arrTmp = array(); foreach ($arrFormData['uploadedFiles'][$key] as $file) { $arrTmp[] = $file['path']; } // a * in front of the file names marks a 'new style' entry $value = implode('*', $arrTmp); } } else { if (isset($arrFormData['data'][$key])) { $value = $arrFormData['data'][$key]; } } if ($value != "") { $objDatabase->Execute("INSERT INTO " . DBPREFIX . "module_contact_form_submit_data\n (`id_entry`, `id_field`, `formlabel`, `formvalue`)\n VALUES\n (" . $lastInsertId . ",\n " . $key . ",\n '" . contrexx_raw2db($arrField['lang'][$_LANGID]['name']) . "',\n '" . contrexx_raw2db($value) . "')"); } } return true; }
/** * get Feed content * @access public * @param string $id * @global ADONewConnection * @global array */ function getContent($id, $cid = 0, $lid = 0) { global $objDatabase, $_ARRAYLANG; //get feed content $objResult = $objDatabase->Execute("\n SELECT *\n FROM " . DBPREFIX . "module_directory_dir\n WHERE id={$id}\n "); if ($objResult) { while (!$objResult->EOF) { $arrFeedContent['id'] = stripslashes($objResult->fields['id']); $arrFeedContent['title'] = stripslashes($objResult->fields['title']); $arrFeedContent['date'] = $objResult->fields['date']; $arrFeedContent['description'] = stripslashes($objResult->fields['description']); $arrFeedContent['relatedlinks'] = $objResult->fields['relatedlinks']; $arrFeedContent['status'] = $objResult->fields['status']; $arrFeedContent['addedby'] = $objResult->fields['addedby']; $arrFeedContent['provider'] = $objResult->fields['provider']; $arrFeedContent['ip'] = $objResult->fields['ip']; $arrFeedContent['validatedate'] = $objResult->fields['validatedate']; $arrFeedContent['link'] = $objResult->fields['link']; $arrFeedContent['rss_link'] = $objResult->fields['rss_link']; $rss_link = $objResult->fields['rss_file']; $arrFeedContent['attachment'] = $objResult->fields['attachment']; $arrFeedContent['platform'] = $objResult->fields['platform']; $arrFeedContent['language'] = $objResult->fields['language']; $arrFeedContent['canton'] = $objResult->fields['canton']; $arrFeedContent['searchkeys'] = $objResult->fields['searchkeys']; $arrFeedContent['company_name'] = $objResult->fields['company_name']; $arrFeedContent['street'] = $objResult->fields['street']; $arrFeedContent['zip'] = $objResult->fields['zip']; $arrFeedContent['phone'] = $objResult->fields['phone']; $arrFeedContent['longitude'] = $objResult->fields['longitude']; $arrFeedContent['latitude'] = $objResult->fields['latitude']; $arrFeedContent["lon"] = substr($objResult->fields['longitude'], 0, strpos($objResult->fields['longitude'], '.')); $arrFeedContent["lon_fraction"] = substr($objResult->fields['longitude'], strpos($objResult->fields['longitude'], '.') + 1); $arrFeedContent["lat"] = substr($objResult->fields['latitude'], 0, strpos($objResult->fields['latitude'], '.')); $arrFeedContent["lat_fraction"] = substr($objResult->fields['latitude'], strpos($objResult->fields['latitude'], '.') + 1); $arrFeedContent['zoom'] = $objResult->fields['zoom']; $arrFeedContent['country'] = $objResult->fields['country']; $arrFeedContent['googlemap'] = "googlemap"; $arrFeedContent['contact'] = $objResult->fields['contact']; $arrFeedContent['hits'] = $objResult->fields['hits']; $arrFeedContent['xml_refresh'] = $objResult->fields['xml_refresh']; // TODO: Field does not exist // $arrFeedContent['checksum'] = $objResult->fields['checksum']; $arrFeedContent['city'] = $objResult->fields['city']; $arrFeedContent['information'] = $objResult->fields['information']; $arrFeedContent['fax'] = $objResult->fields['fax']; $arrFeedContent['mobile'] = $objResult->fields['mobile']; $arrFeedContent['mail'] = $objResult->fields['mail']; $arrFeedContent['homepage'] = $objResult->fields['homepage']; $arrFeedContent['industry'] = $objResult->fields['industry']; $arrFeedContent['legalform'] = $objResult->fields['legalform']; $arrFeedContent['conversion'] = $objResult->fields['conversion']; $arrFeedContent['employee'] = $objResult->fields['employee']; $arrFeedContent['foundation'] = $objResult->fields['foundation']; $arrFeedContent['mwst'] = $objResult->fields['mwst']; $arrFeedContent['opening'] = $objResult->fields['opening']; $arrFeedContent['holidays'] = $objResult->fields['holidays']; $arrFeedContent['places'] = $objResult->fields['places']; $arrFeedContent['logo'] = $objResult->fields['logo']; $arrFeedContent['team'] = $objResult->fields['team']; $arrFeedContent['portfolio'] = $objResult->fields['portfolio']; $arrFeedContent['offers'] = $objResult->fields['offers']; $arrFeedContent['concept'] = $objResult->fields['concept']; $arrFeedContent['map'] = $objResult->fields['map']; $arrFeedContent['premium'] = $objResult->fields['premium']; $arrFeedContent['lokal'] = $objResult->fields['lokal']; $arrFeedContent['spez_field_1'] = $objResult->fields['spez_field_1']; $arrFeedContent['spez_field_2'] = $objResult->fields['spez_field_2']; $arrFeedContent['spez_field_3'] = $objResult->fields['spez_field_3']; $arrFeedContent['spez_field_4'] = $objResult->fields['spez_field_4']; $arrFeedContent['spez_field_5'] = $objResult->fields['spez_field_5']; $arrFeedContent['spez_field_6'] = $objResult->fields['spez_field_6']; $arrFeedContent['spez_field_7'] = $objResult->fields['spez_field_7']; $arrFeedContent['spez_field_8'] = $objResult->fields['spez_field_8']; $arrFeedContent['spez_field_9'] = $objResult->fields['spez_field_9']; $arrFeedContent['spez_field_10'] = $objResult->fields['spez_field_10']; $arrFeedContent['spez_field_11'] = $objResult->fields['spez_field_11']; $arrFeedContent['spez_field_12'] = $objResult->fields['spez_field_12']; $arrFeedContent['spez_field_13'] = $objResult->fields['spez_field_13']; $arrFeedContent['spez_field_14'] = $objResult->fields['spez_field_14']; $arrFeedContent['spez_field_15'] = $objResult->fields['spez_field_15']; $arrFeedContent['spez_field_16'] = $objResult->fields['spez_field_16']; $arrFeedContent['spez_field_17'] = $objResult->fields['spez_field_17']; $arrFeedContent['spez_field_18'] = $objResult->fields['spez_field_18']; $arrFeedContent['spez_field_19'] = $objResult->fields['spez_field_19']; $arrFeedContent['spez_field_20'] = $objResult->fields['spez_field_20']; $arrFeedContent['spez_field_21'] = $objResult->fields['spez_field_21']; $arrFeedContent['spez_field_22'] = $objResult->fields['spez_field_22']; $arrFeedContent['spez_field_23'] = $objResult->fields['spez_field_23']; $arrFeedContent['spez_field_24'] = $objResult->fields['spez_field_24']; $arrFeedContent['spez_field_25'] = $objResult->fields['spez_field_25']; $arrFeedContent['spez_field_26'] = $objResult->fields['spez_field_26']; $arrFeedContent['spez_field_27'] = $objResult->fields['spez_field_27']; $arrFeedContent['spez_field_28'] = $objResult->fields['spez_field_28']; $arrFeedContent['spez_field_29'] = $objResult->fields['spez_field_29']; $arrFeedContent['youtube'] = $objResult->fields['youtube']; $objResult->MoveNext(); } } //get active fields $objResult = $objDatabase->Execute("SELECT id, title, name FROM " . DBPREFIX . "module_directory_inputfields WHERE active_backend='1' ORDER BY sort"); if ($objResult !== false) { while (!$objResult->EOF) { $arrFieldsActive['title'][$objResult->fields['id']] = $objResult->fields['title']; $arrFieldsActive['name'][$objResult->fields['id']] = $objResult->fields['name']; // TODO: Fields do not exist in this table, but in module_directory_dir! // $arrFieldsActive['validatedate'][$objResult->fields['id']] = $objResult->fields['validatedate']; // $arrFieldsActive['hits'][$objResult->fields['id']] = $objResult->fields['hits']; $objResult->MoveNext(); } } $arrSettings = $this->getSettings(); //check fields if ($arrFieldsActive != "") { $fieldsList = ''; foreach ($arrFieldsActive['name'] as $fieldKey => $fieldName) { if ($arrFeedContent[$fieldName] != "") { // set variables $content = contrexx_strip_tags($arrFeedContent[$fieldName]); $name = isset($_ARRAYLANG[$arrFieldsActive['title'][$fieldKey]]) ? $_ARRAYLANG[$arrFieldsActive['title'][$fieldKey]] : ''; //youtube if ($fieldName == "youtube") { $youTubeIdRegex = "#.*[\\?&/]v[=/]([a-zA-Z0-9_-]{11}).*#"; preg_match($youTubeIdRegex, $arrFeedContent[$fieldName], $youTubeArray); $youTubeID = $youTubeArray[1]; $content = '<iframe width="' . $arrSettings['youtubeWidth']['value'] . '" height="' . $arrSettings['youtubeHeight']['value'] . '" src="//www.youtube.com/embed/' . $youTubeID . '" frameborder="0" allowfullscreen></iframe>'; } //get pics if ($fieldName == "logo") { $content = '<img src="' . $this->mediaWebPath . 'images/' . $arrFeedContent[$fieldName] . '" border="0" alt="' . $arrFeedContent['title'] . '" /> '; $info = getimagesize($this->mediaPath . "images/" . $arrFeedContent[$fieldName]); $width = $info[0] + 20; $height = $info[1] + 20; if (!file_exists($this->mediaPath . 'thumbs/' . $arrFeedContent[$fieldName])) { $path = "images/"; } else { $path = "thumbs/"; } $setVariable["DIRECTORY_FEED_LOGO_THUMB"] = '<a href="' . $this->mediaWebPath . "images/" . $arrFeedContent[$fieldName] . '" onclick="window.open(this.href,\'\',\'resizable=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,width=' . $width . ',height=' . $height . ',status\'); return false"><img src="' . $this->mediaWebPath . $path . $arrFeedContent[$fieldName] . '" width="' . $arrSettings['thumbSize']['value'] . '" border="0" alt="' . $arrFeedContent['title'] . '" /></a> '; } //rss link if ($fieldName == "rss_link") { //refresh $refreshTime = $this->settings['refreshfeeds']['value']; $now = mktime(date("G"), date("i"), date("s"), date("m"), date("d"), date("Y")); $d = date("d", $arrFeedContent['xml_refresh']); $m = date("m", $arrFeedContent['xml_refresh']); $Y = date("Y", $arrFeedContent['xml_refresh']); $G = date("G", $arrFeedContent['xml_refresh']); $i = date("i", $arrFeedContent['xml_refresh']); $s = date("s", $arrFeedContent['xml_refresh']); $s = $s + $refreshTime; $xml_refresh = mktime($G, $i, $s, $m, $d, $Y); if ($now >= $xml_refresh) { $this->refreshFeed($id); } $content = $this->parseRSS($rss_link, 1, 0, "ext_feeds/"); } //get pics if ($fieldName == "lokal" || $fieldName == "map" || $fieldName == "spez_field_11" || $fieldName == "spez_field_12" || $fieldName == "spez_field_13" || $fieldName == "spez_field_14" || $fieldName == "spez_field_15" || $fieldName == "spez_field_16" || $fieldName == "spez_field_17" || $fieldName == "spez_field_18" || $fieldName == "spez_field_19" || $fieldName == "spez_field_20") { $info = getimagesize($this->mediaPath . "images/" . $arrFeedContent[$fieldName]); $width = $info[0] + 20; $height = $info[1] + 20; if (!file_exists($this->mediaPath . 'thumbs/' . $arrFeedContent[$fieldName])) { $path = "images/"; } else { $path = "thumbs/"; } $content = '<a href="' . $this->mediaWebPath . "images/" . $arrFeedContent[$fieldName] . '" onclick="window.open(this.href,\'\',\'resizable=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,width=' . $width . ',height=' . $height . ',status\'); return false"><img src="' . $this->mediaWebPath . $path . $arrFeedContent[$fieldName] . '" border="0" width="' . $arrSettings['thumbSize']['value'] . '" alt="' . $arrFeedContent['title'] . '" /></a> '; } //get uploads if ($fieldName == "attachment" || $fieldName == "spez_field_25" || $fieldName == "spez_field_26" || $fieldName == "spez_field_27" || $fieldName == "spez_field_28" || $fieldName == "spez_field_29") { $info = filesize($this->mediaPath . "uploads/" . $arrFeedContent[$fieldName]) / 1000; $content = '<a href="' . $this->mediaWebPath . "uploads/" . $arrFeedContent[$fieldName] . '" target="_blank">' . $arrFeedContent[$fieldName] . '</a> <i>(' . $info . ' KB)</i>'; } if (strtolower($fieldName) == "googlemap") { $inputValueField = '<input type="hidden" name="inputValue[lon]" value="' . $arrFeedContent["lon"] . '" style="width:22px;" maxlength="3" />'; $inputValueField .= '<input type="hidden" name="inputValue[lon_fraction]" value="' . $arrFeedContent["lon_fraction"] . '" style="width:92px;" maxlength="15" />'; $inputValueField .= '<input type="hidden" name="inputValue[lat]" value="' . $arrFeedContent["lat"] . '" style="width:22px;" maxlength="15" />'; $inputValueField .= '<input type="hidden" name="inputValue[lat_fraction]" value="' . $arrFeedContent["lat_fraction"] . '" style="width:92px;" maxlength="15" />'; $inputValueField .= '<input type="hidden" name="inputValue[zoom]" value="' . $arrFeedContent["zoom"] . '" style="width:15px;" maxlength="2" />'; $inputValueField .= '<div id="gmap" style="margin:2px; border:1px solid;width: 400px; height: 300px;"></div>'; $content = $inputValueField; } //get author if ($fieldName == "addedby") { $content = $this->getAuthor($arrFeedContent[$fieldName]); } //get mail if ($fieldName == "mail") { $content = "<a href='mailto:" . $arrFeedContent[$fieldName] . "' target='_blank'>" . $arrFeedContent[$fieldName] . "</a>"; } //get spez voting if ($fieldName == "spez_field_23" || $fieldName == "spez_field_24") { $content = ""; for ($i = 0; $i < $arrFeedContent[$fieldName]; $i++) { $content .= "<img src='" . $this->imageWebPath . "/star_on.gif' border='0' alt='' />"; } } //get homepage, relatedlinks if ($fieldName == "homepage" || $fieldName == "relatedlinks" || $fieldName == "link") { $varLinks = ""; //explode links $arrLinks = explode(", ", $arrFeedContent[$fieldName]); //make links foreach ($arrLinks as $link) { if (substr($link, 0, 7) != "http://") { $linkUrl = "http://" . $link; } else { $linkUrl = $link; } if (strlen($link) >= 55) { /* $arrLink = explode("/", $link); $lastElement = count($arrLink)-1; $lastElementLength = strlen($arrLink[$lastElement]); $firstElementLength = 49-$lastElementLength; $linkName = substr($link, 0, $firstElementLength)."...../".$arrLink[$lastElement]; */ $linkName = substr($link, 0, 55) . "[...]"; } else { $linkName = $link; } $varLinks .= "<a href='" . $linkUrl . "' class='out' target='_blank'>" . $linkName . "</a><br />"; } $content = $varLinks; } //check spez if (substr($fieldName, 0, 10) == "spez_field") { $name = $arrFieldsActive['title'][$fieldKey]; } //get title if ($fieldName == "title") { $newTime = $this->settings['mark_new_entrees']['value']; $now = mktime(date("G"), date("i"), date("s"), date("m"), date("d"), date("Y")); $d = date("d", $arrFeedContent['validatedate']); $m = date("m", $arrFeedContent['validatedate']); $Y = date("Y", $arrFeedContent['validatedate']); $d = $d + $newTime; $newFeed = mktime(0, 0, 0, $m, $d, $Y); if ($now <= $newFeed) { $content = $arrFeedContent[$fieldName] . " <img src='" . $this->imageWebPath . "/new.gif' border='0' alt='' />"; } else { $content = $arrFeedContent[$fieldName]; } } $setVariable["DIRECTORY_FEED_" . strtoupper($fieldName)] = nl2br($content); // we need a plain-URL variant too if ($fieldName == "homepage" || $fieldName == "relatedlinks" || $fieldName == "link") { $setVariable["DIRECTORY_FEED_" . strtoupper($fieldName) . "_URL"] = $arrLinks[0]; } $setVariable["TXT_DIRECTORY_FEED_" . strtoupper($fieldName)] = $name; $fieldsList .= '<div class="fieldsList"><div class="fieldDesc">' . nl2br($name) . '</div><div class="fieldContent">' . nl2br($content) . '</div></div>'; } } $setVariable["DIRECTORY_FIELDS_LIST"] = $fieldsList; } $cid = $cid > 0 ? "&cid={$cid}" : ''; $lid = $lid > 0 ? "&lid={$lid}" : ''; $points = strlen($arrFeedContent['description']) > 400 ? '...' : ''; $parts = explode("\n", wordwrap($arrFeedContent['description'], 400, "\n")); $setVariable["DIRECTORY_FEED_SHORT_DESCRIPTION"] = $parts[0] . $points; $setVariable["DIRECTORY_FEED_ID"] = $arrFeedContent['id']; $setVariable["DIRECTORY_FEED_DETAIL"] = $_ARRAYLANG['TXT_DIRECTORY_DETAIL']; $setVariable["DIRECTORY_FEED_DETAIL_LINK"] = CONTREXX_SCRIPT_PATH . "?section=Directory&cmd=detail&id=" . $arrFeedContent['id'] . $lid . $cid; $setVariable["DIRECTORY_FEED_EDIT"] = $_ARRAYLANG['TXT_DIRECTORY_EDIT']; $setVariable["DIRECTORY_FEED_EDIT_LINK"] = CONTREXX_SCRIPT_PATH . "?section=Directory&cmd=edit&id=" . $arrFeedContent['id']; $setVariable["DIRECTORY_FEED_HITS"] = $arrFeedContent['hits']; if ($arrFeedContent['premium'] == '1') { $content = 'class="premium"'; } else { $content = 'class="normal"'; } $setVariable["DIRECTORY_FEED_PREMIUM"] = $content; //metatitle $cmd = isset($_GET['cmd']) ? $_GET['cmd'] : ''; if ($cmd == 'detail') { $this->pageTitle .= $arrFeedContent['title']; } // set variables $this->_objTpl->setVariable($setVariable); }
/** * Searches the content and returns an array that is built as needed by the search module. * * @param string $searchTerm * * @return array */ public function searchResultsForSearchModule($searchTerm) { $em = \Env::get('cx')->getDb()->getEntityManager(); $pageRepo = $em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); // only list results in case the associated page of the module is active $page = $pageRepo->findOneBy(array('module' => 'MediaDir', 'lang' => FRONTEND_LANG_ID, 'type' => \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION)); //If page is not exists or page is inactive then return empty result if (!$page || !$page->isActive()) { return array(); } //get the config site values \Cx\Core\Setting\Controller\Setting::init('Config', 'site', 'Yaml'); $coreListProtectedPages = \Cx\Core\Setting\Controller\Setting::getValue('coreListProtectedPages', 'Config'); $searchVisibleContentOnly = \Cx\Core\Setting\Controller\Setting::getValue('searchVisibleContentOnly', 'Config'); //get the config otherConfigurations value \Cx\Core\Setting\Controller\Setting::init('Config', 'otherConfigurations', 'Yaml'); $searchDescriptionLength = \Cx\Core\Setting\Controller\Setting::getValue('searchDescriptionLength', 'Config'); $hasPageAccess = true; $isNotVisible = $searchVisibleContentOnly == 'on' && !$page->isVisible(); if ($coreListProtectedPages == 'off' && $page->isFrontendProtected()) { $hasPageAccess = \Permission::checkAccess($page->getFrontendAccessId(), 'dynamic', true); } //If the page is invisible and frontend access is denied then return empty result if ($isNotVisible || !$hasPageAccess) { return array(); } //get the media directory entry by the search term $entries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry($this->moduleName); $entries->getEntries(null, null, null, $searchTerm); //if no entries found then return empty result if (empty($entries->arrEntries)) { return array(); } $results = array(); $formEntries = array(); $defaultEntries = null; $objForm = new \Cx\Modules\MediaDir\Controller\MediaDirectoryForm(null, $this->moduleName); $numOfEntries = intval($entries->arrSettings['settingsPagingNumEntries']); foreach ($entries->arrEntries as $entry) { $pageUrlResult = null; $entryForm = $objForm->arrForms[$entry['entryFormId']]; //Get the entry's link url //check the entry's form detail view exists if not, //check the entry's form overview exists if not, //check the default overview exists if not, dont show the corresponding entry in entry switch (true) { case $entries->checkPageCmd('detail' . $entry['entryFormId']): $pageUrlResult = \Cx\Core\Routing\Url::fromModuleAndCmd($entries->moduleName, 'detail' . $entry['entryFormId'], FRONTEND_LANG_ID, array('eid' => $entry['entryId'])); break; case $pageCmdExists = $entries->checkPageCmd($entryForm['formCmd']): case $entries->checkPageCmd(''): if ($pageCmdExists && !isset($formEntries[$entryForm['formCmd']])) { $formEntries[$entryForm['formCmd']] = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry($entries->moduleName); $formEntries[$entryForm['formCmd']]->getEntries(null, null, null, null, null, null, 1, null, 'n', null, null, $entryForm['formId']); } if (!$pageCmdExists && !isset($defaultEntries)) { $defaultEntries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry($entries->moduleName); $defaultEntries->getEntries(); } //get entry's form overview / default page paging position $entriesPerPage = $numOfEntries; if ($pageCmdExists) { $entriesPerPage = !empty($entryForm['formEntriesPerPage']) ? $entryForm['formEntriesPerPage'] : $numOfEntries; } $pageCmd = $pageCmdExists ? $entryForm['formCmd'] : ''; $entryKeys = $pageCmdExists ? array_keys($formEntries[$entryForm['formCmd']]->arrEntries) : array_keys($defaultEntries->arrEntries); $entryPos = array_search($entry['entryId'], $entryKeys); $position = floor($entryPos / $entriesPerPage); $pageUrlResult = \Cx\Core\Routing\Url::fromModuleAndCmd($entries->moduleName, $pageCmd, FRONTEND_LANG_ID, array('pos' => $position * $entriesPerPage)); break; default: break; } //If page url is empty then dont show it in the result if (!$pageUrlResult) { continue; } //Get the search results title and content from the form context field 'title' and 'content' $title = current($entry['entryFields']); $content = ''; $objInputfields = new MediaDirectoryInputfield($entry['entryFormId'], false, $entry['entryTranslationStatus'], $this->moduleName); $inputFields = $objInputfields->getInputfields(); foreach ($inputFields as $arrInputfield) { $contextType = isset($arrInputfield['context_type']) ? $arrInputfield['context_type'] : ''; if (!in_array($contextType, array('title', 'content'))) { continue; } $strType = isset($arrInputfield['type_name']) ? $arrInputfield['type_name'] : ''; $strInputfieldClass = "\\Cx\\Modules\\MediaDir\\Model\\Entity\\MediaDirectoryInputfield" . ucfirst($strType); try { $objInputfield = safeNew($strInputfieldClass, $this->moduleName); $arrTranslationStatus = contrexx_input2int($arrInputfield['type_multi_lang']) == 1 ? $entry['entryTranslationStatus'] : null; $arrInputfieldContent = $objInputfield->getContent($entry['entryId'], $arrInputfield, $arrTranslationStatus); if (\Cx\Core\Core\Controller\Cx::instanciate()->getMode() == \Cx\Core\Core\Controller\Cx::MODE_FRONTEND && \Cx\Core\Setting\Controller\Setting::getValue('blockStatus', 'Config')) { $arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE'] = preg_replace('/\\[\\[(BLOCK_[A-Z0-9_-]+)\\]\\]/', '{\\1}', $arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE']); \Cx\Modules\Block\Controller\Block::setBlocks($arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE'], \Cx\Core\Core\Controller\Cx::instanciate()->getPage()); } } catch (\Exception $e) { \DBG::log($e->getMessage()); continue; } $inputFieldValue = $arrInputfieldContent[$this->moduleConstVar . '_INPUTFIELD_VALUE']; if (empty($inputFieldValue)) { continue; } if ($contextType == 'title') { $title = $inputFieldValue; } elseif ($contextType == 'content') { $content = \Cx\Core_Modules\Search\Controller\Search::shortenSearchContent($inputFieldValue, $searchDescriptionLength); } } $results[] = array('Score' => 100, 'Title' => html_entity_decode(contrexx_strip_tags($title), ENT_QUOTES, CONTREXX_CHARSET), 'Content' => $content, 'Link' => $pageUrlResult->toString()); } return $results; }
/** * Checks if the user has been successfully authenticated * * If a user has been successfully authenticated then he will be * redirected to the requested page, otherwise the login page will be displayed * * @access private * @global array * @see cmsSession::cmsSessionStatusUpdate(), contrexx_strip_tags, \Cx\Core\Html\Sigma::get() * @return string \Cx\Core\Html\Sigma::get() */ function _login() { global $_CORELANG, $sessionObj; $objFWUser = \FWUser::getFWUserObject(); if (isset($_REQUEST['redirect'])) { $redirect = contrexx_strip_tags($_REQUEST['redirect']); } elseif (isset($_SESSION['redirect'])) { $redirect = $_SESSION['redirect']; } else { $redirect = ""; } \Cx\Lib\SocialLogin::parseSociallogin($this->_objTpl); $arrSettings = \User_Setting::getSettings(); if (function_exists('curl_init') && $arrSettings['sociallogin']['status'] && !empty($_GET['provider'])) { $providerLogin = $this->loginWithProvider($_GET['provider']); if ($providerLogin) { return $providerLogin; } } if ($objFWUser->objUser->login()) { if (isset($_POST['login']) && $objFWUser->checkLogin() || isset($_GET['auth-token']) && isset($_GET['user-id'])) { $objFWUser->objUser->reset(); $objFWUser->logoutAndDestroySession(); $sessionObj = \cmsSession::getInstance(); } else { $_GET['relogin'] = '******'; } } if ((!isset($_GET['relogin']) || $_GET['relogin'] != 'true') && $objFWUser->objUser->login() || $objFWUser->checkAuth()) { $groupRedirect = ($objGroup = $objFWUser->objGroup->getGroup($objFWUser->objUser->getPrimaryGroupId())) && $objGroup->getHomepage() ? preg_replace('/\\[\\[([A-Z0-9_-]+)\\]\\]/', '{\\1}', $objGroup->getHomepage()) : CONTREXX_SCRIPT_PATH; \LinkGenerator::parseTemplate($groupRedirect); if (isset($_SESSION['redirect'])) { unset($_SESSION['redirect']); } if (!empty($redirect)) { $redirect = \FWUser::getRedirectUrl(urlencode(base64_decode($redirect))); } \Cx\Core\Csrf\Controller\Csrf::header('Location: ' . (empty($redirect) ? $groupRedirect : $redirect)); exit; } else { if (isset($_POST['login'])) { $this->_statusMessage = $_CORELANG['TXT_PASSWORD_OR_USERNAME_IS_INCORRECT']; } } if (isset($_SESSION['auth']['loginLastAuthFailed'])) { $this->_objTpl->setVariable(array('TXT_CORE_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], 'CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode())); $this->_objTpl->parse('captcha'); } else { $this->_objTpl->hideBlock('captcha'); } $this->_objTpl->setVariable(array('TXT_LOGIN' => $_CORELANG['TXT_LOGIN'], 'TXT_USER_NAME' => $_CORELANG['TXT_USER_NAME'], 'TXT_PASSWORD' => $_CORELANG['TXT_PASSWORD'], 'TXT_LOGIN_REMEMBER_ME' => $_CORELANG['TXT_CORE_REMEMBER_ME'], 'TXT_PASSWORD_LOST' => $_CORELANG['TXT_PASSWORD_LOST'], 'LOGIN_REDIRECT' => $redirect, 'LOGIN_STATUS_MESSAGE' => $this->_statusMessage)); return $this->_objTpl->get(); }