Initial commit

This commit is contained in:
2018-04-02 08:07:38 +02:00
commit 7330c1ed3e
2054 changed files with 405203 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
RewriteEngine On
RewriteRule ^typo3$ - [L]
RewriteRule ^typo3/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php

View File

@@ -0,0 +1,447 @@
<?php
abstract class tx_realurl_apiwrapper {
/**
* @return tx_realurl_apiwrapper
*/
static public function getInstance() {
if (version_compare(TYPO3_branch, '6.0', '<')) {
$wrapperClassName = 'tx_realurl_apiwrapper_4x';
$utilityClassName = 't3lib_div';
}
else {
$wrapperClassName = 'tx_realurl_apiwrapper_6x';
$utilityClassName = '\\TYPO3\\CMS\\Core\\Utility\\GeneralUtility';
}
return call_user_func_array(array($utilityClassName, 'makeInstance'), array($wrapperClassName));
}
/**
* @param $userFunc
* @param $parameters
* @param $object
* @return mixed
* @see t3lib_div::callUserFunction
*/
abstract public function callUserFunction($userFunc, &$parameters, $object);
/**
* @param $parameters
* @return string
*/
abstract public function getRelevantChashParameters($parameters);
/**
* @param $parameters
* @return string
*/
abstract public function calculateChash(array $parameters);
/**
* @param $delimiter
* @param $string
* @param bool $removeEmptyValues
* @param int $limit
* @return array
* @see t3lib_div::trimExplode
*/
abstract public function trimExplode($delimiter, $string, $removeEmptyValues = FALSE, $limit = 0);
/**
* @param $path
* @return mixed
* @seee t3lib_div::locationHeaderUrl()
*/
abstract public function locationHeaderUrl($path);
/**
* @param $fileref
* @return array
* @see t3lib_div::split_fileref
*/
abstract public function split_fileref($fileref);
/**
* @param $str
* @return int
* @see t3lib_div::md5int()
*/
abstract public function md5int($str);
/*
* @param string $getEnvName Name of the "environment variable"/"server variable" you wish to use. Valid values are SCRIPT_NAME, SCRIPT_FILENAME, REQUEST_URI, PATH_INFO, REMOTE_ADDR, REMOTE_HOST, HTTP_REFERER, HTTP_HOST, HTTP_USER_AGENT, HTTP_ACCEPT_LANGUAGE, QUERY_STRING, TYPO3_DOCUMENT_ROOT, TYPO3_HOST_ONLY, TYPO3_HOST_ONLY, TYPO3_REQUEST_HOST, TYPO3_REQUEST_URL, TYPO3_REQUEST_SCRIPT, TYPO3_REQUEST_DIR, TYPO3_SITE_URL, _ARRAY
* @return string Value based on the input key, independent of server/os environment.
* @throws \UnexpectedValueException
* @see t3lib_div::getIndpEnv()
*/
abstract public function getIndpEnv($getEnvName);
/**
* @param string $name Name prefix for entries. Set to blank if you wish none.
* @param array $theArray The (multidimensional) array to implode
* @param string $str (keep blank)
* @param bool $skipBlank If set, parameters which were blank strings would be removed.
* @param bool $rawurlencodeParamName If set, the param name itself (for example "param[key][key2]") would be rawurlencoded as well.
* @return string Imploded result, fx. &param[key][key2]=value2&param[key][key3]=value3
* @see t3lib_div::implodeArrayForUrl();
*/
abstract public function implodeArrayForUrl($name, array $theArray, $str = '', $skipBlank = FALSE, $rawurlencodeParamName = FALSE);
/**
* @param $varName
* @return mixed
* @see t3lib_div::_GET()
*/
abstract public function _GET($varName);
/**
* @param $varName
* @return mixed
* @see t3lib_div::_POST()
*/
abstract public function _POST($varName);
/**
* @param $varName
* @return mixed
* @see t3lib_div::_GET()
*/
abstract public function _GP($varName);
/**
* @param array $theArray Multidimensional input array, (REFERENCE!)
* @return array
*/
abstract public function stripSlashesOnArray(array &$theArray);
/**
* @param string $delimiter Delimiter string to explode with
* @param string $string The string to explode
* @param int $count Number of array entries
* @return array Exploded values
*/
abstract public function revExplode($delimiter, $string, $count = 0);
/**
* @param string $list Comma-separated list of items (string)
* @param string $item Item to check for
* @return bool TRUE if $item is in $list
*/
abstract public function inList($list, $item);
/**
* @param $charset
* @param $string
* @return mixed
* @see t3lib_cs::strlen()
*/
abstract public function strlen($charset, $string);
/**
* @param string $charset The character set
* @param string $string Character string
* @param int $len Length (in characters)
* @param string $crop Crop signifier
* @return string The shortened string
* @see substr(), mb_strimwidth()
*/
abstract public function crop($charset, $string, $len, $crop = '');
/**
* @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)
*/
abstract public function shortMD5($input, $len = 10);
/**
* @param string $className name of the class to instantiate, must not be empty
* @return object the created instance
*/
abstract public function makeInstance($className);
/**
* @param string $msg Message (in english).
* @param string $extKey Extension key (from which extension you are calling the log)
* @param int $severity Severity: 0 is info, 1 is notice, 2 is warning, 3 is fatal error, -1 is "OK" message
* @param mixed $dataVar Additional data you want to pass to the logger.
* @return void
*/
abstract public function devLog($msg, $extKey, $severity = 0, $dataVar = FALSE);
/**
* @param mixed $value
* @return bool
*/
abstract public function testInt($value);
/**
* @param array $array1
* @param array $array2
* @return array
*/
abstract public function array_merge_recursive_overrule($array1, $array2);
abstract public function isExtLoaded($extKey);
/**
* @param string $msg Message (in English).
* @param string $extKey Extension key (from which extension you are calling the log) or "Core
* @param int $severity \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_* constant
* @return void
*/
abstract public function sysLog($msg, $extKey, $severity = 0);
/**
* @param string $in_list Accept multiple parameters which can be comma-separated lists of values and arrays.
* @param mixed $secondParameter Dummy field, which if set will show a warning!
* @return string Returns the list without any duplicates of values, space around values are trimmed
*/
abstract public function uniqueList($in_list, $secondParameter = NULL);
/**
* @return t3lib_pageSelect|\TYPO3\CMS\Frontend\Page\PageRepository
*/
abstract public function getPageRepository();
/**
* @param array $arr1 First array
* @param array $arr2 Second array
* @return array Merged result.
*/
abstract public function array_merge(array $arr1, array $arr2);
/**
* @param array $modTSconfig Module TS config array
* @param array $itemArray Array of items from which to remove items.
* @param string $TSref $TSref points to the "object string" in $modTSconfig
* @return array The modified $itemArray is returned.
*/
abstract public function unsetMenuItems($modTSconfig, $itemArray, $TSref);
/**
* @param mixed $mainParams The "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
* @param string $elementName The form elements name, probably something like "SET[...]
* @param string $currentValue The value to be selected currently.
* @param array $menuItems An array with the menu items for the selector box
* @param string $script The script to send the &id to, if empty it's automatically found
* @param string $addParams Additional parameters to pass to the script.
* @return string HTML code for selector box
*/
abstract public function getFuncMenu($mainParams, $elementName, $currentValue, $menuItems, $script = '', $addParams = '');
/**
* @return t3lib_pageTree|\TYPO3\CMS\Backend\Tree\View\PageTreeView
*/
abstract public function getPageTree();
/**
* @param string $table Table name
* @param array $row Record array passed by reference. As minimum, the "uid" and "pid" fields must exist! Fake fields cannot exist since the fields in the array is used as field names in the SQL look up. It would be nice to have fields like "t3ver_state" and "t3ver_mode_id" as well to avoid a new lookup inside movePlhOL().
* @param int $wsid Workspace ID, if not specified will use static::getBackendUserAuthentication()->workspace
* @param bool $unsetMovePointers If TRUE the function does not return a "pointer" row for moved records in a workspace
* @return void
* @see fixVersioningPid()
*/
abstract public function workspaceOL($table, &$row, $wsid = -99, $unsetMovePointers = FALSE);
/**
* @param string $table Table name present in $GLOBALS['TCA']
* @param int $uid UID of record
* @param string $fields List of fields to select
* @param string $where Additional WHERE clause, eg. " AND blablabla = 0
* @param bool $useDeleteClause Use the deleteClause to check if a record is deleted (default TRUE)
* @return array|NULL Returns the row if found, otherwise NULL
*/
abstract public function getRecord($table, $uid, $fields = '*', $where = '', $useDeleteClause = TRUE);
/**
* @param string $table Table name, present in TCA
* @param array $row Row from table
* @param bool $prep If set, result is prepared for output: The output is cropped to a limited length (depending on BE_USER->uc['titleLen']) and if no value is found for the title, '<em>[No title]</em>' is returned (localized). Further, the output is htmlspecialchars()'ed
* @param bool $forceResult If set, the function always returns an output. If no value is found for the title, '[No title]' is returned (localized).
* @return string
*/
abstract public function getRecordTitle($table, $row, $prep = FALSE, $forceResult = TRUE);
/**
* @param string $theTable Table name present in $GLOBALS['TCA']
* @param string $theField Field to select on
* @param string $theValue Value that $theField must match
* @param string $whereClause Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
* @param string $groupBy Optional GROUP BY field(s), if none, supply blank string.
* @param string $orderBy Optional ORDER BY field(s), if none, supply blank string.
* @param string $limit Optional LIMIT value ([begin,]max), if none, supply blank string.
* @param bool $useDeleteClause Use the deleteClause to check if a record is deleted (default TRUE)
* @return mixed Multidimensional array with selected records (if any is selected)
*/
abstract public function getRecordsByField($theTable, $theField, $theValue, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '', $useDeleteClause = TRUE);
/**
* Returns a JavaScript string (for an onClick handler) which will load the alt_doc.php script that shows the form for editing of the record(s) you have send as params.
* REMEMBER to always htmlspecialchar() content in href-properties to ampersands get converted to entities (XHTML requirement and XSS precaution)
*
* @param string $params Parameters sent along to alt_doc.php. This requires a much more details description which you must seek in Inside TYPO3s documentation of the alt_doc.php API. And example could be '&edit[pages][123] = edit' which will show edit form for page record 123.
* @param string $backPath Must point back to the TYPO3_mainDir directory (where alt_doc.php is)
* @param string $requestUri An optional returnUrl you can set - automatically set to REQUEST_URI.
*
* @return string
* @see \TYPO3\CMS\Backend\Template\DocumentTemplate::issueCommand()
*/
abstract public function editOnClick($params, $backPath = '', $requestUri = '');
/**
* Returns a JavaScript string for viewing the page id, $id
* It will detect the correct domain name if needed and provide the link with the right back path.
* Also it will re-use any window already open.
*
* @param int $pageUid Page UID
* @param string $backPath Must point back to TYPO3_mainDir (where the site is assumed to be one level above)
* @param array|NULL $rootLine If root line is supplied the function will look for the first found domain record and use that URL instead (if found)
* @param string $anchorSection Optional anchor to the URL
* @param string $alternativeUrl An alternative URL that, if set, will ignore other parameters except $switchFocus: It will return the window.open command wrapped around this URL!
* @param string $additionalGetVars Additional GET variables.
* @param bool $switchFocus If TRUE, then the preview window will gain the focus.
* @return string
*/
abstract public function viewOnClick($pageUid, $backPath = '', $rootLine = NULL, $anchorSection = '', $alternativeUrl = '', $additionalGetVars = '', $switchFocus = TRUE);
/**
* @param string $str Full string to check
* @param string $partStr Reference string which must be found as the "first part" of the full string
* @return bool TRUE if $partStr was found to be equal to the first part of $str
*/
abstract public function isFirstPartOfStr($str, $partStr);
/**
* @param int $tstamp Time stamp, seconds
* @param int $prefix 1/-1 depending on polarity of age.
* @param string $date $date=="date" will yield "dd:mm:yy" formatting, otherwise "dd:mm:yy hh:mm
* @return string
*/
abstract public function dateTimeAge($tstamp, $prefix = 1, $date = '');
/**
* Returns the Page TSconfig for page with id, $id
*
* @param int $id Page uid for which to create Page TSconfig
* @param array $rootLine If $rootLine is an array, that is used as rootline, otherwise rootline is just calculated
* @param bool $returnPartArray If $returnPartArray is set, then the array with accumulated Page TSconfig is returned non-parsed. Otherwise the output will be parsed by the TypoScript parser.
* @return array Page TSconfig
* @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
*/
abstract public function getPagesTSconfig($id, $rootLine = NULL, $returnPartArray = FALSE);
/**
* Returns $tstamp formatted as "ddmmyy hhmm" (According to $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] AND $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'])
*
* @param int $value Time stamp, seconds
* @return string Formatted time
*/
abstract public function datetime($value);
/**
* Returns the "age" in minutes / hours / days / years of the number of $seconds inputted.
*
* @param int $seconds Seconds could be the difference of a certain timestamp and time()
* @param string $labels Labels should be something like ' min| hrs| days| yrs| min| hour| day| year'. This value is typically delivered by this function call: $GLOBALS["LANG"]->sL("LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears")
* @return string Formatted time
*/
abstract public function calcAge($seconds, $labels = ' min| hrs| days| yrs| min| hour| day| year');
/**
* @return t3lib_arrayBrowser|\TYPO3\CMS\Lowlevel\Utility\ArrayBrowser
*/
abstract public function getArrayBrowser();
/**
* @param int $id Page uid
* @param string $TSref An object string which determines the path of the TSconfig to return.
* @return array
*/
abstract public function getModTSconfig($id, $TSref);
/**
* @param string $backPath Current backpath to PATH_typo3 folder
* @param string $src Icon file name relative to PATH_typo3 folder
* @param string $wHattribs Default width/height, defined like 'width="12" height="14"'
* @param int $outputMode Mode: 0 (zero) is default and returns src/width/height. 1 returns value of src+backpath, 2 returns value of w/h.
* @return string Returns ' src="[backPath][src]" [wHattribs]'
* @see skinImgFile()
*/
abstract public function skinImg($backPath, $src, $wHattribs = '', $outputMode = 0);
/**
* Converts a one dimensional array to a one line string which can be used for logging or debugging output
* Example: "loginType: FE; refInfo: Array; HTTP_HOST: www.example.org; REMOTE_ADDR: 192.168.1.5; REMOTE_HOST:; security_level:; showHiddenRecords: 0;"
*
* @param array $arr Data array which should be outputted
* @param mixed $valueList List of keys which should be listed in the output string. Pass a comma list or an array. An empty list outputs the whole array.
* @param int $valueLength Long string values are shortened to this length. Default: 20
* @return string Output string with key names and their value as string
*/
abstract public function arrayToLogString(array $arr, $valueList = array(), $valueLength = 20);
/**
* Truncates a string with appended/prepended "..." and takes current character set into consideration.
*
* @param string $string String to truncate
* @param int $chars Must be an integer with an absolute value of at least 4. if negative the string is cropped from the right end.
* @param string $appendString Appendix to the truncated string
* @return string Cropped string
*/
abstract public function fixed_lgd_cs($string, $chars, $appendString = '...');
/**
* @param string The table name
* @param array The table row ("enablefields" are at least needed for correct icon display and for pages records some more fields in addition!)
* @param string The backpath to the main TYPO3 directory (relative path back to PATH_typo3)
* @param string Additional attributes for the image tag
* @param boolean If set, the icon will be grayed/shaded
* @return string <img>-tag
* @see getIcon()
*/
abstract public function getIconImage($table, $row = array(), $backPath, $params = '', $shaded = FALSE);
/**
* @param int $uid
* @param string $clause
* @param boolean $workspaceOL
* @return array
*/
abstract public function BEgetRootLine($uid, $clause = '', $workspaceOL = FALSE);
/**
* Makes the page tree class instance.
*
* @return t3lib_pageTree|\TYPO3\CMS\Backend\Tree\View\PageTreeView
*/
abstract public function makePageTreeInstance();
/**
* Obtains the lock object with a given name.
*
* @param string $lockObjectName
* @return t3lib_lock|\TYPO3\CMS\Core\Locking\Locker
*/
abstract public function getLockObject($lockObjectName);
/**
* Sets the file system mode and group ownership of a file or a folder.
*
* @param string $path Path of file or folder, must not be escaped. Path can be absolute or relative
* @param bool $recursive If set, also fixes permissions of files and folders in the folder (if $path is a folder)
* @return mixed TRUE on success, FALSE on error, always TRUE on Windows OS
*/
abstract public function fixPermissions($path, $recursive = FALSE);
/**
* Creates a database connection if it is not exist.
*
* @return t3lib_db|\TYPO3\CMS\Core\Database\DatabaseConnection
*/
abstract public function getDatabaseConnection();
}

