<commit_before><?php

namespace App\Http\Controllers;

use App\Helpers\Helper;

class ModalController extends Controller
{
    function show($type, $itemId = null) {
        $view = view("modals.${type}");

        if($type == "statuslabel") {
            $view->with('statuslabel_types', Helper::statusTypeList());
        }
        if(in_array($type, ['kit-model', 'kit-license', 'kit-consumable', 'kit-accessory'])) {
            $view->with('kitId', $itemId);
        }
        return $view;
    }
}<commit_msg>Added allow list to modal view options<commit_after><?php

namespace App\Http\Controllers;

use App\Helpers\Helper;

class ModalController extends Controller
{

    /** 
     * Load the modal views after confirming they are in the allowed_types array.
     * The allowed types away just prevents shithead skiddies from fuzzing the urls 
     * with automated scripts and junking up the logs. - snipe
     */
    function show ($type, $itemId = null) {

        $allowed_types = [
            'category',
            'kit-model', 
            'kit-license', 
            'kit-consumable', 
            'kit-accessory',
            'location',
            'manufacturer',
            'model',
            'statuslabel',
            'supplier',
            'upload-file',
            'user',         
        ];


        if (in_array($type, $allowed_types)) {
            $view = view("modals.${type}");

            if ($type == "statuslabel") {
                $view->with('statuslabel_types', Helper::statusTypeList());
            }
            if (in_array($type, ['kit-model', 'kit-license', 'kit-consumable', 'kit-accessory'])) {
                $view->with('kitId', $itemId);
            }
            return $view;
        }
        
        abort(404,'Page not found');
        
    }
}
{'fraction_non_alphanumeric': 0.1404090657822001, 'fraction_numerical': 0.001658374792703151, 'mean_word_length': 1.896, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7045521', 'n_tokens_mistral': 525, 'n_tokens_neox': 515, 'n_words': 117}