Code Duplication    Length = 80-80 lines in 3 locations

typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php 1 location

@@ 387-466 (lines=80) @@
384
     * @param int $showLimit Limit of records to be listed.
385
     * @deprecated since TYPO3 v9, will be removed in TYPO3 v10
386
     */
387
    public function start($id, $table, $pointer, $search = '', $levels = 0, $showLimit = 0)
388
    {
389
        $backendUser = $this->getBackendUserAuthentication();
390
        // Setting internal variables:
391
        // sets the parent id
392
        $this->id = (int)$id;
393
        if ($GLOBALS['TCA'][$table]) {
394
            // Setting single table mode, if table exists:
395
            $this->table = $table;
396
        }
397
        $this->firstElementNumber = $pointer;
398
        $this->searchString = trim($search);
399
        $this->searchLevels = (int)$levels;
400
        $this->showLimit = MathUtility::forceIntegerInRange($showLimit, 0, 10000);
401
        // Setting GPvars:
402
        $this->csvOutput = (bool)GeneralUtility::_GP('csv');
403
        $this->sortField = GeneralUtility::_GP('sortField');
404
        $this->sortRev = GeneralUtility::_GP('sortRev');
405
        $this->displayFields = GeneralUtility::_GP('displayFields');
406
        $this->duplicateField = GeneralUtility::_GP('duplicateField');
407
        if (GeneralUtility::_GP('justLocalized')) {
408
            $this->localizationRedirect(GeneralUtility::_GP('justLocalized'));
409
        }
410
        // Init dynamic vars:
411
        $this->counter = 0;
412
        $this->JScode = '';
413
        $this->HTMLcode = '';
414
        // Limits
415
        if (isset($this->modTSconfig['properties']['itemsLimitPerTable'])) {
416
            $this->itemsLimitPerTable = MathUtility::forceIntegerInRange(
417
                (int)$this->modTSconfig['properties']['itemsLimitPerTable'],
418
                1,
419
                10000
420
            );
421
        }
422
        if (isset($this->modTSconfig['properties']['itemsLimitSingleTable'])) {
423
            $this->itemsLimitSingleTable = MathUtility::forceIntegerInRange(
424
                (int)$this->modTSconfig['properties']['itemsLimitSingleTable'],
425
                1,
426
                10000
427
            );
428
        }
429
430
        // $table might be NULL at this point in the code. As the expressionBuilder
431
        // is used to limit returned records based on the page permissions and the
432
        // uid field of the pages it can hardcoded to work on the pages table.
433
        $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
434
            ->getQueryBuilderForTable('pages')
435
            ->expr();
436
        $permsClause = $expressionBuilder->andX($backendUser->getPagePermsClause(1));
437
        // This will hide records from display - it has nothing to do with user rights!!
438
        if ($pidList = $backendUser->getTSConfigVal('options.hideRecords.pages')) {
439
            $pidList = GeneralUtility::intExplode(',', $pidList, true);
440
            if (!empty($pidList)) {
441
                $permsClause->add($expressionBuilder->notIn('pages.uid', $pidList));
442
            }
443
        }
444
        $this->perms_clause = (string)$permsClause;
445
446
        // Get configuration of collapsed tables from user uc and merge with sanitized GP vars
447
        $this->tablesCollapsed = is_array($backendUser->uc['moduleData']['list'])
448
            ? $backendUser->uc['moduleData']['list']
449
            : [];
450
        $collapseOverride = GeneralUtility::_GP('collapse');
451
        if (is_array($collapseOverride)) {
452
            foreach ($collapseOverride as $collapseTable => $collapseValue) {
453
                if (is_array($GLOBALS['TCA'][$collapseTable]) && ($collapseValue == 0 || $collapseValue == 1)) {
454
                    $this->tablesCollapsed[$collapseTable] = $collapseValue;
455
                }
456
            }
457
            // Save modified user uc
458
            $backendUser->uc['moduleData']['list'] = $this->tablesCollapsed;
459
            $backendUser->writeUC($backendUser->uc);
460
            $returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
461
            if ($returnUrl !== '') {
462
                HttpUtility::redirect($returnUrl);
463
            }
464
        }
465
        $this->initializeLanguages();
466
    }
467
468
    /**
469
     * Traverses the table(s) to be listed and renders the output code for each:

typo3/sysext/backend/Classes/View/PageLayoutView.php 1 location

@@ 2957-3036 (lines=80) @@
2954
     * @param int $levels Number of levels to search down the page tree
2955
     * @param int $showLimit Limit of records to be listed.
2956
     */