View File

@@ -0,0 +1,646 @@
<?php
class tx_realurl_apiwrapper_4x extends tx_realurl_apiwrapper implements t3lib_Singleton {
/** @var t3lib_cs $csConvObj */
protected $csConvObj;
public function __construct() {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
$this->csConv = t3lib_div::makeInstance('t3lib_cs');
}
/**
* @param $userFunc
* @param $parameters
* @param $object
* @return mixed
* @see t3lib_div::callUserFunction
*/
public function callUserFunction($userFunc, &$parameters, $object) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::callUserFunction($userFunc, $parameters, $object);
}
/**
* @param string $cHashParameters
* @return string
*/
public function getRelevantChashParameters($cHashParameters) {
$cacheHashClassExists = class_exists('t3lib_cacheHash');
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
$cacheHash = ($cacheHashClassExists ? t3lib_div::makeInstance('t3lib_cacheHash') : NULL);
/** @noinspection PhpUndefinedClassInspection */
/* @var t3lib_cacheHash $cacheHash */
if ($cacheHashClassExists) {
/** @noinspection PhpUndefinedMethodInspection */
$result = $cacheHash->getRelevantParameters($cHashParameters);
} else {
/** @noinspection PhpUndefinedMethodInspection PhpDeprecationInspection PhpUndefinedClassInspection */
$result = t3lib_div::cHashParams($cHashParameters);
}
return $result;
}
/**
* @param array $cHashParameters
* @return string
*/
public function calculateChash(array $cHashParameters) {
$cacheHashClassExists = class_exists('t3lib_cacheHash');
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
$cacheHash = ($cacheHashClassExists ? t3lib_div::makeInstance('t3lib_cacheHash') : NULL);
/** @noinspection PhpUndefinedClassInspection */
/* @var t3lib_cacheHash $cacheHash */
if ($cacheHashClassExists) {
/** @noinspection PhpUndefinedMethodInspection */
$result = $cacheHash->calculateCacheHash($cHashParameters);
} elseif (method_exists('t3lib_div', 'calculateCHash')) {
/** @noinspection PhpUndefinedMethodInspection PhpDeprecationInspection PhpUndefinedClassInspection */
$result = t3lib_div::calculateCHash($cHashParameters);
} else {
/** @noinspection PhpUndefinedMethodInspection PhpDeprecationInspection PhpUndefinedClassInspection */
$result = t3lib_div::shortMD5(serialize($cHashParameters));
}
return $result;
}
/**
* @param $delimiter
* @param $string
* @param bool $removeEmptyValues
* @param int $limit
* @return array
* @see t3lib_div::trimExplode
*/
public function trimExplode($delimiter, $string, $removeEmptyValues = FALSE, $limit = 0) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::trimExplode($delimiter, $string, $removeEmptyValues, $limit);
}
/**
* @param $path
* @return mixed
* @seee t3lib_div::locationHeaderUrl()
*/
public function locationHeaderUrl($path) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::locationHeaderUrl($path);
}
/**
* @param $fileref
* @return array
* @see t3lib_div::split_fileref
*/
public function split_fileref($fileref) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::split_fileref($fileref);
}
/**
* @param $str
* @return int
* @see t3lib_div::md5int()
*/
public function md5int($str) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::md5int($str);
}
/*
* @param string $getEnvName Name of the "environment variable"/"server variable" you wish to use. Valid values are SCRIPT_NAME, SCRIPT_FILENAME, REQUEST_URI, PATH_INFO, REMOTE_ADDR, REMOTE_HOST, HTTP_REFERER, HTTP_HOST, HTTP_USER_AGENT, HTTP_ACCEPT_LANGUAGE, QUERY_STRING, TYPO3_DOCUMENT_ROOT, TYPO3_HOST_ONLY, TYPO3_HOST_ONLY, TYPO3_REQUEST_HOST, TYPO3_REQUEST_URL, TYPO3_REQUEST_SCRIPT, TYPO3_REQUEST_DIR, TYPO3_SITE_URL, _ARRAY
* @return string Value based on the input key, independent of server/os environment.
* @throws \UnexpectedValueException
* @see t3lib_div::getIndpEnv()
*/
public function getIndpEnv($getEnvName) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::getIndpEnv($getEnvName);
}
/**
* @param string $name Name prefix for entries. Set to blank if you wish none.
* @param array $theArray The (multidimensional) array to implode
* @param string $str (keep blank)
* @param bool $skipBlank If set, parameters which were blank strings would be removed.
* @param bool $rawurlencodeParamName If set, the param name itself (for example "param[key][key2]") would be rawurlencoded as well.
* @return string Imploded result, fx. &param[key][key2]=value2&param[key][key3]=value3
* @see t3lib_div::implodeArrayForUrl();
*/
public function implodeArrayForUrl($name, array $theArray, $str = '', $skipBlank = FALSE, $rawurlencodeParamName = FALSE) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::implodeArrayForUrl($name, $theArray, $str, $skipBlank, $rawurlencodeParamName);
}
/**
* @param $varName
* @return mixed
* @see t3lib_div::_GET()
*/
public function _GET($varName) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::_GET($varName);
}
/**
* @param $varName
* @return mixed
* @see t3lib_div::_POST()
*/
public function _POST($varName) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::_POST($varName);
}
/**
* @param $varName
* @return mixed
* @see t3lib_div::_GET()
*/
public function _GP($varName) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::_GP($varName);
}
/**
* @param array $theArray Multidimensional input array, (REFERENCE!)
* @return array
*/
public function stripSlashesOnArray(array &$theArray) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::stripSlashesOnArray($theArray);
}
/**
* @param string $delimiter Delimiter string to explode with
* @param string $string The string to explode
* @param int $count Number of array entries
* @return array Exploded values
*/
public function revExplode($delimiter, $string, $count = 0) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::revExplode($delimiter, $string, $count);
}
/**
* @param string $list Comma-separated list of items (string)
* @param string $item Item to check for
* @return bool TRUE if $item is in $list
*/
public function inList($list, $item) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::inList($list, $item);
}
/**
* @param $charset
* @param $string
* @return mixed
* @see t3lib_cs::strlen()
*/
public function strlen($charset, $string) {
return $this->csConv->strlen($charset, $string);
}
/**
* @param string $charset The character set
* @param string $string Character string
* @param int $len Length (in characters)
* @param string $crop Crop signifier
* @return string The shortened string
* @see substr(), mb_strimwidth()
*/
public function crop($charset, $string, $len, $crop = '') {
return $this->csConv->crop($charset, $string, $len, $crop);
}
/**
* @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);
}
/**
* @param string $className name of the class to instantiate, must not be empty
* @return object the created instance
*/
public function makeInstance($className) {
return call_user_func_array(array('t3lib_div', 'makeInstance'), func_get_args());
}
/**
* @param string $msg Message (in english).
* @param string $extKey Extension key (from which extension you are calling the log)
* @param int $severity Severity: 0 is info, 1 is notice, 2 is warning, 3 is fatal error, -1 is "OK" message
* @param mixed $dataVar Additional data you want to pass to the logger.
* @return void
*/
public function devLog($msg, $extKey, $severity = 0, $dataVar = FALSE) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
t3lib_div::devLog($msg, $extKey, $severity, $dataVar);
}
/**
* @param mixed $value
* @return bool
*/
public function testInt($value) {
static $useOldGoodTestInt = null;
if (is_null($useOldGoodTestInt)) {
$useOldGoodTestInt = !class_exists('t3lib_utility_Math');
}
if ($useOldGoodTestInt) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection PhpUndefinedMethodInspection */
$result = t3lib_div::testInt($value);
}
else {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
$result = t3lib_utility_Math::canBeInterpretedAsInteger($value);
}
return $result;
}
/**
* @param array $array1
* @param array $array2
* @return array
*/
public function array_merge_recursive_overrule($array1, $array2) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::array_merge_recursive_overrule($array1, $array2);
}
public function isExtLoaded($extKey) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_extMgm::isLoaded($extKey);
}
/**
* @param string $msg Message (in English).
* @param string $extKey Extension key (from which extension you are calling the log) or "Core
* @param int $severity \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_* constant
* @return void
*/
public function sysLog($msg, $extKey, $severity = 0) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
t3lib_div::sysLog($msg, $extKey, $severity);
}
/**
* @param string $in_list Accept multiple parameters which can be comma-separated lists of values and arrays.
* @param mixed $secondParameter Dummy field, which if set will show a warning!
* @return string Returns the list without any duplicates of values, space around values are trimmed
*/
public function uniqueList($in_list, $secondParameter = NULL) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::uniqueList($in_list, $secondParameter);
}
/**
* @return t3lib_pageSelect|\TYPO3\CMS\Frontend\Page\PageRepository
*/
public function getPageRepository() {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::makeInstance('t3lib_pageSelect');
}
/**
* @param array $arr1 First array
* @param array $arr2 Second array
* @return array Merged result.
*/
public function array_merge(array $arr1, array $arr2) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::array_merge($arr1, $arr2);
}
/**
* @param array $modTSconfig Module TS config array
* @param array $itemArray Array of items from which to remove items.
* @param string $TSref $TSref points to the "object string" in $modTSconfig
* @return array The modified $itemArray is returned.
*/
public function unsetMenuItems($modTSconfig, $itemArray, $TSref) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::unsetMenuItems($modTSconfig, $itemArray, $TSref);
}
/**
* @param mixed $mainParams The "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
* @param string $elementName The form elements name, probably something like "SET[...]
* @param string $currentValue The value to be selected currently.
* @param array $menuItems An array with the menu items for the selector box
* @param string $script The script to send the &id to, if empty it's automatically found
* @param string $addParams Additional parameters to pass to the script.
* @return string HTML code for selector box
*/
public function getFuncMenu($mainParams, $elementName, $currentValue, $menuItems, $script = '', $addParams = '') {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::getFuncMenu($mainParams, $elementName, $currentValue, $menuItems, $script, $addParams);
}
/**
* @return t3lib_pageTree
*/
public function getPageTree() {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::makeInstance('t3lib_pageTree');
}
/**
* @param string $table Table name present in $GLOBALS['TCA']
* @param int $uid UID of record
* @param string $fields List of fields to select
* @param string $where Additional WHERE clause, eg. " AND blablabla = 0
* @param bool $useDeleteClause Use the deleteClause to check if a record is deleted (default TRUE)
* @return array|NULL Returns the row if found, otherwise NULL
*/
public function getRecord($table, $uid, $fields = '*', $where = '', $useDeleteClause = TRUE) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::getRecord($table, $uid, $fields, $where, $useDeleteClause);
}
/**
* @param string $table Table name
* @param array $row Record array passed by reference. As minimum, the "uid" and "pid" fields must exist! Fake fields cannot exist since the fields in the array is used as field names in the SQL look up. It would be nice to have fields like "t3ver_state" and "t3ver_mode_id" as well to avoid a new lookup inside movePlhOL().
* @param int $wsid Workspace ID, if not specified will use static::getBackendUserAuthentication()->workspace
* @param bool $unsetMovePointers If TRUE the function does not return a "pointer" row for moved records in a workspace
* @return void
* @see fixVersioningPid()
*/
public function workspaceOL($table, &$row, $wsid = -99, $unsetMovePointers = FALSE) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
t3lib_BEfunc::workspaceOL($table, $row, $wsid, $unsetMovePointers);
}
/**
* @param string $table Table name, present in TCA
* @param array $row Row from table
* @param bool $prep If set, result is prepared for output: The output is cropped to a limited length (depending on BE_USER->uc['titleLen']) and if no value is found for the title, '<em>[No title]</em>' is returned (localized). Further, the output is htmlspecialchars()'ed
* @param bool $forceResult If set, the function always returns an output. If no value is found for the title, '[No title]' is returned (localized).
* @return string
*/
public function getRecordTitle($table, $row, $prep = FALSE, $forceResult = TRUE) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::getRecordTitle($table, $row, $prep, $forceResult);
}
/**
* @param string $theTable Table name present in $GLOBALS['TCA']
* @param string $theField Field to select on
* @param string $theValue Value that $theField must match
* @param string $whereClause Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
* @param string $groupBy Optional GROUP BY field(s), if none, supply blank string.
* @param string $orderBy Optional ORDER BY field(s), if none, supply blank string.
* @param string $limit Optional LIMIT value ([begin,]max), if none, supply blank string.
* @param bool $useDeleteClause Use the deleteClause to check if a record is deleted (default TRUE)
* @return mixed Multidimensional array with selected records (if any is selected)
*/
public function getRecordsByField($theTable, $theField, $theValue, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '', $useDeleteClause = TRUE) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::getRecordsByField($theTable, $theField, $theValue, $whereClause, $groupBy, $orderBy, $limit, $useDeleteClause);
}
/**
* Returns a JavaScript string (for an onClick handler) which will load the alt_doc.php script that shows the form for editing of the record(s) you have send as params.
* REMEMBER to always htmlspecialchar() content in href-properties to ampersands get converted to entities (XHTML requirement and XSS precaution)
*
* @param string $params Parameters sent along to alt_doc.php. This requires a much more details description which you must seek in Inside TYPO3s documentation of the alt_doc.php API. And example could be '&edit[pages][123] = edit' which will show edit form for page record 123.
* @param string $backPath Must point back to the TYPO3_mainDir directory (where alt_doc.php is)
* @param string $requestUri An optional returnUrl you can set - automatically set to REQUEST_URI.
*
* @return string
* @see \TYPO3\CMS\Backend\Template\DocumentTemplate::issueCommand()
*/
public function editOnClick($params, $backPath = '', $requestUri = '') {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::editOnClick($params, $backPath, $requestUri);
}
/**
* Returns a JavaScript string for viewing the page id, $id
* It will detect the correct domain name if needed and provide the link with the right back path.
* Also it will re-use any window already open.
*
* @param int $pageUid Page UID
* @param string $backPath Must point back to TYPO3_mainDir (where the site is assumed to be one level above)
* @param array|NULL $rootLine If root line is supplied the function will look for the first found domain record and use that URL instead (if found)
* @param string $anchorSection Optional anchor to the URL
* @param string $alternativeUrl An alternative URL that, if set, will ignore other parameters except $switchFocus: It will return the window.open command wrapped around this URL!
* @param string $additionalGetVars Additional GET variables.
* @param bool $switchFocus If TRUE, then the preview window will gain the focus.
* @return string
*/
public function viewOnClick($pageUid, $backPath = '', $rootLine = NULL, $anchorSection = '', $alternativeUrl = '', $additionalGetVars = '', $switchFocus = TRUE) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::viewOnClick($pageUid, $backPath, $rootLine, $anchorSection, $alternativeUrl, $additionalGetVars, $switchFocus);
}
/**
* @param string $str Full string to check
* @param string $partStr Reference string which must be found as the "first part" of the full string
* @return bool TRUE if $partStr was found to be equal to the first part of $str
*/
public function isFirstPartOfStr($str, $partStr) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::isFirstPartOfStr($str, $partStr);
}
/**
* @param int $tstamp Time stamp, seconds
* @param int $prefix 1/-1 depending on polarity of age.
* @param string $date $date=="date" will yield "dd:mm:yy" formatting, otherwise "dd:mm:yy hh:mm
* @return string
*/
public function dateTimeAge($tstamp, $prefix = 1, $date = '') {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::dateTimeAge($tstamp, $prefix, $date);
}
/**
* Returns the Page TSconfig for page with id, $id
*
* @param int $id Page uid for which to create Page TSconfig
* @param array $rootLine If $rootLine is an array, that is used as rootline, otherwise rootline is just calculated
* @param bool $returnPartArray If $returnPartArray is set, then the array with accumulated Page TSconfig is returned non-parsed. Otherwise the output will be parsed by the TypoScript parser.
* @return array Page TSconfig
* @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
*/
public function getPagesTSconfig($id, $rootLine = NULL, $returnPartArray = FALSE) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::getPagesTSconfig($id, $rootLine, $returnPartArray);
}
/**
* @param int $value Time stamp, seconds
* @return string Formatted time
*/
public function datetime($value) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::datetime($value);
}
/**
* @param int $seconds Seconds could be the difference of a certain timestamp and time()
* @param string $labels Labels should be something like ' min| hrs| days| yrs| min| hour| day| year'. This value is typically delivered by this function call: $GLOBALS["LANG"]->sL("LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears")
* @return string Formatted time
*/
public function calcAge($seconds, $labels = ' min| hrs| days| yrs| min| hour| day| year') {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::datetime($seconds, $labels);
}
/**
* @return t3lib_arrayBrowser|\TYPO3\CMS\Lowlevel\Utility\ArrayBrowser
*/
public function getArrayBrowser() {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::makeInstance('t3lib_arrayBrowser');
}
/**
* @param int $id Page uid
* @param string $TSref An object string which determines the path of the TSconfig to return.
* @return array
*/
public function getModTSconfig($id, $TSref) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_BEfunc::getModTSconfig($id, $TSref);
}
/**
* @param string $backPath Current backpath to PATH_typo3 folder
* @param string $src Icon file name relative to PATH_typo3 folder
* @param string $wHattribs Default width/height, defined like 'width="12" height="14"'
* @param int $outputMode Mode: 0 (zero) is default and returns src/width/height. 1 returns value of src+backpath, 2 returns value of w/h.
* @return string Returns ' src="[backPath][src]" [wHattribs]'
* @see skinImgFile()
*/
public function skinImg($backPath, $src, $wHattribs = '', $outputMode = 0) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_iconWorks::skinImg($backPath, $src, $wHattribs, $outputMode);
}
/**
* Converts a one dimensional array to a one line string which can be used for logging or debugging output
* Example: "loginType: FE; refInfo: Array; HTTP_HOST: www.example.org; REMOTE_ADDR: 192.168.1.5; REMOTE_HOST:; security_level:; showHiddenRecords: 0;"
*
* @param array $arr Data array which should be outputted
* @param mixed $valueList List of keys which should be listed in the output string. Pass a comma list or an array. An empty list outputs the whole array.
* @param int $valueLength Long string values are shortened to this length. Default: 20
* @return string Output string with key names and their value as string
*/
public function arrayToLogString(array $arr, $valueList = array(), $valueLength = 20) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::arrayToLogString($arr, $valueLength, $valueLength);
}
/**
* Truncates a string with appended/prepended "..." and takes current character set into consideration.
*
* @param string $string String to truncate
* @param int $chars Must be an integer with an absolute value of at least 4. if negative the string is cropped from the right end.
* @param string $appendString Appendix to the truncated string
* @return string Cropped string
*/
public function fixed_lgd_cs($string, $chars, $appendString = '...') {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::fixed_lgd_cs($string, $chars, $appendString);
}
/**
* Returns an icon image tag, 18x16 pixels, based on input information.
* This function is recommended to use in your backend modules.
* Usage: 60
*
* @param string The table name
* @param array The table row ("enablefields" are at least needed for correct icon display and for pages records some more fields in addition!)
* @param string The backpath to the main TYPO3 directory (relative path back to PATH_typo3)
* @param string Additional attributes for the image tag
* @param boolean If set, the icon will be grayed/shaded
* @return string <img>-tag
* @see getIcon()
*/
public function getIconImage($table, $row = array(), $backPath, $params = '', $shaded = FALSE) {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection PhpUndefinedMethodInspection */
return t3lib_iconWorks::getIconImage($table, $row, $backPath, $params, $shaded);
}
/**
* @param int $uid
* @param string $clause
* @param boolean $workspaceOL
* @return array
*/
public function BEgetRootLine($uid, $clause = '', $workspaceOL = FALSE) {
return t3lib_BEfunc::BEgetRootLine($uid, $clause, $workspaceOL);
}
/**
* Makes the page tree class instance.
*
* @return t3lib_pageTree|\TYPO3\CMS\Backend\Tree\View\PageTreeView
*/
public function makePageTreeInstance() {
return t3lib_div::makeInstance('t3lib_pageTree');
}
/**
* Obtains the lock object with a given name.
*
* @param string $lockObjectName
* @return t3lib_lock|\TYPO3\CMS\Core\Locking\Locker
*/
public function getLockObject($lockObjectName) {
$lockObject = t3lib_div::makeInstance('t3lib_lock', $lockObjectName, $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode']);
/** @var t3lib_lock $lockObject */
$lockObject->setEnableLogging(FALSE);
$lockObject->acquire();
return $lockObject;
}
/**
* Sets the file system mode and group ownership of a file or a folder.
*
* @param string $path Path of file or folder, must not be escaped. Path can be absolute or relative
* @param bool $recursive If set, also fixes permissions of files and folders in the folder (if $path is a folder)
* @return mixed TRUE on success, FALSE on error, always TRUE on Windows OS
*/
public function fixPermissions($path, $recursive = FALSE) {
return t3lib_div::fixPermissions($path, $recursive);
}
/**
* Creates a database connection if it is not exist.
*
* @return NULL|t3lib_db|\TYPO3\CMS\Core\Database\DatabaseConnection
*/
public function getDatabaseConnection() {
$db = NULL;
if (!isset($GLOBALS['TYPO3_DB'])) {
if (TYPO3_db) {
$db = t3lib_div::makeInstance('t3lib_db');
if (!$db->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password) || !$db->sql_select_db(TYPO3_db)) {
// Cannot connect to database
$db = NULL;
}
}
}
else {
$db = &$GLOBALS['TYPO3_DB'];
}
return $db;
}
}

