[TASK] Fix CGL violations against InlineControlStructure
authorWouter Wolters <typo3@wouterwolters.nl>
Fri, 29 Jun 2012 19:01:26 +0000 (21:01 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 29 Jun 2012 19:49:15 +0000 (21:49 +0200)
Fix CGL violations against InlineControlStructure

Change-Id: I296c5f8cc847c4d7d80ab64703834902d65aa8e2
Resolves: #38492
Releases: 6.0
Reviewed-on: http://review.typo3.org/12454
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/class.t3lib_tceforms_inline.php
t3lib/jsfunc.evalfield.js
t3lib/jsfunc.inline.js
t3lib/thumbs.php
typo3/alt_clickmenu.php
typo3/alt_doc.php

index 06c3fe3..0cf3089 100644 (file)
@@ -2269,7 +2269,9 @@ class t3lib_TCEforms_inline {
                $flat = FALSE;
                if (is_array($possibleRecords)) {
                        $flat = array();
-                       foreach ($possibleRecords as $record) $flat[$record[1]] = $record[0];
+                       foreach ($possibleRecords as $record) {
+                               $flat[$record[1]] = $record[0];
+                       }
                }
                return $flat;
        }
index aa1b1c0..411113d 100644 (file)
@@ -137,8 +137,10 @@ function evalFunc_caseSwitch(type,inVal) {
 }
 function evalFunc_parseInt(value) {
        var theVal = ''+value;
-       if (!value)     return 0;
-       for (var a=0;a<theVal.length;a++) {
+       if (!value) {
+               return 0;
+       }
+       for (var a = 0; a < theVal.length; a++) {
                if (theVal.substr(a,1)!='0') {
                        return parseInt(theVal.substr(a,theVal.length)) || 0;
                }
@@ -147,9 +149,11 @@ function evalFunc_parseInt(value) {
 }
 function evalFunc_getNumChars(value) {
        var theVal = ''+value;
-       if (!value)     return 0;
+       if (!value) {
+               return 0;
+       }
        var outVal="";
-       for (var a=0;a<theVal.length;a++) {
+       for (var a = 0; a < theVal.length; a++) {
                if (theVal.substr(a,1)==parseInt(theVal.substr(a,1))) {
                        outVal+=theVal.substr(a,1);
                }
@@ -188,8 +192,10 @@ function evalFunc_noSpace(value) {
 }
 function evalFunc_ltrim(value) {
        var theVal = ''+value;
-       if (!value)     return '';
-       for (var a=0;a<theVal.length;a++) {
+       if (!value) {
+               return '';
+       }
+       for (var a = 0; a < theVal.length; a++) {
                if (theVal.substr(a,1)!=' ') {
                        return theVal.substr(a,theVal.length);
                }
@@ -198,8 +204,10 @@ function evalFunc_ltrim(value) {
 }
 function evalFunc_btrim(value) {
        var theVal = ''+value;
-       if (!value)     return '';
-       for (var a=theVal.length;a>0;a--) {
+       if (!value) {
+               return '';
+       }
+       for (var a = theVal.length; a > 0; a--) {
                if (theVal.substr(a-1,1)!=' ') {
                        return theVal.substr(0,a);
                }
index c0f4913..ff73672 100644 (file)
@@ -41,9 +41,12 @@ var inline = {
                        inline.data[pair.key] = $H(inline.data[pair.key]).merge(pair.value).toObject();
                });
        },
-       setPrependFormFieldNames: function(value) {     this.prependFormFieldNames = value; },
-       setNoTitleString: function(value) { this.noTitleString = value; },
-
+       setPrependFormFieldNames: function(value) {
+               this.prependFormFieldNames = value;
+       },
+       setNoTitleString: function(value) {
+               this.noTitleString = value;
+       },
        expandCollapseRecord: function(objectId, expandSingle, returnURL) {
                var currentUid = this.parseObjectId('none', objectId, 1);
                var objectPrefix = this.parseObjectId('full', objectId, 0, 1);
@@ -67,18 +70,20 @@ var inline = {
 
                        // if only a single record should be visibly for that set of records
                        // and the record clicked itself is no visible, collapse all others
-               if (expandSingle && !Element.visible(objectId+'_fields'))
+               if (expandSingle && !Element.visible(objectId+'_fields')) {
                        collapse = this.collapseAllRecords(objectId, objectPrefix, currentUid);
+               }
 
                Element.toggle(objectId+'_fields');
                currentState = Element.visible(objectId+'_fields') ? 1 : 0
 
-               if (this.isNewRecord(objectId))
+               if (this.isNewRecord(objectId)) {
                        this.updateExpandedCollapsedStateLocally(objectId, currentState);
-               else if (currentState)
+               } else if (currentState) {
                        expand.push(currentUid);
-               else if (!currentState)
+               } else if (!currentState) {
                        collapse.push(currentUid);
+               }
 
                this.setExpandedCollapsedState(objectId, expand.join(','), collapse.join(','));
 
@@ -100,8 +105,11 @@ var inline = {
                                recObjectId = objectPrefix + this.structureSeparator + records[i];
                                if (records[i] != callingUid && Element.visible(recObjectId+'_fields')) {
                                        Element.hide(recObjectId+'_fields');
-                                       if (this.isNewRecord(recObjectId)) this.updateExpandedCollapsedStateLocally(recObjectId, 0);
-                                       else collapse.push(records[i]);
+                                       if (this.isNewRecord(recObjectId)) {
+                                               this.updateExpandedCollapsedStateLocally(recObjectId, 0);
+                                       } else {
+                                               collapse.push(records[i]);
+                                       }
                                }
                        }
                }
@@ -305,13 +313,17 @@ var inline = {
 
                                // for select: only the uid is stored
                        if (unique['type'] == 'select') {
-                               if (values.indexOf(uid) != -1) return true;
+                               if (values.indexOf(uid) != -1) {
+                                       return true;
+                               }
 
                                // for group/db: table and uid is stored in a assoc array
                        } else if (unique.type == 'groupdb') {
                                for (var i=values.length-1; i>=0; i--) {
                                                // if the pair table:uid is already used:
-                                       if (values[i].table==table && values[i].uid==uid) return true;
+                                       if (values[i].table==table && values[i].uid==uid) {
+                                               return true;
+                                       }
                                }
                        }
                }
@@ -405,16 +417,18 @@ var inline = {
 
        domAddNewRecord: function(method, insertObject, objectPrefix, htmlData) {
                if (this.isBelowMax(objectPrefix)) {
-                       if (method == 'bottom')
+                       if (method == 'bottom') {
                                new Insertion.Bottom(insertObject, htmlData);
-                       else if (method == 'after')
+                       } else if (method == 'after') {
                                new Insertion.After(insertObject, htmlData);
+                       }
                }
        },
        domAddRecordDetails: function(objectId, objectPrefix, expandSingle, htmlData) {
                var objectDiv = $(objectId + '_fields');
-               if (!objectDiv || objectDiv.innerHTML.substr(0,16) != '<!--notloaded-->')
+               if (!objectDiv || objectDiv.innerHTML.substr(0,16) != '<!--notloaded-->') {
                        return;
+               }
 
                var elName = this.parseObjectId('full', objectId, 2, 0, true);
 
@@ -438,8 +452,10 @@ var inline = {
 
                // Get script and link elements from head tag:
        getDomHeadChildren: function(head) {
-               var headTags=[];
-               $$('head script', 'head link').each(function(tag) { headTags.push(tag); });
+               var headTags = [];
+               $$('head script', 'head link').each(function(tag) {
+                       headTags.push(tag);
+               });
                return headTags;
        },
 
@@ -582,11 +598,15 @@ var inline = {
                        records = new Array();
                        var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
                        var formObj = document.getElementsByName(objectName);
-                       if (formObj.length) records = formObj[0].value.split(',');
+                       if (formObj.length) {
+                               records = formObj[0].value.split(',');
+                       }
                }
 
                for (i=0; i<records.length; i++) {
-                       if (!records[i].length) continue;
+                       if (!records[i].length) {
+                               continue;
+                       }
 
                        headerObj = $(objectPrefix + this.structureSeparator + records[i] + '_header');
                        sortingObj[0] = Element.select(headerObj, '.sortingUp');
@@ -613,8 +633,12 @@ var inline = {
                                if (afterUid) {
                                        var newRecords = new Array();
                                        for (var i=0; i<records.length; i++) {
-                                               if (records[i].length) newRecords.push(records[i]);
-                                               if (afterUid == records[i]) newRecords.push(newUid);
+                                               if (records[i].length) {
+                                                       newRecords.push(records[i]);
+                                               }
+                                               if (afterUid == records[i]) {
+                                                       newRecords.push(newUid);
+                                               }
                                        }
                                        records = newRecords;
                                } else {
@@ -638,7 +662,9 @@ var inline = {
                        this.hideElementsWithClassName('.inlineNewButton'+(md5 ? '.'+md5 : ''), objectParent);
                }
 
-               if (TBE_EDITOR) TBE_EDITOR.fieldChanged_fName(objectName, formObj);
+               if (TBE_EDITOR) {
+                       TBE_EDITOR.fieldChanged_fName(objectName, formObj);
+               }
        },
 
        memorizeRemoveRecord: function(objectName, removeUid) {
@@ -649,7 +675,9 @@ var inline = {
                                parts = formObj[0].value.split(',');
                                parts = parts.without(removeUid);
                                formObj[0].value = parts.join(',');
-                               if (TBE_EDITOR) TBE_EDITOR.fieldChanged_fName(objectName, formObj);
+                               if (TBE_EDITOR) {
+                                       TBE_EDITOR.fieldChanged_fName(objectName, formObj);
+                               }
                                return parts.length;
                        }
                }
@@ -664,7 +692,9 @@ var inline = {
                        if (unique.selector == 'select') {
                                var selector = $(objectPrefix+'_selector');
                                this.removeSelectOption(selector, srcElement.value);
-                               if (typeof oldValue != 'undefined') this.readdSelectOption(selector, oldValue, unique);
+                               if (typeof oldValue != 'undefined') {
+                                       this.readdSelectOption(selector, oldValue, unique);
+                               }
                        }
 
                        if (!(unique.selector && unique.max == -1)) {
@@ -676,7 +706,9 @@ var inline = {
                                                recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+records[i]+']['+unique.field+']');
                                                if (recordObj.length && recordObj[0] != srcElement) {
                                                        this.removeSelectOption(recordObj[0], srcElement.value);
-                                                       if (typeof oldValue != 'undefined') this.readdSelectOption(recordObj[0], oldValue, unique);
+                                                       if (typeof oldValue != 'undefined') {
+                                                               this.readdSelectOption(recordObj[0], oldValue, unique);
+                                                       }
                                                }
                                        }
                                        this.data.unique[objectPrefix].used[recordUid] = srcElement.value;
@@ -710,7 +742,9 @@ var inline = {
                                                                // walk through all inline records on that level and get the select field
                                                        for (var i=0; i<records.length; i++) {
                                                                recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+records[i]+']['+unique.field+']');
-                                                               if (recordObj.length) this.readdSelectOption(recordObj[0], fieldObj[0].value, unique);
+                                                               if (recordObj.length) {
+                                                                       this.readdSelectOption(recordObj[0], fieldObj[0].value, unique);
+                                                               }
                                                        }
                                                }
                                        }
@@ -812,12 +846,13 @@ var inline = {
                var backSlash = path.lastIndexOf('\\');
                var normalSlash = path.lastIndexOf('/');
 
-               if (backSlash > 0)
+               if (backSlash > 0) {
                        path = path.substring(0,backSlash+1);
-               else if (normalSlash > 0)
+               } else if (normalSlash > 0) {
                        path = path.substring(0,normalSlash+1);
-               else
+               } else {
                        path = '';
+               }
 
                return path;
        },
@@ -825,16 +860,26 @@ var inline = {
        parseFormElementName: function(wrap, formElementName, rightCount, skipRight) {
                var idParts = this.splitFormElementName(formElementName);
 
-               if (!wrap) wrap = 'full';
-               if (!skipRight) skipRight = 0;
+               if (!wrap) {
+                       wrap = 'full';
+               }
+               if (!skipRight) {
+                       skipRight = 0;
+               }
 
                var elParts = new Array();
-               for (var i=0; i<skipRight; i++) idParts.pop();
+               for (var i=0; i<skipRight; i++) {
+                       idParts.pop();
+               }
 
                if (rightCount > 0) {
-                       for (var i=0; i<rightCount; i++) elParts.unshift(idParts.pop());
+                       for (var i=0; i<rightCount; i++) {
+                               elParts.unshift(idParts.pop());
+                       }
                } else {
-                       for (var i=0; i<-rightCount; i++) idParts.shift();
+                       for (var i=0; i<-rightCount; i++) {
+                               idParts.shift();
+                       }
                        elParts = idParts;
                }
 
@@ -889,16 +934,26 @@ var inline = {
        parseObjectId: function(wrap, objectId, rightCount, skipRight, returnAsFormElementName) {
                var idParts = this.splitObjectId(objectId);
 
-               if (!wrap) wrap = 'full';
-               if (!skipRight) skipRight = 0;
+               if (!wrap) {
+                       wrap = 'full';
+               }
+               if (!skipRight) {
+                       skipRight = 0;
+               }
 
                var elParts = new Array();
-               for (var i=0; i<skipRight; i++) idParts.pop();
+               for (var i=0; i<skipRight; i++) {
+                       idParts.pop();
+               }
 
                if (rightCount > 0) {
-                       for (var i=0; i<rightCount; i++) elParts.unshift(idParts.pop());
+                       for (var i=0; i<rightCount; i++) {
+                               elParts.unshift(idParts.pop());
+                       }
                } else {
-                       for (var i=0; i<-rightCount; i++) idParts.shift();
+                       for (var i=0; i<-rightCount; i++) {
+                               idParts.shift();
+                       }
                        elParts = idParts;
                }
 
@@ -917,13 +972,18 @@ var inline = {
                        formObj = formField;
                } else {
                        formObj = document.getElementsByName(formField);
-                       if (formObj.length) formObj = formObj[0];
+                       if (formObj.length) {
+                               formObj = formObj[0];
+                       }
                }
 
                if (formObj != undefined) {
                        var value;
-                       if (formObj.nodeName == 'SELECT') value = formObj.options[formObj.selectedIndex].text;
-                       else value = formObj.value;
+                       if (formObj.nodeName == 'SELECT') {
+                               value = formObj.options[formObj.selectedIndex].text;
+                       } else {
+                               value = formObj.value;
+                       }
                        $(objectId+'_label').innerHTML = value.length ? value : this.noTitleString;
                }
                return true;
@@ -934,7 +994,9 @@ var inline = {
                if (typeof object.length != 'undefined') {
                        count = object.length;
                } else {
-                       for (var i in object) count++;
+                       for (var i in object) {
+                               count++;
+                       }
                }
                return count;
        },
@@ -946,24 +1008,32 @@ var inline = {
 
                if (this.data.config && this.data.config[objectPrefix] && formObj.length) {
                        var recordCount = formObj[0].value ? formObj[0].value.split(',').length : 0;
-                       if (recordCount >= this.data.config[objectPrefix].max) isBelowMax = false;
+                       if (recordCount >= this.data.config[objectPrefix].max) {
+                               isBelowMax = false;
+                       }
                }
                if (isBelowMax && this.data.unique && this.data.unique[objectPrefix]) {
                        var unique = this.data.unique[objectPrefix];
-                       if (this.arrayAssocCount(unique.used) >= unique.max && unique.max >= 0) isBelowMax = false;
+                       if (this.arrayAssocCount(unique.used) >= unique.max && unique.max >= 0) {
+                               isBelowMax = false;
+                       }
                }
                return isBelowMax;
        },
 
        getOptionsHash: function(selectObj) {
                var optionsHash = {};
-               for (var i=0; i<selectObj.options.length; i++) optionsHash[selectObj.options[i].value] = i;
+               for (var i=0; i<selectObj.options.length; i++) {
+                       optionsHash[selectObj.options[i].value] = i;
+               }
                return optionsHash;
        },
 
        removeSelectOption: function(selectObj, value) {
                var optionsHash = this.getOptionsHash(selectObj);
-               if (optionsHash[value] != undefined) selectObj.options[optionsHash[value]] = null;
+               if (optionsHash[value] != undefined) {
+                       selectObj.options[optionsHash[value]] = null;
+               }
        },
 
        readdSelectOption: function(selectObj, value, unique) {
@@ -972,12 +1042,19 @@ var inline = {
                var possibleValues = $H(unique.possible).keys();
 
                for (var possibleValue in unique.possible) {
-                       if (possibleValue == value) break;
-                       if (optionsHash[possibleValue] != undefined) index = optionsHash[possibleValue];
+                       if (possibleValue == value) {
+                               break;
+                       }
+                       if (optionsHash[possibleValue] != undefined) {
+                               index = optionsHash[possibleValue];
+                       }
                }
 
-               if (index == null) index = 0;
-               else if (index < selectObj.options.length) index++;
+               if (index == null) {
+                       index = 0;
+               } else if (index < selectObj.options.length) {
+                       index++;
+               }
                        // recreate the <option> tag
                var readdOption = document.createElement('option');
                readdOption.text = unique.possible[value];
@@ -1006,7 +1083,9 @@ var inline = {
        fadeOutFadeIn: function(objectId) {
                var optIn = { duration:0.5, transition:Effect.Transitions.linear, from:0.50, to:1.00 };
                var optOut = { duration:0.5, transition:Effect.Transitions.linear, from:1.00, to:0.50 };
-               optOut.afterFinish = function() { new Effect.Opacity(objectId, optIn); };
+               optOut.afterFinish = function() {
+                       new Effect.Opacity(objectId, optIn);
+               };
                new Effect.Opacity(objectId, optOut);
        },
 
@@ -1063,4 +1142,4 @@ Object.extend(Array.prototype, {
        }
 });
 
-/*]]>*/
+/*]]>*/
\ No newline at end of file
index ec974fb..da9ad7b 100644 (file)
@@ -192,7 +192,9 @@ class SC_t3lib_thumbs {
 
                                // ... so we passed the extension test meaning that we are going to make a thumbnail here:
                                // default
-                       if (!$this->size) $this->size = $this->sizeDefault;
+                       if (!$this->size) {
+                               $this->size = $this->sizeDefault;
+                       }
 
                                // I added extra check, so that the size input option could not be fooled to pass other values.
                                // That means the value is exploded, evaluated to an integer and the imploded to [value]x[value].
@@ -242,7 +244,9 @@ class SC_t3lib_thumbs {
                                } else {
                                        $this->errorGif('Read problem!', '', $this->output);
                                }
-                       } else exit;
+                       } else {
+                               exit;
+                       }
                } else {
                        $this->errorGif('No valid', 'inputfile!', basename($this->image));
                }
index a2501fe..860688c 100644 (file)
@@ -125,9 +125,15 @@ class clickMenu {
                $this->iParts[3] = t3lib_div::_GP('enDisItems');
 
                        // Setting flags:
-               if ($this->iParts[2])   $this->listFrame=1;
-               if ($GLOBALS['BE_USER']->uc['condensedMode'] || $this->iParts[2]==2) $this->alwaysContentFrame=1;
-               if (strcmp($this->iParts[1], ''))       $this->isDBmenu=1;
+               if ($this->iParts[2]) {
+                       $this->listFrame = 1;
+               }
+               if ($GLOBALS['BE_USER']->uc['condensedMode'] || $this->iParts[2] == 2) {
+                       $this->alwaysContentFrame = 1;
+               }
+               if (strcmp($this->iParts[1], '')) {
+                       $this->isDBmenu = 1;
+               }
 
                $TSkey = ($this->isDBmenu? 'page' : 'folder' ) . ($this->listFrame ? 'List' : 'Tree');
                $this->disabledItems = t3lib_div::trimExplode(',', $GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.'.$TSkey.'.disableItems'), 1);
@@ -210,17 +216,21 @@ class clickMenu {
 
                                // View
                        if (!in_array('view', $this->disabledItems)) {
-                               if ($table == 'pages')  $menuItems['view'] = $this->DB_view($uid);
+                               if ($table == 'pages') {
+                                       $menuItems['view'] = $this->DB_view($uid);
+                               }
                                if ($table == $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']) {
                                        $ws_rec = t3lib_BEfunc::getRecordWSOL($table, $this->rec['uid']);
-                                       $menuItems['view']=$this->DB_view($ws_rec['pid']);
+                                       $menuItems['view'] = $this->DB_view($ws_rec['pid']);
                                }
                        }
 
                                // Edit:
-                       if(!$root && ($GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') || $GLOBALS['BE_USER']->isPSet($lCP, $table, 'editcontent'))) {
-                               if (!in_array('edit', $this->disabledItems))            $menuItems['edit']=$this->DB_edit($table, $uid);
-                               $this->editOK=1;
+                       if (!$root && ($GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') || $GLOBALS['BE_USER']->isPSet($lCP, $table, 'editcontent'))) {
+                               if (!in_array('edit', $this->disabledItems)) {
+                                       $menuItems['edit']=$this->DB_edit($table, $uid);
+                               }
+                               $this->editOK =1 ;
                        }
 
                                // New:
@@ -229,20 +239,26 @@ class clickMenu {
                        }
 
                                // Info:
-                       if(!in_array('info', $this->disabledItems) && !$root)   $menuItems['info']=$this->DB_info($table, $uid);
+                       if (!in_array('info', $this->disabledItems) && !$root) {
+                               $menuItems['info'] = $this->DB_info($table, $uid);
+                       }
 
-                       $menuItems['spacer1']='spacer';
+                       $menuItems['spacer1'] = 'spacer';
 
                                // Copy:
-                       if (!in_array('copy', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay)    $menuItems['copy'] = $this->DB_copycut($table, $uid, 'copy');
+                       if (!in_array('copy', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay) {
+                               $menuItems['copy'] = $this->DB_copycut($table, $uid, 'copy');
+                       }
                                // Cut:
-                       if (!in_array('cut', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay)     $menuItems['cut'] = $this->DB_copycut($table, $uid, 'cut');
+                       if (!in_array('cut', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay) {
+                               $menuItems['cut'] = $this->DB_copycut($table, $uid, 'cut');
+                       }
 
                                // Paste:
                        $elFromAllTables = count($this->clipObj->elFromTable(''));
                        if (!in_array('paste', $this->disabledItems) && $elFromAllTables) {
                                $selItem = $this->clipObj->getSelectedRecord();
-                               $elInfo=array(
+                               $elInfo = array(
                                        t3lib_div::fixed_lgd_cs($selItem['_RECORD_TITLE'],
                                                $GLOBALS['BE_USER']->uc['titleLen']),
                                                ($root
@@ -252,22 +268,26 @@ class clickMenu {
                                                $this->clipObj->currentMode()
                                        );
                                if ($table == 'pages' && ($lCP & 8)) {
-                                       if ($elFromAllTables)   $menuItems['pasteinto']=$this->DB_paste('', $uid, 'into', $elInfo);
+                                       if ($elFromAllTables) {
+                                               $menuItems['pasteinto'] = $this->DB_paste('', $uid, 'into', $elInfo);
+                                       }
                                }
 
                                $elFromTable = count($this->clipObj->elFromTable($table));
-                               if (!$root && !$DBmount && $elFromTable && $GLOBALS['TCA'][$table]['ctrl']['sortby'])   $menuItems['pasteafter']=$this->DB_paste($table, -$uid, 'after', $elInfo);
+                               if (!$root && !$DBmount && $elFromTable && $GLOBALS['TCA'][$table]['ctrl']['sortby']) {
+                                       $menuItems['pasteafter'] = $this->DB_paste($table, -$uid, 'after', $elInfo);
+                               }
                        }
 
                                // Delete:
                        $elInfo=array(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $this->rec), $GLOBALS['BE_USER']->uc['titleLen']));
                        if (!in_array('delete', $this->disabledItems) && !$root && !$DBmount && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'delete')) {
-                               $menuItems['spacer2']='spacer';
-                               $menuItems['delete']=$this->DB_delete($table, $uid, $elInfo);
+                               $menuItems['spacer2'] = 'spacer';
+                               $menuItems['delete'] = $this->DB_delete($table, $uid, $elInfo);
                        }
 
                        if (!in_array('history', $this->disabledItems)) {
-                               $menuItems['history']=$this->DB_history($table, $uid, $elInfo);
+                               $menuItems['history'] = $this->DB_history($table, $uid, $elInfo);
                        }
                }
 
@@ -303,7 +323,7 @@ class clickMenu {
                $menuItems = array();
                $root = 0;
                        // Rootlevel
-               if ($table == 'pages' && !strcmp($uid, '0'))    {
+               if ($table == 'pages' && !strcmp($uid, '0')) {
                        $root = 1;
                }
 
@@ -315,14 +335,16 @@ class clickMenu {
                        );
                                // Edit:
                        if (!$root && ($GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') || $GLOBALS['BE_USER']->isPSet($lCP, $table, 'editcontent'))) {
-                               $this->editOK=1;
+                               $this->editOK = 1;
                        }
 
                        $menuItems = $this->processingByExtClassArray($menuItems, $table, $uid);
                }
 
                        // Return the printed elements:
-               if (!is_array($menuItems))      $menuItems = array();
+               if (!is_array($menuItems)) {
+                       $menuItems = array();
+               }
                return $this->printItems($menuItems,
                        $root?
                        t3lib_iconWorks::getSpriteIcon('apps-pagetree-root') . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']):
@@ -1205,7 +1227,9 @@ class clickMenu {
                        // Clipboard must not be submitted - then it's probably a copy/cut situation.
                if ($this->isCMlayers()) {
                        $frameName = '.'.($this->listFrame ? 'list_frame' : 'nav_frame');
-                       if ($this->alwaysContentFrame)  $frameName='';
+                       if ($this->alwaysContentFrame) {
+                               $frameName = '';
+                       }
 
                                // Create the table displayed in the clickmenu layer:
                        $CMtable = '
@@ -1261,8 +1285,12 @@ class clickMenu {
                                // IF the topbar is the ONLY means of the click menu, then items normally disabled from
                                // the top menu will appear anyways IF they are disabled with a "1" (2+ will still disallow
                                // them in the topbar)
-                       if ($i[4]==1 && !$GLOBALS['SOBE']->doc->isCMlayers())   $i[4] = 0;
-                       if (is_array($i) && !$i[4])     $out[]=$i[0];
+                       if ($i[4] == 1 && !$GLOBALS['SOBE']->doc->isCMlayers()) {
+                               $i[4] = 0;
+                       }
+                       if (is_array($i) && !$i[4]) {
+                               $out[] = $i[0];
+                       }
                }
                return $out;
        }
@@ -1287,7 +1315,9 @@ class clickMenu {
                                $onClick = preg_replace('/return[[:space:]]+hideCM\(\)[[:space:]]*;/i', '', $onClick);
                                $onClick = preg_replace('/return[[:space:]]+false[[:space:]]*;/i', '', $onClick);
                                $onClick = preg_replace('/hideCM\(\);/i', '', $onClick);
-                               if (!$i[5])     $onClick.='Clickmenu.hideAll();';
+                               if (!$i[5]) {
+                                       $onClick.='Clickmenu.hideAll();';
+                               }
 
                                $CSM = ' oncontextmenu="'.htmlspecialchars($onClick).';return false;"';
 
@@ -1337,10 +1367,14 @@ class clickMenu {
                                                                                        $found = TRUE;
                                                                                        break;
                                                                                }
-                                                                               if (!next($menuItems)) break;
+                                                                               if (!next($menuItems)) {
+                                                                                       break;
+                                                                               }
                                                                                $p++;
                                                                        }
-                                                                       if (!$found) break;
+                                                                       if (!$found) {
+                                                                               break;
+                                                                       }
 
                                                                        if ($place == 'before') {
                                                                                $pointer--;
@@ -1364,7 +1398,9 @@ class clickMenu {
                                                        break;
                                                }
                                        }
-                                       if ($found) break;
+                                       if ($found) {
+                                               break;
+                                       }
                                }
                        }
                        $pointer = max(0, $pointer);
@@ -1391,7 +1427,6 @@ class clickMenu {
                        $onClick = str_replace('top.loadTopMenu', 'showClickmenu_raw', $onClick);
                }
 
-
                return array(
                        t3lib_iconWorks::getSpriteIcon('empty-empty', array(
                                'class' => 'c-roimg',
@@ -1486,7 +1521,6 @@ class clickMenu {
                        unset($menuItems[$key]);
                }
 
-
                        // Remove last:
                end($menuItems);
                $key = key($menuItems);
@@ -1592,7 +1626,9 @@ class SC_alt_clickmenu {
                        // Traversing that array and setting files for inclusion:
                if (is_array($this->extClassArray)) {
                        foreach ($this->extClassArray as $extClassConf) {
-                               if ($extClassConf['path'])      $this->include_once[]=$extClassConf['path'];
+                               if ($extClassConf['path']) {
+                                       $this->include_once[]=$extClassConf['path'];
+                               }
                        }
                }
 
@@ -1718,7 +1754,9 @@ $SOBE = t3lib_div::makeInstance('SC_alt_clickmenu');
 $SOBE->init();
 
        // Include files?
-foreach ($SOBE->include_once as $INC_FILE)     include_once($INC_FILE);
+foreach ($SOBE->include_once as $INC_FILE) {
+       include_once($INC_FILE);
+}
 
 $SOBE->main();
 $SOBE->printContent();
index 8a62770..1d40fde 100644 (file)
@@ -699,7 +699,9 @@ class SC_alt_doc {
                                                                                $hasAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($table, $calcPRec);
                                                                                $deniedAccessReason = $GLOBALS['BE_USER']->errorMsg;
                                                                        }
-                                                               } else $hasAccess = 0;
+                                                               } else {
+                                                                       $hasAccess = 0;
+                                                               }
                                                        }
 
                                                        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_doc.php']['makeEditForm_accessCheck'])) {
@@ -1308,9 +1310,18 @@ class SC_alt_doc {
                                                $versionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $table, $reqRecord['uid'], 'uid,pid,t3ver_oid');
                                                return is_array($versionRec) ? $versionRec : $reqRecord;
                                        }
-                               } else return FALSE;            // This means that editing cannot occur on this record because it was not supporting versioning which is required inside an offline workspace.
-                       } else return $reqRecord;       // In ONLINE workspace, just return the originally requested record:
-               } else return FALSE;    // Return FALSE because the table/uid was not found anyway.
+                               } else {
+                                               // This means that editing cannot occur on this record because it was not supporting versioning which is required inside an offline workspace.
+                                       return FALSE;
+                               }
+                       } else {
+                                       // In ONLINE workspace, just return the originally requested record:
+                               return $reqRecord;
+                       }
+               } else {
+                               // Return FALSE because the table/uid was not found anyway.
+                       return FALSE;
+               }
        }
 
        /**
@@ -1424,7 +1435,9 @@ class SC_alt_doc {
         * @return void
         */
        function setDocument($currentDocFromHandlerMD5 = '', $retUrl = 'alt_doc_nodoc.php') {
-               if (!t3lib_extMgm::isLoaded('cms') && !strcmp($retUrl, 'alt_doc_nodoc.php')) return;
+               if (!t3lib_extMgm::isLoaded('cms') && !strcmp($retUrl, 'alt_doc_nodoc.php')) {
+                       return;
+               }
 
                if (!$this->modTSconfig['properties']['disableDocSelector'] && is_array($this->docHandler) && count($this->docHandler)) {
                        if (isset($this->docHandler[$currentDocFromHandlerMD5])) {