2957
    public function start($id, $table, $pointer, $search = '', $levels = 0, $showLimit = 0)
2958
    {
2959
        $backendUser = $this->getBackendUserAuthentication();
2960
        // Setting internal variables:
2961
        // sets the parent id
2962
        $this->id = (int)$id;
2963
        if ($GLOBALS['TCA'][$table]) {
2964
            // Setting single table mode, if table exists:
2965
            $this->table = $table;
2966
        }
2967
        $this->firstElementNumber = $pointer;
2968
        $this->searchString = trim($search);
2969
        $this->searchLevels = (int)$levels;
2970
        $this->showLimit = MathUtility::forceIntegerInRange($showLimit, 0, 10000);
2971
        // Setting GPvars:
2972
        $this->csvOutput = (bool)GeneralUtility::_GP('csv');
2973
        $this->sortField = GeneralUtility::_GP('sortField');
2974
        $this->sortRev = GeneralUtility::_GP('sortRev');
2975
        $this->displayFields = GeneralUtility::_GP('displayFields');
2976
        $this->duplicateField = GeneralUtility::_GP('duplicateField');
2977
        if (GeneralUtility::_GP('justLocalized')) {
2978
            $this->localizationRedirect(GeneralUtility::_GP('justLocalized'));
2979
        }
2980
        // Init dynamic vars:
2981
        $this->counter = 0;
2982
        $this->JScode = '';
2983
        $this->HTMLcode = '';
2984
        // Limits
2985
        if (isset($this->modTSconfig['properties']['itemsLimitPerTable'])) {
2986
            $this->itemsLimitPerTable = MathUtility::forceIntegerInRange(
2987
                (int)$this->modTSconfig['properties']['itemsLimitPerTable'],
2988
                1,
2989
                10000
2990
            );
2991
        }
2992
        if (isset($this->modTSconfig['properties']['itemsLimitSingleTable'])) {
2993
            $this->itemsLimitSingleTable = MathUtility::forceIntegerInRange(
2994
                (int)$this->modTSconfig['properties']['itemsLimitSingleTable'],
2995
                1,
2996
                10000
2997
            );
2998
        }
2999
3000
        // $table might be NULL at this point in the code. As the expressionBuilder
3001
        // is used to limit returned records based on the page permissions and the
3002
        // uid field of the pages it can hardcoded to work on the pages table.
3003
        $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
3004
            ->getQueryBuilderForTable('pages')
3005
            ->expr();
3006
        $permsClause = $expressionBuilder->andX($backendUser->getPagePermsClause(1));
3007
        // This will hide records from display - it has nothing to do with user rights!!
3008
        if ($pidList = $backendUser->getTSConfigVal('options.hideRecords.pages')) {
3009
            $pidList = GeneralUtility::intExplode(',', $pidList, true);
3010
            if (!empty($pidList)) {
3011
                $permsClause->add($expressionBuilder->notIn('pages.uid', $pidList));
3012
            }
3013
        }
3014
        $this->perms_clause = (string)$permsClause;
3015
3016
        // Get configuration of collapsed tables from user uc and merge with sanitized GP vars
3017
        $this->tablesCollapsed = is_array($backendUser->uc['moduleData']['list'])
3018
            ? $backendUser->uc['moduleData']['list']
3019
            : [];
3020
        $collapseOverride = GeneralUtility::_GP('collapse');
3021
        if (is_array($collapseOverride)) {
3022
            foreach ($collapseOverride as $collapseTable => $collapseValue) {
3023
                if (is_array($GLOBALS['TCA'][$collapseTable]) && ($collapseValue == 0 || $collapseValue == 1)) {
3024
                    $this->tablesCollapsed[$collapseTable] = $collapseValue;
3025
                }
3026
            }
3027
            // Save modified user uc
3028
            $backendUser->uc['moduleData']['list'] = $this->tablesCollapsed;
3029
            $backendUser->writeUC($backendUser->uc);
3030
            $returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
3031
            if ($returnUrl !== '') {
3032
                HttpUtility::redirect($returnUrl);
3033
            }
3034
        }
3035
        $this->initializeLanguages();
3036
    }