View File

@@ -0,0 +1,590 @@
<?php
use \TYPO3\CMS\Core\Utility\GeneralUtility;
use \TYPO3\CMS\Backend\Utility\BackendUtility;
class tx_realurl_apiwrapper_6x extends tx_realurl_apiwrapper implements \TYPO3\CMS\Core\SingletonInterface {
/** @var \TYPO3\CMS\Core\Charset\CharsetConverter $csConvObj */
protected $csConvObj;
public function __construct() {
/** @noinspection PhpUndefinedClassInspection */
$this->csConv = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter');
}
/**
* @param $userFunc
* @param $parameters
* @param $object
* @return mixed
* @see t3lib_div::callUserFunction
*/
public function callUserFunction($userFunc, &$parameters, $object) {
/** @noinspection PhpUndefinedClassInspection */
return GeneralUtility::callUserFunction($userFunc, $parameters, $object);
}
/**
* @param string $cHashParameters
* @return string
*/
public function getRelevantChashParameters($cHashParameters) {
$cacheHashCalculator = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\CacheHashCalculator');
/* @var \TYPO3\CMS\Frontend\Page\CacheHashCalculator $cacheHashCalculator */
$result = $cacheHashCalculator->getRelevantParameters($cHashParameters);
return $result;
}
/**
* @param array $cHashParameters
* @return string
*/
public function calculateChash(array $cHashParameters) {
$cacheHashCalculator = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\CacheHashCalculator');
/* @var \TYPO3\CMS\Frontend\Page\CacheHashCalculator $cacheHashCalculator */
$result = $cacheHashCalculator->calculateCacheHash($cHashParameters);
return $result;
}
/**
* @param $delimiter
* @param $string
* @param bool $removeEmptyValues
* @param int $limit
* @return array
* @see t3lib_div::trimExplode
*/
public function trimExplode($delimiter, $string, $removeEmptyValues = FALSE, $limit = 0) {
return GeneralUtility::trimExplode($delimiter, $string, $removeEmptyValues, $limit);
}
/**
* @param $path
* @return mixed
* @seee t3lib_div::locationHeaderUrl()
*/
public function locationHeaderUrl($path) {
return GeneralUtility::locationHeaderUrl($path);
}
/**
* @param $fileref
* @return array
* @see t3lib_div::split_fileref
*/
public function split_fileref($fileref) {
return GeneralUtility::split_fileref($fileref);
}
/**
* @param $str
* @return int
* @see t3lib_div::md5int()
*/
public function md5int($str) {
return GeneralUtility::md5int($str);
}
/*
* @param string $getEnvName Name of the "environment variable"/"server variable" you wish to use. Valid values are SCRIPT_NAME, SCRIPT_FILENAME, REQUEST_URI, PATH_INFO, REMOTE_ADDR, REMOTE_HOST, HTTP_REFERER, HTTP_HOST, HTTP_USER_AGENT, HTTP_ACCEPT_LANGUAGE, QUERY_STRING, TYPO3_DOCUMENT_ROOT, TYPO3_HOST_ONLY, TYPO3_HOST_ONLY, TYPO3_REQUEST_HOST, TYPO3_REQUEST_URL, TYPO3_REQUEST_SCRIPT, TYPO3_REQUEST_DIR, TYPO3_SITE_URL, _ARRAY
* @return string Value based on the input key, independent of server/os environment.
* @throws \UnexpectedValueException
* @see t3lib_div::getIndpEnv()
*/
public function getIndpEnv($getEnvName) {
return GeneralUtility::getIndpEnv($getEnvName);
}
/**
* @param string $name Name prefix for entries. Set to blank if you wish none.
* @param array $theArray The (multidimensional) array to implode
* @param string $str (keep blank)
* @param bool $skipBlank If set, parameters which were blank strings would be removed.
* @param bool $rawurlencodeParamName If set, the param name itself (for example "param[key][key2]") would be rawurlencoded as well.
* @return string Imploded result, fx. &param[key][key2]=value2&param[key][key3]=value3
* @see t3lib_div::implodeArrayForUrl();
*/
public function implodeArrayForUrl($name, array $theArray, $str = '', $skipBlank = FALSE, $rawurlencodeParamName = FALSE) {
return GeneralUtility::implodeArrayForUrl($name, $theArray, $str, $skipBlank, $rawurlencodeParamName);
}
/**
* @param $varName
* @return mixed
* @see t3lib_div::_GET()
*/
public function _GET($varName) {
return GeneralUtility::_GET($varName);
}
/**
* @param $varName
* @return mixed
* @see t3lib_div::_POST()
*/
public function _POST($varName) {
return GeneralUtility::_POST($varName);
}
/**
* @param $varName
* @return mixed
* @see t3lib_div::_GET()
*/
public function _GP($varName) {
return GeneralUtility::_GP($varName);
}
/**
* @param array $theArray Multidimensional input array, (REFERENCE!)
* @return array
*/
public function stripSlashesOnArray(array &$theArray) {
return GeneralUtility::stripSlashesOnArray($theArray);
}
/**
* @param string $delimiter Delimiter string to explode with
* @param string $string The string to explode
* @param int $count Number of array entries
* @return array Exploded values
*/
public function revExplode($delimiter, $string, $count = 0) {
return GeneralUtility::revExplode($delimiter, $string, $count);
}
/**
* @param string $list Comma-separated list of items (string)
* @param string $item Item to check for
* @return bool TRUE if $item is in $list
*/
public function inList($list, $item) {
return GeneralUtility::inList($list, $item);
}
/**
* @param $charset
* @param $string
* @return mixed
* @see t3lib_cs::strlen()
*/
public function strlen($charset, $string) {
return $this->csConv->strlen($charset, $string);
}
/**
* @param string $charset The character set
* @param string $string Character string
* @param int $len Length (in characters)
* @param string $crop Crop signifier
* @return string The shortened string
* @see substr(), mb_strimwidth()
*/
public function crop($charset, $string, $len, $crop = '') {
return $this->csConv->crop($charset, $string, $len, $crop);
}
/**
* @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) {
return GeneralUtility::shortMD5($input, $len);
}
/**
* @param string $className name of the class to instantiate, must not be empty
* @return object the created instance
*/
public function makeInstance($className) {
return call_user_func_array(array('TYPO3\\CMS\\Core\\Utility\\GeneralUtility', 'makeInstance'), func_get_args());
}
/**
* @param string $msg Message (in english).
* @param string $extKey Extension key (from which extension you are calling the log)
* @param int $severity Severity: 0 is info, 1 is notice, 2 is warning, 3 is fatal error, -1 is "OK" message
* @param mixed $dataVar Additional data you want to pass to the logger.
* @return void
*/
public function devLog($msg, $extKey, $severity = 0, $dataVar = FALSE) {
GeneralUtility::devLog($msg, $extKey, $severity, $dataVar);
}
/**
* @param mixed $value
* @return bool
*/
public function testInt($value) {
return \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($value);
}
/**
* @param array $array1
* @param array $array2
* @return array
*/
public function array_merge_recursive_overrule($array1, $array2) {
if (version_compare(TYPO3_branch, '6.2', '<')) {
$array1 = GeneralUtility::array_merge_recursive_overrule($array1, $array2);
} else {
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($array1, $array2);
}
return $array1;
}
public function isExtLoaded($extKey) {
return \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey);
}
/**
* @param string $msg Message (in English).
* @param string $extKey Extension key (from which extension you are calling the log) or "Core
* @param int $severity \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_* constant
* @return void
*/
public function sysLog($msg, $extKey, $severity = 0) {
GeneralUtility::sysLog($msg, $extKey, $severity);
}
/**
* @param string $in_list Accept multiple parameters which can be comma-separated lists of values and arrays.
* @param mixed $secondParameter Dummy field, which if set will show a warning!
* @return string Returns the list without any duplicates of values, space around values are trimmed
*/
public function uniqueList($in_list, $secondParameter = NULL) {
return GeneralUtility::uniqueList($in_list, $secondParameter);
}
/**
* @return t3lib_pageSelect|\TYPO3\CMS\Frontend\Page\PageRepository
*/
public function getPageRepository() {
return GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
}
/**
* @param array $arr1 First array
* @param array $arr2 Second array
* @return array Merged result.
*/
public function array_merge(array $arr1, array $arr2) {
return GeneralUtility::array_merge($arr1, $arr2);
}
/**
* @param array $modTSconfig Module TS config array
* @param array $itemArray Array of items from which to remove items.
* @param string $TSref $TSref points to the "object string" in $modTSconfig
* @return array The modified $itemArray is returned.
*/
public function unsetMenuItems($modTSconfig, $itemArray, $TSref) {
return BackendUtility::unsetMenuItems($modTSconfig, $itemArray, $TSref);
}
/**
* @param mixed $mainParams The "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
* @param string $elementName The form elements name, probably something like "SET[...]
* @param string $currentValue The value to be selected currently.
* @param array $menuItems An array with the menu items for the selector box
* @param string $script The script to send the &id to, if empty it's automatically found
* @param string $addParams Additional parameters to pass to the script.
* @return string HTML code for selector box
*/
public function getFuncMenu($mainParams, $elementName, $currentValue, $menuItems, $script = '', $addParams = '') {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return BackendUtility::getFuncMenu($mainParams, $elementName, $currentValue, $menuItems, $script, $addParams);
}
/**
* @return \TYPO3\CMS\Backend\Tree\View\PageTreeView
*/
public function getPageTree() {
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView');
}
/**
* @param string $table Table name present in $GLOBALS['TCA']
* @param int $uid UID of record
* @param string $fields List of fields to select
* @param string $where Additional WHERE clause, eg. " AND blablabla = 0
* @param bool $useDeleteClause Use the deleteClause to check if a record is deleted (default TRUE)
* @return array|NULL Returns the row if found, otherwise NULL
*/
public function getRecord($table, $uid, $fields = '*', $where = '', $useDeleteClause = TRUE) {
return BackendUtility::getRecord($table, $uid, $fields, $where, $useDeleteClause);
}
/**
* @param string $table Table name
* @param array $row Record array passed by reference. As minimum, the "uid" and "pid" fields must exist! Fake fields cannot exist since the fields in the array is used as field names in the SQL look up. It would be nice to have fields like "t3ver_state" and "t3ver_mode_id" as well to avoid a new lookup inside movePlhOL().
* @param int $wsid Workspace ID, if not specified will use static::getBackendUserAuthentication()->workspace
* @param bool $unsetMovePointers If TRUE the function does not return a "pointer" row for moved records in a workspace
* @return void
* @see fixVersioningPid()
*/
public function workspaceOL($table, &$row, $wsid = -99, $unsetMovePointers = FALSE) {
BackendUtility::workspaceOL($table, $row, $wsid, $unsetMovePointers);
}
/**
* @param string $table Table name, present in TCA
* @param array $row Row from table
* @param bool $prep If set, result is prepared for output: The output is cropped to a limited length (depending on BE_USER->uc['titleLen']) and if no value is found for the title, '<em>[No title]</em>' is returned (localized). Further, the output is htmlspecialchars()'ed
* @param bool $forceResult If set, the function always returns an output. If no value is found for the title, '[No title]' is returned (localized).
* @return string
*/
public function getRecordTitle($table, $row, $prep = FALSE, $forceResult = TRUE) {
return BackendUtility::getRecordTitle($table, $row, $prep, $forceResult);
}
/**
* @param string $theTable Table name present in $GLOBALS['TCA']
* @param string $theField Field to select on
* @param string $theValue Value that $theField must match
* @param string $whereClause Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
* @param string $groupBy Optional GROUP BY field(s), if none, supply blank string.
* @param string $orderBy Optional ORDER BY field(s), if none, supply blank string.
* @param string $limit Optional LIMIT value ([begin,]max), if none, supply blank string.
* @param bool $useDeleteClause Use the deleteClause to check if a record is deleted (default TRUE)
* @return mixed Multidimensional array with selected records (if any is selected)
*/
public function getRecordsByField($theTable, $theField, $theValue, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '', $useDeleteClause = TRUE) {
return BackendUtility::getRecordsByField($theTable, $theField, $theValue, $whereClause, $groupBy, $orderBy, $limit, $useDeleteClause);
}
/**
* Returns a JavaScript string (for an onClick handler) which will load the alt_doc.php script that shows the form for editing of the record(s) you have send as params.
* REMEMBER to always htmlspecialchar() content in href-properties to ampersands get converted to entities (XHTML requirement and XSS precaution)
*
* @param string $params Parameters sent along to alt_doc.php. This requires a much more details description which you must seek in Inside TYPO3s documentation of the alt_doc.php API. And example could be '&edit[pages][123] = edit' which will show edit form for page record 123.
* @param string $backPath Must point back to the TYPO3_mainDir directory (where alt_doc.php is)
* @param string $requestUri An optional returnUrl you can set - automatically set to REQUEST_URI.
*
* @return string
* @see \TYPO3\CMS\Backend\Template\DocumentTemplate::issueCommand()
*/
public function editOnClick($params, $backPath = '', $requestUri = '') {
return BackendUtility::editOnClick($params, $backPath, $requestUri);
}
/**
* Returns a JavaScript string for viewing the page id, $id
* It will detect the correct domain name if needed and provide the link with the right back path.
* Also it will re-use any window already open.
*
* @param int $pageUid Page UID
* @param string $backPath Must point back to TYPO3_mainDir (where the site is assumed to be one level above)
* @param array|NULL $rootLine If root line is supplied the function will look for the first found domain record and use that URL instead (if found)
* @param string $anchorSection Optional anchor to the URL
* @param string $alternativeUrl An alternative URL that, if set, will ignore other parameters except $switchFocus: It will return the window.open command wrapped around this URL!
* @param string $additionalGetVars Additional GET variables.
* @param bool $switchFocus If TRUE, then the preview window will gain the focus.
* @return string
*/
public function viewOnClick($pageUid, $backPath = '', $rootLine = NULL, $anchorSection = '', $alternativeUrl = '', $additionalGetVars = '', $switchFocus = TRUE) {
return BackendUtility::viewOnClick($pageUid, $backPath, $rootLine, $anchorSection, $alternativeUrl, $additionalGetVars, $switchFocus);
}
/**
* @param string $str Full string to check
* @param string $partStr Reference string which must be found as the "first part" of the full string
* @return bool TRUE if $partStr was found to be equal to the first part of $str
*/
public function isFirstPartOfStr($str, $partStr) {
return GeneralUtility::isFirstPartOfStr($str, $partStr);
}
/**
* @param int $tstamp Time stamp, seconds
* @param int $prefix 1/-1 depending on polarity of age.
* @param string $date $date=="date" will yield "dd:mm:yy" formatting, otherwise "dd:mm:yy hh:mm
* @return string
*/
public function dateTimeAge($tstamp, $prefix = 1, $date = '') {
return BackendUtility::dateTimeAge($tstamp, $prefix, $date);
}
/**
* Returns the Page TSconfig for page with id, $id
*
* @param int $id Page uid for which to create Page TSconfig
* @param array $rootLine If $rootLine is an array, that is used as rootline, otherwise rootline is just calculated
* @param bool $returnPartArray If $returnPartArray is set, then the array with accumulated Page TSconfig is returned non-parsed. Otherwise the output will be parsed by the TypoScript parser.
* @return array Page TSconfig
* @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
*/
public function getPagesTSconfig($id, $rootLine = NULL, $returnPartArray = FALSE) {
return BackendUtility::getPagesTSconfig($id, $rootLine, $returnPartArray);
}
/**
* @param int $value Time stamp, seconds
* @return string Formatted time
*/
public function datetime($value) {
return BackendUtility::datetime($value);
}
/**
* @param int $seconds Seconds could be the difference of a certain timestamp and time()
* @param string $labels Labels should be something like ' min| hrs| days| yrs| min| hour| day| year'. This value is typically delivered by this function call: $GLOBALS["LANG"]->sL("LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears")
* @return string Formatted time
*/
public function calcAge($seconds, $labels = ' min| hrs| days| yrs| min| hour| day| year') {
return BackendUtility::datetime($seconds, $labels);
}
/**
* @return t3lib_arrayBrowser|\TYPO3\CMS\Lowlevel\Utility\ArrayBrowser
*/
public function getArrayBrowser() {
return GeneralUtility::makeInstance('TYPO3\\CMS\\Lowlevel\\Utility\\ArrayBrowser');
}
/**
* @param int $id Page uid
* @param string $TSref An object string which determines the path of the TSconfig to return.
* @return array
*/
public function getModTSconfig($id, $TSref) {
return BackendUtility::getModTSconfig($id, $TSref);
}
/**
* @param string $backPath Current backpath to PATH_typo3 folder
* @param string $src Icon file name relative to PATH_typo3 folder
* @param string $wHattribs Default width/height, defined like 'width="12" height="14"'
* @param int $outputMode Mode: 0 (zero) is default and returns src/width/height. 1 returns value of src+backpath, 2 returns value of w/h.
* @return string Returns ' src="[backPath][src]" [wHattribs]'
* @see skinImgFile()
*/
public function skinImg($backPath, $src, $wHattribs = '', $outputMode = 0) {
return \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($backPath, $src, $wHattribs, $outputMode);
}
/**
* Converts a one dimensional array to a one line string which can be used for logging or debugging output
* Example: "loginType: FE; refInfo: Array; HTTP_HOST: www.example.org; REMOTE_ADDR: 192.168.1.5; REMOTE_HOST:; security_level:; showHiddenRecords: 0;"
*
* @param array $arr Data array which should be outputted
* @param mixed $valueList List of keys which should be listed in the output string. Pass a comma list or an array. An empty list outputs the whole array.
* @param int $valueLength Long string values are shortened to this length. Default: 20
* @return string Output string with key names and their value as string
*/
public function arrayToLogString(array $arr, $valueList = array(), $valueLength = 20) {
return GeneralUtility::arrayToLogString($arr, $valueLength, $valueLength);
}
/**
* Truncates a string with appended/prepended "..." and takes current character set into consideration.
*
* @param string $string String to truncate
* @param int $chars Must be an integer with an absolute value of at least 4. if negative the string is cropped from the right end.
* @param string $appendString Appendix to the truncated string
* @return string Cropped string
*/
public function fixed_lgd_cs($string, $chars, $appendString = '...') {
return GeneralUtility::fixed_lgd_cs($string, $chars, $appendString);
}
/**
* Returns an icon image tag, 18x16 pixels, based on input information.
* This function is recommended to use in your backend modules.
* Usage: 60
*
* @param string The table name
* @param array The table row ("enablefields" are at least needed for correct icon display and for pages records some more fields in addition!)
* @param string The backpath to the main TYPO3 directory (relative path back to PATH_typo3)
* @param string Additional attributes for the image tag
* @param boolean If set, the icon will be grayed/shaded
* @return string <img>-tag
* @see getIcon()
*/
public function getIconImage($table, $row = array(), $backPath, $params = '', $shaded = FALSE) {
$str = '<img' .
$this->skinImg($backPath, \TYPO3\CMS\Backend\Utility\IconUtility::getIcon($table, $row, $shaded), 'width="18" height="16"') .
(trim($params) ? ' ' . trim($params) : '');
if (!stristr($str, 'alt="')) {
$str .= ' alt=""';
}
$str .= ' />';
return $str;
}
/**
* @param int $uid
* @param string $clause
* @param boolean $workspaceOL
* @return array
*/
public function BEgetRootLine($uid, $clause = '', $workspaceOL = FALSE) {
return BackendUtility::BEgetRootLine($uid, $clause, $workspaceOL);
}
/**
* Makes the page tree class instance.
*
* @return t3lib_pageTree|\TYPO3\CMS\Backend\Tree\View\PageTreeView
*/
public function makePageTreeInstance() {
return GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView');
}
/**
* Obtains the lock object with a given name.
*
* @param string $lockObjectName
* @return t3lib_lock|\TYPO3\CMS\Core\Locking\Locker
*/
public function getLockObject($lockObjectName) {
$lockObject = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Locking\\Locker', $lockObjectName, $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode']);
/** @var t3lib_lock $lockObject */
$lockObject->setEnableLogging(FALSE);
$lockObject->acquireExclusiveLock();
return $lockObject;
}
/**
* Sets the file system mode and group ownership of a file or a folder.
*
* @param string $path Path of file or folder, must not be escaped. Path can be absolute or relative
* @param bool $recursive If set, also fixes permissions of files and folders in the folder (if $path is a folder)
* @return mixed TRUE on success, FALSE on error, always TRUE on Windows OS
*/
public function fixPermissions($path, $recursive = FALSE) {
return GeneralUtility::fixPermissions($path, $recursive);
}
/**
* Creates a database connection if it is not exist.
*
* @return NULL|t3lib_db|\TYPO3\CMS\Core\Database\DatabaseConnection
*/
public function getDatabaseConnection() {
$db = NULL;
if (!isset($GLOBALS['TYPO3_DB'])) {
if (TYPO3_db) {
$db = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\DatabaseConnection');
if (!$db->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password) || !$db->sql_select_db(TYPO3_db)) {
// Cannot connect to database
$db = NULL;
}
}
}
else {
$db = &$GLOBALS['TYPO3_DB'];
}
return $db;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,255 @@
<?php
/***************************************************************
* Copyright notice
*
* (c) 2007-2010 Dmitry Dulepov (dmitry@typo3.org)
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Class for translating page ids to/from path strings (Speaking URLs)
*
* $Id: class.tx_realurl_advanced.php 5893 2007-07-09 13:41:07Z liels_bugs $
*
* @author Dmitry Dulepov <dmitry@typo3.org>
*/
/**
* [CLASS/FUNCTION INDEX of SCRIPT]
*
*
*
* 57: class tx_realurl_autoconfgen
* 68: function generateConfiguration()
* 89: function doGenerateConfiguration(&$fd)
* 151: function getTemplate()
* 209: function addLanguages(&$conf)
*
* TOTAL FUNCTIONS: 4
* (This index is automatically created/updated by the extension "extdeveval")
*
*/
/**
* Class for generating of automatic RealURL configuration
*
* @author Dmitry Dulepov <dmitry@typo3.org>
* @package realurl
* @subpackage tx_realurl
*/
class tx_realurl_autoconfgen {
/* @var $db t3lib_DB */
var $db;
/** @var bool */
var $hasStaticInfoTables;
/** @var tx_realurl_apiwrapper */
protected $apiWrapper;
/**
* Initializes the class.
*/
public function __construct() {
$this->apiWrapper = tx_realurl_apiwrapper::getInstance();
$this->db = $this->apiWrapper->getDatabaseConnection();
$this->hasStaticInfoTables = $this->apiWrapper->isExtLoaded('static_info_tables');
}
/**
* Generates configuration. Locks configuration file for exclusive access to avoid collisions. Will not be stabe on Windows.
*
* @return void
*/
public function generateConfiguration() {
$fileName = PATH_site . TX_REALURL_AUTOCONF_FILE;
$lockObject = $this->apiWrapper->getLockObject($fileName);
$fd = @fopen($fileName, 'a+');
if ($fd) {
// Check size
fseek($fd, 0, SEEK_END);
if (ftell($fd) == 0) {
$this->doGenerateConfiguration($fd);
}
fclose($fd);
$this->apiWrapper->fixPermissions($fileName);
}
$lockObject->release();
}
/**
* Performs actual generation.
*
* @param resource $fd FIle descriptor to write to
* @return void
*/
protected function doGenerateConfiguration(&$fd) {
$conf = array();
$template = $this->getTemplate();
// Find all domains
$domains = $this->db->exec_SELECTgetRows('pid,domainName,redirectTo', 'sys_domain', 'hidden=0',
'', '', '', 'domainName');
if (count($domains) == 0) {
$conf['_DEFAULT'] = $template;
$rows = $this->db->exec_SELECTgetRows('uid', 'pages',
'deleted=0 AND hidden=0 AND is_siteroot=1', '', '', '1');
if (count($rows) > 0) {
$conf['_DEFAULT']['pagePath']['rootpage_id'] = $rows[0]['uid'];
}
}
else {
foreach ($domains as $domain) {
if ($domain['redirectTo'] != '') {
// Redirects to another domain, see if we can make a shortcut
$parts = parse_url($domain['redirectTo']);
if (isset($domains[$parts['host']]) && ($domains['path'] == '/' || $domains['path'] == '')) {
// Make a shortcut
if ($conf[$parts['host']] != $domain['domainName']) {
// Here if there were no redirect from this domain to source domain
$conf[$domain['domainName']] = $parts['host'];
}
continue;
}
}
// Make entry
$conf[$domain['domainName']] = $template;
$conf[$domain['domainName']]['pagePath']['rootpage_id'] = $domain['pid'];
}
}
// Post process generated configuration
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['postProcessConfiguration'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['postProcessConfiguration'] as $userFunc) {
$parameters = array(
'config' => &$conf,
);
$this->apiWrapper->callUserFunction($userFunc, $parameters, $this);
}
}
$realurlConf = @unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['realurl']);
if ($realurlConf['autoConfFormat'] == 0) {
fwrite($fd, '<' . '?php' . chr(10) . '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'realurl\']=' .
'unserialize(\'' . str_replace('\'', '\\\'', serialize($conf)) . '\');' . chr(10)
);
}
else {
fwrite($fd, '<' . '?php' . chr(10) . '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'realurl\']=' .
var_export($conf, true) . ';' . chr(10)
);
}
}
/**
* Creates common configuration template.
*
* @return array Template
*/
protected function getTemplate() {
$confTemplate = array(
'init' => array(
'enableCHashCache' => true,
'appendMissingSlash' => 'ifNotFile,redirect',
'adminJumpToBackend' => true,
'enableUrlDecodeCache' => true,
'enableUrlEncodeCache' => true,
'emptyUrlReturnValue' => $this->apiWrapper->getIndpEnv('TYPO3_SITE_PATH')
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
),
'fileName' => array(
'defaultToHTMLsuffixOnPrev' => 0,
'acceptHTMLsuffix' => 1,
)
);
// Add print feature if TemplaVoila is not loaded
if (!$this->apiWrapper->isExtLoaded('templavoila')) {
$confTemplate['fileName']['index']['print'] = array(
'keyValues' => array(
'type' => 98,
)
);
}
// Add respectSimulateStaticURLs if SimulateStatic is loaded
if($this->apiWrapper->isExtLoaded('simulatestatic')) {
$confTemplate['init']['respectSimulateStaticURLs'] = true;
}
$this->addLanguages($confTemplate);
// Add from extensions
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['extensionConfiguration'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['extensionConfiguration'] as $extKey => $userFunc) {
$params = array(
'config' => $confTemplate,
'extKey' => $extKey
);
$var = $this->apiWrapper->callUserFunction($userFunc, $params, $this);
if ($var) {
$confTemplate = $var;
}
}
}
return $confTemplate;
}
/**
* Adds languages to configuration
*
* @param array $conf Configuration (passed as reference)
* @return void
*/
protected function addLanguages(&$conf) {
if ($this->hasStaticInfoTables) {
$languages = $this->db->exec_SELECTgetRows('t1.uid AS uid,t2.lg_iso_2 AS lg_iso_2', 'sys_language t1, static_languages t2', 't2.uid=t1.static_lang_isocode AND t1.hidden=0');
}
else {
$languages = $this->db->exec_SELECTgetRows('t1.uid AS uid,t1.uid AS lg_iso_2', 'sys_language t1', 't1.hidden=0');
}
if (count($languages) > 0) {
$conf['preVars'] = array(
0 => array(
'GETvar' => 'L',
'valueMap' => array(
),
'noMatch' => 'bypass'
),
);
foreach ($languages as $lang) {
$conf['preVars'][0]['valueMap'][strtolower($lang['lg_iso_2'])] = $lang['uid'];
}
}
}
}
if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/realurl/class.tx_realurl_autoconfgen.php']) {
/** @noinspection PhpIncludeInspection */
include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/realurl/class.tx_realurl_autoconfgen.php']);
}

