Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_frontendedit
authorSteffen Kamper <info@sk-typo3.de>
Wed, 24 Nov 2010 10:57:52 +0000 (10:57 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Wed, 24 Nov 2010 10:57:52 +0000 (10:57 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9543 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_frontendedit.php

index da18b2f..e26d758 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-11-24  Steffen Kamper  <steffen@typo3.org>
 
 2010-11-24  Steffen Kamper  <steffen@typo3.org>
 
+       * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_frontendedit
        * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_formmail
        * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_foldertree
        * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_flexformtools
        * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_formmail
        * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_foldertree
        * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_flexformtools
index f02bd4b..f24eda2 100644 (file)
@@ -1,30 +1,30 @@
 <?php
 /***************************************************************
 <?php
 /***************************************************************
-*  Copyright notice
-*
-*  (c) 2008-2010 Jeff Segars <jeff@webempoweredchurch.org>
-*  (c) 2008-2010 David Slayback <dave@webempoweredchurch.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!
-***************************************************************/
+ *  Copyright notice
+ *
+ *  (c) 2008-2010 Jeff Segars <jeff@webempoweredchurch.org>
+ *  (c) 2008-2010 David Slayback <dave@webempoweredchurch.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!
+ ***************************************************************/
 /**
  * Controller class for frontend editing.
  *
 /**
  * Controller class for frontend editing.
  *
@@ -94,13 +94,13 @@ class t3lib_frontendedit {
                        // Page ID for new records, 0 if not specified
                $newRecordPid = intval($conf['newRecordInPid']);
                if (!$conf['onlyCurrentPid'] || $dataArray['pid'] == $GLOBALS['TSFE']->id) {
                        // Page ID for new records, 0 if not specified
                $newRecordPid = intval($conf['newRecordInPid']);
                if (!$conf['onlyCurrentPid'] || $dataArray['pid'] == $GLOBALS['TSFE']->id) {
-                       if ($table=='pages') {
+                       if ($table == 'pages') {
                                $newUid = $uid;
                        } else {
                                if ($conf['newRecordFromTable']) {
                                        $newUid = $GLOBALS['TSFE']->id;
                                        if ($newRecordPid) {
                                $newUid = $uid;
                        } else {
                                if ($conf['newRecordFromTable']) {
                                        $newUid = $GLOBALS['TSFE']->id;
                                        if ($newRecordPid) {
-                                                $newUid = $newRecordPid;
+                                               $newUid = $newRecordPid;
                                        }
                                } else {
                                        $newUid = -1 * $uid;
                                        }
                                } else {
                                        $newUid = -1 * $uid;
@@ -111,7 +111,7 @@ class t3lib_frontendedit {
                if ($GLOBALS['TSFE']->displayEditIcons && $table && $this->allowedToEdit($table, $dataArray, $conf, $checkEditAccessInternals) && $this->allowedToEditLanguage($table, $dataArray)) {
                        $editClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']['edit'];
                        if ($editClass) {
                if ($GLOBALS['TSFE']->displayEditIcons && $table && $this->allowedToEdit($table, $dataArray, $conf, $checkEditAccessInternals) && $this->allowedToEditLanguage($table, $dataArray)) {
                        $editClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']['edit'];
                        if ($editClass) {
-                               $edit = t3lib_div::getUserObj($editClass, false);
+                               $edit = t3lib_div::getUserObj($editClass, FALSE);
                                if (is_object($edit)) {
                                        $allowedActions = $this->getAllowedEditActions($table, $conf, $dataArray['pid']);
                                        $content = $edit->editPanel($content, $conf, $currentRecord, $dataArray, $table, $allowedActions, $newUid, $this->getHiddenFields($dataArray));
                                if (is_object($edit)) {
                                        $allowedActions = $this->getAllowedEditActions($table, $conf, $dataArray['pid']);
                                        $content = $edit->editPanel($content, $conf, $currentRecord, $dataArray, $table, $allowedActions, $newUid, $this->getHiddenFields($dataArray));
@@ -135,14 +135,14 @@ class t3lib_frontendedit {
         * @return      string          The input content string, possibly with edit icons added (not necessarily in the end but just after the last string of normal content.
         */
 
         * @return      string          The input content string, possibly with edit icons added (not necessarily in the end but just after the last string of normal content.
         */
 
-       public function displayEditIcons($content, $params, array $conf=array(), $currentRecord = '', array $dataArray = array(), $addUrlParamStr = '') {
+       public function displayEditIcons($content, $params, array $conf = array(), $currentRecord = '', array $dataArray = array(), $addUrlParamStr = '') {
                        // Check incoming params:
                list($currentRecordTable, $currentRecordUID) = explode(':', $currentRecord);
                list($fieldList, $table) = array_reverse(t3lib_div::trimExplode(':', $params, 1)); // Reverse the array because table is optional
                if (!$table) {
                        $table = $currentRecordTable;
                } elseif ($table != $currentRecordTable) {
                        // Check incoming params:
                list($currentRecordTable, $currentRecordUID) = explode(':', $currentRecord);
                list($fieldList, $table) = array_reverse(t3lib_div::trimExplode(':', $params, 1)); // Reverse the array because table is optional
                if (!$table) {
                        $table = $currentRecordTable;
                } elseif ($table != $currentRecordTable) {
-                               return $content;        // If the table is set as the first parameter, and does not match the table of the current record, then just return.
+                       return $content; // If the table is set as the first parameter, and does not match the table of the current record, then just return.
                }
 
                $editUid = $dataArray['_LOCALIZED_UID'] ? $dataArray['_LOCALIZED_UID'] : $currentRecordUID;
                }
 
                $editUid = $dataArray['_LOCALIZED_UID'] ? $dataArray['_LOCALIZED_UID'] : $currentRecordUID;
@@ -185,11 +185,11 @@ class t3lib_frontendedit {
                                $cmd = (string) $this->TSFE_EDIT['cmd'];
                                if (($cmd != 'edit' || (is_array($this->TSFE_EDIT['data']) && ($this->TSFE_EDIT['doSave'] || $this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']))) && $cmd != 'new') {
                                                // $cmd can be a command like "hide" or "move". If $cmd is "edit" or "new" it's an indication to show the formfields. But if data is sent with update-flag then $cmd = edit is accepted because edit may be sent because of .keepGoing flag.
                                $cmd = (string) $this->TSFE_EDIT['cmd'];
                                if (($cmd != 'edit' || (is_array($this->TSFE_EDIT['data']) && ($this->TSFE_EDIT['doSave'] || $this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']))) && $cmd != 'new') {
                                                // $cmd can be a command like "hide" or "move". If $cmd is "edit" or "new" it's an indication to show the formfields. But if data is sent with update-flag then $cmd = edit is accepted because edit may be sent because of .keepGoing flag.
-                                       return true;
+                                       return TRUE;
                                }
                        }
                }
                                }
                        }
                }
-               return false;
+               return FALSE;
        }
 
        /**
        }
 
        /**
@@ -203,7 +203,7 @@ class t3lib_frontendedit {
                if (is_array($this->TSFE_EDIT)) {
                        $cmd = (string) $this->TSFE_EDIT['cmd'];
                        if ($cmd == 'edit' || $cmd == 'new') {
                if (is_array($this->TSFE_EDIT)) {
                        $cmd = (string) $this->TSFE_EDIT['cmd'];
                        if ($cmd == 'edit' || $cmd == 'new') {
-                               return true;
+                               return TRUE;
                        }
                }
        }
                        }
                }
        }
@@ -330,22 +330,22 @@ class t3lib_frontendedit {
         * @param       integer         The UID of record to move after. This is specified for dragging only.
         * @return      void
         */
         * @param       integer         The UID of record to move after. This is specified for dragging only.
         * @return      void
         */
-       protected function move($table, $uid, $direction='', $afterUID=0) {
+       protected function move($table, $uid, $direction = '', $afterUID = 0) {
                $cmdData = array();
                $sortField = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
                if ($sortField) {
                                // Get self:
                $cmdData = array();
                $sortField = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
                if ($sortField) {
                                // Get self:
-                       $fields = array_unique(t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields'] . ',uid,pid,' . $sortField, true));
+                       $fields = array_unique(t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields'] . ',uid,pid,' . $sortField, TRUE));
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',', $fields), $table, 'uid=' . $uid);
                        if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                                        // record before or after
                                if (($GLOBALS['BE_USER']->adminPanel instanceOf tslib_AdminPanel) && ($GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview'))) {
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',', $fields), $table, 'uid=' . $uid);
                        if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                                        // record before or after
                                if (($GLOBALS['BE_USER']->adminPanel instanceOf tslib_AdminPanel) && ($GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview'))) {
-                                       $ignore = array('starttime'=>1, 'endtime'=>1, 'disabled'=>1, 'fe_group'=>1);
+                                       $ignore = array('starttime' => 1, 'endtime' => 1, 'disabled' => 1, 'fe_group' => 1);
                                }
                                $copyAfterFieldsQuery = '';
                                if ($GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields']) {
                                }
                                $copyAfterFieldsQuery = '';
                                if ($GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields']) {
-                                       $cAFields = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields'], true);
-                                       foreach($cAFields as $fieldName) {
+                                       $cAFields = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields'], TRUE);
+                                       foreach ($cAFields as $fieldName) {
                                                $copyAfterFieldsQuery .= ' AND ' . $fieldName . '="' . $row[$fieldName] . '"';
                                        }
                                }
                                                $copyAfterFieldsQuery .= ' AND ' . $fieldName . '="' . $row[$fieldName] . '"';
                                        }
                                }
@@ -360,16 +360,16 @@ class t3lib_frontendedit {
                                        $sortCheck = ' AND ' . $sortField . $operator . intval($row[$sortField]);
                                }
                                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                        $sortCheck = ' AND ' . $sortField . $operator . intval($row[$sortField]);
                                }
                                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                                                       'uid,pid',
-                                                       $table,
-                                                       'pid=' . intval($row['pid']) .
+                                       'uid,pid',
+                                       $table,
+                                               'pid=' . intval($row['pid']) .
                                                                $sortCheck .
                                                                $copyAfterFieldsQuery .
                                                                $GLOBALS['TSFE']->sys_page->enableFields($table, '', $ignore),
                                                                $sortCheck .
                                                                $copyAfterFieldsQuery .
                                                                $GLOBALS['TSFE']->sys_page->enableFields($table, '', $ignore),
-                                                       '',
-                                                       $sortField . ' ' . $order,
-                                                       '2'
-                                               );
+                                       '',
+                                               $sortField . ' ' . $order,
+                                       '2'
+                               );
                                if ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                                        if ($afterUID) {
                                                $cmdData[$table][$uid]['move'] = -$afterUID;
                                if ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                                        if ($afterUID) {
                                                $cmdData[$table][$uid]['move'] = -$afterUID;
@@ -377,10 +377,10 @@ class t3lib_frontendedit {
                                        elseif ($direction == 'down') {
                                                $cmdData[$table][$uid]['move'] = -$row2['uid'];
                                        }
                                        elseif ($direction == 'down') {
                                                $cmdData[$table][$uid]['move'] = -$row2['uid'];
                                        }
-                                       elseif ($row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {  // Must take the second record above...
+                                       elseif ($row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // Must take the second record above...
                                                $cmdData[$table][$uid]['move'] = -$row3['uid'];
                                        }
                                                $cmdData[$table][$uid]['move'] = -$row3['uid'];
                                        }
-                                       else {  // ... and if that does not exist, use pid
+                                       else { // ... and if that does not exist, use pid
                                                $cmdData[$table][$uid]['move'] = $row['pid'];
                                        }
                                } elseif ($direction == 'up') {
                                                $cmdData[$table][$uid]['move'] = $row['pid'];
                                        }
                                } elseif ($direction == 'up') {
@@ -486,9 +486,9 @@ class t3lib_frontendedit {
                }
 
                if ($GLOBALS['BE_USER']->checkLanguageAccess($lang)) {
                }
 
                if ($GLOBALS['BE_USER']->checkLanguageAccess($lang)) {
-                       $languageAccess = true;
+                       $languageAccess = TRUE;
                } else {
                } else {
-                       $languageAccess = false;
+                       $languageAccess = FALSE;
                }
 
                return $languageAccess;
                }
 
                return $languageAccess;
@@ -501,7 +501,7 @@ class t3lib_frontendedit {
         * @param       array   The data array.
         * @param       array   The configuration array for the edit panel.
         * @param       boolean Boolean indicating whether recordEditAccessInternals should not be checked. Defaults
         * @param       array   The data array.
         * @param       array   The configuration array for the edit panel.
         * @param       boolean Boolean indicating whether recordEditAccessInternals should not be checked. Defaults
-        *                                      to true but doesn't makes sense when creating new records on a page.
+        *                                       to true but doesn't makes sense when creating new records on a page.
         * @return      boolean
         */
        protected function allowedToEdit($table, array $dataArray, array $conf, $checkEditAccessInternals = TRUE) {
         * @return      boolean
         */
        protected function allowedToEdit($table, array $dataArray, array $conf, $checkEditAccessInternals = TRUE) {
@@ -514,23 +514,23 @@ class t3lib_frontendedit {
                } else {
                        $editAccessInternals = TRUE;
                }
                } else {
                        $editAccessInternals = TRUE;
                }
-               
+
                if ($editAccessInternals) {
                if ($editAccessInternals) {
-                       if ($table=='pages') {
+                       if ($table == 'pages') {
                                        // 2 = permission to edit the page
                                if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess($dataArray, 2)) {
                                        // 2 = permission to edit the page
                                if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess($dataArray, 2)) {
-                                       $mayEdit = true;
+                                       $mayEdit = TRUE;
                                }
                        } else {
                                        // 16 = permission to edit content on the page
                                if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess(t3lib_BEfunc::getRecord('pages', $dataArray['pid']), 16)) {
                                }
                        } else {
                                        // 16 = permission to edit content on the page
                                if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess(t3lib_BEfunc::getRecord('pages', $dataArray['pid']), 16)) {
-                                       $mayEdit = true;
+                                       $mayEdit = TRUE;
                                }
                        }
 
                        if (!$conf['onlyCurrentPid'] || ($dataArray['pid'] == $GLOBALS['TSFE']->id)) {
                                        // Permissions:
                                }
                        }
 
                        if (!$conf['onlyCurrentPid'] || ($dataArray['pid'] == $GLOBALS['TSFE']->id)) {
                                        // Permissions:
-                               $types = t3lib_div::trimExplode(',', t3lib_div::strtolower($conf['allow']),1);
+                               $types = t3lib_div::trimExplode(',', t3lib_div::strtolower($conf['allow']), 1);
                                $allow = array_flip($types);
 
                                $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
                                $allow = array_flip($types);
 
                                $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
@@ -539,7 +539,7 @@ class t3lib_frontendedit {
 
                                                // Can only display editbox if there are options in the menu
                                        if (count($allow)) {
 
                                                // Can only display editbox if there are options in the menu
                                        if (count($allow)) {
-                                               $mayEdit = true;
+                                               $mayEdit = TRUE;
                                        }
                                } else {
                                        $mayEdit = count($allow) && ($perms & 16);
                                        }
                                } else {
                                        $mayEdit = count($allow) && ($perms & 16);
@@ -562,24 +562,24 @@ class t3lib_frontendedit {
        protected function getAllowedEditActions($table, array $conf, $pid, $allow = '') {
 
                if (!$allow) {
        protected function getAllowedEditActions($table, array $conf, $pid, $allow = '') {
 
                if (!$allow) {
-                       $types = t3lib_div::trimExplode(',', t3lib_div::strtolower($conf['allow']), true);
+                       $types = t3lib_div::trimExplode(',', t3lib_div::strtolower($conf['allow']), TRUE);
                        $allow = array_flip($types);
                }
 
                if (!$conf['onlyCurrentPid'] || $pid == $GLOBALS['TSFE']->id) {
                                // Permissions:
                        $allow = array_flip($types);
                }
 
                if (!$conf['onlyCurrentPid'] || $pid == $GLOBALS['TSFE']->id) {
                                // Permissions:
-                       $types = t3lib_div::trimExplode(',', t3lib_div::strtolower($conf['allow']), true);
+                       $types = t3lib_div::trimExplode(',', t3lib_div::strtolower($conf['allow']), TRUE);
                        $allow = array_flip($types);
 
                        $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
                        $allow = array_flip($types);
 
                        $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
-                       if ($table=='pages') {
+                       if ($table == 'pages') {
                                        // rootpage!
                                if (count($GLOBALS['TSFE']->config['rootLine']) == 1) {
                                        unset($allow['move']);
                                        unset($allow['hide']);
                                        unset($allow['delete']);
                                }
                                        // rootpage!
                                if (count($GLOBALS['TSFE']->config['rootLine']) == 1) {
                                        unset($allow['move']);
                                        unset($allow['hide']);
                                        unset($allow['delete']);
                                }
-                               if (!($perms & 2)){
+                               if (!($perms & 2)) {
                                        unset($allow['edit']);
                                        unset($allow['move']);
                                        unset($allow['hide']);
                                        unset($allow['edit']);
                                        unset($allow['move']);
                                        unset($allow['hide']);
@@ -587,7 +587,7 @@ class t3lib_frontendedit {
                                if (!($perms & 4)) {
                                        unset($allow['delete']);
                                }
                                if (!($perms & 4)) {
                                        unset($allow['delete']);
                                }
-                               if (!($perms&8)) {
+                               if (!($perms & 8)) {
                                        unset($allow['new']);
                                }
                        }
                                        unset($allow['new']);
                                }
                        }
@@ -627,7 +627,7 @@ class t3lib_frontendedit {
        protected function initializeTceMain() {
                if (!isset($this->tce)) {
                        $this->tce = t3lib_div::makeInstance('t3lib_TCEmain');
        protected function initializeTceMain() {
                if (!isset($this->tce)) {
                        $this->tce = t3lib_div::makeInstance('t3lib_TCEmain');
-                       $this->tce->stripslashes_values=0;
+                       $this->tce->stripslashes_values = 0;
                }
        }
 }
                }
        }
 }