示例#1
0
 /**
  * Draws a search result view.
  * 
  * @param
  *        	object Array of the events found ()
  * @return string HTML output.
  */
 public function drawSearchAllResult(&$master_array, $starttime, $endtime, $searchword, $locationIds = '', $organizerIds = '')
 {
     $page = $this->cObj->fileResource($this->conf['view.']['search.']['searchResultAllTemplate']);
     if ($page == '') {
         return '<h3>calendar: no search result template file found:</h3>' . $this->conf['view.']['search.']['searchResultAllTemplate'];
     }
     $sims = array();
     //$this->_init ($master_array);
     if (array_key_exists('phpicalendar_event', $master_array)) {
         $sims['SEARCHEVENTRESULTS'] = $this->drawSearchEventResult($master_array['phpicalendar_event'], $starttime, $endtime, $searchword, $locationIds, $organizerIds);
     }
     $this->initLocalCObject();
     $this->local_cObj->setCurrentVal($sims['SEARCHEVENTRESULTS']);
     $sims['SEARCHEVENTRESULTS'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['search_all.']['searchEvent'], $this->conf['view.']['search_all.']['searchEvent.']);
     $this->objectsInList = array();
     if (array_key_exists('location', $master_array)) {
         $sims['SEARCHLOCATIONRESULTS'] = $this->drawSearchLocationResult($master_array['location'], $searchword);
     }
     $this->initLocalCObject();
     $this->local_cObj->setCurrentVal($sims['SEARCHLOCATIONRESULTS']);
     $sims['SEARCHLOCATIONRESULTS'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['search_all.']['searchLocation'], $this->conf['view.']['search_all.']['searchLocation.']);
     $this->objectsInList = array();
     if (array_key_exists('organizer', $master_array)) {
         $sims['SEARCHORGANIZERRESULTS'] = $this->drawSearchOrganizerResult($master_array['organizer'], $searchword);
     }
     $this->initLocalCObject();
     $this->local_cObj->setCurrentVal($sims['SEARCHORGANIZERRESULTS']);
     $sims['SEARCHORGANIZERRESULTS'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['search_all.']['searchOrganizer'], $this->conf['view.']['search_all.']['searchOrganizer.']);
     $page = \TYPO3\CMS\Cal\Controller\Controller::replace_tags($sims, $page);
     $rems = array();
     return $this->finish($page, $rems);
 }
示例#2
0
文件: Api.php 项目: ulrikkold/cal
 /**
  * Example:
  * require_once ('class.tx_cal_api.php');
  * $calAPI = new Api($this->cObj, &$conf);
  * $event = $calAPI->findEvent('2','tx_cal_phpicalendar');
  */
 function tx_cal_api_with(&$cObj, &$conf)
 {
     $this->cObj =& $cObj;
     $this->conf =& $conf;
     if (!$GLOBALS['TCA']) {
         $GLOBALS['TSFE']->includeTCA();
     }
     $this->conf['useInternalCaching'] = 1;
     $this->conf['cachingEngine'] = 'cachingFramework';
     $this->conf['writeCachingInfoToDevlog'] = 0;
     $GLOBALS['TSFE']->settingLocale();
     $this->controller = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\Controller');
     $this->controller->cObj =& $this->cObj;
     $this->controller->conf =& $this->conf;
     $this->controller->setWeekStartDay();
     $this->controller->cleanPiVarParam($this->piVars);
     $this->controller->clearPiVarParams();
     $this->controller->getParamsFromSession();
     $this->controller->initCaching();
     $this->controller->initConfigs();
     \TYPO3\CMS\Cal\Controller\Controller::initRegistry($this->controller);
     $this->rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
     $this->rightsObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService('cal_rights_model', 'rights');
     $this->rightsObj->setDefaultSaveToPage();
     $this->modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
     $this->modelObj = new \TYPO3\CMS\Cal\Controller\ModelController();
     $this->viewObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'viewcontroller');
     $this->viewObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\ViewController');
     /*
      * $this->rightsObj = &\TYPO3\CMS\Cal\Utility\Registry::Registry('basic','rightscontroller'); $this->modelObj = &\TYPO3\CMS\Cal\Utility\Registry::Registry('basic','modelcontroller'); $this->viewObj = &\TYPO3\CMS\Cal\Utility\Registry::Registry('basic','viewcontroller');
      */
     return $this;
 }