View File

@@ -0,0 +1,375 @@
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010 Dmitry Dulepov (dmitry@typo3.org)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* $Id$
*/
/**
* TCEmain hook to update various caches when data is modified in TYPO3 Backend
*
* @author Dmitry Dulepov <dmitry@typo3.org>
*/
class tx_realurl_tcemain {
/** @var tx_realurl_apiwrapper */
protected $apiWrapper;
/**
* RealURL configuration for the current host
*
* @var array
*/
protected $config;
public function __construct() {
$this->apiWrapper = tx_realurl_apiwrapper::getInstance();
}
/**
* Removes autoconfiguration file if table name is sys_domain
*
* @param string $tableName
* @return void
*/
protected function clearAutoConfiguration($tableName) {
if ($tableName == 'sys_domain') {
@unlink(PATH_site . TX_REALURL_AUTOCONF_FILE);
}
}
/**
* Clears RealURL caches if necessary
*
* @param string $command
* @param string $tableName
* @param int $recordId
* @return void
*/
protected function clearCaches($command, $tableName, $recordId) {
if ($this->isTableForCache($tableName)) {
if ($command == 'delete' || $command == 'move') {
list($pageId, ) = $this->getPageData($tableName, $recordId);
$this->fetchRealURLConfiguration($pageId);
if ($command == 'delete') {
$this->clearPathCache($pageId);
}
else {
$this->expirePathCacheForAllLanguages($pageId);
}
$this->clearOtherCaches($pageId);
}
}
}
/**
* Clears URL decode and encode caches for the given page
*
* @param $pageId
* @return void
*/
protected function clearOtherCaches($pageId) {
/** @noinspection PhpUndefinedMethodInspection */
$GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_realurl_urldecodecache',
'page_id=' . intval($pageId));
/** @noinspection PhpUndefinedMethodInspection */
$GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_realurl_urlencodecache',
'page_id=' . intval($pageId));
}
/**
* Clears path cache for the given page id
*
* @param int $pageId
* @return void
*/
protected function clearPathCache($pageId) {
/** @noinspection PhpUndefinedMethodInspection */
$GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_realurl_pathcache',
'page_id=' . intval($pageId));
}
/**
* Removes unique alias in case if the record is deleted from the table
*
* @param string $command
* @param string $tableName
* @param mixed $recordId
* @return void
*/
protected function clearUniqueAlias($command, $tableName, $recordId) {
if ($command == 'delete') {
/** @noinspection PhpUndefinedMethodInspection */
$GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_realurl_uniqalias',
'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($tableName, 'tx_realurl_uniqalias') .
' AND value_id=' . intval($recordId));
}
}
/**
* Expires record in the path cache
*
* @param int $pageId
* @param int $languageId
* @return void
*/
protected function expirePathCache($pageId, $languageId) {
$expirationTime = $this->getExpirationTime();
$pageIds = $this->getChildPages($pageId);
$pageIds[] = intval($pageId);
/** @noinspection PhpUndefinedMethodInspection */
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_realurl_pathcache',
'page_id IN (' . implode(',', $pageIds) . ') AND language_id=' . intval($languageId) . ' AND expire=0',
array(
'expire' => $expirationTime
));
}
/**
* Expires record in the path cache
*
* @param int $pageId
* @return void
*/
protected function expirePathCacheForAllLanguages($pageId) {
$expirationTime = $this->getExpirationTime();
$pageIds = $this->getChildPages($pageId);
$pageIds[] = intval($pageId);
/** @noinspection PhpUndefinedMethodInspection */
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_realurl_pathcache',
'page_id IN (' . implode(',', $pageIds) . ') AND expire=0',
array(
'expire' => $expirationTime
));
}
/**
* Fetches RealURl configuration for the given page
*
* @param int $pageId
* @return void
*/
protected function fetchRealURLConfiguration($pageId) {
$rootLine = $this->apiWrapper->BEgetRootLine($pageId);
$rootPageId = $rootLine[1]['uid'];
$this->config = array();
if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] as $config) {
if (is_array($config) && $config['pagePath']['rootpage_id'] == $rootPageId) {
$this->config = $config;
return;
}
}
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'])) {
$this->config = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'];
}
}
else {
$this->apiWrapper->sysLog('RealURL is not configured! Please, configure it or uninstall.', 'RealURL', 3);
}
}
/**
* Returns the IDs of all child pages of a given $pageID.
*
* @param $pageId integer Page ID to start searching
* @return int[] Child pages
*/
protected function getChildPages($pageId) {
$children = array();
$tree = $this->apiWrapper->makePageTreeInstance();
/** @noinspection PhpUndefinedMethodInspection */
$tree->init('AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1));
$tree->makeHTML = FALSE;
$tree->getTree($pageId, 99, '');
foreach ($tree->tree as $data) {
$children[] = intval($data['row']['uid']);
}
return $children;
}
/**
* Obtains expiration time for the path cache records
*
* @return int
*/
protected function getExpirationTime() {
$timeOffset = (isset($this->config['pagePath']['expireDays']) ? $this->config['pagePath']['expireDays'] : 60) * 24 * 3600;
$date = getdate(time() + $timeOffset);
return mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']);
}
/**
* Obtains real page id and language from the table name and passed id of the record in the table.
*
* @param $tableName
* @param $id
* @return array First member is page id, second is language
*/
protected static function getPageData($tableName, $id) {
if ($tableName == 'pages_language_overlay') {
$result = self::getInfoFromOverlayPid($id);
}
else {
$result = array($id, 0);
}
return $result;
}
/**
* Retrieves field list to check for modification
*
* @param string $tableName
* @return array
*/
protected function getFieldList($tableName) {
if ($tableName == 'pages_language_overlay') {
$fieldList = TX_REALURL_SEGTITLEFIELDLIST_PLO;
}
else {
if (isset($this->config['pagePath']['segTitleFieldList'])) {
$fieldList = $this->config['pagePath']['segTitleFieldList'];
}
else {
$fieldList = TX_REALURL_SEGTITLEFIELDLIST_DEFAULT;
}
}
$fieldList .= ',hidden';
return array_unique($this->apiWrapper->trimExplode(',', $fieldList, true));
}
/**
* Retrieves real page id given its overlay id
*
* @param int $pid Page id
* @return array Array with two members: real page uid and sys_language_uid
*/
protected static function getInfoFromOverlayPid($pid) {
/** @noinspection PhpUndefinedMethodInspection */
list($rec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pid,sys_language_uid',
'pages_language_overlay', 'uid=' . intval($pid));
return array($rec['pid'], $rec['sys_language_uid']);
}
/**
* Checks if the update table can affect cache entries
*
* @param string $tableName
* @return boolean
*/
protected static function isTableForCache($tableName) {
return ($tableName == 'pages' || $tableName == 'pages_language_overlay');
}
/**
* A TCEMain hook to update caches when something happens to a page or
* language overlay.
*
* @param string $command
* @param string $tableName
* @param mixed $recordId
* @return void
*/
public function processCmdmap_postProcess($command, $tableName, $recordId) {
$this->clearCaches($command, $tableName, $recordId);
$this->clearAutoConfiguration($tableName);
$this->clearUniqueAlias($command, $tableName, $recordId);
}
/**
* A TCEmain hook to expire old records and add new ones
*
* @param string $status 'new' (ignoring) or 'update'
* @param string $tableName
* @param int $recordId
* @param array $databaseData
* @param t3lib_TCEmain $pObj
* @return void
* @todo Expire unique alias cache: how to get the proper timeout value easily here?
*/
public function processDatamap_afterDatabaseOperations($status, $tableName, $recordId, array $databaseData, $pObj) {
$this->processContentUpdates($status, $tableName, $recordId, $databaseData, $pObj);
$this->clearAutoConfiguration($tableName);
}
/**
* Processes page and content changes in regard to RealURL caches.
*
* @param string $status
* @param string $tableName
* @param int $recordId
* @param array $databaseData
* @param t3lib_TCEmain $pObj
* @return void
* @todo Handle changes to tx_realurl_exclude recursively
*/
protected function processContentUpdates($status, $tableName, $recordId, array $databaseData, $pObj) {
if ($tableName !== 'pages' || $status == 'update') {
if (!$this->apiWrapper->testInt($recordId)) {
$recordId = intval($pObj->substNEWwithIDs[$recordId]);
}
list($pageId, $languageId) = $this->getPageData($tableName, $recordId);
$this->fetchRealURLConfiguration($pageId);
if ($this->shouldFixCaches($tableName, $databaseData)) {
if (isset($databaseData['alias'])) {
$this->expirePathCacheForAllLanguages($pageId);
}
else {
$this->expirePathCache($pageId, $languageId);
}
$this->clearOtherCaches($pageId);
}
$this->clearOtherCaches($pageId);
}
}
/**
* Checks if we need to fix caches
*
* @param string $tableName
* @param array $databaseData
* @return boolean
*/
protected function shouldFixCaches($tableName, array $databaseData) {
$result = false;
if (self::isTableForCache($tableName)) {
$interestingFields = $this->getFieldList($tableName);
$result = count(array_intersect($interestingFields, array_keys($databaseData))) > 0;
}
return $result;
}
}
if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/realurl/class.tx_realurl_tcemain.php']) {
/** @noinspection PhpIncludeInspection */
include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/realurl/class.tx_realurl_tcemain.php']);
}

