diff --git a/typo3/class.file_list.inc b/typo3/class.file_list.inc index 28db3aa532a341906785ef6cdc16a4adf5f1f7a3..ce0d520f723a8d3354b60e0d953850145d7087a3 100644 --- a/typo3/class.file_list.inc +++ b/typo3/class.file_list.inc @@ -24,46 +24,47 @@ * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ + /** * Include file extending t3lib_recordList * * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj * - * @author Kasper Skårhøj <kasperYYYY@typo3.com> + * @author Kasper Skårhøj <kasperYYYY@typo3.com> */ - - - - - /** * Class for rendering of File>Filelist * - * @author Kasper Skårhøj <kasperYYYY@typo3.com> + * @author Kasper Skårhøj <kasperYYYY@typo3.com> * @package TYPO3 * @subpackage core */ class fileList extends t3lib_recordList { - var $iLimit = 40; // default Max items shown - var $thumbs = 0; // Boolean. Thumbnails on records containing files (pictures) + // default Max items shown + var $iLimit = 40; + // Boolean. Thumbnails on records containing files (pictures) + var $thumbs = 0; var $widthGif = '<img src="clear.gif" width="1" height="1" hspace="165" alt="" />'; - var $fixedL = 30; // Max length of strings + // Max length of strings + var $fixedL = 30; var $script = 'file_list.php'; - var $clickMenus=1; // If TRUE click menus are generated on files and folders - - var $sort = ''; // The field to sort by... - var $sortRev = 1; // Reverse sorting flag - var $firstElementNumber=0; + // If TRUE click menus are generated on files and folders + var $clickMenus = 1; + // The field to sort by... + var $sort = ''; + // Reverse sorting flag + var $sortRev = 1; + var $firstElementNumber = 0; var $clipBoard = 0; var $bigControlPanel = 0; // internal var $JScode = ''; var $HTMLcode = ''; - var $totalbytes=0; - var $dirs = Array(); - var $files = Array(); + var $totalbytes = 0; + var $dirs = array(); + var $files = array(); var $path = ''; /** @@ -71,12 +72,12 @@ class fileList extends t3lib_recordList { */ protected $folderObject; - var $eCounter=0; // Counting the elements no matter what... + // Counting the elements no matter what... + var $eCounter = 0; var $dirCounter = 0; - var $totalItems=''; - - var $CBnames=array(); + var $totalItems = ''; + var $CBnames = array(); /** * Initialization of class @@ -92,17 +93,17 @@ class fileList extends t3lib_recordList { $this->script = t3lib_extMgm::extRelPath('filelist') . 'mod1/file_list.php'; $this->folderObject = $folderObject; - $this->counter=0; - $this->totalbytes=0; - $this->JScode=''; - $this->HTMLcode=''; + $this->counter = 0; + $this->totalbytes = 0; + $this->JScode = ''; + $this->HTMLcode = ''; $this->path = $folderObject->getIdentifier(); $this->sort = $sort; $this->sortRev = $sortRev; $this->firstElementNumber=$pointer; $this->clipBoard = $clipBoard; $this->bigControlPanel = $bigControlPanel; - // setting the maximum length of the filenames to the user's settings or minimum 30 (= $this->fixedL) + // Setting the maximum length of the filenames to the user's settings or minimum 30 (= $this->fixedL) $this->fixedL = max($this->fixedL, $GLOBALS['BE_USER']->uc['titleLen']); $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_common.xml'); @@ -111,7 +112,7 @@ class fileList extends t3lib_recordList { /** * Reading files and directories, counting elements and generating the list in ->HTMLcode * - * @return void + * @return void */ function generateList() { $this->HTMLcode .= $this->getTable('fileext,tstamp,size,rw,_REF_'); @@ -143,19 +144,19 @@ class fileList extends t3lib_recordList { $title = htmlspecialchars($folderObject->getIdentifier()); // Start compiling the HTML - // @todo: how to fix this? $title = $GLOBALS['SOBE']->basicFF->blindPath($title); + // @todo: how to fix this? $title = $GLOBALS['SOBE']->basicFF->blindPath($title); - // if this is some subpage under the mount root.... + // If this is some subpage under the mount root.... if ($folderObject->getStorage()->isWithinFileMountBoundaries($folderObject)) { // The icon with link $otherMarkers['PAGE_ICON'] = t3lib_iconWorks::getSpriteIcon($icon, array('title' => $title)); $buttons['level_up'] = $this->linkWrapDir(t3lib_iconWorks::getSpriteIcon('actions-view-go-up', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.upOneLevel', 1))), $folderObject); - // No HTML specialchars here - HTML like <strong> </strong> is allowed + // No HTML specialchars here - HTML like <strong> </strong> is allowed $otherMarkers['TITLE'] .= t3lib_div::removeXSS(t3lib_div::fixed_lgd_cs($title, -($this->fixedL+20))); } else { - // this is the root page + // This is the root page $otherMarkers['PAGE_ICON'] = t3lib_iconWorks::getSpriteIcon('apps-filetree-root'); $otherMarkers['TITLE'] .= htmlspecialchars(t3lib_div::fixed_lgd_cs($title, - ($this->fixedL + 20))); } @@ -175,13 +176,13 @@ class fileList extends t3lib_recordList { /** * Wrapping input string in a link with clipboard command. * - * @param string String to be linked - must be htmlspecialchar'ed / prepared before. - * @param string table - NOT USED - * @param string "cmd" value - * @param string Warning for JS confirm message - * @return string Linked string + * @param string $string String to be linked - must be htmlspecialchar'ed / prepared before. + * @param string $table table - NOT USED + * @param string $cmd "cmd" value + * @param string $warning Warning for JS confirm message + * @return string Linked string */ - function linkClipboardHeaderIcon($string,$table,$cmd,$warning='') { + function linkClipboardHeaderIcon($string, $table, $cmd, $warning = '') { $onClickEvent = 'document.dblistForm.cmd.value=\''.$cmd.'\';document.dblistForm.submit();'; if ($warning) $onClickEvent = 'if (confirm('.$GLOBALS['LANG']->JScharCode($warning).')){'.$onClickEvent.'}'; return '<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">'.$string.'</a>'; @@ -190,14 +191,12 @@ class fileList extends t3lib_recordList { /** * Returns a table with directories and files listed. * - * @param array Array of files from path - * @param array Array of directories from path - * @param string List of rows to display horizontallyh - * @return string HTML-table + * @param array $rowlist Array of files from path + * @return string HTML-table */ function getTable($rowlist) { - // TODO use folder methods directly when they support filters + // TODO use folder methods directly when they support filters $storage = $this->folderObject->getStorage(); $storage->resetFileAndFolderNameFiltersToDefault(); @@ -205,13 +204,13 @@ class fileList extends t3lib_recordList { $files = $storage->getFileList($this->folderObject->getIdentifier()); - // only render the contents of a browsable storage + // Only render the contents of a browsable storage if ($this->folderObject->getStorage()->isBrowsable()) { $this->sort = trim($this->sort); if ($this->sort !== '') { $filesToSort = array(); - foreach($files as $file) { + foreach ($files as $file) { $fileObject = $storage->getFile($file['identifier']); switch ($this->sort) { @@ -236,7 +235,9 @@ class fileList extends t3lib_recordList { } } $i = 0; - while(isset($filesToSort[$sortingKey . $i])) { $i++; } + while (isset($filesToSort[$sortingKey . $i])) { + $i++; + } $filesToSort[$sortingKey . $i] = $fileObject; } if (intval($this->sortRev) === 1) { @@ -252,9 +253,9 @@ class fileList extends t3lib_recordList { // Adds the code of files/dirs $out = ''; $titleCol = 'file'; - // @todo: fix this: go up one level with FAL - // $upLevelDir = dirname(substr($files['files'][0]['path'], 0, -1)) . '/'; - // $levelUp = $GLOBALS['SOBE']->basicFF->checkPathAgainstMounts($upLevelDir) ? $this->linkWrapDir(t3lib_iconWorks::getSpriteIcon('actions-view-go-up', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', TRUE))), $upLevelDir) : ''; + // @todo: fix this: go up one level with FAL + // $upLevelDir = dirname(substr($files['files'][0]['path'], 0, -1)) . '/'; + // $levelUp = $GLOBALS['SOBE']->basicFF->checkPathAgainstMounts($upLevelDir) ? $this->linkWrapDir(t3lib_iconWorks::getSpriteIcon('actions-view-go-up', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', TRUE))), $upLevelDir) : ''; // Cleaning rowlist for duplicates and place the $titleCol as the first column always! $rowlist = t3lib_div::rmFromList($titleCol, $rowlist); @@ -274,7 +275,7 @@ class fileList extends t3lib_recordList { $iOut = $this->formatDirList($folderObjects); if ($iOut) { - // half line is drawn + // Half line is drawn $theData = array( $titleCol => '' ); @@ -289,8 +290,8 @@ class fileList extends t3lib_recordList { foreach ($this->fieldArray as $v) { if ($v == '_CLIPBOARD_' && $this->clipBoard) { - $cells=array(); - $table='_FILE'; + $cells = array(); + $table = '_FILE'; $elFromTable = $this->clipObj->elFromTable($table); if (count($elFromTable)) { $cells[] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE',$this->folderObject->getCombinedIdentifier())) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $this->path, 'into', $elFromTable)) . '" title="' . $GLOBALS['LANG']->getLL('clip_paste', 1) . '">' . @@ -378,7 +379,7 @@ class fileList extends t3lib_recordList { $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon, $folderObject->getCombinedIdentifier()); } - // Preparing and getting the data-array + // Preparing and getting the data-array $theData = array(); foreach ($this->fieldArray as $field) { switch($field) { @@ -439,7 +440,7 @@ class fileList extends t3lib_recordList { // Sometimes $code contains plain HTML tags. In such a case the string should not be modified! if (!strcmp($title, strip_tags($title))) { return '<a href="'.htmlspecialchars($href).'"'.$onclick.' title="'.htmlspecialchars($title).'">'.t3lib_div::fixed_lgd_cs($title, $this->fixedL).'</a>'; - } else { + } else { return '<a href="'.htmlspecialchars($href).'"'.$onclick.'>' . $title . '</a>'; } } @@ -465,7 +466,7 @@ class fileList extends t3lib_recordList { * The URL however is not relative (with the backpath), otherwise t3lib_div::sanitizeLocalUrl() would say that * the URL would be invalid * - * @return string URL + * @return string URL */ function listURL() { return t3lib_div::linkThisScript(array( @@ -494,7 +495,7 @@ class fileList extends t3lib_recordList { $title = '<strong>' . $GLOBALS['LANG']->getLL('recycler', TRUE) . '</strong>'; } - // mark the icon as read-only icon if the folder is not writable + // Mark the icon as read-only icon if the folder is not writable if ($folderObject->checkActionPermission('write') === FALSE) { $icon = 'apps-filetree-folder-locked'; } @@ -529,7 +530,7 @@ class fileList extends t3lib_recordList { $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon, $fileObject->getCombinedIdentifier()); } - // Preparing and getting the data-array + // Preparing and getting the data-array $theData = array(); foreach ($this->fieldArray as $field) { switch ($field) { @@ -537,7 +538,7 @@ class fileList extends t3lib_recordList { $theData[$field] = t3lib_div::formatSize($fileObject->getSize(), $GLOBALS['LANG']->getLL('byteSizeUnits', TRUE)); break; case 'rw': - $theData[$field] = '' . + $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<span class="typo3-red"><strong>' . $GLOBALS['LANG']->getLL('read', TRUE) . '</strong></span>') . (!$fileObject->checkActionPermission('write') ? '' : '<span class="typo3-red"><strong>' . $GLOBALS['LANG']->getLL('write', TRUE) . '</strong></span>'); break; @@ -587,23 +588,24 @@ class fileList extends t3lib_recordList { /** * Returns TRUE if $ext is an image-extension according to $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] * - * @param string file extension - * @return boolean + * @param string $ext File extension + * @return boolean */ function isImage($ext) { - return t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],strtolower($ext)); + return t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], strtolower($ext)); } /** * Wraps the directory-titles ($code) in a link to file_list.php (id=$path) and sorting commands... * - * @param string String to be wrapped - * @param string ID (path) - * @param string Sorting column - * @return string HTML + * @param string $code String to be wrapped + * @param string $folderIdentifier ID (path) + * @param string $col Sorting column + * @return string HTML */ function linkWrapSort($code, $folderIdentifier, $col) { - if ($this->sort==$col && !$this->sortRev) { // reverse sorting + // reverse sorting + if ($this->sort == $col && !$this->sortRev) { $params='&SET[sort]=' . $col . '&SET[reverse]=1'; } else { $params='&SET[sort]=' . $col . '&SET[reverse]=0'; @@ -633,11 +635,11 @@ class fileList extends t3lib_recordList { t3lib_iconWorks::getSpriteIcon('actions-edit-cut'.($isSel=='cut'?'-release':''),array('title'=>$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.cut',1))). '</a>'; } else { // For numeric pads, add select checkboxes: - $n='_FILE|'.$md5; - $this->CBnames[]=$n; + $n = '_FILE|'.$md5; + $this->CBnames[] = $n; $checked = ($this->clipObj->isSelected('_FILE',$md5)?' checked="checked"':''); - $cells[]='<input type="hidden" name="CBH['.$n.']" value="0" />'. + $cells[] = '<input type="hidden" name="CBH['.$n.']" value="0" />'. '<input type="checkbox" name="CBC[' . $n . ']" value="' . htmlspecialchars($fullIdentifier) . '" class="smallCheckboxes"' . $checked . ' />'; } @@ -667,7 +669,7 @@ class fileList extends t3lib_recordList { $cells = array(); $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier(); - // edit metadata of file + // Edit metadata of file try { if (is_a($fileOrFolderObject, 't3lib_file_File') && $fileOrFolderObject->isIndexed() && $fileOrFolderObject->checkActionPermission('edit')) { $data = array( @@ -682,7 +684,7 @@ class fileList extends t3lib_recordList { $cells['editmetadata'] = t3lib_iconWorks::getSpriteIcon('empty-empty'); } - // edit file content (if editable) + // Edit file content (if editable) if (is_a($fileOrFolderObject, 't3lib_file_File') && $fileOrFolderObject->checkActionPermission('edit') && t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) { $editOnClick = 'top.content.list_frame.location.href=top.TS.PATH_typo3+\'file_edit.php?target=' . rawurlencode($fullIdentifier) . @@ -711,11 +713,11 @@ class fileList extends t3lib_recordList { $cells['info'] = '<a href="#" onclick="' . $infoOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.info') . '">' . t3lib_iconWorks::getSpriteIcon('status-dialog-information') . '</a>'; // Hook for manipulating edit icons. - if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) { - foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) { + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) { $hookObject = t3lib_div::getUserObj($classData); - if(!($hookObject instanceof fileList_editIconHook)) { + if (!($hookObject instanceof fileList_editIconHook)) { throw new UnexpectedValueException('$hookObject must implement interface fileList_editIconHook', 1235225797); } @@ -751,10 +753,10 @@ class fileList extends t3lib_recordList { ); // Compile information for title tag: - $infoData=array(); + $infoData = array(); if (is_array($rows)) { - foreach($rows as $row) { - $infoData[]= $row['tablename'] . ':' . $row['recuid'] . ':' . $row['field']; + foreach ($rows as $row) { + $infoData[] = $row['tablename'] . ':' . $row['recuid'] . ':' . $row['field']; } } diff --git a/typo3/class.filelistfoldertree.php b/typo3/class.filelistfoldertree.php index cc34a7135f01417b0804ba1847d9783bc01b0719..e23fef278e3b375d60f417d229a507189f399e25 100644 --- a/typo3/class.filelistfoldertree.php +++ b/typo3/class.filelistfoldertree.php @@ -27,13 +27,11 @@ /** * Folder navigation tree for the File main module * - * @author Benjamin Mack <bmack@xnos.org> + * @author Benjamin Mack <bmack@xnos.org> * * * [CLASS/FUNCTION INDEX of SCRIPT] * - * - * * 71: class fileListTree extends t3lib_browseTree * 81: function webPageTree() * 92: function wrapIcon($icon, &$row) @@ -53,8 +51,8 @@ /** * Extension class for the t3lib_filetree class, needed for drag and drop and ajax functionality * - * @author Sebastian Kurfürst <sebastian@garbage-group.de> - * @author Benjamin Mack <bmack@xnos.org> + * @author Sebastian Kurfürst <sebastian@garbage-group.de> + * @author Benjamin Mack <bmack@xnos.org> * @package TYPO3 * @subpackage core * @see class t3lib_browseTree diff --git a/typo3/class.show_rechis.inc b/typo3/class.show_rechis.inc index dd611c2a2e6f6c55e37b8ed9168225ab6bca1924..69f66db244cb9815e54acacf85b01a88238ac789 100644 --- a/typo3/class.show_rechis.inc +++ b/typo3/class.show_rechis.inc @@ -25,31 +25,38 @@ * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ + /** * Class for the record history display script (show_rechis.php) * * XHTML Compliant * - * @author Sebastian Kurfürst <sebastian@garbage-group.de> + * @author Sebastian Kurfürst <sebastian@garbage-group.de> */ /** * Class for the record history display script (show_rechis.php) * - * @author Sebastian Kurfürst <sebastian@garbage-group.de> + * @author Sebastian Kurfürst <sebastian@garbage-group.de> * @package TYPO3 * @subpackage core */ class recordHistory { // External, static: - var $maxSteps = 20; // Maximum number of sys_history steps to show. - var $showDiff = 1; // display diff or not (0-no diff, 1-inline) - var $showSubElements = 1; // on a pages table - show sub elements as well. - var $showInsertDelete = 1; // show inserts and deletes as well + // Maximum number of sys_history steps to show. + var $maxSteps = 20; + // display diff or not (0-no diff, 1-inline) + var $showDiff = 1; + // on a pages table - show sub elements as well. + var $showSubElements = 1; + // show inserts and deletes as well + var $showInsertDelete = 1; // Internal, GPvars - var $element; // Element reference, syntax [tablename]:[uid] - var $lastSyslogId; // syslog ID which is not shown anymore + // Element reference, syntax [tablename]:[uid] + var $element; + // syslog ID which is not shown anymore + var $lastSyslogId; var $returnUrl; // Internal @@ -58,8 +65,6 @@ class recordHistory { /** * Constructor for the class - * - * @return void */ function __construct() { // GPvars: @@ -67,7 +72,7 @@ class recordHistory { $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl')); $this->lastSyslogId = t3lib_div::_GP('diff'); $this->rollbackFields = t3lib_div::_GP('rollbackFields'); - // resolve sh_uid if set + // Resolve sh_uid if set $this->resolveShUid(); } @@ -75,12 +80,12 @@ class recordHistory { * Main function for the listing of history. * It detects incoming variables like element reference, history element uid etc. and renders the correct screen. * - * @return HTML content for the module + * @return HTML content for the module */ function main() { $content = ''; - // single-click rollback + // Single-click rollback if (t3lib_div::_GP('revert') && t3lib_div::_GP('sumUp')) { $this->rollbackFields = t3lib_div::_GP('revert'); $this->showInsertDelete = 0; @@ -104,7 +109,7 @@ class recordHistory { t3lib_utility_Http::redirect($this->returnUrl); } - // save snapshot + // Save snapshot if (t3lib_div::_GP('highlight') && !t3lib_div::_GP('settings')) { $this->toggleHighlight(t3lib_div::_GP('highlight')); } @@ -137,8 +142,8 @@ class recordHistory { /** * Toggles highlight state of record * - * @param integer uid of sys_history entry - * @return [type] ... + * @param integer $uid Uid of sys_history entry + * @return void */ function toggleHighlight($uid) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('snapshot', 'sys_history', 'uid=' . intval($uid)); @@ -149,8 +154,8 @@ class recordHistory { /** * perform rollback * - * @param array diff array to rollback - * @return void + * @param array $diff Diff array to rollback + * @return void * @access private */ function performRollback($diff) { @@ -185,7 +190,7 @@ class recordHistory { $elParts = explode(':', $key); if ($action == 1) { // inserted records should be deleted $cmdmapArray[$elParts[0]][$elParts[1]]['delete'] = 1; - // when the record is deleted, the contents of the record do not need to be updated + // When the record is deleted, the contents of the record do not need to be updated unset($diff['oldData'][$key]); unset($diff['newData'][$key]); } elseif ($action == -1) { // deleted records should be inserted again @@ -243,12 +248,12 @@ class recordHistory { $reloadPageFrame = 1; } - // return to normal operation + // Return to normal operation $this->lastSyslogId = FALSE; $this->rollbackFields = FALSE; $this->createChangeLog(); - // reload page frame if necessary + // Reload page frame if necessary if ($reloadPageFrame) { return '<script type="text/javascript"> /*<![CDATA[*/ @@ -269,10 +274,10 @@ class recordHistory { /** * Displays settings * - * @return string HTML code to modify settings + * @return string HTML code to modify settings */ function displaySettings() { - // get current selection from UC, merge data, write it back to UC + // Get current selection from UC, merge data, write it back to UC $currentSelection = is_array($GLOBALS['BE_USER']->uc['moduleData']['history']) ? $GLOBALS['BE_USER']->uc['moduleData']['history'] : array('maxSteps' => '', 'showDiff' => 1, 'showSubElements' => 1, 'showInsertDelete' => 1); $currentSelectionOverride = t3lib_div::_GP('settings'); @@ -282,7 +287,7 @@ class recordHistory { $GLOBALS['BE_USER']->writeUC($GLOBALS['BE_USER']->uc); } - // display selector for number of history entries + // Display selector for number of history entries $selector['maxSteps'] = array( 10 => 10, 20 => 20, @@ -328,7 +333,7 @@ class recordHistory { $this->showInsertDelete = intval($currentSelection['showInsertDelete']); $content = ''; - // get link to page history if the element history is shown + // Get link to page history if the element history is shown $elParts = explode(':', $this->element); if ($elParts[0] != 'pages') { $content .= '<strong>' . $GLOBALS['LANG']->getLL('elementHistory', 1) . '</strong><br />'; @@ -343,7 +348,7 @@ class recordHistory { /** * Shows the full change log * - * @return string HTML for list, wrapped in a table. + * @return string HTML for list, wrapped in a table. */ function displayHistory() { $lines = array(); @@ -359,7 +364,7 @@ class recordHistory { <td> </td> </tr>'; - // get default page TSconfig expiration time + // Get default page TSconfig expiration time $elParts = explode(':', $this->element); if ($elParts[0] != 'pages') { $tmp = t3lib_BEfunc::getRecordRaw($elParts[0], 'uid=' . intval($elParts[1])); @@ -387,7 +392,7 @@ class recordHistory { break; } - // display inconsistency warning + // Display inconsistency warning if ($entry['tstamp'] < $expirationTimestamp && !$expirationWarning) { $expirationWarning = 1; @@ -397,19 +402,19 @@ class recordHistory { </tr>'; } - // show only marked states + // Show only marked states if (!$entry['snapshot'] && $this->showMarked) { continue; } $i++; - // get user names + // Get user names $userName = ($entry['user']?$be_user_array[$entry['user']]['username']:$GLOBALS['LANG']->getLL('externalChange', 1)); - // build up single line + // Build up single line $singleLine = array(); - // diff link + // Diff link $image = t3lib_iconWorks::getSpriteIcon('actions-view-go-forward', array('title' => $GLOBALS['LANG']->getLL('sumUpChanges', TRUE))); $singleLine[] = '<span>' . $this->linkPage($image, array('diff' => $sysLogUid)) . '</span>'; // remove first link @@ -418,12 +423,13 @@ class recordHistory { $singleLine[] = htmlspecialchars($userName); // add user name $singleLine[] = $this->linkPage($this->generateTitle($entry['tablename'], $entry['recuid']), array('element' => $entry['tablename'] . ':' . $entry['recuid']), '', $GLOBALS['LANG']->getLL('linkRecordHistory', 1)); // add record UID - // show insert/delete/diff/changed field names + // Show insert/delete/diff/changed field names if ($entry['action']) { // insert or delete of element $singleLine[] = '<strong>' . htmlspecialchars($GLOBALS['LANG']->getLL($entry['action'], 1)) . '</strong>'; } else { - if (!$this->showDiff) { // display field names instead of full diff - // re-write field names with labels + // Display field names instead of full diff + if (!$this->showDiff) { + // Re-write field names with labels $tmpFieldList = explode(',', $entry['fieldlist']); foreach ($tmpFieldList as $key => $value) { $tmp = str_replace(':', '', $GLOBALS['LANG']->sl(t3lib_BEfunc::getItemLabel($entry['tablename'], $value), 1)); @@ -431,16 +437,17 @@ class recordHistory { if ($tmp) $tmpFieldList[$key] = $tmp; else - unset($tmpFieldList[$key]); // remove fields if no label available + // remove fields if no label available + unset($tmpFieldList[$key]); } $singleLine[] = htmlspecialchars(implode(',', $tmpFieldList)); - } else { // display diff + } else { // Display diff $diff = $this->renderDiff($entry,$entry['tablename']); $singleLine[] = $diff; } } - // show link to mark/unmark state + // Show link to mark/unmark state if (!$entry['action']) { if ($entry['snapshot']) { $image = '<img' . t3lib_iconWorks::skinImg('', 'gfx/unmarkstate.gif') . ' align="top" alt="' . $GLOBALS['LANG']->getLL('unmarkState', 1) . '" title="' . $GLOBALS['LANG']->getLL('unmarkState', 1) . '" />'; @@ -489,13 +496,13 @@ class recordHistory { /** * Displays a diff over multiple fields including rollback links * - * @param array difference array - * @return string HTML output + * @param array $diff Difference array + * @return string HTML output */ function displayMultipleDiff($diff) { $content = ''; - // get all array keys needed + // Get all array keys needed $arrayKeys = array_merge(array_keys($diff['newData']),array_keys($diff['insertsDeletes']), array_keys($diff['oldData'])); $arrayKeys = array_unique($arrayKeys); @@ -503,7 +510,7 @@ class recordHistory { foreach ($arrayKeys as $key) { $record = ''; $elParts = explode(':', $key); - // turn around diff because it should be a "rollback preview" + // Turn around diff because it should be a "rollback preview" if ($diff['insertsDeletes'][$key] == 1) { // insert $record .= '<strong>' . $GLOBALS['LANG']->getLL('delete', 1) . '</strong>'; $record .= '<br />'; @@ -511,7 +518,7 @@ class recordHistory { $record .= '<strong>' . $GLOBALS['LANG']->getLL('insert', 1) . '</strong>'; $record .= '<br />'; } - // build up temporary diff array + // Build up temporary diff array // turn around diff because it should be a "rollback preview" if ($diff['newData'][$key]) { $tmpArr['newRecord'] = $diff['oldData'][$key]; @@ -535,10 +542,10 @@ class recordHistory { /** * Renders HTML table-rows with the comparison information of an sys_history entry record * - * @param array sys_history entry record. - * @param string The table name - * @param integer If set to UID of record, display rollback links - * @return string HTML table + * @param array $entry sys_history entry record. + * @param string $table The table name + * @param integer $rollbackUid If set to UID of record, display rollback links + * @return string HTML table * @access private */ function renderDiff($entry, $table, $rollbackUid = 0) { @@ -572,7 +579,8 @@ class recordHistory { </table>'; return $content; } - return NULL; // error fallback + // error fallback + return NULL; } /******************************* @@ -614,7 +622,8 @@ class recordHistory { } } else { // update fields - if (!isset($newArr[$field])) { // first row of field + // first row of field + if (!isset($newArr[$field])) { $newArr[$field] = $value['newRecord']; $differences[$field] = $value['oldRecord']; } else { // standard @@ -646,7 +655,7 @@ class recordHistory { /** * Creates change log including sub-elements, filling $this->changeLog * - * @return [type] ... + * @return integer */ function createChangeLog() { $elParts = explode(':', $this->element); @@ -655,9 +664,11 @@ class recordHistory { // get history of tables of this page and merge it into changelog if ($elParts[0] == 'pages' && $this->showSubElements) { foreach ($GLOBALS['TCA'] as $tablename => $value) { - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $tablename, 'pid=' . intval($elParts[1])); // check if there are records on the page + // check if there are records on the page + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $tablename, 'pid=' . intval($elParts[1])); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { - if ($newChangeLog = $this->getHistoryData($tablename, $row['uid'])) { // if there is history data available, merge it into changelog + // if there is history data available, merge it into changelog + if ($newChangeLog = $this->getHistoryData($tablename, $row['uid'])) { foreach ($newChangeLog as $key => $value) { $changeLog[$key] = $value; } @@ -678,11 +689,11 @@ class recordHistory { /** * Gets history and delete/insert data from sys_log and sys_history * - * @param string DB table name - * @param integer UID of record - * @return array history data of the record + * @param string $table DB table name + * @param integer $uid UID of record + * @return array history data of the record */ - function getHistoryData($table,$uid) { + function getHistoryData($table, $uid) { $uid = $this->resolveElement($table, $uid); // If table is found in $GLOBALS['TCA']: @@ -704,7 +715,7 @@ class recordHistory { $changeLog = array(); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { - // only history until a certain syslog ID needed + // Only history until a certain syslog ID needed if ($row['sys_log_uid'] < $this->lastSyslogId && $this->lastSyslogId) { continue; } @@ -724,7 +735,8 @@ class recordHistory { $changeLog[$row['sys_log_uid']] = $hisDat; } else { debug('ERROR: [getHistoryData]'); - return 0; // error fallback + // error fallback + return 0; } } // SELECT INSERTS/DELETES @@ -765,7 +777,8 @@ class recordHistory { } return $changeLog; } - return 0; // error fallback + // error fallback + return 0; } @@ -776,11 +789,11 @@ class recordHistory { *******************************/ /** - * generates the title and puts the record title behind + * Generates the title and puts the record title behind * - * @param [type] $table: ... - * @param [type] $uid: ... - * @return [type] ... + * @param string $table + * @param string $uid + * @return string */ function generateTitle($table, $uid) { $out = $table . ':' . $uid; @@ -791,12 +804,12 @@ class recordHistory { return $out; } /** - * creates a link for the rollback + * Creates a link for the rollback * - * @param sting parameter which is set to rollbackFields - * @param string optional, alternative label and title tag of image - * @param integer optional, type of rollback: 0 - ALL; 1 - element; 2 - field - * @return string HTML output + * @param string $key Parameter which is set to rollbackFields + * @param string $alt Optional, alternative label and title tag of image + * @param integer $type Optional, type of rollback: 0 - ALL; 1 - element; 2 - field + * @return string HTML output */ function createRollbackLink($key, $alt = '', $type = 0) { return $this->linkPage('<img ' . t3lib_iconWorks::skinImg('', 'gfx/revert_' . $type . '.gif', 'width="33" height="33"') . ' alt="' . $alt . '" title="' . $alt . '" align="middle" />', array('rollbackFields' => $key)); @@ -805,14 +818,14 @@ class recordHistory { /** * Creates a link to the same page. * - * @param string String to wrap in <a> tags (must be htmlspecialchars()'ed prior to calling function) - * @param array Array of key/value pairs to override the default values with. - * @param string Possible anchor value. - * @param string Possible title. - * @return string Link. + * @param string $str String to wrap in <a> tags (must be htmlspecialchars()'ed prior to calling function) + * @param array $inparams Array of key/value pairs to override the default values with. + * @param string $anchor Possible anchor value. + * @param string $title Possible title. + * @return string Link. * @access private */ - function linkPage($str, $inparams=array(), $anchor = '', $title = '') { + function linkPage($str, $inparams = array(), $anchor = '', $title = '') { // Setting default values based on GET parameters: $params['element'] = $this->element; @@ -829,17 +842,17 @@ class recordHistory { /** * Will traverse the field names in $dataArray and look in $GLOBALS['TCA'] if the fields are of types which cannot be handled by the sys_history (that is currently group types with internal_type set to "file") * - * @param string Table name - * @param array The data array - * @return array The modified data array + * @param string $table Table name + * @param array $dataArray The data array + * @return array The modified data array * @access private */ - function removeFilefields($table,$dataArray) { + function removeFilefields($table, $dataArray) { if ($GLOBALS['TCA'][$table]) { t3lib_div::loadTCA($table); - foreach($GLOBALS['TCA'][$table]['columns'] as $field => $config) { - if ($config['config']['type']=='group' && $config['config']['internal_type'] == 'file') { + foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $config) { + if ($config['config']['type'] == 'group' && $config['config']['internal_type'] == 'file') { unset($dataArray[$field]); } } @@ -850,9 +863,9 @@ class recordHistory { /** * Convert input element reference to workspace version if any. * - * @param string table of input element - * @param integer UID of record - * @return integer converted UID of record + * @param string $table Table of input element + * @param integer $uid UID of record + * @return integer converted UID of record */ function resolveElement($table, $uid) { if (isset($GLOBALS['TCA'][$table])) { @@ -864,9 +877,9 @@ class recordHistory { } /** - * resolve sh_uid (used from log) + * Resolve sh_uid (used from log) * - * @return [type] ... + * @return void */ function resolveShUid() { if (t3lib_div::_GP('sh_uid')) {