public static function getDevMode() { if (self::$devMode === null) { self::$devMode = t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']); } return self::$devMode; }
/** * Default action. * * @return array * @throws RuntimeException */ public function main() { $this->init(); $allowedIps = t3lib_div::trimExplode(',', $this->config['allowedIps'], true); if ($this->config['debug']) { t3lib_div::sysLog('Connection from ' . t3lib_div::getIndpEnv('REMOTE_ADDR'), self::$extKey); } if ($this->config['mode'] !== 'M' || count($allowedIps) && !t3lib_div::inArray($allowedIps, t3lib_div::getIndpEnv('REMOTE_ADDR'))) { $this->denyAccess(); } $this->initTSFE(); if (!empty($this->config['synchronizeDeletedAccounts']) && $this->config['synchronizeDeletedAccounts']) { $additionalFields = ', deleted'; $additionalWhere = ''; } else { $additionalFields = ''; $additionalWhere = ' AND deleted=0'; } $administrators = $this->getDatabaseConnection()->exec_SELECTgetRows('username, admin, disable, realName, email, TSconfig, starttime, endtime, lang, tx_openid_openid' . $additionalFields, 'be_users', 'admin=1 AND tx_openid_openid<>\'\'' . $additionalWhere); if (count($administrators)) { $key = $this->config['preSharedKey']; $data = json_encode($administrators); $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $data, MCRYPT_MODE_CBC, md5(md5($key))); $encrypted = base64_encode($encrypted); return $encrypted; } else { throw new RuntimeException('No administrators found', 1327586994); } }
/** * Render the facebook like viewhelper * * @return string */ public function render() { $code = ''; $url = !empty($this->arguments['href']) ? $this->arguments['href'] : t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'); // absolute urls are needed $this->tag->addAttribute('href', Tx_News_Utility_Url::prependDomain($url)); $this->tag->forceClosingTag(TRUE); // -1 means no JS if ($this->arguments['javaScript'] != '-1') { if (empty($this->arguments['javaScript'])) { $tsSettings = $this->pluginSettingsService->getSettings(); $locale = !empty($tsSettings['facebookLocale']) ? $tsSettings['facebookLocale'] : 'en_US'; $code = '<script src="http://connect.facebook.net/' . $locale . '/all.js#xfbml=1"></script>'; // Social interaction Google Analytics if ($this->pluginSettingsService->getByPath('analytics.social.facebookLike') == 1) { $code .= t3lib_div::wrapJS("\n\t\t\t\t\t\tFB.Event.subscribe('edge.create', function(targetUrl) {\n\t\t\t\t\t\t \t_gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tFB.Event.subscribe('edge.remove', function(targetUrl) {\n\t\t\t\t\t\t _gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]);\n\t\t\t\t\t\t});\n\t\t\t\t\t"); } } else { $code = '<script src="' . htmlspecialchars($this->arguments['javaScript']) . '"></script>'; } } // seems as if a div with id fb-root is needed this is just a dirty // workaround to make things work again Perhaps we should // use the iframe variation. $code .= '<div id="fb-root"></div>' . $this->tag->render(); return $code; }
/** * Hooks to the felogin extension to provide additional code for FE login * * @return array 0 => onSubmit function, 1 => extra fields and required files */ public function loginFormHook() { $result = array(0 => '', 1 => ''); if ($GLOBALS['TYPO3_CONF_VARS']['FE']['loginSecurityLevel'] == 'rsa') { $backend = tx_rsaauth_backendfactory::getBackend(); if ($backend) { $result[0] = 'tx_rsaauth_feencrypt(this);'; $javascriptPath = t3lib_extMgm::siteRelPath('rsaauth') . 'resources/'; $files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js', 'rsaauth_min.js'); foreach ($files as $file) { $result[1] .= '<script type="text/javascript" src="' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $javascriptPath . $file . '"></script>'; } // Generate a new key pair $keyPair = $backend->createNewKeyPair(); // Save private key $storage = tx_rsaauth_storagefactory::getStorage(); /* @var $storage tx_rsaauth_abstract_storage */ $storage->put($keyPair->getPrivateKey()); // Add RSA hidden fields $result[1] .= '<input type="hidden" id="rsa_n" name="n" value="' . htmlspecialchars($keyPair->getPublicKeyModulus()) . '" />'; $result[1] .= '<input type="hidden" id="rsa_e" name="e" value="' . sprintf('%x', $keyPair->getExponent()) . '" />'; } } return $result; }
/** * Obtains site URL. * * @static * @param int $pageId * @return string */ protected static function getSiteUrl($pageId) { $domain = t3lib_BEfunc::firstDomainRecord(t3lib_BEfunc::BEgetRootLine($pageId)); $pageRecord = t3lib_BEfunc::getRecord('pages', $pageId); $scheme = is_array($pageRecord) && isset($pageRecord['url_scheme']) && $pageRecord['url_scheme'] == t3lib_utility_Http::SCHEME_HTTPS ? 'https' : 'http'; return $domain ? $scheme . '://' . $domain . '/' : t3lib_div::getIndpEnv('TYPO3_SITE_URL'); }
/** * Logs the given values. * * @return void */ public function process() { //set params $table = "tx_formhandler_log"; $fields['ip'] = t3lib_div::getIndpEnv('REMOTE_ADDR'); if (isset($this->settings['disableIPlog']) && intval($this->settings['disableIPlog']) == 1) { $fields['ip'] = NULL; } $fields['tstamp'] = time(); $fields['crdate'] = time(); $fields['pid'] = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'pid'); if (!$fields['pid']) { $fields['pid'] = $GLOBALS['TSFE']->id; } ksort($this->gp); $keys = array_keys($this->gp); $serialized = serialize($this->gp); $hash = md5(serialize($keys)); $fields['params'] = $serialized; $fields['key_hash'] = $hash; if (intval($this->settings['markAsSpam']) == 1) { $fields['is_spam'] = 1; } //query the database $res = $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $fields); $insertedUID = $GLOBALS['TYPO3_DB']->sql_insert_id(); $sessionValues = array('inserted_uid' => $insertedUID, 'inserted_tstamp' => $fields['tstamp'], 'key_hash' => $hash); Tx_Formhandler_Globals::$session->setMultiple($sessionValues); if (!$this->settings['nodebug']) { Tx_Formhandler_StaticFuncs::debugMessage('logging', array($table, implode(',', $fields))); if (strlen($GLOBALS['TYPO3_DB']->sql_error()) > 0) { Tx_Formhandler_StaticFuncs::debugMessage('error', array($GLOBALS['TYPO3_DB']->sql_error()), 3); } } }
/** * Constructor * * @param tslib_cObj $contentObject The current cObject. If NULL a new instance will be created */ public function __construct(tslib_cObj $contentObject = NULL) { if (!t3lib_extMgm::isLoaded('extbase')) { return 'In the current version you still need to have Extbase installed in order to use the Fluid Standalone view!'; } $this->initializeAutoloader(); $this->objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager'); $configurationManager = $this->objectManager->get('Tx_Extbase_Configuration_ConfigurationManagerInterface'); if ($contentObject === NULL) { $contentObject = t3lib_div::makeInstance('tslib_cObj'); } $configurationManager->setContentObject($contentObject); $this->templateParser = $this->objectManager->get('Tx_Fluid_Core_Parser_TemplateParser'); $this->setRenderingContext($this->objectManager->create('Tx_Fluid_Core_Rendering_RenderingContext')); $request = $this->objectManager->create('Tx_Extbase_MVC_Web_Request'); $request->setRequestURI(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')); $request->setBaseURI(t3lib_div::getIndpEnv('TYPO3_SITE_URL')); $uriBuilder = $this->objectManager->create('Tx_Extbase_MVC_Web_Routing_UriBuilder'); $uriBuilder->setRequest($request); $controllerContext = $this->objectManager->create('Tx_Extbase_MVC_Controller_ControllerContext'); $controllerContext->setRequest($request); $controllerContext->setUriBuilder($uriBuilder); $flashMessageContainer = $this->objectManager->get('Tx_Extbase_MVC_Controller_FlashMessages'); // singleton $controllerContext->setFlashMessageContainer($flashMessageContainer); $this->setControllerContext($controllerContext); }
/** * Main function * * @return void */ function main() { switch ((string) t3lib_div::_GET('cmd')) { case 'menuitem': echo ' <img src="gfx/x_t3logo.png" width="61" height="16" hspace="3" alt="" />'; $menuItems = array(array('title' => 'About TYPO3', 'xurl' => 'http://typo3.com/', 'subitems' => array(array('title' => 'License', 'xurl' => 'http://typo3.com/License.1625.0.html'), array('title' => 'Support', 'subitems' => array(array('title' => 'Mailing lists', 'xurl' => 'http://lists.netfielders.de/cgi-bin/mailman/listinfo'), array('title' => 'Documentation', 'xurl' => 'http://typo3.org/documentation/'), array('title' => 'Find consultancy', 'xurl' => 'http://typo3.com/Consultancies.1248.0.html'))), array('title' => 'Contribute', 'xurl' => 'http://typo3.org/community/participate/'), array('title' => 'Donate', 'xurl' => 'http://typo3.com/Donations.1261.0.html', 'icon' => '1'))), array('title' => 'Extensions', 'url' => 'mod/tools/em/index.php'), array('title' => 'Menu preferences and such things', 'onclick' => 'alert("A dialog is now shown which will allow user configuration of items in the menu");event.stopPropagation();', 'state' => 'checked'), array('title' => '--div--'), array('title' => 'Recent Items', 'id' => $this->id . '_recent', 'subitems' => array(), 'html' => $this->menuItemObject($this->id . '_recent', ' fetched: false, onActivate: function() { // if (!this.fetched) { //Element.update("' . $this->id . '_recent-layer","asdfasdf"); getElementContent("' . $this->id . '_recent-layer", 0, "logomenu.php?cmd=recent") this.fetched = true; // } } ')), array('title' => '--div--'), array('title' => 'View frontend', 'xurl' => t3lib_div::getIndpEnv('TYPO3_SITE_URL')), array('title' => 'Log out', 'onclick' => "top.document.location='logout.php';")); echo $this->menuLayer($menuItems); break; case 'recent': $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_log.*, MAX(sys_log.tstamp) AS tstamp_MAX', 'sys_log,pages', 'pages.uid=sys_log.event_pid AND sys_log.userid=' . intval($GLOBALS['BE_USER']->user['uid']) . ' AND sys_log.event_pid>0 AND sys_log.type=1 AND sys_log.action=2 AND sys_log.error=0', 'tablename,recuid', 'tstamp_MAX DESC', 20); $items = array(); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $elRow = t3lib_BEfunc::getRecord($row['tablename'], $row['recuid']); if (is_array($elRow)) { $items[] = array('title' => t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($row['tablename'], $elRow), $GLOBALS['BE_USER']->uc['titleLen']) . ' - ' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $row['tstamp_MAX']), 'icon' => array(t3lib_iconworks::getIcon($row['tablename'], $elRow), 'width="18" height="16"'), 'onclick' => 'content.' . t3lib_BEfunc::editOnClick('&edit[' . $row['tablename'] . '][' . $row['recuid'] . ']=edit', '', 'dummy.php')); } } echo $this->menuItems($items); break; } }
function _render() { $this->oForm->bStoreFormInSession = TRUE; // requesting eID context for upload-service $this->initButtonBrowse(); $this->initButtonUpload(); $this->initListQueue(); $aButtonBrowse = $this->oForm->_renderElement($this->oButtonBrowse); $aButtonUpload = $this->oForm->_renderElement($this->oButtonUpload); $aListQueue = $this->oForm->_renderElement($this->oListQueue); /* forging access to upload service */ $sHtmlId = $this->_getElementHtmlId(); $sObject = "rdt_swfupload"; $sServiceKey = "upload"; $sFormId = $this->oForm->formid; $sSafeLock = $this->_getSessionDataHashKey(); $sThrower = $sHtmlId; $sUrl = $this->oForm->_removeEndingSlash(t3lib_div::getIndpEnv("TYPO3_SITE_URL")) . "/index.php?eID=tx_ameosformidable&object=" . $sObject . "&servicekey=" . $sServiceKey . "&formid=" . $sFormId . "&safelock=" . $sSafeLock . "&thrower=" . $sThrower; $sButtonUrl = $this->oForm->getLLLabel("LLL:EXT:ameos_formidable/api/base/rdt_swfupload/res/locallang.xml:buttonbrowse.image_url"); $aConf = array("buttonBrowseId" => $this->oButtonBrowse->_getElementHtmlId(), "buttonUploadId" => $this->oButtonUpload->_getElementHtmlId(), "listQueueId" => $this->oListQueue->_getElementHtmlId(), "swfupload_config" => array("upload_url" => $sUrl, "flash_url" => $this->sExtWebPath . "res/flash/swfupload.swf", "file_post_name" => "rdt_swfupload", "file_size_limit" => $this->getMaxUploadSize(), "file_types_description" => $this->getFileTypeDesc(), "file_types" => $this->getFileType(), "file_queue_limit" => $this->getQueueLimit(), "button_placeholder_id" => $this->oButtonBrowse->_getElementHtmlId(), "button_image_url" => $this->oForm->toWebPath($sButtonUrl), "button_width" => "61", "button_height" => "22")); $this->includeScripts($aConf); $sAddInputParams = $this->_getAddInputParams(); $GLOBALS["_SESSION"]["ameos_formidable"]["ajax_services"][$sObject][$sServiceKey][$sSafeLock] = array("requester" => array("name" => $this->getAbsName(), "xpath" => $this->sXPath)); $aButtonBrowse["__compiled"] .= "<input type=\"hidden\" id=\"" . $this->_getElementHtmlId() . "\" />"; return array("__compiled" => $aButtonBrowse["__compiled"] . " " . $aButtonUpload["__compiled"] . " " . $aListQueue["__compiled"], "buttonBrowse" => $aButtonBrowse, "buttonUpload" => $aButtonUpload, "listQueue" => $aListQueue); }
/** * Render a share button * * @param boolean $loadJs * @return string */ public function render($loadJs = TRUE) { // check defaults if (empty($this->arguments['href'])) { $this->tag->addAttribute('href', 'http://www.facebook.com/sharer.php'); } if (empty($this->arguments['name'])) { $this->tag->addAttribute('name', 'fb_share'); } if (empty($this->arguments['type'])) { $this->tag->addAttribute('type', 'button_count'); } $shareUrl = empty($this->arguments['shareurl']) ? t3lib_div::getIndpEnv('TYPO3_REQUEST_URL') : $this->arguments['shareurl']; $this->tag->addAttribute('share_url', $shareUrl); $this->tag->removeAttribute('shareurl'); $this->tag->setContent($this->renderChildren()); $code = $this->tag->render(); if ($loadJs) { $code .= '<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>'; } // Social interaction Google Analytics if ($this->pluginSettingsService->getByPath('analytics.social.facebookShare') == 1) { $code .= t3lib_div::wrapJS("\r\n\t\t\t\tFB.Event.subscribe('message.send', function(targetUrl) {\r\n\t\t\t\t _gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]);\r\n\t\t\t\t});\r\n\t\t\t"); } return $code; }
/** * Prepend current url if url is relative * * @param string $url given url * @return string */ public static function prependDomain($url) { if (!t3lib_div::isFirstPartOfStr($url, t3lib_div::getIndpEnv('TYPO3_SITE_URL'))) { $url = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $url; } return $url; }
function tslib_fe_checkAlternativeIdMethods($params, $ref) { $pObj =& $params['pObj']; if (t3lib_div::int_from_ver($GLOBALS["TYPO_VERSION"]) >= 3007000) { $siteScript = t3lib_div::getIndpEnv('TYPO3_SITE_SCRIPT'); } else { $siteScript = $GLOBALS["HTTP_SERVER_VARS"]["REQUEST_URI"]; } if ($siteScript && substr($siteScript, 0, 9) != 'index.php') { // If there has been a redirect (basically; we arrived here otherwise than via "index.php" in the URL) this can happend either due to a CGI-script or because of reWrite rule. Earlier we used $_SERVER['REDIRECT_URL'] to check but $uParts = parse_url($siteScript); // Parse the path: $requestFilename = trim(preg_replace('/.*\\//', '', $uParts['path'])); // This is the filename of the script/simulated pdf-file. $parts = explode('.', preg_replace('/.*\\//', '', $requestFilename)); $pCount = count($parts); if ($parts[$pCount - 1] == 'pdf') { if ($pCount > 2) { $pObj->type = intval($parts[$pCount - 2]); $pObj->id = $parts[$pCount - 3]; } else { $pObj->type = $GLOBALS['pdf_generator2_parameters']['typeNum']; $pObj->id = $parts[0]; } } } }
function execute() { return 1; $pfad = 'fileadmin/medien/fakultaeten/allgemein/modulbeschreibungen'; $documentRoot = t3lib_div::getIndpEnv(TYPO3_DOCUMENT_ROOT); $pfadKomplett = $documentRoot . '/' . $pfad; $this->recursive_rm($pfadKomplett); return 1; $start = time(); $lsfStudiengangDaten = array(); $where = 'deleted=0 AND hidden=0 AND cType="list" AND list_type="he_tools_pi1"'; $contentElems = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pid,pi_flexform', 'tt_content', $where); while ($daten = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($contentElems)) { $flexFormSettings = t3lib_div::xml2array($daten['pi_flexform']); $flexData = $flexFormSettings['data']['sDEF']['lDEF']; if (is_array($flexData)) { if ($flexData['mode']['vDEF'] == 'MODULUEBERSICHT_LSF') { $spoVersion = $flexData['spo_version']['vDEF']; $studiengang = $flexData['studiengang_lsf']['vDEF']; $vertiefung = $flexData['vertiefung_lsf']['vDEF']; $whereStudiengang = 'uid=' . $studiengang; $abfrageStudiengang = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_hetools_module_studiengaenge', $whereStudiengang); if ($datenStudiengang = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($abfrageStudiengang)) { $abschlussLsf = $datenStudiengang['lsf_abs']; $studiengangLsf = $datenStudiengang['lsf_stdg']; $fakultaet = $datenStudiengang['fakultaet']; $vertiefungenLsf = array(); $whereVertiefung = ' modstud_id=' . $studiengang; $abfrageVertiefung = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_hetools_module_vertiefungen', $whereVertiefung); while ($datenVertiefung = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($abfrageVertiefung)) { if (!empty($datenVertiefung['version'])) { if ($datenVertiefung['version'] == $spoVersion) { $vertiefungenLsf[] = $datenVertiefung['kuerzel']; } } else { $vertiefungenLsf[] = $datenVertiefung['kuerzel']; } } if (empty($lsfStudiengangDaten[$studiengang . $spoVersion])) { $lsfStudiengangDaten[$studiengang . $spoVersion] = array($abschlussLsf, $spoVersion, $fakultaet, $studiengangLsf, $vertiefungenLsf); } } } } } foreach ($lsfStudiengangDaten as $lsfStudiengang) { // PDF für den Studiengang speichern $this->createPdf($lsfStudiengang[0], $lsfStudiengang[1], $lsfStudiengang[2], $lsfStudiengang[3], ''); if (!empty($lsfStudiengang[4]) && count($lsfStudiengang[4]) > 0) { foreach ($lsfStudiengang[4] as $vertiefungLsf) { $this->createPdf($lsfStudiengang[0], $lsfStudiengang[1], $lsfStudiengang[2], $lsfStudiengang[3], $vertiefungLsf); } } } $ende = time(); $dauer = $ende - $start; t3lib_div::devLog('dauer: ' . $dauer . ' Sekunden', 'lsf_pdfs', 0); return 1; }
/** * [Describe function...] * * @param [type] $i: ... * @return [type] ... */ function parseContent($i) { $sitepath = t3lib_div::getIndpEnv('REQUEST_URI'); $this->extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['naw_securedl']); $rest = $i; //while (preg_match('/(<[aA]|<[iI][mM][gG])+?\s[^>]*([hH][rR][eE][fF]|[sS][rR][cC])=(\"??)([^\" >]*?)\\3[^>]*>/siU', $i,$match)) { // suchendes secured Verzeichnis //while (preg_match('/(<[aA]|<[iI][mM][gG])+?.[^>]*([hH][rR][eE][fF]|[sS][rR][cC])=(\"??)([^\" >]*?)\\3[^>]*>/siU', $i,$match)) { // suchendes secured Verzeichnis $result = ''; while (preg_match('/(?i)(<a|<img)+?.[^>]*(href|src)=(\\"??)([^\\" >]*?)\\3[^>]*>/siU', $i, $match)) { // suchendes secured Verzeichnis $cont = explode($match[0], $i, 2); $vor = $cont[0]; $tag = $match[0]; if ($this->extConf['debug'] == '2' || $this->extConf['debug'] == '3') { debug('tag:' . $tag); } $rest = $cont[1]; if ($this->extConf['debug'] == '1' || $this->extConf['debug'] == '3') { debug(array('html-tag:' => $tag)); } // investigate the HTML-Tag... //while (preg_match('/"((typo3temp|fileadmin|uploads).*?([pP][dD][fF]|[jJ][pP][eE]?[gG]|[gG][iI][fF]|[pP][nN][gG]))"/i', $tag,$match1)){ if (preg_match('/"(?:' . $this->modifiyregex($this->extConf['domain']) . ')?(\\/?(?:' . $this->modifiyregex($this->extConf['securedDirs']) . ')+?.*?(?:' . $this->modifyfiletypes($this->extConf['filetype']) . '))"/i', $tag, $match1)) { if ($this->extConf['debug'] == '2' || $this->extConf['debug'] == '3') { debug('/"(?:' . $this->modifiyregex($this->extConf['domain']) . ')?(\\/?(?:' . $this->modifiyregex($this->extConf['securedDirs']) . ')+?.*?(?:' . $this->modifyfiletypes($this->extConf['filetype']) . '))"/i'); } if ($this->extConf['debug'] == '2' || $this->extConf['debug'] == '3') { debug($match1); } $replace = $this->makeSecure($match1[1]); $tagexp = explode($match1[1], $tag, 2); if ($this->extConf['debug'] == '2' || $this->extConf['debug'] == '3') { debug($tagexp[0]); } if ($this->extConf['debug'] == '2' || $this->extConf['debug'] == '3') { debug($replace); } if ($this->extConf['debug'] == '2' || $this->extConf['debug'] == '3') { debug($tagexp[1]); } $tag = $tagexp[0] . $replace; //$tag = $tagexp[0].$replace.$tagexp[1]; $tmp = $tagexp[1]; // search in the rest on the tag (e.g. for vHWin=window.open...) //print_R('/\'(?:'.$this->modifiyregex($this->extConf['domain']).')?'.$this->modifiyregex($sitepath).'(\/?(?:'.$this->modifiyregex($this->extConf['securedDirs']).')+?.*?(?:'.$this->modifyfiletypes($this->extConf['filetype']).'))\'/i'); if (preg_match('/\'(?:' . $this->modifiyregex($this->extConf['domain']) . ')?.*?(\\/?(?:' . $this->modifiyregex($this->extConf['securedDirs']) . ')+?.*?(?:' . $this->modifyfiletypes($this->extConf['filetype']) . '))\'/i', $tmp, $match1)) { $replace = $this->makeSecure($match1[1]); $tagexp = explode($match1[1], $tmp, 2); $add = $tagexp[0] . '/' . $replace . $tagexp[1]; } else { $add = $tagexp[1]; } $tag .= $add; } $result .= $vor . $tag; $i = $rest; } return $result . $rest; }
/** * @return string */ public function render() { $url = t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'); if (!t3lib_div::isFirstPartOfStr($url, t3lib_div::getIndpEnv('TYPO3_SITE_URL'))) { $url = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $url; } return $url; }
/** * Echoes an exception for the web. * * @param Exception $exception The exception * @return void */ public function echoExceptionWeb(Exception $exception) { if (!headers_sent()) { header("HTTP/1.1 500 Internal Server Error"); } $this->writeLogEntries($exception, self::CONTEXT_WEB); t3lib_timeTrack::debug_typo3PrintError(get_class($exception), $exception->getMessage(), 0, t3lib_div::getIndpEnv('TYPO3_SITE_URL')); }
/** * Processed Backend session creation and redirect to backend.php * * @return void */ public function main() { if ($GLOBALS['BE_USER']->user['uid']) { t3lib_div::cleanOutputBuffers(); $backendURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'backend.php'; t3lib_utility_Http::redirect($backendURL); } }
function force_download($filename, $mimetype = '') { $filenameOrig = $filename; # $filename = str_replace(,PATH_site,$filename); $filename = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $filename; #if (!file_exists($filename)) return false; // Mimetype not set? if (empty($mimetype)) { $file_extension = strtolower(substr(strrchr($filename, "."), 1)); switch ($file_extension) { case "pdf": $mimetype = "application/pdf"; break; case "exe": $mimetype = "application/octet-stream"; break; case "zip": $mimetype = "application/zip"; break; case "doc": $mimetype = "application/msword"; break; case "xls": $mimetype = "application/vnd.ms-excel"; break; case "ppt": $mimetype = "application/vnd.ms-powerpoint"; break; case "gif": $mimetype = "image/gif"; break; case "png": $mimetype = "image/png"; break; case "jpeg": case "jpg": $mimetype = "image/jpg"; break; default: $mimetype = "application/force-download"; } } // Make sure there's nothing else left ob_clean_all(); // Start sending headers header('Pragma: public'); // required header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private', false); // required for certain browsers header('Content-Transfer-Encoding: binary'); header('Content-Type: ' . 'image/jpg'); header('Content-Disposition: attachment; filename="' . basename($filename) . '";'); // Send data readfile($filename); exit; }
/** * Creates an isntance of this class. * * @return void */ public function __construct() { $urlParameters = tx_realurl::array_merge_recursive_overrule($_GET, $_POST); $this->currentPage = max(1, intval($urlParameters['page'])); unset($urlParameters['page']); unset($urlParameters['cmd']); $this->baseURL = t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT') . '?' . t3lib_div::implodeArrayForUrl('', $urlParameters); $this->resultsPerPage = self::RESULTS_PER_PAGE_DEFAULT; }
/** * The main method called by the controller * * @return array The probably modified GET/POST parameters */ public function process() { $firstInsertInfo = array(); if (is_array($this->gp['saveDB'])) { if (isset($this->settings['table'])) { foreach ($this->gp['saveDB'] as $idx => $insertInfo) { if ($insertInfo['table'] === $this->settings['table']) { $firstInsertInfo = $insertInfo; break; } } } if (empty($firstInsertInfo)) { reset($this->gp['saveDB']); $firstInsertInfo = current($this->gp['saveDB']); } } $table = $firstInsertInfo['table']; $uid = $firstInsertInfo['uid']; $uidField = $firstInsertInfo['uidField']; if (!$uidField) { $uidField = 'uid'; } if ($table && $uid && $uidField) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, $uidField . '=' . $uid); if ($res) { $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); $authCode = $this->generateAuthCode($row); $this->gp['generated_authCode'] = $authCode; // looking for the page, which should be used for the authCode Link // first look for TS-setting 'authCodePage', second look for redirect_page-setting, third use actual page $authCodePage = ''; if (isset($this->settings['authCodePage'])) { $authCodePage = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'authCodePage'); } else { $authCodePage = Tx_Formhandler_StaticFuncs::pi_getFFvalue($this->cObj->data['pi_flexform'], 'redirect_page', 'sMISC'); } if (!$authCodePage) { $authCodePage = $GLOBALS['TSFE']->id; } //create the parameter-array for the authCode Link $paramsArray = array_merge($firstInsertInfo, array('authCode' => $authCode)); // If we have set a formValuesPrefix, add it to the parameter-array if (!empty(Tx_Formhandler_Globals::$formValuesPrefix)) { $paramsArray = array(Tx_Formhandler_Globals::$formValuesPrefix => $paramsArray); } // create the link, using typolink function, use baseUrl if set, else use t3lib_div::getIndpEnv('TYPO3_SITE_URL') $url = $this->cObj->getTypoLink_URL($authCodePage, $paramsArray); $tmpArr = parse_url($url); if (empty($tmpArr['scheme'])) { $url = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . ltrim($url, '/'); } $this->gp['authCodeUrl'] = $url; } } return $this->gp; }
/** * Initialize the tree class. Needs to be overwritten * Will set ->fieldsArray, ->backPath and ->clause * * @param string record WHERE clause * @param string record ORDER BY field * @return void */ function setTable($table) { global $TCA, $LANG; $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME'); $this->table = $table; $this->parentField = $GLOBALS['TCA'][$this->table]['ctrl']['treeParentField']; $this->title = $LANG->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']); parent::init(); }
function registerPngFix($params, $parent) { // handle stupid IE6 $userAgent = t3lib_div::getIndpEnv('HTTP_USER_AGENT'); if (!(strpos($userAgent, 'MSIE 6') === false) && strpos($userAgent, 'Opera') === false && strpos($userAgent, 'MSIE 7') === false) { //make sure we match IE6 but not Opera or IE7 $params['pageRenderer']->addCssFile($parent->backPath . 'sysext/t3skin/stylesheets/ie6/z_t3-icons-gifSprites.css'); } }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree * * @return [type] ... */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; $PATH_TYPO3 = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'typo3/'; if ($BE_USER->user["admin"]) { // Draw the header. $this->doc = t3lib_div::makeInstance("template"); $this->doc->backPath = $BACK_PATH; $this->pageRenderer = $this->doc->getPageRenderer(); // Include Ext JS $this->pageRenderer->loadExtJS(true, true); $this->pageRenderer->enableExtJSQuickTips(); $this->pageRenderer->enableExtJsDebug(); $this->pageRenderer->addJsFile($BACK_PATH . t3lib_extMgm::extRelPath('caretaker') . 'res/js/tx.caretaker.js', 'text/javascript', FALSE, FALSE); $this->pageRenderer->addJsFile($BACK_PATH . t3lib_extMgm::extRelPath('caretaker') . 'res/js/tx.caretaker.NodeTree.js', 'text/javascript', FALSE, FALSE); //Add caretaker css $this->pageRenderer->addCssFile('../res/css/tx.caretaker.nodetree.css', 'stylesheet', 'all', '', FALSE); // storage Pid $confArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['caretaker']); $storagePid = (int) $confArray['storagePid']; $this->pageRenderer->addJsInlineCode('Caretaker_Nodetree', ' Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); Ext.ns("tx.caretaker"); Ext.onReady(function() { tx.caretaker.view = new Ext.Viewport({ layout: "fit", items: { id: "cartaker-tree", xtype: "caretaker-nodetree", autoScroll: true, dataUrl: "' . $this->doc->backPath . 'ajax.php?ajaxID=tx_caretaker::treeloader", addUrl: "' . $PATH_TYPO3 . 'alt_doc.php?edit[###NODE_TYPE###][' . $storagePid . ']=new", editUrl: "' . $PATH_TYPO3 . 'alt_doc.php?edit[tx_caretaker_###NODE_TYPE###][###NODE_UID###]=edit", hideUrl: "' . $PATH_TYPO3 . 'tce_db.php?&data[tx_caretaker_###NODE_TYPE###][###NODE_UID###][hidden]=1", unhideUrl: "' . $PATH_TYPO3 . 'tce_db.php?&data[tx_caretaker_###NODE_TYPE###][###NODE_UID###][hidden]=0" } }); tx_caretaker_updateTreeById = function( id ){ tx_caretaker_tree = Ext.getCmp("cartaker-tree"); tx_caretaker_tree.reloadTreePartial( id ); } }); '); $this->content .= $this->doc->startPage($LANG->getLL("title")); $this->doc->form = ''; } else { // If no access or if not admin $this->doc = t3lib_div::makeInstance("mediumDoc"); $this->doc->backPath = $BACK_PATH; $this->content .= $this->doc->startPage($LANG->getLL("title")); $this->content .= $this->doc->header($LANG->getLL("title")); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } }
/** * Processed Backend session creation and redirect to backend.php * * @return void */ public function main() { if ($GLOBALS['BE_USER']->user['uid']) { while (ob_get_level() > 0) { @ob_end_clean(); } $backendURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'backend.php'; t3lib_utility_Http::redirect($backendURL); } }
/** * Render the USER_INT cObject * * @param array Array of TypoScript properties * @return string Output */ public function render($conf = array()) { $content = parent::render($conf); if ($conf['no_esi'] == FALSE && t3lib_div::_GP('from_varnish') == FALSE) { $substKey = str_replace(array('<!--', '-->'), '', $content); $url = t3lib_div::getIndpEnv('TYPO3_SITE_PATH') . '?id=' . $GLOBALS['TSFE']->id . '&type=978&key=' . $substKey . '&identifier=' . $GLOBALS['TSFE']->newHash . '&from_varnish=1'; $content = '<esi:include src="' . $url . '" />'; } return $content; }
/** * @static * @param $url * @return mixed * @throws InvalidArgumentException */ protected static function sanitizeUrl($url) { // finds the main domain of the current host (www.typo3.org => typo3.org) $serverName = preg_replace('/.*(\\.[\\w\\-_]+\\.[\\w]+)$/', '$1', t3lib_div::getIndpEnv('HTTP_HOST')); $parts = parse_url($url); if ($parts['host'] && !preg_match('/' . $serverName . '$/', $parts['host'])) { throw new InvalidArgumentException('Url is supposed to belong to ' . $serverName . ' but was: ' . $parts['host']); } return $url; }
private function _getContent($file) { $file = realpath($file); if (! $file || in_array($file, self::$filesIncluded) || false === ($content = @file_get_contents($file)) ) { // file missing, already included, or failed read return ''; } self::$filesIncluded[] = realpath($file); $this->_currentDir = dirname($file); // ##################### BEGIN TYPO3 modification if (strpos($this->_currentDir, realpath(t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT'))) === FALSE) { $realPathToTYPO3 = str_replace('typo3/', '', realpath(PATH_typo3)); $this->_currentDir = str_replace($realPathToTYPO3, '', $this->_currentDir); $this->_currentDir = realpath(PATH_site) . '/typo3' . $this->_currentDir; } // ##################### END TYPO3 modification // remove UTF-8 BOM if present if (pack("CCC",0xef,0xbb,0xbf) === substr($content, 0, 3)) { $content = substr($content, 3); } // ensure uniform EOLs $content = str_replace("\r\n", "\n", $content); // process @imports $content = preg_replace_callback( '/ @import\\s+ (?:url\\(\\s*)? # maybe url( [\'"]? # maybe quote (.*?) # 1 = URI [\'"]? # maybe end quote (?:\\s*\\))? # maybe ) ([a-zA-Z,\\s]*)? # 2 = media list ; # end token /x' ,array($this, '_importCB') ,$content ); if (self::$_isCss) { // rewrite remaining relative URIs $content = preg_replace_callback( '/url\\(\\s*([^\\)\\s]+)\\s*\\)/' ,array($this, '_urlCB') ,$content ); } return $this->_importedContent . $content; }
function mkPreviewLinks() { $previewUrls = array(); foreach ($this->pageIds as $pageId) { $ttlHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours')); $ttlHours = $ttlHours ? $ttlHours : 24 * 2; $params = 'id=' . $pageId . '&L=' . $this->sysLang . '&ADMCMD_previewWS=' . $this->workspaceId; $previewUrls[$pageId] = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'index.php?ADMCMD_prev=' . \TYPO3\CMS\Version\Hook\PreviewHook::compilePreviewKeyword($params, $GLOBALS['BE_USER']->user['uid'], 60 * 60 * $ttlHours); } return $previewUrls; }
/** * Render facebook comment viewhelper * * @param string $appId * @return string */ public function render($appId) { $tsSettings = $this->pluginSettingsService->getSettings(); $this->tag->addAttribute('data-href', t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')); $this->tag->forceClosingTag(TRUE); $locale = !empty($tsSettings['facebookLocale']) ? $tsSettings['facebookLocale'] : 'en_US'; $code = '<div id="fb-root"></div> <script src="http://connect.facebook.net/' . $locale . '/all.js#appId=' . htmlspecialchars($appId) . '&xfbml=1"></script>'; $code .= $this->tag->render(); return $code; }
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']); }