本文整理汇总了PHP中System::getReferer方法的典型用法代码示例。如果您正苦于以下问题:PHP System::getReferer方法的具体用法?PHP System::getReferer怎么用?PHP System::getReferer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System::getReferer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: current
public function current()
{
if (version_compare(VERSION, '3', '>=')) {
return System::getReferer();
} else {
return $this->getReferer();
}
}
示例2: generateForm
/**
* @param \NotificationCenter\Model\Notification[] $notifications
* @param int[] $ids
*
* @return string
*/
public static function generateForm(array $notifications, array $ids)
{
$return = '
<div id="tl_buttons">
<a href="' . \System::getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>
<h2 class="sub_headline">' . $GLOBALS['TL_LANG']['tl_lead']['notification'][0] . '</h2>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_leads_notification" class="tl_form" method="post">
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="tl_leads_notification">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<input type="hidden" name="IDS[]" value="' . implode('">
<input type="hidden" name="IDS[]" value="', $ids) . '">
<div class="tl_tbox">
<h3><label for="notification">' . $GLOBALS['TL_LANG']['tl_lead']['notification_list'][0] . '</label></h3>
<select name="notification" id="notification" class="tl_select">';
// Generate options
foreach ($notifications as $id => $name) {
$return .= '<option value="' . $id . '">' . $name . '</option>';
}
$return .= '
</select>
<p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_lead']['notification_list'][1] . '</p>
</div>
</div>
<div class="tl_formbody_submit">
<div class="tl_submit_container">
<input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['tl_lead']['notification'][0]) . '">
</div>
</div>
</form>';
return $return;
}
示例3: parentView
/**
* Show header of the parent table and list all records of the current table
* @return string
*/
protected function parentView()
{
$blnClipboard = false;
$arrClipboard = $this->Session->get('CLIPBOARD');
$blnHasSorting = false;
$blnMultiboard = false;
// Check clipboard
if (!empty($arrClipboard[$this->strTable])) {
$blnClipboard = true;
$arrClipboard = $arrClipboard[$this->strTable];
if (is_array($arrClipboard['id'])) {
$blnMultiboard = true;
}
}
// Load the fonts to display the paste hint
$GLOBALS['TL_CONFIG']['loadGoogleFonts'] = $blnClipboard;
$strBackUrl = \Input::get('id') ? 'contao/main.php?do=iso_products' : \System::getReferer(true, $this->ptable);
$return = '
<div id="tl_buttons">' . (\Input::get('nb') ? ' ' : '
<a href="' . $strBackUrl . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>') . ' ' . (!$blnClipboard ? \Input::get('act') != 'select' ? (!$GLOBALS['TL_DCA'][$this->strTable]['config']['closed'] && !$GLOBALS['TL_DCA'][$this->strTable]['config']['notCreatable'] ? '
<a href="' . $this->addToUrl($blnHasSorting ? 'act=paste&mode=create' : 'act=create&mode=2&pid=' . $this->intId) . '" class="header_new" title="' . specialchars($GLOBALS['TL_LANG'][$this->strTable]['new'][1]) . '" accesskey="n" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG'][$this->strTable]['new'][0] . '</a> ' : '') . $this->generateGlobalButtons() : '' : '<a href="' . $this->addToUrl('clipboard=1') . '" class="header_clipboard" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['clearClipboard']) . '" accesskey="x">' . $GLOBALS['TL_LANG']['MSC']['clearClipboard'] . '</a> ') . '
</div>' . \Message::generate(true);
// Get all details of the parent record
$objParent = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE id=?")->limit(1)->execute(CURRENT_ID);
if ($objParent->numRows < 1) {
return $return;
}
$return .= (\Input::get('act') == 'select' ? '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_select" class="tl_form" method="post">
<div class="tl_formbody">
<input type="hidden" name="FORM_SUBMIT" value="tl_select">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">' : '') . ($blnClipboard ? '
<div id="paste_hint">
<p>' . $GLOBALS['TL_LANG']['MSC']['selectNewPosition'] . '</p>
</div>' : '') . '
<div class="tl_listing_container iso_listing_container parent_view">
<div class="tl_header click2edit" onmouseover="Theme.hoverDiv(this,1)" onmouseout="Theme.hoverDiv(this,0)">';
// List all records of the child table
if (!\Input::get('act') || \Input::get('act') == 'paste' || \Input::get('act') == 'select') {
$imagePasteAfter = \Image::getHtml('pasteafter.gif', $GLOBALS['TL_LANG'][$this->strTable]['pasteafter'][0]);
$imageEditHeader = \Image::getHtml('edit.gif', $GLOBALS['TL_LANG'][$this->strTable]['edit'][0]);
$strEditHeader = $GLOBALS['TL_LANG'][$this->strTable]['edit'][0];
$return .= '
<div class="tl_content_right">' . (\Input::get('act') == 'select' ? '
<label for="tl_select_trigger" class="tl_select_label">' . $GLOBALS['TL_LANG']['MSC']['selectAll'] . '</label> <input type="checkbox" id="tl_select_trigger" onclick="Backend.toggleCheckboxes(this)" class="tl_tree_checkbox">' : (!$GLOBALS['TL_DCA'][$this->ptable]['config']['notEditable'] ? '
<a href="' . preg_replace('/&(amp;)?table=[^& ]*/i', $this->ptable != '' ? '&table=' . $this->ptable : '', $this->addToUrl('act=edit')) . '" class="edit" title="' . specialchars($strEditHeader) . '">' . $imageEditHeader . '</a>' : '') . ($blnHasSorting && !$GLOBALS['TL_DCA'][$this->strTable]['config']['closed'] && !$GLOBALS['TL_DCA'][$this->strTable]['config']['notCreatable'] ? ' <a href="' . $this->addToUrl('act=create&mode=2&pid=' . $objParent->id . '&id=' . $this->intId) . '" title="' . specialchars($GLOBALS['TL_LANG'][$this->strTable]['pastenew'][0]) . '">' . $imagePasteNew . '</a>' : '') . ($blnClipboard ? ' <a href="' . $this->addToUrl('act=' . $arrClipboard['mode'] . '&mode=2&pid=' . $objParent->id . (!$blnMultiboard ? '&id=' . $arrClipboard['id'] : '')) . '" title="' . specialchars($GLOBALS['TL_LANG'][$this->strTable]['pasteafter'][0]) . '" onclick="Backend.getScrollOffset()">' . $imagePasteAfter . '</a>' : '')) . '
</div>';
// Format header fields
$add = array();
$headerFields = $GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['headerFields'];
foreach ($headerFields as $v) {
$_v = deserialize($objParent->{$v});
if (is_array($_v)) {
$_v = implode(', ', $_v);
} elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['inputType'] == 'checkbox' && !$GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['eval']['multiple']) {
$_v = $_v != '' ? $GLOBALS['TL_LANG']['MSC']['yes'] : $GLOBALS['TL_LANG']['MSC']['no'];
} elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['eval']['rgxp'] == 'date') {
$_v = $_v ? \Date::parse($GLOBALS['TL_CONFIG']['dateFormat'], $_v) : '-';
} elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['eval']['rgxp'] == 'time') {
$_v = $_v ? \Date::parse($GLOBALS['TL_CONFIG']['timeFormat'], $_v) : '-';
} elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['eval']['rgxp'] == 'datim') {
$_v = $_v ? \Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $_v) : '-';
} elseif ($v == 'tstamp') {
$objMaxTstamp = $this->Database->prepare("SELECT MAX(tstamp) AS tstamp FROM " . $this->strTable . " WHERE pid=?")->execute($objParent->id);
if (!$objMaxTstamp->tstamp) {
$objMaxTstamp->tstamp = $objParent->tstamp;
}
$_v = \Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], max($objParent->tstamp, $objMaxTstamp->tstamp));
} elseif (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['foreignKey'])) {
$arrForeignKey = explode('.', $GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['foreignKey'], 2);
$objLabel = $this->Database->prepare("SELECT " . $arrForeignKey[1] . " AS value FROM " . $arrForeignKey[0] . " WHERE id=?")->limit(1)->execute($_v);
if ($objLabel->numRows) {
$_v = $objLabel->value;
}
} elseif (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['reference'][$_v])) {
$_v = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['reference'][$_v][0];
} elseif (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['reference'][$_v])) {
$_v = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['reference'][$_v];
} elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['eval']['isAssociative'] || array_is_assoc($GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['options'])) {
$_v = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$v]['options'][$_v];
}
// Add the sorting field
if ($_v != '') {
$key = isset($GLOBALS['TL_LANG'][$this->strTable][$v][0]) ? $GLOBALS['TL_LANG'][$this->strTable][$v][0] : $v;
$add[$key] = $_v;
}
}
// Trigger the header_callback (see #3417)
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['header_callback'])) {
$strClass = $GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['header_callback'][0];
$strMethod = $GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['header_callback'][1];
$this->import($strClass);
//.........这里部分代码省略.........
示例4: addContextTokens
/**
*
* Add contao core tokens, as long as the cron job does not have these information
* on sending mail in queue mode
*
* @param $arrTokens
* @param $strLanguage
* @return bool false if context_tokens has been set already (required by cron)
*/
protected function addContextTokens($objMessage, &$arrTokens, $strLanguage)
{
// add context tokens only once (queue will trigger this function again, and tokens might be overwritten)
if (isset($arrTokens['context_tokens'])) {
return false;
}
$arrTokens['context_tokens'] = true;
// add environment variables as token
$arrTokens['env_host'] = \Idna::decode(\Environment::get('host'));
$arrTokens['env_http_host'] = \Idna::decode(\Environment::get('httpHost'));
$arrTokens['env_url'] = \Idna::decode(\Environment::get('url'));
$arrTokens['env_path'] = \Idna::decode(\Environment::get('base'));
$arrTokens['env_request'] = \Idna::decode(\Environment::get('indexFreeRequest'));
$arrTokens['env_ip'] = \Idna::decode(\Environment::get('ip'));
$arrTokens['env_referer'] = \System::getReferer();
$arrTokens['env_files_url'] = TL_FILES_URL;
$arrTokens['env_plugins_url'] = TL_ASSETS_URL;
$arrTokens['env_script_url'] = TL_ASSETS_URL;
// add date tokens
$arrTokens['date'] = \Controller::replaceInsertTags('{{date}}');
$arrTokens['last_update'] = \Controller::replaceInsertTags('{{last_update}}');
if (TL_MODE == 'FE') {
// add current page as token
global $objPage;
if ($objPage !== null) {
foreach ($objPage->row() as $key => $value) {
$arrTokens['page_' . $key] = $value;
}
if ($objPage->pageTitle == '') {
$arrTokens['pageTitle'] = $objPage->title;
} else {
if ($objPage->parentPageTitle == '') {
$arrTokens['parentPageTitle'] = $objPage->parentTitle;
} else {
if ($objPage->mainPageTitle == '') {
$arrTokens['mainPageTitle'] = $objPage->mainTitle;
}
}
}
}
// add user attributes as token
if (FE_USER_LOGGED_IN) {
$arrUserData = \FrontendUser::getInstance()->getData();
if (is_array($arrUserData)) {
foreach ($arrUserData as $key => $value) {
if (!is_array($value) && \Validator::isBinaryUuid($value)) {
$value = \StringUtil::binToUuid($value);
$objFile = \FilesModel::findByUuid($value);
if ($objFile !== null) {
$value = $objFile->path;
}
}
$arrTokens['user_' . $key] = $value;
}
}
}
}
}
示例5: callback
/**
* Undo the record manually triggered in the backend
* @param \DataContainer
*/
public function callback(\DataContainer $dc)
{
static::undo($dc->id);
\System::redirect(\System::getReferer());
}
示例6: array
/**
* Contao Open Source CMS
*
* Copyright (C) 2005-2015 Leo Feyer
*
* @copyright Tim Gatzky 2013, Premium Contao Webworks, Premium Contao Themes
* @author Tim Gatzky <info@tim-gatzky.de>
* @package pct_customelements
* @subpackage pct_customelements_plugin_customcatalog
* @subpackage pct_customelements_customcatalog_feeds
* @link http://contao.org
*/
/**
* Load language file
*/
$this->loadLanguageFile('tl_news_feed');
$objDcaHelper = \PCT\CustomElements\Plugins\CustomCatalog\Helper\DcaHelper::getInstance()->setTable('tl_pct_customcatalog_feed');
/**
* Table tl_pct_customcatalog_feed
*/
$GLOBALS['TL_DCA'][$objDcaHelper->getTable()] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'ptable' => 'tl_pct_customelement', 'onload_callback' => array(array('PCT\\CustomCatalog\\Feeds\\TableCustomCatalogFeed', 'generateFeed')), 'onsubmit_callback' => array(array('PCT\\CustomCatalog\\Feeds\\TableCustomCatalogFeed', 'scheduleUpdate')), 'sql' => array('keys' => array('id' => 'primary', 'alias' => 'index')), 'backlink' => \System::getReferer()), 'list' => array('sorting' => array('mode' => 1, 'fields' => array('title'), 'flag' => 1, 'panelLayout' => 'filter;search,limit'), 'label' => array('fields' => array('title'), 'format' => '%s'), 'global_operations' => array('all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'), 'show' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['show'], 'href' => 'act=show', 'icon' => 'show.gif'))));
/**
* Palettes
*/
$arrPalettes = array('title_legend' => array('title', 'alias', 'language'), 'configs_legend' => array('configs', 'jumpTo'), 'export_legend' => array('titleField', 'publishedField', 'descriptionField', 'authorField', 'imageField'), 'config_legend' => array('format', 'maxItems', 'feedBase', 'description'));
$GLOBALS['TL_DCA'][$objDcaHelper->getTable()]['palettes']['default'] = $objDcaHelper->generatePalettes($arrPalettes);
/**
* Fields
*/
$objDcaHelper->addFields(array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'pid' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'title' => array('label' => &$GLOBALS['TL_LANG']['tl_news_feed']['title'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 255), 'sql' => "varchar(255) NOT NULL default ''"), 'alias' => array('label' => &$GLOBALS['TL_LANG']['tl_news_feed']['alias'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'rgxp' => 'alias', 'unique' => true, 'maxlength' => 128, 'tl_class' => 'w50'), 'save_callback' => array(array('PCT\\CustomCatalog\\Feeds\\TableCustomCatalogFeed', 'checkFeedAlias')), 'sql' => "varchar(128) COLLATE utf8_bin NOT NULL default ''"), 'language' => array('label' => &$GLOBALS['TL_LANG']['tl_news_feed']['language'], 'exclude' => true, 'search' => true, 'filter' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 32, 'tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''"), 'configs' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['configs'], 'exclude' => true, 'search' => true, 'inputType' => 'checkbox', 'options_callback' => array('PCT\\CustomCatalog\\Feeds\\TableCustomCatalogFeed', 'getAllowedConfigurations'), 'eval' => array('multiple' => true, 'mandatory' => true), 'sql' => "blob NULL"), 'jumpTo' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['jumpTo'], 'exclude' => true, 'inputType' => 'pageTree', 'eval' => array('tl_class' => '', 'mandatory' => true), 'sql' => "int(10) NOT NULL default '0'"), 'format' => array('label' => &$GLOBALS['TL_LANG']['tl_news_feed']['format'], 'default' => 'rss', 'exclude' => true, 'filter' => true, 'inputType' => 'select', 'options' => array('rss' => 'RSS 2.0', 'atom' => 'Atom'), 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''"), 'maxItems' => array('label' => &$GLOBALS['TL_LANG']['tl_news_feed']['maxItems'], 'default' => 25, 'exclude' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'rgxp' => 'natural', 'tl_class' => 'w50'), 'sql' => "smallint(5) unsigned NOT NULL default '0'"), 'feedBase' => array('label' => &$GLOBALS['TL_LANG']['tl_news_feed']['feedBase'], 'default' => \Environment::get('base'), 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('trailingSlash' => true, 'rgxp' => 'url', 'decodeEntities' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'description' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['description'], 'exclude' => true, 'search' => true, 'inputType' => 'textarea', 'eval' => array('style' => 'height:60px', 'tl_class' => 'clr'), 'sql' => "text NULL"), 'titleField' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['titleField'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => array('PCT\\CustomCatalog\\Feeds\\TableCustomCatalogFeed', 'getTextAttributes'), 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true), 'sql' => "int(10) NOT NULL default '0'"), 'descriptionField' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['descriptionField'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => array('PCT\\CustomCatalog\\Feeds\\TableCustomCatalogFeed', 'getTextAttributes'), 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true), 'sql' => "int(10) NOT NULL default '0'"), 'publishedField' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['publishedField'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => array('PCT\\CustomCatalog\\Feeds\\TableCustomCatalogFeed', 'getTimestampAttributes'), 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true), 'sql' => "int(10) NOT NULL default '0'"), 'authorField' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['authorField'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => array('PCT\\CustomCatalog\\Feeds\\TableCustomCatalogFeed', 'getTextAttributes'), 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true), 'sql' => "int(10) NOT NULL default '0'"), 'imageField' => array('label' => &$GLOBALS['TL_LANG'][$objDcaHelper->getTable()]['imageField'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => array('PCT\\CustomCatalog\\Feeds\\TableCustomCatalogFeed', 'getImageAttributes'), 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true), 'sql' => "int(10) NOT NULL default '0'")));
开发者ID:timgatzky,项目名称:pct_customelements_customcatalog_feeds,代码行数:30,代码来源:tl_pct_customcatalog_feed.php
示例7: handleGetReferer
/**
* Retrieve the current referrer url.
*
* @param GetReferrerEvent $event The event.
*
* @return void
*/
public function handleGetReferer(GetReferrerEvent $event)
{
$event->setReferrerUrl(\System::getReferer($event->isEncodeAmpersands(), $event->getTableName()));
}
示例8: exportAndCatchExceptions
/**
* Try to export and catch ExportFailedException.
*
* @param $intConfig
* @param $arrIds
*/
public function exportAndCatchExceptions($intConfig, $arrIds)
{
try {
\Leads\Leads::export($intConfig, $arrIds);
} catch (\Leads\Exporter\ExportFailedException $e) {
\Message::addError($e->getMessage());
\Controller::redirect(\System::getReferer());
}
}
示例9: forVisibilityToggle
/**
* Return the "toggle visibility" button
*
* @param array $row
* @param string $href
* @param string $label
* @param string $title
* @param string $icon
* @param string $attributes
*
* @return string
*/
public function forVisibilityToggle($row, $href, $label, $title, $icon, $attributes)
{
if (strlen(\Input::get('tid'))) {
$this->toggleVisibility(\Input::get('tid'), \Input::get('state') == 1);
\Controller::redirect(\System::getReferer());
}
/** @var \BackendUser $user */
$user = \BackendUser::getInstance();
// Check permissions AFTER checking the tid, so hacking attempts are logged
if (!$user->isAdmin && !$user->hasAccess('tl_iso_product::published', 'alexf')) {
return '';
}
$time = time();
$arrAttributes = array();
if (($objProductType = ProductType::findByProductData($row)) !== null) {
$arrAttributes = $row['pid'] ? $objProductType->getVariantAttributes() : $objProductType->getAttributes();
}
if ($arrAttributes['start']['enabled'] && $row['start'] != '' && $row['start'] > $time || $arrAttributes['stop']['enabled'] && $row['stop'] != '' && $row['stop'] < $time) {
return \Image::getHtml('system/modules/isotope/assets/images/invisible-startstop.png', $label) . ' ';
} elseif ($row['published'] != '1') {
$icon = 'invisible.gif';
}
$href .= '&tid=' . $row['id'] . '&state=' . ($row['published'] ? '' : 1);
return '<a href="' . \Backend::addToUrl($href) . '" title="' . specialchars($title) . '"' . $attributes . '>' . \Image::getHtml($icon, $label) . '</a> ';
}
示例10: run
/**
* Generate the module
*
* @return string
*/
public function run()
{
$this->import('BackendUser', 'User');
$this->registerEvents();
$time = time();
/** @var \BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_filecredits_sync');
$objTemplate->action = ampersand(\Environment::get('request'));
$objTemplate->syncHeadline = $GLOBALS['TL_LANG']['tl_filecredit']['syncHeadline'];
$objTemplate->isActive = $this->isActive();
$objTemplate->pageSelection = $this->generatePageSelection();
if (!\Config::get('headerAddXFrame') || !\Config::get('headerAllowOrigins')) {
$objTemplate->originInfo = $GLOBALS['TL_LANG']['tl_filecredit']['originInfo'];
}
// Add the error message
if ($_SESSION['REBUILD_FILECREDIT_ERROR'] != '') {
$objTemplate->indexMessage = $_SESSION['REBUILD_FILECREDIT_ERROR'];
$_SESSION['REBUILD_FILECREDIT_ERROR'] = '';
}
// Rebuild the index
if (\Input::get('act') == 'index') {
// Check the request token (see #4007)
if (!isset($_GET['rt']) || !\RequestToken::validate(\Input::get('rt'))) {
$this->Session->set('INVALID_TOKEN_URL', \Environment::get('request'));
$this->redirect('contao/confirm.php');
}
$arrPages = static::findFileCreditPages();
// HOOK: take additional pages (news, events…)
if (isset($GLOBALS['TL_HOOKS']['getSearchablePages']) && is_array($GLOBALS['TL_HOOKS']['getSearchablePages'])) {
foreach ($GLOBALS['TL_HOOKS']['getSearchablePages'] as $callback) {
$this->import($callback[0]);
$arrPages = $this->{$callback}[0]->{$callback}[1]($arrPages);
}
}
$blnTruncateTable = true;
if (\Input::get('limitfilecreditpages')) {
$arrSelectedPages = \Input::get('filecreditpages');
if (is_array($arrSelectedPages) && !empty($arrSelectedPages)) {
$arrPages = array_keys(array_intersect(array_flip($arrPages), $arrSelectedPages));
$blnTruncateTable = false;
}
}
// Return if there are no pages
if (empty($arrPages)) {
$_SESSION['REBUILD_FILECREDIT_ERROR'] = $GLOBALS['TL_LANG']['tl_filecredit']['noSearchable'];
\Controller::redirect(\System::getReferer());
}
// Truncate the search tables
if ($blnTruncateTable) {
Automator::purgeFileCreditTables();
}
// Hide unpublished elements
$this->setCookie('FE_PREVIEW', 0, $time - 86400);
// Calculate the hash
$strHash = sha1(session_id() . (!\Config::get('disableIpCheck') ? \Environment::get('ip') : '') . 'FE_USER_AUTH');
// Remove old sessions
$this->Database->prepare("DELETE FROM tl_session WHERE tstamp<? OR hash=?")->execute($time - \Config::get('sessionTimeout'), $strHash);
// Log in the front end user
if (is_numeric(\Input::get('user')) && \Input::get('user') > 0) {
// Insert a new session
$this->Database->prepare("INSERT INTO tl_session (pid, tstamp, name, sessionID, ip, hash) VALUES (?, ?, ?, ?, ?, ?)")->execute(\Input::get('user'), $time, 'FE_USER_AUTH', session_id(), \Environment::get('ip'), $strHash);
// Set the cookie
$this->setCookie('FE_USER_AUTH', $strHash, $time + \Config::get('sessionTimeout'), null, null, false, true);
} else {
// Unset the cookies
$this->setCookie('FE_USER_AUTH', $strHash, $time - 86400, null, null, false, true);
$this->setCookie('FE_AUTO_LOGIN', \Input::cookie('FE_AUTO_LOGIN'), $time - 86400, null, null, false, true);
}
$strBuffer = '';
$rand = rand();
// Display the pages
for ($i = 0, $c = count($arrPages); $i < $c; $i++) {
if (!\Validator::isUrl($arrPages[$i])) {
continue;
}
$strBuffer .= '<span class="page_url" data-url="' . $arrPages[$i] . '#' . $rand . $i . '">' . \StringUtil::substr($arrPages[$i], 100) . '</span><br>';
unset($arrPages[$i]);
// see #5681
}
$objTemplate->content = $strBuffer;
$objTemplate->note = $GLOBALS['TL_LANG']['tl_filecredit']['indexNote'];
$objTemplate->loading = $GLOBALS['TL_LANG']['tl_filecredit']['indexLoading'];
$objTemplate->complete = $GLOBALS['TL_LANG']['tl_filecredit']['indexComplete'];
$objTemplate->indexContinue = $GLOBALS['TL_LANG']['MSC']['continue'];
$objTemplate->theme = \Backend::getTheme();
$objTemplate->isRunning = true;
}
// Default variables
$objTemplate->indexSubmit = $GLOBALS['TL_LANG']['tl_filecredit']['syncSubmit'];
$objTemplate->backHref = \System::getReferer(true);
$objTemplate->backTitle = specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']);
$objTemplate->backButton = $GLOBALS['TL_LANG']['MSC']['backBT'];
return $objTemplate->parse();
}