示例#3
0
 function replaceViewMarker($page)
 {
     $next_day = new \TYPO3\CMS\Cal\Model\CalDate();
     $next_day->copy($this->controller->getDateTimeObject);
     $next_day->addSeconds(86400);
     $prev_day = new \TYPO3\CMS\Cal\Model\CalDate();
     $prev_day->copy($this->controller->getDateTimeObject);
     $prev_day->subtractSeconds(86400);
     $next_week = new \TYPO3\CMS\Cal\Model\CalDate(Calc::beginOfNextWeek($this->conf['day'], $this->conf['month'], $this->conf['year']));
     $prev_week = new \TYPO3\CMS\Cal\Model\CalDate(Calc::beginOfPrevWeek($this->conf['day'], $this->conf['month'], $this->conf['year']));
     $next_year = $this->conf['year'] + 1 . sprintf("%02d", $this->conf['month']) . sprintf("%02d", $this->conf['day']);
     $prev_year = $this->conf['year'] - 1 . sprintf("%02d", $this->conf['month']) . sprintf("%02d", $this->conf['day']);
     $endOfNextMonth = new \TYPO3\CMS\Cal\Model\CalDate(Calc::endOfNextMonth($this->conf['day'], $this->conf['month'], $this->conf['year']));
     $endOfNextMonth->setDay($this->conf['day']);
     $startOfPrevMonth = new \TYPO3\CMS\Cal\Model\CalDate(Calc::endOfPrevMonth($this->conf['day'], $this->conf['month'], $this->conf['year']));
     $startOfPrevMonth->setDay($this->conf['day']);
     $next_month = $endOfNextMonth->format('%Y%m%d');
     $prev_month = $startOfPrevMonth->format('%Y%m%d');
     $startOfThisWeek = new \TYPO3\CMS\Cal\Model\CalDate(Calc::beginOfWeek($this->conf['day'], $this->conf['month'], $this->conf['year']));
     $endOfThisWeek = new \TYPO3\CMS\Cal\Model\CalDate(Calc::endOfWeek($this->conf['day'], $this->conf['month'], $this->conf['year']));
     $GLOBALS['TSFE']->register['cal_week_starttime'] = $startOfThisWeek->getTime();
     $GLOBALS['TSFE']->register['cal_week_endtime'] = $endOfThisWeek->getTime();
     $this->initLocalCObject();
     $dayViewPid = $this->conf['view.']['day.']['dayViewPid'] ? $this->conf['view.']['day.']['dayViewPid'] : false;
     $weekViewPid = $this->conf['view.']['week.']['weekViewPid'] ? $this->conf['view.']['week.']['weekViewPid'] : false;
     $monthViewPid = $this->conf['view.']['month.']['monthViewPid'] ? $this->conf['view.']['month.']['monthViewPid'] : false;
     $yearViewPid = $this->conf['view.']['year.']['yearViewPid'] ? $this->conf['view.']['year.']['yearViewPid'] : false;
     // next day
     $nextdaylinktext = $this->cObj->getSubpart($page, '###NEXT_DAYLINKTEXT###');
     $this->local_cObj->setCurrentVal($nextdaylinktext);
     $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('getdate' => $next_day->format('%Y%m%d'), 'view' => $this->conf['view.']['dayLinkTarget'], $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway'], $dayViewPid);
     $rems['###NEXT_DAYLINK###'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['day.']['nextDayLink'], $this->conf['view.']['day.']['nextDayLink.']);
     // prev day
     $prevdaylinktext = $this->cObj->getSubpart($page, '###PREV_DAYLINKTEXT###');
     $this->local_cObj->setCurrentVal($prevdaylinktext);
     $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('getdate' => $prev_day->format('%Y%m%d'), 'view' => $this->conf['view.']['dayLinkTarget'], $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway'], $dayViewPid);
     $rems['###PREV_DAYLINK###'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['day.']['prevDayLink'], $this->conf['view.']['day.']['prevDayLink.']);
     // next week
     $nextweeklinktext = $this->cObj->getSubpart($page, '###NEXT_WEEKLINKTEXT###');
     $this->local_cObj->setCurrentVal($nextweeklinktext);
     $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('getdate' => $next_week->format('%Y%m%d'), 'view' => $this->conf['view.']['weekLinkTarget'], $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway'], $weekViewPid);
     $rems['###NEXT_WEEKLINK###'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['week.']['nextWeekLink'], $this->conf['view.']['week.']['nextWeekLink.']);
     // prev week
     $prevweeklinktext = $this->cObj->getSubpart($page, '###PREV_WEEKLINKTEXT###');
     $this->local_cObj->setCurrentVal($prevweeklinktext);
     $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('getdate' => $prev_week->format('%Y%m%d'), 'view' => $this->conf['view.']['weekLinkTarget'], $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway'], $weekViewPid);
     $rems['###PREV_WEEKLINK###'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['week.']['prevWeekLink'], $this->conf['view.']['week.']['prevWeekLink.']);
     // next month
     $nextmonthlinktext = $this->cObj->getSubpart($page, '###NEXT_MONTHLINKTEXT###');
     $this->local_cObj->setCurrentVal($nextmonthlinktext);
     $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('getdate' => $next_month, 'view' => $this->conf['view.']['monthLinkTarget'], $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway'], $monthViewPid);
     $rems['###NEXT_MONTHLINK###'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['month.']['nextMonthLink'], $this->conf['view.']['month.']['nextMonthLink.']);
     // prev month
     $prevmonthlinktext = $this->cObj->getSubpart($page, '###PREV_MONTHLINKTEXT###');
     $this->local_cObj->setCurrentVal($prevmonthlinktext);
     $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('getdate' => $prev_month, 'view' => $this->conf['view.']['monthLinkTarget'], $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway'], $monthViewPid);
     $rems['###PREV_MONTHLINK###'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['month.']['prevMonthLink'], $this->conf['view.']['month.']['prevMonthLink.']);
     // next year
     $nextyearlinktext = $this->cObj->getSubpart($page, '###NEXT_YEARLINKTEXT###');
     $this->local_cObj->setCurrentVal($nextyearlinktext);
     $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('getdate' => $next_year, 'view' => $this->conf['view.']['yearLinkTarget'], $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway'], $yearViewPid);
     $rems['###NEXT_YEARLINK###'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['year.']['nextYearLink'], $this->conf['view.']['year.']['nextYearLink.']);
     // prev year
     $prevyearlinktext = $this->cObj->getSubpart($page, '###PREV_YEARLINKTEXT###');
     $this->local_cObj->setCurrentVal($prevyearlinktext);
     $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('getdate' => $prev_year, 'view' => $this->conf['view.']['yearLinkTarget'], $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway'], $yearViewPid);
     $rems['###PREV_YEARLINK###'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['year.']['prevYearLink'], $this->conf['view.']['year.']['prevYearLink.']);
     $this->local_cObj->setCurrentVal($this->controller->getDateTimeObject->getTime());
     $sims['###DISPLAY_DATE###'] = $this->local_cObj->cObjGetSingle($this->conf['view.'][$this->conf['view'] . '.']['displayDate'], $this->conf['view.'][$this->conf['view'] . '.']['displayDate.']);
     $wrapped = array();
     $hookObjectsArr = \TYPO3\CMS\Cal\Utility\Functions::getHookObjectsArray('tx_cal_base_model', 'searchForObjectMarker', 'model');
     // Hook: postSearchForObjectMarker
     foreach ($hookObjectsArr as $hookObj) {
         if (method_exists($hookObj, 'postSearchForObjectMarker')) {
             $hookObj->postSearchForObjectMarker($this, $page, $sims, $rems, $wrapped, $this->conf['view']);
         }
     }
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, $rems, array());
     $languageArray = array('getdate' => $this->conf['getdate'], 'next_month' => $next_month, 'prev_month' => $prev_month, 'calendar_name' => $this->conf['calendarName'], 'this_year' => $this->conf['year'], 'next_year' => $next_year, 'prev_year' => $prev_year);
     return \TYPO3\CMS\Cal\Controller\Controller::replace_tags($languageArray, $page);
 }
示例#4
0
 function getSubscriptionMarker(&$template, &$sims, &$rems, &$wrapped, $view)
 {
     $uid = $this->conf['uid'];
     $type = $this->conf['type'];
     $monitoring = $this->conf['monitor'];
     $getdate = $this->conf['getdate'];
     $captchaStr = 0;
     $rems['###SUBSCRIPTION###'] = '';
     $sims['###NOTLOGGEDIN_NOMONITORING_HEADING###'] = '';
     $sims['###NOTLOGGEDIN_NOMONITORING_SUBMIT###'] = '';
     $sims['###NOTLOGGEDIN_MONITORING_HEADING###'] = '';
     $sims['###NOTLOGGEDIN_MONITORING_SUBMIT###'] = '';
     $sims_temp['L_CAPTCHA_START_SUCCESS'] = '';
     $sims_temp['L_CAPTCHA_STOP_SUCCESS'] = '';
     // controller = &\TYPO3\CMS\Cal\Utility\Registry::Registry('basic','controller');
     $rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
     // cObj = &\TYPO3\CMS\Cal\Utility\Registry::Registry('basic','cobj');
     $cObj =& $this->controller->cObj;
     if (($this->conf['allowSubscribe'] == 1 || $this->conf['subscribeFeUser'] == 1 && $rightsObj->isLoggedIn()) && $uid) {
         if ($monitoring != null && $monitoring != '') {
             $user_uid = $rightsObj->getUserId();
             switch ($monitoring) {
                 case 'start':
                     if ($user_uid > 0) {
                         $table = 'tx_cal_fe_user_event_monitor_mm';
                         $fields_values = array('uid_local' => $uid, 'uid_foreign' => $user_uid, 'tablenames' => 'fe_users', 'sorting' => 1, 'pid' => $this->conf['rights.']['create.']['event.']['saveEventToPid'], 'offset' => $this->conf['view.']['event.']['remind.']['time']);
                         $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $fields_values);
                         if (FALSE === $result) {
                             throw new \RuntimeException('Could not write ' . $table . ' record to database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458137);
                         }
                         $pageTSConf = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($this->conf['rights.']['create.']['event.']['saveEventToPid']);
                         $offset = is_numeric($pageTSConf['options.']['tx_cal_controller.']['view.']['event.']['remind.']['time']) ? $pageTSConf['options.']['tx_cal_controller.']['view.']['event.']['remind.']['time'] * 60 : 0;
                         $date = new \TYPO3\CMS\Cal\Model\CalDate($insertFields['start_date'] . '000000');
                         $date->setTZbyId('UTC');
                         $reminderTimestamp = $date->getTime() + $insertFields['start_time'] - $offset;
                         $reminderService =& \TYPO3\CMS\Cal\Utility\Functions::getReminderService();
                         $reminderService->scheduleReminder($uid);
                     } else {
                         if ($this->conf['subscribeWithCaptcha'] == 1 && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('captcha')) {
                             session_start();
                             $captchaStr = $_SESSION['tx_captcha_string'];
                             $_SESSION['tx_captcha_string'] = '';
                         } else {
                             $captchaStr = -1;
                         }
                         if ($captchaStr && $this->controller->piVars['captcha'] === $captchaStr || $this->conf['subscribeWithCaptcha'] == 0) {
                             // send confirm email!!
                             $email = $this->controller->piVars['email'];
                             $mailer = $mail = new \TYPO3\CMS\Core\Mail\MailMessage();
                             if (GeneralUtility::validEmail($this->conf['view.']['event.']['notify.']['emailAddress'])) {
                                 $mailer->setFrom(array($this->conf['view.']['event.']['notify.']['emailAddress'] => $this->conf['view.']['event.']['notify.']['fromName']));
                             }
                             if (GeneralUtility::validEmail($this->conf['view.']['event.']['notify.']['emailReplyAddress'])) {
                                 $mailer->setReplyTo(array($this->conf['view.']['event.']['notify.']['emailReplyAddress'] => $this->conf['view.']['event.']['notify.']['replyToName']));
                             }
                             $mailer->getHeaders()->addTextHeader('Organization: ', $this->conf['view.']['event.']['notify.']['organisation']);
                             $local_template = $cObj->fileResource($this->conf['view.']['event.']['notify.']['confirmTemplate']);
                             $htmlTemplate = $cObj->getSubpart($local_template, '###HTML###');
                             $plainTemplate = $cObj->getSubpart($local_template, '###PLAIN###');
                             $local_switch = array();
                             $local_rems = array();
                             $local_wrapped = array();
                             $this->getMarker($htmlTemplate, $local_switch, $local_rems, $local_wrapped, 'event');
                             $this->getMarker($plainTemplate, $local_switch, $local_rems, $local_wrapped, 'event');
                             $local_switch['###CONFIRM_LINK###'] = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $this->controller->pi_getPageLink($this->conf['view.']['event.']['notify.']['subscriptionViewPid'], '', array('tx_cal_controller[view]' => 'subscription', 'tx_cal_controller[monitor]' => 'start', 'tx_cal_controller[email]' => $email, 'tx_cal_controller[uid]' => $this->getUid(), 'tx_cal_controller[sid]' => md5($this->getUid() . $email . $this->getCreationDate())));
                             $local_switch['###EVENT_LINK###'] = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $this->controller->pi_getPageLink($this->conf['view.']['event.']['eventViewPid'], '', array('tx_cal_controller[view]' => 'event', 'tx_cal_controller[uid]' => $this->getUid(), 'tx_cal_controller[type]' => $this->getType(), 'tx_cal_controller[getdate]' => $this->getStart->format('%Y%m%d')));
                             $htmlTemplate = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($htmlTemplate, $local_switch, $local_rems, $local_wrapped);
                             $htmlTemplate = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($htmlTemplate, $local_switch, $local_rems, $local_wrapped);
                             $plainTemplate = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($plainTemplate, $local_switch, $local_rems, $local_wrapped);
                             $mailer->setSubject($this->conf['view.']['event.']['notify.']['confirmTitle']);
                             $rems['###SUBSCRIPTION###'] = $this->controller->pi_getLL('l_monitor_start_thanks');
                             $this->controller->finish($htmlTemplate);
                             $this->controller->finish($plainTemplate);
                             $mailer->setTo(array($email));
                             $mailer->setBody(strip_tags($plainTemplate), 'text/plain');
                             $mailer->addPart(\TYPO3\CMS\Cal\Utility\Functions::fixURI($htmlTemplate), 'text/html');
                             $mailer->send();
                             return;
                         } else {
                             $sims_temp['L_CAPTCHA_START_SUCCESS'] = $this->controller->pi_getLL('l_monitor_wrong_captcha');
                         }
                     }
                     break;
                 case 'stop':
                     if ($user_uid > 0) {
                         $table = 'tx_cal_fe_user_event_monitor_mm';
                         $where = 'uid_foreign = ' . $user_uid . ' AND uid_local = ' . $uid . ' AND tablenames = "fe_users"';
                         $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where);
                     } else {
                         if ($this->conf['subscribeWithCaptcha'] == 1 && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('captcha')) {
                             session_start();
                             $captchaStr = $_SESSION['tx_captcha_string'];
                             $_SESSION['tx_captcha_string'] = '';
                         } else {
                             $captchaStr = -1;
                         }
                         if ($captchaStr && $this->controller->piVars['captcha'] === $captchaStr || $this->conf['subscribeWithCaptcha'] == 0) {
                             $email = $this->controller->piVars['email'];
                             $table = 'tx_cal_unknown_users';
                             $select = 'crdate';
                             $where = 'email = "' . $email . '"';
                             $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
                             $crdate = 0;
                             if ($result) {
                                 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                                     $crdate = $row['crdate'];
                                     break;
                                 }
                                 $GLOBALS['TYPO3_DB']->sql_free_result($result);
                             }
                             $mailer = $mail = new \TYPO3\CMS\Core\Mail\MailMessage();
                             $mailer->setFrom(array($this->conf['view.']['event.']['notify.']['emailAddress'] => $this->conf['view.']['event.']['notify.']['fromName']));
                             $mailer->setReplyTo(array($this->conf['view.']['event.']['notify.']['emailReplyAddress'] => $this->conf['view.']['event.']['notify.']['replyToName']));
                             $mailer->getHeaders()->addTextHeader('Organization: ', $this->conf['view.']['event.']['notify.']['organisation']);
                             $local_template = $cObj->fileResource($this->conf['view.']['event.']['notify.']['unsubscribeConfirmTemplate']);
                             $htmlTemplate = $cObj->getSubpart($local_template, '###HTML###');
                             $plainTemplate = $cObj->getSubpart($local_template, '###PLAIN###');
                             $local_switch = array();
                             $local_rems = array();
                             $local_wrapped = array();
                             $this->getMarker($htmlTemplate, $local_switch, $local_rems, $local_wrapped, 'event');
                             $local_switch['###CONFIRM_LINK###'] = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $this->controller->pi_getPageLink($this->conf['view.']['event.']['notify.']['subscriptionViewPid'], '', array('tx_cal_controller[view]' => 'subscription', 'tx_cal_controller[monitor]' => 'stop', 'tx_cal_controller[email]' => $email, 'tx_cal_controller[uid]' => $this->getUid(), 'tx_cal_controller[sid]' => md5($this->getUid() . $email . $crdate)));
                             $htmlTemplate = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($htmlTemplate, $local_switch, $local_rems, $local_wrapped);
                             $local_switch = array();
                             $local_rems = array();
                             $local_wrapped = array();
                             $this->getMarker($plainTemplate, $local_switch, $local_rems, $local_wrapped, 'event');
                             $local_switch['###CONFIRM_LINK###'] = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $this->controller->pi_getPageLink($this->conf['view.']['event.']['notify.']['subscriptionViewPid'], '', array('tx_cal_controller[view]' => 'subscription', 'tx_cal_controller[monitor]' => 'stop', 'tx_cal_controller[email]' => $email, 'tx_cal_controller[uid]' => $this->getUid(), 'tx_cal_controller[sid]' => md5($this->getUid() . $email . $crdate)));
                             $plainTemplate = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($plainTemplate, $local_switch, $local_rems, $local_wrapped);
                             $mailer->setSubject($this->conf['view.']['event.']['notify.']['unsubscribeConfirmTitle']);
                             $rems['###SUBSCRIPTION###'] = $this->controller->pi_getLL('l_monitor_stop_thanks');
                             $this->controller->finish($htmlTemplate);
                             $this->controller->finish($plainTemplate);
                             $mailer->setTo(array($email));
                             $mailer->setBody(strip_tags($plainTemplate), 'text/plain');
                             $mailer->addPart(\TYPO3\CMS\Cal\Utility\Functions::fixURI($htmlTemplate), 'text/html');
                             $mailer->send();
                             return;
                         } else {
                             $sims_temp['L_CAPTCHA_STOP_SUCCESS'] = $this->controller->pi_getLL('l_monitor_wrong_captcha');
                         }
                     }
                     break;
             }
         }
         /* If we have a logged in user */
         if ($rightsObj->isLoggedIn()) {
             $select = '*';
             $from_table = 'tx_cal_fe_user_event_monitor_mm';
             $whereClause = 'uid_foreign = ' . $rightsObj->getUserId() . ' AND uid_local = ' . $uid;
             $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from_table, $whereClause, $groupBy = '', $orderBy = '', $limit = '');
             $found_one = false;
             // create a local cObj with a customized data array, that is allowed to be changed
             $this->initLocalCObject($this->getValuesAsArray());
             $this->local_cObj->setCurrentVal($this->controller->pi_getLL('l_monitor_event_logged_in_monitoring'));
             if ($result) {
                 while ($row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                     $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('view' => 'event', 'monitor' => 'stop', 'type' => $type, 'uid' => $uid), $this->conf['cache'], $this->conf['clear_anyway']);
                     $rems['###SUBSCRIPTION###'] = $this->local_cObj->cObjGetSingle($this->conf['view.'][$view . '.']['event.']['isMonitoringEventLink'], $this->conf['view.'][$view . '.']['event.']['isMonitoringEventLink.']);
                     $found_one = true;
                 }
                 $GLOBALS['TYPO3_DB']->sql_free_result($result);
             }
             if (!$found_one) {
                 $this->local_cObj->setCurrentVal($this->controller->pi_getLL('l_monitor_event_logged_in_nomonitoring'));
                 $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('view' => 'event', 'monitor' => 'start', 'type' => $type, 'uid' => $uid), $this->conf['cache'], $this->conf['clear_anyway']);
                 $rems['###SUBSCRIPTION###'] = $this->local_cObj->cObjGetSingle($this->conf['view.'][$view . '.']['event.']['isNotMonitoringEventLink'], $this->conf['view.'][$view . '.']['event.']['isNotMonitoringEventLink.']);
             }
         } else {
             /* Not a logged in user */
             /* If a CAPTCHA is required to subscribe, add a couple extra markers */
             if ($this->conf['subscribeWithCaptcha'] == 1 && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('captcha')) {
                 $sims_temp['CAPTCHA_SRC'] = '<img src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('captcha') . 'captcha/captcha.php' . '" alt="" />';
                 $sims_temp['L_CAPTCHA_TEXT'] = $this->controller->pi_getLL('l_captcha_text');
                 $sims_temp['CAPTCHA_TEXT'] = '<input type="text" size=10 name="tx_cal_controller[captcha]" value="">';
             } else {
                 $sims_temp['CAPTCHA_SRC'] = '';
                 $sims_temp['L_CAPTCHA_TEXT'] = '';
                 $sims_temp['CAPTCHA_TEXT'] = '';
             }
             $notLoggedinNoMonitoring = $cObj->getSubpart($template, '###NOTLOGGEDIN_NOMONITORING###');
             $parameter = array('no_cache' => 1, 'view' => 'event', 'monitor' => 'start', 'type' => $type, 'uid' => $uid);
             $actionUrl = htmlspecialchars($this->controller->pi_linkTP_keepPIvars_url($parameter));
             $parameter2 = array('no_cache' => 1, 'getdate' => $getdate, 'view' => 'event', 'monitor' => 'stop');
             $actionUrl2 = htmlspecialchars($this->controller->pi_linkTP_keepPIvars_url($parameter2));
             $sims_temp['NOTLOGGEDIN_NOMONITORING_HEADING'] = $this->controller->pi_getLL('l_monitor_event_logged_in_nomonitoring');
             $sims_temp['NOTLOGGEDIN_NOMONITORING_SUBMIT'] = $this->controller->pi_getLL('l_submit');
             $sims_temp['L_ENTER_EMAIL'] = $this->controller->pi_getLL('l_enter_email');
             $sims_temp['ACTIONURL'] = $actionUrl;
             $monitor = \TYPO3\CMS\Cal\Controller\Controller::replace_tags($sims_temp, $notLoggedinNoMonitoring);
             $sims_temp['ACTIONURL'] = $actionUrl2;
             $notLoggedinMonitoring = $cObj->getSubpart($template, '###NOTLOGGEDIN_MONITORING###');
             $sims_temp['NOTLOGGEDIN_MONITORING_HEADING'] = $this->controller->pi_getLL('l_monitor_event_logged_in_monitoring');
             $sims_temp['NOTLOGGEDIN_MONITORING_SUBMIT'] = $this->controller->pi_getLL('l_submit');
             $sims_temp['L_ENTER_EMAIL'] = $this->controller->pi_getLL('l_enter_email');
             $monitor .= \TYPO3\CMS\Cal\Controller\Controller::replace_tags($sims_temp, $notLoggedinMonitoring);
             $rems['###SUBSCRIPTION###'] = $monitor;
         }
     } else {
         $rems['###SUBSCRIPTION###'] = '';
     }
 }
示例#5
0
 /**
  * Sets the PHP constant for the week start day.
  * This must be called as
  * early as possible to avoid PEAR Date defining its default instead.
  *
  * @return void
  */
 public function setWeekStartDay()
 {
     if ($this->cObj->data['pi_flexform']) {
         $this->pi_initPIflexForm();
         // Init and get the flexform data of the plugin
         $piFlexForm = $this->cObj->data['pi_flexform'];
         if ($this->conf['dontListenToFlexForm.']['day.']['weekStartDay'] != 1) {
             Controller::updateIfNotEmpty($this->conf['view.']['weekStartDay'], $this->pi_getFFvalue($piFlexForm, 'weekStartDay'));
         }
     }
     define('DATE_CALC_BEGIN_WEEKDAY', $this->conf['view.']['weekStartDay'] == 'Sunday' ? 0 : 1);
 }