[TASK] Fix CGL violations against InlineControlStructure
authorWouter Wolters <typo3@wouterwolters.nl>
Sun, 1 Jul 2012 15:10:18 +0000 (17:10 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Sun, 1 Jul 2012 17:41:48 +0000 (19:41 +0200)
Fix CGL violations against InlineControlStructure

Change-Id: I1ba792a9d25fbae8e0e32502ab2f20911297cf63
Resolves: #38520
Releases: 6.0
Reviewed-on: http://review.typo3.org/12501
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
typo3/sysext/version/class.tx_version_tcemain.php
typo3/sysext/version/cm1/index.php

index ea5b6bc..12e024f 100644 (file)
@@ -236,8 +236,12 @@ class tx_version_tcemain {
                                                                // it from workspace (because it clears both version and placeholder).
                                                        $this->version_clearWSID($table, $id, FALSE, $tcemainObj);
                                                }
-                                       } else $tcemainObj->newlog('Tried to delete record from another workspace', 1);
-                               } else $tcemainObj->newlog('Versioning not enabled for record with PID = -1!', 2);
+                                       } else {
+                                               $tcemainObj->newlog('Tried to delete record from another workspace', 1);
+                                       }
+                               } else {
+                                       $tcemainObj->newlog('Versioning not enabled for record with PID = -1!', 2);
+                               }
                        } elseif ($res = $tcemainObj->BE_USER->workspaceAllowLiveRecordsInPID($record['pid'], $table)) {
                                        // Look, if record is "online" or in a versionized branch, then delete directly.
                                if ($res>0) {
@@ -671,8 +675,12 @@ class tx_version_tcemain {
                                                $this->notifyStageChange($stat, $stageId, $table, $id, $comment, $tcemainObj, $notificationAlternativeRecipients);
                                        }
                                }
-                       } else $tcemainObj->newlog('The member user tried to set a stage value "' . $stageId . '" that was not allowed', 1);
-               } else $tcemainObj->newlog('Attempt to set stage for record failed because you do not have edit access', 1);
+                       } else {
+                               $tcemainObj->newlog('The member user tried to set a stage value "' . $stageId . '" that was not allowed', 1);
+                       }
+               } else {
+                       $tcemainObj->newlog('Attempt to set stage for record failed because you do not have edit access', 1);
+               }
        }
 
 
@@ -737,9 +745,15 @@ class tx_version_tcemain {
                                                        }
                                                }
                                        }       // else the page was not copied. Too bad...
-                               } else $tcemainObj->newlog('The root version could not be created!', 1);
-                       } else $tcemainObj->newlog('Versioning type "' . $versionizeTree . '" was not allowed in workspace', 1);
-               } else $tcemainObj->newlog('Could not read all subpages to versionize.', 1);
+                               } else {
+                                       $tcemainObj->newlog('The root version could not be created!', 1);
+                               }
+                       } else {
+                               $tcemainObj->newlog('Versioning type "' . $versionizeTree . '" was not allowed in workspace', 1);
+                       }
+               } else {
+                       $tcemainObj->newlog('Could not read all subpages to versionize.', 1);
+               }
        }
 
 
@@ -996,15 +1010,33 @@ class tx_version_tcemain {
                                                                                                        // For delete + completely delete!
                                                                                                $tcemainObj->deleteEl($table, $swapWith, TRUE, TRUE);
                                                                                        }
-                                                                               } else $tcemainObj->newlog('During Swapping: SQL errors happened: ' . implode('; ', $sqlErrors), 2);
-                                                                       } else $tcemainObj->newlog('A swapping lock file was present. Either another swap process is already running or a previous swap process failed. Ask your administrator to handle the situation.', 2);
-                                                               } else $tcemainObj->newlog('In swap version, either pid was not -1 or the t3ver_oid didn\'t match the id of the online version as it must!', 2);
-                                                       } else $tcemainObj->newlog('Workspace #' . $swapVersion['t3ver_wsid'] . ' does not support swapping.', 1);
-                                               } else $tcemainObj->newlog('You cannot publish a record you do not have edit and show permissions for', 1);
-                                       } else $tcemainObj->newlog('Records in workspace #' . $swapVersion['t3ver_wsid'] . ' can only be published when in "Publish" stage.', 1);
-                               } else $tcemainObj->newlog('User could not publish records from workspace #' . $swapVersion['t3ver_wsid'], 1);
-                       } else $tcemainObj->newlog('Error: Either online or swap version could not be selected!', 2);
-               } else $tcemainObj->newlog('Error: You cannot swap versions for a record you do not have access to edit!', 1);
+                                                                               } else {
+                                                                                       $tcemainObj->newlog('During Swapping: SQL errors happened: ' . implode('; ', $sqlErrors), 2);
+                                                                               }
+                                                                       } else {
+                                                                               $tcemainObj->newlog('A swapping lock file was present. Either another swap process is already running or a previous swap process failed. Ask your administrator to handle the situation.', 2);
+                                                                       }
+                                                               } else {
+                                                                       $tcemainObj->newlog('In swap version, either pid was not -1 or the t3ver_oid didn\'t match the id of the online version as it must!', 2);
+                                                               }
+                                                       } else {
+                                                               $tcemainObj->newlog('Workspace #' . $swapVersion['t3ver_wsid'] . ' does not support swapping.', 1);
+                                                       }
+                                               } else {
+                                                       $tcemainObj->newlog('You cannot publish a record you do not have edit and show permissions for', 1);
+                                               }
+                                       } else {
+                                               $tcemainObj->newlog('Records in workspace #' . $swapVersion['t3ver_wsid'] . ' can only be published when in "Publish" stage.', 1);
+                                       }
+                               } else {
+                                       $tcemainObj->newlog('User could not publish records from workspace #' . $swapVersion['t3ver_wsid'], 1);
+                               }
+                       } else {
+                               $tcemainObj->newlog('Error: Either online or swap version could not be selected!', 2);
+                       }
+               } else {
+                       $tcemainObj->newlog('Error: You cannot swap versions for a record you do not have access to edit!', 1);
+               }
        }
 
 
