Project

General

Profile

Bug #23010 » 14883_v2.diff

Administrator Admin, 2010-06-28 09:01

View differences:

t3lib/core_autoload.php (working copy)
return array(
'gzip_encode' => PATH_t3lib . 'class.gzip_encode.php',
't3lib_admin' => PATH_t3lib . 'class.t3lib_admin.php',
't3lib_ajax' => PATH_t3lib . 'class.t3lib_ajax.php',
't3lib_arraybrowser' => PATH_t3lib . 'class.t3lib_arraybrowser.php',
typo3/sysext/cms/tslib/class.tslib_content.php (working copy)
return $newVal;
}
/**
* Formats a number to GB, Mb or Kb or just bytes
*
* @param integer Number of bytes to format.
* @param string Labels for bytes, kilo, mega and giga separated by vertical bar (|) and possibly encapsulated in "". Eg: " | K| M| G" (which is the default value)
* @return string
* @see t3lib_div::formatSize(), stdWrap()
* @deprecated since TYPO3 3.6 - Use t3lib_div::formatSize() instead
*/
function bytes($sizeInBytes,$labels) {
t3lib_div::logDeprecatedFunction();
return t3lib_div::formatSize($sizeInBytes,$labels);
}
/**
* Returns the 'age' of the tstamp $seconds
......
}
}
/**
* Checking syntax of input email address
*
* @param string Input string to evaluate
* @return boolean Returns true if the $email address (input string) is valid; Has a "@", domain name with at least one period and only allowed a-z characters.
* @see t3lib_div::validEmail()
* @deprecated since TYPO3 3.6 - Use t3lib_div::validEmail() instead
*/
function checkEmail($email) {
t3lib_div::logDeprecatedFunction();
return t3lib_div::validEmail($email);
}
/**
* Clears TypoScript properties listed in $propList from the input TypoScript array.
typo3/sysext/indexed_search/class.indexer.php (working copy)
return $contentArr;
}
/**
* Processing words in the array from split*Content -functions
* This function is only a wrapper because the function has been removed (see above).
*
* @param array Array of content to index, see splitHTMLContent() and splitRegularContent()
* @return array Content input array modified so each key is not a unique array of words
* @deprecated since TYPO3 4.0, this function will be removed in TYPO3 4.5.
*/
function procesWordsInArrays($contentArr) {
t3lib_div::logDeprecatedFunction();
return $this->processWordsInArrays($contentArr);
}
/**
* Extracts the sample description text from the content array.
......
return hexdec(substr(md5($str),0,7));
}
/**
* 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.5, 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));
}
......
**************************/
/**
* Frontend hook: If the page is not being re-generated this is our chance to force it to be (because re-generation of the page is required in order to have the indexer called!)
*
* @param array Parameters from frontend
* @param object TSFE object (reference under PHP5)
* @return void
* @deprecated since TYPO3 4.3, this function will be removed in TYPO3 4.5, the method was extracted to hooks/class.tx_indexedsearch_tslib_fe_hook.php
*/
function fe_headerNoCache(&$params, $ref) {
t3lib_div::logDeprecatedFunction();
require_once t3lib_extMgm::extPath('indexed_search') . 'hooks/class.tx_indexedsearch_tslib_fe_hook.php';
t3lib_div::makeInstance('tx_indexedsearch_tslib_fe_hook')->headerNoCache($params, $ref);
}
/**
* Makes sure that keywords are space-separated. This is impotant for their
* proper displaying as a part of fulltext index.
*
t3lib/class.t3lib_tstemplate.php (working copy)
return $outFile;
}
/**
* CheckFile runs through the $menuArr and checks every file-reference in $name
* (Not used anywhere)
*
* @param string Property name in the menu array
* @param array Menu array to traverse
* @return array Modified menu array
* @deprecated since TYPO3 3.6, this function will be removed in TYPO3 4.5.
* @internal
*/
function checkFile($name,$menuArr) {
t3lib_div::logDeprecatedFunction();
foreach ($menuArr as $aKey => $value) {
$menuArr[$aKey][$name] = $this->getFileName($menuArr[$aKey][$name]);
}
return $menuArr;
}
/**
* Compiles the content for the page <title> tag.
typo3/sysext/cms/tslib/class.tslib_fe.php (working copy)
}
}
/**
* Connect to MySQL database
* May exit after outputting an error message or some JavaScript redirecting to the install tool.
*
* @return void
* @deprecated since TYPO3 3.8, this function will be removed in TYPO3 4.5, use connectToDB() instead!
*/
function connectToMySQL() {
t3lib_div::logDeprecatedFunction();
$this->connectToDB();
}
/**
* Connect to SQL database
......
}
}
/**
* Processes a query-string with GET-parameters and returns two strings, one with the parameters that CAN be encoded and one array with those which can't be encoded (encoded by the M5 or B6 methods)
*
* @param string Query string to analyse
* @return array Two num keys returned, first is the parameters that MAY be encoded, second is the non-encodable parameters.
* @see makeSimulFileName(), t3lib_tstemplate::linkData()
* @deprecated since TYPO3 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
*/
function simulateStaticDocuments_pEnc_onlyP_proc($linkVars) {
t3lib_div::logDeprecatedFunction();
if (t3lib_extMgm::isLoaded('simulatestatic')) {
return t3lib_div::callUserFunction(
'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->processEncodedQueryString',
$linkVars,
$this
);
} else {
return false;
}
}
/**
* Returns the simulated static file name (*.html) for the current page (using the page record in $this->page)
*
* @return string The filename (without path)
* @see makeSimulFileName(), publish.php
* @deprecated since TYPO3 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
* @todo Deprecated but still used in the Core!
*/
function getSimulFileName() {
return $this->makeSimulFileName(
$this->page['title'],
($this->page['alias'] ? $this->page['alias'] : $this->id),
$this->type
) . '.html';
}
/**
* Checks and sets replacement character for simulateStaticDocuments. Default is underscore.
*
* @return void
* @deprecated since TYPO3 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
*/
function setSimulReplacementChar() {
t3lib_div::logDeprecatedFunction();
$replacement = $defChar = t3lib_div::compat_version('4.0') ? '-' : '_';
if (isset($this->config['config']['simulateStaticDocuments_replacementChar'])) {
$replacement = trim($this->config['config']['simulateStaticDocuments_replacementChar']);
if (urlencode($replacement) != $replacement) {
// Invalid character
$replacement = $defChar;
}
}
$this->config['config']['simulateStaticDocuments_replacementChar'] = $replacement;
}
/**
* Converts input string to an ASCII based file name prefix
......
}
}
/**
* Seeds the random number engine.
*
* @return void
* @deprecated since TYPO3 4.3, this function will be removed in TYPO3 4.5, the random number generator is seeded automatically since PHP 4.2.0
*/
function make_seed() {
t3lib_div::logDeprecatedFunction();
list($usec, $sec) = explode(' ', microtime());
$seedV = (float)$sec + ((float)$usec * 100000);
srand($seedV);
}
/**
* Returns a unique md5 hash.
t3lib/class.t3lib_db.php (working copy)
*
**************************************/
/**
* Executes query
* mysql() wrapper function
* Usage count/core: 0
*
* @param string Database name
* @param string Query to execute
* @return pointer Result pointer / DBAL object
* @deprecated since TYPO3 3.6, will be removed in TYPO3 4.5
* @see sql_query()
*/
function sql($db, $query) {
t3lib_div::logDeprecatedFunction();
$res = mysql_query($query, $this->link);
if ($this->debugOutput) {
$this->debug('sql', $query);
}
return $res;
}
/**
* Executes query
* mysql_query() wrapper function
t3lib/class.t3lib_install.php (working copy)
return $content;
}
/**
* Reads the field definitions for the input SQL-file string
*
* @param string Should be a string read from an SQL-file made with 'mysqldump [database_name] -d'
* @return array Array with information about table.
* @deprecated since TYPO3 4.2, this function will be removed in TYPO3 4.5, use ->getFieldDefinitions_fileContent() instead!
*/
function getFieldDefinitions_sqlContent($fileContent) {
t3lib_div::logDeprecatedFunction();
return $this->getFieldDefinitions_fileContent($fileContent);
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_install.php']) {
typo3/class.db_list_extra.inc (working copy)
}
}
/**
* Write sys_refindex entries for current record to $this->references
*
* @param string Table name
* @param integer Uid of current record
* @return void
*
* @deprecated since 4.4: Use getReferenceCount instead
*/
function setReferences($table, $uid) {
t3lib_div::logDeprecatedFunction();
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'tablename, recuid, field',
'sys_refindex',
'ref_table='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_refindex').
' AND ref_uid='.intval($uid).
' AND deleted=0'
);
$this->references = $rows;
}
/**
* Gets the number of records referencing the record with the UID $uid in
* the table $tableName.
......
<div class="typo3-clipCtrl">'.implode('',$cells).'</div>';
}
/**
* Make reference count
*
* @param string Table name
* @param integer UID of record
* @return string HTML-table
*
* @deprecated since 4.4: Use getReferenceHTML() instead
*/
function makeRef($table,$uid) {
t3lib_div::logDeprecatedFunction();
// Compile information for title tag:
$infoData=array();
if (is_array($this->references)) {
foreach ($this->references as $row) {
$infoData[]=$row['tablename'].':'.$row['recuid'].':'.$row['field'];
}
}
return count($infoData) ? '<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$uid.'\'); return false;').'" title="'.htmlspecialchars(t3lib_div::fixed_lgd_cs(implode(' / ',$infoData),100)).'">'.count($infoData).'</a>' : '';
}
/**
* Creates the HTML for a reference count for the record with the UID $uid
t3lib/class.t3lib_timetrack.php (working copy)
$this->tsStackPointer--;
}
/**
* Returns the current time in milliseconds
*
* @return integer
* @deprecated since TYPO3 4.3, this function will be removed in TYPO3 4.5, use getDifferenceToStarttime() instead
*/
protected function mtime() {
t3lib_div::logDeprecatedFunction();
return $this->getDifferenceToStarttime();
}
/**
* Returns microtime input to milliseconds
*
* @param string PHP microtime string
* @return integer
* @deprecated since TYPO3 4.3, this function will be removed in TYPO3 4.5, use getMilliseconds() instead that expects microtime as float instead of a string
*/
public function convertMicrotime($microtime) {
t3lib_div::logDeprecatedFunction();
$parts = explode(' ',$microtime);
return round(($parts[0]+$parts[1])*1000);
}
/**
* Gets a microtime value as milliseconds value.
t3lib/class.t3lib_div.php (working copy)
}
}
/**
* Returns the value of incoming data from globals variable $_POST or $_GET, with priority to $_POST (that is equalent to 'GP' order).
* Strips slashes of string-outputs, but not arrays UNLESS $strip is set. If $strip is set all output will have escaped characters unescaped.
* Usage: 2
*
* @param string GET/POST var to return
* @param boolean If set, values are stripped of return values that are *arrays!* - string/integer values returned are always strip-slashed()
* @return mixed POST var named $var and if not set, the GET var of the same name.
* @deprecated since TYPO3 3.6 - Use t3lib_div::_GP instead (ALWAYS delivers a value with un-escaped values!)
* @see _GP()
*/
public static function GPvar($var,$strip=0) {
self::logDeprecatedFunction();
if(empty($var)) return;
$value = isset($_POST[$var]) ? $_POST[$var] : $_GET[$var];
if (isset($value) && is_string($value)) { $value = stripslashes($value); } // Originally check '&& get_magic_quotes_gpc() ' but the values of $_GET are always slashed regardless of get_magic_quotes_gpc() because HTTP_POST/GET_VARS are run through addSlashesOnArray in the very beginning of index_ts.php eg.
if ($strip && isset($value) && is_array($value)) { self::stripSlashesOnArray($value); }
return $value;
}
/**
* Returns the global arrays $_GET and $_POST merged with $_POST taking precedence.
* Usage: 1
*
* @param string Key (variable name) from GET or POST vars
* @return array Returns the GET vars merged recursively onto the POST vars.
* @deprecated since TYPO3 3.7 - Use t3lib_div::_GPmerged instead
* @see _GP()
*/
public static function GParrayMerged($var) {
self::logDeprecatedFunction();
return self::_GPmerged($var);
}
/**
* Wrapper for the RemoveXSS function.
......
*
*************************/
/**
* Truncates string.
* Returns a new string of max. $chars length.
* If the string is longer, it will be truncated and appended with '...'.
* Usage: 39
*
* @param string string to truncate
* @param integer must be an integer with an absolute value of at least 4. if negative the string is cropped from the right end.
* @param string String to append to the output if it is truncated, default is '...'
* @return string new string
* @deprecated since TYPO3 4.1 - Works ONLY for single-byte charsets! Use t3lib_div::fixed_lgd_cs() instead
* @see fixed_lgd_pre()
*/
public static function fixed_lgd($string,$origChars,$preStr='...') {
self::logDeprecatedFunction();
$chars = abs($origChars);
if ($chars >= 4) {
if(strlen($string)>$chars) {
return $origChars < 0 ?
$preStr.trim(substr($string, -($chars-3))) :
trim(substr($string, 0, $chars-3)).$preStr;
}
}
return $string;
}
/**
* Truncates string.
* Returns a new string of max. $chars length.
* If the string is longer, it will be truncated and prepended with '...'.
* This works like fixed_lgd(), but is truncated in the start of the string instead of the end
* Usage: 6
*
* @param string string to truncate
* @param integer must be an integer of at least 4
* @return string new string
* @deprecated since TYPO3 4.1 - Use either fixed_lgd() or fixed_lgd_cs() (with negative input value for $chars)
* @see fixed_lgd()
*/
public static function fixed_lgd_pre($string,$chars) {
self::logDeprecatedFunction();
return strrev(self::fixed_lgd(strrev($string),$chars));
}
/**
* Truncates a string with appended/prepended "..." and takes current character set into consideration.
......
}
}
/**
* Breaks up the text for emails
* Usage: 1
*
* @param string The string to break up
* @param string The string to implode the broken lines with (default/typically \n)
* @param integer The line length
* @deprecated since TYPO3 4.1 - Use PHP function wordwrap()
* @return string
*/
public static function breakTextForEmail($str,$implChar=LF,$charWidth=76) {
self::logDeprecatedFunction();
$lines = explode(LF,$str);
$outArr=array();
foreach ($lines as $lStr) {
$outArr[] = self::breakLinesForEmail($lStr,$implChar,$charWidth);
}
return implode(LF,$outArr);
}
/**
* Breaks up a single line of text for emails
......
return rtrim($string, ',');
}
/**
* strtoupper which converts danish (and other characters) characters as well
* Usage: 0
*
* @param string String to process
* @return string
* @deprecated since TYPO3 3.5 - Use t3lib_cs::conv_case() instead or for HTML output, wrap your content in <span class="uppercase">...</span>)
* @ignore
*/
public static function danish_strtoupper($string) {
self::logDeprecatedFunction();
$value = strtoupper($string);
return strtr($value, '???????????????', '???????????????');
}
/**
* Change umlaut characters to plain ASCII with normally two character target
* Only known characters will be converted, so don't expect a result for any character.
*
* ? => ae, ? => Oe
*
* @param string String to convert.
* @deprecated since TYPO3 4.1 - Works only for western europe single-byte charsets! Use t3lib_cs::specCharsToASCII() instead!
* @return string
*/
public static function convUmlauts($str) {
self::logDeprecatedFunction();
$pat = array ( '/?/', '/?/', '/?/', '/?/', '/?/', '/?/', '/?/', '/?/', '/?/', '/?/', '/?/', '/?/', '/?/' );
$repl = array ( 'ae', 'Ae', 'oe', 'Oe', 'ue', 'Ue', 'ss', 'aa', 'AA', 'oe', 'OE', 'ae', 'AE' );
return preg_replace($pat,$repl,$str);
}
/**
* Tests if the input is an integer.
......
return $result;
}
/**
* Remove duplicate values from an array
* Usage: 0
*
* @param array Array of values to make unique
* @return array
* @ignore
* @deprecated since TYPO3 3.5 - Use the PHP function array_unique instead
*/
public static function uniqueArray(array $valueArray) {
self::logDeprecatedFunction();
return array_unique($valueArray);
}
/**
* Removes the value $cmpValue from the $array if found there. Returns the modified array
......
return $str;
}
/**
* Creates recursively a JSON literal from a multidimensional associative array.
* Uses native function of PHP >= 5.2.0
*
* @param array $jsonArray: The array to be transformed to JSON
* @return string JSON string
* @deprecated since TYPO3 4.3, use PHP native function json_encode() instead, will be removed in TYPO3 4.5
*/
public static function array2json(array $jsonArray) {
self::logDeprecatedFunction();
return json_encode($jsonArray);
}
/**
* Removes dots "." from end of a key identifier of TypoScript styled array.
* array('key.' => array('property.' => 'value')) --> array('key' => array('property' => 'value'))
......
return implode(' ',$list);
}
/**
* Implodes attributes in the array $arr for an attribute list in eg. and HTML tag (with quotes)
*
* @param array See implodeAttributes()
* @param boolean See implodeAttributes()
* @param boolean See implodeAttributes()
* @return string See implodeAttributes()
* @deprecated since TYPO3 3.7 - Name was changed into implodeAttributes
* @see implodeAttributes()
*/
public static function implodeParams(array $arr,$xhtmlSafe=FALSE,$dontOmitBlankAttribs=FALSE) {
self::logDeprecatedFunction();
return self::implodeAttributes($arr,$xhtmlSafe,$dontOmitBlankAttribs);
}
/**
* Wraps JavaScript code XHTML ready with <script>-tags
......
return $instance;
}
/**
* Return classname for new instance
* Takes the class-extensions API of TYPO3 into account
* Usage: 17
*
* @param string Base Class name to evaluate
* @return string Final class name to instantiate with "new [classname]"
* @deprecated since TYPO3 4.3 - Use t3lib_div::makeInstance('myClass', $arg1, $arg2, ..., $argN)
*/
public static function makeInstanceClassName($className) {
self::logDeprecatedFunction();
return (class_exists($className) && class_exists('ux_'.$className, false) ? self::makeInstanceClassName('ux_' . $className) : $className);
}
/**
* Returns the class name for a new instance, taking into account the
t3lib/class.gzip_encode.php (working copy)
<?php
/**
* News: I had once said that when PHP 4.0.5 comes out I will reccomend the built in
* ob_gzhandler over my code unless you are generating flash or images on the fly.
*
* I was wrong. PHP 4.0.5 is out and ob_gzhandler doesn't work for me.
*
* Note: This is rather cool: http://leknor.com/code/gziped.php
* It will calculate the effects of this class on a page.
* compression level, cpu time, download time, etc
*
* Note: this may be better for some sites:
* http://www.remotecommunications.com/apache/mod_gzip/
* I've read that the above doesn't work with PHP output.
*
* Changes compared to the upstream version:
*
* 2007-03-27 Oliver Hader <oh@inpublica.de>
* - Fixed bug #4623: Content encoding with x-gzip not allowed
* - Fixed missing comments and line formats (cleaner)
* 2005-12-09 Peter Niederlag <peter@niederlag.de>
* - Fixed bug #1976: PHP5 type-conversion of string 'true' and boolean
*
* $Id$
*
* @author Sandy McArthur, Jr. <leknor@leknor.com>
* @deprecated since TYPO3 4.3, this function will be removed in TYPO3 4.5, we're using the "ob_gzhandler" for compression now.
*/
/**
* [CLASS/FUNCTION INDEX of SCRIPT]
*
*
*
* 53: class gzip_encode
* 193: function gzip_encode($level = 3, $debug=false, $outputCompressedSizes=false)
* 268: function gzip_accepted()
* 317: function get_complevel()
* 342: function linux_loadavg()
* 363: function freebsd_loadavg()
*
* TOTAL FUNCTIONS: 5
* (This index is automatically created/updated by the extension "extdeveval")
*
*/
/**
* gzip_encode - a class to gzip encode php output
*
* @author Sandy McArthur, Jr. <Leknor@Leknor.com>
* @package TYPO3
* @subpackage t3lib
*/
class gzip_encode {
/**
* gzip_encode - a class to gzip encode php output
*
* By Sandy McArthur, Jr. <Leknor@Leknor.com>
*
* Copyright 2001 (c) All Rights Reserved, All Responsibility Yours.
* One very slight modification 2005 for PHP5 compatibility reasons for TYPO3 port by Peter Niederlag
*
* This code is released under the GNU LGPL Go read it over here:
* http://www.gnu.org/copyleft/lesser.html
*
* I do make one optional request, I would like an account on or a
* copy of where this code is used. If that is not possible then
* an email would be cool.
*
* How to use:
* 1. Output buffering has to be turned on. You can do this with ob_start()
* <http://php.net/manual/function.ob-start.php> or in the php config
* file. Nothing bad happens if output buffering isn't turned on, your
* page just won't get compressed.
* 2. Include the class file.
* 3. At the _very_ end of your script create an instance of the encode
* class.
*
* eg:
* ------------Start of file----------
* |<?php
* | ob_start();
* | include('class.gzip_encode.php');
* |?>
* |<HTML>
* |... the page ...
* |</HTML>
* |<?php
* | new gzip_encode();
* |?>
* -------------End of file-----------
*
* Things to note:
* 1. There is no space before the beginning of the file and the '<?php ' tag
* 2. The ob_start() line is optional if output buffering is turned on in
* the main config file.
* 3. Turning on and off output buffering just won't work.
* 4. There must be nothing after the last '?>' tag at the end of the file.
* Be careful of a space hiding there.
* 5. There are better ways to compress served content but I think this is
* the only way to compress php output.
* 6. Your auto_prepend_file is a good place for the ob_start() and
* your auto_append_file is a good place for new gzip_encode().
* 7. If you put new gzip_encode() in your auto.append file then you can
* call ob_end_flush() in your script to disable compression.
*
* This was written from scratch from info freely available on the web.
*
* These site(s) were useful to me:
* http://www.php.net/manual/
* http://www.ietf.org/rfc/rfc2616.txt (Sections: 3.5, 14.3, 14.11)
*
* Requirments:
* PHP 4.0.1+: I use the '===' operator, and output buffering, crc32();
* zlib: Needed for the gzip encoding. (Odds are you have it)
*
* Benchmarks:
* Take a look at http://Leknor.com/code/gziped.php and feed it a page to
* get an idea of how it will preform on your data or page.
*
* To Do:
* 1. I have reports of no content errors. I can't seem to duplicate this.
* Please visit my discussion boards if you think you may be able to help
* 2. The Accept-Encoding isn't handled to spec. Check out 14.3 in RFC 2616
* to see how it should be done.
*
* Change Log:
* 0.66: Big bug fix. It wouldn't compress when it should.
* 0.65: Fix for PHP-4.0.5 suddenly removing the connection_timeout() function.
* 0.62: Fixed a typo
* 0.61: Detect file types more like described in the magic number files, also
* added detection for gzip and pk zip files.
* 0.6: Detect common file types that shouldn't be compressed, mainly
* for images and swf (Shockwave Flash doesn't really accept gzip)
* 0.53: Made gzip_accepted() method so everyone can detect if a page
* will be gzip'ed with ease.
* 0.52: Detection and graceful handling of improper install/missing libs
* 0.51: Added FreeBSD load average detection.
* 0.5: Passing true as the first parameter will try to calculate the
* compression level from the server's load average. Passing true
* as the second parameter will turn on debugging.
* 0.4: No longer uses a temp file to compress the output. Should speed
* thing up a bit and reduce wear on your hard disk. Also test if
* the http headers have been sent.
* 0.31: Made a small change to the tempnam() line to hopefully be more
* portable.
* 0.3: Added code for the 'x-gzip'. This is untested, I don't know of
* any browser that uses it but the RFC said to look out for it.
* 0.2: Checks for 'gzip' in the Accept-Encoding header
* 0.1: First working version.
*
* Thanks To (Suggestions and stuff):
* ?@boas.anthro.mnsu.edu http://php.net/manual/function.gzcompress.php
* Kaoslord <kaoslord@chaos-productions.com>
* Michael R. Gile <gilem@wsg.net>
* Christian Hamm <chh@admaster.de>
*
* The most recent version is available at:
* http://Leknor.com/code/
*
*/
var $_version = 0.66; // Version of the gzip_encode class
var $level; // Compression level
var $encoding; // Encoding type
var $crc; // crc of the output
var $size; // size of the uncompressed content
var $gzsize; // size of the compressed content
/**
* gzip_encode constructor - gzip encodes the current output buffer
* if the browser supports it.
*
* Note: all arguments are optionial.
*
* You can specify one of the following for the first argument:
* 0: No compression
* 1: Min compression
* ... Some compression (integer from 1 to 9)
* 9: Max compression
* true: Determin the compression level from the system load. The
* higher the load the less the compression.
*
* You can specify one of the following for the second argument:
* true: Don't actully output the compressed form but run as if it
* had. Used for debugging.
*
* @param integer $level: Define the level of compression between 0 (none) and 9 (best compression)
* @param boolean $debug: If true, no data will be outputted (default: false)
* @param boolean $outputCompressedSizes: If true, the original and compressed size appended as HTML (default: false)
* @return void
* @deprecated since TYPO3 4.3, this function will be removed in TYPO3 4.5, we're using the "ob_gzhandler" for compression now.
*/
function gzip_encode($level=3, $debug=false, $outputCompressedSizes=false) {
t3lib_div::logDeprecatedFunction();
if (!function_exists('gzcompress')) {
trigger_error('gzcompress not found, ' .
'zlib needs to be installed for gzip_encode',
E_USER_WARNING);
return;
}
if (!function_exists('crc32')) {
trigger_error('crc32() not found, ' .
'PHP >= 4.0.1 needed for gzip_encode', E_USER_WARNING);
return;
}
if (headers_sent()) return;
if (connection_status() !== 0) return;
$encoding = $this->gzip_accepted();
if (!$encoding) return;
$this->encoding = $encoding;
if (strtolower($level) == 'true' || $level === true) {
$level = $this->get_complevel();
}
$this->level = $level;
$contents = ob_get_contents();
if ($contents === false) return;
$gzdata = "\x1f\x8b\x08\x00\x00\x00\x00\x00"; // gzip header
// By Kasper Skaarhoj, start
if ($outputCompressedSizes) {
$contents.=LF."<!-- Compressed, level ".$level.", original size was ".strlen($contents)." bytes. New size is ".strlen(gzcompress($contents, $level))." bytes -->";
$size = strlen($contents); // Must set again!
}
// By Kasper Skaarhoj, end
$size = strlen($contents);
$crc = crc32($contents);
$gzdata .= gzcompress($contents, $level);
$gzdata = substr($gzdata, 0, strlen($gzdata) - 4); // fix crc bug
$gzdata .= pack("V",$crc) . pack("V", $size);
$this->size = $size;
$this->crc = $crc;
$this->gzsize = strlen($gzdata);
if ($debug) {
return;
}
ob_end_clean();
Header('Content-Encoding: ' . $encoding);
Header('Content-Length: ' . strlen($gzdata));
Header('X-Content-Encoded-By: class.gzip_encode '.$this->_version);
echo $gzdata;
}
/**
* gzip_accepted() - Test headers for Accept-Encoding: gzip
* Returns: if proper headers aren't found: false
* if proper headers are found: 'gzip' or 'x-gzip'
*
* Tip: using this function you can test if the class will gzip the output
* without actually compressing it yet, eg:
* if (gzip_encode::gzip_accepted()) {
* echo "Page will be gziped";
* }
* note the double colon syntax, I don't know where it is documented but
* somehow it got in my brain.
*
* @return mixed Returns 'gzip' if the client browser accepts gzip encoding, otherwise false
* @deprecated since TYPO3 4.3, this function will be removed in TYPO3 4.5, we're using the "ob_gzhandler" for compression now.
*/
function gzip_accepted() {
t3lib_div::logDeprecatedFunction();
// Checks, if the accepted encoding supports gzip or x-gzip.
// Furthermore a qvalue check is done. "gzip;q=0" means no gzip accepted at all.
$acceptEncoding = t3lib_div::getIndpEnv('HTTP_ACCEPT_ENCODING');
if (preg_match('/(^|,\s*)(x-)?gzip(;q=(\d(\.\d+)?))?(,|$)/i', $acceptEncoding, $match) && ($match[4] === '' || $match[4] > 0)) {
$encoding = 'gzip';
} else {
return false;
}
// Test file type. I wish I could get HTTP response headers.
$magic = substr(ob_get_contents(),0,4);
if (substr($magic,0,2) === '^_') {
// gzip data
$encoding = false;
} else if (substr($magic,0,3) === 'GIF') {
// gif images
$encoding = false;
} else if (substr($magic,0,2) === "\xFF\xD8") {
// jpeg images
$encoding = false;
} else if (substr($magic,0,4) === "\x89PNG") {
// png images
$encoding = false;
} else if (substr($magic,0,3) === 'FWS') {
// Don't gzip Shockwave Flash files. Flash on windows incorrectly
// claims it accepts gzip'd content.
$encoding = false;
} else if (substr($magic,0,2) === 'PK') {
// pk zip file
$encoding = false;
}
return $encoding;
}
/**
* get_complevel() - The level of compression we should use.
*
* Returns an int between 0 and 9 inclusive.
*
* Tip: $gzleve = gzip_encode::get_complevel(); to get the compression level
* that will be used with out actually compressing the output.
*
* Help: if you use an OS other then linux please send me code to make
* this work with your OS - Thanks
*
* @return integer Suggests a level of compression (0..9) for the current situation
* @deprecated since TYPO3 4.3, this function will be removed in TYPO3 4.5, we're using the "ob_gzhandler" for compression now.
*/
function get_complevel() {
t3lib_div::logDeprecatedFunction();
$uname = posix_uname();
switch ($uname['sysname']) {
case 'Linux':
$cl = (1 - $this->linux_loadavg()) * 10;
$level = (int)max(min(9, $cl), 0);
break;
case 'FreeBSD':
$cl = (1 - $this->freebsd_loadavg()) * 10;
$level = (int)max(min(9, $cl), 0);
break;
default:
$level = 3;
break;
}
return $level;
}
/**
* linux_loadavg() - Gets the max() system load average from /proc/loadavg
*
* The max() Load Average will be returned
*
* @return float Returns the current load average
* @deprecated since TYPO3 4.3, this function will be removed in TYPO3 4.5, we're using the "ob_gzhandler" for compression now.
*/
function linux_loadavg() {
t3lib_div::logDeprecatedFunction();
$buffer = '0 0 0';
$f = @fopen('/proc/loadavg', 'rb');
if ($f) {
if (!feof($f)) {
$buffer = fgets($f, 1024);
}
fclose($f);
}
$load = explode(' ', $buffer);
return max((float)$load[0], (float)$load[1], (float)$load[2]);
}
/**
* freebsd_loadavg() - Gets the max() system load average from uname(1)
*
* The max() Load Average will be returned
*
* I've been told the code below will work on solaris too, anyone wanna
* test it?
*
* @return float Returns the current load average
* @deprecated since TYPO3 4.3, this function will be removed in TYPO3 4.5, we're using the "ob_gzhandler" for compression now.
*/
function freebsd_loadavg() {
t3lib_div::logDeprecatedFunction();
$buffer= `uptime`;
$load = array();
preg_match('/averag(es|e): ([0-9][.][0-9][0-9]), ([0-9][.][0-9][0-9]), ([0-9][.][0-9][0-9]*)/', $buffer, $load);
return max((float)$load[2], (float)$load[3], (float)$load[4]);
}
}
?>
typo3/template.php (working copy)
if (!defined('TYPO3_MODE')) die("Can't include this file directly.");
/**
* Deprecated fontwrap function. Is just transparent now.
*
* @param string Input string
* @return string Output string (in the old days this was wrapped in <font> tags)
* @deprecated since TYPO3 3.6
*/
function fw($str) {
t3lib_div::logDeprecatedFunction();
return $str;
}
/**
* TYPO3 Backend Template Class
*
t3lib/class.t3lib_stdgraphic.php (working copy)
}
/**
* Writes the input GDlib image pointer to file. Now just a wrapper to ImageWrite.
*
* @param pointer The GDlib image resource pointer
* @param string The filename to write to
* @return mixed The output of either imageGif, imagePng or imageJpeg based on the filename to write
* @see imageWrite()
* @deprecated since TYPO3 4.0, this function will be removed in TYPO3 4.5.
*/
function imageGif($destImg, $theImage) {
t3lib_div::logDeprecatedFunction();
return $this->imageWrite($destImg, $theImage);
}
/**
* This function has been renamed and only exists for providing backwards compatibility.
* Please use $this->imageCreateFromFile() instead.
*
* @param string Image filename
* @return pointer Image Resource pointer
* @deprecated since TYPO3 4.0, this function will be removed in TYPO3 4.5.
*/
function imageCreateFromGif($sourceImg) {
t3lib_div::logDeprecatedFunction();
return $this->imageCreateFromFile($sourceImg);
}
/**
* Creates a new GDlib image resource based on the input image filename.
* If it fails creating a image from the input file a blank gray image with the dimensions of the input image will be created instead.
t3lib/class.t3lib_basicfilefunc.php (working copy)
return preg_replace('/\.*$/', '', $cleanFileName);
}
/**
* Formats an integer, $sizeInBytes, to Mb or Kb or just bytes
*
* @param integer Bytes to be formated
* @return string Formatted with M,K or &nbsp;&nbsp; appended.
* @deprecated since at least TYPO3 4.2 - Use t3lib_div::formatSize() instead
*/
function formatSize($sizeInBytes) {
t3lib_div::logDeprecatedFunction();
if ($sizeInBytes>900) {
if ($sizeInBytes>900000) { // MB
$val = $sizeInBytes/(1024*1024);
return number_format($val, (($val<20)?1:0), '.', '').' M';
} else { // KB
$val = $sizeInBytes/(1024);
return number_format($val, (($val<20)?1:0), '.', '').' K';
}
} else { // Bytes
return $sizeInBytes.'&nbsp;&nbsp;';
}
}
}
t3lib/class.t3lib_befunc.php (working copy)
if (count($rows)) return $rows;
}
}
/**
* Returns a WHERE clause which will make an AND search for the words in the $searchWords array in any of the fields in array $fields.
* Usage: 0
*
* @param array Array of search words
* @param array Array of fields
* @param string Table in which we are searching (for DBAL detection of quoteStr() method)
* @return string WHERE clause for search
* @deprecated since TYPO3 3.6, this function will be removed in TYPO3 4.5, use $GLOBALS['TYPO3_DB']->searchQuery() directly!
*/
public static function searchQuery($searchWords, $fields, $table = '') {
t3lib_div::logDeprecatedFunction();
return $GLOBALS['TYPO3_DB']->searchQuery($searchWords, $fields, $table);
}
/**
* Returns a WHERE clause that can find a value ($value) in a list field ($field)
* For instance a record in the database might contain a list of numbers, "34,234,5" (with no spaces between). This query would be able to select that record based on the value "34", "234" or "5" regardless of their positioni in the list (left, middle or right).
* Is nice to look up list-relations to records or files in TYPO3 database tables.
* Usage: 0
*
* @param string Table field name
* @param string Value to find in list
* @return string WHERE clause for a query
* @deprecated since TYPO3 3.6, this function will be removed in TYPO3 4.5, use $GLOBALS['TYPO3_DB']->listQuery() directly!
*/
public static function listQuery($field, $value) {
t3lib_div::logDeprecatedFunction();
return $GLOBALS['TYPO3_DB']->listQuery($field, $value, '');
}
/**
* Makes an backwards explode on the $str and returns an array with ($table, $uid).
......
/*******************************************
*
* SQL-related, DEPRECATED functions
* (use t3lib_DB functions instead)
*
*******************************************/
/**
* Returns a SELECT query, selecting fields ($select) from two/three tables joined
* $local_table and $mm_table is mandatory. $foreign_table is optional.
* The JOIN is done with [$local_table].uid <--> [$mm_table].uid_local / [$mm_table].uid_foreign <--> [$foreign_table].uid
* The function is very useful for selecting MM-relations between tables adhering to the MM-format used by TCE (TYPO3 Core Engine). See the section on $TCA in Inside TYPO3 for more details.
*
* @param string Field list for SELECT
* @param string Tablename, local table
* @param string Tablename, relation table
* @param string Tablename, foreign table
* @param string Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
* @param string Optional GROUP BY field(s), if none, supply blank string.
* @param string Optional ORDER BY field(s), if none, supply blank string.
* @param string Optional LIMIT value ([begin,]max), if none, supply blank string.
* @return string Full SQL query
* @deprecated since TYPO3 3.6, this function will be removed in TYPO3 4.5, use $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query() instead since that will return the result pointer while this returns the query. Using this function may make your application less fitted for DBAL later.
* @see t3lib_DB::exec_SELECT_mm_query()
*/
public static function mm_query($select, $local_table, $mm_table, $foreign_table, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '') {
t3lib_div::logDeprecatedFunction();
$query = $GLOBALS['TYPO3_DB']->SELECTquery(
$select,
$local_table.','.$mm_table.($foreign_table?','.$foreign_table:''),
$local_table.'.uid='.$mm_table.'.uid_local'.($foreign_table?' AND '.$foreign_table.'.uid='.$mm_table.'.uid_foreign':'').' '.
$whereClause, // whereClauseMightContainGroupOrderBy
$groupBy,
$orderBy,
$limit
);
return $query;
}
/**
* Creates an INSERT SQL-statement for $table from the array with field/value pairs $fields_values.
* DEPRECATED - $GLOBALS['TYPO3_DB']->INSERTquery() directly instead! But better yet, use $GLOBALS['TYPO3_DB']->exec_INSERTquery()
*
* @param string Table name
* @param array Field values as key=>value pairs.
* @return string Full SQL query for INSERT
* @deprecated since TYPO3 3.6, this function will be removed in TYPO3 4.5, use $GLOBALS['TYPO3_DB']->exec_INSERTquery() directly!
*/
public static function DBcompileInsert($table, $fields_values) {
t3lib_div::logDeprecatedFunction();
return $GLOBALS['TYPO3_DB']->INSERTquery($table, $fields_values);
}
/**
* Creates an UPDATE SQL-statement for $table where $where-clause (typ. 'uid=...') from the array with field/value pairs $fields_values.
* DEPRECATED - $GLOBALS['TYPO3_DB']->UPDATEquery() directly instead! But better yet, use $GLOBALS['TYPO3_DB']->exec_UPDATEquery()
*
* @param string Database tablename
* @param string WHERE clause, eg. "uid=1"
* @param array Field values as key=>value pairs.
* @return string Full SQL query for UPDATE
* @deprecated since TYPO3 3.6, this function will be removed in TYPO3 4.5, use $GLOBALS['TYPO3_DB']->exec_UPDATEquery() directly!
*/
public static function DBcompileUpdate($table, $where, $fields_values) {
t3lib_div::logDeprecatedFunction();
return $GLOBALS['TYPO3_DB']->UPDATEquery($table, $where, $fields_values);
}
/*******************************************
*
* Page tree, TCA related
......
: '';
}
/**
* Returns either title = '' or alt = '' attribute. This depends on the client browser and whether it supports title = '' or not (which is the default)
* If no $content is given only the attribute name is returned.
* The returned attribute with content will have a leading space char.
* Warning: Be careful to submit empty $content var - that will return just the attribute name!
* Usage: 0
*
* @param string String to set as title-attribute. If no $content is given only the attribute name is returned.
* @param boolean If $hsc is set, then content of the attribute is htmlspecialchar()'ed (which is good for XHTML and other reasons...)
* @return string
* @deprecated since TYPO3 3.6, this function will be removed in TYPO3 4.5 - The idea made sense with older browsers, but now all browsers should support the "title" attribute - so just hardcode the title attribute instead!
*/
public static function titleAttrib($content = '', $hsc = 0) {
t3lib_div::logDeprecatedFunction();
global $CLIENT;
$attrib= ($CLIENT['BROWSER']=='net'&&$CLIENT['VERSION']<5)||$CLIENT['BROWSER']=='konqu' ? 'alt' : 'title';
return strcmp($content, '')?' '.$attrib.'="'.($hsc?htmlspecialchars($content):$content).'"' : $attrib;
}
/**
* Returns alt="" and title="" attributes with the value of $content.
......
return $itemArray;
}
/**
* Call to update the page tree frame (or something else..?) after
* t3lib_BEfunc::getSetUpdateSignal('updatePageTree') -> will set the page tree to be updated.
* t3lib_BEfunc::getSetUpdateSignal() -> will return some JavaScript that does the update (called in the typo3/template.php file, end() function)
* please use the setUpdateSignal function instead now, as it allows you to add more parameters
* Usage: 11
*
* @param string Whether to set or clear the update signal. When setting, this value contains strings telling WHAT to set. At this point it seems that the value "updatePageTree" is the only one it makes sense to set.
* @return string HTML code (<script> section)
* @see t3lib_BEfunc::getUpdateSignalCode()
* @see t3lib_BEfunc::setUpdateSignal()
* @deprecated since TYPO3 4.2, this function will be removed in TYPO3 4.5, use the setUpdateSignal function instead, as it allows you to add more parameters
*/
public static function getSetUpdateSignal($set = '') {
t3lib_div::logDeprecatedFunction();
// kept for backwards compatibility if $set is empty, use "getUpdateSignalCode()" instead
if ($set) {
return self::setUpdateSignal($set);
} else {
return self::getUpdateSignalCode();
}
}
/**
* Call to update the page tree frame (or something else..?) after
......
return $paramArr;
}
/**
* Returns "list of backend modules". Most likely this will be obsolete soon / removed. Don't use.
* Usage: 0
*
* @param array Module names in array. Must be "addslashes()"ed
* @param string Perms clause for SQL query
* @param string Backpath
* @param string The URL/script to jump to (used in A tag)
* @return array Two keys, rows and list
* @internal
* @deprecated since TYPO3 3.6, this function will be removed in TYPO3 4.5.
* @obsolete
*/
public static function getListOfBackendModules($name, $perms_clause, $backPath = '', $script = 'index.php') {
t3lib_div::logDeprecatedFunction();
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'doktype!=255 AND module IN (\'' . implode('\',\'', $name) . '\') AND' . $perms_clause . self::deleteClause('pages'));
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res)) return false;
$out = '';
$theRows = array();
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$theRows[] = $row;
$out.='<span class="nobr"><a href="'.htmlspecialchars($script.'?id='.$row['uid']).'">'.
t3lib_iconWorks::getIconImage('pages', $row, $backPath, 'title="' . htmlspecialchars(self::getRecordPath($row['uid'], $perms_clause, 20)) . '" align="top"') .
htmlspecialchars($row['title']).
'</a></span><br />';
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
return array('rows'=>$theRows, 'list'=>$out);
}
/**
* Returns the name of the backend script relative to the TYPO3 main directory.
typo3/index.php (working copy)
return $output;
}
/**
* Outputs an empty string. This function is obsolete and kept for the
* compatibility only.
*
* @param string $unused Unused
* @return string HTML output
* @deprecated since TYPO3 4.3, all the functionality was put in $this->startForm() and $this->addFields_hidden
*/
function getHiddenFields($unused = '') {
t3lib_div::logDeprecatedFunction();
return '';
}
/**
* Creates JavaScript for the login form
typo3/sysext/cms/tslib/class.tslib_pibase.php (working copy)
return ' class="'.trim($output).'"';
}
/**
* Sets CSS style-data for the $class-suffix (prefixed by pi_getClassName())
*
* @param string $class: Class suffix, see pi_getClassName
* @param string $data: CSS data
* @param string If $selector is set to any CSS selector, eg 'P' or 'H1' or 'TABLE' then the style $data will regard those HTML-elements only
* @return void
* @deprecated since TYPO3 3.6, this function will be removed in TYPO3 4.5, I think this function should not be used (and probably isn't used anywhere). It was a part of a concept which was left behind quite quickly.
* @obsolete
* @private
*/
function pi_setClassStyle($class,$data,$selector='') {
t3lib_div::logDeprecatedFunction();
$GLOBALS['TSFE']->setCSS($this->pi_getClassName($class).($selector?' '.$selector:''),'.'.$this->pi_getClassName($class).($selector?' '.$selector:'').' {'.$data.'}');
}
/**
* Wraps the input string in a <div> tag with the class attribute set to the prefixId.
t3lib/class.t3lib_tceforms.php (working copy)
return 'document.'.$this->formName."['".$itemName."']";
}
/**
* Returns the "No title" string if the input $str is empty.
*
* DEPRECATED: Use t3lib_BEfunc::getRecordTitle with the $forceResult flag set.
*
* @param string The string which - if empty - will become the no-title string.
* @param array Array with wrappin parts for the no-title output (in keys [0]/[1])
* @return string
* @deprecated since TYPO3 4.1, this function will be removed in TYPO3 4.5.
*/
function noTitle($str,$wrapParts=array()) {
t3lib_div::logDeprecatedFunction();
return strcmp($str,'') ? $str : $wrapParts[0].'['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title').']'.$wrapParts[1];
}
/**
* Returns 'this.blur();' string, if supported.
typo3/sysext/cms/tslib/class.tslib_menu.php (working copy)
}
}
/**
* Includes the PHP script defined for the HMENU special type "userdefined".
* This script is supposed to populate the array $menuItemsArray with a set of page records comprising the menu.
* The "userdefined" type is deprecated since "userfunction" has arrived since and is a better choice for many reasons (like using classes/functions for rendering the menu)
*
* @param array TypoScript parameters for "special.". In particular the property "file" is reserved and specifies the file to include. Seems like any other property can be used freely by the script.
* @param string The sorting field. Can be used from the script in the $incFile.
* @return array An array with the menu items
* @deprecated since TYPO3 3.6, this function will be removed in TYPO3 4.5, use HMENU of type "userfunction" instead of "userdefined"
* @access private
*/
function includeMakeMenu($conf,$altSortField) {
t3lib_div::logDeprecatedFunction();
$incFile = $GLOBALS['TSFE']->tmpl->getFileName($conf['file']);
if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile)) {
include($incFile);
}
return is_array($menuItemsArray) ? $menuItemsArray : array();
}
... This diff was truncated because it exceeds the maximum size that can be displayed.
(2-2/2)