From 64daaef450b87f53c64ef434ab2403e9d34899a8 Mon Sep 17 00:00:00 2001 From: Wouter Wolters <typo3@wouterwolters.nl> Date: Fri, 22 Jun 2012 21:17:50 +0200 Subject: [PATCH] [TASK] Clean up phpDoc comments in typo3/sysext/ Clean up provides: * Provide correct parameter names in phpDoc * Provide correct data types in phpDoc * CGLify phpDoc (remove tabs) Change-Id: I413cc9c71997b8ba7f557c2f80bd013e284bd521 Resolves: #38319 Releases: 6.0 Reviewed-on: http://review.typo3.org/12301 Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn --- typo3/sysext/setup/ext_tables.php | 4 +- typo3/sysext/setup/mod/index.php | 128 ++++++++---------- .../class.tx_statictemplates.php | 9 +- .../sysext/statictemplates/ext_localconf.php | 4 +- typo3/sysext/statictemplates/ext_tables.php | 8 +- typo3/sysext/statictemplates/tca.php | 5 +- typo3/sysext/sv/class.tx_sv_auth.php | 82 ++++++----- typo3/sysext/sv/class.tx_sv_authbase.php | 90 ++++++------ typo3/sysext/sv/class.tx_sv_loginformhook.php | 26 ++-- typo3/sysext/sv/ext_autoload.php | 4 +- typo3/sysext/sv/ext_localconf.php | 4 +- typo3/sysext/sv/ext_tables.php | 4 +- .../class.tx_sv_reports_serviceslist.php | 24 ++-- 13 files changed, 189 insertions(+), 203 deletions(-) diff --git a/typo3/sysext/setup/ext_tables.php b/typo3/sysext/setup/ext_tables.php index 5d8cfa09bc4e..c07b45025e2d 100755 --- a/typo3/sysext/setup/ext_tables.php +++ b/typo3/sysext/setup/ext_tables.php @@ -1,5 +1,7 @@ <?php -if (!defined ('TYPO3_MODE')) die ('Access denied.'); +if (!defined('TYPO3_MODE')) { + die('Access denied.'); +} if (TYPO3_MODE == 'BE') { t3lib_extMgm::addModule('user', 'setup', 'after:task', t3lib_extMgm::extPath($_EXTKEY) . 'mod/'); diff --git a/typo3/sysext/setup/mod/index.php b/typo3/sysext/setup/mod/index.php index 908c47781897..8c45cc07c649 100755 --- a/typo3/sysext/setup/mod/index.php +++ b/typo3/sysext/setup/mod/index.php @@ -29,7 +29,7 @@ * * This module lets users viev and change their individual settings * - * @author Kasper Skårhøj <kasperYYYY@typo3.com> + * @author Kasper Skårhøj <kasperYYYY@typo3.com> * Revised for TYPO3 3.7 6/2004 by Kasper Skårhøj * XHTML compatible. */ @@ -37,7 +37,7 @@ /** * Script class for the Setup module * - * @author Kasper Skårhøj <kasperYYYY@typo3.com> + * @author Kasper Skårhøj <kasperYYYY@typo3.com> * @package TYPO3 * @subpackage tx_setup */ @@ -92,7 +92,6 @@ class SC_mod_user_setup_index { * ******************************/ - /** * Instanciate the form protection before a simulated user is initialized. */ @@ -133,12 +132,12 @@ class SC_mod_user_setup_index { // PUT SETTINGS into the ->uc array: - // reload left frame when switching BE language + // Reload left frame when switching BE language if (isset($d['lang']) && ($d['lang'] != $GLOBALS['BE_USER']->uc['lang'])) { $this->languageUpdate = TRUE; } - // reload pagetree if the title length is changed + // Reload pagetree if the title length is changed if (isset($d['titleLen']) && ($d['titleLen'] !== $GLOBALS['BE_USER']->uc['titleLen'])) { $this->pagetreeNeedsRefresh = TRUE; } @@ -155,9 +154,9 @@ class SC_mod_user_setup_index { } $this->tempDataIsCleared = TRUE; } elseif ($d['save']) { - // save all submitted values if they are no array (arrays are with table=be_users) and exists in $GLOBALS['TYPO3_USER_SETTINGS'][columns] + // Save all submitted values if they are no array (arrays are with table=be_users) and exists in $GLOBALS['TYPO3_USER_SETTINGS'][columns] - foreach($columns as $field => $config) { + foreach ($columns as $field => $config) { if (!in_array($field, $fieldList)) { continue; } @@ -212,7 +211,8 @@ class SC_mod_user_setup_index { $GLOBALS['BE_USER']->overrideUC(); $save_after = md5(serialize($GLOBALS['BE_USER']->uc)); - if ($save_before!=$save_after) { // If something in the uc-array of the user has changed, we save the array... + // If something in the uc-array of the user has changed, we save the array... + if ($save_before!=$save_after) { $GLOBALS['BE_USER']->writeUC($GLOBALS['BE_USER']->uc); $GLOBALS['BE_USER']->writelog(254, 1, 0, 1, 'Personal settings changed', array()); $this->setupIsUpdated = TRUE; @@ -226,10 +226,12 @@ class SC_mod_user_setup_index { if (count($storeRec) && $this->saveData) { // Make instance of TCE for storing the changes. $tce = t3lib_div::makeInstance('t3lib_TCEmain'); - $tce->stripslashes_values=0; + $tce->stripslashes_values = 0; $tce->start($storeRec, array(), $GLOBALS['BE_USER']); - $tce->admin = 1; // This is so the user can actually update his user record. - $tce->bypassWorkspaceRestrictions = TRUE; // This is to make sure that the users record can be updated even if in another workspace. This is tolerated. + // This is so the user can actually update his user record. + $tce->admin = 1; + // This is to make sure that the users record can be updated even if in another workspace. This is tolerated. + $tce->bypassWorkspaceRestrictions = TRUE; $tce->process_datamap(); unset($tce); @@ -240,7 +242,6 @@ class SC_mod_user_setup_index { } } - /****************************** * * Rendering module @@ -250,7 +251,7 @@ class SC_mod_user_setup_index { /** * Initializes the module for display of the settings form. * - * @return void + * @return void */ function init() { $this->MCONF = $GLOBALS['MCONF']; @@ -306,7 +307,7 @@ class SC_mod_user_setup_index { /** * Generate the main settings formular: * - * @return void + * @return void */ function main() { global $LANG; @@ -328,7 +329,7 @@ class SC_mod_user_setup_index { // Start page: $this->doc->loadJavascriptLib('md5.js'); - // use a wrapper div + // Use a wrapper div $this->content .= '<div id="user-setup-wrapper">'; // Load available backend modules @@ -338,7 +339,7 @@ class SC_mod_user_setup_index { $this->content .= $this->doc->header($LANG->getLL('UserSettings')); - // show if setup was saved + // Show if setup was saved if ($this->setupIsUpdated && !$this->tempDataIsCleared && !$this->settingsAreResetToDefault) { $flashMessage = t3lib_div::makeInstance( 't3lib_FlashMessage', @@ -397,7 +398,7 @@ class SC_mod_user_setup_index { } - // render the menu items + // Render the menu items $menuItems = $this->renderUserSetup(); $this->content .= $this->doc->getDynTabMenu($menuItems, 'user-setup', FALSE, FALSE, 1, FALSE, 1, $this->dividers2tabs); @@ -423,7 +424,7 @@ class SC_mod_user_setup_index { TRUE ); - // end of wrapper div + // End of wrapper div $this->content .= '</div>'; // Setting up the buttons and markers for docheader @@ -439,13 +440,12 @@ class SC_mod_user_setup_index { $LANG->getLL('UserSettings'), $this->content ); - } /** * Prints the content / ends page * - * @return void + * @return void */ function printContent() { echo $this->content; @@ -454,7 +454,7 @@ class SC_mod_user_setup_index { /** * Create the panel of buttons for submitting the form or otherwise perform operations. * - * @return array all available buttons as an assoc. array + * @return array All available buttons as an assoc. array */ protected function getButtons() { $buttons = array( @@ -477,21 +477,17 @@ class SC_mod_user_setup_index { return $buttons; } - - - /****************************** * * Render module * ******************************/ - /** * renders the data for all tabs in the user setup and returns * everything that is needed with tabs and dyntab menu * - * @return ready to use for the dyntabmenu itemarray + * @return array Ready to use for the dyntabmenu itemarray */ protected function renderUserSetup() { $result = array(); @@ -509,7 +505,7 @@ class SC_mod_user_setup_index { if (substr($fieldName, 0, 8) == '--div--;') { if ($firstTabLabel == '') { - // first tab + // First tab $tabLabel = $this->getLabel(substr($fieldName, 8), '', FALSE); $firstTabLabel = $tabLabel; } else { @@ -528,7 +524,7 @@ class SC_mod_user_setup_index { $config = $GLOBALS['TYPO3_USER_SETTINGS']['columns'][$fieldName]; - // field my be disabled in setup.fields + // Field my be disabled in setup.fields if (isset($this->tsFieldConf[$fieldName . '.']['disabled']) && $this->tsFieldConf[$fieldName . '.']['disabled'] == 1) { continue; } @@ -615,12 +611,8 @@ class SC_mod_user_setup_index { $html = ''; } - $code[$i][1] = $label; $code[$i++][2] = $html; - - - } if ($this->dividers2tabs == 0) { @@ -632,15 +624,9 @@ class SC_mod_user_setup_index { 'content' => count($code) ? $this->doc->spacer(20) . $this->doc->table($code) : '' ); - return $result; } - - - - - /****************************** * * Helper functions @@ -651,29 +637,28 @@ class SC_mod_user_setup_index { * Returns the backend user object, either the global OR the $this->OLD_BE_USER which is set during simulate-user operation. * Anyway: The REAL user is returned - the one logged in. * - * @return object The REAL user is returned - the one logged in. + * @return object The REAL user is returned - the one logged in. */ protected function getRealScriptUserObj() { return is_object($this->OLD_BE_USER) ? $this->OLD_BE_USER : $GLOBALS['BE_USER']; } - /** * Return a select with available languages * - * @return string complete select as HTML string or warning box if something went wrong. + * @return string Complete select as HTML string or warning box if something went wrong. */ public function renderLanguageSelect($params, $pObj) { $languageOptions = array(); - // compile the languages dropdown + // Compile the languages dropdown $langDefault = $GLOBALS['LANG']->getLL('lang_default', 1); $languageOptions[$langDefault] = '<option value=""' . ($GLOBALS['BE_USER']->uc['lang'] === '' ? ' selected="selected"' : '') . '>' . $langDefault . '</option>'; - // traverse the number of languages + // Traverse the number of languages /** @var $locales t3lib_l10n_Locales */ $locales = t3lib_div::makeInstance('t3lib_l10n_Locales'); $languages = $locales->getLanguages(); @@ -724,10 +709,10 @@ class SC_mod_user_setup_index { /** * Returns a select with all modules for startup * - * @return string complete select as HTML string + * @return string Complete select as HTML string */ public function renderStartModuleSelect($params, $pObj) { - // start module select + // Start module select if (empty($GLOBALS['BE_USER']->uc['startModule'])) { $GLOBALS['BE_USER']->uc['startModule'] = $GLOBALS['BE_USER']->uc_default['startModule']; } @@ -750,13 +735,11 @@ class SC_mod_user_setup_index { * Will make the simulate-user selector if the logged in user is administrator. * It will also set the GLOBAL(!) BE_USER to the simulated user selected if any (and set $this->OLD_BE_USER to logged in user) * - * @return void + * @return void */ public function simulateUser() { - // ******************************************************************************* - // If admin, allow simulation of another user - // ******************************************************************************* + // If admin, allow simulation of another user $this->simUser = 0; $this->simulateSelector = ''; unset($this->OLD_BE_USER); @@ -776,24 +759,27 @@ class SC_mod_user_setup_index { } } - if ($this->simUser>0) { // This can only be set if the previous code was executed. + // This can only be set if the previous code was executed. + if ($this->simUser > 0) { // Save old user... $this->OLD_BE_USER = $GLOBALS['BE_USER']; unset($GLOBALS['BE_USER']); // Unset current - $BE_USER = t3lib_div::makeInstance('t3lib_beUserAuth'); // New backend user object + // New backend user object + $BE_USER = t3lib_div::makeInstance('t3lib_beUserAuth'); $BE_USER->OS = TYPO3_OS; $BE_USER->setBeUserByUid($this->simUser); $BE_USER->fetchGroupData(); $BE_USER->backendSetUC(); - $GLOBALS['BE_USER'] = $BE_USER; // Must do this, because unsetting $BE_USER before apparently unsets the reference to the global variable by this name! + // Must do this, because unsetting $BE_USER before apparently unsets the reference to the global variable by this name! + $GLOBALS['BE_USER'] = $BE_USER; } } /** * Returns a select with simulate users * - * @return string complete select as HTML string + * @return string Complete select as HTML string */ public function renderSimulateUserSelect($params, $pObj) { return $pObj->simulateSelector; @@ -802,16 +788,16 @@ class SC_mod_user_setup_index { /** * Returns access check (currently only "admin" is supported) * - * @param array $config: Configuration of the field, access mode is defined in key 'access' - * @return boolean Whether it is allowed to modify the given field + * @param array $config Configuration of the field, access mode is defined in key 'access' + * @return boolean Whether it is allowed to modify the given field */ protected function checkAccess(array $config) { $access = $config['access']; - // check for hook + // Check for hook if (t3lib_div::hasValidClassPrefix($access)) { $accessObject = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['setup']['accessLevelCheck'][$access] . ':&' . $access); if (is_object($accessObject) && method_exists($accessObject, 'accessLevelCheck')) { - // initialize vars. If method fails, $set will be set to FALSE + // Initialize vars. If method fails, $set will be set to FALSE return $accessObject->accessLevelCheck($config); } } elseif ($access == 'admin') { @@ -823,20 +809,19 @@ class SC_mod_user_setup_index { /** * Returns the label $str from getLL() and grays out the value if the $str/$key is found in $this->overrideConf array * - * @param string Locallang key - * @param string Alternative override-config key - * @param boolean Defines whether the string should be wrapped in a <label> tag. - * @param string Alternative id for use in "for" attribute of <label> tag. By default the $str key is used prepended with "field_". - * @return string HTML output. + * @param string $str Locallang key + * @param string $key Alternative override-config key + * @param boolean $addLabelTag Defines whether the string should be wrapped in a <label> tag. + * @param string $altLabelTagId Alternative id for use in "for" attribute of <label> tag. By default the $str key is used prepended with "field_". + * @return string HTML output. */ - protected function getLabel($str, $key='', $addLabelTag=TRUE, $altLabelTagId='') { + protected function getLabel($str, $key = '', $addLabelTag = TRUE, $altLabelTagId = '') { if (substr($str, 0, 4) == 'LLL:') { $out = $GLOBALS['LANG']->sL($str); } else { $out = htmlspecialchars($str); } - if (isset($this->overrideConf[($key?$key:$str)])) { $out = '<span style="color:#999999">' . $out . '</span>'; } @@ -850,9 +835,9 @@ class SC_mod_user_setup_index { /** * Returns the CSH Icon for given string * - * @param string Locallang key - * @param string The label to be used, that should be wrapped in help - * @return string HTML output. + * @param string $str Locallang key + * @param string $label The label to be used, that should be wrapped in help + * @return string HTML output. */ protected function getCSH($str, $label) { $context = '_MOD_user_setup'; @@ -870,13 +855,12 @@ class SC_mod_user_setup_index { /** * Returns array with fields defined in $GLOBALS['TYPO3_USER_SETTINGS']['showitem'] * - * @param void - * @return array array with fieldnames visible in form + * @return array Array with fieldnames visible in form */ protected function getFieldsFromShowItem() { $fieldList = $GLOBALS['TYPO3_USER_SETTINGS']['showitem']; - // disable fields depended on settings + // Disable fields depended on settings if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) { $fieldList = t3lib_div::rmFromList('edit_RTE', $fieldList); } @@ -886,12 +870,12 @@ class SC_mod_user_setup_index { } } -// Make instance: + // Make instance: $SOBE = t3lib_div::makeInstance('SC_mod_user_setup_index'); $SOBE->simulateUser(); $SOBE->storeIncomingData(); -// These includes MUST be afterwards the settings are saved...! + // These includes MUST be afterwards the settings are saved...! $LANG->includeLLFile('EXT:setup/mod/locallang.xml'); $SOBE->init(); diff --git a/typo3/sysext/statictemplates/class.tx_statictemplates.php b/typo3/sysext/statictemplates/class.tx_statictemplates.php index 79790bb6e0ee..b7b098d1d726 100644 --- a/typo3/sysext/statictemplates/class.tx_statictemplates.php +++ b/typo3/sysext/statictemplates/class.tx_statictemplates.php @@ -28,15 +28,12 @@ class tx_statictemplates { - /** * Includes static template records from static_template table, loaded through a hook * - * @param string A list of already processed template ids including the current; The list is on the form "[prefix]_[uid]" where [prefix] is "sys" for "sys_template" records, "static" for "static_template" records and "ext_" for static include files (from extensions). The list is used to check that the recursive inclusion of templates does not go into circles: Simply it is used to NOT include a template record/file which has already BEEN included somewhere in the recursion. - * @param string The id of the current template. Same syntax as $idList ids, eg. "sys_123" - * @param array The PID of the input template record - * @param array A full TypoScript template record - * @return void + * @param array $params + * @param object $pObj + * @return void */ public function includeStaticTypoScriptSources(&$params, &$pObj) { // Static Template Records (static_template): include_static is a diff --git a/typo3/sysext/statictemplates/ext_localconf.php b/typo3/sysext/statictemplates/ext_localconf.php index cf6e9bf0eea8..1f7c9f900f41 100644 --- a/typo3/sysext/statictemplates/ext_localconf.php +++ b/typo3/sysext/statictemplates/ext_localconf.php @@ -1,6 +1,8 @@ <?php -if (!defined ('TYPO3_MODE')) die ('Access denied.'); +if (!defined('TYPO3_MODE')) { + die('Access denied.'); +} $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['includeStaticTypoScriptSources'][] = 'EXT:statictemplates/class.tx_statictemplates.php:tx_statictemplates->includeStaticTypoScriptSources'; diff --git a/typo3/sysext/statictemplates/ext_tables.php b/typo3/sysext/statictemplates/ext_tables.php index 0fe4a9b5847b..bd7aee85ea8a 100644 --- a/typo3/sysext/statictemplates/ext_tables.php +++ b/typo3/sysext/statictemplates/ext_tables.php @@ -1,10 +1,10 @@ <?php -if (!defined ("TYPO3_MODE")) die ("Access denied."); +if (!defined("TYPO3_MODE")) { + die("Access denied."); +} -// ****************************************************************** -// static_template -// ****************************************************************** + // static_template $TCA['static_template'] = array( 'ctrl' => array( 'label' => 'title', diff --git a/typo3/sysext/statictemplates/tca.php b/typo3/sysext/statictemplates/tca.php index 5173bf906741..4b0301acc1a4 100644 --- a/typo3/sysext/statictemplates/tca.php +++ b/typo3/sysext/statictemplates/tca.php @@ -1,8 +1,6 @@ <?php -// ****************************************************************** -// static_template -// ****************************************************************** + // static_template $TCA['static_template'] = array( 'ctrl' => $TCA['static_template']['ctrl'], 'interface' => array( @@ -63,5 +61,4 @@ $TCA['static_template'] = array( ) ); - ?> \ No newline at end of file diff --git a/typo3/sysext/sv/class.tx_sv_auth.php b/typo3/sysext/sv/class.tx_sv_auth.php index 5983828063d9..d1fea741299f 100644 --- a/typo3/sysext/sv/class.tx_sv_auth.php +++ b/typo3/sysext/sv/class.tx_sv_auth.php @@ -27,19 +27,17 @@ /** * Service 'User authentication' for the 'sv' extension. * - * @author René Fritz <r.fritz@colorcube.de> + * @author René Fritz <r.fritz@colorcube.de> */ - - /** * Authentication services class * - * @author René Fritz <r.fritz@colorcube.de> + * @author René Fritz <r.fritz@colorcube.de> * @package TYPO3 * @subpackage tx_sv */ -class tx_sv_auth extends tx_sv_authbase { +class tx_sv_auth extends tx_sv_authbase { /** * Process the submitted credentials. @@ -86,11 +84,11 @@ class tx_sv_auth extends tx_sv_authbase { /** * This method ensures backwards compatibility of the processed loginData * with older TYPO3 versions. - * Starting with TYPO3 4.9 $loginData['uident'] will always contain the raw + * Starting with TYPO3 6.1 $loginData['uident'] will always contain the raw * value of the submitted password field and will not be processed any further. * * @param array $loginData - * @deprecated will be removed with 4.9 + * @deprecated will be removed with 6.1 */ protected function processOriginalPasswordValue(&$loginData) { if ($this->authInfo['security_level'] === 'superchallenged') { @@ -103,7 +101,7 @@ class tx_sv_auth extends tx_sv_authbase { /** * Find a user (eg. look up the user record in database when a login is sent) * - * @return mixed user array or FALSE + * @return mixed User array or FALSE */ function getUser() { $user = FALSE; @@ -163,8 +161,8 @@ class tx_sv_auth extends tx_sv_authbase { /** * Authenticate a user (Check various conditions for the user that might invalidate its authentication, eg. password match, domain, IP, etc.) * - * @param array Data of user. - * @return boolean + * @param array $user Data of user. + * @return boolean */ public function authUser(array $user) { $OK = 100; @@ -174,7 +172,7 @@ class tx_sv_auth extends tx_sv_authbase { // Checking password match for user: $OK = $this->compareUident($user, $this->login); - if(!$OK) { + if (!$OK) { // Failed login attempt (wrong password) - write that to the log! if ($this->writeAttemptLog) { $this->writelog(255, 3, 3, 1, "Login-attempt from %s (%s), username '%s', password not accepted!", Array($this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname'])); @@ -184,7 +182,9 @@ class tx_sv_auth extends tx_sv_authbase { 0 ); } - if ($this->writeDevLog) t3lib_div::devLog('Password not accepted: '.$this->login['uident'], 'tx_sv_auth', 2); + if ($this->writeDevLog) { + t3lib_div::devLog('Password not accepted: '.$this->login['uident'], 'tx_sv_auth', 2); + } } // Checking the domain (lockToDomain) @@ -208,16 +208,16 @@ class tx_sv_auth extends tx_sv_authbase { /** * Find usergroup records, currently only for frontend * - * @param array Data of user. - * @param array Group data array of already known groups. This is handy if you want select other related groups. Keys in this array are unique IDs of those groups. - * @return mixed Groups array, keys = uid which must be unique + * @param array $user Data of user. + * @param array $knownGroups Group data array of already known groups. This is handy if you want select other related groups. Keys in this array are unique IDs of those groups. + * @return mixed Groups array, keys = uid which must be unique */ function getGroups($user, $knownGroups) { global $TYPO3_CONF_VARS; $groupDataArr = array(); - if($this->mode=='getGroupsFE') { + if($this->mode == 'getGroupsFE') { $groups = array(); if (is_array($user) && $user[$this->db_user['usergroup_column']]) { @@ -228,7 +228,7 @@ class tx_sv_auth extends tx_sv_authbase { // ADD group-numbers if the IPmask matches. if (is_array($TYPO3_CONF_VARS['FE']['IPmaskMountGroups'])) { - foreach($TYPO3_CONF_VARS['FE']['IPmaskMountGroups'] as $IPel) { + foreach ($TYPO3_CONF_VARS['FE']['IPmaskMountGroups'] as $IPel) { if ($this->authInfo['REMOTE_ADDR'] && $IPel[0] && t3lib_div::cmpIP($this->authInfo['REMOTE_ADDR'], $IPel[0])) {$groups[]=intval($IPel[1]);} } } @@ -238,20 +238,28 @@ class tx_sv_auth extends tx_sv_authbase { if (count($groups)) { $list = implode(',', $groups); - if ($this->writeDevLog) t3lib_div::devLog('Get usergroups with id: '.$list, 'tx_sv_auth'); + if ($this->writeDevLog) { + t3lib_div::devLog('Get usergroups with id: '.$list, 'tx_sv_auth'); + } $lockToDomain_SQL = ' AND (lockToDomain=\'\' OR lockToDomain IS NULL OR lockToDomain=\''.$this->authInfo['HTTP_HOST'].'\')'; - if (!$this->authInfo['showHiddenRecords']) $hiddenP = 'AND hidden=0 '; + if (!$this->authInfo['showHiddenRecords']) { + $hiddenP = 'AND hidden=0 '; + } $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->db_groups['table'], 'deleted=0 '.$hiddenP.' AND uid IN ('.$list.')'.$lockToDomain_SQL); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $groupDataArr[$row['uid']] = $row; } - if ($res) $GLOBALS['TYPO3_DB']->sql_free_result($res); + if ($res) { + $GLOBALS['TYPO3_DB']->sql_free_result($res); + } } else { - if ($this->writeDevLog) t3lib_div::devLog('No usergroups found.', 'tx_sv_auth', 2); + if ($this->writeDevLog) { + t3lib_div::devLog('No usergroups found.', 'tx_sv_auth', 2); + } } - } elseif ($this->mode=='getGroupsBE') { + } elseif ($this->mode == 'getGroupsBE') { // Get the BE groups here // still needs to be implemented in t3lib_userauthgroup @@ -264,42 +272,48 @@ class tx_sv_auth extends tx_sv_authbase { * Fetches subgroups of groups. Function is called recursively for each subgroup. * Function was previously copied from t3lib_userAuthGroup->fetchGroups and has been slightly modified. * - * @param string Commalist of fe_groups uid numbers - * @param string List of already processed fe_groups-uids so the function will not fall into a eternal recursion. - * @return array + * @param string $grList Commalist of fe_groups uid numbers + * @param string $idList List of already processed fe_groups-uids so the function will not fall into a eternal recursion. + * @param array $groups + * @return array * @access private */ - function getSubGroups($grList, $idList='', &$groups) { + function getSubGroups($grList, $idList = '', &$groups) { // Fetching records of the groups in $grList (which are not blocked by lockedToDomain either): $lockToDomain_SQL = ' AND (lockToDomain=\'\' OR lockToDomain IS NULL OR lockToDomain=\''.$this->authInfo['HTTP_HOST'].'\')'; if (!$this->authInfo['showHiddenRecords']) $hiddenP = 'AND hidden=0 '; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,subgroup', 'fe_groups', 'deleted=0 '.$hiddenP.' AND uid IN ('.$grList.')'.$lockToDomain_SQL); - - $groupRows = array(); // Internal group record storage + // Internal group record storage + $groupRows = array(); // The groups array is filled while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { - if(!in_array($row['uid'], $groups)) { $groups[] = $row['uid']; } + if(!in_array($row['uid'], $groups)) { + $groups[] = $row['uid']; + } $groupRows[$row['uid']] = $row; } // Traversing records in the correct order $include_staticArr = t3lib_div::intExplode(',', $grList); - foreach($include_staticArr as $uid) { // traversing list + // traversing list + foreach ($include_staticArr as $uid) { // Get row: - $row=$groupRows[$uid]; - if (is_array($row) && !t3lib_div::inList($idList, $uid)) { // Must be an array and $uid should not be in the idList, because then it is somewhere previously in the grouplist + $row = $groupRows[$uid]; + // Must be an array and $uid should not be in the idList, because then it is somewhere previously in the grouplist + if (is_array($row) && !t3lib_div::inList($idList, $uid)) { // Include sub groups if (trim($row['subgroup'])) { // Make integer list $theList = implode(',', t3lib_div::intExplode(',', $row['subgroup'])); - $this->getSubGroups($theList, $idList.','.$uid, $groups); // Call recursively, pass along list of already processed groups so they are not recursed again. + // Call recursively, pass along list of already processed groups so they are not recursed again. + $this->getSubGroups($theList, $idList.','.$uid, $groups); } } } } } -?> +?> \ No newline at end of file diff --git a/typo3/sysext/sv/class.tx_sv_authbase.php b/typo3/sysext/sv/class.tx_sv_authbase.php index 9cd0b98910aa..e594013a728a 100644 --- a/typo3/sysext/sv/class.tx_sv_authbase.php +++ b/typo3/sysext/sv/class.tx_sv_authbase.php @@ -27,16 +27,15 @@ /** * Service base class for 'User authentication'. * - * @author René Fritz <r.fritz@colorcube.de> + * @author René Fritz <r.fritz@colorcube.de> */ require_once(PATH_t3lib . 'class.t3lib_svbase.php'); - /** * Authentication services class * - * @author René Fritz <r.fritz@colorcube.de> + * @author René Fritz <r.fritz@colorcube.de> * @package TYPO3 * @subpackage tx_sv */ @@ -48,33 +47,35 @@ class tx_sv_authbase extends t3lib_svbase { * @var t3lib_userAuth */ var $pObj; - - var $mode; // Subtype of the service which is used to call the service. - - var $login = array(); // Submitted login form data - var $authInfo = array(); // Various data - - var $db_user = array(); // User db table definition - var $db_groups = array(); // Usergroups db table definition - - var $writeAttemptLog = FALSE; // If the writelog() functions is called if a login-attempt has be tried without success - var $writeDevLog = FALSE; // If the t3lib_div::devLog() function should be used - + // Subtype of the service which is used to call the service. + var $mode; + // Submitted login form data + var $login = array(); + // Various data + var $authInfo = array(); + // User db table definition + var $db_user = array(); + // Usergroups db table definition + var $db_groups = array(); + // If the writelog() functions is called if a login-attempt has be tried without success + var $writeAttemptLog = FALSE; + // If the t3lib_div::devLog() function should be used + var $writeDevLog = FALSE; /** * Initialize authentication service * - * @param string Subtype of the service which is used to call the service. - * @param array Submitted login form data - * @param array Information array. Holds submitted form data etc. - * @param object Parent object - * @return void + * @param string $mode Subtype of the service which is used to call the service. + * @param array $loginData Submitted login form data + * @param array $authInfo Information array. Holds submitted form data etc. + * @param object $pObj Parent object + * @return void */ function initAuth($mode, $loginData, $authInfo, $pObj) { $this->pObj = $pObj; - - $this->mode = $mode; // sub type + // Sub type + $this->mode = $mode; $this->login = $loginData; $this->authInfo = $authInfo; @@ -88,9 +89,9 @@ class tx_sv_authbase extends t3lib_svbase { /** * Check the login data with the user record data for builtin login methods * - * @param array $user user data array - * @param array $loginData login data array - * @param string $passwordCompareStrategy password compare strategy + * @param array $user User data array + * @param array $loginData Login data array + * @param string $passwordCompareStrategy Password compare strategy * @return boolean TRUE if login data matched */ function compareUident(array $user, array $loginData, $passwordCompareStrategy = '') { @@ -111,16 +112,16 @@ class tx_sv_authbase extends t3lib_svbase { /** * Writes to log database table in pObj * - * @param integer $type: denotes which module that has submitted the entry. This is the current list: 1=tce_db; 2=tce_file; 3=system (eg. sys_history save); 4=modules; 254=Personal settings changed; 255=login / out action: 1=login, 2=logout, 3=failed login (+ errorcode 3), 4=failure_warning_email sent - * @param integer $action: denotes which specific operation that wrote the entry (eg. 'delete', 'upload', 'update' and so on...). Specific for each $type. Also used to trigger update of the interface. (see the log-module for the meaning of each number !!) - * @param integer $error: flag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin) - * @param integer $details_nr: The message number. Specific for each $type and $action. in the future this will make it possible to translate errormessages to other languages - * @param string $details: Default text that follows the message - * @param array $data: Data that follows the log. Might be used to carry special information. If an array the first 5 entries (0-4) will be sprintf'ed the details-text... - * @param string $tablename: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) - * @param integer $recuid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) - * @param integer $recpid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) - * @return void + * @param integer $type denotes which module that has submitted the entry. This is the current list: 1=tce_db; 2=tce_file; 3=system (eg. sys_history save); 4=modules; 254=Personal settings changed; 255=login / out action: 1=login, 2=logout, 3=failed login (+ errorcode 3), 4=failure_warning_email sent + * @param integer $action denotes which specific operation that wrote the entry (eg. 'delete', 'upload', 'update' and so on...). Specific for each $type. Also used to trigger update of the interface. (see the log-module for the meaning of each number !!) + * @param integer $error flag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin) + * @param integer $details_nr The message number. Specific for each $type and $action. in the future this will make it possible to translate errormessages to other languages + * @param string $details Default text that follows the message + * @param array $data Data that follows the log. Might be used to carry special information. If an array the first 5 entries (0-4) will be sprintf'ed the details-text... + * @param string $tablename Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) + * @param integer $recuid Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) + * @param integer $recpid Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) + * @return void * @see t3lib_userauthgroup::writelog() */ function writelog($type, $action, $error, $details_nr, $details, $data, $tablename='', $recuid='', $recpid='') { @@ -129,15 +130,6 @@ class tx_sv_authbase extends t3lib_svbase { } } - - - - - - - - - /************************* * * create/update user - EXPERIMENTAL @@ -147,12 +139,12 @@ class tx_sv_authbase extends t3lib_svbase { /** * Get a user from DB by username * - * @param string user name - * @param string additional WHERE clause: " AND ... - * @param array User db table definition: $this->db_user - * @return mixed user array or FALSE + * @param string $username User name + * @param string $extraWhere Additional WHERE clause: " AND ... + * @param array $dbUserSetup User db table definition: $this->db_user + * @return mixed User array or FALSE */ - function fetchUserRecord($username, $extraWhere='', $dbUserSetup='') { + function fetchUserRecord($username, $extraWhere = '', $dbUserSetup = '') { $dbUser = is_array($dbUserSetup) ? $dbUserSetup : $this->db_user; $user = $this->pObj->fetchUserRecord($dbUser, $username, $extraWhere); diff --git a/typo3/sysext/sv/class.tx_sv_loginformhook.php b/typo3/sysext/sv/class.tx_sv_loginformhook.php index 5c9103eec869..cc0dbea91763 100644 --- a/typo3/sysext/sv/class.tx_sv_loginformhook.php +++ b/typo3/sysext/sv/class.tx_sv_loginformhook.php @@ -22,26 +22,25 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ - /** * This class contains a BE login form hook. It adds all necessary JavaScript * for the superchallenged authentication. * - * @author Dmitry Dulepov <dmitry@typo3.org> - * @package TYPO3 - * @subpackage tx_sv + * @author Dmitry Dulepov <dmitry@typo3.org> + * @package TYPO3 + * @subpackage tx_sv */ class tx_sv_loginformhook { /** * Provides form code for the superchallenged authentication. * - * @param array $params Parameters to the script - * @param SC_index $pObj Calling object - * @return string The code for the login form + * @param array $params Parameters to the script + * @param SC_index $pObj Calling object + * @return string The code for the login form */ public function getLoginFormTag(array $params, SC_index &$pObj) { - // Get the code according to the login level + // Get the code according to the login level switch ($pObj->loginSecurityLevel) { case 'challenged': case 'superchallenged': @@ -56,7 +55,7 @@ class tx_sv_loginformhook { $content = '<form action="index.php" method="post" name="loginform" onsubmit="document.loginform.userident.value=document.loginform.p_field.value;document.loginform.p_field.value=\'\';return true;">'; break; default: - // No code for unknown level! + // No code for unknown level! $content = ''; } @@ -66,9 +65,9 @@ class tx_sv_loginformhook { /** * Provides form code for the superchallenged authentication. * - * @param array $params Parameters to the script - * @param SC_index $pObj Calling object - * @return string The code for the login form + * @param array $params Parameters to the script + * @param SC_index $pObj Calling object + * @return string The code for the login form */ public function getLoginScripts(array $params, SC_index &$pObj) { $content = ''; @@ -96,11 +95,10 @@ class tx_sv_loginformhook { return $content; } - /** * Create a random challenge string * - * @return string Challenge value + * @return string Challenge value */ protected function getChallenge() { $challenge = md5(uniqid('') . getmypid()); diff --git a/typo3/sysext/sv/ext_autoload.php b/typo3/sysext/sv/ext_autoload.php index cb8a24c04fbd..24ad745edfc3 100644 --- a/typo3/sysext/sv/ext_autoload.php +++ b/typo3/sysext/sv/ext_autoload.php @@ -1,7 +1,5 @@ <?php -/* - * Register necessary class names with autoloader - */ + // Register necessary class names with autoloader $extensionPath = t3lib_extMgm::extPath('sv'); return array( 'tx_sv_reports_serviceslist' => $extensionPath . 'reports/class.tx_sv_reports_serviceslist.php', diff --git a/typo3/sysext/sv/ext_localconf.php b/typo3/sysext/sv/ext_localconf.php index 667b215cc909..4e9e2eb3dfde 100644 --- a/typo3/sysext/sv/ext_localconf.php +++ b/typo3/sysext/sv/ext_localconf.php @@ -1,5 +1,7 @@ <?php -if (!defined ('TYPO3_MODE')) die ('Access denied.'); +if (!defined('TYPO3_MODE')) { + die('Access denied.'); +} // Register base authentication service t3lib_extMgm::addService($_EXTKEY, 'auth' /* sv type */, 'tx_sv_auth' /* sv key */, diff --git a/typo3/sysext/sv/ext_tables.php b/typo3/sysext/sv/ext_tables.php index 46fe162a2213..925009314409 100644 --- a/typo3/sysext/sv/ext_tables.php +++ b/typo3/sysext/sv/ext_tables.php @@ -1,5 +1,7 @@ <?php -if (!defined ('TYPO3_MODE')) die ('Access denied.'); +if (!defined('TYPO3_MODE')) { + die('Access denied.'); +} if (TYPO3_MODE == 'BE') { $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['sv']['services'] = array( diff --git a/typo3/sysext/sv/reports/class.tx_sv_reports_serviceslist.php b/typo3/sysext/sv/reports/class.tx_sv_reports_serviceslist.php index 0565f4009062..119b48acb6ad 100644 --- a/typo3/sysext/sv/reports/class.tx_sv_reports_serviceslist.php +++ b/typo3/sysext/sv/reports/class.tx_sv_reports_serviceslist.php @@ -22,12 +22,11 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ - /** * This class provides a report displaying a list of all installed services * Code inspired by EXT:dam/lib/class.tx_dam_svlist.php by René Fritz * - * @author Francois Suter <francois@typo3.org> + * @author Francois Suter <francois@typo3.org> * @package TYPO3 * @subpackage sv */ @@ -36,7 +35,7 @@ class tx_sv_reports_ServicesList implements tx_reports_Report { /** * Back-reference to the calling reports module * - * @var tx_reports_Module $reportsModule + * @var tx_reports_Module */ protected $reportsModule; @@ -53,7 +52,7 @@ class tx_sv_reports_ServicesList implements tx_reports_Report { /** * This method renders the report * - * @return string The status report as HTML + * @return string The status report as HTML */ public function getReport() { $content = ''; @@ -75,7 +74,7 @@ class tx_sv_reports_ServicesList implements tx_reports_Report { /** * Renders the help comments at the top of the module. * - * @return string The help content for this module. + * @return string The help content for this module. */ protected function renderHelp() { $help = '<p class="help">' @@ -91,7 +90,7 @@ class tx_sv_reports_ServicesList implements tx_reports_Report { /** * This method assembles a list of all installed services * - * @return string HTML to display + * @return string HTML to display */ protected function renderServicesList() { $servicesList = ''; @@ -143,9 +142,9 @@ class tx_sv_reports_ServicesList implements tx_reports_Report { /** * Renders a single service's row. * - * @param string $serviceKey The service key to access the service. - * @param array $serviceInformation registration information of the service. - * @return string HTML row for the service. + * @param string $serviceKey The service key to access the service. + * @param array $serviceInformation registration information of the service. + * @return string HTML row for the service. */ protected function renderServiceRow($serviceKey, $serviceInformation) { $serviceDescription = ' @@ -177,8 +176,7 @@ class tx_sv_reports_ServicesList implements tx_reports_Report { $serviceAvailabilityClass = 'typo3-message message-ok'; $serviceAvailable = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes'); } - } - catch (t3lib_exception $e) { + } catch (t3lib_exception $e) { // Nothing to do, the default display is already not available } @@ -199,7 +197,7 @@ class tx_sv_reports_ServicesList implements tx_reports_Report { /** * This method assembles a list of all defined executables search paths * - * @return string HTML to display + * @return string HTML to display */ protected function renderExecutablesSearchPathList() { $searchPaths = t3lib_exec::getPaths(TRUE); @@ -253,7 +251,7 @@ class tx_sv_reports_ServicesList implements tx_reports_Report { * Furthermore, inside each service type, installed services must be * ordered by priority and quality * - * @return array List of filtered and ordered services + * @return array List of filtered and ordered services */ protected function getInstalledServices() { $filteredServices = array(); -- GitLab