@@ -1130,7 +1162,9 @@ class tx_version_tcemain {
                                        }
                                }
                        }
-               } else $tcemainObj->newlog('Attempt to reset workspace for record failed because you do not have edit access', 1);
+               } else {
+                       $tcemainObj->newlog('Attempt to reset workspace for record failed because you do not have edit access', 1);
+               }
        }
 
 
index 6f091e8..7bff439 100755 (executable)
@@ -375,7 +375,9 @@ class tx_version_cm1 extends t3lib_SCbase {
                                        } else {
                                                $content .= $GLOBALS['LANG']->getLL('recordsMatchesCompletely');
                                        }
-                               } else $content .= $GLOBALS['LANG']->getLL('errorRecordsNotFound');
+                               } else {
+                                       $content .= $GLOBALS['LANG']->getLL('errorRecordsNotFound');
+                               }
                        } else {
                                $content .= $GLOBALS['LANG']->getLL('errorDiffSources');
                        }
@@ -755,7 +757,9 @@ class tx_version_cm1 extends t3lib_SCbase {
                        $tableRows = array_merge($tableRows, $this->displayWorkspaceOverview_list($pArray));
 
                        $table = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding workspace-overview">' . implode('', $tableRows) . '</table>';
-               } else $table = '';
+               } else {
+                       $table = '';
+               }
 
                $returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
                $linkBack = t3lib_div::_GP('returnUrl') ? '<a href="' . htmlspecialchars($returnUrl) . '" class="typo3-goBack">' .
@@ -846,7 +850,9 @@ class tx_version_cm1 extends t3lib_SCbase {
                                                                $diffCode.= ($diffPct<0 ? $GLOBALS['LANG']->getLL('notAvailable') : ($diffPct ? $diffPct . '% ' . $GLOBALS['LANG']->getLL('change') : ''));
                                                                $diffCode.= $diffHTML;
                                                        }
-                                               } else $diffCode = '';
+                                               } else {
+                                                       $diffCode = '';
+                                               }
 
                                                switch ($vType) {
                                                        case 'element':
@@ -967,7 +973,9 @@ class tx_version_cm1 extends t3lib_SCbase {
                        if ($rec_off = t3lib_BEfunc::getRecordWSOL($table, $uid)) {
                                $uid = $rec_off['_ORIG_uid'];
                        }
-               } else $table = '';
+               } else {
+                       $table = '';
+               }
 
                if ($table) {
                        if ($uid && $this->recIndex[$table][$uid]) {
@@ -980,9 +988,12 @@ class tx_version_cm1 extends t3lib_SCbase {
                                                $label = $GLOBALS['LANG']->getLL('commentForPublisher');
                                        break;
                                }
-                       } else $sId = 0;
+                       } else {
+                               $sId = 0;
+                       }
                } else {
-                       if (count($this->stageIndex[1]))        {       // Review:
+                               // Review:
+                       if (count($this->stageIndex[1])) {
                                $sId = 1;
                                $color = '#666666';
                                $label = $GLOBALS['LANG']->getLL('sendItemsToReview') . $GLOBALS['LANG']->getLL('commentForReviewer');
@@ -1029,7 +1040,9 @@ class tx_version_cm1 extends t3lib_SCbase {
                        $onClick = 'window.location.href = "'.$this->REQUEST_URI.'";';
                        $actionLinks.=
                                $this->doc->wrapScriptTags($onClick);
-               } else $actionLinks = '';
+               } else {
+                       $actionLinks = '';
+               }
 
                return $actionLinks;
        }
@@ -1521,7 +1534,9 @@ class tx_version_cm1 extends t3lib_SCbase {
                        } else {
                                $content.= '<span class="nobr">'.$this->doc->icons(1) . $GLOBALS['LANG']->getLL('completeMatch') . '</span>';
                        }
-               } else $content.= $this->doc->icons(3) . $GLOBALS['LANG']->getLL('errorRecordsNotFound');
+               } else {
+                       $content.= $this->doc->icons(3) . $GLOBALS['LANG']->getLL('errorRecordsNotFound');
+               }
 
                        // Return value:
                return array($content, $pctChange);