function handleError($params, tslib_fe $pObj)
 {
     // create regular FE environment so we can link, access setup, etc
     $this->createTSFE();
     // get constants/setup
     $setup = $GLOBALS['TSFE']->tmpl->setup['plugin.']['itypo_404handler.'];
     // support for itypo_securedfiles
     if (t3lib_extMgm::isLoaded('itypo_securedfiles') && $params['reasonText'] == 'No permission to access this file') {
         $throw403 = true;
     }
     if (isset($params['pageAccessFailureReasons']['fe_group']) && !isset($params['pageAccessFailureReasons']['hidden']) && current($params['pageAccessFailureReasons']['fe_group']) !== 0 && !is_array($pObj->fe_user->user)) {
         // redirect to login page, 303
         if (is_numeric($setup['loginPage'])) {
             $loginPage = $this->cObj->getTypoLink_URL(intval($setup['loginPage']));
         } else {
             $loginPage = $setup['loginPage'];
         }
         // if the url ends with a /, add a ? for the parameters, this happens when realurl is used for example
         if (substr($loginPage, -1, 1) == '/') {
             $loginPage .= '?';
         }
         $url = 'REDIRECT:' . $loginPage . '&redirect_url=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'));
     } elseif (isset($params['pageAccessFailureReasons']['fe_group']) && !isset($params['pageAccessFailureReasons']['hidden']) && current($params['pageAccessFailureReasons']['fe_group']) !== 0 && is_array($pObj->fe_user->user) || $throw403) {
         // logged in but no access, 403
         $header = 'HTTP/1.0 403 Forbidden';
         $forbiddenPage = $this->cObj->getTypoLink_URL(intval($setup['forbiddenPage']));
         // if the url ends with a /, add a ? for the parameters, this happens when realurl is used for example
         if (substr($forbiddenPage, -1, 1) == '/') {
             $forbiddenPage .= '?';
         }
         $url = $forbiddenPage;
         if (is_array($pObj->fe_user->user)) {
             $urlParams = '&tx_itypo404handler[ses_id]=' . $pObj->fe_user->user['ses_id'];
             $url .= $urlParams;
             $url .= '&cHash=' . t3lib_div::generateCHash($urlParams);
         }
     } else {
         // item not found, 404
         $header = $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_statheader'];
         $notfoundPage = $this->cObj->getTypoLink_URL(intval($setup['notfoundPage']));
         // if the url ends with a /, add a ? for the parameters, this happens when realurl is used for example
         if (substr($notfoundPage, -1, 1) == '/') {
             $notfoundPage .= '?';
         }
         $url = $notfoundPage;
         if (is_array($pObj->fe_user->user)) {
             $urlParams = '&tx_itypo404handler[ses_id]=' . $pObj->fe_user->user['ses_id'];
             $url .= $urlParams;
             $url .= '&cHash=' . t3lib_div::generateCHash($urlParams);
         }
     }
     // output the page
     $pObj->pageErrorHandler($url, $header, $params['reasonText']);
 }
 function processOutput()
 {
     if ($GLOBALS['TSFE']->type != $GLOBALS['pdf_generator2_parameters']['typeNum']) {
         parent::processOutput();
     } else {
         $_params = array('pObj' => &$this);
         require_once t3lib_div::getFileAbsFileName('EXT:pdf_generator2/class.tx_pdfgenerator2.php');
         t3lib_div::callUserFunction("tx_pdfgenerator2->tslib_fe_processOutput", $_params, $this);
     }
 }
 /**
  * Initializes the extension, sets some configuration options and does some basic checks
  *
  * @param	array		holds all the information about the link that is about to be created
  * @param	tslib_fe	is a reference to the parent object that calls the hook
  * @return	void
  */
 public function hookInitConfig(array &$parameters, tslib_fe &$parentObject)
 {
     $TSconf =& $parameters['config'];
     // if .simulateStaticDocuments was not present, the installation-wide default value will be used
     if (!isset($TSconf['simulateStaticDocuments'])) {
         $TSconf['simulateStaticDocuments'] = trim($parentObject->TYPO3_CONF_VARS['FE']['simulateStaticDocuments']);
     }
     // simulateStatic was not activated
     if (!$TSconf['simulateStaticDocuments']) {
         return;
     }
     $this->enabled = true;
     // setting configuration options
     $this->conf = array('mode' => $TSconf['simulateStaticDocuments'], 'dontRedirectPathInfoError' => $TSconf['simulateStaticDocuments_dontRedirectPathInfoError'] ? $TSconf['simulateStaticDocuments_dontRedirectPathInfoError'] : $TSconf['simulateStaticDocuments.']['dontRedirectPathInfoError'], 'pEncoding' => $TSconf['simulateStaticDocuments_pEnc'] ? $TSconf['simulateStaticDocuments_pEnc'] : $TSconf['simulateStaticDocuments.']['pEncoding'], 'pEncodingOnlyP' => $TSconf['simulateStaticDocuments_pEnc_onlyP'] ? $TSconf['simulateStaticDocuments_pEnc_onlyP'] : $TSconf['simulateStaticDocuments.']['pEncoding_onlyP'], 'addTitle' => $TSconf['simulateStaticDocuments_addTitle'] ? $TSconf['simulateStaticDocuments_addTitle'] : $TSconf['simulateStaticDocuments.']['addTitle'], 'noTypeIfNoTitle' => $TSconf['simulateStaticDocuments_noTypeIfNoTitle'] ? $TSconf['simulateStaticDocuments_noTypeIfNoTitle'] : $TSconf['simulateStaticDocuments.']['noTypeIfNoTitle'], 'replacementChar' => t3lib_div::compat_version('4.0') ? '-' : '_');
     if ($this->conf['pEncodingOnlyP']) {
         $tempParts = t3lib_div::trimExplode(',', $this->conf['pEncodingOnlyP'], 1);
         foreach ($tempParts as $tempPart) {
             $this->pEncodingAllowedParamNames[$tempPart] = 1;
         }
     }
     // Checks and sets replacement character for simulateStaticDocuments.
     $replacement = trim($TSconf['simulateStaticDocuments_replacementChar'] ? $TSconf['simulateStaticDocuments_replacementChar'] : $TSconf['simulateStaticDocuments.']['replacementChar']);
     if ($replacement && urlencode($replacement) == $replacement) {
         $this->conf['replacementChar'] = $replacement;
     }
     // Force absRefPrefix to this value is PATH_INFO is used.
     $absRefPrefix = $TSconf['absRefPrefix'];
     $absRefPrefix = trim($absRefPrefix);
     if ((!strcmp($this->conf['mode'], 'PATH_INFO') || $parentObject->absRefPrefix_force) && !$absRefPrefix) {
         $absRefPrefix = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')) . '/';
     }
     $parentObject->absRefPrefix = $absRefPrefix;
     $parentObject->config['config']['absRefPrefix'] = $absRefPrefix;
     // Check PATH_INFO url
     if ($parentObject->absRefPrefix_force && strcmp($this->conf['mode'], 'PATH_INFO')) {
         $redirectUrl = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR') . 'index.php?id=' . $parentObject->id . '&type=' . $parentObject->type;
         if ($this->conf['dontRedirectPathInfoError']) {
             if ($parentObject->checkPageUnavailableHandler()) {
                 $parentObject->pageUnavailableAndExit('PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!');
             } else {
                 $message = 'PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!';
                 header(t3lib_utility_Http::HTTP_STATUS_503);
                 t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
                 $message = 'Error: PATH_INFO not configured: ' . $message . '<br /><br /><a href="' . htmlspecialchars($redirectUrl) . '">Click here to get to the right page.</a>';
                 throw new RuntimeException($message);
             }
         } else {
             t3lib_utility_Http::redirect($redirectUrl);
         }
         exit;
         // Set no_cache if PATH_INFO is NOT used as simulateStaticDoc.
         // and if absRefPrefix_force shows that such an URL has been passed along.
         // $this->set_no_cache();
     }
 }
 public function handleError($params, tslib_fe $pObj)
 {
     if (isset($params['pageAccessFailureReasons']['fe_group']) && !isset($params['pageAccessFailureReasons']['hidden']) && current($params['pageAccessFailureReasons']['fe_group']) !== 0) {
         // make sure realurl does't issue this 401
         $code = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ajaxlogin']['unauthorized_handling'];
         $header = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ajaxlogin']['unauthorized_handling_statheader'];
         if (t3lib_div::isFirstPartOfStr($code, 'REDIRECT:')) {
             $appendQueryString = 'redirect_url=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'));
             if (strpos($code, '?') === false) {
                 $code .= '?' . $appendQueryString;
             } else {
                 $code .= '&' . $appendQueryString;
             }
         }
     } else {
         $code = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ajaxlogin']['pageNotFound_handling'];
         $header = $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_statheader'];
     }
     $pObj->pageErrorHandler($code, $header, $params['reasonText']);
 }
 /**
  * Setting the language key that'll be used by the current page.
  * In this function it should be checked, 1) that this language exists, 2) that a page_overlay_record exists, .. and if not the default language, 0 (zero), should be set.
  *
  * @return	void
  * @access private
  */
 function settingLanguage()
 {
     // Get values from TypoScript:
     $lUid = intval($this->config['config']['sys_language_uid']);
     //works only with "ignore" setting
     //need to check access for current page and show error:
     if (!tx_languagevisibility_feservices::checkVisiblityForElement($this->page['uid'], 'pages', $lUid)) {
         $GLOBALS['TSFE']->pageNotFoundAndExit('Page is not visible in requested language [' . $lUid . '/' . $this->page['uid'] . ']');
     }
     //overlay of current page is handled in ux_t3lib_pageSelect::getPageOverlay
     parent::settingLanguage();
 }