Binary file not shown.

View File

@@ -0,0 +1,11 @@
<?php
$extpath = (version_compare(TYPO3_branch, '6.0', '<') ? t3lib_extMgm::extPath('realurl') : \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('realurl'));
return array(
'tx_realurl' => $extpath . 'class.tx_realurl.php',
'tx_realurl_autoconfgen' => $extpath . 'class.tx_realurl_autoconfgen.php',
'tx_realurl_modfunc1' => $extpath . 'modfunc1/class.tx_realurl_modfunc1.php',
'tx_realurl_pagebrowser' => $extpath . 'modfunc1/class.tx_realurl_pagebrowser.php',
'tx_realurl_apiwrapper' => $extpath . 'apiwrappers/class.tx_realurl_apiwrapper.php',
'tx_realurl_apiwrapper_4x' => $extpath . 'apiwrappers/class.tx_realurl_apiwrapper_4x.php',
'tx_realurl_apiwrapper_6x' => $extpath . 'apiwrappers/class.tx_realurl_apiwrapper_6x.php',
);

View File

@@ -0,0 +1,17 @@
# cat=basic/enable; type=string; label=Path to configuration file:Optional. If you placed RealURL configuration in a separate file, RealURL can include it for you. Specify a file name related to web site root directory.
configFile = typo3conf/realurl_conf.php
# cat=basic/enable; type=boolean; label=Enable automatic configuration:Enable this if you do not want to write configuration manually. It will generate configuration automatically and store it in typo3conf/. Automatically ignored if you wrote configuration yourself. See manual for more information.
enableAutoConf = 1
# cat=basic/enable; type=options[Serialized=0,PHP source (slow!)=1]; label=Automatic configuration file format:Defines how autoconfiguration file is stored. Use "Serialized" because it is 10 times or more faster! Use "PHP source" if you are curious what is generated or want to copy and modify generated configuration.
autoConfFormat = 0
# cat=basic/enable; type=boolean; label=Enable devLog:Debugging-only! Required any 3rd party devLog extension
enableDevLog = 0
# cat=basic/enable; type=boolean; label=Enable strict mode:In strict mode RealURL will not do workarounds for configuration errors but will abort with the "404 Not found" error. It is recommended to enable this setting because it makes sure that the configuration is correct. Turning this mode off will force RealURL to recover from errors but will badly affect the performance if the configuration contains errors.
#enableStrictMode = 1
# cat=basic/enable; type=boolean; label=Store URL for cHash cache:Allows to store full URL in the cHash cache table for debugging purposes. Normally should be off.
enableChashUrlDebug = 0

