本文整理汇总了PHP中t3lib_div::shortMD5方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::shortMD5方法的具体用法?PHP t3lib_div::shortMD5怎么用?PHP t3lib_div::shortMD5使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::shortMD5方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setCache
/**
* Initializes the identifier prefix when setting the cache.
*
* @param t3lib_cache_frontend_Frontend $cache The frontend for this backend
* @return void
* @author Robert Lemke <robert@typo3.org>
*/
public function setCache(t3lib_cache_frontend_Frontend $cache)
{
parent::setCache($cache);
$processUser = extension_loaded('posix') ? posix_getpwuid(posix_geteuid()) : array('name' => 'default');
$pathHash = t3lib_div::shortMD5(PATH_site . $processUser['name'], 12);
$this->identifierPrefix = 'TYPO3_' . $pathHash;
}
示例2: wrapClickMenuOnIcon
/**
* @param $str
* @param $table
* @param string $uid
* @return string
*/
private function wrapClickMenuOnIcon($str, $table, $uid = '')
{
$listFr = 1;
$addParams = '';
$enDisItems = '';
$returnOnClick = FALSE;
$backPath = rawurlencode($GLOBALS['BACK_PATH']) . '|' . t3lib_div::shortMD5($GLOBALS['BACK_PATH'] . '|' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']);
$onClick = 'showClickmenu("' . $table . '","' . $uid . '","' . $listFr . '","' . str_replace('+', '%2B', $enDisItems) . '","' . str_replace('&', '&', addcslashes($backPath, '"')) . '","' . str_replace('&', '&', addcslashes($addParams, '"')) . '");return false;';
return $returnOnClick ? $onClick : '<a href="#" onclick="' . htmlspecialchars($onClick) . '" oncontextmenu="' . htmlspecialchars($onClick) . '">' . $str . '</a>';
}
示例3: getCacheID
function getCacheID($cache_id = null)
{
// If caching is disabled in TYPO3 make sure it's disabled in Smarty as well
if ($GLOBALS['TSFE']->no_cache || t3lib_div::_GP('no_cache')) {
$this->caching = false;
return;
// Exit here
}
// If cHash is set, use it for the cache_id
if (t3lib_div::_GP('cHash')) {
return t3lib_div::_GP('cHash');
}
// Otherwise create a unique cache_id from POST/GET vars
// TODO: Observe how well Smarty caching works in the context of TYPO3. Disabling caching is generally recommended...
return $cache_id ? $cache_id : t3lib_div::shortMD5(serialize(array_merge(t3lib_div::_GET(), t3lib_div::_POST())));
}
示例4: fileList
/**
* Render list of files.
*
* @param array List of files. See t3lib_div::getFilesInDir
* @param string If set a header with a folder icon and folder name are shown
* @param boolean Whether to show thumbnails or not. If set, no thumbnails are shown.
* @return string HTML output
*/
function fileList($files, $folderName = '', $noThumbs = 0)
{
global $LANG, $BACK_PATH;
$out = '';
// Listing the files:
if (is_array($files)) {
// Create headline (showing number of files):
$filesCount = count($files);
$out .= $this->barheader(sprintf($GLOBALS['LANG']->getLL('files') . ' (%s):', $filesCount));
$out .= $this->getBulkSelector($filesCount);
$titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
// Create the header of current folder:
if ($folderName) {
$picon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
$picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($folderName), $titleLen));
$out .= $picon . '<br />';
}
// Init graphic object for reading file dimensions:
$imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
$imgObj->init();
$imgObj->mayScaleUp = 0;
$imgObj->tempPath = PATH_site . $imgObj->tempPath;
// Traverse the file list:
$lines = array();
foreach ($files as $filepath) {
$fI = pathinfo($filepath);
// Thumbnail/size generation:
if (t3lib_div::inList(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']), strtolower($fI['extension'])) && !$noThumbs) {
$imgInfo = $imgObj->getImageDimensions($filepath);
$pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
$clickIcon = t3lib_BEfunc::getThumbNail($BACK_PATH . 'thumbs.php', $filepath, 'hspace="5" vspace="5" border="1"');
} else {
$clickIcon = '';
$pDim = '';
}
// Create file icon:
$ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
$size = ' (' . t3lib_div::formatSize(filesize($filepath)) . 'bytes' . ($pDim ? ', ' . $pDim : '') . ')';
$icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/fileicons/' . $ficon, 'width="18" height="16"') . ' title="' . htmlspecialchars($fI['basename'] . $size) . '" class="absmiddle" alt="" />';
// Create links for adding the file:
if (strstr($filepath, ',') || strstr($filepath, '|')) {
// In case an invalid character is in the filepath, display error message:
$eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'), ', |'));
$ATag = $ATag_alt = "<a href=\"#\" onclick=\"alert(" . $eMsg . ");return false;\">";
$bulkCheckBox = '';
} else {
// If filename is OK, just add it:
$filesIndex = count($this->elements);
$this->elements['file_' . $filesIndex] = array('md5' => t3lib_div::shortMD5($filepath), 'type' => 'file', 'fileName' => $fI['basename'], 'filePath' => $filepath, 'fileExt' => $fI['extension'], 'fileIcon' => $ficon);
$ATag = "<a href=\"#\" onclick=\"return BrowseLinks.File.insertElement('file_{$filesIndex}');\">";
$ATag_alt = substr($ATag, 0, -4) . ",1);\">";
$bulkCheckBox = '<input type="checkbox" class="typo3-bulk-item" name="file_' . $filesIndex . '" value="0" /> ';
}
$ATag_e = '</a>';
// Create link to showing details about the file in a window:
$Ahref = $BACK_PATH . 'show_item.php?table=' . rawurlencode($filepath) . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
$ATag2 = '<a href="' . htmlspecialchars($Ahref) . '">';
$ATag2_e = '</a>';
// Combine the stuff:
$filenameAndIcon = $bulkCheckBox . $ATag_alt . $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen)) . $ATag_e;
// Show element:
if ($pDim) {
// Image...
$lines[] = '
<tr class="bgColor4">
<td nowrap="nowrap">' . $filenameAndIcon . ' </td>
<td>' . $ATag . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" />' . $ATag_e . '</td>
<td nowrap="nowrap">' . ($ATag2 . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $LANG->getLL('info', 1) . '" alt="" /> ' . $LANG->getLL('info', 1) . $ATag2_e) . '</td>
<td nowrap="nowrap"> ' . $pDim . '</td>
</tr>';
$lines[] = '
<tr>
<td colspan="4">' . $ATag_alt . $clickIcon . $ATag_e . '</td>
</tr>';
} else {
$lines[] = '
<tr class="bgColor4">
<td nowrap="nowrap">' . $filenameAndIcon . ' </td>
<td>' . $ATag . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" />' . $ATag_e . '</td>
<td nowrap="nowrap">' . ($ATag2 . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $LANG->getLL('info', 1) . '" alt="" /> ' . $LANG->getLL('info', 1) . $ATag2_e) . '</td>
<td> </td>
</tr>';
}
$lines[] = '
<tr>
<td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td>
</tr>';
}
// Wrap all the rows in table tags:
$out .= '
//.........这里部分代码省略.........
示例5: shortMD5
/**
* @param string $input Input string to be md5-hashed
* @param int $len The string-length of the output
* @return string Substring of the resulting md5-hash, being $len chars long (from beginning)
*/
public function shortMD5($input, $len = 10)
{
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::shortMD5($input, $len);
}
示例6: renderFileContent
//.........这里部分代码省略.........
Description for "' . htmlspecialchars($headerString) . '"
-->
<div class="' . $tClass . '">
<a name="' . $anchor . '"></a>
<h4><a href="#top">' . htmlspecialchars($headerString) . '</a></h4>
<p class="c-funcDescription">' . nl2br(htmlspecialchars(trim($v['cDat']['text']))) . '</p>
';
// Render details for the function/class:
// Parameters:
$tableRows = array();
if (is_array($v['cDat']['param'])) {
// Get argument names of current function:
$funcHeadParams = $this->splitFunctionHeader($v['header']);
// For each argument, render a row in the table:
foreach ($v['cDat']['param'] as $k2 => $pp) {
$tableRows[] = '
<tr>
<td class="c-Hcell">' . htmlspecialchars($funcHeadParams[$k2]) . '</td>
<td class="c-vType">' . htmlspecialchars($pp[0]) . '</td>
<td class="c-vDescr">' . htmlspecialchars(trim($pp[1])) . '</td>
</tr>';
}
}
// Add "return" value:
$tableRows[] = '
<tr>
<td class="c-Hcell">Returns: </td>
<td class="c-vType">' . htmlspecialchars($v['cDat']['return'][0]) . '</td>
<td class="c-vDescr">' . htmlspecialchars(trim($v['cDat']['return'][1])) . '</td>
</tr>';
// Add other tags:
if (is_array($v['cDat']['other'])) {
foreach ($v['cDat']['other'] as $k2 => $pp) {
$tableRows[] = '
<tr>
<td> </td>
<td colspan="2" class="c-vDescr">' . htmlspecialchars($pp) . '</td>
</tr>';
}
}
// Usage counts, if set:
$uCKey = 'H_' . t3lib_div::shortMD5($v['header']);
if (is_array($fDat['usageCount'][$uCKey])) {
// Add "TOTAL" usage:
$tableRows[] = '
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td class="c-Hcell">Total Usage:</td>
<td class="c-vType">' . intval($fDat['usageCount'][$uCKey]['ALL']['TOTAL']) . '</td>
<td class="c-vDescr"> </td>
</tr>';
// Add usage for single files:
foreach ($fDat['usageCount'][$uCKey] as $k3 => $v3) {
if (substr($k3, 0, 4) == 'MD5_') {
$tableRows[] = '
<tr>
<td class="c-vType"> </td>
<td class="c-vType">' . intval($fDat['usageCount'][$uCKey][$k3]['TOTAL']) . '</td>
<td class="c-vDescr">' . htmlspecialchars($fDat['usageCount'][$uCKey][$k3]['fileName']) . '</td>
</tr>';
}
}
}
// Add it all together:
$content .= '
<table border="0" cellpadding="0" cellspacing="1" class="c-details">
' . implode('
', $tableRows) . '
</table>';
// Adding todo to index:
if (is_array($v['cDat']['other_index']['@todo'])) {
$index .= '<p class="c-indexTags"><span class="typo3-red"><strong>@todo:</strong> ' . nl2br(htmlspecialchars(implode(chr(10), $v['cDat']['other_index']['@todo']))) . '</span></p>';
}
// Adding package tags to index:
if (is_array($v['cDat']['other_index']['@package'])) {
$index .= '<p class="c-indexTags"><span class="typo3-dimmed"><strong>@package:</strong> ' . nl2br(htmlspecialchars(implode(chr(10), $v['cDat']['other_index']['@package']))) . '</span></p>';
}
if (is_array($v['cDat']['other_index']['@subpackage'])) {
$index .= '<p class="c-indexTags"><span class="typo3-dimmed"><strong>@subpackage:</strong> ' . nl2br(htmlspecialchars(implode(chr(10), $v['cDat']['other_index']['@subpackage']))) . '</span></p>';
}
// Sample Content of function/class:
if (is_array($v['content'])) {
$content .= '
<div class="php-content">
<pre>' . highlight_string('<?php' . chr(10) . chr(10) . ' ' . trim($v['header'] . chr(10) . $v['content'][0]) . chr(10) . chr(10) . '?>', 1) . '</pre>
</div>
';
}
// End with </div>
$content .= '
</div>
';
}
}
}
// Return index and content variables:
return array($superIndex, $index, $content);
}
示例7: makeCHash
/**
* Calculates the cHash value of input GET array (for constructing cHash values if needed)
*
* @param array Array of GET parameters to encode
* @return void
* @deprecated since TYPO3 4.3, this function will be removed in TYPO3 4.6, use directly t3lib_div::calculateCHash()
*/
function makeCHash($paramArray)
{
t3lib_div::logDeprecatedFunction();
$addQueryParams = t3lib_div::implodeArrayForUrl('', $paramArray);
$pA = t3lib_div::cHashParams($addQueryParams);
return t3lib_div::shortMD5(serialize($pA));
}
示例8: folderList
/**
* Render list of files.
*
* @param array List of folder. See $this->getFolderInDir()
* @param string If set a header with a folder icon and folder name are shown
* @param boolean Whether to show thumbnails or not. If set, no thumbnails are shown.
* @return string HTML output
*/
function folderList($folder, $folderName = '', $noThumbs = 0)
{
global $LANG, $BACK_PATH;
$out = '';
// Listing the files:
if (is_array($folder)) {
// Create headline (showing number of files):
$out .= $this->barheader(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:file_newfolder.php.folders') . ' (%s):', count($folder)));
$titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
$folderIcon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"');
// todo: use modes?
# $fileadminDir = PATH_site.$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'];
$fcount = count($folder);
$folder = array_merge(array(md5($folderName) => $folderName), $folder);
// Traverse the file list:
$lines = array();
foreach ($folder as $filepath) {
$path_parts = t3lib_div::split_fileref($filepath);
# $shortFilepath = preg_replace('#^'.preg_quote($fileadminDir).'#','', $filepath);
$shortFilepath = preg_replace('#^' . preg_quote(PATH_site) . '#', '', $filepath);
if (count($lines) == 0) {
$treeLine = '';
} elseif (count($lines) < $fcount) {
$LN = 'join';
$treeLine = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/ol/' . $LN . '.gif', 'width="18" height="16"') . ' alt="" />';
} else {
$LN = 'joinbottom';
$treeLine = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/ol/' . $LN . '.gif', 'width="18" height="16"') . ' alt="" />';
}
// Create folder icon:
$icon = $folderIcon . ' title="' . htmlspecialchars($path_parts['file']) . '" class="absmiddle" alt="" />';
// Create links for adding the file:
if (strstr($filepath, ',') || strstr($filepath, '|')) {
// In case an invalid character is in the filepath, display error message:
$eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'), ', |'));
$ATag = $ATag_alt = "<a href=\"#\" onclick=\"alert(" . $eMsg . ");return false;\">";
} else {
// If filename is OK, just add it:
$ATag = "<a href=\"#\" onclick=\"return insertElement('','" . t3lib_div::shortMD5($filepath) . "', 'file', '" . rawurlencode($shortFilepath) . "', unescape('" . rawurlencode($shortFilepath) . "'), '" . '' . "', '" . '' . "');\">";
$ATag_alt = substr($ATag, 0, -4) . ",'',1);\">";
}
$ATag_e = '</a>';
// Combine the stuff:
$filenameAndIcon = $ATag_alt . $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs($path_parts['file'], $titleLen)) . $ATag_e;
$lines[] = '
<tr class="bgColor4">
<td nowrap="nowrap">' . $treeLine . $filenameAndIcon . ' </td>
<td>' . $ATag . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" />' . $ATag_e . '</td>
</tr>';
}
// Wrap all the rows in table tags:
$out .= '
<!--
File listing
-->
<table border="0" cellpadding="0" cellspacing="1" id="typo3-fileList">
' . implode('', $lines) . '
</table>';
}
// Return accumulated content for filelisting:
return $out;
}
示例9: TS_images_db
/**
* Transformation handler: 'ts_images' / direction: "db"
* Processing images inserted in the RTE.
* This is used when content goes from the RTE to the database.
* Images inserted in the RTE has an absolute URL applied to the src attribute. This URL is converted to a relative URL
* If it turns out that the URL is from another website than the current the image is read from that external URL and moved to the local server.
* Also "magic" images are processed here.
*
* @param string The content from RTE going to Database
* @return string Processed content
*/
function TS_images_db($value)
{
// Split content by <img> tags and traverse the resulting array for processing:
$imgSplit = $this->splitTags('img', $value);
foreach ($imgSplit as $k => $v) {
if ($k % 2) {
// image found, do processing:
// Init
$attribArray = $this->get_tag_attributes_classic($v, 1);
$siteUrl = $this->siteUrl();
$sitePath = str_replace(t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST'), '', $siteUrl);
$absRef = trim($attribArray['src']);
// It's always a absolute URL coming from the RTE into the Database.
// make path absolute if it is relative and we have a site path wich is not '/'
$pI = pathinfo($absRef);
if ($sitePath and !$pI['scheme'] && t3lib_div::isFirstPartOfStr($absRef, $sitePath)) {
// if site is in a subpath (eg. /~user_jim/) this path needs to be removed because it will be added with $siteUrl
$absRef = substr($absRef, strlen($sitePath));
$absRef = $siteUrl . $absRef;
}
// External image from another URL? In that case, fetch image (unless disabled feature).
if (!t3lib_div::isFirstPartOfStr($absRef, $siteUrl) && !$this->procOptions['dontFetchExtPictures']) {
$externalFile = $this->getUrl($absRef);
// Get it
if ($externalFile) {
$pU = parse_url($absRef);
$pI = pathinfo($pU['path']);
if (t3lib_div::inList('gif,png,jpeg,jpg', strtolower($pI['extension']))) {
$filename = t3lib_div::shortMD5($absRef) . '.' . $pI['extension'];
$origFilePath = PATH_site . $this->rteImageStorageDir() . 'RTEmagicP_' . $filename;
$C_origFilePath = PATH_site . $this->rteImageStorageDir() . 'RTEmagicC_' . $filename . '.' . $pI['extension'];
if (!@is_file($origFilePath)) {
t3lib_div::writeFile($origFilePath, $externalFile);
t3lib_div::writeFile($C_origFilePath, $externalFile);
}
$absRef = $siteUrl . $this->rteImageStorageDir() . 'RTEmagicC_' . $filename . '.' . $pI['extension'];
$attribArray['src'] = $absRef;
$params = t3lib_div::implodeAttributes($attribArray, 1);
$imgSplit[$k] = '<img ' . $params . ' />';
}
}
}
// Check image as local file (siteURL equals the one of the image)
if (strpos($absRef, 'http://') === FALSE and strpos($absRef, 'https://') === FALSE and strpos($absRef, 'ftp://') === FALSE) {
//XCLASS changed from: if (t3lib_div::isFirstPartOfStr($absRef,$siteUrl)) {
$path = rawurldecode(substr($absRef, strlen($siteUrl)));
// Rel-path, rawurldecoded for special characters.
$path = $absRef;
//XCLASS added
$filepath = t3lib_div::getFileAbsFileName($path);
// Abs filepath, locked to relative path of this project.
// Check file existence (in relative dir to this installation!)
if ($filepath && @is_file($filepath)) {
// If "magic image":
$pathPre = $this->rteImageStorageDir() . 'RTEmagicC_';
if (t3lib_div::isFirstPartOfStr($path, $pathPre)) {
// Find original file:
$pI = pathinfo(substr($path, strlen($pathPre)));
$filename = substr($pI['basename'], 0, -strlen('.' . $pI['extension']));
$origFilePath = PATH_site . $this->rteImageStorageDir() . 'RTEmagicP_' . $filename;
if (@is_file($origFilePath)) {
$imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
$imgObj->init();
$imgObj->mayScaleUp = 0;
$imgObj->tempPath = PATH_site . $imgObj->tempPath;
$curInfo = $imgObj->getImageDimensions($filepath);
// Image dimensions of the current image
$curWH = $this->getWHFromAttribs($attribArray);
// Image dimensions as set in the image tag
// Compare dimensions:
if ($curWH[0] != $curInfo[0] || $curWH[1] != $curInfo[1]) {
$origImgInfo = $imgObj->getImageDimensions($origFilePath);
// Image dimensions of the current image
$cW = $curWH[0];
$cH = $curWH[1];
$cH = 1000;
// Make the image based on the width solely...
$imgI = $imgObj->imageMagickConvert($origFilePath, $pI['extension'], $cW . 'm', $cH . 'm');
if ($imgI[3]) {
$fI = pathinfo($imgI[3]);
@copy($imgI[3], $filepath);
// Override the child file
// Removing width and heigth form style attribute
$attribArray['style'] = preg_replace('/((?:^|)\\s*(?:width|height)\\s*:[^;]*(?:$|;))/si', '', $attribArray['style']);
$attribArray['width'] = $imgI[0];
$attribArray['height'] = $imgI[1];
$params = t3lib_div::implodeAttributes($attribArray, 1);
$imgSplit[$k] = '<img ' . $params . ' />';
}
//.........这里部分代码省略.........
示例10: storeFixedPiVars
/**
* Store the setfixed vars and return a replacement hash
*/
public function storeFixedPiVars($vars)
{
// Create a unique hash value
if (class_exists('t3lib_cacheHash')) {
$cacheHash = t3lib_div::makeInstance('t3lib_cacheHash');
$regHash_calc = $cacheHash->calculateCacheHash($vars);
$regHash_calc = substr($regHash_calc, 0, 20);
} else {
// t3lib_div::cHashParams is deprecated in TYPO3 4.7
$regHash_array = t3lib_div::cHashParams(t3lib_div::implodeArrayForUrl('', $vars));
$regHash_calc = t3lib_div::shortMD5(serialize($regHash_array), 20);
}
// and store it with a serialized version of the array in the DB
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('md5hash', 'cache_md5params', 'md5hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($regHash_calc, 'cache_md5params'));
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
$insertFields = array('md5hash' => $regHash_calc, 'tstamp' => time(), 'type' => 99, 'params' => serialize($vars));
$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_md5params', $insertFields);
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
return $regHash_calc;
}
示例11: visualID
/**
* Creates a visual response to the TemplaVoila blocks on the page.
*
* @param [type] $content: ...
* @param [type] $srcPointer: ...
* @param [type] $DSrec: ...
* @param [type] $TOrec: ...
* @param [type] $row: ...
* @param [type] $table: ...
* @return [type] ...
*/
function visualID($content,$srcPointer,$DSrec,$TOrec,$row,$table) {
// Create table rows:
$tRows = array();
switch ($table) {
case 'pages':
$tRows[] = '<tr style="background-color: #ABBBB4;">
<td colspan="2"><b>Page:</b> '.htmlspecialchars(t3lib_div::fixed_lgd_cs($row['title'],30)).' <em>[UID:'.$row['uid'].']</em></td>
</tr>';
break;
case 'tt_content':
$tRows[] = '<tr style="background-color: #ABBBB4;">
<td colspan="2"><b>Flexible Content:</b> '.htmlspecialchars(t3lib_div::fixed_lgd_cs($row['header'],30)).' <em>[UID:'.$row['uid'].']</em></td>
</tr>';
break;
default:
$tRows[] = '<tr style="background-color: #ABBBB4;">
<td colspan="2">Table "'.$table.'" <em>[UID:'.$row['uid'].']</em></td>
</tr>';
break;
}
// Draw data structure:
if (is_numeric($srcPointer)) {
$tRows[] = '<tr>
<td valign="top"><b>Data Structure:</b></td>
<td>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($DSrec['title'],30)).' <em>[UID:'.$srcPointer.']</em>'.
($DSrec['previewicon'] ? '<br/><img src="uploads/tx_templavoila/'.$DSrec['previewicon'].'" alt="" />' : '').
'</td>
</tr>';
} else {
$tRows[] = '<tr>
<td valign="top"><b>Data Structure:</b></td>
<td>'.htmlspecialchars($srcPointer).'</td>
</tr>';
}
// Template Object:
$tRows[] = '<tr>
<td valign="top"><b>Template Object:</b></td>
<td>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($TOrec['title'],30)).' <em>[UID:'.$TOrec['uid'].']</em>'.
($TOrec['previewicon'] ? '<br/><img src="uploads/tx_templavoila/'.$TOrec['previewicon'].'" alt="" />' : '').
'</td>
</tr>';
if ($TOrec['description']) {
$tRows[] = '<tr>
<td valign="top" nowrap="nowrap"> Description:</td>
<td>'.htmlspecialchars($TOrec['description']).'</td>
</tr>';
}
$tRows[] = '<tr>
<td valign="top" nowrap="nowrap"> Template File:</td>
<td>'.htmlspecialchars($TOrec['fileref']).'</td>
</tr>';
$tRows[] = '<tr>
<td valign="top" nowrap="nowrap"> Render type:</td>
<td>'.htmlspecialchars($TOrec['rendertype'] ? $TOrec['rendertype'] : 'Normal').'</td>
</tr>';
$tRows[] = '<tr>
<td valign="top" nowrap="nowrap"> Language:</td>
<td>'.htmlspecialchars($TOrec['sys_language_uid'] ? $TOrec['sys_language_uid'] : 'Default').'</td>
</tr>';
$tRows[] = '<tr>
<td valign="top" nowrap="nowrap"> Local Proc.:</td>
<td>'.htmlspecialchars($TOrec['localprocessing'] ? 'Yes' : '-').'</td>
</tr>';
// Compile information table:
$infoArray = '<table style="border:1px solid black; background-color: #D9D5C9; font-family: verdana,arial; font-size: 10px;" border="0" cellspacing="1" cellpadding="1">
'.implode('',$tRows).'
</table>';
// Compile information:
$id = 'templavoila-preview-'.t3lib_div::shortMD5(microtime());
$content = '<div style="text-align: left; position: absolute; display:none; filter: alpha(Opacity=90);" id="'.$id.'">
'.$infoArray.'
</div>
<div id="'.$id.'-wrapper" style=""
onmouseover="
document.getElementById(\''.$id.'\').style.display=\'block\';
document.getElementById(\''.$id.'-wrapper\').attributes.getNamedItem(\'style\').nodeValue = \'border: 2px dashed #333366;\';
"
onmouseout="
document.getElementById(\''.$id.'\').style.display=\'none\';
document.getElementById(\''.$id.'-wrapper\').attributes.getNamedItem(\'style\').nodeValue = \'\';
">'.
$content.
'</div>';
//.........这里部分代码省略.........
示例12: jumpUrl
/**
* Sends a header "Location" to jumpUrl, if jumpurl is set.
* Will exit if a location header is sent (for instance if jumpUrl was triggered)
*
* "jumpUrl" is a concept where external links are redirected from the index_ts.php script, which first logs the URL.
* This feature is only interesting if config.sys_stat is used.
*
* @return void
*/
function jumpUrl()
{
if ($this->jumpurl) {
if (t3lib_div::_GP('juSecure')) {
$hArr = array($this->jumpurl, t3lib_div::_GP('locationData'), $this->TYPO3_CONF_VARS['SYS']['encryptionKey']);
$calcJuHash = t3lib_div::shortMD5(serialize($hArr));
$locationData = t3lib_div::_GP('locationData');
$juHash = t3lib_div::_GP('juHash');
if ($juHash == $calcJuHash) {
if ($this->locDataCheck($locationData)) {
$this->jumpurl = rawurldecode($this->jumpurl);
// 211002 - goes with cObj->filelink() rawurlencode() of filenames so spaces can be allowed.
// Deny access to files that match TYPO3_CONF_VARS[SYS][fileDenyPattern] and whose parent directory is typo3conf/ (there could be a backup file in typo3conf/ which does not match against the fileDenyPattern)
if (t3lib_div::verifyFilenameAgainstDenyPattern($this->jumpurl) && basename(dirname($this->jumpurl)) !== 'typo3conf') {
if (@is_file($this->jumpurl)) {
$mimeType = t3lib_div::_GP('mimeType');
$mimeType = $mimeType ? $mimeType : 'application/octet-stream';
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Type: ' . $mimeType);
header('Content-Disposition: attachment; filename=' . basename($this->jumpurl));
readfile($this->jumpurl);
exit;
} else {
die('jumpurl Secure: "' . $this->jumpurl . '" was not a valid file!');
}
} else {
die('jumpurl Secure: The requested file type was not allowed to be accessed through jumpUrl (fileDenyPattern)!');
}
} else {
die('jumpurl Secure: locationData, ' . $locationData . ', was not accessible.');
}
} else {
die('jumpurl Secure: Calculated juHash did not match the submitted juHash.');
}
} else {
$TSConf = $this->getPagesTSconfig();
if ($TSConf['TSFE.']['jumpUrl_transferSession']) {
$uParts = parse_url($this->jumpurl);
$params = '&FE_SESSION_KEY=' . rawurlencode($this->fe_user->id . '-' . md5($this->fe_user->id . '/' . $this->TYPO3_CONF_VARS['SYS']['encryptionKey']));
$this->jumpurl .= ($uParts['query'] ? '' : '?') . $params;
// Add the session parameter ...
}
if ($TSConf['TSFE.']['jumpURL_HTTPStatusCode']) {
switch (intval($TSConf['TSFE.']['jumpURL_HTTPStatusCode'])) {
case 301:
$statusCode = t3lib_utility_Http::HTTP_STATUS_301;
break;
case 302:
$statusCode = t3lib_utility_Http::HTTP_STATUS_302;
break;
case 307:
$statusCode = t3lib_utility_Http::HTTP_STATUS_307;
break;
case 303:
default:
$statusCode = t3lib_utility_Http::HTTP_STATUS_303;
break;
}
}
t3lib_utility_Http::redirect($this->jumpurl, $statusCode);
}
}
}
示例13: filterInvalidContentHash
/**
* Checks whether a given string is a valid cHash.
* If the hash is valid it will be returned as is, an empty string will be
* returned otherwise.
*
* @param string The cHash to check for validity
* @return string The passed cHash if valid, an empty string if invalid
* @see tslib_fe->makeCacheHash
*/
protected function filterInvalidContentHash($cHash)
{
$urlParameters = t3lib_div::_GET();
$cHashParameters = t3lib_div::cHashParams(t3lib_div::implodeArrayForUrl('', $urlParameters));
if (SOLR_COMPAT) {
$calculatedCHash = t3lib_div::shortMD5(serialize($cHashParameters));
} else {
$calculatedCHash = t3lib_div::calculateCHash($cHashParameters);
}
return $calculatedCHash == $cHash ? $cHash : '';
}
示例14: processStoreControl
/**
* Processing of the storage command LOAD, SAVE, REMOVE
*
* @param string Name of the module to store the settings for. Default: $GLOBALS['SOBE']->MCONF['name'] (current module)
* @return string Storage message. Also set in $this->msg
*/
function processStoreControl($mconfName = '')
{
$this->initStorage();
$storeControl = t3lib_div::_GP('storeControl');
$storeIndex = $storeControl['STORE'];
$msg = '';
$saveSettings = FALSE;
$writeArray = array();
if (is_array($storeControl)) {
if ($this->writeDevLog) {
t3lib_div::devLog('Store command: ' . t3lib_div::arrayToLogString($storeControl), 't3lib_modSettings', 0);
}
//
// processing LOAD
//
if ($storeControl['LOAD'] and $storeIndex) {
$writeArray = $this->getStoredData($storeIndex, $writeArray);
$saveSettings = TRUE;
$msg = "'" . $this->storedSettings[$storeIndex]['title'] . "' preset loaded!";
//
// processing SAVE
//
} elseif ($storeControl['SAVE']) {
if (trim($storeControl['title'])) {
// get the data to store
$newEntry = $this->compileEntry($storeControl);
// create an index for the storage array
if (!$storeIndex) {
$storeIndex = t3lib_div::shortMD5($newEntry['title']);
}
// add data to the storage array
$this->storedSettings[$storeIndex] = $newEntry;
$saveSettings = TRUE;
$msg = "'" . $newEntry['title'] . "' preset saved!";
} else {
$msg = 'Please enter a name for the preset!';
}
//
// processing REMOVE
//
} elseif ($storeControl['REMOVE'] and $storeIndex) {
// Removing entry
$msg = "'" . $this->storedSettings[$storeIndex]['title'] . "' preset entry removed!";
unset($this->storedSettings[$storeIndex]);
$saveSettings = TRUE;
}
$this->msg = $msg;
if ($saveSettings) {
$this->writeStoredSetting($writeArray, $mconfName);
}
}
return $this->msg;
}
示例15: getThumbNail
/**
* Returns single image tag to thumbnail using a thumbnail script (like thumbs.php)
* Usage: 3
*
* @param string $thumbScript must point to "thumbs.php" relative to the script position
* @param string $theFile must be the proper reference to the file thumbs.php should show
* @param string $tparams are additional attributes for the image tag
* @param integer $size is the size of the thumbnail send along to "thumbs.php"
* @return string Image tag
*/
public static function getThumbNail($thumbScript, $theFile, $tparams = '', $size = '')
{
$check = basename($theFile) . ':' . filemtime($theFile) . ':' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
$params = '&file=' . rawurlencode($theFile);
$params .= trim($size) ? '&size=' . trim($size) : '';
$params .= '&md5sum=' . t3lib_div::shortMD5($check);
$url = $thumbScript . '?&dummy=' . $GLOBALS['EXEC_TIME'] . $params;
$th = '<img src="' . htmlspecialchars($url) . '" title="' . trim(basename($theFile)) . '"' . ($tparams ? " " . $tparams : "") . ' alt="" />';
return $th;
}