예제 #6
0
 /**
  * Checks if rootpage_id is set and if not, sets it
  *
  * @return void
  */
 protected function adjustRootPageId()
 {
     if (!$this->extConf['pagePath']['rootpage_id']) {
         if ($this->enableStrictMode) {
             $this->pObj->pageNotFoundAndExit('RealURL strict mode error: ' . 'multidomain configuration without rootpage_id. ' . 'Please, fix your RealURL configuration!');
         }
         /** @noinspection PhpUndefinedMethodInspection */
         $GLOBALS['TT']->setTSlogMessage('RealURL warning: rootpage_id was not configured!');
         $this->extConf['pagePath']['rootpage_id'] = $this->findRootPageId();
         if ($this->multidomain && !$this->extConf['pagePath']['rootpage_id']) {
             $this->pObj->pageNotFoundAndExit('RealURL error: ' . 'unable to determine rootpage_id for the current domain.');
         }
     }
 }
예제 #7
0
 /**
  * Checks page record for enableFields
  * First we use the parent method.
  * If the page is not disabled we check subpages for contexts.
  *
  * @param array   $row              The page record to evaluate
  * @param boolean $bypassGroupCheck Bypass group-check
  *
  * @return boolean
  *
  * @see tslib_fe::checkEnableFields($row, $bypassGroupCheck)
  * @see Tx_Contexts_Service_Tsfe::checkEnableFields
  */
 public function checkEnableFields($row, $bypassGroupCheck = false)
 {
     $bResult = parent::checkEnableFields($row, $bypassGroupCheck);
     if ($bResult !== true) {
         return $bResult;
     }
     $arParams = array('pObj' => &$this);
     $test = new Tx_Contexts_Service_Tsfe();
     $bResult = $test->checkEnableFields($arParams);
     if ($bResult === false) {
         return null;
     } else {
         return true;
     }
 }
 /**
  * Setting the language key that'll be used by the current page.
  * In this function it should be checked, 1) that this language exists, 2) that a page_overlay_record exists, .. and if not the default language, 0 (zero), should be set.
  *
  * @return	void
  * @access private
  */
 function settingLanguage()
 {
     if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_preProcess'])) {
         $_params = array();
         foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_preProcess'] as $_funcRef) {
             t3lib_div::callUserFunction($_funcRef, $_params, $this);
         }
     }
     parent::settingLanguage();
     if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_postProcess'])) {
         $_params = array();
         foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_postProcess'] as $_funcRef) {
             t3lib_div::callUserFunction($_funcRef, $_params, $this);
         }
     }
 }