View File

@@ -0,0 +1,42 @@
<?php
/***************************************************************
* Extension Manager/Repository config file for ext "realurl".
*
* Auto generated 02-02-2016 16:19
*
* Manual updates:
* Only the data in the array - everything else is removed by next
* writing. "version" and "dependencies" must not be touched!
***************************************************************/
$EM_CONF[$_EXTKEY] = array (
'title' => 'RealURL: speaking paths for TYPO3',
'description' => 'Creates nice looking URLs for TYPO3 pages: converts http://example.com/index.phpid=12345&L=2 to http://example.com/path/to/your/page/. Please, ask for free support in TYPO3 mailing lists or contact the maintainer for paid support.',
'category' => 'fe',
'version' => '1.13.6',
'state' => 'stable',
'uploadfolder' => true,
'createDirs' => '',
'clearcacheonload' => false,
'author' => 'Dmitry Dulepov',
'author_email' => 'dmitry.dulepov@gmail.com',
'author_company' => '',
'constraints' =>
array (
'depends' =>
array (
'php' => '5.3.2-5.999.999',
'typo3' => '4.5.40-7.9.999',
),
'conflicts' =>
array (
'cooluri' => '',
'simulatestatic' => '',
),
'suggests' =>
array (
),
),
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

View File

@@ -0,0 +1,38 @@
<?php
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc']['tx_realurl'] = 'EXT:realurl/class.tx_realurl.php:tx_realurl->encodeSpURL';
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['typoLink_PostProc']['tx_realurl'] = 'EXT:realurl/class.tx_realurl.php:tx_realurl->encodeSpURL_urlPrepend';
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['checkAlternativeIdMethods-PostProc']['tx_realurl'] = 'EXT:realurl/class.tx_realurl.php:tx_realurl->decodeSpURL';
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearPageCacheEval']['tx_realurl'] = 'EXT:realurl/class.tx_realurl.php:tx_realurl->clearPageCacheMgm';
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables']['tx_realurl_urldecodecache'] = 'tx_realurl_urldecodecache';
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables']['tx_realurl_urlencodecache'] = 'tx_realurl_urlencodecache';
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['tx_realurl'] = 'EXT:realurl/class.tx_realurl_tcemain.php:tx_realurl_tcemain';
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['tx_realurl'] = 'EXT:realurl/class.tx_realurl_tcemain.php:tx_realurl_tcemain';
$TYPO3_CONF_VARS['FE']['addRootLineFields'] .= ',tx_realurl_pathsegment,tx_realurl_exclude,tx_realurl_pathoverride';
$TYPO3_CONF_VARS['FE']['pageOverlayFields'] .= ',tx_realurl_pathsegment';
// Include configuration file
$_realurl_conf = @unserialize($_EXTCONF);
if (is_array($_realurl_conf)) {
$_realurl_conf_file = trim($_realurl_conf['configFile']);
if ($_realurl_conf_file && @file_exists(PATH_site . $_realurl_conf_file)) {
/** @noinspection PhpIncludeInspection */
require_once(PATH_site . $_realurl_conf_file);
}
unset($_realurl_conf_file);
}
define('TX_REALURL_AUTOCONF_FILE', 'typo3conf/realurl_autoconf.php');
if ($_realurl_conf['enableAutoConf'] && !isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'])) {
/** @noinspection PhpIncludeInspection */
@include_once(PATH_site . TX_REALURL_AUTOCONF_FILE);
}
unset($_realurl_conf);
define('TX_REALURL_SEGTITLEFIELDLIST_DEFAULT', 'tx_realurl_pathsegment,alias,nav_title,title,uid');
define('TX_REALURL_SEGTITLEFIELDLIST_PLO', 'tx_realurl_pathsegment,nav_title,title,uid');
?>

View File

@@ -0,0 +1,99 @@
<?php
if (version_compare(TYPO3_branch, '6.2', '<')) {
t3lib_div::loadTCA('pages');
$extensionMamagementUtility = 't3lib_extMgm';
$generalUtility = 't3lib_div';
$isLegacyVersion = TRUE;
}
else {
$extensionMamagementUtility = '\\TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility';
$generalUtility = '\\TYPO3\\CMS\\Core\\Utility\\GeneralUtility';
$isLegacyVersion = FALSE;
}
/** @var t3lib_extMgm|\TYPO3\CMS\Core\Utility\ExtensionManagementUtility $extensionMamagementUtility */
/** @var t3lib_div|\TYPO3\CMS\Core\Utility\GeneralUtility $generalUtility */
if (TYPO3_MODE == 'BE') {
// Add Web>Info module
$extensionMamagementUtility::insertModuleFunction(
'web_info',
'tx_realurl_modfunc1',
$isLegacyVersion ? $extensionMamagementUtility::extPath('realurl') . 'modfunc1/class.tx_realurl_modfunc1.php' : NULL,
'LLL:EXT:realurl/locallang_db.xml:moduleFunction.tx_realurl_modfunc1',
'function',
'online'
);
}
$GLOBALS['TCA']['pages']['columns'] += array(
'tx_realurl_pathsegment' => array(
'label' => 'LLL:EXT:realurl/locallang_db.xml:pages.tx_realurl_pathsegment',
'displayCond' => 'FIELD:tx_realurl_exclude:!=:1',
'exclude' => 1,
'config' => array (
'type' => 'input',
'max' => 255,
'eval' => 'trim,nospace,lower'
),
),
'tx_realurl_pathoverride' => array(
'label' => 'LLL:EXT:realurl/locallang_db.xml:pages.tx_realurl_path_override',
'exclude' => 1,
'config' => array (
'type' => 'check',
'items' => array(
array('', '')
)
)
),
'tx_realurl_exclude' => array(
'label' => 'LLL:EXT:realurl/locallang_db.xml:pages.tx_realurl_exclude',
'exclude' => 1,
'config' => array (
'type' => 'check',
'items' => array(
array('', '')
)
)
),
'tx_realurl_nocache' => array(
'label' => 'LLL:EXT:realurl/locallang_db.xml:pages.tx_realurl_nocache',
'exclude' => 1,
'config' => array (
'type' => 'check',
'items' => array(
array('', ''),
),
),
)
);
$GLOBALS['TCA']['pages']['ctrl']['requestUpdate'] .= ',tx_realurl_exclude';
$GLOBALS['TCA']['pages']['palettes']['137'] = array(
'showitem' => 'tx_realurl_pathoverride'
);
$extensionMamagementUtility::addFieldsToPalette('pages', '3', 'tx_realurl_nocache', 'after:cache_timeout');
$extensionMamagementUtility::addToAllTCAtypes('pages', 'tx_realurl_pathsegment;;137;;,tx_realurl_exclude', '1', 'after:nav_title');
$extensionMamagementUtility::addToAllTCAtypes('pages', 'tx_realurl_pathsegment;;137;;,tx_realurl_exclude', '4,199,254', 'after:title');
$extensionMamagementUtility::addLLrefForTCAdescr('pages','EXT:realurl/locallang_csh.xml');
$GLOBALS['TCA']['pages_language_overlay']['columns'] += array(
'tx_realurl_pathsegment' => array(
'label' => 'LLL:EXT:realurl/locallang_db.xml:pages.tx_realurl_pathsegment',
'exclude' => 1,
'config' => array (
'type' => 'input',
'max' => 255,
'eval' => 'trim,nospace,lower'
),
),
);
$extensionMamagementUtility::addToAllTCAtypes('pages_language_overlay', 'tx_realurl_pathsegment', '', 'after:nav_title');
unset($extensionMamagementUtility, $generalUtility, $isLegacyVersion);
?>

View File

@@ -0,0 +1,141 @@
#
# Table structure for table 'tx_realurl_pathcache'
#
CREATE TABLE tx_realurl_pathcache (
cache_id int(11) NOT NULL auto_increment,
page_id int(11) DEFAULT '0' NOT NULL,
language_id int(11) DEFAULT '0' NOT NULL,
rootpage_id int(11) DEFAULT '0' NOT NULL,
mpvar tinytext NOT NULL,
pagepath text NOT NULL,
expire int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (cache_id),
KEY pathq1 (rootpage_id,pagepath(32),expire),
KEY pathq2 (page_id,language_id,rootpage_id,expire),
KEY expire (expire)
) ENGINE=InnoDB;
#
# Table structure for table 'tx_realurl_uniqalias'
#
CREATE TABLE tx_realurl_uniqalias (
uid int(11) NOT NULL auto_increment,
tstamp int(11) DEFAULT '0' NOT NULL,
tablename varchar(255) DEFAULT '' NOT NULL,
field_alias varchar(255) DEFAULT '' NOT NULL,
field_id varchar(60) DEFAULT '' NOT NULL,
value_alias varchar(255) DEFAULT '' NOT NULL,
value_id int(11) DEFAULT '0' NOT NULL,
lang int(11) DEFAULT '0' NOT NULL,
expire int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (uid),
KEY tablename (tablename),
KEY bk_realurl01 (field_alias(20),field_id,value_id,lang,expire),
KEY bk_realurl02 (tablename(32),field_alias(20),field_id,value_alias(20),expire)
);
#
# Table structure for table 'tx_realurl_chashcache'
#
CREATE TABLE tx_realurl_chashcache (
spurl_hash char(32) DEFAULT '' NOT NULL,
chash_string varchar(32) DEFAULT '' NOT NULL,
spurl_string text,
PRIMARY KEY (spurl_hash),
KEY chash_string (chash_string)
) ENGINE=InnoDB;
#
# Table structure for table 'tx_realurl_urldecodecache'
# Cache for Speaking URLS when translated to internal GET vars.
# Flushable
#
CREATE TABLE tx_realurl_urldecodecache (
url_hash char(32) DEFAULT '' NOT NULL,
spurl tinytext NOT NULL,
content blob NOT NULL,
page_id int(11) DEFAULT '0' NOT NULL,
rootpage_id int(11) DEFAULT '0' NOT NULL,
tstamp int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (url_hash),
KEY page_id (page_id),
) ENGINE=InnoDB;
#
# Table structure for table 'tx_realurl_urlencodecache'
#
CREATE TABLE tx_realurl_urlencodecache (
url_hash char(32) DEFAULT '' NOT NULL,
origparams tinytext NOT NULL,
internalExtras tinytext NOT NULL,
content text NOT NULL,
page_id int(11) DEFAULT '0' NOT NULL,
tstamp int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (url_hash),
KEY page_id (page_id)
) ENGINE=InnoDB;
CREATE TABLE tx_realurl_errorlog (
url_hash int(11) DEFAULT '0' NOT NULL,
url text NOT NULL,
error text NOT NULL,
last_referer text NOT NULL,
counter int(11) DEFAULT '0' NOT NULL,
cr_date int(11) DEFAULT '0' NOT NULL,
tstamp int(11) DEFAULT '0' NOT NULL,
rootpage_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (url_hash,rootpage_id),
KEY counter (counter,tstamp)
);
CREATE TABLE tx_realurl_redirects (
uid int(11) NOT NULL auto_increment,
url_hash int(11) DEFAULT '0' NOT NULL,
url text NOT NULL,
destination text NOT NULL,
last_referer text NOT NULL,
counter int(11) DEFAULT '0' NOT NULL,
tstamp int(11) DEFAULT '0' NOT NULL,
has_moved int(11) DEFAULT '0' NOT NULL,
domain_limit int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (uid),
UNIQUE KEY sel01 (url_hash,domain_limit)
);
#
# Modifying pages table
#
CREATE TABLE pages (
tx_realurl_pathsegment varchar(255) DEFAULT '' NOT NULL,
tx_realurl_pathoverride int(1) DEFAULT '0' NOT NULL,
tx_realurl_exclude int(1) DEFAULT '0' NOT NULL,
tx_realurl_nocache int(1) DEFAULT '0' NOT NULL
);
#
# Modifying pages_language_overlay table
#
CREATE TABLE pages_language_overlay (
tx_realurl_pathsegment varchar(255) DEFAULT '' NOT NULL
);
#
# Modifying sys_domain table
#
CREATE TABLE sys_domain (
KEY tx_realurl (domainName,hidden)
);
#
# Modifying sys_template table
#
CREATE TABLE sys_template (
KEY tx_realurl (root,hidden)
);

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<description>CSH for additional pages fields</description>
<type>CSH</type>
<csh_table>tt_content</csh_table>
<fileId>EXT:realurl/locallang_csh.xml</fileId>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="tx_realurl_nocache.description">Disables RealURL encode and decode cache for this page only</label>
<label index="tx_realurl_pathsegment.description">URL path segment for this. Only valid URL characters are allowed, namely: latin letters, numbers, underscore and/or minus character.</label>
<label index="tx_realurl_exclude.description">Excludes this page from the speaking URL. Note that this works only if this page is not the target page of the reader.</label>
<label index="tx_realurl_pathoverride.description">If checked, the speaking path segment field must contain the whole path to the page (excluding pre- and postVars). This gives an option to override the path completely. Without this option the field defines only a single URL segment for the current page. When overriding the whole path, the path MUST NOT start or end with a slash!</label>
</languageKey>
</data>
</T3locallang>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<description>Database labels</description>
<type>database</type>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="pages.tx_realurl_pathsegment">Speaking URL path segment:</label>
<label index="pages.tx_realurl_exclude">Exclude from speaking URL:</label>
<label index="pages.tx_realurl_path_override">Override the whole page path</label>
<label index="pages.tx_realurl_nocache">Disable RealURL cache</label>
<label index="moduleFunction.tx_realurl_modfunc1">RealURL management</label>
</languageKey>
</data>
</T3locallang>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,150 @@
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Dmitry Dulepov (dmitry.dulepov@gmail.com)
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* This class is a page browser for the RealURL backend module.
*
* @author Dmitry Dulepov <dmitry.dulepov@gmail.com>
* @package TYPO3
* @subpackage tx_realurl
*/
class tx_realurl_pagebrowser {
const PAGES_BEFORE = 1;
const PAGES_BEFORE_END = 1;
const PAGES_AFTER = 1;
const PAGES_AFTER_START = 1;
const RESULTS_PER_PAGE_DEFAULT = 20;
protected $currentPage;
protected $totalPages;
protected $baseURL;
protected $resultsPerPage;
/** @var tx_realurl_apiwrapper */
protected $apiWrapper;
/**
* Creates an isntance of this class.
*/
public function __construct() {
$this->apiWrapper = tx_realurl_apiwrapper::getInstance();
$urlParameters = $this->apiWrapper->array_merge_recursive_overrule($_GET, $_POST);
$this->currentPage = max(1, intval($urlParameters['page']));
unset($urlParameters['page']);
unset($urlParameters['cmd']);
$this->baseURL = $this->apiWrapper->getIndpEnv('TYPO3_REQUEST_SCRIPT') .
'?' . $this->apiWrapper->implodeArrayForUrl('', $urlParameters);
$this->resultsPerPage = self::RESULTS_PER_PAGE_DEFAULT;
}
public function getPageBrowser($totalResults, $resultsPerPage = 0) {
if ($resultsPerPage) {
$this->resultsPerPage = $resultsPerPage;
}
$this->calcTotalPages($totalResults);
$markup = '';
if ($this->totalPages > 1) {
$markup = $this->generatePageBrowser();
$markup = '<table class="pagebrowser"><tr>' . $markup . '</tr></table>';
}
return $markup;
}
static public function getInlineStyles() {
return '
TABLE.pagebrowser {
margin-left: auto;
}
TABLE.pagebrowser TR TD {
padding: 2px 4px;
}
TABLE.pagebrowser TR TD.page {
border: 1px solid #595d66;
}
';
}
protected function generatePageBrowser() {
$markup = '';
for ($page = 1; $page <= min($this->totalPages, $this->currentPage, self::PAGES_AFTER_START + 1); $page++) {
$markup .= $this->createCell($page);
}
if ($page < $this->currentPage - self::PAGES_BEFORE) {
$markup .= $this->createEllipses();
$page = $this->currentPage - self::PAGES_BEFORE;
}
for ( ; $page <= min($this->totalPages, $this->currentPage + self::PAGES_AFTER); $page++) {
$markup .= $this->createCell($page);
}
if ($page < $this->totalPages - self::PAGES_BEFORE_END) {
$markup .= $this->createEllipses();
$page = $this->totalPages - self::PAGES_BEFORE_END;
}
for ( ; $page <= $this->totalPages; $page++) {
$markup .= $this->createCell($page);
}
return $markup;
}
protected function createCell($pageNumber) {
if ($pageNumber != $this->currentPage) {
$link = array(
'<a href="' . $this->baseURL . '&amp;page=' . $pageNumber . '">',
'</a>'
);
$extraClass = '';
}
else {
$link = array('', '');
$extraClass = ' bgColor-20';
}
return '<td class="page' . $extraClass . '">' . $link[0] . $pageNumber . $link[1] . '</td>';
}
protected function createEllipses() {
return '<td>...</td>';
}
protected function calcTotalPages($totalResults) {
$this->totalPages = intval($totalResults/$this->resultsPerPage) +
(($totalResults % $this->resultsPerPage) != 0 ? 1 : 0);
}
}
if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/realurl/modfunc1/class.tx_realurl_pagebrowser.php']) {
/** @noinspection PhpIncludeInspection */
include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/realurl/modfunc1/class.tx_realurl_pagebrowser.php']);
}

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<description>mod1 labels</description>
<type>module</type>
<csh_table></csh_table>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="title">Speaking URL Management</label>
<label index="no_page_id">Please, select a page from the page tree.</label>
<label index="depth">Depth:</label>
<label index="function">Show:</label>
<label index="default_language">Default</label>
<label index="all_languages">All</label>
<label index="language">Language:</label>
<label index="search_path">Path:</label>
<label index="look_up">Look up</label>
<label index="show_all">Show all</label>
<label index="displaying_results">Results %1$d-%2$d of %3$d</label>
<label index="all_domains">-- All domains --</label>
</languageKey>
</data>
</T3locallang>