本文整理汇总了PHP中t3lib_div::locationHeaderUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::locationHeaderUrl方法的具体用法?PHP t3lib_div::locationHeaderUrl怎么用?PHP t3lib_div::locationHeaderUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::locationHeaderUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createSitemap
/**
* Create Sitemap
*
* @return string Text Sitemap
*/
protected function createSitemap()
{
$ret = array();
foreach ($this->sitemapPages as $sitemapPage) {
if (empty($this->pages[$sitemapPage['page_uid']])) {
// invalid page
continue;
}
$page = $this->pages[$sitemapPage['page_uid']];
$ret[] = t3lib_div::locationHeaderUrl($sitemapPage['page_url']);
}
return implode("\n", $ret);
}
示例2: main
/**
* The main method of the PlugIn
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
* @return The content that is displayed on the website
*/
function main($content, $conf)
{
/* --------------------------------------------------
Detect Startpage
-------------------------------------------------- */
$startpage = false;
// is_siteroot
if ($conf['startpage']) {
if ($GLOBALS['TSFE']->page['is_siteroot']) {
$startpage = true;
} else {
// shortcut from is_siteroot
foreach ($GLOBALS['TSFE']->rootLine as $page) {
if ($page['is_siteroot'] && $page['doktype'] == 4 && $page['shortcut'] == $GLOBALS['TSFE']->id) {
$startpage = true;
break;
}
}
}
// Multilingual startpage
if ($startpage) {
$startlinks = explode(';', $conf['startpage']);
if (sizeof($startlinks) > 1) {
$startlink = $startlinks[intval($_GET['L'])];
} else {
$startlink = $startlinks[0];
}
}
}
$additionalParams = array_diff_key($_GET, array('id' => 0, 'L' => 0, 'type' => 0));
$conf['typolink.']['additionalParams'] .= '&' . http_build_query($additionalParams);
$url = t3lib_div::locationHeaderUrl($startpage ? $startlink : $this->cObj->typolink('', $conf['typolink.']));
/* --------------------------------------------------
Redirect
-------------------------------------------------- */
if ($conf['redirect'] && !$GLOBALS['BE_USER']) {
$request_url = parse_url($_SERVER['REQUEST_URI']);
if ($request_url['path'] != parse_url($url, PHP_URL_PATH)) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $url . ($request_url['query'] ? '?' . $request_url['query'] : ''));
header('X-Note: Redirect by ods_seo');
exit;
}
}
/* --------------------------------------------------
Canonical
-------------------------------------------------- */
if ($conf['canonical']) {
$GLOBALS['TSFE']->additionalHeaderData[$this->prefixId] = '<link rel="canonical" href="' . htmlentities($url) . '" />';
}
}
示例3: main
/**
* Cette methode permet de verifier si l'utilisateur
* du portail poss�de d�j� une authentification SSO sur le
* serveur CAS.
* Si ce dernier ne poss�de pas d'authetification, le plugin redirige l'utilisateur sur
* une page d'authentification CAS dans une iframe.
*/
function main($content, $conf)
{
session_start();
//$idPageAuth = '3434';
$idPageAuth = '3682';
$this->typeExecution = "prod";
$urlCas = "none";
$portCas = "none";
if ($this->typeExecution == "dev") {
$urlCas = "xinf-devlinux.intranet.haras-nationaux.fr";
$portCas = 7777;
} else {
if ($this->typeExecution == "prod") {
$urlCas = "cerbere.haras-nationaux.fr";
$portCas = 443;
}
}
//debug($_SESSION);
if ($GLOBALS["TSFE"]->page["tx_dlcube04CAS_auth_cas_required"] == 1) {
phpCAS::client(CAS_VERSION_2_0, $urlCas, $portCas, 'cas', 'true');
$auth = phpCAS::checkAuthentication();
if (!$auth) {
$_SESSION["service_id_auth"] = $GLOBALS["TSFE"]->id;
header('Location: ' . t3lib_div::locationHeaderUrl($this->pi_getPageLink($idPageAuth, "", array("action" => "auth"))));
exit;
} else {
$_SESSION["portalId"] = phpCAS::getUser();
}
}
if (isset($_GET["action_cas"]) && $_GET["action_cas"] == "logout") {
unset($_SESSION["portalId"]);
header('Location: ' . t3lib_div::locationHeaderUrl($this->pi_getPageLink("3683", "", array("action" => "disconnect"))));
}
/**
* Gestion des langues pour le cookie
*/
if (isset($_GET["lang"])) {
if ($_GET["lang"] == "fr") {
$this->cookie_fr();
}
if ($_GET["lang"] == "en") {
$this->cookie_en();
}
}
}
示例4: main
/**
* The main method of the PlugIn
*
* @param string $content The PlugIn content
* @param array $conf The PlugIn configuration
* @return The content that is displayed on the website
*/
function main($content, $conf)
{
$this->conf = $conf;
// Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
$this->pi_USER_INT_obj = 1;
if ($this->cObj->data['pages']) {
$destination = $this->getLink($this->cObj->data['pages'], $GLOBALS['TSFE']->sys_language_uid);
// Redirect
if ($redirect['has_moved']) {
header('HTTP/1.1 301 Moved Permanently');
} else {
header('HTTP/1.1 302 Moved Temporarily');
}
header('Location: ' . t3lib_div::locationHeaderUrl($destination));
header('Connection: close');
exit;
}
}
示例5: main
/**
* Handles incoming trackback requests
*
* @return void
*/
public function main()
{
header('Content-type: text/plain; charset=iso-8859-1');
if ($this->pageId) {
$this->createTSFE();
$cObj = t3lib_div::makeInstance('tslib_cObj');
/* @var $cObj tslib_cObj */
$typolinkConf = array('parameter' => $this->pageId, 'useCacheHash' => $this->parameters != '');
if ($this->parameters) {
$typolinkConf['additionalParams'] = $this->parameters;
}
$url = $cObj->typoLink_URL($typolinkConf);
if ($url == '') {
$url = '/';
}
$parts = parse_url($url);
if ($parts['host'] == '') {
$url = t3lib_div::locationHeaderUrl($url);
}
echo $url;
}
}
示例6: redirectToCurrentUrl
/**
* Redirects to the current URL.
*
* @return void
*/
protected function redirectToCurrentUrl()
{
$currentUrl = t3lib_div::locationHeaderUrl(t3lib_div::getIndpEnv('REQUEST_URI'));
tx_oelib_headerProxyFactory::getInstance()->getHeaderProxy()->addHeader('Location: ' . $currentUrl);
}
示例7: renderJsLibraries
/**
* helper function for render the javascript libraries
*
* @return string content with javascript libraries
*/
protected function renderJsLibraries()
{
$out = '';
if ($this->addPrototype) {
$out .= '<script src="' . $this->processJsFile($this->backPath . 'contrib/prototype/prototype.js') . '" type="text/javascript"></script>' . LF;
unset($this->jsFiles[$this->backPath . 'contrib/prototype/prototype.js']);
}
if ($this->addScriptaculous) {
$mods = array();
foreach ($this->addScriptaculousModules as $key => $value) {
if ($this->addScriptaculousModules[$key]) {
$mods[] = $key;
}
}
// resolve dependencies
if (in_array('dragdrop', $mods) || in_array('controls', $mods)) {
$mods = array_merge(array('effects'), $mods);
}
if (count($mods)) {
foreach ($mods as $module) {
$out .= '<script src="' . $this->processJsFile($this->backPath . 'contrib/scriptaculous/' . $module . '.js') . '" type="text/javascript"></script>' . LF;
unset($this->jsFiles[$this->backPath . 'contrib/scriptaculous/' . $module . '.js']);
}
}
$out .= '<script src="' . $this->processJsFile($this->backPath . 'contrib/scriptaculous/scriptaculous.js') . '" type="text/javascript"></script>' . LF;
unset($this->jsFiles[$this->backPath . 'contrib/scriptaculous/scriptaculous.js']);
}
// include extCore
if ($this->addExtCore) {
$out .= '<script src="' . $this->processJsFile($this->backPath . 'contrib/extjs/ext-core' . ($this->enableExtCoreDebug ? '-debug' : '') . '.js') . '" type="text/javascript"></script>' . LF;
unset($this->jsFiles[$this->backPath . 'contrib/extjs/ext-core' . ($this->enableExtCoreDebug ? '-debug' : '') . '.js']);
}
// include extJS
if ($this->addExtJS) {
// use the base adapter all the time
$out .= '<script src="' . $this->processJsFile($this->backPath . 'contrib/extjs/adapter/' . ($this->enableExtJsDebug ? str_replace('.js', '-debug.js', $this->extJSadapter) : $this->extJSadapter)) . '" type="text/javascript"></script>' . LF;
$out .= '<script src="' . $this->processJsFile($this->backPath . 'contrib/extjs/ext-all' . ($this->enableExtJsDebug ? '-debug' : '') . '.js') . '" type="text/javascript"></script>' . LF;
// add extJS localization
$localeMap = $this->csConvObj->isoArray;
// load standard ISO mapping and modify for use with ExtJS
$localeMap[''] = 'en';
$localeMap['default'] = 'en';
$localeMap['gr'] = 'el_GR';
// Greek
$localeMap['no'] = 'no_BO';
// Norwegian Bokmaal
$localeMap['se'] = 'se_SV';
// Swedish
$extJsLang = isset($localeMap[$this->lang]) ? $localeMap[$this->lang] : $this->lang;
// TODO autoconvert file from UTF8 to current BE charset if necessary!!!!
$extJsLocaleFile = 'contrib/extjs/locale/ext-lang-' . $extJsLang . '.js';
if (file_exists(PATH_typo3 . $extJsLocaleFile)) {
$out .= '<script src="' . $this->processJsFile($this->backPath . $extJsLocaleFile) . '" type="text/javascript" charset="utf-8"></script>' . LF;
}
// remove extjs from JScodeLibArray
unset($this->jsFiles[$this->backPath . 'contrib/extjs/ext-all.js'], $this->jsFiles[$this->backPath . 'contrib/extjs/ext-all-debug.js']);
}
// Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:
if ($this->getCharSet() !== 'utf-8') {
if ($this->inlineLanguageLabels) {
$this->csConvObj->convArray($this->inlineLanguageLabels, $this->getCharSet(), 'utf-8');
}
if ($this->inlineSettings) {
$this->csConvObj->convArray($this->inlineSettings, $this->getCharSet(), 'utf-8');
}
}
$inlineSettings = $this->inlineLanguageLabels ? 'TYPO3.lang = ' . json_encode($this->inlineLanguageLabels) . ';' : '';
$inlineSettings .= $this->inlineSettings ? 'TYPO3.settings = ' . json_encode($this->inlineSettings) . ';' : '';
if ($this->addExtCore || $this->addExtJS) {
// set clear.gif, move it on top, add handler code
$code = '';
if (count($this->extOnReadyCode)) {
foreach ($this->extOnReadyCode as $block) {
$code .= $block;
}
}
$out .= $this->inlineJavascriptWrap[0] . '
Ext.ns("TYPO3");
Ext.BLANK_IMAGE_URL = "' . htmlspecialchars(t3lib_div::locationHeaderUrl($this->backPath . 'gfx/clear.gif')) . '";' . LF . $inlineSettings . 'Ext.onReady(function() {' . ($this->enableExtJSQuickTips ? 'Ext.QuickTips.init();' . LF : '') . $code . ' });' . $this->inlineJavascriptWrap[1];
unset($this->extOnReadyCode);
if ($this->extJStheme) {
if (isset($GLOBALS['TBE_STYLES']['extJS']['theme'])) {
$this->addCssFile($this->backPath . $GLOBALS['TBE_STYLES']['extJS']['theme'], 'stylesheet', 'all', '', TRUE, TRUE);
} else {
$this->addCssFile($this->backPath . 'contrib/extjs/resources/css/xtheme-blue.css', 'stylesheet', 'all', '', TRUE, TRUE);
}
}
if ($this->extJScss) {
if (isset($GLOBALS['TBE_STYLES']['extJS']['all'])) {
$this->addCssFile($this->backPath . $GLOBALS['TBE_STYLES']['extJS']['all'], 'stylesheet', 'all', '', TRUE, TRUE);
} else {
$this->addCssFile($this->backPath . 'contrib/extjs/resources/css/ext-all-notheme.css', 'stylesheet', 'all', '', TRUE, TRUE);
}
}
} else {
//.........这里部分代码省略.........
示例8: renderXMLSitemap
/**
* Generates a XML sitemap from the page structure
*
* @param string the content to be filled, usually empty
* @param array additional configuration parameters
* @return string the XML sitemap ready to render
*/
public function renderXMLSitemap($content, $conf)
{
$this->conf = $conf;
$id = intval($GLOBALS['TSFE']->id);
$depth = 50;
$additionalFields = 'uid,pid,doktype,shortcut,crdate,SYS_LASTCHANGED';
$baseURL = $this->getBaseUrl();
$baseURLParts = parse_url($baseURL);
$currentHostname = $baseURLParts['host'];
// -- do a 301 redirect to the "main" sitemap.xml if not already there
if ($this->conf['redirectToMainSitemap'] && $baseURL) {
$sitemapURL = $baseURL . 'sitemap.xml';
$requestURL = t3lib_div::getIndpEnv('TYPO3_REQUEST_URL');
if ($requestURL != $sitemapURL && strpos($requestURL, 'sitemap.xml')) {
header('Location: ' . t3lib_div::locationHeaderUrl($sitemapURL), true, 301);
}
}
// Initializing the tree object
$treeStartingRecord = $GLOBALS['TSFE']->sys_page->getRawRecord('pages', $id, $additionalFields);
// now we need to see if this page is a redirect from the parent page
// and loop while parentid is not null and the parent is still a redirect
$parentId = $treeStartingRecord['pid'];
while ($parentId > 0) {
$parentRecord = $GLOBALS['TSFE']->sys_page->getRawRecord('pages', $parentId, $additionalFields);
// check for shortcuts
if ($this->conf['resolveMainShortcut'] == 1) {
if ($parentRecord['doktype'] == 4 && ($parentRecord['shortcut'] == $id || $parentRecord['shortcut_mode'] > 0)) {
$treeStartingRecord = $parentRecord;
$id = $parentId = $parentRecord['pid'];
} else {
break;
}
} else {
// just traverse the rootline up
$treeStartingRecord = $parentRecord;
$id = $parentId = $parentRecord['pid'];
}
}
$tree = t3lib_div::makeInstance('t3lib_pageTree');
$tree->addField('SYS_LASTCHANGED', 1);
$tree->addField('crdate', 1);
$tree->addField('no_search', 1);
$tree->addField('doktype', 1);
$tree->addField('nav_hide', 1);
// disable recycler and everything below
$tree->init('AND doktype!=255' . $GLOBALS['TSFE']->sys_page->enableFields('pages'));
// create the tree from starting point
$tree->getTree($id, $depth, '');
$treeRecords = $tree->tree;
array_unshift($treeRecords, array('row' => $treeStartingRecord));
foreach ($treeRecords as $row) {
$item = $row['row'];
// don't render spacers, sysfolders etc, and the ones that have the
// "no_search" checkbox
if ($item['doktype'] >= 199 || intval($item['no_search']) == 1) {
continue;
}
// remove "hide-in-menu" items
if ($this->conf['renderHideInMenu'] == 0 && intval($item['nav_hide']) == 1) {
continue;
}
$conf = array('parameter' => $item['uid']);
// also allow different languages
if (!empty($GLOBALS['TSFE']->sys_language_uid)) {
$conf['additionalParams'] = '&L=' . $GLOBALS['TSFE']->sys_language_uid;
}
// create the final URL
$url = $GLOBALS['TSFE']->cObj->typoLink_URL($conf);
$urlParts = parse_url($url);
if (!$urlParts['host']) {
$url = $baseURL . ltrim($url, '/');
}
$url = htmlspecialchars($url);
if (isset($this->usedUrls[$url])) {
continue;
}
$lastmod = $item['SYS_LASTCHANGED'] ? $item['SYS_LASTCHANGED'] : $item['crdate'];
// format date, see http://www.w3.org/TR/NOTE-datetime for possible formats
$lastmod = date('c', $lastmod);
$this->usedUrls[$url] = array('url' => $url, 'lastmod' => $lastmod);
}
// check for additional pages
$additionalPages = trim($this->conf['scrapeLinksFromPages']);
if ($additionalPages) {
$additionalPages = t3lib_div::trimExplode(',', $additionalPages, TRUE);
if (count($additionalPages)) {
$additionalSubpagesOfPages = $this->conf['scrapeLinksFromPages.']['includingSubpages'];
$additionalSubpagesOfPages = t3lib_div::trimExplode(',', $additionalSubpagesOfPages);
$this->fetchAdditionalUrls($additionalPages, $additionalSubpagesOfPages);
}
}
// creating the XML output
$content = '';
//.........这里部分代码省略.........
示例9: generateAndSendHash
/**
* generates a hashed link and send it with email
*
* @param array $user contains user data
* @return string Empty string with success, error message with no success
*/
protected function generateAndSendHash($user)
{
$hours = intval($this->conf['forgotLinkHashValidTime']) > 0 ? intval($this->conf['forgotLinkHashValidTime']) : 24;
$validEnd = time() + 3600 * $hours;
$validEndString = date($this->conf['dateFormat'], $validEnd);
$hash = md5(t3lib_div::generateRandomBytes(64));
$randHash = $validEnd . '|' . $hash;
$randHashDB = $validEnd . '|' . md5($hash);
//write hash to DB
$res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('fe_users', 'uid=' . $user['uid'], array('felogin_forgotHash' => $randHashDB));
// send hashlink to user
$this->conf['linkPrefix'] = -1;
$isAbsRelPrefix = !empty($GLOBALS['TSFE']->absRefPrefix);
$isBaseURL = !empty($GLOBALS['TSFE']->baseUrl);
$isFeloginBaseURL = !empty($this->conf['feloginBaseURL']);
$link = $this->pi_getPageLink($GLOBALS['TSFE']->id, '', array($this->prefixId . '[user]' => $user['uid'], $this->prefixId . '[forgothash]' => $randHash));
// Prefix link if necessary
if ($isFeloginBaseURL) {
// First priority, use specific base URL
// "absRefPrefix" must be removed first, otherwise URL will be prepended twice
if (!empty($GLOBALS['TSFE']->absRefPrefix)) {
$link = substr($link, strlen($GLOBALS['TSFE']->absRefPrefix));
}
$link = $this->conf['feloginBaseURL'] . $link;
} elseif ($isAbsRelPrefix) {
// Second priority
// absRefPrefix must not necessarily contain a hostname and URL scheme, so add it if needed
$link = t3lib_div::locationHeaderUrl($link);
} elseif ($isBaseURL) {
// Third priority
// Add the global base URL to the link
$link = $GLOBALS['TSFE']->baseUrlWrap($link);
} else {
// no prefix is set, return the error
return $this->pi_getLL('ll_change_password_nolinkprefix_message');
}
$msg = sprintf($this->pi_getLL('ll_forgot_validate_reset_password', '', 0), $user['username'], $link, $validEndString);
// no RDCT - Links for security reasons
$oldSetting = $GLOBALS['TSFE']->config['config']['notification_email_urlmode'];
$GLOBALS['TSFE']->config['config']['notification_email_urlmode'] = 0;
// send the email
$this->cObj->sendNotifyEmail($msg, $user['email'], '', $this->conf['email_from'], $this->conf['email_fromName'], $this->conf['replyTo']);
// restore settings
$GLOBALS['TSFE']->config['config']['notification_email_urlmode'] = $oldSetting;
return '';
}
示例10: showSingleCollection
/**
* Builds a collection's list
*
* @access protected
*
* @param integer $id: The collection's UID
*
* @return void
*/
protected function showSingleCollection($id)
{
// Should user-defined collections be shown?
if (empty($this->conf['show_userdefined'])) {
$additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
} elseif ($this->conf['show_userdefined'] > 0) {
$additionalWhere = ' AND NOT tx_dlf_collections.fe_cruser_id=0';
}
// Get all documents in collection.
$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('tx_dlf_collections.index_name AS index_name,tx_dlf_collections.label AS collLabel,tx_dlf_collections.description AS collDesc,tx_dlf_collections.thumbnail AS collThumb,tx_dlf_collections.fe_cruser_id AS userid,tx_dlf_documents.uid AS uid,tx_dlf_documents.metadata_sorting AS metadata_sorting,tx_dlf_documents.volume_sorting AS volume_sorting,tx_dlf_documents.partof AS partof', 'tx_dlf_documents', 'tx_dlf_relations', 'tx_dlf_collections', 'AND tx_dlf_collections.uid=' . intval($id) . ' AND tx_dlf_collections.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations') . $additionalWhere . tx_dlf_helper::whereClause('tx_dlf_documents') . tx_dlf_helper::whereClause('tx_dlf_collections'), '', 'tx_dlf_documents.title_sorting ASC', '');
$toplevel = array();
$subparts = array();
$listMetadata = array();
// Process results.
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
if (empty($listMetadata)) {
$listMetadata = array('label' => htmlspecialchars($resArray['collLabel']), 'description' => $this->pi_RTEcssText($resArray['collDesc']), 'thumbnail' => htmlspecialchars($resArray['collThumb']), 'options' => array('source' => 'collection', 'select' => $id, 'userid' => $resArray['userid'], 'params' => array('fq' => array('collection_faceting:"' . $resArray['index_name'] . '"')), 'core' => '', 'pid' => $this->conf['pages'], 'order' => 'title', 'order.asc' => TRUE));
}
// Split toplevel documents from volumes.
if ($resArray['partof'] == 0) {
// Prepare document's metadata for sorting.
$sorting = unserialize($resArray['metadata_sorting']);
if (!empty($sorting['type']) && tx_dlf_helper::testInt($sorting['type'])) {
$sorting['type'] = tx_dlf_helper::getIndexName($sorting['type'], 'tx_dlf_structures', $this->conf['pages']);
}
if (!empty($sorting['owner']) && tx_dlf_helper::testInt($sorting['owner'])) {
$sorting['owner'] = tx_dlf_helper::getIndexName($sorting['owner'], 'tx_dlf_libraries', $this->conf['pages']);
}
if (!empty($sorting['collection']) && tx_dlf_helper::testInt($sorting['collection'])) {
$sorting['collection'] = tx_dlf_helper::getIndexName($sorting['collection'], 'tx_dlf_collections', $this->conf['pages']);
}
$toplevel[$resArray['uid']] = array('u' => $resArray['uid'], 's' => $sorting, 'p' => array());
} else {
$subparts[$resArray['partof']][$resArray['volume_sorting']] = $resArray['uid'];
}
}
// Add volumes to the corresponding toplevel documents.
foreach ($subparts as $partof => $parts) {
if (!empty($toplevel[$partof])) {
ksort($parts);
$toplevel[$partof]['p'] = array_values($parts);
}
}
// Save list of documents.
$list = t3lib_div::makeInstance('tx_dlf_list');
$list->reset();
$list->add(array_values($toplevel));
$list->metadata = $listMetadata;
$list->save();
// Clean output buffer.
t3lib_div::cleanOutputBuffers();
// Send headers.
header('Location: ' . t3lib_div::locationHeaderUrl($this->cObj->typoLink_URL(array('parameter' => $this->conf['targetPid']))));
// Flush output buffer and end script processing.
ob_end_flush();
exit;
}
示例11: fillDefaultMarkers
/**
* Substitutes default markers in $this->template.
*
* @return void
*/
protected function fillDefaultMarkers()
{
$parameters = t3lib_div::_GET();
if (isset($parameters['id'])) {
unset($parameters['id']);
}
$path = $this->pi_getPageLink($GLOBALS['TSFE']->id, '', $parameters);
$path = htmlspecialchars($path);
$markers = array();
$markers['###REL_URL###'] = $path;
$markers['###TIMESTAMP###'] = time();
$markers['###RANDOM_ID###'] = $this->gp['randomID'];
$markers['###ABS_URL###'] = t3lib_div::locationHeaderUrl('') . $path;
$markers['###rel_url###'] = $markers['###REL_URL###'];
$markers['###timestamp###'] = $markers['###TIMESTAMP###'];
$markers['###abs_url###'] = $markers['###ABS_URL###'];
$name = 'submitted';
if (Tx_Formhandler_Globals::$formValuesPrefix) {
$name = Tx_Formhandler_Globals::$formValuesPrefix . '[submitted]';
}
$markers['###HIDDEN_FIELDS###'] = '
<input type="hidden" name="id" value="' . $GLOBALS['TSFE']->id . '" />
<input type="hidden" name="' . $name . '" value="1" />
';
$name = 'randomID';
if (Tx_Formhandler_Globals::$formValuesPrefix) {
$name = Tx_Formhandler_Globals::$formValuesPrefix . '[randomID]';
}
$markers['###HIDDEN_FIELDS###'] .= '
<input type="hidden" name="' . $name . '" value="' . $this->gp['randomID'] . '" />
';
$name = 'removeFile';
if (Tx_Formhandler_Globals::$formValuesPrefix) {
$name = Tx_Formhandler_Globals::$formValuesPrefix . '[removeFile]';
}
$markers['###HIDDEN_FIELDS###'] .= '
<input type="hidden" id="removeFile-' . $this->gp['randomID'] . '" name="' . $name . '" value="" />
';
$name = 'removeFileField';
if (Tx_Formhandler_Globals::$formValuesPrefix) {
$name = Tx_Formhandler_Globals::$formValuesPrefix . '[removeFileField]';
}
$markers['###HIDDEN_FIELDS###'] .= '
<input type="hidden" id="removeFileField-' . $this->gp['randomID'] . '" name="' . $name . '" value="" />
';
$name = 'submitField';
if (Tx_Formhandler_Globals::$formValuesPrefix) {
$name = Tx_Formhandler_Globals::$formValuesPrefix . '[submitField]';
}
$markers['###HIDDEN_FIELDS###'] .= '
<input type="hidden" id="submitField-' . $this->gp['randomID'] . '" name="' . $name . '" value="" />
';
$markers['###formValuesPrefix###'] = Tx_Formhandler_Globals::$formValuesPrefix;
if ($this->gp['generated_authCode']) {
$markers['###auth_code###'] = $this->gp['generated_authCode'];
}
$markers['###ip###'] = t3lib_div::getIndpEnv('REMOTE_ADDR');
$markers['###IP###'] = $markers['###ip###'];
$markers['###submission_date###'] = date('d.m.Y H:i:s', time());
$markers['###pid###'] = $GLOBALS['TSFE']->id;
$markers['###PID###'] = $markers['###pid###'];
// current step
$currentStepFromSession = Tx_Formhandler_Globals::$session->get('currentStep');
$markers['###curStep###'] = $currentStepFromSession;
// maximum step/number of steps
$markers['###maxStep###'] = Tx_Formhandler_Globals::$session->get('totalSteps');
// the last step shown
$markers['###lastStep###'] = Tx_Formhandler_Globals::$session->get('lastStep');
$name = 'step-';
$prefix = Tx_Formhandler_Globals::$formValuesPrefix;
if ($prefix) {
$name = $prefix . '[' . $name . '#step#-#action#]';
} else {
$name = $name . '#step#-#action#';
}
// submit name for next page
$nextName = ' name="' . str_replace('#action#', 'next', $name) . '" ';
$nextName = str_replace('#step#', $currentStepFromSession + 1, $nextName);
$markers['###submit_nextStep###'] = $nextName;
// submit name for previous page
$prevName = ' name="' . str_replace('#action#', 'prev', $name) . '" ';
$prevName = str_replace('#step#', $currentStepFromSession - 1, $prevName);
$markers['###submit_prevStep###'] = $prevName;
// submits for next/prev steps with template suffix
preg_match_all('/###submit_nextStep_[^#]+?###/Ssm', $this->template, $allNextSubmits);
foreach ($allNextSubmits[0] as $nextSubmitSuffix) {
$nextSubmitSuffix = substr($nextSubmitSuffix, 19, -3);
$nextName = ' name="' . str_replace('#action#', 'next', $name) . '[' . $nextSubmitSuffix . ']" ';
$nextName = str_replace('#step#', $currentStepFromSession + 1, $nextName);
$markers['###submit_nextStep_' . $nextSubmitSuffix . '###'] = $nextName;
}
preg_match_all('/###submit_prevStep_[^#]+?###/Ssm', $this->template, $allPrevSubmits);
foreach ($allPrevSubmits[0] as $prevSubmitSuffix) {
$prevSubmitSuffix = substr($prevSubmitSuffix, 19, -3);
$prevName = ' name="' . str_replace('#action#', 'prev', $name) . '[' . $prevSubmitSuffix . ']" ';
//.........这里部分代码省略.........
示例12: locationHeaderUrl
/**
* @param $path
* @return mixed
* @seee t3lib_div::locationHeaderUrl()
*/
public function locationHeaderUrl($path)
{
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::locationHeaderUrl($path);
}
示例13: login
/**
* Perform user login and redirect to configured url, if any
*
* @param array $row: incoming setfixed parameters
* @param boolen $redirect: whether to redirect after login or not
* @return boolean TRUE, if login was successful, FALSE otherwise
*/
public function login($conf, $langObj, $controlData, array $row, $redirect = TRUE)
{
$result = TRUE;
// Log the user in
$loginData = array('uname' => $row['username'], 'uident' => $row['password'], 'uident_text' => $row['password'], 'status' => 'login');
// Check against configured pid (defaulting to current page)
$GLOBALS['TSFE']->fe_user->checkPid = TRUE;
$GLOBALS['TSFE']->fe_user->checkPid_value = $controlData->getPid();
// Get authentication info array
$authInfo = $GLOBALS['TSFE']->fe_user->getAuthInfoArray();
// Get user info
$user = $GLOBALS['TSFE']->fe_user->fetchUserRecord($authInfo['db_user'], $loginData['uname']);
if (is_array($user)) {
// Get the appropriate authentication service
$authServiceObj = t3lib_div::makeInstanceService('auth', 'authUserFE');
// Check authentication
if (is_object($authServiceObj)) {
$ok = $authServiceObj->compareUident($user, $loginData);
if ($ok) {
// Login successfull: create user session
$GLOBALS['TSFE']->fe_user->createUserSession($user);
$GLOBALS['TSFE']->initUserGroups();
$GLOBALS['TSFE']->fe_user->user = $GLOBALS['TSFE']->fe_user->fetchUserSession();
$GLOBALS['TSFE']->loginUser = 1;
// Delete regHash
if ($controlData->getValidRegHash()) {
$regHash = $controlData->getRegHash();
$controlData->deleteShortUrl($regHash);
}
if ($redirect) {
// Redirect to configured page, if any
$redirectUrl = $controlData->readRedirectUrl();
if (!$redirectUrl) {
$redirectUrl = trim($conf['autoLoginRedirect_url']);
}
if (!$redirectUrl) {
if ($conf['loginPID']) {
$redirectUrl = $this->urlObj->get('', $conf['loginPID']);
} else {
$redirectUrl = $controlData->getSiteUrl();
}
}
header('Location: ' . t3lib_div::locationHeaderUrl($redirectUrl));
}
} else {
// Login failed...
$controlData->clearSessionData(FALSE);
$result = FALSE;
}
} else {
// Required authentication service not available
$message = $langObj->getLL('internal_required_authentication_service_not_available');
t3lib_div::sysLog($message, $controlData->getExtKey(), t3lib_div::SYSLOG_SEVERITY_ERROR);
$controlData->clearSessionData(FALSE);
$result = FALSE;
}
} else {
// No enabled user of the given name
$controlData->clearSessionData(FALSE);
$result = FALSE;
}
return $result;
}
示例14: renderTO_editProcessing
//.........这里部分代码省略.........
// Get BODY content for caching:
$contentSplittedByMapping=$this->markupObj->splitContentToMappingInfo($fileContent,$currentMappingInfo);
$templatemapping['MappingData_cached'] = $contentSplittedByMapping['sub']['ROOT'];
// Get HEAD content for caching:
list($html_header) = $this->markupObj->htmlParse->getAllParts($htmlParse->splitIntoBlock('head',$fileContent),1,0);
$this->markupObj->tags = $this->head_markUpTags; // Set up the markupObject to process only header-section tags:
$h_currentMappingInfo=array();
if (is_array($currentMappingInfo_head['headElementPaths'])) {
foreach($currentMappingInfo_head['headElementPaths'] as $kk => $vv) {
$h_currentMappingInfo['el_'.$kk]['MAP_EL'] = $vv;
}
}
$contentSplittedByMapping = $this->markupObj->splitContentToMappingInfo($html_header,$h_currentMappingInfo);
$templatemapping['MappingData_head_cached'] = $contentSplittedByMapping;
// Get <body> tag:
$reg='';
preg_match('/<body[^>]*>/i',$fileContent,$reg);
$templatemapping['BodyTag_cached'] = $currentMappingInfo_head['addBodyTag'] ? $reg[0] : '';
$TOuid = t3lib_BEfunc::wsMapId('tx_templavoila_tmplobj',$row['uid']);
$dataArr['tx_templavoila_tmplobj'][$TOuid]['templatemapping'] = serialize($templatemapping);
$dataArr['tx_templavoila_tmplobj'][$TOuid]['fileref_mtime'] = @filemtime($theFile);
$dataArr['tx_templavoila_tmplobj'][$TOuid]['fileref_md5'] = @md5_file($theFile);
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$tce->stripslashes_values=0;
$tce->start($dataArr,array());
$tce->process_datamap();
unset($tce);
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('msgMappingSaved'),
'',
t3lib_FlashMessage::OK
);
$msg[] .= $flashMessage->render();
$row = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj',$this->displayUid);
$templatemapping = unserialize($row['templatemapping']);
if (t3lib_div::_GP('_save_to_return')) {
header('Location: '.t3lib_div::locationHeaderUrl($this->returnUrl));
exit;
}
}
// Making the menu
$menuItems=array();
$menuItems[]='<input type="submit" name="_clear" value="' . $GLOBALS['LANG']->getLL('buttonClearAll') . '" title="' . $GLOBALS['LANG']->getLL('buttonClearAllMappingTitle') . '" />';
// Make either "Preview" button (body) or "Set" button (header)
if ($headerPart) { // Header:
$menuItems[] = '<input type="submit" name="_save_data_mapping" value="' . $GLOBALS['LANG']->getLL('buttonSet') . '" title="' . $GLOBALS['LANG']->getLL('buttonSetTitle') . '" />';
} else { // Body:
$menuItems[] = '<input type="submit" name="_preview" value="' . $GLOBALS['LANG']->getLL('buttonPreview') . '" title="' . $GLOBALS['LANG']->getLL('buttonPreviewMappingTitle') . '" />';
}
$menuItems[]='<input type="submit" name="_save_to" value="' . $GLOBALS['LANG']->getLL('buttonSave') . '" title="' . $GLOBALS['LANG']->getLL('buttonSaveTOTitle') . '" />';
if ($this->returnUrl) {
$menuItems[]='<input type="submit" name="_save_to_return" value="' . $GLOBALS['LANG']->getLL('buttonSaveAndReturn') . '" title="' . $GLOBALS['LANG']->getLL('buttonSaveAndReturnTitle') . '" />';
}
// If a difference is detected...:
if (
(serialize($templatemapping['MappingInfo_head']) != serialize($currentMappingInfo_head)) ||
(serialize($templatemapping['MappingInfo']) != serialize($currentMappingInfo))
) {
$menuItems[]='<input type="submit" name="_reload_from" value="' . $GLOBALS['LANG']->getLL('buttonRevert') . '" title="'.sprintf($GLOBALS['LANG']->getLL('buttonRevertTitle'), $headerPart ? 'HEAD' : 'BODY') . '" />';
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('msgMappingIsDifferent'),
'',
t3lib_FlashMessage::INFO
);
$msg[] .= $flashMessage->render();
}
$content = '
<!--
Menu for saving Template Objects
-->
<table border="0" cellpadding="2" cellspacing="2" id="c-toMenu">
<tr class="bgColor5">
<td>'.implode('</td>
<td>',$menuItems).'</td>
</tr>
</table>
';
// @todo - replace with FlashMessage Queue
$content .= implode('', $msg);
return array($content, $headerPart ? $currentMappingInfo_head : $currentMappingInfo);
}
示例15: handleSubmittedForm
//.........这里部分代码省略.........
// Remember the internal fields that have changed
if (!empty($fieldConf['internal'])) {
if (strlen($changedInternalFields)) {
$changedInternalFields .= ',';
}
$changedInternalFields .= $fieldConf['name'];
}
}
}
// If a comment has been submitted, process it now.
// Comments are not normal fields but have an own table, so we
// cannot process them like the ticket fields.
// Remember the fields that have changed for the notification mail.
if (isset($this->piVars['content']) && !empty($this->piVars['content'])) {
$saveCommentStatus = $this->handleSubmittedCommentForm();
// if the ticket currently is closed, re-open it.
if (stristr($this->internal['currentRow']['status'], CONST_STATUS_CLOSED)) {
// change the status
$this->insertFields['status'] = CONST_STATUS_OPEN;
// add the information to changedFields list
$changedFields = $this->addToCommaList($changedFields, CONST_REOPENANDCOMMENT);
// add a history entry
$this->addHistoryEntry(array('ticket_uid' => $this->internal['currentRow']['uid'], 'databasefield' => 'status', 'value_old' => $this->internal['currentRow']['status'], 'value_new' => CONST_STATUS_OPEN));
} else {
// if the status is currentyl "wait", set the status to the value
// defined in typoscript
// only do so if the status has not been changed by the user.
if ($this->conf['changeWaitStatusOnNewComment'] && $this->internal['currentRow']['status'] == CONST_STATUS_WAIT && $this->insertFields['status'] == $this->internal['currentRow']['status'] && t3lib_div::inList($this->conf['statusList'], $this->conf['changeWaitStatusOnNewComment'])) {
// change the status
$this->insertFields['status'] = $this->conf['changeWaitStatusOnNewComment'];
// add the information to changedFields list
$changedFields = $this->addToCommaList($changedFields, 'status');
// add a history entry
$this->addHistoryEntry(array('ticket_uid' => $this->internal['currentRow']['uid'], 'databasefield' => 'status', 'value_old' => $this->internal['currentRow']['status'], 'value_new' => $this->conf['changeWaitStatusOnNewComment']));
}
$changedFields = $this->addToCommaList($changedFields, CONST_NEWCOMMENT);
}
}
// get ticket progress
$newStatus = $this->insertFields['status'];
if ($newStatus == CONST_STATUS_CLOSED || $newStatus == CONST_STATUS_CLOSED_LOCKED) {
$this->insertFields['progress'] = 100;
} else {
$this->insertFields['progress'] = $this->lib->getTicketProgressFromToDo($this->internal['currentRow']['uid']);
}
if ($this->insertFields['progress'] != $this->internal['currentRow']['progress']) {
$changedFields = $this->addToCommaList($changedFields, 'progress');
}
// exec update database query
$saveFieldsStatus = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($this->tablename, 'uid=' . $this->internal['currentRow']['uid'], $this->insertFields) ? true : false;
// hook: after updating a ticket
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_troubletickets']['afterTicketUpdate'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_troubletickets']['afterTicketUpdate'] as $_classRef) {
$_procObj =& t3lib_div::getUserObj($_classRef);
$_procObj->afterTicketUpdate($this->internal['currentRow']['uid'], $this);
}
}
// send the notification emails
$this->checkChangesAndSendNotificationEmails($this->internal['currentRow']['uid'], $changedFields, $changedInternalFields);
// check if saving of fields and comments went fine
// and set status texts
// fields changed and new comment
if (!empty($changedFields) && strstr($changedFields, CONST_NEWCOMMENT) && trim($changedFields) != CONST_NEWCOMMENT || !empty($changedInternalFields) && strstr($changedFields, CONST_NEWCOMMENT)) {
if ($saveFieldsStatus && $saveCommentStatus) {
$this->markerArray['STATUS_CSS_CLASS'] = 'status_ok';
$this->markerArray['STATUS_MESSAGE_TEXT'] = $this->pi_getLL('status_fields_and_comment');
}
} else {
if (empty($changedInternalFields) && trim($changedFields) == CONST_NEWCOMMENT) {
if ($saveCommentStatus) {
$this->markerArray['STATUS_CSS_CLASS'] = 'status_ok';
$this->markerArray['STATUS_MESSAGE_TEXT'] = $this->pi_getLL('status_comment_only');
}
} else {
if (!empty($changedFields) && !strstr($changedFields, CONST_NEWCOMMENT) || !empty($changedInternalFields)) {
if ($saveFieldsStatus) {
$this->markerArray['STATUS_CSS_CLASS'] = 'status_ok';
$this->markerArray['STATUS_MESSAGE_TEXT'] = $this->pi_getLL('status_fields_only');
}
}
}
}
}
// process redirect if activated and back pid set
// AK, 13.08.2010
if ($this->conf['listView.']['backPidRedirect.']['activated'] && $this->piVars['backPid']) {
// extend the status message with redirection notice
$this->markerArray['STATUS_MESSAGE_TEXT'] .= ' ' . sprintf($this->pi_getLL('status_additional_redirect'), $this->conf['listView.']['backPidRedirect.']['wait']);
// generate redirect link
unset($linkconf);
$linkconf['parameter'] = $this->piVars['backPid'];
$linkconf['useCacheHash'] = false;
$redirectLink = $this->cObj->typoLink_URL($linkconf);
// generate location header url
$redirectUrl = t3lib_div::locationHeaderUrl($redirectLink);
// process redirect
header("Refresh: " . $this->conf['listView.']['backPidRedirect.']['wait'] . "; " . $redirectUrl);
}
}
}