예제 #9
0
 /**
  * initialize category related vars and add subcategories to the category selection
  *
  * @return	void
  */
 function initCategoryVars()
 {
     $storagePid = FALSE;
     if ($this->confArr['useStoragePid']) {
         $sParr = $this->tsfe->getStorageSiterootPids();
         $storagePid = $sParr['_STORAGE_PID'];
     }
     $lc = $this->conf['displayCatMenu.'];
     if ($this->theCode == 'CATMENU') {
         // init catPidList
         $catPl = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'pages', 's_misc');
         $catPl = $catPl ? $catPl : $this->cObj->stdWrap($lc['catPidList'], $lc['catPidList.']);
         $catPl = implode(',', t3lib_div::intExplode(',', $catPl));
         $recursive = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'recursive', 's_misc');
         if (!strcmp($recursive, '') || $recursive === NULL) {
             $recursive = $this->cObj->stdWrap($lc['recursive'], $lc['recursive.']);
         }
         if ($catPl) {
             $storagePid = $this->pi_getPidList($catPl, $recursive);
         }
     }
     if ($storagePid) {
         $this->SPaddWhere = ' AND tt_news_cat.pid IN (' . $storagePid . ')';
     }
     if ($this->conf['catExcludeList']) {
         $this->SPaddWhere .= ' AND tt_news_cat.uid NOT IN (' . $this->conf['catExcludeList'] . ')';
     }
     $this->enableCatFields = $this->getEnableFields('tt_news_cat');
     $addWhere = $this->SPaddWhere . $this->enableCatFields;
     $useSubCategories = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'useSubCategories', 'sDEF');
     $this->config['useSubCategories'] = strcmp($useSubCategories, '') ? $useSubCategories : $this->conf['useSubCategories'];
     // global ordering for categories, Can be overwritten later by catOrderBy for a certain content element
     $catOrderBy = trim($this->conf['catOrderBy']);
     $this->config['catOrderBy'] = $catOrderBy ? $catOrderBy : 'sorting';
     // categoryModes are: 0=display all categories, 1=display selected categories, -1=display deselected categories
     $categoryMode = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'categoryMode', 'sDEF');
     $this->config['categoryMode'] = $categoryMode ? $categoryMode : intval($this->conf['categoryMode']);
     // catselection holds only the uids of the categories selected by GETvars
     if ($this->piVars['cat']) {
         // catselection holds only the uids of the categories selected by GETvars
         $this->config['catSelection'] = $this->hObj->checkRecords($this->piVars['cat']);
         $this->piVars_catSelection = $this->config['catSelection'];
         if ($this->config['useSubCategories'] && $this->config['catSelection']) {
             // get subcategories for selection from getVars
             $subcats = tx_ttnews_div::getSubCategories($this->config['catSelection'], $addWhere);
             $this->config['catSelection'] = implode(',', array_unique(explode(',', $this->config['catSelection'] . ($subcats ? ',' . $subcats : ''))));
         }
     }
     $catExclusive = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'categorySelection', 'sDEF');
     $catExclusive = $catExclusive ? $catExclusive : trim($this->cObj->stdWrap($this->conf['categorySelection'], $this->conf['categorySelection.']));
     $this->catExclusive = $this->config['categoryMode'] ? $catExclusive : 0;
     // ignore cat selection if categoryMode isn't set
     $this->catExclusive = $this->hObj->checkRecords($this->catExclusive);
     // store the actually selected categories because we need them for the comparison in categoryMode 2 and -2
     $this->actuallySelectedCategories = $this->catExclusive;
     // get subcategories
     if ($this->config['useSubCategories'] && $this->catExclusive) {
         $subcats = tx_ttnews_div::getSubCategories($this->catExclusive, $addWhere);
         $this->catExclusive = implode(',', array_unique(explode(',', $this->catExclusive . ($subcats ? ',' . $subcats : ''))));
     }
     // get more category fields from FF or TS
     $fields = explode(',', 'catImageMode,catTextMode,catImageMaxWidth,catImageMaxHeight,maxCatImages,catTextLength,maxCatTexts');
     foreach ($fields as $key) {
         $value = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], $key, 's_category');
         $this->config[$key] = is_numeric($value) ? $value : $this->conf[$key];
     }
 }
예제 #10
0
 /**
  * @test
  */
 public function roundTripCryptStringAppliedTwoTimesReturnsOriginalString()
 {
     $clearText = 'Hello world!';
     $this->assertEquals($clearText, $this->fixture->roundTripCryptString($this->fixture->roundTripCryptString($clearText)));
 }
예제 #11
0
// Exit, if script is called directly (must be included via eID in index_ts.php)
if (!defined('PATH_typo3conf')) {
    die('Could not access this script directly!');
}
$TYPO3_AJAX = true;
//print_r(array(TYPO3_REQUESTTYPE_AJAX,TYPO3_REQUESTTYPE,TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX));
$L = intval(t3lib_div::_GP('L'));
if ($L > 0) {
    t3lib_div::_GETset(array('L' => $L));
}
$idAndTarget = rawurldecode(t3lib_div::_GP('id'));
$idParts = t3lib_div::trimExplode(' ', $idAndTarget, 1);
$id = intval($idParts[0]);
// Make new instance of TSFE
//$temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
$TSFE = new tslib_fe($GLOBALS['TYPO3_CONF_VARS'], $id, t3lib_div::_GP('type'), t3lib_div::_GP('no_cache'), t3lib_div::_GP('cHash'), t3lib_div::_GP('jumpurl'), t3lib_div::_GP('MP'), t3lib_div::_GP('RDCT'));
// don't cache ajax responses
$TSFE->no_cache = true;
$TSFE->connectToDB();
$TSFE->initFEuser();
$TSFE->checkAlternativeIdMethods();
$TSFE->clear_preview();
$TSFE->determineId();
$TSFE->getCompressedTCarray();
$TSFE->initTemplate();
$TSFE->getConfigArray();
if ($L > 0) {
    $TSFE->settingLanguage();
    $TSFE->settingLocale();
}
// finding the script path from the variable