3037
3038
    /**
3039
     * Traverses the table(s) to be listed and renders the output code for each:

typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php 1 location

@@ 2817-2896 (lines=80) @@
2814
     * @param int $levels Number of levels to search down the page tree
2815
     * @param int $showLimit Limit of records to be listed.
2816
     */
2817
    public function start($id, $table, $pointer, $search = '', $levels = 0, $showLimit = 0)
2818
    {
2819
        $backendUser = $this->getBackendUserAuthentication();
2820
        // Setting internal variables:
2821
        // sets the parent id
2822
        $this->id = (int)$id;
2823
        if ($GLOBALS['TCA'][$table]) {
2824
            // Setting single table mode, if table exists:
2825
            $this->table = $table;
2826
        }
2827
        $this->firstElementNumber = $pointer;
2828
        $this->searchString = trim($search);
2829
        $this->searchLevels = (int)$levels;
2830
        $this->showLimit = MathUtility::forceIntegerInRange($showLimit, 0, 10000);
2831
        // Setting GPvars:
2832
        $this->csvOutput = (bool)GeneralUtility::_GP('csv');
2833
        $this->sortField = GeneralUtility::_GP('sortField');
2834
        $this->sortRev = GeneralUtility::_GP('sortRev');
2835
        $this->displayFields = GeneralUtility::_GP('displayFields');
2836
        $this->duplicateField = GeneralUtility::_GP('duplicateField');
2837
        if (GeneralUtility::_GP('justLocalized')) {
2838
            $this->localizationRedirect(GeneralUtility::_GP('justLocalized'));
2839
        }
2840
        // Init dynamic vars:
2841
        $this->counter = 0;
2842
        $this->JScode = '';
2843
        $this->HTMLcode = '';
2844
        // Limits
2845
        if (isset($this->modTSconfig['properties']['itemsLimitPerTable'])) {
2846
            $this->itemsLimitPerTable = MathUtility::forceIntegerInRange(
2847
                (int)$this->modTSconfig['properties']['itemsLimitPerTable'],
2848
                1,
2849
                10000
2850
            );
2851
        }
2852
        if (isset($this->modTSconfig['properties']['itemsLimitSingleTable'])) {
2853
            $this->itemsLimitSingleTable = MathUtility::forceIntegerInRange(
2854
                (int)$this->modTSconfig['properties']['itemsLimitSingleTable'],
2855
                1,
2856
                10000
2857
            );
2858
        }
2859
2860
        // $table might be NULL at this point in the code. As the expressionBuilder
2861
        // is used to limit returned records based on the page permissions and the
2862
        // uid field of the pages it can hardcoded to work on the pages table.
2863
        $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
2864
            ->getQueryBuilderForTable('pages')
2865
            ->expr();
2866
        $permsClause = $expressionBuilder->andX($backendUser->getPagePermsClause(1));
2867
        // This will hide records from display - it has nothing to do with user rights!!
2868
        if ($pidList = $backendUser->getTSConfigVal('options.hideRecords.pages')) {
2869
            $pidList = GeneralUtility::intExplode(',', $pidList, true);
2870
            if (!empty($pidList)) {
2871
                $permsClause->add($expressionBuilder->notIn('pages.uid', $pidList));
2872
            }
2873
        }
2874
        $this->perms_clause = (string)$permsClause;
2875
2876
        // Get configuration of collapsed tables from user uc and merge with sanitized GP vars
2877
        $this->tablesCollapsed = is_array($backendUser->uc['moduleData']['list'])
2878
            ? $backendUser->uc['moduleData']['list']
2879
            : [];
2880
        $collapseOverride = GeneralUtility::_GP('collapse');
2881
        if (is_array($collapseOverride)) {
2882
            foreach ($collapseOverride as $collapseTable => $collapseValue) {
2883
                if (is_array($GLOBALS['TCA'][$collapseTable]) && ($collapseValue == 0 || $collapseValue == 1)) {
2884
                    $this->tablesCollapsed[$collapseTable] = $collapseValue;
2885
                }
2886
            }
2887
            // Save modified user uc
2888
            $backendUser->uc['moduleData']['list'] = $this->tablesCollapsed;
2889
            $backendUser->writeUC($backendUser->uc);
2890
            $returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
2891
            if ($returnUrl !== '') {
2892
                HttpUtility::redirect($returnUrl);
2893
            }
2894
        }
2895
        $this->initializeLanguages();
2896
    }
2897
2898
    /**
2899
     * Traverses the table(s) to be listed and renders the output code for each: