当前位置: 首页>>代码示例>>PHP>>正文


PHP BackendUserAuthentication::checkAuthMode方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Authentication\BackendUserAuthentication::checkAuthMode方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUserAuthentication::checkAuthMode方法的具体用法?PHP BackendUserAuthentication::checkAuthMode怎么用?PHP BackendUserAuthentication::checkAuthMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Authentication\BackendUserAuthentication的用法示例。


在下文中一共展示了BackendUserAuthentication::checkAuthMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkValueForGroupSelect

 /**
  * Evaluates 'group' or 'select' type values.
  *
  * @param array $res The result array. The processed value (if any!) is set in the 'value' key.
  * @param string $value The value to set.
  * @param array $tcaFieldConf Field configuration from TCA
  * @param string $table Table name
  * @param int $id UID of record
  * @param mixed $curValue Current value of the field
  * @param string $status 'update' or 'new' flag
  * @param string $recFID Field identifier [table:uid:field] for flexforms
  * @param array $uploadedFiles
  * @param string $field Field name
  * @return array Modified $res array
  */
 protected function checkValueForGroupSelect($res, $value, $tcaFieldConf, $table, $id, $curValue, $status, $recFID, $uploadedFiles, $field)
 {
     // Detecting if value sent is an array and if so, implode it around a comma:
     if (is_array($value)) {
         $value = implode(',', $value);
     }
     // This converts all occurrences of '{' to the byte 123 in the string - this is needed in very rare cases where file names with special characters (e.g. ???, umlaut) gets sent to the server as HTML entities instead of bytes. The error is done only by MSIE, not Mozilla and Opera.
     // Anyway, this should NOT disturb anything else:
     $value = $this->convNumEntityToByteValue($value);
     // When values are sent as group or select they come as comma-separated values which are exploded by this function:
     $valueArray = $this->checkValue_group_select_explodeSelectGroupValue($value);
     // If multiple is not set, remove duplicates:
     if (!$tcaFieldConf['multiple']) {
         $valueArray = array_unique($valueArray);
     }
     // If an exclusive key is found, discard all others:
     if ($tcaFieldConf['type'] == 'select' && $tcaFieldConf['exclusiveKeys']) {
         $exclusiveKeys = GeneralUtility::trimExplode(',', $tcaFieldConf['exclusiveKeys']);
         foreach ($valueArray as $index => $key) {
             if (in_array($key, $exclusiveKeys, true)) {
                 $valueArray = array($index => $key);
                 break;
             }
         }
     }
     // This could be a good spot for parsing the array through a validation-function which checks if the values are correct (except that database references are not in their final form - but that is the point, isn't it?)
     // NOTE!!! Must check max-items of files before the later check because that check would just leave out file names if there are too many!!
     $valueArray = $this->applyFiltersToValues($tcaFieldConf, $valueArray);
     // Checking for select / authMode, removing elements from $valueArray if any of them is not allowed!
     if ($tcaFieldConf['type'] == 'select' && $tcaFieldConf['authMode']) {
         $preCount = count($valueArray);
         foreach ($valueArray as $index => $key) {
             if (!$this->BE_USER->checkAuthMode($table, $field, $key, $tcaFieldConf['authMode'])) {
                 unset($valueArray[$index]);
             }
         }
         // During the check it turns out that the value / all values were removed - we respond by simply returning an empty array so nothing is written to DB for this field.
         if ($preCount && empty($valueArray)) {
             return array();
         }
     }
     // For group types:
     if ($tcaFieldConf['type'] == 'group') {
         switch ($tcaFieldConf['internal_type']) {
             case 'file_reference':
             case 'file':
                 $valueArray = $this->checkValue_group_select_file($valueArray, $tcaFieldConf, $curValue, $uploadedFiles, $status, $table, $id, $recFID);
                 break;
             case 'db':
                 $valueArray = $this->checkValue_group_select_processDBdata($valueArray, $tcaFieldConf, $id, $status, 'group', $table, $field);
                 break;
         }
     }
     // For select types which has a foreign table attached:
     $unsetResult = false;
     if ($tcaFieldConf['type'] == 'select' && $tcaFieldConf['foreign_table']) {
         // check, if there is a NEW... id in the value, that should be substituted later
         if (strpos($value, 'NEW') !== false) {
             $this->remapStackRecords[$table][$id] = array('remapStackIndex' => count($this->remapStack));
             $this->addNewValuesToRemapStackChildIds($valueArray);
             $this->remapStack[] = array('func' => 'checkValue_group_select_processDBdata', 'args' => array($valueArray, $tcaFieldConf, $id, $status, 'select', $table, $field), 'pos' => array('valueArray' => 0, 'tcaFieldConf' => 1, 'id' => 2, 'table' => 5), 'field' => $field);
             $unsetResult = true;
         } else {
             $valueArray = $this->checkValue_group_select_processDBdata($valueArray, $tcaFieldConf, $id, $status, 'select', $table, $field);
         }
     }
     if (!$unsetResult) {
         $newVal = $this->checkValue_checkMax($tcaFieldConf, $valueArray);
         $res['value'] = $this->castReferenceValue(implode(',', $newVal), $tcaFieldConf);
     } else {
         unset($res['value']);
     }
     return $res;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:89,代码来源:DataHandler.php


注:本文中的TYPO3\CMS\Core\Authentication\BackendUserAuthentication::checkAuthMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。